linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 1/1] mfd: intel-lpss: save register context on suspend
@ 2016-03-30 13:35 Andy Shevchenko
  2016-03-30 13:54 ` Heikki Krogerus
  0 siblings, 1 reply; 4+ messages in thread
From: Andy Shevchenko @ 2016-03-30 13:35 UTC (permalink / raw)
  To: Heikki Krogerus, Mika Westerberg, Lee Jones, linux-kernel

From: Heikki Krogerus <heikki.krogerus@linux.intel.com>

All configurations are lost and the registers will have
default values when the hardware is suspended and resumed,
so saving the private register space context on suspend, and
restoring it on resume.

Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Acked-by: Lee Jones <lee.jones@linaro.org>
---
Since v2:
- add Ack
- remove Fixes tag
 drivers/mfd/intel-lpss.c | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/drivers/mfd/intel-lpss.c b/drivers/mfd/intel-lpss.c
index 1bbbe87..807a3e3 100644
--- a/drivers/mfd/intel-lpss.c
+++ b/drivers/mfd/intel-lpss.c
@@ -34,6 +34,7 @@
 #define LPSS_DEV_SIZE		0x200
 #define LPSS_PRIV_OFFSET	0x200
 #define LPSS_PRIV_SIZE		0x100
+#define LPSS_PRIV_REG_COUNT	(LPSS_PRIV_SIZE / 4)
 #define LPSS_IDMA64_OFFSET	0x800
 #define LPSS_IDMA64_SIZE	0x800
 
@@ -76,6 +77,7 @@ struct intel_lpss {
 	struct mfd_cell *cell;
 	struct device *dev;
 	void __iomem *priv;
+	u32 priv_ctx[LPSS_PRIV_REG_COUNT];
 	int devid;
 	u32 caps;
 	u32 active_ltr;
@@ -493,6 +495,16 @@ EXPORT_SYMBOL_GPL(intel_lpss_prepare);
 
 int intel_lpss_suspend(struct device *dev)
 {
+	struct intel_lpss *lpss = dev_get_drvdata(dev);
+	unsigned int i;
+
+	/* Save device context */
+	for (i = 0; i < LPSS_PRIV_REG_COUNT; i++)
+		lpss->priv_ctx[i] = readl(lpss->priv + i * 4);
+
+	/* Put the device into reset state */
+	writel(0, lpss->priv + LPSS_PRIV_RESETS);
+
 	return 0;
 }
 EXPORT_SYMBOL_GPL(intel_lpss_suspend);
@@ -500,8 +512,13 @@ EXPORT_SYMBOL_GPL(intel_lpss_suspend);
 int intel_lpss_resume(struct device *dev)
 {
 	struct intel_lpss *lpss = dev_get_drvdata(dev);
+	unsigned int i;
 
-	intel_lpss_init_dev(lpss);
+	intel_lpss_deassert_reset(lpss);
+
+	/* Restore device context */
+	for (i = 0; i < LPSS_PRIV_REG_COUNT; i++)
+		writel(lpss->priv_ctx[i], lpss->priv + i * 4);
 
 	return 0;
 }
-- 
2.8.0.rc3

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v3 1/1] mfd: intel-lpss: save register context on suspend
  2016-03-30 13:35 [PATCH v3 1/1] mfd: intel-lpss: save register context on suspend Andy Shevchenko
@ 2016-03-30 13:54 ` Heikki Krogerus
  2016-04-15 12:13   ` Andy Shevchenko
  0 siblings, 1 reply; 4+ messages in thread
From: Heikki Krogerus @ 2016-03-30 13:54 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: Mika Westerberg, Lee Jones, linux-kernel

Hi,

On Wed, Mar 30, 2016 at 04:35:46PM +0300, Andy Shevchenko wrote:
> From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
> 
> All configurations are lost and the registers will have
> default values when the hardware is suspended and resumed,
> so saving the private register space context on suspend, and
> restoring it on resume.
> 
> Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
> Acked-by: Lee Jones <lee.jones@linaro.org>

Lee's Ack? I'm confused? Who is meant to take this patch?

> ---
> Since v2:
> - add Ack
> - remove Fixes tag

Why? This is a fix. And it also needs to go into the stable trees as
well, so we will also need tag it with "Cc: stable@vger.kernel.org".


Cheers,

-- 
heikki

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v3 1/1] mfd: intel-lpss: save register context on suspend
  2016-03-30 13:54 ` Heikki Krogerus
@ 2016-04-15 12:13   ` Andy Shevchenko
  2016-04-18  7:48     ` Lee Jones
  0 siblings, 1 reply; 4+ messages in thread
From: Andy Shevchenko @ 2016-04-15 12:13 UTC (permalink / raw)
  To: Heikki Krogerus; +Cc: Mika Westerberg, Lee Jones, linux-kernel

On Wed, 2016-03-30 at 16:54 +0300, Heikki Krogerus wrote:
> Hi,
> 
> On Wed, Mar 30, 2016 at 04:35:46PM +0300, Andy Shevchenko wrote:
> > 
> > From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
> > 
> > All configurations are lost and the registers will have
> > default values when the hardware is suspended and resumed,
> > so saving the private register space context on suspend, and
> > restoring it on resume.
> > 
> > Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
> > Acked-by: Lee Jones <lee.jones@linaro.org>
> Lee's Ack? I'm confused? Who is meant to take this patch?
> 
> > 
> > ---
> > Since v2:
> > - add Ack
> > - remove Fixes tag
> Why? This is a fix. And it also needs to go into the stable trees as
> well, so we will also need tag it with "Cc: stable@vger.kernel.org".

So, in that case v2 is what you want, right?

Lee, do I need to resend v2 as v4 or something else is required?

-- 
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Intel Finland Oy

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v3 1/1] mfd: intel-lpss: save register context on suspend
  2016-04-15 12:13   ` Andy Shevchenko
@ 2016-04-18  7:48     ` Lee Jones
  0 siblings, 0 replies; 4+ messages in thread
From: Lee Jones @ 2016-04-18  7:48 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: Heikki Krogerus, Mika Westerberg, linux-kernel

On Fri, 15 Apr 2016, Andy Shevchenko wrote:

> On Wed, 2016-03-30 at 16:54 +0300, Heikki Krogerus wrote:
> > Hi,
> > 
> > On Wed, Mar 30, 2016 at 04:35:46PM +0300, Andy Shevchenko wrote:
> > > 
> > > From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
> > > 
> > > All configurations are lost and the registers will have
> > > default values when the hardware is suspended and resumed,
> > > so saving the private register space context on suspend, and
> > > restoring it on resume.
> > > 
> > > Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
> > > Acked-by: Lee Jones <lee.jones@linaro.org>
> > Lee's Ack? I'm confused? Who is meant to take this patch?
> > 
> > > 
> > > ---
> > > Since v2:
> > > - add Ack
> > > - remove Fixes tag
> > Why? This is a fix. And it also needs to go into the stable trees as
> > well, so we will also need tag it with "Cc: stable@vger.kernel.org".
> 
> So, in that case v2 is what you want, right?
> 
> Lee, do I need to resend v2 as v4 or something else is required?

If you need a further change, please submit it as v4.

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-04-18  7:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-30 13:35 [PATCH v3 1/1] mfd: intel-lpss: save register context on suspend Andy Shevchenko
2016-03-30 13:54 ` Heikki Krogerus
2016-04-15 12:13   ` Andy Shevchenko
2016-04-18  7:48     ` Lee Jones

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).