Skip to content

Commit c79e387

Browse files
Aidan MacDonaldlag-linaro
authored andcommitted
mfd: stpmic1: Fix swapped mask/unmask in irq chip
The usual behavior of mask registers is writing a '1' bit to disable (mask) an interrupt; similarly, writing a '1' bit to an unmask register enables (unmasks) an interrupt. Due to a longstanding issue in regmap-irq, mask and unmask registers were inverted when both kinds of registers were present on the same chip, ie. regmap-irq actually wrote '1's to the mask register to enable an IRQ and '1's to the unmask register to disable an IRQ. This was fixed by commit e8ffb12 ("regmap-irq: Fix inverted handling of unmask registers") but the fix is opt-in via mask_unmask_non_inverted = true because it requires manual changes for each affected driver. The new behavior will become the default once all drivers have been updated. The STPMIC1 has a normal mask register with separate set and clear registers. The driver intends to use the set & clear registers with regmap-irq and has compensated for regmap-irq's inverted behavior, and should currently be working properly. Thus, swap mask_base and unmask_base, and opt in to the new non-inverted behavior. Signed-off-by: Aidan MacDonald <[email protected]> Signed-off-by: Lee Jones <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 963cd95 commit c79e387

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

drivers/mfd/stpmic1.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,9 @@ static const struct regmap_irq stpmic1_irqs[] = {
108108
static const struct regmap_irq_chip stpmic1_regmap_irq_chip = {
109109
.name = "pmic_irq",
110110
.status_base = INT_PENDING_R1,
111-
.mask_base = INT_CLEAR_MASK_R1,
112-
.unmask_base = INT_SET_MASK_R1,
111+
.mask_base = INT_SET_MASK_R1,
112+
.unmask_base = INT_CLEAR_MASK_R1,
113+
.mask_unmask_non_inverted = true,
113114
.ack_base = INT_CLEAR_R1,
114115
.num_regs = STPMIC1_PMIC_NUM_IRQ_REGS,
115116
.irqs = stpmic1_irqs,

0 commit comments

Comments
 (0)