Platform总线设备驱动未采用设备树的方式之参考:
03_Platform总线设备驱动_猩猩の點燈的博客-CSDN博客
一:设备树下的platform驱动简介
platform驱动框架分为总线,设备和驱动,其中总线不需要我们这些驱动程序员去管理,这个是Linux内核提供的,我们在编写驱动的时候只需要关注设备和驱动的具体实现即可。在以前没有设备树的内核下,我们需要分别编写并注册platform_device和platform_driver。使用设备树的情况下,设备的描述被放到设备树中,因此platform_device就不需要我们去编写了,我们只需要实现platform_driver即可。
1、设备树中创建设备节点
重点是设置好compatible属性的值,因为platform总线需要通过设备节点的compatible属性值来匹配驱动。‘’
gpioled {
#address-cells = <1>;
#size-cells = <1>;
compatible = "my-led";
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_led>;
led-gpio = <&gpio1 3 GPIO_ACTIVE_LOW>;
status = "okay";
};
compatible属性值为“my-led”,因此在p