blob: ca88ddc2d78ff1d0fab418de7bc6b3c6f71f3e17 [file] [log] [blame]
srinivas pandruvada401ca242012-09-05 13:56:00 +01001/*
2 * HID Sensors Driver
3 * Copyright (c) 2012, Intel Corporation.
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms and conditions of the GNU General Public License,
7 * version 2, as published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along with
15 * this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
17 *
18 */
19#include <linux/device.h>
20#include <linux/hid.h>
21#include <linux/usb.h>
22#include "usbhid/usbhid.h"
23#include <linux/module.h>
24#include <linux/slab.h>
25#include <linux/mfd/core.h>
26#include <linux/list.h>
27#include <linux/hid-sensor-ids.h>
28#include <linux/hid-sensor-hub.h>
29#include "hid-ids.h"
30
31/**
32 * struct sensor_hub_pending - Synchronous read pending information
33 * @status: Pending status true/false.
34 * @ready: Completion synchronization data.
35 * @usage_id: Usage id for physical device, E.g. Gyro usage id.
36 * @attr_usage_id: Usage Id of a field, E.g. X-AXIS for a gyro.
37 * @raw_size: Response size for a read request.
38 * @raw_data: Place holder for received response.
39 */
40struct sensor_hub_pending {
41 bool status;
42 struct completion ready;
43 u32 usage_id;
44 u32 attr_usage_id;
45 int raw_size;
46 u8 *raw_data;
47};
48
49/**
50 * struct sensor_hub_data - Hold a instance data for a HID hub device
51 * @hsdev: Stored hid instance for current hub device.
52 * @mutex: Mutex to serialize synchronous request.
53 * @lock: Spin lock to protect pending request structure.
54 * @pending: Holds information of pending sync read request.
55 * @dyn_callback_list: Holds callback function
56 * @dyn_callback_lock: spin lock to protect callback list
57 * @hid_sensor_hub_client_devs: Stores all MFD cells for a hub instance.
58 * @hid_sensor_client_cnt: Number of MFD cells, (no of sensors attached).
59 */
60struct sensor_hub_data {
61 struct hid_sensor_hub_device *hsdev;
62 struct mutex mutex;
63 spinlock_t lock;
64 struct sensor_hub_pending pending;
65 struct list_head dyn_callback_list;
66 spinlock_t dyn_callback_lock;
67 struct mfd_cell *hid_sensor_hub_client_devs;
68 int hid_sensor_client_cnt;
69};
70
71/**
72 * struct hid_sensor_hub_callbacks_list - Stores callback list
73 * @list: list head.
74 * @usage_id: usage id for a physical device.
75 * @usage_callback: Stores registered callback functions.
76 * @priv: Private data for a physical device.
77 */
78struct hid_sensor_hub_callbacks_list {
79 struct list_head list;
80 u32 usage_id;
81 struct hid_sensor_hub_callbacks *usage_callback;
82 void *priv;
83};
84
srinivas pandruvada401ca242012-09-05 13:56:00 +010085static struct hid_report *sensor_hub_report(int id, struct hid_device *hdev,
86 int dir)
87{
88 struct hid_report *report;
89
90 list_for_each_entry(report, &hdev->report_enum[dir].report_list, list) {
91 if (report->id == id)
92 return report;
93 }
94 hid_warn(hdev, "No report with id 0x%x found\n", id);
95
96 return NULL;
97}
98
99static int sensor_hub_get_physical_device_count(
100 struct hid_report_enum *report_enum)
101{
102 struct hid_report *report;
103 struct hid_field *field;
104 int cnt = 0;
105
106 list_for_each_entry(report, &report_enum->report_list, list) {
107 field = report->field[0];
108 if (report->maxfield && field &&
109 field->physical)
110 cnt++;
111 }
112
113 return cnt;
114}
115
116static void sensor_hub_fill_attr_info(
117 struct hid_sensor_hub_attribute_info *info,
118 s32 index, s32 report_id, s32 units, s32 unit_expo, s32 size)
119{
120 info->index = index;
121 info->report_id = report_id;
122 info->units = units;
123 info->unit_expo = unit_expo;
124 info->size = size/8;
125}
126
127static struct hid_sensor_hub_callbacks *sensor_hub_get_callback(
128 struct hid_device *hdev,
129 u32 usage_id, void **priv)
130{
131 struct hid_sensor_hub_callbacks_list *callback;
132 struct sensor_hub_data *pdata = hid_get_drvdata(hdev);
133
134 spin_lock(&pdata->dyn_callback_lock);
135 list_for_each_entry(callback, &pdata->dyn_callback_list, list)
136 if (callback->usage_id == usage_id) {
137 *priv = callback->priv;
138 spin_unlock(&pdata->dyn_callback_lock);
139 return callback->usage_callback;
140 }
141 spin_unlock(&pdata->dyn_callback_lock);
142
143 return NULL;
144}
145
146int sensor_hub_register_callback(struct hid_sensor_hub_device *hsdev,
147 u32 usage_id,
148 struct hid_sensor_hub_callbacks *usage_callback)
149{
150 struct hid_sensor_hub_callbacks_list *callback;
151 struct sensor_hub_data *pdata = hid_get_drvdata(hsdev->hdev);
152
153 spin_lock(&pdata->dyn_callback_lock);
154 list_for_each_entry(callback, &pdata->dyn_callback_list, list)
155 if (callback->usage_id == usage_id) {
156 spin_unlock(&pdata->dyn_callback_lock);
157 return -EINVAL;
158 }
Dan Carpenter2b7c4b82012-09-14 06:53:23 +0000159 callback = kzalloc(sizeof(*callback), GFP_ATOMIC);
srinivas pandruvada401ca242012-09-05 13:56:00 +0100160 if (!callback) {
161 spin_unlock(&pdata->dyn_callback_lock);
162 return -ENOMEM;
163 }
164 callback->usage_callback = usage_callback;
165 callback->usage_id = usage_id;
166 callback->priv = NULL;
167 list_add_tail(&callback->list, &pdata->dyn_callback_list);
168 spin_unlock(&pdata->dyn_callback_lock);
169
170 return 0;
171}
172EXPORT_SYMBOL_GPL(sensor_hub_register_callback);
173
174int sensor_hub_remove_callback(struct hid_sensor_hub_device *hsdev,
175 u32 usage_id)
176{
177 struct hid_sensor_hub_callbacks_list *callback;
178 struct sensor_hub_data *pdata = hid_get_drvdata(hsdev->hdev);
179
180 spin_lock(&pdata->dyn_callback_lock);
181 list_for_each_entry(callback, &pdata->dyn_callback_list, list)
182 if (callback->usage_id == usage_id) {
183 list_del(&callback->list);
184 kfree(callback);
185 break;
186 }
187 spin_unlock(&pdata->dyn_callback_lock);
188
189 return 0;
190}
191EXPORT_SYMBOL_GPL(sensor_hub_remove_callback);
192
193int sensor_hub_set_feature(struct hid_sensor_hub_device *hsdev, u32 report_id,
194 u32 field_index, s32 value)
195{
196 struct hid_report *report;
197 struct sensor_hub_data *data = hid_get_drvdata(hsdev->hdev);
198 int ret = 0;
199
srinivas pandruvada401ca242012-09-05 13:56:00 +0100200 mutex_lock(&data->mutex);
201 report = sensor_hub_report(report_id, hsdev->hdev, HID_FEATURE_REPORT);
202 if (!report || (field_index >= report->maxfield)) {
203 ret = -EINVAL;
204 goto done_proc;
205 }
206 hid_set_field(report->field[field_index], 0, value);
207 usbhid_submit_report(hsdev->hdev, report, USB_DIR_OUT);
208 usbhid_wait_io(hsdev->hdev);
209
210done_proc:
211 mutex_unlock(&data->mutex);
212
213 return ret;
214}
215EXPORT_SYMBOL_GPL(sensor_hub_set_feature);
216
217int sensor_hub_get_feature(struct hid_sensor_hub_device *hsdev, u32 report_id,
218 u32 field_index, s32 *value)
219{
220 struct hid_report *report;
221 struct sensor_hub_data *data = hid_get_drvdata(hsdev->hdev);
222 int ret = 0;
223
srinivas pandruvada401ca242012-09-05 13:56:00 +0100224 mutex_lock(&data->mutex);
225 report = sensor_hub_report(report_id, hsdev->hdev, HID_FEATURE_REPORT);
226 if (!report || (field_index >= report->maxfield)) {
227 ret = -EINVAL;
228 goto done_proc;
229 }
230 usbhid_submit_report(hsdev->hdev, report, USB_DIR_IN);
231 usbhid_wait_io(hsdev->hdev);
232 *value = report->field[field_index]->value[0];
233
234done_proc:
235 mutex_unlock(&data->mutex);
236
237 return ret;
238}
239EXPORT_SYMBOL_GPL(sensor_hub_get_feature);
240
241
242int sensor_hub_input_attr_get_raw_value(struct hid_sensor_hub_device *hsdev,
243 u32 usage_id,
244 u32 attr_usage_id, u32 report_id)
245{
246 struct sensor_hub_data *data = hid_get_drvdata(hsdev->hdev);
247 unsigned long flags;
248 struct hid_report *report;
249 int ret_val = 0;
250
srinivas pandruvada401ca242012-09-05 13:56:00 +0100251 mutex_lock(&data->mutex);
252 memset(&data->pending, 0, sizeof(data->pending));
253 init_completion(&data->pending.ready);
254 data->pending.usage_id = usage_id;
255 data->pending.attr_usage_id = attr_usage_id;
256 data->pending.raw_size = 0;
257
258 spin_lock_irqsave(&data->lock, flags);
259 data->pending.status = true;
260 report = sensor_hub_report(report_id, hsdev->hdev, HID_INPUT_REPORT);
261 if (!report) {
262 spin_unlock_irqrestore(&data->lock, flags);
263 goto err_free;
264 }
265 usbhid_submit_report(hsdev->hdev, report, USB_DIR_IN);
266 spin_unlock_irqrestore(&data->lock, flags);
267 wait_for_completion_interruptible_timeout(&data->pending.ready, HZ*5);
268 switch (data->pending.raw_size) {
269 case 1:
270 ret_val = *(u8 *)data->pending.raw_data;
271 break;
272 case 2:
273 ret_val = *(u16 *)data->pending.raw_data;
274 break;
275 case 4:
276 ret_val = *(u32 *)data->pending.raw_data;
277 break;
278 default:
279 ret_val = 0;
280 }
281 kfree(data->pending.raw_data);
282
283err_free:
284 data->pending.status = false;
285 mutex_unlock(&data->mutex);
286
287 return ret_val;
288}
289EXPORT_SYMBOL_GPL(sensor_hub_input_attr_get_raw_value);
290
291int sensor_hub_input_get_attribute_info(struct hid_sensor_hub_device *hsdev,
292 u8 type,
293 u32 usage_id,
294 u32 attr_usage_id,
295 struct hid_sensor_hub_attribute_info *info)
296{
297 int ret = -1;
298 int i, j;
299 int collection_index = -1;
300 struct hid_report *report;
301 struct hid_field *field;
302 struct hid_report_enum *report_enum;
303 struct hid_device *hdev = hsdev->hdev;
304
305 /* Initialize with defaults */
306 info->usage_id = usage_id;
307 info->attrib_id = attr_usage_id;
308 info->report_id = -1;
309 info->index = -1;
310 info->units = -1;
311 info->unit_expo = -1;
312
313 for (i = 0; i < hdev->maxcollection; ++i) {
314 struct hid_collection *collection = &hdev->collection[i];
315 if (usage_id == collection->usage) {
316 collection_index = i;
317 break;
318 }
319 }
320 if (collection_index == -1)
321 goto err_ret;
322
323 report_enum = &hdev->report_enum[type];
324 list_for_each_entry(report, &report_enum->report_list, list) {
325 for (i = 0; i < report->maxfield; ++i) {
326 field = report->field[i];
327 if (field->physical == usage_id &&
328 field->logical == attr_usage_id) {
329 sensor_hub_fill_attr_info(info, i, report->id,
330 field->unit, field->unit_exponent,
331 field->report_size);
332 ret = 0;
333 } else {
334 for (j = 0; j < field->maxusage; ++j) {
335 if (field->usage[j].hid ==
336 attr_usage_id &&
337 field->usage[j].collection_index ==
338 collection_index) {
339 sensor_hub_fill_attr_info(info,
340 i, report->id,
341 field->unit,
342 field->unit_exponent,
343 field->report_size);
344 ret = 0;
345 break;
346 }
347 }
348 }
349 if (ret == 0)
350 break;
351 }
352 }
353
354err_ret:
355 return ret;
356}
357EXPORT_SYMBOL_GPL(sensor_hub_input_get_attribute_info);
358
359#ifdef CONFIG_PM
360static int sensor_hub_suspend(struct hid_device *hdev, pm_message_t message)
361{
362 struct sensor_hub_data *pdata = hid_get_drvdata(hdev);
363 struct hid_sensor_hub_callbacks_list *callback;
364
365 hid_dbg(hdev, " sensor_hub_suspend\n");
366 spin_lock(&pdata->dyn_callback_lock);
367 list_for_each_entry(callback, &pdata->dyn_callback_list, list) {
368 if (callback->usage_callback->suspend)
369 callback->usage_callback->suspend(
370 pdata->hsdev, callback->priv);
371 }
372 spin_unlock(&pdata->dyn_callback_lock);
373
374 return 0;
375}
376
377static int sensor_hub_resume(struct hid_device *hdev)
378{
379 struct sensor_hub_data *pdata = hid_get_drvdata(hdev);
380 struct hid_sensor_hub_callbacks_list *callback;
381
382 hid_dbg(hdev, " sensor_hub_resume\n");
383 spin_lock(&pdata->dyn_callback_lock);
384 list_for_each_entry(callback, &pdata->dyn_callback_list, list) {
385 if (callback->usage_callback->resume)
386 callback->usage_callback->resume(
387 pdata->hsdev, callback->priv);
388 }
389 spin_unlock(&pdata->dyn_callback_lock);
390
391 return 0;
392}
393
394static int sensor_hub_reset_resume(struct hid_device *hdev)
395{
396 return 0;
397}
398#endif
399/*
400 * Handle raw report as sent by device
401 */
402static int sensor_hub_raw_event(struct hid_device *hdev,
403 struct hid_report *report, u8 *raw_data, int size)
404{
405 int i;
406 u8 *ptr;
407 int sz;
408 struct sensor_hub_data *pdata = hid_get_drvdata(hdev);
409 unsigned long flags;
410 struct hid_sensor_hub_callbacks *callback = NULL;
411 struct hid_collection *collection = NULL;
412 void *priv = NULL;
413
414 hid_dbg(hdev, "sensor_hub_raw_event report id:0x%x size:%d type:%d\n",
415 report->id, size, report->type);
416 hid_dbg(hdev, "maxfield:%d\n", report->maxfield);
417 if (report->type != HID_INPUT_REPORT)
418 return 1;
419
420 ptr = raw_data;
421 ptr++; /*Skip report id*/
422
423 if (!report)
424 goto err_report;
425
426 spin_lock_irqsave(&pdata->lock, flags);
427
428 for (i = 0; i < report->maxfield; ++i) {
429
430 hid_dbg(hdev, "%d collection_index:%x hid:%x sz:%x\n",
431 i, report->field[i]->usage->collection_index,
432 report->field[i]->usage->hid,
433 report->field[i]->report_size/8);
434
435 sz = report->field[i]->report_size/8;
436 if (pdata->pending.status && pdata->pending.attr_usage_id ==
437 report->field[i]->usage->hid) {
438 hid_dbg(hdev, "data was pending ...\n");
Dan Carpenter2b7c4b82012-09-14 06:53:23 +0000439 pdata->pending.raw_data = kmalloc(sz, GFP_ATOMIC);
srinivas pandruvada401ca242012-09-05 13:56:00 +0100440 if (pdata->pending.raw_data) {
441 memcpy(pdata->pending.raw_data, ptr, sz);
442 pdata->pending.raw_size = sz;
443 } else
444 pdata->pending.raw_size = 0;
445 complete(&pdata->pending.ready);
446 }
447 collection = &hdev->collection[
448 report->field[i]->usage->collection_index];
449 hid_dbg(hdev, "collection->usage %x\n",
450 collection->usage);
451 callback = sensor_hub_get_callback(pdata->hsdev->hdev,
452 report->field[i]->physical,
453 &priv);
454 if (callback && callback->capture_sample) {
455 if (report->field[i]->logical)
456 callback->capture_sample(pdata->hsdev,
457 report->field[i]->logical, sz, ptr,
458 callback->pdev);
459 else
460 callback->capture_sample(pdata->hsdev,
461 report->field[i]->usage->hid, sz, ptr,
462 callback->pdev);
463 }
464 ptr += sz;
465 }
466 if (callback && collection && callback->send_event)
467 callback->send_event(pdata->hsdev, collection->usage,
468 callback->pdev);
469 spin_unlock_irqrestore(&pdata->lock, flags);
470
471err_report:
472 return 1;
473}
474
475static int sensor_hub_probe(struct hid_device *hdev,
476 const struct hid_device_id *id)
477{
478 int ret;
479 struct sensor_hub_data *sd;
480 int i;
481 char *name;
482 struct hid_report *report;
483 struct hid_report_enum *report_enum;
484 struct hid_field *field;
485 int dev_cnt;
486
487 sd = kzalloc(sizeof(struct sensor_hub_data), GFP_KERNEL);
488 if (!sd) {
489 hid_err(hdev, "cannot allocate Sensor data\n");
490 return -ENOMEM;
491 }
492 sd->hsdev = kzalloc(sizeof(struct hid_sensor_hub_device), GFP_KERNEL);
493 if (!sd->hsdev) {
494 hid_err(hdev, "cannot allocate hid_sensor_hub_device\n");
495 ret = -ENOMEM;
496 goto err_free_hub;
497 }
498 hid_set_drvdata(hdev, sd);
499 sd->hsdev->hdev = hdev;
500 sd->hsdev->vendor_id = hdev->vendor;
501 sd->hsdev->product_id = hdev->product;
502 spin_lock_init(&sd->lock);
503 spin_lock_init(&sd->dyn_callback_lock);
504 mutex_init(&sd->mutex);
505 ret = hid_parse(hdev);
506 if (ret) {
507 hid_err(hdev, "parse failed\n");
508 goto err_free;
509 }
srinivas pandruvada401ca242012-09-05 13:56:00 +0100510 INIT_LIST_HEAD(&hdev->inputs);
511
srinivas pandruvada401ca242012-09-05 13:56:00 +0100512 ret = hid_hw_start(hdev, 0);
513 if (ret) {
514 hid_err(hdev, "hw start failed\n");
515 goto err_free;
516 }
517 ret = hid_hw_open(hdev);
518 if (ret) {
519 hid_err(hdev, "failed to open input interrupt pipe\n");
520 goto err_stop_hw;
521 }
522
523 INIT_LIST_HEAD(&sd->dyn_callback_list);
524 sd->hid_sensor_client_cnt = 0;
525 report_enum = &hdev->report_enum[HID_INPUT_REPORT];
526
527 dev_cnt = sensor_hub_get_physical_device_count(report_enum);
528 if (dev_cnt > HID_MAX_PHY_DEVICES) {
529 hid_err(hdev, "Invalid Physical device count\n");
530 ret = -EINVAL;
531 goto err_close;
532 }
533 sd->hid_sensor_hub_client_devs = kzalloc(dev_cnt *
534 sizeof(struct mfd_cell),
535 GFP_KERNEL);
536 if (sd->hid_sensor_hub_client_devs == NULL) {
Axel Linf2f13a62012-09-19 16:30:00 +0100537 hid_err(hdev, "Failed to allocate memory for mfd cells\n");
srinivas pandruvada401ca242012-09-05 13:56:00 +0100538 ret = -ENOMEM;
539 goto err_close;
540 }
541 list_for_each_entry(report, &report_enum->report_list, list) {
542 hid_dbg(hdev, "Report id:%x\n", report->id);
543 field = report->field[0];
544 if (report->maxfield && field &&
545 field->physical) {
546 name = kasprintf(GFP_KERNEL, "HID-SENSOR-%x",
547 field->physical);
548 if (name == NULL) {
Axel Linf2f13a62012-09-19 16:30:00 +0100549 hid_err(hdev, "Failed MFD device name\n");
srinivas pandruvada401ca242012-09-05 13:56:00 +0100550 ret = -ENOMEM;
Axel Linf2f13a62012-09-19 16:30:00 +0100551 goto err_free_names;
srinivas pandruvada401ca242012-09-05 13:56:00 +0100552 }
553 sd->hid_sensor_hub_client_devs[
554 sd->hid_sensor_client_cnt].name = name;
555 sd->hid_sensor_hub_client_devs[
556 sd->hid_sensor_client_cnt].platform_data =
557 sd->hsdev;
558 sd->hid_sensor_hub_client_devs[
559 sd->hid_sensor_client_cnt].pdata_size =
560 sizeof(*sd->hsdev);
561 hid_dbg(hdev, "Adding %s:%p\n", name, sd);
562 sd->hid_sensor_client_cnt++;
563 }
564 }
565 ret = mfd_add_devices(&hdev->dev, 0, sd->hid_sensor_hub_client_devs,
Stephen Rothwellf45c69b2012-09-12 07:07:00 +0100566 sd->hid_sensor_client_cnt, NULL, 0, NULL);
srinivas pandruvada401ca242012-09-05 13:56:00 +0100567 if (ret < 0)
568 goto err_free_names;
569
570 return ret;
571
572err_free_names:
573 for (i = 0; i < sd->hid_sensor_client_cnt ; ++i)
574 kfree(sd->hid_sensor_hub_client_devs[i].name);
srinivas pandruvada401ca242012-09-05 13:56:00 +0100575 kfree(sd->hid_sensor_hub_client_devs);
576err_close:
srinivas pandruvada401ca242012-09-05 13:56:00 +0100577 hid_hw_close(hdev);
578err_stop_hw:
579 hid_hw_stop(hdev);
580err_free:
581 kfree(sd->hsdev);
582err_free_hub:
583 kfree(sd);
584
585 return ret;
586}
587
588static void sensor_hub_remove(struct hid_device *hdev)
589{
590 struct sensor_hub_data *data = hid_get_drvdata(hdev);
591 unsigned long flags;
592 int i;
593
594 hid_dbg(hdev, " hardware removed\n");
srinivas pandruvada401ca242012-09-05 13:56:00 +0100595 hid_hw_close(hdev);
Axel Linf2f13a62012-09-19 16:30:00 +0100596 hid_hw_stop(hdev);
srinivas pandruvada401ca242012-09-05 13:56:00 +0100597 spin_lock_irqsave(&data->lock, flags);
598 if (data->pending.status)
599 complete(&data->pending.ready);
600 spin_unlock_irqrestore(&data->lock, flags);
601 mfd_remove_devices(&hdev->dev);
602 for (i = 0; i < data->hid_sensor_client_cnt ; ++i)
603 kfree(data->hid_sensor_hub_client_devs[i].name);
604 kfree(data->hid_sensor_hub_client_devs);
605 hid_set_drvdata(hdev, NULL);
606 mutex_destroy(&data->mutex);
607 kfree(data->hsdev);
608 kfree(data);
609}
610
611static const struct hid_device_id sensor_hub_devices[] = {
Alexander Holler83499b52012-12-09 12:44:30 +0100612 { HID_DEVICE(BUS_USB, HID_GROUP_SENSOR_HUB, HID_ANY_ID, HID_ANY_ID) },
srinivas pandruvada401ca242012-09-05 13:56:00 +0100613 { }
614};
615MODULE_DEVICE_TABLE(hid, sensor_hub_devices);
616
617static const struct hid_usage_id sensor_hub_grabbed_usages[] = {
618 { HID_ANY_ID, HID_ANY_ID, HID_ANY_ID },
619 { HID_ANY_ID - 1, HID_ANY_ID - 1, HID_ANY_ID - 1 }
620};
621
622static struct hid_driver sensor_hub_driver = {
623 .name = "hid-sensor-hub",
624 .id_table = sensor_hub_devices,
625 .probe = sensor_hub_probe,
626 .remove = sensor_hub_remove,
627 .raw_event = sensor_hub_raw_event,
628#ifdef CONFIG_PM
629 .suspend = sensor_hub_suspend,
630 .resume = sensor_hub_resume,
631 .reset_resume = sensor_hub_reset_resume,
632#endif
633};
634
635static int __init sensor_hub_init(void)
636{
637 return hid_register_driver(&sensor_hub_driver);
638}
639
640static void __exit sensor_hub_exit(void)
641{
642 hid_unregister_driver(&sensor_hub_driver);
643}
644
645module_init(sensor_hub_init);
646module_exit(sensor_hub_exit);
647
648MODULE_DESCRIPTION("HID Sensor Hub driver");
649MODULE_AUTHOR("Srinivas Pandruvada <srinivas.pandruvada@intel.com>");
650MODULE_LICENSE("GPL");