drm/vc4: hdmi: Handle error case of pm_runtime_resume_and_get

[ Upstream commit f1a54e860b ]

The commit 0f5251339e ("drm/vc4: hdmi: Make sure the controller is
powered in detect") introduced the necessary power management handling
to avoid register access while controller is powered down.
Unfortunately it just print a warning if pm_runtime_resume_and_get()
fails and proceed anyway.

This could happen during suspend to idle. So we must assume it is unsafe
to access the HDMI register. So bail out properly.

Fixes: 0f5251339e ("drm/vc4: hdmi: Make sure the controller is powered in detect")
Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
Reviewed-by: Maíra Canal <mcanal@igalia.com>
Acked-by: Maxime Ripard <mripard@kernel.org>
Signed-off-by: Maíra Canal <mcanal@igalia.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240821214052.6800-3-wahrenst@gmx.net
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
Stefan Wahren 2024-08-21 23:40:45 +02:00 committed by Greg Kroah-Hartman
parent 087b880880
commit 9263023a0b

View File

@ -458,6 +458,7 @@ static int vc4_hdmi_connector_detect_ctx(struct drm_connector *connector,
{ {
struct vc4_hdmi *vc4_hdmi = connector_to_vc4_hdmi(connector); struct vc4_hdmi *vc4_hdmi = connector_to_vc4_hdmi(connector);
enum drm_connector_status status = connector_status_disconnected; enum drm_connector_status status = connector_status_disconnected;
int ret;
/* /*
* NOTE: This function should really take vc4_hdmi->mutex, but * NOTE: This function should really take vc4_hdmi->mutex, but
@ -470,7 +471,12 @@ static int vc4_hdmi_connector_detect_ctx(struct drm_connector *connector,
* the lock for now. * the lock for now.
*/ */
WARN_ON(pm_runtime_resume_and_get(&vc4_hdmi->pdev->dev)); ret = pm_runtime_resume_and_get(&vc4_hdmi->pdev->dev);
if (ret) {
drm_err_once(connector->dev, "Failed to retain HDMI power domain: %d\n",
ret);
return connector_status_unknown;
}
if (vc4_hdmi->hpd_gpio) { if (vc4_hdmi->hpd_gpio) {
if (gpiod_get_value_cansleep(vc4_hdmi->hpd_gpio)) if (gpiod_get_value_cansleep(vc4_hdmi->hpd_gpio))