From: sam@ravnborg.org (Sam Ravnborg)
To: linux-arm-kernel@lists.infradead.org
Subject: [RESEND 4/5] drm/mxsfb: Add PM_SLEEP support
Date: Mon, 17 Sep 2018 21:37:48 +0200 [thread overview]
Message-ID: <20180917193748.GA13165@ravnborg.org> (raw)
In-Reply-To: <7d661819825a36f4aebe412e7bed8fe24c7292ae.1535367027.git.leonard.crestez@nxp.com>
Hi Leonard.
On Mon, Aug 27, 2018 at 02:10:40PM +0300, Leonard Crestez wrote:
> Since power to the lcdif block can be lost on suspend implement
> PM_SLEEP_OPS using drm_mode_config_helper_suspend/resume to save/restore
> the current mode.
>
> Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
> Reviewed-by: Stefan Agner <stefan@agner.ch>
> ---
> drivers/gpu/drm/mxsfb/mxsfb_drv.c | 21 +++++++++++++++++++++
> 1 file changed, 21 insertions(+)
>
> diff --git a/drivers/gpu/drm/mxsfb/mxsfb_drv.c b/drivers/gpu/drm/mxsfb/mxsfb_drv.c
> index 68d79f5dc0d3..d797dfd40d98 100644
> --- a/drivers/gpu/drm/mxsfb/mxsfb_drv.c
> +++ b/drivers/gpu/drm/mxsfb/mxsfb_drv.c
> @@ -416,17 +416,38 @@ static int mxsfb_remove(struct platform_device *pdev)
> drm_dev_unref(drm);
>
> return 0;
> }
>
> +#ifdef CONFIG_PM_SLEEP
> +static int mxsfb_suspend(struct device *dev)
> +{
> + struct drm_device *drm = dev_get_drvdata(dev);
> +
> + return drm_mode_config_helper_suspend(drm);
> +}
> +
> +static int mxsfb_resume(struct device *dev)
> +{
> + struct drm_device *drm = dev_get_drvdata(dev);
> +
> + return drm_mode_config_helper_resume(drm);
> +}
> +#endif
Other suspend/resume users skip the #ifdef and declare
the functions __maybe_unused
See for example arm/hdlcd_drv.c.
The resulting code is a bit simpler to read and you
have the added benefit that the suspend/resume functions
are always compiled so bit-rotting is less likely.
Sam
WARNING: multiple messages have this Message-ID (diff)
From: Sam Ravnborg <sam@ravnborg.org>
To: Leonard Crestez <leonard.crestez@nxp.com>
Cc: Marek Vasut <marex@denx.de>, Dong Aisheng <aisheng.dong@nxp.com>,
kernel@pengutronix.de, David Airlie <airlied@linux.ie>,
linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
Fabio Estevam <fabio.estevam@nxp.com>,
linux-imx@nxp.com, Robert Chiras <robert.chiras@nxp.com>,
Marco Franchi <marco.franchi@nxp.com>,
Shawn Guo <shawnguo@kernel.org>,
linux-arm-kernel@lists.infradead.org
Subject: Re: [RESEND 4/5] drm/mxsfb: Add PM_SLEEP support
Date: Mon, 17 Sep 2018 21:37:48 +0200 [thread overview]
Message-ID: <20180917193748.GA13165@ravnborg.org> (raw)
In-Reply-To: <7d661819825a36f4aebe412e7bed8fe24c7292ae.1535367027.git.leonard.crestez@nxp.com>
Hi Leonard.
On Mon, Aug 27, 2018 at 02:10:40PM +0300, Leonard Crestez wrote:
> Since power to the lcdif block can be lost on suspend implement
> PM_SLEEP_OPS using drm_mode_config_helper_suspend/resume to save/restore
> the current mode.
>
> Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
> Reviewed-by: Stefan Agner <stefan@agner.ch>
> ---
> drivers/gpu/drm/mxsfb/mxsfb_drv.c | 21 +++++++++++++++++++++
> 1 file changed, 21 insertions(+)
>
> diff --git a/drivers/gpu/drm/mxsfb/mxsfb_drv.c b/drivers/gpu/drm/mxsfb/mxsfb_drv.c
> index 68d79f5dc0d3..d797dfd40d98 100644
> --- a/drivers/gpu/drm/mxsfb/mxsfb_drv.c
> +++ b/drivers/gpu/drm/mxsfb/mxsfb_drv.c
> @@ -416,17 +416,38 @@ static int mxsfb_remove(struct platform_device *pdev)
> drm_dev_unref(drm);
>
> return 0;
> }
>
> +#ifdef CONFIG_PM_SLEEP
> +static int mxsfb_suspend(struct device *dev)
> +{
> + struct drm_device *drm = dev_get_drvdata(dev);
> +
> + return drm_mode_config_helper_suspend(drm);
> +}
> +
> +static int mxsfb_resume(struct device *dev)
> +{
> + struct drm_device *drm = dev_get_drvdata(dev);
> +
> + return drm_mode_config_helper_resume(drm);
> +}
> +#endif
Other suspend/resume users skip the #ifdef and declare
the functions __maybe_unused
See for example arm/hdlcd_drv.c.
The resulting code is a bit simpler to read and you
have the added benefit that the suspend/resume functions
are always compiled so bit-rotting is less likely.
Sam
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
WARNING: multiple messages have this Message-ID (diff)
From: Sam Ravnborg <sam@ravnborg.org>
To: Leonard Crestez <leonard.crestez@nxp.com>
Cc: Marek Vasut <marex@denx.de>,
Philipp Zabel <p.zabel@pengutronix.de>,
Dong Aisheng <aisheng.dong@nxp.com>,
David Airlie <airlied@linux.ie>,
linux-kernel@vger.kernel.org,
Robert Chiras <robert.chiras@nxp.com>,
dri-devel@lists.freedesktop.org, kernel@pengutronix.de,
Fabio Estevam <fabio.estevam@nxp.com>,
Marco Franchi <marco.franchi@nxp.com>,
Shawn Guo <shawnguo@kernel.org>,
linux-arm-kernel@lists.infradead.org, linux-imx@nxp.com
Subject: Re: [RESEND 4/5] drm/mxsfb: Add PM_SLEEP support
Date: Mon, 17 Sep 2018 21:37:48 +0200 [thread overview]
Message-ID: <20180917193748.GA13165@ravnborg.org> (raw)
In-Reply-To: <7d661819825a36f4aebe412e7bed8fe24c7292ae.1535367027.git.leonard.crestez@nxp.com>
Hi Leonard.
On Mon, Aug 27, 2018 at 02:10:40PM +0300, Leonard Crestez wrote:
> Since power to the lcdif block can be lost on suspend implement
> PM_SLEEP_OPS using drm_mode_config_helper_suspend/resume to save/restore
> the current mode.
>
> Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
> Reviewed-by: Stefan Agner <stefan@agner.ch>
> ---
> drivers/gpu/drm/mxsfb/mxsfb_drv.c | 21 +++++++++++++++++++++
> 1 file changed, 21 insertions(+)
>
> diff --git a/drivers/gpu/drm/mxsfb/mxsfb_drv.c b/drivers/gpu/drm/mxsfb/mxsfb_drv.c
> index 68d79f5dc0d3..d797dfd40d98 100644
> --- a/drivers/gpu/drm/mxsfb/mxsfb_drv.c
> +++ b/drivers/gpu/drm/mxsfb/mxsfb_drv.c
> @@ -416,17 +416,38 @@ static int mxsfb_remove(struct platform_device *pdev)
> drm_dev_unref(drm);
>
> return 0;
> }
>
> +#ifdef CONFIG_PM_SLEEP
> +static int mxsfb_suspend(struct device *dev)
> +{
> + struct drm_device *drm = dev_get_drvdata(dev);
> +
> + return drm_mode_config_helper_suspend(drm);
> +}
> +
> +static int mxsfb_resume(struct device *dev)
> +{
> + struct drm_device *drm = dev_get_drvdata(dev);
> +
> + return drm_mode_config_helper_resume(drm);
> +}
> +#endif
Other suspend/resume users skip the #ifdef and declare
the functions __maybe_unused
See for example arm/hdlcd_drv.c.
The resulting code is a bit simpler to read and you
have the added benefit that the suspend/resume functions
are always compiled so bit-rotting is less likely.
Sam
next prev parent reply other threads:[~2018-09-17 19:37 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-27 11:10 [RESEND 0/5] drm/mxsfb: Fix runtime PM for unpowering lcdif block Leonard Crestez
2018-08-27 11:10 ` Leonard Crestez
2018-08-27 11:10 ` [RESEND 1/5] drm/mxsfb: Move axi clk enable/disable to crtc enable/disable Leonard Crestez
2018-08-27 11:10 ` Leonard Crestez
2018-08-27 11:10 ` [RESEND 2/5] drm/mxsfb: Fix initial corrupt frame when activating display Leonard Crestez
2018-08-27 11:10 ` Leonard Crestez
2018-08-27 11:10 ` [RESEND 3/5] drm/mxsfb: Add pm_runtime calls to pipe_enable/disable Leonard Crestez
2018-08-27 11:10 ` Leonard Crestez
2018-08-27 11:10 ` [RESEND 4/5] drm/mxsfb: Add PM_SLEEP support Leonard Crestez
2018-08-27 11:10 ` Leonard Crestez
2018-09-17 19:37 ` Sam Ravnborg [this message]
2018-09-17 19:37 ` Sam Ravnborg
2018-09-17 19:37 ` Sam Ravnborg
2018-08-27 11:10 ` [RESEND 5/5] drm/mxsfb: Switch to drm_atomic_helper_commit_tail_rpm Leonard Crestez
2018-08-27 11:10 ` Leonard Crestez
2018-08-27 12:02 ` [RESEND 0/5] drm/mxsfb: Fix runtime PM for unpowering lcdif block Philipp Zabel
2018-08-27 12:02 ` Philipp Zabel
2018-08-27 12:02 ` Philipp Zabel
2018-09-03 13:51 ` Leonard Crestez
2018-09-03 13:51 ` Leonard Crestez
-- strict thread matches above, loose matches on Subject: below --
2018-09-17 13:42 Leonard Crestez
2018-09-17 13:42 ` [RESEND 4/5] drm/mxsfb: Add PM_SLEEP support Leonard Crestez
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180917193748.GA13165@ravnborg.org \
--to=sam@ravnborg.org \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.