Lines Matching refs:wacom

93 	struct wacom *wacom = hid_get_drvdata(hdev);  in wacom_wac_pen_serial_enforce()  local
94 struct wacom_wac *wacom_wac = &wacom->wacom_wac; in wacom_wac_pen_serial_enforce()
161 struct wacom *wacom = hid_get_drvdata(hdev); in wacom_raw_event() local
169 memcpy(wacom->wacom_wac.data, raw_data, size); in wacom_raw_event()
171 wacom_wac_irq(&wacom->wacom_wac, size); in wacom_raw_event()
178 struct wacom *wacom = input_get_drvdata(dev); in wacom_open() local
180 return hid_hw_open(wacom->hdev); in wacom_open()
185 struct wacom *wacom = input_get_drvdata(dev); in wacom_close() local
191 if (wacom->hdev) in wacom_close()
192 hid_hw_close(wacom->hdev); in wacom_close()
214 struct wacom *wacom = hid_get_drvdata(hdev); in wacom_hid_usage_quirk() local
215 struct wacom_features *features = &wacom->wacom_wac.features; in wacom_hid_usage_quirk()
225 wacom->wacom_wac.mode_report = field->report->id; in wacom_hid_usage_quirk()
226 wacom->wacom_wac.mode_value = 2; in wacom_hid_usage_quirk()
297 struct wacom *wacom = hid_get_drvdata(hdev); in wacom_feature_mapping() local
298 struct wacom_features *features = &wacom->wacom_wac.features; in wacom_feature_mapping()
299 struct hid_data *hid_data = &wacom->wacom_wac.hid_data; in wacom_feature_mapping()
309 wacom->generic_has_leds = true; in wacom_feature_mapping()
352 wacom->wacom_wac.mode_report = field->report->id; in wacom_feature_mapping()
353 wacom->wacom_wac.mode_value = 0; in wacom_feature_mapping()
358 wacom->wacom_wac.mode_report = field->report->id; in wacom_feature_mapping()
359 wacom->wacom_wac.mode_value = 2; in wacom_feature_mapping()
367 wacom->wacom_wac.mode_report = field->report->id; in wacom_feature_mapping()
368 wacom->wacom_wac.mode_value = 0; in wacom_feature_mapping()
430 struct wacom *wacom = hid_get_drvdata(hdev); in wacom_usage_mapping() local
431 struct wacom_features *features = &wacom->wacom_wac.features; in wacom_usage_mapping()
486 struct wacom *wacom = hid_get_drvdata(hdev); in wacom_post_parse_hid() local
487 struct wacom_wac *wacom_wac = &wacom->wacom_wac; in wacom_post_parse_hid()
551 struct wacom *wacom = hid_get_drvdata(hdev); in wacom_hid_set_device_mode() local
552 struct hid_data *hid_data = &wacom->wacom_wac.hid_data; in wacom_hid_set_device_mode()
612 struct wacom *wacom = hid_get_drvdata(hdev); in wacom_bt_query_tablet_data() local
631 wacom->wacom_wac.bt_high_speed = speed; in wacom_bt_query_tablet_data()
645 wacom->wacom_wac.bt_features &= ~0x20; in wacom_bt_query_tablet_data()
647 wacom->wacom_wac.bt_features |= 0x20; in wacom_bt_query_tablet_data()
650 rep_data[1] = wacom->wacom_wac.bt_features; in wacom_bt_query_tablet_data()
655 wacom->wacom_wac.bt_high_speed = speed; in wacom_bt_query_tablet_data()
669 static int _wacom_query_tablet_data(struct wacom *wacom) in _wacom_query_tablet_data() argument
671 struct hid_device *hdev = wacom->hdev; in _wacom_query_tablet_data()
672 struct wacom_wac *wacom_wac = &wacom->wacom_wac; in _wacom_query_tablet_data()
713 struct wacom *wacom = hid_get_drvdata(hdev); in wacom_retrieve_hid_descriptor() local
714 struct usb_interface *intf = wacom->intf; in wacom_retrieve_hid_descriptor()
753 struct wacom *wacom = hid_get_drvdata(hdev); in wacom_are_sibling() local
754 struct wacom_features *features = &wacom->wacom_wac.features; in wacom_are_sibling()
755 struct wacom *sibling_wacom = hid_get_drvdata(sibling); in wacom_are_sibling()
853 struct wacom *wacom = res; in wacom_remove_shared_data() local
855 struct wacom_wac *wacom_wac = &wacom->wacom_wac; in wacom_remove_shared_data()
861 if (wacom_wac->shared->touch == wacom->hdev) in wacom_remove_shared_data()
863 else if (wacom_wac->shared->pen == wacom->hdev) in wacom_remove_shared_data()
873 struct wacom *wacom = hid_get_drvdata(hdev); in wacom_add_shared_data() local
874 struct wacom_wac *wacom_wac = &wacom->wacom_wac; in wacom_add_shared_data()
895 retval = devm_add_action(&hdev->dev, wacom_remove_shared_data, wacom); in wacom_add_shared_data()
898 wacom_remove_shared_data(wacom); in wacom_add_shared_data()
912 static int wacom_led_control(struct wacom *wacom) in wacom_led_control() argument
919 if (!wacom->led.groups) in wacom_led_control()
922 if (wacom->wacom_wac.features.type == REMOTE) in wacom_led_control()
925 if (wacom->wacom_wac.pid) { /* wireless connected */ in wacom_led_control()
929 else if (wacom->wacom_wac.features.type == INTUOSP2_BT) { in wacom_led_control()
937 if (wacom->wacom_wac.features.type == HID_GENERIC) { in wacom_led_control()
939 buf[1] = wacom->led.llv; in wacom_led_control()
940 buf[2] = wacom->led.groups[0].select & 0x03; in wacom_led_control()
942 } else if ((wacom->wacom_wac.features.type >= INTUOS5S && in wacom_led_control()
943 wacom->wacom_wac.features.type <= INTUOSPL)) { in wacom_led_control()
949 int ring_led = wacom->led.groups[0].select & 0x03; in wacom_led_control()
950 int ring_lum = (((wacom->led.llv & 0x60) >> 5) - 1) & 0x03; in wacom_led_control()
955 if (wacom->wacom_wac.pid) { in wacom_led_control()
956 wacom_get_report(wacom->hdev, HID_FEATURE_REPORT, in wacom_led_control()
963 else if (wacom->wacom_wac.features.type == INTUOSP2_BT) { in wacom_led_control()
970 buf[9] = wacom->led.llv; in wacom_led_control()
971 buf[10] = wacom->led.groups[0].select & 0x03; in wacom_led_control()
974 int led = wacom->led.groups[0].select | 0x4; in wacom_led_control()
976 if (wacom->wacom_wac.features.type == WACOM_21UX2 || in wacom_led_control()
977 wacom->wacom_wac.features.type == WACOM_24HD) in wacom_led_control()
978 led |= (wacom->led.groups[1].select << 4) | 0x40; in wacom_led_control()
982 buf[2] = wacom->led.llv; in wacom_led_control()
983 buf[3] = wacom->led.hlv; in wacom_led_control()
984 buf[4] = wacom->led.img_lum; in wacom_led_control()
987 retval = wacom_set_report(wacom->hdev, HID_FEATURE_REPORT, buf, buf_size, in wacom_led_control()
994 static int wacom_led_putimage(struct wacom *wacom, int button_id, u8 xfer_id, in wacom_led_putimage() argument
1008 retval = wacom_set_report(wacom->hdev, HID_FEATURE_REPORT, buf, 2, in wacom_led_putimage()
1019 retval = wacom_set_report(wacom->hdev, HID_FEATURE_REPORT, in wacom_led_putimage()
1028 wacom_set_report(wacom->hdev, HID_FEATURE_REPORT, buf, 2, in wacom_led_putimage()
1040 struct wacom *wacom = hid_get_drvdata(hdev); in wacom_led_select_store() local
1048 mutex_lock(&wacom->lock); in wacom_led_select_store()
1050 wacom->led.groups[set_id].select = id & 0x3; in wacom_led_select_store()
1051 err = wacom_led_control(wacom); in wacom_led_select_store()
1053 mutex_unlock(&wacom->lock); in wacom_led_select_store()
1068 struct wacom *wacom = hid_get_drvdata(hdev); \
1070 wacom->led.groups[SET_ID].select); \
1079 static ssize_t wacom_luminance_store(struct wacom *wacom, u8 *dest, in wacom_luminance_store() argument
1089 mutex_lock(&wacom->lock); in wacom_luminance_store()
1092 err = wacom_led_control(wacom); in wacom_luminance_store()
1094 mutex_unlock(&wacom->lock); in wacom_luminance_store()
1104 struct wacom *wacom = hid_get_drvdata(hdev); \
1106 return wacom_luminance_store(wacom, &wacom->led.field, \
1112 struct wacom *wacom = dev_get_drvdata(dev); \
1113 return scnprintf(buf, PAGE_SIZE, "%d\n", wacom->led.field); \
1127 struct wacom *wacom = hid_get_drvdata(hdev); in wacom_button_image_store() local
1143 mutex_lock(&wacom->lock); in wacom_button_image_store()
1145 err = wacom_led_putimage(wacom, button_id, xfer_id, len, buf); in wacom_button_image_store()
1147 mutex_unlock(&wacom->lock); in wacom_button_image_store()
1239 static int __wacom_devm_sysfs_create_group(struct wacom *wacom, in __wacom_devm_sysfs_create_group() argument
1261 devres_add(&wacom->hdev->dev, devres); in __wacom_devm_sysfs_create_group()
1266 static int wacom_devm_sysfs_create_group(struct wacom *wacom, in wacom_devm_sysfs_create_group() argument
1269 return __wacom_devm_sysfs_create_group(wacom, &wacom->hdev->dev.kobj, in wacom_devm_sysfs_create_group()
1280 static int wacom_devm_kfifo_alloc(struct wacom *wacom) in wacom_devm_kfifo_alloc() argument
1282 struct wacom_wac *wacom_wac = &wacom->wacom_wac; in wacom_devm_kfifo_alloc()
1299 devres_add(&wacom->hdev->dev, pen_fifo); in wacom_devm_kfifo_alloc()
1307 struct wacom *wacom = led->wacom; in wacom_leds_brightness_get() local
1309 if (wacom->led.max_hlv) in wacom_leds_brightness_get()
1310 return led->hlv * LED_FULL / wacom->led.max_hlv; in wacom_leds_brightness_get()
1312 if (wacom->led.max_llv) in wacom_leds_brightness_get()
1313 return led->llv * LED_FULL / wacom->led.max_llv; in wacom_leds_brightness_get()
1322 struct wacom *wacom = led->wacom; in __wacom_led_brightness_get() local
1324 if (wacom->led.groups[led->group].select != led->id) in __wacom_led_brightness_get()
1334 struct wacom *wacom = led->wacom; in wacom_led_brightness_set() local
1337 mutex_lock(&wacom->lock); in wacom_led_brightness_set()
1339 if (!wacom->led.groups || (brightness == LED_OFF && in wacom_led_brightness_set()
1340 wacom->led.groups[led->group].select != led->id)) { in wacom_led_brightness_set()
1345 led->llv = wacom->led.llv = wacom->led.max_llv * brightness / LED_FULL; in wacom_led_brightness_set()
1346 led->hlv = wacom->led.hlv = wacom->led.max_hlv * brightness / LED_FULL; in wacom_led_brightness_set()
1348 wacom->led.groups[led->group].select = led->id; in wacom_led_brightness_set()
1350 error = wacom_led_control(wacom); in wacom_led_brightness_set()
1353 mutex_unlock(&wacom->lock); in wacom_led_brightness_set()
1363 static int wacom_led_register_one(struct device *dev, struct wacom *wacom, in wacom_led_register_one() argument
1382 hid_err(wacom->hdev, in wacom_led_register_one()
1391 led->wacom = wacom; in wacom_led_register_one()
1392 led->llv = wacom->led.llv; in wacom_led_register_one()
1393 led->hlv = wacom->led.hlv; in wacom_led_register_one()
1407 hid_err(wacom->hdev, in wacom_led_register_one()
1425 struct wacom *wacom, in wacom_led_groups_alloc_and_register_one() argument
1432 if (group_id >= wacom->led.count || count <= 0) in wacom_led_groups_alloc_and_register_one()
1435 if (!devres_open_group(dev, &wacom->led.groups[group_id], GFP_KERNEL)) in wacom_led_groups_alloc_and_register_one()
1444 wacom->led.groups[group_id].leds = leds; in wacom_led_groups_alloc_and_register_one()
1445 wacom->led.groups[group_id].count = count; in wacom_led_groups_alloc_and_register_one()
1448 error = wacom_led_register_one(dev, wacom, &leds[i], in wacom_led_groups_alloc_and_register_one()
1454 wacom->led.groups[group_id].dev = dev; in wacom_led_groups_alloc_and_register_one()
1456 devres_close_group(dev, &wacom->led.groups[group_id]); in wacom_led_groups_alloc_and_register_one()
1467 error = devm_add_action_or_reset(&wacom->hdev->dev, in wacom_led_groups_alloc_and_register_one()
1469 &wacom->led.groups[group_id]); in wacom_led_groups_alloc_and_register_one()
1476 devres_release_group(dev, &wacom->led.groups[group_id]); in wacom_led_groups_alloc_and_register_one()
1480 struct wacom_led *wacom_led_find(struct wacom *wacom, unsigned int group_id, in wacom_led_find() argument
1485 if (group_id >= wacom->led.count) in wacom_led_find()
1488 group = &wacom->led.groups[group_id]; in wacom_led_find()
1504 struct wacom_led *wacom_led_next(struct wacom *wacom, struct wacom_led *cur) in wacom_led_next() argument
1509 if (!wacom || !cur) in wacom_led_next()
1516 next_led = wacom_led_find(wacom, group, ++next); in wacom_led_next()
1526 struct wacom *wacom = data; in wacom_led_groups_release() local
1528 wacom->led.groups = NULL; in wacom_led_groups_release()
1529 wacom->led.count = 0; in wacom_led_groups_release()
1532 static int wacom_led_groups_allocate(struct wacom *wacom, int count) in wacom_led_groups_allocate() argument
1534 struct device *dev = &wacom->hdev->dev; in wacom_led_groups_allocate()
1543 error = devm_add_action_or_reset(dev, wacom_led_groups_release, wacom); in wacom_led_groups_allocate()
1547 wacom->led.groups = groups; in wacom_led_groups_allocate()
1548 wacom->led.count = count; in wacom_led_groups_allocate()
1553 static int wacom_leds_alloc_and_register(struct wacom *wacom, int group_count, in wacom_leds_alloc_and_register() argument
1559 if (!wacom->wacom_wac.pad_input) in wacom_leds_alloc_and_register()
1562 dev = &wacom->wacom_wac.pad_input->dev; in wacom_leds_alloc_and_register()
1564 error = wacom_led_groups_allocate(wacom, group_count); in wacom_leds_alloc_and_register()
1569 error = wacom_led_groups_alloc_and_register_one(dev, wacom, i, in wacom_leds_alloc_and_register()
1579 int wacom_initialize_leds(struct wacom *wacom) in wacom_initialize_leds() argument
1583 if (!(wacom->wacom_wac.features.device_type & WACOM_DEVICETYPE_PAD)) in wacom_initialize_leds()
1587 switch (wacom->wacom_wac.features.type) { in wacom_initialize_leds()
1589 if (!wacom->generic_has_leds) in wacom_initialize_leds()
1591 wacom->led.llv = 100; in wacom_initialize_leds()
1592 wacom->led.max_llv = 100; in wacom_initialize_leds()
1594 error = wacom_leds_alloc_and_register(wacom, 1, 4, false); in wacom_initialize_leds()
1596 hid_err(wacom->hdev, in wacom_initialize_leds()
1601 error = wacom_devm_sysfs_create_group(wacom, in wacom_initialize_leds()
1609 wacom->led.llv = 10; in wacom_initialize_leds()
1610 wacom->led.hlv = 20; in wacom_initialize_leds()
1611 wacom->led.max_llv = 127; in wacom_initialize_leds()
1612 wacom->led.max_hlv = 127; in wacom_initialize_leds()
1613 wacom->led.img_lum = 10; in wacom_initialize_leds()
1615 error = wacom_leds_alloc_and_register(wacom, 1, 4, false); in wacom_initialize_leds()
1617 hid_err(wacom->hdev, in wacom_initialize_leds()
1622 error = wacom_devm_sysfs_create_group(wacom, in wacom_initialize_leds()
1628 wacom->led.llv = 0; in wacom_initialize_leds()
1629 wacom->led.hlv = 0; in wacom_initialize_leds()
1630 wacom->led.img_lum = 0; in wacom_initialize_leds()
1632 error = wacom_leds_alloc_and_register(wacom, 2, 4, false); in wacom_initialize_leds()
1634 hid_err(wacom->hdev, in wacom_initialize_leds()
1639 error = wacom_devm_sysfs_create_group(wacom, in wacom_initialize_leds()
1649 wacom->led.llv = 32; in wacom_initialize_leds()
1650 wacom->led.max_llv = 96; in wacom_initialize_leds()
1652 error = wacom_leds_alloc_and_register(wacom, 1, 4, false); in wacom_initialize_leds()
1654 hid_err(wacom->hdev, in wacom_initialize_leds()
1659 error = wacom_devm_sysfs_create_group(wacom, in wacom_initialize_leds()
1664 wacom->led.llv = 50; in wacom_initialize_leds()
1665 wacom->led.max_llv = 100; in wacom_initialize_leds()
1666 error = wacom_leds_alloc_and_register(wacom, 1, 4, false); in wacom_initialize_leds()
1668 hid_err(wacom->hdev, in wacom_initialize_leds()
1675 wacom->led.llv = 255; in wacom_initialize_leds()
1676 wacom->led.max_llv = 255; in wacom_initialize_leds()
1677 error = wacom_led_groups_allocate(wacom, 5); in wacom_initialize_leds()
1679 hid_err(wacom->hdev, in wacom_initialize_leds()
1690 hid_err(wacom->hdev, in wacom_initialize_leds()
1700 struct wacom *wacom = container_of(work, struct wacom, init_work.work); in wacom_init_work() local
1702 _wacom_query_tablet_data(wacom); in wacom_init_work()
1703 wacom_led_control(wacom); in wacom_init_work()
1706 static void wacom_query_tablet_data(struct wacom *wacom) in wacom_query_tablet_data() argument
1708 schedule_delayed_work(&wacom->init_work, msecs_to_jiffies(1000)); in wacom_query_tablet_data()
1728 val->strval = battery->wacom->wacom_wac.name; in wacom_battery_get_property()
1760 static int __wacom_initialize_battery(struct wacom *wacom, in __wacom_initialize_battery() argument
1764 struct device *dev = &wacom->hdev->dev; in __wacom_initialize_battery()
1774 battery->wacom = wacom; in __wacom_initialize_battery()
1792 power_supply_powers(ps_bat, &wacom->hdev->dev); in __wacom_initialize_battery()
1804 static int wacom_initialize_battery(struct wacom *wacom) in wacom_initialize_battery() argument
1806 if (wacom->wacom_wac.features.quirks & WACOM_QUIRK_BATTERY) in wacom_initialize_battery()
1807 return __wacom_initialize_battery(wacom, &wacom->battery); in wacom_initialize_battery()
1812 static void wacom_destroy_battery(struct wacom *wacom) in wacom_destroy_battery() argument
1814 if (wacom->battery.battery) { in wacom_destroy_battery()
1815 devres_release_group(&wacom->hdev->dev, in wacom_destroy_battery()
1816 &wacom->battery.bat_desc); in wacom_destroy_battery()
1817 wacom->battery.battery = NULL; in wacom_destroy_battery()
1826 struct wacom *wacom = hid_get_drvdata(hdev); in wacom_show_speed() local
1828 return snprintf(buf, PAGE_SIZE, "%i\n", wacom->wacom_wac.bt_high_speed); in wacom_show_speed()
1836 struct wacom *wacom = hid_get_drvdata(hdev); in wacom_store_speed() local
1845 wacom_bt_query_tablet_data(hdev, new_speed, &wacom->wacom_wac.features); in wacom_store_speed()
1860 struct wacom *wacom = hid_get_drvdata(hdev); in wacom_show_remote_mode() local
1863 mode = wacom->led.groups[index].select; in wacom_show_remote_mode()
1893 static int wacom_remote_create_attr_group(struct wacom *wacom, __u32 serial, in wacom_remote_create_attr_group() argument
1897 struct wacom_remote *remote = wacom->remote; in wacom_remote_create_attr_group()
1899 remote->remotes[index].group.name = devm_kasprintf(&wacom->hdev->dev, in wacom_remote_create_attr_group()
1905 error = __wacom_devm_sysfs_create_group(wacom, remote->remote_dir, in wacom_remote_create_attr_group()
1909 hid_err(wacom->hdev, in wacom_remote_create_attr_group()
1917 static int wacom_cmd_unpair_remote(struct wacom *wacom, unsigned char selector) in wacom_cmd_unpair_remote() argument
1930 retval = wacom_set_report(wacom->hdev, HID_OUTPUT_REPORT, buf, in wacom_cmd_unpair_remote()
1944 struct wacom *wacom = hid_get_drvdata(hdev); in wacom_store_unpair_remote() local
1950 hid_info(wacom->hdev, "remote: unrecognized unpair code: %s\n", in wacom_store_unpair_remote()
1955 mutex_lock(&wacom->lock); in wacom_store_unpair_remote()
1957 err = wacom_cmd_unpair_remote(wacom, selector); in wacom_store_unpair_remote()
1958 mutex_unlock(&wacom->lock); in wacom_store_unpair_remote()
1975 struct wacom *wacom = data; in wacom_remotes_destroy() local
1976 struct wacom_remote *remote = wacom->remote; in wacom_remotes_destroy()
1983 wacom->remote = NULL; in wacom_remotes_destroy()
1986 static int wacom_initialize_remotes(struct wacom *wacom) in wacom_initialize_remotes() argument
1992 if (wacom->wacom_wac.features.type != REMOTE) in wacom_initialize_remotes()
1995 remote = devm_kzalloc(&wacom->hdev->dev, sizeof(*wacom->remote), in wacom_initialize_remotes()
2000 wacom->remote = remote; in wacom_initialize_remotes()
2008 hid_err(wacom->hdev, "failed allocating remote_fifo\n"); in wacom_initialize_remotes()
2019 &wacom->hdev->dev.kobj); in wacom_initialize_remotes()
2026 hid_err(wacom->hdev, in wacom_initialize_remotes()
2032 wacom->led.groups[i].select = WACOM_STATUS_UNKNOWN; in wacom_initialize_remotes()
2036 error = devm_add_action_or_reset(&wacom->hdev->dev, in wacom_initialize_remotes()
2037 wacom_remotes_destroy, wacom); in wacom_initialize_remotes()
2044 static struct input_dev *wacom_allocate_input(struct wacom *wacom) in wacom_allocate_input() argument
2047 struct hid_device *hdev = wacom->hdev; in wacom_allocate_input()
2048 struct wacom_wac *wacom_wac = &(wacom->wacom_wac); in wacom_allocate_input()
2064 input_set_drvdata(input_dev, wacom); in wacom_allocate_input()
2069 static int wacom_allocate_inputs(struct wacom *wacom) in wacom_allocate_inputs() argument
2071 struct wacom_wac *wacom_wac = &(wacom->wacom_wac); in wacom_allocate_inputs()
2073 wacom_wac->pen_input = wacom_allocate_input(wacom); in wacom_allocate_inputs()
2074 wacom_wac->touch_input = wacom_allocate_input(wacom); in wacom_allocate_inputs()
2075 wacom_wac->pad_input = wacom_allocate_input(wacom); in wacom_allocate_inputs()
2088 static int wacom_register_inputs(struct wacom *wacom) in wacom_register_inputs() argument
2091 struct wacom_wac *wacom_wac = &(wacom->wacom_wac); in wacom_register_inputs()
2181 struct wacom *wacom = container_of(work, struct wacom, battery_work); in wacom_battery_work() local
2183 if ((wacom->wacom_wac.features.quirks & WACOM_QUIRK_BATTERY) && in wacom_battery_work()
2184 !wacom->battery.battery) { in wacom_battery_work()
2185 wacom_initialize_battery(wacom); in wacom_battery_work()
2187 else if (!(wacom->wacom_wac.features.quirks & WACOM_QUIRK_BATTERY) && in wacom_battery_work()
2188 wacom->battery.battery) { in wacom_battery_work()
2189 wacom_destroy_battery(wacom); in wacom_battery_work()
2210 static void wacom_update_name(struct wacom *wacom, const char *suffix) in wacom_update_name() argument
2212 struct wacom_wac *wacom_wac = &wacom->wacom_wac; in wacom_update_name()
2218 char *product_name = wacom->hdev->name; in wacom_update_name()
2220 if (hid_is_usb(wacom->hdev)) { in wacom_update_name()
2221 struct usb_interface *intf = to_usb_interface(wacom->hdev->dev.parent); in wacom_update_name()
2226 if (wacom->hdev->bus == BUS_I2C) { in wacom_update_name()
2228 features->name, wacom->hdev->product); in wacom_update_name()
2265 static void wacom_release_resources(struct wacom *wacom) in wacom_release_resources() argument
2267 struct hid_device *hdev = wacom->hdev; in wacom_release_resources()
2269 if (!wacom->resources) in wacom_release_resources()
2272 devres_release_group(&hdev->dev, wacom); in wacom_release_resources()
2274 wacom->resources = false; in wacom_release_resources()
2276 wacom->wacom_wac.pen_input = NULL; in wacom_release_resources()
2277 wacom->wacom_wac.touch_input = NULL; in wacom_release_resources()
2278 wacom->wacom_wac.pad_input = NULL; in wacom_release_resources()
2301 static int wacom_parse_and_register(struct wacom *wacom, bool wireless) in wacom_parse_and_register() argument
2303 struct wacom_wac *wacom_wac = &wacom->wacom_wac; in wacom_parse_and_register()
2305 struct hid_device *hdev = wacom->hdev; in wacom_parse_and_register()
2313 if (!devres_open_group(&hdev->dev, wacom, GFP_KERNEL)) in wacom_parse_and_register()
2316 wacom->resources = true; in wacom_parse_and_register()
2318 error = wacom_allocate_inputs(wacom); in wacom_parse_and_register()
2342 wacom_setup_device_quirks(wacom); in wacom_parse_and_register()
2360 wacom_update_name(wacom, wireless ? " (WL)" : ""); in wacom_parse_and_register()
2376 error = wacom_initialize_battery(wacom); in wacom_parse_and_register()
2381 error = wacom_register_inputs(wacom); in wacom_parse_and_register()
2385 if (wacom->wacom_wac.features.device_type & WACOM_DEVICETYPE_PAD) { in wacom_parse_and_register()
2386 error = wacom_initialize_leds(wacom); in wacom_parse_and_register()
2390 error = wacom_initialize_remotes(wacom); in wacom_parse_and_register()
2407 wacom_query_tablet_data(wacom); in wacom_parse_and_register()
2413 cancel_delayed_work_sync(&wacom->init_work); in wacom_parse_and_register()
2414 _wacom_query_tablet_data(wacom); in wacom_parse_and_register()
2423 devres_close_group(&hdev->dev, wacom); in wacom_parse_and_register()
2430 wacom_release_resources(wacom); in wacom_parse_and_register()
2436 struct wacom *wacom = container_of(work, struct wacom, wireless_work); in wacom_wireless_work() local
2437 struct usb_device *usbdev = wacom->usbdev; in wacom_wireless_work()
2438 struct wacom_wac *wacom_wac = &wacom->wacom_wac; in wacom_wireless_work()
2440 struct wacom *wacom1, *wacom2; in wacom_wireless_work()
2449 wacom_destroy_battery(wacom); in wacom_wireless_work()
2467 hid_info(wacom->hdev, "wireless tablet disconnected\n"); in wacom_wireless_work()
2471 hid_info(wacom->hdev, "wireless tablet connected with PID %x\n", in wacom_wireless_work()
2482 hid_info(wacom->hdev, "ignoring unknown PID.\n"); in wacom_wireless_work()
2511 error = wacom_initialize_battery(wacom); in wacom_wireless_work()
2524 static void wacom_remote_destroy_one(struct wacom *wacom, unsigned int index) in wacom_remote_destroy_one() argument
2526 struct wacom_remote *remote = wacom->remote; in wacom_remote_destroy_one()
2539 devres_release_group(&wacom->hdev->dev, in wacom_remote_destroy_one()
2543 devres_release_group(&wacom->hdev->dev, in wacom_remote_destroy_one()
2549 wacom->led.groups[i].select = WACOM_STATUS_UNKNOWN; in wacom_remote_destroy_one()
2554 static int wacom_remote_create_one(struct wacom *wacom, u32 serial, in wacom_remote_create_one() argument
2557 struct wacom_remote *remote = wacom->remote; in wacom_remote_create_one()
2558 struct device *dev = &wacom->hdev->dev; in wacom_remote_create_one()
2577 error = wacom_remote_create_attr_group(wacom, serial, index); in wacom_remote_create_one()
2581 remote->remotes[index].input = wacom_allocate_input(wacom); in wacom_remote_create_one()
2587 remote->remotes[index].input->name = wacom->wacom_wac.pad_name; in wacom_remote_create_one()
2595 &wacom->wacom_wac); in wacom_remote_create_one()
2607 wacom, index, 3, true); in wacom_remote_create_one()
2622 static int wacom_remote_attach_battery(struct wacom *wacom, int index) in wacom_remote_attach_battery() argument
2624 struct wacom_remote *remote = wacom->remote; in wacom_remote_attach_battery()
2633 if (wacom->led.groups[index].select == WACOM_STATUS_UNKNOWN) in wacom_remote_attach_battery()
2636 error = __wacom_initialize_battery(wacom, in wacom_remote_attach_battery()
2637 &wacom->remote->remotes[index].battery); in wacom_remote_attach_battery()
2646 struct wacom *wacom = container_of(work, struct wacom, remote_work); in wacom_remote_work() local
2647 struct wacom_remote *remote = wacom->remote; in wacom_remote_work()
2659 hid_err(wacom->hdev, in wacom_remote_work()
2666 wacom_schedule_work(&wacom->wacom_wac, WACOM_WORKER_REMOTE); in wacom_remote_work()
2675 wacom_remote_attach_battery(wacom, i); in wacom_remote_work()
2680 wacom_remote_destroy_one(wacom, i); in wacom_remote_work()
2682 wacom_remote_create_one(wacom, serial, i); in wacom_remote_work()
2685 wacom_remote_destroy_one(wacom, i); in wacom_remote_work()
2692 struct wacom *wacom = container_of(work, struct wacom, mode_change_work); in wacom_mode_change_work() local
2693 struct wacom_shared *shared = wacom->wacom_wac.shared; in wacom_mode_change_work()
2694 struct wacom *wacom1 = NULL; in wacom_mode_change_work()
2695 struct wacom *wacom2 = NULL; in wacom_mode_change_work()
2696 bool is_direct = wacom->wacom_wac.is_direct_mode; in wacom_mode_change_work()
2733 struct wacom *wacom; in wacom_probe() local
2746 wacom = devm_kzalloc(&hdev->dev, sizeof(struct wacom), GFP_KERNEL); in wacom_probe()
2747 if (!wacom) in wacom_probe()
2750 hid_set_drvdata(hdev, wacom); in wacom_probe()
2751 wacom->hdev = hdev; in wacom_probe()
2753 wacom_wac = &wacom->wacom_wac; in wacom_probe()
2760 error = wacom_devm_kfifo_alloc(wacom); in wacom_probe()
2771 wacom->usbdev = dev; in wacom_probe()
2772 wacom->intf = intf; in wacom_probe()
2775 mutex_init(&wacom->lock); in wacom_probe()
2776 INIT_DELAYED_WORK(&wacom->init_work, wacom_init_work); in wacom_probe()
2777 INIT_WORK(&wacom->wireless_work, wacom_wireless_work); in wacom_probe()
2778 INIT_WORK(&wacom->battery_work, wacom_battery_work); in wacom_probe()
2779 INIT_WORK(&wacom->remote_work, wacom_remote_work); in wacom_probe()
2780 INIT_WORK(&wacom->mode_change_work, wacom_mode_change_work); in wacom_probe()
2789 error = wacom_parse_and_register(wacom, false); in wacom_probe()
2806 struct wacom *wacom = hid_get_drvdata(hdev); in wacom_remove() local
2807 struct wacom_wac *wacom_wac = &wacom->wacom_wac; in wacom_remove()
2815 cancel_delayed_work_sync(&wacom->init_work); in wacom_remove()
2816 cancel_work_sync(&wacom->wireless_work); in wacom_remove()
2817 cancel_work_sync(&wacom->battery_work); in wacom_remove()
2818 cancel_work_sync(&wacom->remote_work); in wacom_remove()
2819 cancel_work_sync(&wacom->mode_change_work); in wacom_remove()
2824 wacom_led_groups_release(wacom); in wacom_remove()
2826 if (wacom->wacom_wac.features.type != REMOTE) in wacom_remove()
2827 wacom_release_resources(wacom); in wacom_remove()
2833 struct wacom *wacom = hid_get_drvdata(hdev); in wacom_resume() local
2835 mutex_lock(&wacom->lock); in wacom_resume()
2838 _wacom_query_tablet_data(wacom); in wacom_resume()
2839 wacom_led_control(wacom); in wacom_resume()
2841 mutex_unlock(&wacom->lock); in wacom_resume()