Lines Matching refs:hsdev
43 * @hsdev: Stored hid instance for current hub device.
50 struct hid_sensor_hub_device *hsdev;
101 struct hid_sensor_hub_device **hsdev,
113 callback->hsdev->start_collection_index) &&
115 callback->hsdev->end_collection_index)) {
117 *hsdev = callback->hsdev;
127 int sensor_hub_register_callback(struct hid_sensor_hub_device *hsdev,
132 struct sensor_hub_data *pdata = hid_get_drvdata(hsdev->hdev);
138 callback->hsdev == hsdev) {
147 callback->hsdev = hsdev;
169 int sensor_hub_remove_callback(struct hid_sensor_hub_device *hsdev,
173 struct sensor_hub_data *pdata = hid_get_drvdata(hsdev->hdev);
179 callback->hsdev == hsdev) {
190 int sensor_hub_set_feature(struct hid_sensor_hub_device *hsdev, u32 report_id,
194 struct sensor_hub_data *data = hid_get_drvdata(hsdev->hdev);
202 report = sensor_hub_report(report_id, hsdev->hdev, HID_FEATURE_REPORT);
228 hid_hw_request(hsdev->hdev, report, HID_REQ_SET_REPORT);
229 hid_hw_wait(hsdev->hdev);
238 int sensor_hub_get_feature(struct hid_sensor_hub_device *hsdev, u32 report_id,
242 struct sensor_hub_data *data = hid_get_drvdata(hsdev->hdev);
252 report = sensor_hub_report(report_id, hsdev->hdev, HID_FEATURE_REPORT);
258 hid_hw_request(hsdev->hdev, report, HID_REQ_GET_REPORT);
259 hid_hw_wait(hsdev->hdev);
290 int sensor_hub_input_attr_get_raw_value(struct hid_sensor_hub_device *hsdev,
296 struct sensor_hub_data *data = hid_get_drvdata(hsdev->hdev);
301 report = sensor_hub_report(report_id, hsdev->hdev,
306 mutex_lock(hsdev->mutex_ptr);
308 memset(&hsdev->pending, 0, sizeof(hsdev->pending));
309 init_completion(&hsdev->pending.ready);
310 hsdev->pending.usage_id = usage_id;
311 hsdev->pending.attr_usage_id = attr_usage_id;
312 hsdev->pending.raw_size = 0;
315 hsdev->pending.status = true;
319 hid_hw_request(hsdev->hdev, report, HID_REQ_GET_REPORT);
323 &hsdev->pending.ready, HZ*5);
324 switch (hsdev->pending.raw_size) {
327 ret_val = *(s8 *)hsdev->pending.raw_data;
329 ret_val = *(u8 *)hsdev->pending.raw_data;
333 ret_val = *(s16 *)hsdev->pending.raw_data;
335 ret_val = *(u16 *)hsdev->pending.raw_data;
338 ret_val = *(u32 *)hsdev->pending.raw_data;
343 kfree(hsdev->pending.raw_data);
344 hsdev->pending.status = false;
346 mutex_unlock(hsdev->mutex_ptr);
352 int hid_sensor_get_usage_index(struct hid_sensor_hub_device *hsdev,
359 report = sensor_hub_report(report_id, hsdev->hdev, HID_FEATURE_REPORT);
374 int sensor_hub_input_get_attribute_info(struct hid_sensor_hub_device *hsdev,
385 struct hid_device *hdev = hsdev->hdev;
406 hsdev->start_collection_index) &&
408 hsdev->end_collection_index)) {
437 callback->hsdev, callback->priv);
455 callback->hsdev, callback->priv);
482 struct hid_sensor_hub_device *hsdev = NULL;
513 &hsdev, &priv);
518 if (hsdev->pending.status && (hsdev->pending.attr_usage_id ==
520 hsdev->pending.attr_usage_id ==
523 hsdev->pending.raw_data = kmemdup(ptr, sz, GFP_ATOMIC);
524 if (hsdev->pending.raw_data)
525 hsdev->pending.raw_size = sz;
527 hsdev->pending.raw_size = 0;
528 complete(&hsdev->pending.ready);
532 callback->capture_sample(hsdev,
536 callback->capture_sample(hsdev,
543 callback->send_event(hsdev, collection->usage,
550 int sensor_hub_device_open(struct hid_sensor_hub_device *hsdev)
553 struct sensor_hub_data *data = hid_get_drvdata(hsdev->hdev);
557 ret = hid_hw_open(hsdev->hdev);
559 hid_err(hsdev->hdev, "failed to open hid device\n");
571 void sensor_hub_device_close(struct hid_sensor_hub_device *hsdev)
573 struct sensor_hub_data *data = hid_get_drvdata(hsdev->hdev);
578 hid_hw_close(hsdev->hdev);
613 struct hid_sensor_hub_device *hsdev;
665 hsdev = devm_kzalloc(&hdev->dev, sizeof(*hsdev),
667 if (!hsdev) {
672 hsdev->hdev = hdev;
673 hsdev->vendor_id = hdev->vendor;
674 hsdev->product_id = hdev->product;
675 hsdev->usage = collection->usage;
676 hsdev->mutex_ptr = devm_kzalloc(&hdev->dev,
679 if (!hsdev->mutex_ptr) {
683 mutex_init(hsdev->mutex_ptr);
684 hsdev->start_collection_index = i;
687 last_hsdev = hsdev;
700 hsdev;
703 sizeof(*hsdev);
705 hsdev->start_collection_index);
711 collection_hsdev = hsdev;
744 struct hid_sensor_hub_device *hsdev =
746 if (hsdev->pending.status)
747 complete(&hsdev->pending.ready);