linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Leonard Crestez <leonard.crestez@nxp.com>
To: Stefan Agner <stefan@agner.ch>,
	Philipp Zabel <p.zabel@pengutronix.de>,
	Marek Vasut <marex@denx.de>
Cc: Shawn Guo <shawnguo@kernel.org>,
	Fabio Estevam <fabio.estevam@nxp.com>,
	Robert Chiras <robert.chiras@nxp.com>,
	Mirela Rabulea <mirela.rabulea@nxp.com>,
	Anson Huang <Anson.Huang@nxp.com>,
	dri-devel@lists.freedesktop.org,
	Dong Aisheng <aisheng.dong@nxp.com>,
	linux-imx@nxp.com, kernel@pengutronix.de,
	linux-kernel@vger.kernel.org
Subject: [PATCH v3 3/4] drm/mxsfb: Add PM_SLEEP support
Date: Mon,  6 Aug 2018 22:31:09 +0300	[thread overview]
Message-ID: <948022edecc7af494e8bb6f55bc4ddbc33c74e3c.1533583611.git.leonard.crestez@nxp.com> (raw)
In-Reply-To: <cover.1533583611.git.leonard.crestez@nxp.com>

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>
---
 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
+
+static const struct dev_pm_ops mxsfb_pm_ops = {
+       SET_SYSTEM_SLEEP_PM_OPS(mxsfb_suspend, mxsfb_resume)
+};
+
 static struct platform_driver mxsfb_platform_driver = {
 	.probe		= mxsfb_probe,
 	.remove		= mxsfb_remove,
 	.id_table	= mxsfb_devtype,
 	.driver	= {
 		.name		= "mxsfb",
 		.of_match_table	= mxsfb_dt_ids,
+		.pm		= &mxsfb_pm_ops,
 	},
 };
 
 module_platform_driver(mxsfb_platform_driver);
 
-- 
2.17.1


  parent reply	other threads:[~2018-08-06 19:31 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-06 19:31 [PATCH v3 0/4] drm/mxsfb: Fix runtime PM for unpowering lcdif block Leonard Crestez
2018-08-06 19:31 ` [PATCH v3 1/4] drm/mxsfb: Fix initial corrupt frame when activating display Leonard Crestez
2018-08-07 10:53   ` Philipp Zabel
2018-08-07 18:29   ` Stefan Agner
2018-08-06 19:31 ` [PATCH v3 2/4] drm/mxsfb: Add pm_runtime calls to pipe_enable/disable Leonard Crestez
2018-08-07 18:32   ` Stefan Agner
2018-08-06 19:31 ` Leonard Crestez [this message]
2018-08-07 18:41   ` [PATCH v3 3/4] drm/mxsfb: Add PM_SLEEP support Stefan Agner
2018-08-06 19:31 ` [PATCH v3 4/4] drm/mxsfb: Switch to drm_atomic_helper_commit_tail_rpm Leonard Crestez
2018-08-07 19:01   ` Stefan Agner
2018-08-08  8:00     ` Leonard Crestez
2018-08-08 12:30       ` Stefan Agner

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=948022edecc7af494e8bb6f55bc4ddbc33c74e3c.1533583611.git.leonard.crestez@nxp.com \
    --to=leonard.crestez@nxp.com \
    --cc=Anson.Huang@nxp.com \
    --cc=aisheng.dong@nxp.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=fabio.estevam@nxp.com \
    --cc=kernel@pengutronix.de \
    --cc=linux-imx@nxp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marex@denx.de \
    --cc=mirela.rabulea@nxp.com \
    --cc=p.zabel@pengutronix.de \
    --cc=robert.chiras@nxp.com \
    --cc=shawnguo@kernel.org \
    --cc=stefan@agner.ch \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).