* [PATCH] drm/bridge: analogix_dp: Power down synchronously on bridge disable
[not found] <CGME20261119084929eucas1p26166723765c9707e2e2b81f8ded99da6@eucas1p2.samsung.com>
@ 2026-11-19 8:49 ` Marek Szyprowski
2026-11-19 8:59 ` sashiko-bot
2026-11-19 18:31 ` Brian Norris
0 siblings, 2 replies; 6+ messages in thread
From: Marek Szyprowski @ 2026-11-19 8:49 UTC (permalink / raw)
To: dri-devel
Cc: Marek Szyprowski, Andrzej Hajda, Neil Armstrong, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec, Luca Ceresoli,
Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, Damon Ding,
Dmitry Baryshkov, Heiko Stuebner, Douglas Anderson, Brian Norris
The pipe (FIMD -> DP video) clock on Exynos is switched from the
analogix_dp runtime PM callbacks via plat_data->power_on()/power_off(),
which require the encoder to be still attached to a CRTC. The driver
relies on pm_runtime_put_sync() in analogix_dp_bridge_disable() to run
the runtime suspend callback immediately, while the encoder->crtc link
is still valid.
The device uses autosuspend, so whether put_sync() suspends the device
right away depends on the last_busy timestamp. Since commit f2b556e3dad6
("PM: runtime: Update last_busy before calling rpm_suspend() in
rpm_idle()") last_busy is refreshed in rpm_idle(), so
pm_runtime_put_sync() now only schedules an autosuspend 100ms later.
During system suspend this means that the device is runtime suspended
only by pm_runtime_force_suspend(), when encoder->crtc is already NULL,
so the FIMD DP clock is never disabled and its cached state gets out of
sync with the hardware after FIMD loses power. On resume the clock is
not re-enabled and enabling the bridge fails on Exynos5250 Snow:
exynos-dp 145b0000.dp-controller: Timeout of slave video streamclk ok
exynos-dp 145b0000.dp-controller: unable to config video
[drm:analogix_dp_bridge_atomic_enable [analogix_dp]] *ERROR* dp commit error, ret = -110
exynos-dp 145b0000.dp-controller: failed to set bridge, retry: 0
...
exynos-dp 145b0000.dp-controller: too many times retry set bridge, give it up
Use pm_runtime_put_sync_suspend() in the bridge disable path and in the
analogix_dp_set_bridge() error path, so the hardware is powered down
immediately when the display is turned off, regardless of the
autosuspend delay used for the AUX channel transfers.
Fixes: f28dd5075675 ("drm/bridge: analogix_dp: Enable autosuspend")
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
---
This patch has been developed with LLM assistance and have been tested
on the real Exynos5250-based Snow Chromebook device.
Best regards
Marek Szyprowski, PhD
Samsung R&D Institute Poland
---
drivers/gpu/drm/bridge/analogix/analogix_dp_core.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
index 8bb4c48aa3b4..022acb962b7c 100644
--- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
+++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
@@ -1021,7 +1021,7 @@ static int analogix_dp_set_bridge(struct analogix_dp_device *dp)
return 0;
out_dp_init:
- pm_runtime_put_sync(dp->dev);
+ pm_runtime_put_sync_suspend(dp->dev);
return ret;
}
@@ -1163,7 +1163,7 @@ static void analogix_dp_bridge_disable(struct drm_bridge *bridge)
analogix_dp_set_analog_power_down(dp, POWER_ALL, 1);
- pm_runtime_put_sync(dp->dev);
+ pm_runtime_put_sync_suspend(dp->dev);
dp->fast_train_enable = false;
dp->psr_supported = false;
--
2.43.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] drm/bridge: analogix_dp: Power down synchronously on bridge disable
2026-11-19 8:49 ` [PATCH] drm/bridge: analogix_dp: Power down synchronously on bridge disable Marek Szyprowski
@ 2026-11-19 8:59 ` sashiko-bot
2026-11-19 18:31 ` Brian Norris
1 sibling, 0 replies; 6+ messages in thread
From: sashiko-bot @ 2026-11-19 8:59 UTC (permalink / raw)
To: Marek Szyprowski, dri-devel
Thank you for your contribution! Sashiko AI review found no new issues
in this patch, but noticed 1 related pre-existing issue it does not
introduce:
- [High] drm/bridge: analogix_dp: unclocked MMIO access in
analogix_dp_bridge_detect() [1]
--
commit fd813b0a1a5eac6ddf7400690200a86fc66c6e6d
Author: Marek Szyprowski <m.szyprowski@samsung.com>
drm/bridge: analogix_dp: Power down synchronously on bridge disable
This commit switches analogix_dp_set_bridge() and
analogix_dp_bridge_disable() from pm_runtime_put_sync() to
pm_runtime_put_sync_suspend() so the device runtime-suspends immediately
rather than waiting for the autosuspend timer.
> diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
> index 8bb4c48aa3b48..022acb962b7ca 100644
> --- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
> +++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
> @@ -1021,7 +1021,7 @@ static int analogix_dp_set_bridge(struct analogix_dp_device *dp)
> return 0;
>
> out_dp_init:
> - pm_runtime_put_sync(dp->dev);
> + pm_runtime_put_sync_suspend(dp->dev);
>
> return ret;
> }
> @@ -1163,7 +1163,7 @@ static void analogix_dp_bridge_disable(struct drm_bridge *bridge)
>
> analogix_dp_set_analog_power_down(dp, POWER_ALL, 1);
>
> - pm_runtime_put_sync(dp->dev);
> + pm_runtime_put_sync_suspend(dp->dev);
>
> dp->fast_train_enable = false;
> dp->psr_supported = false;
[Severity: High]
This problem wasn't introduced by this patch, but can
analogix_dp_bridge_detect() access ANALOGIX_DP_SYS_CTL_3 while dp->dev is
runtime-suspended [1]?
drivers/gpu/drm/bridge/analogix/analogix_dp_core.c:analogix_dp_bridge_detect() {
if (dp->plat_data->next_bridge)
return connector_status_connected;
if (!analogix_dp_detect_hpd(dp))
status = connector_status_connected;
}
When dp->plat_data->next_bridge is NULL, analogix_dp_bridge_detect() calls
analogix_dp_detect_hpd() without holding a runtime PM reference on
dp->dev. If dp->hpd_gpiod is NULL (or dp->force_hpd is set),
analogix_dp_get_plug_in_status() and analogix_dp_force_hpd() read and
write ANALOGIX_DP_SYS_CTL_3 while the DP controller clocks and power
domain are off during connector polling with the display disabled, which
can trigger an external abort or bus hang on Exynos and Rockchip SoCs.
[1] https://sashiko.dev/#/bug/linux-ea09d64b-12cd-4301-bd54-12c515b01bde
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261119084923.1156243-1-m.szyprowski@samsung.com?part=1
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] drm/bridge: analogix_dp: Power down synchronously on bridge disable
2026-11-19 8:49 ` [PATCH] drm/bridge: analogix_dp: Power down synchronously on bridge disable Marek Szyprowski
2026-11-19 8:59 ` sashiko-bot
@ 2026-11-19 18:31 ` Brian Norris
2026-11-19 22:27 ` Marek Szyprowski
1 sibling, 1 reply; 6+ messages in thread
From: Brian Norris @ 2026-11-19 18:31 UTC (permalink / raw)
To: Marek Szyprowski
Cc: dri-devel, Andrzej Hajda, Neil Armstrong, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec, Luca Ceresoli,
Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, Damon Ding,
Dmitry Baryshkov, Heiko Stuebner, Douglas Anderson
Hi,
On Thu, Nov 19, 2026 at 09:49:21AM +0100, Marek Szyprowski wrote:
> The pipe (FIMD -> DP video) clock on Exynos is switched from the
> analogix_dp runtime PM callbacks via plat_data->power_on()/power_off(),
> which require the encoder to be still attached to a CRTC. The driver
> relies on pm_runtime_put_sync() in analogix_dp_bridge_disable() to run
> the runtime suspend callback immediately, while the encoder->crtc link
> is still valid.
This is a bit concerning, as this is somewhat of a misunderstanding of
how runtime PM works. (But then, I guess it's not really surprising that
people misunderstand runtime PM -- it's highly confusing.)
Runtime PM cannot guarantee that something powers off, at least while
runtime PM is enabled. It provides hints, but those can be overridden.
A primary reason: /sys/.../<this_device>/power/control can be set to
'on', which means the device will always be prevented from
runtime-suspending. So I assume that if you 'echo on >
.../power/control', you'll still see the same bug.
(It's possible that 'power/control' is the only way things break. I've
wondered at times whether we should allow for drivers to opt out, and
block this interface.)
> The device uses autosuspend, so whether put_sync() suspends the device
> right away depends on the last_busy timestamp. Since commit f2b556e3dad6
> ("PM: runtime: Update last_busy before calling rpm_suspend() in
> rpm_idle()") last_busy is refreshed in rpm_idle(), so
> pm_runtime_put_sync() now only schedules an autosuspend 100ms later.
I don't think commit f2b556e3dad6 is the only reason you'll get this
behavior. There's also:
55b2b8af704f ("PM: runtime: Update last_busy in rpm_resume() for active devices")
56f487c78015 ("PM / Runtime: Update last_busy in rpm_resume")
Those are all reasons that last_busy may get refreshed without explicit
calls in your driver.
> During system suspend this means that the device is runtime suspended
> only by pm_runtime_force_suspend(), when encoder->crtc is already NULL,
> so the FIMD DP clock is never disabled and its cached state gets out of
> sync with the hardware after FIMD loses power. On resume the clock is
> not re-enabled and enabling the bridge fails on Exynos5250 Snow:
I didn't spend enough time on all of this to see if it makes any sense
(or if, for instance, it's just LLM garbage), but it seems suspect that
you have to reason about runtime PM state so much in order to get
correct system PM behavior. They should be pretty much orthogonal,
functionally.
> exynos-dp 145b0000.dp-controller: Timeout of slave video streamclk ok
> exynos-dp 145b0000.dp-controller: unable to config video
> [drm:analogix_dp_bridge_atomic_enable [analogix_dp]] *ERROR* dp commit error, ret = -110
> exynos-dp 145b0000.dp-controller: failed to set bridge, retry: 0
> ...
> exynos-dp 145b0000.dp-controller: too many times retry set bridge, give it up
>
> Use pm_runtime_put_sync_suspend() in the bridge disable path and in the
> analogix_dp_set_bridge() error path, so the hardware is powered down
> immediately when the display is turned off, regardless of the
> autosuspend delay used for the AUX channel transfers.
>
> Fixes: f28dd5075675 ("drm/bridge: analogix_dp: Enable autosuspend")
> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
> ---
> This patch has been developed with LLM assistance and have been tested
> on the real Exynos5250-based Snow Chromebook device.
>
> Best regards
> Marek Szyprowski, PhD
> Samsung R&D Institute Poland
> ---
> drivers/gpu/drm/bridge/analogix/analogix_dp_core.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
> index 8bb4c48aa3b4..022acb962b7c 100644
> --- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
> +++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
> @@ -1021,7 +1021,7 @@ static int analogix_dp_set_bridge(struct analogix_dp_device *dp)
> return 0;
>
> out_dp_init:
> - pm_runtime_put_sync(dp->dev);
> + pm_runtime_put_sync_suspend(dp->dev);
>
> return ret;
> }
> @@ -1163,7 +1163,7 @@ static void analogix_dp_bridge_disable(struct drm_bridge *bridge)
>
> analogix_dp_set_analog_power_down(dp, POWER_ALL, 1);
>
> - pm_runtime_put_sync(dp->dev);
> + pm_runtime_put_sync_suspend(dp->dev);
These may be valid changes to make (they are the correct way to
purposely skip autosuspend delays), but I'm not sure about all the
justification, and whether they imply there are larger bugs in here that
you're papering over.
Brian
>
> dp->fast_train_enable = false;
> dp->psr_supported = false;
> --
> 2.43.0
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] drm/bridge: analogix_dp: Power down synchronously on bridge disable
2026-11-19 18:31 ` Brian Norris
@ 2026-11-19 22:27 ` Marek Szyprowski
2026-11-19 22:40 ` Marek Szyprowski
2026-11-19 23:23 ` Brian Norris
0 siblings, 2 replies; 6+ messages in thread
From: Marek Szyprowski @ 2026-11-19 22:27 UTC (permalink / raw)
To: Brian Norris
Cc: dri-devel, Andrzej Hajda, Neil Armstrong, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec, Luca Ceresoli,
Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, Damon Ding,
Dmitry Baryshkov, Heiko Stuebner, Douglas Anderson
On 19.11.2026 19:31, Brian Norris wrote:
> On Thu, Nov 19, 2026 at 09:49:21AM +0100, Marek Szyprowski wrote:
>> The pipe (FIMD -> DP video) clock on Exynos is switched from the
>> analogix_dp runtime PM callbacks via plat_data->power_on()/power_off(),
>> which require the encoder to be still attached to a CRTC. The driver
>> relies on pm_runtime_put_sync() in analogix_dp_bridge_disable() to run
>> the runtime suspend callback immediately, while the encoder->crtc link
>> is still valid.
> This is a bit concerning, as this is somewhat of a misunderstanding of
> how runtime PM works. (But then, I guess it's not really surprising that
> people misunderstand runtime PM -- it's highly confusing.)
>
> Runtime PM cannot guarantee that something powers off, at least while
> runtime PM is enabled. It provides hints, but those can be overridden.
>
> A primary reason: /sys/.../<this_device>/power/control can be set to
> 'on', which means the device will always be prevented from
> runtime-suspending. So I assume that if you 'echo on >
> .../power/control', you'll still see the same bug.
>
> (It's possible that 'power/control' is the only way things break. I've
> wondered at times whether we should allow for drivers to opt out, and
> block this interface.)
Sigh... Runtime PM API is highly confusing and imho a bit over-engineered.
Indeed, after calling
echo on >/sys/bus/platform/drivers/exynos-dp/145b0000.dp-controller/power/control
the display is broken again after suspend/resume cycle. It looks that the
source of this issue is in using runtime PM to control display pipe clocks. After
moving that to encoder's enable/disable it works fine in all 3 cases: before the
mentioned commit, after it and with power/control set to "on". This also matches
the pipe clock handling in other Exynos DRM sub-drivers. Thanks for a
constructive review.
> ...
Best regards
--
Marek Szyprowski, PhD
Samsung R&D Institute Poland
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] drm/bridge: analogix_dp: Power down synchronously on bridge disable
2026-11-19 22:27 ` Marek Szyprowski
@ 2026-11-19 22:40 ` Marek Szyprowski
2026-11-19 23:23 ` Brian Norris
1 sibling, 0 replies; 6+ messages in thread
From: Marek Szyprowski @ 2026-11-19 22:40 UTC (permalink / raw)
To: Brian Norris
Cc: dri-devel, Andrzej Hajda, Neil Armstrong, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec, Luca Ceresoli,
Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, Damon Ding,
Dmitry Baryshkov, Heiko Stuebner, Douglas Anderson
On 19.11.2026 23:27, Marek Szyprowski wrote:
> On 19.11.2026 19:31, Brian Norris wrote:
>> On Thu, Nov 19, 2026 at 09:49:21AM +0100, Marek Szyprowski wrote:
>>> The pipe (FIMD -> DP video) clock on Exynos is switched from the
>>> analogix_dp runtime PM callbacks via plat_data->power_on()/power_off(),
>>> which require the encoder to be still attached to a CRTC. The driver
>>> relies on pm_runtime_put_sync() in analogix_dp_bridge_disable() to run
>>> the runtime suspend callback immediately, while the encoder->crtc link
>>> is still valid.
>> This is a bit concerning, as this is somewhat of a misunderstanding of
>> how runtime PM works. (But then, I guess it's not really surprising that
>> people misunderstand runtime PM -- it's highly confusing.)
>>
>> Runtime PM cannot guarantee that something powers off, at least while
>> runtime PM is enabled. It provides hints, but those can be overridden.
>>
>> A primary reason: /sys/.../<this_device>/power/control can be set to
>> 'on', which means the device will always be prevented from
>> runtime-suspending. So I assume that if you 'echo on >
>> .../power/control', you'll still see the same bug.
>>
>> (It's possible that 'power/control' is the only way things break. I've
>> wondered at times whether we should allow for drivers to opt out, and
>> block this interface.)
>
> Sigh... Runtime PM API is highly confusing and imho a bit over-engineered.
>
> Indeed, after calling
>
> echo on >/sys/bus/platform/drivers/exynos-dp/145b0000.dp-controller/power/control
>
> the display is broken again after suspend/resume cycle. It looks that the
> source of this issue is in using runtime PM to control display pipe clocks. After
> moving that to encoder's enable/disable it works fine in all 3 cases: before the
> mentioned commit, after it and with power/control set to "on". This also matches
> the pipe clock handling in other Exynos DRM sub-drivers. Thanks for a
> constructive review.
For the reference, this is the patch implementing this approach:
https://lore.kernel.org/all/20261119223843.3694307-1-m.szyprowski@samsung.com/
Best regards
--
Marek Szyprowski, PhD
Samsung R&D Institute Poland
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] drm/bridge: analogix_dp: Power down synchronously on bridge disable
2026-11-19 22:27 ` Marek Szyprowski
2026-11-19 22:40 ` Marek Szyprowski
@ 2026-11-19 23:23 ` Brian Norris
1 sibling, 0 replies; 6+ messages in thread
From: Brian Norris @ 2026-11-19 23:23 UTC (permalink / raw)
To: Marek Szyprowski
Cc: dri-devel, Andrzej Hajda, Neil Armstrong, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec, Luca Ceresoli,
Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, Damon Ding,
Dmitry Baryshkov, Heiko Stuebner, Douglas Anderson
On Thu, Nov 19, 2026 at 11:27:33PM +0100, Marek Szyprowski wrote:
> Sigh... Runtime PM API is highly confusing and imho a bit over-engineered.
Agreed. Or, over-implemented / under-engineered perhaps.
I'm working on trying to reduce some of the confusion (e.g., we're about
ready to eliminate all the differences between put*() and
put_*autosuspend()).
I'm nearly of a mind that put_sync() and friends serve more to confuse
than to help, because while they work like you expect much of the time,
they aren't really guaranteed to be all that synchronous. So in its
current state, it might be better to not pretend it's synchronous at
all.
Anyway, enough musing. Feel free to send me thoughts separately if you
have specific confusing things that you think could be improved.
Brian
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-11-19 23:23 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <CGME20261119084929eucas1p26166723765c9707e2e2b81f8ded99da6@eucas1p2.samsung.com>
2026-11-19 8:49 ` [PATCH] drm/bridge: analogix_dp: Power down synchronously on bridge disable Marek Szyprowski
2026-11-19 8:59 ` sashiko-bot
2026-11-19 18:31 ` Brian Norris
2026-11-19 22:27 ` Marek Szyprowski
2026-11-19 22:40 ` Marek Szyprowski
2026-11-19 23:23 ` Brian Norris
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.