sunxi: Add AXP209 regulator support
Subsystems (5)
cover sunxi: Add AXP209 regulator support
Hi,
This serie reworks a bit the MFD and regulator drivers for the AXP209 PMIC so that we rely purely on the DT and no longer on the regulator aliases provided by the MFD driver.
It also enables the PMIC support for the Cubieboard2. Eventually, other boards will follow.
Thanks!
Maxime
Maxime Ripard (3):
regulator: axp20x: Use parent device as regulator configuration device
mfd: axp209x: Drop the parent supplies field
ARM: sun7i: cubieboard2: Enable the AXP209
arch/arm/boot/dts/sun7i-a20-cubieboard2.dts | 31 +++++++++++++++++++++++++++++ drivers/mfd/axp20x.c | 11 ---------- drivers/regulator/axp20x-regulator.c | 2 +- 3 files changed, 32 insertions(+), 12 deletions(-)
Signature · 1 line
2.1.0
PATCH 1/3 regulator: axp20x: Use parent device as regulator configuration device
The current device used for the regulator configuration is the child device created by the MFD driver. This means that it doesn't have any of_node pointing to it, and whenever we register the regulators, it will not look into the regulator supply in the DT, hence requiring to provide regulator aliases in the MFD driver.
We can easily fix that by using the parent device in our configuration, which has a DT node associated to it, and will allow a DT lookup. Eventually, we will be able to remove the aliases in the MFD driver.
--- drivers/regulator/axp20x-regulator.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/regulator/axp20x-regulator.c +1 -1
@@ -245,7 +245,7 @@ static int axp20x_regulator_probe(struct platform_device *pdev)for (i =0 ; i <AXP20X_REG_ID_MAX ; i++) { init_data = axp20x_matches[i].init_data; - config.dev = &pdev->dev; + config.dev = pdev->dev.parent; config.init_data = init_data; config.regmap = axp20x->regmap; config.of_node = axp20x_matches[i].of_node;
Signature · 1 line
2.1.0
Mark Brown
maintainerPATCH 1/3 regulator: axp20x: Use parent device as regulator configuration device
Quoted 5 lines · Maxime Ripard
The current device used for the regulator configuration is the child device created by the MFD driver. This means that it doesn't have any
of_nodepointing to it, and whenever we register the regulators, it will not look into the regulator supply in the DT, hence requiring to provide regulator aliases in the MFD driver.
Applied, thanks. Please try to wrap your commit message a bit below 80
characters to allow for quoting.
-------------- 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/20140922/3d28b96a/attachment.sig>
PATCH 2/3 mfd: axp209x: Drop the parent supplies field
In reply to Maxime RipardNow that the regulator code get its parent supplies purely from the DT, we can drop the parent supplies resources in the MFD driver.
--- drivers/mfd/axp20x.c | 11 ----------- 1 file changed, 11 deletions(-)
drivers/mfd/axp20x.c +0 -11
@@ -140,15 +140,6 @@ static const struct regmap_irq_chip axp20x_regmap_irq_chip = { .init_ack_masked = true, }; -static const char *const axp20x_supplies[] = { -"acin" , -"vin2" , -"vin3" , -"ldo24in" , -"ldo3in" , -"ldo5in" , -}; -static struct mfd_cell axp20x_cells[] = { { .name ="axp20x-pek" ,
@@ -156,8 +147,6 @@ static struct mfd_cell axp20x_cells[] = { .resources = axp20x_pek_resources, }, { .name = "axp20x-regulator", - .parent_supplies = axp20x_supplies, - .num_parent_supplies = ARRAY_SIZE(axp20x_supplies), }, };
Signature · 1 line
2.1.0
PATCH 2/3 mfd: axp209x: Drop the parent supplies field
Hi Lee,
Quoted 5 lines · Maxime Ripard
Now that the regulator code get its parent supplies purely from the DT, we can drop the parent supplies resources in the MFD driver.
Signed-off-by Maxime Ripard <[email protected]>Acked-by Lee Jones <[email protected]>
I know you have given your acked-by already, but could you merge this patch through your tree?
It doesn't have any depedency, so it should be rather safe to do so.
Thanks!
Maxime
Signature · 10 lines
Maxime Ripard, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140924/eb60c0e2/attachment.sig>
Lee Jones
AppliedPATCH 2/3 mfd: axp209x: Drop the parent supplies field
In reply to Maxime RipardQuoted 8 lines · Maxime Ripard
Now that the regulator code get its parent supplies purely from the DT, we can drop the parent supplies resources in the MFD driver.
Signed-off-by Maxime Ripard <[email protected]>Acked-by Lee Jones <[email protected]>--- drivers/mfd/axp20x.c | 11 ----------- 1 file changed, 11 deletions(-)
Applied, thanks.
Quoted 29 lines
drivers/mfd/axp20x.c +0
-11@@ -140,15 +140,6 @@ static const struct regmap_irq_chip axp20x_regmap_irq_chip = { .init_ack_masked = true, }; -static const char *const axp20x_supplies[] = { -"acin" , -"vin2" , -"vin3" , -"ldo24in" , -"ldo3in" , -"ldo5in" , -}; -static struct mfd_cell axp20x_cells[] = { { .name ="axp20x-pek" ,@@ -156,8 +147,6 @@ static struct mfd_cell axp20x_cells[] = { .resources = axp20x_pek_resources, }, { .name = "axp20x-regulator", - .parent_supplies = axp20x_supplies, - .num_parent_supplies = ARRAY_SIZE(axp20x_supplies), }, };
Signature · 4 lines
Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org ? Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
PATCH 3/3 ARM: sun7i: cubieboard2: Enable the AXP209
In reply to Maxime RipardAdd the AXP209 PMIC with the regulators in use on the cubie2.
The RTC regulator can be disabled, but since the RTC driver doesn't grab the regulator for now, the driver wouldn't work anymore.
--- arch/arm/boot/dts/sun7i-a20-cubieboard2.dts | 31 +++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+)
arch/arm/boot/dts/sun7i-a20-cubieboard2.dts +31 -0
@@ -91,6 +91,29 @@ interrupt-controller; #interrupt-cells = <1>; + + regulators { + x-powers,dcdc-freq = <1500>; + + vdd_cpu: dcdc2 { + vin-supply = <®_axp_ipsout>; + regulator-always-on; + }; + + vdd_dll: dcdc3 { + vin-supply = <®_axp_ipsout>; + regulator-always-on; + }; + + vdd_rtc: ldo1 { + vin-supply = <®_axp_ipsout>; + }; + + avcc: ldo2 { + vin-supply = <®_axp_ipsout>; + regulator-always-on; + }; + }; }; };
@@ -140,4 +163,12 @@ reg_usb2_vbus: usb2-vbus { status = "okay"; }; + + reg_axp_ipsout: axp_ipsout { + compatible = "regulator-fixed"; + regulator-name = "axp-ipsout"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + regulator-always-on; + }; };
Signature · 1 line
2.1.0
PATCH 3/3 ARM: sun7i: cubieboard2: Enable the AXP209
Quoted 6 lines · Maxime Ripard
Add the AXP209 PMIC with the regulators in use on the cubie2.
The RTC regulator can be disabled, but since the RTC driver doesn't grab the regulator for now, the driver wouldn't work anymore.
Signed-off-by Maxime Ripard <[email protected]>
Queued this one for 3.19.
Maxime
Signature · 10 lines
Maxime Ripard, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140925/d58f5c39/attachment.sig>
PATCH 3/3 ARM: sun7i: cubieboard2: Enable the AXP209
In reply to Maxime RipardHi,
Quoted 15 lines · Maxime Ripard
Add the AXP209 PMIC with the regulators in use on the cubie2.
The RTC regulator can be disabled, but since the RTC driver doesn't grab the regulator for now, the driver wouldn't work anymore.
Signed-off-by Maxime Ripard <[email protected]>--- arch/arm/boot/dts/sun7i-a20-cubieboard2.dts | 31 +++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+)arch/arm/boot/dts/sun7i-a20-cubieboard2.dts +0
-0
arch/arm/boot/dts/sun7i-a20-cubieboard2.dts line 99
Quoted 9 lines
arch/arm/boot/dts/sun7i-a20-cubieboard2.dts +6
-0@@ -91,6 +91,29 @@ interrupt-controller; #interrupt-cells = <1>; + + regulators { + x-powers,dcdc-freq = <1500>; + + vdd_cpu: dcdc2 { + vin-supply = <®_axp_ipsout>;
The driver ignores the vin-supply properties.
I think the original intended design was to have
acin-supply = <®_axp_ipsout>;
vin2-supply = <®_axp_ipsout>;
vin3-supply = <®_axp_ipsout>;
ldo24in-supply = <®_axp_ipsout>;
ldo3in-supply = <®_axp_ipsout>;
ldo5in-supply = <®_axp_ipsout>;under the axp209 node.
With this change, the kernel does find the supplies:
LDO1: 1300 mV
LDO1: supplied by axp-ipsout
LDO2: at 3000 mV
LDO2: supplied by axp-ipsout
LDO3: at 2275 mV
LDO3: supplied by axp-ipsout
LDO4: at 2800 mV
LDO4: supplied by axp-ipsout
LDO5: at 2800 mV
LDO5: supplied by axp-ipsout
DCDC2: at 1400 mV
DCDC2: supplied by axp-ipsout
DCDC3: at 1250 mV
DCDC3: supplied by axp-ipsout
ChenYu
P.S. my /sys/kernel/debug/regulator/supply_map is always empty. Is that normal?
Quoted 41 lines
arch/arm/boot/dts/sun7i-a20-cubieboard2.dts +25
-1+ regulator-always-on; + }; + + vdd_dll: dcdc3 { + vin-supply = <®_axp_ipsout>; + regulator-always-on; + }; + + vdd_rtc: ldo1 { + vin-supply = <®_axp_ipsout>; + }; + + avcc: ldo2 { + vin-supply = <®_axp_ipsout>; + regulator-always-on; + }; + }; }; };@@ -140,4 +163,12 @@ reg_usb2_vbus: usb2-vbus { status = "okay"; }; + + reg_axp_ipsout: axp_ipsout { + compatible = "regulator-fixed"; + regulator-name = "axp-ipsout"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + regulator-always-on; + }; }; --2.1.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH 3/3 ARM: sun7i: cubieboard2: Enable the AXP209
Quoted 44 lines · Chen-Yu Tsai
Hi,
Quoted 15 lines · Maxime Ripard
Add the AXP209 PMIC with the regulators in use on the cubie2.
The RTC regulator can be disabled, but since the RTC driver doesn't grab the regulator for now, the driver wouldn't work anymore.
Signed-off-by Maxime Ripard <[email protected]>--- arch/arm/boot/dts/sun7i-a20-cubieboard2.dts | 31 +++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+)arch/arm/boot/dts/sun7i-a20-cubieboard2.dts +0
-0arch/arm/boot/dts/sun7i-a20-cubieboard2.dts line 99
Quoted 9 lines
arch/arm/boot/dts/sun7i-a20-cubieboard2.dts +6
-0@@ -91,6 +91,29 @@ interrupt-controller; #interrupt-cells = <1>; + + regulators { + x-powers,dcdc-freq = <1500>; + + vdd_cpu: dcdc2 { + vin-supply = <®_axp_ipsout>;The driver ignores the vin-supply properties.
I think the original intended design was to have
acin-supply = <®_axp_ipsout>; vin2-supply = <®_axp_ipsout>; vin3-supply = <®_axp_ipsout>; ldo24in-supply = <®_axp_ipsout>; ldo3in-supply = <®_axp_ipsout>; ldo5in-supply = <®_axp_ipsout>;under the axp209 node.
With this change, the kernel does find the supplies:
Quoted 14 lines
LDO1: 1300 mV
LDO1: supplied by axp-ipsout
LDO2: at 3000 mV
LDO2: supplied by axp-ipsout
LDO3: at 2275 mV
LDO3: supplied by axp-ipsout
LDO4: at 2800 mV
LDO4: supplied by axp-ipsout
LDO5: at 2800 mV
LDO5: supplied by axp-ipsout
DCDC2: at 1400 mV
DCDC2: supplied by axp-ipsout
DCDC3: at 1250 mV
DCDC3: supplied by axp-ipsout
Wow. Thanks. I have no idea how I could have send this patch, and how I could merge it too.
You're obviously right, I'll amend my queued patch.
Quoted 2 lines
P.S. my/sys/kernel/debug/regulator/supply_mapis always empty. Is that normal?
Yeah, I have seen this too, I honestly have no idea :)
Maxime
Signature · 10 lines
Maxime Ripard, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20141006/9b6fa4ad/attachment-0001.sig>
PATCH 3/3 ARM: sun7i: cubieboard2: Enable the AXP209
BTW,
Quoted 9 lines · Maxime Ripard
Quoted 8 lines · Chen-Yu Tsai
Hi,
Quoted 4 lines · Maxime Ripard
Add the AXP209 PMIC with the regulators in use on the cubie2.
The RTC regulator can be disabled, but since the RTC driver doesn't grab the regulator for now, the driver wouldn't work anymore.
This is wrong. The RTC regulator, i.e. LDO1, can not be disabled.
Quoted 1 line
From the datasheet: "LDO1?30mA?????", or "Always effective/enabled".
And it is defined in the driver without enabling controls.
ChenYu
Quoted 66 lines
Quoted 35 lines
Quoted 10 lines
Signed-off-by Maxime Ripard <[email protected]>--- arch/arm/boot/dts/sun7i-a20-cubieboard2.dts | 31 +++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+)arch/arm/boot/dts/sun7i-a20-cubieboard2.dts +0
-0arch/arm/boot/dts/sun7i-a20-cubieboard2.dts line 99
Quoted 9 lines
arch/arm/boot/dts/sun7i-a20-cubieboard2.dts +6
-0@@ -91,6 +91,29 @@ interrupt-controller; #interrupt-cells = <1>; + + regulators { + x-powers,dcdc-freq = <1500>; + + vdd_cpu: dcdc2 { + vin-supply = <®_axp_ipsout>;The driver ignores the vin-supply properties.
I think the original intended design was to have
acin-supply = <®_axp_ipsout>; vin2-supply = <®_axp_ipsout>; vin3-supply = <®_axp_ipsout>; ldo24in-supply = <®_axp_ipsout>; ldo3in-supply = <®_axp_ipsout>; ldo5in-supply = <®_axp_ipsout>;under the axp209 node.
With this change, the kernel does find the supplies:
Quoted 14 lines
LDO1: 1300 mV
LDO1: supplied by axp-ipsout
LDO2: at 3000 mV
LDO2: supplied by axp-ipsout
LDO3: at 2275 mV
LDO3: supplied by axp-ipsout
LDO4: at 2800 mV
LDO4: supplied by axp-ipsout
LDO5: at 2800 mV
LDO5: supplied by axp-ipsout
DCDC2: at 1400 mV
DCDC2: supplied by axp-ipsout
DCDC3: at 1250 mV
DCDC3: supplied by axp-ipsoutWow. Thanks. I have no idea how I could have send this patch, and how I could merge it too.
You're obviously right, I'll amend my queued patch.
Quoted 2 lines
P.S. my/sys/kernel/debug/regulator/supply_mapis always empty. Is that normal?Yeah, I have seen this too, I honestly have no idea :)
Maxime
--
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
PATCH 3/3 ARM: sun7i: cubieboard2: Enable the AXP209
Quoted 9 lines · Chen-Yu Tsai
BTW,
Quoted 5 lines · Maxime Ripard
Quoted 4 lines · Chen-Yu Tsai
Hi,
On Sun, Sep 21, 2014 at 4:06 AM, Maxime Ripard
<[email protected]> wrote:
Quoted 8 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Add the AXP209 PMIC with the regulators in use on the cubie2.
The RTC regulator can be disabled, but since the RTC driver doesn't grab the regulator for now, the driver wouldn't work anymore.
This is wrong. The RTC regulator, i.e. LDO1, can not be disabled. From the datasheet: "LDO1?30mA?????", or "Always effective/enabled". And it is defined in the driver without enabling controls.
Yeah, I know, it was supposed to be fixed too.
I ended up dropping this patch, and will resubmit it.
Thanks!
Maxime
Signature · 10 lines
Maxime Ripard, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20141006/d27736fb/attachment.sig>