msm: camera: Camera sensor bringup on 8930 EVT SGLTE

ov8825 & ov9724 sensor drivers added on 8930 EVT

Change-Id: I10f2fe984e2dba70d3f027f1aff39b41a01aed3c
Signed-off-by: Raju P.L.S.S.S.N <rplsssn@codeaurora.org>
diff --git a/arch/arm/mach-msm/board-8930-camera.c b/arch/arm/mach-msm/board-8930-camera.c
index ea4215a..6192cc4 100644
--- a/arch/arm/mach-msm/board-8930-camera.c
+++ b/arch/arm/mach-msm/board-8930-camera.c
@@ -13,6 +13,7 @@
 
 #include <asm/mach-types.h>
 #include <linux/gpio.h>
+#include <mach/socinfo.h>
 #include <mach/camera.h>
 #include <mach/msm_bus_board.h>
 #include <mach/gpiomux.h>
@@ -154,6 +155,16 @@
 	},
 };
 
+static struct msm_gpiomux_config msm8930_evt_cam_configs[] = {
+	{
+		.gpio = 75,
+		.settings = {
+			[GPIOMUX_ACTIVE]    = &cam_settings[2],
+			[GPIOMUX_SUSPENDED] = &cam_settings[0],
+		},
+	},
+};
+
 static struct msm_gpiomux_config msm8930_cam_2d_configs[] = {
 	{
 		.gpio = 18,
@@ -185,6 +196,23 @@
 	},
 };
 
+static struct msm_gpiomux_config msm8930_evt_cam_2d_configs[] = {
+	{
+		.gpio = 36,
+		.settings = {
+			[GPIOMUX_ACTIVE]    = &cam_settings[3],
+			[GPIOMUX_SUSPENDED] = &cam_settings[8],
+		},
+	},
+	{
+		.gpio = 37,
+		.settings = {
+			[GPIOMUX_ACTIVE]    = &cam_settings[3],
+			[GPIOMUX_SUSPENDED] = &cam_settings[8],
+		},
+	},
+};
+
 #define VFE_CAMIF_TIMER1_GPIO 2
 #define VFE_CAMIF_TIMER2_GPIO 3
 #define VFE_CAMIF_TIMER3_GPIO_INT 4
@@ -203,6 +231,12 @@
 	._fsrc.ext_driver_src.led_flash_en = VFE_CAMIF_TIMER2_GPIO,
 	._fsrc.ext_driver_src.flash_id = MAM_CAMERA_EXT_LED_FLASH_TPS61310,
 };
+
+static struct msm_camera_sensor_flash_src msm_flash_src_led = {
+	.flash_sr_type = MSM_CAMERA_FLASH_SRC_LED1,
+	._fsrc.ext_driver_src.led_en = VFE_CAMIF_TIMER1_GPIO,
+	._fsrc.ext_driver_src.led_flash_en = VFE_CAMIF_TIMER2_GPIO,
+};
 #endif
 
 static struct msm_bus_vectors cam_init_vectors[] = {
@@ -410,16 +444,34 @@
 	{"cam_vaf", REG_LDO, 2800000, 2850000, 300000},
 };
 
+static struct camera_vreg_t msm_8930_evt_cam_vreg[] = {
+	{"cam_vdig", REG_LDO, 1500000, 1500000, 105000},
+	{"cam_vio", REG_VS, 0, 0, 0},
+	{"cam_vana", REG_LDO, 2800000, 2850000, 85600},
+	{"cam_vaf", REG_LDO, 2800000, 2850000, 300000},
+};
+
 static struct gpio msm8930_common_cam_gpio[] = {
 	{20, GPIOF_DIR_IN, "CAMIF_I2C_DATA"},
 	{21, GPIOF_DIR_IN, "CAMIF_I2C_CLK"},
 };
 
+static struct gpio msm8930_evt_common_cam_gpio[] = {
+	{36, GPIOF_DIR_IN, "CAMIF_I2C_DATA"},
+	{37, GPIOF_DIR_IN, "CAMIF_I2C_CLK"},
+};
+
 static struct gpio msm8930_front_cam_gpio[] = {
 	{4, GPIOF_DIR_IN, "CAMIF_MCLK"},
 	{76, GPIOF_DIR_OUT, "CAM_RESET"},
 };
 
+static struct gpio msm8930_evt_front_cam_gpio[] = {
+	{4, GPIOF_DIR_IN, "CAMIF_MCLK"},
+	{76, GPIOF_DIR_OUT, "CAM_RESET"},
+	{75, GPIOF_DIR_OUT, "CAM_STBY_N"},
+};
+
 static struct gpio msm8930_back_cam_gpio[] = {
 	{5, GPIOF_DIR_IN, "CAMIF_MCLK"},
 	{107, GPIOF_DIR_OUT, "CAM_RESET"},
@@ -431,6 +483,13 @@
 	{76, GPIOF_OUT_INIT_HIGH, 4000},
 };
 
+static struct msm_gpio_set_tbl msm8930_evt_front_cam_gpio_set_tbl[] = {
+	{75, GPIOF_OUT_INIT_LOW, 1000},
+	{75, GPIOF_OUT_INIT_HIGH, 4000},
+	{76, GPIOF_OUT_INIT_LOW, 1000},
+	{76, GPIOF_OUT_INIT_HIGH, 4000},
+};
+
 static struct msm_gpio_set_tbl msm8930_back_cam_gpio_set_tbl[] = {
 	{54, GPIOF_OUT_INIT_LOW, 1000},
 	{54, GPIOF_OUT_INIT_HIGH, 4000},
@@ -449,6 +508,17 @@
 	.cam_gpio_set_tbl_size = ARRAY_SIZE(msm8930_front_cam_gpio_set_tbl),
 };
 
+static struct msm_camera_gpio_conf msm_8930_evt__front_cam_gpio_conf = {
+	.cam_gpiomux_conf_tbl = msm8930_evt_cam_2d_configs,
+	.cam_gpiomux_conf_tbl_size = ARRAY_SIZE(msm8930_evt_cam_2d_configs),
+	.cam_gpio_common_tbl = msm8930_evt_common_cam_gpio,
+	.cam_gpio_common_tbl_size = ARRAY_SIZE(msm8930_evt_common_cam_gpio),
+	.cam_gpio_req_tbl = msm8930_evt_front_cam_gpio,
+	.cam_gpio_req_tbl_size = ARRAY_SIZE(msm8930_evt_front_cam_gpio),
+	.cam_gpio_set_tbl = msm8930_evt_front_cam_gpio_set_tbl,
+	.cam_gpio_set_tbl_size = ARRAY_SIZE(msm8930_evt_front_cam_gpio_set_tbl),
+};
+
 static struct msm_camera_gpio_conf msm_8930_back_cam_gpio_conf = {
 	.cam_gpiomux_conf_tbl = msm8930_cam_2d_configs,
 	.cam_gpiomux_conf_tbl_size = ARRAY_SIZE(msm8930_cam_2d_configs),
@@ -460,10 +530,89 @@
 	.cam_gpio_set_tbl_size = ARRAY_SIZE(msm8930_back_cam_gpio_set_tbl),
 };
 
+static struct msm_camera_gpio_conf msm_8930_evt_back_cam_gpio_conf = {
+	.cam_gpiomux_conf_tbl = msm8930_evt_cam_2d_configs,
+	.cam_gpiomux_conf_tbl_size = ARRAY_SIZE(msm8930_evt_cam_2d_configs),
+	.cam_gpio_common_tbl = msm8930_evt_common_cam_gpio,
+	.cam_gpio_common_tbl_size = ARRAY_SIZE(msm8930_evt_common_cam_gpio),
+	.cam_gpio_req_tbl = msm8930_back_cam_gpio,
+	.cam_gpio_req_tbl_size = ARRAY_SIZE(msm8930_back_cam_gpio),
+	.cam_gpio_set_tbl = msm8930_back_cam_gpio_set_tbl,
+	.cam_gpio_set_tbl_size = ARRAY_SIZE(msm8930_back_cam_gpio_set_tbl),
+};
+
 static struct i2c_board_info msm_act_main_cam_i2c_info = {
 	I2C_BOARD_INFO("msm_actuator", 0x11),
 };
 
+static struct msm_actuator_info msm_act_main_cam_3_info = {
+	.board_info     = &msm_act_main_cam_i2c_info,
+	.cam_name       = MSM_ACTUATOR_MAIN_CAM_3,
+	/* bus_id GSBI8 is specific to 8930 sglte evt */
+	.bus_id         = MSM_8930_GSBI8_QUP_I2C_BUS_ID,
+	.vcm_pwd        = 0,
+	.vcm_enable     = 0,
+};
+
+
+static struct msm_camera_sensor_flash_data flash_ov8825 = {
+	.flash_type = MSM_CAMERA_FLASH_LED,
+#ifdef CONFIG_MSM_CAMERA_FLASH
+	.flash_src	= &msm_flash_src_led
+#endif
+};
+
+static struct msm_camera_csi_lane_params ov8825_csi_lane_params = {
+	.csi_lane_assign = 0xE4,
+	.csi_lane_mask = 0x3,
+};
+
+static struct msm_camera_sensor_platform_info sensor_board_info_ov8825 = {
+	.mount_angle = 90,
+	.cam_vreg = msm_8930_evt_cam_vreg,
+	.num_vreg = ARRAY_SIZE(msm_8930_evt_cam_vreg),
+	.gpio_conf = &msm_8930_evt_back_cam_gpio_conf,
+	.csi_lane_params = &ov8825_csi_lane_params,
+};
+
+static struct msm_camera_sensor_info msm_camera_sensor_ov8825_data = {
+	.sensor_name = "ov8825",
+	.pdata = &msm_camera_csi_device_data[0],
+	.flash_data = &flash_ov8825,
+	.sensor_platform_info = &sensor_board_info_ov8825,
+	.csi_if = 1,
+	.camera_type = BACK_CAMERA_2D,
+	.sensor_type = BAYER_SENSOR,
+	.actuator_info = &msm_act_main_cam_3_info,
+};
+
+static struct msm_camera_sensor_flash_data flash_ov9724 = {
+	.flash_type = MSM_CAMERA_FLASH_NONE
+};
+
+static struct msm_camera_csi_lane_params ov9724_csi_lane_params = {
+	.csi_lane_assign = 0xE4,
+	.csi_lane_mask = 0x1,
+};
+
+static struct msm_camera_sensor_platform_info sensor_board_info_ov9724 = {
+	.mount_angle = 90,
+	.cam_vreg = msm_8930_evt_cam_vreg,
+	.num_vreg = ARRAY_SIZE(msm_8930_evt_cam_vreg),
+	.gpio_conf = &msm_8930_evt__front_cam_gpio_conf,
+	.csi_lane_params = &ov9724_csi_lane_params,
+};
+
+static struct msm_camera_sensor_info msm_camera_sensor_ov9724_data = {
+	.sensor_name = "ov9724",
+	.pdata = &msm_camera_csi_device_data[1],
+	.flash_data = &flash_ov9724,
+	.sensor_platform_info = &sensor_board_info_ov9724,
+	.csi_if = 1,
+	.camera_type = FRONT_CAMERA_2D,
+	.sensor_type = BAYER_SENSOR,
+};
+
 static struct msm_actuator_info msm_act_main_cam_0_info = {
 	.board_info     = &msm_act_main_cam_i2c_info,
 	.cam_name   = MSM_ACTUATOR_MAIN_CAM_0,
@@ -605,6 +754,13 @@
 	msm_gpiomux_install(msm8930_cam_common_configs,
 			ARRAY_SIZE(msm8930_cam_common_configs));
 
+	if (machine_is_msm8930_evt() &&
+			(socinfo_get_platform_subtype() ==
+			 PLATFORM_SUBTYPE_SGLTE)) {
+		msm_gpiomux_install(msm8930_evt_cam_configs,
+				ARRAY_SIZE(msm8930_evt_cam_configs));
+	}
+
 	if (machine_is_msm8930_cdp()) {
 		struct msm_camera_sensor_info *s_info;
 		s_info = &msm_camera_sensor_s5k3l1yx_data;
@@ -652,6 +808,14 @@
 	{
 	I2C_BOARD_INFO("tps61310", 0x66),
 	},
+	{
+	I2C_BOARD_INFO("ov8825", 0x6c>>1),
+	.platform_data = &msm_camera_sensor_ov8825_data,
+	},
+	{
+	I2C_BOARD_INFO("ov9724", 0x20>>1),
+	.platform_data = &msm_camera_sensor_ov9724_data,
+	},
 };
 
 struct msm_camera_board_info msm8930_camera_board_info = {
diff --git a/arch/arm/mach-msm/board-8930-regulator-pm8038.c b/arch/arm/mach-msm/board-8930-regulator-pm8038.c
index 0203db4..00af565 100644
--- a/arch/arm/mach-msm/board-8930-regulator-pm8038.c
+++ b/arch/arm/mach-msm/board-8930-regulator-pm8038.c
@@ -76,6 +76,19 @@
 	REGULATOR_SUPPLY("cam_vaf",		"4-0048"),
 	REGULATOR_SUPPLY("cam_vana",            "4-0020"),
 	REGULATOR_SUPPLY("cam_vaf",             "4-0020"),
+/* Regulators for 8930 QRD SGLTE EVT */
+	REGULATOR_SUPPLY("cam_vana",		"8-001a"),
+	REGULATOR_SUPPLY("cam_vana",		"8-006c"),
+	REGULATOR_SUPPLY("cam_vana",		"8-0048"),
+	REGULATOR_SUPPLY("cam_vana",		"8-0020"),
+	REGULATOR_SUPPLY("cam_vana",		"8-0036"),
+	REGULATOR_SUPPLY("cam_vana",		"8-0010"),
+	REGULATOR_SUPPLY("cam_vaf",		"8-001a"),
+	REGULATOR_SUPPLY("cam_vaf",		"8-006c"),
+	REGULATOR_SUPPLY("cam_vaf",		"8-0048"),
+	REGULATOR_SUPPLY("cam_vaf",		"8-0020"),
+	REGULATOR_SUPPLY("cam_vaf",		"8-0036"),
+	REGULATOR_SUPPLY("cam_vaf",		"8-0010"),
 	REGULATOR_SUPPLY("vdd",			"12-0018"),
 	REGULATOR_SUPPLY("vdd",			"12-0068"),
 };
@@ -103,7 +116,14 @@
 	REGULATOR_SUPPLY("cam_vdig",		"4-001a"),
 	REGULATOR_SUPPLY("cam_vdig",		"4-006c"),
 	REGULATOR_SUPPLY("cam_vdig",		"4-0048"),
-	REGULATOR_SUPPLY("cam_vdig",            "4-0020"),
+	REGULATOR_SUPPLY("cam_vdig",		"4-0020"),
+/* Regulators for 8930 QRD SGLTE EVT */
+	REGULATOR_SUPPLY("cam_vdig",		"8-001a"),
+	REGULATOR_SUPPLY("cam_vdig",		"8-006c"),
+	REGULATOR_SUPPLY("cam_vdig",		"8-0048"),
+	REGULATOR_SUPPLY("cam_vdig",		"8-0020"),
+	REGULATOR_SUPPLY("cam_vdig",		"8-0036"),
+	REGULATOR_SUPPLY("cam_vdig",		"8-0010"),
 };
 VREG_CONSUMERS(L13) = {
 	REGULATOR_SUPPLY("8038_l13",		NULL),
@@ -202,7 +222,14 @@
 	REGULATOR_SUPPLY("cam_vio",		"4-001a"),
 	REGULATOR_SUPPLY("cam_vio",		"4-006c"),
 	REGULATOR_SUPPLY("cam_vio",		"4-0048"),
-	REGULATOR_SUPPLY("cam_vio",             "4-0020"),
+	REGULATOR_SUPPLY("cam_vio",		"4-0020"),
+/* Regulators for 8930 QRD SGLTE EVT */
+	REGULATOR_SUPPLY("cam_vio",		"8-001a"),
+	REGULATOR_SUPPLY("cam_vio",		"8-006c"),
+	REGULATOR_SUPPLY("cam_vio",		"8-0048"),
+	REGULATOR_SUPPLY("cam_vio",		"8-0020"),
+	REGULATOR_SUPPLY("cam_vio",		"8-0036"),
+	REGULATOR_SUPPLY("cam_vio",		"8-0010"),
 };
 VREG_CONSUMERS(LVS2) = {
 	REGULATOR_SUPPLY("8038_lvs2",		NULL),
@@ -506,7 +533,7 @@
 	RPM_LDO(L9,	 0, 1, 0, 2850000, 2850000, NULL,      0, 0),
 	RPM_LDO(L10,	 0, 1, 0, 2900000, 2900000, NULL,      0, 0),
 	RPM_LDO(L11,	 1, 1, 0, 1800000, 1800000, "8038_s4", 10000, 10000),
-	RPM_LDO(L12,	 0, 1, 0, 1200000, 1200000, "8038_s2", 0, 0),
+	RPM_LDO(L12,	 0, 1, 0, 1200000, 1500000, "8038_s2", 0, 0),
 	RPM_LDO(L13,	 0, 0, 0, 2220000, 2220000, NULL,      0, 0),
 	RPM_LDO(L14,	 0, 1, 0, 1800000, 1800000, NULL,      0, 0),
 	RPM_LDO(L15,	 0, 1, 0, 1800000, 2950000, NULL,      0, 0),
diff --git a/arch/arm/mach-msm/board-8930.c b/arch/arm/mach-msm/board-8930.c
index 69e5288..624f8ea 100644
--- a/arch/arm/mach-msm/board-8930.c
+++ b/arch/arm/mach-msm/board-8930.c
@@ -2769,7 +2769,8 @@
 	int i;
 #ifdef CONFIG_MSM_CAMERA
 	struct i2c_registry msm8930_camera_i2c_devices = {
-		I2C_SURF | I2C_FFA | I2C_FLUID | I2C_LIQUID | I2C_RUMI,
+		I2C_SURF | I2C_FFA | I2C_FLUID | I2C_LIQUID | I2C_RUMI
+			| I2C_EVT,
 		MSM_8930_GSBI4_QUP_I2C_BUS_ID,
 		msm8930_camera_board_info.board_info,
 		msm8930_camera_board_info.num_i2c_board_info,
diff --git a/arch/arm/mach-msm/clock-8960.c b/arch/arm/mach-msm/clock-8960.c
index 7375f99..bb163ae 100755
--- a/arch/arm/mach-msm/clock-8960.c
+++ b/arch/arm/mach-msm/clock-8960.c
@@ -6054,7 +6054,7 @@
 	CLK_LOOKUP("core_clk",		gsbi5_qup_clk.c,	""),
 	CLK_LOOKUP("core_clk",		gsbi6_qup_clk.c,	""),
 	CLK_LOOKUP("core_clk",		gsbi7_qup_clk.c,	""),
-	CLK_LOOKUP("core_clk",		gsbi8_qup_clk.c,	""),
+	CLK_LOOKUP("core_clk",		gsbi8_qup_clk.c,	"qup_i2c.8"),
 	CLK_LOOKUP("core_clk",		gsbi9_qup_clk.c,	"qup_i2c.0"),
 	CLK_LOOKUP("core_clk",		gsbi10_qup_clk.c,	"qup_i2c.10"),
 	CLK_LOOKUP("core_clk",		gsbi11_qup_clk.c,	""),
@@ -6094,7 +6094,8 @@
 	CLK_LOOKUP("iface_clk",		gsbi5_p_clk.c,	"msm_serial_hsl.0"),
 	CLK_LOOKUP("iface_clk",		gsbi6_p_clk.c,  "msm_serial_hs.0"),
 	CLK_LOOKUP("iface_clk",		gsbi7_p_clk.c,		""),
-	CLK_LOOKUP("iface_clk",		gsbi8_p_clk.c,		""),
+	/* used on 8930 SGLTE for Camera */
+	CLK_LOOKUP("iface_clk",		gsbi8_p_clk.c,		"qup_i2c.8"),
 	/* used on 8930 SGLTE for Primary IPC */
 	CLK_LOOKUP("iface_clk",         gsbi9_p_clk.c,	"msm_serial_hs.1"),
 	CLK_LOOKUP("iface_clk",		gsbi9_p_clk.c,		"qup_i2c.0"),
@@ -6121,6 +6122,13 @@
 	CLK_LOOKUP("cam_clk",		cam1_clk.c,	"4-0048"),
 	CLK_LOOKUP("cam_clk",		cam2_clk.c,		NULL),
 	CLK_LOOKUP("cam_clk",		cam0_clk.c,	"4-0020"),
+	CLK_LOOKUP("cam_clk",		cam0_clk.c,	"8-001a"),
+	CLK_LOOKUP("cam_clk",		cam0_clk.c,	"8-0036"),
+	CLK_LOOKUP("cam_clk",		cam1_clk.c,	"8-006c"),
+	CLK_LOOKUP("cam_clk",		cam1_clk.c,	"8-0010"),
+	CLK_LOOKUP("cam_clk",		cam1_clk.c,	"8-0048"),
+	CLK_LOOKUP("cam_clk",		cam2_clk.c,		NULL),
+	CLK_LOOKUP("cam_clk",		cam0_clk.c,	"8-0020"),
 	CLK_LOOKUP("csi_src_clk",	csi0_src_clk.c,		"msm_csid.0"),
 	CLK_LOOKUP("csi_src_clk",	csi1_src_clk.c,		"msm_csid.1"),
 	CLK_LOOKUP("csi_src_clk",	csi2_src_clk.c,		"msm_csid.2"),
diff --git a/drivers/media/video/msm/Kconfig b/drivers/media/video/msm/Kconfig
index be9c43c..e08c673 100644
--- a/drivers/media/video/msm/Kconfig
+++ b/drivers/media/video/msm/Kconfig
@@ -217,6 +217,15 @@
 	  support.
 	  Say Y if the platform uses IMX135 sensor.
 
+config OV9724
+	bool "Sensor ov9724 (Omnivision 1.3M)"
+	depends on MSM_CAMERA
+	---help---
+	  Support for OV9724 sensor driver.
+	  It is a Bayer 1.3MP sensor with auto focus and it supports
+	  two mipi lanes, required for msm8625 platform.
+	  Say Y here if this is msm8625 variant platform.
+
 config VB6801
 	bool "Sensor vb6801"
 	depends on MSM_CAMERA && !ARCH_MSM8X60 && !MSM_CAMERA_V4L2
diff --git a/drivers/media/video/msm/sensors/Makefile b/drivers/media/video/msm/sensors/Makefile
index a70a632..25b1374 100644
--- a/drivers/media/video/msm/sensors/Makefile
+++ b/drivers/media/video/msm/sensors/Makefile
@@ -16,3 +16,4 @@
 obj-$(CONFIG_WEBCAM_OV9726) += ov9726_v4l2.o
 obj-$(CONFIG_OV7692) += ov7692_v4l2.o
 obj-$(CONFIG_VX6953) += vx6953.o
+obj-$(CONFIG_OV9724) += ov9724_v4l2.o
diff --git a/drivers/media/video/msm/sensors/ov8825_v4l2.c b/drivers/media/video/msm/sensors/ov8825_v4l2.c
index 5c717ad..eaf9baa 100644
--- a/drivers/media/video/msm/sensors/ov8825_v4l2.c
+++ b/drivers/media/video/msm/sensors/ov8825_v4l2.c
@@ -11,16 +11,37 @@
  *
  */
 
+#include <linux/module.h>
 #include "msm_sensor.h"
 #include "msm.h"
 #define SENSOR_NAME "ov8825"
 #define PLATFORM_DRIVER_NAME "msm_camera_ov8825"
 #define ov8825_obj ov8825_##obj
 
+#define OV8825_2LANES 1
+
+#ifdef CDBG
+#undef CDBG
+#endif
+#ifdef CDBG_HIGH
+#undef CDBG_HIGH
+#endif
+
+#define OV8825_DGB
+
+#ifdef OV8825_DGB
+#define CDBG printk
+#define CDBG_HIGH(fmt, args...) printk(fmt, ##args)
+#else
+#define CDBG printk
+#define CDBG_HIGH(fmt, args...) printk(fmt, ##args)
+#endif
+
+
 /* TO DO - Currently ov5647 typical values are used
  * Need to get the exact values */
-#define OV8825_RG_RATIO_TYPICAL_VALUE 64 /* R/G of typical camera module */
-#define OV8825_BG_RATIO_TYPICAL_VALUE 105 /* B/G of typical camera module */
+#define OV8825_RG_RATIO_TYPICAL_VALUE 0x51 /* R/G of typical camera module */
+#define OV8825_BG_RATIO_TYPICAL_VALUE 0x4e /* B/G of typical camera module */
 
 DEFINE_MUTEX(ov8825_mut);
 static struct msm_sensor_ctrl_t ov8825_s_ctrl;
@@ -34,6 +55,7 @@
 	uint8_t user_data[5];
 } st_ov8825_otp;
 
+
 static struct msm_camera_i2c_reg_conf ov8825_start_settings[] = {
 	{0x0100, 0x01},
 };
@@ -53,18 +75,27 @@
 
 static struct msm_camera_i2c_reg_conf ov8825_prev_settings[] = {
 	{0x3003, 0xce}, /*PLL_CTRL0*/
+#if OV8825_2LANES
 	{0x3004, 0xd4}, /*PLL_CTRL1*/
 	{0x3005, 0x00}, /*PLL_CTRL2*/
+#else
+	{0x3004, 0xce}, /*PLL_CTRL1*/
+	{0x3005, 0x10}, /*PLL_CTRL2*/
+#endif
 	{0x3006, 0x10}, /*PLL_CTRL3*/
 	{0x3007, 0x3b}, /*PLL_CTRL4*/
+#if OV8825_2LANES
 	{0x3011, 0x01}, /*MIPI_Lane_4_Lane*/
+#else
+	{0x3011, 0x02}, /*MIPI_Lane_4_Lane*/
+#endif
 	{0x3012, 0x80}, /*SC_PLL CTRL_S0*/
 	{0x3013, 0x39}, /*SC_PLL CTRL_S1*/
 	{0x3104, 0x20}, /*SCCB_PLL*/
 	{0x3106, 0x15}, /*SRB_CTRL*/
-	{0x3501, 0x4e}, /*AEC_HIGH*/
-	{0x3502, 0xa0}, /*AEC_LOW*/
-	{0x350b, 0x1f}, /*AGC*/
+	/*{0x3501, 0x4e},*/ /*AEC_HIGH*/
+	/*{0x3502, 0xa0},*/ /*AEC_LOW*/
+	/*{0x350b, 0x1f},*/ /*AGC*/
 	{0x3600, 0x06}, /*ANACTRL0*/
 	{0x3601, 0x34}, /*ANACTRL1*/
 	{0x3700, 0x20}, /*SENCTROL0 Sensor control*/
@@ -106,15 +137,21 @@
 	{0x3813, 0x04}, /*VOFF*/
 	{0x3814, 0x31}, /*X INC*/
 	{0x3815, 0x31}, /*Y INC*/
-	{0x3820, 0x81}, /*Timing Reg20:Vflip*/
-	{0x3821, 0x17}, /*Timing Reg21:Hmirror*/
+	{0x3820, 0x87}, /*Timing Reg20:Vflip*/
+	{0x3821, 0x11}, /*Timing Reg21:Hmirror*/
+	{0x4005, 0x18},
+	{0x404f, 0x8f},
 	{0x3f00, 0x00}, /*PSRAM Ctrl0*/
 	{0x3f01, 0xfc}, /*PSRAM Ctrl1*/
 	{0x3f05, 0x10}, /*PSRAM Ctrl5*/
 	{0x4600, 0x04}, /*VFIFO Ctrl0*/
 	{0x4601, 0x00}, /*VFIFO Read ST High*/
 	{0x4602, 0x30}, /*VFIFO Read ST Low*/
-	{0x4837, 0x28}, /*MIPI PCLK PERIOD*/
+#if OV8825_2LANES
+	{0x4837, 0x16}, /*MIPI PCLK PERIOD*/
+#else
+	{0x4837, 0x27}, /*MIPI PCLK PERIOD*/
+#endif
 	{0x5068, 0x00}, /*HSCALE_CTRL*/
 	{0x506a, 0x00}, /*VSCALE_CTRL*/
 	{0x5c00, 0x80}, /*PBLC CTRL00*/
@@ -128,18 +165,27 @@
 
 static struct msm_camera_i2c_reg_conf ov8825_snap_settings[] = {
 	{0x3003, 0xce}, /*PLL_CTRL0*/
+#if OV8825_2LANES
 	{0x3004, 0xd8}, /*PLL_CTRL1*/
 	{0x3005, 0x00}, /*PLL_CTRL2*/
+#else
+	{0x3004, 0xce}, /*PLL_CTRL1*/
+	{0x3005, 0x10}, /*PLL_CTRL2*/
+#endif
 	{0x3006, 0x10}, /*PLL_CTRL3*/
 	{0x3007, 0x3b}, /*PLL_CTRL4*/
+#if OV8825_2LANES
 	{0x3011, 0x01}, /*MIPI_Lane_4_Lane*/
+#else
+	{0x3011, 0x02}, /*MIPI_Lane_4_Lane*/
+#endif
 	{0x3012, 0x81}, /*SC_PLL CTRL_S0*/
 	{0x3013, 0x39}, /*SC_PLL CTRL_S1*/
 	{0x3104, 0x20}, /*SCCB_PLL*/
 	{0x3106, 0x11}, /*SRB_CTRL*/
-	{0x3501, 0x9a}, /*AEC_HIGH*/
-	{0x3502, 0xa0}, /*AEC_LOW*/
-	{0x350b, 0x1f}, /*AGC*/
+	/*{0x3501, 0x9a},*/ /*AEC_HIGH*/
+	/*{0x3502, 0xa0},*/ /*AEC_LOW*/
+	/*{0x350b, 0x1f},*/ /*AGC*/
 	{0x3600, 0x07}, /*ANACTRL0*/
 	{0x3601, 0x33}, /*ANACTRL1*/
 	{0x3700, 0x10}, /*SENCTROL0 Sensor control*/
@@ -181,15 +227,21 @@
 	{0x3813, 0x06}, /*VOFF*/
 	{0x3814, 0x11}, /*X INC*/
 	{0x3815, 0x11}, /*Y INC*/
-	{0x3820, 0x80}, /*Timing Reg20:Vflip*/
-	{0x3821, 0x16}, /*Timing Reg21:Hmirror*/
+	{0x3820, 0x86}, /*Timing Reg20:Vflip*/
+	{0x3821, 0x10}, /*Timing Reg21:Hmirror*/
+	{0x4005, 0x1a},
+	{0x404f, 0x7f},
 	{0x3f00, 0x02}, /*PSRAM Ctrl0*/
 	{0x3f01, 0xfc}, /*PSRAM Ctrl1*/
 	{0x3f05, 0x10}, /*PSRAM Ctrl5*/
 	{0x4600, 0x04}, /*VFIFO Ctrl0*/
 	{0x4601, 0x00}, /*VFIFO Read ST High*/
 	{0x4602, 0x78}, /*VFIFO Read ST Low*/
-	{0x4837, 0x28}, /*MIPI PCLK PERIOD*/
+#if OV8825_2LANES
+	{0x4837, 0x18}, /*MIPI PCLK PERIOD*/
+#else
+	{0x4837, 0x27}, /*MIPI PCLK PERIOD*/
+#endif
 	{0x5068, 0x00}, /*HSCALE_CTRL*/
 	{0x506a, 0x00}, /*VSCALE_CTRL*/
 	{0x5c00, 0x80}, /*PBLC CTRL00*/
@@ -202,10 +254,6 @@
 };
 
 
-static struct msm_camera_i2c_reg_conf ov8825_reset_settings[] = {
-	{0x0103, 0x01},
-};
-
 static struct msm_camera_i2c_reg_conf ov8825_recommend_settings[] = {
 	{0x3000, 0x16},
 	{0x3001, 0x00},
@@ -387,10 +435,10 @@
 	{0x5848, 0x00},
 	{0x5849, 0xd5},
 	{0x3503, 0x07},
-	{0x3500, 0x00},
-	{0x3501, 0x27},
-	{0x3502, 0x00},
-	{0x350b, 0xff},
+	/*{0x3500, 0x00},*/
+	/*{0x3501, 0x27},*/
+	/*{0x3502, 0x00},*/
+	/*{0x350b, 0xff},*/
 	{0x3400, 0x04},
 	{0x3401, 0x00},
 	{0x3402, 0x04},
@@ -463,6 +511,95 @@
 	{0x583b, 0x28},
 	{0x583c, 0x26},
 	{0x583d, 0x9d},
+	{0x4818, 0x00},
+	{0x4819, 0xe0},
+	{0x482a, 0x05},
+
+	{0x3003, 0xce}, /*PLL_CTRL0*/
+#if OV8825_2LANES
+	{0x3004, 0xd4}, /*PLL_CTRL1*/
+	{0x3005, 0x00}, /*PLL_CTRL2*/
+#else
+	{0x3004, 0xce}, /*PLL_CTRL1*/
+	{0x3005, 0x10}, /*PLL_CTRL2*/
+#endif
+	{0x3006, 0x10}, /*PLL_CTRL3*/
+	{0x3007, 0x3b}, /*PLL_CTRL4*/
+#if OV8825_2LANES
+	{0x3011, 0x01}, /*MIPI_Lane_4_Lane*/
+#else
+	{0x3011, 0x02}, /*MIPI_Lane_4_Lane*/
+#endif
+	{0x3012, 0x80}, /*SC_PLL CTRL_S0*/
+	{0x3013, 0x39}, /*SC_PLL CTRL_S1*/
+	{0x3104, 0x20}, /*SCCB_PLL*/
+	{0x3106, 0x15}, /*SRB_CTRL*/
+	{0x3501, 0x4e}, /*AEC_HIGH*/
+	{0x3502, 0xa0}, /*AEC_LOW*/
+	{0x350b, 0x1f}, /*AGC*/
+	{0x3600, 0x06}, /*ANACTRL0*/
+	{0x3601, 0x34}, /*ANACTRL1*/
+	{0x3700, 0x20}, /*SENCTROL0 Sensor control*/
+	{0x3702, 0x50}, /*SENCTROL2 Sensor control*/
+	{0x3703, 0xcc}, /*SENCTROL3 Sensor control*/
+	{0x3704, 0x19}, /*SENCTROL4 Sensor control*/
+	{0x3705, 0x14}, /*SENCTROL5 Sensor control*/
+	{0x3706, 0x4b}, /*SENCTROL6 Sensor control*/
+	{0x3707, 0x63}, /*SENCTROL7 Sensor control*/
+	{0x3708, 0x84}, /*SENCTROL8 Sensor control*/
+	{0x3709, 0x40}, /*SENCTROL9 Sensor control*/
+	{0x370a, 0x12}, /*SENCTROLA Sensor control*/
+	{0x370e, 0x00}, /*SENCTROLE Sensor control*/
+	{0x3711, 0x0f}, /*SENCTROL11 Sensor control*/
+	{0x3712, 0x9c}, /*SENCTROL12 Sensor control*/
+	{0x3724, 0x01}, /*Reserved*/
+	{0x3725, 0x92}, /*Reserved*/
+	{0x3726, 0x01}, /*Reserved*/
+	{0x3727, 0xa9}, /*Reserved*/
+	{0x3800, 0x00}, /*HS(HREF start High)*/
+	{0x3801, 0x00}, /*HS(HREF start Low)*/
+	{0x3802, 0x00}, /*VS(Vertical start High)*/
+	{0x3803, 0x00}, /*VS(Vertical start Low)*/
+	{0x3804, 0x0c}, /*HW = 3295*/
+	{0x3805, 0xdf}, /*HW*/
+	{0x3806, 0x09}, /*VH = 2459*/
+	{0x3807, 0x9b}, /*VH*/
+	{0x3808, 0x06}, /*ISPHO = 1632*/
+	{0x3809, 0x60}, /*ISPHO*/
+	{0x380a, 0x04}, /*ISPVO = 1224*/
+	{0x380b, 0xc8}, /*ISPVO*/
+	{0x380c, 0x0d}, /*HTS = 3516*/
+	{0x380d, 0xbc}, /*HTS*/
+	{0x380e, 0x04}, /*VTS = 1264*/
+	{0x380f, 0xf0}, /*VTS*/
+	{0x3810, 0x00}, /*HOFF = 8*/
+	{0x3811, 0x08}, /*HOFF*/
+	{0x3812, 0x00}, /*VOFF = 4*/
+	{0x3813, 0x04}, /*VOFF*/
+	{0x3814, 0x31}, /*X INC*/
+	{0x3815, 0x31}, /*Y INC*/
+	{0x3820, 0x87}, /*Timing Reg20:Vflip*/
+	{0x3821, 0x11}, /*Timing Reg21:Hmirror*/
+	{0x3f00, 0x00}, /*PSRAM Ctrl0*/
+	{0x3f01, 0xfc}, /*PSRAM Ctrl1*/
+	{0x3f05, 0x10}, /*PSRAM Ctrl5*/
+	{0x4600, 0x04}, /*VFIFO Ctrl0*/
+	{0x4601, 0x00}, /*VFIFO Read ST High*/
+	{0x4602, 0x30}, /*VFIFO Read ST Low*/
+#if OV8825_2LANES
+	{0x4837, 0x16}, /*MIPI PCLK PERIOD*/
+#else
+	{0x4837, 0x27}, /*MIPI PCLK PERIOD*/
+#endif
+	{0x5068, 0x00}, /*HSCALE_CTRL*/
+	{0x506a, 0x00}, /*VSCALE_CTRL*/
+	{0x5c00, 0x80}, /*PBLC CTRL00*/
+	{0x5c01, 0x00}, /*PBLC CTRL01*/
+	{0x5c02, 0x00}, /*PBLC CTRL02*/
+	{0x5c03, 0x00}, /*PBLC CTRL03*/
+	{0x5c04, 0x00}, /*PBLC CTRL04*/
+	{0x5c08, 0x10}, /*PBLC CTRL08*/
+	{0x6900, 0x61}, /*CADC CTRL00*/
 };
 
 static struct v4l2_subdev_info ov8825_subdev_info[] = {
@@ -476,8 +613,6 @@
 };
 
 static struct msm_camera_i2c_conf_array ov8825_init_conf[] = {
-	{&ov8825_reset_settings[0],
-	ARRAY_SIZE(ov8825_reset_settings), 50, MSM_CAMERA_I2C_BYTE_DATA},
 	{&ov8825_recommend_settings[0],
 	ARRAY_SIZE(ov8825_recommend_settings), 0, MSM_CAMERA_I2C_BYTE_DATA}
 };
@@ -495,17 +630,26 @@
 		.y_output = 0x990,
 		.line_length_pclk = 0xE00,
 		.frame_length_lines = 0x9B0,
+#if OV8825_2LANES
 		.vt_pixel_clk = 133400000,
+#else
+		.vt_pixel_clk = 133000000,
+#endif
 		.op_pixel_clk = 176000000,
 		.binning_factor = 1,
 	},
 	{
 		.x_output = 0x660,
 		.y_output = 0x4C8,
-		.line_length_pclk = 0x6DE,
-		.frame_length_lines = 0x505,
-		.vt_pixel_clk = 66700000,
-		.op_pixel_clk = 88000000,
+		.line_length_pclk = 0xdbc,
+		.frame_length_lines = 0x4f0,
+#if OV8825_2LANES
+		.vt_pixel_clk = 133400000,
+#else
+		.vt_pixel_clk = 133000000,
+#endif
+		.op_pixel_clk = 176000000,
+
 		.binning_factor = 2,
 	},
 };
@@ -791,33 +935,40 @@
 	return 0;
 }
 
+static int32_t ov8825_write_pic_exp_gain(struct msm_sensor_ctrl_t *s_ctrl,
+		uint16_t gain, uint32_t line, int32_t luma_avg, uint16_t fgain)
+{
+	uint32_t fl_lines, offset;
+	uint8_t int_time[3];
+
+	fl_lines =
+		(s_ctrl->curr_frame_length_lines * s_ctrl->fps_divider) / Q10;
+	offset = s_ctrl->sensor_exp_gain_info->vert_offset;
+	if (line > (fl_lines - offset))
+		fl_lines = line + offset;
+	CDBG("ov8825_write_exp_gain: %d %d %d\n", fl_lines, gain, line);
+	/*s_ctrl->func_tbl->sensor_group_hold_on(s_ctrl);*/
+	msm_camera_i2c_write(s_ctrl->sensor_i2c_client,
+		s_ctrl->sensor_output_reg_addr->frame_length_lines, fl_lines,
+		MSM_CAMERA_I2C_WORD_DATA);
+	int_time[0] = line >> 12;
+	int_time[1] = line >> 4;
+	int_time[2] = line << 4;
+	msm_camera_i2c_write_seq(s_ctrl->sensor_i2c_client,
+		s_ctrl->sensor_exp_gain_info->coarse_int_time_addr-1,
+		&int_time[0], 3);
+	msm_camera_i2c_write(s_ctrl->sensor_i2c_client,
+		s_ctrl->sensor_exp_gain_info->global_gain_addr, gain,
+		MSM_CAMERA_I2C_WORD_DATA);
+	s_ctrl->func_tbl->sensor_group_hold_off(s_ctrl);
+	return 0;
+}
+
 static const struct i2c_device_id ov8825_i2c_id[] = {
 	{SENSOR_NAME, (kernel_ulong_t)&ov8825_s_ctrl},
 	{ }
 };
 
-int32_t ov8825_sensor_power_up(struct msm_sensor_ctrl_t *s_ctrl)
-{
-	int32_t rc = 0;
-	struct msm_camera_sensor_info *info = NULL;
-
-	info = s_ctrl->sensordata;
-	gpio_direction_output(info->sensor_pwd, 0);
-	gpio_direction_output(info->sensor_reset, 0);
-	usleep_range(10000, 11000);
-	rc = msm_sensor_power_up(s_ctrl);
-	if (rc < 0) {
-		CDBG("%s: msm_sensor_power_up failed\n", __func__);
-		return rc;
-	}
-	/* turn on ldo and vreg */
-	gpio_direction_output(info->sensor_pwd, 1);
-	msleep(20);
-	gpio_direction_output(info->sensor_reset, 1);
-	msleep(40);
-	return rc;
-}
-
 static struct i2c_driver ov8825_i2c_driver = {
 	.id_table = ov8825_i2c_id,
 	.probe  = msm_sensor_i2c_probe,
@@ -830,8 +981,6 @@
 	.addr_type = MSM_CAMERA_I2C_WORD_ADDR,
 };
 
-
-
 static int __init msm_sensor_init_module(void)
 {
 	return i2c_add_driver(&ov8825_i2c_driver);
@@ -856,6 +1005,8 @@
 {
 	int32_t rc = 0;
 
+	CDBG("function:%s,line:%d\n", __func__, __LINE__);
+
 	if (update_type == MSM_SENSOR_REG_INIT) {
 		CDBG("Register INIT\n");
 		s_ctrl->func_tbl->sensor_stop_stream(s_ctrl);
@@ -863,21 +1014,19 @@
 		msm_sensor_write_init_settings(s_ctrl);
 		CDBG("Update OTP\n");
 		msm_camera_i2c_write(s_ctrl->sensor_i2c_client, 0x100, 0x1,
-				MSM_CAMERA_I2C_BYTE_DATA);
+		MSM_CAMERA_I2C_BYTE_DATA);
 		msleep(66);
 		ov8825_update_otp(s_ctrl);
 		usleep_range(10000, 11000);
 		msm_camera_i2c_write(s_ctrl->sensor_i2c_client, 0x100, 0x0,
-		  MSM_CAMERA_I2C_BYTE_DATA);
+		MSM_CAMERA_I2C_BYTE_DATA);
 	} else if (update_type == MSM_SENSOR_UPDATE_PERIODIC) {
 		CDBG("PERIODIC : %d\n", res);
-		msm_sensor_write_conf_array(
-			s_ctrl->sensor_i2c_client,
-			s_ctrl->msm_sensor_reg->mode_settings, res);
+		msm_sensor_write_res_settings(s_ctrl, res);
 		msleep(30);
 		v4l2_subdev_notify(&s_ctrl->sensor_v4l2_subdev,
-			NOTIFY_PCLK_CHANGE,
-			&s_ctrl->sensordata->pdata->ioclk.vfe_clk_rate);
+			NOTIFY_PCLK_CHANGE, &s_ctrl->msm_sensor_reg->
+			output_settings[res].op_pixel_clk);
 	}
 	return rc;
 }
@@ -889,14 +1038,17 @@
 	.sensor_group_hold_off = msm_sensor_group_hold_off,
 	.sensor_set_fps = msm_sensor_set_fps,
 	.sensor_write_exp_gain = ov8825_write_exp_gain,
-	.sensor_write_snapshot_exp_gain = ov8825_write_exp_gain,
-	.sensor_csi_setting = ov8825_sensor_setting,
+	.sensor_write_snapshot_exp_gain = ov8825_write_pic_exp_gain,
+	.sensor_setting = ov8825_sensor_setting,    /*msm_sensor_setting,*/
+	.sensor_csi_setting = msm_sensor_setting,
 	.sensor_set_sensor_mode = msm_sensor_set_sensor_mode,
 	.sensor_mode_init = msm_sensor_mode_init,
 	.sensor_get_output_info = msm_sensor_get_output_info,
 	.sensor_config = msm_sensor_config,
-	.sensor_power_up = ov8825_sensor_power_up,
+	.sensor_power_up = msm_sensor_power_up,
 	.sensor_power_down = msm_sensor_power_down,
+	.sensor_adjust_frame_lines = msm_sensor_adjust_frame_lines1,
+	.sensor_get_csi_params = msm_sensor_get_csi_params,
 };
 
 static struct msm_sensor_reg_t ov8825_regs = {
@@ -930,8 +1082,9 @@
 	.sensor_v4l2_subdev_info_size = ARRAY_SIZE(ov8825_subdev_info),
 	.sensor_v4l2_subdev_ops = &ov8825_subdev_ops,
 	.func_tbl = &ov8825_func_tbl,
+	.clk_rate = MSM_SENSOR_MCLK_24HZ,
 };
 
 module_init(msm_sensor_init_module);
-MODULE_DESCRIPTION("Omnivison 8MP Bayer sensor driver");
+MODULE_DESCRIPTION("OV 8MP Bayer sensor driver");
 MODULE_LICENSE("GPL v2");
diff --git a/drivers/media/video/msm/sensors/ov9724_v4l2.c b/drivers/media/video/msm/sensors/ov9724_v4l2.c
new file mode 100644
index 0000000..67a41ca
--- /dev/null
+++ b/drivers/media/video/msm/sensors/ov9724_v4l2.c
@@ -0,0 +1,254 @@
+/* Copyright (c) 2013, The Linux Foundation. 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 version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * 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.
+ *
+ */
+
+#include "msm_sensor.h"
+#define SENSOR_NAME "ov9724"
+#define PLATFORM_DRIVER_NAME "msm_camera_ov9724"
+#define ov9724_obj ov9724_##obj
+
+DEFINE_MUTEX(ov9724_mut);
+static struct msm_sensor_ctrl_t ov9724_s_ctrl;
+
+static struct msm_camera_i2c_reg_conf ov9724_start_settings[] = {
+	{0x0100, 0x01},
+};
+
+static struct msm_camera_i2c_reg_conf ov9724_stop_settings[] = {
+	{0x0100, 0x00},
+};
+
+static struct msm_camera_i2c_reg_conf ov9724_groupon_settings[] = {
+	{0x0104, 0x01},
+};
+
+static struct msm_camera_i2c_reg_conf ov9724_groupoff_settings[] = {
+	{0x0104, 0x00},
+};
+
+static struct msm_camera_i2c_reg_conf ov9724_prev_settings[] = {
+};
+
+static struct msm_camera_i2c_reg_conf ov9724_recommend_settings[] = {
+	{0x0103, 0x01}, /* SOFTWARE_RESET */
+	{0x3002, 0x03}, /* IO_CTRL00 */
+	{0x0340, 0x03}, /* FRAME_LENGTH_LINES_HI */
+	{0x0341, 0xC1}, /* FRAME_LENGTH_LINES_LO */
+	{0x0342, 0x06}, /* LINE_LENGTH_PCK_HI */
+	{0x0343, 0x80}, /* LINE_LENGTH_PCK_LO */
+	{0x0202, 0x03}, /* COARSE_INTEGRATION_TIME_HI */
+	{0x0203, 0x43}, /* COARSE_INTEGRATION_TIME_LO */
+	{0x034c, 0x05}, /* X_OUTPUT_SIZE_HI */
+	{0x034d, 0x10}, /* X_OUTPUT_SIZE_LO */
+	{0x034e, 0x02}, /* Y_OUTPUT_SIZE_HI */
+	{0x034f, 0xd8}, /* Y_OUTPUT_SIZE_LO */
+	{0x0340, 0x03}, /* FRAME_LENGTH_LINES_HI */
+	{0x0341, 0xC1}, /* FRAME_LENGTH_LINES_LO */
+	{0x0342, 0x06}, /* LINE_LENGTH_PCK_HI */
+	{0x0343, 0x80}, /* LINE_LENGTH_PCK_LO */
+	{0x0202, 0x03}, /* COARSE_INTEGRATION_TIME_HI */
+	{0x0203, 0x43}, /* COARSE_INTEGRATION_TIME_LO */
+	{0x0303, 0x01}, /* VT_SYS_CLK_DIV_LO */
+	{0x3002, 0x03}, /* IO_CTRL00 */
+	{0x4801, 0x0e}, /* MIPI_CTRL01 */
+	{0x4803, 0x05}, /* MIPI_CTRL03 */
+	{0x0305, 0x04}, /* PRE_PLL_CLK_DIV_LO */
+	{0x0307, 0x64}, /* PLL_MULTIPLIER_LO */
+	{0x0101, 0x02}, /* IMAGE_ORIENTATION */
+	{0x5000, 0x06}, /* ISP_CTRL0 */
+	{0x5001, 0x71}, /* ISP_CTRL1 */
+	{0x4008, 0x10}, /* BLC_CTRL05 */
+	{0x0100, 0x01}, /* MODE_SELECT */
+};
+
+static struct v4l2_subdev_info ov9724_subdev_info[] = {
+	{
+		.code   = V4L2_MBUS_FMT_SBGGR10_1X10,
+		.colorspace = V4L2_COLORSPACE_JPEG,
+		.fmt    = 1,
+		.order    = 0,
+	},
+	/* more can be supported, to be added later */
+};
+
+static struct msm_camera_i2c_conf_array ov9724_init_conf[] = {
+	{&ov9724_recommend_settings[0],
+		ARRAY_SIZE(ov9724_recommend_settings), 0,
+		MSM_CAMERA_I2C_BYTE_DATA}
+};
+
+static struct msm_camera_i2c_conf_array ov9724_confs[] = {
+	{&ov9724_prev_settings[0],
+		ARRAY_SIZE(ov9724_prev_settings), 0, MSM_CAMERA_I2C_BYTE_DATA},
+};
+
+static struct msm_sensor_output_info_t ov9724_dimensions[] = {
+	{
+		.x_output = 0x510, /* 1296 */
+		.y_output = 0x2d8, /* 728 */
+		.line_length_pclk = 0x680, /* 1664 */
+		.frame_length_lines = 0x3C1, /* 961 */
+		.vt_pixel_clk = 320000000,
+		.op_pixel_clk = 320000000,
+		.binning_factor = 1,
+	},
+};
+
+static struct msm_sensor_output_reg_addr_t ov9724_reg_addr = {
+	.x_output = 0x034c,
+	.y_output = 0x034e,
+	.line_length_pclk = 0x0342,
+	.frame_length_lines = 0x0340,
+};
+
+static struct msm_sensor_id_info_t ov9724_id_info = {
+	.sensor_id_reg_addr = 0x0000,
+	.sensor_id = 0x9724,
+};
+
+static struct msm_sensor_exp_gain_info_t ov9724_exp_gain_info = {
+	.coarse_int_time_addr = 0x0202,
+	.global_gain_addr = 0x0205,
+	.vert_offset = 6,
+};
+
+static const struct i2c_device_id ov9724_i2c_id[] = {
+	{SENSOR_NAME, (kernel_ulong_t)&ov9724_s_ctrl},
+	{ }
+};
+
+static struct i2c_driver ov9724_i2c_driver = {
+	.id_table = ov9724_i2c_id,
+	.probe  = msm_sensor_i2c_probe,
+	.driver = {
+		.name = SENSOR_NAME,
+	},
+};
+
+static struct msm_camera_i2c_client ov9724_sensor_i2c_client = {
+	.addr_type = MSM_CAMERA_I2C_WORD_ADDR,
+};
+
+static int __init msm_sensor_init_module(void)
+{
+	return i2c_add_driver(&ov9724_i2c_driver);
+}
+
+
+int32_t ov9724_write_exp_gain(struct msm_sensor_ctrl_t *s_ctrl,
+		uint16_t gain, uint32_t line, int32_t luma_avg, uint16_t fgain)
+{
+	uint32_t fl_lines;
+	uint8_t offset;
+	uint32_t gain_reg = 0;
+	uint8_t  gain_offset = 4;
+	fl_lines = s_ctrl->curr_frame_length_lines;
+	fl_lines = (fl_lines * s_ctrl->fps_divider) / Q10;
+	offset = s_ctrl->sensor_exp_gain_info->vert_offset;
+	if (line > (fl_lines - offset))
+		fl_lines = line + offset;
+
+	s_ctrl->func_tbl->sensor_group_hold_on(s_ctrl);
+
+	msm_camera_i2c_write(s_ctrl->sensor_i2c_client,
+			s_ctrl->sensor_output_reg_addr->frame_length_lines,
+			fl_lines, MSM_CAMERA_I2C_WORD_DATA);
+	msm_camera_i2c_write(s_ctrl->sensor_i2c_client,
+			s_ctrl->sensor_exp_gain_info->coarse_int_time_addr,
+			line, MSM_CAMERA_I2C_WORD_DATA);
+
+	while (gain > 31) {
+		gain_reg = gain_reg | (1 << gain_offset);
+		gain     = gain >> 1;
+	}
+	gain_reg = gain_reg | (gain - 16);
+
+	msm_camera_i2c_write(s_ctrl->sensor_i2c_client,
+			s_ctrl->sensor_exp_gain_info->global_gain_addr, gain,
+			MSM_CAMERA_I2C_BYTE_DATA);
+	s_ctrl->func_tbl->sensor_group_hold_off(s_ctrl);
+	return 0;
+}
+
+
+static struct v4l2_subdev_core_ops ov9724_subdev_core_ops = {
+	.ioctl = msm_sensor_subdev_ioctl,
+	.s_power = msm_sensor_power,
+};
+
+static struct v4l2_subdev_video_ops ov9724_subdev_video_ops = {
+	.enum_mbus_fmt = msm_sensor_v4l2_enum_fmt,
+};
+
+static struct v4l2_subdev_ops ov9724_subdev_ops = {
+	.core = &ov9724_subdev_core_ops,
+	.video  = &ov9724_subdev_video_ops,
+};
+
+static struct msm_sensor_fn_t ov9724_func_tbl = {
+	.sensor_start_stream = msm_sensor_start_stream,
+	.sensor_stop_stream = msm_sensor_stop_stream,
+	.sensor_group_hold_on = msm_sensor_group_hold_on,
+	.sensor_group_hold_off = msm_sensor_group_hold_off,
+	.sensor_set_fps = msm_sensor_set_fps,
+	.sensor_write_exp_gain = ov9724_write_exp_gain,
+	.sensor_write_snapshot_exp_gain = ov9724_write_exp_gain,
+	.sensor_setting = msm_sensor_setting,
+	.sensor_csi_setting = msm_sensor_setting1,
+	.sensor_set_sensor_mode = msm_sensor_set_sensor_mode,
+	.sensor_mode_init = msm_sensor_mode_init,
+	.sensor_get_output_info = msm_sensor_get_output_info,
+	.sensor_config = msm_sensor_config,
+	.sensor_power_up = msm_sensor_power_up,
+	.sensor_power_down = msm_sensor_power_down,
+	.sensor_get_csi_params = msm_sensor_get_csi_params,
+};
+
+static struct msm_sensor_reg_t ov9724_regs = {
+	.default_data_type = MSM_CAMERA_I2C_BYTE_DATA,
+	.start_stream_conf = ov9724_start_settings,
+	.start_stream_conf_size = ARRAY_SIZE(ov9724_start_settings),
+	.stop_stream_conf = ov9724_stop_settings,
+	.stop_stream_conf_size = ARRAY_SIZE(ov9724_stop_settings),
+	.group_hold_on_conf = ov9724_groupon_settings,
+	.group_hold_on_conf_size = ARRAY_SIZE(ov9724_groupon_settings),
+	.group_hold_off_conf = ov9724_groupoff_settings,
+	.group_hold_off_conf_size =
+		ARRAY_SIZE(ov9724_groupoff_settings),
+	.init_settings = &ov9724_init_conf[0],
+	.init_size = ARRAY_SIZE(ov9724_init_conf),
+	.mode_settings = &ov9724_confs[0],
+	.output_settings = &ov9724_dimensions[0],
+	.num_conf = ARRAY_SIZE(ov9724_confs),
+};
+
+static struct msm_sensor_ctrl_t ov9724_s_ctrl = {
+	.msm_sensor_reg = &ov9724_regs,
+	.sensor_i2c_client = &ov9724_sensor_i2c_client,
+	.sensor_i2c_addr = 0x20,
+	.sensor_output_reg_addr = &ov9724_reg_addr,
+	.sensor_id_info = &ov9724_id_info,
+	.sensor_exp_gain_info = &ov9724_exp_gain_info,
+	.cam_mode = MSM_SENSOR_MODE_INVALID,
+	.msm_sensor_mutex = &ov9724_mut,
+	.sensor_i2c_driver = &ov9724_i2c_driver,
+	.sensor_v4l2_subdev_info = ov9724_subdev_info,
+	.sensor_v4l2_subdev_info_size = ARRAY_SIZE(ov9724_subdev_info),
+	.sensor_v4l2_subdev_ops = &ov9724_subdev_ops,
+	.func_tbl = &ov9724_func_tbl,
+	.clk_rate = MSM_SENSOR_MCLK_24HZ,
+};
+
+module_init(msm_sensor_init_module);
+MODULE_DESCRIPTION("Omnivision WXGA Bayer sensor driver");
+MODULE_LICENSE("GPL v2");
+