Skip to contentSkip to conversation

regulator: pca9450: add LOADSW regulator

PATCH In review Nicolas Heemeryck 2 participants 4 messages Mar 17, 2023

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

cover regulator: pca9450: add LOADSW regulator

This series adds support for the load switch present in the PCA9450.

Nicolas Heemeryck (2):
regulator: pca9450: Add LOADSW regulator
bindings: regulator: pca9450: Add LOADSW regulator

 .../regulator/nxp,pca9450-regulator.yaml      | 14 ++++++++
 drivers/regulator/pca9450-regulator.c         | 32 +++++++++++++++++++
 include/linux/regulator/pca9450.h             |  4 +++
 3 files changed, 50 insertions(+)
Signature · 5 lines
2.34.1


-- 
- Confidential -
#1 lore raw

PATCH 1/2 regulator: pca9450: Add LOADSW regulator

Make the load switch present in the PCA9450 accessible and configurable from the devicetree. Note that the SWIn for the load switch is connected to BUCK4.

---
 drivers/regulator/pca9450-regulator.c | 32 +++++++++++++++++++++++++++
 include/linux/regulator/pca9450.h     |  4 ++++
 2 files changed, 36 insertions(+)
drivers/regulator/pca9450-regulator.c +32 -0
index c6351fac9f4d..ccb61fc73a59 100644
@@ -99,6 +99,12 @@ static const struct regulator_ops pca9450_ldo_regulator_ops = {
 	.get_voltage_sel = regulator_get_voltage_sel_regmap,
 };
 
+static const struct regulator_ops pca9450_loadsw_regulator_ops = {
+	.enable = regulator_enable_regmap,
+	.disable = regulator_disable_regmap,
+	.is_enabled = regulator_is_enabled_regmap,
+};
+
 /*
  * BUCK1/2/3
  * 0.60 to 2.1875V (12.5mV step)
@@ -452,6 +458,19 @@ static const struct pca9450_regulator_desc pca9450a_regulators[] = {
 			.owner = THIS_MODULE,
 		},
 	},
+	{
+		.desc = {
+			.name = "loadsw",
+			.of_match = of_match_ptr("LOADSW"),
+			.regulators_node = of_match_ptr("regulators"),
+			.id = PCA9450_LOADSW,
+			.ops = &pca9450_loadsw_regulator_ops,
+			.type = REGULATOR_VOLTAGE,
+			.enable_reg = PCA9450_REG_LOADSW_CTRL,
+			.enable_mask = LOADSW_CTRL_EN_MASK,
+			.owner = THIS_MODULE,
+		},
+	},
 };
 
 /*
@@ -661,6 +680,19 @@ static const struct pca9450_regulator_desc pca9450bc_regulators[] = {
 			.owner = THIS_MODULE,
 		},
 	},
+	{
+		.desc = {
+			.name = "loadsw",
+			.of_match = of_match_ptr("LOADSW"),
+			.regulators_node = of_match_ptr("regulators"),
+			.id = PCA9450_LOADSW,
+			.ops = &pca9450_loadsw_regulator_ops,
+			.type = REGULATOR_VOLTAGE,
+			.enable_reg = PCA9450_REG_LOADSW_CTRL,
+			.enable_mask = LOADSW_CTRL_EN_MASK,
+			.owner = THIS_MODULE,
+		},
+	},
 };
 
 static irqreturn_t pca9450_irq_handler(int irq, void *data)
include/linux/regulator/pca9450.h +4 -0
index 3c01c2bf84f5..4e922d6010cb 100644
@@ -24,6 +24,7 @@ enum {
 	PCA9450_LDO3,
 	PCA9450_LDO4,
 	PCA9450_LDO5,
+	PCA9450_LOADSW,
 	PCA9450_REGULATOR_CNT,
 };
 
@@ -209,6 +210,9 @@ enum {
 #define LDO5H_EN_MASK			0xC0
 #define LDO5HOUT_MASK			0x0F
 
+/* PCA9450_REG_LOADSW_CTRL bits */
+#define LOADSW_CTRL_EN_MASK		0x03
+
 /* PCA9450_REG_IRQ bits */
 #define IRQ_PWRON			0x80
 #define IRQ_WDOGB			0x40
Signature · 5 lines
2.34.1


-- 
- Confidential -
#2 lore raw

PATCH 2/2 bindings: regulator: pca9450: Add LOADSW regulator

In reply to Nicolas Heemeryck

Add the binding documentation for the load switch regulator.

---
 .../bindings/regulator/nxp,pca9450-regulator.yaml  | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
Documentation/devicetree/bindings/regulator/nxp,pca9450-regulator.yaml +14 -0
index 835b53302db8..064d57256aff 100644
@@ -20,6 +20,7 @@ description: |
 #The valid names for PCA9450 regulator nodes are:
 #BUCK1, BUCK2, BUCK3, BUCK4, BUCK5, BUCK6,
 #LDO1, LDO2, LDO3, LDO4, LDO5
+#LOADSW
 #Note: Buck3 removed on PCA9450B and connect with Buck1 on PCA9450C.
 
 properties:
@@ -74,6 +75,14 @@ properties:
 
         unevaluatedProperties: false
 
+        "LOADSW":
+          type: object
+          $ref: regulator.yaml#
+          description:
+            Properties for LOAD SWITCH regulator.
+
+        unevaluatedProperties: false
+
     additionalProperties: false
 
   sd-vsel-gpios:
@@ -190,6 +199,11 @@ examples:
                     regulator-boot-on;
                     regulator-always-on;
                 };
+                loadsw: LOADSW {
+                    regulator-name = "LOADSW";
+                    regulator-boot-on;
+                    regulator-always-on;
+                };
             };
         };
     };
Signature · 5 lines
2.34.1


-- 
- Confidential -
#3 lore raw

Re: [PATCH 2/2] bindings: regulator: pca9450: Add LOADSW regulator

Quoted 1 line · Nicolas Heemeryck

Add the binding documentation for the load switch regulator.

Please use scripts/get_maintainers.pl to get a list of necessary people and lists to CC. It might happen, that command when run on an older kernel, gives you outdated entries. Therefore please be sure you base your patches on recent Linux kernel.

You missed important mailing lists as well, thus patch won't be tested. That's a NAK. :(

Quoted 19 lines
---
 .../bindings/regulator/nxp,pca9450-regulator.yaml  | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
Documentation/devicetree/bindings/regulator/nxp,pca9450-regulator.yaml +1 -0
index 835b53302db8..064d57256aff 100644
@@ -20,6 +20,7 @@ description: |
 #The valid names for PCA9450 regulator nodes are:
 #BUCK1, BUCK2, BUCK3, BUCK4, BUCK5, BUCK6,
 #LDO1, LDO2, LDO3, LDO4, LDO5
+#LOADSW
 #Note: Buck3 removed on PCA9450B and connect with Buck1 on PCA9450C.
 
 properties:

Documentation/devicetree/bindings/regulator/nxp,pca9450-regulator.yaml properties: · line 78

Quoted 4 lines
Documentation/devicetree/bindings/regulator/nxp,pca9450-regulator.yaml +1 -0
@@ -74,6 +75,14 @@ properties:
 
         unevaluatedProperties: false
 
+        "LOADSW":

Does not look like pattern... unless you want something-LOADSW, but then why?

Best regards,
Krzysztof