Navigation

    全志在线开发者论坛

    • Register
    • Login
    • Search
    • Categories
    • Tags
    • 在线文档
    • 社区主页

    【FAQ】全志R329在dtbo中如何配置gpio?

    其它全志芯片讨论区
    r329 faq 技术支持
    1
    1
    1361
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • q1215200171
      budbool LV 9 last edited by

      问题背景

      客户同一款产品,一供模拟功放和二供模拟功放使用不同的PIN脚来使能PA,客户想在dtbo中根据硬件版本类型配置不同的pin脚。但是在dtbo中根据dts的方法配置的时候会报syntax error。如当时按以下方法配置成PM8的情况,会提示syntax error

      &codec_ex {
        gpio-spk = <&r_pio PM 8 1 1 1 1>;
      };
      

      问题分析

      在dts中,如果要使用gpio.h中定义的pin脚,那么可以直接用#include <dt-bindings/gpio/gpio.h>这句话把gpio.h头文件包含之后就可以使用里面定义的宏了。但dtbo的语法不支持这种include的方式,也不支持直接在dtbo中定义宏的方式,因此要配置PM8这个pin时,不能写PM这个符号,只能写PM实际定义的数字。所有pin定义的数字定义在lichee/linux-4.9/include/dt-bindings/gpio/gpio.h,如下所示:

      /* sunxi gpio arg */
      #define  PA  0
      #define  PB  1
      #define  PC  2
      #define  PD  3
      #define  PE  4
      #define  PF  5
      #define  PG  6
      #define  PH  7
      #define  PI  8
      #define  PJ  9
      #define  PK  10
      #define  PL  11
      #define  PM  12
      #define  PN  13
      #define  PO  14
      #define  PP  15
      #define  default 0xffffffff
      

      解决方法

      在device/config/chips/r329/configs/xxx/dtbo/xxx.dts中根据实际要配置的pin脚加入以下代码,如配置使能脚为PM8,则根据lichee/linux-4.9/include/dt-bindings/gpio/gpio.h中的宏定义把PM改成12,改动如下:

      &codec_ex {
        gpio-spk = <&r_pio 12 8 1 1 1 1>;
      };
      
      1 Reply Last reply Reply Quote Share 0
      • Referenced by  q1215200171 q1215200171 
      • Referenced by  q1215200171 q1215200171 
      • Referenced by  q1215200171 q1215200171 
      • Referenced by  q1215200171 q1215200171 
      • Referenced by  q1215200171 q1215200171 
      • 1 / 1
      • First post
        Last post

      Copyright © 2024 深圳全志在线有限公司 粤ICP备2021084185号 粤公网安备44030502007680号

      行为准则 | 用户协议 | 隐私权政策