Skip to content

Commit 531b4e2

Browse files
committed
drm/msm/hdmi: add runtime PM calls to DDC transfer function
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 <[email protected]> Signed-off-by: Dmitry Baryshkov <[email protected]> Patchwork: https://patchwork.freedesktop.org/patch/651727/ Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Dmitry Baryshkov <[email protected]>
1 parent 81aa834 commit 531b4e2

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

drivers/gpu/drm/msm/hdmi/hdmi_i2c.c

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,11 +107,15 @@ static int msm_hdmi_i2c_xfer(struct i2c_adapter *i2c,
107107
if (num == 0)
108108
return num;
109109

110+
ret = pm_runtime_resume_and_get(&hdmi->pdev->dev);
111+
if (ret)
112+
return ret;
113+
110114
init_ddc(hdmi_i2c);
111115

112116
ret = ddc_clear_irq(hdmi_i2c);
113117
if (ret)
114-
return ret;
118+
goto fail;
115119

116120
for (i = 0; i < num; i++) {
117121
struct i2c_msg *p = &msgs[i];
@@ -169,7 +173,7 @@ static int msm_hdmi_i2c_xfer(struct i2c_adapter *i2c,
169173
hdmi_read(hdmi, REG_HDMI_DDC_SW_STATUS),
170174
hdmi_read(hdmi, REG_HDMI_DDC_HW_STATUS),
171175
hdmi_read(hdmi, REG_HDMI_DDC_INT_CTRL));
172-
return ret;
176+
goto fail;
173177
}
174178

175179
ddc_status = hdmi_read(hdmi, REG_HDMI_DDC_SW_STATUS);
@@ -202,7 +206,13 @@ static int msm_hdmi_i2c_xfer(struct i2c_adapter *i2c,
202206
}
203207
}
204208

209+
pm_runtime_put(&hdmi->pdev->dev);
210+
205211
return i;
212+
213+
fail:
214+
pm_runtime_put(&hdmi->pdev->dev);
215+
return ret;
206216
}
207217

208218
static u32 msm_hdmi_i2c_func(struct i2c_adapter *adapter)

0 commit comments

Comments
 (0)