Skip to contentSkip to conversation

ARM: dts: sun8i: Add leds and switches on Orangepi Plus boards

PATCH New Hans de Goede 2 participants 4 messages Mar 20, 2016 – Mar 21, 2016

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v7 1/1 ARM: dts: sun8i: Add leds and switches on Orangepi Plus boards

From: Krzysztof Adamski <[email protected]>

OrangePi Plus board has two leds - green ("pwr") and red ("status") and two switches ("sw4" and "sw2"). This patch describes them in devicetree.

---
Changes in v6 (hdegoede):
-Merge leds and r_leds nodes into one
-Fix led labels to be in <board>:<colour>:<role> form -Alphabetically sort the added nodes
-Add support for sw2 (this is the small reset-like button) Changes in v7 (hdegoede):
-Use PL3 / PL4 in the pinctrl node, not PL03 / PL04

---
 arch/arm/boot/dts/sun8i-h3-orangepi-plus.dts | 63 ++++++++++++++++++++++++++++
 1 file changed, 63 insertions(+)
arch/arm/boot/dts/sun8i-h3-orangepi-plus.dts +63 -0
index a680b1f..9d8c038 100644
@@ -45,6 +45,7 @@
 #include "sunxi-common-regulators.dtsi"
 
 #include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
 #include <dt-bindings/pinctrl/sun4i-a10.h>
 
 / {
@@ -59,6 +60,43 @@
 		stdout-path = "serial0:115200n8";
 	};
 
+	gpio_keys {
+		compatible = "gpio-keys";
+		input-name = "sw4";
+
+		pinctrl-names = "default";
+		pinctrl-0 = <&sw_r_opc>;
+
+		sw2 at 0 {
+			label = "sw2";
+			linux,code = <BTN_1>;
+			gpios = <&r_pio 0 4 GPIO_ACTIVE_LOW>;
+		};
+
+		sw4 at 0 {
+			label = "sw4";
+			linux,code = <BTN_0>;
+			gpios = <&r_pio 0 3 GPIO_ACTIVE_LOW>;
+		};
+	};
+
+	leds {
+		compatible = "gpio-leds";
+		pinctrl-names = "default";
+		pinctrl-0 = <&leds_opc>, <&leds_r_opc>;
+
+		status_led {
+			label = "orangepi-plus:red:status";
+			gpios = <&pio 0 15 GPIO_ACTIVE_HIGH>;
+		};
+
+		pwr_led {
+			label = "orangepi-plus:green:pwr";
+			gpios = <&r_pio 0 10 GPIO_ACTIVE_HIGH>;
+			default-state = "on";
+		};
+	};
+
 	reg_usb3_vbus: usb3-vbus {
 		compatible = "regulator-fixed";
 		pinctrl-names = "default";
@@ -72,6 +110,31 @@
 	};
 };
 
+&pio {
+	leds_opc: led_pins at 0 {
+		allwinner,pins = "PA15";
+		allwinner,function = "gpio_out";
+		allwinner,drive = <SUN4I_PINCTRL_10_MA>;
+		allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
+	};
+};
+
+&r_pio {
+	leds_r_opc: led_pins at 0 {
+		allwinner,pins = "PL10";
+		allwinner,function = "gpio_out";
+		allwinner,drive = <SUN4I_PINCTRL_10_MA>;
+		allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
+	};
+
+	sw_r_opc: key_pins at 0 {
+		allwinner,pins = "PL3", "PL4";
+		allwinner,function = "gpio_in";
+		allwinner,drive = <SUN4I_PINCTRL_10_MA>;
+		allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
+	};
+};
+
 &ehci1 {
 	status = "okay";
 };
Signature · 1 line
2.7.3
#1 lore raw

PATCH v7 1/1 ARM: dts: sun8i: Add leds and switches on Orangepi Plus boards

Hi,

Quoted 8 lines · Hans de Goede

From: Krzysztof Adamski <[email protected]>

OrangePi Plus board has two leds - green ("pwr") and red ("status") and two switches ("sw4" and "sw2"). This patch describes them in devicetree.

An earlier version has already been sent for 4.6, please base your changes on top of this one.

And there's a bunch of things I didn't catch at that time :/

Quoted 25 lines

---
Changes in v6 (hdegoede):

(quoted diff) +0 -4
-Merge leds and r_leds nodes into one
-Fix led labels to be in <board>:<colour>:<role> form
-Alphabetically sort the added nodes
-Add support for sw2 (this is the small reset-like button)

Changes in v7 (hdegoede):

(quoted diff) +0 -2
-Use PL3 / PL4 in the pinctrl node, not PL03 / PL04
---
 arch/arm/boot/dts/sun8i-h3-orangepi-plus.dts | 63 ++++++++++++++++++++++++++++
 1 file changed, 63 insertions(+)
arch/arm/boot/dts/sun8i-h3-orangepi-plus.dts +1 -0
index a680b1f..9d8c038 100644
@@ -45,6 +45,7 @@
 #include "sunxi-common-regulators.dtsi"
 
 #include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
 #include <dt-bindings/pinctrl/sun4i-a10.h>
 
 / {

arch/arm/boot/dts/sun8i-h3-orangepi-plus.dts line 65

Quoted 6 lines
arch/arm/boot/dts/sun8i-h3-orangepi-plus.dts +3 -0
@@ -59,6 +60,43 @@
 		stdout-path = "serial0:115200n8";
 	};
 
+	gpio_keys {
+		compatible = "gpio-keys";
+		input-name = "sw4";

This is an undocumented (and apparently unused) property

arch/arm/boot/dts/sun8i-h3-orangepi-plus.dts line 70

Quoted 5 lines
arch/arm/boot/dts/sun8i-h3-orangepi-plus.dts +5 -0
+
+		pinctrl-names = "default";
+		pinctrl-0 = <&sw_r_opc>;
+
+		sw2 at 0 {

You shouldn't have a unit-address here

arch/arm/boot/dts/sun8i-h3-orangepi-plus.dts line 76

Quoted 6 lines
arch/arm/boot/dts/sun8i-h3-orangepi-plus.dts +6 -0
+			label = "sw2";
+			linux,code = <BTN_1>;
+			gpios = <&r_pio 0 4 GPIO_ACTIVE_LOW>;
+		};
+
+		sw4 at 0 {

Ditto.

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/20160321/90d11ec6/attachment-0001.sig>
#2 lore raw

Hi,

Quoted 9 lines · Maxime Ripard

Hi,

Quoted 6 lines · Hans de Goede

From: Krzysztof Adamski <[email protected]>

OrangePi Plus board has two leds - green ("pwr") and red ("status") and two switches ("sw4" and "sw2"). This patch describes them in devicetree.

Quoted 5 lines
Quoted 2 lines

An earlier version has already been sent for 4.6, please base your changes on top of this one.

Ah, I missed that one because it is not in your for-next branch!

It is only in sunxi-dt-for-4.6.

Quoted 1 line

And there's a bunch of things I didn't catch at that time :/

I'll cherry-pick the patch you've in sunxi-dt-for-4.6 into my tree and send a fixup patch to apply on top.

Regards,

Hans

Quoted 55 lines
Quoted 26 lines

---
Changes in v6 (hdegoede):

(quoted diff) +0 -4
-Merge leds and r_leds nodes into one
-Fix led labels to be in <board>:<colour>:<role> form
-Alphabetically sort the added nodes
-Add support for sw2 (this is the small reset-like button)

Changes in v7 (hdegoede):

(quoted diff) +0 -2
-Use PL3 / PL4 in the pinctrl node, not PL03 / PL04
---
  arch/arm/boot/dts/sun8i-h3-orangepi-plus.dts | 63 ++++++++++++++++++++++++++++
  1 file changed, 63 insertions(+)
arch/arm/boot/dts/sun8i-h3-orangepi-plus.dts +1 -0
index a680b1f..9d8c038 100644
@@ -45,6 +45,7 @@
  #include "sunxi-common-regulators.dtsi"
 
  #include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
  #include <dt-bindings/pinctrl/sun4i-a10.h>
 
  / {

arch/arm/boot/dts/sun8i-h3-orangepi-plus.dts line 65

Quoted 6 lines
arch/arm/boot/dts/sun8i-h3-orangepi-plus.dts +3 -0
@@ -59,6 +60,43 @@
  		stdout-path = "serial0:115200n8";
  	};
 
+	gpio_keys {
+		compatible = "gpio-keys";
+		input-name = "sw4";

This is an undocumented (and apparently unused) property

arch/arm/boot/dts/sun8i-h3-orangepi-plus.dts line 70

Quoted 5 lines
arch/arm/boot/dts/sun8i-h3-orangepi-plus.dts +5 -0
+
+		pinctrl-names = "default";
+		pinctrl-0 = <&sw_r_opc>;
+
+		sw2 at 0 {

You shouldn't have a unit-address here

arch/arm/boot/dts/sun8i-h3-orangepi-plus.dts line 76

Quoted 6 lines
arch/arm/boot/dts/sun8i-h3-orangepi-plus.dts +6 -0
+			label = "sw2";
+			linux,code = <BTN_1>;
+			gpios = <&r_pio 0 4 GPIO_ACTIVE_LOW>;
+		};
+
+		sw4 at 0 {

Ditto.

Thanks!
Maxime

#3 lore raw
In reply to Maxime Ripard

Hi,

Quoted 9 lines · Maxime Ripard

Hi,

Quoted 6 lines · Hans de Goede

From: Krzysztof Adamski <[email protected]>

OrangePi Plus board has two leds - green ("pwr") and red ("status") and two switches ("sw4" and "sw2"). This patch describes them in devicetree.

Quoted 7 lines
Quoted 2 lines

An earlier version has already been sent for 4.6, please base your changes on top of this one.

And there's a bunch of things I didn't catch at that time :/

As promised I will send a fixup patch for this, I was wondering if you can push your current queue, where you've already merged my other orangepi-plus patches somewhere, so that I can base this fixup patch on top of it ?

Regards,

Hans

Quoted 55 lines
Quoted 26 lines

---
Changes in v6 (hdegoede):

(quoted diff) +0 -4
-Merge leds and r_leds nodes into one
-Fix led labels to be in <board>:<colour>:<role> form
-Alphabetically sort the added nodes
-Add support for sw2 (this is the small reset-like button)

Changes in v7 (hdegoede):

(quoted diff) +0 -2
-Use PL3 / PL4 in the pinctrl node, not PL03 / PL04
---
  arch/arm/boot/dts/sun8i-h3-orangepi-plus.dts | 63 ++++++++++++++++++++++++++++
  1 file changed, 63 insertions(+)
arch/arm/boot/dts/sun8i-h3-orangepi-plus.dts +1 -0
index a680b1f..9d8c038 100644
@@ -45,6 +45,7 @@
  #include "sunxi-common-regulators.dtsi"
 
  #include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
  #include <dt-bindings/pinctrl/sun4i-a10.h>
 
  / {

arch/arm/boot/dts/sun8i-h3-orangepi-plus.dts line 65

Quoted 6 lines
arch/arm/boot/dts/sun8i-h3-orangepi-plus.dts +3 -0
@@ -59,6 +60,43 @@
  		stdout-path = "serial0:115200n8";
  	};
 
+	gpio_keys {
+		compatible = "gpio-keys";
+		input-name = "sw4";

This is an undocumented (and apparently unused) property

arch/arm/boot/dts/sun8i-h3-orangepi-plus.dts line 70

Quoted 5 lines
arch/arm/boot/dts/sun8i-h3-orangepi-plus.dts +5 -0
+
+		pinctrl-names = "default";
+		pinctrl-0 = <&sw_r_opc>;
+
+		sw2 at 0 {

You shouldn't have a unit-address here

arch/arm/boot/dts/sun8i-h3-orangepi-plus.dts line 76

Quoted 6 lines
arch/arm/boot/dts/sun8i-h3-orangepi-plus.dts +6 -0
+			label = "sw2";
+			linux,code = <BTN_1>;
+			gpios = <&r_pio 0 4 GPIO_ACTIVE_LOW>;
+		};
+
+		sw4 at 0 {

Ditto.

Thanks!
Maxime