Lines Matching defs:hdev
301 struct hid_device *hdev;
320 ret = hid_hw_power(led->hdev, PM_HINT_FULLON);
322 hid_err(led->hdev, "failed: device not resumed %d\n", ret);
326 ret = hid_hw_output_report(led->hdev, led->buf, sizeof(led->buf));
328 ret = hid_hw_raw_request(led->hdev, 0, led->buf,
333 hid_err(led->hdev, "failed to set keyboard backlight: %d\n",
337 hid_hw_power(led->hdev, PM_HINT_NORMAL);
342 static int hammer_register_leds(struct hid_device *hdev)
346 kbd_backlight = devm_kzalloc(&hdev->dev, sizeof(*kbd_backlight),
351 kbd_backlight->hdev = hdev;
361 return devm_led_classdev_register(&hdev->dev, &kbd_backlight->cdev);
371 static int hammer_input_mapping(struct hid_device *hdev, struct hid_input *hi,
388 static void hammer_folded_event(struct hid_device *hdev, bool folded)
400 hid_dbg(hdev, "%s: base: %d, folded: %d\n", __func__,
422 static bool hammer_has_usage(struct hid_device *hdev, unsigned int report_type,
425 struct hid_report_enum *re = &hdev->report_enum[report_type];
445 static bool hammer_has_folded_event(struct hid_device *hdev)
447 return hammer_has_usage(hdev, HID_INPUT_REPORT,
451 static bool hammer_has_backlight_control(struct hid_device *hdev)
453 return hammer_has_usage(hdev, HID_OUTPUT_REPORT,
457 static void hammer_get_folded_state(struct hid_device *hdev)
464 report = hdev->report_enum[HID_INPUT_REPORT].report_id_hash[0x0];
475 rlen = hid_hw_raw_request(hdev, report->id, buf, len, report->type, HID_REQ_GET_REPORT);
478 hid_warn(hdev, "Unable to read base folded state: %d (expected %d)\n", rlen, len);
486 u32 value = hid_field_extract(hdev, buf+1,
489 hammer_folded_event(hdev, value);
498 static void hammer_stop(void *hdev)
500 hid_hw_stop(hdev);
503 static int hammer_probe(struct hid_device *hdev,
509 vdata = devm_kzalloc(&hdev->dev, sizeof(*vdata), GFP_KERNEL);
513 hid_set_drvdata(hdev, vdata);
515 error = hid_parse(hdev);
519 error = hid_hw_start(hdev, HID_CONNECT_DEFAULT);
523 error = devm_add_action(&hdev->dev, hammer_stop, hdev);
533 if (hammer_has_folded_event(hdev)) {
534 hdev->quirks |= HID_QUIRK_ALWAYS_POLL;
535 error = hid_hw_open(hdev);
539 hammer_get_folded_state(hdev);
542 if (hammer_has_backlight_control(hdev)) {
543 error = hammer_register_leds(hdev);
545 hid_warn(hdev,
553 static void hammer_remove(struct hid_device *hdev)
557 if (hammer_has_folded_event(hdev)) {
558 hid_hw_close(hdev);