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: 1145363 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-tegra-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="hQpCtMe4"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 46677d0HB4z9sNC for ; Mon, 12 Aug 2019 04:39:56 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725939AbfHKSjz (ORCPT ); Sun, 11 Aug 2019 14:39:55 -0400 Received: from mail-wr1-f65.google.com ([209.85.221.65]:39480 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725730AbfHKSjy (ORCPT ); Sun, 11 Aug 2019 14:39:54 -0400 Received: by mail-wr1-f65.google.com with SMTP id t16so12640695wra.6; Sun, 11 Aug 2019 11:39:52 -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: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-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=fLfOINKjZsbUDo3XisL+srEvK4jPPd1djaHb7iRAoSHPnfBdusaqOFRRbHJTN74frB aGx6FHkpWB7RGeGETqiQ2LqJJ7lJWJuBWKKSpN4ehBJP32hDg5C7QYzKtMy+clLTRc/2 ozLWekhmW8LF95chx6Szn7vCuYMpsr0rP+9lZAF9W7hF2A8lTqiLQJifkZffUeZ8sVWg B6KkkvwvTS7M6xw22yGI49IbdqPt5lrYZ7Ho6MPKzvKkKRsXvGgOU8gHbtlYBHVv+5to je8AbF9BzMHuaoc1alH36IEaoU08yziHp2bPvHiOVFF5Y0Ygz/i+X6hIhjDXvDnF4GUp wCPQ== X-Gm-Message-State: APjAAAXkqIHnXSiZt8W9QuR8Tb4Wm2qH/rD5I30INQa1UUNbmSeGY3jj Rc+YCRX7fpzRXPqScGhiyLg= 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 Cc: dri-devel@lists.freedesktop.org, linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org 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 Sender: linux-tegra-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-tegra@vger.kernel.org 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 = {