Skip to content

Commit ae5ae35

Browse files
author
Bartosz Golaszewski
committed
Merge tag 'regmap-no-status' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap into gpio/for-next
regmap: Add no_status support This patch adds support for devices which don't support readback of individual interrupt statuses, we report all interrupts as firing and hope the consumers do the right thing.
2 parents a7400a4 + 4d60cac commit ae5ae35

2 files changed

Lines changed: 17 additions & 7 deletions

File tree

drivers/base/regmap/regmap-irq.c

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,10 @@ static irqreturn_t regmap_irq_thread(int irq, void *d)
433433
* possible in order to reduce the I/O overheads.
434434
*/
435435

436-
if (chip->num_main_regs) {
436+
if (chip->no_status) {
437+
/* no status register so default to all active */
438+
memset32(data->status_buf, GENMASK(31, 0), chip->num_regs);
439+
} else if (chip->num_main_regs) {
437440
unsigned int max_main_bits;
438441
unsigned long size;
439442

@@ -949,12 +952,17 @@ int regmap_add_irq_chip_fwnode(struct fwnode_handle *fwnode,
949952
continue;
950953

951954
/* Ack masked but set interrupts */
952-
reg = d->get_irq_reg(d, d->chip->status_base, i);
953-
ret = regmap_read(map, reg, &d->status_buf[i]);
954-
if (ret != 0) {
955-
dev_err(map->dev, "Failed to read IRQ status: %d\n",
956-
ret);
957-
goto err_alloc;
955+
if (d->chip->no_status) {
956+
/* no status register so default to all active */
957+
d->status_buf[i] = GENMASK(31, 0);
958+
} else {
959+
reg = d->get_irq_reg(d, d->chip->status_base, i);
960+
ret = regmap_read(map, reg, &d->status_buf[i]);
961+
if (ret != 0) {
962+
dev_err(map->dev, "Failed to read IRQ status: %d\n",
963+
ret);
964+
goto err_alloc;
965+
}
958966
}
959967

960968
if (chip->status_invert)

include/linux/regmap.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1567,6 +1567,7 @@ struct regmap_irq_chip_data;
15671567
* the need for a @sub_reg_offsets table.
15681568
* @status_invert: Inverted status register: cleared bits are active interrupts.
15691569
* @runtime_pm: Hold a runtime PM lock on the device when accessing it.
1570+
* @no_status: No status register: all interrupts assumed generated by device.
15701571
*
15711572
* @num_regs: Number of registers in each control bank.
15721573
* @irqs: Descriptors for individual IRQs. Interrupt numbers are
@@ -1631,6 +1632,7 @@ struct regmap_irq_chip {
16311632
unsigned int clear_on_unmask:1;
16321633
unsigned int not_fixed_stride:1;
16331634
unsigned int status_invert:1;
1635+
unsigned int no_status:1;
16341636

16351637
int num_regs;
16361638

0 commit comments

Comments
 (0)