[PATCH v4 4/5] mfd: axp20x-i2c: Fix i2c instantiation

From: Jerome Brunet

Date: Fri Jul 17 2026 - 10:32:49 EST


Apparently this device never really supported i2c instantiation via
sysfs, because the driver does not even look at the i2c driver, which are
not set. It would only probe if the device matched through DT.

Fix that for correctness, even-though it is probably useless.
Add the missing AXP323 while at it.

Reported-by: Sashiko <sashiko-bot@xxxxxxxxxx>
Closes: https://lore.kernel.org/r/20260717090209.2A09B1F000E9@xxxxxxxxxxxxxxx
Fixes: 41751b033aaa ("mfd: axp20x-i2c: Add i2c-ids to fix module auto-loading")
Signed-off-by: Jerome Brunet <jbrunet@xxxxxxxxxxxx>
---
drivers/mfd/axp20x-i2c.c | 26 ++++++++++++++------------
drivers/mfd/axp20x-rsb.c | 1 +
drivers/mfd/axp20x.c | 1 -
3 files changed, 15 insertions(+), 13 deletions(-)

diff --git a/drivers/mfd/axp20x-i2c.c b/drivers/mfd/axp20x-i2c.c
index 4e4ebfc78525..64c212b76e5e 100644
--- a/drivers/mfd/axp20x-i2c.c
+++ b/drivers/mfd/axp20x-i2c.c
@@ -35,6 +35,7 @@ static int axp20x_i2c_probe(struct i2c_client *i2c)
axp20x->irq = i2c->irq;
dev_set_drvdata(axp20x->dev, axp20x);

+ axp20x->variant = (kernel_ulong_t)i2c_get_match_data(i2c);
ret = axp20x_match_device(axp20x);
if (ret)
return ret;
@@ -77,18 +78,19 @@ MODULE_DEVICE_TABLE(of, axp20x_i2c_of_match);
#endif

static const struct i2c_device_id axp20x_i2c_id[] = {
- { "axp152" },
- { "axp192" },
- { "axp202" },
- { "axp209" },
- { "axp221" },
- { "axp223" },
- { "axp313a" },
- { "axp318w" },
- { "axp717" },
- { "axp803" },
- { "axp806" },
- { "axp15060" },
+ { .name = "axp152", .driver_data = AXP152_ID },
+ { .name = "axp192", .driver_data = AXP192_ID },
+ { .name = "axp202", .driver_data = AXP202_ID },
+ { .name = "axp209", .driver_data = AXP209_ID },
+ { .name = "axp221", .driver_data = AXP221_ID },
+ { .name = "axp223", .driver_data = AXP223_ID },
+ { .name = "axp313a", .driver_data = AXP313A_ID },
+ { .name = "axp318w", .driver_data = AXP318_ID },
+ { .name = "axp323", .driver_data = AXP323_ID },
+ { .name = "axp717", .driver_data = AXP717_ID },
+ { .name = "axp803", .driver_data = AXP803_ID },
+ { .name = "axp806", .driver_data = AXP806_ID },
+ { .name = "axp15060", .driver_data = AXP15060_ID },
{ }
};
MODULE_DEVICE_TABLE(i2c, axp20x_i2c_id);
diff --git a/drivers/mfd/axp20x-rsb.c b/drivers/mfd/axp20x-rsb.c
index 059656f2a1bd..8fdc870c1fe4 100644
--- a/drivers/mfd/axp20x-rsb.c
+++ b/drivers/mfd/axp20x-rsb.c
@@ -35,6 +35,7 @@ static int axp20x_rsb_probe(struct sunxi_rsb_device *rdev)
axp20x->irq = rdev->irq;
dev_set_drvdata(&rdev->dev, axp20x);

+ axp20x->variant = (kernel_ulong_t)device_get_match_data(axp20x->dev);
ret = axp20x_match_device(axp20x);
if (ret)
return ret;
diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c
index 2bbe73afff43..25509e47bedc 100644
--- a/drivers/mfd/axp20x.c
+++ b/drivers/mfd/axp20x.c
@@ -1339,7 +1339,6 @@ int axp20x_match_device(struct axp20x_dev *axp20x)
const struct mfd_cell *cells_no_irq = NULL;
int nr_cells_no_irq = 0;

- axp20x->variant = (long)device_get_match_data(dev);
switch (axp20x->variant) {
case AXP152_ID:
axp20x->nr_cells = ARRAY_SIZE(axp152_cells);

--
2.47.3