msm: camera: Add i2c mux support for native 3D camera

Signed-off-by: Nishant Pandit <npandit@codeaurora.org>
diff --git a/arch/arm/mach-msm/board-msm8960.c b/arch/arm/mach-msm/board-msm8960.c
index 87896df..4c29fd3 100644
--- a/arch/arm/mach-msm/board-msm8960.c
+++ b/arch/arm/mach-msm/board-msm8960.c
@@ -475,7 +475,7 @@
 		},
 	},
 };
-static struct gpiomux_setting cam_settings[4] = {
+static struct gpiomux_setting cam_settings[] = {
 	{
 		.func = GPIOMUX_FUNC_GPIO, /*suspend*/
 		.drv = GPIOMUX_DRV_2MA,
@@ -499,9 +499,34 @@
 		.drv = GPIOMUX_DRV_8MA,
 		.pull = GPIOMUX_PULL_UP,
 	},
+
+	{
+		.func = GPIOMUX_FUNC_5, /*active 4*/
+		.drv = GPIOMUX_DRV_8MA,
+		.pull = GPIOMUX_PULL_UP,
+	},
+
+	{
+		.func = GPIOMUX_FUNC_6, /*active 5*/
+		.drv = GPIOMUX_DRV_8MA,
+		.pull = GPIOMUX_PULL_UP,
+	},
+
+	{
+		.func = GPIOMUX_FUNC_2, /*active 6*/
+		.drv = GPIOMUX_DRV_2MA,
+		.pull = GPIOMUX_PULL_UP,
+	},
+
+	{
+		.func = GPIOMUX_FUNC_3, /*active 7*/
+		.drv = GPIOMUX_DRV_8MA,
+		.pull = GPIOMUX_PULL_UP,
+	},
+
 };
 
-static struct msm_gpiomux_config msm8960_cam_configs[] = {
+static struct msm_gpiomux_config msm8960_cam_common_configs[] = {
 	{
 		.gpio = 2,
 		.settings = {
@@ -531,6 +556,23 @@
 		},
 	},
 	{
+		.gpio = 76,
+		.settings = {
+			[GPIOMUX_ACTIVE]    = &cam_settings[2],
+			[GPIOMUX_SUSPENDED] = &cam_settings[0],
+		},
+	},
+	{
+		.gpio = 107,
+		.settings = {
+			[GPIOMUX_ACTIVE]    = &cam_settings[2],
+			[GPIOMUX_SUSPENDED] = &cam_settings[0],
+		},
+	},
+};
+
+static struct msm_gpiomux_config msm8960_cam_2d_configs[] = {
+	{
 		.gpio = 18,
 		.settings = {
 			[GPIOMUX_ACTIVE]    = &cam_settings[3],
@@ -558,20 +600,6 @@
 			[GPIOMUX_SUSPENDED] = &cam_settings[0],
 		},
 	},
-	{
-		.gpio = 76,
-		.settings = {
-			[GPIOMUX_ACTIVE]    = &cam_settings[2],
-			[GPIOMUX_SUSPENDED] = &cam_settings[0],
-		},
-	},
-	{
-		.gpio = 107,
-		.settings = {
-			[GPIOMUX_ACTIVE]    = &cam_settings[2],
-			[GPIOMUX_SUSPENDED] = &cam_settings[0],
-		},
-	},
 };
 
 static struct gpiomux_setting cyts_resout_sus_cfg = {
@@ -892,12 +920,19 @@
 
 #ifdef CONFIG_MSM_CAMERA
 
-static uint16_t msm_cam_gpio_tbl[] = {
+static uint16_t msm_cam_gpio_2d_tbl[] = {
 	5, /*CAMIF_MCLK*/
 	20, /*CAMIF_I2C_DATA*/
 	21, /*CAMIF_I2C_CLK*/
 };
 
+static struct msm_camera_gpio_conf gpio_conf = {
+	.cam_gpiomux_conf_tbl = msm8960_cam_2d_configs,
+	.cam_gpiomux_conf_tbl_size = ARRAY_SIZE(msm8960_cam_2d_configs),
+	.cam_gpio_tbl = msm_cam_gpio_2d_tbl,
+	.cam_gpio_tbl_size = ARRAY_SIZE(msm_cam_gpio_2d_tbl),
+};
+
 #define VFE_CAMIF_TIMER1_GPIO 2
 #define VFE_CAMIF_TIMER2_GPIO 3
 #define VFE_CAMIF_TIMER3_GPIO_INT 4
@@ -921,26 +956,17 @@
 };
 #endif
 
-#ifdef CONFIG_IMX074
-static struct msm_camera_sensor_platform_info sensor_board_info = {
-	.mount_angle = 90
-};
-#endif
-
-struct msm_camera_device_platform_data msm_camera_csi0_device_data = {
-	.ioclk.mclk_clk_rate = 24000000,
-	.ioclk.vfe_clk_rate  = 228570000,
-	.csid_core = 0,
-	.cam_gpio_tbl = msm_cam_gpio_tbl,
-	.cam_gpio_tbl_size = ARRAY_SIZE(msm_cam_gpio_tbl),
-};
-
-struct msm_camera_device_platform_data msm_camera_csi1_device_data = {
-	.ioclk.mclk_clk_rate = 24000000,
-	.ioclk.vfe_clk_rate  = 228570000,
-	.csid_core = 1,
-	.cam_gpio_tbl = msm_cam_gpio_tbl,
-	.cam_gpio_tbl_size = ARRAY_SIZE(msm_cam_gpio_tbl),
+struct msm_camera_device_platform_data msm_camera_csi_device_data[] = {
+	{
+		.ioclk.mclk_clk_rate = 24000000,
+		.ioclk.vfe_clk_rate  = 228570000,
+		.csid_core = 0,
+	},
+	{
+		.ioclk.mclk_clk_rate = 24000000,
+		.ioclk.vfe_clk_rate  = 228570000,
+		.csid_core = 1,
+	},
 };
 
 #ifdef CONFIG_IMX074
@@ -951,17 +977,23 @@
 #endif
 };
 
-static struct msm_camera_sensor_info msm_camera_sensor_imx074_data = {
-	.sensor_name	= "imx074",
+static struct msm_camera_sensor_platform_info sensor_board_info_imx074 = {
+	.mount_angle	= 90,
 	.sensor_reset	= 107,
 	.sensor_pwd	= 85,
 	.vcm_pwd	= 0,
 	.vcm_enable	= 1,
-	.pdata	= &msm_camera_csi0_device_data,
+};
+
+static struct msm_camera_sensor_info msm_camera_sensor_imx074_data = {
+	.sensor_name	= "imx074",
+	.pdata	= &msm_camera_csi_device_data[0],
 	.flash_data	= &flash_imx074,
 	.strobe_flash_data = &strobe_flash_xenon,
-	.sensor_platform_info = &sensor_board_info,
-	.csi_if	= 1
+	.sensor_platform_info = &sensor_board_info_imx074,
+	.gpio_conf = &gpio_conf,
+	.csi_if	= 1,
+	.camera_type = BACK_CAMERA_2D,
 };
 
 struct platform_device msm8960_camera_sensor_imx074 = {
@@ -976,15 +1008,22 @@
 	.flash_type	= MSM_CAMERA_FLASH_NONE,
 };
 
-static struct msm_camera_sensor_info msm_camera_sensor_ov2720_data = {
-	.sensor_name	= "ov2720",
+static struct msm_camera_sensor_platform_info sensor_board_info_ov2720 = {
+	.mount_angle	= 0,
 	.sensor_reset	= 76,
 	.sensor_pwd	= 85,
 	.vcm_pwd	= 0,
 	.vcm_enable	= 1,
-	.pdata	= &msm_camera_csi1_device_data,
+};
+
+static struct msm_camera_sensor_info msm_camera_sensor_ov2720_data = {
+	.sensor_name	= "ov2720",
+	.pdata	= &msm_camera_csi_device_data[1],
 	.flash_data	= &flash_ov2720,
-	.csi_if	= 1
+	.sensor_platform_info = &sensor_board_info_ov2720,
+	.gpio_conf = &gpio_conf,
+	.csi_if	= 1,
+	.camera_type = FRONT_CAMERA_2D,
 };
 
 struct platform_device msm8960_camera_sensor_ov2720 = {
@@ -999,16 +1038,22 @@
 	.flash_type	= MSM_CAMERA_FLASH_LED,
 };
 
-static struct msm_camera_sensor_info msm_camera_sensor_qs_mt9p017_data = {
-	.sensor_name	= "qs_mt9p017",
+static struct msm_camera_sensor_platform_info sensor_board_info_qs_mt9p017 = {
+	.mount_angle	= 270,
 	.sensor_reset	= 107,
 	.sensor_pwd	= 85,
 	.vcm_pwd	= 0,
 	.vcm_enable	= 1,
-	.pdata	= &msm_camera_csi0_device_data,
+};
+
+static struct msm_camera_sensor_info msm_camera_sensor_qs_mt9p017_data = {
+	.sensor_name	= "qs_mt9p017",
+	.pdata	= &msm_camera_csi_device_data[0],
 	.flash_data	= &flash_qs_mt9p017,
-	.sensor_platform_info = &sensor_board_info,
-	.csi_if	= 1
+	.sensor_platform_info = &sensor_board_info_qs_mt9p017,
+	.gpio_conf = &gpio_conf,
+	.csi_if	= 1,
+	.camera_type = BACK_CAMERA_3D,
 };
 
 struct platform_device msm8960_camera_sensor_qs_mt9p017 = {
@@ -2085,8 +2130,8 @@
 		return rc;
 	}
 
-	msm_gpiomux_install(msm8960_cam_configs,
-			ARRAY_SIZE(msm8960_cam_configs));
+	msm_gpiomux_install(msm8960_cam_common_configs,
+			ARRAY_SIZE(msm8960_cam_common_configs));
 
 	msm_gpiomux_install(msm8960_gpiomux_configs,
 			ARRAY_SIZE(msm8960_gpiomux_configs));