Skip to contentSkip to conversation

dt-bindings: regulator: Add property for I2C level shifter

PATCH In review Rickard Andersson 2 participants 6 messages Apr 29, 2022 – May 3, 2022

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

PATCH v2 1/5 dt-bindings: regulator: Add property for I2C level shifter

From: Per-Daniel Olsson <[email protected]>

By setting nxp,i2c-lt-enable the I2C level translator is enabled.

---
 .../devicetree/bindings/regulator/nxp,pca9450-regulator.yaml | 5 +++++
 1 file changed, 5 insertions(+)
Documentation/devicetree/bindings/regulator/nxp,pca9450-regulator.yaml +5 -0
index f70f2e758a00..e723f8cf6d74 100644
@@ -92,6 +92,11 @@ properties:
       LDO5CTRL_L or LDO5CTRL_H register. Use this if the SD_VSEL signal is
       connected to a host GPIO.
 
+  nxp,i2c-lt-enable:
+    type: boolean
+    description:
+      Indicates that the I2C Level Translator is used.
+
 required:
   - compatible
   - reg
Signature · 1 line
2.20.1
#1 lore raw

PATCH v2 2/5 regulator: pca9450: Make I2C Level Translator configurable

From: Per-Daniel Olsson <[email protected]>

Make the I2C Level Translator included in PCA9450 configurable from devicetree. The reset state is off. By setting nxp,i2c-lt-enable, the I2C Level Translator will be enabled while in STANDBY or RUN state.

---
 drivers/regulator/pca9450-regulator.c | 11 +++++++++++
 include/linux/regulator/pca9450.h     |  7 +++++++
 2 files changed, 18 insertions(+)
drivers/regulator/pca9450-regulator.c +11 -0
index 64e5f5f0cc84..87b4e6e29ba1 100644
@@ -810,6 +810,17 @@ static int pca9450_i2c_probe(struct i2c_client *i2c,
 		return ret;
 	}
 
+	if (of_property_read_bool(i2c->dev.of_node, "nxp,i2c-lt-enable")) {
+		/* Enable I2C Level Translator */
+		ret = regmap_update_bits(pca9450->regmap, PCA9450_REG_CONFIG2,
+					 I2C_LT_MASK, I2C_LT_ON_STANDBY_RUN);
+		if (ret) {
+			dev_err(&i2c->dev,
+				"Failed to enable I2C level translator\n");
+			return ret;
+		}
+	}
+
 	/*
 	 * The driver uses the LDO5CTRL_H register to control the LDO5 regulator.
 	 * This is only valid if the SD_VSEL input of the PMIC is high. Let's
include/linux/regulator/pca9450.h +7 -0
index 71902f41c919..3c01c2bf84f5 100644
@@ -226,4 +226,11 @@ enum {
 #define WDOG_B_CFG_COLD_LDO12		0x80
 #define WDOG_B_CFG_COLD			0xC0
 
+/* PCA9450_REG_CONFIG2 bits */
+#define I2C_LT_MASK			0x03
+#define I2C_LT_FORCE_DISABLE		0x00
+#define I2C_LT_ON_STANDBY_RUN		0x01
+#define I2C_LT_ON_RUN			0x02
+#define I2C_LT_FORCE_ENABLE		0x03
+
 #endif /* __LINUX_REG_PCA9450_H__ */
Signature · 1 line
2.20.1
#2 lore raw

PATCH v2 3/5 dt-bindings: regulator: Add property for WDOG_B warm reset

In reply to Rickard Andersson

From: Rickard x Andersson <[email protected]>

Make it possible to do warm reset on WDOG_B assertion.

---
 .../bindings/regulator/nxp,pca9450-regulator.yaml           | 6 ++++++
 1 file changed, 6 insertions(+)
Documentation/devicetree/bindings/regulator/nxp,pca9450-regulator.yaml +6 -0
index e723f8cf6d74..b539781e39aa 100644
@@ -97,6 +97,12 @@ properties:
     description:
       Indicates that the I2C Level Translator is used.
 
+  nxp,wdog_b-warm-reset:
+    type: boolean
+    description:
+      When WDOG_B signal is asserted a warm reset will be done instead of cold
+      reset.
+
 required:
   - compatible
   - reg
Signature · 1 line
2.20.1
#3 lore raw

PATCH v2 4/5 regulator: pca9450: Make warm reset on WDOG_B assertion

In reply to Rickard Andersson

From: Rickard x Andersson <[email protected]>

The default configuration of the PMIC behavior makes the PMIC power cycle most regulators on WDOG_B assertion. This power cycling causes the memory contents of OCRAM to be lost. Some systems neeeds some memory that survives reset and reboot, therefore this patch is created.

---
 drivers/regulator/pca9450-regulator.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/regulator/pca9450-regulator.c +7 -1
index 87b4e6e29ba1..4a3ae73c600c 100644
@@ -702,6 +702,7 @@ static int pca9450_i2c_probe(struct i2c_client *i2c,
 	struct regulator_config config = { };
 	struct pca9450 *pca9450;
 	unsigned int device_id, i;
+	unsigned int reset_ctrl;
 	int ret;
 
 	if (!i2c->irq) {
@@ -802,9 +803,14 @@ static int pca9450_i2c_probe(struct i2c_client *i2c,
 		return ret;
 	}
 
+	if (of_property_read_bool(i2c->dev.of_node, "nxp,wdog_b-warm-reset"))
+		reset_ctrl = WDOG_B_CFG_WARM;
+	else
+		reset_ctrl = WDOG_B_CFG_COLD_LDO12;
+
 	/* Set reset behavior on assertion of WDOG_B signal */
 	ret = regmap_update_bits(pca9450->regmap, PCA9450_REG_RESET_CTRL,
-				WDOG_B_CFG_MASK, WDOG_B_CFG_COLD_LDO12);
+				 WDOG_B_CFG_MASK, reset_ctrl);
 	if (ret) {
 		dev_err(&i2c->dev, "Failed to set WDOG_B reset behavior\n");
 		return ret;
Signature · 1 line
2.20.1
#4 lore raw

PATCH v2 5/5 regulator: pca9450: Enable DVS control via PMIC_STBY_REQ

In reply to Rickard Andersson

From: Rickard x Andersson <[email protected]>

When DVS is enabled via the devicetree properties "nxp,dvs-run-voltage" and "nxp,dvs-standby-voltage" then also the bit that enables DVS control via PMIC_STBY_REQ pin should be set.

---
 drivers/regulator/pca9450-regulator.c | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/regulator/pca9450-regulator.c +8 -0
index 4a3ae73c600c..14b7d3376516 100644
@@ -174,6 +174,14 @@ static int buck_set_dvs(const struct regulator_desc *desc,
 		}
 	}
 
+	if (ret == 0) {
+		struct pca9450_regulator_desc *regulator = container_of(desc,
+					struct pca9450_regulator_desc, desc);
+
+		/* Enable DVS control through PMIC_STBY_REQ for this BUCK */
+		ret = regmap_update_bits(regmap, regulator->desc.enable_reg,
+					 BUCK1_DVS_CTRL, BUCK1_DVS_CTRL);
+	}
 	return ret;
 }
 
Signature · 1 line
2.20.1
maintainer
#5 lore raw
In reply to Rickard Andersson
Quoted 6 lines · Rickard Andersson

From: Per-Daniel Olsson <[email protected]>

By setting nxp,i2c-lt-enable the I2C level translator is enabled.

Applied to

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git for-next

Thanks!

[1/5] dt-bindings: regulator: Add property for I2C level shifter

      commit: e721b161399b30e085faa2f4b930ebeb15df36a7
[2/5] regulator: pca9450: Make I2C Level Translator configurable
      commit: 62139f52b7e588d565aa9df81ea0a0548a68b823
[3/5] dt-bindings: regulator: Add property for WDOG_B warm reset
      commit: bd2f5e71454bc84427c4fd67c5ea4881f155ac6e
[4/5] regulator: pca9450: Make warm reset on WDOG_B assertion
      commit: 2364a64d0673f5044e6a52cb17d6d60c6f1f8329
[5/5] regulator: pca9450: Enable DVS control via PMIC_STBY_REQ
      commit: 20078e3bbe6e5adb1a88f03f9609d532d99c690c

All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying to this mail.

Thanks,
Mark