Hi all,
Linux kernel 5.x.x leds class and device tree node.
I have an GPIO output that controls a relay. The output is put in the device tree as a ‘leds’ node.
Snippet from my device tree.
led1 {
label = "board:none:relay0";
gpios = <&gpio1 23 GPIO_ACTIVE_LOW>;
default-state = "off";
};
user_leds_s0: user_leds_s0 {
pinctrl-single,pins = <
AM33XX_IOPAD(0x85c, PIN_OUTPUT_PULLUP | MUX_MODE7) /* (T15) gpmc_a7.gpio1[23] relay0 */
>;
};
gpio1_pins_default: pinmux_gpio1_pins {
pinctrl-single,pins = <
AM33XX_IOPAD(0x830, PIN_INPUT_PULLUP | MUX_MODE7) /* (T12) gpmc_ad12.gpio1[12] button0 */
>;
};
I have a pinmux for the relay0 (output) and button0 (input).
I can control the relay thru the command line,
echo “1” > /sys/class/leds/board:none:relay0/brightness
My app can control the output using /dev/mem and mmap (I know that mmap() is not recommended).
The push button will also be read using mmap().
If ‘leds’ are outputs then what class/device tree node is inputs?
Can you provide example of an ‘inputs’ node in the device tree?
How to check the state of the ‘input’ class from the command line?
Thank you,