From patchwork Sun Jul 9 07:59:51 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Liu X-Patchwork-Id: 9832135 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 8BFD2602BD for ; Mon, 10 Jul 2017 00:58:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7B9A127FB7 for ; Mon, 10 Jul 2017 00:58:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6FB18283C7; Mon, 10 Jul 2017 00:58:48 +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 E699927FB7 for ; Mon, 10 Jul 2017 00:58:47 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 09EC86E11B; Mon, 10 Jul 2017 00:58:46 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pg0-x244.google.com (mail-pg0-x244.google.com [IPv6:2607:f8b0:400e:c05::244]) by gabe.freedesktop.org (Postfix) with ESMTPS id D3D2D6E1FB for ; Sun, 9 Jul 2017 07:59:28 +0000 (UTC) Received: by mail-pg0-x244.google.com with SMTP id d193so9071513pgc.2 for ; Sun, 09 Jul 2017 00:59:28 -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=6wWdnMapV8mNiPJKqVhFXBqiRod8WlLVwrGRRIgGY+0=; b=M9a/qelLaGgB9weGUwOgIgeZhtEetmEVNS+YXduUQvoMijn1LwfagrK5x2gramHfxJ t24py7rkboBD2HfonX1eEuccpf+zHWc8Fznm3p9EtydKiZPBU0ySUOADx86iMZTqMZMH 880WnJxFZLlrDKohydwWuf9gqE09CNYTHZphn7b77eF9GMg7RrwuJDURdgJoOWr4J+Ns QhdG9VokXmYWQD5ZhgjbHHgXkaZfmUGgpSQy6DIQ3RJfzowWUMKGeaiA/MHygJ8kswMJ Bs9M74SzbDnWXdXpWwj0ktAWxDBOh+gSEww4HxOqSFKdPPF6qevNmzDvVhqr7GhPRsss S0Eg== 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=6wWdnMapV8mNiPJKqVhFXBqiRod8WlLVwrGRRIgGY+0=; b=mDCZEH0z6e0UtJSgjbJlHc8uJYK9N5qZ3GbgQDs7XP3wYdgTpamjMvD95jdT/qXtF9 2jPx8hBXWl3C9bRdjpT8YTm9l+BBcJWCbC1hL3aayAx4eY6GeRVF5Hi6Stj+2KrZLLGX RZt7dRtZxuzFJ/WKQrfG6u0RTQL9QV36eyb9S08sIuaCQ3rlgIf9cJhaYuD+AcQHy+kV zg7zESp9LvmWKdxa8hF7EI1SL77aOuGEhiqHUPFtTQj3O4zNhxcjyYJYA1mvYR6g9aaT CQvnirQ7yhZREsde2FYYQJJ5HTgjb/uWkQmq16Iy4rPKbihWcUQ7Vwbp6WxHqb54NdvP Ugyg== X-Gm-Message-State: AIVw110jnPJTZpQRKFlDiRcpZnBzx9aMNEwrslJNCQLPLcs17S5tCmL/ 0iSiyKzetJveaA== X-Received: by 10.84.231.16 with SMTP id f16mr2038950plk.131.1499587168590; Sun, 09 Jul 2017 00:59:28 -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 q3sm10110289pfk.8.2017.07.09.00.59.27 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 09 Jul 2017 00:59:27 -0700 (PDT) From: Jonathan Liu To: Maxime Ripard , David Airlie , Chen-Yu Tsai Subject: [PATCH v2] drm/sun4i: Implement drm_driver lastclose to restore fbdev console Date: Sun, 9 Jul 2017 17:59:51 +1000 Message-Id: <20170709075951.16690-1-net147@gmail.com> X-Mailer: git-send-email 2.13.2 X-Mailman-Approved-At: Mon, 10 Jul 2017 00:58:45 +0000 Cc: linux-sunxi@googlegroups.com, Jonathan Liu , linux-arm-kernel@lists.infradead.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.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. Signed-off-by: Jonathan Liu 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",