贴出异常,运行ts_test,能运行那个tslib自带的画面,首次运行就出现这样的内核警告。
# ts_test
[ 26.815685]
[ 26.817350] ======================================================
[ 26.823636] WARNING: possible circular locking dependency detected
[ 26.829937] 4.14.85-01139-g4bae6b9d2d1e-dirty #48 Not tainted
[ 26.835784] ------------------------------------------------------
[ 26.842073] irq/51-tsc2007/54 is trying to acquire lock:
[ 26.847487] (prepare_lock){+.+.}, at: [<c0496650>] clk_prepare_lock+0x80/0xf4
[ 26.854999]
[ 26.854999] but task is already holding lock:
[ 26.860944] (i2c_register_adapter){+.+.}, at: [<c06959b0>] i2c_adapter_lock_bus+0x20/0x24
[ 26.869480]
[ 26.869480] which lock already depends on the new lock.
[ 26.869480]
[ 26.877791]
[ 26.877791] the existing dependency chain (in reverse order) is:
[ 26.885388]
[ 26.885388] -> #1 (i2c_register_adapter){+.+.}:
[ 26.891686] rt_mutex_lock_nested+0x48/0x60
[ 26.896533] i2c_adapter_lock_bus+0x20/0x24
[ 26.901377] i2c_transfer+0xa8/0xbc
[ 26.905525] pcf8563_read_block_data+0x60/0x94
[ 26.910634] pcf8563_clkout_recalc_rate+0x24/0x4c
[ 26.916004] clk_register+0x31c/0x644
[ 26.920328] devm_clk_register+0x40/0x78
[ 26.924906] pcf8563_probe+0x170/0x244
[ 26.929315] i2c_device_probe+0x258/0x278
[ 26.933984] driver_probe_device+0x214/0x2e8
[ 26.938907] __driver_attach+0xb4/0xb8
[ 26.943307] bus_for_each_dev+0x54/0xa4
[ 26.947793] driver_attach+0x20/0x28
[ 26.952020] bus_add_driver+0x178/0x20c
[ 26.956509] driver_register+0x80/0xfc
[ 26.960917] i2c_register_driver+0x40/0x84
[ 26.965684] pcf8563_driver_init+0x18/0x20
[ 26.970436] do_one_initcall+0x44/0x174
[ 26.974938] kernel_init_freeable+0x120/0x1e0
[ 26.979955] kernel_init+0x10/0x11c
[ 26.984104] ret_from_fork+0x14/0x20
[ 26.988301]
[ 26.988301] -> #0 (prepare_lock){+.+.}:
[ 26.993914] lock_acquire+0x70/0x90
[ 26.998072] __mutex_lock+0x58/0x960
[ 27.002312] mutex_lock_nested+0x24/0x2c
[ 27.006892] clk_prepare_lock+0x80/0xf4
[ 27.011386] clk_core_get_rate+0x14/0x78
[ 27.015964] clk_get_rate+0x1c/0x20
[ 27.020106] i2c_imx_start+0x20/0x1c8
[ 27.024419] i2c_imx_xfer+0x44/0xb24
[ 27.028659] __i2c_transfer+0x138/0x27c
[ 27.033154] i2c_transfer+0x6c/0xbc
[ 27.037306] i2c_smbus_xfer+0x220/0x5cc
[ 27.041806] i2c_smbus_read_word_data+0x38/0x48
[ 27.046997] tsc2007_xfer+0x18/0x54
[ 27.051144] tsc2007_soft_irq+0x80/0x268
[ 27.055728] irq_thread_fn+0x24/0x80
[ 27.059963] irq_thread+0x140/0x1f4
[ 27.064111] kthread+0x14c/0x164
[ 27.068000] ret_from_fork+0x14/0x20
[ 27.072196]
[ 27.072196] other info that might help us debug this:
[ 27.072196]
[ 27.080335] Possible unsafe locking scenario:
[ 27.080335]
[ 27.086366] CPU0 CPU1
[ 27.090992] ---- ----
[ 27.095612] lock(i2c_register_adapter);
[ 27.099792] lock(prepare_lock);
[ 27.105791] lock(i2c_register_adapter);
[ 27.112481] lock(prepare_lock);
[ 27.115962]
[ 27.115962] *** DEADLOCK ***
[ 27.115962]
[ 27.122029] 2 locks held by irq/51-tsc2007/54:
[ 27.126569] #0: (&ts->mlock){+.+.}, at: [<c068a378>] tsc2007_soft_irq+0x54/0x268
[ 27.134426] #1: (i2c_register_adapter){+.+.}, at: [<c06959b0>] i2c_adapter_lock_bus+0x20/0x24
[ 27.143417]
[ 27.143417] stack backtrace:
[ 27.147931] CPU: 0 PID: 54 Comm: irq/51-tsc2007 Not tainted 4.14.85-01139-g4bae6b9d2d1e-dirty #48
[ 27.156914] Hardware name: Freescale i.MX6 Ultralite (Device Tree)
[ 27.163190] Backtrace:
[ 27.165834] [<c010c31c>] (dump_backtrace) from [<c010c5e8>] (show_stack+0x18/0x1c)
[ 27.173554] r7:00000000 r6:60070093 r5:00000000 r4:c0e6c190
[ 27.179374] [<c010c5d0>] (show_stack) from [<c098a9cc>] (dump_stack+0xb4/0xec)
[ 27.186774] [<c098a918>] (dump_stack) from [<c016e26c>] (print_circular_bug.constprop.19+0x1c4/0x2f8)
[ 27.196164] r10:c15cd9e0 r9:ffffffff r8:d8351900 r7:d8351e48 r6:c12bb1e8 r5:c12cfbc8
[ 27.204117] r4:c12bb1e8 r3:00000001
[ 27.207869] [<c016e0a8>] (print_circular_bug.constprop.19) from [<c0171464>] (__lock_acquire+0x18e0/0x1914)
[ 27.217779] r10:d8351900 r9:c12bb1e8 r8:c157a410 r7:00000002 r6:69912d26 r5:d8351e28
[ 27.225731] r4:d8351e48 r3:d8351e28
[ 27.229478] [<c016fb84>] (__lock_acquire) from [<c0171c3c>] (lock_acquire+0x70/0x90)
[ 27.237387] r10:00000002 r9:c15db728 r8:00000001 r7:00000001 r6:60070013 r5:00000000
[ 27.245329] r4:ffffe000
[ 27.248039] [<c0171bcc>] (lock_acquire) from [<c09a1548>] (__mutex_lock+0x58/0x960)
[ 27.255852] r8:ffff9548 r7:c0e04900 r6:00000000 r5:00000000 r4:c0e28d18
[ 27.262740] [<c09a14f0>] (__mutex_lock) from [<c09a1e74>] (mutex_lock_nested+0x24/0x2c)
[ 27.270911] r10:00000002 r9:c15db728 r8:ffff9548 r7:c0e04900 r6:c0e47bcc r5:00000001
[ 27.278854] r4:c15d0924
[ 27.281565] [<c09a1e50>] (mutex_lock_nested) from [<c0496650>] (clk_prepare_lock+0x80/0xf4)
[ 27.290095] [<c04965d0>] (clk_prepare_lock) from [<c0498084>] (clk_core_get_rate+0x14/0x78)
[ 27.298571] r5:00000001 r4:d8016f80
[ 27.302321] [<c0498070>] (clk_core_get_rate) from [<c0498c04>] (clk_get_rate+0x1c/0x20)
[ 27.310452] r5:00000001 r4:d80d5810
[ 27.314201] [<c0498be8>] (clk_get_rate) from [<c069b518>] (i2c_imx_start+0x20/0x1c8)
[ 27.322109] [<c069b4f8>] (i2c_imx_start) from [<c069ba80>] (i2c_imx_xfer+0x44/0xb24)
[ 27.330018] r9:c15db728 r8:ffff9548 r7:c0e04900 r6:d859fdd8 r5:00000001 r4:d80d5810
[ 27.337933] [<c069ba3c>] (i2c_imx_xfer) from [<c06963e0>] (__i2c_transfer+0x138/0x27c)
[ 27.346017] r10:00000002 r9:c15db728 r8:ffff9548 r7:c0e04900 r6:d859fdd8 r5:00000000
[ 27.353959] r4:d80d5810
[ 27.356670] [<c06962a8>] (__i2c_transfer) from [<c0696590>] (i2c_transfer+0x6c/0xbc)
[ 27.364577] r10:00000019 r9:00000048 r8:00000001 r7:00000000 r6:00000002 r5:d859fdd8
[ 27.372531] r4:d80d5810 r3:d8351900
[ 27.376288] [<c0696524>] (i2c_transfer) from [<c06979c4>] (i2c_smbus_xfer+0x220/0x5cc)
[ 27.384353] r7:00000000 r6:00000000 r5:d844c410 r4:d80d5810
[ 27.390198] [<c06977a4>] (i2c_smbus_xfer) from [<c0697ec0>] (i2c_smbus_read_word_data+0x38/0x48)
[ 27.399150] r10:00000019 r9:d8322800 r8:d844c48c r7:00000001 r6:00000000 r5:d844c410
[ 27.407093] r4:d844c410
[ 27.409808] [<c0697e88>] (i2c_smbus_read_word_data) from [<c0689e10>] (tsc2007_xfer+0x18/0x54)
[ 27.418598] [<c0689df8>] (tsc2007_xfer) from [<c068a3a4>] (tsc2007_soft_irq+0x80/0x268)
[ 27.426729] r5:d8125800 r4:d844c410
[ 27.430483] [<c068a324>] (tsc2007_soft_irq) from [<c017eeec>] (irq_thread_fn+0x24/0x80)
[ 27.438653] r10:00000001 r9:d856a980 r8:d8125800 r7:00000001 r6:00000000 r5:d8125800
[ 27.446593] r4:d856a980
[ 27.449301] [<c017eec8>] (irq_thread_fn) from [<c017f208>] (irq_thread+0x140/0x1f4)
[ 27.457104] r7:00000001 r6:00000000 r5:ffffe000 r4:d856a9a4
[ 27.462940] [<c017f0c8>] (irq_thread) from [<c01475e8>] (kthread+0x14c/0x164)
[ 27.470244] r10:d8055c2c r9:c017f0c8 r8:d856a980 r7:d859e000 r6:d856a9c0 r5:d856cf80
[ 27.478182] r4:00000000
[ 27.480889] [<c014749c>] (kthread) from [<c0107eb4>] (ret_from_fork+0x14/0x20)
[ 27.488275] r10:00000000 r9:00000000 r8:00000000 r7:00000000 r6:00000000 r5:c014749c
[ 27.496215] r4:d856a9c0
下面这里触摸可以显示出坐标
30.142003: 515 11 3362
30.169044: 516 12 3420
30.187874: 514 12 3461
30.206580: 514 13 3480
触摸久了会出现
[ 45.424447] tsc2007 1-0048: i2c io error: -6
# cat /proc/interrupts
CPU0
16: 37647 GPC 55 Level i.MX Timer Tick
17: 15772 GPC 13 Level mxs-dma
18: 5078 GPC 15 Level bch
19: 977 GPC 26 Level 2020000.serial
31: 0 GPC 80 Level 20bc000.wdog
37: 0 GPC 19 Level rtc alarm
39: 0 GPC 4 Level 20cc000.snvs:snvs-powerkey
44: 0 GPC 2 Level sdma
45: 0 GPC 36 Level 21a0000.i2c
46: 164887 GPC 37 Level 21a4000.i2c
47: 0 GPC 5 Level mxsfb-drm
51: 6153 gpio-mxc 3 Level tsc2007
IPI0: 0 CPU wakeup interrupts
IPI1: 0 Timer broadcast interrupts
IPI2: 0 Rescheduling interrupts
IPI3: 0 Function call interrupts
IPI4: 0 CPU stop interrupts
IPI5: 2973 IRQ work interrupts
IPI6: 0 completion interrupts
Err: 0
这是dts的配置
i2c2: i2c@021a4000 {
#address-cells = <1>;
#size-cells = <0>;
compatible = "fsl,imx6ul-i2c", "fsl,imx21-i2c";
reg = <0x021a4000 0x4000>;
interrupts = <GIC_SPI 37 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&clks IMX6UL_CLK_I2C2>;
status = "disabled";
};
&i2c2 {
clock_frequency = <400000>;//ckk
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_i2c2>;
status = "okay";
pcf8563@51 {
compatible = "nxp,pcf8563";
reg = <0x51>;
};
touchscreen: touchscreen@48 {
compatible = "ti,tsc2007";
reg = <0x48>;
interrupt-parent = <&gpio1>;
interrupts = <3 8>;
ti,x-plate-ohms = <660>;
};
};
pinctrl_i2c2: i2c2grp {
fsl,pins = <
MX6UL_PAD_CSI_VSYNC__I2C2_SDA 0x4001b8b0
MX6UL_PAD_CSI_HSYNC__I2C2_SCL 0x4001b8b0
MX6UL_PAD_GPIO1_IO02__GPIO1_IO02 0x1b0b0 /* Interrupt */
>;
};
另外我对这个中断的概念完全不懂,希望各位大神可以指点指点..
最近编辑记录 as86455011 (2018-12-12 11:14:06)
离线
首先 PCF8563 工作正常吗? 用来确定硬件, I2C总线配置是否正确.
两个都已经注册了。
内核上显示
[ 2.264915] input: 20cc000.snvs:snvs-powerkey as /devices/soc0/soc/2000000.aips-bus/20cc000.snvs/20cc000.snvs:snvs-powerkey/input/input0
[ 2.283318] tsc2007 1-0048: GPIO not specified in DT (of_get_gpio returned -2)
[ 2.295832] input: TSC2007 Touchscreen as /devices/soc0/soc/2100000.aips-bus/21a4000.i2c/i2c-1/1-0048/input/input1
[ 2.316971] rtc-pcf8563 1-0051: low voltage detected, date/time is not reliable.
[ 2.325783] rtc-pcf8563 1-0051: rtc core: registered rtc-pcf8563 as rtc0
[ 2.338505] snvs_rtc 20cc000.snvs:snvs-rtc-lp: rtc core: registered 20cc000.snvs:snvs-rtc-lp as rtc1
离线
看楼上的错误信息,应该是这里出错:
interrupt-parent = <&gpio1>;
interrupts = <3 8>;
那个信息问题不大。
我上了逻辑仪看到好奇怪的现象,我明明没有按下屏幕,中断引脚自动会拉低。。。
离线
我看了一下手册 的 参考原理图: http://www.ti.com/lit/ds/symlink/tsc2007.pdf
觉得很可能是你的 X-, X+, Y-, Y+ 接错了, 先把电阻屏取下,再用逻辑分析仪测量一下.
没有接错,貌似本来驱动就是这样子。。打开 evtest 后,一直循环发送命令。。
离线
as86455011 说:晕哥 说:我看了一下手册 的 参考原理图: http://www.ti.com/lit/ds/symlink/tsc2007.pdf
觉得很可能是你的 X-, X+, Y-, Y+ 接错了, 先把电阻屏取下,再用逻辑分析仪测量一下.
没有接错,貌似本来驱动就是这样子。。打开 evtest 后,一直循环发送命令。。
取下触摸屏,让 X-, X+, Y-, Y+ 全部悬空呢?
不接屏幕 ,evtest 重复打印
Event: time 238.529936, -------------- SYN_REPORT ------------
Event: time 238.549510, type 3 (EV_ABS), code 0 (ABS_X), value 2218
Event: time 238.549510, type 3 (EV_ABS), code 1 (ABS_Y), value 1609
Event: time 238.549510, -------------- SYN_REPORT ------------
Event: time 238.574793, type 3 (EV_ABS), code 0 (ABS_X), value 2224
Event: time 238.574793, type 3 (EV_ABS), code 1 (ABS_Y), value 1564
Event: time 238.574793, -------------- SYN_REPORT ------------
Event: time 238.599501, type 3 (EV_ABS), code 0 (ABS_X), value 2212
Event: time 238.599501, type 3 (EV_ABS), code 1 (ABS_Y), value 1590
Event: time 238.599501, -------------- SYN_REPORT ------------
Event: time 238.619524, type 3 (EV_ABS), code 0 (ABS_X), va^C_X), value 2214
Event: time 238.783022, type 3 (EV_ABS), code 1 (ABS_Y), value 1614
Event: time 238.783022, type 3 (EV_ABS), code 24 (ABS_PRESSURE), value 3722
Event: time 238.783022, -------------- SYN_REPORT ------------
Event: time 238.806661, type 3 (EV_ABS), code 0 (ABS_X), value 2219
Event: time 238.806661, type 3 (EV_ABS), code 1 (ABS_Y), value 1618
Event: time 238.806661, -------------- SYN_REPORT ------------
Event: time 238.832342, type 3 (EV_ABS), code 0 (ABS_X), value 2212
Event: time 238.832342, type 3 (EV_ABS), code 1 (ABS_Y), value 1588
Event: time 238.832342, type 3 (EV_ABS), code 24 (ABS_PRESSURE), value 3720
Event: time 238.832342, -------------- SYN_REPORT ------------
离线