[PATCH RFC] drm/vc4: hdmi: Fix connector detect logic

Maxime Ripard maxime at cerno.tech
Tue Jul 6 09:58:07 UTC 2021


Hi,

On Mon, Jul 05, 2021 at 11:36:34PM +0200, Stefan Wahren wrote:
> Commit "drm/vc4: hdmi: Convert to gpiod" changes the behavior of
> vc4_hdmi_connector_detect() which results into CPU hangs in case there
> is no HDMI connected. Let's restore the old behavior.
> 
> Reported-by: Nathan Chancellor <nathan at kernel.org>
> Reported-by: Ojaswin Mujoo <ojaswin98 at gmail.com>
> Fixes: 6800234ceee0 ("drm/vc4: hdmi: Convert to gpiod")
> Signed-off-by: Stefan Wahren <stefan.wahren at i2se.com>

I already sent this patch last week:

https://lore.kernel.org/dri-devel/20210628124257.140453-3-maxime@cerno.tech/

I'm not entirely sure how this could create a CPU hang though. Withouth
this patch, if the HPD GPIO is low, we would first try to retrieve the
EDID, and then if it doesn't we would read the hotplug register.

The first is using a separate i2c controller (and even if it was in the
same power domain, we have the pm_runtime_resume call), and the register
read should be fine too?

Maxime

>  drivers/gpu/drm/vc4/vc4_hdmi.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c
> index aab1b36..cf8339c 100644
> --- a/drivers/gpu/drm/vc4/vc4_hdmi.c
> +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c
> @@ -168,9 +168,9 @@ vc4_hdmi_connector_detect(struct drm_connector *connector, bool force)
>  
>  	WARN_ON(pm_runtime_resume_and_get(&vc4_hdmi->pdev->dev));
>  
> -	if (vc4_hdmi->hpd_gpio &&
> -	    gpiod_get_value_cansleep(vc4_hdmi->hpd_gpio)) {
> -		connected = true;
> +	if (vc4_hdmi->hpd_gpio) {
> +		if (gpiod_get_value_cansleep(vc4_hdmi->hpd_gpio))
> +			connected = true;
>  	} else if (drm_probe_ddc(vc4_hdmi->ddc)) {
>  		connected = true;
>  	} else if (HDMI_READ(HDMI_HOTPLUG) & VC4_HDMI_HOTPLUG_CONNECTED) {
> -- 
> 2.7.4
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/dri-devel/attachments/20210706/6a66f377/attachment.sig>


More information about the dri-devel mailing list