summaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorErik Lilliebjerg <elilliebjerg@nvidia.com>2016-02-01 12:00:22 -0500
committerRobert Collins <rcollins@nvidia.com>2017-07-13 17:12:50 -0400
commitce810fbcbf78cd165ed41eb4d3e5bcc6e09dbf5f (patch)
tree1d53ce6e6dbfa8949bd23e19688466542ff07123 /include/linux
parentef30da167febed7cc25e03de79f19b070c02b60d (diff)
iio: imu: NVI v.304 DMP implementation
- MPU6515: - Implement DMP. - Add Significant Motion sensor. - Add Quaternion sensor (fixes gravity) - Move compass to DMP driven for improved rate accuracy. - ICM: - Fix auxiliary timing. - Add separate timing per sensor. - Add auxiliary data (compass) to its own FIFO. - Add separate FIFOs per ICM sensor. - Both: - Improve suspend/resume time. Bug 200162691 Bug 200159288 Bug 200130656 Bug 1699137 Change-Id: Icc9bcac30d19fd575969445350223914bfb9cb46 Signed-off-by: Erik Lilliebjerg <elilliebjerg@nvidia.com> Reviewed-on: http://git-master/r/1000952 (cherry picked from commit 7fd4dc50c5535bb8f173a372550920316023cc71) Reviewed-on: http://git-master/r/1009570 GVS: Gerrit_Virtual_Submit Reviewed-by: Robert Collins <rcollins@nvidia.com> Tested-by: Robert Collins <rcollins@nvidia.com>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/mpu_iio.h39
1 files changed, 9 insertions, 30 deletions
diff --git a/include/linux/mpu_iio.h b/include/linux/mpu_iio.h
index 73c8940ad..6bf8e5dfa 100644
--- a/include/linux/mpu_iio.h
+++ b/include/linux/mpu_iio.h
@@ -1,6 +1,6 @@
1/* 1/*
2* Copyright (C) 2012 Invensense, Inc. 2* Copyright (C) 2012 Invensense, Inc.
3* Copyright (c) 2013-2014, NVIDIA CORPORATION. All rights reserved. 3* Copyright (c) 2013-2016, NVIDIA CORPORATION. All rights reserved.
4* 4*
5* This software is licensed under the terms of the GNU General Public 5* This software is licensed under the terms of the GNU General Public
6* License version 2, as published by the Free Software Foundation, and 6* License version 2, as published by the Free Software Foundation, and
@@ -174,8 +174,12 @@ struct mpu_platform_data {
174 * - *ext_driver: A generic pointer that can be used by the 174 * - *ext_driver: A generic pointer that can be used by the
175 * external driver. Note that this is specifically for the 175 * external driver. Note that this is specifically for the
176 * external driver and not used by the MPU. 176 * external driver and not used by the MPU.
177 * - matrix: device orientation on platform.
178 * Needed by the DMP.
177 * - type: Define if device is to be used by the MPU DMP. 179 * - type: Define if device is to be used by the MPU DMP.
178 * - id: Define if device is to be used by the MPU DMP. 180 * - id: Define if device is to be used by the MPU DMP.
181 * - asa: compass axis sensitivity adjustment.
182 * Needed by the DMP.
179 */ 183 */
180struct nvi_mpu_port { 184struct nvi_mpu_port {
181 u8 addr; 185 u8 addr;
@@ -188,8 +192,10 @@ struct nvi_mpu_port {
188 void (*handler)(u8 *data, unsigned int len, 192 void (*handler)(u8 *data, unsigned int len,
189 long long timestamp, void *ext_driver); 193 long long timestamp, void *ext_driver);
190 void *ext_driver; 194 void *ext_driver;
195 signed char matrix[9];
191 enum secondary_slave_type type; 196 enum secondary_slave_type type;
192 enum ext_slave_id id; 197 enum ext_slave_id id;
198 u8 asa[3];
193 int rate_scale; 199 int rate_scale;
194}; 200};
195 201
@@ -313,28 +319,6 @@ int nvi_mpu_port_free(int port);
313int nvi_mpu_enable(int port, bool enable); 319int nvi_mpu_enable(int port, bool enable);
314 320
315/** 321/**
316 * Use to change the ports sampling delay in microseconds. The
317 * hardware only supports one sampling rate so the shortest time
318 * is used among all enabled ports, accelerometer, and gyro. If
319 * the requested rate is longer than the actual rate and the
320 * port is configured for reads, the data will be reported at
321 * the requested rate skipping the data polled at the faster
322 * rate. Setting this to zero causes other enabled devices to
323 * determine the sampling rate. If there are no other enabled
324 * devices, then the MPU default rate is used.
325 * @param port
326 * @param delay_us
327 * @return int error
328 * Possible errors are:
329 * - -EAGAIN: MPU is not initialized yet.
330 * - -EPERM: MPU is shutdown. MPU API won't be
331 * available until a system restart.
332 * - -EBUSY: MPU is busy with another request.
333 * - -EINVAL: Problem with input parameters.
334 */
335int nvi_mpu_delay_us(int port, unsigned long delay_us);
336
337/**
338 * Use to change the ports polling delay in milliseconds. 322 * Use to change the ports polling delay in milliseconds.
339 * A delay value of 0 disables the delay for that port. The 323 * A delay value of 0 disables the delay for that port. The
340 * hardware only supports one delay value so the largest request 324 * hardware only supports one delay value so the largest request
@@ -372,22 +356,17 @@ int nvi_mpu_data_out(int port, u8 data_out);
372/** 356/**
373 * batch mode. 357 * batch mode.
374 * @param port 358 * @param port
375 * @param flags
376 * @param period_us 359 * @param period_us
377 * @param timeout_us 360 * @param timeout_us
378 * @return int error 361 * @return int error
379 * if return >= 0 then this is the supported batch
380 * flags. If batch is not supported then 0 is
381 * returned.
382 * Possible errors are: 362 * Possible errors are:
383 * - -EAGAIN: MPU is not initialized yet. 363 * - -EAGAIN: MPU is not initialized yet.
384 * - -EPERM: MPU is shutdown. MPU API won't be 364 * - -EPERM: MPU is shutdown. MPU API won't be
385 * available until a system restart. 365 * available until a system restart.
386 * - -EBUSY: MPU is busy with another request. 366 * - -EBUSY: MPU is busy with another request.
387 * - -EINVAL: Problem with input parameters. 367 * - -EINVAL: timeout_us not supported if > 0.
388 */ 368 */
389int nvi_mpu_batch(int port, unsigned int flags, 369int nvi_mpu_batch(int port, unsigned int period_us, unsigned int timeout_us);
390 unsigned int period_us, unsigned int timeout_us);
391 370
392/** 371/**
393 * batch flush. 372 * batch flush.