Skip to contentSkip to conversation

arm64: dts: renesas: r8a77995-draak: gpio-leds prototype

PATCH/RFC Magnus Damm 2 participants 2 messages Jun 22, 2020

Subsystems (2)
lore
Share & tools
lore

Magnus Damm

author maintainer
#0 lore raw

From: Magnus Damm <[email protected]>

This patch adds support for a couple of LEDs on the r8a77995 Draak board.

It also ignores the issue that push switches are also used on the same GPIOs.

The approach is the same as in the earlier posted patch for other boards:
[PATCH/RFC] arm64: dts: renesas: salvator-common: gpio-leds prototype

The limitations of DT bindings and kernel software support remain the same.

As Geert pointed out we need to extend the software to allow sharing of GPIOs somehow. On this board and several others the GPIOs used for LEDs are also used for push switches. Both DT bindings and drivers need to be extended, most likely together with the GPIO subsystem. And to make it more fun it is probably possible to get interrupts from these GPIOs as well.

In the patch the LED order and the GPIO number assignments look quite random but match the schematics.

---

 arch/arm64/boot/dts/renesas/r8a77995-draak.dts |   14 ++++++++++++++
 1 file changed, 14 insertions(+)
arch/arm64/boot/dts/renesas/r8a77995-draak.dts +14 -0
@@ -91,6 +91,20 @@
 		};
 	};
 
+	leds {
+		compatible = "gpio-leds";
+
+		led13 {
+			gpios = <&gpio4 7 GPIO_ACTIVE_HIGH>;
+		};
+		led12 {
+			gpios = <&gpio1 30 GPIO_ACTIVE_HIGH>;
+		};
+		led14 {
+			gpios = <&gpio4 25 GPIO_ACTIVE_HIGH>;
+		};
+	};
+
 	memory@48000000 {
 		device_type = "memory";
 		/* first 128MB is reserved for secure area. */
Reviewed-by
#1 lore raw

Hi Magnus,

Quoted 17 lines · Magnus Damm

From: Magnus Damm <[email protected]>

This patch adds support for a couple of LEDs on the r8a77995 Draak board.

It also ignores the issue that push switches are also used on the same GPIOs.

The approach is the same as in the earlier posted patch for other boards:
[PATCH/RFC] arm64: dts: renesas: salvator-common: gpio-leds prototype

The limitations of DT bindings and kernel software support remain the same.

As Geert pointed out we need to extend the software to allow sharing of GPIOs somehow. On this board and several others the GPIOs used for LEDs are also used for push switches. Both DT bindings and drivers need to be extended, most likely together with the GPIO subsystem. And to make it more fun it is probably possible to get interrupts from these GPIOs as well.

Quoted 4 lines

In the patch the LED order and the GPIO number assignments look quite random but match the schematics.

arch/arm64/boot/dts/renesas/r8a77995-draak.dts 2020-06-22 21:00:20.000000000 +0900 line 97

Quoted 10 lines
arch/arm64/boot/dts/renesas/r8a77995-draak.dts 2020-06-22 21:00:20.000000000 +0900 renamed from arch/arm64/boot/dts/renesas/r8a77995-draak.dts +4 -0
@@ -91,6 +91,20 @@
                };
        };
 
+       leds {
+               compatible = "gpio-leds";
+
+               led13 {

While a name like "led13" is still considered acceptable these days, the preferred format uses a hyphen ("^led-[0-9a-f]$"; whoops no one thought of more than 16 LEDs?)

arch/arm64/boot/dts/renesas/r8a77995-draak.dts 2020-06-22 21:00:20.000000000 +0900 line 110

Quoted 13 lines
arch/arm64/boot/dts/renesas/r8a77995-draak.dts 2020-06-22 21:00:20.000000000 +0900 renamed from arch/arm64/boot/dts/renesas/r8a77995-draak.dts +10 -0
+                       gpios = <&gpio4 7 GPIO_ACTIVE_HIGH>;
+               };
+               led12 {
+                       gpios = <&gpio1 30 GPIO_ACTIVE_HIGH>;
+               };
+               led14 {
+                       gpios = <&gpio4 25 GPIO_ACTIVE_HIGH>;
+               };
+       };
+
        memory@48000000 {
                device_type = "memory";
                /* first 128MB is reserved for secure area. */

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds