展讯物理按键配置经验

展讯物理按键配置经验

展讯系统驱动配置物理按键,首先查看硬件原理图,找到对应物理按键的管脚,比如按键5接的是gpio125

1.打开kernel/arch/arm/boot/dts/对应项目的.dts文件
修改gpio_keys下的配置,gpios修改对应的gpio引脚号

1
2
3
4
5
6
7
8
9
10
11
gpio_keys {
key_5 {
label = "5 Key";
linux,code = <6>;
- gpios = <&ap_gpio 92 1>;
+ gpios = <&ap_gpio 125 1>;
gpio-key,wakeup;
gpio-key,level-trigger;
};

}

linux,code对应的就是KEY CODE
gpio-key,wakeup代表按下时如果系统正在休眠会触发唤醒
gpio-key,level-trigger 表示增加电平触发判断

2.打开u-boot15/board/spreadtrum/对应项目的pinmap .c文件

对照平台GPIO_Spec的xls表,找到gpio125对应的Ball Name,修改Fuction为默认gpio功能:BITS_PIN_AF(3)

1
2
{REG_PIN_RTCK_LTE,                      BITS_PIN_AF(3)},
{REG_MISC_PIN_RTCK_LTE, BITS_PIN_DS(1)|BIT_PIN_NULL|BIT_PIN_NUL|BIT_PIN_SLP_AP|BIT_PIN_SLP_NUL|BIT_PIN_SLP_OE},
Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×