查ledqu

    leds {
        compatible = "gpio-leds";
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_gpio_leds
                 &pinctrl_beep>;

        led1{
            label = "sys-led";
            gpios = <&gpio1 3 GPIO_ACTIVE_LOW>;
            linux,default-trigger = "heartbeat";
            default-state = "on";
        };

        beep{
            label = "beep";
            gpios = <&gpio5 1 GPIO_ACTIVE_LOW>;
            default-state = "off";
        };
    };
compatible 
compatible属性也叫做“兼容性”属性,是一个字符串列表,compatible属性用于将设备和驱动绑定起来。字符串列表用于选择设备所要使用的驱动程序,格式如下所示

                                                      “manufacturer,model”

其中manufacturrer表示厂商,model一般是模块对应的驱动名字。比如像下面这个sound节点

        sound {
                 compatible = "fsl,imx6ul-evk-wm8960","fsl,imx-audio-wm8960";
                        . . . . . .
               }
https://blog.csdn.net/qq_44708426/article/details/108757687

一般驱动程序文件都会有一个OF匹配表,此OF匹配表保存着一些compatible值,如果设备节点的compatible属性值和OF匹配表中的任何一个值相等,那么就表示设备可以使用这个驱动。

static const struct of_device_id of_gpio_leds_match[] = {
    { .compatible = "gpio-leds", },
    {},
};
 
posted @ 2022-08-03 16:25  cnchengv  阅读(14)  评论(0编辑  收藏  举报