* [PATCH v2 0/5] regulator: add X-Powers AXP323 support
@ 2024-10-07 0:14 Andre Przywara
2024-10-07 0:14 ` [PATCH v2 1/5] dt-bindings: mfd: x-powers,axp152: Document AXP323 Andre Przywara
` (5 more replies)
0 siblings, 6 replies; 12+ messages in thread
From: Andre Przywara @ 2024-10-07 0:14 UTC (permalink / raw)
To: Lee Jones, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Chen-Yu Tsai, Liam Girdwood, Mark Brown
Cc: devicetree, linux-sunxi, linux-kernel, Martin Botka, Chris Morgan
A small update of version, just changing the regmap cache type to maple
tree, and adding the accrued tags (thanks to the reviewers!).
================================
The X-Powers AXP323 is a close sibling to the AXP313a PMIC, only that it
allows to dual-phase the first two DC/DC converters. This is controlled
via a new register. On the first glance that would sound like a
compatible extension, but any random AXP313a driver would not know about
the potential dual-phase nature of the second DCDC rail, so might want
to turn that off, spoiling the whole setup. So this patchset introduces
a new compatible string, without any fallbacks.
Patch 1 adds the DT binding documentation, patch 2 fixes some fragile
connection between PMIC IDs and an array. Patch 3 allows multiple AXP
chips, since the AXP323 seems to be often paired with the AXP717, and
there is some sysfs naming clash with the current code.
Patch 4 then adds the MFD bits, to introduce the new device type and that
extra register, while patch 4 eventually adds the new regulator device,
and takes care about the proper poly-phase detection.
One note: so far the poly-phased AXP PMICs had that setting already
enabled at reset time, so we just detected it and were good. However the
AXP323 on my board does not, so it requires enabling the dual-phase bit at
boot time. The BSP kernel does that in their boot0 (SPL) early boot code,
and the plan would be to do this either in U-Boot or TF-A for mainline.
But should we actually expose this in the DT, as some new property, to
give kernels a chance to set it? The rails in question power the secondary
cluster, so it's not strictly required at boot time, but it's probably too
late for the kernel anyway, given that SMP bringup is much earlier than
drivers? I would appreciate any thoughts here.
Thanks,
Andre
Changelog:
v1 ... v2:
- change regmap cache type to maple tree (as all the others use)
- add R-b: and ACK tags
Andre Przywara (5):
dt-bindings: mfd: x-powers,axp152: Document AXP323
mfd: axp20x: ensure relationship between IDs and model names
mfd: axp20x: Allow multiple regulators
mfd: axp20x: Add support for AXP323
regulator: axp20x: add support for the AXP323
.../bindings/mfd/x-powers,axp152.yaml | 3 +
drivers/mfd/axp20x-i2c.c | 1 +
drivers/mfd/axp20x.c | 58 ++++++++++++++-----
drivers/regulator/axp20x-regulator.c | 13 ++++-
include/linux/mfd/axp20x.h | 4 +-
5 files changed, 61 insertions(+), 18 deletions(-)
--
2.46.2
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH v2 1/5] dt-bindings: mfd: x-powers,axp152: Document AXP323
2024-10-07 0:14 [PATCH v2 0/5] regulator: add X-Powers AXP323 support Andre Przywara
@ 2024-10-07 0:14 ` Andre Przywara
2024-10-07 0:14 ` [PATCH v2 2/5] mfd: axp20x: ensure relationship between IDs and model names Andre Przywara
` (4 subsequent siblings)
5 siblings, 0 replies; 12+ messages in thread
From: Andre Przywara @ 2024-10-07 0:14 UTC (permalink / raw)
To: Lee Jones, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Chen-Yu Tsai, Liam Girdwood, Mark Brown
Cc: devicetree, linux-sunxi, linux-kernel, Martin Botka, Chris Morgan
The X-Powers AXP323 is a PMIC used on some newer Allwinner devices.
It is almost the same as the AXP313, but supports dual-phasing the first
two DC/DC converters. A pure AXP313 driver wouldn't know about this, and
might turn the linked DCDC2 regulator off, as it does not seem to be
used. This makes the AXP323 incompatible to the AXP313a.
Add the new compatible string, and treat it like the AXP313a.
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Chen-Yu Tsai <wens@csie.org>
Acked-by: Rob Herring (Arm) <robh@kernel.org>
---
Documentation/devicetree/bindings/mfd/x-powers,axp152.yaml | 3 +++
1 file changed, 3 insertions(+)
diff --git a/Documentation/devicetree/bindings/mfd/x-powers,axp152.yaml b/Documentation/devicetree/bindings/mfd/x-powers,axp152.yaml
index 14ab367fc8871..3f7661bdd2020 100644
--- a/Documentation/devicetree/bindings/mfd/x-powers,axp152.yaml
+++ b/Documentation/devicetree/bindings/mfd/x-powers,axp152.yaml
@@ -71,6 +71,7 @@ allOf:
- x-powers,axp15060
- x-powers,axp305
- x-powers,axp313a
+ - x-powers,axp323
then:
required:
@@ -82,6 +83,7 @@ allOf:
contains:
enum:
- x-powers,axp313a
+ - x-powers,axp323
- x-powers,axp15060
- x-powers,axp717
@@ -100,6 +102,7 @@ properties:
- x-powers,axp221
- x-powers,axp223
- x-powers,axp313a
+ - x-powers,axp323
- x-powers,axp717
- x-powers,axp803
- x-powers,axp806
--
2.46.2
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH v2 2/5] mfd: axp20x: ensure relationship between IDs and model names
2024-10-07 0:14 [PATCH v2 0/5] regulator: add X-Powers AXP323 support Andre Przywara
2024-10-07 0:14 ` [PATCH v2 1/5] dt-bindings: mfd: x-powers,axp152: Document AXP323 Andre Przywara
@ 2024-10-07 0:14 ` Andre Przywara
2024-10-07 0:14 ` [PATCH v2 3/5] mfd: axp20x: Allow multiple regulators Andre Przywara
` (3 subsequent siblings)
5 siblings, 0 replies; 12+ messages in thread
From: Andre Przywara @ 2024-10-07 0:14 UTC (permalink / raw)
To: Lee Jones, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Chen-Yu Tsai, Liam Girdwood, Mark Brown
Cc: devicetree, linux-sunxi, linux-kernel, Martin Botka, Chris Morgan
At the moment there is an implicit relationship between the AXP model
IDs and the order of the strings in the axp20x_model_names[] array.
This is fragile, and makes adding IDs in the middle error prone.
Make this relationship official by changing the ID type to the actual
enum used, and using indexed initialisers for the string list.
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Chen-Yu Tsai <wens@csie.org>
---
drivers/mfd/axp20x.c | 30 ++++++++++++++--------------
drivers/regulator/axp20x-regulator.c | 2 +-
include/linux/mfd/axp20x.h | 2 +-
3 files changed, 17 insertions(+), 17 deletions(-)
diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c
index 4051551757f2d..5ceea359289f4 100644
--- a/drivers/mfd/axp20x.c
+++ b/drivers/mfd/axp20x.c
@@ -34,20 +34,20 @@
#define AXP806_REG_ADDR_EXT_ADDR_SLAVE_MODE BIT(4)
static const char * const axp20x_model_names[] = {
- "AXP152",
- "AXP192",
- "AXP202",
- "AXP209",
- "AXP221",
- "AXP223",
- "AXP288",
- "AXP313a",
- "AXP717",
- "AXP803",
- "AXP806",
- "AXP809",
- "AXP813",
- "AXP15060",
+ [AXP152_ID] = "AXP152",
+ [AXP192_ID] = "AXP192",
+ [AXP202_ID] = "AXP202",
+ [AXP209_ID] = "AXP209",
+ [AXP221_ID] = "AXP221",
+ [AXP223_ID] = "AXP223",
+ [AXP288_ID] = "AXP288",
+ [AXP313A_ID] = "AXP313a",
+ [AXP717_ID] = "AXP717",
+ [AXP803_ID] = "AXP803",
+ [AXP806_ID] = "AXP806",
+ [AXP809_ID] = "AXP809",
+ [AXP813_ID] = "AXP813",
+ [AXP15060_ID] = "AXP15060",
};
static const struct regmap_range axp152_writeable_ranges[] = {
@@ -1345,7 +1345,7 @@ int axp20x_match_device(struct axp20x_dev *axp20x)
axp20x->regmap_irq_chip = &axp15060_regmap_irq_chip;
break;
default:
- dev_err(dev, "unsupported AXP20X ID %lu\n", axp20x->variant);
+ dev_err(dev, "unsupported AXP20X ID %u\n", axp20x->variant);
return -EINVAL;
}
diff --git a/drivers/regulator/axp20x-regulator.c b/drivers/regulator/axp20x-regulator.c
index a8e91d9d028b8..3ba76dbd0fb9e 100644
--- a/drivers/regulator/axp20x-regulator.c
+++ b/drivers/regulator/axp20x-regulator.c
@@ -1597,7 +1597,7 @@ static int axp20x_regulator_probe(struct platform_device *pdev)
nregulators = AXP15060_REG_ID_MAX;
break;
default:
- dev_err(&pdev->dev, "Unsupported AXP variant: %ld\n",
+ dev_err(&pdev->dev, "Unsupported AXP variant: %d\n",
axp20x->variant);
return -EINVAL;
}
diff --git a/include/linux/mfd/axp20x.h b/include/linux/mfd/axp20x.h
index f4dfc1871a95b..79ecaaaa20703 100644
--- a/include/linux/mfd/axp20x.h
+++ b/include/linux/mfd/axp20x.h
@@ -959,7 +959,7 @@ struct axp20x_dev {
unsigned long irq_flags;
struct regmap *regmap;
struct regmap_irq_chip_data *regmap_irqc;
- long variant;
+ enum axp20x_variants variant;
int nr_cells;
const struct mfd_cell *cells;
const struct regmap_config *regmap_cfg;
--
2.46.2
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH v2 3/5] mfd: axp20x: Allow multiple regulators
2024-10-07 0:14 [PATCH v2 0/5] regulator: add X-Powers AXP323 support Andre Przywara
2024-10-07 0:14 ` [PATCH v2 1/5] dt-bindings: mfd: x-powers,axp152: Document AXP323 Andre Przywara
2024-10-07 0:14 ` [PATCH v2 2/5] mfd: axp20x: ensure relationship between IDs and model names Andre Przywara
@ 2024-10-07 0:14 ` Andre Przywara
2024-12-07 17:45 ` Chris Morgan
2024-10-07 0:14 ` [PATCH v2 4/5] mfd: axp20x: Add support for AXP323 Andre Przywara
` (2 subsequent siblings)
5 siblings, 1 reply; 12+ messages in thread
From: Andre Przywara @ 2024-10-07 0:14 UTC (permalink / raw)
To: Lee Jones, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Chen-Yu Tsai, Liam Girdwood, Mark Brown
Cc: devicetree, linux-sunxi, linux-kernel, Martin Botka, Chris Morgan
At the moment trying to register a second AXP chip makes the probe fail,
as some sysfs registration fails due to a duplicate name:
...
[ 3.688215] axp20x-i2c 0-0035: AXP20X driver loaded
[ 3.695610] axp20x-i2c 0-0036: AXP20x variant AXP323 found
[ 3.706151] sysfs: cannot create duplicate filename '/bus/platform/devices/axp20x-regulator'
[ 3.714718] CPU: 0 UID: 0 PID: 1 Comm: swapper/0 Not tainted 6.12.0-rc1-00026-g50bf2e2c079d-dirty #192
[ 3.724020] Hardware name: Avaota A1 (DT)
[ 3.728029] Call trace:
[ 3.730477] dump_backtrace+0x94/0xec
[ 3.734146] show_stack+0x18/0x24
[ 3.737462] dump_stack_lvl+0x80/0xf4
[ 3.741128] dump_stack+0x18/0x24
[ 3.744444] sysfs_warn_dup+0x64/0x80
[ 3.748109] sysfs_do_create_link_sd+0xf0/0xf8
[ 3.752553] sysfs_create_link+0x20/0x40
[ 3.756476] bus_add_device+0x64/0x104
[ 3.760229] device_add+0x310/0x760
[ 3.763717] platform_device_add+0x10c/0x238
[ 3.767990] mfd_add_device+0x4ec/0x5c8
[ 3.771829] mfd_add_devices+0x88/0x11c
[ 3.775666] axp20x_device_probe+0x70/0x184
[ 3.779851] axp20x_i2c_probe+0x9c/0xd8
...
This is because we use PLATFORM_DEVID_NONE for the mfd_add_devices()
call, which would number the child devices in the same 0-based way, even
for the second (or any other) instance.
Use PLATFORM_DEVID_AUTO instead, which automatically assigns
non-conflicting device numbers.
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Chen-Yu Tsai <wens@csie.org>
---
drivers/mfd/axp20x.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c
index 5ceea359289f4..bc08ae4332604 100644
--- a/drivers/mfd/axp20x.c
+++ b/drivers/mfd/axp20x.c
@@ -1419,7 +1419,7 @@ int axp20x_device_probe(struct axp20x_dev *axp20x)
}
}
- ret = mfd_add_devices(axp20x->dev, -1, axp20x->cells,
+ ret = mfd_add_devices(axp20x->dev, PLATFORM_DEVID_AUTO, axp20x->cells,
axp20x->nr_cells, NULL, 0, NULL);
if (ret) {
--
2.46.2
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH v2 4/5] mfd: axp20x: Add support for AXP323
2024-10-07 0:14 [PATCH v2 0/5] regulator: add X-Powers AXP323 support Andre Przywara
` (2 preceding siblings ...)
2024-10-07 0:14 ` [PATCH v2 3/5] mfd: axp20x: Allow multiple regulators Andre Przywara
@ 2024-10-07 0:14 ` Andre Przywara
2024-10-07 0:14 ` [PATCH v2 5/5] regulator: axp20x: add support for the AXP323 Andre Przywara
2024-10-31 15:51 ` [PATCH v2 0/5] regulator: add X-Powers AXP323 support Lee Jones
5 siblings, 0 replies; 12+ messages in thread
From: Andre Przywara @ 2024-10-07 0:14 UTC (permalink / raw)
To: Lee Jones, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Chen-Yu Tsai, Liam Girdwood, Mark Brown
Cc: devicetree, linux-sunxi, linux-kernel, Martin Botka, Chris Morgan
The X-Powers AXP323 is a very close sibling of the AXP313A. The only
difference seems to be the ability to dual-phase the first two DC/DC
converter, which adds another register.
Add the required boilerplate to introduce a new PMIC to the AXP MFD
driver. Where possible, this just maps into the existing structs defined
for the AXP313A, only deviating where needed.
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Chen-Yu Tsai <wens@csie.org>
---
drivers/mfd/axp20x-i2c.c | 1 +
drivers/mfd/axp20x.c | 26 ++++++++++++++++++++++++++
include/linux/mfd/axp20x.h | 2 ++
3 files changed, 29 insertions(+)
diff --git a/drivers/mfd/axp20x-i2c.c b/drivers/mfd/axp20x-i2c.c
index 791a0b4cb64bb..5c93136f977e7 100644
--- a/drivers/mfd/axp20x-i2c.c
+++ b/drivers/mfd/axp20x-i2c.c
@@ -65,6 +65,7 @@ static const struct of_device_id axp20x_i2c_of_match[] = {
{ .compatible = "x-powers,axp221", .data = (void *)AXP221_ID },
{ .compatible = "x-powers,axp223", .data = (void *)AXP223_ID },
{ .compatible = "x-powers,axp313a", .data = (void *)AXP313A_ID },
+ { .compatible = "x-powers,axp323", .data = (void *)AXP323_ID },
{ .compatible = "x-powers,axp717", .data = (void *)AXP717_ID },
{ .compatible = "x-powers,axp803", .data = (void *)AXP803_ID },
{ .compatible = "x-powers,axp806", .data = (void *)AXP806_ID },
diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c
index bc08ae4332604..251465a656d09 100644
--- a/drivers/mfd/axp20x.c
+++ b/drivers/mfd/axp20x.c
@@ -42,6 +42,7 @@ static const char * const axp20x_model_names[] = {
[AXP223_ID] = "AXP223",
[AXP288_ID] = "AXP288",
[AXP313A_ID] = "AXP313a",
+ [AXP323_ID] = "AXP323",
[AXP717_ID] = "AXP717",
[AXP803_ID] = "AXP803",
[AXP806_ID] = "AXP806",
@@ -193,6 +194,10 @@ static const struct regmap_range axp313a_writeable_ranges[] = {
regmap_reg_range(AXP313A_ON_INDICATE, AXP313A_IRQ_STATE),
};
+static const struct regmap_range axp323_writeable_ranges[] = {
+ regmap_reg_range(AXP313A_ON_INDICATE, AXP323_DCDC_MODE_CTRL2),
+};
+
static const struct regmap_range axp313a_volatile_ranges[] = {
regmap_reg_range(AXP313A_SHUTDOWN_CTRL, AXP313A_SHUTDOWN_CTRL),
regmap_reg_range(AXP313A_IRQ_STATE, AXP313A_IRQ_STATE),
@@ -203,6 +208,11 @@ static const struct regmap_access_table axp313a_writeable_table = {
.n_yes_ranges = ARRAY_SIZE(axp313a_writeable_ranges),
};
+static const struct regmap_access_table axp323_writeable_table = {
+ .yes_ranges = axp323_writeable_ranges,
+ .n_yes_ranges = ARRAY_SIZE(axp323_writeable_ranges),
+};
+
static const struct regmap_access_table axp313a_volatile_table = {
.yes_ranges = axp313a_volatile_ranges,
.n_yes_ranges = ARRAY_SIZE(axp313a_volatile_ranges),
@@ -433,6 +443,15 @@ static const struct regmap_config axp313a_regmap_config = {
.cache_type = REGCACHE_MAPLE,
};
+static const struct regmap_config axp323_regmap_config = {
+ .reg_bits = 8,
+ .val_bits = 8,
+ .wr_table = &axp323_writeable_table,
+ .volatile_table = &axp313a_volatile_table,
+ .max_register = AXP323_DCDC_MODE_CTRL2,
+ .cache_type = REGCACHE_MAPLE,
+};
+
static const struct regmap_config axp717_regmap_config = {
.reg_bits = 8,
.val_bits = 8,
@@ -1221,6 +1240,7 @@ static int axp20x_power_off(struct sys_off_data *data)
unsigned int shutdown_reg;
switch (axp20x->variant) {
+ case AXP323_ID:
case AXP313A_ID:
shutdown_reg = AXP313A_SHUTDOWN_CTRL;
break;
@@ -1289,6 +1309,12 @@ int axp20x_match_device(struct axp20x_dev *axp20x)
axp20x->regmap_cfg = &axp313a_regmap_config;
axp20x->regmap_irq_chip = &axp313a_regmap_irq_chip;
break;
+ case AXP323_ID:
+ axp20x->nr_cells = ARRAY_SIZE(axp313a_cells);
+ axp20x->cells = axp313a_cells;
+ axp20x->regmap_cfg = &axp323_regmap_config;
+ axp20x->regmap_irq_chip = &axp313a_regmap_irq_chip;
+ break;
case AXP717_ID:
axp20x->nr_cells = ARRAY_SIZE(axp717_cells);
axp20x->cells = axp717_cells;
diff --git a/include/linux/mfd/axp20x.h b/include/linux/mfd/axp20x.h
index 79ecaaaa20703..c3df0e615fbf4 100644
--- a/include/linux/mfd/axp20x.h
+++ b/include/linux/mfd/axp20x.h
@@ -19,6 +19,7 @@ enum axp20x_variants {
AXP223_ID,
AXP288_ID,
AXP313A_ID,
+ AXP323_ID,
AXP717_ID,
AXP803_ID,
AXP806_ID,
@@ -113,6 +114,7 @@ enum axp20x_variants {
#define AXP313A_SHUTDOWN_CTRL 0x1a
#define AXP313A_IRQ_EN 0x20
#define AXP313A_IRQ_STATE 0x21
+#define AXP323_DCDC_MODE_CTRL2 0x22
#define AXP717_ON_INDICATE 0x00
#define AXP717_PMU_STATUS_2 0x01
--
2.46.2
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH v2 5/5] regulator: axp20x: add support for the AXP323
2024-10-07 0:14 [PATCH v2 0/5] regulator: add X-Powers AXP323 support Andre Przywara
` (3 preceding siblings ...)
2024-10-07 0:14 ` [PATCH v2 4/5] mfd: axp20x: Add support for AXP323 Andre Przywara
@ 2024-10-07 0:14 ` Andre Przywara
2024-10-15 10:23 ` Lee Jones
2024-10-31 15:51 ` [PATCH v2 0/5] regulator: add X-Powers AXP323 support Lee Jones
5 siblings, 1 reply; 12+ messages in thread
From: Andre Przywara @ 2024-10-07 0:14 UTC (permalink / raw)
To: Lee Jones, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Chen-Yu Tsai, Liam Girdwood, Mark Brown
Cc: devicetree, linux-sunxi, linux-kernel, Martin Botka, Chris Morgan
The X-Powers AXP323 is a very close sibling of the AXP313A. The only
difference seems to be the ability to dual-phase the first two DC/DC
converters.
Place the new AXP323 ID next to the existing AXP313A checks, to let
them share most code.
The only difference is the poly-phase detection code, which gets
extended to check the respective bit in a newly used register.
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Chen-Yu Tsai <wens@csie.org>
Reviewed-by: Mark Brown <broonie@kernel.org>
---
drivers/regulator/axp20x-regulator.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/drivers/regulator/axp20x-regulator.c b/drivers/regulator/axp20x-regulator.c
index 3ba76dbd0fb9e..e3cc59b82ea61 100644
--- a/drivers/regulator/axp20x-regulator.c
+++ b/drivers/regulator/axp20x-regulator.c
@@ -1341,6 +1341,7 @@ static int axp20x_set_dcdc_freq(struct platform_device *pdev, u32 dcdcfreq)
step = 150;
break;
case AXP313A_ID:
+ case AXP323_ID:
case AXP717_ID:
case AXP15060_ID:
/* The DCDC PWM frequency seems to be fixed to 3 MHz. */
@@ -1527,6 +1528,15 @@ static bool axp20x_is_polyphase_slave(struct axp20x_dev *axp20x, int id)
}
break;
+ case AXP323_ID:
+ regmap_read(axp20x->regmap, AXP323_DCDC_MODE_CTRL2, ®);
+
+ switch (id) {
+ case AXP313A_DCDC2:
+ return !!(reg & BIT(1));
+ }
+ break;
+
default:
return false;
}
@@ -1565,6 +1575,7 @@ static int axp20x_regulator_probe(struct platform_device *pdev)
"x-powers,drive-vbus-en");
break;
case AXP313A_ID:
+ case AXP323_ID:
regulators = axp313a_regulators;
nregulators = AXP313A_REG_ID_MAX;
break;
--
2.46.2
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH v2 5/5] regulator: axp20x: add support for the AXP323
2024-10-07 0:14 ` [PATCH v2 5/5] regulator: axp20x: add support for the AXP323 Andre Przywara
@ 2024-10-15 10:23 ` Lee Jones
2024-10-18 19:18 ` Mark Brown
0 siblings, 1 reply; 12+ messages in thread
From: Lee Jones @ 2024-10-15 10:23 UTC (permalink / raw)
To: Andre Przywara
Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Chen-Yu Tsai,
Liam Girdwood, Mark Brown, devicetree, linux-sunxi, linux-kernel,
Martin Botka, Chris Morgan
On Mon, 07 Oct 2024, Andre Przywara wrote:
> The X-Powers AXP323 is a very close sibling of the AXP313A. The only
> difference seems to be the ability to dual-phase the first two DC/DC
> converters.
>
> Place the new AXP323 ID next to the existing AXP313A checks, to let
> them share most code.
> The only difference is the poly-phase detection code, which gets
> extended to check the respective bit in a newly used register.
>
> Signed-off-by: Andre Przywara <andre.przywara@arm.com>
> Reviewed-by: Chen-Yu Tsai <wens@csie.org>
> Reviewed-by: Mark Brown <broonie@kernel.org>
Mark, can I take this without issuing a PR?
--
Lee Jones [李琼斯]
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v2 5/5] regulator: axp20x: add support for the AXP323
2024-10-15 10:23 ` Lee Jones
@ 2024-10-18 19:18 ` Mark Brown
0 siblings, 0 replies; 12+ messages in thread
From: Mark Brown @ 2024-10-18 19:18 UTC (permalink / raw)
To: Lee Jones
Cc: Andre Przywara, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Chen-Yu Tsai, Liam Girdwood, devicetree, linux-sunxi,
linux-kernel, Martin Botka, Chris Morgan
[-- Attachment #1: Type: text/plain, Size: 359 bytes --]
On Tue, Oct 15, 2024 at 11:23:14AM +0100, Lee Jones wrote:
> On Mon, 07 Oct 2024, Andre Przywara wrote:
>
> > The X-Powers AXP323 is a very close sibling of the AXP313A. The only
> > difference seems to be the ability to dual-phase the first two DC/DC
> > converters.
> Mark, can I take this without issuing a PR?
Yes, it should be fine I think.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v2 0/5] regulator: add X-Powers AXP323 support
2024-10-07 0:14 [PATCH v2 0/5] regulator: add X-Powers AXP323 support Andre Przywara
` (4 preceding siblings ...)
2024-10-07 0:14 ` [PATCH v2 5/5] regulator: axp20x: add support for the AXP323 Andre Przywara
@ 2024-10-31 15:51 ` Lee Jones
5 siblings, 0 replies; 12+ messages in thread
From: Lee Jones @ 2024-10-31 15:51 UTC (permalink / raw)
To: Lee Jones, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Chen-Yu Tsai, Liam Girdwood, Mark Brown, Andre Przywara
Cc: devicetree, linux-sunxi, linux-kernel, Martin Botka, Chris Morgan
On Mon, 07 Oct 2024 01:14:03 +0100, Andre Przywara wrote:
> A small update of version, just changing the regmap cache type to maple
> tree, and adding the accrued tags (thanks to the reviewers!).
> ================================
> The X-Powers AXP323 is a close sibling to the AXP313a PMIC, only that it
> allows to dual-phase the first two DC/DC converters. This is controlled
> via a new register. On the first glance that would sound like a
> compatible extension, but any random AXP313a driver would not know about
> the potential dual-phase nature of the second DCDC rail, so might want
> to turn that off, spoiling the whole setup. So this patchset introduces
> a new compatible string, without any fallbacks.
>
> [...]
Applied, thanks!
[1/5] dt-bindings: mfd: x-powers,axp152: Document AXP323
commit: bd91530aee6007a979e52d816779a6e10ed8c00a
[2/5] mfd: axp20x: ensure relationship between IDs and model names
commit: 697a4001d31a607a72c6297e4eb0f7918c6e6929
[3/5] mfd: axp20x: Allow multiple regulators
commit: e37ec32188701efa01455b9be42a392adab06ce4
[4/5] mfd: axp20x: Add support for AXP323
commit: 35fec94afe045856456faca4879b9c560e39d1e3
[5/5] regulator: axp20x: add support for the AXP323
commit: a0f8a8898e120d5a3f14cd22289daa3709d83f5b
--
Lee Jones [李琼斯]
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v2 3/5] mfd: axp20x: Allow multiple regulators
2024-10-07 0:14 ` [PATCH v2 3/5] mfd: axp20x: Allow multiple regulators Andre Przywara
@ 2024-12-07 17:45 ` Chris Morgan
2024-12-27 22:34 ` Vasily Khoruzhick
0 siblings, 1 reply; 12+ messages in thread
From: Chris Morgan @ 2024-12-07 17:45 UTC (permalink / raw)
To: Andre Przywara
Cc: Lee Jones, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Chen-Yu Tsai, Liam Girdwood, Mark Brown, devicetree, linux-sunxi,
linux-kernel, Martin Botka, Chris Morgan
On Mon, Oct 07, 2024 at 01:14:06AM +0100, Andre Przywara wrote:
> At the moment trying to register a second AXP chip makes the probe fail,
> as some sysfs registration fails due to a duplicate name:
>
> ...
> [ 3.688215] axp20x-i2c 0-0035: AXP20X driver loaded
> [ 3.695610] axp20x-i2c 0-0036: AXP20x variant AXP323 found
> [ 3.706151] sysfs: cannot create duplicate filename '/bus/platform/devices/axp20x-regulator'
> [ 3.714718] CPU: 0 UID: 0 PID: 1 Comm: swapper/0 Not tainted 6.12.0-rc1-00026-g50bf2e2c079d-dirty #192
> [ 3.724020] Hardware name: Avaota A1 (DT)
> [ 3.728029] Call trace:
> [ 3.730477] dump_backtrace+0x94/0xec
> [ 3.734146] show_stack+0x18/0x24
> [ 3.737462] dump_stack_lvl+0x80/0xf4
> [ 3.741128] dump_stack+0x18/0x24
> [ 3.744444] sysfs_warn_dup+0x64/0x80
> [ 3.748109] sysfs_do_create_link_sd+0xf0/0xf8
> [ 3.752553] sysfs_create_link+0x20/0x40
> [ 3.756476] bus_add_device+0x64/0x104
> [ 3.760229] device_add+0x310/0x760
> [ 3.763717] platform_device_add+0x10c/0x238
> [ 3.767990] mfd_add_device+0x4ec/0x5c8
> [ 3.771829] mfd_add_devices+0x88/0x11c
> [ 3.775666] axp20x_device_probe+0x70/0x184
> [ 3.779851] axp20x_i2c_probe+0x9c/0xd8
> ...
>
> This is because we use PLATFORM_DEVID_NONE for the mfd_add_devices()
> call, which would number the child devices in the same 0-based way, even
> for the second (or any other) instance.
>
> Use PLATFORM_DEVID_AUTO instead, which automatically assigns
> non-conflicting device numbers.
>
> Signed-off-by: Andre Przywara <andre.przywara@arm.com>
> Reviewed-by: Chen-Yu Tsai <wens@csie.org>
> ---
> drivers/mfd/axp20x.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c
> index 5ceea359289f4..bc08ae4332604 100644
> --- a/drivers/mfd/axp20x.c
> +++ b/drivers/mfd/axp20x.c
> @@ -1419,7 +1419,7 @@ int axp20x_device_probe(struct axp20x_dev *axp20x)
> }
> }
>
> - ret = mfd_add_devices(axp20x->dev, -1, axp20x->cells,
> + ret = mfd_add_devices(axp20x->dev, PLATFORM_DEVID_AUTO, axp20x->cells,
> axp20x->nr_cells, NULL, 0, NULL);
>
> if (ret) {
> --
> 2.46.2
>
Using git bisect, I found that this patch breaks the CONFIG_AXP20X_ADC
option which is used by some of the battery and charger drivers for the
axp20x PMIC series. My current assumption is that the
devm_iio_channel_get() call made by these drivers worked correctly
previously when the PLATFORM_DEVID_NONE, but now it's not working
anymore. I'm still testing possible solutions for that problem.
Thank you,
Chris
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v2 3/5] mfd: axp20x: Allow multiple regulators
2024-12-07 17:45 ` Chris Morgan
@ 2024-12-27 22:34 ` Vasily Khoruzhick
2025-01-06 19:50 ` Andrey Skvortsov
0 siblings, 1 reply; 12+ messages in thread
From: Vasily Khoruzhick @ 2024-12-27 22:34 UTC (permalink / raw)
To: Chris Morgan
Cc: Andre Przywara, Lee Jones, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Chen-Yu Tsai, Liam Girdwood, Mark Brown, devicetree,
linux-sunxi, linux-kernel, Martin Botka, Chris Morgan
On Sat, Dec 7, 2024 at 9:45 AM Chris Morgan <macroalpha82@gmail.com> wrote:
> Using git bisect, I found that this patch breaks the CONFIG_AXP20X_ADC
> option which is used by some of the battery and charger drivers for the
> axp20x PMIC series. My current assumption is that the
> devm_iio_channel_get() call made by these drivers worked correctly
> previously when the PLATFORM_DEVID_NONE, but now it's not working
> anymore. I'm still testing possible solutions for that problem.
I confirm that this patch breaks the battery driver on Pinebook (and
likely Pinephone). Reverting it fixes the issue for me.
> Thank you,
> Chris
>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v2 3/5] mfd: axp20x: Allow multiple regulators
2024-12-27 22:34 ` Vasily Khoruzhick
@ 2025-01-06 19:50 ` Andrey Skvortsov
0 siblings, 0 replies; 12+ messages in thread
From: Andrey Skvortsov @ 2025-01-06 19:50 UTC (permalink / raw)
To: Vasily Khoruzhick
Cc: Chris Morgan, Andre Przywara, Lee Jones, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Chen-Yu Tsai, Liam Girdwood,
Mark Brown, devicetree, linux-sunxi, linux-kernel, Martin Botka,
Chris Morgan
Hi,
On 24-12-27 14:34, Vasily Khoruzhick wrote:
> On Sat, Dec 7, 2024 at 9:45 AM Chris Morgan <macroalpha82@gmail.com> wrote:
>
> > Using git bisect, I found that this patch breaks the CONFIG_AXP20X_ADC
> > option which is used by some of the battery and charger drivers for the
> > axp20x PMIC series. My current assumption is that the
> > devm_iio_channel_get() call made by these drivers worked correctly
> > previously when the PLATFORM_DEVID_NONE, but now it's not working
> > anymore. I'm still testing possible solutions for that problem.
>
> I confirm that this patch breaks the battery driver on Pinebook (and
> likely Pinephone). Reverting it fixes the issue for me.
>
git bisect pointed me to this commit, when I've investigated why
battery power supply stopped working on PinePhone.
The problem is that devm_iio_channel_get() can't get channel by name,
since consumer's name has changed (from "axp20x-battery-power-supply" to
"axp20x-battery-power-supply.4.auto") and axp20x_adc has hardcoded
consumer dev names [1].
For other readers of this thread there is related discussion here. [2]
Chris, do you work on another solution of this problem?
1. https://elixir.bootlin.com/linux/v6.12.4/source/drivers/iio/adc/axp20x_adc.c#L176
2. https://lore.kernel.org/all/20241210224859.58917-1-macroalpha82@gmail.com/#t
--
Best regards,
Andrey Skvortsov
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2025-01-06 19:50 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-07 0:14 [PATCH v2 0/5] regulator: add X-Powers AXP323 support Andre Przywara
2024-10-07 0:14 ` [PATCH v2 1/5] dt-bindings: mfd: x-powers,axp152: Document AXP323 Andre Przywara
2024-10-07 0:14 ` [PATCH v2 2/5] mfd: axp20x: ensure relationship between IDs and model names Andre Przywara
2024-10-07 0:14 ` [PATCH v2 3/5] mfd: axp20x: Allow multiple regulators Andre Przywara
2024-12-07 17:45 ` Chris Morgan
2024-12-27 22:34 ` Vasily Khoruzhick
2025-01-06 19:50 ` Andrey Skvortsov
2024-10-07 0:14 ` [PATCH v2 4/5] mfd: axp20x: Add support for AXP323 Andre Przywara
2024-10-07 0:14 ` [PATCH v2 5/5] regulator: axp20x: add support for the AXP323 Andre Przywara
2024-10-15 10:23 ` Lee Jones
2024-10-18 19:18 ` Mark Brown
2024-10-31 15:51 ` [PATCH v2 0/5] regulator: add X-Powers AXP323 support Lee Jones
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).