arm64: dts: allwinner: a64: bananapi-m64: Add LED device node
Subsystems (2)
PATCH 1/1 arm64: dts: allwinner: a64: bananapi-m64: Add LED device node
The Bananapi-M64 has 3 LEDS in red, green, and blue. These are toggled via GPIO lines, which drive transistors that control current across the LEDS. The red LED is by default on, via an additional pull-up on the control line. We consider this means that it is a power indicator. So we set the "default-on" property for it.
The pingroups the GPIO lines belong to require external regulators be enabled to be able to drive the GPIO high. These regulators also have other purposes. However the pin controller does not have bindings for regulators. Here we just set them to always-on.
--- .../boot/dts/allwinner/sun50i-a64-bananapi-m64.dts | 36 ++++++++++++++++++++++ 1 file changed, 36 insertions(+)
arch/arm64/boot/dts/allwinner/sun50i-a64-bananapi-m64.dts +36 -0
@@ -60,6 +60,26 @@ stdout-path = "serial0:115200n8"; }; + leds { + compatible = "gpio-leds"; + + pwr-led { + label = "bananapi-m64:red:pwr"; + gpios = <&pio 3 24 GPIO_ACTIVE_HIGH>; /* PD24 */ + default-state = "on"; + }; + + green { + label = "bananapi-m64:green:user"; + gpios = <&pio 4 14 GPIO_ACTIVE_HIGH>; /* PE14 */ + }; + + blue { + label = "bananapi-m64:blue:user"; + gpios = <&pio 4 15 GPIO_ACTIVE_HIGH>; /* PE15 */ + }; + }; + wifi_pwrseq: wifi_pwrseq { compatible = "mmc-pwrseq-simple"; reset-gpios = <&r_pio 0 2 GPIO_ACTIVE_LOW>; /* PL2 */
@@ -153,6 +173,17 @@ #include "axp803.dtsi" +®_aldo1 { + /* + * This regulator also drives the PE pingroup GPIOs, + * which also controls two LEDs. + */ + regulator-always-on; + regulator-min-microvolt = <2800000>; + regulator-max-microvolt = <2800000>; + regulator-name = "afvcc-csi"; +}; + ®_aldo2 { regulator-always-on; regulator-min-microvolt = <1800000>;
@@ -168,6 +199,11 @@ }; ®_dc1sw { + /* + * This regulator also indirectly drives the PD pingroup GPIOs, + * which also controls the power LED. + */ + regulator-always-on; regulator-name = "vcc-phy"; };
Signature · 1 line
2.15.0
PATCH 1/1 arm64: dts: allwinner: a64: bananapi-m64: Add LED device node
Quoted 49 lines · Chen-Yu Tsai
The Bananapi-M64 has 3 LEDS in red, green, and blue. These are toggled via GPIO lines, which drive transistors that control current across the LEDS. The red LED is by default on, via an additional pull-up on the control line. We consider this means that it is a power indicator. So we set the "default-on" property for it.
The pingroups the GPIO lines belong to require external regulators be enabled to be able to drive the GPIO high. These regulators also have other purposes. However the pin controller does not have bindings for regulators. Here we just set them to always-on.
Signed-off-by Chen-Yu Tsai <[email protected]>--- .../boot/dts/allwinner/sun50i-a64-bananapi-m64.dts | 36 ++++++++++++++++++++++ 1 file changed, 36 insertions(+)arch/arm64/boot/dts/allwinner/sun50i-a64-bananapi-m64.dts +20
-0@@ -60,6 +60,26 @@ stdout-path = "serial0:115200n8"; }; + leds { + compatible = "gpio-leds"; + + pwr-led { + label = "bananapi-m64:red:pwr"; + gpios = <&pio 3 24 GPIO_ACTIVE_HIGH>; /* PD24 */ + default-state = "on"; + }; + + green { + label = "bananapi-m64:green:user"; + gpios = <&pio 4 14 GPIO_ACTIVE_HIGH>; /* PE14 */ + }; + + blue { + label = "bananapi-m64:blue:user"; + gpios = <&pio 4 15 GPIO_ACTIVE_HIGH>; /* PE15 */ + }; + }; + wifi_pwrseq: wifi_pwrseq { compatible = "mmc-pwrseq-simple"; reset-gpios = <&r_pio 0 2 GPIO_ACTIVE_LOW>; /* PL2 */@@ -153,6 +173,17 @@
arch/arm64/boot/dts/allwinner/sun50i-a64-bananapi-m64.dts line 183
Quoted 10 lines
arch/arm64/boot/dts/allwinner/sun50i-a64-bananapi-m64.dts +8
-0#include "axp803.dtsi" +®_aldo1 { + /* + * This regulator also drives the PE pingroup GPIOs, + * which also controls two LEDs. + */ + regulator-always-on; + regulator-min-microvolt = <2800000>; + regulator-max-microvolt = <2800000>;
why 2.8v?
Quoted 7 lines
arch/arm64/boot/dts/allwinner/sun50i-a64-bananapi-m64.dts +3
-0+ regulator-name = "afvcc-csi"; +}; + ®_aldo2 { regulator-always-on; regulator-min-microvolt = <1800000>;
arch/arm64/boot/dts/allwinner/sun50i-a64-bananapi-m64.dts line 206
Quoted 8 lines
arch/arm64/boot/dts/allwinner/sun50i-a64-bananapi-m64.dts +5
-0@@ -168,6 +199,11 @@ }; ®_dc1sw { + /* + * This regulator also indirectly drives the PD pingroup GPIOs, + * which also controls the power LED. + */ + regulator-always-on;
This make rgmii phy always on, does this make emac power-drop?
Signature · 4 lines
Jagan Teki Senior Linux Kernel Engineer | Amarula Solutions U-Boot, Linux | Upstream Maintainer Hyderabad, India.
PATCH 1/1 arm64: dts: allwinner: a64: bananapi-m64: Add LED device node
Quoted 52 lines · Jagan Teki
Quoted 51 lines · Chen-Yu Tsai
The Bananapi-M64 has 3 LEDS in red, green, and blue. These are toggled via GPIO lines, which drive transistors that control current across the LEDS. The red LED is by default on, via an additional pull-up on the control line. We consider this means that it is a power indicator. So we set the "default-on" property for it.
The pingroups the GPIO lines belong to require external regulators be enabled to be able to drive the GPIO high. These regulators also have other purposes. However the pin controller does not have bindings for regulators. Here we just set them to always-on.
Signed-off-by Chen-Yu Tsai <[email protected]>--- .../boot/dts/allwinner/sun50i-a64-bananapi-m64.dts | 36 ++++++++++++++++++++++ 1 file changed, 36 insertions(+)arch/arm64/boot/dts/allwinner/sun50i-a64-bananapi-m64.dts +20
-0@@ -60,6 +60,26 @@ stdout-path = "serial0:115200n8"; }; + leds { + compatible = "gpio-leds"; + + pwr-led { + label = "bananapi-m64:red:pwr"; + gpios = <&pio 3 24 GPIO_ACTIVE_HIGH>; /* PD24 */ + default-state = "on"; + }; + + green { + label = "bananapi-m64:green:user"; + gpios = <&pio 4 14 GPIO_ACTIVE_HIGH>; /* PE14 */ + }; + + blue { + label = "bananapi-m64:blue:user"; + gpios = <&pio 4 15 GPIO_ACTIVE_HIGH>; /* PE15 */ + }; + }; + wifi_pwrseq: wifi_pwrseq { compatible = "mmc-pwrseq-simple"; reset-gpios = <&r_pio 0 2 GPIO_ACTIVE_LOW>; /* PL2 */@@ -153,6 +173,17 @@ #include "axp803.dtsi"
Quoted 10 lines
arch/arm64/boot/dts/allwinner/sun50i-a64-bananapi-m64.dts line 183
Quoted 8 lines
arch/arm64/boot/dts/allwinner/sun50i-a64-bananapi-m64.dts +8
-0+®_aldo1 { + /* + * This regulator also drives the PE pingroup GPIOs, + * which also controls two LEDs. + */ + regulator-always-on; + regulator-min-microvolt = <2800000>; + regulator-max-microvolt = <2800000>;why 2.8v?
That is what is written on the schematics. Plus it seems camera modules are meant to use 2.8v.
Quoted 10 lines
Quoted 10 lines
arch/arm64/boot/dts/allwinner/sun50i-a64-bananapi-m64.dts +3
-0+ regulator-name = "afvcc-csi"; +}; + ®_aldo2 { regulator-always-on; regulator-min-microvolt = <1800000>;@@ -168,6 +199,11 @@ };
Quoted 8 lines
arch/arm64/boot/dts/allwinner/sun50i-a64-bananapi-m64.dts line 206
Quoted 6 lines
arch/arm64/boot/dts/allwinner/sun50i-a64-bananapi-m64.dts +5
-0®_dc1sw { + /* + * This regulator also indirectly drives the PD pingroup GPIOs, + * which also controls the power LED. + */ + regulator-always-on;This make rgmii phy always on, does this make emac power-drop?
emac power-drop? Please elaborate.
ChenYu
PATCH 1/1 arm64: dts: allwinner: a64: bananapi-m64: Add LED device node
In reply to Chen-Yu TsaiHi,
Quoted 10 lines · Chen-Yu Tsai
The Bananapi-M64 has 3 LEDS in red, green, and blue. These are toggled via GPIO lines, which drive transistors that control current across the LEDS. The red LED is by default on, via an additional pull-up on the control line. We consider this means that it is a power indicator. So we set the "default-on" property for it.
The pingroups the GPIO lines belong to require external regulators be enabled to be able to drive the GPIO high. These regulators also have other purposes. However the pin controller does not have bindings for regulators. Here we just set them to always-on.
I guess we should take the opportunity to do just that.
We have been deferring this for quite some time now, this is a perfect occasion to do it once and for all :)
Maxime
Signature · 10 lines
Maxime Ripard, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: not available URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20171205/67860803/attachment.sig>
PATCH 1/1 arm64: dts: allwinner: a64: bananapi-m64: Add LED device node
Quoted 14 lines · Maxime Ripard
Hi,
Quoted 10 lines · Chen-Yu Tsai
The Bananapi-M64 has 3 LEDS in red, green, and blue. These are toggled via GPIO lines, which drive transistors that control current across the LEDS. The red LED is by default on, via an additional pull-up on the control line. We consider this means that it is a power indicator. So we set the "default-on" property for it.
The pingroups the GPIO lines belong to require external regulators be enabled to be able to drive the GPIO high. These regulators also have other purposes. However the pin controller does not have bindings for regulators. Here we just set them to always-on.
Quoted 4 lines
I guess we should take the opportunity to do just that.
We have been deferring this for quite some time now, this is a perfect occasion to do it once and for all :)
True. But right now I don't see an elegant solution. What is the purpose of having the regulator tied to pinctrl / GPIO? You can't have the pinctrl driver asking for the regulator at probe time, as it might not be available or even have a cyclic dependency (because the PMIC is I2C driven, which needs an I2C controller, which needs the pinctrl). If you defer fetching the regulator to a later point, you might end up with an inconsistent state. Again with the I2C driven regulator example, what happens if the regulator core decides to turn the regulator off before the pinctrl side has a chance to take a reference and enable it?
Regards
ChenYu
PATCH 1/1 arm64: dts: allwinner: a64: bananapi-m64: Add LED device node
Quoted 18 lines · Chen-Yu Tsai
Quoted 16 lines · Maxime Ripard
Hi,
Quoted 10 lines · Chen-Yu Tsai
The Bananapi-M64 has 3 LEDS in red, green, and blue. These are toggled via GPIO lines, which drive transistors that control current across the LEDS. The red LED is by default on, via an additional pull-up on the control line. We consider this means that it is a power indicator. So we set the "default-on" property for it.
The pingroups the GPIO lines belong to require external regulators be enabled to be able to drive the GPIO high. These regulators also have other purposes. However the pin controller does not have bindings for regulators. Here we just set them to always-on.
I guess we should take the opportunity to do just that.
Quoted 8 lines
Quoted 2 lines
We have been deferring this for quite some time now, this is a perfect occasion to do it once and for all :)
True. But right now I don't see an elegant solution. What is the purpose of having the regulator tied to pinctrl / GPIO? You can't have the pinctrl driver asking for the regulator at probe time, as it might not be available or even have a cyclic dependency (because the PMIC is I2C driven, which needs an I2C controller, which needs the pinctrl).
Ah, right, you definitely have a circular dependency.
Quoted 5 lines
If you defer fetching the regulator to a later point, you might end up with an inconsistent state. Again with the I2C driven regulator example, what happens if the regulator core decides to turn the regulator off before the pinctrl side has a chance to take a reference and enable it?
I guess you could implement something based on the an asynchronous regulator_get. You call regulator_get_async (or whatever) in the pinctrl probe, and get notified as soon as it is registered so that you can act upon it.
Anyway, this is a bit too much to ask to enable 3 LEDs... I've applied that patch.
Maxime
Signature · 10 lines
Maxime Ripard, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: not available URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20171208/9c1af039/attachment-0001.sig>