Lines Matching defs:hdev
541 struct hid_device *hdev;
608 struct hid_device *hdev = to_hid_device(dev);
609 struct sony_sc *sc = hid_get_drvdata(hdev);
618 struct hid_device *hdev = to_hid_device(dev);
619 struct sony_sc *sc = hid_get_drvdata(hdev);
645 struct hid_device *hdev = to_hid_device(dev);
646 struct sony_sc *sc = hid_get_drvdata(hdev);
657 struct hid_device *hdev = to_hid_device(dev);
658 struct sony_sc *sc = hid_get_drvdata(hdev);
665 static u8 *motion_fixup(struct hid_device *hdev, u8 *rdesc,
672 static u8 *ps3remote_fixup(struct hid_device *hdev, u8 *rdesc,
679 static int ps3remote_mapping(struct hid_device *hdev, struct hid_input *hi,
713 static int navigation_mapping(struct hid_device *hdev, struct hid_input *hi,
761 static int sixaxis_mapping(struct hid_device *hdev, struct hid_input *hi,
809 static int ds4_mapping(struct hid_device *hdev, struct hid_input *hi,
840 static u8 *sony_report_fixup(struct hid_device *hdev, u8 *rdesc,
843 struct sony_sc *sc = hid_get_drvdata(hdev);
859 hid_info(hdev, "Fixing up Sony RF Receiver report descriptor\n");
865 return motion_fixup(hdev, rdesc, rsize);
868 return ps3remote_fixup(hdev, rdesc, rsize);
881 hid_info(hdev, "Fixing up USB dongle report descriptor\n");
942 struct hid_input *hidinput = list_entry(sc->hdev->inputs.next,
1200 static int sony_raw_event(struct hid_device *hdev, struct hid_report *report,
1203 struct sony_sc *sc = hid_get_drvdata(hdev);
1246 hid_dbg(sc->hdev, "DualShock 4 input report's CRC check failed, received crc 0x%0x != 0x%0x\n",
1277 hid_info(sc->hdev, "DualShock 4 USB dongle: controller connected\n");
1292 hid_info(sc->hdev, "DualShock 4 USB dongle: controller disconnected\n");
1322 static int sony_mapping(struct hid_device *hdev, struct hid_input *hi,
1326 struct sony_sc *sc = hid_get_drvdata(hdev);
1352 return ps3remote_mapping(hdev, hi, field, usage, bit, max);
1355 return navigation_mapping(hdev, hi, field, usage, bit, max);
1358 return sixaxis_mapping(hdev, hi, field, usage, bit, max);
1361 return ds4_mapping(hdev, hi, field, usage, bit, max);
1375 sc->touchpad = devm_input_allocate_device(&sc->hdev->dev);
1380 sc->touchpad->dev.parent = &sc->hdev->dev;
1381 sc->touchpad->phys = sc->hdev->phys;
1382 sc->touchpad->uniq = sc->hdev->uniq;
1383 sc->touchpad->id.bustype = sc->hdev->bus;
1384 sc->touchpad->id.vendor = sc->hdev->vendor;
1385 sc->touchpad->id.product = sc->hdev->product;
1386 sc->touchpad->id.version = sc->hdev->version;
1391 name_sz = strlen(sc->hdev->name) + sizeof(DS4_TOUCHPAD_SUFFIX);
1392 name = devm_kzalloc(&sc->hdev->dev, name_sz, GFP_KERNEL);
1395 snprintf(name, name_sz, "%s" DS4_TOUCHPAD_SUFFIX, sc->hdev->name);
1439 sc->sensor_dev = devm_input_allocate_device(&sc->hdev->dev);
1444 sc->sensor_dev->dev.parent = &sc->hdev->dev;
1445 sc->sensor_dev->phys = sc->hdev->phys;
1446 sc->sensor_dev->uniq = sc->hdev->uniq;
1447 sc->sensor_dev->id.bustype = sc->hdev->bus;
1448 sc->sensor_dev->id.vendor = sc->hdev->vendor;
1449 sc->sensor_dev->id.product = sc->hdev->product;
1450 sc->sensor_dev->id.version = sc->hdev->version;
1455 name_sz = strlen(sc->hdev->name) + sizeof(SENSOR_SUFFIX);
1456 name = devm_kzalloc(&sc->hdev->dev, name_sz, GFP_KERNEL);
1459 snprintf(name, name_sz, "%s" SENSOR_SUFFIX, sc->hdev->name);
1510 static int sixaxis_set_operational_usb(struct hid_device *hdev)
1512 struct sony_sc *sc = hid_get_drvdata(hdev);
1522 ret = hid_hw_raw_request(hdev, 0xf2, buf, SIXAXIS_REPORT_0xF2_SIZE,
1525 hid_err(hdev, "can't set operational mode: step 1\n");
1533 ret = hid_hw_raw_request(hdev, 0xf5, buf, SIXAXIS_REPORT_0xF5_SIZE,
1536 hid_err(hdev, "can't set operational mode: step 2\n");
1547 ret = hid_hw_output_report(hdev, buf, 1);
1549 hid_info(hdev, "can't set operational mode: step 3, ignoring\n");
1559 static int sixaxis_set_operational_bt(struct hid_device *hdev)
1569 ret = hid_hw_raw_request(hdev, buf[0], buf, sizeof(report),
1604 ret = hid_hw_raw_request(sc->hdev, 0x02, buf,
1621 ret = hid_hw_raw_request(sc->hdev, 0x05, buf,
1633 hid_warn(sc->hdev, "DualShock 4 calibration report's CRC check failed, received crc 0x%0x != 0x%0x\n",
1636 hid_warn(sc->hdev, "Retrying DualShock 4 get calibration report request\n");
1736 hid_err(sc->hdev, "DualShock 4 USB dongle: calibration failed, disabling device\n");
1739 hid_info(sc->hdev, "DualShock 4 USB dongle: calibration completed\n");
1757 ret = hid_hw_raw_request(sc->hdev, 0xA3, buf,
1825 struct hid_device *hdev = sc->hdev;
1827 &hdev->report_enum[HID_OUTPUT_REPORT].report_list;
1841 hid_hw_request(hdev, report, HID_REQ_SET_REPORT);
1856 struct hid_device *hdev = to_hid_device(dev);
1862 drv_data = hid_get_drvdata(hdev);
1864 hid_err(hdev, "No device data\n");
1898 struct hid_device *hdev = to_hid_device(dev);
1903 drv_data = hid_get_drvdata(hdev);
1905 hid_err(hdev, "No device data\n");
1921 struct hid_device *hdev = to_hid_device(dev);
1922 struct sony_sc *drv_data = hid_get_drvdata(hdev);
1927 hid_err(hdev, "No device data\n");
1966 struct hid_device *hdev = sc->hdev;
1987 if (!hid_validate_values(hdev, HID_OUTPUT_REPORT, 0, 0, 7))
2029 name_sz = strlen(dev_name(&hdev->dev)) + name_len + 1;
2034 name_sz = strlen(dev_name(&hdev->dev)) + strlen(ds4_name_str[n]) + 2;
2036 led = devm_kzalloc(&hdev->dev, sizeof(struct led_classdev) + name_sz, GFP_KERNEL);
2038 hid_err(hdev, "Couldn't allocate memory for LED %d\n", n);
2044 snprintf(name, name_sz, name_fmt, dev_name(&hdev->dev),
2047 snprintf(name, name_sz, name_fmt, dev_name(&hdev->dev), n + 1);
2060 ret = devm_led_classdev_register(&hdev->dev, led);
2062 hid_err(hdev, "Failed to register LED %d\n", n);
2123 hid_hw_output_report(sc->hdev, (u8 *)report,
2126 hid_hw_raw_request(sc->hdev, report->report_id, (u8 *)report,
2133 struct hid_device *hdev = sc->hdev;
2180 hid_hw_output_report(hdev, buf, DS4_OUTPUT_REPORT_0x05_SIZE);
2189 hid_hw_output_report(hdev, buf, DS4_OUTPUT_REPORT_0x11_SIZE);
2195 struct hid_device *hdev = sc->hdev;
2210 hid_hw_output_report(hdev, (u8 *)report, MOTION_REPORT_0x02_SIZE);
2231 devm_kmalloc(&sc->hdev->dev,
2235 sc->output_report_dmabuf = devm_kmalloc(&sc->hdev->dev,
2239 sc->output_report_dmabuf = devm_kmalloc(&sc->hdev->dev,
2243 sc->output_report_dmabuf = devm_kmalloc(&sc->hdev->dev,
2277 if (list_empty(&sc->hdev->inputs)) {
2278 hid_err(sc->hdev, "no inputs found\n");
2281 hidinput = list_entry(sc->hdev->inputs.next, struct hid_input, list);
2343 struct hid_device *hdev = sc->hdev;
2357 sc->battery_desc.name = devm_kasprintf(&hdev->dev, GFP_KERNEL,
2362 sc->battery = devm_power_supply_register(&hdev->dev, &sc->battery_desc,
2366 hid_err(hdev, "Unable to register battery device\n");
2370 power_supply_powers(sc->battery, &hdev->dev);
2410 hid_info(sc->hdev,
2442 ret = strlen(sc->hdev->uniq);
2446 ret = sscanf(sc->hdev->uniq,
2473 hid_warn(sc->hdev, "UNIQ does not contain a MAC address; duplicate check skipped\n");
2486 ret = hid_hw_raw_request(sc->hdev, 0x81, buf,
2491 hid_err(sc->hdev, "failed to retrieve feature report 0x81 with the DualShock 4 MAC address\n");
2498 snprintf(sc->hdev->uniq, sizeof(sc->hdev->uniq),
2511 ret = hid_hw_raw_request(sc->hdev, 0xf2, buf,
2516 hid_err(sc->hdev, "failed to retrieve feature report 0xf2 with the Sixaxis MAC address\n");
2528 snprintf(sc->hdev->uniq, sizeof(sc->hdev->uniq),
2600 static int sony_input_configured(struct hid_device *hdev,
2603 struct sony_sc *sc = hid_get_drvdata(hdev);
2609 hid_err(hdev, "failed to allocate the device id\n");
2619 hid_err(hdev, "failed to allocate the output report buffer\n");
2640 hdev->quirks |= HID_QUIRK_NO_OUTPUT_REPORTS_ON_INTR_EP;
2641 hdev->quirks |= HID_QUIRK_SKIP_OUTPUT_REPORT_ID;
2644 ret = sixaxis_set_operational_usb(hdev);
2646 hid_err(hdev, "Failed to set controller into operational mode\n");
2656 hdev->quirks |= HID_QUIRK_NO_OUTPUT_REPORTS_ON_INTR_EP;
2658 ret = sixaxis_set_operational_bt(hdev);
2660 hid_err(hdev, "Failed to set controller into operational mode\n");
2672 hdev->quirks |= HID_QUIRK_NO_OUTPUT_REPORTS_ON_INTR_EP;
2673 hdev->quirks |= HID_QUIRK_SKIP_OUTPUT_REPORT_ID;
2676 ret = sixaxis_set_operational_usb(hdev);
2678 hid_err(hdev, "Failed to set controller into operational mode\n");
2684 hid_err(sc->hdev,
2695 hdev->quirks |= HID_QUIRK_NO_OUTPUT_REPORTS_ON_INTR_EP;
2697 ret = sixaxis_set_operational_bt(hdev);
2699 hid_err(hdev, "Failed to set controller into operational mode\n");
2705 hid_err(sc->hdev,
2714 hid_err(hdev, "Failed to get calibration data from Dualshock 4\n");
2720 hid_err(sc->hdev, "Failed to get version data from Dualshock 4\n");
2724 ret = device_create_file(&sc->hdev->dev, &dev_attr_firmware_version);
2729 hid_err(sc->hdev, "can't create sysfs firmware_version attribute err: %d\n", ret);
2733 ret = device_create_file(&sc->hdev->dev, &dev_attr_hardware_version);
2736 hid_err(sc->hdev, "can't create sysfs hardware_version attribute err: %d\n", ret);
2746 hid_err(sc->hdev,
2754 hid_err(sc->hdev,
2761 ret = device_create_file(&sc->hdev->dev, &dev_attr_bt_poll_interval);
2763 hid_warn(sc->hdev,
2783 hid_err(sc->hdev,
2807 ret = hid_hw_open(hdev);
2809 hid_err(hdev, "hw open failed\n");
2822 hid_hw_close(hdev);
2829 device_remove_file(&sc->hdev->dev, &dev_attr_bt_poll_interval);
2831 device_remove_file(&sc->hdev->dev, &dev_attr_firmware_version);
2833 device_remove_file(&sc->hdev->dev, &dev_attr_hardware_version);
2840 static int sony_probe(struct hid_device *hdev, const struct hid_device_id *id)
2847 if (!strcmp(hdev->name, "FutureMax Dance Mat"))
2850 if (!strcmp(hdev->name, "SHANWAN PS3 GamePad"))
2853 sc = devm_kzalloc(&hdev->dev, sizeof(*sc), GFP_KERNEL);
2855 hid_err(hdev, "can't alloc sony descriptor\n");
2862 hid_set_drvdata(hdev, sc);
2863 sc->hdev = hdev;
2865 ret = hid_parse(hdev);
2867 hid_err(hdev, "parse failed\n");
2883 hdev->version |= 0x8000;
2885 ret = hid_hw_start(hdev, connect_mask);
2887 hid_err(hdev, "hw start failed\n");
2899 if (!(hdev->claimed & HID_CLAIMED_INPUT)) {
2900 hid_err(hdev, "failed to claim input\n");
2901 hid_hw_stop(hdev);
2908 static void sony_remove(struct hid_device *hdev)
2910 struct sony_sc *sc = hid_get_drvdata(hdev);
2912 hid_hw_close(hdev);
2915 device_remove_file(&sc->hdev->dev, &dev_attr_bt_poll_interval);
2918 device_remove_file(&sc->hdev->dev, &dev_attr_firmware_version);
2921 device_remove_file(&sc->hdev->dev, &dev_attr_hardware_version);
2929 hid_hw_stop(hdev);
2934 static int sony_suspend(struct hid_device *hdev, pm_message_t message)
2940 struct sony_sc *sc = hid_get_drvdata(hdev);
2950 static int sony_resume(struct hid_device *hdev)
2952 struct sony_sc *sc = hid_get_drvdata(hdev);
2960 sixaxis_set_operational_usb(sc->hdev);