linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] regulator: act8865: add input supply handling
@ 2015-03-07 14:28 Heiko Stuebner
  2015-03-07 14:30 ` [PATCH 2/2] ARM: dts: rockchip: add input supplies for the act8846 on Radxa Rock Heiko Stuebner
  2015-03-07 14:39 ` [PATCH 1/2] regulator: act8865: add input supply handling Mark Brown
  0 siblings, 2 replies; 5+ messages in thread
From: Heiko Stuebner @ 2015-03-07 14:28 UTC (permalink / raw)
  To: linux-arm-kernel

The act8846/act8865 regulators have a number of input supplies supplying the
individual regulators. This may even be recursively like on most Rockchip boards
using the act8846 where REG4 is most of the time connected to the inl1-supply.

Therefore add the ability to specify the input supplies for the individual inputs.
The input-names are taken from the datasheets of both act8846 and act8865.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
---
 .../bindings/regulator/act8865-regulator.txt       | 16 +++++++++
 drivers/regulator/act8865-regulator.c              | 41 +++++++++++-----------
 2 files changed, 37 insertions(+), 20 deletions(-)

diff --git a/Documentation/devicetree/bindings/regulator/act8865-regulator.txt b/Documentation/devicetree/bindings/regulator/act8865-regulator.txt
index dad6358..45028bb 100644
--- a/Documentation/devicetree/bindings/regulator/act8865-regulator.txt
+++ b/Documentation/devicetree/bindings/regulator/act8865-regulator.txt
@@ -9,6 +9,22 @@ Optional properties:
 - system-power-controller: Telling whether or not this pmic is controlling
   the system power. See Documentation/devicetree/bindings/power/power-controller.txt .
 
+Optional input supply properties:
+- for act8846:
+  - vp1-supply:  The input supply for REG1
+  - vp2-supply:  The input supply for REG2
+  - vp3-supply:  The input supply for REG3
+  - vp4-supply:  The input supply for REG4
+  - inl1-supply:  The input supply for REG5, REG6 and REG7
+  - inl2-supply:  The input supply for REG8 and LDO_REG9
+  - inl3-supply:  The input supply for REG10, REG11 and REG12
+- for act8865:
+  - vp1-supply:  The input supply for DCDC_REG1
+  - vp2-supply:  The input supply for DCDC_REG2
+  - vp3-supply:  The input supply for DCDC_REG3
+  - inl45-supply:  The input supply for LDO_REG1 and LDO_REG2
+  - inl67-supply:  The input supply for LDO_REG3 and LDO_REG4
+
 Any standard regulator properties can be used to configure the single regulator.
 
 The valid names for regulators are:
diff --git a/drivers/regulator/act8865-regulator.c b/drivers/regulator/act8865-regulator.c
index 9eec453..a4a85cd 100644
--- a/drivers/regulator/act8865-regulator.c
+++ b/drivers/regulator/act8865-regulator.c
@@ -126,9 +126,10 @@ static struct regulator_ops act8865_ops = {
 	.is_enabled		= regulator_is_enabled_regmap,
 };
 
-#define ACT88xx_REG(_name, _family, _id, _vsel_reg)			\
+#define ACT88xx_REG(_name, _family, _id, _vsel_reg, _supply)		\
 	[_family##_ID_##_id] = {					\
 		.name			= _name,			\
+		.supply_name		= _supply,			\
 		.id			= _family##_ID_##_id,		\
 		.type			= REGULATOR_VOLTAGE,		\
 		.ops			= &act8865_ops,			\
@@ -143,28 +144,28 @@ static struct regulator_ops act8865_ops = {
 	}
 
 static const struct regulator_desc act8846_regulators[] = {
-	ACT88xx_REG("REG1", ACT8846, REG1, VSET),
-	ACT88xx_REG("REG2", ACT8846, REG2, VSET0),
-	ACT88xx_REG("REG3", ACT8846, REG3, VSET0),
-	ACT88xx_REG("REG4", ACT8846, REG4, VSET0),
-	ACT88xx_REG("REG5", ACT8846, REG5, VSET),
-	ACT88xx_REG("REG6", ACT8846, REG6, VSET),
-	ACT88xx_REG("REG7", ACT8846, REG7, VSET),
-	ACT88xx_REG("REG8", ACT8846, REG8, VSET),
-	ACT88xx_REG("REG9", ACT8846, REG9, VSET),
-	ACT88xx_REG("REG10", ACT8846, REG10, VSET),
-	ACT88xx_REG("REG11", ACT8846, REG11, VSET),
-	ACT88xx_REG("REG12", ACT8846, REG12, VSET),
+	ACT88xx_REG("REG1", ACT8846, REG1, VSET, "vp1"),
+	ACT88xx_REG("REG2", ACT8846, REG2, VSET0, "vp2"),
+	ACT88xx_REG("REG3", ACT8846, REG3, VSET0, "vp3"),
+	ACT88xx_REG("REG4", ACT8846, REG4, VSET0, "vp4"),
+	ACT88xx_REG("REG5", ACT8846, REG5, VSET, "inl1"),
+	ACT88xx_REG("REG6", ACT8846, REG6, VSET, "inl1"),
+	ACT88xx_REG("REG7", ACT8846, REG7, VSET, "inl1"),
+	ACT88xx_REG("REG8", ACT8846, REG8, VSET, "inl2"),
+	ACT88xx_REG("REG9", ACT8846, REG9, VSET, "inl2"),
+	ACT88xx_REG("REG10", ACT8846, REG10, VSET, "inl3"),
+	ACT88xx_REG("REG11", ACT8846, REG11, VSET, "inl3"),
+	ACT88xx_REG("REG12", ACT8846, REG12, VSET, "inl3"),
 };
 
 static const struct regulator_desc act8865_regulators[] = {
-	ACT88xx_REG("DCDC_REG1", ACT8865, DCDC1, VSET1),
-	ACT88xx_REG("DCDC_REG2", ACT8865, DCDC2, VSET1),
-	ACT88xx_REG("DCDC_REG3", ACT8865, DCDC3, VSET1),
-	ACT88xx_REG("LDO_REG1", ACT8865, LDO1, VSET),
-	ACT88xx_REG("LDO_REG2", ACT8865, LDO2, VSET),
-	ACT88xx_REG("LDO_REG3", ACT8865, LDO3, VSET),
-	ACT88xx_REG("LDO_REG4", ACT8865, LDO4, VSET),
+	ACT88xx_REG("DCDC_REG1", ACT8865, DCDC1, VSET1, "vp1"),
+	ACT88xx_REG("DCDC_REG2", ACT8865, DCDC2, VSET1, "vp2"),
+	ACT88xx_REG("DCDC_REG3", ACT8865, DCDC3, VSET1, "vp3"),
+	ACT88xx_REG("LDO_REG1", ACT8865, LDO1, VSET, "inl45"),
+	ACT88xx_REG("LDO_REG2", ACT8865, LDO2, VSET, "inl45"),
+	ACT88xx_REG("LDO_REG3", ACT8865, LDO3, VSET, "inl67"),
+	ACT88xx_REG("LDO_REG4", ACT8865, LDO4, VSET, "inl67"),
 };
 
 #ifdef CONFIG_OF
-- 
2.1.4

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

* [PATCH 2/2] ARM: dts: rockchip: add input supplies for the act8846 on Radxa Rock
  2015-03-07 14:28 [PATCH 1/2] regulator: act8865: add input supply handling Heiko Stuebner
@ 2015-03-07 14:30 ` Heiko Stuebner
  2015-03-07 14:39 ` [PATCH 1/2] regulator: act8865: add input supply handling Mark Brown
  1 sibling, 0 replies; 5+ messages in thread
From: Heiko Stuebner @ 2015-03-07 14:30 UTC (permalink / raw)
  To: linux-arm-kernel

On the Radxa Rock board most supplies come from the static 5v vsys supply, but
the inl1-supply comes from the REG4 of the act8846 itself. Model this dependency
using the added supply-handling to make sure the supplying regulator gets handled
correctly and not accidentially turned off.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
---
I'll apply this one to my dts branch myself, if patch 1/2 is accepted

 arch/arm/boot/dts/rk3188-radxarock.dts | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/arch/arm/boot/dts/rk3188-radxarock.dts b/arch/arm/boot/dts/rk3188-radxarock.dts
index 9a09579..bdf8570 100644
--- a/arch/arm/boot/dts/rk3188-radxarock.dts
+++ b/arch/arm/boot/dts/rk3188-radxarock.dts
@@ -103,6 +103,14 @@
 		regulator-always-on;
 		regulator-boot-on;
 	};
+
+	vsys: vsys-regulator {
+		compatible = "regulator-fixed";
+		regulator-name = "vsys";
+		regulator-min-microvolt = <5000000>;
+		regulator-max-microvolt = <5000000>;
+		regulator-boot-on;
+	};
 };
 
 &emac {
@@ -148,6 +156,14 @@
 		pinctrl-names = "default";
 		pinctrl-0 = <&act8846_dvs0_ctl>;
 
+		vp1-supply = <&vsys>;
+		vp2-supply = <&vsys>;
+		vp3-supply = <&vsys>;
+		vp4-supply = <&vsys>;
+		inl1-supply = <&vcc_io>;
+		inl2-supply = <&vsys>;
+		inl3-supply = <&vsys>;
+
 		regulators {
 			vcc_ddr: REG1 {
 				regulator-name = "VCC_DDR";
-- 
2.1.4

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

* [PATCH 1/2] regulator: act8865: add input supply handling
  2015-03-07 14:28 [PATCH 1/2] regulator: act8865: add input supply handling Heiko Stuebner
  2015-03-07 14:30 ` [PATCH 2/2] ARM: dts: rockchip: add input supplies for the act8846 on Radxa Rock Heiko Stuebner
@ 2015-03-07 14:39 ` Mark Brown
  2015-03-07 15:33   ` [PATCH v2 " Heiko Stuebner
  1 sibling, 1 reply; 5+ messages in thread
From: Mark Brown @ 2015-03-07 14:39 UTC (permalink / raw)
  To: linux-arm-kernel

On Sat, Mar 07, 2015 at 03:28:54PM +0100, Heiko Stuebner wrote:
> The act8846/act8865 regulators have a number of input supplies supplying the
> individual regulators. This may even be recursively like on most Rockchip boards

This doesn't apply against current code, please check and resend.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20150307/48e81323/attachment.sig>

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

* [PATCH v2 1/2] regulator: act8865: add input supply handling
  2015-03-07 14:39 ` [PATCH 1/2] regulator: act8865: add input supply handling Mark Brown
@ 2015-03-07 15:33   ` Heiko Stuebner
  2015-03-07 16:34     ` Mark Brown
  0 siblings, 1 reply; 5+ messages in thread
From: Heiko Stuebner @ 2015-03-07 15:33 UTC (permalink / raw)
  To: linux-arm-kernel

The act88600/act8846/act8865 regulators have a number of input supplies
supplying the individual regulators. This may even be recursively like on
most Rockchip boards using the act8846 where REG4 is most of the time
connected to the inl1-supply.

Therefore add the ability to specify the input supplies for the individual inputs.
The input-names are taken from the datasheets of act8600, act8846 and act8865.
On the act8600 some regulators do not have separate input supplies.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
---
changes since v1:
adapt to newly added act8600 support. In contrast to the previous 2 chips some
regulators of the act8600 do not seem to have separate input supplies.

 .../bindings/regulator/act8865-regulator.txt       | 22 +++++++++
 drivers/regulator/act8865-regulator.c              | 55 +++++++++++-----------
 2 files changed, 50 insertions(+), 27 deletions(-)

diff --git a/Documentation/devicetree/bindings/regulator/act8865-regulator.txt b/Documentation/devicetree/bindings/regulator/act8865-regulator.txt
index e170df2..e91485d 100644
--- a/Documentation/devicetree/bindings/regulator/act8865-regulator.txt
+++ b/Documentation/devicetree/bindings/regulator/act8865-regulator.txt
@@ -9,6 +9,28 @@ Optional properties:
 - system-power-controller: Telling whether or not this pmic is controlling
   the system power. See Documentation/devicetree/bindings/power/power-controller.txt .
 
+Optional input supply properties:
+- for act8600:
+  - vp1-supply: The input supply for DCDC_REG1
+  - vp2-supply: The input supply for DCDC_REG2
+  - vp3-supply: The input supply for DCDC_REG3
+  - inl-supply: The input supply for LDO_REG5, LDO_REG6, LDO_REG7 and LDO_REG8
+  SUDCDC_REG4, LDO_REG9 and LDO_REG10 do not have separate supplies.
+- for act8846:
+  - vp1-supply: The input supply for REG1
+  - vp2-supply: The input supply for REG2
+  - vp3-supply: The input supply for REG3
+  - vp4-supply: The input supply for REG4
+  - inl1-supply: The input supply for REG5, REG6 and REG7
+  - inl2-supply: The input supply for REG8 and LDO_REG9
+  - inl3-supply: The input supply for REG10, REG11 and REG12
+- for act8865:
+  - vp1-supply: The input supply for DCDC_REG1
+  - vp2-supply: The input supply for DCDC_REG2
+  - vp3-supply: The input supply for DCDC_REG3
+  - inl45-supply: The input supply for LDO_REG1 and LDO_REG2
+  - inl67-supply: The input supply for LDO_REG3 and LDO_REG4
+
 Any standard regulator properties can be used to configure the single regulator.
 
 The valid names for regulators are:
diff --git a/drivers/regulator/act8865-regulator.c b/drivers/regulator/act8865-regulator.c
index 3781f6e..2ff73d7 100644
--- a/drivers/regulator/act8865-regulator.c
+++ b/drivers/regulator/act8865-regulator.c
@@ -173,9 +173,10 @@ static struct regulator_ops act8865_ldo_ops = {
 	.is_enabled		= regulator_is_enabled_regmap,
 };
 
-#define ACT88xx_REG(_name, _family, _id, _vsel_reg)			\
+#define ACT88xx_REG(_name, _family, _id, _vsel_reg, _supply)		\
 	[_family##_ID_##_id] = {					\
 		.name			= _name,			\
+		.supply_name		= _supply,			\
 		.id			= _family##_ID_##_id,		\
 		.type			= REGULATOR_VOLTAGE,		\
 		.ops			= &act8865_ops,			\
@@ -190,9 +191,9 @@ static struct regulator_ops act8865_ldo_ops = {
 	}
 
 static const struct regulator_desc act8600_regulators[] = {
-	ACT88xx_REG("DCDC1", ACT8600, DCDC1, VSET),
-	ACT88xx_REG("DCDC2", ACT8600, DCDC2, VSET),
-	ACT88xx_REG("DCDC3", ACT8600, DCDC3, VSET),
+	ACT88xx_REG("DCDC1", ACT8600, DCDC1, VSET, "vp1"),
+	ACT88xx_REG("DCDC2", ACT8600, DCDC2, VSET, "vp2"),
+	ACT88xx_REG("DCDC3", ACT8600, DCDC3, VSET, "vp3"),
 	{
 		.name = "SUDCDC_REG4",
 		.id = ACT8600_ID_SUDCDC4,
@@ -207,10 +208,10 @@ static const struct regulator_desc act8600_regulators[] = {
 		.enable_mask = ACT8865_ENA,
 		.owner = THIS_MODULE,
 	},
-	ACT88xx_REG("LDO5", ACT8600, LDO5, VSET),
-	ACT88xx_REG("LDO6", ACT8600, LDO6, VSET),
-	ACT88xx_REG("LDO7", ACT8600, LDO7, VSET),
-	ACT88xx_REG("LDO8", ACT8600, LDO8, VSET),
+	ACT88xx_REG("LDO5", ACT8600, LDO5, VSET, "inl"),
+	ACT88xx_REG("LDO6", ACT8600, LDO6, VSET, "inl"),
+	ACT88xx_REG("LDO7", ACT8600, LDO7, VSET, "inl"),
+	ACT88xx_REG("LDO8", ACT8600, LDO8, VSET, "inl"),
 	{
 		.name = "LDO_REG9",
 		.id = ACT8600_ID_LDO9,
@@ -236,28 +237,28 @@ static const struct regulator_desc act8600_regulators[] = {
 };
 
 static const struct regulator_desc act8846_regulators[] = {
-	ACT88xx_REG("REG1", ACT8846, REG1, VSET),
-	ACT88xx_REG("REG2", ACT8846, REG2, VSET0),
-	ACT88xx_REG("REG3", ACT8846, REG3, VSET0),
-	ACT88xx_REG("REG4", ACT8846, REG4, VSET0),
-	ACT88xx_REG("REG5", ACT8846, REG5, VSET),
-	ACT88xx_REG("REG6", ACT8846, REG6, VSET),
-	ACT88xx_REG("REG7", ACT8846, REG7, VSET),
-	ACT88xx_REG("REG8", ACT8846, REG8, VSET),
-	ACT88xx_REG("REG9", ACT8846, REG9, VSET),
-	ACT88xx_REG("REG10", ACT8846, REG10, VSET),
-	ACT88xx_REG("REG11", ACT8846, REG11, VSET),
-	ACT88xx_REG("REG12", ACT8846, REG12, VSET),
+	ACT88xx_REG("REG1", ACT8846, REG1, VSET, "vp1"),
+	ACT88xx_REG("REG2", ACT8846, REG2, VSET0, "vp2"),
+	ACT88xx_REG("REG3", ACT8846, REG3, VSET0, "vp3"),
+	ACT88xx_REG("REG4", ACT8846, REG4, VSET0, "vp4"),
+	ACT88xx_REG("REG5", ACT8846, REG5, VSET, "inl1"),
+	ACT88xx_REG("REG6", ACT8846, REG6, VSET, "inl1"),
+	ACT88xx_REG("REG7", ACT8846, REG7, VSET, "inl1"),
+	ACT88xx_REG("REG8", ACT8846, REG8, VSET, "inl2"),
+	ACT88xx_REG("REG9", ACT8846, REG9, VSET, "inl2"),
+	ACT88xx_REG("REG10", ACT8846, REG10, VSET, "inl3"),
+	ACT88xx_REG("REG11", ACT8846, REG11, VSET, "inl3"),
+	ACT88xx_REG("REG12", ACT8846, REG12, VSET, "inl3"),
 };
 
 static const struct regulator_desc act8865_regulators[] = {
-	ACT88xx_REG("DCDC_REG1", ACT8865, DCDC1, VSET1),
-	ACT88xx_REG("DCDC_REG2", ACT8865, DCDC2, VSET1),
-	ACT88xx_REG("DCDC_REG3", ACT8865, DCDC3, VSET1),
-	ACT88xx_REG("LDO_REG1", ACT8865, LDO1, VSET),
-	ACT88xx_REG("LDO_REG2", ACT8865, LDO2, VSET),
-	ACT88xx_REG("LDO_REG3", ACT8865, LDO3, VSET),
-	ACT88xx_REG("LDO_REG4", ACT8865, LDO4, VSET),
+	ACT88xx_REG("DCDC_REG1", ACT8865, DCDC1, VSET1, "vp1"),
+	ACT88xx_REG("DCDC_REG2", ACT8865, DCDC2, VSET1, "vp2"),
+	ACT88xx_REG("DCDC_REG3", ACT8865, DCDC3, VSET1, "vp3"),
+	ACT88xx_REG("LDO_REG1", ACT8865, LDO1, VSET, "inl45"),
+	ACT88xx_REG("LDO_REG2", ACT8865, LDO2, VSET, "inl45"),
+	ACT88xx_REG("LDO_REG3", ACT8865, LDO3, VSET, "inl67"),
+	ACT88xx_REG("LDO_REG4", ACT8865, LDO4, VSET, "inl67"),
 };
 
 #ifdef CONFIG_OF
-- 
2.1.4

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

* [PATCH v2 1/2] regulator: act8865: add input supply handling
  2015-03-07 15:33   ` [PATCH v2 " Heiko Stuebner
@ 2015-03-07 16:34     ` Mark Brown
  0 siblings, 0 replies; 5+ messages in thread
From: Mark Brown @ 2015-03-07 16:34 UTC (permalink / raw)
  To: linux-arm-kernel

On Sat, Mar 07, 2015 at 04:33:53PM +0100, Heiko Stuebner wrote:
> The act88600/act8846/act8865 regulators have a number of input supplies
> supplying the individual regulators. This may even be recursively like on
> most Rockchip boards using the act8846 where REG4 is most of the time
> connected to the inl1-supply.

Applied, thanks.  The recursive supplies are very common - DCDCs are
vastly more efficient than LDOs so if you've got the capacity and care
about power it's much better to drop your main supply voltage down to
something near the LDO headroom with a DCDC in order to improve system
performance.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20150307/2a52fb38/attachment.sig>

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

end of thread, other threads:[~2015-03-07 16:34 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-07 14:28 [PATCH 1/2] regulator: act8865: add input supply handling Heiko Stuebner
2015-03-07 14:30 ` [PATCH 2/2] ARM: dts: rockchip: add input supplies for the act8846 on Radxa Rock Heiko Stuebner
2015-03-07 14:39 ` [PATCH 1/2] regulator: act8865: add input supply handling Mark Brown
2015-03-07 15:33   ` [PATCH v2 " Heiko Stuebner
2015-03-07 16:34     ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).