arm: tegra: cardhu: add support for PM315
[linux-2.6.git] / arch / arm / mach-tegra / board-cardhu-sensors.c
index d4515a7..d90802d 100644 (file)
 #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"
 #include "board-cardhu.h"
 #include "cpu-tegra.h"
+#include "devices.h"
 
 static struct regulator *cardhu_1v8_cam1 = NULL;
 static struct regulator *cardhu_1v8_cam2 = NULL;
@@ -88,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",
@@ -132,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));
@@ -153,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));
@@ -164,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);
@@ -194,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);
@@ -273,7 +278,7 @@ static struct i2c_board_info cardhu_i2c_board_info_e1214[] = {
 };
 #endif
 
-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);
@@ -281,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));
@@ -301,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));
@@ -334,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);
@@ -342,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);
@@ -363,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);
@@ -382,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));
@@ -401,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));
@@ -438,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);
@@ -446,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);
@@ -465,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);
@@ -473,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);
@@ -481,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));
@@ -493,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));
@@ -518,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);
@@ -526,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);
@@ -738,100 +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_get_temp_low(void *_data, long *temp)
-{
-       struct nct1008_data *data = _data;
-       return nct1008_thermal_get_temp_low(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);
-}
-
-static int nct_set_shutdown_temp(void *_data, long shutdown_temp)
-{
-       struct nct1008_data *data = _data;
-       return nct1008_thermal_set_shutdown_temp(data, shutdown_temp);
-}
-
-#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->offset = TDIODE_OFFSET;
-       ext_nct->get_temp = nct_get_temp;
-       ext_nct->get_temp_low = nct_get_temp_low;
-       ext_nct->set_limits = nct_set_limits;
-       ext_nct->set_alert = nct_set_alert;
-       ext_nct->set_shutdown_temp = nct_set_shutdown_temp;
-
-       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[] = {
@@ -858,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) ||
@@ -868,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);
 
@@ -880,9 +856,91 @@ 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;
 }
 
+#ifdef CONFIG_TEGRA_SKIN_THROTTLE
+static int tegra_skin_match(struct thermal_zone_device *thz, void *data)
+{
+       return strcmp((char *)data, thz->type) == 0;
+}
+
+static int tegra_skin_get_temp(void *data, long *temp)
+{
+       struct thermal_zone_device *thz;
+
+       thz = thermal_zone_device_find(data, tegra_skin_match);
+
+       if (!thz || thz->ops->get_temp(thz, temp))
+               *temp = 25000;
+
+       return 0;
+}
+
+static struct therm_est_data skin_data = {
+       .toffset = 9793,
+       .polling_period = 1100,
+       .ndevs = 2,
+       .devs = {
+                       {
+                               .dev_data = "nct_ext",
+                               .get_temp = tegra_skin_get_temp,
+                               .coeffs = {
+                                       2, 1, 1, 1,
+                                       1, 1, 1, 1,
+                                       1, 1, 1, 0,
+                                       1, 1, 0, 0,
+                                       0, 0, -1, -7
+                               },
+                       },
+                       {
+                               .dev_data = "nct_int",
+                               .get_temp = tegra_skin_get_temp,
+                               .coeffs = {
+                                       -11, -7, -5, -3,
+                                       -3, -2, -1, 0,
+                                       0, 0, 1, 1,
+                                       1, 2, 2, 3,
+                                       4, 6, 11, 18
+                               },
+                       },
+       },
+       .trip_temp = 43000,
+       .tc1 = 1,
+       .tc2 = 15,
+       .passive_delay = 15000,
+};
+
+static struct balanced_throttle skin_throttle = {
+       .throt_tab_size = 6,
+       .throt_tab = {
+               { 640000, 1200 },
+               { 640000, 1200 },
+               { 760000, 1200 },
+               { 760000, 1200 },
+               {1000000, 1200 },
+               {1000000, 1200 },
+       },
+};
+
+static int __init cardhu_skin_init(void)
+{
+       struct thermal_cooling_device *skin_cdev;
+
+       skin_cdev = balanced_throttle_register(&skin_throttle);
+
+       skin_data.cdev = skin_cdev;
+       tegra_skin_therm_est_device.dev.platform_data = &skin_data;
+       platform_device_register(&tegra_skin_therm_est_device);
+
+       return 0;
+}
+late_initcall(cardhu_skin_init);
+#endif
+
 #if defined(CONFIG_GPIO_PCA953X)
 static struct pca953x_platform_data cardhu_pmu_tca6416_data = {
        .gpio_base      = PMU_TCA6416_GPIO_BASE,
@@ -944,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[] = {
@@ -979,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,
@@ -998,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);
@@ -1014,7 +1056,6 @@ static void mpuirq_init(void)
                return;
        }
 #endif
-#endif
 
        /* MPU-IRQ assignment */
        ret = gpio_request(MPU_GYRO_IRQ_GPIO, MPU_GYRO_NAME);
@@ -1032,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
@@ -1113,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));
 
@@ -1169,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);