hid-sensor-hub.c 17 KB

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