summaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorSpencer Sutterlin <ssutterlin@nvidia.com>2017-12-28 19:46:47 -0500
committerSpencer Sutterlin <ssutterlin@nvidia.com>2017-12-28 19:48:00 -0500
commitb56df09b9d651e704da9f5d3620d372091d96b91 (patch)
treeee55d565d7a9cc69d41f49f921ac4714a1087506 /include/linux
parent684290c419c6cfa2f9454e6a148ce84401a2f20a (diff)
parent1bb3d38500ecc3eed15d1d9c437aea4a41d7c816 (diff)
Merge remote-tracking branch 'origin/dev/ssutterlin_hid-atv-jarvis_12-28-17' into dev-kernel
Snapshot taken at from project:linux-3.10 branch:rel-24-uda-r1 at commit 93968a1 ("drivers: hid: hid-atv-javis: set silence timeout") 2 additional commits required for it to build: commit 1bb3d38 ("hid: jarvis: Cleanup compiler warnings") commit 30a65c5 ("hid: jarvis: Fix compile errors on Kernel-3.18") Bug 200344387 Bug 200371124 Change-Id: I8061bd31cc86abb69e9ecbd22d18d971c6b781c5 Signed-off-by: Spencer Sutterlin <ssutterlin@nvidia.com>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/iio/imu/tsfw_icm20628.h79
1 files changed, 79 insertions, 0 deletions
diff --git a/include/linux/iio/imu/tsfw_icm20628.h b/include/linux/iio/imu/tsfw_icm20628.h
new file mode 100644
index 000000000..11d075d6b
--- /dev/null
+++ b/include/linux/iio/imu/tsfw_icm20628.h
@@ -0,0 +1,79 @@
1/*
2 * include/linux/iio/imu/tsfw_icm20628.h
3 *
4 * Copyright (c) 2016, NVIDIA CORPORATION, All rights reserved.
5 *
6 * This software is licensed under the terms of the GNU General Public
7 * License version 2, as published by the Free Software Foundation, and
8 * may be copied, distributed, and modified under those terms.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 */
15
16#ifndef __IIO_NVI_TS_MPU_H__
17#define __IIO_NVI_TS_MPU_H__
18
19#include <linux/nvs.h>
20#include <linux/hid.h>
21
22#define SENSOR_REPORT_ID_COMBINED 5
23#define SENSOR_REPORT_ID 6
24#define SENSOR_REPORT_ID_SYN 7
25
26#define SNSR_N 3
27#define SENSOR_DATA_SET_SIZE 18
28
29struct tsfw_icm20628_snsr {
30 void *nvs_st;
31 struct sensor_cfg cfg;
32};
33
34struct tsfw_icm20628_state {
35 struct nvs_fn_if *nvs;
36 struct hid_device *hdev; /* keep ptr to hid_device to send HOSTCMDs */
37 unsigned int sts; /* TODO: needed? */
38 unsigned int errs; /* TODO: needed? */
39 unsigned int enabled; /* TODO: move to tsfw_icm20628_snsr? */
40 struct tsfw_icm20628_snsr snsr[SNSR_N];
41 u8 report_counter;
42 /* sensor data buffer for fragmented packets
43 * guaranteed to be < SENSOR_DATA_SET_SIZE
44 */
45 u8 buffered_data[SENSOR_DATA_SET_SIZE];
46 u8 buffered_cnt;
47};
48
49struct tsfw_icm20628_fn_dev {
50 /* probe
51 * @hdev: hid device associated with sensor
52 * @pst: sensor state data
53 * Returns 0 on success or a negative error code.
54 */
55 int (*probe)(struct hid_device *hdev, struct tsfw_icm20628_state **pst);
56
57 /* recv
58 * @st: sensor state data
59 * @type: report type
60 * @data: sensor data from hid report
61 * @len: length of sensor data
62 * Returns 0 on success or a negative error code.
63 */
64 int (*recv)(struct tsfw_icm20628_state *st, u8 *data, size_t len);
65
66 /* remove
67 * @st: sensor state data
68 * Returns 0 on success or a negative error code.
69 */
70 int (*remove)(struct tsfw_icm20628_state *st);
71};
72
73#ifdef CONFIG_TSFW_ICM
74struct tsfw_icm20628_fn_dev *tsfw_icm20628_fns(void);
75#else
76inline struct tsfw_icm20628_fn_dev *tsfw_icm20628_fns(void) { return NULL; }
77#endif
78
79#endif