Lines Matching defs:hdev

300 	struct hid_device *hdev;
319 ret = hid_hw_power(led->hdev, PM_HINT_FULLON);
321 hid_err(led->hdev, "failed: device not resumed %d\n", ret);
325 ret = hid_hw_output_report(led->hdev, led->buf, sizeof(led->buf));
327 ret = hid_hw_raw_request(led->hdev, 0, led->buf,
332 hid_err(led->hdev, "failed to set keyboard backlight: %d\n",
336 hid_hw_power(led->hdev, PM_HINT_NORMAL);
341 static int hammer_register_leds(struct hid_device *hdev)
345 kbd_backlight = devm_kzalloc(&hdev->dev, sizeof(*kbd_backlight),
350 kbd_backlight->hdev = hdev;
360 return devm_led_classdev_register(&hdev->dev, &kbd_backlight->cdev);
370 static int hammer_input_mapping(struct hid_device *hdev, struct hid_input *hi,
387 static void hammer_folded_event(struct hid_device *hdev, bool folded)
399 hid_dbg(hdev, "%s: base: %d, folded: %d\n", __func__,
421 static bool hammer_has_usage(struct hid_device *hdev, unsigned int report_type,
424 struct hid_report_enum *re = &hdev->report_enum[report_type];
444 static bool hammer_has_folded_event(struct hid_device *hdev)
446 return hammer_has_usage(hdev, HID_INPUT_REPORT,
450 static bool hammer_has_backlight_control(struct hid_device *hdev)
452 return hammer_has_usage(hdev, HID_OUTPUT_REPORT,
456 static void hammer_get_folded_state(struct hid_device *hdev)
463 report = hdev->report_enum[HID_INPUT_REPORT].report_id_hash[0x0];
474 rlen = hid_hw_raw_request(hdev, report->id, buf, len, report->type, HID_REQ_GET_REPORT);
477 hid_warn(hdev, "Unable to read base folded state: %d (expected %d)\n", rlen, len);
485 u32 value = hid_field_extract(hdev, buf+1,
488 hammer_folded_event(hdev, value);
497 static void hammer_stop(void *hdev)
499 hid_hw_stop(hdev);
502 static int hammer_probe(struct hid_device *hdev,
508 vdata = devm_kzalloc(&hdev->dev, sizeof(*vdata), GFP_KERNEL);
512 hid_set_drvdata(hdev, vdata);
514 error = hid_parse(hdev);
518 error = hid_hw_start(hdev, HID_CONNECT_DEFAULT);
522 error = devm_add_action(&hdev->dev, hammer_stop, hdev);
532 if (hammer_has_folded_event(hdev)) {
533 hdev->quirks |= HID_QUIRK_ALWAYS_POLL;
534 error = hid_hw_open(hdev);
538 hammer_get_folded_state(hdev);
541 if (hammer_has_backlight_control(hdev)) {
542 error = hammer_register_leds(hdev);
544 hid_warn(hdev,
552 static void hammer_remove(struct hid_device *hdev)
556 if (hammer_has_folded_event(hdev)) {
557 hid_hw_close(hdev);