* [PATCH v2 0/3] regulator: axp20x: Drop AXP221 DC1SW/DC5LDO supplies from bindings
@ 2015-09-30 6:39 Chen-Yu Tsai
[not found] ` <1443595188-1283-1-git-send-email-wens-jdAy2FN1RRM@public.gmane.org>
0 siblings, 1 reply; 5+ messages in thread
From: Chen-Yu Tsai @ 2015-09-30 6:39 UTC (permalink / raw)
To: Lee Jones, Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell,
Kumar Gala, Russell King, Maxime Ripard, Liam Girdwood,
Mark Brown
Cc: linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, Chen-Yu Tsai,
open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
open list, moderated list:ARM PORT
Hi everyone,
This is v2 of "regulators: axp20x: Rename AXP221 DC1SW and DC5LDO supply
names". v2 removes the regulator supply properties for AXP221 DC1SW
and DC5LDO, instead of renaming them. These 2 regulators are secondary
outputs for DCDC1 and DCDC5 buck regulators, respectively, so they are
connected to them internally. This relationship should not be represented
in the device tree.
Patch 1 drops the AXP22X DC1SW/DC5LDO supply properties from the axp20x
DT bindings.
Patch 2 updates the axp20x regulator driver.
Patch 3 updates the only dts, the Hummingbird A31, that uses these
bindings.
If everything's ok, could we merge this for 4.4?
Thanks.
Regards,
ChenYu
Chen-Yu Tsai (3):
mfd: axp20x: Drop AXP221 DC1SW and DC5LDO regulator supplies from
bindings
regulator: axp20x: set supply names for AXP22X DC1SW/DC5LDO internally
ARM: dts: sun6i: hummingbird: Drop AXP221 DC1SW and DC5LDO supplies
Documentation/devicetree/bindings/mfd/axp20x.txt | 4 +-
arch/arm/boot/dts/sun6i-a31-hummingbird.dts | 2 -
drivers/regulator/axp20x-regulator.c | 54 ++++++++++++++++++++++--
3 files changed, 52 insertions(+), 8 deletions(-)
--
2.5.3
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v2 1/3] mfd: axp20x: Drop AXP221 DC1SW and DC5LDO regulator supplies from bindings
[not found] ` <1443595188-1283-1-git-send-email-wens-jdAy2FN1RRM@public.gmane.org>
@ 2015-09-30 6:39 ` Chen-Yu Tsai
2015-09-30 6:39 ` [PATCH v2 2/3] regulator: axp20x: set supply names for AXP22X DC1SW/DC5LDO internally Chen-Yu Tsai
2015-09-30 6:39 ` [PATCH v2 3/3] ARM: dts: sun6i: hummingbird: Drop AXP221 DC1SW and DC5LDO supplies Chen-Yu Tsai
2 siblings, 0 replies; 5+ messages in thread
From: Chen-Yu Tsai @ 2015-09-30 6:39 UTC (permalink / raw)
To: Lee Jones, Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell,
Kumar Gala, Russell King, Maxime Ripard, Liam Girdwood,
Mark Brown
Cc: linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, Chen-Yu Tsai,
open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
open list, moderated list:ARM PORT
The DC1SW and DC5LDO regulators in the AXP221 are internally chained
to DCDC1 and DCDC5, hence the names. The original bindings used the
parent regulator names for the supply regulator property. This causes
some confusion when we actually use it in the dts:
axp221 {
/* self supplying? */
dcdc1-supply = <&dcdc1>;
dcdc5-supply = <&dcdc5>;
dcdc1: dcdc1 {
...
};
dcdc5: dcdc5 {
...
};
};
Since they are internally connected within the PMIC, their relationships
should not be visible in the device tree.
Signed-off-by: Chen-Yu Tsai <wens-jdAy2FN1RRM@public.gmane.org>
---
Documentation/devicetree/bindings/mfd/axp20x.txt | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/Documentation/devicetree/bindings/mfd/axp20x.txt b/Documentation/devicetree/bindings/mfd/axp20x.txt
index 41811223e5be..a474359dd206 100644
--- a/Documentation/devicetree/bindings/mfd/axp20x.txt
+++ b/Documentation/devicetree/bindings/mfd/axp20x.txt
@@ -60,8 +60,8 @@ DCDC2 : DC-DC buck : vin2-supply
DCDC3 : DC-DC buck : vin3-supply
DCDC4 : DC-DC buck : vin4-supply
DCDC5 : DC-DC buck : vin5-supply
-DC1SW : On/Off Switch : dcdc1-supply : DCDC1 secondary output
-DC5LDO : LDO : dcdc5-supply : input from DCDC5
+DC1SW : On/Off Switch : : DCDC1 secondary output
+DC5LDO : LDO : : input from DCDC5
ALDO1 : LDO : aldoin-supply : shared supply
ALDO2 : LDO : aldoin-supply : shared supply
ALDO3 : LDO : aldoin-supply : shared supply
--
2.5.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH v2 2/3] regulator: axp20x: set supply names for AXP22X DC1SW/DC5LDO internally
[not found] ` <1443595188-1283-1-git-send-email-wens-jdAy2FN1RRM@public.gmane.org>
2015-09-30 6:39 ` [PATCH v2 1/3] mfd: axp20x: Drop AXP221 DC1SW and DC5LDO regulator " Chen-Yu Tsai
@ 2015-09-30 6:39 ` Chen-Yu Tsai
2015-09-30 6:39 ` [PATCH v2 3/3] ARM: dts: sun6i: hummingbird: Drop AXP221 DC1SW and DC5LDO supplies Chen-Yu Tsai
2 siblings, 0 replies; 5+ messages in thread
From: Chen-Yu Tsai @ 2015-09-30 6:39 UTC (permalink / raw)
To: Lee Jones, Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell,
Kumar Gala, Russell King, Maxime Ripard, Liam Girdwood,
Mark Brown
Cc: linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, Chen-Yu Tsai,
open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
open list, moderated list:ARM PORT
The DC1SW and DC5LDO regulators in the AXP22X are internally chained
to DCDC1 and DCDC5, hence the names. The original bindings used the
parent regulator names for the supply regulator property.
Since they are internally connected, the relationship should not be
represented in the device tree, but handled internally by the driver.
This patch has the driver remember the regulator names for the parent
DCDC1/DCDC5, and use them as supply names for DC1SW/DC5LDO.
Signed-off-by: Chen-Yu Tsai <wens-jdAy2FN1RRM@public.gmane.org>
---
drivers/regulator/axp20x-regulator.c | 54 +++++++++++++++++++++++++++++++++---
1 file changed, 50 insertions(+), 4 deletions(-)
diff --git a/drivers/regulator/axp20x-regulator.c b/drivers/regulator/axp20x-regulator.c
index a9567af7cec0..35de22fdb7a0 100644
--- a/drivers/regulator/axp20x-regulator.c
+++ b/drivers/regulator/axp20x-regulator.c
@@ -196,10 +196,10 @@ static const struct regulator_desc axp22x_regulators[] = {
AXP_DESC(AXP22X, DCDC5, "dcdc5", "vin5", 1000, 2550, 50,
AXP22X_DCDC5_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL1, BIT(5)),
/* secondary switchable output of DCDC1 */
- AXP_DESC_SW(AXP22X, DC1SW, "dc1sw", "dcdc1", 1600, 3400, 100,
+ AXP_DESC_SW(AXP22X, DC1SW, "dc1sw", NULL, 1600, 3400, 100,
AXP22X_DCDC1_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, BIT(7)),
/* LDO regulator internally chained to DCDC5 */
- AXP_DESC(AXP22X, DC5LDO, "dc5ldo", "dcdc5", 700, 1400, 100,
+ AXP_DESC(AXP22X, DC5LDO, "dc5ldo", NULL, 700, 1400, 100,
AXP22X_DC5LDO_V_OUT, 0x7, AXP22X_PWR_OUT_CTRL1, BIT(0)),
AXP_DESC(AXP22X, ALDO1, "aldo1", "aldoin", 700, 3300, 100,
AXP22X_ALDO1_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL1, BIT(6)),
@@ -350,6 +350,8 @@ static int axp20x_regulator_probe(struct platform_device *pdev)
};
int ret, i, nregulators;
u32 workmode;
+ const char *axp22x_dc1_name = axp22x_regulators[AXP22X_DCDC1].name;
+ const char *axp22x_dc5_name = axp22x_regulators[AXP22X_DCDC5].name;
switch (axp20x->variant) {
case AXP202_ID:
@@ -371,8 +373,37 @@ static int axp20x_regulator_probe(struct platform_device *pdev)
axp20x_regulator_parse_dt(pdev);
for (i = 0; i < nregulators; i++) {
- rdev = devm_regulator_register(&pdev->dev, ®ulators[i],
- &config);
+ const struct regulator_desc *desc = ®ulators[i];
+ struct regulator_desc *new_desc;
+
+ /*
+ * Regulators DC1SW and DC5LDO are connected internally,
+ * so we have to handle their supply names separately.
+ *
+ * We always register the regulators in proper sequence,
+ * so the supply names are correctly read. See the last
+ * part of this loop to see where we save the DT defined
+ * name.
+ */
+ if (regulators == axp22x_regulators) {
+ if (i == AXP22X_DC1SW) {
+ new_desc = devm_kzalloc(&pdev->dev,
+ sizeof(*desc),
+ GFP_KERNEL);
+ *new_desc = regulators[i];
+ new_desc->supply_name = axp22x_dc1_name;
+ desc = new_desc;
+ } else if (i == AXP22X_DC5LDO) {
+ new_desc = devm_kzalloc(&pdev->dev,
+ sizeof(*desc),
+ GFP_KERNEL);
+ *new_desc = regulators[i];
+ new_desc->supply_name = axp22x_dc5_name;
+ desc = new_desc;
+ }
+ }
+
+ rdev = devm_regulator_register(&pdev->dev, desc, &config);
if (IS_ERR(rdev)) {
dev_err(&pdev->dev, "Failed to register %s\n",
regulators[i].name);
@@ -388,6 +419,21 @@ static int axp20x_regulator_probe(struct platform_device *pdev)
dev_err(&pdev->dev, "Failed to set workmode on %s\n",
rdev->desc->name);
}
+
+ /*
+ * Save AXP22X DCDC1 / DCDC5 regulator names for later.
+ */
+ if (regulators == axp22x_regulators) {
+ /* Can we use rdev->constraints->name instead? */
+ if (i == AXP22X_DCDC1)
+ of_property_read_string(rdev->dev.of_node,
+ "regulator-name",
+ &axp22x_dc1_name);
+ else if (i == AXP22X_DCDC5)
+ of_property_read_string(rdev->dev.of_node,
+ "regulator-name",
+ &axp22x_dc5_name);
+ }
}
return 0;
--
2.5.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH v2 3/3] ARM: dts: sun6i: hummingbird: Drop AXP221 DC1SW and DC5LDO supplies
[not found] ` <1443595188-1283-1-git-send-email-wens-jdAy2FN1RRM@public.gmane.org>
2015-09-30 6:39 ` [PATCH v2 1/3] mfd: axp20x: Drop AXP221 DC1SW and DC5LDO regulator " Chen-Yu Tsai
2015-09-30 6:39 ` [PATCH v2 2/3] regulator: axp20x: set supply names for AXP22X DC1SW/DC5LDO internally Chen-Yu Tsai
@ 2015-09-30 6:39 ` Chen-Yu Tsai
[not found] ` <1443595188-1283-4-git-send-email-wens-jdAy2FN1RRM@public.gmane.org>
2 siblings, 1 reply; 5+ messages in thread
From: Chen-Yu Tsai @ 2015-09-30 6:39 UTC (permalink / raw)
To: Lee Jones, Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell,
Kumar Gala, Russell King, Maxime Ripard, Liam Girdwood,
Mark Brown
Cc: linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, Chen-Yu Tsai,
open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
open list, moderated list:ARM PORT
"dcdc1-supply" and "dcdc5-supply" have been dropped, as they are
internally connected and should not be represented in the device
tree.
Signed-off-by: Chen-Yu Tsai <wens-jdAy2FN1RRM@public.gmane.org>
---
arch/arm/boot/dts/sun6i-a31-hummingbird.dts | 2 --
1 file changed, 2 deletions(-)
diff --git a/arch/arm/boot/dts/sun6i-a31-hummingbird.dts b/arch/arm/boot/dts/sun6i-a31-hummingbird.dts
index 06d9391ca30e..f93cf4c42a7a 100644
--- a/arch/arm/boot/dts/sun6i-a31-hummingbird.dts
+++ b/arch/arm/boot/dts/sun6i-a31-hummingbird.dts
@@ -178,8 +178,6 @@
interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
interrupt-controller;
#interrupt-cells = <1>;
- dcdc1-supply = <&vcc_3v0>;
- dcdc5-supply = <&vcc_dram>;
regulators {
x-powers,dcdc-freq = <3000>;
--
2.5.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v2 3/3] ARM: dts: sun6i: hummingbird: Drop AXP221 DC1SW and DC5LDO supplies
[not found] ` <1443595188-1283-4-git-send-email-wens-jdAy2FN1RRM@public.gmane.org>
@ 2015-10-07 10:35 ` Maxime Ripard
0 siblings, 0 replies; 5+ messages in thread
From: Maxime Ripard @ 2015-10-07 10:35 UTC (permalink / raw)
To: Chen-Yu Tsai
Cc: Lee Jones, Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell,
Kumar Gala, Russell King, Liam Girdwood, Mark Brown,
linux-sunxi-/JYPxA39Uh5TLH3MbocFFw,
open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
open list, moderated list:ARM PORT
[-- Attachment #1: Type: text/plain, Size: 405 bytes --]
On Wed, Sep 30, 2015 at 02:39:47PM +0800, Chen-Yu Tsai wrote:
> "dcdc1-supply" and "dcdc5-supply" have been dropped, as they are
> internally connected and should not be represented in the device
> tree.
>
> Signed-off-by: Chen-Yu Tsai <wens-jdAy2FN1RRM@public.gmane.org>
Applied, thanks!
Maxime
--
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2015-10-07 10:35 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-30 6:39 [PATCH v2 0/3] regulator: axp20x: Drop AXP221 DC1SW/DC5LDO supplies from bindings Chen-Yu Tsai
[not found] ` <1443595188-1283-1-git-send-email-wens-jdAy2FN1RRM@public.gmane.org>
2015-09-30 6:39 ` [PATCH v2 1/3] mfd: axp20x: Drop AXP221 DC1SW and DC5LDO regulator " Chen-Yu Tsai
2015-09-30 6:39 ` [PATCH v2 2/3] regulator: axp20x: set supply names for AXP22X DC1SW/DC5LDO internally Chen-Yu Tsai
2015-09-30 6:39 ` [PATCH v2 3/3] ARM: dts: sun6i: hummingbird: Drop AXP221 DC1SW and DC5LDO supplies Chen-Yu Tsai
[not found] ` <1443595188-1283-4-git-send-email-wens-jdAy2FN1RRM@public.gmane.org>
2015-10-07 10:35 ` Maxime Ripard
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).