linux gpio-leds driver
gpio-leds dts
source:
drivers/leds/
documentation:
linux/Documentation/devicetree/bindings/leds/leds-gpio.txt
dts:
leds {
compatible = "gpio-leds";
pinctrl-names = "default";
pinctrl-0 = <&leds_default>;
status = "okay";
led0 {
gpios = <&gpio 07 GPIO_ACTIVE_HIGH>;
default-state = "on";
};
led1:heartbeat-led {
label = "heartbeat-led";
gpios = <&gpio 08 GPIO_ACTIVE_HIGH>;
linux,default-trigger = "heartbeat";
/*linux,default-trigger = "timer";*/
};
};
[root]# pwd
/sys/devices/platform/leds/leds
[root]#
[root]# ls
led0 led1
control led
leds {
compatible = "gpio-leds";
pinctrl-names = "default";
pinctrl-0 = <&led0_pins_default>;
status = "okay";
led0 {
lable = "led0";
gpios = <&gpio 18 GPIO_ACTIVE_HIGH>;
linux,default-trigger = "default-on";
};
};
root@soc:/opt/wangyangkai# cat led.sh
#!/bin/sh
echo 0 > /sys/devices/platform/leds/leds/led0/brightness
usleep 200000
echo 255 > /sys/devices/platform/leds/leds/led0/brightness
root@soc:/opt/wangyangkai#