regmap: irq: Allow using zero value for ack_base
Subsystems (2)
PATCH 1/1 regmap: irq: Allow using zero value for ack_base
In some cases, clear interrupt register may be at address 0. This patch allows to use such configurations by adding additional configuration bit to indicate this.
--- drivers/base/regmap/regmap-irq.c | 6 +++--- include/linux/regmap.h | 5 ++++- 2 files changed, 7 insertions(+), 4 deletions(-)
drivers/base/regmap/regmap-irq.c +3 -3
@@ -113,7 +113,7 @@ static void regmap_irq_sync_unlock(struct irq_data *data)* OR if there is masked interrupt which hasn't been Acked, * it'll be ignored in irq handler, then may introduce irq storm */ -if (d->mask_buf[i] && d->chip->ack_base) { +if (d->mask_buf[i] && (d->chip->ack_base || d->chip->use_ack)) { reg = d->chip->ack_base + (i * map->reg_stride * d->irq_reg_stride); ret =regmap_write (map, reg, d->mask_buf[i]);
@@ -271,7 +271,7 @@ static irqreturn_t regmap_irq_thread(int irq, void *d)for (i =0 ; i < data->chip->num_regs; i++) { data->status_buf[i] &= ~data->mask_buf[i]; -if (data->status_buf[i] && chip->ack_base) { +if (data->status_buf[i] && (chip->ack_base || chip->use_ack)) { reg = chip->ack_base + (i * map->reg_stride * data->irq_reg_stride); ret =regmap_write (map, reg, data->status_buf[i]);
@@ -448,7 +448,7 @@ int regmap_add_irq_chip(struct regmap *map, int irq, int irq_flags, goto err_alloc; } -if (d->status_buf[i] && chip->ack_base) { +if (d->status_buf[i] && (chip->ack_base || chip->use_ack)) { reg = chip->ack_base + (i * map->reg_stride * d->irq_reg_stride); ret = regmap_write(map, reg,
include/linux/regmap.h +4 -1
@@ -497,11 +497,13 @@ struct regmap_irq {* * @status_base: Base status register address. * @mask_base: Base mask register address. -* @ack_base: Base ack address. If zero then the chip is clear on read. +* @ack_base: Base ack address. If zero then the chip is clear on read. +* Using zero value is possible with @use_ack bit. * @wake_base: Base address for wake enables. If zero unsupported. * @irq_reg_stride: Stride to use for chips where registers are not contiguous. * @init_ack_masked: Ack all masked interrupts once during initalization. * @mask_invert: Inverted mask register: cleared bits are masked out. +* @use_ack: Use @ack register even it zero. * @wake_invert: Inverted wake register: cleared bits are wake enabled. * @runtime_pm: Hold a runtime PM lock on the device when accessing it. *
@@ -520,6 +522,7 @@ struct regmap_irq_chip {unsigned int irq_reg_stride; bool init_ack_masked:1; bool mask_invert:1; + bool use_ack:1; bool wake_invert:1; bool runtime_pm:1;
Signature · 1 line
1.8.3.2
Quoted 46 lines · Alexander Shiyan
In some cases, clear interrupt register may be at address 0. This patch allows to use such configurations by adding additional configuration bit to indicate this.
Signed-off-by Alexander Shiyan <[email protected]>--- drivers/base/regmap/regmap-irq.c | 6 +++--- include/linux/regmap.h | 5 ++++- 2 files changed, 7 insertions(+), 4 deletions(-)drivers/base/regmap/regmap-irq.c +3
-3@@ -113,7 +113,7 @@ static void regmap_irq_sync_unlock(struct irq_data *data)* OR if there is masked interrupt which hasn't been Acked, * it'll be ignored in irq handler, then may introduce irq storm */ -if (d->mask_buf[i] && d->chip->ack_base) { +if (d->mask_buf[i] && (d->chip->ack_base || d->chip->use_ack)) { reg = d->chip->ack_base + (i * map->reg_stride * d->irq_reg_stride); ret =regmap_write (map, reg, d->mask_buf[i]);@@ -271,7 +271,7 @@ static irqreturn_t regmap_irq_thread(int irq, void *d)for (i =0 ; i < data->chip->num_regs; i++) { data->status_buf[i] &= ~data->mask_buf[i]; -if (data->status_buf[i] && chip->ack_base) { +if (data->status_buf[i] && (chip->ack_base || chip->use_ack)) { reg = chip->ack_base + (i * map->reg_stride * data->irq_reg_stride); ret =regmap_write (map, reg, data->status_buf[i]);@@ -448,7 +448,7 @@ int regmap_add_irq_chip(struct regmap *map, int irq, int irq_flags, goto err_alloc; } -if (d->status_buf[i] && chip->ack_base) { +if (d->status_buf[i] && (chip->ack_base || chip->use_ack)) { reg = chip->ack_base + (i * map->reg_stride * d->irq_reg_stride); ret = regmap_write(map, reg,include/linux/regmap.h +0
-0
include/linux/regmap.h struct regmap_irq { · line 504
Quoted 9 lines
include/linux/regmap.h +2
-1@@ -497,11 +497,13 @@ struct regmap_irq {* * @status_base: Base status register address. * @mask_base: Base mask register address. -* @ack_base: Base ack address. If zero then the chip is clear on read. +* @ack_base: Base ack address. If zero then the chip is clear on read. +* Using zero value is possible with @use_ack bit. * @wake_base: Base address for wake enables. If zero unsupported. * @irq_reg_stride: Stride to use for chips where registers are not contiguous. * @init_ack_masked: Ack all masked interrupts once during initalization.
Oh a typo! 'initalization' should be 'initialization'
include/linux/regmap.h struct regmap_irq { · line 506
Quoted 2 lines
include/linux/regmap.h +1
-0* @mask_invert: Inverted mask register: cleared bits are masked out. +* @use_ack: Use @ack register even it zero.
'even it zero' should be 'even if it is zero'
include/linux/regmap.h struct regmap_irq_chip { · line 525
Quoted 8 lines
include/linux/regmap.h +1
-0* @wake_invert: Inverted wake register: cleared bits are wake enabled. * @runtime_pm: Hold a runtime PM lock on the device when accessing it. * @@ -520,6 +522,7 @@ struct regmap_irq_chip {unsigned int irq_reg_stride; bool init_ack_masked:1; bool mask_invert:1; + bool use_ack:1;
I think this will break something. Better use 0 as default value. Reason I think so, is because in the above code you effectively add a new possibility for most code to run.
Signature · 2 lines
Regards, Levente Kurusa
Quoted 10 lines · Alexander Shiyan
Quoted 9 lines
In some cases, clear interrupt register may be at address 0. This patch allows to use such configurations by adding additional configuration bit to indicate this.
Signed-off-by Alexander Shiyan <[email protected]>--- drivers/base/regmap/regmap-irq.c | 6 +++--- include/linux/regmap.h | 5 ++++- 2 files changed, 7 insertions(+), 4 deletions(-)
...
Quoted 4 lines
Quoted 4 lines
include/linux/regmap.h +0
-0
...
Quoted 8 lines
include/linux/regmap.h struct regmap_irq_chip { · line 525
Quoted 5 lines
include/linux/regmap.h +1
-0@@ -520,6 +522,7 @@ struct regmap_irq_chip {unsigned int irq_reg_stride; bool init_ack_masked:1; bool mask_invert:1; + bool use_ack:1;I think this will break something. Better use 0 as default value. Reason I think so, is because in the above code you effectively add a new possibility for most code to run.
This is not a default value but bit-size of this field.
---
���{.n�+�������+%�����ݶ��w��{.n�+����{��G�����{ay�ʇڙ�,j��f���h��������z_�(�階�ݢj"���m������G������?����&���~��iO��z��v�^�m����������?�I�
Quoted 3 lines · Alexander Shiyan
In some cases, clear interrupt register may be at address 0. This patch allows to use such configurations by adding additional configuration bit to indicate this.
Applied, thanks with the grammar for the docs corrected. We probably ought to do this for most of the fields :/ I guess this is for some driver you're upstreaming so a signed tag would
be useful?
Quoted 8 lines · Alexander Shiyan
Quoted 3 lines
In some cases, clear interrupt register may be at address 0. This patch allows to use such configurations by adding additional configuration bit to indicate this.
Applied, thanks with the grammar for the docs corrected. We probably ought to do this for most of the fields :/ I guess this is for some driver you're upstreaming so a signed tag would
be useful?
I plan to use regmap-irq for migration mc13xxx MFD core to use IRQ domains. It will not be so soon.
---
���{.n�+�������+%�����ݶ��w��{.n�+����{��G�����{ay�ʇڙ�,j��f���h��������z_�(�階�ݢj"���m������G������?����&���~��iO��z��v�^�m����������?�I�
Mark Brown
maintainerQuoted 5 lines · Alexander Shiyan
Quoted 2 lines
I guess this is for some driver you're upstreaming so a signed tag would be useful?
I plan to use regmap-irq for migration mc13xxx MFD core to use IRQ domains. It will not be so soon.
OK, well let me know if you do need a signed tag and I'll do one.