高通msm8909增加GPIO按键

1、根据原理图确定GPIO。

2、在设备树,msm8909-mpt.dtsi文件中找到gpio_keys,增加相关内容:

		scan {
			label = "scan";
			gpios = <&msm_gpio 96 0x1>;//GPIO口选带中断功能的引脚
			linux,input-type = <1>;
			linux,code = <77>; //驱动发出的键盘扫描码
			gpio-key,wakeup;
			debounce-interval = <15>;
		};

 

3、引脚相关配置文件msm8909-pincrtl.dtsi中找到tlmn_gpio_key节,增加gpio相关内容:

tlmm_gpio_key {
			qcom,pins = <&gp 90>, <&gp 91>, <&gp 92>, <&gp 11>,  <&gp 17>,  <&gp 93>,  <&gp 98>, <&gp 96>;//增加GPIO 96
			qcom,pin-func = <0>;
			qcom,num-grp-pins = <8>;//GPIO口数量
			label = "tlmm_gpio_key";
			gpio_key_active: gpio_key_active {
				drive-strength = <2>;
				bias-pull-up;
			};
			gpio_key_suspend: gpio_key_suspend {
				drive-strength = <2>;
				bias-pull-up;
			};
		};

 注意:需要注意 gpio 在其他地方的引用,这个会引起冲突。

4、device\qcom\msm8909\gpio-keys.kl中增加键盘扫描码对应的键盘码

key 115   VOLUME_UP
key 114   VOLUME_DOWN
key 102   HOME
key 528   FOCUS
key 766   CAMERA
key 139   MENU
key 158   BACK
key 77    F7  

F7对应的键盘码为137;

 

查看logcat:

01-01 00:16:01.235  2880  3338 D WindowManager: interceptKeyTq keycode=137 interactive=false keyguardActive=true policyFlags=2000000
01-01 00:16:01.395  2880  3338 D WindowManager: interceptKeyTq keycode=137 interactive=false keyguardActive=true policyFlags=2000000
01-01 00:16:01.465  2880  3338 D WindowManager: interceptKeyTq keycode=137 interactive=false keyguardActive=true policyFlags=2000000
01-01 00:16:01.605  2880  3338 D WindowManager: interceptKeyTq keycode=137 interactive=false keyguardActive=true policyFlags=2000000
01-01 00:16:01.705  2880  3338 D WindowManager: interceptKeyTq keycode=137 interactive=false keyguardActive=true policyFlags=2000000
01-01 00:16:01.825  2880  3338 D WindowManager: interceptKeyTq keycode=137 interactive=false keyguardActive=true policyFlags=2000000
01-01 00:16:01.915  2880  3338 D WindowManager: interceptKeyTq keycode=137 interactive=false keyguardActive=true policyFlags=2000000

你可能感兴趣的:(高通msm8909增加GPIO按键)