drm/msm/hdmi: add runtime PM calls to DDC transfer function
authorDmitry Baryshkov <dmitry.baryshkov@linaro.org>
Mon, 5 May 2025 00:14:52 +0000 (03:14 +0300)
committerDmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Mon, 12 May 2025 16:18:48 +0000 (19:18 +0300)
We must be sure that the HDMI controller is powered on, while performing
the DDC transfer. Add corresponding runtime PM calls to
msm_hdmi_i2c_xfer().

Reviewed-by: Jessica Zhang <quic_jesszhan@quicinc.com>
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Patchwork: https://patchwork.freedesktop.org/patch/651727/
Link: https://lore.kernel.org/r/20250505-fd-hdmi-hpd-v5-8-48541f76318c@oss.qualcomm.com
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
drivers/gpu/drm/msm/hdmi/hdmi_i2c.c

index 7aa500d24240ff3ed6694c469eafc4388c982346..ebefea4fb40855745001ed97367d571bde28f413 100644 (file)
@@ -107,11 +107,15 @@ static int msm_hdmi_i2c_xfer(struct i2c_adapter *i2c,
        if (num == 0)
                return num;
 
+       ret = pm_runtime_resume_and_get(&hdmi->pdev->dev);
+       if (ret)
+               return ret;
+
        init_ddc(hdmi_i2c);
 
        ret = ddc_clear_irq(hdmi_i2c);
        if (ret)
-               return ret;
+               goto fail;
 
        for (i = 0; i < num; i++) {
                struct i2c_msg *p = &msgs[i];
@@ -169,7 +173,7 @@ static int msm_hdmi_i2c_xfer(struct i2c_adapter *i2c,
                                hdmi_read(hdmi, REG_HDMI_DDC_SW_STATUS),
                                hdmi_read(hdmi, REG_HDMI_DDC_HW_STATUS),
                                hdmi_read(hdmi, REG_HDMI_DDC_INT_CTRL));
-               return ret;
+               goto fail;
        }
 
        ddc_status = hdmi_read(hdmi, REG_HDMI_DDC_SW_STATUS);
@@ -202,7 +206,13 @@ static int msm_hdmi_i2c_xfer(struct i2c_adapter *i2c,
                }
        }
 
+       pm_runtime_put(&hdmi->pdev->dev);
+
        return i;
+
+fail:
+       pm_runtime_put(&hdmi->pdev->dev);
+       return ret;
 }
 
 static u32 msm_hdmi_i2c_func(struct i2c_adapter *adapter)