Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Jonas Karlman <jonas@kwiboo.se>
To: Neil Armstrong <neil.armstrong@linaro.org>,
	Kevin Hilman <khilman@baylibre.com>,
	Heiko Stuebner <heiko@sntech.de>,
	Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	Maxime Ripard <mripard@kernel.org>,
	Thomas Zimmermann <tzimmermann@suse.de>,
	David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>,
	Jerome Brunet <jbrunet@baylibre.com>,
	Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Cc: dri-devel@lists.freedesktop.org,
	linux-amlogic@lists.infradead.org,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, Jonas Karlman <jonas@kwiboo.se>,
	linux-rockchip@lists.infradead.org
Subject: [PATCH 13/13] drm/meson: dw-hdmi: Use suspend_late/resume_early/resume_noirq pm ops
Date: Mon, 18 May 2026 19:47:41 +0000	[thread overview]
Message-ID: <20260518194744.2483580-14-jonas@kwiboo.se> (raw)
In-Reply-To: <20260518194744.2483580-1-jonas@kwiboo.se>

meson_drv_pm_suspend()/drm_mode_config_helper_suspend() and
meson_drv_pm_resume()/drm_mode_config_helper_resume() is called
after/before the suspend/resume pm ops of dw-hdmi.

This result in atomic_disable() being called after
meson_dw_hdmi_pm_suspend() and atomic_enable() before
meson_dw_hdmi_pm_resume()/dw_hdmi_resume() is called.

Suspend (without changes):
- meson_dw_hdmi_pm_suspend()
- meson_drv_pm_suspend()
  - drm_mode_config_helper_suspend()
    - atomic_disable()

Resume (without changes):
- resume_irq()            <<-- system freeze at hdmi-tx irq on G12B
- meson_drv_pm_resume()
  - drm_mode_config_helper_resume()
    - atomic_enable()
- meson_dw_hdmi_pm_resume()
  - meson_dw_hdmi_init()
  - dw_hdmi_resume()
    - dw_hdmi_init_hw()

Change to use suspend_late/resume_early pm ops for system suspend to
ensure pm ops for dw-hdmi is run after/before meson_drv pm ops.

The G12B can trigger an IRQ (stat=0x40) very early during resume_irq
that causes a system freeze. Move the meson_dw_hdmi_init() call to
resume_noirq pm ops to resolve the system freeze.

Also move meson_dw_hdmi_init() to run before interrupt allocation to
ensure HW has been initialized when first IRQ is triggered.

Suspend (with changes):
- meson_drv_pm_suspend()
  - drm_mode_config_helper_suspend()
    - atomic_disable()
- meson_dw_hdmi_pm_suspend_late()

Resume (with changes):
- meson_dw_hdmi_pm_resume_noirq()
  - meson_dw_hdmi_init()
- resume_irq()
- meson_dw_hdmi_pm_resume_early()
  - dw_hdmi_resume()
    - dw_hdmi_init_hw()
- meson_drv_pm_resume()
  - drm_mode_config_helper_resume()
    - atomic_enable()

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
---
This can be tested using CONFIG_PM_DEBUG with a simulated suspend:
  echo N > /sys/module/printk/parameters/console_suspend
  echo 1 > /sys/power/pm_debug_messages
  echo platform > /sys/power/pm_test
  echo mem > /sys/power/state
or using something like following for real suspend/resume:
  echo N > /sys/module/printk/parameters/console_suspend
  rtcwake -m mem -s 5 -d /dev/rtc1

On S905X a simulated platform pm_test could only be tested. On G12A both
simulated and real suspend works. And on G12B the board seems to freeze
at a later stage when taking out of real suspend, however platform
pm_test works.
---
 drivers/gpu/drm/meson/meson_dw_hdmi.c | 27 +++++++++++++++++++--------
 1 file changed, 19 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/meson/meson_dw_hdmi.c b/drivers/gpu/drm/meson/meson_dw_hdmi.c
index 7b465e216759..16f15466a6f4 100644
--- a/drivers/gpu/drm/meson/meson_dw_hdmi.c
+++ b/drivers/gpu/drm/meson/meson_dw_hdmi.c
@@ -696,6 +696,8 @@ static int meson_dw_hdmi_bind(struct device *dev, struct device *master,
 	if (IS_ERR(dw_plat_data->regm))
 		return PTR_ERR(dw_plat_data->regm);
 
+	meson_dw_hdmi_init(meson_dw_hdmi);
+
 	irq = platform_get_irq(pdev, 0);
 	if (irq < 0)
 		return irq;
@@ -706,8 +708,6 @@ static int meson_dw_hdmi_bind(struct device *dev, struct device *master,
 		return dev_err_probe(dev, ret,
 				     "Failed to request hdmi top irq\n");
 
-	meson_dw_hdmi_init(meson_dw_hdmi);
-
 	/* Bridge / Connector */
 
 	dw_plat_data->priv_data = meson_dw_hdmi;
@@ -763,7 +763,7 @@ static const struct component_ops meson_dw_hdmi_ops = {
 	.unbind	= meson_dw_hdmi_unbind,
 };
 
-static int __maybe_unused meson_dw_hdmi_pm_suspend(struct device *dev)
+static int __maybe_unused meson_dw_hdmi_pm_suspend_late(struct device *dev)
 {
 	struct meson_dw_hdmi *meson_dw_hdmi = dev_get_drvdata(dev);
 
@@ -777,7 +777,19 @@ static int __maybe_unused meson_dw_hdmi_pm_suspend(struct device *dev)
 	return 0;
 }
 
-static int __maybe_unused meson_dw_hdmi_pm_resume(struct device *dev)
+static int __maybe_unused meson_dw_hdmi_pm_resume_early(struct device *dev)
+{
+	struct meson_dw_hdmi *meson_dw_hdmi = dev_get_drvdata(dev);
+
+	if (!meson_dw_hdmi)
+		return 0;
+
+	dw_hdmi_resume(meson_dw_hdmi->hdmi);
+
+	return 0;
+}
+
+static int __maybe_unused meson_dw_hdmi_pm_resume_noirq(struct device *dev)
 {
 	struct meson_dw_hdmi *meson_dw_hdmi = dev_get_drvdata(dev);
 
@@ -786,8 +798,6 @@ static int __maybe_unused meson_dw_hdmi_pm_resume(struct device *dev)
 
 	meson_dw_hdmi_init(meson_dw_hdmi);
 
-	dw_hdmi_resume(meson_dw_hdmi->hdmi);
-
 	return 0;
 }
 
@@ -802,8 +812,9 @@ static void meson_dw_hdmi_remove(struct platform_device *pdev)
 }
 
 static const struct dev_pm_ops meson_dw_hdmi_pm_ops = {
-	SET_SYSTEM_SLEEP_PM_OPS(meson_dw_hdmi_pm_suspend,
-				meson_dw_hdmi_pm_resume)
+	SET_LATE_SYSTEM_SLEEP_PM_OPS(meson_dw_hdmi_pm_suspend_late,
+				     meson_dw_hdmi_pm_resume_early)
+	SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(NULL, meson_dw_hdmi_pm_resume_noirq)
 };
 
 static const struct of_device_id meson_dw_hdmi_of_table[] = {
-- 
2.54.0



      parent reply	other threads:[~2026-05-18 19:49 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-18 19:47 [PATCH 00/13] drm/meson: dw-hdmi: Misc cleanup and use CEC notifier helpers Jonas Karlman
2026-05-18 19:47 ` [PATCH 01/13] drm/meson: dw-hdmi: Report connector status based on HPD bit Jonas Karlman
2026-05-19  7:23   ` Neil Armstrong
2026-05-18 19:47 ` [PATCH 02/13] drm/meson: dw-hdmi: Protect from possible NULL pointer dereference Jonas Karlman
2026-05-19  7:23   ` Neil Armstrong
2026-05-18 19:47 ` [PATCH 03/13] drm/meson: dw-hdmi: Call dw_hdmi_remove() consistently Jonas Karlman
2026-05-19  7:24   ` Neil Armstrong
2026-05-18 19:47 ` [PATCH 04/13] drm/meson: dw-hdmi: Drop call to drm_bridge_hpd_notify() Jonas Karlman
2026-05-19  7:25   ` Neil Armstrong
2026-05-18 19:47 ` [PATCH 05/13] drm/meson: encoder_hdmi: Use CEC phys addr from display_info Jonas Karlman
2026-05-19  6:36   ` Hans Verkuil
2026-05-19  7:27   ` Neil Armstrong
2026-05-18 19:47 ` [PATCH 06/13] drm/meson: encoder_hdmi: Use bridge connector CEC notifier Jonas Karlman
2026-05-19  6:38   ` Hans Verkuil
2026-05-19  7:30   ` Neil Armstrong
2026-05-18 19:47 ` [PATCH 07/13] drm/meson: encoder_hdmi: Report ycbcr_420_allowed from encoder Jonas Karlman
2026-05-19  7:31   ` Neil Armstrong
2026-05-18 19:47 ` [PATCH 08/13] drm/meson: dw-hdmi: Use local dev variable consistently in bind() Jonas Karlman
2026-05-19  7:33   ` Neil Armstrong
2026-05-18 19:47 ` [PATCH 09/13] drm/meson: dw-hdmi: Use devm_clk_get_enabled() helper Jonas Karlman
2026-05-19  7:33   ` Neil Armstrong
2026-05-18 19:47 ` [PATCH 10/13] drm/meson: dw-hdmi: Use dev_err_probe() to report errors Jonas Karlman
2026-05-19  7:34   ` Neil Armstrong
2026-05-18 19:47 ` [PATCH 11/13] drm/bridge: dw-hdmi: Export dw_hdmi_schedule_hpd_work() helper Jonas Karlman
2026-05-18 19:47 ` [PATCH 12/13] drm/meson: dw-hdmi: Use " Jonas Karlman
2026-05-18 19:47 ` Jonas Karlman [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260518194744.2483580-14-jonas@kwiboo.se \
    --to=jonas@kwiboo.se \
    --cc=airlied@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=heiko@sntech.de \
    --cc=jbrunet@baylibre.com \
    --cc=khilman@baylibre.com \
    --cc=linux-amlogic@lists.infradead.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=martin.blumenstingl@googlemail.com \
    --cc=mripard@kernel.org \
    --cc=neil.armstrong@linaro.org \
    --cc=simona@ffwll.ch \
    --cc=tzimmermann@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox