* [PATCH 1/2] regulator: pca9450: Add LOADSW regulator
2023-03-17 9:39 [PATCH 0/2] regulator: pca9450: add LOADSW regulator Nicolas Heemeryck
@ 2023-03-17 9:39 ` Nicolas Heemeryck
2023-03-17 9:39 ` [PATCH 2/2] bindings: " Nicolas Heemeryck
1 sibling, 0 replies; 4+ messages in thread
From: Nicolas Heemeryck @ 2023-03-17 9:39 UTC (permalink / raw)
To: Liam Girdwood, Mark Brown; +Cc: linux-kernel, Nicolas Heemeryck
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.
Signed-off-by: Nicolas Heemeryck <nicolas.heemeryck@devialet.com>
---
drivers/regulator/pca9450-regulator.c | 32 +++++++++++++++++++++++++++
include/linux/regulator/pca9450.h | 4 ++++
2 files changed, 36 insertions(+)
diff --git a/drivers/regulator/pca9450-regulator.c b/drivers/regulator/pca9450-regulator.c
index c6351fac9f4d..ccb61fc73a59 100644
--- a/drivers/regulator/pca9450-regulator.c
+++ b/drivers/regulator/pca9450-regulator.c
@@ -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)
diff --git a/include/linux/regulator/pca9450.h b/include/linux/regulator/pca9450.h
index 3c01c2bf84f5..4e922d6010cb 100644
--- a/include/linux/regulator/pca9450.h
+++ b/include/linux/regulator/pca9450.h
@@ -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
--
2.34.1
--
- Confidential -
^ permalink raw reply [flat|nested] 4+ messages in thread* [PATCH 2/2] bindings: regulator: pca9450: Add LOADSW regulator
2023-03-17 9:39 [PATCH 0/2] regulator: pca9450: add LOADSW regulator Nicolas Heemeryck
2023-03-17 9:39 ` [PATCH 1/2] regulator: pca9450: Add " Nicolas Heemeryck
@ 2023-03-17 9:39 ` Nicolas Heemeryck
2023-03-17 11:49 ` Krzysztof Kozlowski
1 sibling, 1 reply; 4+ messages in thread
From: Nicolas Heemeryck @ 2023-03-17 9:39 UTC (permalink / raw)
To: Liam Girdwood, Mark Brown; +Cc: linux-kernel, Nicolas Heemeryck
Add the binding documentation for the load switch regulator.
Signed-off-by: Nicolas Heemeryck <nicolas.heemeryck@devialet.com>
---
.../bindings/regulator/nxp,pca9450-regulator.yaml | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/Documentation/devicetree/bindings/regulator/nxp,pca9450-regulator.yaml b/Documentation/devicetree/bindings/regulator/nxp,pca9450-regulator.yaml
index 835b53302db8..064d57256aff 100644
--- a/Documentation/devicetree/bindings/regulator/nxp,pca9450-regulator.yaml
+++ b/Documentation/devicetree/bindings/regulator/nxp,pca9450-regulator.yaml
@@ -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;
+ };
};
};
};
--
2.34.1
--
- Confidential -
^ permalink raw reply [flat|nested] 4+ messages in thread