[linux]GPIO 设备树

在/节点下添加
aledspx: aledspx {
compatible = “agpio-leds”;
pinctrl-names = “default”;
pinctrl-0 =<&aleds_gpio>;

led@1 {
gpios = <&gpio0 RK_PC1 GPIO_ACTIVE_HIGH>;
label = “astatus_led”;
};
};

pinctr中加入
awork-led {
aleds_gpio: aleds-gpio {
rockchip,pins = <0 RK_PC1 RK_FUNC_GPIO &pcfg_pull_none>;
};
};

——————————————————————-
多个IO可这样写
leds: leds {
compatible = “gpio-leds”;
pinctrl-names = “default”;
pinctrl-0 =<&leds_gpio>;

led = <&gpio0 RK_PC0 GPIO_ACTIVE_LOW>;
ledb = <&gpio0 RK_PC1 GPIO_ACTIVE_LOW>;
ledc = <&gpio0 RK_PC2 GPIO_ACTIVE_LOW>;

};

pinctr:

work-led {
leds_gpio: leds-gpio {
rockchip,pins = < 0 RK_PC0 RK_FUNC_GPIO &pcfg_pull_none>,
< 0 RK_PC1 RK_FUNC_GPIO &pcfg_pull_none>,
< 0 RK_PC2 RK_FUNC_GPIO &pcfg_pull_none>;
};
};

—————————–也可以这样写————————————
leds: leds {
compatible = “gpio-leds”;
pinctrl-names = “default”;
pinctrl-0 =<&leds_gpio>;

led@1 {
gpios = <&gpio0 RK_PC0 GPIO_ACTIVE_HIGH>;
label = “status_led”;
linux,default-trigger = “heartbeat”;
};
leda {
gpios = <&gpio0 RK_PC1 GPIO_ACTIVE_HIGH>;
label = “astatus_led”;
};
ledb {
gpios = <&gpio0 RK_PC2 GPIO_ACTIVE_HIGH>;
label = “bstatus_led”;
};
};

pinctr:

work-led {
leds_gpio: leds-gpio {
rockchip,pins = < 0 RK_PC0 RK_FUNC_GPIO &pcfg_pull_none>,
< 0 RK_PC1 RK_FUNC_GPIO &pcfg_pull_none>,
< 0 RK_PC2 RK_FUNC_GPIO &pcfg_pull_none>;
};
};

编译设备树

发表评论

邮箱地址不会被公开。 必填项已用*标注