From patchwork Sun Aug 11 18:39:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 11095223 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A58891823 for ; Thu, 15 Aug 2019 08:35:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 962C62811A for ; Thu, 15 Aug 2019 08:35:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8AC8A2864B; Thu, 15 Aug 2019 08:35:41 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED 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 2D8022861E for ; Thu, 15 Aug 2019 08:35:41 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D06166E8D6; Thu, 15 Aug 2019 08:34:56 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wr1-x441.google.com (mail-wr1-x441.google.com [IPv6:2a00:1450:4864:20::441]) by gabe.freedesktop.org (Postfix) with ESMTPS id 69BB06E390 for ; Sun, 11 Aug 2019 18:39:53 +0000 (UTC) Received: by mail-wr1-x441.google.com with SMTP id r3so9015716wrt.3 for ; Sun, 11 Aug 2019 11:39:53 -0700 (PDT) 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:mime-version :content-transfer-encoding; bh=Thd+SnJS94FvgyesMyy8xkGkKId6wz/t2E7VQfVHPsQ=; b=MJ6amqlCCr5J7GXf5O/jv6n1QemGPwJwLbs/MwIa2QLeS3K0zmoxyIb+4NsvrkkWfv GaXVMJ5XErzM2yPUxAj1kl+bne1iOu0InakAMPfde4nteBCupfoYFlCB6QN7WVchu71X 6JcDhQLUhxGrHCD9fYraFJA+Blnp5odNEWGcrLi3fshtaVDT+DYHD00txYS74euPWEtP 6entrK06gITJKG9BvP41veIoXHblp0G2tP86iS/ly7n40AUM7BDmMTsIrI9h1ri2MAAl X3JOjupHjkt1sfSefdrQKezDqgtvPZnNIXzSkq3FGmSQ+R/t5xFGd8lsm88Tr3FptUz5 vdHw== X-Gm-Message-State: APjAAAUN1aWbsXJgTQCC/0Zd+2YVGSwvC2vgbO/jUq804w4CLtoaZ8YW zVng7uugtu/R1405Jq9vFss= X-Google-Smtp-Source: APXvYqyjVVhbZx0ZteIn9cxOADrr26dnXT6i+8K2IY25Cz3eBvSl2n+pUrQ6NFBjo3SUKD5zw68rHw== X-Received: by 2002:adf:e912:: with SMTP id f18mr15517298wrm.46.1565548791877; Sun, 11 Aug 2019 11:39:51 -0700 (PDT) Received: from localhost.localdomain ([94.29.34.218]) by smtp.gmail.com with ESMTPSA id c187sm27793082wmd.39.2019.08.11.11.39.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 11 Aug 2019 11:39:51 -0700 (PDT) From: Dmitry Osipenko To: Thierry Reding Subject: [PATCH v2] drm/tegra: Turn off and reset hardware across suspend-resume Date: Sun, 11 Aug 2019 21:39:32 +0300 Message-Id: <20190811183932.15850-1-digetx@gmail.com> X-Mailer: git-send-email 2.22.0 MIME-Version: 1.0 X-Mailman-Approved-At: Thu, 15 Aug 2019 08:34:55 +0000 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=Thd+SnJS94FvgyesMyy8xkGkKId6wz/t2E7VQfVHPsQ=; b=hQpCtMe4aKBdXRiIioMwywueTIhJj72eB8yQASJiWao35F/h0dD6onsC7K0t6SESb5 kNvdwzEdbmVM6I75KL+EfchmH70cGFNsjb5bfRWRe+WAW0DYtpMqCeeKhfExD9o/EkYG Flfa84ybQYMOxt1+4XtmegE/fIyDoHjncAR9U2CDo9ZyUxcOSNTYUd6BRwW0Flq0CwyG 1bRzqts14TO/nsEwIQmn7hKVWncQAhYB4PUt1df3QvhuMdtqJCyjubwfeez6tbccuMVt TPmdWTafYme41O6M3Dm64gmKENiR2zROmWtVOif4J5zj0U+CwrgVNyjd6U30yUqfSeYJ 6S0g== X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP The drivers core bumps runtime PM refcount during of entering into suspend to workaround some problem where parent device may become turned off before its children. In order to disable and reset CRTCs/HDMI/etc hardware, the runtime PM needs to be "forced" into suspend mode. Signed-off-by: Dmitry Osipenko --- Changelog: v2: The SYSTEM_SLEEP_PM_OPS are now set for all of the relevant drivers and not only for the DC because turned out that they all should enforce the suspending. drivers/gpu/drm/tegra/dc.c | 2 ++ drivers/gpu/drm/tegra/dpaux.c | 2 ++ drivers/gpu/drm/tegra/dsi.c | 2 ++ drivers/gpu/drm/tegra/hdmi.c | 2 ++ drivers/gpu/drm/tegra/hub.c | 2 ++ drivers/gpu/drm/tegra/sor.c | 2 ++ drivers/gpu/drm/tegra/vic.c | 2 ++ 7 files changed, 14 insertions(+) diff --git a/drivers/gpu/drm/tegra/dc.c b/drivers/gpu/drm/tegra/dc.c index 4a75d149e368..6c8f5222d558 100644 --- a/drivers/gpu/drm/tegra/dc.c +++ b/drivers/gpu/drm/tegra/dc.c @@ -2572,6 +2572,8 @@ static int tegra_dc_resume(struct device *dev) static const struct dev_pm_ops tegra_dc_pm_ops = { SET_RUNTIME_PM_OPS(tegra_dc_suspend, tegra_dc_resume, NULL) + SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, + pm_runtime_force_resume) }; struct platform_driver tegra_dc_driver = { diff --git a/drivers/gpu/drm/tegra/dpaux.c b/drivers/gpu/drm/tegra/dpaux.c index 2d94da225e51..22f80f69ffb8 100644 --- a/drivers/gpu/drm/tegra/dpaux.c +++ b/drivers/gpu/drm/tegra/dpaux.c @@ -638,6 +638,8 @@ static int tegra_dpaux_resume(struct device *dev) static const struct dev_pm_ops tegra_dpaux_pm_ops = { SET_RUNTIME_PM_OPS(tegra_dpaux_suspend, tegra_dpaux_resume, NULL) + SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, + pm_runtime_force_resume) }; static const struct of_device_id tegra_dpaux_of_match[] = { diff --git a/drivers/gpu/drm/tegra/dsi.c b/drivers/gpu/drm/tegra/dsi.c index 2fbfefe9cb42..fd0f8cec8c7e 100644 --- a/drivers/gpu/drm/tegra/dsi.c +++ b/drivers/gpu/drm/tegra/dsi.c @@ -1665,6 +1665,8 @@ static int tegra_dsi_resume(struct device *dev) static const struct dev_pm_ops tegra_dsi_pm_ops = { SET_RUNTIME_PM_OPS(tegra_dsi_suspend, tegra_dsi_resume, NULL) + SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, + pm_runtime_force_resume) }; static const struct of_device_id tegra_dsi_of_match[] = { diff --git a/drivers/gpu/drm/tegra/hdmi.c b/drivers/gpu/drm/tegra/hdmi.c index 334c4d7d238b..ef66defac767 100644 --- a/drivers/gpu/drm/tegra/hdmi.c +++ b/drivers/gpu/drm/tegra/hdmi.c @@ -1739,6 +1739,8 @@ static int tegra_hdmi_resume(struct device *dev) static const struct dev_pm_ops tegra_hdmi_pm_ops = { SET_RUNTIME_PM_OPS(tegra_hdmi_suspend, tegra_hdmi_resume, NULL) + SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, + pm_runtime_force_resume) }; struct platform_driver tegra_hdmi_driver = { diff --git a/drivers/gpu/drm/tegra/hub.c b/drivers/gpu/drm/tegra/hub.c index 92f202ec0577..3d33d0360169 100644 --- a/drivers/gpu/drm/tegra/hub.c +++ b/drivers/gpu/drm/tegra/hub.c @@ -931,6 +931,8 @@ static int __maybe_unused tegra_display_hub_resume(struct device *dev) static const struct dev_pm_ops tegra_display_hub_pm_ops = { SET_RUNTIME_PM_OPS(tegra_display_hub_suspend, tegra_display_hub_resume, NULL) + SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, + pm_runtime_force_resume) }; static const struct tegra_display_hub_soc tegra186_display_hub = { diff --git a/drivers/gpu/drm/tegra/sor.c b/drivers/gpu/drm/tegra/sor.c index 4ffe3794e6d3..b743193bf0b1 100644 --- a/drivers/gpu/drm/tegra/sor.c +++ b/drivers/gpu/drm/tegra/sor.c @@ -3572,6 +3572,8 @@ static int tegra_sor_resume(struct device *dev) static const struct dev_pm_ops tegra_sor_pm_ops = { SET_RUNTIME_PM_OPS(tegra_sor_suspend, tegra_sor_resume, NULL) + SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, + pm_runtime_force_resume) }; struct platform_driver tegra_sor_driver = { diff --git a/drivers/gpu/drm/tegra/vic.c b/drivers/gpu/drm/tegra/vic.c index 958548ef69e7..880304a65c5c 100644 --- a/drivers/gpu/drm/tegra/vic.c +++ b/drivers/gpu/drm/tegra/vic.c @@ -476,6 +476,8 @@ static int vic_remove(struct platform_device *pdev) static const struct dev_pm_ops vic_pm_ops = { SET_RUNTIME_PM_OPS(vic_runtime_suspend, vic_runtime_resume, NULL) + SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, + pm_runtime_force_resume) }; struct platform_driver tegra_vic_driver = {