diff options
-rw-r--r-- | drivers/base/regmap/regmap-irq.c | 21 | ||||
-rw-r--r-- | 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 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); |
diff --git a/include/linux/regmap.h b/include/linux/regmap.h index b7e95bf942c9..8c0b50df3d59 100644 --- a/include/linux/regmap.h +++ b/include/linux/regmap.h | |||
@@ -381,6 +381,7 @@ struct regmap_irq_chip { | |||
381 | unsigned int wake_base; | 381 | unsigned int wake_base; |
382 | unsigned int irq_reg_stride; | 382 | unsigned int irq_reg_stride; |
383 | unsigned int mask_invert; | 383 | unsigned int mask_invert; |
384 | unsigned int wake_invert; | ||
384 | bool runtime_pm; | 385 | bool runtime_pm; |
385 | 386 | ||
386 | int num_regs; | 387 | int num_regs; |