Symbol: w8001
drivers/input/touchscreen/wacom_w8001.c
138
static void scale_touch_coordinates(struct w8001 *w8001,
drivers/input/touchscreen/wacom_w8001.c
141
if (w8001->max_pen_x && w8001->max_touch_x)
drivers/input/touchscreen/wacom_w8001.c
142
*x = *x * w8001->max_pen_x / w8001->max_touch_x;
drivers/input/touchscreen/wacom_w8001.c
144
if (w8001->max_pen_y && w8001->max_touch_y)
drivers/input/touchscreen/wacom_w8001.c
145
*y = *y * w8001->max_pen_y / w8001->max_touch_y;
drivers/input/touchscreen/wacom_w8001.c
148
static void parse_multi_touch(struct w8001 *w8001)
drivers/input/touchscreen/wacom_w8001.c
150
struct input_dev *dev = w8001->touch_dev;
drivers/input/touchscreen/wacom_w8001.c
151
unsigned char *data = w8001->data;
drivers/input/touchscreen/wacom_w8001.c
167
scale_touch_coordinates(w8001, &x, &y);
drivers/input/touchscreen/wacom_w8001.c
179
if (w8001->type != BTN_TOOL_PEN &&
drivers/input/touchscreen/wacom_w8001.c
180
w8001->type != BTN_TOOL_RUBBER) {
drivers/input/touchscreen/wacom_w8001.c
181
w8001->type = count == 1 ? BTN_TOOL_FINGER : KEY_RESERVED;
drivers/input/touchscreen/wacom_w8001.c
214
static void report_pen_events(struct w8001 *w8001, struct w8001_coord *coord)
drivers/input/touchscreen/wacom_w8001.c
216
struct input_dev *dev = w8001->pen_dev;
drivers/input/touchscreen/wacom_w8001.c
228
switch (w8001->type) {
drivers/input/touchscreen/wacom_w8001.c
237
w8001->type = BTN_TOOL_PEN;
drivers/input/touchscreen/wacom_w8001.c
243
w8001->type = coord->f2 ? BTN_TOOL_RUBBER : BTN_TOOL_PEN;
drivers/input/touchscreen/wacom_w8001.c
256
input_report_key(dev, w8001->type, coord->rdy);
drivers/input/touchscreen/wacom_w8001.c
260
w8001->type = KEY_RESERVED;
drivers/input/touchscreen/wacom_w8001.c
263
static void report_single_touch(struct w8001 *w8001, struct w8001_coord *coord)
drivers/input/touchscreen/wacom_w8001.c
265
struct input_dev *dev = w8001->touch_dev;
drivers/input/touchscreen/wacom_w8001.c
270
scale_touch_coordinates(w8001, &x, &y);
drivers/input/touchscreen/wacom_w8001.c
278
w8001->type = coord->tsw ? BTN_TOOL_FINGER : KEY_RESERVED;
drivers/input/touchscreen/wacom_w8001.c
284
struct w8001 *w8001 = serio_get_drvdata(serio);
drivers/input/touchscreen/wacom_w8001.c
288
w8001->data[w8001->idx] = data;
drivers/input/touchscreen/wacom_w8001.c
289
switch (w8001->idx++) {
drivers/input/touchscreen/wacom_w8001.c
293
w8001->idx = 0;
drivers/input/touchscreen/wacom_w8001.c
299
tmp = w8001->data[0] & W8001_TOUCH_BYTE;
drivers/input/touchscreen/wacom_w8001.c
303
if (w8001->pktlen == w8001->idx) {
drivers/input/touchscreen/wacom_w8001.c
304
w8001->idx = 0;
drivers/input/touchscreen/wacom_w8001.c
305
if (w8001->type != BTN_TOOL_PEN &&
drivers/input/touchscreen/wacom_w8001.c
306
w8001->type != BTN_TOOL_RUBBER) {
drivers/input/touchscreen/wacom_w8001.c
307
parse_single_touch(w8001->data, &coord);
drivers/input/touchscreen/wacom_w8001.c
308
report_single_touch(w8001, &coord);
drivers/input/touchscreen/wacom_w8001.c
315
tmp = w8001->data[0] & W8001_TAB_MASK;
drivers/input/touchscreen/wacom_w8001.c
319
tmp = w8001->data[0] & W8001_TOUCH_BYTE;
drivers/input/touchscreen/wacom_w8001.c
323
w8001->idx = 0;
drivers/input/touchscreen/wacom_w8001.c
324
parse_pen_data(w8001->data, &coord);
drivers/input/touchscreen/wacom_w8001.c
325
report_pen_events(w8001, &coord);
drivers/input/touchscreen/wacom_w8001.c
330
tmp = w8001->data[0] & W8001_TOUCH_MASK;
drivers/input/touchscreen/wacom_w8001.c
334
w8001->idx = 0;
drivers/input/touchscreen/wacom_w8001.c
335
memcpy(w8001->response, w8001->data, W8001_MAX_LENGTH);
drivers/input/touchscreen/wacom_w8001.c
336
w8001->response_type = W8001_QUERY_PACKET;
drivers/input/touchscreen/wacom_w8001.c
337
complete(&w8001->cmd_done);
drivers/input/touchscreen/wacom_w8001.c
342
w8001->idx = 0;
drivers/input/touchscreen/wacom_w8001.c
343
parse_multi_touch(w8001);
drivers/input/touchscreen/wacom_w8001.c
352
if (!w8001->touch_dev && w8001->idx > W8001_PKTLEN_TPCPEN - 1)
drivers/input/touchscreen/wacom_w8001.c
353
w8001->idx = 0;
drivers/input/touchscreen/wacom_w8001.c
359
static int w8001_command(struct w8001 *w8001, unsigned char command,
drivers/input/touchscreen/wacom_w8001.c
364
w8001->response_type = 0;
drivers/input/touchscreen/wacom_w8001.c
365
init_completion(&w8001->cmd_done);
drivers/input/touchscreen/wacom_w8001.c
367
rc = serio_write(w8001->serio, command);
drivers/input/touchscreen/wacom_w8001.c
370
wait_for_completion_timeout(&w8001->cmd_done, HZ);
drivers/input/touchscreen/wacom_w8001.c
371
if (w8001->response_type != W8001_QUERY_PACKET)
drivers/input/touchscreen/wacom_w8001.c
380
struct w8001 *w8001 = input_get_drvdata(dev);
drivers/input/touchscreen/wacom_w8001.c
383
scoped_guard(mutex_intr, &w8001->mutex) {
drivers/input/touchscreen/wacom_w8001.c
384
if (w8001->open_count == 0) {
drivers/input/touchscreen/wacom_w8001.c
385
err = w8001_command(w8001, W8001_CMD_START, false);
drivers/input/touchscreen/wacom_w8001.c
390
w8001->open_count++;
drivers/input/touchscreen/wacom_w8001.c
399
struct w8001 *w8001 = input_get_drvdata(dev);
drivers/input/touchscreen/wacom_w8001.c
401
guard(mutex)(&w8001->mutex);
drivers/input/touchscreen/wacom_w8001.c
403
if (--w8001->open_count == 0)
drivers/input/touchscreen/wacom_w8001.c
404
w8001_command(w8001, W8001_CMD_STOP, false);
drivers/input/touchscreen/wacom_w8001.c
407
static int w8001_detect(struct w8001 *w8001)
drivers/input/touchscreen/wacom_w8001.c
411
error = w8001_command(w8001, W8001_CMD_STOP, false);
drivers/input/touchscreen/wacom_w8001.c
420
static int w8001_setup_pen(struct w8001 *w8001, char *basename,
drivers/input/touchscreen/wacom_w8001.c
423
struct input_dev *dev = w8001->pen_dev;
drivers/input/touchscreen/wacom_w8001.c
428
error = w8001_command(w8001, W8001_CMD_QUERY, true);
drivers/input/touchscreen/wacom_w8001.c
441
parse_pen_data(w8001->response, &coord);
drivers/input/touchscreen/wacom_w8001.c
442
w8001->max_pen_x = coord.x;
drivers/input/touchscreen/wacom_w8001.c
443
w8001->max_pen_y = coord.y;
drivers/input/touchscreen/wacom_w8001.c
455
w8001->id = 0x90;
drivers/input/touchscreen/wacom_w8001.c
461
static int w8001_setup_touch(struct w8001 *w8001, char *basename,
drivers/input/touchscreen/wacom_w8001.c
464
struct input_dev *dev = w8001->touch_dev;
drivers/input/touchscreen/wacom_w8001.c
470
error = w8001_command(w8001, W8001_CMD_TOUCHQUERY, true);
drivers/input/touchscreen/wacom_w8001.c
477
if (!w8001->response[1])
drivers/input/touchscreen/wacom_w8001.c
485
parse_touchquery(w8001->response, &touch);
drivers/input/touchscreen/wacom_w8001.c
486
w8001->max_touch_x = touch.x;
drivers/input/touchscreen/wacom_w8001.c
487
w8001->max_touch_y = touch.y;
drivers/input/touchscreen/wacom_w8001.c
489
if (w8001->max_pen_x && w8001->max_pen_y) {
drivers/input/touchscreen/wacom_w8001.c
491
touch.x = w8001->max_pen_x;
drivers/input/touchscreen/wacom_w8001.c
492
touch.y = w8001->max_pen_y;
drivers/input/touchscreen/wacom_w8001.c
504
w8001->pktlen = W8001_PKTLEN_TOUCH93;
drivers/input/touchscreen/wacom_w8001.c
505
w8001->id = 0x93;
drivers/input/touchscreen/wacom_w8001.c
512
w8001->pktlen = W8001_PKTLEN_TOUCH9A;
drivers/input/touchscreen/wacom_w8001.c
514
w8001->id = 0x9a;
drivers/input/touchscreen/wacom_w8001.c
518
w8001->pktlen = W8001_PKTLEN_TOUCH2FG;
drivers/input/touchscreen/wacom_w8001.c
523
dev_err(&w8001->serio->dev,
drivers/input/touchscreen/wacom_w8001.c
538
if (w8001->max_pen_x && w8001->max_pen_y)
drivers/input/touchscreen/wacom_w8001.c
539
w8001->id = 0xE3;
drivers/input/touchscreen/wacom_w8001.c
541
w8001->id = 0xE2;
drivers/input/touchscreen/wacom_w8001.c
550
static void w8001_set_devdata(struct input_dev *dev, struct w8001 *w8001,
drivers/input/touchscreen/wacom_w8001.c
553
dev->phys = w8001->phys;
drivers/input/touchscreen/wacom_w8001.c
555
dev->id.product = w8001->id;
drivers/input/touchscreen/wacom_w8001.c
563
input_set_drvdata(dev, w8001);
drivers/input/touchscreen/wacom_w8001.c
572
struct w8001 *w8001 = serio_get_drvdata(serio);
drivers/input/touchscreen/wacom_w8001.c
576
if (w8001->pen_dev)
drivers/input/touchscreen/wacom_w8001.c
577
input_unregister_device(w8001->pen_dev);
drivers/input/touchscreen/wacom_w8001.c
578
if (w8001->touch_dev)
drivers/input/touchscreen/wacom_w8001.c
579
input_unregister_device(w8001->touch_dev);
drivers/input/touchscreen/wacom_w8001.c
580
kfree(w8001);
drivers/input/touchscreen/wacom_w8001.c
593
struct w8001 *w8001;
drivers/input/touchscreen/wacom_w8001.c
599
w8001 = kzalloc_obj(*w8001);
drivers/input/touchscreen/wacom_w8001.c
602
if (!w8001 || !input_dev_pen || !input_dev_touch) {
drivers/input/touchscreen/wacom_w8001.c
607
w8001->serio = serio;
drivers/input/touchscreen/wacom_w8001.c
608
w8001->pen_dev = input_dev_pen;
drivers/input/touchscreen/wacom_w8001.c
609
w8001->touch_dev = input_dev_touch;
drivers/input/touchscreen/wacom_w8001.c
610
mutex_init(&w8001->mutex);
drivers/input/touchscreen/wacom_w8001.c
611
init_completion(&w8001->cmd_done);
drivers/input/touchscreen/wacom_w8001.c
612
snprintf(w8001->phys, sizeof(w8001->phys), "%s/input0", serio->phys);
drivers/input/touchscreen/wacom_w8001.c
614
serio_set_drvdata(serio, w8001);
drivers/input/touchscreen/wacom_w8001.c
619
err = w8001_detect(w8001);
drivers/input/touchscreen/wacom_w8001.c
626
err_pen = w8001_setup_pen(w8001, basename, sizeof(basename));
drivers/input/touchscreen/wacom_w8001.c
627
err_touch = w8001_setup_touch(w8001, basename, sizeof(basename));
drivers/input/touchscreen/wacom_w8001.c
634
snprintf(w8001->pen_name, sizeof(w8001->pen_name),
drivers/input/touchscreen/wacom_w8001.c
636
input_dev_pen->name = w8001->pen_name;
drivers/input/touchscreen/wacom_w8001.c
638
w8001_set_devdata(input_dev_pen, w8001, serio);
drivers/input/touchscreen/wacom_w8001.c
640
err = input_register_device(w8001->pen_dev);
drivers/input/touchscreen/wacom_w8001.c
646
w8001->pen_dev = NULL;
drivers/input/touchscreen/wacom_w8001.c
650
snprintf(w8001->touch_name, sizeof(w8001->touch_name),
drivers/input/touchscreen/wacom_w8001.c
652
input_dev_touch->name = w8001->touch_name;
drivers/input/touchscreen/wacom_w8001.c
654
w8001_set_devdata(input_dev_touch, w8001, serio);
drivers/input/touchscreen/wacom_w8001.c
656
err = input_register_device(w8001->touch_dev);
drivers/input/touchscreen/wacom_w8001.c
662
w8001->touch_dev = NULL;
drivers/input/touchscreen/wacom_w8001.c
668
if (w8001->pen_dev)
drivers/input/touchscreen/wacom_w8001.c
669
input_unregister_device(w8001->pen_dev);
drivers/input/touchscreen/wacom_w8001.c
677
kfree(w8001);