From mboxrd@z Thu Jan 1 00:00:00 1970 From: a.hajda@samsung.com (Andrzej Hajda) Date: Mon, 18 Aug 2014 09:43:19 +0200 Subject: [PATCH v2] imx-drm: imx-drm-core: add suspend/resume support In-Reply-To: <1406269240-24622-1-git-send-email-shawn.guo@freescale.com> References: <1406269240-24622-1-git-send-email-shawn.guo@freescale.com> Message-ID: <53F1AE97.8090807@samsung.com> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org Hi Shawn, On 07/25/2014 08:20 AM, Shawn Guo wrote: > HDMI currently stops working after a system suspend/resume cycle. The > cause is that the mode setting states in hardware gets lost and isn't > restored across the suspend/resume cycle. > > The patch adds a very basic suspend/resume support to imx-drm driver, > and calls drm_helper_resume_force_mode() in .resume hook to restore the > mode setting states, so that HDMI can continue working after a system > suspend/resume cycle. > > Signed-off-by: Shawn Guo > --- > Changs since v1: > - Do not walk through connector->funcs->dpms() but only call > drm_helper_resume_force_mode() in .resume. > > drivers/staging/imx-drm/imx-drm-core.c | 24 ++++++++++++++++++++++++ > 1 file changed, 24 insertions(+) > > diff --git a/drivers/staging/imx-drm/imx-drm-core.c b/drivers/staging/imx-drm/imx-drm-core.c > index def8280d7ee6..ab41152089a3 100644 > --- a/drivers/staging/imx-drm/imx-drm-core.c > +++ b/drivers/staging/imx-drm/imx-drm-core.c > @@ -696,6 +696,29 @@ static int imx_drm_platform_remove(struct platform_device *pdev) > return 0; > } > > +#ifdef CONFIG_PM_SLEEP > +static int imx_drm_suspend(struct device *dev) > +{ > + struct drm_device *drm_dev = dev_get_drvdata(dev); > + > + drm_kms_helper_poll_disable(drm_dev); drm_dev can be NULL here. You should add check before. > + > + return 0; > +} > + > +static int imx_drm_resume(struct device *dev) > +{ > + struct drm_device *drm_dev = dev_get_drvdata(dev); > + > + drm_helper_resume_force_mode(drm_dev); ditto Regards Andrzej > + drm_kms_helper_poll_enable(drm_dev); > + > + return 0; > +} > +#endif > + > +static SIMPLE_DEV_PM_OPS(imx_drm_pm_ops, imx_drm_suspend, imx_drm_resume); > + > static const struct of_device_id imx_drm_dt_ids[] = { > { .compatible = "fsl,imx-display-subsystem", }, > { /* sentinel */ }, > @@ -708,6 +731,7 @@ static struct platform_driver imx_drm_pdrv = { > .driver = { > .owner = THIS_MODULE, > .name = "imx-drm", > + .pm = &imx_drm_pm_ops, > .of_match_table = imx_drm_dt_ids, > }, > }; > From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrzej Hajda Subject: Re: [PATCH v2] imx-drm: imx-drm-core: add suspend/resume support Date: Mon, 18 Aug 2014 09:43:19 +0200 Message-ID: <53F1AE97.8090807@samsung.com> References: <1406269240-24622-1-git-send-email-shawn.guo@freescale.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mailout4.w1.samsung.com (mailout4.w1.samsung.com [210.118.77.14]) by gabe.freedesktop.org (Postfix) with ESMTP id 664746E19C for ; Mon, 18 Aug 2014 00:43:30 -0700 (PDT) Received: from eucpsbgm2.samsung.com (unknown [203.254.199.245]) by mailout4.w1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0NAH00BH6S44W950@mailout4.w1.samsung.com> for dri-devel@lists.freedesktop.org; Mon, 18 Aug 2014 08:43:16 +0100 (BST) In-reply-to: <1406269240-24622-1-git-send-email-shawn.guo@freescale.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" To: Shawn Guo , Russell King Cc: kernel@pengutronix.de, dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org List-Id: dri-devel@lists.freedesktop.org Hi Shawn, On 07/25/2014 08:20 AM, Shawn Guo wrote: > HDMI currently stops working after a system suspend/resume cycle. The > cause is that the mode setting states in hardware gets lost and isn't > restored across the suspend/resume cycle. > > The patch adds a very basic suspend/resume support to imx-drm driver, > and calls drm_helper_resume_force_mode() in .resume hook to restore the > mode setting states, so that HDMI can continue working after a system > suspend/resume cycle. > > Signed-off-by: Shawn Guo > --- > Changs since v1: > - Do not walk through connector->funcs->dpms() but only call > drm_helper_resume_force_mode() in .resume. > > drivers/staging/imx-drm/imx-drm-core.c | 24 ++++++++++++++++++++++++ > 1 file changed, 24 insertions(+) > > diff --git a/drivers/staging/imx-drm/imx-drm-core.c b/drivers/staging/imx-drm/imx-drm-core.c > index def8280d7ee6..ab41152089a3 100644 > --- a/drivers/staging/imx-drm/imx-drm-core.c > +++ b/drivers/staging/imx-drm/imx-drm-core.c > @@ -696,6 +696,29 @@ static int imx_drm_platform_remove(struct platform_device *pdev) > return 0; > } > > +#ifdef CONFIG_PM_SLEEP > +static int imx_drm_suspend(struct device *dev) > +{ > + struct drm_device *drm_dev = dev_get_drvdata(dev); > + > + drm_kms_helper_poll_disable(drm_dev); drm_dev can be NULL here. You should add check before. > + > + return 0; > +} > + > +static int imx_drm_resume(struct device *dev) > +{ > + struct drm_device *drm_dev = dev_get_drvdata(dev); > + > + drm_helper_resume_force_mode(drm_dev); ditto Regards Andrzej > + drm_kms_helper_poll_enable(drm_dev); > + > + return 0; > +} > +#endif > + > +static SIMPLE_DEV_PM_OPS(imx_drm_pm_ops, imx_drm_suspend, imx_drm_resume); > + > static const struct of_device_id imx_drm_dt_ids[] = { > { .compatible = "fsl,imx-display-subsystem", }, > { /* sentinel */ }, > @@ -708,6 +731,7 @@ static struct platform_driver imx_drm_pdrv = { > .driver = { > .owner = THIS_MODULE, > .name = "imx-drm", > + .pm = &imx_drm_pm_ops, > .of_match_table = imx_drm_dt_ids, > }, > }; >