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