lkml.org 
[lkml]   [2022]   [Nov]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v2 04/26] drm: rockchip: Define and use generic PM ops
Date
Use the new DEFINE_DRM_MODE_CONFIG_HELPER_PM_OPS() macro to create a
"struct dev_pm_ops" that can be used by this driver, instead of using
custom PM callbacks with the same behaviour.

v2: Use the DEFINE_DRM_MODE_CONFIG_HELPER_PM_OPS() macro instead of an
exported dev_pm_ops.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
---
Cc: Sandy Huang <hjc@rock-chips.com>
Cc: "Heiko Stübner" <heiko@sntech.de>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-rockchip@lists.infradead.org
---
drivers/gpu/drm/rockchip/rockchip_drm_drv.c | 25 +++------------------
1 file changed, 3 insertions(+), 22 deletions(-)

diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
index 6e0788d14c10..ec117c52cb24 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
@@ -236,27 +236,6 @@ static const struct drm_driver rockchip_drm_driver = {
.minor = DRIVER_MINOR,
};

-#ifdef CONFIG_PM_SLEEP
-static int rockchip_drm_sys_suspend(struct device *dev)
-{
- struct drm_device *drm = dev_get_drvdata(dev);
-
- return drm_mode_config_helper_suspend(drm);
-}
-
-static int rockchip_drm_sys_resume(struct device *dev)
-{
- struct drm_device *drm = dev_get_drvdata(dev);
-
- return drm_mode_config_helper_resume(drm);
-}
-#endif
-
-static const struct dev_pm_ops rockchip_drm_pm_ops = {
- SET_SYSTEM_SLEEP_PM_OPS(rockchip_drm_sys_suspend,
- rockchip_drm_sys_resume)
-};
-
#define MAX_ROCKCHIP_SUB_DRIVERS 16
static struct platform_driver *rockchip_sub_drivers[MAX_ROCKCHIP_SUB_DRIVERS];
static int num_rockchip_sub_drivers;
@@ -473,6 +452,8 @@ static const struct of_device_id rockchip_drm_dt_ids[] = {
};
MODULE_DEVICE_TABLE(of, rockchip_drm_dt_ids);

+DEFINE_DRM_MODE_CONFIG_HELPER_PM_OPS(rockchip_pm_ops);
+
static struct platform_driver rockchip_drm_platform_driver = {
.probe = rockchip_drm_platform_probe,
.remove = rockchip_drm_platform_remove,
@@ -480,7 +461,7 @@ static struct platform_driver rockchip_drm_platform_driver = {
.driver = {
.name = "rockchip-drm",
.of_match_table = rockchip_drm_dt_ids,
- .pm = &rockchip_drm_pm_ops,
+ .pm = pm_sleep_ptr(&rockchip_pm_ops),
},
};

--
2.35.1
\
 
 \ /
  Last update: 2022-11-29 20:19    [W:0.176 / U:0.268 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site