Lines Matching +full:kbd +full:- +full:led +full:- +full:backlight
1 // SPDX-License-Identifier: GPL-2.0-or-later
4 * - ThinkPad USB Keyboard with TrackPoint (tpkbd)
5 * - ThinkPad Compact Bluetooth Keyboard with TrackPoint (cptkbd)
6 * - ThinkPad Compact USB Keyboard with TrackPoint (cptkbd)
7 * - ThinkPad TrackPoint Keyboard II USB/Bluetooth (cptkbd/tpIIkbd)
13 * - IBM Scrollpoint III
14 * - IBM Scrollpoint Pro
15 * - IBM Scrollpoint Optical
16 * - IBM Scrollpoint Optical 800dpi
17 * - IBM Scrollpoint Optical 800dpi Pro
18 * - Lenovo Scrollpoint Optical
37 #include "hid-ids.h"
39 /* Userspace expects F20 for mic-mute KEY_MICMUTE does not work */
97 mutex_lock(&data->led_report_mutex); in lenovo_led_set_tp10ubkbd()
99 data->led_report[0] = TP10UBKBD_LED_OUTPUT_REPORT; in lenovo_led_set_tp10ubkbd()
100 data->led_report[1] = led_code; in lenovo_led_set_tp10ubkbd()
101 data->led_report[2] = value ? TP10UBKBD_LED_ON : TP10UBKBD_LED_OFF; in lenovo_led_set_tp10ubkbd()
102 ret = hid_hw_raw_request(hdev, data->led_report[0], data->led_report, 3, in lenovo_led_set_tp10ubkbd()
105 if (ret != -ENODEV) in lenovo_led_set_tp10ubkbd()
106 hid_err(hdev, "Set LED output report error: %d\n", ret); in lenovo_led_set_tp10ubkbd()
108 ret = ret < 0 ? ret : -EIO; in lenovo_led_set_tp10ubkbd()
113 mutex_unlock(&data->led_report_mutex); in lenovo_led_set_tp10ubkbd()
123 lenovo_led_set_tp10ubkbd(data->hdev, TP10UBKBD_FN_LOCK_LED, in lenovo_tp10ubkbd_sync_fn_lock()
124 data->fn_lock); in lenovo_tp10ubkbd_sync_fn_lock()
156 switch (hdev->product) { in lenovo_report_fixup()
159 * - get a reasonable usage max for the vendor collection in lenovo_report_fixup()
190 if (usage->hid == (HID_UP_BUTTON | 0x0010)) { in lenovo_input_mapping_tpkbd()
191 /* This sub-device contains trackpoint, mark it */ in lenovo_input_mapping_tpkbd()
204 if ((usage->hid & HID_USAGE_PAGE) == HID_UP_MSVENDOR || in lenovo_input_mapping_cptkbd()
205 (usage->hid & HID_USAGE_PAGE) == HID_UP_LNVENDOR) { in lenovo_input_mapping_cptkbd()
206 switch (usage->hid & HID_USAGE) { in lenovo_input_mapping_cptkbd()
207 case 0x00f1: /* Fn-F4: Mic mute */ in lenovo_input_mapping_cptkbd()
210 case 0x00f2: /* Fn-F5: Brightness down */ in lenovo_input_mapping_cptkbd()
213 case 0x00f3: /* Fn-F6: Brightness up */ in lenovo_input_mapping_cptkbd()
216 case 0x00f4: /* Fn-F7: External display (projector) */ in lenovo_input_mapping_cptkbd()
219 case 0x00f5: /* Fn-F8: Wireless */ in lenovo_input_mapping_cptkbd()
222 case 0x00f6: /* Fn-F9: Control panel */ in lenovo_input_mapping_cptkbd()
225 case 0x00f8: /* Fn-F11: View open applications (3 boxes) */ in lenovo_input_mapping_cptkbd()
228 case 0x00f9: /* Fn-F12: Open My computer (6 boxes) USB-only */ in lenovo_input_mapping_cptkbd()
232 case 0x00fa: /* Fn-Esc: Fn-lock toggle */ in lenovo_input_mapping_cptkbd()
242 if (usage->hid == HID_GD_WHEEL) in lenovo_input_mapping_cptkbd()
243 return -1; in lenovo_input_mapping_cptkbd()
244 if ((usage->hid & HID_USAGE_PAGE) == HID_UP_BUTTON && in lenovo_input_mapping_cptkbd()
245 (usage->hid & HID_USAGE) == 0x003) in lenovo_input_mapping_cptkbd()
246 return -1; in lenovo_input_mapping_cptkbd()
247 if ((usage->hid & HID_USAGE_PAGE) == HID_UP_CONSUMER && in lenovo_input_mapping_cptkbd()
248 (usage->hid & HID_USAGE) == 0x238) in lenovo_input_mapping_cptkbd()
249 return -1; in lenovo_input_mapping_cptkbd()
252 if ((usage->hid & HID_USAGE_PAGE) == 0xff100000 || in lenovo_input_mapping_cptkbd()
253 (usage->hid & HID_USAGE_PAGE) == 0xffa10000) { in lenovo_input_mapping_cptkbd()
254 field->flags |= HID_MAIN_ITEM_RELATIVE | HID_MAIN_ITEM_VARIABLE; in lenovo_input_mapping_cptkbd()
255 field->logical_minimum = -127; in lenovo_input_mapping_cptkbd()
256 field->logical_maximum = 127; in lenovo_input_mapping_cptkbd()
258 switch (usage->hid & HID_USAGE) { in lenovo_input_mapping_cptkbd()
266 return -1; in lenovo_input_mapping_cptkbd()
283 if (((usage->hid & HID_USAGE_PAGE) == 0xff0a0000 || in lenovo_input_mapping_tpIIkbd()
284 (usage->hid & HID_USAGE_PAGE) == HID_UP_MSVENDOR) && in lenovo_input_mapping_tpIIkbd()
285 field->report->id == 5) { in lenovo_input_mapping_tpIIkbd()
286 switch (usage->hid & HID_USAGE) { in lenovo_input_mapping_tpIIkbd()
287 case 0x00bb: /* Fn-F4: Mic mute */ in lenovo_input_mapping_tpIIkbd()
290 case 0x00c3: /* Fn-F5: Brightness down */ in lenovo_input_mapping_tpIIkbd()
293 case 0x00c4: /* Fn-F6: Brightness up */ in lenovo_input_mapping_tpIIkbd()
296 case 0x00c1: /* Fn-F8: Notification center */ in lenovo_input_mapping_tpIIkbd()
299 case 0x00bc: /* Fn-F9: Control panel */ in lenovo_input_mapping_tpIIkbd()
302 case 0x00b6: /* Fn-F10: Bluetooth */ in lenovo_input_mapping_tpIIkbd()
305 case 0x00b7: /* Fn-F11: Keyboard config */ in lenovo_input_mapping_tpIIkbd()
308 case 0x00b8: /* Fn-F12: User function */ in lenovo_input_mapping_tpIIkbd()
311 case 0x00b9: /* Fn-PrtSc: Snipping tool */ in lenovo_input_mapping_tpIIkbd()
314 case 0x00b5: /* Fn-Esc: Fn-lock toggle */ in lenovo_input_mapping_tpIIkbd()
320 if ((usage->hid & HID_USAGE_PAGE) == 0xffa00000) { in lenovo_input_mapping_tpIIkbd()
321 switch (usage->hid & HID_USAGE) { in lenovo_input_mapping_tpIIkbd()
328 if ((usage->hid & HID_USAGE_PAGE) == HID_UP_MSVENDOR && in lenovo_input_mapping_tpIIkbd()
329 field->report->id == 21) { in lenovo_input_mapping_tpIIkbd()
330 switch (usage->hid & HID_USAGE) { in lenovo_input_mapping_tpIIkbd()
338 if (usage->hid == HID_GD_WHEEL) in lenovo_input_mapping_tpIIkbd()
339 return -1; in lenovo_input_mapping_tpIIkbd()
340 if ((usage->hid & HID_USAGE_PAGE) == HID_UP_BUTTON && in lenovo_input_mapping_tpIIkbd()
341 (usage->hid & HID_USAGE) == 0x003) in lenovo_input_mapping_tpIIkbd()
342 return -1; in lenovo_input_mapping_tpIIkbd()
343 if ((usage->hid & HID_USAGE_PAGE) == HID_UP_CONSUMER && in lenovo_input_mapping_tpIIkbd()
344 (usage->hid & HID_USAGE) == 0x238) in lenovo_input_mapping_tpIIkbd()
345 return -1; in lenovo_input_mapping_tpIIkbd()
348 if ((usage->hid & HID_USAGE_PAGE) == 0xff100000) { in lenovo_input_mapping_tpIIkbd()
349 field->flags |= HID_MAIN_ITEM_RELATIVE | HID_MAIN_ITEM_VARIABLE; in lenovo_input_mapping_tpIIkbd()
350 field->logical_minimum = -127; in lenovo_input_mapping_tpIIkbd()
351 field->logical_maximum = 127; in lenovo_input_mapping_tpIIkbd()
353 switch (usage->hid & HID_USAGE) { in lenovo_input_mapping_tpIIkbd()
361 return -1; in lenovo_input_mapping_tpIIkbd()
372 if (usage->hid == HID_GD_Z) { in lenovo_input_mapping_scrollpoint()
387 if (usage->hid == 0x000c0001) { in lenovo_input_mapping_tp10_ultrabook_kbd()
388 switch (usage->usage_index) { in lenovo_input_mapping_tp10_ultrabook_kbd()
389 case 8: /* Fn-Esc: Fn-lock toggle */ in lenovo_input_mapping_tp10_ultrabook_kbd()
392 case 9: /* Fn-F4: Mic mute */ in lenovo_input_mapping_tp10_ultrabook_kbd()
395 case 10: /* Fn-F7: Control panel */ in lenovo_input_mapping_tp10_ultrabook_kbd()
398 case 11: /* Fn-F8: Search (magnifier glass) */ in lenovo_input_mapping_tp10_ultrabook_kbd()
401 case 12: /* Fn-F10: Open My computer (6 boxes) */ in lenovo_input_mapping_tp10_ultrabook_kbd()
408 * The Ultrabook Keyboard sends a spurious F23 key-press when resuming in lenovo_input_mapping_tp10_ultrabook_kbd()
411 if (usage->hid == 0x00070072) in lenovo_input_mapping_tp10_ultrabook_kbd()
412 return -1; in lenovo_input_mapping_tp10_ultrabook_kbd()
425 if (usage->hid == 0x000c0001) { in lenovo_input_mapping_x1_tab_kbd()
426 switch (usage->usage_index) { in lenovo_input_mapping_x1_tab_kbd()
427 case 0: /* Fn-F10: Enable/disable bluetooth */ in lenovo_input_mapping_x1_tab_kbd()
430 case 1: /* Fn-F11: Keyboard settings */ in lenovo_input_mapping_x1_tab_kbd()
433 case 2: /* Fn-F12: User function / Cortana */ in lenovo_input_mapping_x1_tab_kbd()
436 case 3: /* Fn-PrtSc: Snipping tool */ in lenovo_input_mapping_x1_tab_kbd()
439 case 8: /* Fn-Esc: Fn-lock toggle */ in lenovo_input_mapping_x1_tab_kbd()
442 case 9: /* Fn-F4: Mute/unmute microphone */ in lenovo_input_mapping_x1_tab_kbd()
445 case 10: /* Fn-F9: Settings */ in lenovo_input_mapping_x1_tab_kbd()
448 case 13: /* Fn-F7: Manage external displays */ in lenovo_input_mapping_x1_tab_kbd()
451 case 14: /* Fn-F8: Enable/disable wifi */ in lenovo_input_mapping_x1_tab_kbd()
457 if (usage->hid == (HID_UP_KEYBOARD | 0x009a)) { in lenovo_input_mapping_x1_tab_kbd()
469 switch (hdev->product) { in lenovo_input_mapping()
514 return -ENOMEM; in lenovo_send_cmd_cptkbd()
525 switch (hdev->product) { in lenovo_send_cmd_cptkbd()
536 ret = -EINVAL; in lenovo_send_cmd_cptkbd()
554 if (hdev->product == USB_DEVICE_ID_LENOVO_CUSBKBD || in lenovo_features_set_cptkbd()
555 hdev->product == USB_DEVICE_ID_LENOVO_CBTKBD) { in lenovo_features_set_cptkbd()
566 ret = lenovo_send_cmd_cptkbd(hdev, 0x05, cptkbd_data->fn_lock); in lenovo_features_set_cptkbd()
568 hid_err(hdev, "Fn-lock setting failed: %d\n", ret); in lenovo_features_set_cptkbd()
570 ret = lenovo_send_cmd_cptkbd(hdev, 0x02, cptkbd_data->sensitivity); in lenovo_features_set_cptkbd()
582 return sysfs_emit(buf, "%u\n", data->fn_lock); in attr_fn_lock_show()
595 return -EINVAL; in attr_fn_lock_store()
597 return -EINVAL; in attr_fn_lock_store()
599 data->fn_lock = !!value; in attr_fn_lock_store()
601 switch (hdev->product) { in attr_fn_lock_store()
630 return sysfs_emit(buf, "%u\n", cptkbd_data->sensitivity); in attr_sensitivity_show_cptkbd()
643 return -EINVAL; in attr_sensitivity_store_cptkbd()
645 cptkbd_data->sensitivity = value; in attr_sensitivity_store_cptkbd()
659 cptkbd_data->middleclick_workaround_cptkbd); in attr_middleclick_workaround_show_cptkbd()
672 return -EINVAL; in attr_middleclick_workaround_store_cptkbd()
674 return -EINVAL; in attr_middleclick_workaround_store_cptkbd()
676 cptkbd_data->middleclick_workaround_cptkbd = !!value; in attr_middleclick_workaround_store_cptkbd()
716 list_for_each_entry(hidinput, &hdev->inputs, list) { in lenovo_raw_event_TP_X12_tab()
717 input = hidinput->input; in lenovo_raw_event_TP_X12_tab()
722 /* fn-F20 being used here for MIC mute*/ in lenovo_raw_event_TP_X12_tab()
726 /* Power-mode or Airplane mode will be called based on the device*/ in lenovo_raw_event_TP_X12_tab()
729 * TP X12 TAB uses Fn-F8 calls Airplanemode in lenovo_raw_event_TP_X12_tab()
730 * Whereas TP X12 TAB2 uses Fn-F8 for toggling in lenovo_raw_event_TP_X12_tab()
733 if (hdev->product == USB_DEVICE_ID_LENOVO_X12_TAB) { in lenovo_raw_event_TP_X12_tab()
741 (hdev->product == USB_DEVICE_ID_LENOVO_X12_TAB) ? in lenovo_raw_event_TP_X12_tab()
750 /* Keyboard LED backlight toggle*/ in lenovo_raw_event_TP_X12_tab()
764 * Compact USB keyboard's Fn-F12 report holds down many other keys, and in lenovo_raw_event()
768 if (unlikely(hdev->product == USB_DEVICE_ID_LENOVO_CUSBKBD in lenovo_raw_event()
778 * Lenovo TP X12 Tab KBD's Fn+XX is HID raw data defined. Report ID is 0x03 in lenovo_raw_event()
781 if (unlikely((hdev->product == USB_DEVICE_ID_LENOVO_X12_TAB in lenovo_raw_event()
782 || hdev->product == USB_DEVICE_ID_LENOVO_X12_TAB2) in lenovo_raw_event()
783 && size >= 3 && report->id == 0x03)) in lenovo_raw_event()
794 if (usage->type == EV_KEY && usage->code == KEY_FN_ESC && value == 1) { in lenovo_event_tp10ubkbd()
796 * The user has toggled the Fn-lock state. Toggle our own in lenovo_event_tp10ubkbd()
798 * ensure things are in sync (the sycning should be a no-op). in lenovo_event_tp10ubkbd()
800 data->fn_lock = !data->fn_lock; in lenovo_event_tp10ubkbd()
801 schedule_work(&data->fn_lock_sync_work); in lenovo_event_tp10ubkbd()
812 if (cptkbd_data->middleclick_workaround_cptkbd) { in lenovo_event_cptkbd()
814 if (usage->type == EV_REL && (usage->code == REL_WHEEL || in lenovo_event_cptkbd()
815 usage->code == REL_HWHEEL)) { in lenovo_event_cptkbd()
816 /* Scroll events disable middle-click event */ in lenovo_event_cptkbd()
817 cptkbd_data->middlebutton_state = 2; in lenovo_event_cptkbd()
822 if (usage->type == EV_KEY && usage->code == BTN_MIDDLE) { in lenovo_event_cptkbd()
824 cptkbd_data->middlebutton_state = 1; in lenovo_event_cptkbd()
826 if (cptkbd_data->middlebutton_state == 1) { in lenovo_event_cptkbd()
827 /* No scrolling inbetween, send middle-click */ in lenovo_event_cptkbd()
828 input_event(field->hidinput->input, in lenovo_event_cptkbd()
830 input_sync(field->hidinput->input); in lenovo_event_cptkbd()
831 input_event(field->hidinput->input, in lenovo_event_cptkbd()
833 input_sync(field->hidinput->input); in lenovo_event_cptkbd()
835 cptkbd_data->middlebutton_state = 0; in lenovo_event_cptkbd()
841 if (usage->type == EV_KEY && usage->code == KEY_FN_ESC && value == 1) { in lenovo_event_cptkbd()
843 * The user has toggled the Fn-lock state. Toggle our own in lenovo_event_cptkbd()
845 * ensure things are in sync (the syncing should be a no-op). in lenovo_event_cptkbd()
847 cptkbd_data->fn_lock = !cptkbd_data->fn_lock; in lenovo_event_cptkbd()
859 switch (hdev->product) { in lenovo_event()
882 report = hdev->report_enum[HID_FEATURE_REPORT].report_id_hash[4]; in lenovo_features_set_tpkbd()
884 report->field[0]->value[0] = data_pointer->press_to_select ? 0x01 : 0x02; in lenovo_features_set_tpkbd()
885 report->field[0]->value[0] |= data_pointer->dragging ? 0x04 : 0x08; in lenovo_features_set_tpkbd()
886 report->field[0]->value[0] |= data_pointer->release_to_select ? 0x10 : 0x20; in lenovo_features_set_tpkbd()
887 report->field[0]->value[0] |= data_pointer->select_right ? 0x80 : 0x40; in lenovo_features_set_tpkbd()
888 report->field[1]->value[0] = 0x03; // unknown setting, imitate windows driver in lenovo_features_set_tpkbd()
889 report->field[2]->value[0] = data_pointer->sensitivity; in lenovo_features_set_tpkbd()
890 report->field[3]->value[0] = data_pointer->press_speed; in lenovo_features_set_tpkbd()
903 return sysfs_emit(buf, "%u\n", data_pointer->press_to_select); in attr_press_to_select_show_tpkbd()
916 return -EINVAL; in attr_press_to_select_store_tpkbd()
918 return -EINVAL; in attr_press_to_select_store_tpkbd()
920 data_pointer->press_to_select = value; in attr_press_to_select_store_tpkbd()
933 return sysfs_emit(buf, "%u\n", data_pointer->dragging); in attr_dragging_show_tpkbd()
946 return -EINVAL; in attr_dragging_store_tpkbd()
948 return -EINVAL; in attr_dragging_store_tpkbd()
950 data_pointer->dragging = value; in attr_dragging_store_tpkbd()
963 return sysfs_emit(buf, "%u\n", data_pointer->release_to_select); in attr_release_to_select_show_tpkbd()
976 return -EINVAL; in attr_release_to_select_store_tpkbd()
978 return -EINVAL; in attr_release_to_select_store_tpkbd()
980 data_pointer->release_to_select = value; in attr_release_to_select_store_tpkbd()
993 return sysfs_emit(buf, "%u\n", data_pointer->select_right); in attr_select_right_show_tpkbd()
1006 return -EINVAL; in attr_select_right_store_tpkbd()
1008 return -EINVAL; in attr_select_right_store_tpkbd()
1010 data_pointer->select_right = value; in attr_select_right_store_tpkbd()
1023 return sysfs_emit(buf, "%u\n", data_pointer->sensitivity); in attr_sensitivity_show_tpkbd()
1036 return -EINVAL; in attr_sensitivity_store_tpkbd()
1038 data_pointer->sensitivity = value; in attr_sensitivity_store_tpkbd()
1051 return sysfs_emit(buf, "%u\n", data_pointer->press_speed); in attr_press_speed_show_tpkbd()
1064 return -EINVAL; in attr_press_speed_store_tpkbd()
1066 data_pointer->press_speed = value; in attr_press_speed_store_tpkbd()
1121 report = hdev->report_enum[HID_OUTPUT_REPORT].report_id_hash[3]; in lenovo_led_set_tpkbd()
1122 report->field[0]->value[0] = (data_pointer->led_state >> 0) & 1; in lenovo_led_set_tpkbd()
1123 report->field[0]->value[1] = (data_pointer->led_state >> 1) & 1; in lenovo_led_set_tpkbd()
1130 struct device *dev = led_cdev->dev->parent; in lenovo_led_brightness_set()
1137 if (led_cdev == &data_pointer->led_micmute) in lenovo_led_brightness_set()
1141 data_pointer->led_state &= ~(1 << led_nr); in lenovo_led_brightness_set()
1143 data_pointer->led_state |= 1 << led_nr; in lenovo_led_brightness_set()
1145 switch (hdev->product) { in lenovo_led_brightness_set()
1165 size_t name_sz = strlen(dev_name(&hdev->dev)) + 16; in lenovo_register_leds()
1169 name_mute = devm_kzalloc(&hdev->dev, name_sz, GFP_KERNEL); in lenovo_register_leds()
1170 name_micm = devm_kzalloc(&hdev->dev, name_sz, GFP_KERNEL); in lenovo_register_leds()
1172 hid_err(hdev, "Could not allocate memory for led data\n"); in lenovo_register_leds()
1173 return -ENOMEM; in lenovo_register_leds()
1175 snprintf(name_mute, name_sz, "%s:amber:mute", dev_name(&hdev->dev)); in lenovo_register_leds()
1176 snprintf(name_micm, name_sz, "%s:amber:micmute", dev_name(&hdev->dev)); in lenovo_register_leds()
1178 data->led_mute.name = name_mute; in lenovo_register_leds()
1179 data->led_mute.default_trigger = "audio-mute"; in lenovo_register_leds()
1180 data->led_mute.brightness_set_blocking = lenovo_led_brightness_set; in lenovo_register_leds()
1181 data->led_mute.max_brightness = 1; in lenovo_register_leds()
1182 data->led_mute.flags = LED_HW_PLUGGABLE; in lenovo_register_leds()
1183 data->led_mute.dev = &hdev->dev; in lenovo_register_leds()
1184 ret = led_classdev_register(&hdev->dev, &data->led_mute); in lenovo_register_leds()
1188 data->led_micmute.name = name_micm; in lenovo_register_leds()
1189 data->led_micmute.default_trigger = "audio-micmute"; in lenovo_register_leds()
1190 data->led_micmute.brightness_set_blocking = lenovo_led_brightness_set; in lenovo_register_leds()
1191 data->led_micmute.max_brightness = 1; in lenovo_register_leds()
1192 data->led_micmute.flags = LED_HW_PLUGGABLE; in lenovo_register_leds()
1193 data->led_micmute.dev = &hdev->dev; in lenovo_register_leds()
1194 ret = led_classdev_register(&hdev->dev, &data->led_micmute); in lenovo_register_leds()
1196 led_classdev_unregister(&data->led_mute); in lenovo_register_leds()
1220 return -ENODEV; in lenovo_probe_tpkbd()
1223 return -ENODEV; in lenovo_probe_tpkbd()
1225 ret = sysfs_create_group(&hdev->dev.kobj, &lenovo_attr_group_tpkbd); in lenovo_probe_tpkbd()
1229 data_pointer = devm_kzalloc(&hdev->dev, in lenovo_probe_tpkbd()
1234 ret = -ENOMEM; in lenovo_probe_tpkbd()
1239 data_pointer->sensitivity = 0xa0; in lenovo_probe_tpkbd()
1240 data_pointer->press_speed = 0x38; in lenovo_probe_tpkbd()
1252 sysfs_remove_group(&hdev->dev.kobj, &lenovo_attr_group_tpkbd); in lenovo_probe_tpkbd()
1262 if (((hdev->product == USB_DEVICE_ID_LENOVO_CUSBKBD) || in lenovo_probe_cptkbd()
1263 (hdev->product == USB_DEVICE_ID_LENOVO_TPIIUSBKBD)) && in lenovo_probe_cptkbd()
1264 hdev->type != HID_TYPE_USBMOUSE) { in lenovo_probe_cptkbd()
1269 cptkbd_data = devm_kzalloc(&hdev->dev, in lenovo_probe_cptkbd()
1274 return -ENOMEM; in lenovo_probe_cptkbd()
1279 cptkbd_data->middlebutton_state = 0; in lenovo_probe_cptkbd()
1280 cptkbd_data->fn_lock = true; in lenovo_probe_cptkbd()
1281 cptkbd_data->sensitivity = 0x05; in lenovo_probe_cptkbd()
1282 cptkbd_data->middleclick_workaround_cptkbd = true; in lenovo_probe_cptkbd()
1285 ret = sysfs_create_group(&hdev->dev.kobj, &lenovo_attr_group_cptkbd); in lenovo_probe_cptkbd()
1310 * The LEDs and the Fn-lock functionality use output report 9, in lenovo_probe_tp10ubkbd()
1315 rep_enum = &hdev->report_enum[HID_OUTPUT_REPORT]; in lenovo_probe_tp10ubkbd()
1316 list_for_each_entry(rep, &rep_enum->report_list, list) { in lenovo_probe_tp10ubkbd()
1317 if (rep->application == 0xffa00001) in lenovo_probe_tp10ubkbd()
1323 data = devm_kzalloc(&hdev->dev, sizeof(*data), GFP_KERNEL); in lenovo_probe_tp10ubkbd()
1325 return -ENOMEM; in lenovo_probe_tp10ubkbd()
1327 mutex_init(&data->led_report_mutex); in lenovo_probe_tp10ubkbd()
1328 INIT_WORK(&data->fn_lock_sync_work, lenovo_tp10ubkbd_sync_fn_lock); in lenovo_probe_tp10ubkbd()
1329 data->hdev = hdev; in lenovo_probe_tp10ubkbd()
1334 * The Thinkpad 10 ultrabook USB kbd dock's Fn-lock defaults to on. in lenovo_probe_tp10ubkbd()
1336 * (which should be a no-op) to make sure that our state matches the in lenovo_probe_tp10ubkbd()
1337 * keyboard's FN-lock state. This is the same as what Windows does. in lenovo_probe_tp10ubkbd()
1339 * For X12 TAB and TAB2, the default windows behaviour Fn-lock Off. in lenovo_probe_tp10ubkbd()
1344 data->fn_lock = !(hdev->product == USB_DEVICE_ID_LENOVO_X12_TAB || in lenovo_probe_tp10ubkbd()
1345 hdev->product == USB_DEVICE_ID_LENOVO_X12_TAB2); in lenovo_probe_tp10ubkbd()
1347 lenovo_led_set_tp10ubkbd(hdev, TP10UBKBD_FN_LOCK_LED, data->fn_lock); in lenovo_probe_tp10ubkbd()
1349 ret = sysfs_create_group(&hdev->dev.kobj, &lenovo_attr_group_tp10ubkbd); in lenovo_probe_tp10ubkbd()
1359 sysfs_remove_group(&hdev->dev.kobj, &lenovo_attr_group_tp10ubkbd); in lenovo_probe_tp10ubkbd()
1380 switch (hdev->product) { in lenovo_probe()
1415 switch (hdev->product) { in lenovo_reset_resume()
1418 if (hdev->type == HID_TYPE_USBMOUSE) in lenovo_reset_resume()
1441 sysfs_remove_group(&hdev->dev.kobj, in lenovo_remove_tpkbd()
1444 led_classdev_unregister(&data_pointer->led_micmute); in lenovo_remove_tpkbd()
1445 led_classdev_unregister(&data_pointer->led_mute); in lenovo_remove_tpkbd()
1450 sysfs_remove_group(&hdev->dev.kobj, in lenovo_remove_cptkbd()
1461 led_classdev_unregister(&data->led_micmute); in lenovo_remove_tp10ubkbd()
1462 led_classdev_unregister(&data->led_mute); in lenovo_remove_tp10ubkbd()
1464 sysfs_remove_group(&hdev->dev.kobj, &lenovo_attr_group_tp10ubkbd); in lenovo_remove_tp10ubkbd()
1465 cancel_work_sync(&data->fn_lock_sync_work); in lenovo_remove_tp10ubkbd()
1470 switch (hdev->product) { in lenovo_remove()
1496 switch (hdev->product) { in lenovo_input_configured()
1502 if (test_bit(EV_REL, hi->input->evbit)) { in lenovo_input_configured()
1504 __set_bit(INPUT_PROP_POINTER, hi->input->propbit); in lenovo_input_configured()
1506 hi->input->propbit); in lenovo_input_configured()
1531 * part, while letting hid-multitouch.c handle the touchpad and trackpoint.