From: Daniel Vetter Subject: Re: [PATCH v2] drm: sun4i: Add support for suspending the display driver Date: Mon, 4 Nov 2019 18:42:18 +0100 Message-ID: <20191104174218.GL10326@phenom.ffwll.local> References: <20191029112846.3604925-1-megous@megous.com> Reply-To: daniel-/w4YWyX8dFk@public.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Return-path: Sender: Daniel Vetter Content-Disposition: inline In-Reply-To: <20191029112846.3604925-1-megous-5qf/QAjKc83QT0dZR+AlfA@public.gmane.org> List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , To: Ondrej Jirman Cc: linux-sunxi-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org, Maxime Ripard , Chen-Yu Tsai , David Airlie , Daniel Vetter , "open list:DRM DRIVERS FOR ALLWINNER A10" , "moderated list:ARM/Allwinner sunXi SoC support" , open list List-Id: dri-devel@lists.freedesktop.org On Tue, Oct 29, 2019 at 12:28:46PM +0100, Ondrej Jirman wrote: > Shut down the display engine during suspend. > > Signed-off-by: Ondrej Jirman > --- > Changes in v2: > - spaces -> tabs > > drivers/gpu/drm/sun4i/sun4i_drv.c | 22 ++++++++++++++++++++++ > 1 file changed, 22 insertions(+) > > diff --git a/drivers/gpu/drm/sun4i/sun4i_drv.c b/drivers/gpu/drm/sun4i/sun4i_drv.c > index a5757b11b730..c519d7cfcf43 100644 > --- a/drivers/gpu/drm/sun4i/sun4i_drv.c > +++ b/drivers/gpu/drm/sun4i/sun4i_drv.c > @@ -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) > +}; 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 > + > 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); > -- > 2.23.0 > -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch