From dac06a55940ff2bd3e5b7a388fff9270a9434dec Mon Sep 17 00:00:00 2001 From: ddl Date: Thu, 16 May 2013 18:40:28 +0800 Subject: [PATCH] camera: cif:v0.3.5 generic_sensor:v0.1.7 --- drivers/media/video/generic_sensor.c | 18 +++++++++--------- drivers/media/video/generic_sensor.h | 2 +- drivers/media/video/rk30_camera_oneframe.c | 9 +++++---- 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/drivers/media/video/generic_sensor.c b/drivers/media/video/generic_sensor.c index a8640fbebf3e..ec12fb506cb3 100755 --- a/drivers/media/video/generic_sensor.c +++ b/drivers/media/video/generic_sensor.c @@ -21,10 +21,10 @@ *v0.1.3: * add support flash control; * -*v0.1.5: +*v0.1.5/v0.1.7: * fix use v4l2_mbus_framefmt.reserved array overflow in generic_sensor_s_fmt; */ -static int version = KERNEL_VERSION(0,1,5); +static int version = KERNEL_VERSION(0,1,7); module_param(version, int, S_IRUGO); @@ -851,11 +851,11 @@ int generic_sensor_s_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf) { struct i2c_client *client = v4l2_get_subdevdata(sd); struct soc_camera_device *icd = client->dev.platform_data; - const struct rk_sensor_datafmt *fmt; + const struct rk_sensor_datafmt *fmt=NULL; struct generic_sensor *sensor = to_generic_sensor(client); struct rk_sensor_sequence *winseqe_set_addr=NULL; - struct sensor_v4l2ctrl_info_s *v4l2ctrl_info; - bool is_capture=(mf->reserved[6]==0xfefe5a5a)?true:false; /* ddl@rock-chips.com : v0.1.5 */ + struct sensor_v4l2ctrl_info_s *v4l2ctrl_info=NULL; + bool is_capture=(mf->reserved[0]==0xfefe5a5a)?true:false; /* ddl@rock-chips.com : v0.1.5 */ int ret=0; fmt =generic_sensor_find_datafmt(mf->code, sensor->info_priv.datafmt, @@ -876,7 +876,7 @@ int generic_sensor_s_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf) ret |= sensor->sensor_cb.sensor_s_fmt_cb_th(client, mf, is_capture); v4l2ctrl_info = sensor_find_ctrl(sensor->ctrls,V4L2_CID_FLASH); /* ddl@rock-chips.com: v0.1.3 */ - if (v4l2ctrl_info) { + if (v4l2ctrl_info!=NULL) { if (is_capture) { if ((v4l2ctrl_info->cur_value == 2) || (v4l2ctrl_info->cur_value == 1)) { generic_sensor_ioctrl(icd, Sensor_Flash, 1); @@ -885,7 +885,7 @@ int generic_sensor_s_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf) generic_sensor_ioctrl(icd, Sensor_Flash, 0); } } - + ret |= generic_sensor_write_array(client, winseqe_set_addr->data); if (ret != 0) { SENSOR_TR("set format capability failed"); @@ -1035,7 +1035,7 @@ int generic_sensor_s_ext_controls(struct v4l2_subdev *sd, struct v4l2_ext_contro { struct i2c_client *client = v4l2_get_subdevdata(sd); struct soc_camera_device *icd = client->dev.platform_data; - struct generic_sensor*sensor = to_generic_sensor(client); + //struct generic_sensor*sensor = to_generic_sensor(client); int i, error_cnt=0, error_idx=-1; @@ -1293,7 +1293,7 @@ int generic_sensor_enum_fmt(struct v4l2_subdev *sd, unsigned int index, break; } -set_end: +//set_end: if (sensor_work->wait == false) { kfree((void*)sensor_work); } else { diff --git a/drivers/media/video/generic_sensor.h b/drivers/media/video/generic_sensor.h index 31526d072a9c..6cdae7211ba1 100755 --- a/drivers/media/video/generic_sensor.h +++ b/drivers/media/video/generic_sensor.h @@ -493,7 +493,7 @@ static inline int sensor_v4l2ctrl_default_cb(struct soc_camera_device *icd, stru static inline int sensor_v4l2ctrl_flash_cb(struct soc_camera_device *icd, struct sensor_v4l2ctrl_info_s *ctrl_info, struct v4l2_ext_control *ext_ctrl) { - struct i2c_client *client = to_i2c_client(to_soc_camera_control(icd)); + //struct i2c_client *client = to_i2c_client(to_soc_camera_control(icd)); int value = ext_ctrl->value; if ((value < ctrl_info->qctrl->minimum) || (value > ctrl_info->qctrl->maximum)) { diff --git a/drivers/media/video/rk30_camera_oneframe.c b/drivers/media/video/rk30_camera_oneframe.c index cd1ac2be2fca..aef351e5693c 100755 --- a/drivers/media/video/rk30_camera_oneframe.c +++ b/drivers/media/video/rk30_camera_oneframe.c @@ -297,11 +297,11 @@ module_param(debug, int, S_IRUGO|S_IWUSR); *v0.3.1 : * 1. compatible with generic_sensor; * -*v0.3.3 : +*v0.3.3 / v0.3.5: * 1. fix use v4l2_mbus_framefmt.reserved array overflow in generic_sensor_s_fmt; */ -#define RK_CAM_VERSION_CODE KERNEL_VERSION(0, 3, 0x03) +#define RK_CAM_VERSION_CODE KERNEL_VERSION(0, 3, 0x05) static int version = RK_CAM_VERSION_CODE; module_param(version, int, S_IRUGO); @@ -2111,13 +2111,14 @@ static int rk_camera_set_fmt(struct soc_camera_device *icd, stream_on = read_cif_reg(pcdev->base,CIF_CIF_CTRL); if (stream_on & ENABLE_CAPTURE) write_cif_reg(pcdev->base,CIF_CIF_CTRL, (stream_on & (~ENABLE_CAPTURE))); - + mf.width = pix->width; mf.height = pix->height; mf.field = pix->field; mf.colorspace = pix->colorspace; mf.code = xlate->code; - mf.reserved[6] = pix->priv; /* ddl@rock-chips.com : v0.3.3 */ + mf.reserved[0] = pix->priv; /* ddl@rock-chips.com : v0.3.3 */ + ret = v4l2_subdev_call(sd, video, s_mbus_fmt, &mf); if (mf.code != xlate->code) return -EINVAL; -- 2.34.1