import PULS_20160108
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / drivers / misc / mediatek / accelerometer / mpu6515 / mpu6515.h
1 #ifndef MPU6515_H
2 #define MPU6515_H
3
4 #include <linux/ioctl.h>
5
6 #define MPU6515_I2C_SLAVE_ADDR 0xD0 // or 0xD1
7
8
9 /* MPU6515 Register Map (Please refer to MPU6515 Specifications) */
10 #define MPU6515_REG_DEVID 0x75
11 #define MPU6515_REG_BW_RATE 0x1A
12 #define MPU6515_REG_POWER_CTL 0x6B
13 #define MPU6515_REG_POWER_CTL2 0x6C
14 #define MPU6515_REG_INT_ENABLE 0x38
15 #define MPU6515_REG_DATA_FORMAT 0x1C
16 #define MPU6515_REG_DATAX0 0x3B
17 #define MPU6515_REG_DATAY0 0x3D
18 #define MPU6515_REG_DATAZ0 0x3F
19 #define MPU6515_REG_RESET 0x68
20
21 /* register Value */
22 #define MPU6515_FIXED_DEVID 0x74
23
24 // delay(ms)
25 #define MPU6515_BW_460HZ 0x00 //1.94
26 #define MPU6515_BW_184HZ 0x01 //5.8
27 #define MPU6515_BW_92HZ 0x02 //7.8
28 #define MPU6515_BW_41HZ 0x03 //11.8
29 #define MPU6515_BW_20HZ 0x04 //19.8
30 #define MPU6515_BW_10HZ 0x05 //35.7
31 #define MPU6515_BW_5HZ 0x06 //66.96
32
33 #define MPU6515_DEV_RESET 0x80
34
35 //#define MPU6515_FULL_RES 0x08
36 #define MPU6515_RANGE_2G (0x00 << 3)
37 #define MPU6515_RANGE_4G (0x01 << 3)
38 #define MPU6515_RANGE_8G (0x02 << 3)
39 #define MPU6515_RANGE_16G (0x03 << 3)
40 //#define MPU6515_SELF_TEST 0x80
41
42
43 #define MPU6515_SLEEP 0x40 //enable low power sleep mode
44
45
46
47 // below do not modify
48 #define MPU6515_SUCCESS 0
49 #define MPU6515_ERR_I2C -1
50 #define MPU6515_ERR_STATUS -3
51 #define MPU6515_ERR_SETUP_FAILURE -4
52 #define MPU6515_ERR_GETGSENSORDATA -5
53 #define MPU6515_ERR_IDENTIFICATION -6
54
55 #define MPU6515_BUFSIZE 256
56
57 #define MPU6515_AXES_NUM 3
58
59 /*----------------------------------------------------------------------------*/
60 typedef enum{
61 MPU6515_CUST_ACTION_SET_CUST = 1,
62 MPU6515_CUST_ACTION_SET_CALI,
63 MPU6515_CUST_ACTION_RESET_CALI
64 }CUST_ACTION;
65 /*----------------------------------------------------------------------------*/
66 typedef struct
67 {
68 uint16_t action;
69 }MPU6515_CUST;
70 /*----------------------------------------------------------------------------*/
71 typedef struct
72 {
73 uint16_t action;
74 uint16_t part;
75 int32_t data[0];
76 }MPU6515_SET_CUST;
77 /*----------------------------------------------------------------------------*/
78 typedef struct
79 {
80 uint16_t action;
81 int32_t data[MPU6515_AXES_NUM];
82 }MPU6515_SET_CALI;
83 /*----------------------------------------------------------------------------*/
84 typedef MPU6515_CUST MPU6515_RESET_CALI;
85 /*----------------------------------------------------------------------------*/
86 typedef union
87 {
88 uint32_t data[10];
89 MPU6515_CUST cust;
90 MPU6515_SET_CUST setCust;
91 MPU6515_SET_CALI setCali;
92 MPU6515_RESET_CALI resetCali;
93 }MPU6515_CUST_DATA;
94 /*----------------------------------------------------------------------------*/
95
96 #endif
97