Merge branch linux-linaro-lsk-v3.10-android
[firefly-linux-kernel-4.4.55.git] / drivers / misc / inv_mpu / README
1 Kernel driver mpu
2 =====================
3
4 Supported chips:
5   * InvenSense IMU3050
6     Prefix: 'mpu3050'
7     Datasheet:
8         PS-MPU-3000A-00.2.4b.pdf
9
10 Author: InvenSense <http://invensense.com>
11
12 Description
13 -----------
14 The mpu is a motion processor unit that controls the mpu3050 gyroscope, a slave
15 accelerometer, a compass and a pressure sensor.  This document describes how to
16 install the driver into a Linux kernel.
17
18 Sysfs entries
19 -------------
20 /dev/mpu
21 /dev/mpuirq
22 /dev/accelirq
23 /dev/compassirq
24 /dev/pressureirq
25
26 General Remarks MPU3050
27 -----------------------
28 * Valid addresses for the MPU3050 is 0x68.
29 * Accelerometer must be on the secondary I2C bus for MPU3050, the
30   magnetometer must be on the primary bus and pressure sensor must
31   be on the primary bus.
32
33 Programming the chip using /dev/mpu
34 ----------------------------------
35 Programming of MPU3050 is done by first opening the /dev/mpu file and
36 then performing a series of IOCTLS on the handle returned.  The IOCTL codes can
37 be found in mpu.h.  Typically this is done by the mllite library in user
38 space.
39
40 Board and Platform Data
41 -----------------------
42
43 In order for the driver to work, board and platform data specific to the device
44 needs to be added to the board file.  A mpu_platform_data structure must
45 be created and populated and set in the i2c_board_info_structure.  For details
46 of each structure member see mpu.h.  All values below are simply an example and
47 should be modified for your platform.
48
49 #include <linux/mpu.h>
50
51 static struct mpu_platform_data mpu3050_data = {
52         .int_config  = 0x10,
53         .orientation = {  -1,  0,  0,
54                            0,  1,  0,
55                            0,  0, -1 },
56 };
57
58 /* accel */
59 static struct ext_slave_platform_data inv_mpu_kxtf9_data = {
60         .bus         = EXT_SLAVE_BUS_SECONDARY,
61         .orientation = {  -1,  0,  0,
62                           0,  1,  0,
63                           0,  0, -1 },
64 };
65 /* compass */
66 static struct ext_slave_platform_data inv_mpu_ak8975_data = {
67         .bus         = EXT_SLAVE_BUS_PRIMARY,
68         .orientation = { 1, 0, 0,
69                          0, 1, 0,
70                          0, 0, 1 },
71 };
72
73 static struct i2c_board_info __initdata panda_inv_mpu_i2c4_boardinfo[] = {
74         {
75                 I2C_BOARD_INFO("mpu3050", 0x68),
76                 .irq = (IH_GPIO_BASE + MPUIRQ_GPIO),
77                 .platform_data = &mpu3050_data,
78         },
79         {
80                 I2C_BOARD_INFO("kxtf9", 0x0F),
81                 .irq = (IH_GPIO_BASE + ACCEL_IRQ_GPIO),
82                 .platform_data = &inv_mpu_kxtf9_data
83         },
84         {
85                 I2C_BOARD_INFO("ak8975", 0x0E),
86                 .irq = (IH_GPIO_BASE + COMPASS_IRQ_GPIO),
87                 .platform_data = &inv_mpu_ak8975_data,
88         },
89 };
90
91 Typically the IRQ is a GPIO input pin and needs to be configured properly.  If
92 in the above example GPIO 168 corresponds to IRQ 299, the following should be
93 done as well:
94
95 #define MPU_GPIO_IRQ 168
96
97     gpio_request(MPU_GPIO_IRQ,"MPUIRQ");
98     gpio_direction_input(MPU_GPIO_IRQ)
99
100 Dynamic Debug
101 =============
102
103 The mpu3050 makes use of dynamic debug.  For details on how to use this
104 refer to Documentation/dynamic-debug-howto.txt