Skip to contentSkip to conversation

pmic: pca9450: Add upstream regulators subnode match

PATCH New Marek Vasut 2 participants 4 messages May 20, 2022

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/2 pmic: pca9450: Add upstream regulators subnode match

The upstream DT regulators node subnodes are named BUCKn and LDOn, the downstream DT regulators node subnodes are named buckn and ldon, add the upstream match.

---
V2: Add RB by Fabio
V3: No change

---
 drivers/power/pmic/pca9450.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/power/pmic/pca9450.c +2 -0
index 2394b196c56..26c876c9c45 100644
@@ -19,8 +19,10 @@ DECLARE_GLOBAL_DATA_PTR;
 static const struct pmic_child_info pmic_children_info[] = {
 	/* buck */
 	{ .prefix = "b", .driver = PCA9450_REGULATOR_DRIVER},
+	{ .prefix = "B", .driver = PCA9450_REGULATOR_DRIVER},
 	/* ldo */
 	{ .prefix = "l", .driver = PCA9450_REGULATOR_DRIVER},
+	{ .prefix = "L", .driver = PCA9450_REGULATOR_DRIVER},
 	{ },
 };
 
Signature · 1 line
2.35.1
#1 lore raw

PATCH v3 2/2 pmic: pca9450: Add regulator driver

Add PCA9450 regulator driver. This is complementary driver for the BUCKn and LDOn regulators provided by the PCA9450 PMIC driver. Currently the driver permits reading the settngs and configuring the BUCKn and LDOn regulators.

---
V2: Add RB by Fabio
V3: Rename DVS_BUCK_RUN_MASK to PCA9450_DVS_BUCK_RUN_MASK

---
 drivers/power/pmic/pca9450.c      |   6 +-
 drivers/power/regulator/Kconfig   |  15 ++
 drivers/power/regulator/Makefile  |   1 +
 drivers/power/regulator/pca9450.c | 333 ++++++++++++++++++++++++++++++
 include/power/pca9450.h           |  11 +
 5 files changed, 363 insertions(+), 3 deletions(-)
 create mode 100644 drivers/power/regulator/pca9450.c
drivers/power/pmic/pca9450.c +3 -3
index 26c876c9c45..116ac49a8db 100644
@@ -83,9 +83,9 @@ static struct dm_pmic_ops pca9450_ops = {
 };
 
 static const struct udevice_id pca9450_ids[] = {
-	{ .compatible = "nxp,pca9450a", .data = 0x25, },
-	{ .compatible = "nxp,pca9450b", .data = 0x25, },
-	{ .compatible = "nxp,pca9450c", .data = 0x25, },
+	{ .compatible = "nxp,pca9450a", .data = NXP_CHIP_TYPE_PCA9450A, },
+	{ .compatible = "nxp,pca9450b", .data = NXP_CHIP_TYPE_PCA9450BC, },
+	{ .compatible = "nxp,pca9450c", .data = NXP_CHIP_TYPE_PCA9450BC, },
 	{ }
 };
 
drivers/power/regulator/Kconfig +15 -0
index 9145408b3c9..d6cea8ec666 100644
@@ -60,6 +60,21 @@ config SPL_DM_REGULATOR_BD71837
 	This config enables implementation of driver-model regulator uclass
 	features for regulators on ROHM BD71837 and BD71847 in SPL.
 
+config DM_REGULATOR_PCA9450
+	bool "Enable Driver Model for NXP PCA9450 regulators"
+	depends on DM_REGULATOR && DM_PMIC_PCA9450
+	help
+	This config enables implementation of driver-model regulator uclass
+	features for regulators on NXP PCA9450 PMICs. PCA9450 contains 6 bucks
+	and 5 LDOS. The driver implements get/set api for value and enable.
+
+config SPL_DM_REGULATOR_PCA9450
+	bool "Enable Driver Model for NXP PCA9450 regulators in SPL"
+	depends on DM_REGULATOR_PCA9450
+	help
+	This config enables implementation of driver-model regulator uclass
+	features for regulators on ROHM PCA9450 in SPL.
+
 config DM_REGULATOR_DA9063
 	bool "Enable Driver Model for REGULATOR DA9063"
 	depends on DM_REGULATOR && DM_PMIC_DA9063
drivers/power/regulator/Makefile +1 -0
index b9883df9281..bc736068bca 100644
@@ -11,6 +11,7 @@ obj-$(CONFIG_$(SPL_)DM_REGULATOR_DA9063) += da9063.o
 obj-$(CONFIG_DM_REGULATOR_MAX77686) += max77686.o
 obj-$(CONFIG_$(SPL_)DM_PMIC_PFUZE100) += pfuze100.o
 obj-$(CONFIG_$(SPL_)DM_REGULATOR_BD71837) += bd71837.o
+obj-$(CONFIG_$(SPL_)DM_REGULATOR_PCA9450) += pca9450.o
 obj-$(CONFIG_$(SPL_)REGULATOR_PWM) += pwm_regulator.o
 obj-$(CONFIG_$(SPL_)DM_REGULATOR_FAN53555) += fan53555.o
 obj-$(CONFIG_$(SPL_)DM_REGULATOR_COMMON) += regulator_common.o
drivers/power/regulator/pca9450.c new file +333 -0

333 lines not on this page · raw message

include/power/pca9450.h +11 -0
index 27703bb1f91..fa0405fcb87 100644
@@ -56,4 +56,15 @@ enum {
 
 int power_pca9450_init(unsigned char bus, unsigned char addr);
 
+enum {
+	NXP_CHIP_TYPE_PCA9450A = 0,
+	NXP_CHIP_TYPE_PCA9450BC,
+	NXP_CHIP_TYPE_AMOUNT
+};
+
+#define PCA9450_DVS_BUCK_RUN_MASK	0x7f
+#define PCA9450_LDO12_MASK		0x07
+#define PCA9450_LDO34_MASK		0x1f
+#define PCA9450_LDO5_MASK		0x0f
+
 #endif
Signature · 1 line
2.35.1
#2 lore raw

PATCH v3 2/2 pmic: pca9450: Add regulator driver

Quoted 9 lines

Add PCA9450 regulator driver. This is complementary driver for the BUCKn and LDOn regulators provided by the PCA9450 PMIC driver. Currently the driver permits reading the settngs and configuring the BUCKn and LDOn regulators.

Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: [email protected]
=====================================================================
#3 lore raw

PATCH v3 1/2 pmic: pca9450: Add upstream regulators subnode match

In reply to Marek Vasut
Quoted 8 lines

The upstream DT regulators node subnodes are named BUCKn and LDOn, the downstream DT regulators node subnodes are named buckn and ldon, add the upstream match.

Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: [email protected]
=====================================================================