问题描述
我无法在Android 5平台上让由Atmel MXT641T驱动的触摸屏正常工作.
I am having troubles getting a touch screen powered by an Atmel MXT641T on an Android 5 platform to work.
我的设置如下:
- 硬件:配备Qualcomm Snapdragon 410 msm8916 ARM64处理器的Inforce 6309 SBC.
- 使用Atmel MXT641T控制器芯片的定制触摸屏.
- Atmel和Snapdragon之间的I2C连接已连接到I2C0.
- 使用Linux内核3.10的
- Android 5操作系统,来自
git://codeaurora.org/kernel/msm-3.10.git
分支Rel_V1.3
(这是SBC随附的BSP)... - ...但是使用最新版本的Atmel驱动程序
atmel_mxt_ts.c
覆盖在内核树上(但也已在atmel_maxtouch_ts.c
版本中进行了测试> msm-3.10.git 表示相同的行为). 来自Atmel芯片的 - INT线连接到GPIO 53(这是此板的
EXT_CONN_GPIO_1
),并带有外部上拉电阻至1.8V. - Atmel芯片的RESET线已断开.
- Hardware: Inforce 6309 SBC with Qualcomm Snapdragon 410 msm8916 ARM64 processor.
- Custom touch screen with Atmel MXT641T controller chip.
- I2C connection between Atmel and Snapdragon connected to I2C0.
- Android 5 operating system using Linux kernel 3.10 from
git://codeaurora.org/kernel/msm-3.10.git
branchRel_V1.3
(this is part of the BSP that comes with the SBC)... - ... but with the latest version of the Atmel driver
atmel_mxt_ts.c
overlaid on the kernel tree (but also tested with version ofatmel_maxtouch_ts.c
inmsm-3.10.git
which shows same behaviour). - INT line from Atmel chip connected to GPIO 53 (this is
EXT_CONN_GPIO_1
of this board) and with external pull-up resistor to 1.8V. - RESET line from Atmel chip disconnected.
到目前为止,我要做的就是修改设备树以包含Atmel设备,如下所示:
What I did to get to this point is to modify the device tree to include the Atmel device as follows:
&i2c_0 {
atmel_maxtouch_ts@4a {
compatible = "atmel,maxtouch";
reg = <0x4a>;
interrupt-parent = <&msm_gpio>;
interrupts = <53 0>;
atmel,panel-coords = <0 0 1024 768>;
atmel,display-coords = <0 0 1024 768>;
atmel,family-id = <164>;
atmel,variant-id = <2>;
atmel,version = <21>;
atmel,build = <0xaa>;
};
};
作为参考, msm_gpio
在BSP中的定义如下(未修改).
For reference, the msm_gpio
is defined as follows in the BSP (untouched).
&soc {
tlmm_pinmux: pinctrl@1000000 {
compatible = "qcom,msm-tlmm-8916";
reg = <0x1000000 0x300000>;
interrupts = <0 208 0>;
/*General purpose pins*/
gp: gp {
qcom,num-pins = <122>;
#qcom,pin-cells = <1>;
msm_gpio: msm_gpio {
compatible = "qcom,msm-tlmm-gp";
gpio-controller;
#gpio-cells = <2>;
interrupt-controller;
#interrupt-cells = <2>;
num_irqs = <122>;
};
};
我将内核编译为模块( CONFIG_TOUCHSCREEN_ATMEL_MXT = m
),并且正在手动运行 insmod
.
I compiled the kernel as a module (CONFIG_TOUCHSCREEN_ATMEL_MXT=m
) and I am running insmod
manually.
我看到的是以下内容:
- 使用Atmel实用程序
mxt-app
时,设备可以正常工作:当我触摸屏幕消息时,表明I2C连接正常(但它使用轮询). - 在加载驱动程序时,将调用
mxt_start
,其中启用了中断.我在驱动程序中添加了许多调试语句,以验证驱动程序是否正在实际加载. - 加载驱动程序时,将从设备读取信息块,并在示波器上显示简短的I2C流量.I2C地址是从设备树中读取的,因此我确定设备树已加载.
- 输入设备已注册为
/dev/input/event6
,并且可以使用cat
打开(但触摸屏幕时不会出现任何消息). - 该中断在
/proc/interrupts
中可见,但从不触发(见下文). - 每当我触摸屏幕时,Atmel芯片的INT线都会被该芯片拉低,但是在示波器上看不到I2C流量.
- 我已验证中断触发条件(
0x0
,0x8
或0x2008
作为设备树中中断单元中的第二个元素)是否确实手动造成中断线上的高低无关紧要:在任何情况下都不会触发中断.
- When using the Atmel utility
mxt-app
the device works: when I touch the screen messages come in, so the I2C connection is ok (but it uses polling). - When loading the driver
mxt_start
is called, in which the interrupt is enabled. I have added a number of debug statements to the driver to verify that it is actually loading. - When loading the driver the info block is read from the device and brief I2C traffic shows on the oscilloscope. The I2C address is read from the device tree so I am sure that my device tree is loaded.
- The input device is registered as
/dev/input/event6
and can be opened withcat
(but no messages appear when touching the screen). - The interrupt is visible in
/proc/interrupts
but never fires (see below). - Whenever I touch the screen, the INT line from the Atmel chip is pulled low by the chip, but no I2C traffic is visible on the oscilloscope.
- I verified that the interrupt triggering condition (
0x0
,0x8
or0x2008
as second element in the interrupt cell in the device tree) does not matter by manually causing highs and lows on the interrupt line: no interrupt is triggered in any event.
/proc/interrupts
中的条目:
$ cat /proc/interrupts
...
326: 0 0 0 0 msm_tlmm_irq maxtouch
...
这是 dmesg
中出现的内容:
<6>[ 55.290620] atmel_mxt_ts 0-004a: Family: 164 Variant: 2 Firmware V1.5.AA Objects: 43
<4>[ 55.291252] atmel_mxt_ts 0-004a: Enabling RETRIGEN workaround
<6>[ 55.365918] atmel_mxt_ts 0-004a: Touchscreen size X1024Y768
<6>[ 55.367017] input: Atmel maXTouch Touchscreen as /devices/soc.0/78b6000.i2c/i2c-0/0-004a/input/input6
通过阅读 atmel_mxt_ts.c
中的驱动程序代码,我了解到,驱动程序应在此中断线上触发,然后通过启动I2C传输以读取T5消息来查询设备.设备将返回触摸列表,然后将触摸列表传递给操作系统.我没有找到能正确解释这一问题的数据表或文档,但这是基于我到目前为止所看到的内容.
What I understand from reading the driver code in atmel_mxt_ts.c
is that the driver should trigger on this interrupt line, and then query the device by starting an I2C transfer to read the T5 message, upon which the device will return a list of touches which are then passed on to the operating system. I have not found a datasheet or document properly explaining this, but this is what I suspect based on what I have seen so far.
我已通过以下操作手动测试了GPIO引脚53(通常将Atmel芯片的INT线连接到该引脚):
I have tested the GPIO pin 53 (to which I normally connect the INT line of the Atmel chip) manually by doing the following:
$ echo 955 > /sys/class/gpio/export # 955 because EXP_CONN_GPIO_1 is GPIO pin 53, which has offset 902
cat /sys/class/gpio/gpio955/value
当我将INT线连接到V +或接地时,此值会更改,因此,我确定必须使用GPIO 53.
This value changes when I connect the INT line to V+ or ground, so I am sure that I have to use GPIO 53.
在/sys/kernel/debug/gpio
中没有显示用于maxtouch驱动程序的GPIO:
No GPIO for the maxtouch driver is shown in /sys/kernel/debug/gpio
:
$ cat /sys/kernel/debug/gpio
GPIOs 576-607, platform/qcom,smp2pgpio-ssr-smp2p-4-out.19, master-kernel:
GPIOs 608-639, platform/qcom,smp2pgpio-ssr-smp2p-4-in.18, slave-kernel:
GPIOs 640-671, platform/qcom,smp2pgpio-ssr-smp2p-1-out.13, master-kernel:
GPIOs 672-703, platform/qcom,smp2pgpio-ssr-smp2p-1-in.12, slave-kernel:
GPIOs 704-735, platform/qcom,smp2pgpio-smp2p-4-out.16, smp2p:
GPIOs 736-767, platform/qcom,smp2pgpio-smp2p-4-in.14, smp2p:
GPIOs 768-799, platform/qcom,smp2pgpio-smp2p-1-out.10, smp2p:
GPIOs 800-831, platform/qcom,smp2pgpio-smp2p-1-in.8, smp2p:
GPIOs 832-863, platform/qcom,smp2pgpio-smp2p-7-out.6, smp2p:
GPIOs 864-895, platform/qcom,smp2pgpio-smp2p-7-in.4, smp2p:
GPIOs 896-899, spmi/qpnp-pin-ffffffc031550c00, pm8916-gpio:
gpio-898 (qcom,hub-reset-gpio ) out hi
gpio-899 (qcom,sw-sel-gpio ) in lo
GPIOs 900-901, spmi/qpnp-pin-ffffffc031550800, pm8916-mpp:
GPIOs 902-1023, platform/1000000.pinctrl, msm_tlmm_gpio:
gpio-922 (adv7533_hpd_irq_gpio) in lo
gpio-923 (led1 ) out lo
gpio-927 (disp_rst_n ) in hi
gpio-933 (adv7533_irq_gpio ) in hi
gpio-934 (hdmi_lvds ) in lo
gpio-940 (7864900.sdhci cd ) in hi
gpio-1009 (volume_up ) in hi
gpio-1010 (camera_focus ) in hi
gpio-1011 (camera_snapshot ) in hi
gpio-1022 (led2 ) out lo
gpio-1023 (USB_ID_GPIO ) in hi
我提出了一些具体的问题来帮助解决这个难题:
I phrased some specific questions to help solve the puzzle:
- 注册中断的正确方法是什么?我正在使用
interrupt-parent =<& msm_gpio> ;;
和interrupts =< 53 0>
来标识Snapdragon的GPIO引脚53.我同时测试了< 53 0>
和< 53 8>
. - 我有时会看到人们使用
0x2008
作为单元格中的第二个条目.我认为0x0008
是将中断设置为在LOW电平上触发,但是第13位有什么作用?我用0x0
和0x8
进行了测试,都没有什么不同(但:-)). - 我应该在
/sys/kernel/debug/gpio
中输入一个条目吗? - 在设备树中是否需要将maxtouch中断连接到物理引脚的其他条目?
-
/proc/interrupts
中的IRQ编号326
是从哪里来的,有没有办法验证它链接到哪个引脚? - 是否可以将INT线配置为由Snapdragon上拉,而不需要使用外部上拉电阻?
- What is the correct way to register the interrupt? I am using
interrupt-parent = <&msm_gpio>;
andinterrupts = <53 0>
to identify the GPIO pin 53 of the Snapdragon. I tested with both<53 0>
and<53 8>
. - I sometimes see people use
0x2008
as second entry in the cell. I think the0x0008
is to set the interrupt to trigger on LOW level, but what does the 13-th bit do? I tested with both0x0
and0x8
, does not make a difference (yet :-)). - Should I expect an entry in
/sys/kernel/debug/gpio
? - Are any additional entries in the device tree needed to hook up the maxtouch interrupt to the physical pin?
- Where does the IRQ number
326
in/proc/interrupts
come from, and is there a way to verify what pin it is linked to? - Is it possible to configure that the INT line will be pulled up by the Snapdragon, instead of having to use an external pull-up resistor?
预先感谢您的帮助.
PS:还有一个与切线相关的问题:我如何快速测试设备树的更新,而不必等待20分钟即可加载所有Makefile,而内核也可以重新编译,然后刷新新的 boot.img
到设备并重新启动?我使用命令 make bootimage
.
PS: And a tangentially related question: how can I quickly test updates of the device tree without having to wait 20 minutes for all Makefiles to load and the kernel to recompile and then flash the new boot.img
to the device and reboot? I use the command make bootimage
.
推荐答案
在发现设备树中已经有或多或少可以使用的触摸屏定义,但是引脚不同之后,我得出了以下设备树:
After finding out that there is already a more or less working touchscreen definition in the device tree but that the pins are different, I ended up with the following device tree:
&i2c_0 {
atmel_maxtouch_ts@4a {
compatible = "atmel,maxtouch";
reg = <0x4a>;
interrupt-parent = <&msm_gpio>;
interrupts = <53 0x2008>;
pinctrl-names = "pmx_ts_active","pmx_ts_suspend","pmx_ts_suspend";
pinctrl-0 = <&ts_int_active &ts_reset_active>;
pinctrl-1 = <&ts_int_suspend &ts_reset_suspend>;
pinctrl-2 = <&ts_release>;
atmel,irq-gpio = <&msm_gpio 53 0x2008>;
atmel,reset-gpio = <&msm_gpio 54 0>;
atmel,panel-coords = <0 0 800 480>;
atmel,display-coords = <0 0 800 480>;
atmel,family-id = <164>;
atmel,variant-id = <2>;
atmel,version = <21>;
atmel,build = <0xaa>;
};
};
因此,以下几行不同:
interrupts = <53 0x2008>;
pinctrl-names = "pmx_ts_active","pmx_ts_suspend","pmx_ts_suspend";
pinctrl-0 = <&ts_int_active &ts_reset_active>;
pinctrl-1 = <&ts_int_suspend &ts_reset_suspend>;
pinctrl-2 = <&ts_release>;
atmel,irq-gpio = <&msm_gpio 53 0x2008>;
atmel,reset-gpio = <&msm_gpio 54 0>;
需要0x2008才能使Snapdragon拉起中断线并在下降沿触发.
The 0x2008 is needed to make the Snapdragon pull up this interrupt line and trigger on the falling edge.
pinctrl定义已经位于BSP随附的 qcom/msm8916-pinctrl.dtsi
中,但是,对于我而言,我不得不将12针更改为54并将13针更改为53:/p>
The pinctrl definitions were already located in qcom/msm8916-pinctrl.dtsi
that comes with the BSP, however, for my case I had to change pin 12 to 54 and pin 13 to 53:
diff --git a/arch/arm/boot/dts/qcom/msm8916-pinctrl.dtsi b/arch/arm/boot/dts/qcom/msm8916-pinctrl.dtsi
index 204c718..80a2a6d 100644
--- a/arch/arm/boot/dts/qcom/msm8916-pinctrl.dtsi
+++ b/arch/arm/boot/dts/qcom/msm8916-pinctrl.dtsi
@@ -30,16 +30,6 @@
};
};
- atmel-int-pin {
- qcom,pins = <&gp 53>;
- qcom,num-grp-pins = <1>;
- label = "atmel-int-pin";
- default {
- drive-strength = <0>;
- bias-pull-up;
- };
- };
-
ext-cdc-tlmm-lines {
qcom,pins = <&gp 116>, <&gp 112>, <&gp 117>,
<&gp 118>, <&gp 119>;
@@ -1175,7 +1165,7 @@
/* add pingrp for touchscreen */
pmx_ts_int_active {
- qcom,pins = <&gp 13>;
+ qcom,pins = <&gp 53>;
qcom,pin-func = <0>;
qcom,num-grp-pins = <1>;
label = "pmx_ts_int_active";
@@ -1187,7 +1177,7 @@
};
pmx_ts_int_suspend {
- qcom,pins = <&gp 13>;
+ qcom,pins = <&gp 53>;
qcom,pin-func = <0>;
qcom,num-grp-pins = <1>;
label = "pmx_ts_int_suspend";
@@ -1199,7 +1189,7 @@
};
pmx_ts_reset_active {
- qcom,pins = <&gp 12>;
+ qcom,pins = <&gp 54>;
qcom,pin-func = <0>;
qcom,num-grp-pins = <1>;
label = "pmx_ts_reset_active";
@@ -1211,7 +1201,7 @@
};
pmx_ts_reset_suspend {
- qcom,pins = <&gp 12>;
+ qcom,pins = <&gp 54>;
qcom,pin-func = <0>;
qcom,num-grp-pins = <1>;
label = "pmx_ts_reset_suspend";
@@ -1223,7 +1213,7 @@
};
pmx_ts_release {
- qcom,pins = <&gp 13>, <&gp 12>;
+ qcom,pins = <&gp 53>, <&gp 54>;
qcom,num-grp-pins = <2>;
label = "pmx_ts_release";
这篇关于如何在Android 5内核设备树中正确配置Atmel MXT641T触摸芯片的INT线中断?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!