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 v2] drm/bridge: analogix_dp: Hold runtime PM reference in bridge detect
Date: Thu, 19 Nov 2026 10:14:20 -0800	[thread overview]
Message-ID: <av88fNztBjS79X8L@google.com> (raw)
In-Reply-To: <20261119103742.1161858-1-m.szyprowski@samsung.com>

On Thu, Nov 19, 2026 at 11:37:41AM +0100, Marek Szyprowski wrote:
> analogix_dp_bridge_detect() calls analogix_dp_detect_hpd() without
> holding a runtime PM reference on the DP device. If there is no HPD
> GPIO, analogix_dp_get_plug_in_status() reads ANALOGIX_DP_SYS_CTL_3 and,
> with "force-hpd", analogix_dp_force_hpd() also writes to it. When the
> display is disabled the controller is runtime suspended, so these are
> accesses to an unclocked (and possibly unpowered) IP block.

If there *is* an HPD GPIO and no 'force-hpd' ... is this patch wasteful?
How much?

(Honest question. I don't remember all the details here, but you're
suggesting this can be poked by userspace any time, so it seems like it
might be relevant.)

Brian

> The connector created by drm_bridge_connector is polled because the
> bridge provides DRM_BRIDGE_OP_DETECT without DRM_BRIDGE_OP_HPD, and
> userspace may also query the connector state at any time, so this path
> is regularly executed with the device suspended. It affects only setups
> without a next bridge or panel (e.g. a DP connector), as otherwise
> detect returns early.
> 
> Take a runtime PM reference around the HPD check, the same way as
> analogix_dpaux_transfer() and analogix_dpaux_wait_hpd_asserted() do,
> and report the connector status as unknown if the device cannot be
> resumed.
> 
> Fixes: 2b77a2918c5d ("drm: bridge: analogix/dp: move hpd detect to connector detect function")
> Closes: https://sashiko.dev/#/bug/linux-ea09d64b-12cd-4301-bd54-12c515b01bde
> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
> ---
> Changelog:
> v2:
> - removed pm_runtime_mark_last_busy(), as it is not included in
>   pm_runtime_put_autosuspend()
> 
> v1: https://lore.kernel.org/all/20261119092857.1158971-1-m.szyprowski@samsung.com/
> ---
>  drivers/gpu/drm/bridge/analogix/analogix_dp_core.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
> index 84951413012b..664ee46c8e53 100644
> --- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
> +++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
> @@ -905,9 +905,14 @@ analogix_dp_bridge_detect(struct drm_bridge *bridge, struct drm_connector *conne
>  	if (dp->plat_data->next_bridge)
>  		return connector_status_connected;
>  
> +	if (pm_runtime_resume_and_get(dp->dev) < 0)
> +		return connector_status_unknown;
> +
>  	if (!analogix_dp_detect_hpd(dp))
>  		status = connector_status_connected;
>  
> +	pm_runtime_put_autosuspend(dp->dev);
> +
>  	return status;
>  }
>  
> -- 
> 2.43.0
> 

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

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20261119103751eucas1p16485be9bf23e31909f3b2df7c1c9d43f@eucas1p1.samsung.com>
2026-11-19 10:37 ` [PATCH v2] drm/bridge: analogix_dp: Hold runtime PM reference in bridge detect Marek Szyprowski
2026-11-19 18:14   ` Brian Norris [this message]
2026-11-20  2:07   ` Damon Ding

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=av88fNztBjS79X8L@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.