核心代码如下,内核报错内容晚点贴上,这么写看起来应该没啥问题吧
input = devm_input_allocate_device(dev);
if (!input)
return -ENOMEM;
ts_data->input_dev = input;
input->name = client->name;
input->id.bustype = BUS_I2C;
set_bit(EV_ABS, input->evbit);
set_bit(EV_KEY, input->evbit);
set_bit(BTN_TOUCH, input->keybit);
input_set_abs_params(ts_data->input_dev, ABS_X,
0, 240, 0, 0);
input_set_abs_params(ts_data->input_dev, ABS_Y,
0, 280, 0, 0);
input_set_abs_params(ts_data->input_dev, ABS_PRESSURE,
0, 1, 0, 0);
err = input_register_device(input);
if (err) {
dev_err(dev, "failed to register input device: %d\n", err);
return err;
}
static void cst3xx_touch_report1(struct work_struct *work)
{
u8 buf[5];
struct delayed_work *dw =
container_of(work, struct delayed_work, work);
struct hynitron_ts_data *ts_data =
container_of(dw, struct hynitron_ts_data, poll_work);
if( touch_flag ){
touch_flag = 0;
// int err = cst3xx_i2c_read_register(ts_data->client, 0x02,
// buf, 5);
// if ( err ){
// dev_err(&ts_data->client->dev, "cst3xx touch read failure %d\n",err);
// }
// printk("touch data is 0x%2x 0x%2x 0x%2x 0x%2x\r\n",buf[1],buf[2],buf[3],buf[4]);
cst3xx_touch_report(ts_data->client);
}
schedule_delayed_work(&ts_data->poll_work,
msecs_to_jiffies(80));
}
INIT_DELAYED_WORK(&ts_data->poll_work, cst3xx_touch_report1);
//INIT_DELAYED_WORK(&poll_work, hyn_interrupt_handler);
schedule_delayed_work(&ts_data->poll_work,
msecs_to_jiffies(80));
input_report_abs(ts_data->input_dev,ABS_X, 10);
input_report_abs(ts_data->input_dev,ABS_Y, 10);
input_report_abs(ts_data->input_dev,ABS_PRESSURE, 1);
input_report_key(ts_data->input_dev,BTN_TOUCH,1);
// //input_mt_sync_frame(ts_data->input_dev);
input_sync(ts_data->input_dev);
input_report_abs(ts_data->input_dev,ABS_PRESSURE, 0);
input_report_key(ts_data->input_dev,BTN_TOUCH,0);
input_sync(ts_data->input_dev);
离线
内核报错
root@TinaLinux:/# [ 837.170196] hyn_probe twi3
[ 837.173363] hyn_probe test 8 98
[ 837.257179] i2c_lock_bus
[ 837.260569] i2c_unlock_bus
[ 837.263799] hyn Chip id b5 ProjID 0 FW Version 1 FactoryID 4
[ 837.270840] input: cst340 as /devices/platform/soc/twi3/i2c-3/3-0015/input/in put1
[ 837.279573] hyn_probe test 11 98
[ 837.365597] i2c_lock_bus
[ 837.369022] i2c_unlock_bus
[ 837.372251] touch data is x 0 y 0
[ 837.376105] ------------[ cut here ]------------
[ 837.381290] WARNING: CPU: 0 PID: 366 at kernel/workqueue.c:1534 __queue_delay ed_work+0x80/0x14c
[ 837.391025] Modules linked in: hynitron_cstxxx vin_v4l2 gc2053_mipi vin_io vi deobuf2_v4l2 videobuf2_dma_contig videobuf2_memops videobuf2_core xradio_wlan xr adio_core xradio_mac
[ 837.408791] CPU: 0 PID: 366 Comm: kworker/0:1 Not tainted 4.9.191 #99
[ 837.415993] Hardware name: sun8iw21
[ 837.419905] Workqueue: events cst3xx_touch_report1 [hynitron_cstxxx]
[ 837.427037] [<c010d5a0>] (unwind_backtrace) from [<c010a694>] (show_stack+0x1 0/0x14)
[ 837.435716] [<c010a694>] (show_stack) from [<c0118904>] (__warn+0xc8/0xf8)
[ 837.443415] [<c0118904>] (__warn) from [<c01189d8>] (warn_slowpath_null+0x1c/ 0x24)
[ 837.451894] [<c01189d8>] (warn_slowpath_null) from [<c012cd28>] (__queue_dela yed_work+0x80/0x14c)
[ 837.461827] [<c012cd28>] (__queue_delayed_work) from [<c012ce2c>] (queue_dela yed_work_on+0x38/0x44)
[ 837.471959] [<c012ce2c>] (queue_delayed_work_on) from [<c012cb2c>] (process_o ne_work+0x1dc/0x318)
[ 837.481890] [<c012cb2c>] (process_one_work) from [<c012d81c>] (worker_thread+ 0x318/0x464)
[ 837.491050] [<c012d81c>] (worker_thread) from [<c0131d64>] (kthread+0xcc/0xe4 )
[ 837.499134] [<c0131d64>] (kthread) from [<c0106e08>] (ret_from_fork+0x14/0x2c )
[ 837.507218] ---[ end trace 2ca1c3d30aa0844a ]---
[ 837.512379] ------------[ cut here ]------------
[ 837.517545] WARNING: CPU: 0 PID: 366 at kernel/workqueue.c:1536 __queue_delay ed_work+0xe4/0x14c
[ 837.527278] Modules linked in: hynitron_cstxxx vin_v4l2 gc2053_mipi vin_io vi deobuf2_v4l2 videobuf2_dma_contig videobuf2_memops videobuf2_core xradio_wlan xr adio_core xradio_mac
[ 837.545036] CPU: 0 PID: 366 Comm: kworker/0:1 Tainted: G W 4.9.1 91 #99
[ 837.553597] Hardware name: sun8iw21
[ 837.557501] Workqueue: events cst3xx_touch_report1 [hynitron_cstxxx]
[ 837.564619] [<c010d5a0>] (unwind_backtrace) from [<c010a694>] (show_stack+0x1 0/0x14)
[ 837.573293] [<c010a694>] (show_stack) from [<c0118904>] (__warn+0xc8/0xf8)
[ 837.580989] [<c0118904>] (__warn) from [<c01189d8>] (warn_slowpath_null+0x1c/ 0x24)
[ 837.589468] [<c01189d8>] (warn_slowpath_null) from [<c012cd8c>] (__queue_dela yed_work+0xe4/0x14c)
[ 837.599400] [<c012cd8c>] (__queue_delayed_work) from [<c012ce2c>] (queue_dela yed_work_on+0x38/0x44)
[ 837.609532] [<c012ce2c>] (queue_delayed_work_on) from [<c012cb2c>] (process_o ne_work+0x1dc/0x318)
[ 837.619463] [<c012cb2c>] (process_one_work) from [<c012d81c>] (worker_thread+ 0x318/0x464)
[ 837.628621] [<c012d81c>] (worker_thread) from [<c0131d64>] (kthread+0xcc/0xe4 )
[ 837.636704] [<c0131d64>] (kthread) from [<c0106e08>] (ret_from_fork+0x14/0x2c )
[ 837.644781] ---[ end trace 2ca1c3d30aa0844b ]---
[ 837.649955] ------------[ cut here ]------------
[ 837.655119] kernel BUG at kernel/time/timer.c:973!
[ 837.660474] Internal error: Oops - BUG: 0 [#1] PREEMPT ARM
[ 837.666610] Modules linked in: hynitron_cstxxx vin_v4l2 gc2053_mipi vin_io vi deobuf2_v4l2 videobuf2_dma_contig videobuf2_memops videobuf2_core xradio_wlan xr adio_core xradio_mac
[ 837.684366] CPU: 0 PID: 366 Comm: kworker/0:1 Tainted: G W 4.9.1 91 #99
[ 837.692927] Hardware name: sun8iw21
[ 837.696832] Workqueue: events cst3xx_touch_report1 [hynitron_cstxxx]
[ 837.703940] task: c36d2f00 task.stack: c3686000
[ 837.709008] PC is at mod_timer+0xc/0x26c
[ 837.713393] LR is at queue_delayed_work_on+0x38/0x44
[ 837.718949] pc : [<c01556e0>] lr : [<c012ce2c>] psr: 60000093
[ 837.718949] sp : c3687f08 ip : 00000000 fp : c373b318
[ 837.731789] r10: c0a12980 r9 : 00000000 r8 : c0a0daf4
[ 837.737635] r7 : c3b3b100 r6 : c205b181 r5 : 60000093 r4 : 60000013
[ 837.744938] r3 : 00000000 r2 : 00000000 r1 : 0000d1f1 r0 : c205bd10
[ 837.752244] Flags: nZCv IRQs off FIQs on Mode SVC_32 ISA ARM Segment non e
[ 837.760321] Control: 10c5387d Table: 42244059 DAC: 00000051
[ 837.766746] Process kworker/0:1 (pid: 366, stack limit = 0xc3686208)
[ 837.773852] Stack: (0xc3687f08 to 0xc3688000)
[ 837.778727] 7f00: c373b300 c205bda8 00000000 c012cb2c c373b 300 c205bda8
[ 837.787884] 7f20: c373b300 c0a0daf4 c0a0daf4 c3686000 ffffe000 c0a0db08 c0a12 980 c012d81c
[ 837.797040] 7f40: c373b300 40000013 c36d2f00 c3787400 00000000 c373b300 c012d 504 00000000
[ 837.806191] 7f60: 00000000 00000000 00000000 c0131d64 c3687f94 00000000 00000 000 c373b300
[ 837.815348] 7f80: 00000000 c3687f84 c3687f84 00000000 c3687f90 c3687f90 c3787 400 c3787400
[ 837.824503] 7fa0: c0131c98 00000000 00000000 c0106e08 00000000 00000000 00000 000 00000000
[ 837.833653] 7fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000 000 00000000
[ 837.842808] 7fe0: 00000000 00000000 00000000 00000000 00000013 00000000 00000 000 00000000
[ 837.851968] [<c01556e0>] (mod_timer) from [<c3686000>] (0xc3686000)
[ 837.858986] Code: c0a11880 e590300c e3530000 1a000000 (e7f001f2)
[ 837.865802] ---[ end trace 2ca1c3d30aa0844c ]---
[ 837.871282] Unable to handle kernel paging request at virtual address fffffff 0
[ 837.879362] pgd = c0004000
[ 837.882385] [fffffff0] *pgd=43bfd861, *pte=00000000, *ppte=00000000
[ 837.889410] Internal error: Oops: 37 [#2] PREEMPT ARM
[ 837.895056] Modules linked in: hynitron_cstxxx vin_v4l2 gc2053_mipi vin_io vi deobuf2_v4l2 videobuf2_dma_contig videobuf2_memops videobuf2_core xradio_wlan xr adio_core xradio_mac
[ 837.912816] CPU: 0 PID: 366 Comm: kworker/0:1 Tainted: G D W 4.9.1 91 #99
[ 837.921377] Hardware name: sun8iw21
[ 837.925281] task: c36d2f00 task.stack: c3686000
[ 837.930349] PC is at kthread_data+0x4/0xc
[ 837.934834] LR is at wq_worker_sleeping+0x8/0xb4
[ 837.939997] pc : [<c01327b0>] lr : [<c012dc98>] psr: 00000093
[ 837.939997] sp : c3687d98 ip : 00000000 fp : c3687dc4
[ 837.952831] r10: 00000000 r9 : c36d30cc r8 : c36d3158
[ 837.958672] r7 : 00000000 r6 : c0a0e4b0 r5 : ffffe000 r4 : c36d2f00
[ 837.965967] r3 : 00000000 r2 : 0004a73b r1 : 00000001 r0 : c36d2f00
[ 837.973267] Flags: nzcv IRQs off FIQs on Mode SVC_32 ISA ARM Segment non e
[ 837.981345] Control: 10c5387d Table: 42244059 DAC: 00000051
[ 837.987769] Process kworker/0:1 (pid: 366, stack limit = 0xc3686208)
[ 837.994874] Stack: (0xc3687d98 to 0xc3688000)
[ 837.999746] 7d80: c36d2 f00 c06575f0
[ 838.008898] 7da0: c36d2f00 c01197a4 c36d2f00 c3687bf0 c3444000 c3687dd8 00000 000 c36d30cc
[ 838.018049] 7dc0: c3687dcc c0137330 c373b318 c011a098 0000000b 00000001 c3687 dd8 c3687dd8
[ 838.027200] 7de0: 0000000b 60000093 c373b318 c010a8b4 c3686208 0000000b e7f00 1f2 c3687eb8
[ 838.036351] 7e00: c01556e0 00000000 60000093 c010b0b8 c3686000 c01010a4 00000 006 00000024
[ 838.045502] 7e20: 00000004 00000000 00030001 c01556e0 00000000 00000000 00000 000 00000000
[ 838.054653] 7e40: c0a4ad56 00000024 00000000 00000000 60000093 c0106e08 00000 000 c3687eac
[ 838.063804] 7e60: c0145968 00000000 00000009 c012cd8c 00000600 c0a12980 c373b 318 c0145984
[ 838.072956] 7e80: c07b2747 c3687eac 00000000 c01707d4 c07b2747 c3687eac 0aa08 44b 00000000
[ 838.082107] 7ea0: c01556e4 00000000 c010b558 00000000 e7100000 c010b0b8 c205b d10 0000d1f1
[ 838.091258] 7ec0: 00000000 00000000 60000013 60000093 c205b181 c3b3b100 c0a0d af4 00000000
[ 838.100409] 7ee0: c0a12980 c373b318 00000000 c3687f08 c012ce2c c01556e0 60000 093 ffffffff
[ 838.109560] 7f00: 00000051 00000000 c373b300 c205bda8 00000000 c012cb2c c373b 300 c205bda8
[ 838.118712] 7f20: c373b300 c0a0daf4 c0a0daf4 c3686000 ffffe000 c0a0db08 c0a12 980 c012d81c
[ 838.127863] 7f40: c373b300 40000013 c36d2f00 c3787400 00000000 c373b300 c012d 504 00000000
[ 838.137014] 7f60: 00000000 00000000 00000000 c0131d64 c3687f94 00000000 00000 000 c373b300
[ 838.146165] 7f80: 00000000 c3687f84 c3687f84 00000001 c3687f90 c3687f90 c3787 400 c3787400
[ 838.155315] 7fa0: c0131c98 00000000 00000000 c0106e08 00000000 00000000 00000 000 00000000
[ 838.164465] 7fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000 000 00000000
[ 838.173616] 7fe0: 00000000 00000000 00000000 00000000 00000013 00000000 00000 000 00000000
[ 838.182775] [<c01327b0>] (kthread_data) from [<c012dc98>] (wq_worker_sleeping +0x8/0xb4)
[ 838.191736] [<c012dc98>] (wq_worker_sleeping) from [<c06575f0>] (__schedule+0 xdc/0x3d0)
[ 838.200698] [<c06575f0>] (__schedule) from [<c0137330>] (do_task_dead+0x40/0x 48)
[ 838.208980] [<c0137330>] (do_task_dead) from [<c011a098>] (do_exit+0x8d4/0x90 c)
[ 838.217166] [<c011a098>] (do_exit) from [<c010a8b4>] (die+0x21c/0x254)
[ 838.224474] [<c010a8b4>] (die) from [<c01010a4>] (do_undefinstr+0xa0/0x1f4)
[ 838.232260] [<c01010a4>] (do_undefinstr) from [<c010b0b8>] (__und_svc_finish+ 0x0/0x48)
[ 838.241115] Exception stack(0xc3687eb8 to 0xc3687f00)
[ 838.246763] 7ea0: c205b d10 0000d1f1
[ 838.255908] 7ec0: 00000000 00000000 60000013 60000093 c205b181 c3b3b100 c0a0d af4 00000000
[ 838.265053] 7ee0: c0a12980 c373b318 00000000 c3687f08 c012ce2c c01556e0 60000 093 ffffffff
[ 838.274202] [<c010b0b8>] (__und_svc_finish) from [<c01556e0>] (mod_timer+0xc/ 0x26c)
[ 838.282771] [<c01556e0>] (mod_timer) from [<c3686000>] (0xc3686000)
[ 838.289784] Code: eaffffed e3e00025 e8bd8070 e5903224 (e5130010)
[ 838.296599] ---[ end trace 2ca1c3d30aa0844d ]---
[ 838.301760] Fixing recursive fault but reboot is needed!
[ 838.307705] Unable to handle kernel paging request at virtual address fffffff 0
[ 838.315781] pgd = c0004000
[ 838.318802] [fffffff0] *pgd=43bfd861, *pte=00000000, *ppte=00000000
[ 838.325825] Internal error: Oops: 37 [#3] PREEMPT ARM
[ 838.331471] Modules linked in: hynitron_cstxxx vin_v4l2 gc2053_mipi vin_io vi deobuf2_v4l2 videobuf2_dma_contig videobuf2_memops videobuf2_core xradio_wlan xr adio_core xradio_mac
[ 838.349227] CPU: 0 PID: 366 Comm: kworker/0:1 Tainted: G D W 4.9.1 91 #99
[ 838.357788] Hardware name: sun8iw21
[ 838.361691] task: c36d2f00 task.stack: c3686000
[ 838.366755] PC is at kthread_data+0x4/0xc
[ 838.371238] LR is at wq_worker_sleeping+0x8/0xb4
[ 838.376401] pc : [<c01327b0>] lr : [<c012dc98>] psr: 00000193
[ 838.376401] sp : c3687be0 ip : 00000000 fp : c3687c0c
[ 838.389242] r10: 00000037 r9 : c07b0695 r8 : c36d3158
[ 838.395083] r7 : 00000000 r6 : c0a0e4b0 r5 : c3686000 r4 : c36d2f00
[ 838.402383] r3 : 00000000 r2 : 0004a73b r1 : 00000001 r0 : c36d2f00
[ 838.409682] Flags: nzcv IRQs off FIQs on Mode SVC_32 ISA ARM Segment non e
[ 838.417760] Control: 10c5387d Table: 42244059 DAC: 00000051
[ 838.424184] Process kworker/0:1 (pid: 366, stack limit = 0xc3686208)
[ 838.431289] Stack: (0xc3687be0 to 0xc3688000)
[ 838.436163] 7be0: c36d2f00 c06575f0 c07b28eb c3687c14 c3686000 0000000b c3686 000 60000193
[ 838.445315] 7c00: bf000000 c07b0695 c3687c1c c0657990 c36d2f00 0000000b c3687 dc4 c01198c4
离线