From 5f3b8a89cc7c96a62b9a006cd4ef6df3758979e2 Mon Sep 17 00:00:00 2001 From: Dobrica Pavlinusic Date: Wed, 18 Apr 2018 08:18:33 +0000 Subject: [PATCH] define relay as leds This allows us to take over pins right after kernel boot as opposed to waiting for userland to start up. This configuration starts with relays off so that brightness values in /sys/class/leds is correct --- device-tree/relay-leds.dts | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 device-tree/relay-leds.dts diff --git a/device-tree/relay-leds.dts b/device-tree/relay-leds.dts new file mode 100644 index 0000000..0136477 --- /dev/null +++ b/device-tree/relay-leds.dts @@ -0,0 +1,28 @@ +/dts-v1/; +/plugin/; +/* dtc -I dts -O dtb relay-leds.dts > /boot/overlays/relay-leds.dtbo */ +/ { + fragment@0 { + target = <&leds>; + __overlay__ { + compatible = "gpio-leds"; + relay1: relay@1 { + label = "relay1"; + gpios = <&gpio 12 1>; /* 0 = active low, 1 = active high */ + linux,default-trigger = "none"; /* default-on */ + }; + relay2: relay@2 { + label = "relay2"; + gpios = <&gpio 16 1>; + }; + relay3: relay@3 { + label = "relay3"; + gpios = <&gpio 20 1>; + }; + relay4: relay@4 { + label = "relay4"; + gpios = <&gpio 21 1>; + }; + }; + }; +}; -- 2.20.1