Skip to content

Commit 81aa834

Browse files
committed
drm/msm/hdmi: switch to pm_runtime_resume_and_get()
The pm_runtime_get_sync() function is a bad choise for runtime power management. Switch HDMI driver to pm_runtime_resume_and_get() and add proper error handling, while we are at it. Reviewed-by: Jessica Zhang <[email protected]> Signed-off-by: Dmitry Baryshkov <[email protected]> Patchwork: https://patchwork.freedesktop.org/patch/651713/ Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Dmitry Baryshkov <[email protected]>
1 parent 15a5223 commit 81aa834

File tree

3 files changed

+16
-4
lines changed

3 files changed

+16
-4
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ static void msm_hdmi_power_on(struct drm_bridge *bridge)
2121
const struct hdmi_platform_config *config = hdmi->config;
2222
int ret;
2323

24-
pm_runtime_get_sync(&hdmi->pdev->dev);
24+
pm_runtime_resume_and_get(&hdmi->pdev->dev);
2525

2626
ret = regulator_bulk_enable(config->pwr_reg_cnt, hdmi->pwr_regs);
2727
if (ret)

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

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,12 @@ int msm_hdmi_hpd_enable(struct drm_bridge *bridge)
8585
if (hdmi->hpd_gpiod)
8686
gpiod_set_value_cansleep(hdmi->hpd_gpiod, 1);
8787

88-
pm_runtime_get_sync(dev);
88+
ret = pm_runtime_resume_and_get(dev);
89+
if (ret) {
90+
DRM_DEV_ERROR(dev, "runtime resume failed: %d\n", ret);
91+
goto fail;
92+
}
93+
8994
ret = clk_bulk_prepare_enable(config->hpd_clk_cnt, hdmi->hpd_clks);
9095
if (ret)
9196
goto fail;
@@ -178,7 +183,10 @@ static enum drm_connector_status detect_reg(struct hdmi *hdmi)
178183
u32 hpd_int_status = 0;
179184
int ret;
180185

181-
pm_runtime_get_sync(&hdmi->pdev->dev);
186+
ret = pm_runtime_resume_and_get(&hdmi->pdev->dev);
187+
if (ret)
188+
goto out;
189+
182190
ret = clk_bulk_prepare_enable(config->hpd_clk_cnt, hdmi->hpd_clks);
183191
if (ret)
184192
goto out;

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,11 @@ int msm_hdmi_phy_resource_enable(struct hdmi_phy *phy)
5858
struct device *dev = &phy->pdev->dev;
5959
int i, ret = 0;
6060

61-
pm_runtime_get_sync(dev);
61+
ret = pm_runtime_resume_and_get(dev);
62+
if (ret) {
63+
DRM_DEV_ERROR(dev, "runtime resume failed: %d\n", ret);
64+
return ret;
65+
}
6266

6367
ret = regulator_bulk_enable(cfg->num_regs, phy->regs);
6468
if (ret) {

0 commit comments

Comments
 (0)