hid-sensor-hub.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630
  1. /*
  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. * struct sensor_hub_pending - Synchronous read pending information
  32. * @status: Pending status true/false.
  33. * @ready: Completion synchronization data.
  34. * @usage_id: Usage id for physical device, E.g. Gyro usage id.
  35. * @attr_usage_id: Usage Id of a field, E.g. X-AXIS for a gyro.
  36. * @raw_size: Response size for a read request.
  37. * @raw_data: Place holder for received response.
  38. */
  39. struct sensor_hub_pending {
  40. bool status;
  41. struct completion ready;
  42. u32 usage_id;
  43. u32 attr_usage_id;
  44. int raw_size;
  45. u8 *raw_data;
  46. };
  47. /**
  48. * struct sensor_hub_data - Hold a instance data for a HID hub device
  49. * @hsdev: Stored hid instance for current hub device.
  50. * @mutex: Mutex to serialize synchronous request.
  51. * @lock: Spin lock to protect pending request structure.
  52. * @pending: Holds information of pending sync read request.
  53. * @dyn_callback_list: Holds callback function
  54. * @dyn_callback_lock: spin lock to protect callback list
  55. * @hid_sensor_hub_client_devs: Stores all MFD cells for a hub instance.
  56. * @hid_sensor_client_cnt: Number of MFD cells, (no of sensors attached).
  57. */
  58. struct sensor_hub_data {
  59. struct hid_sensor_hub_device *hsdev;
  60. struct mutex mutex;
  61. spinlock_t lock;
  62. struct sensor_hub_pending pending;
  63. struct list_head dyn_callback_list;
  64. spinlock_t dyn_callback_lock;
  65. struct mfd_cell *hid_sensor_hub_client_devs;
  66. int hid_sensor_client_cnt;
  67. };
  68. /**
  69. * struct hid_sensor_hub_callbacks_list - Stores callback list
  70. * @list: list head.
  71. * @usage_id: usage id for a physical device.
  72. * @usage_callback: Stores registered callback functions.
  73. * @priv: Private data for a physical device.
  74. */
  75. struct hid_sensor_hub_callbacks_list {
  76. struct list_head list;
  77. u32 usage_id;
  78. struct hid_sensor_hub_callbacks *usage_callback;
  79. void *priv;
  80. };
  81. static struct hid_report *sensor_hub_report(int id, struct hid_device *hdev,
  82. int dir)
  83. {
  84. struct hid_report *report;
  85. list_for_each_entry(report, &hdev->report_enum[dir].report_list, list) {
  86. if (report->id == id)
  87. return report;
  88. }
  89. hid_warn(hdev, "No report with id 0x%x found\n", id);
  90. return NULL;
  91. }
  92. static int sensor_hub_get_physical_device_count(
  93. struct hid_report_enum *report_enum)
  94. {
  95. struct hid_report *report;
  96. struct hid_field *field;
  97. int cnt = 0;
  98. list_for_each_entry(report, &report_enum->report_list, list) {
  99. field = report->field[0];
  100. if (report->maxfield && field &&
  101. field->physical)
  102. cnt++;
  103. }
  104. return cnt;
  105. }
  106. static void sensor_hub_fill_attr_info(
  107. struct hid_sensor_hub_attribute_info *info,
  108. s32 index, s32 report_id, s32 units, s32 unit_expo, s32 size)
  109. {
  110. info->index = index;
  111. info->report_id = report_id;
  112. info->units = units;
  113. info->unit_expo = unit_expo;
  114. info->size = size/8;
  115. }
  116. static struct hid_sensor_hub_callbacks *sensor_hub_get_callback(
  117. struct hid_device *hdev,
  118. u32 usage_id, void **priv)
  119. {
  120. struct hid_sensor_hub_callbacks_list *callback;
  121. struct sensor_hub_data *pdata = hid_get_drvdata(hdev);
  122. spin_lock(&pdata->dyn_callback_lock);
  123. list_for_each_entry(callback, &pdata->dyn_callback_list, list)
  124. if (callback->usage_id == usage_id) {
  125. *priv = callback->priv;
  126. spin_unlock(&pdata->dyn_callback_lock);
  127. return callback->usage_callback;
  128. }
  129. spin_unlock(&pdata->dyn_callback_lock);
  130. return NULL;
  131. }
  132. int sensor_hub_register_callback(struct hid_sensor_hub_device *hsdev,
  133. u32 usage_id,
  134. struct hid_sensor_hub_callbacks *usage_callback)
  135. {
  136. struct hid_sensor_hub_callbacks_list *callback;
  137. struct sensor_hub_data *pdata = hid_get_drvdata(hsdev->hdev);
  138. spin_lock(&pdata->dyn_callback_lock);
  139. list_for_each_entry(callback, &pdata->dyn_callback_list, list)
  140. if (callback->usage_id == usage_id) {
  141. spin_unlock(&pdata->dyn_callback_lock);
  142. return -EINVAL;
  143. }
  144. callback = kzalloc(sizeof(*callback), GFP_ATOMIC);
  145. if (!callback) {
  146. spin_unlock(&pdata->dyn_callback_lock);
  147. return -ENOMEM;
  148. }
  149. callback->usage_callback = usage_callback;
  150. callback->usage_id = usage_id;
  151. callback->priv = NULL;
  152. list_add_tail(&callback->list, &pdata->dyn_callback_list);
  153. spin_unlock(&pdata->dyn_callback_lock);
  154. return 0;
  155. }
  156. EXPORT_SYMBOL_GPL(sensor_hub_register_callback);
  157. int sensor_hub_remove_callback(struct hid_sensor_hub_device *hsdev,
  158. u32 usage_id)
  159. {
  160. struct hid_sensor_hub_callbacks_list *callback;
  161. struct sensor_hub_data *pdata = hid_get_drvdata(hsdev->hdev);
  162. spin_lock(&pdata->dyn_callback_lock);
  163. list_for_each_entry(callback, &pdata->dyn_callback_list, list)
  164. if (callback->usage_id == usage_id) {
  165. list_del(&callback->list);
  166. kfree(callback);
  167. break;
  168. }
  169. spin_unlock(&pdata->dyn_callback_lock);
  170. return 0;
  171. }
  172. EXPORT_SYMBOL_GPL(sensor_hub_remove_callback);
  173. int sensor_hub_set_feature(struct hid_sensor_hub_device *hsdev, u32 report_id,
  174. u32 field_index, s32 value)
  175. {
  176. struct hid_report *report;
  177. struct sensor_hub_data *data = hid_get_drvdata(hsdev->hdev);
  178. int ret = 0;
  179. mutex_lock(&data->mutex);
  180. report = sensor_hub_report(report_id, hsdev->hdev, HID_FEATURE_REPORT);
  181. if (!report || (field_index >= report->maxfield)) {
  182. ret = -EINVAL;
  183. goto done_proc;
  184. }
  185. hid_set_field(report->field[field_index], 0, value);
  186. usbhid_submit_report(hsdev->hdev, report, USB_DIR_OUT);
  187. usbhid_wait_io(hsdev->hdev);
  188. done_proc:
  189. mutex_unlock(&data->mutex);
  190. return ret;
  191. }
  192. EXPORT_SYMBOL_GPL(sensor_hub_set_feature);
  193. int sensor_hub_get_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. mutex_lock(&data->mutex);
  200. report = sensor_hub_report(report_id, hsdev->hdev, HID_FEATURE_REPORT);
  201. if (!report || (field_index >= report->maxfield)) {
  202. ret = -EINVAL;
  203. goto done_proc;
  204. }
  205. usbhid_submit_report(hsdev->hdev, report, USB_DIR_IN);
  206. usbhid_wait_io(hsdev->hdev);
  207. *value = report->field[field_index]->value[0];
  208. done_proc:
  209. mutex_unlock(&data->mutex);
  210. return ret;
  211. }
  212. EXPORT_SYMBOL_GPL(sensor_hub_get_feature);
  213. int sensor_hub_input_attr_get_raw_value(struct hid_sensor_hub_device *hsdev,
  214. u32 usage_id,
  215. u32 attr_usage_id, u32 report_id)
  216. {
  217. struct sensor_hub_data *data = hid_get_drvdata(hsdev->hdev);
  218. unsigned long flags;
  219. struct hid_report *report;
  220. int ret_val = 0;
  221. mutex_lock(&data->mutex);
  222. memset(&data->pending, 0, sizeof(data->pending));
  223. init_completion(&data->pending.ready);
  224. data->pending.usage_id = usage_id;
  225. data->pending.attr_usage_id = attr_usage_id;
  226. data->pending.raw_size = 0;
  227. spin_lock_irqsave(&data->lock, flags);
  228. data->pending.status = true;
  229. report = sensor_hub_report(report_id, hsdev->hdev, HID_INPUT_REPORT);
  230. if (!report) {
  231. spin_unlock_irqrestore(&data->lock, flags);
  232. goto err_free;
  233. }
  234. usbhid_submit_report(hsdev->hdev, report, USB_DIR_IN);
  235. spin_unlock_irqrestore(&data->lock, flags);
  236. wait_for_completion_interruptible_timeout(&data->pending.ready, HZ*5);
  237. switch (data->pending.raw_size) {
  238. case 1:
  239. ret_val = *(u8 *)data->pending.raw_data;
  240. break;
  241. case 2:
  242. ret_val = *(u16 *)data->pending.raw_data;
  243. break;
  244. case 4:
  245. ret_val = *(u32 *)data->pending.raw_data;
  246. break;
  247. default:
  248. ret_val = 0;
  249. }
  250. kfree(data->pending.raw_data);
  251. err_free:
  252. data->pending.status = false;
  253. mutex_unlock(&data->mutex);
  254. return ret_val;
  255. }
  256. EXPORT_SYMBOL_GPL(sensor_hub_input_attr_get_raw_value);
  257. int sensor_hub_input_get_attribute_info(struct hid_sensor_hub_device *hsdev,
  258. u8 type,
  259. u32 usage_id,
  260. u32 attr_usage_id,
  261. struct hid_sensor_hub_attribute_info *info)
  262. {
  263. int ret = -1;
  264. int i, j;
  265. int collection_index = -1;
  266. struct hid_report *report;
  267. struct hid_field *field;
  268. struct hid_report_enum *report_enum;
  269. struct hid_device *hdev = hsdev->hdev;
  270. /* Initialize with defaults */
  271. info->usage_id = usage_id;
  272. info->attrib_id = attr_usage_id;
  273. info->report_id = -1;
  274. info->index = -1;
  275. info->units = -1;
  276. info->unit_expo = -1;
  277. for (i = 0; i < hdev->maxcollection; ++i) {
  278. struct hid_collection *collection = &hdev->collection[i];
  279. if (usage_id == collection->usage) {
  280. collection_index = i;
  281. break;
  282. }
  283. }
  284. if (collection_index == -1)
  285. goto err_ret;
  286. report_enum = &hdev->report_enum[type];
  287. list_for_each_entry(report, &report_enum->report_list, list) {
  288. for (i = 0; i < report->maxfield; ++i) {
  289. field = report->field[i];
  290. if (field->physical == usage_id &&
  291. field->logical == attr_usage_id) {
  292. sensor_hub_fill_attr_info(info, i, report->id,
  293. field->unit, field->unit_exponent,
  294. field->report_size);
  295. ret = 0;
  296. } else {
  297. for (j = 0; j < field->maxusage; ++j) {
  298. if (field->usage[j].hid ==
  299. attr_usage_id &&
  300. field->usage[j].collection_index ==
  301. collection_index) {
  302. sensor_hub_fill_attr_info(info,
  303. i, report->id,
  304. field->unit,
  305. field->unit_exponent,
  306. field->report_size);
  307. ret = 0;
  308. break;
  309. }
  310. }
  311. }
  312. if (ret == 0)
  313. break;
  314. }
  315. }
  316. err_ret:
  317. return ret;
  318. }
  319. EXPORT_SYMBOL_GPL(sensor_hub_input_get_attribute_info);
  320. #ifdef CONFIG_PM
  321. static int sensor_hub_suspend(struct hid_device *hdev, pm_message_t message)
  322. {
  323. struct sensor_hub_data *pdata = hid_get_drvdata(hdev);
  324. struct hid_sensor_hub_callbacks_list *callback;
  325. hid_dbg(hdev, " sensor_hub_suspend\n");
  326. spin_lock(&pdata->dyn_callback_lock);
  327. list_for_each_entry(callback, &pdata->dyn_callback_list, list) {
  328. if (callback->usage_callback->suspend)
  329. callback->usage_callback->suspend(
  330. pdata->hsdev, callback->priv);
  331. }
  332. spin_unlock(&pdata->dyn_callback_lock);
  333. return 0;
  334. }
  335. static int sensor_hub_resume(struct hid_device *hdev)
  336. {
  337. struct sensor_hub_data *pdata = hid_get_drvdata(hdev);
  338. struct hid_sensor_hub_callbacks_list *callback;
  339. hid_dbg(hdev, " sensor_hub_resume\n");
  340. spin_lock(&pdata->dyn_callback_lock);
  341. list_for_each_entry(callback, &pdata->dyn_callback_list, list) {
  342. if (callback->usage_callback->resume)
  343. callback->usage_callback->resume(
  344. pdata->hsdev, callback->priv);
  345. }
  346. spin_unlock(&pdata->dyn_callback_lock);
  347. return 0;
  348. }
  349. static int sensor_hub_reset_resume(struct hid_device *hdev)
  350. {
  351. return 0;
  352. }
  353. #endif
  354. /*
  355. * Handle raw report as sent by device
  356. */
  357. static int sensor_hub_raw_event(struct hid_device *hdev,
  358. struct hid_report *report, u8 *raw_data, int size)
  359. {
  360. int i;
  361. u8 *ptr;
  362. int sz;
  363. struct sensor_hub_data *pdata = hid_get_drvdata(hdev);
  364. unsigned long flags;
  365. struct hid_sensor_hub_callbacks *callback = NULL;
  366. struct hid_collection *collection = NULL;
  367. void *priv = NULL;
  368. hid_dbg(hdev, "sensor_hub_raw_event report id:0x%x size:%d type:%d\n",
  369. report->id, size, report->type);
  370. hid_dbg(hdev, "maxfield:%d\n", report->maxfield);
  371. if (report->type != HID_INPUT_REPORT)
  372. return 1;
  373. ptr = raw_data;
  374. ptr++; /*Skip report id*/
  375. spin_lock_irqsave(&pdata->lock, flags);
  376. for (i = 0; i < report->maxfield; ++i) {
  377. hid_dbg(hdev, "%d collection_index:%x hid:%x sz:%x\n",
  378. i, report->field[i]->usage->collection_index,
  379. report->field[i]->usage->hid,
  380. report->field[i]->report_size/8);
  381. sz = report->field[i]->report_size/8;
  382. if (pdata->pending.status && pdata->pending.attr_usage_id ==
  383. report->field[i]->usage->hid) {
  384. hid_dbg(hdev, "data was pending ...\n");
  385. pdata->pending.raw_data = kmalloc(sz, GFP_ATOMIC);
  386. if (pdata->pending.raw_data) {
  387. memcpy(pdata->pending.raw_data, ptr, sz);
  388. pdata->pending.raw_size = sz;
  389. } else
  390. pdata->pending.raw_size = 0;
  391. complete(&pdata->pending.ready);
  392. }
  393. collection = &hdev->collection[
  394. report->field[i]->usage->collection_index];
  395. hid_dbg(hdev, "collection->usage %x\n",
  396. collection->usage);
  397. callback = sensor_hub_get_callback(pdata->hsdev->hdev,
  398. report->field[i]->physical,
  399. &priv);
  400. if (callback && callback->capture_sample) {
  401. if (report->field[i]->logical)
  402. callback->capture_sample(pdata->hsdev,
  403. report->field[i]->logical, sz, ptr,
  404. callback->pdev);
  405. else
  406. callback->capture_sample(pdata->hsdev,
  407. report->field[i]->usage->hid, sz, ptr,
  408. callback->pdev);
  409. }
  410. ptr += sz;
  411. }
  412. if (callback && collection && callback->send_event)
  413. callback->send_event(pdata->hsdev, collection->usage,
  414. callback->pdev);
  415. spin_unlock_irqrestore(&pdata->lock, flags);
  416. return 1;
  417. }
  418. static int sensor_hub_probe(struct hid_device *hdev,
  419. const struct hid_device_id *id)
  420. {
  421. int ret;
  422. struct sensor_hub_data *sd;
  423. int i;
  424. char *name;
  425. struct hid_report *report;
  426. struct hid_report_enum *report_enum;
  427. struct hid_field *field;
  428. int dev_cnt;
  429. sd = kzalloc(sizeof(struct sensor_hub_data), GFP_KERNEL);
  430. if (!sd) {
  431. hid_err(hdev, "cannot allocate Sensor data\n");
  432. return -ENOMEM;
  433. }
  434. sd->hsdev = kzalloc(sizeof(struct hid_sensor_hub_device), GFP_KERNEL);
  435. if (!sd->hsdev) {
  436. hid_err(hdev, "cannot allocate hid_sensor_hub_device\n");
  437. ret = -ENOMEM;
  438. goto err_free_hub;
  439. }
  440. hid_set_drvdata(hdev, sd);
  441. sd->hsdev->hdev = hdev;
  442. sd->hsdev->vendor_id = hdev->vendor;
  443. sd->hsdev->product_id = hdev->product;
  444. spin_lock_init(&sd->lock);
  445. spin_lock_init(&sd->dyn_callback_lock);
  446. mutex_init(&sd->mutex);
  447. ret = hid_parse(hdev);
  448. if (ret) {
  449. hid_err(hdev, "parse failed\n");
  450. goto err_free;
  451. }
  452. INIT_LIST_HEAD(&hdev->inputs);
  453. ret = hid_hw_start(hdev, 0);
  454. if (ret) {
  455. hid_err(hdev, "hw start failed\n");
  456. goto err_free;
  457. }
  458. ret = hid_hw_open(hdev);
  459. if (ret) {
  460. hid_err(hdev, "failed to open input interrupt pipe\n");
  461. goto err_stop_hw;
  462. }
  463. INIT_LIST_HEAD(&sd->dyn_callback_list);
  464. sd->hid_sensor_client_cnt = 0;
  465. report_enum = &hdev->report_enum[HID_INPUT_REPORT];
  466. dev_cnt = sensor_hub_get_physical_device_count(report_enum);
  467. if (dev_cnt > HID_MAX_PHY_DEVICES) {
  468. hid_err(hdev, "Invalid Physical device count\n");
  469. ret = -EINVAL;
  470. goto err_close;
  471. }
  472. sd->hid_sensor_hub_client_devs = kzalloc(dev_cnt *
  473. sizeof(struct mfd_cell),
  474. GFP_KERNEL);
  475. if (sd->hid_sensor_hub_client_devs == NULL) {
  476. hid_err(hdev, "Failed to allocate memory for mfd cells\n");
  477. ret = -ENOMEM;
  478. goto err_close;
  479. }
  480. list_for_each_entry(report, &report_enum->report_list, list) {
  481. hid_dbg(hdev, "Report id:%x\n", report->id);
  482. field = report->field[0];
  483. if (report->maxfield && field &&
  484. field->physical) {
  485. name = kasprintf(GFP_KERNEL, "HID-SENSOR-%x",
  486. field->physical);
  487. if (name == NULL) {
  488. hid_err(hdev, "Failed MFD device name\n");
  489. ret = -ENOMEM;
  490. goto err_free_names;
  491. }
  492. sd->hid_sensor_hub_client_devs[
  493. sd->hid_sensor_client_cnt].name = name;
  494. sd->hid_sensor_hub_client_devs[
  495. sd->hid_sensor_client_cnt].platform_data =
  496. sd->hsdev;
  497. sd->hid_sensor_hub_client_devs[
  498. sd->hid_sensor_client_cnt].pdata_size =
  499. sizeof(*sd->hsdev);
  500. hid_dbg(hdev, "Adding %s:%p\n", name, sd);
  501. sd->hid_sensor_client_cnt++;
  502. }
  503. }
  504. ret = mfd_add_devices(&hdev->dev, 0, sd->hid_sensor_hub_client_devs,
  505. sd->hid_sensor_client_cnt, NULL, 0, NULL);
  506. if (ret < 0)
  507. goto err_free_names;
  508. return ret;
  509. err_free_names:
  510. for (i = 0; i < sd->hid_sensor_client_cnt ; ++i)
  511. kfree(sd->hid_sensor_hub_client_devs[i].name);
  512. kfree(sd->hid_sensor_hub_client_devs);
  513. err_close:
  514. hid_hw_close(hdev);
  515. err_stop_hw:
  516. hid_hw_stop(hdev);
  517. err_free:
  518. kfree(sd->hsdev);
  519. err_free_hub:
  520. kfree(sd);
  521. return ret;
  522. }
  523. static void sensor_hub_remove(struct hid_device *hdev)
  524. {
  525. struct sensor_hub_data *data = hid_get_drvdata(hdev);
  526. unsigned long flags;
  527. int i;
  528. hid_dbg(hdev, " hardware removed\n");
  529. hid_hw_close(hdev);
  530. hid_hw_stop(hdev);
  531. spin_lock_irqsave(&data->lock, flags);
  532. if (data->pending.status)
  533. complete(&data->pending.ready);
  534. spin_unlock_irqrestore(&data->lock, flags);
  535. mfd_remove_devices(&hdev->dev);
  536. for (i = 0; i < data->hid_sensor_client_cnt ; ++i)
  537. kfree(data->hid_sensor_hub_client_devs[i].name);
  538. kfree(data->hid_sensor_hub_client_devs);
  539. hid_set_drvdata(hdev, NULL);
  540. mutex_destroy(&data->mutex);
  541. kfree(data->hsdev);
  542. kfree(data);
  543. }
  544. static const struct hid_device_id sensor_hub_devices[] = {
  545. { HID_DEVICE(HID_BUS_ANY, HID_GROUP_SENSOR_HUB, HID_ANY_ID,
  546. HID_ANY_ID) },
  547. { }
  548. };
  549. MODULE_DEVICE_TABLE(hid, sensor_hub_devices);
  550. static struct hid_driver sensor_hub_driver = {
  551. .name = "hid-sensor-hub",
  552. .id_table = sensor_hub_devices,
  553. .probe = sensor_hub_probe,
  554. .remove = sensor_hub_remove,
  555. .raw_event = sensor_hub_raw_event,
  556. #ifdef CONFIG_PM
  557. .suspend = sensor_hub_suspend,
  558. .resume = sensor_hub_resume,
  559. .reset_resume = sensor_hub_reset_resume,
  560. #endif
  561. };
  562. module_hid_driver(sensor_hub_driver);
  563. MODULE_DESCRIPTION("HID Sensor Hub driver");
  564. MODULE_AUTHOR("Srinivas Pandruvada <srinivas.pandruvada@intel.com>");
  565. MODULE_LICENSE("GPL");