cdns-dsi: Split pm_ops into runtime_pm and system_sleep ops
Subsystems (3)
PATCH 1/1 cdns-dsi: Split pm_ops into runtime_pm and system_sleep ops
Use pm_runtime_force_suspend/resume in system_sleep pm callbacks to let runtime-pm take care of the coordination between system suspend and itself. This ensures that they do not interfere with each other.
Signed-off-by Abhash Kumar Jha <[email protected]>
--- .../gpu/drm/bridge/cadence/cdns-dsi-core.c | 32 +++++++++++++------ 1 file changed, 23 insertions(+), 9 deletions(-)
drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c +23 -9
@@ -1230,7 +1230,18 @@ static const struct mipi_dsi_host_ops cdns_dsi_ops = { .transfer = cdns_dsi_transfer, }; -static int __maybe_unused cdns_dsi_resume (struct device *dev) +static int cdns_dsi_runtime_suspend (struct device *dev) +{ +struct cdns_dsi *dsi =dev_get_drvdata (dev); + +clk_disable_unprepare (dsi->dsi_sys_clk); +clk_disable_unprepare (dsi->dsi_p_clk); +reset_control_assert (dsi->dsi_p_rst); + +return 0 ; +} + +static int cdns_dsi_runtime_resume (struct device *dev) {struct cdns_dsi *dsi =dev_get_drvdata (dev);
@@ -1241,18 +1252,21 @@ static int __maybe_unused cdns_dsi_resume(struct device *dev)return 0 ; } -static int __maybe_unused cdns_dsi_suspend (struct device *dev) +static int cdns_dsi_suspend (struct device *dev) { -struct cdns_dsi *dsi =dev_get_drvdata (dev); +return pm_runtime_force_suspend (dev); +} -clk_disable_unprepare (dsi->dsi_sys_clk); -clk_disable_unprepare (dsi->dsi_p_clk); -reset_control_assert (dsi->dsi_p_rst); -return 0 ; +static int cdns_dsi_resume (struct device *dev) +{ +return pm_runtime_force_resume (dev); } -static UNIVERSAL_DEV_PM_OPS(cdns_dsi_pm_ops, cdns_dsi_suspend, cdns_dsi_resume, - NULL); +static const struct dev_pm_ops cdns_dsi_pm_ops = { + SET_RUNTIME_PM_OPS(cdns_dsi_runtime_suspend, + cdns_dsi_runtime_resume, NULL) +SET_SYSTEM_SLEEP_PM_OPS (cdns_dsi_suspend, cdns_dsi_resume) +};static int cdns_dsi_drm_probe (struct platform_device *pdev) {
Signature · 1 line
2.34.1
$subject prefix, Please check with git log drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c
should be drm/bridge: cdns-dsi:....
Quoted 3 lines · Abhash Kumar Jha
Use pm_runtime_force_suspend/resume in
system_sleeppm callbacks to let runtime-pm take care of the coordination between system suspend and itself. This ensures that they do not interfere with each other.
Could you add details, where you saw interference
Quoted 60 lines
Signed-off-by Abhash Kumar Jha <[email protected]>--- .../gpu/drm/bridge/cadence/cdns-dsi-core.c | 32 +++++++++++++------ 1 file changed, 23 insertions(+), 9 deletions(-)drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c +23
-9@@ -1230,7 +1230,18 @@ static const struct mipi_dsi_host_ops cdns_dsi_ops = { .transfer = cdns_dsi_transfer, }; -static int __maybe_unused cdns_dsi_resume (struct device *dev) +static int cdns_dsi_runtime_suspend (struct device *dev) +{ +struct cdns_dsi *dsi =dev_get_drvdata (dev); + +clk_disable_unprepare (dsi->dsi_sys_clk); +clk_disable_unprepare (dsi->dsi_p_clk); +reset_control_assert (dsi->dsi_p_rst); + +return 0 ; +} + +static int cdns_dsi_runtime_resume (struct device *dev) {struct cdns_dsi *dsi =dev_get_drvdata (dev);@@ -1241,18 +1252,21 @@ static int __maybe_unused cdns_dsi_resume(struct device *dev)return 0 ; } -static int __maybe_unused cdns_dsi_suspend (struct device *dev) +static int cdns_dsi_suspend (struct device *dev) { -struct cdns_dsi *dsi =dev_get_drvdata (dev); +return pm_runtime_force_suspend (dev); +} -clk_disable_unprepare (dsi->dsi_sys_clk); -clk_disable_unprepare (dsi->dsi_p_clk); -reset_control_assert (dsi->dsi_p_rst); -return 0 ; +static int cdns_dsi_resume (struct device *dev) +{ +return pm_runtime_force_resume (dev); } -static UNIVERSAL_DEV_PM_OPS(cdns_dsi_pm_ops, cdns_dsi_suspend, cdns_dsi_resume, - NULL); +static const struct dev_pm_ops cdns_dsi_pm_ops = { + SET_RUNTIME_PM_OPS(cdns_dsi_runtime_suspend, + cdns_dsi_runtime_resume, NULL) +SET_SYSTEM_SLEEP_PM_OPS (cdns_dsi_suspend, cdns_dsi_resume) +};static int cdns_dsi_drm_probe (struct platform_device *pdev) {