aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/hid/wacom_sys.c35
-rw-r--r--drivers/hid/wacom_wac.c30
-rw-r--r--drivers/hid/wacom_wac.h5
3 files changed, 38 insertions, 32 deletions
diff --git a/drivers/hid/wacom_sys.c b/drivers/hid/wacom_sys.c
index bdf31c97fa2a..2b4cbd872f94 100644
--- a/drivers/hid/wacom_sys.c
+++ b/drivers/hid/wacom_sys.c
@@ -197,9 +197,9 @@ static void wacom_usage_mapping(struct hid_device *hdev,
197 * values commonly reported. 197 * values commonly reported.
198 */ 198 */
199 if (pen) 199 if (pen)
200 features->device_type = BTN_TOOL_PEN; 200 features->device_type |= WACOM_DEVICETYPE_PEN;
201 else if (finger) 201 else if (finger)
202 features->device_type = BTN_TOOL_FINGER; 202 features->device_type |= WACOM_DEVICETYPE_TOUCH;
203 else 203 else
204 return; 204 return;
205 205
@@ -411,7 +411,7 @@ static int wacom_query_tablet_data(struct hid_device *hdev,
411 if (features->type == HID_GENERIC) 411 if (features->type == HID_GENERIC)
412 return wacom_hid_set_device_mode(hdev); 412 return wacom_hid_set_device_mode(hdev);
413 413
414 if (features->device_type == BTN_TOOL_FINGER) { 414 if (features->device_type & WACOM_DEVICETYPE_TOUCH) {
415 if (features->type > TABLETPC) { 415 if (features->type > TABLETPC) {
416 /* MT Tablet PC touch */ 416 /* MT Tablet PC touch */
417 return wacom_set_device_mode(hdev, 3, 4, 4); 417 return wacom_set_device_mode(hdev, 3, 4, 4);
@@ -425,7 +425,7 @@ static int wacom_query_tablet_data(struct hid_device *hdev,
425 else if (features->type == BAMBOO_PAD) { 425 else if (features->type == BAMBOO_PAD) {
426 return wacom_set_device_mode(hdev, 2, 2, 2); 426 return wacom_set_device_mode(hdev, 2, 2, 2);
427 } 427 }
428 } else if (features->device_type == BTN_TOOL_PEN) { 428 } else if (features->device_type & WACOM_DEVICETYPE_PEN) {
429 if (features->type <= BAMBOO_PT && features->type != WIRELESS) { 429 if (features->type <= BAMBOO_PT && features->type != WIRELESS) {
430 return wacom_set_device_mode(hdev, 2, 2, 2); 430 return wacom_set_device_mode(hdev, 2, 2, 2);
431 } 431 }
@@ -454,9 +454,9 @@ static void wacom_retrieve_hid_descriptor(struct hid_device *hdev,
454 */ 454 */
455 if (features->type == WIRELESS) { 455 if (features->type == WIRELESS) {
456 if (intf->cur_altsetting->desc.bInterfaceNumber == 0) { 456 if (intf->cur_altsetting->desc.bInterfaceNumber == 0) {
457 features->device_type = 0; 457 features->device_type = WACOM_DEVICETYPE_NONE;
458 } else if (intf->cur_altsetting->desc.bInterfaceNumber == 2) { 458 } else if (intf->cur_altsetting->desc.bInterfaceNumber == 2) {
459 features->device_type = BTN_TOOL_FINGER; 459 features->device_type |= WACOM_DEVICETYPE_TOUCH;
460 features->pktlen = WACOM_PKGLEN_BBTOUCH3; 460 features->pktlen = WACOM_PKGLEN_BBTOUCH3;
461 } 461 }
462 } 462 }
@@ -538,9 +538,9 @@ static int wacom_add_shared_data(struct hid_device *hdev)
538 538
539 wacom_wac->shared = &data->shared; 539 wacom_wac->shared = &data->shared;
540 540
541 if (wacom_wac->features.device_type == BTN_TOOL_FINGER) 541 if (wacom_wac->features.device_type & WACOM_DEVICETYPE_TOUCH)
542 wacom_wac->shared->touch = hdev; 542 wacom_wac->shared->touch = hdev;
543 else if (wacom_wac->features.device_type == BTN_TOOL_PEN) 543 else if (wacom_wac->features.device_type & WACOM_DEVICETYPE_PEN)
544 wacom_wac->shared->pen = hdev; 544 wacom_wac->shared->pen = hdev;
545 545
546out: 546out:
@@ -892,7 +892,7 @@ static int wacom_initialize_leds(struct wacom *wacom)
892 case INTUOSPS: 892 case INTUOSPS:
893 case INTUOSPM: 893 case INTUOSPM:
894 case INTUOSPL: 894 case INTUOSPL:
895 if (wacom->wacom_wac.features.device_type == BTN_TOOL_PEN) { 895 if (wacom->wacom_wac.features.device_type & WACOM_DEVICETYPE_PEN) {
896 wacom->led.select[0] = 0; 896 wacom->led.select[0] = 0;
897 wacom->led.select[1] = 0; 897 wacom->led.select[1] = 0;
898 wacom->led.llv = 32; 898 wacom->led.llv = 32;
@@ -948,7 +948,7 @@ static void wacom_destroy_leds(struct wacom *wacom)
948 case INTUOSPS: 948 case INTUOSPS:
949 case INTUOSPM: 949 case INTUOSPM:
950 case INTUOSPL: 950 case INTUOSPL:
951 if (wacom->wacom_wac.features.device_type == BTN_TOOL_PEN) 951 if (wacom->wacom_wac.features.device_type & WACOM_DEVICETYPE_PEN)
952 sysfs_remove_group(&wacom->hdev->dev.kobj, 952 sysfs_remove_group(&wacom->hdev->dev.kobj,
953 &intuos5_led_attr_group); 953 &intuos5_led_attr_group);
954 break; 954 break;
@@ -1296,7 +1296,7 @@ static void wacom_wireless_work(struct work_struct *work)
1296 /* Stylus interface */ 1296 /* Stylus interface */
1297 wacom_wac1->features = 1297 wacom_wac1->features =
1298 *((struct wacom_features *)id->driver_data); 1298 *((struct wacom_features *)id->driver_data);
1299 wacom_wac1->features.device_type = BTN_TOOL_PEN; 1299 wacom_wac1->features.device_type |= WACOM_DEVICETYPE_PEN;
1300 snprintf(wacom_wac1->name, WACOM_NAME_MAX, "%s (WL) Pen", 1300 snprintf(wacom_wac1->name, WACOM_NAME_MAX, "%s (WL) Pen",
1301 wacom_wac1->features.name); 1301 wacom_wac1->features.name);
1302 snprintf(wacom_wac1->pad_name, WACOM_NAME_MAX, "%s (WL) Pad", 1302 snprintf(wacom_wac1->pad_name, WACOM_NAME_MAX, "%s (WL) Pad",
@@ -1315,7 +1315,7 @@ static void wacom_wireless_work(struct work_struct *work)
1315 wacom_wac2->features = 1315 wacom_wac2->features =
1316 *((struct wacom_features *)id->driver_data); 1316 *((struct wacom_features *)id->driver_data);
1317 wacom_wac2->features.pktlen = WACOM_PKGLEN_BBTOUCH3; 1317 wacom_wac2->features.pktlen = WACOM_PKGLEN_BBTOUCH3;
1318 wacom_wac2->features.device_type = BTN_TOOL_FINGER; 1318 wacom_wac2->features.device_type |= WACOM_DEVICETYPE_TOUCH;
1319 wacom_wac2->features.x_max = wacom_wac2->features.y_max = 4096; 1319 wacom_wac2->features.x_max = wacom_wac2->features.y_max = 4096;
1320 if (wacom_wac2->features.touch_max) 1320 if (wacom_wac2->features.touch_max)
1321 snprintf(wacom_wac2->name, WACOM_NAME_MAX, 1321 snprintf(wacom_wac2->name, WACOM_NAME_MAX,
@@ -1451,11 +1451,11 @@ static void wacom_update_name(struct wacom *wacom)
1451 snprintf(wacom_wac->pad_name, sizeof(wacom_wac->pad_name), 1451 snprintf(wacom_wac->pad_name, sizeof(wacom_wac->pad_name),
1452 "%s Pad", name); 1452 "%s Pad", name);
1453 1453
1454 if (features->device_type == BTN_TOOL_PEN) { 1454 if (features->device_type & WACOM_DEVICETYPE_PEN) {
1455 snprintf(wacom_wac->name, sizeof(wacom_wac->name), 1455 snprintf(wacom_wac->name, sizeof(wacom_wac->name),
1456 "%s Pen", name); 1456 "%s Pen", name);
1457 } 1457 }
1458 else if (features->device_type == BTN_TOOL_FINGER) { 1458 else if (features->device_type & WACOM_DEVICETYPE_TOUCH) {
1459 if (features->touch_max) 1459 if (features->touch_max)
1460 snprintf(wacom_wac->name, sizeof(wacom_wac->name), 1460 snprintf(wacom_wac->name, sizeof(wacom_wac->name),
1461 "%s Finger", name); 1461 "%s Finger", name);
@@ -1545,7 +1545,8 @@ static int wacom_probe(struct hid_device *hdev,
1545 wacom_retrieve_hid_descriptor(hdev, features); 1545 wacom_retrieve_hid_descriptor(hdev, features);
1546 wacom_setup_device_quirks(wacom); 1546 wacom_setup_device_quirks(wacom);
1547 1547
1548 if (!features->device_type && features->type != WIRELESS) { 1548 if (features->device_type == WACOM_DEVICETYPE_NONE &&
1549 features->type != WIRELESS) {
1549 error = features->type == HID_GENERIC ? -ENODEV : 0; 1550 error = features->type == HID_GENERIC ? -ENODEV : 0;
1550 1551
1551 dev_warn(&hdev->dev, "Unknown device_type for '%s'. %s.", 1552 dev_warn(&hdev->dev, "Unknown device_type for '%s'. %s.",
@@ -1555,7 +1556,7 @@ static int wacom_probe(struct hid_device *hdev,
1555 if (error) 1556 if (error)
1556 goto fail_shared_data; 1557 goto fail_shared_data;
1557 1558
1558 features->device_type = BTN_TOOL_PEN; 1559 features->device_type |= WACOM_DEVICETYPE_PEN;
1559 } 1560 }
1560 1561
1561 wacom_calculate_res(features); 1562 wacom_calculate_res(features);
@@ -1604,7 +1605,7 @@ static int wacom_probe(struct hid_device *hdev,
1604 error = hid_hw_open(hdev); 1605 error = hid_hw_open(hdev);
1605 1606
1606 if (wacom_wac->features.type == INTUOSHT && wacom_wac->features.touch_max) { 1607 if (wacom_wac->features.type == INTUOSHT && wacom_wac->features.touch_max) {
1607 if (wacom_wac->features.device_type == BTN_TOOL_FINGER) 1608 if (wacom_wac->features.device_type & WACOM_DEVICETYPE_TOUCH)
1608 wacom_wac->shared->touch_input = wacom_wac->input; 1609 wacom_wac->shared->touch_input = wacom_wac->input;
1609 } 1610 }
1610 1611
diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c
index a52fc2580b6b..5e7710d6b048 100644
--- a/drivers/hid/wacom_wac.c
+++ b/drivers/hid/wacom_wac.c
@@ -2168,7 +2168,7 @@ void wacom_setup_device_quirks(struct wacom *wacom)
2168 struct wacom_features *features = &wacom->wacom_wac.features; 2168 struct wacom_features *features = &wacom->wacom_wac.features;
2169 2169
2170 /* touch device found but size is not defined. use default */ 2170 /* touch device found but size is not defined. use default */
2171 if (features->device_type == BTN_TOOL_FINGER && !features->x_max) { 2171 if (features->device_type & WACOM_DEVICETYPE_TOUCH && !features->x_max) {
2172 features->x_max = 1023; 2172 features->x_max = 1023;
2173 features->y_max = 1023; 2173 features->y_max = 1023;
2174 } 2174 }
@@ -2182,7 +2182,7 @@ void wacom_setup_device_quirks(struct wacom *wacom)
2182 if ((features->type >= INTUOS5S && features->type <= INTUOSHT) || 2182 if ((features->type >= INTUOS5S && features->type <= INTUOSHT) ||
2183 (features->type == BAMBOO_PT)) { 2183 (features->type == BAMBOO_PT)) {
2184 if (features->pktlen == WACOM_PKGLEN_BBTOUCH3) { 2184 if (features->pktlen == WACOM_PKGLEN_BBTOUCH3) {
2185 features->device_type = BTN_TOOL_FINGER; 2185 features->device_type |= WACOM_DEVICETYPE_TOUCH;
2186 2186
2187 features->x_max = 4096; 2187 features->x_max = 4096;
2188 features->y_max = 4096; 2188 features->y_max = 4096;
@@ -2197,7 +2197,7 @@ void wacom_setup_device_quirks(struct wacom *wacom)
2197 * so rewrite this one to be of type BTN_TOOL_FINGER. 2197 * so rewrite this one to be of type BTN_TOOL_FINGER.
2198 */ 2198 */
2199 if (features->type == BAMBOO_PAD) 2199 if (features->type == BAMBOO_PAD)
2200 features->device_type = BTN_TOOL_FINGER; 2200 features->device_type |= WACOM_DEVICETYPE_TOUCH;
2201 2201
2202 if (wacom->hdev->bus == BUS_BLUETOOTH) 2202 if (wacom->hdev->bus == BUS_BLUETOOTH)
2203 features->quirks |= WACOM_QUIRK_BATTERY; 2203 features->quirks |= WACOM_QUIRK_BATTERY;
@@ -2218,7 +2218,7 @@ void wacom_setup_device_quirks(struct wacom *wacom)
2218 features->quirks |= WACOM_QUIRK_NO_INPUT; 2218 features->quirks |= WACOM_QUIRK_NO_INPUT;
2219 2219
2220 /* must be monitor interface if no device_type set */ 2220 /* must be monitor interface if no device_type set */
2221 if (!features->device_type) { 2221 if (features->device_type == WACOM_DEVICETYPE_NONE) {
2222 features->quirks |= WACOM_QUIRK_MONITOR; 2222 features->quirks |= WACOM_QUIRK_MONITOR;
2223 features->quirks |= WACOM_QUIRK_BATTERY; 2223 features->quirks |= WACOM_QUIRK_BATTERY;
2224 } 2224 }
@@ -2230,7 +2230,7 @@ static void wacom_abs_set_axis(struct input_dev *input_dev,
2230{ 2230{
2231 struct wacom_features *features = &wacom_wac->features; 2231 struct wacom_features *features = &wacom_wac->features;
2232 2232
2233 if (features->device_type == BTN_TOOL_PEN) { 2233 if (features->device_type & WACOM_DEVICETYPE_PEN) {
2234 input_set_abs_params(input_dev, ABS_X, features->x_min, 2234 input_set_abs_params(input_dev, ABS_X, features->x_min,
2235 features->x_max, features->x_fuzz, 0); 2235 features->x_max, features->x_fuzz, 0);
2236 input_set_abs_params(input_dev, ABS_Y, features->y_min, 2236 input_set_abs_params(input_dev, ABS_Y, features->y_min,
@@ -2349,7 +2349,7 @@ int wacom_setup_pentouch_input_capabilities(struct input_dev *input_dev,
2349 case INTUOSPS: 2349 case INTUOSPS:
2350 __set_bit(INPUT_PROP_POINTER, input_dev->propbit); 2350 __set_bit(INPUT_PROP_POINTER, input_dev->propbit);
2351 2351
2352 if (features->device_type == BTN_TOOL_PEN) { 2352 if (features->device_type & WACOM_DEVICETYPE_PEN) {
2353 input_set_abs_params(input_dev, ABS_DISTANCE, 0, 2353 input_set_abs_params(input_dev, ABS_DISTANCE, 0,
2354 features->distance_max, 2354 features->distance_max,
2355 0, 0); 2355 0, 0);
@@ -2358,7 +2358,7 @@ int wacom_setup_pentouch_input_capabilities(struct input_dev *input_dev,
2358 input_abs_set_res(input_dev, ABS_Z, 287); 2358 input_abs_set_res(input_dev, ABS_Z, 287);
2359 2359
2360 wacom_setup_intuos(wacom_wac); 2360 wacom_setup_intuos(wacom_wac);
2361 } else if (features->device_type == BTN_TOOL_FINGER) { 2361 } else if (features->device_type & WACOM_DEVICETYPE_TOUCH) {
2362 __clear_bit(ABS_MISC, input_dev->absbit); 2362 __clear_bit(ABS_MISC, input_dev->absbit);
2363 2363
2364 input_set_abs_params(input_dev, ABS_MT_TOUCH_MAJOR, 2364 input_set_abs_params(input_dev, ABS_MT_TOUCH_MAJOR,
@@ -2370,7 +2370,7 @@ int wacom_setup_pentouch_input_capabilities(struct input_dev *input_dev,
2370 break; 2370 break;
2371 2371
2372 case WACOM_24HDT: 2372 case WACOM_24HDT:
2373 if (features->device_type == BTN_TOOL_FINGER) { 2373 if (features->device_type & WACOM_DEVICETYPE_TOUCH) {
2374 input_set_abs_params(input_dev, ABS_MT_TOUCH_MAJOR, 0, features->x_max, 0, 0); 2374 input_set_abs_params(input_dev, ABS_MT_TOUCH_MAJOR, 0, features->x_max, 0, 0);
2375 input_set_abs_params(input_dev, ABS_MT_WIDTH_MAJOR, 0, features->x_max, 0, 0); 2375 input_set_abs_params(input_dev, ABS_MT_WIDTH_MAJOR, 0, features->x_max, 0, 0);
2376 input_set_abs_params(input_dev, ABS_MT_WIDTH_MINOR, 0, features->y_max, 0, 0); 2376 input_set_abs_params(input_dev, ABS_MT_WIDTH_MINOR, 0, features->y_max, 0, 0);
@@ -2383,7 +2383,7 @@ int wacom_setup_pentouch_input_capabilities(struct input_dev *input_dev,
2383 case MTTPC: 2383 case MTTPC:
2384 case MTTPC_B: 2384 case MTTPC_B:
2385 case TABLETPC2FG: 2385 case TABLETPC2FG:
2386 if (features->device_type == BTN_TOOL_FINGER && features->touch_max > 1) 2386 if (features->device_type & WACOM_DEVICETYPE_TOUCH && features->touch_max > 1)
2387 input_mt_init_slots(input_dev, features->touch_max, INPUT_MT_DIRECT); 2387 input_mt_init_slots(input_dev, features->touch_max, INPUT_MT_DIRECT);
2388 /* fall through */ 2388 /* fall through */
2389 2389
@@ -2393,7 +2393,7 @@ int wacom_setup_pentouch_input_capabilities(struct input_dev *input_dev,
2393 2393
2394 __set_bit(INPUT_PROP_DIRECT, input_dev->propbit); 2394 __set_bit(INPUT_PROP_DIRECT, input_dev->propbit);
2395 2395
2396 if (features->device_type != BTN_TOOL_PEN) 2396 if (!(features->device_type & WACOM_DEVICETYPE_PEN))
2397 break; /* no need to process stylus stuff */ 2397 break; /* no need to process stylus stuff */
2398 2398
2399 /* fall through */ 2399 /* fall through */
@@ -2424,7 +2424,7 @@ int wacom_setup_pentouch_input_capabilities(struct input_dev *input_dev,
2424 2424
2425 case INTUOSHT: 2425 case INTUOSHT:
2426 if (features->touch_max && 2426 if (features->touch_max &&
2427 features->device_type == BTN_TOOL_FINGER) { 2427 features->device_type & WACOM_DEVICETYPE_TOUCH) {
2428 input_dev->evbit[0] |= BIT_MASK(EV_SW); 2428 input_dev->evbit[0] |= BIT_MASK(EV_SW);
2429 __set_bit(SW_MUTE_DEVICE, input_dev->swbit); 2429 __set_bit(SW_MUTE_DEVICE, input_dev->swbit);
2430 } 2430 }
@@ -2433,7 +2433,7 @@ int wacom_setup_pentouch_input_capabilities(struct input_dev *input_dev,
2433 case BAMBOO_PT: 2433 case BAMBOO_PT:
2434 __clear_bit(ABS_MISC, input_dev->absbit); 2434 __clear_bit(ABS_MISC, input_dev->absbit);
2435 2435
2436 if (features->device_type == BTN_TOOL_FINGER) { 2436 if (features->device_type & WACOM_DEVICETYPE_TOUCH) {
2437 2437
2438 if (features->touch_max) { 2438 if (features->touch_max) {
2439 if (features->pktlen == WACOM_PKGLEN_BBTOUCH3) { 2439 if (features->pktlen == WACOM_PKGLEN_BBTOUCH3) {
@@ -2454,7 +2454,7 @@ int wacom_setup_pentouch_input_capabilities(struct input_dev *input_dev,
2454 /* PAD is setup by wacom_setup_pad_input_capabilities later */ 2454 /* PAD is setup by wacom_setup_pad_input_capabilities later */
2455 return 1; 2455 return 1;
2456 } 2456 }
2457 } else if (features->device_type == BTN_TOOL_PEN) { 2457 } else if (features->device_type & WACOM_DEVICETYPE_PEN) {
2458 __set_bit(INPUT_PROP_POINTER, input_dev->propbit); 2458 __set_bit(INPUT_PROP_POINTER, input_dev->propbit);
2459 __set_bit(BTN_TOOL_RUBBER, input_dev->keybit); 2459 __set_bit(BTN_TOOL_RUBBER, input_dev->keybit);
2460 __set_bit(BTN_TOOL_PEN, input_dev->keybit); 2460 __set_bit(BTN_TOOL_PEN, input_dev->keybit);
@@ -2619,7 +2619,7 @@ int wacom_setup_pad_input_capabilities(struct input_dev *input_dev,
2619 case INTUOS5S: 2619 case INTUOS5S:
2620 case INTUOSPS: 2620 case INTUOSPS:
2621 /* touch interface does not have the pad device */ 2621 /* touch interface does not have the pad device */
2622 if (features->device_type != BTN_TOOL_PEN) 2622 if (!(features->device_type & WACOM_DEVICETYPE_PEN))
2623 return -ENODEV; 2623 return -ENODEV;
2624 2624
2625 for (i = 0; i < 7; i++) 2625 for (i = 0; i < 7; i++)
@@ -2664,7 +2664,7 @@ int wacom_setup_pad_input_capabilities(struct input_dev *input_dev,
2664 case INTUOSHT: 2664 case INTUOSHT:
2665 case BAMBOO_PT: 2665 case BAMBOO_PT:
2666 /* pad device is on the touch interface */ 2666 /* pad device is on the touch interface */
2667 if ((features->device_type != BTN_TOOL_FINGER) || 2667 if (!(features->device_type & WACOM_DEVICETYPE_TOUCH) ||
2668 /* Bamboo Pen only tablet does not have pad */ 2668 /* Bamboo Pen only tablet does not have pad */
2669 ((features->type == BAMBOO_PT) && !features->touch_max)) 2669 ((features->type == BAMBOO_PT) && !features->touch_max))
2670 return -ENODEV; 2670 return -ENODEV;
diff --git a/drivers/hid/wacom_wac.h b/drivers/hid/wacom_wac.h
index 9a5ee623cb44..da2b3095c2f8 100644
--- a/drivers/hid/wacom_wac.h
+++ b/drivers/hid/wacom_wac.h
@@ -72,6 +72,11 @@
72#define WACOM_QUIRK_MONITOR 0x0004 72#define WACOM_QUIRK_MONITOR 0x0004
73#define WACOM_QUIRK_BATTERY 0x0008 73#define WACOM_QUIRK_BATTERY 0x0008
74 74
75/* device types */
76#define WACOM_DEVICETYPE_NONE 0x0000
77#define WACOM_DEVICETYPE_PEN 0x0001
78#define WACOM_DEVICETYPE_TOUCH 0x0002
79
75#define WACOM_VENDORDEFINED_PEN 0xff0d0001 80#define WACOM_VENDORDEFINED_PEN 0xff0d0001
76 81
77#define WACOM_PEN_FIELD(f) (((f)->logical == HID_DG_STYLUS) || \ 82#define WACOM_PEN_FIELD(f) (((f)->logical == HID_DG_STYLUS) || \