msm: camera: OV7692 v4l2 sensor driver
Add board file configuration, clock configuration, regulator
setting and sensor register setting to enable OV7692 sensor
driver based on v4l2 architecture
CRs-fixed: 351530
Change-Id: I76287fdd0fc45999e6463f43b4dd3b0640017bfc
Signed-off-by: Sreesudhan Ramakrish Ramkumar <srramku@codeaurora.org>
diff --git a/arch/arm/mach-msm/board-msm7627a-camera.c b/arch/arm/mach-msm/board-msm7627a-camera.c
index 8e64a43..e330f21 100644
--- a/arch/arm/mach-msm/board-msm7627a-camera.c
+++ b/arch/arm/mach-msm/board-msm7627a-camera.c
@@ -73,9 +73,25 @@
};
#ifdef CONFIG_WEBCAM_OV7692_QRD
+static struct gpio ov7692_cam_req_gpio[] = {
+ {GPIO_SKU1_CAM_VGA_SHDN, GPIOF_DIR_OUT, "CAM_VGA_SHDN"},
+ {GPIO_SKU1_CAM_VGA_RESET_N, GPIOF_DIR_OUT, "CAM_VGA_RESET"},
+};
+
+static struct msm_gpio_set_tbl ov7692_cam_gpio_set_tbl[] = {
+ {GPIO_SKU1_CAM_VGA_SHDN, GPIOF_OUT_INIT_HIGH, 5000},
+ {GPIO_SKU1_CAM_VGA_SHDN, GPIOF_OUT_INIT_LOW, 5000},
+ {GPIO_SKU1_CAM_VGA_RESET_N, GPIOF_OUT_INIT_HIGH, 5000},
+ {GPIO_SKU1_CAM_VGA_RESET_N, GPIOF_OUT_INIT_LOW, 5000},
+ {40, GPIOF_OUT_INIT_HIGH, 5000},
+ {35, GPIOF_OUT_INIT_HIGH, 5000},
+};
+
static struct msm_camera_gpio_conf gpio_conf_ov7692 = {
- .camera_off_table = camera_off_gpio_table,
- .camera_on_table = camera_on_gpio_table,
+ .cam_gpio_req_tbl = ov7692_cam_req_gpio,
+ .cam_gpio_req_tbl_size = ARRAY_SIZE(ov7692_cam_req_gpio),
+ .cam_gpio_set_tbl = ov7692_cam_gpio_set_tbl,
+ .cam_gpio_set_tbl_size = ARRAY_SIZE(ov7692_cam_gpio_set_tbl),
.gpio_no_mux = 1,
};
#endif
@@ -455,38 +471,6 @@
gpio_direction_output(GPIO_SKU3_CAM_5MP_CAMIF_RESET, 1);
- rc = gpio_request(GPIO_SKU1_CAM_VGA_SHDN, "ov7692");
- if (rc < 0)
- pr_err("%s: gpio_request---GPIO_SKU1_CAM_VGA_SHDN failed!",
- __func__);
-
- rc = gpio_tlmm_config(GPIO_CFG(GPIO_SKU1_CAM_VGA_SHDN, 0,
- GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP,
- GPIO_CFG_2MA), GPIO_CFG_ENABLE);
- if (rc < 0) {
- pr_err("%s:unable to enable Powr Dwn gpio for frnt camera!\n",
- __func__);
- gpio_free(GPIO_SKU1_CAM_VGA_SHDN);
- }
-
- gpio_direction_output(GPIO_SKU1_CAM_VGA_SHDN, 1);
-
- rc = gpio_request(GPIO_SKU1_CAM_VGA_RESET_N, "ov7692");
- if (rc < 0)
- pr_err("%s: gpio_request---GPIO_SKU1_CAM_VGA_RESET_N failed!",
- __func__);
-
- rc = gpio_tlmm_config(GPIO_CFG(GPIO_SKU1_CAM_VGA_RESET_N, 0,
- GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP,
- GPIO_CFG_2MA), GPIO_CFG_ENABLE);
-
- if (rc < 0) {
- pr_err("%s: unable to enable reset gpio for front camera!\n",
- __func__);
- gpio_free(GPIO_SKU1_CAM_VGA_RESET_N);
- }
- gpio_direction_output(GPIO_SKU1_CAM_VGA_RESET_N, 1);
-
}
#ifndef CONFIG_MSM_CAMERA_V4L2
diff --git a/arch/arm/mach-msm/board-msm8x60-camera.c b/arch/arm/mach-msm/board-msm8x60-camera.c
index b52f951..32d5530 100644
--- a/arch/arm/mach-msm/board-msm8x60-camera.c
+++ b/arch/arm/mach-msm/board-msm8x60-camera.c
@@ -23,6 +23,7 @@
#include "devices.h"
#define GPIO_EXT_CAMIF_PWR_EN1 (PM8901_MPP_BASE + PM8901_MPPS + 13)
+#define GPIO_WEB_CAMIF_STANDBY1 (PM8901_MPP_BASE + PM8901_MPPS + 60)
#ifdef CONFIG_MSM_CAMERA_FLASH
#define VFE_CAMIF_TIMER1_GPIO 29
#define VFE_CAMIF_TIMER2_GPIO 30
@@ -388,10 +389,10 @@
{47, GPIOF_DIR_IN, "CAMIF_I2C_DATA"},
{48, GPIOF_DIR_IN, "CAMIF_I2C_CLK"},
{105, GPIOF_DIR_IN, "STANDBY"},
- {GPIO_EXT_CAMIF_PWR_EN1, GPIOF_DIR_OUT, "CAMIF_PWR_EN"},
};
static struct gpio msm8x60_back_cam_gpio[] = {
+ {GPIO_EXT_CAMIF_PWR_EN1, GPIOF_DIR_OUT, "CAMIF_PWR_EN"},
{106, GPIOF_DIR_OUT, "CAM_RESET"},
};
@@ -468,6 +469,43 @@
.camera_type = BACK_CAMERA_2D,
};
+static struct gpio ov7692_cam_gpio[] = {
+ {GPIO_WEB_CAMIF_STANDBY1, GPIOF_DIR_OUT, "CAM_EN"},
+};
+
+static struct msm_gpio_set_tbl ov7692_cam_gpio_set_tbl[] = {
+ {GPIO_WEB_CAMIF_STANDBY1, GPIOF_OUT_INIT_LOW, 10000},
+};
+
+static struct msm_camera_gpio_conf ov7692_cam_gpio_conf = {
+ .cam_gpio_common_tbl = msm8x60_common_cam_gpio,
+ .cam_gpio_common_tbl_size = ARRAY_SIZE(msm8x60_common_cam_gpio),
+ .cam_gpio_req_tbl = ov7692_cam_gpio,
+ .cam_gpio_req_tbl_size = ARRAY_SIZE(ov7692_cam_gpio),
+ .cam_gpio_set_tbl = ov7692_cam_gpio_set_tbl,
+ .cam_gpio_set_tbl_size = ARRAY_SIZE(ov7692_cam_gpio_set_tbl),
+};
+
+static struct msm_camera_sensor_flash_data flash_ov7692 = {
+ .flash_type = MSM_CAMERA_FLASH_NONE,
+};
+
+static struct msm_camera_sensor_platform_info sensor_board_info_ov7692 = {
+ .mount_angle = 0,
+ .cam_vreg = msm_8x60_back_cam_vreg,
+ .num_vreg = ARRAY_SIZE(msm_8x60_back_cam_vreg),
+ .gpio_conf = &ov7692_cam_gpio_conf,
+};
+
+static struct msm_camera_sensor_info msm_camera_sensor_ov7692_data = {
+ .sensor_name = "ov7692",
+ .pdata = &msm_camera_csi_device_data[1],
+ .flash_data = &flash_ov7692,
+ .sensor_platform_info = &sensor_board_info_ov7692,
+ .csi_if = 1,
+ .camera_type = FRONT_CAMERA_2D,
+};
+
static struct platform_device msm_camera_server = {
.name = "msm_cam_server",
.id = 0,
@@ -492,6 +530,10 @@
I2C_BOARD_INFO("mt9e013", 0x6C),
.platform_data = &msm_camera_sensor_mt9e013_data,
},
+ {
+ I2C_BOARD_INFO("ov7692", 0x78),
+ .platform_data = &msm_camera_sensor_ov7692_data,
+ },
};
struct msm_camera_board_info msm8x60_camera_board_info = {
diff --git a/arch/arm/mach-msm/board-msm8x60.c b/arch/arm/mach-msm/board-msm8x60.c
index 6b22e99..477b17d 100644
--- a/arch/arm/mach-msm/board-msm8x60.c
+++ b/arch/arm/mach-msm/board-msm8x60.c
@@ -3813,6 +3813,7 @@
REGULATOR_SUPPLY("8058_l15", NULL),
REGULATOR_SUPPLY("cam_vana", "1-001a"),
REGULATOR_SUPPLY("cam_vana", "1-006c"),
+ REGULATOR_SUPPLY("cam_vana", "1-0078"),
};
static struct regulator_consumer_supply vreg_consumers_PM8058_L16[] = {
REGULATOR_SUPPLY("8058_l16", NULL),
@@ -3845,6 +3846,7 @@
REGULATOR_SUPPLY("8058_l25", NULL),
REGULATOR_SUPPLY("cam_vdig", "1-001a"),
REGULATOR_SUPPLY("cam_vdig", "1-006c"),
+ REGULATOR_SUPPLY("cam_vdig", "1-0078"),
};
static struct regulator_consumer_supply vreg_consumers_PM8058_S0[] = {
REGULATOR_SUPPLY("8058_s0", NULL),
@@ -3865,6 +3867,7 @@
REGULATOR_SUPPLY("8058_lvs0", NULL),
REGULATOR_SUPPLY("cam_vio", "1-001a"),
REGULATOR_SUPPLY("cam_vio", "1-006c"),
+ REGULATOR_SUPPLY("cam_vio", "1-0078"),
};
static struct regulator_consumer_supply vreg_consumers_PM8058_LVS1[] = {
REGULATOR_SUPPLY("8058_lvs1", NULL),