Lines Matching refs:hdev
144 static int __hidpp_send_report(struct hid_device *hdev, in __hidpp_send_report() argument
166 ret = hid_hw_raw_request(hdev, hidpp_report->report_id, in __hidpp_send_report()
761 static int wtp_input_mapping(struct hid_device *hdev, struct hid_input *hi, in wtp_input_mapping() argument
882 static int wtp_raw_event(struct hid_device *hdev, u8 *data, int size) in wtp_raw_event() argument
884 struct hidpp_device *hidpp = hid_get_drvdata(hdev); in wtp_raw_event()
895 hid_err(hdev, "Received HID report of bad size (%d)", in wtp_raw_event()
954 static int wtp_allocate(struct hid_device *hdev, const struct hid_device_id *id) in wtp_allocate() argument
956 struct hidpp_device *hidpp = hid_get_drvdata(hdev); in wtp_allocate()
959 wd = devm_kzalloc(&hdev->dev, sizeof(struct wtp_data), in wtp_allocate()
969 static int wtp_connect(struct hid_device *hdev, bool connected) in wtp_connect() argument
971 struct hidpp_device *hidpp = hid_get_drvdata(hdev); in wtp_connect()
981 hid_err(hdev, "Can not get wtp config: %d\n", ret); in wtp_connect()
1038 static int m560_send_config_command(struct hid_device *hdev, bool connected) in m560_send_config_command() argument
1043 hidpp_dev = hid_get_drvdata(hdev); in m560_send_config_command()
1059 static int m560_allocate(struct hid_device *hdev) in m560_allocate() argument
1061 struct hidpp_device *hidpp = hid_get_drvdata(hdev); in m560_allocate()
1064 d = devm_kzalloc(&hdev->dev, sizeof(struct m560_private_data), in m560_allocate()
1074 static int m560_raw_event(struct hid_device *hdev, u8 *data, int size) in m560_raw_event() argument
1076 struct hidpp_device *hidpp = hid_get_drvdata(hdev); in m560_raw_event()
1081 hid_err(hdev, "error in parameter\n"); in m560_raw_event()
1086 hid_err(hdev, "error in report\n"); in m560_raw_event()
1121 hid_err(hdev, "error in report\n"); in m560_raw_event()
1148 v = hid_snto32(hid_field_extract(hdev, data+3, 0, 12), 12); in m560_raw_event()
1151 v = hid_snto32(hid_field_extract(hdev, data+3, 12, 12), 12); in m560_raw_event()
1184 static int m560_input_mapping(struct hid_device *hdev, struct hid_input *hi, in m560_input_mapping() argument
1232 static int k400_allocate(struct hid_device *hdev) in k400_allocate() argument
1234 struct hidpp_device *hidpp = hid_get_drvdata(hdev); in k400_allocate()
1237 k400 = devm_kzalloc(&hdev->dev, sizeof(struct k400_private_data), in k400_allocate()
1247 static int k400_connect(struct hid_device *hdev, bool connected) in k400_connect() argument
1249 struct hidpp_device *hidpp = hid_get_drvdata(hdev); in k400_connect()
1264 static int hidpp_input_mapping(struct hid_device *hdev, struct hid_input *hi, in hidpp_input_mapping() argument
1268 struct hidpp_device *hidpp = hid_get_drvdata(hdev); in hidpp_input_mapping()
1271 return wtp_input_mapping(hdev, hi, field, usage, bit, max); in hidpp_input_mapping()
1274 return m560_input_mapping(hdev, hi, field, usage, bit, max); in hidpp_input_mapping()
1288 static int hidpp_input_configured(struct hid_device *hdev, in hidpp_input_configured() argument
1291 struct hidpp_device *hidpp = hid_get_drvdata(hdev); in hidpp_input_configured()
1342 static int hidpp_raw_event(struct hid_device *hdev, struct hid_report *report, in hidpp_raw_event() argument
1345 struct hidpp_device *hidpp = hid_get_drvdata(hdev); in hidpp_raw_event()
1352 hid_err(hdev, "received hid++ report of bad size (%d)", in hidpp_raw_event()
1360 hid_err(hdev, "received hid++ report of bad size (%d)", in hidpp_raw_event()
1374 return wtp_raw_event(hdev, data, size); in hidpp_raw_event()
1376 return m560_raw_event(hdev, data, size); in hidpp_raw_event()
1381 static void hidpp_overwrite_name(struct hid_device *hdev, bool use_unifying) in hidpp_overwrite_name() argument
1383 struct hidpp_device *hidpp = hid_get_drvdata(hdev); in hidpp_overwrite_name()
1397 hid_err(hdev, "unable to retrieve the name of the device"); in hidpp_overwrite_name()
1399 snprintf(hdev->name, sizeof(hdev->name), "%s", name); in hidpp_overwrite_name()
1418 static struct input_dev *hidpp_allocate_input(struct hid_device *hdev) in hidpp_allocate_input() argument
1420 struct input_dev *input_dev = devm_input_allocate_device(&hdev->dev); in hidpp_allocate_input()
1421 struct hidpp_device *hidpp = hid_get_drvdata(hdev); in hidpp_allocate_input()
1426 input_set_drvdata(input_dev, hdev); in hidpp_allocate_input()
1431 input_dev->phys = hdev->phys; in hidpp_allocate_input()
1432 input_dev->uniq = hdev->uniq; in hidpp_allocate_input()
1433 input_dev->id.bustype = hdev->bus; in hidpp_allocate_input()
1434 input_dev->id.vendor = hdev->vendor; in hidpp_allocate_input()
1435 input_dev->id.product = hdev->product; in hidpp_allocate_input()
1436 input_dev->id.version = hdev->version; in hidpp_allocate_input()
1437 input_dev->dev.parent = &hdev->dev; in hidpp_allocate_input()
1444 struct hid_device *hdev = hidpp->hid_dev; in hidpp_connect_event() local
1451 ret = wtp_connect(hdev, connected); in hidpp_connect_event()
1455 ret = m560_send_config_command(hdev, connected); in hidpp_connect_event()
1459 ret = k400_connect(hdev, connected); in hidpp_connect_event()
1472 hid_err(hdev, "Can not get the protocol version.\n"); in hidpp_connect_event()
1475 hid_info(hdev, "HID++ %u.%u device connected.\n", in hidpp_connect_event()
1483 if (!hidpp->name || hidpp->name == hdev->name) { in hidpp_connect_event()
1486 hid_err(hdev, in hidpp_connect_event()
1491 devm_name = devm_kasprintf(&hdev->dev, GFP_KERNEL, "%s", name); in hidpp_connect_event()
1499 input = hidpp_allocate_input(hdev); in hidpp_connect_event()
1501 hid_err(hdev, "cannot allocate new input device: %d\n", ret); in hidpp_connect_event()
1514 static int hidpp_probe(struct hid_device *hdev, const struct hid_device_id *id) in hidpp_probe() argument
1521 hidpp = devm_kzalloc(&hdev->dev, sizeof(struct hidpp_device), in hidpp_probe()
1526 hidpp->hid_dev = hdev; in hidpp_probe()
1527 hidpp->name = hdev->name; in hidpp_probe()
1528 hid_set_drvdata(hdev, hidpp); in hidpp_probe()
1539 ret = wtp_allocate(hdev, id); in hidpp_probe()
1543 ret = m560_allocate(hdev); in hidpp_probe()
1547 ret = k400_allocate(hdev); in hidpp_probe()
1556 ret = hid_parse(hdev); in hidpp_probe()
1558 hid_err(hdev, "%s:parse failed\n", __func__); in hidpp_probe()
1563 hid_device_io_start(hdev); in hidpp_probe()
1569 hid_err(hdev, "Device not connected"); in hidpp_probe()
1570 hid_device_io_stop(hdev); in hidpp_probe()
1574 hid_info(hdev, "HID++ %u.%u device connected.\n", in hidpp_probe()
1578 hidpp_overwrite_name(hdev, id->group == HID_GROUP_LOGITECH_DJ_DEVICE); in hidpp_probe()
1588 hid_device_io_stop(hdev); in hidpp_probe()
1593 ret = hid_hw_start(hdev, connect_mask); in hidpp_probe()
1595 hid_err(hdev, "%s:hid_hw_start returned error\n", __func__); in hidpp_probe()
1601 hid_device_io_start(hdev); in hidpp_probe()
1613 hid_set_drvdata(hdev, NULL); in hidpp_probe()
1617 static void hidpp_remove(struct hid_device *hdev) in hidpp_remove() argument
1619 struct hidpp_device *hidpp = hid_get_drvdata(hdev); in hidpp_remove()
1623 hid_hw_stop(hdev); in hidpp_remove()