aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2013-01-04 11:35:07 -0500
committerMark Brown <broonie@opensource.wolfsonmicro.com>2013-01-04 15:53:44 -0500
commit9442490a02867088bcd5ed6231fa3b35a733c2b8 (patch)
treef086d7f0acc384c6765f80b85bf8541104252ed5 /drivers/base
parent33be49324f7f3e9dff10d3d07a5c78ee82f8d54e (diff)
regmap: irq: Support wake IRQ mask inversion
Support devices which have an enable rather than mask register for wake sources. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'drivers/base')
-rw-r--r--drivers/base/regmap/regmap-irq.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/drivers/base/regmap/regmap-irq.c b/drivers/base/regmap/regmap-irq.c
index be5579964be0..4706c63d0bc6 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)
92 reg = d->chip->wake_base + 92 reg = d->chip->wake_base +
93 (i * map->reg_stride * d->irq_reg_stride); 93 (i * map->reg_stride * d->irq_reg_stride);
94 if (d->wake_buf) { 94 if (d->wake_buf) {
95 ret = regmap_update_bits(d->map, reg, 95 if (d->chip->wake_invert)
96 d->mask_buf_def[i], d->wake_buf[i]); 96 ret = regmap_update_bits(d->map, reg,
97 d->mask_buf_def[i],
98 ~d->wake_buf[i]);
99 else
100 ret = regmap_update_bits(d->map, reg,
101 d->mask_buf_def[i],
102 d->wake_buf[i]);
97 if (ret != 0) 103 if (ret != 0)
98 dev_err(d->map->dev, 104 dev_err(d->map->dev,
99 "Failed to sync wakes in %x: %d\n", 105 "Failed to sync wakes in %x: %d\n",
@@ -419,8 +425,15 @@ int regmap_add_irq_chip(struct regmap *map, int irq, int irq_flags,
419 d->wake_buf[i] = d->mask_buf_def[i]; 425 d->wake_buf[i] = d->mask_buf_def[i];
420 reg = chip->wake_base + 426 reg = chip->wake_base +
421 (i * map->reg_stride * d->irq_reg_stride); 427 (i * map->reg_stride * d->irq_reg_stride);
422 ret = regmap_update_bits(map, reg, d->wake_buf[i], 428
423 d->wake_buf[i]); 429 if (chip->wake_invert)
430 ret = regmap_update_bits(map, reg,
431 d->mask_buf_def[i],
432 0);
433 else
434 ret = regmap_update_bits(map, reg,
435 d->mask_buf_def[i],
436 d->wake_buf[i]);
424 if (ret != 0) { 437 if (ret != 0) {
425 dev_err(map->dev, "Failed to set masks in 0x%x: %d\n", 438 dev_err(map->dev, "Failed to set masks in 0x%x: %d\n",
426 reg, ret); 439 reg, ret);