From patchwork Mon Jul 10 06:55:04 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Liu X-Patchwork-Id: 9833889 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 63E5A60363 for ; Tue, 11 Jul 2017 00:54:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5FDC01FF2D for ; Tue, 11 Jul 2017 00:54:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 54785251F4; Tue, 11 Jul 2017 00:54:34 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id DEBEA1FF2D for ; Tue, 11 Jul 2017 00:54:33 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1DFF16E287; Tue, 11 Jul 2017 00:54:13 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pg0-x241.google.com (mail-pg0-x241.google.com [IPv6:2607:f8b0:400e:c05::241]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6F76E6E0F8 for ; Mon, 10 Jul 2017 06:54:48 +0000 (UTC) Received: by mail-pg0-x241.google.com with SMTP id u62so11599863pgb.0 for ; Sun, 09 Jul 2017 23:54:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=SWZ6qrKzc1sC+ZBXzSQX8TzRFY+DEoKKEOnm8ora0gI=; b=OEMrPvJLhvqyeFV1jomkwhB1NuFXLTTix4j3jmjsLJ4Uz6YlM8bPjRtmll83ur6Nsi CPaUYAUZPk2AIRIXI5KUVH/s80MXqGkzG1Pk3hcYJokLEOFnnWauGI/ng7ip+IXMWNap vOlefQauDLrtt1h/NB7hqaqJf+U7ikMVFjF5r+erDu0My2pUgT6C3uYbJJNSIPkJyToH BC6/3OQCLDvZt4mnPFPs8Q8LD4BBXife7BKfW9c+uXEfeu2qn6VR+FKVksWJUyldRFtv 4n+jQu4YRv5YHnhN/R1dowqYbynhxNOKMWWQgHW7Wghl1Gb5UMftkBmcBL/Vfrzr6su7 3tBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=SWZ6qrKzc1sC+ZBXzSQX8TzRFY+DEoKKEOnm8ora0gI=; b=tiM4kuX/svLRdTGyPmdUF1zFOPwFVsYz3wMaNrkzL7HyFroJqwnA2FpH3KMy+oinoV AmiIvh1cPDao1CZ4T4H8jeT9N4xZJKs9phpvyX0R8rVir0tDuMIR+8QY2Ka3qLlpAgCV kSUVMDbc7/nMh7cZ5V0s1a3xJsCqLNs1XUZBPe1j5pqEe2iio71i8jHXxus4ps2QJwA2 2y8e3ju5r8gGJpS2a19nqzXG24ltKW1da42idiH6eVcCfwV7Jy2bhIEtMjR+3C4+ZDVG XnW1BJPEKYgRQVe5pMnGzs7jQnoFT7bE3T4qMZJZ4TtezMTMbiPOWxNTrQXcqmZtczA7 TXmw== X-Gm-Message-State: AIVw112Vq4UZMCDFBK6IaYKpF4Y+DJ91Muh8UVMN5sfJ7ubXurmuHSAs sDDZrBen9MQyTQ== X-Received: by 10.98.212.91 with SMTP id u27mr44441383pfl.157.1499669688086; Sun, 09 Jul 2017 23:54:48 -0700 (PDT) Received: from 60-242-179-244.static.tpgi.com.au (60-242-179-244.static.tpgi.com.au. [60.242.179.244]) by smtp.gmail.com with ESMTPSA id t11sm24315810pfi.66.2017.07.09.23.54.47 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 09 Jul 2017 23:54:47 -0700 (PDT) From: Jonathan Liu To: Maxime Ripard , David Airlie , Chen-Yu Tsai Subject: [PATCH v3] drm/sun4i: Implement drm_driver lastclose to restore fbdev console Date: Mon, 10 Jul 2017 16:55:04 +1000 Message-Id: <20170710065504.31497-1-net147@gmail.com> X-Mailer: git-send-email 2.13.2 X-Mailman-Approved-At: Tue, 11 Jul 2017 00:54:09 +0000 Cc: Jonathan Liu , linux-kernel@vger.kernel.org, stable@vger.kernel.org, linux-sunxi@googlegroups.com, dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP The drm_driver lastclose callback is called when the last userspace DRM client has closed. Call drm_fbdev_cma_restore_mode to restore the fbdev console otherwise the fbdev console will stop working. Fixes: 9026e0d122ac ("drm: Add Allwinner A10 Display Engine support") Cc: stable@vger.kernel.org Signed-off-by: Jonathan Liu Reviewed-by: Chen-Yu Tsai Tested-by: Olliver Schinagl --- Changes for v3: - Add 'Fixes:' tag - Add CC to stable - Add 'Reviewed-by: Chen-Yu Tsai ' Changes for v2: - Rename sun4i_drm_lastclose to sun4i_drv_lastclose drivers/gpu/drm/sun4i/sun4i_drv.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/gpu/drm/sun4i/sun4i_drv.c b/drivers/gpu/drm/sun4i/sun4i_drv.c index abc7d8fe06b4..a45a627283a1 100644 --- a/drivers/gpu/drm/sun4i/sun4i_drv.c +++ b/drivers/gpu/drm/sun4i/sun4i_drv.c @@ -25,12 +25,20 @@ #include "sun4i_framebuffer.h" #include "sun4i_tcon.h" +static void sun4i_drv_lastclose(struct drm_device *dev) +{ + struct sun4i_drv *drv = dev->dev_private; + + drm_fbdev_cma_restore_mode(drv->fbdev); +} + DEFINE_DRM_GEM_CMA_FOPS(sun4i_drv_fops); static struct drm_driver sun4i_drv_driver = { .driver_features = DRIVER_GEM | DRIVER_MODESET | DRIVER_PRIME | DRIVER_ATOMIC, /* Generic Operations */ + .lastclose = sun4i_drv_lastclose, .fops = &sun4i_drv_fops, .name = "sun4i-drm", .desc = "Allwinner sun4i Display Engine",