If the HPD GPIO is not available and drm_probe_ddc fails, we end up
reading the HDMI_HOTPLUG register, but the controller might be powered
off resulting in a CPU hang. Make sure we have the power domain and the
HSM clock powered during the detect cycle to prevent the hang from
happening.
Fixes: 4f6e3d66ac52 ("drm/vc4: Add runtime PM support to the HDMI encoder driver")
Signed-off-by: Maxime Ripard <[email protected]>
---
drivers/gpu/drm/vc4/vc4_hdmi.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c
index 867009a471e1..4b6857467e58 100644
--- a/drivers/gpu/drm/vc4/vc4_hdmi.c
+++ b/drivers/gpu/drm/vc4/vc4_hdmi.c
@@ -166,6 +166,8 @@ vc4_hdmi_connector_detect(struct drm_connector *connector, bool force)
struct vc4_hdmi *vc4_hdmi = connector_to_vc4_hdmi(connector);
bool connected = false;
+ WARN_ON(pm_runtime_resume_and_get(&vc4_hdmi->pdev->dev));
+
if (vc4_hdmi->hpd_gpio) {
if (gpio_get_value_cansleep(vc4_hdmi->hpd_gpio) ^
vc4_hdmi->hpd_active_low)
@@ -187,10 +189,12 @@ vc4_hdmi_connector_detect(struct drm_connector *connector, bool force)
}
}
+ pm_runtime_put(&vc4_hdmi->pdev->dev);
return connector_status_connected;
}
cec_phys_addr_invalidate(vc4_hdmi->cec_adap);
+ pm_runtime_put(&vc4_hdmi->pdev->dev);
return connector_status_disconnected;
}
--
2.31.1
On Tue, 25 May 2021 at 10:11, Maxime Ripard <[email protected]> wrote:
>
> If the HPD GPIO is not available and drm_probe_ddc fails, we end up
> reading the HDMI_HOTPLUG register, but the controller might be powered
> off resulting in a CPU hang. Make sure we have the power domain and the
> HSM clock powered during the detect cycle to prevent the hang from
> happening.
>
> Fixes: 4f6e3d66ac52 ("drm/vc4: Add runtime PM support to the HDMI encoder driver")
> Signed-off-by: Maxime Ripard <[email protected]>
Reviewed-by: Dave Stevenson <[email protected]>
> ---
> drivers/gpu/drm/vc4/vc4_hdmi.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c
> index 867009a471e1..4b6857467e58 100644
> --- a/drivers/gpu/drm/vc4/vc4_hdmi.c
> +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c
> @@ -166,6 +166,8 @@ vc4_hdmi_connector_detect(struct drm_connector *connector, bool force)
> struct vc4_hdmi *vc4_hdmi = connector_to_vc4_hdmi(connector);
> bool connected = false;
>
> + WARN_ON(pm_runtime_resume_and_get(&vc4_hdmi->pdev->dev));
> +
> if (vc4_hdmi->hpd_gpio) {
> if (gpio_get_value_cansleep(vc4_hdmi->hpd_gpio) ^
> vc4_hdmi->hpd_active_low)
> @@ -187,10 +189,12 @@ vc4_hdmi_connector_detect(struct drm_connector *connector, bool force)
> }
> }
>
> + pm_runtime_put(&vc4_hdmi->pdev->dev);
> return connector_status_connected;
> }
>
> cec_phys_addr_invalidate(vc4_hdmi->cec_adap);
> + pm_runtime_put(&vc4_hdmi->pdev->dev);
> return connector_status_disconnected;
> }
>
> --
> 2.31.1
>
On Wed, Jun 16, 2021 at 11:51:26AM +0100, Dave Stevenson wrote:
> On Tue, 25 May 2021 at 10:11, Maxime Ripard <[email protected]> wrote:
> >
> > If the HPD GPIO is not available and drm_probe_ddc fails, we end up
> > reading the HDMI_HOTPLUG register, but the controller might be powered
> > off resulting in a CPU hang. Make sure we have the power domain and the
> > HSM clock powered during the detect cycle to prevent the hang from
> > happening.
> >
> > Fixes: 4f6e3d66ac52 ("drm/vc4: Add runtime PM support to the HDMI encoder driver")
> > Signed-off-by: Maxime Ripard <[email protected]>
>
> Reviewed-by: Dave Stevenson <[email protected]>
Applied patches 2 and 3, I'll resend a new version of patch 1 after some
comments by Daniel on IRC.
Thanks!
Maxime