blob: 159b9d8fc6d01e4d84a67080f64cbf16834d4084 [file] [log] [blame]
chohee.park9a20a0e2013-05-29 02:02:54 +09001/*
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
22enum secondary_slave_type {
23 SECONDARY_SLAVE_TYPE_NONE,
24 SECONDARY_SLAVE_TYPE_ACCEL,
25 SECONDARY_SLAVE_TYPE_COMPASS,
26 SECONDARY_SLAVE_TYPE_PRESSURE,
27
28 SECONDARY_SLAVE_TYPE_TYPES
29};
30
31enum ext_slave_id {
32 ID_INVALID = 0,
33 GYRO_ID_MPU3050,
34 GYRO_ID_MPU6050A2,
35 GYRO_ID_MPU6050B1,
36 GYRO_ID_MPU6050B1_NO_ACCEL,
37 GYRO_ID_ITG3500,
38
39 ACCEL_ID_LIS331,
40 ACCEL_ID_LSM303DLX,
41 ACCEL_ID_LIS3DH,
42 ACCEL_ID_KXSD9,
43 ACCEL_ID_KXTF9,
44 ACCEL_ID_BMA150,
45 ACCEL_ID_BMA222,
46 ACCEL_ID_BMA250,
47 ACCEL_ID_ADXL34X,
48 ACCEL_ID_MMA8450,
49 ACCEL_ID_MMA845X,
50 ACCEL_ID_MPU6050,
51
52 COMPASS_ID_AK8963,
53 COMPASS_ID_AK8975,
54 COMPASS_ID_AK8972,
55 COMPASS_ID_AMI30X,
56 COMPASS_ID_AMI306,
57 COMPASS_ID_YAS529,
58 COMPASS_ID_YAS530,
59 COMPASS_ID_HMC5883,
60 COMPASS_ID_LSM303DLH,
61 COMPASS_ID_LSM303DLM,
62 COMPASS_ID_MMC314X,
63 COMPASS_ID_HSCDTD002B,
64 COMPASS_ID_HSCDTD004A,
65 COMPASS_ID_MLX90399,
66
67 PRESSURE_ID_BMP085,
68 PRESSURE_ID_BMP280,
69};
70
71#define INV_PROD_KEY(ver, rev) (ver * 100 + rev)
72/**
73 * struct mpu_platform_data - Platform data for the mpu driver
74 * @int_config: Bits [7:3] of the int config register.
75 * @level_shifter: 0: VLogic, 1: VDD
76 * @orientation: Orientation matrix of the gyroscope
77 * @sec_slave_type: secondary slave device type, can be compass, accel, etc
78 * @sec_slave_id: id of the secondary slave device
79 * @secondary_i2c_address: secondary device's i2c address
80 * @secondary_orientation: secondary device's orientation matrix
81 * @key: key for MPL library.
82 *
83 * Contains platform specific information on how to configure the MPU3050 to
84 * work on this platform. The orientation matricies are 3x3 rotation matricies
85 * that are applied to the data to rotate from the mounting orientation to the
86 * platform orientation. The values must be one of 0, 1, or -1 and each row and
87 * column should have exactly 1 non-zero value.
88 */
89struct mpu_platform_data {
90 __u8 int_config;
91 __u8 level_shifter;
92 __s8 orientation[9];
93 enum secondary_slave_type sec_slave_type;
94 enum ext_slave_id sec_slave_id;
95 __u16 secondary_i2c_addr;
96 __s8 secondary_orientation[9];
97 __u8 key[16];
98 enum secondary_slave_type aux_slave_type;
99 enum ext_slave_id aux_slave_id;
100 __u16 aux_i2c_addr;
101 int (*power_on)(struct mpu_platform_data *);
102 int (*power_off)(struct mpu_platform_data *);
103 struct regulator *vdd_ana;
104 struct regulator *vdd_i2c;
105};
106
107#endif /* __MPU_H_ */