mfd: mt6397: Use PMIC specific interrupt count for domain creation
Subsystems (2)
PATCH v2 1/1 mfd: mt6397: Use PMIC specific interrupt count for domain creation
mt6397_irq_init() currently creates its IRQ domain with a fixed number of interrupts (MT6397_IRQ_NR). However, not every PMIC supported by this driver has the same number of interrupts as the MT6397. The MT6328 has 47 interrupts, so its interrupts above MT6397_IRQ_NR (32) are currently unusable.
Correct this by passing the PMIC's actual interrupt count to irq_domain_create_linear() based on the chip ID. Define the missing interrupt count for MT6328, as the other supported PMICs already have it defined.
---
Changes in v2:
- EDITME: describe what is new in this series revision.
- EDITME: use bulletpoints and terse descriptions.
- Link to v1: https://patch.msgid.link/[email protected]
--- drivers/mfd/mt6397-irq.c | 7 ++++++- include/linux/mfd/mt6328/core.h | 1 + 2 files changed, 7 insertions(+), 1 deletion(-)
drivers/mfd/mt6397-irq.c +6 -1
@@ -171,6 +171,7 @@ static int mt6397_irq_pm_notifier(struct notifier_block *notifier,int mt6397_irq_init (struct mt6397_chip *chip) { +unsigned int irq_num;int ret;mutex_init (&chip->irqlock);
@@ -181,6 +182,7 @@ int mt6397_irq_init(struct mt6397_chip *chip) chip->int_con[1 ] =MT6323_INT_CON1 ; chip->int_status[0 ] =MT6323_INT_STATUS0 ; chip->int_status[1 ] =MT6323_INT_STATUS1 ; + irq_num =MT6323_IRQ_STATUS_NR ;break ;case MT6328_CHIP_ID : chip->int_con[0 ] =MT6328_INT_CON0 ;
@@ -189,12 +191,14 @@ int mt6397_irq_init(struct mt6397_chip *chip) chip->int_status[0 ] =MT6328_INT_STATUS0 ; chip->int_status[1 ] =MT6328_INT_STATUS1 ; chip->int_status[2 ] =MT6328_INT_STATUS2 ; + irq_num =MT6328_IRQ_STATUS_NR ;break ;case MT6331_CHIP_ID : chip->int_con[0 ] =MT6331_INT_CON0 ; chip->int_con[1 ] =MT6331_INT_CON1 ; chip->int_status[0 ] =MT6331_INT_STATUS_CON0 ; chip->int_status[1 ] =MT6331_INT_STATUS_CON1 ; + irq_num =MT6331_IRQ_STATUS_NR ;break ;case MT6391_CHIP_ID :case MT6397_CHIP_ID :
@@ -202,6 +206,7 @@ int mt6397_irq_init(struct mt6397_chip *chip) chip->int_con[1 ] =MT6397_INT_CON1 ; chip->int_status[0 ] =MT6397_INT_STATUS0 ; chip->int_status[1 ] =MT6397_INT_STATUS1 ; + irq_num =MT6397_IRQ_NR ;break ;default :
@@ -216,7 +221,7 @@ int mt6397_irq_init(struct mt6397_chip *chip)regmap_write (chip->regmap, chip->int_con[2 ],0x0 ); chip->pm_nb.notifier_call = mt6397_irq_pm_notifier; - chip->irq_domain =irq_domain_create_linear (dev_fwnode (chip->dev),MT6397_IRQ_NR , + chip->irq_domain =irq_domain_create_linear (dev_fwnode (chip->dev), irq_num, &mt6397_irq_domain_ops, chip);if (!chip->irq_domain) {dev_err (chip->dev,"could not create irq domain\n" );
include/linux/mfd/mt6328/core.h +1 -0
@@ -48,6 +48,7 @@ enum mt6328_irq_status_numbers {MT6328_IRQ_STATUS_FG_ZCV ,MT6328_IRQ_STATUS_SPKL_D ,MT6328_IRQ_STATUS_SPKL_AB , + MT6328_IRQ_STATUS_NR, };#endif /* __MFD_MT6323_CORE_H__ */
---
base-commit: 630059a5a632377b9b7b487baccde92b7ae1dd47
change-id: 20261110-mt6397-irq-num-fix-2de78da5695e
Best regards,
Signature · 1 line
Ben Grisdale <[email protected]>
[email protected]
AI reviewSashiko has reviewed this patch and found no issues.
Quoted 6 lines
mt6397_irq_init()currently creates its IRQ domain with a fixed number of interrupts (MT6397_IRQ_NR). However, not every PMIC supported by this driver has the same number of interrupts as the MT6397. The MT6328 has 47 interrupts, so its interrupts aboveMT6397_IRQ_NR(32) are currently unusable.
Quoted 7 lines
Correct this by passing the PMIC's actual interrupt count to
irq_domain_create_linear()based on the chip ID. Define the missing interrupt count for MT6328, as the other supported PMICs already have it defined.Fixes 6e31bb8d3a63 ("mfd: mt6397: Add initial support for MT6328")Signed-off-by Ben Grisdale <[email protected]>
Sashiko has reviewed this patch and found no issues.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Quoted 7 lines · Ben Grisdale
mt6397_irq_init()currently creates its IRQ domain with a fixed number of interrupts (MT6397_IRQ_NR). However, not every PMIC supported by this driver has the same number of interrupts as the MT6397. The MT6328 has 47 interrupts, so its interrupts aboveMT6397_IRQ_NR(32) are currently unusable.
Quoted 7 lines
Correct this by passing the PMIC's actual interrupt count to
irq_domain_create_linear()based on the chip ID. Define the missing interrupt count for MT6328, as the other supported PMICs already have it defined.Fixes 6e31bb8d3a63 ("mfd: mt6397: Add initial support for MT6328")Signed-off-by Ben Grisdale <[email protected]>
Changes make sense to me, and it also seems to fix MT6332.
Hi Chen-Yu,
Thanks for the review!
This v2 was sent by accident while I was testing my mail setup, which is why the changelog was left unfilled. My follow-up saying so is still stuck in the moderation queue on the mailing lists.
The patch itself is identical to v1, so I assume v2 can be applied as-is with your tag. If a v3 is needed, I'll carry your tag over.
Best regards,
Ben Grisdale