diff options
Diffstat (limited to 'drivers/input/tablet')
-rw-r--r-- | drivers/input/tablet/wacom_sys.c | 58 | ||||
-rw-r--r-- | drivers/input/tablet/wacom_wac.c | 66 | ||||
-rw-r--r-- | drivers/input/tablet/wacom_wac.h | 10 |
3 files changed, 78 insertions, 56 deletions
diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c index be4b76f264a..f22b88d03c6 100644 --- a/drivers/input/tablet/wacom_sys.c +++ b/drivers/input/tablet/wacom_sys.c | |||
@@ -211,7 +211,8 @@ void input_dev_g(struct input_dev *input_dev, struct wacom_wac *wacom_wac) | |||
211 | input_dev->keybit[BIT_WORD(BTN_DIGI)] |= BIT_MASK(BTN_TOOL_RUBBER) | | 211 | input_dev->keybit[BIT_WORD(BTN_DIGI)] |= BIT_MASK(BTN_TOOL_RUBBER) | |
212 | BIT_MASK(BTN_TOOL_PEN) | BIT_MASK(BTN_STYLUS) | | 212 | BIT_MASK(BTN_TOOL_PEN) | BIT_MASK(BTN_STYLUS) | |
213 | BIT_MASK(BTN_TOOL_MOUSE) | BIT_MASK(BTN_STYLUS2); | 213 | BIT_MASK(BTN_TOOL_MOUSE) | BIT_MASK(BTN_STYLUS2); |
214 | input_set_abs_params(input_dev, ABS_DISTANCE, 0, wacom_wac->features->distance_max, 0, 0); | 214 | input_set_abs_params(input_dev, ABS_DISTANCE, |
215 | 0, wacom_wac->features.distance_max, 0, 0); | ||
215 | } | 216 | } |
216 | 217 | ||
217 | void input_dev_i3s(struct input_dev *input_dev, struct wacom_wac *wacom_wac) | 218 | void input_dev_i3s(struct input_dev *input_dev, struct wacom_wac *wacom_wac) |
@@ -261,7 +262,8 @@ void input_dev_i(struct input_dev *input_dev, struct wacom_wac *wacom_wac) | |||
261 | BIT_MASK(BTN_TOOL_MOUSE) | BIT_MASK(BTN_TOOL_BRUSH) | | 262 | BIT_MASK(BTN_TOOL_MOUSE) | BIT_MASK(BTN_TOOL_BRUSH) | |
262 | BIT_MASK(BTN_TOOL_PENCIL) | BIT_MASK(BTN_TOOL_AIRBRUSH) | | 263 | BIT_MASK(BTN_TOOL_PENCIL) | BIT_MASK(BTN_TOOL_AIRBRUSH) | |
263 | BIT_MASK(BTN_TOOL_LENS) | BIT_MASK(BTN_STYLUS2); | 264 | BIT_MASK(BTN_TOOL_LENS) | BIT_MASK(BTN_STYLUS2); |
264 | input_set_abs_params(input_dev, ABS_DISTANCE, 0, wacom_wac->features->distance_max, 0, 0); | 265 | input_set_abs_params(input_dev, ABS_DISTANCE, |
266 | 0, wacom_wac->features.distance_max, 0, 0); | ||
265 | input_set_abs_params(input_dev, ABS_WHEEL, 0, 1023, 0, 0); | 267 | input_set_abs_params(input_dev, ABS_WHEEL, 0, 1023, 0, 0); |
266 | input_set_abs_params(input_dev, ABS_TILT_X, 0, 127, 0, 0); | 268 | input_set_abs_params(input_dev, ABS_TILT_X, 0, 127, 0, 0); |
267 | input_set_abs_params(input_dev, ABS_TILT_Y, 0, 127, 0, 0); | 269 | input_set_abs_params(input_dev, ABS_TILT_Y, 0, 127, 0, 0); |
@@ -282,17 +284,19 @@ void input_dev_pt(struct input_dev *input_dev, struct wacom_wac *wacom_wac) | |||
282 | 284 | ||
283 | void input_dev_tpc(struct input_dev *input_dev, struct wacom_wac *wacom_wac) | 285 | void input_dev_tpc(struct input_dev *input_dev, struct wacom_wac *wacom_wac) |
284 | { | 286 | { |
285 | if (wacom_wac->features->device_type == BTN_TOOL_DOUBLETAP || | 287 | struct wacom_features *features = &wacom_wac->features; |
286 | wacom_wac->features->device_type == BTN_TOOL_TRIPLETAP) { | 288 | |
287 | input_set_abs_params(input_dev, ABS_RX, 0, wacom_wac->features->x_phy, 0, 0); | 289 | if (features->device_type == BTN_TOOL_DOUBLETAP || |
288 | input_set_abs_params(input_dev, ABS_RY, 0, wacom_wac->features->y_phy, 0, 0); | 290 | features->device_type == BTN_TOOL_TRIPLETAP) { |
289 | input_dev->keybit[BIT_WORD(BTN_DIGI)] |= BIT_MASK(BTN_TOOL_DOUBLETAP); | 291 | input_set_abs_params(input_dev, ABS_RX, 0, features->x_phy, 0, 0); |
292 | input_set_abs_params(input_dev, ABS_RY, 0, features->y_phy, 0, 0); | ||
293 | __set_bit(BTN_TOOL_DOUBLETAP, input_dev->keybit); | ||
290 | } | 294 | } |
291 | } | 295 | } |
292 | 296 | ||
293 | void input_dev_tpc2fg(struct input_dev *input_dev, struct wacom_wac *wacom_wac) | 297 | void input_dev_tpc2fg(struct input_dev *input_dev, struct wacom_wac *wacom_wac) |
294 | { | 298 | { |
295 | if (wacom_wac->features->device_type == BTN_TOOL_TRIPLETAP) { | 299 | if (wacom_wac->features.device_type == BTN_TOOL_TRIPLETAP) { |
296 | input_dev->keybit[BIT_WORD(BTN_DIGI)] |= BIT_MASK(BTN_TOOL_TRIPLETAP); | 300 | input_dev->keybit[BIT_WORD(BTN_DIGI)] |= BIT_MASK(BTN_TOOL_TRIPLETAP); |
297 | input_dev->evbit[0] |= BIT_MASK(EV_MSC); | 301 | input_dev->evbit[0] |= BIT_MASK(EV_MSC); |
298 | input_dev->mscbit[0] |= BIT_MASK(MSC_SERIAL); | 302 | input_dev->mscbit[0] |= BIT_MASK(MSC_SERIAL); |
@@ -530,26 +534,40 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i | |||
530 | struct usb_endpoint_descriptor *endpoint; | 534 | struct usb_endpoint_descriptor *endpoint; |
531 | struct wacom *wacom; | 535 | struct wacom *wacom; |
532 | struct wacom_wac *wacom_wac; | 536 | struct wacom_wac *wacom_wac; |
533 | struct wacom_features *features = (void *)id->driver_info; | 537 | struct wacom_features *features; |
534 | struct input_dev *input_dev; | 538 | struct input_dev *input_dev; |
535 | int error = -ENOMEM; | 539 | int error; |
536 | 540 | ||
537 | if (!features) | 541 | if (!id->driver_info) |
538 | return -EINVAL; | 542 | return -EINVAL; |
539 | 543 | ||
540 | wacom = kzalloc(sizeof(struct wacom), GFP_KERNEL); | 544 | wacom = kzalloc(sizeof(struct wacom), GFP_KERNEL); |
541 | wacom_wac = kzalloc(sizeof(struct wacom_wac), GFP_KERNEL); | 545 | wacom_wac = kzalloc(sizeof(struct wacom_wac), GFP_KERNEL); |
542 | input_dev = input_allocate_device(); | 546 | input_dev = input_allocate_device(); |
543 | if (!wacom || !input_dev || !wacom_wac) | 547 | if (!wacom || !input_dev || !wacom_wac) { |
548 | error = -ENOMEM; | ||
549 | goto fail1; | ||
550 | } | ||
551 | |||
552 | wacom_wac->features = *((struct wacom_features *)id->driver_info); | ||
553 | features = &wacom_wac->features; | ||
554 | if (features->pktlen > WACOM_PKGLEN_MAX) { | ||
555 | error = -EINVAL; | ||
544 | goto fail1; | 556 | goto fail1; |
557 | } | ||
545 | 558 | ||
546 | wacom_wac->data = usb_buffer_alloc(dev, WACOM_PKGLEN_MAX, GFP_KERNEL, &wacom->data_dma); | 559 | wacom_wac->data = usb_buffer_alloc(dev, WACOM_PKGLEN_MAX, |
547 | if (!wacom_wac->data) | 560 | GFP_KERNEL, &wacom->data_dma); |
561 | if (!wacom_wac->data) { | ||
562 | error = -ENOMEM; | ||
548 | goto fail1; | 563 | goto fail1; |
564 | } | ||
549 | 565 | ||
550 | wacom->irq = usb_alloc_urb(0, GFP_KERNEL); | 566 | wacom->irq = usb_alloc_urb(0, GFP_KERNEL); |
551 | if (!wacom->irq) | 567 | if (!wacom->irq) { |
568 | error = -ENOMEM; | ||
552 | goto fail2; | 569 | goto fail2; |
570 | } | ||
553 | 571 | ||
554 | wacom->usbdev = dev; | 572 | wacom->usbdev = dev; |
555 | wacom->dev = input_dev; | 573 | wacom->dev = input_dev; |
@@ -558,11 +576,6 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i | |||
558 | usb_make_path(dev, wacom->phys, sizeof(wacom->phys)); | 576 | usb_make_path(dev, wacom->phys, sizeof(wacom->phys)); |
559 | strlcat(wacom->phys, "/input0", sizeof(wacom->phys)); | 577 | strlcat(wacom->phys, "/input0", sizeof(wacom->phys)); |
560 | 578 | ||
561 | wacom_wac->features = features; | ||
562 | BUG_ON(features->pktlen > WACOM_PKGLEN_MAX); | ||
563 | |||
564 | input_dev->name = wacom_wac->features->name; | ||
565 | wacom->wacom_wac = wacom_wac; | ||
566 | usb_to_input_id(dev, &input_dev->id); | 579 | usb_to_input_id(dev, &input_dev->id); |
567 | 580 | ||
568 | input_dev->dev.parent = &intf->dev; | 581 | input_dev->dev.parent = &intf->dev; |
@@ -579,6 +592,9 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i | |||
579 | if (error) | 592 | if (error) |
580 | goto fail2; | 593 | goto fail2; |
581 | 594 | ||
595 | input_dev->name = features->name; | ||
596 | wacom->wacom_wac = wacom_wac; | ||
597 | |||
582 | input_dev->evbit[0] |= BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS); | 598 | input_dev->evbit[0] |= BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS); |
583 | input_dev->keybit[BIT_WORD(BTN_DIGI)] |= BIT_MASK(BTN_TOUCH); | 599 | input_dev->keybit[BIT_WORD(BTN_DIGI)] |= BIT_MASK(BTN_TOUCH); |
584 | 600 | ||
@@ -643,7 +659,7 @@ static int wacom_suspend(struct usb_interface *intf, pm_message_t message) | |||
643 | static int wacom_resume(struct usb_interface *intf) | 659 | static int wacom_resume(struct usb_interface *intf) |
644 | { | 660 | { |
645 | struct wacom *wacom = usb_get_intfdata(intf); | 661 | struct wacom *wacom = usb_get_intfdata(intf); |
646 | struct wacom_features *features = wacom->wacom_wac->features; | 662 | struct wacom_features *features = &wacom->wacom_wac->features; |
647 | int rv; | 663 | int rv; |
648 | 664 | ||
649 | mutex_lock(&wacom->lock); | 665 | mutex_lock(&wacom->lock); |
diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c index 56aaf0164a5..e4a1a7dcd9a 100644 --- a/drivers/input/tablet/wacom_wac.c +++ b/drivers/input/tablet/wacom_wac.c | |||
@@ -55,6 +55,7 @@ static int wacom_penpartner_irq(struct wacom_wac *wacom, void *wcombo) | |||
55 | 55 | ||
56 | static int wacom_pl_irq(struct wacom_wac *wacom, void *wcombo) | 56 | static int wacom_pl_irq(struct wacom_wac *wacom, void *wcombo) |
57 | { | 57 | { |
58 | struct wacom_features *features = &wacom->features; | ||
58 | unsigned char *data = wacom->data; | 59 | unsigned char *data = wacom->data; |
59 | int prox, pressure; | 60 | int prox, pressure; |
60 | 61 | ||
@@ -68,9 +69,9 @@ static int wacom_pl_irq(struct wacom_wac *wacom, void *wcombo) | |||
68 | if (prox) { | 69 | if (prox) { |
69 | wacom->id[0] = ERASER_DEVICE_ID; | 70 | wacom->id[0] = ERASER_DEVICE_ID; |
70 | pressure = (signed char)((data[7] << 1) | ((data[4] >> 2) & 1)); | 71 | pressure = (signed char)((data[7] << 1) | ((data[4] >> 2) & 1)); |
71 | if (wacom->features->pressure_max > 255) | 72 | if (features->pressure_max > 255) |
72 | pressure = (pressure << 1) | ((data[4] >> 6) & 1); | 73 | pressure = (pressure << 1) | ((data[4] >> 6) & 1); |
73 | pressure += (wacom->features->pressure_max + 1) / 2; | 74 | pressure += (features->pressure_max + 1) / 2; |
74 | 75 | ||
75 | /* | 76 | /* |
76 | * if going from out of proximity into proximity select between the eraser | 77 | * if going from out of proximity into proximity select between the eraser |
@@ -152,6 +153,7 @@ static int wacom_ptu_irq(struct wacom_wac *wacom, void *wcombo) | |||
152 | 153 | ||
153 | static int wacom_graphire_irq(struct wacom_wac *wacom, void *wcombo) | 154 | static int wacom_graphire_irq(struct wacom_wac *wacom, void *wcombo) |
154 | { | 155 | { |
156 | struct wacom_features *features = &wacom->features; | ||
155 | unsigned char *data = wacom->data; | 157 | unsigned char *data = wacom->data; |
156 | int x, y, rw; | 158 | int x, y, rw; |
157 | static int penData = 0; | 159 | static int penData = 0; |
@@ -179,8 +181,7 @@ static int wacom_graphire_irq(struct wacom_wac *wacom, void *wcombo) | |||
179 | 181 | ||
180 | case 2: /* Mouse with wheel */ | 182 | case 2: /* Mouse with wheel */ |
181 | wacom_report_key(wcombo, BTN_MIDDLE, data[1] & 0x04); | 183 | wacom_report_key(wcombo, BTN_MIDDLE, data[1] & 0x04); |
182 | if (wacom->features->type == WACOM_G4 || | 184 | if (features->type == WACOM_G4 || features->type == WACOM_MO) { |
183 | wacom->features->type == WACOM_MO) { | ||
184 | rw = data[7] & 0x04 ? (data[7] & 0x03)-4 : (data[7] & 0x03); | 185 | rw = data[7] & 0x04 ? (data[7] & 0x03)-4 : (data[7] & 0x03); |
185 | wacom_report_rel(wcombo, REL_WHEEL, -rw); | 186 | wacom_report_rel(wcombo, REL_WHEEL, -rw); |
186 | } else | 187 | } else |
@@ -192,8 +193,7 @@ static int wacom_graphire_irq(struct wacom_wac *wacom, void *wcombo) | |||
192 | wacom->id[0] = CURSOR_DEVICE_ID; | 193 | wacom->id[0] = CURSOR_DEVICE_ID; |
193 | wacom_report_key(wcombo, BTN_LEFT, data[1] & 0x01); | 194 | wacom_report_key(wcombo, BTN_LEFT, data[1] & 0x01); |
194 | wacom_report_key(wcombo, BTN_RIGHT, data[1] & 0x02); | 195 | wacom_report_key(wcombo, BTN_RIGHT, data[1] & 0x02); |
195 | if (wacom->features->type == WACOM_G4 || | 196 | if (features->type == WACOM_G4 || features->type == WACOM_MO) |
196 | wacom->features->type == WACOM_MO) | ||
197 | wacom_report_abs(wcombo, ABS_DISTANCE, data[6] & 0x3f); | 197 | wacom_report_abs(wcombo, ABS_DISTANCE, data[6] & 0x3f); |
198 | else | 198 | else |
199 | wacom_report_abs(wcombo, ABS_DISTANCE, data[7] & 0x3f); | 199 | wacom_report_abs(wcombo, ABS_DISTANCE, data[7] & 0x3f); |
@@ -230,7 +230,7 @@ static int wacom_graphire_irq(struct wacom_wac *wacom, void *wcombo) | |||
230 | } | 230 | } |
231 | 231 | ||
232 | /* send pad data */ | 232 | /* send pad data */ |
233 | switch (wacom->features->type) { | 233 | switch (features->type) { |
234 | case WACOM_G4: | 234 | case WACOM_G4: |
235 | if (data[7] & 0xf8) { | 235 | if (data[7] & 0xf8) { |
236 | if (penData) { | 236 | if (penData) { |
@@ -300,11 +300,12 @@ static int wacom_graphire_irq(struct wacom_wac *wacom, void *wcombo) | |||
300 | 300 | ||
301 | static int wacom_intuos_inout(struct wacom_wac *wacom, void *wcombo) | 301 | static int wacom_intuos_inout(struct wacom_wac *wacom, void *wcombo) |
302 | { | 302 | { |
303 | struct wacom_features *features = &wacom->features; | ||
303 | unsigned char *data = wacom->data; | 304 | unsigned char *data = wacom->data; |
304 | int idx = 0; | 305 | int idx = 0; |
305 | 306 | ||
306 | /* tool number */ | 307 | /* tool number */ |
307 | if (wacom->features->type == INTUOS) | 308 | if (features->type == INTUOS) |
308 | idx = data[1] & 0x01; | 309 | idx = data[1] & 0x01; |
309 | 310 | ||
310 | /* Enter report */ | 311 | /* Enter report */ |
@@ -402,7 +403,7 @@ static int wacom_intuos_inout(struct wacom_wac *wacom, void *wcombo) | |||
402 | wacom_report_key(wcombo, BTN_STYLUS2, 0); | 403 | wacom_report_key(wcombo, BTN_STYLUS2, 0); |
403 | wacom_report_key(wcombo, BTN_TOUCH, 0); | 404 | wacom_report_key(wcombo, BTN_TOUCH, 0); |
404 | wacom_report_abs(wcombo, ABS_WHEEL, 0); | 405 | wacom_report_abs(wcombo, ABS_WHEEL, 0); |
405 | if (wacom->features->type >= INTUOS3S) | 406 | if (features->type >= INTUOS3S) |
406 | wacom_report_abs(wcombo, ABS_Z, 0); | 407 | wacom_report_abs(wcombo, ABS_Z, 0); |
407 | } | 408 | } |
408 | wacom_report_key(wcombo, wacom->tool[idx], 0); | 409 | wacom_report_key(wcombo, wacom->tool[idx], 0); |
@@ -416,13 +417,14 @@ static int wacom_intuos_inout(struct wacom_wac *wacom, void *wcombo) | |||
416 | 417 | ||
417 | static void wacom_intuos_general(struct wacom_wac *wacom, void *wcombo) | 418 | static void wacom_intuos_general(struct wacom_wac *wacom, void *wcombo) |
418 | { | 419 | { |
420 | struct wacom_features *features = &wacom->features; | ||
419 | unsigned char *data = wacom->data; | 421 | unsigned char *data = wacom->data; |
420 | unsigned int t; | 422 | unsigned int t; |
421 | 423 | ||
422 | /* general pen packet */ | 424 | /* general pen packet */ |
423 | if ((data[1] & 0xb8) == 0xa0) { | 425 | if ((data[1] & 0xb8) == 0xa0) { |
424 | t = (data[6] << 2) | ((data[7] >> 6) & 3); | 426 | t = (data[6] << 2) | ((data[7] >> 6) & 3); |
425 | if (wacom->features->type >= INTUOS4S && wacom->features->type <= INTUOS4L) | 427 | if (features->type >= INTUOS4S && features->type <= INTUOS4L) |
426 | t = (t << 1) | (data[1] & 1); | 428 | t = (t << 1) | (data[1] & 1); |
427 | wacom_report_abs(wcombo, ABS_PRESSURE, t); | 429 | wacom_report_abs(wcombo, ABS_PRESSURE, t); |
428 | wacom_report_abs(wcombo, ABS_TILT_X, | 430 | wacom_report_abs(wcombo, ABS_TILT_X, |
@@ -446,6 +448,7 @@ static void wacom_intuos_general(struct wacom_wac *wacom, void *wcombo) | |||
446 | 448 | ||
447 | static int wacom_intuos_irq(struct wacom_wac *wacom, void *wcombo) | 449 | static int wacom_intuos_irq(struct wacom_wac *wacom, void *wcombo) |
448 | { | 450 | { |
451 | struct wacom_features *features = &wacom->features; | ||
449 | unsigned char *data = wacom->data; | 452 | unsigned char *data = wacom->data; |
450 | unsigned int t; | 453 | unsigned int t; |
451 | int idx = 0, result; | 454 | int idx = 0, result; |
@@ -457,7 +460,7 @@ static int wacom_intuos_irq(struct wacom_wac *wacom, void *wcombo) | |||
457 | } | 460 | } |
458 | 461 | ||
459 | /* tool number */ | 462 | /* tool number */ |
460 | if (wacom->features->type == INTUOS) | 463 | if (features->type == INTUOS) |
461 | idx = data[1] & 0x01; | 464 | idx = data[1] & 0x01; |
462 | 465 | ||
463 | /* pad packets. Works as a second tool and is always in prox */ | 466 | /* pad packets. Works as a second tool and is always in prox */ |
@@ -466,7 +469,7 @@ static int wacom_intuos_irq(struct wacom_wac *wacom, void *wcombo) | |||
466 | if (wacom->tool[1] != BTN_TOOL_FINGER) | 469 | if (wacom->tool[1] != BTN_TOOL_FINGER) |
467 | wacom->tool[1] = BTN_TOOL_FINGER; | 470 | wacom->tool[1] = BTN_TOOL_FINGER; |
468 | 471 | ||
469 | if (wacom->features->type >= INTUOS4S && wacom->features->type <= INTUOS4L) { | 472 | if (features->type >= INTUOS4S && features->type <= INTUOS4L) { |
470 | wacom_report_key(wcombo, BTN_0, (data[2] & 0x01)); | 473 | wacom_report_key(wcombo, BTN_0, (data[2] & 0x01)); |
471 | wacom_report_key(wcombo, BTN_1, (data[3] & 0x01)); | 474 | wacom_report_key(wcombo, BTN_1, (data[3] & 0x01)); |
472 | wacom_report_key(wcombo, BTN_2, (data[3] & 0x02)); | 475 | wacom_report_key(wcombo, BTN_2, (data[3] & 0x02)); |
@@ -480,7 +483,7 @@ static int wacom_intuos_irq(struct wacom_wac *wacom, void *wcombo) | |||
480 | /* Out of proximity, clear wheel value. */ | 483 | /* Out of proximity, clear wheel value. */ |
481 | wacom_report_abs(wcombo, ABS_WHEEL, 0); | 484 | wacom_report_abs(wcombo, ABS_WHEEL, 0); |
482 | } | 485 | } |
483 | if (wacom->features->type != INTUOS4S) { | 486 | if (features->type != INTUOS4S) { |
484 | wacom_report_key(wcombo, BTN_7, (data[3] & 0x40)); | 487 | wacom_report_key(wcombo, BTN_7, (data[3] & 0x40)); |
485 | wacom_report_key(wcombo, BTN_8, (data[3] & 0x80)); | 488 | wacom_report_key(wcombo, BTN_8, (data[3] & 0x80)); |
486 | } | 489 | } |
@@ -528,18 +531,20 @@ static int wacom_intuos_irq(struct wacom_wac *wacom, void *wcombo) | |||
528 | return 0; | 531 | return 0; |
529 | 532 | ||
530 | /* Only large Intuos support Lense Cursor */ | 533 | /* Only large Intuos support Lense Cursor */ |
531 | if ((wacom->tool[idx] == BTN_TOOL_LENS) | 534 | if (wacom->tool[idx] == BTN_TOOL_LENS && |
532 | && ((wacom->features->type == INTUOS3) | 535 | (features->type == INTUOS3 || |
533 | || (wacom->features->type == INTUOS3S) | 536 | features->type == INTUOS3S || |
534 | || (wacom->features->type == INTUOS4) | 537 | features->type == INTUOS4 || |
535 | || (wacom->features->type == INTUOS4S))) | 538 | features->type == INTUOS4S)) { |
539 | |||
536 | return 0; | 540 | return 0; |
541 | } | ||
537 | 542 | ||
538 | /* Cintiq doesn't send data when RDY bit isn't set */ | 543 | /* Cintiq doesn't send data when RDY bit isn't set */ |
539 | if ((wacom->features->type == CINTIQ) && !(data[1] & 0x40)) | 544 | if (features->type == CINTIQ && !(data[1] & 0x40)) |
540 | return 0; | 545 | return 0; |
541 | 546 | ||
542 | if (wacom->features->type >= INTUOS3S) { | 547 | if (features->type >= INTUOS3S) { |
543 | wacom_report_abs(wcombo, ABS_X, (data[2] << 9) | (data[3] << 1) | ((data[9] >> 1) & 1)); | 548 | wacom_report_abs(wcombo, ABS_X, (data[2] << 9) | (data[3] << 1) | ((data[9] >> 1) & 1)); |
544 | wacom_report_abs(wcombo, ABS_Y, (data[4] << 9) | (data[5] << 1) | (data[9] & 1)); | 549 | wacom_report_abs(wcombo, ABS_Y, (data[4] << 9) | (data[5] << 1) | (data[9] & 1)); |
545 | wacom_report_abs(wcombo, ABS_DISTANCE, ((data[9] >> 2) & 0x3f)); | 550 | wacom_report_abs(wcombo, ABS_DISTANCE, ((data[9] >> 2) & 0x3f)); |
@@ -557,7 +562,7 @@ static int wacom_intuos_irq(struct wacom_wac *wacom, void *wcombo) | |||
557 | 562 | ||
558 | if (data[1] & 0x02) { | 563 | if (data[1] & 0x02) { |
559 | /* Rotation packet */ | 564 | /* Rotation packet */ |
560 | if (wacom->features->type >= INTUOS3S) { | 565 | if (features->type >= INTUOS3S) { |
561 | /* I3 marker pen rotation */ | 566 | /* I3 marker pen rotation */ |
562 | t = (data[6] << 3) | ((data[7] >> 5) & 7); | 567 | t = (data[6] << 3) | ((data[7] >> 5) & 7); |
563 | t = (data[7] & 0x20) ? ((t > 900) ? ((t-1) / 2 - 1350) : | 568 | t = (data[7] & 0x20) ? ((t > 900) ? ((t-1) / 2 - 1350) : |
@@ -570,7 +575,7 @@ static int wacom_intuos_irq(struct wacom_wac *wacom, void *wcombo) | |||
570 | ((t - 1) / 2) : -t / 2); | 575 | ((t - 1) / 2) : -t / 2); |
571 | } | 576 | } |
572 | 577 | ||
573 | } else if (!(data[1] & 0x10) && wacom->features->type < INTUOS3S) { | 578 | } else if (!(data[1] & 0x10) && features->type < INTUOS3S) { |
574 | /* 4D mouse packet */ | 579 | /* 4D mouse packet */ |
575 | wacom_report_key(wcombo, BTN_LEFT, data[8] & 0x01); | 580 | wacom_report_key(wcombo, BTN_LEFT, data[8] & 0x01); |
576 | wacom_report_key(wcombo, BTN_MIDDLE, data[8] & 0x02); | 581 | wacom_report_key(wcombo, BTN_MIDDLE, data[8] & 0x02); |
@@ -583,7 +588,7 @@ static int wacom_intuos_irq(struct wacom_wac *wacom, void *wcombo) | |||
583 | 588 | ||
584 | } else if (wacom->tool[idx] == BTN_TOOL_MOUSE) { | 589 | } else if (wacom->tool[idx] == BTN_TOOL_MOUSE) { |
585 | /* I4 mouse */ | 590 | /* I4 mouse */ |
586 | if (wacom->features->type >= INTUOS4S && wacom->features->type <= INTUOS4L) { | 591 | if (features->type >= INTUOS4S && features->type <= INTUOS4L) { |
587 | wacom_report_key(wcombo, BTN_LEFT, data[6] & 0x01); | 592 | wacom_report_key(wcombo, BTN_LEFT, data[6] & 0x01); |
588 | wacom_report_key(wcombo, BTN_MIDDLE, data[6] & 0x02); | 593 | wacom_report_key(wcombo, BTN_MIDDLE, data[6] & 0x02); |
589 | wacom_report_key(wcombo, BTN_RIGHT, data[6] & 0x04); | 594 | wacom_report_key(wcombo, BTN_RIGHT, data[6] & 0x04); |
@@ -604,13 +609,13 @@ static int wacom_intuos_irq(struct wacom_wac *wacom, void *wcombo) | |||
604 | - ((data[8] & 0x02) >> 1)); | 609 | - ((data[8] & 0x02) >> 1)); |
605 | 610 | ||
606 | /* I3 2D mouse side buttons */ | 611 | /* I3 2D mouse side buttons */ |
607 | if (wacom->features->type >= INTUOS3S && wacom->features->type <= INTUOS3L) { | 612 | if (features->type >= INTUOS3S && features->type <= INTUOS3L) { |
608 | wacom_report_key(wcombo, BTN_SIDE, data[8] & 0x40); | 613 | wacom_report_key(wcombo, BTN_SIDE, data[8] & 0x40); |
609 | wacom_report_key(wcombo, BTN_EXTRA, data[8] & 0x20); | 614 | wacom_report_key(wcombo, BTN_EXTRA, data[8] & 0x20); |
610 | } | 615 | } |
611 | } | 616 | } |
612 | } else if ((wacom->features->type < INTUOS3S || wacom->features->type == INTUOS3L || | 617 | } else if ((features->type < INTUOS3S || features->type == INTUOS3L || |
613 | wacom->features->type == INTUOS4L) && | 618 | features->type == INTUOS4L) && |
614 | wacom->tool[idx] == BTN_TOOL_LENS) { | 619 | wacom->tool[idx] == BTN_TOOL_LENS) { |
615 | /* Lens cursor packets */ | 620 | /* Lens cursor packets */ |
616 | wacom_report_key(wcombo, BTN_LEFT, data[8] & 0x01); | 621 | wacom_report_key(wcombo, BTN_LEFT, data[8] & 0x01); |
@@ -718,6 +723,7 @@ static void wacom_tpc_touch_in(struct wacom_wac *wacom, void *wcombo) | |||
718 | 723 | ||
719 | static int wacom_tpc_irq(struct wacom_wac *wacom, void *wcombo) | 724 | static int wacom_tpc_irq(struct wacom_wac *wacom, void *wcombo) |
720 | { | 725 | { |
726 | struct wacom_features *features = &wacom->features; | ||
721 | char *data = wacom->data; | 727 | char *data = wacom->data; |
722 | int prox = 0, pressure, idx = -1; | 728 | int prox = 0, pressure, idx = -1; |
723 | static int stylusInProx, touchInProx = 1, touchOut; | 729 | static int stylusInProx, touchInProx = 1, touchOut; |
@@ -791,7 +797,7 @@ static int wacom_tpc_irq(struct wacom_wac *wacom, void *wcombo) | |||
791 | wacom_report_abs(wcombo, ABS_Y, wacom_le16_to_cpu(&data[4])); | 797 | wacom_report_abs(wcombo, ABS_Y, wacom_le16_to_cpu(&data[4])); |
792 | pressure = ((data[7] & 0x01) << 8) | data[6]; | 798 | pressure = ((data[7] & 0x01) << 8) | data[6]; |
793 | if (pressure < 0) | 799 | if (pressure < 0) |
794 | pressure = wacom->features->pressure_max + pressure + 1; | 800 | pressure = features->pressure_max + pressure + 1; |
795 | wacom_report_abs(wcombo, ABS_PRESSURE, pressure); | 801 | wacom_report_abs(wcombo, ABS_PRESSURE, pressure); |
796 | wacom_report_key(wcombo, BTN_TOUCH, data[1] & 0x05); | 802 | wacom_report_key(wcombo, BTN_TOUCH, data[1] & 0x05); |
797 | } else { | 803 | } else { |
@@ -815,7 +821,7 @@ static int wacom_tpc_irq(struct wacom_wac *wacom, void *wcombo) | |||
815 | 821 | ||
816 | int wacom_wac_irq(struct wacom_wac *wacom_wac, void *wcombo) | 822 | int wacom_wac_irq(struct wacom_wac *wacom_wac, void *wcombo) |
817 | { | 823 | { |
818 | switch (wacom_wac->features->type) { | 824 | switch (wacom_wac->features.type) { |
819 | case PENPARTNER: | 825 | case PENPARTNER: |
820 | return wacom_penpartner_irq(wacom_wac, wcombo); | 826 | return wacom_penpartner_irq(wacom_wac, wcombo); |
821 | 827 | ||
@@ -853,7 +859,7 @@ int wacom_wac_irq(struct wacom_wac *wacom_wac, void *wcombo) | |||
853 | 859 | ||
854 | void wacom_init_input_dev(struct input_dev *input_dev, struct wacom_wac *wacom_wac) | 860 | void wacom_init_input_dev(struct input_dev *input_dev, struct wacom_wac *wacom_wac) |
855 | { | 861 | { |
856 | switch (wacom_wac->features->type) { | 862 | switch (wacom_wac->features.type) { |
857 | case WACOM_MO: | 863 | case WACOM_MO: |
858 | input_dev_mo(input_dev, wacom_wac); | 864 | input_dev_mo(input_dev, wacom_wac); |
859 | case WACOM_G4: | 865 | case WACOM_G4: |
@@ -888,7 +894,7 @@ void wacom_init_input_dev(struct input_dev *input_dev, struct wacom_wac *wacom_w | |||
888 | /* fall through */ | 894 | /* fall through */ |
889 | case TABLETPC: | 895 | case TABLETPC: |
890 | input_dev_tpc(input_dev, wacom_wac); | 896 | input_dev_tpc(input_dev, wacom_wac); |
891 | if (wacom_wac->features->device_type != BTN_TOOL_PEN) | 897 | if (wacom_wac->features.device_type != BTN_TOOL_PEN) |
892 | break; /* no need to process stylus stuff */ | 898 | break; /* no need to process stylus stuff */ |
893 | 899 | ||
894 | /* fall through */ | 900 | /* fall through */ |
diff --git a/drivers/input/tablet/wacom_wac.h b/drivers/input/tablet/wacom_wac.h index ee01e190278..3f4b89d51fe 100644 --- a/drivers/input/tablet/wacom_wac.h +++ b/drivers/input/tablet/wacom_wac.h | |||
@@ -15,11 +15,11 @@ | |||
15 | /* packet length for individual models */ | 15 | /* packet length for individual models */ |
16 | #define WACOM_PKGLEN_PENPRTN 7 | 16 | #define WACOM_PKGLEN_PENPRTN 7 |
17 | #define WACOM_PKGLEN_GRAPHIRE 8 | 17 | #define WACOM_PKGLEN_GRAPHIRE 8 |
18 | #define WACOM_PKGLEN_BBFUN 9 | 18 | #define WACOM_PKGLEN_BBFUN 9 |
19 | #define WACOM_PKGLEN_INTUOS 10 | 19 | #define WACOM_PKGLEN_INTUOS 10 |
20 | #define WACOM_PKGLEN_PENABLED 8 | 20 | #define WACOM_PKGLEN_PENABLED 8 |
21 | #define WACOM_PKGLEN_TPC1FG 5 | 21 | #define WACOM_PKGLEN_TPC1FG 5 |
22 | #define WACOM_PKGLEN_TPC2FG 14 | 22 | #define WACOM_PKGLEN_TPC2FG 14 |
23 | 23 | ||
24 | /* device IDs */ | 24 | /* device IDs */ |
25 | #define STYLUS_DEVICE_ID 0x02 | 25 | #define STYLUS_DEVICE_ID 0x02 |
@@ -58,7 +58,7 @@ enum { | |||
58 | }; | 58 | }; |
59 | 59 | ||
60 | struct wacom_features { | 60 | struct wacom_features { |
61 | char *name; | 61 | const char *name; |
62 | int pktlen; | 62 | int pktlen; |
63 | int x_max; | 63 | int x_max; |
64 | int y_max; | 64 | int y_max; |
@@ -77,7 +77,7 @@ struct wacom_wac { | |||
77 | int tool[2]; | 77 | int tool[2]; |
78 | int id[2]; | 78 | int id[2]; |
79 | __u32 serial[2]; | 79 | __u32 serial[2]; |
80 | struct wacom_features *features; | 80 | struct wacom_features features; |
81 | }; | 81 | }; |
82 | 82 | ||
83 | #endif | 83 | #endif |