[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1357319957-11480-2-git-send-email-broonie@opensource.wolfsonmicro.com>
Date: Fri, 4 Jan 2013 17:19:15 +0000
From: Mark Brown <broonie@...nsource.wolfsonmicro.com>
To: Samuel Ortiz <sameo@...ux.intel.com>, linux-kernel@...r.kernel.org
Cc: patches@...nsource.wolfsonmicro.com,
Mark Brown <broonie@...nsource.wolfsonmicro.com>
Subject: [PATCH 2/4] 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@...nsource.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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists