We would like to set the default value of GPIO in the device tree with option to override the set value when the system is booted using for example gpiod
lib. Main purpose of using the device tree to set the GPIO is that we would like to turn on the LED during booting. If there are any better alternatives than device tree, then please do tell.
Currently we tried to set the default value with the following entry in apq8096-db820c.dtsi:
led {
gpios = <&msmgpio 122 GPIO_ACTIVE_HIGH>;
};
but the LED was not turned on during boot. Next we tried using the gpio-leds
driver:
led {
compatible = "gpio-leds";
client1 {
label = "client1_gpio";
gpios = <&msmgpio 122 GPIO_ACTIVE_HIGH>;
default-state = "on";
};
};
but this took a hold of the GPIO and when we tried controlling the said LED via gpiod
we got the following error:
Traceback (most recent call last):
File "led_test.py", line 7, in <module>
pin.request(consumer="gpio_led_test", type=gpiod.LINE_REQ_DIR_OUT)
OSError: [Errno 16] Device or resource busy
It works with the sysfs interface (e.g echo 1 > /sys/class/leds/led1/brightness
) , but it’s deprecated. Any ideas on what to try are welcome