All of lore.kernel.org
 help / color / mirror / Atom feed
From: Brian Norris <briannorris@chromium.org>
To: Marek Szyprowski <m.szyprowski@samsung.com>
Cc: dri-devel@lists.freedesktop.org,
	Andrzej Hajda <andrzej.hajda@intel.com>,
	Neil Armstrong <neil.armstrong@linaro.org>,
	Robert Foss <rfoss@kernel.org>,
	Laurent Pinchart <Laurent.pinchart@ideasonboard.com>,
	Jonas Karlman <jonas@kwiboo.se>,
	Jernej Skrabec <jernej.skrabec@gmail.com>,
	Luca Ceresoli <luca.ceresoli@bootlin.com>,
	Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	Maxime Ripard <mripard@kernel.org>,
	Thomas Zimmermann <tzimmermann@suse.de>,
	Damon Ding <damon.ding@rock-chips.com>,
	Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>,
	Heiko Stuebner <heiko@sntech.de>,
	Douglas Anderson <dianders@chromium.org>
Subject: Re: [PATCH] drm/bridge: analogix_dp: Power down synchronously on bridge disable
Date: Thu, 19 Nov 2026 10:31:47 -0800	[thread overview]
Message-ID: <av9AkwQDhB7O4wgl@google.com> (raw)
In-Reply-To: <20261119084923.1156243-1-m.szyprowski@samsung.com>

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
> 

  parent reply	other threads:[~2026-11-19 18:32 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [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 [this message]
2026-11-19 22:27     ` Marek Szyprowski
2026-11-19 22:40       ` Marek Szyprowski
2026-11-19 23:23       ` Brian Norris

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=av9AkwQDhB7O4wgl@google.com \
    --to=briannorris@chromium.org \
    --cc=Laurent.pinchart@ideasonboard.com \
    --cc=andrzej.hajda@intel.com \
    --cc=damon.ding@rock-chips.com \
    --cc=dianders@chromium.org \
    --cc=dmitry.baryshkov@oss.qualcomm.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=heiko@sntech.de \
    --cc=jernej.skrabec@gmail.com \
    --cc=jonas@kwiboo.se \
    --cc=luca.ceresoli@bootlin.com \
    --cc=m.szyprowski@samsung.com \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    --cc=neil.armstrong@linaro.org \
    --cc=rfoss@kernel.org \
    --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 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.