All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/5] dt-bindings: regulator: Add property for I2C level shifter
@ 2022-04-28 14:01 Rickard Andersson
  2022-04-28 14:01 ` [PATCH 2/5] regulator: pca9450: Make I2C Level Translator configurable Rickard Andersson
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Rickard Andersson @ 2022-04-28 14:01 UTC (permalink / raw)
  To: broonie, lgirdwood, linux-kernel, yibin.gong
  Cc: rickaran, rickard314.andersson, perdo

From: Per-Daniel Olsson <perdo@axis.com>

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

Signed-off-by: Per-Daniel Olsson <perdo@axis.com>
---
 .../devicetree/bindings/regulator/nxp,pca9450-regulator.yaml | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/Documentation/devicetree/bindings/regulator/nxp,pca9450-regulator.yaml b/Documentation/devicetree/bindings/regulator/nxp,pca9450-regulator.yaml
index f70f2e758a00..e723f8cf6d74 100644
--- a/Documentation/devicetree/bindings/regulator/nxp,pca9450-regulator.yaml
+++ b/Documentation/devicetree/bindings/regulator/nxp,pca9450-regulator.yaml
@@ -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
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/5] regulator: pca9450: Make I2C Level Translator configurable
  2022-04-28 14:01 [PATCH 1/5] dt-bindings: regulator: Add property for I2C level shifter Rickard Andersson
@ 2022-04-28 14:01 ` Rickard Andersson
  2022-04-28 14:01 ` [PATCH 3/5] dt-bindings: regulator: Add property for WDOG_B warm reset Rickard Andersson
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Rickard Andersson @ 2022-04-28 14:01 UTC (permalink / raw)
  To: broonie, lgirdwood, linux-kernel, yibin.gong
  Cc: rickaran, rickard314.andersson, perdo

From: Per-Daniel Olsson <perdo@axis.com>

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.

Signed-off-by: Per-Daniel Olsson <perdo@axis.com>
---
 drivers/regulator/pca9450-regulator.c | 11 +++++++++++
 include/linux/regulator/pca9450.h     |  7 +++++++
 2 files changed, 18 insertions(+)

diff --git a/drivers/regulator/pca9450-regulator.c b/drivers/regulator/pca9450-regulator.c
index 64e5f5f0cc84..87b4e6e29ba1 100644
--- a/drivers/regulator/pca9450-regulator.c
+++ b/drivers/regulator/pca9450-regulator.c
@@ -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
diff --git a/include/linux/regulator/pca9450.h b/include/linux/regulator/pca9450.h
index 71902f41c919..3c01c2bf84f5 100644
--- a/include/linux/regulator/pca9450.h
+++ b/include/linux/regulator/pca9450.h
@@ -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__ */
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 3/5] dt-bindings: regulator: Add property for WDOG_B warm reset
  2022-04-28 14:01 [PATCH 1/5] dt-bindings: regulator: Add property for I2C level shifter Rickard Andersson
  2022-04-28 14:01 ` [PATCH 2/5] regulator: pca9450: Make I2C Level Translator configurable Rickard Andersson
@ 2022-04-28 14:01 ` Rickard Andersson
  2022-04-28 14:01 ` [PATCH 4/5] regulator: pca9450: Make warm reset on WDOG_B assertion Rickard Andersson
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Rickard Andersson @ 2022-04-28 14:01 UTC (permalink / raw)
  To: broonie, lgirdwood, linux-kernel, yibin.gong
  Cc: rickaran, rickard314.andersson, perdo

From: Rickard x Andersson <rickaran@axis.com>

Make it possible to do warm reset on WDOG_B assertion.

Signed-off-by: Rickard x Andersson <rickaran@axis.com>
---
 .../bindings/regulator/nxp,pca9450-regulator.yaml           | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/Documentation/devicetree/bindings/regulator/nxp,pca9450-regulator.yaml b/Documentation/devicetree/bindings/regulator/nxp,pca9450-regulator.yaml
index e723f8cf6d74..b539781e39aa 100644
--- a/Documentation/devicetree/bindings/regulator/nxp,pca9450-regulator.yaml
+++ b/Documentation/devicetree/bindings/regulator/nxp,pca9450-regulator.yaml
@@ -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
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 4/5] regulator: pca9450: Make warm reset on WDOG_B assertion
  2022-04-28 14:01 [PATCH 1/5] dt-bindings: regulator: Add property for I2C level shifter Rickard Andersson
  2022-04-28 14:01 ` [PATCH 2/5] regulator: pca9450: Make I2C Level Translator configurable Rickard Andersson
  2022-04-28 14:01 ` [PATCH 3/5] dt-bindings: regulator: Add property for WDOG_B warm reset Rickard Andersson
@ 2022-04-28 14:01 ` Rickard Andersson
  2022-04-28 14:01 ` [PATCH 5/5] regulator: pca9450: Enable DVS control via PMIC_STBY_REQ Rickard Andersson
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Rickard Andersson @ 2022-04-28 14:01 UTC (permalink / raw)
  To: broonie, lgirdwood, linux-kernel, yibin.gong
  Cc: rickaran, rickard314.andersson, perdo

From: Rickard x Andersson <rickaran@axis.com>

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.

Signed-off-by: Rickard x Andersson <rickaran@axis.com>
---
 drivers/regulator/pca9450-regulator.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/regulator/pca9450-regulator.c b/drivers/regulator/pca9450-regulator.c
index 87b4e6e29ba1..4a3ae73c600c 100644
--- a/drivers/regulator/pca9450-regulator.c
+++ b/drivers/regulator/pca9450-regulator.c
@@ -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;
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 5/5] regulator: pca9450: Enable DVS control via PMIC_STBY_REQ
  2022-04-28 14:01 [PATCH 1/5] dt-bindings: regulator: Add property for I2C level shifter Rickard Andersson
                   ` (2 preceding siblings ...)
  2022-04-28 14:01 ` [PATCH 4/5] regulator: pca9450: Make warm reset on WDOG_B assertion Rickard Andersson
@ 2022-04-28 14:01 ` Rickard Andersson
  2022-04-28 15:07 ` [PATCH 1/5] dt-bindings: regulator: Add property for I2C level shifter Mark Brown
  2022-05-03 15:51 ` (subset) " Mark Brown
  5 siblings, 0 replies; 7+ messages in thread
From: Rickard Andersson @ 2022-04-28 14:01 UTC (permalink / raw)
  To: broonie, lgirdwood, linux-kernel, yibin.gong
  Cc: rickaran, rickard314.andersson, perdo

From: Rickard x Andersson <rickaran@axis.com>

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.

Signed-off-by: Rickard x Andersson <rickaran@axis.com>
---
 drivers/regulator/pca9450-regulator.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/regulator/pca9450-regulator.c b/drivers/regulator/pca9450-regulator.c
index 4a3ae73c600c..14b7d3376516 100644
--- a/drivers/regulator/pca9450-regulator.c
+++ b/drivers/regulator/pca9450-regulator.c
@@ -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;
 }
 
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/5] dt-bindings: regulator: Add property for I2C level shifter
  2022-04-28 14:01 [PATCH 1/5] dt-bindings: regulator: Add property for I2C level shifter Rickard Andersson
                   ` (3 preceding siblings ...)
  2022-04-28 14:01 ` [PATCH 5/5] regulator: pca9450: Enable DVS control via PMIC_STBY_REQ Rickard Andersson
@ 2022-04-28 15:07 ` Mark Brown
  2022-05-03 15:51 ` (subset) " Mark Brown
  5 siblings, 0 replies; 7+ messages in thread
From: Mark Brown @ 2022-04-28 15:07 UTC (permalink / raw)
  To: Rickard Andersson
  Cc: lgirdwood, linux-kernel, yibin.gong, rickard314.andersson, perdo

[-- Attachment #1: Type: text/plain, Size: 442 bytes --]

On Thu, Apr 28, 2022 at 04:01:35PM +0200, Rickard Andersson wrote:
> From: Per-Daniel Olsson <perdo@axis.com>
> 
> By setting nxp,i2c-lt-enable the I2C level translator is
> enabled.
> 
> Signed-off-by: Per-Daniel Olsson <perdo@axis.com>
> ---

You've not provided a Signed-off-by for this so I can't do anything with
it, please see Documentation/process/submitting-patches.rst for details
on what this is and why it's important.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: (subset) [PATCH 1/5] dt-bindings: regulator: Add property for I2C level shifter
  2022-04-28 14:01 [PATCH 1/5] dt-bindings: regulator: Add property for I2C level shifter Rickard Andersson
                   ` (4 preceding siblings ...)
  2022-04-28 15:07 ` [PATCH 1/5] dt-bindings: regulator: Add property for I2C level shifter Mark Brown
@ 2022-05-03 15:51 ` Mark Brown
  5 siblings, 0 replies; 7+ messages in thread
From: Mark Brown @ 2022-05-03 15:51 UTC (permalink / raw)
  To: lgirdwood, yibin.gong, linux-kernel, rickaran; +Cc: rickard314.andersson, perdo

On Thu, 28 Apr 2022 16:01:35 +0200, Rickard Andersson wrote:
> From: Per-Daniel Olsson <perdo@axis.com>
> 
> 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!

[3/5] dt-bindings: regulator: Add property for WDOG_B warm reset
      (no commit info)
[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

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-05-03 15:51 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-28 14:01 [PATCH 1/5] dt-bindings: regulator: Add property for I2C level shifter Rickard Andersson
2022-04-28 14:01 ` [PATCH 2/5] regulator: pca9450: Make I2C Level Translator configurable Rickard Andersson
2022-04-28 14:01 ` [PATCH 3/5] dt-bindings: regulator: Add property for WDOG_B warm reset Rickard Andersson
2022-04-28 14:01 ` [PATCH 4/5] regulator: pca9450: Make warm reset on WDOG_B assertion Rickard Andersson
2022-04-28 14:01 ` [PATCH 5/5] regulator: pca9450: Enable DVS control via PMIC_STBY_REQ Rickard Andersson
2022-04-28 15:07 ` [PATCH 1/5] dt-bindings: regulator: Add property for I2C level shifter Mark Brown
2022-05-03 15:51 ` (subset) " Mark Brown

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.