regmap: Add support for devices with no interrupt readback

Merge series from William Breathitt Gray <william.gray@linaro.org>:

There are devices which have interrupt support with mask and ack
registers but no status register.  Add a flag which lets us support
them, we just assume that all the interrupts fired.
This commit is contained in:
Mark Brown 2023-03-06 14:07:40 +00:00
commit 054a0da568
No known key found for this signature in database
GPG key ID: 24D68B725D5487D0
2 changed files with 17 additions and 7 deletions

View file

@ -433,7 +433,10 @@ static irqreturn_t regmap_irq_thread(int irq, void *d)
* possible in order to reduce the I/O overheads.
*/
if (chip->num_main_regs) {
if (chip->no_status) {
/* no status register so default to all active */
memset32(data->status_buf, GENMASK(31, 0), chip->num_regs);
} else if (chip->num_main_regs) {
unsigned int max_main_bits;
unsigned long size;
@ -949,12 +952,17 @@ int regmap_add_irq_chip_fwnode(struct fwnode_handle *fwnode,
continue;
/* Ack masked but set interrupts */
reg = d->get_irq_reg(d, d->chip->status_base, i);
ret = regmap_read(map, reg, &d->status_buf[i]);
if (ret != 0) {
dev_err(map->dev, "Failed to read IRQ status: %d\n",
ret);
goto err_alloc;
if (d->chip->no_status) {
/* no status register so default to all active */
d->status_buf[i] = GENMASK(31, 0);
} else {
reg = d->get_irq_reg(d, d->chip->status_base, i);
ret = regmap_read(map, reg, &d->status_buf[i]);
if (ret != 0) {
dev_err(map->dev, "Failed to read IRQ status: %d\n",
ret);
goto err_alloc;
}
}
if (chip->status_invert)

View file

@ -1567,6 +1567,7 @@ struct regmap_irq_chip_data;
* offsets to each peripheral. Deprecated; the same thing
* can be accomplished with a @get_irq_reg callback, without
* the need for a @sub_reg_offsets table.
* @no_status: No status register: all interrupts assumed generated by device.
*
* @num_regs: Number of registers in each control bank.
*
@ -1634,6 +1635,7 @@ struct regmap_irq_chip {
unsigned int clear_on_unmask:1;
unsigned int runtime_pm:1;
unsigned int not_fixed_stride:1;
unsigned int no_status:1;
int num_regs;