summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYuxi Sun <b36102@freescale.com>2012-02-08 15:47:51 +0800
committerYuxi Sun <b36102@freescale.com>2012-02-08 16:37:07 +0800
commitb97af738efa254d96a2a40635e2e711d739b23bc (patch)
treeea51fbcef15c307672a838da94b46b03f228ab77
parent217f64e3c2b2f8a50c99fd9509eb551efe480129 (diff)
ENGR00174039 camera: modify camera drivers
Modify ov3640 ov5640 ov5642 driver according to sensor data structure change for dual camera switch Signed-off-by: Yuxi Sun <b36102@freescale.com>
-rw-r--r--drivers/media/video/mxc/capture/ov3640.c41
-rw-r--r--drivers/media/video/mxc/capture/ov5640.c43
-rw-r--r--drivers/media/video/mxc/capture/ov5640_mipi.c39
-rw-r--r--drivers/media/video/mxc/capture/ov5642.c43
4 files changed, 45 insertions, 121 deletions
diff --git a/drivers/media/video/mxc/capture/ov3640.c b/drivers/media/video/mxc/capture/ov3640.c
index 570f50bae161..b1d1abb884d9 100644
--- a/drivers/media/video/mxc/capture/ov3640.c
+++ b/drivers/media/video/mxc/capture/ov3640.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2005-2011 Freescale Semiconductor, Inc. All Rights Reserved.
+ * Copyright 2005-2012 Freescale Semiconductor, Inc. All Rights Reserved.
*/
/*
@@ -72,27 +72,7 @@ struct ov3640_mode_info {
/*!
* Maintains the information on the current state of the sesor.
*/
-struct sensor {
- const struct ov3640_platform_data *platform_data;
- struct v4l2_int_device *v4l2_int_device;
- struct i2c_client *i2c_client;
- struct v4l2_pix_format pix;
- struct v4l2_captureparm streamcap;
- bool on;
-
- /* control settings */
- int brightness;
- int hue;
- int contrast;
- int saturation;
- int red;
- int green;
- int blue;
- int ae_mode;
-
- u32 mclk;
- int csi;
-} ov3640_data;
+struct sensor_data ov3640_data;
static struct reg_value ov3640_setting_15fps_QXGA_2048_1536[] = {
#if 0
@@ -1005,7 +985,7 @@ static int ioctl_g_ifparm(struct v4l2_int_device *s, struct v4l2_ifparm *p)
*/
static int ioctl_s_power(struct v4l2_int_device *s, int on)
{
- struct sensor *sensor = s->priv;
+ struct sensor_data *sensor = s->priv;
if (on && !sensor->on) {
if (io_regulator)
@@ -1033,6 +1013,9 @@ static int ioctl_s_power(struct v4l2_int_device *s, int on)
regulator_disable(io_regulator);
if (gpo_regulator)
regulator_disable(gpo_regulator);
+
+ if (camera_plat->pwdn)
+ camera_plat->pwdn(1);
}
sensor->on = on;
@@ -1049,7 +1032,7 @@ static int ioctl_s_power(struct v4l2_int_device *s, int on)
*/
static int ioctl_g_parm(struct v4l2_int_device *s, struct v4l2_streamparm *a)
{
- struct sensor *sensor = s->priv;
+ struct sensor_data *sensor = s->priv;
struct v4l2_captureparm *cparm = &a->parm.capture;
int ret = 0;
@@ -1094,7 +1077,7 @@ static int ioctl_g_parm(struct v4l2_int_device *s, struct v4l2_streamparm *a)
*/
static int ioctl_s_parm(struct v4l2_int_device *s, struct v4l2_streamparm *a)
{
- struct sensor *sensor = s->priv;
+ struct sensor_data *sensor = s->priv;
struct v4l2_fract *timeperframe = &a->parm.capture.timeperframe;
u32 tgt_fps; /* target frames per secound */
enum ov3640_frame_rate frame_rate;
@@ -1178,7 +1161,7 @@ static int ioctl_s_parm(struct v4l2_int_device *s, struct v4l2_streamparm *a)
*/
static int ioctl_g_fmt_cap(struct v4l2_int_device *s, struct v4l2_format *f)
{
- struct sensor *sensor = s->priv;
+ struct sensor_data *sensor = s->priv;
f->fmt.pix = sensor->pix;
@@ -1357,7 +1340,7 @@ static int ioctl_enum_fmt_cap(struct v4l2_int_device *s,
*/
static int ioctl_dev_init(struct v4l2_int_device *s)
{
- struct sensor *sensor = s->priv;
+ struct sensor_data *sensor = s->priv;
u32 tgt_xclk; /* target xclk */
u32 tgt_fps; /* target frames per secound */
enum ov3640_frame_rate frame_rate;
@@ -1460,6 +1443,7 @@ static int ov3640_probe(struct i2c_client *client,
ov3640_data.mclk = 24000000; /* 6 - 54 MHz, typical 24MHz */
ov3640_data.mclk = plat_data->mclk;
ov3640_data.csi = plat_data->csi;
+ ov3640_data.io_init = plat_data->io_init;
ov3640_data.i2c_client = client;
ov3640_data.pix.pixelformat = V4L2_PIX_FMT_UYVY;
@@ -1547,9 +1531,6 @@ static int ov3640_probe(struct i2c_client *client,
if (plat_data->io_init)
plat_data->io_init();
- if (plat_data->pwdn)
- plat_data->pwdn(0);
-
camera_plat = plat_data;
ov3640_int_device.priv = &ov3640_data;
diff --git a/drivers/media/video/mxc/capture/ov5640.c b/drivers/media/video/mxc/capture/ov5640.c
index 64ee178f2e58..f9087499b5f1 100644
--- a/drivers/media/video/mxc/capture/ov5640.c
+++ b/drivers/media/video/mxc/capture/ov5640.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 Freescale Semiconductor, Inc. All Rights Reserved.
+ * Copyright (C) 2012 Freescale Semiconductor, Inc. All Rights Reserved.
*/
/*
@@ -78,27 +78,7 @@ struct ov5640_mode_info {
/*!
* Maintains the information on the current state of the sesor.
*/
-struct sensor {
- const struct ov5640_platform_data *platform_data;
- struct v4l2_int_device *v4l2_int_device;
- struct i2c_client *i2c_client;
- struct v4l2_pix_format pix;
- struct v4l2_captureparm streamcap;
- bool on;
-
- /* control settings */
- int brightness;
- int hue;
- int contrast;
- int saturation;
- int red;
- int green;
- int blue;
- int ae_mode;
-
- u32 mclk;
- int csi;
-} ov5640_data;
+struct sensor_data ov5640_data;
static struct reg_value ov5640_setting_15fps_QSXGA_2592_1944[] = {
{0x3103, 0x11, 0, 0}, {0x3008, 0x82, 0, 0}, {0x3008, 0x42, 0, 0},
@@ -960,7 +940,7 @@ static int ioctl_g_ifparm(struct v4l2_int_device *s, struct v4l2_ifparm *p)
*/
static int ioctl_s_power(struct v4l2_int_device *s, int on)
{
- struct sensor *sensor = s->priv;
+ struct sensor_data *sensor = s->priv;
if (on && !sensor->on) {
if (io_regulator)
@@ -988,7 +968,10 @@ static int ioctl_s_power(struct v4l2_int_device *s, int on)
regulator_disable(io_regulator);
if (gpo_regulator)
regulator_disable(gpo_regulator);
- }
+
+ if (camera_plat->pwdn)
+ camera_plat->pwdn(1);
+}
sensor->on = on;
@@ -1004,7 +987,7 @@ static int ioctl_s_power(struct v4l2_int_device *s, int on)
*/
static int ioctl_g_parm(struct v4l2_int_device *s, struct v4l2_streamparm *a)
{
- struct sensor *sensor = s->priv;
+ struct sensor_data *sensor = s->priv;
struct v4l2_captureparm *cparm = &a->parm.capture;
int ret = 0;
@@ -1049,7 +1032,7 @@ static int ioctl_g_parm(struct v4l2_int_device *s, struct v4l2_streamparm *a)
*/
static int ioctl_s_parm(struct v4l2_int_device *s, struct v4l2_streamparm *a)
{
- struct sensor *sensor = s->priv;
+ struct sensor_data *sensor = s->priv;
struct v4l2_fract *timeperframe = &a->parm.capture.timeperframe;
u32 tgt_fps; /* target frames per secound */
enum ov5640_frame_rate frame_rate;
@@ -1133,7 +1116,7 @@ static int ioctl_s_parm(struct v4l2_int_device *s, struct v4l2_streamparm *a)
*/
static int ioctl_g_fmt_cap(struct v4l2_int_device *s, struct v4l2_format *f)
{
- struct sensor *sensor = s->priv;
+ struct sensor_data *sensor = s->priv;
f->fmt.pix = sensor->pix;
@@ -1312,7 +1295,7 @@ static int ioctl_enum_fmt_cap(struct v4l2_int_device *s,
*/
static int ioctl_dev_init(struct v4l2_int_device *s)
{
- struct sensor *sensor = s->priv;
+ struct sensor_data *sensor = s->priv;
u32 tgt_xclk; /* target xclk */
u32 tgt_fps; /* target frames per secound */
enum ov5640_frame_rate frame_rate;
@@ -1415,6 +1398,7 @@ static int ov5640_probe(struct i2c_client *client,
ov5640_data.mclk = 24000000; /* 6 - 54 MHz, typical 24MHz */
ov5640_data.mclk = plat_data->mclk;
ov5640_data.csi = plat_data->csi;
+ ov5640_data.io_init = plat_data->io_init;
ov5640_data.i2c_client = client;
ov5640_data.pix.pixelformat = V4L2_PIX_FMT_YUYV;
@@ -1484,9 +1468,6 @@ static int ov5640_probe(struct i2c_client *client,
if (plat_data->io_init)
plat_data->io_init();
- if (plat_data->pwdn)
- plat_data->pwdn(0);
-
camera_plat = plat_data;
ov5640_int_device.priv = &ov5640_data;
diff --git a/drivers/media/video/mxc/capture/ov5640_mipi.c b/drivers/media/video/mxc/capture/ov5640_mipi.c
index 7b678f7fa0e4..bd47d9d45413 100644
--- a/drivers/media/video/mxc/capture/ov5640_mipi.c
+++ b/drivers/media/video/mxc/capture/ov5640_mipi.c
@@ -80,27 +80,7 @@ struct ov5640_mode_info {
/*!
* Maintains the information on the current state of the sesor.
*/
-struct sensor {
- const struct ov5640_platform_data *platform_data;
- struct v4l2_int_device *v4l2_int_device;
- struct i2c_client *i2c_client;
- struct v4l2_pix_format pix;
- struct v4l2_captureparm streamcap;
- bool on;
-
- /* control settings */
- int brightness;
- int hue;
- int contrast;
- int saturation;
- int red;
- int green;
- int blue;
- int ae_mode;
-
- u32 mclk;
- int csi;
-} ov5640_data;
+struct sensor_data ov5640_data;
static struct reg_value ov5640_init_setting_30fps_VGA[] = {
{0x3103, 0x11, 0, 0}, {0x3008, 0x82, 0, 5}, {0x3008, 0x42, 0, 0},
@@ -773,7 +753,7 @@ static int ioctl_g_ifparm(struct v4l2_int_device *s, struct v4l2_ifparm *p)
*/
static int ioctl_s_power(struct v4l2_int_device *s, int on)
{
- struct sensor *sensor = s->priv;
+ struct sensor_data *sensor = s->priv;
if (on && !sensor->on) {
if (io_regulator)
@@ -801,6 +781,9 @@ static int ioctl_s_power(struct v4l2_int_device *s, int on)
regulator_disable(io_regulator);
if (gpo_regulator)
regulator_disable(gpo_regulator);
+
+ if (camera_plat->pwdn)
+ camera_plat->pwdn(1);
}
sensor->on = on;
@@ -817,7 +800,7 @@ static int ioctl_s_power(struct v4l2_int_device *s, int on)
*/
static int ioctl_g_parm(struct v4l2_int_device *s, struct v4l2_streamparm *a)
{
- struct sensor *sensor = s->priv;
+ struct sensor_data *sensor = s->priv;
struct v4l2_captureparm *cparm = &a->parm.capture;
int ret = 0;
@@ -862,7 +845,7 @@ static int ioctl_g_parm(struct v4l2_int_device *s, struct v4l2_streamparm *a)
*/
static int ioctl_s_parm(struct v4l2_int_device *s, struct v4l2_streamparm *a)
{
- struct sensor *sensor = s->priv;
+ struct sensor_data *sensor = s->priv;
struct v4l2_fract *timeperframe = &a->parm.capture.timeperframe;
u32 tgt_fps; /* target frames per secound */
enum ov5640_frame_rate frame_rate;
@@ -946,7 +929,7 @@ static int ioctl_s_parm(struct v4l2_int_device *s, struct v4l2_streamparm *a)
*/
static int ioctl_g_fmt_cap(struct v4l2_int_device *s, struct v4l2_format *f)
{
- struct sensor *sensor = s->priv;
+ struct sensor_data *sensor = s->priv;
f->fmt.pix = sensor->pix;
@@ -1125,7 +1108,7 @@ static int ioctl_enum_fmt_cap(struct v4l2_int_device *s,
*/
static int ioctl_dev_init(struct v4l2_int_device *s)
{
- struct sensor *sensor = s->priv;
+ struct sensor_data *sensor = s->priv;
u32 tgt_xclk; /* target xclk */
u32 tgt_fps; /* target frames per secound */
int ret;
@@ -1250,6 +1233,7 @@ static int ov5640_probe(struct i2c_client *client,
ov5640_data.mclk = 24000000; /* 6 - 54 MHz, typical 24MHz */
ov5640_data.mclk = plat_data->mclk;
ov5640_data.csi = plat_data->csi;
+ ov5640_data.io_init = plat_data->io_init;
ov5640_data.i2c_client = client;
ov5640_data.pix.pixelformat = V4L2_PIX_FMT_UYVY;
@@ -1319,9 +1303,6 @@ static int ov5640_probe(struct i2c_client *client,
if (plat_data->io_init)
plat_data->io_init();
- if (plat_data->pwdn)
- plat_data->pwdn(0);
-
camera_plat = plat_data;
ov5640_int_device.priv = &ov5640_data;
diff --git a/drivers/media/video/mxc/capture/ov5642.c b/drivers/media/video/mxc/capture/ov5642.c
index 206c96b5ebc7..38f22e7a942a 100644
--- a/drivers/media/video/mxc/capture/ov5642.c
+++ b/drivers/media/video/mxc/capture/ov5642.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 Freescale Semiconductor, Inc. All Rights Reserved.
+ * Copyright (C) 2012 Freescale Semiconductor, Inc. All Rights Reserved.
*/
/*
@@ -79,27 +79,7 @@ struct ov5642_mode_info {
/*!
* Maintains the information on the current state of the sesor.
*/
-struct sensor {
- const struct ov5642_platform_data *platform_data;
- struct v4l2_int_device *v4l2_int_device;
- struct i2c_client *i2c_client;
- struct v4l2_pix_format pix;
- struct v4l2_captureparm streamcap;
- bool on;
-
- /* control settings */
- int brightness;
- int hue;
- int contrast;
- int saturation;
- int red;
- int green;
- int blue;
- int ae_mode;
-
- u32 mclk;
- int csi;
-} ov5642_data;
+struct sensor_data ov5642_data;
static struct reg_value ov5642_rotate_none_VGA[] = {
{0x3818, 0xc1, 0x00, 0x00}, {0x3621, 0x87, 0x00, 0x00},
@@ -2155,7 +2135,7 @@ static int ioctl_g_ifparm(struct v4l2_int_device *s, struct v4l2_ifparm *p)
*/
static int ioctl_s_power(struct v4l2_int_device *s, int on)
{
- struct sensor *sensor = s->priv;
+ struct sensor_data *sensor = s->priv;
if (on && !sensor->on) {
if (io_regulator)
@@ -2183,6 +2163,9 @@ static int ioctl_s_power(struct v4l2_int_device *s, int on)
regulator_disable(io_regulator);
if (gpo_regulator)
regulator_disable(gpo_regulator);
+
+ if (camera_plat->pwdn)
+ camera_plat->pwdn(1);
}
sensor->on = on;
@@ -2199,7 +2182,7 @@ static int ioctl_s_power(struct v4l2_int_device *s, int on)
*/
static int ioctl_g_parm(struct v4l2_int_device *s, struct v4l2_streamparm *a)
{
- struct sensor *sensor = s->priv;
+ struct sensor_data *sensor = s->priv;
struct v4l2_captureparm *cparm = &a->parm.capture;
int ret = 0;
@@ -2244,7 +2227,7 @@ static int ioctl_g_parm(struct v4l2_int_device *s, struct v4l2_streamparm *a)
*/
static int ioctl_s_parm(struct v4l2_int_device *s, struct v4l2_streamparm *a)
{
- struct sensor *sensor = s->priv;
+ struct sensor_data *sensor = s->priv;
struct v4l2_fract *timeperframe = &a->parm.capture.timeperframe;
u32 tgt_fps; /* target frames per secound */
enum ov5642_frame_rate frame_rate;
@@ -2326,7 +2309,7 @@ static int ioctl_s_parm(struct v4l2_int_device *s, struct v4l2_streamparm *a)
*/
static int ioctl_g_fmt_cap(struct v4l2_int_device *s, struct v4l2_format *f)
{
- struct sensor *sensor = s->priv;
+ struct sensor_data *sensor = s->priv;
f->fmt.pix = sensor->pix;
@@ -2387,7 +2370,7 @@ static int ioctl_g_ctrl(struct v4l2_int_device *s, struct v4l2_control *vc)
static int ioctl_s_ctrl(struct v4l2_int_device *s, struct v4l2_control *vc)
{
int retval = 0;
- struct sensor *sensor = s->priv;
+ struct sensor_data *sensor = s->priv;
__u32 captureMode = sensor->streamcap.capturemode;
pr_debug("In ov5642:ioctl_s_ctrl %d\n",
@@ -2561,7 +2544,7 @@ static int ioctl_dev_init(struct v4l2_int_device *s)
u8 RegVal = 0;
int retval = 0;
- struct sensor *sensor = s->priv;
+ struct sensor_data *sensor = s->priv;
u32 tgt_xclk; /* target xclk */
u32 tgt_fps; /* target frames per secound */
enum ov5642_frame_rate frame_rate;
@@ -2689,6 +2672,7 @@ static int ov5642_probe(struct i2c_client *client,
ov5642_data.mclk = 24000000; /* 6 - 54 MHz, typical 24MHz */
ov5642_data.mclk = plat_data->mclk;
ov5642_data.csi = plat_data->csi;
+ ov5642_data.io_init = plat_data->io_init;
ov5642_data.i2c_client = client;
ov5642_data.pix.pixelformat = V4L2_PIX_FMT_YUYV;
@@ -2758,9 +2742,6 @@ static int ov5642_probe(struct i2c_client *client,
if (plat_data->io_init)
plat_data->io_init();
- if (plat_data->pwdn)
- plat_data->pwdn(0);
-
camera_plat = plat_data;
ov5642_int_device.priv = &ov5642_data;