• Home
  • Raw
  • Download

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()
350 wacom->wacom_wac.mode_report = field->report->id; in wacom_feature_mapping()
351 wacom->wacom_wac.mode_value = 0; in wacom_feature_mapping()
356 wacom->wacom_wac.mode_report = field->report->id; in wacom_feature_mapping()
357 wacom->wacom_wac.mode_value = 2; in wacom_feature_mapping()
365 wacom->wacom_wac.mode_report = field->report->id; in wacom_feature_mapping()
366 wacom->wacom_wac.mode_value = 0; in wacom_feature_mapping()
428 struct wacom *wacom = hid_get_drvdata(hdev); in wacom_usage_mapping() local
429 struct wacom_features *features = &wacom->wacom_wac.features; in wacom_usage_mapping()
484 struct wacom *wacom = hid_get_drvdata(hdev); in wacom_post_parse_hid() local
485 struct wacom_wac *wacom_wac = &wacom->wacom_wac; in wacom_post_parse_hid()
549 struct wacom *wacom = hid_get_drvdata(hdev); in wacom_hid_set_device_mode() local
550 struct hid_data *hid_data = &wacom->wacom_wac.hid_data; in wacom_hid_set_device_mode()
610 struct wacom *wacom = hid_get_drvdata(hdev); in wacom_bt_query_tablet_data() local
629 wacom->wacom_wac.bt_high_speed = speed; in wacom_bt_query_tablet_data()
643 wacom->wacom_wac.bt_features &= ~0x20; in wacom_bt_query_tablet_data()
645 wacom->wacom_wac.bt_features |= 0x20; in wacom_bt_query_tablet_data()
648 rep_data[1] = wacom->wacom_wac.bt_features; in wacom_bt_query_tablet_data()
653 wacom->wacom_wac.bt_high_speed = speed; in wacom_bt_query_tablet_data()
667 static int _wacom_query_tablet_data(struct wacom *wacom) in _wacom_query_tablet_data() argument
669 struct hid_device *hdev = wacom->hdev; in _wacom_query_tablet_data()
670 struct wacom_wac *wacom_wac = &wacom->wacom_wac; in _wacom_query_tablet_data()
711 struct wacom *wacom = hid_get_drvdata(hdev); in wacom_retrieve_hid_descriptor() local
712 struct usb_interface *intf = wacom->intf; in wacom_retrieve_hid_descriptor()
751 struct wacom *wacom = hid_get_drvdata(hdev); in wacom_are_sibling() local
752 struct wacom_features *features = &wacom->wacom_wac.features; in wacom_are_sibling()
753 struct wacom *sibling_wacom = hid_get_drvdata(sibling); in wacom_are_sibling()
851 struct wacom *wacom = res; in wacom_remove_shared_data() local
853 struct wacom_wac *wacom_wac = &wacom->wacom_wac; in wacom_remove_shared_data()
859 if (wacom_wac->shared->touch == wacom->hdev) in wacom_remove_shared_data()
861 else if (wacom_wac->shared->pen == wacom->hdev) in wacom_remove_shared_data()
871 struct wacom *wacom = hid_get_drvdata(hdev); in wacom_add_shared_data() local
872 struct wacom_wac *wacom_wac = &wacom->wacom_wac; in wacom_add_shared_data()
893 retval = devm_add_action(&hdev->dev, wacom_remove_shared_data, wacom); in wacom_add_shared_data()
896 wacom_remove_shared_data(wacom); in wacom_add_shared_data()
910 static int wacom_led_control(struct wacom *wacom) in wacom_led_control() argument
917 if (!wacom->led.groups) in wacom_led_control()
920 if (wacom->wacom_wac.features.type == REMOTE) in wacom_led_control()
923 if (wacom->wacom_wac.pid) { /* wireless connected */ in wacom_led_control()
927 else if (wacom->wacom_wac.features.type == INTUOSP2_BT) { in wacom_led_control()
935 if (wacom->wacom_wac.features.type == HID_GENERIC) { in wacom_led_control()
937 buf[1] = wacom->led.llv; in wacom_led_control()
938 buf[2] = wacom->led.groups[0].select & 0x03; in wacom_led_control()
940 } else if ((wacom->wacom_wac.features.type >= INTUOS5S && in wacom_led_control()
941 wacom->wacom_wac.features.type <= INTUOSPL)) { in wacom_led_control()
947 int ring_led = wacom->led.groups[0].select & 0x03; in wacom_led_control()
948 int ring_lum = (((wacom->led.llv & 0x60) >> 5) - 1) & 0x03; in wacom_led_control()
953 if (wacom->wacom_wac.pid) { in wacom_led_control()
954 wacom_get_report(wacom->hdev, HID_FEATURE_REPORT, in wacom_led_control()
961 else if (wacom->wacom_wac.features.type == INTUOSP2_BT) { in wacom_led_control()
968 buf[9] = wacom->led.llv; in wacom_led_control()
969 buf[10] = wacom->led.groups[0].select & 0x03; in wacom_led_control()
972 int led = wacom->led.groups[0].select | 0x4; in wacom_led_control()
974 if (wacom->wacom_wac.features.type == WACOM_21UX2 || in wacom_led_control()
975 wacom->wacom_wac.features.type == WACOM_24HD) in wacom_led_control()
976 led |= (wacom->led.groups[1].select << 4) | 0x40; in wacom_led_control()
980 buf[2] = wacom->led.llv; in wacom_led_control()
981 buf[3] = wacom->led.hlv; in wacom_led_control()
982 buf[4] = wacom->led.img_lum; in wacom_led_control()
985 retval = wacom_set_report(wacom->hdev, HID_FEATURE_REPORT, buf, buf_size, in wacom_led_control()
992 static int wacom_led_putimage(struct wacom *wacom, int button_id, u8 xfer_id, in wacom_led_putimage() argument
1006 retval = wacom_set_report(wacom->hdev, HID_FEATURE_REPORT, buf, 2, in wacom_led_putimage()
1017 retval = wacom_set_report(wacom->hdev, HID_FEATURE_REPORT, in wacom_led_putimage()
1026 wacom_set_report(wacom->hdev, HID_FEATURE_REPORT, buf, 2, in wacom_led_putimage()
1038 struct wacom *wacom = hid_get_drvdata(hdev); in wacom_led_select_store() local
1046 mutex_lock(&wacom->lock); in wacom_led_select_store()
1048 wacom->led.groups[set_id].select = id & 0x3; in wacom_led_select_store()
1049 err = wacom_led_control(wacom); in wacom_led_select_store()
1051 mutex_unlock(&wacom->lock); in wacom_led_select_store()
1066 struct wacom *wacom = hid_get_drvdata(hdev); \
1068 wacom->led.groups[SET_ID].select); \
1077 static ssize_t wacom_luminance_store(struct wacom *wacom, u8 *dest, in wacom_luminance_store() argument
1087 mutex_lock(&wacom->lock); in wacom_luminance_store()
1090 err = wacom_led_control(wacom); in wacom_luminance_store()
1092 mutex_unlock(&wacom->lock); in wacom_luminance_store()
1102 struct wacom *wacom = hid_get_drvdata(hdev); \
1104 return wacom_luminance_store(wacom, &wacom->led.field, \
1110 struct wacom *wacom = dev_get_drvdata(dev); \
1111 return scnprintf(buf, PAGE_SIZE, "%d\n", wacom->led.field); \
1125 struct wacom *wacom = hid_get_drvdata(hdev); in wacom_button_image_store() local
1141 mutex_lock(&wacom->lock); in wacom_button_image_store()
1143 err = wacom_led_putimage(wacom, button_id, xfer_id, len, buf); in wacom_button_image_store()
1145 mutex_unlock(&wacom->lock); in wacom_button_image_store()
1237 static int __wacom_devm_sysfs_create_group(struct wacom *wacom, in __wacom_devm_sysfs_create_group() argument
1259 devres_add(&wacom->hdev->dev, devres); in __wacom_devm_sysfs_create_group()
1264 static int wacom_devm_sysfs_create_group(struct wacom *wacom, in wacom_devm_sysfs_create_group() argument
1267 return __wacom_devm_sysfs_create_group(wacom, &wacom->hdev->dev.kobj, in wacom_devm_sysfs_create_group()
1273 struct wacom *wacom = led->wacom; in wacom_leds_brightness_get() local
1275 if (wacom->led.max_hlv) in wacom_leds_brightness_get()
1276 return led->hlv * LED_FULL / wacom->led.max_hlv; in wacom_leds_brightness_get()
1278 if (wacom->led.max_llv) in wacom_leds_brightness_get()
1279 return led->llv * LED_FULL / wacom->led.max_llv; in wacom_leds_brightness_get()
1288 struct wacom *wacom = led->wacom; in __wacom_led_brightness_get() local
1290 if (wacom->led.groups[led->group].select != led->id) in __wacom_led_brightness_get()
1300 struct wacom *wacom = led->wacom; in wacom_led_brightness_set() local
1303 mutex_lock(&wacom->lock); in wacom_led_brightness_set()
1305 if (!wacom->led.groups || (brightness == LED_OFF && in wacom_led_brightness_set()
1306 wacom->led.groups[led->group].select != led->id)) { in wacom_led_brightness_set()
1311 led->llv = wacom->led.llv = wacom->led.max_llv * brightness / LED_FULL; in wacom_led_brightness_set()
1312 led->hlv = wacom->led.hlv = wacom->led.max_hlv * brightness / LED_FULL; in wacom_led_brightness_set()
1314 wacom->led.groups[led->group].select = led->id; in wacom_led_brightness_set()
1316 error = wacom_led_control(wacom); in wacom_led_brightness_set()
1319 mutex_unlock(&wacom->lock); in wacom_led_brightness_set()
1329 static int wacom_led_register_one(struct device *dev, struct wacom *wacom, in wacom_led_register_one() argument
1348 hid_err(wacom->hdev, in wacom_led_register_one()
1357 led->wacom = wacom; in wacom_led_register_one()
1358 led->llv = wacom->led.llv; in wacom_led_register_one()
1359 led->hlv = wacom->led.hlv; in wacom_led_register_one()
1373 hid_err(wacom->hdev, in wacom_led_register_one()
1391 struct wacom *wacom, in wacom_led_groups_alloc_and_register_one() argument
1398 if (group_id >= wacom->led.count || count <= 0) in wacom_led_groups_alloc_and_register_one()
1401 if (!devres_open_group(dev, &wacom->led.groups[group_id], GFP_KERNEL)) in wacom_led_groups_alloc_and_register_one()
1410 wacom->led.groups[group_id].leds = leds; in wacom_led_groups_alloc_and_register_one()
1411 wacom->led.groups[group_id].count = count; in wacom_led_groups_alloc_and_register_one()
1414 error = wacom_led_register_one(dev, wacom, &leds[i], in wacom_led_groups_alloc_and_register_one()
1420 wacom->led.groups[group_id].dev = dev; in wacom_led_groups_alloc_and_register_one()
1422 devres_close_group(dev, &wacom->led.groups[group_id]); in wacom_led_groups_alloc_and_register_one()
1433 error = devm_add_action_or_reset(&wacom->hdev->dev, in wacom_led_groups_alloc_and_register_one()
1435 &wacom->led.groups[group_id]); in wacom_led_groups_alloc_and_register_one()
1442 devres_release_group(dev, &wacom->led.groups[group_id]); in wacom_led_groups_alloc_and_register_one()
1446 struct wacom_led *wacom_led_find(struct wacom *wacom, unsigned int group_id, in wacom_led_find() argument
1451 if (group_id >= wacom->led.count) in wacom_led_find()
1454 group = &wacom->led.groups[group_id]; in wacom_led_find()
1470 struct wacom_led *wacom_led_next(struct wacom *wacom, struct wacom_led *cur) in wacom_led_next() argument
1475 if (!wacom || !cur) in wacom_led_next()
1482 next_led = wacom_led_find(wacom, group, ++next); in wacom_led_next()
1492 struct wacom *wacom = data; in wacom_led_groups_release() local
1494 wacom->led.groups = NULL; in wacom_led_groups_release()
1495 wacom->led.count = 0; in wacom_led_groups_release()
1498 static int wacom_led_groups_allocate(struct wacom *wacom, int count) in wacom_led_groups_allocate() argument
1500 struct device *dev = &wacom->hdev->dev; in wacom_led_groups_allocate()
1509 error = devm_add_action_or_reset(dev, wacom_led_groups_release, wacom); in wacom_led_groups_allocate()
1513 wacom->led.groups = groups; in wacom_led_groups_allocate()
1514 wacom->led.count = count; in wacom_led_groups_allocate()
1519 static int wacom_leds_alloc_and_register(struct wacom *wacom, int group_count, in wacom_leds_alloc_and_register() argument
1525 if (!wacom->wacom_wac.pad_input) in wacom_leds_alloc_and_register()
1528 dev = &wacom->wacom_wac.pad_input->dev; in wacom_leds_alloc_and_register()
1530 error = wacom_led_groups_allocate(wacom, group_count); in wacom_leds_alloc_and_register()
1535 error = wacom_led_groups_alloc_and_register_one(dev, wacom, i, in wacom_leds_alloc_and_register()
1545 int wacom_initialize_leds(struct wacom *wacom) in wacom_initialize_leds() argument
1549 if (!(wacom->wacom_wac.features.device_type & WACOM_DEVICETYPE_PAD)) in wacom_initialize_leds()
1553 switch (wacom->wacom_wac.features.type) { in wacom_initialize_leds()
1555 if (!wacom->generic_has_leds) in wacom_initialize_leds()
1557 wacom->led.llv = 100; in wacom_initialize_leds()
1558 wacom->led.max_llv = 100; in wacom_initialize_leds()
1560 error = wacom_leds_alloc_and_register(wacom, 1, 4, false); in wacom_initialize_leds()
1562 hid_err(wacom->hdev, in wacom_initialize_leds()
1567 error = wacom_devm_sysfs_create_group(wacom, in wacom_initialize_leds()
1575 wacom->led.llv = 10; in wacom_initialize_leds()
1576 wacom->led.hlv = 20; in wacom_initialize_leds()
1577 wacom->led.max_llv = 127; in wacom_initialize_leds()
1578 wacom->led.max_hlv = 127; in wacom_initialize_leds()
1579 wacom->led.img_lum = 10; in wacom_initialize_leds()
1581 error = wacom_leds_alloc_and_register(wacom, 1, 4, false); in wacom_initialize_leds()
1583 hid_err(wacom->hdev, in wacom_initialize_leds()
1588 error = wacom_devm_sysfs_create_group(wacom, in wacom_initialize_leds()
1594 wacom->led.llv = 0; in wacom_initialize_leds()
1595 wacom->led.hlv = 0; in wacom_initialize_leds()
1596 wacom->led.img_lum = 0; in wacom_initialize_leds()
1598 error = wacom_leds_alloc_and_register(wacom, 2, 4, false); in wacom_initialize_leds()
1600 hid_err(wacom->hdev, in wacom_initialize_leds()
1605 error = wacom_devm_sysfs_create_group(wacom, in wacom_initialize_leds()
1615 wacom->led.llv = 32; in wacom_initialize_leds()
1616 wacom->led.max_llv = 96; in wacom_initialize_leds()
1618 error = wacom_leds_alloc_and_register(wacom, 1, 4, false); in wacom_initialize_leds()
1620 hid_err(wacom->hdev, in wacom_initialize_leds()
1625 error = wacom_devm_sysfs_create_group(wacom, in wacom_initialize_leds()
1630 wacom->led.llv = 50; in wacom_initialize_leds()
1631 wacom->led.max_llv = 100; in wacom_initialize_leds()
1632 error = wacom_leds_alloc_and_register(wacom, 1, 4, false); in wacom_initialize_leds()
1634 hid_err(wacom->hdev, in wacom_initialize_leds()
1641 wacom->led.llv = 255; in wacom_initialize_leds()
1642 wacom->led.max_llv = 255; in wacom_initialize_leds()
1643 error = wacom_led_groups_allocate(wacom, 5); in wacom_initialize_leds()
1645 hid_err(wacom->hdev, in wacom_initialize_leds()
1656 hid_err(wacom->hdev, in wacom_initialize_leds()
1666 struct wacom *wacom = container_of(work, struct wacom, init_work.work); in wacom_init_work() local
1668 _wacom_query_tablet_data(wacom); in wacom_init_work()
1669 wacom_led_control(wacom); in wacom_init_work()
1672 static void wacom_query_tablet_data(struct wacom *wacom) in wacom_query_tablet_data() argument
1674 schedule_delayed_work(&wacom->init_work, msecs_to_jiffies(1000)); in wacom_query_tablet_data()
1694 val->strval = battery->wacom->wacom_wac.name; in wacom_battery_get_property()
1726 static int __wacom_initialize_battery(struct wacom *wacom, in __wacom_initialize_battery() argument
1730 struct device *dev = &wacom->hdev->dev; in __wacom_initialize_battery()
1740 battery->wacom = wacom; in __wacom_initialize_battery()
1758 power_supply_powers(ps_bat, &wacom->hdev->dev); in __wacom_initialize_battery()
1770 static int wacom_initialize_battery(struct wacom *wacom) in wacom_initialize_battery() argument
1772 if (wacom->wacom_wac.features.quirks & WACOM_QUIRK_BATTERY) in wacom_initialize_battery()
1773 return __wacom_initialize_battery(wacom, &wacom->battery); in wacom_initialize_battery()
1778 static void wacom_destroy_battery(struct wacom *wacom) in wacom_destroy_battery() argument
1780 if (wacom->battery.battery) { in wacom_destroy_battery()
1781 devres_release_group(&wacom->hdev->dev, in wacom_destroy_battery()
1782 &wacom->battery.bat_desc); in wacom_destroy_battery()
1783 wacom->battery.battery = NULL; in wacom_destroy_battery()
1792 struct wacom *wacom = hid_get_drvdata(hdev); in wacom_show_speed() local
1794 return snprintf(buf, PAGE_SIZE, "%i\n", wacom->wacom_wac.bt_high_speed); in wacom_show_speed()
1802 struct wacom *wacom = hid_get_drvdata(hdev); in wacom_store_speed() local
1811 wacom_bt_query_tablet_data(hdev, new_speed, &wacom->wacom_wac.features); in wacom_store_speed()
1826 struct wacom *wacom = hid_get_drvdata(hdev); in wacom_show_remote_mode() local
1829 mode = wacom->led.groups[index].select; in wacom_show_remote_mode()
1859 static int wacom_remote_create_attr_group(struct wacom *wacom, __u32 serial, in wacom_remote_create_attr_group() argument
1863 struct wacom_remote *remote = wacom->remote; in wacom_remote_create_attr_group()
1865 remote->remotes[index].group.name = devm_kasprintf(&wacom->hdev->dev, in wacom_remote_create_attr_group()
1871 error = __wacom_devm_sysfs_create_group(wacom, remote->remote_dir, in wacom_remote_create_attr_group()
1875 hid_err(wacom->hdev, in wacom_remote_create_attr_group()
1883 static int wacom_cmd_unpair_remote(struct wacom *wacom, unsigned char selector) in wacom_cmd_unpair_remote() argument
1896 retval = wacom_set_report(wacom->hdev, HID_OUTPUT_REPORT, buf, in wacom_cmd_unpair_remote()
1910 struct wacom *wacom = hid_get_drvdata(hdev); in wacom_store_unpair_remote() local
1916 hid_info(wacom->hdev, "remote: unrecognized unpair code: %s\n", in wacom_store_unpair_remote()
1921 mutex_lock(&wacom->lock); in wacom_store_unpair_remote()
1923 err = wacom_cmd_unpair_remote(wacom, selector); in wacom_store_unpair_remote()
1924 mutex_unlock(&wacom->lock); in wacom_store_unpair_remote()
1941 struct wacom *wacom = data; in wacom_remotes_destroy() local
1942 struct wacom_remote *remote = wacom->remote; in wacom_remotes_destroy()
1949 wacom->remote = NULL; in wacom_remotes_destroy()
1952 static int wacom_initialize_remotes(struct wacom *wacom) in wacom_initialize_remotes() argument
1958 if (wacom->wacom_wac.features.type != REMOTE) in wacom_initialize_remotes()
1961 remote = devm_kzalloc(&wacom->hdev->dev, sizeof(*wacom->remote), in wacom_initialize_remotes()
1966 wacom->remote = remote; in wacom_initialize_remotes()
1974 hid_err(wacom->hdev, "failed allocating remote_fifo\n"); in wacom_initialize_remotes()
1985 &wacom->hdev->dev.kobj); in wacom_initialize_remotes()
1992 hid_err(wacom->hdev, in wacom_initialize_remotes()
1998 wacom->led.groups[i].select = WACOM_STATUS_UNKNOWN; in wacom_initialize_remotes()
2002 error = devm_add_action_or_reset(&wacom->hdev->dev, in wacom_initialize_remotes()
2003 wacom_remotes_destroy, wacom); in wacom_initialize_remotes()
2010 static struct input_dev *wacom_allocate_input(struct wacom *wacom) in wacom_allocate_input() argument
2013 struct hid_device *hdev = wacom->hdev; in wacom_allocate_input()
2014 struct wacom_wac *wacom_wac = &(wacom->wacom_wac); in wacom_allocate_input()
2030 input_set_drvdata(input_dev, wacom); in wacom_allocate_input()
2035 static int wacom_allocate_inputs(struct wacom *wacom) in wacom_allocate_inputs() argument
2037 struct wacom_wac *wacom_wac = &(wacom->wacom_wac); in wacom_allocate_inputs()
2039 wacom_wac->pen_input = wacom_allocate_input(wacom); in wacom_allocate_inputs()
2040 wacom_wac->touch_input = wacom_allocate_input(wacom); in wacom_allocate_inputs()
2041 wacom_wac->pad_input = wacom_allocate_input(wacom); in wacom_allocate_inputs()
2054 static int wacom_register_inputs(struct wacom *wacom) in wacom_register_inputs() argument
2057 struct wacom_wac *wacom_wac = &(wacom->wacom_wac); in wacom_register_inputs()
2147 struct wacom *wacom = container_of(work, struct wacom, battery_work); in wacom_battery_work() local
2149 if ((wacom->wacom_wac.features.quirks & WACOM_QUIRK_BATTERY) && in wacom_battery_work()
2150 !wacom->battery.battery) { in wacom_battery_work()
2151 wacom_initialize_battery(wacom); in wacom_battery_work()
2153 else if (!(wacom->wacom_wac.features.quirks & WACOM_QUIRK_BATTERY) && in wacom_battery_work()
2154 wacom->battery.battery) { in wacom_battery_work()
2155 wacom_destroy_battery(wacom); in wacom_battery_work()
2176 static void wacom_update_name(struct wacom *wacom, const char *suffix) in wacom_update_name() argument
2178 struct wacom_wac *wacom_wac = &wacom->wacom_wac; in wacom_update_name()
2184 char *product_name = wacom->hdev->name; in wacom_update_name()
2186 if (hid_is_using_ll_driver(wacom->hdev, &usb_hid_driver)) { in wacom_update_name()
2187 struct usb_interface *intf = to_usb_interface(wacom->hdev->dev.parent); in wacom_update_name()
2192 if (wacom->hdev->bus == BUS_I2C) { in wacom_update_name()
2194 features->name, wacom->hdev->product); in wacom_update_name()
2231 static void wacom_release_resources(struct wacom *wacom) in wacom_release_resources() argument
2233 struct hid_device *hdev = wacom->hdev; in wacom_release_resources()
2235 if (!wacom->resources) in wacom_release_resources()
2238 devres_release_group(&hdev->dev, wacom); in wacom_release_resources()
2240 wacom->resources = false; in wacom_release_resources()
2242 wacom->wacom_wac.pen_input = NULL; in wacom_release_resources()
2243 wacom->wacom_wac.touch_input = NULL; in wacom_release_resources()
2244 wacom->wacom_wac.pad_input = NULL; in wacom_release_resources()
2267 static int wacom_parse_and_register(struct wacom *wacom, bool wireless) in wacom_parse_and_register() argument
2269 struct wacom_wac *wacom_wac = &wacom->wacom_wac; in wacom_parse_and_register()
2271 struct hid_device *hdev = wacom->hdev; in wacom_parse_and_register()
2279 if (!devres_open_group(&hdev->dev, wacom, GFP_KERNEL)) in wacom_parse_and_register()
2282 wacom->resources = true; in wacom_parse_and_register()
2284 error = wacom_allocate_inputs(wacom); in wacom_parse_and_register()
2308 wacom_setup_device_quirks(wacom); in wacom_parse_and_register()
2326 wacom_update_name(wacom, wireless ? " (WL)" : ""); in wacom_parse_and_register()
2342 error = wacom_initialize_battery(wacom); in wacom_parse_and_register()
2347 error = wacom_register_inputs(wacom); in wacom_parse_and_register()
2351 if (wacom->wacom_wac.features.device_type & WACOM_DEVICETYPE_PAD) { in wacom_parse_and_register()
2352 error = wacom_initialize_leds(wacom); in wacom_parse_and_register()
2356 error = wacom_initialize_remotes(wacom); in wacom_parse_and_register()
2373 wacom_query_tablet_data(wacom); in wacom_parse_and_register()
2379 cancel_delayed_work_sync(&wacom->init_work); in wacom_parse_and_register()
2380 _wacom_query_tablet_data(wacom); in wacom_parse_and_register()
2389 devres_close_group(&hdev->dev, wacom); in wacom_parse_and_register()
2396 wacom_release_resources(wacom); in wacom_parse_and_register()
2402 struct wacom *wacom = container_of(work, struct wacom, wireless_work); in wacom_wireless_work() local
2403 struct usb_device *usbdev = wacom->usbdev; in wacom_wireless_work()
2404 struct wacom_wac *wacom_wac = &wacom->wacom_wac; in wacom_wireless_work()
2406 struct wacom *wacom1, *wacom2; in wacom_wireless_work()
2415 wacom_destroy_battery(wacom); in wacom_wireless_work()
2430 hid_info(wacom->hdev, "wireless tablet disconnected\n"); in wacom_wireless_work()
2434 hid_info(wacom->hdev, "wireless tablet connected with PID %x\n", in wacom_wireless_work()
2445 hid_info(wacom->hdev, "ignoring unknown PID.\n"); in wacom_wireless_work()
2474 error = wacom_initialize_battery(wacom); in wacom_wireless_work()
2487 static void wacom_remote_destroy_one(struct wacom *wacom, unsigned int index) in wacom_remote_destroy_one() argument
2489 struct wacom_remote *remote = wacom->remote; in wacom_remote_destroy_one()
2502 devres_release_group(&wacom->hdev->dev, in wacom_remote_destroy_one()
2506 devres_release_group(&wacom->hdev->dev, in wacom_remote_destroy_one()
2512 wacom->led.groups[i].select = WACOM_STATUS_UNKNOWN; in wacom_remote_destroy_one()
2517 static int wacom_remote_create_one(struct wacom *wacom, u32 serial, in wacom_remote_create_one() argument
2520 struct wacom_remote *remote = wacom->remote; in wacom_remote_create_one()
2521 struct device *dev = &wacom->hdev->dev; in wacom_remote_create_one()
2540 error = wacom_remote_create_attr_group(wacom, serial, index); in wacom_remote_create_one()
2544 remote->remotes[index].input = wacom_allocate_input(wacom); in wacom_remote_create_one()
2550 remote->remotes[index].input->name = wacom->wacom_wac.pad_name; in wacom_remote_create_one()
2558 &wacom->wacom_wac); in wacom_remote_create_one()
2570 wacom, index, 3, true); in wacom_remote_create_one()
2585 static int wacom_remote_attach_battery(struct wacom *wacom, int index) in wacom_remote_attach_battery() argument
2587 struct wacom_remote *remote = wacom->remote; in wacom_remote_attach_battery()
2596 if (wacom->led.groups[index].select == WACOM_STATUS_UNKNOWN) in wacom_remote_attach_battery()
2599 error = __wacom_initialize_battery(wacom, in wacom_remote_attach_battery()
2600 &wacom->remote->remotes[index].battery); in wacom_remote_attach_battery()
2609 struct wacom *wacom = container_of(work, struct wacom, remote_work); in wacom_remote_work() local
2610 struct wacom_remote *remote = wacom->remote; in wacom_remote_work()
2622 hid_err(wacom->hdev, in wacom_remote_work()
2629 wacom_schedule_work(&wacom->wacom_wac, WACOM_WORKER_REMOTE); in wacom_remote_work()
2638 wacom_remote_attach_battery(wacom, i); in wacom_remote_work()
2643 wacom_remote_destroy_one(wacom, i); in wacom_remote_work()
2645 wacom_remote_create_one(wacom, serial, i); in wacom_remote_work()
2648 wacom_remote_destroy_one(wacom, i); in wacom_remote_work()
2655 struct wacom *wacom = container_of(work, struct wacom, mode_change_work); in wacom_mode_change_work() local
2656 struct wacom_shared *shared = wacom->wacom_wac.shared; in wacom_mode_change_work()
2657 struct wacom *wacom1 = NULL; in wacom_mode_change_work()
2658 struct wacom *wacom2 = NULL; in wacom_mode_change_work()
2659 bool is_direct = wacom->wacom_wac.is_direct_mode; in wacom_mode_change_work()
2698 struct wacom *wacom; in wacom_probe() local
2711 wacom = devm_kzalloc(&hdev->dev, sizeof(struct wacom), GFP_KERNEL); in wacom_probe()
2712 if (!wacom) in wacom_probe()
2715 hid_set_drvdata(hdev, wacom); in wacom_probe()
2716 wacom->hdev = hdev; in wacom_probe()
2718 wacom_wac = &wacom->wacom_wac; in wacom_probe()
2732 wacom->usbdev = dev; in wacom_probe()
2733 wacom->intf = intf; in wacom_probe()
2734 mutex_init(&wacom->lock); in wacom_probe()
2735 INIT_DELAYED_WORK(&wacom->init_work, wacom_init_work); in wacom_probe()
2736 INIT_WORK(&wacom->wireless_work, wacom_wireless_work); in wacom_probe()
2737 INIT_WORK(&wacom->battery_work, wacom_battery_work); in wacom_probe()
2738 INIT_WORK(&wacom->remote_work, wacom_remote_work); in wacom_probe()
2739 INIT_WORK(&wacom->mode_change_work, wacom_mode_change_work); in wacom_probe()
2748 error = wacom_parse_and_register(wacom, false); in wacom_probe()
2765 struct wacom *wacom = hid_get_drvdata(hdev); in wacom_remove() local
2766 struct wacom_wac *wacom_wac = &wacom->wacom_wac; in wacom_remove()
2774 cancel_delayed_work_sync(&wacom->init_work); in wacom_remove()
2775 cancel_work_sync(&wacom->wireless_work); in wacom_remove()
2776 cancel_work_sync(&wacom->battery_work); in wacom_remove()
2777 cancel_work_sync(&wacom->remote_work); in wacom_remove()
2778 cancel_work_sync(&wacom->mode_change_work); in wacom_remove()
2783 wacom_led_groups_release(wacom); in wacom_remove()
2785 if (wacom->wacom_wac.features.type != REMOTE) in wacom_remove()
2786 wacom_release_resources(wacom); in wacom_remove()
2794 struct wacom *wacom = hid_get_drvdata(hdev); in wacom_resume() local
2796 mutex_lock(&wacom->lock); in wacom_resume()
2799 _wacom_query_tablet_data(wacom); in wacom_resume()
2800 wacom_led_control(wacom); in wacom_resume()
2802 mutex_unlock(&wacom->lock); in wacom_resume()