Skip to contentSkip to conversation

regulator: Add X-Powers AXP717 PMIC support

PATCH In review Andre Przywara 8 participants 21 messages Mar 10, 2024 – Mar 28, 2024

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

cover regulator: Add X-Powers AXP717 PMIC support

This patch series adds support for the X-Powers AXP717 PMIC, which is used recently on new boards with Allwinner SoCs.
Allwinner's BSP code often speaks of the AXP2202, this seems to be the same chip, at least a boot0 AXP2202 driver happily drove a chip labelled AXP717.

Patch 1 fixes a typo in some macro names for the AXP313a PMIC, I just realised that during some copy&paste action. It's just an identifier rename, so not a backport candidate, I'd say.
Patch 2 adds the compatible string to the binding document. Patch 3 is the MFD part, describing the regmap and all the interrupts. So far we support the regulator and power key devices, the USB and charging devices will follow later.
Patch 4 adds the voltage regulator rails, this part is crucial to enable any board using this PMIC, as we depend on those rails even for basic devices.

Please note that I could not test this driver myself, but had success messages from others. It would be good to hear from Ryan and Chris here on the list, with a Tested-by: tag.

This series is based on next-20240308 for now. I will send a rebased update after the merge window, but wanted to start discussion and review now.

Please have a look!

Cheers,
Andre

Andre Przywara (4):
regulator: axp20x: fix typo-ed identifier
dt-bindings: mfd: x-powers,axp152: document AXP717
mfd: axp20x: add support for AXP717 PMIC
regulator: axp20x: add support for the AXP717

 .../bindings/mfd/x-powers,axp152.yaml         |  2 +
 drivers/mfd/axp20x-i2c.c                      |  2 +
 drivers/mfd/axp20x-rsb.c                      |  1 +
 drivers/mfd/axp20x.c                          | 90 +++++++++++++++++
 drivers/regulator/axp20x-regulator.c          | 94 +++++++++++++++++-
 include/linux/mfd/axp20x.h                    | 98 ++++++++++++++++++-
 6 files changed, 277 insertions(+), 10 deletions(-)
Signature · 1 line
2.35.8
#1 lore raw

PATCH 1/4 regulator: axp20x: fix typo-ed identifier

The registers to set the X-Powers AXP313 regulators are of course "CONTROL" registers, not "CONRTOL" ones.

Fix the typo in the header file and in its users. No functional change.

---
 drivers/regulator/axp20x-regulator.c | 10 +++++-----
 include/linux/mfd/axp20x.h           | 10 +++++-----
 2 files changed, 10 insertions(+), 10 deletions(-)
drivers/regulator/axp20x-regulator.c +5 -5
index c657820b0bbb5..7bcc2d508b65a 100644
@@ -733,21 +733,21 @@ static const struct linear_range axp313a_dcdc3_ranges[] = {
 static const struct regulator_desc axp313a_regulators[] = {
 	AXP_DESC_RANGES(AXP313A, DCDC1, "dcdc1", "vin1",
 			axp313a_dcdc1_ranges, AXP313A_DCDC1_NUM_VOLTAGES,
-			AXP313A_DCDC1_CONRTOL, AXP313A_DCDC_V_OUT_MASK,
+			AXP313A_DCDC1_CONTROL, AXP313A_DCDC_V_OUT_MASK,
 			AXP313A_OUTPUT_CONTROL, BIT(0)),
 	AXP_DESC_RANGES(AXP313A, DCDC2, "dcdc2", "vin2",
 			axp313a_dcdc2_ranges, AXP313A_DCDC23_NUM_VOLTAGES,
-			AXP313A_DCDC2_CONRTOL, AXP313A_DCDC_V_OUT_MASK,
+			AXP313A_DCDC2_CONTROL, AXP313A_DCDC_V_OUT_MASK,
 			AXP313A_OUTPUT_CONTROL, BIT(1)),
 	AXP_DESC_RANGES(AXP313A, DCDC3, "dcdc3", "vin3",
 			axp313a_dcdc3_ranges, AXP313A_DCDC23_NUM_VOLTAGES,
-			AXP313A_DCDC3_CONRTOL, AXP313A_DCDC_V_OUT_MASK,
+			AXP313A_DCDC3_CONTROL, AXP313A_DCDC_V_OUT_MASK,
 			AXP313A_OUTPUT_CONTROL, BIT(2)),
 	AXP_DESC(AXP313A, ALDO1, "aldo1", "vin1", 500, 3500, 100,
-		 AXP313A_ALDO1_CONRTOL, AXP313A_LDO_V_OUT_MASK,
+		 AXP313A_ALDO1_CONTROL, AXP313A_LDO_V_OUT_MASK,
 		 AXP313A_OUTPUT_CONTROL, BIT(3)),
 	AXP_DESC(AXP313A, DLDO1, "dldo1", "vin1", 500, 3500, 100,
-		 AXP313A_DLDO1_CONRTOL, AXP313A_LDO_V_OUT_MASK,
+		 AXP313A_DLDO1_CONTROL, AXP313A_LDO_V_OUT_MASK,
 		 AXP313A_OUTPUT_CONTROL, BIT(4)),
 	AXP_DESC_FIXED(AXP313A, RTC_LDO, "rtc-ldo", "vin1", 1800),
 };
include/linux/mfd/axp20x.h +5 -5
index f1755163dd9f1..9b2b7ac2107f4 100644
@@ -104,11 +104,11 @@ enum axp20x_variants {
 
 #define AXP313A_ON_INDICATE		0x00
 #define AXP313A_OUTPUT_CONTROL		0x10
-#define AXP313A_DCDC1_CONRTOL		0x13
-#define AXP313A_DCDC2_CONRTOL		0x14
-#define AXP313A_DCDC3_CONRTOL		0x15
-#define AXP313A_ALDO1_CONRTOL		0x16
-#define AXP313A_DLDO1_CONRTOL		0x17
+#define AXP313A_DCDC1_CONTROL		0x13
+#define AXP313A_DCDC2_CONTROL		0x14
+#define AXP313A_DCDC3_CONTROL		0x15
+#define AXP313A_ALDO1_CONTROL		0x16
+#define AXP313A_DLDO1_CONTROL		0x17
 #define AXP313A_SHUTDOWN_CTRL		0x1a
 #define AXP313A_IRQ_EN			0x20
 #define AXP313A_IRQ_STATE		0x21
Signature · 1 line
2.35.8
maintainer Acked-by on v1 1/4
#2 lore raw

Re: [PATCH 1/4] regulator: axp20x: fix typo-ed identifier

Dne nedelja, 10. marec 2024 ob 02:02:08 CET je Andre Przywara napisal(a):

Quoted 6 lines

The registers to set the X-Powers AXP313 regulators are of course "CONTROL" registers, not "CONRTOL" ones.

Fix the typo in the header file and in its users. No functional change.

Best regards,
Jernej

#3 lore raw

PATCH 2/4 dt-bindings: mfd: x-powers,axp152: document AXP717

In reply to Andre Przywara

The X-Powers AXP717 is a PMIC used on some newer Allwinner devices. Among quite some regulators it features the usual ADC/IRQ/power key parts, plus a battery charger circuit, and some newly introduced USB type-C circuitry.
Like two other recent PMICs, it lacks the DC/DC converter PWM frequency control register, that rate is fixed here as well.

Add the new compatible string, and add that to the list of PMICs without the PWM frequency property.

---
 Documentation/devicetree/bindings/mfd/x-powers,axp152.yaml | 2 ++
 1 file changed, 2 insertions(+)
Documentation/devicetree/bindings/mfd/x-powers,axp152.yaml +2 -0
index 06f1779835a1e..b8e8db0d58e9c 100644
@@ -83,6 +83,7 @@ allOf:
             enum:
               - x-powers,axp313a
               - x-powers,axp15060
+              - x-powers,axp717
 
     then:
       properties:
@@ -99,6 +100,7 @@ properties:
           - x-powers,axp221
           - x-powers,axp223
           - x-powers,axp313a
+          - x-powers,axp717
           - x-powers,axp803
           - x-powers,axp806
           - x-powers,axp809
Signature · 1 line
2.35.8
Acked-by on v1 2/4
#4 lore raw

Re: [PATCH 2/4] dt-bindings: mfd: x-powers,axp152: document AXP717

Quoted 9 lines · Andre Przywara

The X-Powers AXP717 is a PMIC used on some newer Allwinner devices. Among quite some regulators it features the usual ADC/IRQ/power key parts, plus a battery charger circuit, and some newly introduced USB type-C circuitry.
Like two other recent PMICs, it lacks the DC/DC converter PWM frequency control register, that rate is fixed here as well.

Add the new compatible string, and add that to the list of PMICs without the PWM frequency property.

Best regards,
Krzysztof

maintainer
#5 lore raw

Re: [PATCH 2/4] dt-bindings: mfd: x-powers,axp152: document AXP717

In reply to Andre Przywara

Hi Andre,

Quoted 4 lines · Andre Przywara

The X-Powers AXP717 is a PMIC used on some newer Allwinner devices. Among quite some regulators it features the usual ADC/IRQ/power key parts, plus a battery charger circuit, and some newly introduced USB type-C circuitry.

Do you plan to put the Type-C logic under a subnode, or should the Type-C connector node go directly under the PMIC node? Either way, the binding probably needs to be updated for that.

Quoted 24 lines

Like two other recent PMICs, it lacks the DC/DC converter PWM frequency control register, that rate is fixed here as well.

Add the new compatible string, and add that to the list of PMICs without the PWM frequency property.

---
 Documentation/devicetree/bindings/mfd/x-powers,axp152.yaml | 2 ++
 1 file changed, 2 insertions(+)
Documentation/devicetree/bindings/mfd/x-powers,axp152.yaml +1 -0
index 06f1779835a1e..b8e8db0d58e9c 100644
@@ -83,6 +83,7 @@ allOf:
             enum:
               - x-powers,axp313a
               - x-powers,axp15060
+              - x-powers,axp717
 
     then:
       properties:

Documentation/devicetree/bindings/mfd/x-powers,axp152.yaml properties: · line 106

Quoted 7 lines
Documentation/devicetree/bindings/mfd/x-powers,axp152.yaml +1 -0
@@ -99,6 +100,7 @@ properties:
           - x-powers,axp221
           - x-powers,axp223
           - x-powers,axp313a
+          - x-powers,axp717
           - x-powers,axp803
           - x-powers,axp806
           - x-powers,axp809

The regulators patternProperties needs to be updated for the new boost regulator.

Regards,
Samuel

#6 lore raw

Re: [PATCH 2/4] dt-bindings: mfd: x-powers,axp152: document AXP717

On Mon, 11 Mar 2024 17:20:50 -0500
Samuel Holland <[email protected]> wrote:

Hi Samuel,

thanks for having a look!

Quoted 9 lines · Andre Przywara
Quoted 4 lines

The X-Powers AXP717 is a PMIC used on some newer Allwinner devices. Among quite some regulators it features the usual ADC/IRQ/power key parts, plus a battery charger circuit, and some newly introduced USB type-C circuitry.

Do you plan to put the Type-C logic under a subnode, or should the Type-C connector node go directly under the PMIC node? Either way, the binding probably needs to be updated for that.

I haven't looked into this yet, so cannot say which way to go. I definitely consider this some non-trivial task, so indeed wanted to push this off to later.
For now there is a device (Anbernic RG35XX) with that PMIC, so we need at least the regulators to unblock this. USB support is not critical for now.

Quoted 21 lines
Quoted 21 lines

Like two other recent PMICs, it lacks the DC/DC converter PWM frequency control register, that rate is fixed here as well.

Add the new compatible string, and add that to the list of PMICs without the PWM frequency property.

---
 Documentation/devicetree/bindings/mfd/x-powers,axp152.yaml | 2 ++
 1 file changed, 2 insertions(+)
Documentation/devicetree/bindings/mfd/x-powers,axp152.yaml +1 -0
index 06f1779835a1e..b8e8db0d58e9c 100644
@@ -83,6 +83,7 @@ allOf:
             enum:
               - x-powers,axp313a
               - x-powers,axp15060
+              - x-powers,axp717
 
Quoted 13 lines

Documentation/devicetree/bindings/mfd/x-powers,axp152.yaml properties: · line 106

Quoted 10 lines
Documentation/devicetree/bindings/mfd/x-powers,axp152.yaml +1 -0
     then:
       properties:
@@ -99,6 +100,7 @@ properties:
           - x-powers,axp221
           - x-powers,axp223
           - x-powers,axp313a
+          - x-powers,axp717
           - x-powers,axp803
           - x-powers,axp806
           - x-powers,axp809  

The regulators patternProperties needs to be updated for the new boost regulator.

Ah, I indeed missed this one. I think the former PMICs had this batter->VBUS boost regulator hidden, controlled entirely by the PMIC? I will need to check if exposing this will present any surprises. I guess this goes together with the USB-C support, to have role switching, unless this appears on some device with just USB-A or micro-B. I will check what it takes to add this one, the regulator itself looks easy.

Thanks!
Andre.

#7 lore raw

Re: [PATCH 2/4] dt-bindings: mfd: x-powers,axp152: document AXP717

Quoted 59 lines · Andre Przywara

On Mon, 11 Mar 2024 17:20:50 -0500
Samuel Holland <[email protected]> wrote:

Hi Samuel,

thanks for having a look!

Quoted 9 lines · Andre Przywara
Quoted 4 lines

The X-Powers AXP717 is a PMIC used on some newer Allwinner devices. Among quite some regulators it features the usual ADC/IRQ/power key parts, plus a battery charger circuit, and some newly introduced USB type-C circuitry.

Do you plan to put the Type-C logic under a subnode, or should the Type-C connector node go directly under the PMIC node? Either way, the binding probably needs to be updated for that.

I haven't looked into this yet, so cannot say which way to go. I definitely consider this some non-trivial task, so indeed wanted to push this off to later.
For now there is a device (Anbernic RG35XX) with that PMIC, so we need at least the regulators to unblock this. USB support is not critical for now.

Quoted 21 lines
Quoted 21 lines

Like two other recent PMICs, it lacks the DC/DC converter PWM frequency control register, that rate is fixed here as well.

Add the new compatible string, and add that to the list of PMICs without the PWM frequency property.

---
 Documentation/devicetree/bindings/mfd/x-powers,axp152.yaml | 2 ++
 1 file changed, 2 insertions(+)
Documentation/devicetree/bindings/mfd/x-powers,axp152.yaml +1 -0
index 06f1779835a1e..b8e8db0d58e9c 100644
@@ -83,6 +83,7 @@ allOf:
             enum:
               - x-powers,axp313a
               - x-powers,axp15060
+              - x-powers,axp717
 
Quoted 13 lines

Documentation/devicetree/bindings/mfd/x-powers,axp152.yaml properties: · line 106

Quoted 10 lines
Documentation/devicetree/bindings/mfd/x-powers,axp152.yaml +1 -0
     then:
       properties:
@@ -99,6 +100,7 @@ properties:
           - x-powers,axp221
           - x-powers,axp223
           - x-powers,axp313a
+          - x-powers,axp717
           - x-powers,axp803
           - x-powers,axp806
           - x-powers,axp809

The regulators patternProperties needs to be updated for the new boost regulator.

Quoted 7 lines

Ah, I indeed missed this one. I think the former PMICs had this batter->VBUS boost regulator hidden, controlled entirely by the PMIC? I will need to check if exposing this will present any surprises. I guess this goes together with the USB-C support, to have role switching, unless this appears on some device with just USB-A or micro-B. I will check what it takes to add this one, the regulator itself looks easy.

I don't think there was such a boost regulator on previous PMICs. It was just a passthrough, which is why on some boards such as the Cubietruck there is an external boost converter to put out 5V when just the battery is used.

ChenYu

#8 lore raw

PATCH 3/4 mfd: axp20x: add support for AXP717 PMIC

In reply to Andre Przywara

The AXP717a is a PMIC chip produced by X-Powers, it can be connected to an I2C or RSB bus.

It's a rather complete PMIC, with many regulators, interrupts, an ADC and battery charging functionality. It also offer USB type-C CC pin handling.

Describe the regmap and the MFD bits, along with the registers exposed via I2C or RSB. This covers the regulator, interrupts and power key devices for now.
Advertise the device using the new compatible string.

---
 drivers/mfd/axp20x-i2c.c   |  2 +
 drivers/mfd/axp20x-rsb.c   |  1 +
 drivers/mfd/axp20x.c       | 90 ++++++++++++++++++++++++++++++++++++++
 include/linux/mfd/axp20x.h | 67 ++++++++++++++++++++++++++++
 4 files changed, 160 insertions(+)
drivers/mfd/axp20x-i2c.c +2 -0
index 68d3560cfe4a0..b8e7ac89f6976 100644
@@ -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,axp717", .data = (void *)AXP717_ID },
 	{ .compatible = "x-powers,axp803", .data = (void *)AXP803_ID },
 	{ .compatible = "x-powers,axp806", .data = (void *)AXP806_ID },
 	{ .compatible = "x-powers,axp15060", .data = (void *)AXP15060_ID },
@@ -81,6 +82,7 @@ static const struct i2c_device_id axp20x_i2c_id[] = {
 	{ "axp221", 0 },
 	{ "axp223", 0 },
 	{ "axp313a", 0 },
+	{ "axp717", 0 },
 	{ "axp803", 0 },
 	{ "axp806", 0 },
 	{ "axp15060", 0 },
drivers/mfd/axp20x-rsb.c +1 -0
index 214bc0d84d44c..059656f2a1bd6 100644
@@ -58,6 +58,7 @@ static void axp20x_rsb_remove(struct sunxi_rsb_device *rdev)
 
 static const struct of_device_id axp20x_rsb_of_match[] = {
 	{ .compatible = "x-powers,axp223", .data = (void *)AXP223_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 },
 	{ .compatible = "x-powers,axp809", .data = (void *)AXP809_ID },
drivers/mfd/axp20x.c +90 -0

138 lines not on this page · raw message

include/linux/mfd/axp20x.h +67 -0

85 lines not on this page · raw message

Signature · 1 line
2.35.8
maintainer Acked-by on v1 3/4
#9 lore raw

Re: [PATCH 3/4] mfd: axp20x: add support for AXP717 PMIC

Dne nedelja, 10. marec 2024 ob 02:02:10 CET je Andre Przywara napisal(a):

Quoted 7 lines

The AXP717a is a PMIC chip produced by X-Powers, it can be connected to an I2C or RSB bus.

It's a rather complete PMIC, with many regulators, interrupts, an ADC and battery charging functionality. It also offer USB type-C CC pin handling.

Quoted 6 lines

Describe the regmap and the MFD bits, along with the registers exposed via I2C or RSB. This covers the regulator, interrupts and power key devices for now.
Advertise the device using the new compatible string.

Best regards,
Jernej

#10 lore raw

PATCH 4/4 regulator: axp20x: add support for the AXP717

In reply to Andre Przywara

The X-Powers AXP717 is a typical PMIC from X-Powers, featuring four DC/DC converters and 15 LDOs, on the regulator side.

Describe the chip's voltage settings and switch registers, how the voltages are encoded, and connect this to the MFD device via its regulator ID.

---
 drivers/regulator/axp20x-regulator.c | 84 ++++++++++++++++++++++++++++
 include/linux/mfd/axp20x.h           | 21 +++++++
 2 files changed, 105 insertions(+)
drivers/regulator/axp20x-regulator.c +84 -0
index 7bcc2d508b65a..34fcdd82b2eaa 100644
@@ -138,6 +138,12 @@
 #define AXP313A_DCDC_V_OUT_MASK		GENMASK(6, 0)
 #define AXP313A_LDO_V_OUT_MASK		GENMASK(4, 0)
 
+#define AXP717_DCDC1_NUM_VOLTAGES	88
+#define AXP717_DCDC2_NUM_VOLTAGES	107
+#define AXP717_DCDC3_NUM_VOLTAGES	104
+#define AXP717_DCDC_V_OUT_MASK		GENMASK(6, 0)
+#define AXP717_LDO_V_OUT_MASK		GENMASK(4, 0)
+
 #define AXP803_PWR_OUT_DCDC1_MASK	BIT_MASK(0)
 #define AXP803_PWR_OUT_DCDC2_MASK	BIT_MASK(1)
 #define AXP803_PWR_OUT_DCDC3_MASK	BIT_MASK(2)
@@ -752,6 +758,79 @@ static const struct regulator_desc axp313a_regulators[] = {
 	AXP_DESC_FIXED(AXP313A, RTC_LDO, "rtc-ldo", "vin1", 1800),
 };
 
+static const struct linear_range axp717_dcdc1_ranges[] = {
+	REGULATOR_LINEAR_RANGE(500000,   0, 70, 10000),
+	REGULATOR_LINEAR_RANGE(1220000, 71, 87, 20000),
+};
+
+static const struct linear_range axp717_dcdc2_ranges[] = {
+	REGULATOR_LINEAR_RANGE(500000,   0,  70,  10000),
+	REGULATOR_LINEAR_RANGE(1220000, 71,  87,  20000),
+	REGULATOR_LINEAR_RANGE(1600000, 88, 107, 100000),
+};
+
+static const struct linear_range axp717_dcdc3_ranges[] = {
+	REGULATOR_LINEAR_RANGE(500000,   0,  70, 10000),
+	REGULATOR_LINEAR_RANGE(1220000, 71, 102, 20000),
+};
+
+static const struct regulator_desc axp717_regulators[] = {
+	AXP_DESC_RANGES(AXP717, DCDC1, "dcdc1", "vin1",
+			axp717_dcdc1_ranges, AXP717_DCDC1_NUM_VOLTAGES,
+			AXP717_DCDC1_CONTROL, AXP717_DCDC_V_OUT_MASK,
+			AXP717_DCDC_OUTPUT_CONTROL, BIT(0)),
+	AXP_DESC_RANGES(AXP717, DCDC2, "dcdc2", "vin2",
+			axp717_dcdc2_ranges, AXP717_DCDC2_NUM_VOLTAGES,
+			AXP717_DCDC2_CONTROL, AXP717_DCDC_V_OUT_MASK,
+			AXP717_DCDC_OUTPUT_CONTROL, BIT(1)),
+	AXP_DESC_RANGES(AXP717, DCDC3, "dcdc3", "vin3",
+			axp717_dcdc3_ranges, AXP717_DCDC3_NUM_VOLTAGES,
+			AXP717_DCDC3_CONTROL, AXP717_DCDC_V_OUT_MASK,
+			AXP717_DCDC_OUTPUT_CONTROL, BIT(2)),
+	AXP_DESC(AXP717, DCDC4, "dcdc4", "vin4", 1000, 3700, 100,
+		 AXP717_DCDC4_CONTROL, AXP717_DCDC_V_OUT_MASK,
+		 AXP717_DCDC_OUTPUT_CONTROL, BIT(3)),
+	AXP_DESC(AXP717, ALDO1, "aldo1", "vin1", 500, 3500, 100,
+		 AXP717_ALDO1_CONTROL, AXP717_LDO_V_OUT_MASK,
+		 AXP717_LDO0_OUTPUT_CONTROL, BIT(0)),
+	AXP_DESC(AXP717, ALDO2, "aldo2", "vin1", 500, 3500, 100,
+		 AXP717_ALDO2_CONTROL, AXP717_LDO_V_OUT_MASK,
+		 AXP717_LDO0_OUTPUT_CONTROL, BIT(1)),
+	AXP_DESC(AXP717, ALDO3, "aldo3", "vin1", 500, 3500, 100,
+		 AXP717_ALDO3_CONTROL, AXP717_LDO_V_OUT_MASK,
+		 AXP717_LDO0_OUTPUT_CONTROL, BIT(2)),
+	AXP_DESC(AXP717, ALDO4, "aldo4", "vin1", 500, 3500, 100,
+		 AXP717_ALDO4_CONTROL, AXP717_LDO_V_OUT_MASK,
+		 AXP717_LDO0_OUTPUT_CONTROL, BIT(3)),
+	AXP_DESC(AXP717, BLDO1, "bldo1", "vin1", 500, 3500, 100,
+		 AXP717_BLDO1_CONTROL, AXP717_LDO_V_OUT_MASK,
+		 AXP717_LDO0_OUTPUT_CONTROL, BIT(4)),
+	AXP_DESC(AXP717, BLDO2, "bldo2", "vin1", 500, 3500, 100,
+		 AXP717_BLDO2_CONTROL, AXP717_LDO_V_OUT_MASK,
+		 AXP717_LDO0_OUTPUT_CONTROL, BIT(5)),
+	AXP_DESC(AXP717, BLDO3, "bldo3", "vin1", 500, 3500, 100,
+		 AXP717_BLDO3_CONTROL, AXP717_LDO_V_OUT_MASK,
+		 AXP717_LDO0_OUTPUT_CONTROL, BIT(6)),
+	AXP_DESC(AXP717, BLDO4, "bldo4", "vin1", 500, 3500, 100,
+		 AXP717_BLDO4_CONTROL, AXP717_LDO_V_OUT_MASK,
+		 AXP717_LDO0_OUTPUT_CONTROL, BIT(7)),
+	AXP_DESC(AXP717, CLDO1, "cldo1", "vin1", 500, 3500, 100,
+		 AXP717_CLDO1_CONTROL, AXP717_LDO_V_OUT_MASK,
+		 AXP717_LDO1_OUTPUT_CONTROL, BIT(0)),
+	AXP_DESC(AXP717, CLDO2, "cldo2", "vin1", 500, 3500, 100,
+		 AXP717_CLDO2_CONTROL, AXP717_LDO_V_OUT_MASK,
+		 AXP717_LDO1_OUTPUT_CONTROL, BIT(1)),
+	AXP_DESC(AXP717, CLDO3, "cldo3", "vin1", 500, 3500, 100,
+		 AXP717_CLDO3_CONTROL, AXP717_LDO_V_OUT_MASK,
+		 AXP717_LDO1_OUTPUT_CONTROL, BIT(2)),
+	AXP_DESC(AXP717, CLDO4, "cldo4", "vin1", 500, 3500, 100,
+		 AXP717_CLDO4_CONTROL, AXP717_LDO_V_OUT_MASK,
+		 AXP717_LDO1_OUTPUT_CONTROL, BIT(3)),
+	AXP_DESC(AXP717, CPUSLDO, "cpusldo", "vin1", 500, 1400, 50,
+		 AXP717_CPUSLDO_CONTROL, AXP717_LDO_V_OUT_MASK,
+		 AXP717_LDO1_OUTPUT_CONTROL, BIT(4)),
+};
+
 /* DCDC ranges shared with AXP813 */
 static const struct linear_range axp803_dcdc234_ranges[] = {
 	REGULATOR_LINEAR_RANGE(500000,
@@ -1253,6 +1332,7 @@ static int axp20x_set_dcdc_freq(struct platform_device *pdev, u32 dcdcfreq)
 		step = 150;
 		break;
 	case AXP313A_ID:
+	case AXP717_ID:
 	case AXP15060_ID:
 		/* The DCDC PWM frequency seems to be fixed to 3 MHz. */
 		if (dcdcfreq != 0) {
@@ -1479,6 +1559,10 @@ static int axp20x_regulator_probe(struct platform_device *pdev)
 		regulators = axp313a_regulators;
 		nregulators = AXP313A_REG_ID_MAX;
 		break;
+	case AXP717_ID:
+		regulators = axp717_regulators;
+		nregulators = AXP717_REG_ID_MAX;
+		break;
 	case AXP803_ID:
 		regulators = axp803_regulators;
 		nregulators = AXP803_REG_ID_MAX;
include/linux/mfd/axp20x.h +21 -0
index fd7a41a69526f..8c0a33a2e9ce2 100644
@@ -466,6 +466,27 @@ enum {
 	AXP313A_REG_ID_MAX,
 };
 
+enum {
+	AXP717_DCDC1 = 0,
+	AXP717_DCDC2,
+	AXP717_DCDC3,
+	AXP717_DCDC4,
+	AXP717_ALDO1,
+	AXP717_ALDO2,
+	AXP717_ALDO3,
+	AXP717_ALDO4,
+	AXP717_BLDO1,
+	AXP717_BLDO2,
+	AXP717_BLDO3,
+	AXP717_BLDO4,
+	AXP717_CLDO1,
+	AXP717_CLDO2,
+	AXP717_CLDO3,
+	AXP717_CLDO4,
+	AXP717_CPUSLDO,
+	AXP717_REG_ID_MAX,
+};
+
 enum {
 	AXP806_DCDCA = 0,
 	AXP806_DCDCB,
Signature · 1 line
2.35.8
maintainer
#11 lore raw

Re: [PATCH 4/4] regulator: axp20x: add support for the AXP717

Hi Andre,

Quoted 7 lines · Andre Przywara

The X-Powers AXP717 is a typical PMIC from X-Powers, featuring four DC/DC converters and 15 LDOs, on the regulator side.

Describe the chip's voltage settings and switch registers, how the voltages are encoded, and connect this to the MFD device via its regulator ID.

Quoted 5 lines
---
 drivers/regulator/axp20x-regulator.c | 84 ++++++++++++++++++++++++++++
 include/linux/mfd/axp20x.h           | 21 +++++++
 2 files changed, 105 insertions(+)

This is missing support for the boost regulator.

Regards,
Samuel

maintainer
#12 lore raw

Re: [PATCH 4/4] regulator: axp20x: add support for the AXP717

Quoted 10 lines · Samuel Holland
Quoted 6 lines · Andre Przywara

The X-Powers AXP717 is a typical PMIC from X-Powers, featuring four DC/DC converters and 15 LDOs, on the regulator side.

Describe the chip's voltage settings and switch registers, how the voltages are encoded, and connect this to the MFD device via its regulator ID.

This is missing support for the boost regulator.

That can always be added incrementally.

maintainer Acked-by on v1 4/4
#13 lore raw

Re: [PATCH 4/4] regulator: axp20x: add support for the AXP717

In reply to Andre Przywara
Quoted 6 lines · Andre Przywara

The X-Powers AXP717 is a typical PMIC from X-Powers, featuring four DC/DC converters and 15 LDOs, on the regulator side.

Describe the chip's voltage settings and switch registers, how the voltages are encoded, and connect this to the MFD device via its regulator ID.

Tested-by on the v1 series
#14 lore raw
In reply to Andre Przywara
Quoted 6 lines · Andre Przywara

This patch series adds support for the X-Powers AXP717 PMIC, which is used recently on new boards with Allwinner SoCs.

Please note that I could not test this driver myself, but had success messages from others. It would be good to hear from Ryan and Chris here on the list, with a Tested-by: tag.

Thanks Andre, tested on an Allwinner H700-based board (Anbernic RG35XX+) with successful bringup of DRAM, boot and regulator reporting via /sys/kernel/debug/regulator/regulator_summary.

Battery charging not tested but according to vendor datasheet this functionality is internal to the PMIC and can complete without reference to the host, with informational reporting and charging parameters optionally modified by host over I2C or RSB.

Ryan

maintainer
#15 lore raw
In reply to Andre Przywara
Quoted 36 lines · Andre Przywara

This patch series adds support for the X-Powers AXP717 PMIC, which is used recently on new boards with Allwinner SoCs.
Allwinner's BSP code often speaks of the AXP2202, this seems to be the same chip, at least a boot0 AXP2202 driver happily drove a chip labelled AXP717.

Patch 1 fixes a typo in some macro names for the AXP313a PMIC, I just realised that during some copy&paste action. It's just an identifier rename, so not a backport candidate, I'd say.
Patch 2 adds the compatible string to the binding document. Patch 3 is the MFD part, describing the regmap and all the interrupts. So far we support the regulator and power key devices, the USB and charging devices will follow later.
Patch 4 adds the voltage regulator rails, this part is crucial to enable any board using this PMIC, as we depend on those rails even for basic devices.

Please note that I could not test this driver myself, but had success messages from others. It would be good to hear from Ryan and Chris here on the list, with a Tested-by: tag.

This series is based on next-20240308 for now. I will send a rebased update after the merge window, but wanted to start discussion and review now.

Please have a look!

Cheers,
Andre

Andre Przywara (4):
regulator: axp20x: fix typo-ed identifier
dt-bindings: mfd: x-powers,axp152: document AXP717
mfd: axp20x: add support for AXP717 PMIC
regulator: axp20x: add support for the AXP717

Quoted 7 lines
 .../bindings/mfd/x-powers,axp152.yaml         |  2 +
 drivers/mfd/axp20x-i2c.c                      |  2 +
 drivers/mfd/axp20x-rsb.c                      |  1 +
 drivers/mfd/axp20x.c                          | 90 +++++++++++++++++
 drivers/regulator/axp20x-regulator.c          | 94 +++++++++++++++++-
 include/linux/mfd/axp20x.h                    | 98 ++++++++++++++++++-
 6 files changed, 277 insertions(+), 10 deletions(-)

All applied and sent for build testing. If everything works out, I'll send out a pull-request to an immutable branch shortly.

Signature · 1 line
Lee Jones [李琼斯]
maintainer
#16 lore raw
Quoted 46 lines · Lee Jones
Quoted 36 lines · Andre Przywara

This patch series adds support for the X-Powers AXP717 PMIC, which is used recently on new boards with Allwinner SoCs.
Allwinner's BSP code often speaks of the AXP2202, this seems to be the same chip, at least a boot0 AXP2202 driver happily drove a chip labelled AXP717.

Patch 1 fixes a typo in some macro names for the AXP313a PMIC, I just realised that during some copy&paste action. It's just an identifier rename, so not a backport candidate, I'd say.
Patch 2 adds the compatible string to the binding document. Patch 3 is the MFD part, describing the regmap and all the interrupts. So far we support the regulator and power key devices, the USB and charging devices will follow later.
Patch 4 adds the voltage regulator rails, this part is crucial to enable any board using this PMIC, as we depend on those rails even for basic devices.

Please note that I could not test this driver myself, but had success messages from others. It would be good to hear from Ryan and Chris here on the list, with a Tested-by: tag.

This series is based on next-20240308 for now. I will send a rebased update after the merge window, but wanted to start discussion and review now.

Please have a look!

Cheers,
Andre

Andre Przywara (4):
regulator: axp20x: fix typo-ed identifier
dt-bindings: mfd: x-powers,axp152: document AXP717
mfd: axp20x: add support for AXP717 PMIC
regulator: axp20x: add support for the AXP717

Quoted 7 lines
 .../bindings/mfd/x-powers,axp152.yaml         |  2 +
 drivers/mfd/axp20x-i2c.c                      |  2 +
 drivers/mfd/axp20x-rsb.c                      |  1 +
 drivers/mfd/axp20x.c                          | 90 +++++++++++++++++
 drivers/regulator/axp20x-regulator.c          | 94 +++++++++++++++++-
 include/linux/mfd/axp20x.h                    | 98 ++++++++++++++++++-
 6 files changed, 277 insertions(+), 10 deletions(-)
Quoted 2 lines

All applied and sent for build testing. If everything works out, I'll send out a pull-request to an immutable branch shortly.

Okay, these are building okay based on v6.8.

I'll send out a PR once I can rebase tem onto v6.9-rc1.

Note to self: ib-mfd-regulator-6.9

Signature · 1 line
Lee Jones [李琼斯]
maintainer
#17 lore raw

[GIT PULL] Immutable branch between MFD and Regulator due for the v6.9 merge window:wq

In reply to Andre Przywara

Enjoy!

The following changes since commit 4cece764965020c22cff7665b18a012006359095:

Linux 6.9-rc1 (2024-03-24 14:10:05 -0700)

are available in the Git repository at:

git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd.git ib-mfd-regulator-v6.9

for you to fetch changes up to d2ac3df75c3a995064cfac0171e082a30d8c4c66:

regulator: axp20x: add support for the AXP717 (2024-03-28 09:51:03 +0000)

----------------------------------------------------------------
Immutable branch between MFD and Regulator due for the v6.9 merge window

----------------------------------------------------------------
Andre Przywara (4):

      regulator: axp20x: fix typo-ed identifier
      dt-bindings: mfd: x-powers,axp152: Document AXP717
      mfd: axp20x: Add support for AXP717 PMIC
      regulator: axp20x: add support for the AXP717
 .../devicetree/bindings/mfd/x-powers,axp152.yaml   |  2 +
 drivers/mfd/axp20x-i2c.c                           |  2 +
 drivers/mfd/axp20x-rsb.c                           |  1 +
 drivers/mfd/axp20x.c                               | 90 ++++++++++++++++++++
 drivers/regulator/axp20x-regulator.c               | 94 +++++++++++++++++++--
 include/linux/mfd/axp20x.h                         | 98 ++++++++++++++++++++--
 6 files changed, 277 insertions(+), 10 deletions(-)
Signature · 1 line
Lee Jones [李琼斯]
#18 lore raw

Re: [GIT PULL] Immutable branch between MFD and Regulator due for the v6.9 merge window:wq

On Thu, 28 Mar 2024 09:56:31 +0000
Lee Jones <[email protected]> wrote:

Hi Lee,

many thanks for picking this up!

Quoted 8 lines

Enjoy!

The following changes since commit 4cece764965020c22cff7665b18a012006359095:

Linux 6.9-rc1 (2024-03-24 14:10:05 -0700)

are available in the Git repository at:

Quoted 8 lines

git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd.git ib-mfd-regulator-v6.9

for you to fetch changes up to d2ac3df75c3a995064cfac0171e082a30d8c4c66:

regulator: axp20x: add support for the AXP717 (2024-03-28 09:51:03 +0000)

----------------------------------------------------------------
Immutable branch between MFD and Regulator due for the v6.9 merge window

Did you mean v6.10 merge window? Or is there a plan to merge this into 6.9 still?

Also I found some issue with the LDOs' supply voltage: there are not all the same, as described right now. Fix is quite easy, how do you want to take this? As a follow up patch? And would this be squashed or kept separate?
Or do you want we to send a new version? If yes, based on what branch?

Thanks,
Andre

Quoted 16 lines

----------------------------------------------------------------
Andre Przywara (4):

      regulator: axp20x: fix typo-ed identifier
      dt-bindings: mfd: x-powers,axp152: Document AXP717
      mfd: axp20x: Add support for AXP717 PMIC
      regulator: axp20x: add support for the AXP717
 .../devicetree/bindings/mfd/x-powers,axp152.yaml   |  2 +
 drivers/mfd/axp20x-i2c.c                           |  2 +
 drivers/mfd/axp20x-rsb.c                           |  1 +
 drivers/mfd/axp20x.c                               | 90 ++++++++++++++++++++
 drivers/regulator/axp20x-regulator.c               | 94 +++++++++++++++++++--
 include/linux/mfd/axp20x.h                         | 98 ++++++++++++++++++++--
 6 files changed, 277 insertions(+), 10 deletions(-)
maintainer
#19 lore raw

Re: [GIT PULL] Immutable branch between MFD and Regulator due for the v6.9 merge window:wq

Quoted 19 lines · Andre Przywara

On Thu, 28 Mar 2024 09:56:31 +0000
Lee Jones <[email protected]> wrote:

Hi Lee,

many thanks for picking this up!

Quoted 12 lines

Enjoy!

The following changes since commit 4cece764965020c22cff7665b18a012006359095:

Linux 6.9-rc1 (2024-03-24 14:10:05 -0700)

are available in the Git repository at:

git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd.git ib-mfd-regulator-v6.9

for you to fetch changes up to d2ac3df75c3a995064cfac0171e082a30d8c4c66:

Quoted 7 lines
Quoted 4 lines

regulator: axp20x: add support for the AXP717 (2024-03-28 09:51:03 +0000)

----------------------------------------------------------------
Immutable branch between MFD and Regulator due for the v6.9 merge window

Did you mean v6.10 merge window? Or is there a plan to merge this into 6.9 still?

Yes - off-by-one!

Quoted 5 lines

Also I found some issue with the LDOs' supply voltage: there are not all the same, as described right now. Fix is quite easy, how do you want to take this? As a follow up patch? And would this be squashed or kept separate?
Or do you want we to send a new version? If yes, based on what branch?

Please submit a fix-up.

I'll sent out a new (ib-mfd-regulator-v6.9-1) PR based on this one.

Quoted 16 lines
Quoted 15 lines

----------------------------------------------------------------
Andre Przywara (4):

      regulator: axp20x: fix typo-ed identifier
      dt-bindings: mfd: x-powers,axp152: Document AXP717
      mfd: axp20x: Add support for AXP717 PMIC
      regulator: axp20x: add support for the AXP717
 .../devicetree/bindings/mfd/x-powers,axp152.yaml   |  2 +
 drivers/mfd/axp20x-i2c.c                           |  2 +
 drivers/mfd/axp20x-rsb.c                           |  1 +
 drivers/mfd/axp20x.c                               | 90 ++++++++++++++++++++
 drivers/regulator/axp20x-regulator.c               | 94 +++++++++++++++++++--
 include/linux/mfd/axp20x.h                         | 98 ++++++++++++++++++++--
 6 files changed, 277 insertions(+), 10 deletions(-)
Signature · 1 line
Lee Jones [李琼斯]
maintainer
#20 lore raw

Re: [GIT PULL] Immutable branch between MFD and Regulator due for the v6.9 merge window:wq

Quoted 23 lines · Lee Jones
Quoted 21 lines · Andre Przywara

On Thu, 28 Mar 2024 09:56:31 +0000
Lee Jones <[email protected]> wrote:

Hi Lee,

many thanks for picking this up!

Quoted 14 lines

Enjoy!

The following changes since commit 4cece764965020c22cff7665b18a012006359095:

Linux 6.9-rc1 (2024-03-24 14:10:05 -0700)

are available in the Git repository at:

git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd.git ib-mfd-regulator-v6.9

for you to fetch changes up to d2ac3df75c3a995064cfac0171e082a30d8c4c66:

regulator: axp20x: add support for the AXP717 (2024-03-28 09:51:03 +0000)

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

----------------------------------------------------------------
Immutable branch between MFD and Regulator due for the v6.9 merge window

Did you mean v6.10 merge window? Or is there a plan to merge this into 6.9 still?

Yes - off-by-one!

Just recreated ib-mfd-regulator-v6.10 for all the OCD types (like me!).

Signature · 1 line
Lee Jones [李琼斯]