Skip to contentSkip to conversation

regulator: Add X-Powers AXP318W PMIC support

RFC PATCH In review Andre Przywara 4 participants 8 messages Aug 13, 2025 – Oct 21, 2025

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

cover regulator: Add X-Powers AXP318W PMIC support

This patch series adds support for the X-Powers AXP318W PMIC, which is used recently on new boards with Allwinner SoCs (the A733).
It features 9 DCDC buck converters and 28 LDOs, plus the usual ADC, interrupts, and power key components.
I am marking this as RFC, as this is untested, since I don't have hardware, but at least the datasheet [1] gives enough information to get the review and discussion started.

Patch 1 adds the compatible string to the binding document, and adds the additional input supply properties.
Patch 2 is the MFD part, describing the regmap and all the interrupts. So far we support the regulator and power key devices, the ADC and other pieces will follow later.
Patch 3 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.
Based on v6.17-rc1.

Please have a look!

Cheers,
Andre

[1] https://linux-sunxi.org/AXP_PMICs (link in last line)

Andre Przywara (3):
dt-bindings: mfd: x-powers,axp152: Document AXP318W
mfd: axp20x: Add support for AXP318W PMIC
regulator: axp20x: add support for the AXP318W

 .../bindings/mfd/x-powers,axp152.yaml         |  18 ++
 drivers/mfd/axp20x-i2c.c                      |   2 +
 drivers/mfd/axp20x.c                          |  84 +++++++++
 drivers/regulator/axp20x-regulator.c          | 159 ++++++++++++++++++
 include/linux/mfd/axp20x.h                    | 127 ++++++++++++++
 5 files changed, 390 insertions(+)
Signature · 1 line
2.46.3
#1 lore raw

RFC PATCH 1/3 dt-bindings: mfd: x-powers,axp152: Document AXP318W

The X-Powers AXP318W is a PMIC used on some newer Allwinner devices. Among a large number of both DCDC and LDO regulators it features the usual ADC/IRQ/power key parts.
Like other recent PMICs, it lacks the DC/DC converter PWM frequency control register, that rate is fixed here (1.5MHz on DCDC1, 3 MHz on the others).

Add the new compatible string, and add that to the list of PMICs without the PWM frequency property.
Also add more input supply properties, for the two more DCDC convertes, and also for the split ALDO supply.

---
 .../bindings/mfd/x-powers,axp152.yaml          | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
Documentation/devicetree/bindings/mfd/x-powers,axp152.yaml +18 -0
index 45f015d63df16..35f01a6cc440a 100644
@@ -83,6 +83,7 @@ allOf:
           contains:
             enum:
               - x-powers,axp313a
+              - x-powers,axp318w
               - x-powers,axp323
               - x-powers,axp15060
               - x-powers,axp717
@@ -102,6 +103,7 @@ properties:
           - x-powers,axp221
           - x-powers,axp223
           - x-powers,axp313a
+          - x-powers,axp318w
           - x-powers,axp323
           - x-powers,axp717
           - x-powers,axp803
@@ -180,6 +182,14 @@ properties:
     description: >
       DCDC7 power supply node, if present.
 
+  vin8-supply:
+    description: >
+      DCDC7 power supply node, if present.
+
+  vin9-supply:
+    description: >
+      DCDC7 power supply node, if present.
+
   vina-supply:
     description: >
       DCDCA power supply node, if present.
@@ -220,6 +230,14 @@ properties:
     description: >
       ALDO* power supply node, if present.
 
+  aldo156in-supply:
+    description: >
+      ALDO* power supply node, if present.
+
+  aldo234in-supply:
+    description: >
+      ALDO* power supply node, if present.
+
   bldoin-supply:
     description: >
       BLDO* power supply node, if present.
Signature · 1 line
2.46.3
maintainer Reviewed-by on v1 1/3
#2 lore raw

Re: [RFC PATCH 1/3] dt-bindings: mfd: x-powers,axp152: Document AXP318W

Quoted 11 lines · Andre Przywara

The X-Powers AXP318W is a PMIC used on some newer Allwinner devices. Among a large number of both DCDC and LDO regulators it features the usual ADC/IRQ/power key parts.
Like other recent PMICs, it lacks the DC/DC converter PWM frequency control register, that rate is fixed here (1.5MHz on DCDC1, 3 MHz on the others).

Add the new compatible string, and add that to the list of PMICs without the PWM frequency property.
Also add more input supply properties, for the two more DCDC convertes, and also for the split ALDO supply.

Quoted 5 lines
---
 .../bindings/mfd/x-powers,axp152.yaml          | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
#3 lore raw

RFC PATCH 2/3 mfd: axp20x: Add support for AXP318W PMIC

In reply to Andre Przywara

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

It has a large number of regulators: 9(!) DCDC buck converters, and 28 LDOs, also some ADCs, interrupts, and a power key.

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

We use just "318" for the internal identifiers, for easier typing and less churn, but use "318W" for anything externally visible. If something else other than the "AXP318W" shows up, that's an easy change then.

---
 drivers/mfd/axp20x-i2c.c   |  2 +
 drivers/mfd/axp20x.c       | 84 +++++++++++++++++++++++++++++++++++++
 include/linux/mfd/axp20x.h | 86 ++++++++++++++++++++++++++++++++++++++
 3 files changed, 172 insertions(+)
drivers/mfd/axp20x-i2c.c +2 -0
index 5c93136f977e7..4e4ebfc78525c 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,axp318w", .data = (void *)AXP318_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 },
@@ -83,6 +84,7 @@ static const struct i2c_device_id axp20x_i2c_id[] = {
 	{ "axp221" },
 	{ "axp223" },
 	{ "axp313a" },
+	{ "axp318w" },
 	{ "axp717" },
 	{ "axp803" },
 	{ "axp806" },
drivers/mfd/axp20x.c +84 -0

132 lines not on this page · raw message

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

104 lines not on this page · raw message

Signature · 1 line
2.46.3
maintainer
#4 lore raw

Re: [RFC PATCH 2/3] mfd: axp20x: Add support for AXP318W PMIC

Quoted 15 lines · Andre Przywara

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

It has a large number of regulators: 9(!) DCDC buck converters, and 28 LDOs, also some ADCs, interrupts, and a power key.

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

We use just "318" for the internal identifiers, for easier typing and less churn, but use "318W" for anything externally visible. If something else other than the "AXP318W" shows up, that's an easy change then.

Quoted 6 lines
---
 drivers/mfd/axp20x-i2c.c   |  2 +
 drivers/mfd/axp20x.c       | 84 +++++++++++++++++++++++++++++++++++++
 include/linux/mfd/axp20x.h | 86 ++++++++++++++++++++++++++++++++++++++
 3 files changed, 172 insertions(+)

Looks okay. Let me know when you're !RFC.

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

RFC PATCH 3/3 regulator: axp20x: add support for the AXP318W

In reply to Andre Przywara

The X-Powers AXP318W is a typical PMIC from X-Powers, featuring nine DC/DC converters and 28 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.
We use just "318" for the internal identifiers, for easier typing and less churn. If something else other than the "AXP318W" shows up, that's an easy change, externally visible strings carry the additional letter already.

---
 drivers/regulator/axp20x-regulator.c | 159 +++++++++++++++++++++++++++
 include/linux/mfd/axp20x.h           |  41 +++++++
 2 files changed, 200 insertions(+)
drivers/regulator/axp20x-regulator.c +159 -0
index da891415efc0b..eb2c45b5b9eb0 100644
@@ -138,6 +138,15 @@
 #define AXP313A_DCDC_V_OUT_MASK		GENMASK(6, 0)
 #define AXP313A_LDO_V_OUT_MASK		GENMASK(4, 0)
 
+#define AXP318_DCDC1_V_OUT_MASK		GENMASK(4, 0)
+#define AXP318_DCDC2_V_OUT_MASK		GENMASK(6, 0)
+#define AXP318_LDO_V_OUT_MASK		GENMASK(4, 0)
+#define AXP318_ELDO_V_OUT_MASK		GENMASK(5, 0)
+#define AXP318_DCDC2_NUM_VOLTAGES	88
+#define AXP318_DCDC6_NUM_VOLTAGES	128
+#define AXP318_DCDC7_NUM_VOLTAGES	103
+#define AXP318_DCDC8_NUM_VOLTAGES	119
+
 #define AXP717_DCDC1_NUM_VOLTAGES	88
 #define AXP717_DCDC2_NUM_VOLTAGES	107
 #define AXP717_DCDC3_NUM_VOLTAGES	103
@@ -765,6 +774,151 @@ static const struct regulator_desc axp313a_regulators[] = {
 	AXP_DESC_FIXED(AXP313A, RTC_LDO, "rtc-ldo", "vin1", 1800),
 };
 
+static const struct linear_range axp318_dcdc2_ranges[] = {
+	REGULATOR_LINEAR_RANGE(500000,   0, 70, 10000),
+	REGULATOR_LINEAR_RANGE(1220000, 71, 87, 20000),
+};
+
+static const struct linear_range axp318_dcdc6_ranges[] = {
+	REGULATOR_LINEAR_RANGE(500000,    0,  70,  10000),
+	REGULATOR_LINEAR_RANGE(1220000,  71,  87,  20000),
+	REGULATOR_LINEAR_RANGE(1800000,  88, 118,  20000),
+	REGULATOR_LINEAR_RANGE(2440000, 119, 127,  40000),
+};
+
+static const struct linear_range axp318_dcdc7_ranges[] = {
+	REGULATOR_LINEAR_RANGE(500000,   0,  70, 10000),
+	REGULATOR_LINEAR_RANGE(1220000, 71, 102, 20000),
+};
+
+static const struct linear_range axp318_dcdc8_ranges[] = {
+	REGULATOR_LINEAR_RANGE(500000,    0,  70,  10000),
+	REGULATOR_LINEAR_RANGE(1220000,  71, 102,  20000),
+	REGULATOR_LINEAR_RANGE(1900000, 103, 118, 100000),
+};
+
+static const struct regulator_desc axp318_regulators[] = {
+	AXP_DESC(AXP318, DCDC1, "dcdc1", "vin1", 1000, 3400, 100,
+		 AXP318_DCDC1_CONTROL, AXP318_DCDC1_V_OUT_MASK,
+		 AXP318_DCDC_OUTPUT_CONTROL1, BIT(0)),
+	AXP_DESC_RANGES(AXP318, DCDC2, "dcdc2", "vin2",
+			axp318_dcdc2_ranges, AXP318_DCDC2_NUM_VOLTAGES,
+			AXP318_DCDC2_CONTROL, AXP318_DCDC2_V_OUT_MASK,
+			AXP318_DCDC_OUTPUT_CONTROL1, BIT(1)),
+	AXP_DESC_RANGES(AXP318, DCDC3, "dcdc3", "vin3",
+			axp318_dcdc2_ranges, AXP318_DCDC2_NUM_VOLTAGES,
+			AXP318_DCDC3_CONTROL, AXP318_DCDC2_V_OUT_MASK,
+			AXP318_DCDC_OUTPUT_CONTROL1, BIT(2)),
+	AXP_DESC_RANGES(AXP318, DCDC4, "dcdc4", "vin4",
+			axp318_dcdc2_ranges, AXP318_DCDC2_NUM_VOLTAGES,
+			AXP318_DCDC4_CONTROL, AXP318_DCDC2_V_OUT_MASK,
+			AXP318_DCDC_OUTPUT_CONTROL1, BIT(3)),
+	AXP_DESC_RANGES(AXP318, DCDC5, "dcdc5", "vin5",
+			axp318_dcdc2_ranges, AXP318_DCDC2_NUM_VOLTAGES,
+			AXP318_DCDC5_CONTROL, AXP318_DCDC2_V_OUT_MASK,
+			AXP318_DCDC_OUTPUT_CONTROL1, BIT(4)),
+	AXP_DESC_RANGES(AXP318, DCDC6, "dcdc6", "vin6",
+			axp318_dcdc6_ranges, AXP318_DCDC6_NUM_VOLTAGES,
+			AXP318_DCDC6_CONTROL, AXP318_DCDC2_V_OUT_MASK,
+			AXP318_DCDC_OUTPUT_CONTROL1, BIT(5)),
+	AXP_DESC_RANGES(AXP318, DCDC7, "dcdc7", "vin7",
+			axp318_dcdc7_ranges, AXP318_DCDC7_NUM_VOLTAGES,
+			AXP318_DCDC7_CONTROL, AXP318_DCDC2_V_OUT_MASK,
+			AXP318_DCDC_OUTPUT_CONTROL1, BIT(6)),
+	AXP_DESC_RANGES(AXP318, DCDC8, "dcdc8", "vin8",
+			axp318_dcdc8_ranges, AXP318_DCDC8_NUM_VOLTAGES,
+			AXP318_DCDC8_CONTROL, AXP318_DCDC2_V_OUT_MASK,
+			AXP318_DCDC_OUTPUT_CONTROL1, BIT(7)),
+	AXP_DESC_RANGES(AXP318, DCDC9, "dcdc9", "vin9",
+			axp318_dcdc8_ranges, AXP318_DCDC8_NUM_VOLTAGES,
+			AXP318_DCDC9_CONTROL, AXP318_DCDC2_V_OUT_MASK,
+			AXP318_DCDC_OUTPUT_CONTROL2, BIT(0)),
+	AXP_DESC(AXP318, ALDO1, "aldo1", "aldo156in", 500, 3400, 100,
+		 AXP318_ALDO1_CONTROL, AXP318_LDO_V_OUT_MASK,
+		 AXP318_LDO_OUTPUT_CONTROL1, BIT(0)),
+	AXP_DESC(AXP318, ALDO2, "aldo2", "aldo234in", 500, 3400, 100,
+		 AXP318_ALDO2_CONTROL, AXP318_LDO_V_OUT_MASK,
+		 AXP318_LDO_OUTPUT_CONTROL1, BIT(1)),
+	AXP_DESC(AXP318, ALDO3, "aldo3", "aldo234in", 500, 3400, 100,
+		 AXP318_ALDO3_CONTROL, AXP318_LDO_V_OUT_MASK,
+		 AXP318_LDO_OUTPUT_CONTROL1, BIT(2)),
+	AXP_DESC(AXP318, ALDO4, "aldo4", "aldo234in", 500, 3400, 100,
+		 AXP318_ALDO4_CONTROL, AXP318_LDO_V_OUT_MASK,
+		 AXP318_LDO_OUTPUT_CONTROL1, BIT(3)),
+	AXP_DESC(AXP318, ALDO5, "aldo5", "aldo156in", 500, 3400, 100,
+		 AXP318_ALDO5_CONTROL, AXP318_LDO_V_OUT_MASK,
+		 AXP318_LDO_OUTPUT_CONTROL1, BIT(4)),
+	AXP_DESC(AXP318, ALDO6, "aldo6", "aldo156in", 500, 3400, 100,
+		 AXP318_ALDO6_CONTROL, AXP318_LDO_V_OUT_MASK,
+		 AXP318_LDO_OUTPUT_CONTROL1, BIT(5)),
+	AXP_DESC(AXP318, BLDO1, "bldo1", "bldoin", 500, 3400, 100,
+		 AXP318_BLDO1_CONTROL, AXP318_LDO_V_OUT_MASK,
+		 AXP318_LDO_OUTPUT_CONTROL1, BIT(6)),
+	AXP_DESC(AXP318, BLDO2, "bldo2", "bldoin", 500, 3400, 100,
+		 AXP318_BLDO2_CONTROL, AXP318_LDO_V_OUT_MASK,
+		 AXP318_LDO_OUTPUT_CONTROL1, BIT(7)),
+	AXP_DESC(AXP318, BLDO3, "bldo3", "bldoin", 500, 3400, 100,
+		 AXP318_BLDO3_CONTROL, AXP318_LDO_V_OUT_MASK,
+		 AXP318_LDO_OUTPUT_CONTROL2, BIT(0)),
+	AXP_DESC(AXP318, BLDO4, "bldo4", "bldoin", 500, 3400, 100,
+		 AXP318_BLDO4_CONTROL, AXP318_LDO_V_OUT_MASK,
+		 AXP318_LDO_OUTPUT_CONTROL2, BIT(1)),
+	AXP_DESC(AXP318, BLDO5, "bldo5", "bldoin", 500, 3400, 100,
+		 AXP318_BLDO5_CONTROL, AXP318_LDO_V_OUT_MASK,
+		 AXP318_LDO_OUTPUT_CONTROL2, BIT(2)),
+	AXP_DESC(AXP318, CLDO1, "cldo1", "cldoin", 500, 3400, 100,
+		 AXP318_CLDO1_CONTROL, AXP318_LDO_V_OUT_MASK,
+		 AXP318_LDO_OUTPUT_CONTROL2, BIT(3)),
+	AXP_DESC(AXP318, CLDO2, "cldo2", "cldoin", 500, 3400, 100,
+		 AXP318_CLDO2_CONTROL, AXP318_LDO_V_OUT_MASK,
+		 AXP318_LDO_OUTPUT_CONTROL2, BIT(4)),
+	AXP_DESC(AXP318, CLDO3, "cldo3", "cldoin", 500, 3400, 100,
+		 AXP318_CLDO3_CONTROL, AXP318_LDO_V_OUT_MASK,
+		 AXP318_LDO_OUTPUT_CONTROL2, BIT(5)),
+	AXP_DESC(AXP318, CLDO4, "cldo4", "cldoin", 500, 3400, 100,
+		 AXP318_CLDO4_CONTROL, AXP318_LDO_V_OUT_MASK,
+		 AXP318_LDO_OUTPUT_CONTROL2, BIT(6)),
+	AXP_DESC(AXP318, CLDO5, "cldo5", "cldoin", 500, 3400, 100,
+		 AXP318_CLDO5_CONTROL, AXP318_LDO_V_OUT_MASK,
+		 AXP318_LDO_OUTPUT_CONTROL2, BIT(7)),
+	AXP_DESC(AXP318, DLDO1, "dldo1", "dldoin", 500, 3400, 100,
+		 AXP318_DLDO1_CONTROL, AXP318_LDO_V_OUT_MASK,
+		 AXP318_LDO_OUTPUT_CONTROL3, BIT(0)),
+	AXP_DESC(AXP318, DLDO2, "dldo2", "dldoin", 500, 3400, 100,
+		 AXP318_DLDO2_CONTROL, AXP318_LDO_V_OUT_MASK,
+		 AXP318_LDO_OUTPUT_CONTROL3, BIT(1)),
+	AXP_DESC(AXP318, DLDO3, "dldo3", "dldoin", 500, 3400, 100,
+		 AXP318_DLDO3_CONTROL, AXP318_LDO_V_OUT_MASK,
+		 AXP318_LDO_OUTPUT_CONTROL3, BIT(2)),
+	AXP_DESC(AXP318, DLDO4, "dldo4", "dldoin", 500, 3400, 100,
+		 AXP318_DLDO4_CONTROL, AXP318_LDO_V_OUT_MASK,
+		 AXP318_LDO_OUTPUT_CONTROL3, BIT(3)),
+	AXP_DESC(AXP318, DLDO5, "dldo5", "dldoin", 500, 3400, 100,
+		 AXP318_DLDO5_CONTROL, AXP318_LDO_V_OUT_MASK,
+		 AXP318_LDO_OUTPUT_CONTROL3, BIT(4)),
+	AXP_DESC(AXP318, DLDO6, "dldo6", "dldoin", 500, 3400, 100,
+		 AXP318_DLDO6_CONTROL, AXP318_LDO_V_OUT_MASK,
+		 AXP318_LDO_OUTPUT_CONTROL3, BIT(5)),
+	AXP_DESC(AXP318, ELDO1, "eldo1", "eldoin", 500, 1500, 25,
+		 AXP318_ELDO1_CONTROL, AXP318_ELDO_V_OUT_MASK,
+		 AXP318_LDO_OUTPUT_CONTROL3, BIT(6)),
+	AXP_DESC(AXP318, ELDO2, "eldo2", "eldoin", 500, 1500, 25,
+		 AXP318_ELDO2_CONTROL, AXP318_ELDO_V_OUT_MASK,
+		 AXP318_LDO_OUTPUT_CONTROL3, BIT(7)),
+	AXP_DESC(AXP318, ELDO3, "eldo3", "eldoin", 500, 1500, 25,
+		 AXP318_ELDO3_CONTROL, AXP318_ELDO_V_OUT_MASK,
+		 AXP318_LDO_OUTPUT_CONTROL4, BIT(0)),
+	AXP_DESC(AXP318, ELDO4, "eldo4", "eldoin", 500, 1500, 25,
+		 AXP318_ELDO4_CONTROL, AXP318_ELDO_V_OUT_MASK,
+		 AXP318_LDO_OUTPUT_CONTROL4, BIT(1)),
+	AXP_DESC(AXP318, ELDO5, "eldo5", "eldoin", 500, 1500, 25,
+		 AXP318_ELDO5_CONTROL, AXP318_ELDO_V_OUT_MASK,
+		 AXP318_LDO_OUTPUT_CONTROL4, BIT(2)),
+	AXP_DESC(AXP318, ELDO6, "eldo6", "eldoin", 500, 1500, 25,
+		 AXP318_ELDO6_CONTROL, AXP318_ELDO_V_OUT_MASK,
+		 AXP318_LDO_OUTPUT_CONTROL4, BIT(3)),
+};
+
 static const struct linear_range axp717_dcdc1_ranges[] = {
 	REGULATOR_LINEAR_RANGE(500000,   0, 70, 10000),
 	REGULATOR_LINEAR_RANGE(1220000, 71, 87, 20000),
@@ -1347,6 +1501,7 @@ static int axp20x_set_dcdc_freq(struct platform_device *pdev, u32 dcdcfreq)
 		step = 150;
 		break;
 	case AXP313A_ID:
+	case AXP318_ID:
 	case AXP323_ID:
 	case AXP717_ID:
 	case AXP15060_ID:
@@ -1585,6 +1740,10 @@ static int axp20x_regulator_probe(struct platform_device *pdev)
 		regulators = axp313a_regulators;
 		nregulators = AXP313A_REG_ID_MAX;
 		break;
+	case AXP318_ID:
+		regulators = axp318_regulators;
+		nregulators = AXP318_REG_ID_MAX;
+		break;
 	case AXP717_ID:
 		regulators = axp717_regulators;
 		nregulators = AXP717_REG_ID_MAX;
include/linux/mfd/axp20x.h +41 -0

47 lines not on this page · raw message

Signature · 1 line
2.46.3
#6 lore raw

Re: [RFC PATCH 3/3] regulator: axp20x: add support for the AXP318W

Hi Andre,

Quoted 90 lines · Andre Przywara

The X-Powers AXP318W is a typical PMIC from X-Powers, featuring nine DC/DC converters and 28 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.
We use just "318" for the internal identifiers, for easier typing and less churn. If something else other than the "AXP318W" shows up, that's an easy change, externally visible strings carry the additional letter already.

---
 drivers/regulator/axp20x-regulator.c | 159 +++++++++++++++++++++++++++
 include/linux/mfd/axp20x.h           |  41 +++++++
 2 files changed, 200 insertions(+)
drivers/regulator/axp20x-regulator.c +58 -0
index da891415efc0b..eb2c45b5b9eb0 100644
@@ -138,6 +138,15 @@
 #define AXP313A_DCDC_V_OUT_MASK		GENMASK(6, 0)
 #define AXP313A_LDO_V_OUT_MASK		GENMASK(4, 0)
 
+#define AXP318_DCDC1_V_OUT_MASK		GENMASK(4, 0)
+#define AXP318_DCDC2_V_OUT_MASK		GENMASK(6, 0)
+#define AXP318_LDO_V_OUT_MASK		GENMASK(4, 0)
+#define AXP318_ELDO_V_OUT_MASK		GENMASK(5, 0)
+#define AXP318_DCDC2_NUM_VOLTAGES	88
+#define AXP318_DCDC6_NUM_VOLTAGES	128
+#define AXP318_DCDC7_NUM_VOLTAGES	103
+#define AXP318_DCDC8_NUM_VOLTAGES	119
+
 #define AXP717_DCDC1_NUM_VOLTAGES	88
 #define AXP717_DCDC2_NUM_VOLTAGES	107
 #define AXP717_DCDC3_NUM_VOLTAGES	103
@@ -765,6 +774,151 @@ static const struct regulator_desc axp313a_regulators[] = {
 	AXP_DESC_FIXED(AXP313A, RTC_LDO, "rtc-ldo", "vin1", 1800),
 };
 
+static const struct linear_range axp318_dcdc2_ranges[] = {
+	REGULATOR_LINEAR_RANGE(500000,   0, 70, 10000),
+	REGULATOR_LINEAR_RANGE(1220000, 71, 87, 20000),
+};
+
+static const struct linear_range axp318_dcdc6_ranges[] = {
+	REGULATOR_LINEAR_RANGE(500000,    0,  70,  10000),
+	REGULATOR_LINEAR_RANGE(1220000,  71,  87,  20000),
+	REGULATOR_LINEAR_RANGE(1800000,  88, 118,  20000),
+	REGULATOR_LINEAR_RANGE(2440000, 119, 127,  40000),
+};
+
+static const struct linear_range axp318_dcdc7_ranges[] = {
+	REGULATOR_LINEAR_RANGE(500000,   0,  70, 10000),
+	REGULATOR_LINEAR_RANGE(1220000, 71, 102, 20000),
+};
+
+static const struct linear_range axp318_dcdc8_ranges[] = {
+	REGULATOR_LINEAR_RANGE(500000,    0,  70,  10000),
+	REGULATOR_LINEAR_RANGE(1220000,  71, 102,  20000),
+	REGULATOR_LINEAR_RANGE(1900000, 103, 118, 100000),
+};
+
+static const struct regulator_desc axp318_regulators[] = {
+	AXP_DESC(AXP318, DCDC1, "dcdc1", "vin1", 1000, 3400, 100,
+		 AXP318_DCDC1_CONTROL, AXP318_DCDC1_V_OUT_MASK,
+		 AXP318_DCDC_OUTPUT_CONTROL1, BIT(0)),
+	AXP_DESC_RANGES(AXP318, DCDC2, "dcdc2", "vin2",
+			axp318_dcdc2_ranges, AXP318_DCDC2_NUM_VOLTAGES,
+			AXP318_DCDC2_CONTROL, AXP318_DCDC2_V_OUT_MASK,
+			AXP318_DCDC_OUTPUT_CONTROL1, BIT(1)),
+	AXP_DESC_RANGES(AXP318, DCDC3, "dcdc3", "vin3",
+			axp318_dcdc2_ranges, AXP318_DCDC2_NUM_VOLTAGES,
+			AXP318_DCDC3_CONTROL, AXP318_DCDC2_V_OUT_MASK,
+			AXP318_DCDC_OUTPUT_CONTROL1, BIT(2)),
+	AXP_DESC_RANGES(AXP318, DCDC4, "dcdc4", "vin4",
+			axp318_dcdc2_ranges, AXP318_DCDC2_NUM_VOLTAGES,
+			AXP318_DCDC4_CONTROL, AXP318_DCDC2_V_OUT_MASK,
+			AXP318_DCDC_OUTPUT_CONTROL1, BIT(3)),
+	AXP_DESC_RANGES(AXP318, DCDC5, "dcdc5", "vin5",
+			axp318_dcdc2_ranges, AXP318_DCDC2_NUM_VOLTAGES,
+			AXP318_DCDC5_CONTROL, AXP318_DCDC2_V_OUT_MASK,
+			AXP318_DCDC_OUTPUT_CONTROL1, BIT(4)),
+	AXP_DESC_RANGES(AXP318, DCDC6, "dcdc6", "vin6",
+			axp318_dcdc6_ranges, AXP318_DCDC6_NUM_VOLTAGES,
+			AXP318_DCDC6_CONTROL, AXP318_DCDC2_V_OUT_MASK,
+			AXP318_DCDC_OUTPUT_CONTROL1, BIT(5)),
+	AXP_DESC_RANGES(AXP318, DCDC7, "dcdc7", "vin7",
+			axp318_dcdc7_ranges, AXP318_DCDC7_NUM_VOLTAGES,

drivers/regulator/axp20x-regulator.c static const struct regulator_desc axp313a_regulators[] = { · line 835

Quoted 10 lines
drivers/regulator/axp20x-regulator.c +10 -0
+			AXP318_DCDC7_CONTROL, AXP318_DCDC2_V_OUT_MASK,
+			AXP318_DCDC_OUTPUT_CONTROL1, BIT(6)),
+	AXP_DESC_RANGES(AXP318, DCDC8, "dcdc8", "vin8",
+			axp318_dcdc8_ranges, AXP318_DCDC8_NUM_VOLTAGES,
+			AXP318_DCDC8_CONTROL, AXP318_DCDC2_V_OUT_MASK,
+			AXP318_DCDC_OUTPUT_CONTROL1, BIT(7)),
+	AXP_DESC_RANGES(AXP318, DCDC9, "dcdc9", "vin9",
+			axp318_dcdc8_ranges, AXP318_DCDC8_NUM_VOLTAGES,
+			AXP318_DCDC9_CONTROL, AXP318_DCDC2_V_OUT_MASK,
+			AXP318_DCDC_OUTPUT_CONTROL2, BIT(0)),

I think there are two switches missing (which is SWOUT1/2 in datsheet) it's BIT(3), BIT(4) of AXP318_DCDC_OUTPUT_CONTROL2

btw, I don't understand what's the meaning of BIT(1) BIT(2) - DCDC_EN1/2 or if they has any connection with those two switches..

Quoted 163 lines
drivers/regulator/axp20x-regulator.c +91 -0
+	AXP_DESC(AXP318, ALDO1, "aldo1", "aldo156in", 500, 3400, 100,
+		 AXP318_ALDO1_CONTROL, AXP318_LDO_V_OUT_MASK,
+		 AXP318_LDO_OUTPUT_CONTROL1, BIT(0)),
+	AXP_DESC(AXP318, ALDO2, "aldo2", "aldo234in", 500, 3400, 100,
+		 AXP318_ALDO2_CONTROL, AXP318_LDO_V_OUT_MASK,
+		 AXP318_LDO_OUTPUT_CONTROL1, BIT(1)),
+	AXP_DESC(AXP318, ALDO3, "aldo3", "aldo234in", 500, 3400, 100,
+		 AXP318_ALDO3_CONTROL, AXP318_LDO_V_OUT_MASK,
+		 AXP318_LDO_OUTPUT_CONTROL1, BIT(2)),
+	AXP_DESC(AXP318, ALDO4, "aldo4", "aldo234in", 500, 3400, 100,
+		 AXP318_ALDO4_CONTROL, AXP318_LDO_V_OUT_MASK,
+		 AXP318_LDO_OUTPUT_CONTROL1, BIT(3)),
+	AXP_DESC(AXP318, ALDO5, "aldo5", "aldo156in", 500, 3400, 100,
+		 AXP318_ALDO5_CONTROL, AXP318_LDO_V_OUT_MASK,
+		 AXP318_LDO_OUTPUT_CONTROL1, BIT(4)),
+	AXP_DESC(AXP318, ALDO6, "aldo6", "aldo156in", 500, 3400, 100,
+		 AXP318_ALDO6_CONTROL, AXP318_LDO_V_OUT_MASK,
+		 AXP318_LDO_OUTPUT_CONTROL1, BIT(5)),
+	AXP_DESC(AXP318, BLDO1, "bldo1", "bldoin", 500, 3400, 100,
+		 AXP318_BLDO1_CONTROL, AXP318_LDO_V_OUT_MASK,
+		 AXP318_LDO_OUTPUT_CONTROL1, BIT(6)),
+	AXP_DESC(AXP318, BLDO2, "bldo2", "bldoin", 500, 3400, 100,
+		 AXP318_BLDO2_CONTROL, AXP318_LDO_V_OUT_MASK,
+		 AXP318_LDO_OUTPUT_CONTROL1, BIT(7)),
+	AXP_DESC(AXP318, BLDO3, "bldo3", "bldoin", 500, 3400, 100,
+		 AXP318_BLDO3_CONTROL, AXP318_LDO_V_OUT_MASK,
+		 AXP318_LDO_OUTPUT_CONTROL2, BIT(0)),
+	AXP_DESC(AXP318, BLDO4, "bldo4", "bldoin", 500, 3400, 100,
+		 AXP318_BLDO4_CONTROL, AXP318_LDO_V_OUT_MASK,
+		 AXP318_LDO_OUTPUT_CONTROL2, BIT(1)),
+	AXP_DESC(AXP318, BLDO5, "bldo5", "bldoin", 500, 3400, 100,
+		 AXP318_BLDO5_CONTROL, AXP318_LDO_V_OUT_MASK,
+		 AXP318_LDO_OUTPUT_CONTROL2, BIT(2)),
+	AXP_DESC(AXP318, CLDO1, "cldo1", "cldoin", 500, 3400, 100,
+		 AXP318_CLDO1_CONTROL, AXP318_LDO_V_OUT_MASK,
+		 AXP318_LDO_OUTPUT_CONTROL2, BIT(3)),
+	AXP_DESC(AXP318, CLDO2, "cldo2", "cldoin", 500, 3400, 100,
+		 AXP318_CLDO2_CONTROL, AXP318_LDO_V_OUT_MASK,
+		 AXP318_LDO_OUTPUT_CONTROL2, BIT(4)),
+	AXP_DESC(AXP318, CLDO3, "cldo3", "cldoin", 500, 3400, 100,
+		 AXP318_CLDO3_CONTROL, AXP318_LDO_V_OUT_MASK,
+		 AXP318_LDO_OUTPUT_CONTROL2, BIT(5)),
+	AXP_DESC(AXP318, CLDO4, "cldo4", "cldoin", 500, 3400, 100,
+		 AXP318_CLDO4_CONTROL, AXP318_LDO_V_OUT_MASK,
+		 AXP318_LDO_OUTPUT_CONTROL2, BIT(6)),
+	AXP_DESC(AXP318, CLDO5, "cldo5", "cldoin", 500, 3400, 100,
+		 AXP318_CLDO5_CONTROL, AXP318_LDO_V_OUT_MASK,
+		 AXP318_LDO_OUTPUT_CONTROL2, BIT(7)),
+	AXP_DESC(AXP318, DLDO1, "dldo1", "dldoin", 500, 3400, 100,
+		 AXP318_DLDO1_CONTROL, AXP318_LDO_V_OUT_MASK,
+		 AXP318_LDO_OUTPUT_CONTROL3, BIT(0)),
+	AXP_DESC(AXP318, DLDO2, "dldo2", "dldoin", 500, 3400, 100,
+		 AXP318_DLDO2_CONTROL, AXP318_LDO_V_OUT_MASK,
+		 AXP318_LDO_OUTPUT_CONTROL3, BIT(1)),
+	AXP_DESC(AXP318, DLDO3, "dldo3", "dldoin", 500, 3400, 100,
+		 AXP318_DLDO3_CONTROL, AXP318_LDO_V_OUT_MASK,
+		 AXP318_LDO_OUTPUT_CONTROL3, BIT(2)),
+	AXP_DESC(AXP318, DLDO4, "dldo4", "dldoin", 500, 3400, 100,
+		 AXP318_DLDO4_CONTROL, AXP318_LDO_V_OUT_MASK,
+		 AXP318_LDO_OUTPUT_CONTROL3, BIT(3)),
+	AXP_DESC(AXP318, DLDO5, "dldo5", "dldoin", 500, 3400, 100,
+		 AXP318_DLDO5_CONTROL, AXP318_LDO_V_OUT_MASK,
+		 AXP318_LDO_OUTPUT_CONTROL3, BIT(4)),
+	AXP_DESC(AXP318, DLDO6, "dldo6", "dldoin", 500, 3400, 100,
+		 AXP318_DLDO6_CONTROL, AXP318_LDO_V_OUT_MASK,
+		 AXP318_LDO_OUTPUT_CONTROL3, BIT(5)),
+	AXP_DESC(AXP318, ELDO1, "eldo1", "eldoin", 500, 1500, 25,
+		 AXP318_ELDO1_CONTROL, AXP318_ELDO_V_OUT_MASK,
+		 AXP318_LDO_OUTPUT_CONTROL3, BIT(6)),
+	AXP_DESC(AXP318, ELDO2, "eldo2", "eldoin", 500, 1500, 25,
+		 AXP318_ELDO2_CONTROL, AXP318_ELDO_V_OUT_MASK,
+		 AXP318_LDO_OUTPUT_CONTROL3, BIT(7)),
+	AXP_DESC(AXP318, ELDO3, "eldo3", "eldoin", 500, 1500, 25,
+		 AXP318_ELDO3_CONTROL, AXP318_ELDO_V_OUT_MASK,
+		 AXP318_LDO_OUTPUT_CONTROL4, BIT(0)),
+	AXP_DESC(AXP318, ELDO4, "eldo4", "eldoin", 500, 1500, 25,
+		 AXP318_ELDO4_CONTROL, AXP318_ELDO_V_OUT_MASK,
+		 AXP318_LDO_OUTPUT_CONTROL4, BIT(1)),
+	AXP_DESC(AXP318, ELDO5, "eldo5", "eldoin", 500, 1500, 25,
+		 AXP318_ELDO5_CONTROL, AXP318_ELDO_V_OUT_MASK,
+		 AXP318_LDO_OUTPUT_CONTROL4, BIT(2)),
+	AXP_DESC(AXP318, ELDO6, "eldo6", "eldoin", 500, 1500, 25,
+		 AXP318_ELDO6_CONTROL, AXP318_ELDO_V_OUT_MASK,
+		 AXP318_LDO_OUTPUT_CONTROL4, BIT(3)),
+};
+
 static const struct linear_range axp717_dcdc1_ranges[] = {
 	REGULATOR_LINEAR_RANGE(500000,   0, 70, 10000),
 	REGULATOR_LINEAR_RANGE(1220000, 71, 87, 20000),
@@ -1347,6 +1501,7 @@ static int axp20x_set_dcdc_freq(struct platform_device *pdev, u32 dcdcfreq)
 		step = 150;
 		break;
 	case AXP313A_ID:
+	case AXP318_ID:
 	case AXP323_ID:
 	case AXP717_ID:
 	case AXP15060_ID:
@@ -1585,6 +1740,10 @@ static int axp20x_regulator_probe(struct platform_device *pdev)
 		regulators = axp313a_regulators;
 		nregulators = AXP313A_REG_ID_MAX;
 		break;
+	case AXP318_ID:
+		regulators = axp318_regulators;
+		nregulators = AXP318_REG_ID_MAX;
+		break;
 	case AXP717_ID:
 		regulators = axp717_regulators;
 		nregulators = AXP717_REG_ID_MAX;
include/linux/mfd/axp20x.h +41 -0
index a871789f6cfa9..f4217c4763669 100644
@@ -559,6 +559,47 @@ enum {
 	AXP313A_REG_ID_MAX,
 };
 
+enum {
+	AXP318_DCDC1 = 0,
+	AXP318_DCDC2,
+	AXP318_DCDC3,
+	AXP318_DCDC4,
+	AXP318_DCDC5,
+	AXP318_DCDC6,
+	AXP318_DCDC7,
+	AXP318_DCDC8,
+	AXP318_DCDC9,
+	AXP318_ALDO1,
+	AXP318_ALDO2,
+	AXP318_ALDO3,
+	AXP318_ALDO4,
+	AXP318_ALDO5,
+	AXP318_ALDO6,
+	AXP318_BLDO1,
+	AXP318_BLDO2,
+	AXP318_BLDO3,
+	AXP318_BLDO4,
+	AXP318_BLDO5,
+	AXP318_CLDO1,
+	AXP318_CLDO2,
+	AXP318_CLDO3,
+	AXP318_CLDO4,
+	AXP318_CLDO5,
+	AXP318_DLDO1,
+	AXP318_DLDO2,
+	AXP318_DLDO3,
+	AXP318_DLDO4,
+	AXP318_DLDO5,
+	AXP318_DLDO6,
+	AXP318_ELDO1,
+	AXP318_ELDO2,
+	AXP318_ELDO3,
+	AXP318_ELDO4,
+	AXP318_ELDO5,
+	AXP318_ELDO6,
+	AXP318_REG_ID_MAX,
+};
+
 enum {
 	AXP717_DCDC1 = 0,
 	AXP717_DCDC2,
Signature · 1 line
2.46.3
Signature · 1 line
Yixun Lan (dlan)
#7 lore raw

Re: [RFC PATCH 3/3] regulator: axp20x: add support for the AXP318W

On Tue, 19 Aug 2025 21:36:50 +0800
Yixun Lan <[email protected]> wrote:

Hi,

Quoted 97 lines

Hi Andre,

Quoted 94 lines · Andre Przywara

The X-Powers AXP318W is a typical PMIC from X-Powers, featuring nine DC/DC converters and 28 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.
We use just "318" for the internal identifiers, for easier typing and less churn. If something else other than the "AXP318W" shows up, that's an easy change, externally visible strings carry the additional letter already.

---
 drivers/regulator/axp20x-regulator.c | 159 +++++++++++++++++++++++++++
 include/linux/mfd/axp20x.h           |  41 +++++++
 2 files changed, 200 insertions(+)
drivers/regulator/axp20x-regulator.c +62 -0
index da891415efc0b..eb2c45b5b9eb0 100644
@@ -138,6 +138,15 @@
 #define AXP313A_DCDC_V_OUT_MASK		GENMASK(6, 0)
 #define AXP313A_LDO_V_OUT_MASK		GENMASK(4, 0)
 
+#define AXP318_DCDC1_V_OUT_MASK		GENMASK(4, 0)
+#define AXP318_DCDC2_V_OUT_MASK		GENMASK(6, 0)
+#define AXP318_LDO_V_OUT_MASK		GENMASK(4, 0)
+#define AXP318_ELDO_V_OUT_MASK		GENMASK(5, 0)
+#define AXP318_DCDC2_NUM_VOLTAGES	88
+#define AXP318_DCDC6_NUM_VOLTAGES	128
+#define AXP318_DCDC7_NUM_VOLTAGES	103
+#define AXP318_DCDC8_NUM_VOLTAGES	119
+
 #define AXP717_DCDC1_NUM_VOLTAGES	88
 #define AXP717_DCDC2_NUM_VOLTAGES	107
 #define AXP717_DCDC3_NUM_VOLTAGES	103
@@ -765,6 +774,151 @@ static const struct regulator_desc axp313a_regulators[] = {
 	AXP_DESC_FIXED(AXP313A, RTC_LDO, "rtc-ldo", "vin1", 1800),
 };
 
+static const struct linear_range axp318_dcdc2_ranges[] = {
+	REGULATOR_LINEAR_RANGE(500000,   0, 70, 10000),
+	REGULATOR_LINEAR_RANGE(1220000, 71, 87, 20000),
+};
+
+static const struct linear_range axp318_dcdc6_ranges[] = {
+	REGULATOR_LINEAR_RANGE(500000,    0,  70,  10000),
+	REGULATOR_LINEAR_RANGE(1220000,  71,  87,  20000),
+	REGULATOR_LINEAR_RANGE(1800000,  88, 118,  20000),
+	REGULATOR_LINEAR_RANGE(2440000, 119, 127,  40000),
+};
+
+static const struct linear_range axp318_dcdc7_ranges[] = {
+	REGULATOR_LINEAR_RANGE(500000,   0,  70, 10000),
+	REGULATOR_LINEAR_RANGE(1220000, 71, 102, 20000),
+};
+
+static const struct linear_range axp318_dcdc8_ranges[] = {
+	REGULATOR_LINEAR_RANGE(500000,    0,  70,  10000),
+	REGULATOR_LINEAR_RANGE(1220000,  71, 102,  20000),
+	REGULATOR_LINEAR_RANGE(1900000, 103, 118, 100000),
+};
+
+static const struct regulator_desc axp318_regulators[] = {
+	AXP_DESC(AXP318, DCDC1, "dcdc1", "vin1", 1000, 3400, 100,
+		 AXP318_DCDC1_CONTROL, AXP318_DCDC1_V_OUT_MASK,
+		 AXP318_DCDC_OUTPUT_CONTROL1, BIT(0)),
+	AXP_DESC_RANGES(AXP318, DCDC2, "dcdc2", "vin2",
+			axp318_dcdc2_ranges, AXP318_DCDC2_NUM_VOLTAGES,
+			AXP318_DCDC2_CONTROL, AXP318_DCDC2_V_OUT_MASK,
+			AXP318_DCDC_OUTPUT_CONTROL1, BIT(1)),
+	AXP_DESC_RANGES(AXP318, DCDC3, "dcdc3", "vin3",
+			axp318_dcdc2_ranges, AXP318_DCDC2_NUM_VOLTAGES,
+			AXP318_DCDC3_CONTROL, AXP318_DCDC2_V_OUT_MASK,
+			AXP318_DCDC_OUTPUT_CONTROL1, BIT(2)),
+	AXP_DESC_RANGES(AXP318, DCDC4, "dcdc4", "vin4",
+			axp318_dcdc2_ranges, AXP318_DCDC2_NUM_VOLTAGES,
+			AXP318_DCDC4_CONTROL, AXP318_DCDC2_V_OUT_MASK,
+			AXP318_DCDC_OUTPUT_CONTROL1, BIT(3)),
+	AXP_DESC_RANGES(AXP318, DCDC5, "dcdc5", "vin5",
+			axp318_dcdc2_ranges, AXP318_DCDC2_NUM_VOLTAGES,
+			AXP318_DCDC5_CONTROL, AXP318_DCDC2_V_OUT_MASK,
+			AXP318_DCDC_OUTPUT_CONTROL1, BIT(4)),
+	AXP_DESC_RANGES(AXP318, DCDC6, "dcdc6", "vin6",
+			axp318_dcdc6_ranges, AXP318_DCDC6_NUM_VOLTAGES,
+			AXP318_DCDC6_CONTROL, AXP318_DCDC2_V_OUT_MASK,
+			AXP318_DCDC_OUTPUT_CONTROL1, BIT(5)),
+	AXP_DESC_RANGES(AXP318, DCDC7, "dcdc7", "vin7",
+			axp318_dcdc7_ranges, AXP318_DCDC7_NUM_VOLTAGES,
+			AXP318_DCDC7_CONTROL, AXP318_DCDC2_V_OUT_MASK,
+			AXP318_DCDC_OUTPUT_CONTROL1, BIT(6)),
+	AXP_DESC_RANGES(AXP318, DCDC8, "dcdc8", "vin8",
+			axp318_dcdc8_ranges, AXP318_DCDC8_NUM_VOLTAGES,
Quoted 8 lines

drivers/regulator/axp20x-regulator.c static const struct regulator_desc axp313a_regulators[] = { · line 835

Quoted 6 lines
drivers/regulator/axp20x-regulator.c +6 -0
+			AXP318_DCDC8_CONTROL, AXP318_DCDC2_V_OUT_MASK,
+			AXP318_DCDC_OUTPUT_CONTROL1, BIT(7)),
+	AXP_DESC_RANGES(AXP318, DCDC9, "dcdc9", "vin9",
+			axp318_dcdc8_ranges, AXP318_DCDC8_NUM_VOLTAGES,
+			AXP318_DCDC9_CONTROL, AXP318_DCDC2_V_OUT_MASK,
+			AXP318_DCDC_OUTPUT_CONTROL2, BIT(0)),  

I think there are two switches missing (which is SWOUT1/2 in datsheet) it's BIT(3), BIT(4) of AXP318_DCDC_OUTPUT_CONTROL2

Ah, right, I saw them, but then forgot to add them. Fixed now.

Thanks,
Andre

Quoted 168 lines

btw, I don't understand what's the meaning of BIT(1) BIT(2) - DCDC_EN1/2 or if they has any connection with those two switches..

Quoted 163 lines
drivers/regulator/axp20x-regulator.c +91 -0
+	AXP_DESC(AXP318, ALDO1, "aldo1", "aldo156in", 500, 3400, 100,
+		 AXP318_ALDO1_CONTROL, AXP318_LDO_V_OUT_MASK,
+		 AXP318_LDO_OUTPUT_CONTROL1, BIT(0)),
+	AXP_DESC(AXP318, ALDO2, "aldo2", "aldo234in", 500, 3400, 100,
+		 AXP318_ALDO2_CONTROL, AXP318_LDO_V_OUT_MASK,
+		 AXP318_LDO_OUTPUT_CONTROL1, BIT(1)),
+	AXP_DESC(AXP318, ALDO3, "aldo3", "aldo234in", 500, 3400, 100,
+		 AXP318_ALDO3_CONTROL, AXP318_LDO_V_OUT_MASK,
+		 AXP318_LDO_OUTPUT_CONTROL1, BIT(2)),
+	AXP_DESC(AXP318, ALDO4, "aldo4", "aldo234in", 500, 3400, 100,
+		 AXP318_ALDO4_CONTROL, AXP318_LDO_V_OUT_MASK,
+		 AXP318_LDO_OUTPUT_CONTROL1, BIT(3)),
+	AXP_DESC(AXP318, ALDO5, "aldo5", "aldo156in", 500, 3400, 100,
+		 AXP318_ALDO5_CONTROL, AXP318_LDO_V_OUT_MASK,
+		 AXP318_LDO_OUTPUT_CONTROL1, BIT(4)),
+	AXP_DESC(AXP318, ALDO6, "aldo6", "aldo156in", 500, 3400, 100,
+		 AXP318_ALDO6_CONTROL, AXP318_LDO_V_OUT_MASK,
+		 AXP318_LDO_OUTPUT_CONTROL1, BIT(5)),
+	AXP_DESC(AXP318, BLDO1, "bldo1", "bldoin", 500, 3400, 100,
+		 AXP318_BLDO1_CONTROL, AXP318_LDO_V_OUT_MASK,
+		 AXP318_LDO_OUTPUT_CONTROL1, BIT(6)),
+	AXP_DESC(AXP318, BLDO2, "bldo2", "bldoin", 500, 3400, 100,
+		 AXP318_BLDO2_CONTROL, AXP318_LDO_V_OUT_MASK,
+		 AXP318_LDO_OUTPUT_CONTROL1, BIT(7)),
+	AXP_DESC(AXP318, BLDO3, "bldo3", "bldoin", 500, 3400, 100,
+		 AXP318_BLDO3_CONTROL, AXP318_LDO_V_OUT_MASK,
+		 AXP318_LDO_OUTPUT_CONTROL2, BIT(0)),
+	AXP_DESC(AXP318, BLDO4, "bldo4", "bldoin", 500, 3400, 100,
+		 AXP318_BLDO4_CONTROL, AXP318_LDO_V_OUT_MASK,
+		 AXP318_LDO_OUTPUT_CONTROL2, BIT(1)),
+	AXP_DESC(AXP318, BLDO5, "bldo5", "bldoin", 500, 3400, 100,
+		 AXP318_BLDO5_CONTROL, AXP318_LDO_V_OUT_MASK,
+		 AXP318_LDO_OUTPUT_CONTROL2, BIT(2)),
+	AXP_DESC(AXP318, CLDO1, "cldo1", "cldoin", 500, 3400, 100,
+		 AXP318_CLDO1_CONTROL, AXP318_LDO_V_OUT_MASK,
+		 AXP318_LDO_OUTPUT_CONTROL2, BIT(3)),
+	AXP_DESC(AXP318, CLDO2, "cldo2", "cldoin", 500, 3400, 100,
+		 AXP318_CLDO2_CONTROL, AXP318_LDO_V_OUT_MASK,
+		 AXP318_LDO_OUTPUT_CONTROL2, BIT(4)),
+	AXP_DESC(AXP318, CLDO3, "cldo3", "cldoin", 500, 3400, 100,
+		 AXP318_CLDO3_CONTROL, AXP318_LDO_V_OUT_MASK,
+		 AXP318_LDO_OUTPUT_CONTROL2, BIT(5)),
+	AXP_DESC(AXP318, CLDO4, "cldo4", "cldoin", 500, 3400, 100,
+		 AXP318_CLDO4_CONTROL, AXP318_LDO_V_OUT_MASK,
+		 AXP318_LDO_OUTPUT_CONTROL2, BIT(6)),
+	AXP_DESC(AXP318, CLDO5, "cldo5", "cldoin", 500, 3400, 100,
+		 AXP318_CLDO5_CONTROL, AXP318_LDO_V_OUT_MASK,
+		 AXP318_LDO_OUTPUT_CONTROL2, BIT(7)),
+	AXP_DESC(AXP318, DLDO1, "dldo1", "dldoin", 500, 3400, 100,
+		 AXP318_DLDO1_CONTROL, AXP318_LDO_V_OUT_MASK,
+		 AXP318_LDO_OUTPUT_CONTROL3, BIT(0)),
+	AXP_DESC(AXP318, DLDO2, "dldo2", "dldoin", 500, 3400, 100,
+		 AXP318_DLDO2_CONTROL, AXP318_LDO_V_OUT_MASK,
+		 AXP318_LDO_OUTPUT_CONTROL3, BIT(1)),
+	AXP_DESC(AXP318, DLDO3, "dldo3", "dldoin", 500, 3400, 100,
+		 AXP318_DLDO3_CONTROL, AXP318_LDO_V_OUT_MASK,
+		 AXP318_LDO_OUTPUT_CONTROL3, BIT(2)),
+	AXP_DESC(AXP318, DLDO4, "dldo4", "dldoin", 500, 3400, 100,
+		 AXP318_DLDO4_CONTROL, AXP318_LDO_V_OUT_MASK,
+		 AXP318_LDO_OUTPUT_CONTROL3, BIT(3)),
+	AXP_DESC(AXP318, DLDO5, "dldo5", "dldoin", 500, 3400, 100,
+		 AXP318_DLDO5_CONTROL, AXP318_LDO_V_OUT_MASK,
+		 AXP318_LDO_OUTPUT_CONTROL3, BIT(4)),
+	AXP_DESC(AXP318, DLDO6, "dldo6", "dldoin", 500, 3400, 100,
+		 AXP318_DLDO6_CONTROL, AXP318_LDO_V_OUT_MASK,
+		 AXP318_LDO_OUTPUT_CONTROL3, BIT(5)),
+	AXP_DESC(AXP318, ELDO1, "eldo1", "eldoin", 500, 1500, 25,
+		 AXP318_ELDO1_CONTROL, AXP318_ELDO_V_OUT_MASK,
+		 AXP318_LDO_OUTPUT_CONTROL3, BIT(6)),
+	AXP_DESC(AXP318, ELDO2, "eldo2", "eldoin", 500, 1500, 25,
+		 AXP318_ELDO2_CONTROL, AXP318_ELDO_V_OUT_MASK,
+		 AXP318_LDO_OUTPUT_CONTROL3, BIT(7)),
+	AXP_DESC(AXP318, ELDO3, "eldo3", "eldoin", 500, 1500, 25,
+		 AXP318_ELDO3_CONTROL, AXP318_ELDO_V_OUT_MASK,
+		 AXP318_LDO_OUTPUT_CONTROL4, BIT(0)),
+	AXP_DESC(AXP318, ELDO4, "eldo4", "eldoin", 500, 1500, 25,
+		 AXP318_ELDO4_CONTROL, AXP318_ELDO_V_OUT_MASK,
+		 AXP318_LDO_OUTPUT_CONTROL4, BIT(1)),
+	AXP_DESC(AXP318, ELDO5, "eldo5", "eldoin", 500, 1500, 25,
+		 AXP318_ELDO5_CONTROL, AXP318_ELDO_V_OUT_MASK,
+		 AXP318_LDO_OUTPUT_CONTROL4, BIT(2)),
+	AXP_DESC(AXP318, ELDO6, "eldo6", "eldoin", 500, 1500, 25,
+		 AXP318_ELDO6_CONTROL, AXP318_ELDO_V_OUT_MASK,
+		 AXP318_LDO_OUTPUT_CONTROL4, BIT(3)),
+};
+
 static const struct linear_range axp717_dcdc1_ranges[] = {
 	REGULATOR_LINEAR_RANGE(500000,   0, 70, 10000),
 	REGULATOR_LINEAR_RANGE(1220000, 71, 87, 20000),
@@ -1347,6 +1501,7 @@ static int axp20x_set_dcdc_freq(struct platform_device *pdev, u32 dcdcfreq)
 		step = 150;
 		break;
 	case AXP313A_ID:
+	case AXP318_ID:
 	case AXP323_ID:
 	case AXP717_ID:
 	case AXP15060_ID:
@@ -1585,6 +1740,10 @@ static int axp20x_regulator_probe(struct platform_device *pdev)
 		regulators = axp313a_regulators;
 		nregulators = AXP313A_REG_ID_MAX;
 		break;
+	case AXP318_ID:
+		regulators = axp318_regulators;
+		nregulators = AXP318_REG_ID_MAX;
+		break;
 	case AXP717_ID:
 		regulators = axp717_regulators;
 		nregulators = AXP717_REG_ID_MAX;
include/linux/mfd/axp20x.h +41 -0
index a871789f6cfa9..f4217c4763669 100644
@@ -559,6 +559,47 @@ enum {
 	AXP313A_REG_ID_MAX,
 };
 
+enum {
+	AXP318_DCDC1 = 0,
+	AXP318_DCDC2,
+	AXP318_DCDC3,
+	AXP318_DCDC4,
+	AXP318_DCDC5,
+	AXP318_DCDC6,
+	AXP318_DCDC7,
+	AXP318_DCDC8,
+	AXP318_DCDC9,
+	AXP318_ALDO1,
+	AXP318_ALDO2,
+	AXP318_ALDO3,
+	AXP318_ALDO4,
+	AXP318_ALDO5,
+	AXP318_ALDO6,
+	AXP318_BLDO1,
+	AXP318_BLDO2,
+	AXP318_BLDO3,
+	AXP318_BLDO4,
+	AXP318_BLDO5,
+	AXP318_CLDO1,
+	AXP318_CLDO2,
+	AXP318_CLDO3,
+	AXP318_CLDO4,
+	AXP318_CLDO5,
+	AXP318_DLDO1,
+	AXP318_DLDO2,
+	AXP318_DLDO3,
+	AXP318_DLDO4,
+	AXP318_DLDO5,
+	AXP318_DLDO6,
+	AXP318_ELDO1,
+	AXP318_ELDO2,
+	AXP318_ELDO3,
+	AXP318_ELDO4,
+	AXP318_ELDO5,
+	AXP318_ELDO6,
+	AXP318_REG_ID_MAX,
+};
+
 enum {
 	AXP717_DCDC1 = 0,
 	AXP717_DCDC2,
Signature · 1 line
2.46.3