linux内核如何为gpio 扩展芯片驱动添加设备节点?


1. 关注属性gpio-hog

   GPIO hogging is a mechanism providing automatic GPIO request and configuration as part of the gpio-controller's driver probe function.(gpio-hog是一种提供自动gpio资源申请并且配置为gpio控制器驱动探测函数的一部分的机制)
2. 举例
    pca9554:pca9554@20 {
  compatible = "nxp,pca9554";
  reg=<0x20>;
    gpio-controller;
  #gpio-cells=<2>;
  interrupt-controller;
  #interrupt-cells = <2>;
  interrupt-parent = <&gpio3>;
  interrupts = <28 IRQ_TYPE_NONE>;

      P00 {
    gpio-hog;
    gpios = <0 GPIO_ACTIVE_LOW>;
    output-high;
    line-name = "led_normal";
  }
    }
3. 如何引用pca9554节点?
  displayport {
        dp.aux_sw_oe = <&pca9554 4 GPIO_ACTIVE_HIGH>
        dp.sbu_sw_sel = <&pca9554 1 GPIO_ACTIVE_HIGH>
    }; 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM