Skip to contentSkip to conversation

mfd: axp20x: Skip PEK on AXP313A/AXP323 if no interrupt line is available

PATCH In review Chen-Yu Tsai 2 participants 2 messages Jun 30, 2025 – Jul 1, 2025

Subsystems (3)
lore
Share & tools
lore

Chen-Yu Tsai

author maintainer
#0 lore raw

PATCH 1/1 mfd: axp20x: Skip PEK on AXP313A/AXP323 if no interrupt line is available

From: Chen-Yu Tsai <[email protected]>

Originally an explicit ID for the AXP313/AXP323 regulator was set to avoid a conflict with the primary AXP717 PMIC on Allwinner A523 family boards.

This didn't entirely work since on some or all of these boards, the interrupt line on this secondary PMIC was left unconnected, and thus the driver would fall back to the generic "no interrupt; only regulators" case, which didn't have the explicit ID set, thus undoing the intended fix.

Explicitly exclude the PEK cell in the no IRQ case for the AXP313/AXP323, instead of using the generic fallback.

Fixes 249abf9b1e25 ("mfd: axp20x: Set explicit ID for AXP313 regulator")

---
The other option would be to move the explicit ID to the generic fallback case instead. This is really only visible in sysfs and the kernel logs, so probably not that important.

---
 drivers/mfd/axp20x.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/mfd/axp20x.c +7 -0
index 25c639b348cd..8877482a95a1 100644
@@ -1055,6 +1055,7 @@ static const struct mfd_cell axp152_cells[] = {
 static struct mfd_cell axp313a_cells[] = {
 	/* AXP323 is sometimes paired with AXP717 as sub-PMIC */
 	MFD_CELL_BASIC("axp20x-regulator", NULL, NULL, 0, 1),
+	/* Keep PEK as last entry for exclusion in no-irq cases */
 	MFD_CELL_RES("axp313a-pek", axp313a_pek_resources),
 };
 
@@ -1306,12 +1307,18 @@ int axp20x_match_device(struct axp20x_dev *axp20x)
 		axp20x->irq_flags = IRQF_TRIGGER_LOW;
 		break;
 	case AXP313A_ID:
+		/* Exclude PEK if no IRQ is available */
+		nr_cells_no_irq = ARRAY_SIZE(axp313a_cells) - 1;
+		cells_no_irq = axp313a_cells;
 		axp20x->nr_cells = ARRAY_SIZE(axp313a_cells);
 		axp20x->cells = axp313a_cells;
 		axp20x->regmap_cfg = &axp313a_regmap_config;
 		axp20x->regmap_irq_chip = &axp313a_regmap_irq_chip;
 		break;
 	case AXP323_ID:
+		/* Exclude PEK if no IRQ is available */
+		nr_cells_no_irq = ARRAY_SIZE(axp313a_cells) - 1;
+		cells_no_irq = axp313a_cells;
 		axp20x->nr_cells = ARRAY_SIZE(axp313a_cells);
 		axp20x->cells = axp313a_cells;
 		axp20x->regmap_cfg = &axp323_regmap_config;
Signature · 1 line
2.39.5
maintainer
#1 lore raw
Quoted 38 lines · Chen-Yu Tsai

From: Chen-Yu Tsai <[email protected]>

Originally an explicit ID for the AXP313/AXP323 regulator was set to avoid a conflict with the primary AXP717 PMIC on Allwinner A523 family boards.

This didn't entirely work since on some or all of these boards, the interrupt line on this secondary PMIC was left unconnected, and thus the driver would fall back to the generic "no interrupt; only regulators" case, which didn't have the explicit ID set, thus undoing the intended fix.

Explicitly exclude the PEK cell in the no IRQ case for the AXP313/AXP323, instead of using the generic fallback.

Fixes 249abf9b1e25 ("mfd: axp20x: Set explicit ID for AXP313 regulator")

---
The other option would be to move the explicit ID to the generic fallback case instead. This is really only visible in sysfs and the kernel logs, so probably not that important.

---
 drivers/mfd/axp20x.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/mfd/axp20x.c +1 -0
index 25c639b348cd..8877482a95a1 100644
@@ -1055,6 +1055,7 @@ static const struct mfd_cell axp152_cells[] = {
 static struct mfd_cell axp313a_cells[] = {
 	/* AXP323 is sometimes paired with AXP717 as sub-PMIC */
 	MFD_CELL_BASIC("axp20x-regulator", NULL, NULL, 0, 1),
+	/* Keep PEK as last entry for exclusion in no-irq cases */
 	MFD_CELL_RES("axp313a-pek", axp313a_pek_resources),
 };
 

drivers/mfd/axp20x.c int axp20x_match_device(struct axp20x_dev *axp20x) · line 1311

Quoted 5 lines
drivers/mfd/axp20x.c +2 -0
@@ -1306,12 +1307,18 @@ int axp20x_match_device(struct axp20x_dev *axp20x)
 		axp20x->irq_flags = IRQF_TRIGGER_LOW;
 		break;
 	case AXP313A_ID:
+		/* Exclude PEK if no IRQ is available */
+		nr_cells_no_irq = ARRAY_SIZE(axp313a_cells) - 1;

This is too fragile. Please fine another way to achieve your goal.

Quoted 16 lines
drivers/mfd/axp20x.c +4 -0
+		cells_no_irq = axp313a_cells;
 		axp20x->nr_cells = ARRAY_SIZE(axp313a_cells);
 		axp20x->cells = axp313a_cells;
 		axp20x->regmap_cfg = &axp313a_regmap_config;
 		axp20x->regmap_irq_chip = &axp313a_regmap_irq_chip;
 		break;
 	case AXP323_ID:
+		/* Exclude PEK if no IRQ is available */
+		nr_cells_no_irq = ARRAY_SIZE(axp313a_cells) - 1;
+		cells_no_irq = axp313a_cells;
 		axp20x->nr_cells = ARRAY_SIZE(axp313a_cells);
 		axp20x->cells = axp313a_cells;
 		axp20x->regmap_cfg = &axp323_regmap_config;
Signature · 1 line
2.39.5
Signature · 1 line
Lee Jones [李琼斯]