Skip to contentSkip to conversation

mfd: intel-lpss: save register context on suspend

PATCH Superseded Andy Shevchenko 3 participants 4 messages Mar 30, 2016 – Apr 18, 2016

Subsystems (2)

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

Andy Shevchenko

author reviewer
#0 lore raw

PATCH v3 1/1 mfd: intel-lpss: save register context on suspend

From: Heikki Krogerus <[email protected]>

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.

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

 drivers/mfd/intel-lpss.c | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)
drivers/mfd/intel-lpss.c +18 -1
index 1bbbe87..807a3e3 100644
@@ -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;
 }
Signature · 1 line
2.8.0.rc3
#1 lore raw

Hi,

Quoted 9 lines · Andy Shevchenko

From: Heikki Krogerus <[email protected]>

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.

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

Quoted 4 lines

---
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: [email protected]".

Cheers,

Signature · 1 line
heikki
author reviewer
#2 lore raw
Quoted 16 lines · Heikki Krogerus

Hi,

Quoted 10 lines · Andy Shevchenko

From: Heikki Krogerus <[email protected]>

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.

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

Quoted 1 line
Quoted 6 lines
Quoted 4 lines

---
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: [email protected]".

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

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

Signature · 2 lines
Andy Shevchenko <[email protected]>
Intel Finland Oy
#3 lore raw
Quoted 21 lines · Andy Shevchenko
Quoted 20 lines · Heikki Krogerus

Hi,

Quoted 10 lines · Andy Shevchenko

From: Heikki Krogerus <[email protected]>

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.

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

Quoted 5 lines

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

Quoted 6 lines
Quoted 2 lines

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: [email protected]".

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.

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