regmap: Support for acknowledging masked IRQs
Some devices need interrupts to be clear when they are masked otherwise the interrupt is not deasserted by the mask being set - add support for this to regmap-irq from Philipp Zabel. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) iQIcBAABAgAGBQJR9RRgAAoJELSic+t+oim91RUQAIas5Oj4Gi8w0r4TOCjRx17t La1M6eL6ANU84cB/9KZWvERkN/JrXereGuk2FLNg32diI8GtAv4ee++Sk2vac2rp WZkf32A8uEkUi/kErVcOdH85UWckcvgljt1zzTaNGz6l6K+VdF34Lu8/l4+EdsaZ 6YBAhtL4t0ScrshqMIt48XdS3ZajuzKmUmEydM7/7M7FUZRNOiWmVOkoYBS5QrYH 63HTDVPxC1DYmgXR/Manp7SbYF2uzLbu5spBC3DFqXT0rOrwzFxR60ZBFZISRArF xjRRuEY8m+vQku1mjYZd+iEKNnkYyw/YrskoJeimIEJOP2aGEQlqTOll2MHnpQFt P+T7he/DBwOnX81JwP1Ign0MYayQKnr9dw4KuReP+5ogf/THZ5+YOuDbqO8fZZIt t+RahmozKDi2yGjVHu/65YJV3+iX7d5KFQs3VBTGCr4f9H8uTw75ZlBKbY4J04dz YWMjsEG/lvfvHQtSYeXqaVfIUB/5mAv2mMtXDydq1Bv9bcxrUuJnmVIuJ58YG5pY B0f2mBhehQZG5x86Zh2m9U6JlxpIHcjYU8Ksmkx9wTtMa2s93kU7Z4KCi18xQ6GV rHy0Z7LoJ3PU4AB0k4kEQhrgMtwPIo5/gtH0fzPnEdCR0BNIW6bBUM1wzuFJiywj veyFzRMjnmrKVK0AduN/ =SAte -----END PGP SIGNATURE----- Merge tag 'regmap-irq-ack-mask' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap regmap: Support for acknowledging masked IRQs Some devices need interrupts to be clear when they are masked otherwise the interrupt is not deasserted by the mask being set - add support for this to regmap-irq from Philipp Zabel.
This commit is contained in:
commit
a849212f6e
|
@ -418,6 +418,31 @@ int regmap_add_irq_chip(struct regmap *map, int irq, int irq_flags,
|
|||
reg, ret);
|
||||
goto err_alloc;
|
||||
}
|
||||
|
||||
if (!chip->init_ack_masked)
|
||||
continue;
|
||||
|
||||
/* Ack masked but set interrupts */
|
||||
reg = chip->status_base +
|
||||
(i * map->reg_stride * d->irq_reg_stride);
|
||||
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->status_buf[i] && chip->ack_base) {
|
||||
reg = chip->ack_base +
|
||||
(i * map->reg_stride * d->irq_reg_stride);
|
||||
ret = regmap_write(map, reg,
|
||||
d->status_buf[i] & d->mask_buf[i]);
|
||||
if (ret != 0) {
|
||||
dev_err(map->dev, "Failed to ack 0x%x: %d\n",
|
||||
reg, ret);
|
||||
goto err_alloc;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Wake is disabled by default */
|
||||
|
|
|
@ -470,6 +470,9 @@ struct regmap_irq {
|
|||
* @ack_base: Base ack address. If zero then the chip is clear on read.
|
||||
* @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.
|
||||
* @wake_invert: Inverted wake register: cleared bits are wake enabled.
|
||||
* @runtime_pm: Hold a runtime PM lock on the device when accessing it.
|
||||
*
|
||||
* @num_regs: Number of registers in each control bank.
|
||||
|
@ -485,9 +488,10 @@ struct regmap_irq_chip {
|
|||
unsigned int ack_base;
|
||||
unsigned int wake_base;
|
||||
unsigned int irq_reg_stride;
|
||||
unsigned int mask_invert;
|
||||
unsigned int wake_invert;
|
||||
bool runtime_pm;
|
||||
bool init_ack_masked:1;
|
||||
bool mask_invert:1;
|
||||
bool wake_invert:1;
|
||||
bool runtime_pm:1;
|
||||
|
||||
int num_regs;
|
||||
|
||||
|
|
Loading…
Reference in New Issue