mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] mfd: wm8994: Restore pin configuration after reset during suspend
@ 2012-06-11 16:43 Mark Brown
  2012-07-02 11:09 ` Samuel Ortiz
  0 siblings, 1 reply; 2+ messages in thread
From: Mark Brown @ 2012-06-11 16:43 UTC (permalink / raw)
  To: Samuel Ortiz; +Cc: linux-kernel, patches, Chris Rattray, Mark Brown

From: Chris Rattray <crattray@opensource.wolfsonmicro.com>

Ensure that we leave the device with the pins in the expected
configuration if we leave it in reset over suspend, avoiding any
interoperation problems with other devices in the system.

Signed-off-by: Chris Rattray <crattray@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
---
 drivers/mfd/wm8994-core.c |   13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/drivers/mfd/wm8994-core.c b/drivers/mfd/wm8994-core.c
index 1e321d3..f75cdcc 100644
--- a/drivers/mfd/wm8994-core.c
+++ b/drivers/mfd/wm8994-core.c
@@ -196,6 +196,7 @@ static int wm8994_suspend(struct device *dev)
 {
 	struct wm8994 *wm8994 = dev_get_drvdata(dev);
 	int ret;
+	int gpio_regs[WM8994_NUM_GPIO_REGS];
 
 	/* Don't actually go through with the suspend if the CODEC is
 	 * still active (eg, for audio passthrough from CP. */
@@ -277,12 +278,24 @@ static int wm8994_suspend(struct device *dev)
 				WM8994_LDO1ENA_PD | WM8994_LDO2ENA_PD,
 				WM8994_LDO1ENA_PD | WM8994_LDO2ENA_PD);
 
+	/* Save GPIO registers before reset */
+	regmap_bulk_read(wm8994->regmap, WM8994_GPIO_1, gpio_regs,
+			 WM8994_NUM_GPIO_REGS);
+
 	/* Explicitly put the device into reset in case regulators
 	 * don't get disabled in order to ensure consistent restart.
 	 */
 	wm8994_reg_write(wm8994, WM8994_SOFTWARE_RESET,
 			 wm8994_reg_read(wm8994, WM8994_SOFTWARE_RESET));
 
+	/* Restore GPIO registers to prevent problems with mismatched
+	 * pin configurations.
+	 */
+	ret = regmap_bulk_write(wm8994->regmap, WM8994_GPIO_1, gpio_regs,
+				WM8994_NUM_GPIO_REGS);
+	if (ret != 0)
+		dev_err(dev, "Failed to restore GPIO registers: %d\n", ret);
+
 	regcache_cache_only(wm8994->regmap, true);
 	regcache_mark_dirty(wm8994->regmap);
 
-- 
1.7.10


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

* Re: [PATCH] mfd: wm8994: Restore pin configuration after reset during suspend
  2012-06-11 16:43 [PATCH] mfd: wm8994: Restore pin configuration after reset during suspend Mark Brown
@ 2012-07-02 11:09 ` Samuel Ortiz
  0 siblings, 0 replies; 2+ messages in thread
From: Samuel Ortiz @ 2012-07-02 11:09 UTC (permalink / raw)
  To: Mark Brown; +Cc: linux-kernel, patches, Chris Rattray

Hi Mark,

On Tue, Jun 12, 2012 at 12:43:35AM +0800, Mark Brown wrote:
> From: Chris Rattray <crattray@opensource.wolfsonmicro.com>
> 
> Ensure that we leave the device with the pins in the expected
> configuration if we leave it in reset over suspend, avoiding any
> interoperation problems with other devices in the system.
> 
> Signed-off-by: Chris Rattray <crattray@opensource.wolfsonmicro.com>
> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
> ---
>  drivers/mfd/wm8994-core.c |   13 +++++++++++++
>  1 file changed, 13 insertions(+)
Patch applied, thanks.

Cheers,
Samuel.

-- 
Intel Open Source Technology Centre
http://oss.intel.com/

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

end of thread, other threads:[~2012-07-02 10:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-11 16:43 [PATCH] mfd: wm8994: Restore pin configuration after reset during suspend Mark Brown
2012-07-02 11:09 ` Samuel Ortiz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®