diff options
| author | Gerrit Code Review <gerrit2@nvidia.com> | 2018-01-01 23:11:09 -0500 |
|---|---|---|
| committer | Gerrit Code Review <gerrit2@nvidia.com> | 2018-01-01 23:11:09 -0500 |
| commit | cdb09781d317df981cc50fb34b1fe90b4a7ebe6d (patch) | |
| tree | 35adeec0d66b5404da6db22c1082d55e96f821a1 /include/linux | |
| parent | e49b46caea9d1b84db96463c3092bf08f25f77b2 (diff) | |
| parent | b56df09b9d651e704da9f5d3620d372091d96b91 (diff) | |
Merge "Merge remote-tracking branch 'origin/dev/ssutterlin_hid-atv-jarvis_12-28-17' into dev-kernel" into dev-t194
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/iio/imu/tsfw_icm20628.h | 79 |
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 | |||
| 29 | struct tsfw_icm20628_snsr { | ||
| 30 | void *nvs_st; | ||
| 31 | struct sensor_cfg cfg; | ||
| 32 | }; | ||
| 33 | |||
| 34 | struct 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 | |||
| 49 | struct 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 | ||
| 74 | struct tsfw_icm20628_fn_dev *tsfw_icm20628_fns(void); | ||
| 75 | #else | ||
| 76 | inline struct tsfw_icm20628_fn_dev *tsfw_icm20628_fns(void) { return NULL; } | ||
| 77 | #endif | ||
| 78 | |||
| 79 | #endif | ||
