Skip to content

Commit 394409a

Browse files
Guru Das Srinageshbroonie
authored andcommitted
regmap-irq: Add driver callback to configure virtual regs
Enable drivers to configure and modify "virtual" registers, which are non-standard registers that further configure irq type on some devices. Since they are non-standard, enable drivers to configure them according to their particular idiosyncrasies by specifying an optional callback function while registering with the framework. Signed-off-by: Guru Das Srinagesh <gurus@codeaurora.org> Link: https://lore.kernel.org/r/07e058cdec2297d15c95c825aa0263064d962d5a.1616613838.git.gurus@codeaurora.org Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 4c50144 commit 394409a

2 files changed

Lines changed: 9 additions & 0 deletions

File tree

drivers/base/regmap/regmap-irq.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,11 @@ static int regmap_irq_set_type(struct irq_data *data, unsigned int type)
333333
default:
334334
return -EINVAL;
335335
}
336+
337+
if (d->chip->set_type_virt)
338+
return d->chip->set_type_virt(d->virt_buf, type, data->hwirq,
339+
reg);
340+
336341
return 0;
337342
}
338343

include/linux/regmap.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1426,6 +1426,8 @@ struct regmap_irq_sub_irq_map {
14261426
* before regmap_irq_handler process the interrupts.
14271427
* @handle_post_irq: Driver specific callback to handle interrupt from device
14281428
* after handling the interrupts in regmap_irq_handler().
1429+
* @set_type_virt: Driver specific callback to extend regmap_irq_set_type()
1430+
* and configure virt regs.
14291431
* @irq_drv_data: Driver specific IRQ data which is passed as parameter when
14301432
* driver specific pre/post interrupt handler is called.
14311433
*
@@ -1473,6 +1475,8 @@ struct regmap_irq_chip {
14731475

14741476
int (*handle_pre_irq)(void *irq_drv_data);
14751477
int (*handle_post_irq)(void *irq_drv_data);
1478+
int (*set_type_virt)(unsigned int **buf, unsigned int type,
1479+
unsigned long hwirq, int reg);
14761480
void *irq_drv_data;
14771481
};
14781482

0 commit comments

Comments
 (0)