Lines Matching refs:hdev

68 static struct hid_report *sensor_hub_report(int id, struct hid_device *hdev,  in sensor_hub_report()  argument
73 list_for_each_entry(report, &hdev->report_enum[dir].report_list, list) { in sensor_hub_report()
77 hid_warn(hdev, "No report with id 0x%x found\n", id); in sensor_hub_report()
82 static int sensor_hub_get_physical_device_count(struct hid_device *hdev) in sensor_hub_get_physical_device_count() argument
87 for (i = 0; i < hdev->maxcollection; ++i) { in sensor_hub_get_physical_device_count()
88 struct hid_collection *collection = &hdev->collection[i]; in sensor_hub_get_physical_device_count()
111 struct hid_device *hdev, in sensor_hub_get_callback() argument
118 struct sensor_hub_data *pdata = hid_get_drvdata(hdev); in sensor_hub_get_callback()
145 struct sensor_hub_data *pdata = hid_get_drvdata(hsdev->hdev); in sensor_hub_register_callback()
186 struct sensor_hub_data *pdata = hid_get_drvdata(hsdev->hdev); in sensor_hub_remove_callback()
207 struct sensor_hub_data *data = hid_get_drvdata(hsdev->hdev); in sensor_hub_set_feature()
215 report = sensor_hub_report(report_id, hsdev->hdev, HID_FEATURE_REPORT); in sensor_hub_set_feature()
235 hid_hw_request(hsdev->hdev, report, HID_REQ_SET_REPORT); in sensor_hub_set_feature()
236 hid_hw_wait(hsdev->hdev); in sensor_hub_set_feature()
249 struct sensor_hub_data *data = hid_get_drvdata(hsdev->hdev); in sensor_hub_get_feature()
254 report = sensor_hub_report(report_id, hsdev->hdev, HID_FEATURE_REPORT); in sensor_hub_get_feature()
260 hid_hw_request(hsdev->hdev, report, HID_REQ_GET_REPORT); in sensor_hub_get_feature()
261 hid_hw_wait(hsdev->hdev); in sensor_hub_get_feature()
287 struct sensor_hub_data *data = hid_get_drvdata(hsdev->hdev); in sensor_hub_input_attr_get_raw_value()
292 report = sensor_hub_report(report_id, hsdev->hdev, in sensor_hub_input_attr_get_raw_value()
310 hid_hw_request(hsdev->hdev, report, HID_REQ_GET_REPORT); in sensor_hub_input_attr_get_raw_value()
344 report = sensor_hub_report(report_id, hsdev->hdev, HID_FEATURE_REPORT); in hid_sensor_get_usage_index()
370 struct hid_device *hdev = hsdev->hdev; in sensor_hub_input_get_attribute_info() local
380 report_enum = &hdev->report_enum[type]; in sensor_hub_input_get_attribute_info()
410 static int sensor_hub_suspend(struct hid_device *hdev, pm_message_t message) in sensor_hub_suspend() argument
412 struct sensor_hub_data *pdata = hid_get_drvdata(hdev); in sensor_hub_suspend()
416 hid_dbg(hdev, " sensor_hub_suspend\n"); in sensor_hub_suspend()
428 static int sensor_hub_resume(struct hid_device *hdev) in sensor_hub_resume() argument
430 struct sensor_hub_data *pdata = hid_get_drvdata(hdev); in sensor_hub_resume()
434 hid_dbg(hdev, " sensor_hub_resume\n"); in sensor_hub_resume()
446 static int sensor_hub_reset_resume(struct hid_device *hdev) in sensor_hub_reset_resume() argument
455 static int sensor_hub_raw_event(struct hid_device *hdev, in sensor_hub_raw_event() argument
461 struct sensor_hub_data *pdata = hid_get_drvdata(hdev); in sensor_hub_raw_event()
468 hid_dbg(hdev, "sensor_hub_raw_event report id:0x%x size:%d type:%d\n", in sensor_hub_raw_event()
470 hid_dbg(hdev, "maxfield:%d\n", report->maxfield); in sensor_hub_raw_event()
480 hid_dbg(hdev, "%d collection_index:%x hid:%x sz:%x\n", in sensor_hub_raw_event()
487 collection = &hdev->collection[ in sensor_hub_raw_event()
489 hid_dbg(hdev, "collection->usage %x\n", in sensor_hub_raw_event()
492 callback = sensor_hub_get_callback(hdev, in sensor_hub_raw_event()
504 hid_dbg(hdev, "data was pending ...\n"); in sensor_hub_raw_event()
535 struct sensor_hub_data *data = hid_get_drvdata(hsdev->hdev); in sensor_hub_device_open()
539 ret = hid_hw_open(hsdev->hdev); in sensor_hub_device_open()
541 hid_err(hsdev->hdev, "failed to open hid device\n"); in sensor_hub_device_open()
555 struct sensor_hub_data *data = hid_get_drvdata(hsdev->hdev); in sensor_hub_device_close()
560 hid_hw_close(hsdev->hdev); in sensor_hub_device_close()
565 static __u8 *sensor_hub_report_fixup(struct hid_device *hdev, __u8 *rdesc, in sensor_hub_report_fixup() argument
569 struct sensor_hub_data *sd = hid_get_drvdata(hdev); in sensor_hub_report_fixup()
576 hid_dbg(hdev, "No Enum quirks\n"); in sensor_hub_report_fixup()
598 if (hdev->product == USB_DEVICE_ID_TEXAS_INSTRUMENTS_LENOVO_YOGA && in sensor_hub_report_fixup()
613 static int sensor_hub_probe(struct hid_device *hdev, in sensor_hub_probe() argument
625 sd = devm_kzalloc(&hdev->dev, sizeof(*sd), GFP_KERNEL); in sensor_hub_probe()
627 hid_err(hdev, "cannot allocate Sensor data\n"); in sensor_hub_probe()
631 hid_set_drvdata(hdev, sd); in sensor_hub_probe()
637 ret = hid_parse(hdev); in sensor_hub_probe()
639 hid_err(hdev, "parse failed\n"); in sensor_hub_probe()
642 INIT_LIST_HEAD(&hdev->inputs); in sensor_hub_probe()
644 ret = hid_hw_start(hdev, 0); in sensor_hub_probe()
646 hid_err(hdev, "hw start failed\n"); in sensor_hub_probe()
652 dev_cnt = sensor_hub_get_physical_device_count(hdev); in sensor_hub_probe()
654 hid_err(hdev, "Invalid Physical device count\n"); in sensor_hub_probe()
658 sd->hid_sensor_hub_client_devs = devm_kzalloc(&hdev->dev, dev_cnt * in sensor_hub_probe()
662 hid_err(hdev, "Failed to allocate memory for mfd cells\n"); in sensor_hub_probe()
667 for (i = 0; i < hdev->maxcollection; ++i) { in sensor_hub_probe()
668 struct hid_collection *collection = &hdev->collection[i]; in sensor_hub_probe()
673 hsdev = devm_kzalloc(&hdev->dev, sizeof(*hsdev), in sensor_hub_probe()
676 hid_err(hdev, "cannot allocate hid_sensor_hub_device\n"); in sensor_hub_probe()
680 hsdev->hdev = hdev; in sensor_hub_probe()
681 hsdev->vendor_id = hdev->vendor; in sensor_hub_probe()
682 hsdev->product_id = hdev->product; in sensor_hub_probe()
684 hsdev->mutex_ptr = devm_kzalloc(&hdev->dev, in sensor_hub_probe()
696 name = devm_kasprintf(&hdev->dev, GFP_KERNEL, in sensor_hub_probe()
700 hid_err(hdev, "Failed MFD device name\n"); in sensor_hub_probe()
712 hid_dbg(hdev, "Adding %s:%d\n", name, in sensor_hub_probe()
727 ret = mfd_add_hotplug_devices(&hdev->dev, in sensor_hub_probe()
736 hid_hw_stop(hdev); in sensor_hub_probe()
741 static void sensor_hub_remove(struct hid_device *hdev) in sensor_hub_remove() argument
743 struct sensor_hub_data *data = hid_get_drvdata(hdev); in sensor_hub_remove()
747 hid_dbg(hdev, " hardware removed\n"); in sensor_hub_remove()
748 hid_hw_close(hdev); in sensor_hub_remove()
749 hid_hw_stop(hdev); in sensor_hub_remove()
758 mfd_remove_devices(&hdev->dev); in sensor_hub_remove()
759 hid_set_drvdata(hdev, NULL); in sensor_hub_remove()