Controlling SAMA5D27-SOM1-EK1 Board LEDS using DEVICE-TREE file in linux kernel

旧街凉风 提交于 2019-12-19 11:57:37

问题


I have SAMA5D27-SOM1-EK1 Board. It has 3 Leds ( Red connected to PA10 pin , green connected to PB1 pin , blue connected to PA31 pin ) and 4 buttons, one of them is user push button (PB4) connected to PIO PA29, and optionally to PIOBU1.

This is a link to device-tree file for my linux kernel : https://github.com/torvalds/linux/blob/master/arch/arm/boot/dts/at91-sama5d27_som1_ek.dts

You can find a part which describing LED and User Push Button :

leds {
        compatible = "gpio-leds";
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_led_gpio_default>;
        status = "okay"; /* Conflict with pwm0. */

        red {
            label = "red";
            gpios = <&pioA PIN_PA10 GPIO_ACTIVE_HIGH>;
        };

        green {
            label = "green";
            gpios = <&pioA PIN_PB1 GPIO_ACTIVE_HIGH>;
        };

        blue {
            label = "blue";
            gpios = <&pioA PIN_PA31 GPIO_ACTIVE_HIGH>;
            linux,default-trigger = "heartbeat";
        };

gpio_keys {
        compatible = "gpio-keys";

        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_key_gpio_default>;

        pb4 {
            label = "USER";
            gpios = <&pioA PIN_PA29 GPIO_ACTIVE_LOW>;
            linux,code = <0x104>;
            wakeup-source;
        };

I want to take the control of one of the three leds with the button : When I push the button it lights My question is : How can I take the control of any Led of the three leds with the user button ? How can I modify the device-tree file for this ?

来源:https://stackoverflow.com/questions/57578148/controlling-sama5d27-som1-ek1-board-leds-using-device-tree-file-in-linux-kernel

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!