Hello Sebastian,
Sebastian Reichel <[email protected]> 于2026年6月13日周六 02:01写道: > Add support for runtime PM to the Rockchip RK3576/3588 Synopsys > DesignWare DisplayPort driver. > > Signed-off-by: Sebastian Reichel <[email protected]> > --- > drivers/gpu/drm/rockchip/dw_dp-rockchip.c | 40 > +++++++++++++++++++++++++++++++ > 1 file changed, 40 insertions(+) > > diff --git a/drivers/gpu/drm/rockchip/dw_dp-rockchip.c > b/drivers/gpu/drm/rockchip/dw_dp-rockchip.c > index 9c53f1d2c29a..1f53228e56d9 100644 > --- a/drivers/gpu/drm/rockchip/dw_dp-rockchip.c > +++ b/drivers/gpu/drm/rockchip/dw_dp-rockchip.c > @@ -12,6 +12,7 @@ > #include <linux/mfd/syscon.h> > #include <linux/of_device.h> > #include <linux/platform_device.h> > +#include <linux/pm_runtime.h> > #include <linux/regmap.h> > #include <linux/videodev2.h> > > @@ -58,6 +59,8 @@ static void dw_dp_rockchip_hpd_sw_sel(void *data, bool > force_hpd_from_sw) > > dp->hpd_sel = force_hpd_from_sw; > > + ACQUIRE(pm_runtime_active_auto, pm)(dp->dev); > This can triger HPD irq for USB-C DP AltMode, but for a standard DP port, this is no way to acquire runtime, so there will no irq when plug in . > + > regmap_write(dp->vo_grf, hpd_reg, > FIELD_PREP_WM16(ROCKCHIP_VO_GRF_DP_SINK_HPD_SEL, > dp->hpd_sel)); > } > @@ -71,6 +74,8 @@ static void dw_dp_rockchip_hpd_sw_cfg(void *data, bool > hpd) > > dp->hpd_cfg = hpd; > > + ACQUIRE(pm_runtime_active_auto, pm)(dp->dev); > + > regmap_write(dp->vo_grf, hpd_reg, > FIELD_PREP_WM16(ROCKCHIP_VO_GRF_DP_SINK_HPD_CFG, > dp->hpd_cfg)); > } > @@ -213,6 +218,12 @@ static int dw_dp_rockchip_bind(struct device *dev, > struct device *master, void * > if (IS_ERR(dp->base)) > return PTR_ERR(dp->base); > > + pm_runtime_use_autosuspend(dev); > + pm_runtime_set_autosuspend_delay(dev, 500); > + ret = devm_pm_runtime_enable(dev); > + if (ret) > + return dev_err_probe(dev, ret, "failed to enable runtime > PM\n"); > + > connector = drm_bridge_connector_init(drm_dev, encoder); > if (IS_ERR(connector)) { > dw_dp_unbind(dp->base); > @@ -246,6 +257,34 @@ static void dw_dp_remove(struct platform_device *pdev) > component_del(&pdev->dev, &dw_dp_rockchip_component_ops); > } > > +static int dw_dp_rockchip_runtime_suspend(struct device *dev) > +{ > + struct rockchip_dw_dp *dp = dev_get_drvdata(dev); > + > + return dw_dp_runtime_suspend(dp->base); > +} > + > +static int dw_dp_rockchip_runtime_resume(struct device *dev) > +{ > + struct rockchip_dw_dp *dp = dev_get_drvdata(dev); > + u32 hpd_reg = dp->pdata->hpd_reg[dp->id]; > + int ret; > + > + ret = dw_dp_runtime_resume(dp->base); > + if (ret) > + return ret; > + > + regmap_write(dp->vo_grf, hpd_reg, > + FIELD_PREP_WM16(ROCKCHIP_VO_GRF_DP_SINK_HPD_SEL, > dp->hpd_sel) | > + FIELD_PREP_WM16(ROCKCHIP_VO_GRF_DP_SINK_HPD_CFG, > dp->hpd_cfg)); > + > + return 0; > +} > + > +static const struct dev_pm_ops dw_dp_pm_ops = { > + RUNTIME_PM_OPS(dw_dp_rockchip_runtime_suspend, > dw_dp_rockchip_runtime_resume, NULL) > +}; > + > static const struct rockchip_dw_dp_plat_data rk3588_dp_plat_data = { > .num_ctrls = 2, > .ctrl_ids = {0xfde50000, 0xfde60000}, > @@ -280,5 +319,6 @@ struct platform_driver dw_dp_driver = { > .driver = { > .name = "dw-dp", > .of_match_table = dw_dp_of_match, > + .pm = pm_ptr(&dw_dp_pm_ops), > }, > }; > > -- > 2.53.0 > > >
