public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/4] regmap: irq: Fix sync of wake statuses to hardware
@ 2013-01-04 17:19 Mark Brown
  2013-01-04 17:19 ` [PATCH 2/4] regmap: irq: Support wake IRQ mask inversion Mark Brown
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Mark Brown @ 2013-01-04 17:19 UTC (permalink / raw)
  To: Samuel Ortiz, linux-kernel; +Cc: patches, Mark Brown

This wasn't implemented but happened to work on test systems due to lack
of wake mask inversion support.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
---
 drivers/base/regmap/regmap-irq.c |   11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/drivers/base/regmap/regmap-irq.c b/drivers/base/regmap/regmap-irq.c
index 4eab586..7dabfc8 100644
--- a/drivers/base/regmap/regmap-irq.c
+++ b/drivers/base/regmap/regmap-irq.c
@@ -88,6 +88,17 @@ static void regmap_irq_sync_unlock(struct irq_data *data)
 		if (ret != 0)
 			dev_err(d->map->dev, "Failed to sync masks in %x\n",
 				reg);
+
+		reg = d->chip->wake_base +
+			(i * map->reg_stride * d->irq_reg_stride);
+		if (d->wake_buf) {
+			ret = regmap_update_bits(d->map, reg,
+					 d->mask_buf_def[i], d->wake_buf[i]);
+			if (ret != 0)
+				dev_err(d->map->dev,
+					"Failed to sync wakes in %x: %d\n",
+					reg, ret);
+		}
 	}
 
 	if (d->chip->runtime_pm)
-- 
1.7.10.4


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

* [PATCH 2/4] regmap: irq: Support wake IRQ mask inversion
  2013-01-04 17:19 [PATCH 1/4] regmap: irq: Fix sync of wake statuses to hardware Mark Brown
@ 2013-01-04 17:19 ` Mark Brown
  2013-01-04 17:19 ` [PATCH 3/4] mfd: wm5110: Mark wakes as inverted Mark Brown
  2013-01-04 17:19 ` [PATCH 4/4] mfd: wm5102: " Mark Brown
  2 siblings, 0 replies; 5+ messages in thread
From: Mark Brown @ 2013-01-04 17:19 UTC (permalink / raw)
  To: Samuel Ortiz, linux-kernel; +Cc: patches, Mark Brown

Support devices which have an enable rather than mask register for wake
sources.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
---
 drivers/base/regmap/regmap-irq.c |   21 +++++++++++++++++----
 include/linux/regmap.h           |    1 +
 2 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/drivers/base/regmap/regmap-irq.c b/drivers/base/regmap/regmap-irq.c
index 7dabfc8..9bbe5ba 100644
--- a/drivers/base/regmap/regmap-irq.c
+++ b/drivers/base/regmap/regmap-irq.c
@@ -92,8 +92,14 @@ static void regmap_irq_sync_unlock(struct irq_data *data)
 		reg = d->chip->wake_base +
 			(i * map->reg_stride * d->irq_reg_stride);
 		if (d->wake_buf) {
-			ret = regmap_update_bits(d->map, reg,
-					 d->mask_buf_def[i], d->wake_buf[i]);
+			if (d->chip->wake_invert)
+				ret = regmap_update_bits(d->map, reg,
+							 d->mask_buf_def[i],
+							 ~d->wake_buf[i]);
+			else
+				ret = regmap_update_bits(d->map, reg,
+							 d->mask_buf_def[i],
+							 d->wake_buf[i]);
 			if (ret != 0)
 				dev_err(d->map->dev,
 					"Failed to sync wakes in %x: %d\n",
@@ -417,8 +423,15 @@ int regmap_add_irq_chip(struct regmap *map, int irq, int irq_flags,
 			d->wake_buf[i] = d->mask_buf_def[i];
 			reg = chip->wake_base +
 				(i * map->reg_stride * d->irq_reg_stride);
-			ret = regmap_update_bits(map, reg, d->wake_buf[i],
-						 d->wake_buf[i]);
+
+			if (chip->wake_invert)
+				ret = regmap_update_bits(map, reg,
+							 d->mask_buf_def[i],
+							 0);
+			else
+				ret = regmap_update_bits(map, reg,
+							 d->mask_buf_def[i],
+							 d->wake_buf[i]);
 			if (ret != 0) {
 				dev_err(map->dev, "Failed to set masks in 0x%x: %d\n",
 					reg, ret);
diff --git a/include/linux/regmap.h b/include/linux/regmap.h
index 390d879..5e81abf 100644
--- a/include/linux/regmap.h
+++ b/include/linux/regmap.h
@@ -382,6 +382,7 @@ struct regmap_irq_chip {
 	unsigned int wake_base;
 	unsigned int irq_reg_stride;
 	unsigned int mask_invert;
+	unsigned int wake_invert;
 	bool runtime_pm;
 
 	int num_regs;
-- 
1.7.10.4


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

* [PATCH 3/4] mfd: wm5110: Mark wakes as inverted
  2013-01-04 17:19 [PATCH 1/4] regmap: irq: Fix sync of wake statuses to hardware Mark Brown
  2013-01-04 17:19 ` [PATCH 2/4] regmap: irq: Support wake IRQ mask inversion Mark Brown
@ 2013-01-04 17:19 ` Mark Brown
  2013-01-22  3:30   ` Samuel Ortiz
  2013-01-04 17:19 ` [PATCH 4/4] mfd: wm5102: " Mark Brown
  2 siblings, 1 reply; 5+ messages in thread
From: Mark Brown @ 2013-01-04 17:19 UTC (permalink / raw)
  To: Samuel Ortiz, linux-kernel; +Cc: patches, Mark Brown

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
---

Seems sensible to merge this via regmap given that it uses the new
feature?

 drivers/mfd/wm5110-tables.c |    1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/mfd/wm5110-tables.c b/drivers/mfd/wm5110-tables.c
index 59614d0..d0fb5b4 100644
--- a/drivers/mfd/wm5110-tables.c
+++ b/drivers/mfd/wm5110-tables.c
@@ -255,6 +255,7 @@ const struct regmap_irq_chip wm5110_aod = {
 	.mask_base = ARIZONA_AOD_IRQ_MASK_IRQ1,
 	.ack_base = ARIZONA_AOD_IRQ1,
 	.wake_base = ARIZONA_WAKE_CONTROL,
+	.wake_invert = 1,
 	.num_regs = 1,
 	.irqs = wm5110_aod_irqs,
 	.num_irqs = ARRAY_SIZE(wm5110_aod_irqs),
-- 
1.7.10.4


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

* [PATCH 4/4] mfd: wm5102: Mark wakes as inverted
  2013-01-04 17:19 [PATCH 1/4] regmap: irq: Fix sync of wake statuses to hardware Mark Brown
  2013-01-04 17:19 ` [PATCH 2/4] regmap: irq: Support wake IRQ mask inversion Mark Brown
  2013-01-04 17:19 ` [PATCH 3/4] mfd: wm5110: Mark wakes as inverted Mark Brown
@ 2013-01-04 17:19 ` Mark Brown
  2 siblings, 0 replies; 5+ messages in thread
From: Mark Brown @ 2013-01-04 17:19 UTC (permalink / raw)
  To: Samuel Ortiz, linux-kernel; +Cc: patches, Mark Brown

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
---

Seems sensible to merge this via regmap given that it uses the new 
feature?

 drivers/mfd/wm5102-tables.c |    1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/mfd/wm5102-tables.c b/drivers/mfd/wm5102-tables.c
index 277bc61..acce284 100644
--- a/drivers/mfd/wm5102-tables.c
+++ b/drivers/mfd/wm5102-tables.c
@@ -103,6 +103,7 @@ const struct regmap_irq_chip wm5102_aod = {
 	.mask_base = ARIZONA_AOD_IRQ_MASK_IRQ1,
 	.ack_base = ARIZONA_AOD_IRQ1,
 	.wake_base = ARIZONA_WAKE_CONTROL,
+	.wake_invert = 1,
 	.num_regs = 1,
 	.irqs = wm5102_aod_irqs,
 	.num_irqs = ARRAY_SIZE(wm5102_aod_irqs),
-- 
1.7.10.4


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

* Re: [PATCH 3/4] mfd: wm5110: Mark wakes as inverted
  2013-01-04 17:19 ` [PATCH 3/4] mfd: wm5110: Mark wakes as inverted Mark Brown
@ 2013-01-22  3:30   ` Samuel Ortiz
  0 siblings, 0 replies; 5+ messages in thread
From: Samuel Ortiz @ 2013-01-22  3:30 UTC (permalink / raw)
  To: Mark Brown; +Cc: linux-kernel, patches

Hi Mark,

On Fri, Jan 04, 2013 at 05:19:16PM +0000, Mark Brown wrote:
> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
> ---
> 
> Seems sensible to merge this via regmap given that it uses the new
> feature?
Definitely:

Acked-by: Samuel Ortiz <sameo@linux.intel.com>

Cheers,
Samuel.

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

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

end of thread, other threads:[~2013-01-22  3:30 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-04 17:19 [PATCH 1/4] regmap: irq: Fix sync of wake statuses to hardware Mark Brown
2013-01-04 17:19 ` [PATCH 2/4] regmap: irq: Support wake IRQ mask inversion Mark Brown
2013-01-04 17:19 ` [PATCH 3/4] mfd: wm5110: Mark wakes as inverted Mark Brown
2013-01-22  3:30   ` Samuel Ortiz
2013-01-04 17:19 ` [PATCH 4/4] mfd: wm5102: " Mark Brown

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