mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2] mfd: mt6397: Use PMIC specific interrupt count for domain creation
@ 2026-11-10 22:51 Ben Grisdale
  2026-11-11  2:30 ` Chen-Yu Tsai
  0 siblings, 1 reply; 4+ messages in thread
From: Ben Grisdale @ 2026-11-10 22:51 UTC (permalink / raw)
  Cc: mfd, linux-kernel, linux-arm-kernel, linux-mediatek, 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 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.

Fixes: 6e31bb8d3a63 ("mfd: mt6397: Add initial support for MT6328")
Signed-off-by: Ben Grisdale <bengris32@protonmail.ch>
---
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/20261110-mt6397-irq-num-fix-v1-1-81d17454194e@protonmail.ch
---
 drivers/mfd/mt6397-irq.c        | 7 ++++++-
 include/linux/mfd/mt6328/core.h | 1 +
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/mfd/mt6397-irq.c b/drivers/mfd/mt6397-irq.c
index 5d2e5459f744..783be9f5c9c3 100644
--- a/drivers/mfd/mt6397-irq.c
+++ b/drivers/mfd/mt6397-irq.c
@@ -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");
diff --git a/include/linux/mfd/mt6328/core.h b/include/linux/mfd/mt6328/core.h
index 9a08aed72b9f..18e000cf5d29 100644
--- a/include/linux/mfd/mt6328/core.h
+++ b/include/linux/mfd/mt6328/core.h
@@ -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,
--  
Ben Grisdale <bengris32@protonmail.ch>



^ permalink raw reply	[flat|nested] 4+ messages in thread
* Re: [PATCH v2] mfd: mt6397: Use PMIC specific interrupt count for domain creation
@ 2026-11-10 23:42 Ben Grisdale
  0 siblings, 0 replies; 4+ messages in thread
From: Ben Grisdale @ 2026-11-10 23:42 UTC (permalink / raw)
  To: Lee Jones, Matthias Brugger, AngeloGioacchino Del Regno, Yassine Oudjana
  Cc: Ben Grisdale, mfd, linux-kernel, linux-arm-kernel, linux-mediatek

Hi folks,

Please ignore this V2, it was CC'd to the lists by mistake whilst I was
testing my mail setup.
It is identical to the patch in V1, which is still current:
https://lore.kernel.org/all/20261110-mt6397-irq-num-fix-v1-1-81d17454194e@protonmail.ch

Apologies for any inconvenience or noise caused.

Best regards,
Ben Grisdale


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-11-11 10:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-10 22:51 [PATCH v2] mfd: mt6397: Use PMIC specific interrupt count for domain creation Ben Grisdale
2026-11-11  2:30 ` Chen-Yu Tsai
2026-11-11 10:21   ` Ben Grisdale
2026-11-10 23:42 Ben Grisdale

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®