linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] mfd: wm8994: Use regcache_sync_region() to sync GPIO registers on suspend
@ 2012-06-29 13:55 Mark Brown
  2012-06-29 13:55 ` [PATCH 2/2] mfd: wm8994: Also restore GPIO IRQ masks after reset Mark Brown
  2012-07-08 22:34 ` [PATCH 1/2] mfd: wm8994: Use regcache_sync_region() to sync GPIO registers on suspend Samuel Ortiz
  0 siblings, 2 replies; 4+ messages in thread
From: Mark Brown @ 2012-06-29 13:55 UTC (permalink / raw)
  To: Samuel Ortiz; +Cc: linux-kernel, patches, Mark Brown

Now we have regcache sync region we can use it to do a more efficient
sync of the pin configuration after we reset the device during suspend.

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

diff --git a/drivers/mfd/wm8994-core.c b/drivers/mfd/wm8994-core.c
index f75cdcc..53293c7 100644
--- a/drivers/mfd/wm8994-core.c
+++ b/drivers/mfd/wm8994-core.c
@@ -196,7 +196,6 @@ 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. */
@@ -278,27 +277,23 @@ 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));
 
+	regcache_mark_dirty(wm8994->regmap);
+
 	/* 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);
+	ret = regcache_sync_region(wm8994->regmap, WM8994_GPIO_1,
+				   WM8994_GPIO_11);
 	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);
-
 	wm8994->suspended = true;
 
 	ret = regulator_bulk_disable(wm8994->num_supplies,
-- 
1.7.10


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

* [PATCH 2/2] mfd: wm8994: Also restore GPIO IRQ masks after reset
  2012-06-29 13:55 [PATCH 1/2] mfd: wm8994: Use regcache_sync_region() to sync GPIO registers on suspend Mark Brown
@ 2012-06-29 13:55 ` Mark Brown
  2012-07-08 22:34   ` Samuel Ortiz
  2012-07-08 22:34 ` [PATCH 1/2] mfd: wm8994: Use regcache_sync_region() to sync GPIO registers on suspend Samuel Ortiz
  1 sibling, 1 reply; 4+ messages in thread
From: Mark Brown @ 2012-06-29 13:55 UTC (permalink / raw)
  To: Samuel Ortiz; +Cc: linux-kernel, patches, Mark Brown

This ensures that if we are using a GPIO as a wake source it continues to
function while we're suspended.

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

diff --git a/drivers/mfd/wm8994-core.c b/drivers/mfd/wm8994-core.c
index 53293c7..eec74aa 100644
--- a/drivers/mfd/wm8994-core.c
+++ b/drivers/mfd/wm8994-core.c
@@ -293,6 +293,13 @@ static int wm8994_suspend(struct device *dev)
 	if (ret != 0)
 		dev_err(dev, "Failed to restore GPIO registers: %d\n", ret);
 
+	/* In case one of the GPIOs is used as a wake input. */
+	ret = regcache_sync_region(wm8994->regmap,
+				   WM8994_INTERRUPT_STATUS_1_MASK,
+				   WM8994_INTERRUPT_STATUS_1_MASK);
+	if (ret != 0)
+		dev_err(dev, "Failed to restore interrupt mask: %d\n", ret);
+
 	regcache_cache_only(wm8994->regmap, true);
 	wm8994->suspended = true;
 
-- 
1.7.10


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

* Re: [PATCH 1/2] mfd: wm8994: Use regcache_sync_region() to sync GPIO registers on suspend
  2012-06-29 13:55 [PATCH 1/2] mfd: wm8994: Use regcache_sync_region() to sync GPIO registers on suspend Mark Brown
  2012-06-29 13:55 ` [PATCH 2/2] mfd: wm8994: Also restore GPIO IRQ masks after reset Mark Brown
@ 2012-07-08 22:34 ` Samuel Ortiz
  1 sibling, 0 replies; 4+ messages in thread
From: Samuel Ortiz @ 2012-07-08 22:34 UTC (permalink / raw)
  To: Mark Brown; +Cc: linux-kernel, patches

Hi Mark,

On Fri, Jun 29, 2012 at 02:55:39PM +0100, Mark Brown wrote:
> Now we have regcache sync region we can use it to do a more efficient
> sync of the pin configuration after we reset the device during suspend.
> 
> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
> ---
>  drivers/mfd/wm8994-core.c |   13 ++++---------
>  1 file changed, 4 insertions(+), 9 deletions(-)
Applied, thanks.

Cheers,
Samuel.

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

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

* Re: [PATCH 2/2] mfd: wm8994: Also restore GPIO IRQ masks after reset
  2012-06-29 13:55 ` [PATCH 2/2] mfd: wm8994: Also restore GPIO IRQ masks after reset Mark Brown
@ 2012-07-08 22:34   ` Samuel Ortiz
  0 siblings, 0 replies; 4+ messages in thread
From: Samuel Ortiz @ 2012-07-08 22:34 UTC (permalink / raw)
  To: Mark Brown; +Cc: linux-kernel, patches

Hi Mark,

On Fri, Jun 29, 2012 at 02:55:40PM +0100, Mark Brown wrote:
> This ensures that if we are using a GPIO as a wake source it continues to
> function while we're suspended.
> 
> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
> ---
>  drivers/mfd/wm8994-core.c |    7 +++++++
>  1 file changed, 7 insertions(+)
Applied as well, thanks.

Cheers,
Samuel.

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

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

end of thread, other threads:[~2012-07-08 22:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-29 13:55 [PATCH 1/2] mfd: wm8994: Use regcache_sync_region() to sync GPIO registers on suspend Mark Brown
2012-06-29 13:55 ` [PATCH 2/2] mfd: wm8994: Also restore GPIO IRQ masks after reset Mark Brown
2012-07-08 22:34   ` Samuel Ortiz
2012-07-08 22:34 ` [PATCH 1/2] mfd: wm8994: Use regcache_sync_region() to sync GPIO registers on suspend Samuel Ortiz

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