arm: tegra: board support for sensors
Erik Lilliebjerg [Wed, 20 Mar 2013 07:29:32 +0000 (00:29 -0700)]
Added support for BMP180 pressure sensor and auto-detection of AKM89XX compass.

Change-Id: I3e45250e7b4e2887d79bd62a402ddcdc0d057b92
Signed-off-by: Erik Lilliebjerg <elilliebjerg@nvidia.com>
Reviewed-on: http://git-master/r/211081
Reviewed-by: Mrutyunjay Sawant <msawant@nvidia.com>
Tested-by: Mrutyunjay Sawant <msawant@nvidia.com>

arch/arm/mach-tegra/board-dalmore-power.c
arch/arm/mach-tegra/board-dalmore-sensors.c
arch/arm/mach-tegra/board-enterprise-sensors.c
arch/arm/mach-tegra/board-macallan-power.c
arch/arm/mach-tegra/board-macallan-sensors.c
arch/arm/mach-tegra/board-pluto-power.c
arch/arm/mach-tegra/board-pluto-sensors.c

index 70379d5..cb0299c 100644 (file)
@@ -246,6 +246,8 @@ static struct regulator_consumer_supply max77663_sd2_supply[] = {
        REGULATOR_SUPPLY("vddio_bt_1v8", "bluedroid_pm.0"),
        REGULATOR_SUPPLY("vdd_dtv_1v8", NULL),
        REGULATOR_SUPPLY("vlogic", "0-0069"),
+       REGULATOR_SUPPLY("vid", "0-000d"),
+       REGULATOR_SUPPLY("vddio", "0-0078"),
 };
 
 static struct regulator_consumer_supply max77663_sd3_supply[] = {
@@ -272,6 +274,8 @@ static struct regulator_consumer_supply max77663_ldo2_supply[] = {
        REGULATOR_SUPPLY("vdd_als", NULL),
        REGULATOR_SUPPLY("vdd", "0-004c"),
        REGULATOR_SUPPLY("vdd", "0-0069"),
+       REGULATOR_SUPPLY("vdd", "0-000d"),
+       REGULATOR_SUPPLY("vdd", "0-0078"),
 };
 
 static struct regulator_consumer_supply max77663_ldo3_supply[] = {
index 30bf3fe..c79993a 100644 (file)
@@ -521,21 +521,6 @@ static int dalmore_camera_init(void)
        return 0;
 }
 
-/* MPU board file definition   */
-static struct mpu_platform_data mpu9150_gyro_data = {
-       .int_config     = 0x10,
-       .level_shifter  = 0,
-       /* Located in board_[platformname].h */
-       .orientation    = MPU_GYRO_ORIENTATION,
-       .sec_slave_type = SECONDARY_SLAVE_TYPE_COMPASS,
-       .sec_slave_id   = COMPASS_ID_AK8975,
-       .secondary_i2c_addr     = MPU_COMPASS_ADDR,
-       .secondary_read_reg     = 0x06,
-       .secondary_orientation  = MPU_COMPASS_ORIENTATION,
-       .key            = {0x4E, 0xCC, 0x7E, 0xEB, 0xF6, 0x1E, 0x35, 0x22,
-                          0x00, 0x34, 0x0D, 0x65, 0x32, 0xE9, 0x94, 0x89},
-};
-
 #define TEGRA_CAMERA_GPIO(_gpio, _label, _value)               \
        {                                                       \
                .gpio = _gpio,                                  \
@@ -549,11 +534,45 @@ static struct i2c_board_info dalmore_i2c_board_info_cm3218[] = {
        },
 };
 
+/* MPU board file definition   */
+static struct mpu_platform_data mpu9150_gyro_data = {
+       .int_config     = 0x10,
+       .level_shifter  = 0,
+       /* Located in board_[platformname].h */
+       .orientation    = MPU_GYRO_ORIENTATION,
+       .sec_slave_type = SECONDARY_SLAVE_TYPE_NONE,
+       .key            = {0x4E, 0xCC, 0x7E, 0xEB, 0xF6, 0x1E, 0x35, 0x22,
+                          0x00, 0x34, 0x0D, 0x65, 0x32, 0xE9, 0x94, 0x89},
+};
+
+static struct mpu_platform_data mpu_compass_data = {
+       .orientation    = MPU_COMPASS_ORIENTATION,
+       .config         = NVI_CONFIG_BOOT_MPU,
+};
+
+static struct mpu_platform_data bmp180_pdata = {
+       .config         = NVI_CONFIG_BOOT_MPU,
+};
+
 static struct i2c_board_info __initdata inv_mpu9150_i2c2_board_info[] = {
        {
                I2C_BOARD_INFO(MPU_GYRO_NAME, MPU_GYRO_ADDR),
                .platform_data = &mpu9150_gyro_data,
        },
+       {
+               /* The actual BMP180 address is 0x77 but because this conflicts
+                * with another device, this address is hacked so Linux will
+                * call the driver.  The conflict is technically okay since the
+                * BMP180 is behind the MPU.  Also, the BMP180 driver uses a
+                * hard-coded address of 0x77 since it can't be changed anyway.
+                */
+               I2C_BOARD_INFO("bmp180", 0x78),
+               .platform_data = &bmp180_pdata,
+       },
+       {
+               I2C_BOARD_INFO(MPU_COMPASS_NAME, MPU_COMPASS_ADDR),
+               .platform_data = &mpu_compass_data,
+       },
 };
 
 static void mpuirq_init(void)
index 721554e..919ced1 100644 (file)
@@ -167,11 +167,7 @@ static struct mpu_platform_data mpu9150_gyro_data = {
        .int_config     = 0x10,
        .level_shifter  = 0,
        .orientation    = MPU_GYRO_ORIENTATION,
-       .sec_slave_type = SECONDARY_SLAVE_TYPE_COMPASS,
-       .sec_slave_id   = COMPASS_ID_AK8975,
-       .secondary_i2c_addr     = MPU_COMPASS_ADDR,
-       .secondary_read_reg     = 0x06,
-       .secondary_orientation  = MPU_COMPASS_ORIENTATION,
+       .sec_slave_type = SECONDARY_SLAVE_TYPE_NONE,
        .key            = {0x4E, 0xCC, 0x7E, 0xEB, 0xF6, 0x1E, 0x35, 0x22,
                           0x00, 0x34, 0x0D, 0x65, 0x32, 0xE9, 0x94, 0x89},
 };
@@ -200,6 +196,10 @@ static struct i2c_board_info __initdata inv_mpu9150_i2c2_board_info[] = {
                I2C_BOARD_INFO(MPU_GYRO_NAME_TAI, MPU_GYRO_ADDR),
                .platform_data = &mpu9150_gyro_data,
        },
+       {
+               I2C_BOARD_INFO(MPU_COMPASS_NAME, MPU_COMPASS_ADDR),
+               .platform_data = &mpu_compass_data,
+       },
 };
 
 static void mpuirq_init(void)
index 77964a0..b408f2f 100644 (file)
@@ -135,6 +135,8 @@ static struct regulator_consumer_supply palmas_smps8_supply[] = {
        REGULATOR_SUPPLY("pwrdet_uart", NULL),
        REGULATOR_SUPPLY("vddio_gmi", NULL),
        REGULATOR_SUPPLY("vlogic", "0-0069"),
+       REGULATOR_SUPPLY("vid", "0-000d"),
+       REGULATOR_SUPPLY("vddio", "0-0078"),
 };
 
 static struct regulator_consumer_supply palmas_smps9_supply[] = {
@@ -182,6 +184,8 @@ static struct regulator_consumer_supply palmas_ldo5_supply[] = {
 
 static struct regulator_consumer_supply palmas_ldo6_supply[] = {
        REGULATOR_SUPPLY("vdd", "0-0069"),
+       REGULATOR_SUPPLY("vdd", "0-000d"),
+       REGULATOR_SUPPLY("vdd", "0-0078"),
 };
 
 static struct regulator_consumer_supply palmas_ldo7_supply[] = {
index 8991bae..ddbd8a1 100644 (file)
@@ -522,21 +522,6 @@ static int macallan_camera_init(void)
        return 0;
 }
 
-/* MPU board file definition   */
-static struct mpu_platform_data mpu6050_gyro_data = {
-       .int_config     = 0x10,
-       .level_shifter  = 0,
-       /* Located in board_[platformname].h */
-       .orientation    = MPU_GYRO_ORIENTATION,
-       .sec_slave_type = SECONDARY_SLAVE_TYPE_COMPASS,
-       .sec_slave_id   = COMPASS_ID_AK8975,
-       .secondary_i2c_addr     = MPU_COMPASS_ADDR,
-       .secondary_read_reg     = 0x06,
-       .secondary_orientation  = MPU_COMPASS_ORIENTATION,
-       .key            = {0x4E, 0xCC, 0x7E, 0xEB, 0xF6, 0x1E, 0x35, 0x22,
-                          0x00, 0x34, 0x0D, 0x65, 0x32, 0xE9, 0x94, 0x89},
-};
-
 #define TEGRA_CAMERA_GPIO(_gpio, _label, _value)               \
        {                                                       \
                .gpio = _gpio,                                  \
@@ -557,11 +542,45 @@ static struct i2c_board_info macallan_i2c0_board_info_cm3217[] = {
        },
 };
 
+/* MPU board file definition   */
+static struct mpu_platform_data mpu6050_gyro_data = {
+       .int_config     = 0x10,
+       .level_shifter  = 0,
+       /* Located in board_[platformname].h */
+       .orientation    = MPU_GYRO_ORIENTATION,
+       .sec_slave_type = SECONDARY_SLAVE_TYPE_NONE,
+       .key            = {0x4E, 0xCC, 0x7E, 0xEB, 0xF6, 0x1E, 0x35, 0x22,
+                          0x00, 0x34, 0x0D, 0x65, 0x32, 0xE9, 0x94, 0x89},
+};
+
+static struct mpu_platform_data mpu_compass_data = {
+       .orientation    = MPU_COMPASS_ORIENTATION,
+       .config         = NVI_CONFIG_BOOT_MPU,
+};
+
+static struct mpu_platform_data bmp180_pdata = {
+       .config         = NVI_CONFIG_BOOT_MPU,
+};
+
 static struct i2c_board_info __initdata inv_mpu6050_i2c2_board_info[] = {
        {
                I2C_BOARD_INFO(MPU_GYRO_NAME, MPU_GYRO_ADDR),
                .platform_data = &mpu6050_gyro_data,
        },
+       {
+               /* The actual BMP180 address is 0x77 but because this conflicts
+                * with another device, this address is hacked so Linux will
+                * call the driver.  The conflict is technically okay since the
+                * BMP180 is behind the MPU.  Also, the BMP180 driver uses a
+                * hard-coded address of 0x77 since it can't be changed anyway.
+                */
+               I2C_BOARD_INFO("bmp180", 0x78),
+               .platform_data = &bmp180_pdata,
+       },
+       {
+               I2C_BOARD_INFO(MPU_COMPASS_NAME, MPU_COMPASS_ADDR),
+               .platform_data = &mpu_compass_data,
+       },
 };
 
 static void mpuirq_init(void)
index c55ae73..936d0e8 100644 (file)
@@ -96,6 +96,8 @@ static struct regulator_consumer_supply palmas_smps8_supply[] = {
        REGULATOR_SUPPLY("vdd_gps", NULL),
        REGULATOR_SUPPLY("vdd_nfc", NULL),
        REGULATOR_SUPPLY("vlogic", "0-0069"),
+       REGULATOR_SUPPLY("vid", "0-000d"),
+       REGULATOR_SUPPLY("vddio", "0-0078"),
        REGULATOR_SUPPLY("vdd_dtv", NULL),
        REGULATOR_SUPPLY("vdd_bb", NULL),
        REGULATOR_SUPPLY("vcore1_lpddr", NULL),
@@ -182,6 +184,8 @@ static struct regulator_consumer_supply palmas_ldo6_supply[] = {
        REGULATOR_SUPPLY("vdd", "0-004c"),
        REGULATOR_SUPPLY("avdd", "spi3.2"),
        REGULATOR_SUPPLY("vdd", "0-0069"),
+       REGULATOR_SUPPLY("vdd", "0-000d"),
+       REGULATOR_SUPPLY("vdd", "0-0078"),
 };
 
 static struct regulator_consumer_supply palmas_ldo7_supply[] = {
index ba6cf99..593374e 100644 (file)
@@ -900,19 +900,39 @@ static struct mpu_platform_data mpu_gyro_data = {
        .int_config     = 0x00,
        .level_shifter  = 0,
        .orientation    = MPU_GYRO_ORIENTATION,
-       .sec_slave_type = SECONDARY_SLAVE_TYPE_COMPASS,
-       .sec_slave_id   = COMPASS_ID_AK8963,
-       .secondary_i2c_addr     = MPU_COMPASS_ADDR,
-       .secondary_orientation  = MPU_COMPASS_ORIENTATION,
+       .sec_slave_type = SECONDARY_SLAVE_TYPE_NONE,
        .key            = {0x4E, 0xCC, 0x7E, 0xEB, 0xF6, 0x1E, 0x35, 0x22,
                           0x00, 0x34, 0x0D, 0x65, 0x32, 0xE9, 0x94, 0x89},
 };
 
+static struct mpu_platform_data mpu_compass_data = {
+       .orientation    = MPU_COMPASS_ORIENTATION,
+       .config         = NVI_CONFIG_BOOT_MPU,
+};
+
+static struct mpu_platform_data bmp180_pdata = {
+       .config         = NVI_CONFIG_BOOT_MPU,
+};
+
 static struct i2c_board_info __initdata inv_mpu_i2c0_board_info[] = {
        {
                I2C_BOARD_INFO(MPU_GYRO_NAME, MPU_GYRO_ADDR),
                .platform_data = &mpu_gyro_data,
        },
+       {
+               /* The actual BMP180 address is 0x77 but because this conflicts
+                * with another device, this address is hacked so Linux will
+                * call the driver.  The conflict is technically okay since the
+                * BMP180 is behind the MPU.  Also, the BMP180 driver uses a
+                * hard-coded address of 0x77 since it can't be changed anyway.
+                */
+               I2C_BOARD_INFO("bmp180", 0x78),
+               .platform_data = &bmp180_pdata,
+       },
+       {
+               I2C_BOARD_INFO(MPU_COMPASS_NAME, MPU_COMPASS_ADDR),
+               .platform_data = &mpu_compass_data,
+       },
 };
 
 static void mpuirq_init(void)