]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
drm/msm/hdmi: switch to pm_runtime_resume_and_get()
authorDmitry Baryshkov <dmitry.baryshkov@linaro.org>
Mon, 5 May 2025 00:14:51 +0000 (03:14 +0300)
committerDmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Mon, 12 May 2025 16:18:48 +0000 (19:18 +0300)
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 <quic_jesszhan@quicinc.com>
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Patchwork: https://patchwork.freedesktop.org/patch/651713/
Link: https://lore.kernel.org/r/20250505-fd-hdmi-hpd-v5-7-48541f76318c@oss.qualcomm.com
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
drivers/gpu/drm/msm/hdmi/hdmi_bridge.c
drivers/gpu/drm/msm/hdmi/hdmi_hpd.c
drivers/gpu/drm/msm/hdmi/hdmi_phy.c

index e7997e4a741c3b27c9086651efe6b79dbba6bf88..3ae305e868a5931a8982e261f518cd8134d559cc 100644 (file)
@@ -21,7 +21,7 @@ static void msm_hdmi_power_on(struct drm_bridge *bridge)
        const struct hdmi_platform_config *config = hdmi->config;
        int ret;
 
-       pm_runtime_get_sync(&hdmi->pdev->dev);
+       pm_runtime_resume_and_get(&hdmi->pdev->dev);
 
        ret = regulator_bulk_enable(config->pwr_reg_cnt, hdmi->pwr_regs);
        if (ret)
index e253c1408dd1c6dcd7e94506f0b8edcfd4a9a159..d77c68914c5f525cf12971c1058b1abc33792b24 100644 (file)
@@ -85,7 +85,12 @@ int msm_hdmi_hpd_enable(struct drm_bridge *bridge)
        if (hdmi->hpd_gpiod)
                gpiod_set_value_cansleep(hdmi->hpd_gpiod, 1);
 
-       pm_runtime_get_sync(dev);
+       ret = pm_runtime_resume_and_get(dev);
+       if (ret) {
+               DRM_DEV_ERROR(dev, "runtime resume failed: %d\n", ret);
+               goto fail;
+       }
+
        ret = clk_bulk_prepare_enable(config->hpd_clk_cnt, hdmi->hpd_clks);
        if (ret)
                goto fail;
@@ -178,7 +183,10 @@ static enum drm_connector_status detect_reg(struct hdmi *hdmi)
        u32 hpd_int_status = 0;
        int ret;
 
-       pm_runtime_get_sync(&hdmi->pdev->dev);
+       ret = pm_runtime_resume_and_get(&hdmi->pdev->dev);
+       if (ret)
+               goto out;
+
        ret = clk_bulk_prepare_enable(config->hpd_clk_cnt, hdmi->hpd_clks);
        if (ret)
                goto out;
index 03120c54ced686dcd2ddfe809dd9c9011f608235..667573f1db7c6bfef6c75828b5c581c147a86d0d 100644 (file)
@@ -58,7 +58,11 @@ int msm_hdmi_phy_resource_enable(struct hdmi_phy *phy)
        struct device *dev = &phy->pdev->dev;
        int i, ret = 0;
 
-       pm_runtime_get_sync(dev);
+       ret = pm_runtime_resume_and_get(dev);
+       if (ret) {
+               DRM_DEV_ERROR(dev, "runtime resume failed: %d\n", ret);
+               return ret;
+       }
 
        ret = regulator_bulk_enable(cfg->num_regs, phy->regs);
        if (ret) {