ARM: tegra: sensors: Add support for enterprise
Krishna Yarlagadda [Tue, 17 May 2011 17:16:27 +0000 (22:16 +0530)]
Enable mpu and isl & proxy sensors for enterprise board

Bug 827932

Change-Id: I735790f722b143ac654b5f8c0b1d4b3914e693d9
Reviewed-on: http://git-master/r/31879
Reviewed-by: Niket Sirsi <nsirsi@nvidia.com>
Tested-by: Niket Sirsi <nsirsi@nvidia.com>

Rebase-Id: R7c2d4d8b434670769c6f09f55f364799335d0d53

arch/arm/mach-tegra/Makefile
arch/arm/mach-tegra/board-enterprise-power.c
arch/arm/mach-tegra/board-enterprise-sensors.c [new file with mode: 0644]
arch/arm/mach-tegra/board-enterprise.c
arch/arm/mach-tegra/board-enterprise.h

index af3a685..869b95d 100644 (file)
@@ -113,3 +113,4 @@ obj-${CONFIG_MACH_TEGRA_ENTERPRISE}     += board-enterprise-memory.o
 obj-${CONFIG_MACH_TEGRA_ENTERPRISE}     += board-enterprise-power.o
 obj-${CONFIG_MACH_TEGRA_ENTERPRISE}     += board-enterprise-baseband.o
 obj-${CONFIG_MACH_TEGRA_ENTERPRISE}     += board-enterprise-kbc.o
+obj-${CONFIG_MACH_TEGRA_ENTERPRISE}     += board-enterprise-sensors.o
index dd1856e..9d7b52d 100644 (file)
@@ -87,7 +87,7 @@ static struct regulator_consumer_supply tps80031_ldo4_supply[] = {
 };
 
 static struct regulator_consumer_supply tps80031_ldo5_supply[] = {
-       REGULATOR_SUPPLY("unused_ldo5", NULL),
+       REGULATOR_SUPPLY("vdd_sensor", NULL),
 };
 
 static struct regulator_consumer_supply tps80031_ldo6_supply[] = {
diff --git a/arch/arm/mach-tegra/board-enterprise-sensors.c b/arch/arm/mach-tegra/board-enterprise-sensors.c
new file mode 100644 (file)
index 0000000..c6e4ed4
--- /dev/null
@@ -0,0 +1,103 @@
+/*
+ * arch/arm/mach-tegra/board-enterprise-sensors.c
+ *
+ * Copyright (c) 2011, NVIDIA, All Rights Reserved.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include <linux/i2c.h>
+#include <linux/err.h>
+#include <linux/mpu.h>
+#include <mach/gpio.h>
+#include "gpio-names.h"
+#include "board-enterprise.h"
+
+#define SENSOR_MPU_NAME "mpu3050"
+static struct mpu3050_platform_data mpu3050_data = {
+       .int_config  = 0x10,
+       /* Orientation matrix for MPU on enterprise */
+       .orientation = { 0, -1, 0, -1, 0, 0, 0, 0, -1 },
+       .level_shifter = 0,
+
+       .accel = {
+               .get_slave_descr = get_accel_slave_descr,
+               .adapt_num   = 0,
+               .bus         = EXT_SLAVE_BUS_SECONDARY,
+               .address     = 0x0F,
+               /* Orientation matrix for Kionix on enterprise */
+               .orientation = { 0, -1, 0, -1, 0, 0, 0, 0, -1 },
+
+       },
+
+       .compass = {
+               .get_slave_descr = get_compass_slave_descr,
+               .adapt_num   = 0,
+               .bus         = EXT_SLAVE_BUS_PRIMARY,
+               .address     = 0x0C,
+               /* Orientation matrix for AKM on enterprise */
+               .orientation = { 1, 0, 0, 0, -1, 0, 0, 0, -1 },
+       },
+};
+
+static struct i2c_board_info __initdata mpu3050_i2c0_boardinfo[] = {
+       {
+               I2C_BOARD_INFO(SENSOR_MPU_NAME, 0x68),
+               .irq = TEGRA_GPIO_TO_IRQ(TEGRA_GPIO_PH4),
+               .platform_data = &mpu3050_data,
+       },
+};
+
+static void enterprise_mpuirq_init(void)
+{
+       int ret = 0;
+
+       tegra_gpio_enable(TEGRA_GPIO_PH4);
+       ret = gpio_request(TEGRA_GPIO_PH4, SENSOR_MPU_NAME);
+       if (ret < 0) {
+               pr_err("%s: gpio_request failed %d\n", __func__, ret);
+               return;
+       }
+
+       ret = gpio_direction_input(TEGRA_GPIO_PH4);
+       if (ret < 0) {
+               pr_err("%s: gpio_direction_input failed %d\n", __func__, ret);
+               gpio_free(TEGRA_GPIO_PH4);
+               return;
+       }
+
+       i2c_register_board_info(0, mpu3050_i2c0_boardinfo,
+                               ARRAY_SIZE(mpu3050_i2c0_boardinfo));
+}
+
+static struct i2c_board_info enterprise_i2c0_isl_board_info[] = {
+       {
+               I2C_BOARD_INFO("isl29028", 0x44),
+       }
+};
+
+static void enterprise_isl_init(void)
+{
+       i2c_register_board_info(0, enterprise_i2c0_isl_board_info,
+                               ARRAY_SIZE(enterprise_i2c0_isl_board_info));
+}
+
+int __init enterprise_sensors_init(void)
+{
+       enterprise_isl_init();
+       enterprise_mpuirq_init();
+
+       return 0;
+}
index 2d15316..68e8873 100644 (file)
@@ -367,6 +367,7 @@ static void __init tegra_enterprise_init(void)
        enterprise_panel_init();
        enterprise_bt_rfkill();
        enterprise_emc_init();
+       enterprise_sensors_init();
 }
 
 static void __init tegra_enterprise_reserve(void)
index e7a4ebf..93c3d15 100644 (file)
@@ -28,6 +28,7 @@ int enterprise_charge_init(void);
 int enterprise_sdhci_init(void);
 int enterprise_pinmux_init(void);
 int enterprise_panel_init(void);
+int enterprise_sensors_init(void);
 int touch_init(void);
 int enterprise_kbc_init(void);
 int enterprise_emc_init(void);