diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2015-04-14 12:25:26 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-04-14 12:25:26 -0400 |
commit | 8de29a35dc840a05e451ad035bcb06e21ccf605f (patch) | |
tree | f887a98818ef7dd56c0c64c95039377931dcc903 /drivers/hid/wacom_sys.c | |
parent | 31f7dc796998d2967e999a0f9229d8a50c7b348d (diff) | |
parent | 2e455c27bddbf8cf6d1039daea40de8e6865c453 (diff) |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid
Pull HID updates from Jiri Kosina:
- quite a few firmware fixes for RMI driver by Andrew Duggan
- huion and uclogic drivers have been substantially overlaping in
functionality laterly. This redundancy is fixed by hid-huion driver
being merged into hid-uclogic; work done by Benjamin Tissoires and
Nikolai Kondrashov
- i2c-hid now supports ACPI GPIO interrupts; patch from Mika Westerberg
- Some of the quirks, that got separated into individual drivers, have
historically had EXPERT dependency. As HID subsystem matured (as
well as the individual drivers), this made less and less sense. This
dependency is now being removed by patch from Jean Delvare
- Logitech lg4ff driver received a couple of improvements for mode
switching, by Michal MalĂ˝
- multitouch driver now supports clickpads, patches by Benjamin
Tissoires and Seth Forshee
- hid-sensor framework received a substantial update; namely support
for Custom and Generic pages is being added; work done by Srinivas
Pandruvada
- wacom driver received substantial update; it now supports
i2c-conntected devices (Mika Westerberg), Bamboo PADs are now
properly supported (Benjamin Tissoires), much improved battery
reporting (Jason Gerecke) and pen proximity cleanups (Ping Cheng)
- small assorted fixes and device ID additions
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid: (68 commits)
HID: sensor: Update document for custom sensor
HID: sensor: Custom and Generic sensor support
HID: debug: fix error handling in hid_debug_events_read()
Input - mt: Fix input_mt_get_slot_by_key
HID: logitech-hidpp: fix error return code
HID: wacom: Add support for Cintiq 13HD Touch
HID: logitech-hidpp: add a module parameter to keep firmware gestures
HID: usbhid: yet another mouse with ALWAYS_POLL
HID: usbhid: more mice with ALWAYS_POLL
HID: wacom: set stylus_in_proximity before checking touch_down
HID: wacom: use wacom_wac_finger_count_touches to set touch_down
HID: wacom: remove hardcoded WACOM_QUIRK_MULTI_INPUT
HID: pidff: effect can't be NULL
HID: add quirk for PIXART OEM mouse used by HP
HID: add HP OEM mouse to quirk ALWAYS_POLL
HID: wacom: ask for a in-prox report when it was missed
HID: hid-sensor-hub: Fix sparse warning
HID: hid-sensor-hub: fix attribute read for logical usage id
HID: plantronics: fix Kconfig default
HID: pidff: support more than one concurrent effect
...
Diffstat (limited to 'drivers/hid/wacom_sys.c')
-rw-r--r-- | drivers/hid/wacom_sys.c | 97 |
1 files changed, 77 insertions, 20 deletions
diff --git a/drivers/hid/wacom_sys.c b/drivers/hid/wacom_sys.c index ba9af470bea0..e8607d096138 100644 --- a/drivers/hid/wacom_sys.c +++ b/drivers/hid/wacom_sys.c | |||
@@ -406,6 +406,9 @@ static int wacom_query_tablet_data(struct hid_device *hdev, | |||
406 | else if (features->type == WACOM_27QHDT) { | 406 | else if (features->type == WACOM_27QHDT) { |
407 | return wacom_set_device_mode(hdev, 131, 3, 2); | 407 | return wacom_set_device_mode(hdev, 131, 3, 2); |
408 | } | 408 | } |
409 | else if (features->type == BAMBOO_PAD) { | ||
410 | return wacom_set_device_mode(hdev, 2, 2, 2); | ||
411 | } | ||
409 | } else if (features->device_type == BTN_TOOL_PEN) { | 412 | } else if (features->device_type == BTN_TOOL_PEN) { |
410 | if (features->type <= BAMBOO_PT && features->type != WIRELESS) { | 413 | if (features->type <= BAMBOO_PT && features->type != WIRELESS) { |
411 | return wacom_set_device_mode(hdev, 2, 2, 2); | 414 | return wacom_set_device_mode(hdev, 2, 2, 2); |
@@ -524,6 +527,11 @@ static int wacom_add_shared_data(struct hid_device *hdev) | |||
524 | 527 | ||
525 | wacom_wac->shared = &data->shared; | 528 | wacom_wac->shared = &data->shared; |
526 | 529 | ||
530 | if (wacom_wac->features.device_type == BTN_TOOL_FINGER) | ||
531 | wacom_wac->shared->touch = hdev; | ||
532 | else if (wacom_wac->features.device_type == BTN_TOOL_PEN) | ||
533 | wacom_wac->shared->pen = hdev; | ||
534 | |||
527 | out: | 535 | out: |
528 | mutex_unlock(&wacom_udev_list_lock); | 536 | mutex_unlock(&wacom_udev_list_lock); |
529 | return retval; | 537 | return retval; |
@@ -541,14 +549,22 @@ static void wacom_release_shared_data(struct kref *kref) | |||
541 | kfree(data); | 549 | kfree(data); |
542 | } | 550 | } |
543 | 551 | ||
544 | static void wacom_remove_shared_data(struct wacom_wac *wacom) | 552 | static void wacom_remove_shared_data(struct wacom *wacom) |
545 | { | 553 | { |
546 | struct wacom_hdev_data *data; | 554 | struct wacom_hdev_data *data; |
555 | struct wacom_wac *wacom_wac = &wacom->wacom_wac; | ||
556 | |||
557 | if (wacom_wac->shared) { | ||
558 | data = container_of(wacom_wac->shared, struct wacom_hdev_data, | ||
559 | shared); | ||
560 | |||
561 | if (wacom_wac->shared->touch == wacom->hdev) | ||
562 | wacom_wac->shared->touch = NULL; | ||
563 | else if (wacom_wac->shared->pen == wacom->hdev) | ||
564 | wacom_wac->shared->pen = NULL; | ||
547 | 565 | ||
548 | if (wacom->shared) { | ||
549 | data = container_of(wacom->shared, struct wacom_hdev_data, shared); | ||
550 | kref_put(&data->kref, wacom_release_shared_data); | 566 | kref_put(&data->kref, wacom_release_shared_data); |
551 | wacom->shared = NULL; | 567 | wacom_wac->shared = NULL; |
552 | } | 568 | } |
553 | } | 569 | } |
554 | 570 | ||
@@ -929,6 +945,7 @@ static void wacom_destroy_leds(struct wacom *wacom) | |||
929 | } | 945 | } |
930 | 946 | ||
931 | static enum power_supply_property wacom_battery_props[] = { | 947 | static enum power_supply_property wacom_battery_props[] = { |
948 | POWER_SUPPLY_PROP_PRESENT, | ||
932 | POWER_SUPPLY_PROP_STATUS, | 949 | POWER_SUPPLY_PROP_STATUS, |
933 | POWER_SUPPLY_PROP_SCOPE, | 950 | POWER_SUPPLY_PROP_SCOPE, |
934 | POWER_SUPPLY_PROP_CAPACITY | 951 | POWER_SUPPLY_PROP_CAPACITY |
@@ -948,6 +965,9 @@ static int wacom_battery_get_property(struct power_supply *psy, | |||
948 | int ret = 0; | 965 | int ret = 0; |
949 | 966 | ||
950 | switch (psp) { | 967 | switch (psp) { |
968 | case POWER_SUPPLY_PROP_PRESENT: | ||
969 | val->intval = wacom->wacom_wac.bat_connected; | ||
970 | break; | ||
951 | case POWER_SUPPLY_PROP_SCOPE: | 971 | case POWER_SUPPLY_PROP_SCOPE: |
952 | val->intval = POWER_SUPPLY_SCOPE_DEVICE; | 972 | val->intval = POWER_SUPPLY_SCOPE_DEVICE; |
953 | break; | 973 | break; |
@@ -961,6 +981,8 @@ static int wacom_battery_get_property(struct power_supply *psy, | |||
961 | else if (wacom->wacom_wac.battery_capacity == 100 && | 981 | else if (wacom->wacom_wac.battery_capacity == 100 && |
962 | wacom->wacom_wac.ps_connected) | 982 | wacom->wacom_wac.ps_connected) |
963 | val->intval = POWER_SUPPLY_STATUS_FULL; | 983 | val->intval = POWER_SUPPLY_STATUS_FULL; |
984 | else if (wacom->wacom_wac.ps_connected) | ||
985 | val->intval = POWER_SUPPLY_STATUS_NOT_CHARGING; | ||
964 | else | 986 | else |
965 | val->intval = POWER_SUPPLY_STATUS_DISCHARGING; | 987 | val->intval = POWER_SUPPLY_STATUS_DISCHARGING; |
966 | break; | 988 | break; |
@@ -1045,8 +1067,7 @@ static int wacom_initialize_battery(struct wacom *wacom) | |||
1045 | 1067 | ||
1046 | static void wacom_destroy_battery(struct wacom *wacom) | 1068 | static void wacom_destroy_battery(struct wacom *wacom) |
1047 | { | 1069 | { |
1048 | if ((wacom->wacom_wac.features.quirks & WACOM_QUIRK_BATTERY) && | 1070 | if (wacom->battery) { |
1049 | wacom->battery) { | ||
1050 | power_supply_unregister(wacom->battery); | 1071 | power_supply_unregister(wacom->battery); |
1051 | wacom->battery = NULL; | 1072 | wacom->battery = NULL; |
1052 | power_supply_unregister(wacom->ac); | 1073 | power_supply_unregister(wacom->ac); |
@@ -1317,6 +1338,20 @@ fail: | |||
1317 | return; | 1338 | return; |
1318 | } | 1339 | } |
1319 | 1340 | ||
1341 | void wacom_battery_work(struct work_struct *work) | ||
1342 | { | ||
1343 | struct wacom *wacom = container_of(work, struct wacom, work); | ||
1344 | |||
1345 | if ((wacom->wacom_wac.features.quirks & WACOM_QUIRK_BATTERY) && | ||
1346 | !wacom->battery) { | ||
1347 | wacom_initialize_battery(wacom); | ||
1348 | } | ||
1349 | else if (!(wacom->wacom_wac.features.quirks & WACOM_QUIRK_BATTERY) && | ||
1350 | wacom->battery) { | ||
1351 | wacom_destroy_battery(wacom); | ||
1352 | } | ||
1353 | } | ||
1354 | |||
1320 | /* | 1355 | /* |
1321 | * Not all devices report physical dimensions from HID. | 1356 | * Not all devices report physical dimensions from HID. |
1322 | * Compute the default from hardcoded logical dimension | 1357 | * Compute the default from hardcoded logical dimension |
@@ -1377,6 +1412,9 @@ static int wacom_probe(struct hid_device *hdev, | |||
1377 | 1412 | ||
1378 | hdev->quirks |= HID_QUIRK_NO_INIT_REPORTS; | 1413 | hdev->quirks |= HID_QUIRK_NO_INIT_REPORTS; |
1379 | 1414 | ||
1415 | /* hid-core sets this quirk for the boot interface */ | ||
1416 | hdev->quirks &= ~HID_QUIRK_NOGET; | ||
1417 | |||
1380 | wacom = kzalloc(sizeof(struct wacom), GFP_KERNEL); | 1418 | wacom = kzalloc(sizeof(struct wacom), GFP_KERNEL); |
1381 | if (!wacom) | 1419 | if (!wacom) |
1382 | return -ENOMEM; | 1420 | return -ENOMEM; |
@@ -1416,6 +1454,21 @@ static int wacom_probe(struct hid_device *hdev, | |||
1416 | goto fail_allocate_inputs; | 1454 | goto fail_allocate_inputs; |
1417 | } | 1455 | } |
1418 | 1456 | ||
1457 | /* | ||
1458 | * Bamboo Pad has a generic hid handling for the Pen, and we switch it | ||
1459 | * into debug mode for the touch part. | ||
1460 | * We ignore the other interfaces. | ||
1461 | */ | ||
1462 | if (features->type == BAMBOO_PAD) { | ||
1463 | if (features->pktlen == WACOM_PKGLEN_PENABLED) { | ||
1464 | features->type = HID_GENERIC; | ||
1465 | } else if ((features->pktlen != WACOM_PKGLEN_BPAD_TOUCH) && | ||
1466 | (features->pktlen != WACOM_PKGLEN_BPAD_TOUCH_USB)) { | ||
1467 | error = -ENODEV; | ||
1468 | goto fail_shared_data; | ||
1469 | } | ||
1470 | } | ||
1471 | |||
1419 | /* set the default size in case we do not get them from hid */ | 1472 | /* set the default size in case we do not get them from hid */ |
1420 | wacom_set_default_phy(features); | 1473 | wacom_set_default_phy(features); |
1421 | 1474 | ||
@@ -1450,6 +1503,12 @@ static int wacom_probe(struct hid_device *hdev, | |||
1450 | features->y_max = 4096; | 1503 | features->y_max = 4096; |
1451 | } | 1504 | } |
1452 | 1505 | ||
1506 | /* | ||
1507 | * Same thing for Bamboo PAD | ||
1508 | */ | ||
1509 | if (features->type == BAMBOO_PAD) | ||
1510 | features->device_type = BTN_TOOL_FINGER; | ||
1511 | |||
1453 | if (hdev->bus == BUS_BLUETOOTH) | 1512 | if (hdev->bus == BUS_BLUETOOTH) |
1454 | features->quirks |= WACOM_QUIRK_BATTERY; | 1513 | features->quirks |= WACOM_QUIRK_BATTERY; |
1455 | 1514 | ||
@@ -1466,19 +1525,17 @@ static int wacom_probe(struct hid_device *hdev, | |||
1466 | snprintf(wacom_wac->pad_name, sizeof(wacom_wac->pad_name), | 1525 | snprintf(wacom_wac->pad_name, sizeof(wacom_wac->pad_name), |
1467 | "%s Pad", features->name); | 1526 | "%s Pad", features->name); |
1468 | 1527 | ||
1469 | if (features->quirks & WACOM_QUIRK_MULTI_INPUT) { | 1528 | /* Append the device type to the name */ |
1470 | /* Append the device type to the name */ | 1529 | if (features->device_type != BTN_TOOL_FINGER) |
1471 | if (features->device_type != BTN_TOOL_FINGER) | 1530 | strlcat(wacom_wac->name, " Pen", WACOM_NAME_MAX); |
1472 | strlcat(wacom_wac->name, " Pen", WACOM_NAME_MAX); | 1531 | else if (features->touch_max) |
1473 | else if (features->touch_max) | 1532 | strlcat(wacom_wac->name, " Finger", WACOM_NAME_MAX); |
1474 | strlcat(wacom_wac->name, " Finger", WACOM_NAME_MAX); | 1533 | else |
1475 | else | 1534 | strlcat(wacom_wac->name, " Pad", WACOM_NAME_MAX); |
1476 | strlcat(wacom_wac->name, " Pad", WACOM_NAME_MAX); | ||
1477 | 1535 | ||
1478 | error = wacom_add_shared_data(hdev); | 1536 | error = wacom_add_shared_data(hdev); |
1479 | if (error) | 1537 | if (error) |
1480 | goto fail_shared_data; | 1538 | goto fail_shared_data; |
1481 | } | ||
1482 | 1539 | ||
1483 | if (!(features->quirks & WACOM_QUIRK_MONITOR) && | 1540 | if (!(features->quirks & WACOM_QUIRK_MONITOR) && |
1484 | (features->quirks & WACOM_QUIRK_BATTERY)) { | 1541 | (features->quirks & WACOM_QUIRK_BATTERY)) { |
@@ -1531,7 +1588,7 @@ fail_register_inputs: | |||
1531 | wacom_clean_inputs(wacom); | 1588 | wacom_clean_inputs(wacom); |
1532 | wacom_destroy_battery(wacom); | 1589 | wacom_destroy_battery(wacom); |
1533 | fail_battery: | 1590 | fail_battery: |
1534 | wacom_remove_shared_data(wacom_wac); | 1591 | wacom_remove_shared_data(wacom); |
1535 | fail_shared_data: | 1592 | fail_shared_data: |
1536 | wacom_clean_inputs(wacom); | 1593 | wacom_clean_inputs(wacom); |
1537 | fail_allocate_inputs: | 1594 | fail_allocate_inputs: |
@@ -1554,7 +1611,7 @@ static void wacom_remove(struct hid_device *hdev) | |||
1554 | if (hdev->bus == BUS_BLUETOOTH) | 1611 | if (hdev->bus == BUS_BLUETOOTH) |
1555 | device_remove_file(&hdev->dev, &dev_attr_speed); | 1612 | device_remove_file(&hdev->dev, &dev_attr_speed); |
1556 | wacom_destroy_battery(wacom); | 1613 | wacom_destroy_battery(wacom); |
1557 | wacom_remove_shared_data(&wacom->wacom_wac); | 1614 | wacom_remove_shared_data(wacom); |
1558 | 1615 | ||
1559 | hid_set_drvdata(hdev, NULL); | 1616 | hid_set_drvdata(hdev, NULL); |
1560 | kfree(wacom); | 1617 | kfree(wacom); |