Lines Matching defs:hdev

81 	struct hid_device *hdev;
86 struct hid_device *hdev;
352 static bool apple_is_non_apple_keyboard(struct hid_device *hdev)
359 if (strncmp(hdev->name, non_apple, strlen(non_apple)) == 0)
542 static int apple_event(struct hid_device *hdev, struct hid_field *field,
545 struct apple_sc *asc = hid_get_drvdata(hdev);
547 if (!(hdev->claimed & HID_CLAIMED_INPUT) || !field->hidinput ||
559 hidinput_apple_event(hdev, field->hidinput->input,
567 static int apple_fetch_battery(struct hid_device *hdev)
570 struct apple_sc *asc = hid_get_drvdata(hdev);
574 if (!(asc->quirks & APPLE_RDESC_BATTERY) || !hdev->battery)
577 report_enum = &hdev->report_enum[hdev->battery_report_type];
578 report = report_enum->report_id_hash[hdev->battery_report_id];
583 if (hdev->battery_capacity == hdev->battery_max)
586 hid_hw_request(hdev, report, HID_REQ_GET_REPORT);
596 struct hid_device *hdev = asc->hdev;
598 if (apple_fetch_battery(hdev) == 0) {
608 static __u8 *apple_report_fixup(struct hid_device *hdev, __u8 *rdesc,
611 struct apple_sc *asc = hid_get_drvdata(hdev);
614 hid_info(hdev,
621 hid_info(hdev,
636 hid_info(hdev,
668 static int apple_input_mapping(struct hid_device *hdev, struct hid_input *hi,
672 struct apple_sc *asc = hid_get_drvdata(hdev);
689 static int apple_input_mapped(struct hid_device *hdev, struct hid_input *hi,
693 struct apple_sc *asc = hid_get_drvdata(hdev);
707 static int apple_input_configured(struct hid_device *hdev,
710 struct apple_sc *asc = hid_get_drvdata(hdev);
713 hid_info(hdev, "Fn key not found (Apple Wireless Keyboard clone?), disabling Fn key handling\n");
717 if (apple_is_non_apple_keyboard(hdev)) {
718 hid_info(hdev, "Non-apple keyboard detected; function keys will default to fnmode=2 behavior\n");
725 static bool apple_backlight_check_support(struct hid_device *hdev)
731 list_for_each_entry(report, &hdev->report_enum[HID_INPUT_REPORT].report_list, list) {
742 static int apple_backlight_set(struct hid_device *hdev, u16 value, u16 rate)
756 ret = hid_hw_raw_request(hdev, 0xB0u, (u8 *) rep, sizeof(*rep),
769 return apple_backlight_set(backlight->hdev, brightness, 0);
772 static int apple_backlight_init(struct hid_device *hdev)
775 struct apple_sc *asc = hid_get_drvdata(hdev);
778 if (!apple_backlight_check_support(hdev))
785 ret = hid_hw_raw_request(hdev, 0xBFu, (u8 *) rep, sizeof(*rep),
788 hid_err(hdev, "backlight request failed: %d\n", ret);
792 hid_err(hdev, "backlight config struct: bad version %i\n", rep->version);
797 hid_dbg(hdev, "backlight config: off=%u, on_min=%u, on_max=%u\n",
800 asc->backlight = devm_kzalloc(&hdev->dev, sizeof(*asc->backlight), GFP_KERNEL);
806 asc->backlight->hdev = hdev;
811 ret = apple_backlight_set(hdev, 0, 0);
813 hid_err(hdev, "backlight set request failed: %d\n", ret);
817 ret = devm_led_classdev_register(&hdev->dev, &asc->backlight->cdev);
824 static int apple_probe(struct hid_device *hdev,
831 asc = devm_kzalloc(&hdev->dev, sizeof(*asc), GFP_KERNEL);
833 hid_err(hdev, "can't alloc apple descriptor\n");
837 asc->hdev = hdev;
840 hid_set_drvdata(hdev, asc);
842 ret = hid_parse(hdev);
844 hid_err(hdev, "parse failed\n");
848 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT);
850 hid_err(hdev, "hw start failed\n");
857 apple_fetch_battery(hdev);
860 apple_backlight_init(hdev);
865 static void apple_remove(struct hid_device *hdev)
867 struct apple_sc *asc = hid_get_drvdata(hdev);
871 hid_hw_stop(hdev);