AnsweredAssumed Answered

Using gpio led triggers in device tree

Question asked by bryce johnson on Dec 19, 2017
Latest reply on Dec 20, 2017 by bryce johnson

I am working with a imx6ull custom board.

 

Was there a way to specify trigger parameters in the devicetree?

 

For example I'll like gpio 122 to trigger the led to blink.

 

Current DT:

 

leds {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_led>;
compatible = "gpio-leds";
led_wwan {
label = "led_wwan";
gpios = <&gpio2 4 GPIO_ACTIVE_LOW>;
};

 

In the userspace I can do this to make it work:

 

echo gpio > /sys/class/leds/led_wwan
echo 122 > echo gpio > /sys/class/leds/led_wwan

 

Adding trigger to DT:

leds {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_led>;
compatible = "gpio-leds"; 
led_wwan {
label = "led_wwan";
gpios = <&gpio2 4 GPIO_ACTIVE_LOW>;
linux,default-trigger = "gpio";
};

 

Can I set the 122 in the device tree or would I need to always do it in userland with 

echo 122 > /sys/class/leds/led_wwan/gpio

Outcomes