版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/JerryGou/article/details/85861049
参考:kernel(九)LED(触发器)、Documentation\devicetree\bindings\leds\leds-gpio.txt
一、原理图
二、设备树文件
对应的驱动文件:drivers/leds/leds-gpio.c
修改设备树文件 arch/arm/boot/dts/s5pv210-smdkv210.dts
#include <dt-bindings/gpio/gpio.h>
leds {
compatible = "gpio-leds";
led1 {
label = "led0";
gpios = <&gpc0 3 GPIO_ACTIVE_HIGH>;
default-state = "off";
linux,default-trigger = "heartbeat";
};
led2 {
label = "led1";
gpios = <&gpc0 4 GPIO_ACTIVE_HIGH>;
default-state = "off";
};
};
GPIO_ACTIVE_HIGH表示高电平有效(灯亮),如果是低电平有效,需要替换为 GPIO_ACTIVE_LOW