ARM64: DTS: Add rk3399-firefly uart4 device, node as /dev/ttyS1
[firefly-linux-kernel-4.4.55.git] / include / linux / mpu.h
1 /*
2 * Copyright (C) 2012 Invensense, Inc.
3 *
4 * This software is licensed under the terms of the GNU General Public
5 * License version 2, as published by the Free Software Foundation, and
6 * may be copied, distributed, and modified under those terms.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11 * GNU General Public License for more details.
12 */
13
14 #ifndef __MPU_H_
15 #define __MPU_H_
16
17 #ifdef __KERNEL__
18 #include <linux/types.h>
19 #include <linux/ioctl.h>
20 #endif
21
22 enum secondary_slave_type {
23         SECONDARY_SLAVE_TYPE_NONE,
24         SECONDARY_SLAVE_TYPE_ACCEL,
25         SECONDARY_SLAVE_TYPE_COMPASS,
26         SECONDARY_SLAVE_TYPE_PRESSURE,
27         SECONDARY_SLAVE_TYPE_ALS,
28
29         SECONDARY_SLAVE_TYPE_TYPES
30 };
31
32 enum ext_slave_id {
33         ID_INVALID = 0,
34         GYRO_ID_MPU3050,
35         GYRO_ID_MPU6050A2,
36         GYRO_ID_MPU6050B1,
37         GYRO_ID_MPU6050B1_NO_ACCEL,
38         GYRO_ID_ITG3500,
39
40         ACCEL_ID_LIS331,
41         ACCEL_ID_LSM303DLX,
42         ACCEL_ID_LIS3DH,
43         ACCEL_ID_KXSD9,
44         ACCEL_ID_KXTF9,
45         ACCEL_ID_BMA150,
46         ACCEL_ID_BMA222,
47         ACCEL_ID_BMA250,
48         ACCEL_ID_ADXL34X,
49         ACCEL_ID_MMA8450,
50         ACCEL_ID_MMA845X,
51         ACCEL_ID_MPU6050,
52
53         COMPASS_ID_AK8963,
54         COMPASS_ID_AK8975,
55         COMPASS_ID_AK8972,
56         COMPASS_ID_AMI30X,
57         COMPASS_ID_AMI306,
58         COMPASS_ID_YAS529,
59         COMPASS_ID_YAS530,
60         COMPASS_ID_HMC5883,
61         COMPASS_ID_LSM303DLH,
62         COMPASS_ID_LSM303DLM,
63         COMPASS_ID_MMC314X,
64         COMPASS_ID_HSCDTD002B,
65         COMPASS_ID_HSCDTD004A,
66         COMPASS_ID_MLX90399,
67         COMPASS_ID_AK09911,
68         COMPASS_ID_AK09912,
69         COMPASS_ID_ST480M,
70
71         PRESSURE_ID_BMP085,
72         PRESSURE_ID_BMP280,
73
74         ALS_ID_APDS_9900,
75         ALS_ID_APDS_9930,
76 };
77
78 #define INV_PROD_KEY(ver, rev) (ver * 100 + rev)
79 /**
80  * struct mpu_platform_data - Platform data for the mpu driver
81  * @int_config:         Bits [7:3] of the int config register.
82  * @level_shifter:      0: VLogic, 1: VDD
83  * @orientation:        Orientation matrix of the gyroscope
84  * @sec_slave_type:     secondary slave device type, can be compass, accel, etc
85  * @sec_slave_id:       id of the secondary slave device
86  * @secondary_i2c_address: secondary device's i2c address
87  * @secondary_orientation: secondary device's orientation matrix
88  * @aux_slave_type: auxiliary slave. Another slave device type
89  * @aux_slave_id: auxiliary slave ID.
90  * @aux_i2c_addr: auxiliary device I2C address.
91  * @read_only_slave_type: read only slave type.
92  * @read_only_slave_id: read only slave device ID.
93  * @read_only_i2c_addr: read only slave device address.
94  *
95  * Contains platform specific information on how to configure the MPU3050 to
96  * work on this platform.  The orientation matricies are 3x3 rotation matricies
97  * that are applied to the data to rotate from the mounting orientation to the
98  * platform orientation.  The values must be one of 0, 1, or -1 and each row and
99  * column should have exactly 1 non-zero value.
100  */
101 struct mpu_platform_data {
102         __u8 int_config;
103         __u8 level_shifter;
104         __s8 orientation[9];
105         enum secondary_slave_type sec_slave_type;
106         enum ext_slave_id sec_slave_id;
107         __u16 secondary_i2c_addr;
108         __s8 secondary_orientation[9];
109         enum secondary_slave_type aux_slave_type;
110         enum ext_slave_id aux_slave_id;
111         __u16 aux_i2c_addr;
112         enum secondary_slave_type read_only_slave_type;
113         enum ext_slave_id read_only_slave_id;
114         __u16 read_only_i2c_addr;
115 #ifdef CONFIG_DTS_INV_MPU_IIO
116         int (*power_on)(struct mpu_platform_data *);
117         int (*power_off)(struct mpu_platform_data *);
118         struct regulator *vdd_ana;
119         struct regulator *vdd_i2c;
120 #endif
121 };
122
123 #endif  /* __MPU_H_ */