drm: sun4i: Add support for suspending the display driver
PATCH v2 1/1 drm: sun4i: Add support for suspending the display driver
Shut down the display engine during suspend.
Signed-off-by Ondrej Jirman <[email protected]>
---
Changes in v2:
- spaces -> tabs
drivers/gpu/drm/sun4i/sun4i_drv.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+)
drivers/gpu/drm/sun4i/sun4i_drv.c +22 -0
@@ -346,6 +346,27 @@ static int sun4i_drv_add_endpoints(struct device *dev,return count; } +#ifdef CONFIG_PM_SLEEP +static int sun4i_drv_drm_sys_suspend (struct device *dev) +{ +struct drm_device *drm =dev_get_drvdata (dev); + +return drm_mode_config_helper_suspend (drm); +} + +static int sun4i_drv_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 sun4i_drv_drm_pm_ops = { +SET_SYSTEM_SLEEP_PM_OPS (sun4i_drv_drm_sys_suspend, + sun4i_drv_drm_sys_resume) +}; +static int sun4i_drv_probe (struct platform_device *pdev) {struct component_match *match =NULL ;
@@ -418,6 +439,7 @@ static struct platform_driver sun4i_drv_platform_driver = { .driver = { .name = "sun4i-drm", .of_match_table = sun4i_drv_of_table, + .pm = &sun4i_drv_drm_pm_ops, }, };module_platform_driver (sun4i_drv_platform_driver);
Signature · 1 line
2.23.0
Quoted 3 lines · Ondrej Jirman
Shut down the display engine during suspend.
Signed-off-by Ondrej Jirman <[email protected]>
Applied, thanks
Maxime
Quoted 28 lines · Ondrej Jirman
Shut down the display engine during suspend.
Signed-off-by Ondrej Jirman <megous-5qf/[email protected]>---
Changes in v2:
- spaces -> tabsdrivers/gpu/drm/sun4i/sun4i_drv.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+)drivers/gpu/drm/sun4i/sun4i_drv.c +10
-0@@ -346,6 +346,27 @@ static int sun4i_drv_add_endpoints(struct device *dev,return count; } +#ifdef CONFIG_PM_SLEEP +static int sun4i_drv_drm_sys_suspend (struct device *dev) +{ +struct drm_device *drm =dev_get_drvdata (dev); + +return drm_mode_config_helper_suspend (drm); +} + +static int sun4i_drv_drm_sys_resume (struct device *dev) +{
drivers/gpu/drm/sun4i/sun4i_drv.c static int sun4i_drv_add_endpoints(struct device *dev, · line 368
Quoted 10 lines
drivers/gpu/drm/sun4i/sun4i_drv.c +10
-0+struct drm_device *drm =dev_get_drvdata (dev); + + return drm_mode_config_helper_resume(drm); +} +#endif + +static const struct dev_pm_ops sun4i_drv_drm_pm_ops = { +SET_SYSTEM_SLEEP_PM_OPS (sun4i_drv_drm_sys_suspend, + sun4i_drv_drm_sys_resume) +};
I wonder whether we should have these as default helpers somewhere, there's probably a few drivers that could use them? It's just a handful of lines we're saving here, but we have enough kms drivers to justify this kind of stuff nowadays ...
-Daniel
Quoted 15 lines
drivers/gpu/drm/sun4i/sun4i_drv.c +2
-0+static int sun4i_drv_probe (struct platform_device *pdev) {struct component_match *match =NULL ;@@ -418,6 +439,7 @@ static struct platform_driver sun4i_drv_platform_driver = { .driver = { .name = "sun4i-drm", .of_match_table = sun4i_drv_of_table, + .pm = &sun4i_drv_drm_pm_ops, }, };module_platform_driver (sun4i_drv_platform_driver);Signature · 1 line
2.23.0
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch