Lines Matching refs:hdev

56 static __u8 *lenovo_report_fixup(struct hid_device *hdev, __u8 *rdesc,  in lenovo_report_fixup()  argument
59 switch (hdev->product) { in lenovo_report_fixup()
76 static int lenovo_input_mapping_tpkbd(struct hid_device *hdev, in lenovo_input_mapping_tpkbd() argument
82 hid_set_drvdata(hdev, (void *)1); in lenovo_input_mapping_tpkbd()
89 static int lenovo_input_mapping_cptkbd(struct hid_device *hdev, in lenovo_input_mapping_cptkbd() argument
163 static int lenovo_input_mapping(struct hid_device *hdev, in lenovo_input_mapping() argument
167 switch (hdev->product) { in lenovo_input_mapping()
169 return lenovo_input_mapping_tpkbd(hdev, hi, field, in lenovo_input_mapping()
173 return lenovo_input_mapping_cptkbd(hdev, hi, field, in lenovo_input_mapping()
183 static int lenovo_send_cmd_cptkbd(struct hid_device *hdev, in lenovo_send_cmd_cptkbd() argument
189 switch (hdev->product) { in lenovo_send_cmd_cptkbd()
191 ret = hid_hw_raw_request(hdev, 0x13, buf, sizeof(buf), in lenovo_send_cmd_cptkbd()
195 ret = hid_hw_output_report(hdev, buf, sizeof(buf)); in lenovo_send_cmd_cptkbd()
205 static void lenovo_features_set_cptkbd(struct hid_device *hdev) in lenovo_features_set_cptkbd() argument
208 struct lenovo_drvdata_cptkbd *cptkbd_data = hid_get_drvdata(hdev); in lenovo_features_set_cptkbd()
210 ret = lenovo_send_cmd_cptkbd(hdev, 0x05, cptkbd_data->fn_lock); in lenovo_features_set_cptkbd()
212 hid_err(hdev, "Fn-lock setting failed: %d\n", ret); in lenovo_features_set_cptkbd()
214 ret = lenovo_send_cmd_cptkbd(hdev, 0x02, cptkbd_data->sensitivity); in lenovo_features_set_cptkbd()
216 hid_err(hdev, "Sensitivity setting failed: %d\n", ret); in lenovo_features_set_cptkbd()
223 struct hid_device *hdev = container_of(dev, struct hid_device, dev); in attr_fn_lock_show_cptkbd() local
224 struct lenovo_drvdata_cptkbd *cptkbd_data = hid_get_drvdata(hdev); in attr_fn_lock_show_cptkbd()
234 struct hid_device *hdev = container_of(dev, struct hid_device, dev); in attr_fn_lock_store_cptkbd() local
235 struct lenovo_drvdata_cptkbd *cptkbd_data = hid_get_drvdata(hdev); in attr_fn_lock_store_cptkbd()
244 lenovo_features_set_cptkbd(hdev); in attr_fn_lock_store_cptkbd()
253 struct hid_device *hdev = container_of(dev, struct hid_device, dev); in attr_sensitivity_show_cptkbd() local
254 struct lenovo_drvdata_cptkbd *cptkbd_data = hid_get_drvdata(hdev); in attr_sensitivity_show_cptkbd()
265 struct hid_device *hdev = container_of(dev, struct hid_device, dev); in attr_sensitivity_store_cptkbd() local
266 struct lenovo_drvdata_cptkbd *cptkbd_data = hid_get_drvdata(hdev); in attr_sensitivity_store_cptkbd()
273 lenovo_features_set_cptkbd(hdev); in attr_sensitivity_store_cptkbd()
300 static int lenovo_raw_event(struct hid_device *hdev, in lenovo_raw_event() argument
308 if (unlikely(hdev->product == USB_DEVICE_ID_LENOVO_CUSBKBD in lenovo_raw_event()
320 static int lenovo_event_cptkbd(struct hid_device *hdev, in lenovo_event_cptkbd() argument
323 struct lenovo_drvdata_cptkbd *cptkbd_data = hid_get_drvdata(hdev); in lenovo_event_cptkbd()
355 static int lenovo_event(struct hid_device *hdev, struct hid_field *field, in lenovo_event() argument
358 switch (hdev->product) { in lenovo_event()
361 return lenovo_event_cptkbd(hdev, field, usage, value); in lenovo_event()
367 static int lenovo_features_set_tpkbd(struct hid_device *hdev) in lenovo_features_set_tpkbd() argument
370 struct lenovo_drvdata_tpkbd *data_pointer = hid_get_drvdata(hdev); in lenovo_features_set_tpkbd()
372 report = hdev->report_enum[HID_FEATURE_REPORT].report_id_hash[4]; in lenovo_features_set_tpkbd()
382 hid_hw_request(hdev, report, HID_REQ_SET_REPORT); in lenovo_features_set_tpkbd()
390 struct hid_device *hdev = container_of(dev, struct hid_device, dev); in attr_press_to_select_show_tpkbd() local
391 struct lenovo_drvdata_tpkbd *data_pointer = hid_get_drvdata(hdev); in attr_press_to_select_show_tpkbd()
401 struct hid_device *hdev = container_of(dev, struct hid_device, dev); in attr_press_to_select_store_tpkbd() local
402 struct lenovo_drvdata_tpkbd *data_pointer = hid_get_drvdata(hdev); in attr_press_to_select_store_tpkbd()
411 lenovo_features_set_tpkbd(hdev); in attr_press_to_select_store_tpkbd()
420 struct hid_device *hdev = container_of(dev, struct hid_device, dev); in attr_dragging_show_tpkbd() local
421 struct lenovo_drvdata_tpkbd *data_pointer = hid_get_drvdata(hdev); in attr_dragging_show_tpkbd()
431 struct hid_device *hdev = container_of(dev, struct hid_device, dev); in attr_dragging_store_tpkbd() local
432 struct lenovo_drvdata_tpkbd *data_pointer = hid_get_drvdata(hdev); in attr_dragging_store_tpkbd()
441 lenovo_features_set_tpkbd(hdev); in attr_dragging_store_tpkbd()
450 struct hid_device *hdev = container_of(dev, struct hid_device, dev); in attr_release_to_select_show_tpkbd() local
451 struct lenovo_drvdata_tpkbd *data_pointer = hid_get_drvdata(hdev); in attr_release_to_select_show_tpkbd()
461 struct hid_device *hdev = container_of(dev, struct hid_device, dev); in attr_release_to_select_store_tpkbd() local
462 struct lenovo_drvdata_tpkbd *data_pointer = hid_get_drvdata(hdev); in attr_release_to_select_store_tpkbd()
471 lenovo_features_set_tpkbd(hdev); in attr_release_to_select_store_tpkbd()
480 struct hid_device *hdev = container_of(dev, struct hid_device, dev); in attr_select_right_show_tpkbd() local
481 struct lenovo_drvdata_tpkbd *data_pointer = hid_get_drvdata(hdev); in attr_select_right_show_tpkbd()
491 struct hid_device *hdev = container_of(dev, struct hid_device, dev); in attr_select_right_store_tpkbd() local
492 struct lenovo_drvdata_tpkbd *data_pointer = hid_get_drvdata(hdev); in attr_select_right_store_tpkbd()
501 lenovo_features_set_tpkbd(hdev); in attr_select_right_store_tpkbd()
510 struct hid_device *hdev = container_of(dev, struct hid_device, dev); in attr_sensitivity_show_tpkbd() local
511 struct lenovo_drvdata_tpkbd *data_pointer = hid_get_drvdata(hdev); in attr_sensitivity_show_tpkbd()
522 struct hid_device *hdev = container_of(dev, struct hid_device, dev); in attr_sensitivity_store_tpkbd() local
523 struct lenovo_drvdata_tpkbd *data_pointer = hid_get_drvdata(hdev); in attr_sensitivity_store_tpkbd()
530 lenovo_features_set_tpkbd(hdev); in attr_sensitivity_store_tpkbd()
539 struct hid_device *hdev = container_of(dev, struct hid_device, dev); in attr_press_speed_show_tpkbd() local
540 struct lenovo_drvdata_tpkbd *data_pointer = hid_get_drvdata(hdev); in attr_press_speed_show_tpkbd()
551 struct hid_device *hdev = container_of(dev, struct hid_device, dev); in attr_press_speed_store_tpkbd() local
552 struct lenovo_drvdata_tpkbd *data_pointer = hid_get_drvdata(hdev); in attr_press_speed_store_tpkbd()
559 lenovo_features_set_tpkbd(hdev); in attr_press_speed_store_tpkbd()
612 struct hid_device *hdev = container_of(dev, struct hid_device, dev); in lenovo_led_brightness_get_tpkbd() local
613 struct lenovo_drvdata_tpkbd *data_pointer = hid_get_drvdata(hdev); in lenovo_led_brightness_get_tpkbd()
628 struct hid_device *hdev = container_of(dev, struct hid_device, dev); in lenovo_led_brightness_set_tpkbd() local
629 struct lenovo_drvdata_tpkbd *data_pointer = hid_get_drvdata(hdev); in lenovo_led_brightness_set_tpkbd()
641 report = hdev->report_enum[HID_OUTPUT_REPORT].report_id_hash[3]; in lenovo_led_brightness_set_tpkbd()
644 hid_hw_request(hdev, report, HID_REQ_SET_REPORT); in lenovo_led_brightness_set_tpkbd()
647 static int lenovo_probe_tpkbd(struct hid_device *hdev) in lenovo_probe_tpkbd() argument
649 struct device *dev = &hdev->dev; in lenovo_probe_tpkbd()
660 if (!hid_get_drvdata(hdev)) in lenovo_probe_tpkbd()
663 hid_set_drvdata(hdev, NULL); in lenovo_probe_tpkbd()
667 if (!hid_validate_values(hdev, HID_FEATURE_REPORT, 4, i, 1)) in lenovo_probe_tpkbd()
670 if (!hid_validate_values(hdev, HID_OUTPUT_REPORT, 3, 0, 2)) in lenovo_probe_tpkbd()
673 ret = sysfs_create_group(&hdev->dev.kobj, &lenovo_attr_group_tpkbd); in lenovo_probe_tpkbd()
675 hid_warn(hdev, "Could not create sysfs group: %d\n", ret); in lenovo_probe_tpkbd()
677 data_pointer = devm_kzalloc(&hdev->dev, in lenovo_probe_tpkbd()
681 hid_err(hdev, "Could not allocate memory for driver data\n"); in lenovo_probe_tpkbd()
690 name_mute = devm_kzalloc(&hdev->dev, name_sz, GFP_KERNEL); in lenovo_probe_tpkbd()
691 name_micmute = devm_kzalloc(&hdev->dev, name_sz, GFP_KERNEL); in lenovo_probe_tpkbd()
693 hid_err(hdev, "Could not allocate memory for led data\n"); in lenovo_probe_tpkbd()
700 hid_set_drvdata(hdev, data_pointer); in lenovo_probe_tpkbd()
716 lenovo_features_set_tpkbd(hdev); in lenovo_probe_tpkbd()
720 sysfs_remove_group(&hdev->dev.kobj, &lenovo_attr_group_tpkbd); in lenovo_probe_tpkbd()
724 static int lenovo_probe_cptkbd(struct hid_device *hdev) in lenovo_probe_cptkbd() argument
730 if (hdev->product == USB_DEVICE_ID_LENOVO_CUSBKBD in lenovo_probe_cptkbd()
731 && hdev->type != HID_TYPE_USBMOUSE) { in lenovo_probe_cptkbd()
732 hid_dbg(hdev, "Ignoring keyboard half of device\n"); in lenovo_probe_cptkbd()
736 cptkbd_data = devm_kzalloc(&hdev->dev, in lenovo_probe_cptkbd()
740 hid_err(hdev, "can't alloc keyboard descriptor\n"); in lenovo_probe_cptkbd()
743 hid_set_drvdata(hdev, cptkbd_data); in lenovo_probe_cptkbd()
749 ret = lenovo_send_cmd_cptkbd(hdev, 0x01, 0x03); in lenovo_probe_cptkbd()
751 hid_warn(hdev, "Failed to switch F7/9/11 mode: %d\n", ret); in lenovo_probe_cptkbd()
754 ret = lenovo_send_cmd_cptkbd(hdev, 0x09, 0x01); in lenovo_probe_cptkbd()
756 hid_warn(hdev, "Failed to switch middle button: %d\n", ret); in lenovo_probe_cptkbd()
762 lenovo_features_set_cptkbd(hdev); in lenovo_probe_cptkbd()
764 ret = sysfs_create_group(&hdev->dev.kobj, &lenovo_attr_group_cptkbd); in lenovo_probe_cptkbd()
766 hid_warn(hdev, "Could not create sysfs group: %d\n", ret); in lenovo_probe_cptkbd()
771 static int lenovo_probe(struct hid_device *hdev, in lenovo_probe() argument
776 ret = hid_parse(hdev); in lenovo_probe()
778 hid_err(hdev, "hid_parse failed\n"); in lenovo_probe()
782 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT); in lenovo_probe()
784 hid_err(hdev, "hid_hw_start failed\n"); in lenovo_probe()
788 switch (hdev->product) { in lenovo_probe()
790 ret = lenovo_probe_tpkbd(hdev); in lenovo_probe()
794 ret = lenovo_probe_cptkbd(hdev); in lenovo_probe()
805 hid_hw_stop(hdev); in lenovo_probe()
810 static void lenovo_remove_tpkbd(struct hid_device *hdev) in lenovo_remove_tpkbd() argument
812 struct lenovo_drvdata_tpkbd *data_pointer = hid_get_drvdata(hdev); in lenovo_remove_tpkbd()
821 sysfs_remove_group(&hdev->dev.kobj, in lenovo_remove_tpkbd()
827 hid_set_drvdata(hdev, NULL); in lenovo_remove_tpkbd()
830 static void lenovo_remove_cptkbd(struct hid_device *hdev) in lenovo_remove_cptkbd() argument
832 sysfs_remove_group(&hdev->dev.kobj, in lenovo_remove_cptkbd()
836 static void lenovo_remove(struct hid_device *hdev) in lenovo_remove() argument
838 switch (hdev->product) { in lenovo_remove()
840 lenovo_remove_tpkbd(hdev); in lenovo_remove()
844 lenovo_remove_cptkbd(hdev); in lenovo_remove()
848 hid_hw_stop(hdev); in lenovo_remove()
851 static int lenovo_input_configured(struct hid_device *hdev, in lenovo_input_configured() argument
854 switch (hdev->product) { in lenovo_input_configured()