arm: tegra: cardhu: add support for PM315
[linux-2.6.git] / arch / arm / mach-tegra / board-cardhu-sensors.c
index e50be58..d90802d 100644 (file)
@@ -46,7 +46,6 @@
 #include <media/ov14810.h>
 #include <media/ov2710.h>
 #include <media/tps61050.h>
-#include <media/imx091.h>
 #include <generated/mach-types.h>
 #include "board.h"
 #include <linux/mpu.h>
@@ -54,7 +53,6 @@
 #include <media/ad5816.h>
 #include <linux/bq27x00.h>
 #include <mach/edp.h>
-#include <mach/thermal.h>
 #include <linux/therm_est.h>
 
 #include "gpio-names.h"
@@ -90,7 +88,8 @@ static int cardhu_camera_init(void)
        /* Boards E1198 and E1291 are of Cardhu personality
         * and donot have TCA6416 exp for camera */
        if ((board_info.board_id == BOARD_E1198) ||
-               (board_info.board_id == BOARD_E1291)) {
+               (board_info.board_id == BOARD_E1291) ||
+               (board_info.board_id == BOARD_PM315)) {
                ret = gpio_request(CAM1_POWER_DWN_GPIO, "camera_power_en");
                if (ret < 0)
                        pr_err("%s: gpio_request failed for gpio %s\n",
@@ -134,15 +133,17 @@ static int cardhu_camera_init(void)
        return 0;
 }
 
-static int cardhu_left_ov5650_power_on(void)
+static int cardhu_left_ov5650_power_on(struct device *dev)
 {
        /* Boards E1198 and E1291 are of Cardhu personality
         * and donot have TCA6416 exp for camera */
        if ((board_info.board_id == BOARD_E1198) ||
-               (board_info.board_id == BOARD_E1291)) {
+               (board_info.board_id == BOARD_E1291) ||
+               (board_info.board_id == BOARD_PM315)) {
 
                if (cardhu_vdd_2v8_cam1 == NULL) {
-                       cardhu_vdd_2v8_cam1 = regulator_get(NULL, "vdd_2v8_cam1");
+                       cardhu_vdd_2v8_cam1 =
+                               regulator_get(dev, "vdd_2v8_cam1");
                        if (WARN_ON(IS_ERR(cardhu_vdd_2v8_cam1))) {
                                pr_err("%s: couldn't get regulator vdd_2v8_cam1: %ld\n",
                                        __func__, PTR_ERR(cardhu_vdd_2v8_cam1));
@@ -155,7 +156,7 @@ static int cardhu_left_ov5650_power_on(void)
 
        /* Enable VDD_1V8_Cam1 */
        if (cardhu_1v8_cam1 == NULL) {
-               cardhu_1v8_cam1 = regulator_get(NULL, "vdd_1v8_cam1");
+               cardhu_1v8_cam1 = regulator_get(dev, "vdd_1v8_cam1");
                if (WARN_ON(IS_ERR(cardhu_1v8_cam1))) {
                        pr_err("%s: couldn't get regulator vdd_1v8_cam1: %ld\n",
                                __func__, PTR_ERR(cardhu_1v8_cam1));
@@ -166,7 +167,8 @@ static int cardhu_left_ov5650_power_on(void)
 
        mdelay(5);
        if ((board_info.board_id == BOARD_E1198) ||
-               (board_info.board_id == BOARD_E1291)) {
+               (board_info.board_id == BOARD_E1291) ||
+               (board_info.board_id == BOARD_PM315)) {
                gpio_direction_output(CAM1_POWER_DWN_GPIO, 0);
                mdelay(20);
                gpio_direction_output(OV5650_RESETN_GPIO, 0);
@@ -196,12 +198,13 @@ reg_alloc_fail:
 
 }
 
-static int cardhu_left_ov5650_power_off(void)
+static int cardhu_left_ov5650_power_off(struct device *dev)
 {
        /* Boards E1198 and E1291 are of Cardhu personality
         * and donot have TCA6416 exp for camera */
        if ((board_info.board_id == BOARD_E1198) ||
-               (board_info.board_id == BOARD_E1291)) {
+               (board_info.board_id == BOARD_E1291) ||
+               (board_info.board_id == BOARD_PM315)) {
                gpio_direction_output(CAM1_POWER_DWN_GPIO, 1);
                gpio_direction_output(CAM2_POWER_DWN_GPIO, 1);
                gpio_direction_output(CAM3_POWER_DWN_GPIO, 1);
@@ -275,92 +278,7 @@ static struct i2c_board_info cardhu_i2c_board_info_e1214[] = {
 };
 #endif
 
-#ifdef CONFIG_VIDEO_IMX091
-static int cardhu_imx091_power_on(void)
-{
-       /* Boards E1198 and E1291 are of Cardhu personality
-       * and donot have TCA6416 exp for camera */
-       if ((board_info.board_id == BOARD_E1198) ||
-               (board_info.board_id == BOARD_E1291)) {
-
-                       if (cardhu_vdd_2v8_cam1 == NULL) {
-                               cardhu_vdd_2v8_cam1 = regulator_get(NULL, "vdd_2v8_cam1");
-                               if (WARN_ON(IS_ERR(cardhu_vdd_2v8_cam1))) {
-                                       pr_err("%s: couldn't get regulator vdd_2v8_cam1: %ld\n",
-                                                       __func__, PTR_ERR(cardhu_vdd_2v8_cam1));
-                                               goto reg_alloc_fail;
-                                       }
-                       }
-               regulator_enable(cardhu_vdd_2v8_cam1);
-               mdelay(5);
-       }
-
-       /* Enable VDD_1V8_Cam1 */
-       if (cardhu_1v8_cam1 == NULL) {
-                       cardhu_1v8_cam1 = regulator_get(NULL, "vdd_1v8_cam1");
-                       if (WARN_ON(IS_ERR(cardhu_1v8_cam1))) {
-                                       pr_err("%s: couldn't get regulator vdd_1v8_cam1: %ld\n",
-                                                       __func__, PTR_ERR(cardhu_1v8_cam1));
-                                       goto reg_alloc_fail;
-                       }
-       }
-       regulator_enable(cardhu_1v8_cam1);
-
-       mdelay(5);
-       if ((board_info.board_id == BOARD_E1198) ||
-                       (board_info.board_id == BOARD_E1291)) {
-                       gpio_direction_output(CAM1_POWER_DWN_GPIO, 1);
-                       mdelay(20);
-       }
-       return 0;
-
-reg_alloc_fail:
-       if (cardhu_1v8_cam1) {
-                       regulator_put(cardhu_1v8_cam1);
-                       cardhu_1v8_cam1 = NULL;
-       }
-       if (cardhu_vdd_2v8_cam1) {
-                       regulator_put(cardhu_vdd_2v8_cam1);
-                       cardhu_vdd_2v8_cam1 = NULL;
-       }
-
-       return -ENODEV;
-
-}
-
-static int cardhu_imx091_power_off(void)
-{
-       /* Boards E1198 and E1291 are of Cardhu personality
-        * and donot have TCA6416 exp for camera */
-       if ((board_info.board_id == BOARD_E1198) ||
-                       (board_info.board_id == BOARD_E1291)) {
-                       gpio_direction_output(CAM1_POWER_DWN_GPIO, 0);
-       }
-       if (cardhu_1v8_cam1)
-                       regulator_disable(cardhu_1v8_cam1);
-       if (cardhu_vdd_2v8_cam1)
-                       regulator_disable(cardhu_vdd_2v8_cam1);
-
-       return 0;
-}
-
-struct imx091_platform_data cardhu_imx091_data = {
-       .power_on = cardhu_imx091_power_on,
-       .power_off = cardhu_imx091_power_off,
-};
-
-
-static struct i2c_board_info cardhu_i2c_board_info_e1244[] = {
-       {
-               I2C_BOARD_INFO("imx091", 0x36),
-               .platform_data = &cardhu_imx091_data,
-       },
-};
-#endif /* CONFIG_VIDEO_IMX091 */
-
-
-
-static int cardhu_right_ov5650_power_on(void)
+static int cardhu_right_ov5650_power_on(struct device *dev)
 {
        /* CSI-B and front sensor are muxed on cardhu */
        gpio_direction_output(CAMERA_CSI_MUX_SEL_GPIO, 0);
@@ -368,14 +286,16 @@ static int cardhu_right_ov5650_power_on(void)
        /* Boards E1198 and E1291 are of Cardhu personality
         * and donot have TCA6416 exp for camera */
        if ((board_info.board_id == BOARD_E1198) ||
-               (board_info.board_id == BOARD_E1291)) {
+               (board_info.board_id == BOARD_E1291) ||
+               (board_info.board_id == BOARD_PM315)) {
 
                gpio_direction_output(CAM1_POWER_DWN_GPIO, 0);
                gpio_direction_output(CAM2_POWER_DWN_GPIO, 0);
                mdelay(10);
 
                if (cardhu_vdd_2v8_cam2 == NULL) {
-                       cardhu_vdd_2v8_cam2 = regulator_get(NULL, "vdd_2v8_cam2");
+                       cardhu_vdd_2v8_cam2 =
+                               regulator_get(dev, "vdd_2v8_cam2");
                        if (WARN_ON(IS_ERR(cardhu_vdd_2v8_cam2))) {
                                pr_err("%s: couldn't get regulator vdd_2v8_cam2: %ld\n",
                                        __func__, PTR_ERR(cardhu_vdd_2v8_cam2));
@@ -388,7 +308,7 @@ static int cardhu_right_ov5650_power_on(void)
 
        /* Enable VDD_1V8_Cam2 */
        if (cardhu_1v8_cam2 == NULL) {
-               cardhu_1v8_cam2 = regulator_get(NULL, "vdd_1v8_cam2");
+               cardhu_1v8_cam2 = regulator_get(dev, "vdd_1v8_cam2");
                if (WARN_ON(IS_ERR(cardhu_1v8_cam2))) {
                        pr_err("%s: couldn't get regulator vdd_1v8_cam2: %ld\n",
                                __func__, PTR_ERR(cardhu_1v8_cam2));
@@ -421,7 +341,7 @@ reg_alloc_fail:
 
 }
 
-static int cardhu_right_ov5650_power_off(void)
+static int cardhu_right_ov5650_power_off(struct device *dev)
 {
        /* CSI-B and front sensor are muxed on cardhu */
        gpio_direction_output(CAMERA_CSI_MUX_SEL_GPIO, 0);
@@ -429,7 +349,8 @@ static int cardhu_right_ov5650_power_off(void)
        /* Boards E1198 and E1291 are of Cardhu personality
         * and do not have TCA6416 for camera */
        if ((board_info.board_id == BOARD_E1198) ||
-               (board_info.board_id == BOARD_E1291)) {
+               (board_info.board_id == BOARD_E1291) ||
+               (board_info.board_id == BOARD_PM315)) {
                gpio_direction_output(CAM1_POWER_DWN_GPIO, 1);
                gpio_direction_output(CAM2_POWER_DWN_GPIO, 1);
                gpio_direction_output(CAM3_POWER_DWN_GPIO, 1);
@@ -450,8 +371,8 @@ static void cardhu_ov5650_synchronize_sensors(void)
                mdelay(50);
                gpio_direction_output(CAM1_POWER_DWN_GPIO, 0);
                mdelay(50);
-       }
-       else if (board_info.board_id == BOARD_E1291) {
+       } else if ((board_info.board_id == BOARD_E1291) ||
+                       (board_info.board_id == BOARD_PM315)) {
                gpio_direction_output(CAM1_POWER_DWN_GPIO, 1);
                gpio_direction_output(CAM2_POWER_DWN_GPIO, 1);
                mdelay(50);
@@ -469,14 +390,14 @@ struct ov5650_platform_data cardhu_right_ov5650_data = {
        .synchronize_sensors = cardhu_ov5650_synchronize_sensors,
 };
 
-static int cardhu_ov2710_power_on(void)
+static int cardhu_ov2710_power_on(struct device *dev)
 {
        /* CSI-B and front sensor are muxed on cardhu */
        gpio_direction_output(CAMERA_CSI_MUX_SEL_GPIO, 1);
 
        /* Enable VDD_1V8_Cam3 */
        if (cardhu_1v8_cam3 == NULL) {
-               cardhu_1v8_cam3 = regulator_get(NULL, "vdd_1v8_cam3");
+               cardhu_1v8_cam3 = regulator_get(dev, "vdd_1v8_cam3");
                if (WARN_ON(IS_ERR(cardhu_1v8_cam3))) {
                        pr_err("%s: couldn't get regulator vdd_1v8_cam3: %ld\n",
                                __func__, PTR_ERR(cardhu_1v8_cam3));
@@ -488,9 +409,10 @@ static int cardhu_ov2710_power_on(void)
        /* Boards E1198 and E1291 are of Cardhu personality
         * and do not have TCA6416 for camera */
        if ((board_info.board_id == BOARD_E1198) ||
-               (board_info.board_id == BOARD_E1291)) {
+               (board_info.board_id == BOARD_E1291) ||
+               (board_info.board_id == BOARD_PM315)) {
                if (cardhu_vdd_cam3 == NULL) {
-                       cardhu_vdd_cam3 = regulator_get(NULL, "vdd_cam3");
+                       cardhu_vdd_cam3 = regulator_get(dev, "vdd_cam3");
                        if (WARN_ON(IS_ERR(cardhu_vdd_cam3))) {
                                pr_err("%s: couldn't get regulator vdd_cam3: %ld\n",
                                        __func__, PTR_ERR(cardhu_vdd_cam3));
@@ -525,7 +447,7 @@ reg_alloc_fail:
        return -ENODEV;
 }
 
-static int cardhu_ov2710_power_off(void)
+static int cardhu_ov2710_power_off(struct device *dev)
 {
        /* CSI-B and front sensor are muxed on cardhu */
        gpio_direction_output(CAMERA_CSI_MUX_SEL_GPIO, 1);
@@ -533,7 +455,8 @@ static int cardhu_ov2710_power_off(void)
        /* Boards E1198 and E1291 are of Cardhu personality
         * and donot have TCA6416 exp for camera */
        if ((board_info.board_id == BOARD_E1198) ||
-               (board_info.board_id == BOARD_E1291)) {
+               (board_info.board_id == BOARD_E1291) ||
+               (board_info.board_id == BOARD_PM315)) {
                gpio_direction_output(CAM1_POWER_DWN_GPIO, 1);
                gpio_direction_output(CAM2_POWER_DWN_GPIO, 1);
                gpio_direction_output(CAM3_POWER_DWN_GPIO, 1);
@@ -552,7 +475,7 @@ struct ov2710_platform_data cardhu_ov2710_data = {
        .power_off = cardhu_ov2710_power_off,
 };
 
-static int cardhu_ov5640_power_on(void)
+static int cardhu_ov5640_power_on(struct device *dev)
 {
        /* CSI-B and front sensor are muxed on cardhu */
        gpio_direction_output(CAMERA_CSI_MUX_SEL_GPIO, 1);
@@ -560,7 +483,8 @@ static int cardhu_ov5640_power_on(void)
        /* Boards E1198 and E1291 are of Cardhu personality
         * and donot have TCA6416 exp for camera */
        if ((board_info.board_id == BOARD_E1198) ||
-               (board_info.board_id == BOARD_E1291)) {
+               (board_info.board_id == BOARD_E1291) ||
+               (board_info.board_id == BOARD_PM315)) {
 
                gpio_direction_output(CAM1_POWER_DWN_GPIO, 0);
                gpio_direction_output(CAM2_POWER_DWN_GPIO, 0);
@@ -568,7 +492,7 @@ static int cardhu_ov5640_power_on(void)
                mdelay(10);
 
                if (cardhu_vdd_cam3 == NULL) {
-                       cardhu_vdd_cam3 = regulator_get(NULL, "vdd_cam3");
+                       cardhu_vdd_cam3 = regulator_get(dev, "vdd_cam3");
                        if (WARN_ON(IS_ERR(cardhu_vdd_cam3))) {
                                pr_err("%s: couldn't get regulator vdd_cam3: %ld\n",
                                        __func__, PTR_ERR(cardhu_vdd_cam3));
@@ -580,7 +504,7 @@ static int cardhu_ov5640_power_on(void)
 
        /* Enable VDD_1V8_Cam3 */
        if (cardhu_1v8_cam3 == NULL) {
-               cardhu_1v8_cam3 = regulator_get(NULL, "vdd_1v8_cam3");
+               cardhu_1v8_cam3 = regulator_get(dev, "vdd_1v8_cam3");
                if (WARN_ON(IS_ERR(cardhu_1v8_cam3))) {
                        pr_err("%s: couldn't get regulator vdd_1v8_cam3: %ld\n",
                                __func__, PTR_ERR(cardhu_1v8_cam3));
@@ -605,7 +529,7 @@ reg_alloc_fail:
        return -ENODEV;
 }
 
-static int cardhu_ov5640_power_off(void)
+static int cardhu_ov5640_power_off(struct device *dev)
 {
        /* CSI-B and front sensor are muxed on cardhu */
        gpio_direction_output(CAMERA_CSI_MUX_SEL_GPIO, 1);
@@ -613,7 +537,8 @@ static int cardhu_ov5640_power_off(void)
        /* Boards E1198 and E1291 are of Cardhu personality
         * and donot have TCA6416 exp for camera */
        if ((board_info.board_id == BOARD_E1198) ||
-               (board_info.board_id == BOARD_E1291)) {
+               (board_info.board_id == BOARD_E1291) ||
+               (board_info.board_id == BOARD_PM315)) {
                gpio_direction_output(CAM1_POWER_DWN_GPIO, 1);
                gpio_direction_output(CAM2_POWER_DWN_GPIO, 1);
                gpio_direction_output(CAM3_POWER_DWN_GPIO, 1);
@@ -825,85 +750,40 @@ static struct i2c_board_info cardhu_i2c8_board_info[] = {
        },
 };
 
-static int nct_get_temp(void *_data, long *temp)
-{
-       struct nct1008_data *data = _data;
-       return nct1008_thermal_get_temp(data, temp);
-}
-
-static int nct_set_limits(void *_data,
-                       long lo_limit_milli,
-                       long hi_limit_milli)
-{
-       struct nct1008_data *data = _data;
-       return nct1008_thermal_set_limits(data,
-                                       lo_limit_milli,
-                                       hi_limit_milli);
-}
-
-static int nct_set_alert(void *_data,
-                               void (*alert_func)(void *),
-                               void *alert_data)
-{
-       struct nct1008_data *data = _data;
-       return nct1008_thermal_set_alert(data, alert_func, alert_data);
-}
-
-#ifdef CONFIG_TEGRA_SKIN_THROTTLE
-static int nct_get_itemp(void *dev_data, long *temp)
-{
-       struct nct1008_data *data = dev_data;
-       return nct1008_thermal_get_temps(data, NULL, temp);
-}
-#endif
-
-static void nct1008_probe_callback(struct nct1008_data *data)
-{
-       struct tegra_thermal_device *ext_nct;
-
-       ext_nct = kzalloc(sizeof(struct tegra_thermal_device),
-                                       GFP_KERNEL);
-       if (!ext_nct) {
-               pr_err("unable to allocate thermal device\n");
-               return;
-       }
-
-       ext_nct->name = "nct_ext";
-       ext_nct->id = THERMAL_DEVICE_ID_NCT_EXT;
-       ext_nct->data = data;
-       ext_nct->get_temp = nct_get_temp;
-       ext_nct->set_limits = nct_set_limits;
-       ext_nct->set_alert = nct_set_alert;
-
-       tegra_thermal_device_register(ext_nct);
-
-#ifdef CONFIG_TEGRA_SKIN_THROTTLE
-       {
-               struct tegra_thermal_device *int_nct;
-               int_nct = kzalloc(sizeof(struct tegra_thermal_device),
-                                               GFP_KERNEL);
-               if (!int_nct) {
-                       kfree(int_nct);
-                       pr_err("unable to allocate thermal device\n");
-                       return;
-               }
-
-               int_nct->name = "nct_int";
-               int_nct->id = THERMAL_DEVICE_ID_NCT_INT;
-               int_nct->data = data;
-               int_nct->get_temp = nct_get_itemp;
-
-               tegra_thermal_device_register(int_nct);
-       }
-#endif
-}
+static struct balanced_throttle tj_throttle = {
+       .throt_tab_size = 10,
+       .throt_tab = {
+               {      0, 1000 },
+               { 640000, 1000 },
+               { 640000, 1000 },
+               { 640000, 1000 },
+               { 640000, 1000 },
+               { 640000, 1000 },
+               { 760000, 1000 },
+               { 760000, 1050 },
+               {1000000, 1050 },
+               {1000000, 1100 },
+       },
+};
 
 static struct nct1008_platform_data cardhu_nct1008_pdata = {
        .supported_hwrev = true,
        .ext_range = true,
        .conv_rate = 0x08,
        .offset = 8, /* 4 * 2C. Bug 844025 - 1C for device accuracies */
-       .probe_callback = nct1008_probe_callback,
+       .shutdown_ext_limit = 90, /* C */
+       .shutdown_local_limit = 100, /* C */
+
+       /* Thermal Throttling */
+       .passive = {
+               .create_cdev = (struct thermal_cooling_device *(*)(void *))
+                               balanced_throttle_register,
+               .cdev_data = &tj_throttle,
+               .trip_temp = 85000,
+               .tc1 = 0,
+               .tc2 = 1,
+               .passive_delay = 2000,
+       }
 };
 
 static struct i2c_board_info cardhu_i2c4_bq27510_board_info[] = {
@@ -930,7 +810,8 @@ static int cardhu_nct1008_init(void)
                (board_info.board_id == BOARD_E1257) ||
                (board_info.board_id == BOARD_PM269) ||
                (board_info.board_id == BOARD_PM305) ||
-               (board_info.board_id == BOARD_PM311)) {
+               (board_info.board_id == BOARD_PM311) ||
+               (board_info.board_id == BOARD_PM315)) {
                nct1008_port = TEGRA_GPIO_PCC2;
        } else if ((board_info.board_id == BOARD_E1186) ||
                (board_info.board_id == BOARD_E1187) ||
@@ -940,6 +821,29 @@ static int cardhu_nct1008_init(void)
        }
 
        if (nct1008_port >= 0) {
+#ifdef CONFIG_TEGRA_EDP_LIMITS
+               const struct tegra_edp_limits *cpu_edp_limits;
+               int cpu_edp_limits_size;
+               int i;
+
+               /* edp capping */
+               tegra_get_cpu_edp_limits(&cpu_edp_limits, &cpu_edp_limits_size);
+
+               if (cpu_edp_limits_size > MAX_THROT_TABLE_SIZE)
+                       BUG();
+
+               for (i = 0; i < cpu_edp_limits_size-1; i++) {
+                       cardhu_nct1008_pdata.active[i].create_cdev =
+                               (struct thermal_cooling_device *(*)(void *))
+                                       edp_cooling_device_create;
+                       cardhu_nct1008_pdata.active[i].cdev_data = (void *)i;
+                       cardhu_nct1008_pdata.active[i].trip_temp =
+                               cpu_edp_limits[i].temperature * 1000;
+                       cardhu_nct1008_pdata.active[i].hysteresis = 1000;
+               }
+               cardhu_nct1008_pdata.active[i].create_cdev = NULL;
+#endif
+
                /* FIXME: enable irq when throttling is supported */
                cardhu_i2c4_nct1008_board_info[0].irq = gpio_to_irq(nct1008_port);
 
@@ -952,6 +856,9 @@ static int cardhu_nct1008_init(void)
                        gpio_free(nct1008_port);
        }
 
+       i2c_register_board_info(4, cardhu_i2c4_nct1008_board_info,
+               ARRAY_SIZE(cardhu_i2c4_nct1008_board_info));
+
        return ret;
 }
 
@@ -1095,34 +1002,22 @@ static int __init cam_tca6416_init(void)
 #endif
 
 /* MPU board file definition   */
-#if (MPU_GYRO_TYPE == MPU_TYPE_MPU3050)
-#define MPU_GYRO_NAME          "mpu3050"
-#endif
-#if (MPU_GYRO_TYPE == MPU_TYPE_MPU6050)
-#define MPU_GYRO_NAME          "mpu6050"
-#endif
 static struct mpu_platform_data mpu_gyro_data = {
        .int_config     = 0x10,
        .level_shifter  = 0,
        .orientation    = MPU_GYRO_ORIENTATION, /* Located in board_[platformname].h    */
+       .sec_slave_type = SECONDARY_SLAVE_TYPE_ACCEL,
+       .sec_slave_id   = ACCEL_ID_KXTF9,
+       .secondary_i2c_addr     = MPU_ACCEL_ADDR,
+       .secondary_read_reg     = 0x06,
+       .secondary_orientation  = MPU_ACCEL_ORIENTATION,
+       .key            = {0x4E, 0xCC, 0x7E, 0xEB, 0xF6, 0x1E, 0x35, 0x22,
+                          0x00, 0x34, 0x0D, 0x65, 0x32, 0xE9, 0x94, 0x89},
 };
 
-#if (MPU_GYRO_TYPE == MPU_TYPE_MPU3050)
-static struct ext_slave_platform_data mpu_accel_data = {
-       .address        = MPU_ACCEL_ADDR,
-       .irq            = 0,
-       .adapt_num      = MPU_ACCEL_BUS_NUM,
-       .bus            = EXT_SLAVE_BUS_SECONDARY,
-       .orientation    = MPU_ACCEL_ORIENTATION,        /* Located in board_[platformname].h    */
-};
-#endif
-
-static struct ext_slave_platform_data mpu_compass_data = {
-       .address        = MPU_COMPASS_ADDR,
-       .irq            = 0,
-       .adapt_num      = MPU_COMPASS_BUS_NUM,
-       .bus            = EXT_SLAVE_BUS_PRIMARY,
-       .orientation    = MPU_COMPASS_ORIENTATION,      /* Located in board_[platformname].h    */
+static struct mpu_platform_data mpu_compass_data = {
+       .orientation    = MPU_COMPASS_ORIENTATION,
+       .sec_slave_type = SECONDARY_SLAVE_TYPE_NONE,
 };
 
 static struct i2c_board_info __initdata inv_mpu_i2c2_board_info[] = {
@@ -1130,12 +1025,9 @@ static struct i2c_board_info __initdata inv_mpu_i2c2_board_info[] = {
                I2C_BOARD_INFO(MPU_GYRO_NAME, MPU_GYRO_ADDR),
                .platform_data = &mpu_gyro_data,
        },
-#if (MPU_GYRO_TYPE == MPU_TYPE_MPU3050)
        {
                I2C_BOARD_INFO(MPU_ACCEL_NAME, MPU_ACCEL_ADDR),
-               .platform_data = &mpu_accel_data,
        },
-#endif
        {
                I2C_BOARD_INFO(MPU_COMPASS_NAME, MPU_COMPASS_ADDR),
                .platform_data = &mpu_compass_data,
@@ -1149,7 +1041,6 @@ static void mpuirq_init(void)
 
        pr_info("*** MPU START *** mpuirq_init...\n");
 
-#if (MPU_GYRO_TYPE == MPU_TYPE_MPU3050)
 #if    MPU_ACCEL_IRQ_GPIO
        /* ACCEL-IRQ assignment */
        ret = gpio_request(MPU_ACCEL_IRQ_GPIO, MPU_ACCEL_NAME);
@@ -1165,7 +1056,6 @@ static void mpuirq_init(void)
                return;
        }
 #endif
-#endif
 
        /* MPU-IRQ assignment */
        ret = gpio_request(MPU_GYRO_IRQ_GPIO, MPU_GYRO_NAME);
@@ -1183,12 +1073,10 @@ static void mpuirq_init(void)
        pr_info("*** MPU END *** mpuirq_init...\n");
 
        inv_mpu_i2c2_board_info[i++].irq = gpio_to_irq(MPU_GYRO_IRQ_GPIO);
-#if (MPU_GYRO_TYPE == MPU_TYPE_MPU3050)
 #if MPU_ACCEL_IRQ_GPIO
        inv_mpu_i2c2_board_info[i].irq = gpio_to_irq(MPU_ACCEL_IRQ_GPIO);
 #endif
        i++;
-#endif
 #if MPU_COMPASS_IRQ_GPIO
        inv_mpu_i2c2_board_info[i++].irq = gpio_to_irq(MPU_COMPAS_IRQ_GPIO);
 #endif
@@ -1217,11 +1105,6 @@ int __init cardhu_sensors_init(void)
        cardhu_camera_init();
        cam_tca6416_init();
 
-#ifdef CONFIG_VIDEO_IMX091
-       i2c_register_board_info(2, cardhu_i2c_board_info_e1244,
-               ARRAY_SIZE(cardhu_i2c_board_info_e1244));
-#endif
-
        i2c_register_board_info(2, cardhu_i2c3_board_info,
                ARRAY_SIZE(cardhu_i2c3_board_info));
 
@@ -1269,7 +1152,7 @@ int __init cardhu_sensors_init(void)
        if (board_info.sku == BOARD_SKU_B11)
                i2c_register_board_info(2, cardhu_i2c2_ltr_board_info,
                        ARRAY_SIZE(cardhu_i2c2_ltr_board_info));
-       else
+       else if (board_info.board_id != BOARD_PM315)
                i2c_register_board_info(2, cardhu_i2c2_isl_board_info,
                        ARRAY_SIZE(cardhu_i2c2_isl_board_info));
 
@@ -1325,19 +1208,20 @@ int __init cardhu_ov5650_late_init(void)
                return 0;
 
        if ((board_info.board_id == BOARD_E1198) ||
-               (board_info.board_id == BOARD_E1291))
+               (board_info.board_id == BOARD_E1291) ||
+               (board_info.board_id == BOARD_PM315))
                return 0;
 
-       printk("%s: \n", __func__);
+       printk(KERN_INFO "%s:\n", __func__);
        for (i = 0; i < ARRAY_SIZE(ov5650_gpio_keys); i++) {
                ret = gpio_request(ov5650_gpio_keys[i].gpio,
                        ov5650_gpio_keys[i].name);
                if (ret < 0) {
-                       printk("%s: gpio_request failed for gpio #%d\n",
+                       printk(KERN_INFO "%s: gpio_request failed for gpio #%d\n",
                                __func__, i);
                        goto fail;
                }
-               printk("%s: enable - %d\n", __func__, i);
+               printk(KERN_INFO "%s: enable - %d\n", __func__, i);
                gpio_direction_output(ov5650_gpio_keys[i].gpio,
                        ov5650_gpio_keys[i].enabled);
                gpio_export(ov5650_gpio_keys[i].gpio, false);