Lines Matching defs:hdev

81 	struct hid_device *hdev;
85 struct hid_device *hdev;
353 static bool apple_is_non_apple_keyboard(struct hid_device *hdev)
360 if (strncmp(hdev->name, non_apple, strlen(non_apple)) == 0)
543 static int apple_event(struct hid_device *hdev, struct hid_field *field,
546 struct apple_sc *asc = hid_get_drvdata(hdev);
548 if (!(hdev->claimed & HID_CLAIMED_INPUT) || !field->hidinput ||
560 hidinput_apple_event(hdev, field->hidinput->input,
568 static int apple_fetch_battery(struct hid_device *hdev)
571 struct apple_sc *asc = hid_get_drvdata(hdev);
575 if (!(asc->quirks & APPLE_RDESC_BATTERY) || !hdev->battery)
578 report_enum = &hdev->report_enum[hdev->battery_report_type];
579 report = report_enum->report_id_hash[hdev->battery_report_id];
584 if (hdev->battery_capacity == hdev->battery_max)
587 hid_hw_request(hdev, report, HID_REQ_GET_REPORT);
597 struct hid_device *hdev = asc->hdev;
599 if (apple_fetch_battery(hdev) == 0) {
609 static __u8 *apple_report_fixup(struct hid_device *hdev, __u8 *rdesc,
612 struct apple_sc *asc = hid_get_drvdata(hdev);
615 hid_info(hdev,
622 hid_info(hdev,
637 hid_info(hdev,
669 static int apple_input_mapping(struct hid_device *hdev, struct hid_input *hi,
673 struct apple_sc *asc = hid_get_drvdata(hdev);
690 static int apple_input_mapped(struct hid_device *hdev, struct hid_input *hi,
694 struct apple_sc *asc = hid_get_drvdata(hdev);
708 static int apple_input_configured(struct hid_device *hdev,
711 struct apple_sc *asc = hid_get_drvdata(hdev);
714 hid_info(hdev, "Fn key not found (Apple Wireless Keyboard clone?), disabling Fn key handling\n");
718 if (apple_is_non_apple_keyboard(hdev)) {
719 hid_info(hdev, "Non-apple keyboard detected; function keys will default to fnmode=2 behavior\n");
726 static bool apple_backlight_check_support(struct hid_device *hdev)
732 list_for_each_entry(report, &hdev->report_enum[HID_INPUT_REPORT].report_list, list) {
743 static int apple_backlight_set(struct hid_device *hdev, u16 value, u16 rate)
757 ret = hid_hw_raw_request(hdev, 0xB0u, (u8 *) rep, sizeof(*rep),
770 return apple_backlight_set(backlight->hdev, brightness, 0);
773 static int apple_backlight_init(struct hid_device *hdev)
776 struct apple_sc *asc = hid_get_drvdata(hdev);
779 if (!apple_backlight_check_support(hdev))
786 ret = hid_hw_raw_request(hdev, 0xBFu, (u8 *) rep, sizeof(*rep),
789 hid_err(hdev, "backlight request failed: %d\n", ret);
793 hid_err(hdev, "backlight config struct: bad version %i\n", rep->version);
798 hid_dbg(hdev, "backlight config: off=%u, on_min=%u, on_max=%u\n",
801 asc->backlight = devm_kzalloc(&hdev->dev, sizeof(*asc->backlight), GFP_KERNEL);
807 asc->backlight->hdev = hdev;
812 ret = apple_backlight_set(hdev, 0, 0);
814 hid_err(hdev, "backlight set request failed: %d\n", ret);
818 ret = devm_led_classdev_register(&hdev->dev, &asc->backlight->cdev);
825 static int apple_probe(struct hid_device *hdev,
832 asc = devm_kzalloc(&hdev->dev, sizeof(*asc), GFP_KERNEL);
834 hid_err(hdev, "can't alloc apple descriptor\n");
838 asc->hdev = hdev;
841 hid_set_drvdata(hdev, asc);
843 ret = hid_parse(hdev);
845 hid_err(hdev, "parse failed\n");
849 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT);
851 hid_err(hdev, "hw start failed\n");
858 apple_fetch_battery(hdev);
861 apple_backlight_init(hdev);
866 static void apple_remove(struct hid_device *hdev)
868 struct apple_sc *asc = hid_get_drvdata(hdev);
872 hid_hw_stop(hdev);