camera: Port all sensor driver for rockchip to 3.0 kernel

This commit is contained in:
ddl 2012-01-30 15:17:53 +08:00
parent 01dd8fe7ad
commit 1c2e256b7b
18 changed files with 3495 additions and 444 deletions

View File

@ -817,26 +817,26 @@ config SOC_CAMERA_MT9T031
This driver supports MT9T031 cameras from Micron.
config SOC_CAMERA_MT9T111
tristate "mt9t111 support"
tristate "mt9t111 support for rockchip"
depends on SOC_CAMERA && I2C
help
This driver supports MT9T111 cameras from Micron.
This driver supports MT9T111 cameras from Micron for rockchip.
config SOC_CAMERA_MT9P111
tristate "mt9p111 support"
tristate "mt9p111 support for rockchip"
depends on SOC_CAMERA && I2C
help
This driver supports MT9P111 cameras from Micron.
This driver supports MT9P111 cameras from Micron for rockchip.
config SOC_CAMERA_MT9D112
tristate "mt9d112 support"
tristate "mt9d112 support for rockchip"
depends on SOC_CAMERA && I2C
help
This driver supports MT9D112 cameras from Micron
This driver supports MT9D112 cameras from Micron for rockchip
config SOC_CAMERA_MT9D113
tristate "mt9d113 support"
tristate "mt9d113 support for rockchip"
depends on SOC_CAMERA && I2C
help
This driver supports MT9D113 cameras from Micron
This driver supports MT9D113 cameras from Micron for rockchip
config SOC_CAMERA_MT9T112
tristate "mt9t112 support"
@ -888,46 +888,46 @@ config SOC_CAMERA_OV772X
This is a ov772x camera driver
config SOC_CAMERA_OV7675
tristate "ov7675 camera support"
tristate "ov7675 camera support for rockchip"
depends on SOC_CAMERA && I2C
help
This is a ov7675 camera driver
This is a ov7675 camera driver for rockchip
config SOC_CAMERA_OV2655
tristate "ov2655 camera support"
tristate "ov2655 camera support for rockchip"
depends on SOC_CAMERA && I2C
help
This is a ov2655 camera driver
This is a ov2655 camera driver for rockchip
config SOC_CAMERA_OV2659
tristate "ov2659 camera support"
tristate "ov2659 camera support for rockchip"
depends on SOC_CAMERA && I2C
help
This is a ov2659 camera driver
This is a ov2659 camera driver for rockchip
config SOC_CAMERA_OV7690
tristate "ov7690 camera support"
tristate "ov7690 camera support for rockchip"
depends on SOC_CAMERA && I2C
help
This is a ov7690 camera driver
This is a ov7690 camera driver for rockchip
config SOC_CAMERA_OV9650
tristate "ov9650 camera support"
tristate "ov9650 camera support for rockchip"
depends on SOC_CAMERA && I2C
help
This is a ov9650 camera driver
This is a ov9650 camera driver for rockchip
config SOC_CAMERA_OV2640
tristate "ov2640 camera support"
config SOC_CAMERA_OV2640_RK
tristate "ov2640 camera support for rockchip"
depends on SOC_CAMERA && I2C
help
This is a ov2640 camera driver
This is a ov2640 camera driver for rockchip
config SOC_CAMERA_OV3640
tristate "ov3640 camera support"
tristate "ov3640 camera support for rockchip"
depends on SOC_CAMERA && I2C
help
This is a ov3640 camera driver
This is a ov3640 camera driver for rockchip
choice
prompt "OV3640 Module Focus select"
depends on SOC_CAMERA_OV3640
@ -942,10 +942,10 @@ config OV3640_FIXEDFOCUS
endchoice
config SOC_CAMERA_OV5642
tristate "ov5642 camera support"
tristate "ov5642 camera support for rockchip"
depends on SOC_CAMERA && I2C
help
This is a ov5642 camera driver
This is a ov5642 camera driver for rockchip
choice
prompt "OV5642 Module Focus select"
depends on SOC_CAMERA_OV5642
@ -960,10 +960,10 @@ config OV5642_FIXEDFOCUS
endchoice
config SOC_CAMERA_OV5640
tristate "ov5640 camera support"
tristate "ov5640 camera support for rockchip"
depends on SOC_CAMERA && I2C
help
This is a ov5640 camera driver
This is a ov5640 camera driver for rockchip
choice
prompt "OV5640 Module Focus select"
depends on SOC_CAMERA_OV5640
@ -996,34 +996,34 @@ config OV5640_FIXEDFOCUS_FOR_TD8801
endchoice
config SOC_CAMERA_S5K6AA
tristate "Samsung S5K6AA camera support"
tristate "Samsung S5K6AA camera support for rockchip"
depends on SOC_CAMERA && I2C
help
This is a samsung S5K6AA camera driver
This is a samsung S5K6AA camera driver for rockchip
config SOC_CAMERA_GT2005
tristate "GT2005 support"
tristate "GT2005 support for rockchip"
depends on SOC_CAMERA && I2C
help
This is a GT2005 camera driver
This is a GT2005 camera driver for rockchip
config SOC_CAMERA_GC0307
tristate "GC0307 support"
tristate "GC0307 support for rockchip"
depends on SOC_CAMERA && I2C
help
This is a GC0307 camera driver
This is a GC0307 camera driver for rockchip
config SOC_CAMERA_GC0308
tristate "GC0308 support"
tristate "GC0308 support for rockchip"
depends on SOC_CAMERA && I2C
help
This is a GC0308 camera driver
This is a GC0308 camera driver for rockchip
config SOC_CAMERA_GC0309
tristate "GC0309 support"
tristate "GC0309 support for rockchip"
depends on SOC_CAMERA && I2C
help
This is a GC0309 camera driver
This is a GC0309 camera driver for rockchip
config SOC_CAMERA_GC0309_FOR_TD8801
tristate "GC0309 support for td8801"
depends on SOC_CAMERA && I2C
@ -1031,40 +1031,40 @@ config SOC_CAMERA_GC0309_FOR_TD8801
This is a GC0309 camera driver for td8801
config SOC_CAMERA_GC2015
tristate "GC2015 support"
tristate "GC2015 support for rockchip"
depends on SOC_CAMERA && I2C
help
This is a GC2015 camera driver
This is a GC2015 camera driver for rockchip
config SOC_CAMERA_HI253
tristate "HI253 support"
tristate "HI253 support for rockchip"
depends on SOC_CAMERA && I2C
help
This is a HI253 camera driver
This is a HI253 camera driver for rockchip
config SOC_CAMERA_HI704
tristate "HI704 support"
tristate "HI704 support for rockchip"
depends on SOC_CAMERA && I2C
help
This is a HI704 camera driver
This is a HI704 camera driver for rockchip
config SOC_CAMERA_SIV120B
tristate "siv120b support"
tristate "siv120b support for rockchip"
depends on SOC_CAMERA && I2C
help
This is a SIV120B camera driver
This is a SIV120B camera driver for rockchip
config SOC_CAMERA_SID130B
tristate "sid130b support"
tristate "sid130b support for rockchip"
depends on SOC_CAMERA && I2C
help
This is a SID130B camera driver
This is a SID130B camera driver for rockchip
config SOC_CAMERA_NT99250
tristate "NT99250 support"
tristate "NT99250 support for rockchip"
depends on SOC_CAMERA && I2C
help
This is a NT99250 camera driver
This is a NT99250 camera driver for rockchip
config SOC_CAMERA_OV9640
tristate "ov9640 camera support"

View File

@ -94,7 +94,7 @@ obj-$(CONFIG_SOC_CAMERA_OV2655) += ov2655.o
obj-$(CONFIG_SOC_CAMERA_OV2659) += ov2659.o
obj-$(CONFIG_SOC_CAMERA_OV7690) += ov7690.o
obj-$(CONFIG_SOC_CAMERA_OV9650) += ov9650.o
obj-$(CONFIG_SOC_CAMERA_OV2640) += ov2640.o
obj-$(CONFIG_SOC_CAMERA_OV2640_RK) += ov2640_rk.o
obj-$(CONFIG_SOC_CAMERA_OV3640) += ov3640.o
obj-$(CONFIG_SOC_CAMERA_OV5640) += ov5640.o
obj-$(CONFIG_SOC_CAMERA_OV5640_FOR_TD8801) += ov5640_for_td8801.o

View File

@ -54,7 +54,7 @@ module_param(debug, int, S_IRUGO|S_IWUSR);
#define SENSOR_INIT_WIDTH 640 /* Sensor pixel size for sensor_init_data array */
#define SENSOR_INIT_HEIGHT 480
#define SENSOR_INIT_WINSEQADR sensor_vga
#define SENSOR_INIT_PIXFMT V4L2_PIX_FMT_YUYV
#define SENSOR_INIT_PIXFMT V4L2_MBUS_FMT_YUYV8_2X8
#define CONFIG_SENSOR_WhiteBalance 1
#define CONFIG_SENSOR_Brightness 0
@ -1272,8 +1272,12 @@ static int sensor_suspend(struct soc_camera_device *icd, pm_message_t pm_msg);
static int sensor_resume(struct soc_camera_device *icd);
static int sensor_set_bus_param(struct soc_camera_device *icd,unsigned long flags);
static unsigned long sensor_query_bus_param(struct soc_camera_device *icd);
#if CONFIG_SENSOR_Effect
static int sensor_set_effect(struct soc_camera_device *icd, const struct v4l2_queryctrl *qctrl, int value);
#endif
#if CONFIG_SENSOR_WhiteBalance
static int sensor_set_whiteBalance(struct soc_camera_device *icd, const struct v4l2_queryctrl *qctrl, int value);
#endif
static int sensor_deactivate(struct i2c_client *client);
static struct soc_camera_ops sensor_ops =
@ -1288,18 +1292,29 @@ static struct soc_camera_ops sensor_ops =
.num_menus = ARRAY_SIZE(sensor_menus),
};
#define COL_FMT(_name, _depth, _fourcc, _colorspace) \
{ .name = _name, .depth = _depth, .fourcc = _fourcc, \
.colorspace = _colorspace }
#define JPG_FMT(_name, _depth, _fourcc) \
COL_FMT(_name, _depth, _fourcc, V4L2_COLORSPACE_JPEG)
static const struct soc_camera_data_format sensor_colour_formats[] = {
JPG_FMT(SENSOR_NAME_STRING(YUYV), 16, V4L2_PIX_FMT_YUYV),
//JPG_FMT(SENSOR_NAME_STRING(UYVY), 16, V4L2_PIX_FMT_UYVY),
/* only one fixed colorspace per pixelcode */
struct sensor_datafmt {
enum v4l2_mbus_pixelcode code;
enum v4l2_colorspace colorspace;
};
/* Find a data format by a pixel code in an array */
static const struct sensor_datafmt *sensor_find_datafmt(
enum v4l2_mbus_pixelcode code, const struct sensor_datafmt *fmt,
int n)
{
int i;
for (i = 0; i < n; i++)
if (fmt[i].code == code)
return fmt + i;
return NULL;
}
static const struct sensor_datafmt sensor_colour_fmts[] = {
{V4L2_MBUS_FMT_YUYV8_2X8, V4L2_COLORSPACE_JPEG},
{V4L2_MBUS_FMT_UYVY8_2X8, V4L2_COLORSPACE_JPEG}
};
typedef struct sensor_info_priv_s
{
int whiteBalance;
@ -1317,7 +1332,7 @@ typedef struct sensor_info_priv_s
unsigned char mirror; /* HFLIP */
unsigned char flip; /* VFLIP */
unsigned int winseqe_cur_addr;
unsigned int pixfmt;
struct sensor_datafmt fmt;
unsigned int funmodule_state;
} sensor_info_priv_t;
@ -1601,10 +1616,11 @@ static int sensor_ioctrl(struct soc_camera_device *icd,enum rk29sensor_power_cmd
static int sensor_init(struct v4l2_subdev *sd, u32 val)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);;
struct soc_camera_device *icd = client->dev.platform_data;
struct sensor *sensor = to_sensor(client);
const struct v4l2_queryctrl *qctrl;
const struct sensor_datafmt *fmt;
int ret;
@ -1656,7 +1672,13 @@ static int sensor_init(struct v4l2_subdev *sd, u32 val)
//icd->user_width = SENSOR_INIT_WIDTH;
//icd->user_height = SENSOR_INIT_HEIGHT;
sensor->info_priv.winseqe_cur_addr = (int)SENSOR_INIT_WINSEQADR;
sensor->info_priv.pixfmt = SENSOR_INIT_PIXFMT;
fmt = sensor_find_datafmt(SENSOR_INIT_PIXFMT,sensor_colour_fmts, ARRAY_SIZE(sensor_colour_fmts));
if (!fmt) {
SENSOR_TR("error: %s initial array colour fmts is not support!!",SENSOR_NAME_STRING());
ret = -EINVAL;
goto sensor_INIT_ERR;
}
sensor->info_priv.fmt = *fmt;
/* sensor sensor information for initialization */
qctrl = soc_camera_find_qctrl(&sensor_ops, V4L2_CID_DO_WHITE_BALANCE);
@ -1797,78 +1819,81 @@ static unsigned long sensor_query_bus_param(struct soc_camera_device *icd)
return soc_camera_apply_sensor_flags(icl, flags);
}
static int sensor_g_fmt(struct v4l2_subdev *sd, struct v4l2_format *f)
static int sensor_g_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct soc_camera_device *icd = client->dev.platform_data;
struct sensor *sensor = to_sensor(client);
struct v4l2_pix_format *pix = &f->fmt.pix;
pix->width = icd->user_width;
pix->height = icd->user_height;
pix->pixelformat = sensor->info_priv.pixfmt;
pix->field = V4L2_FIELD_NONE;
pix->colorspace = V4L2_COLORSPACE_JPEG;
mf->width = icd->user_width;
mf->height = icd->user_height;
mf->code = sensor->info_priv.fmt.code;
mf->colorspace = sensor->info_priv.fmt.colorspace;
mf->field = V4L2_FIELD_NONE;
return 0;
}
static bool sensor_fmt_capturechk(struct v4l2_subdev *sd, struct v4l2_format *f)
static bool sensor_fmt_capturechk(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf)
{
bool ret = false;
if ((f->fmt.pix.width == 1024) && (f->fmt.pix.height == 768)) {
if ((mf->width == 1024) && (mf->height == 768)) {
ret = true;
} else if ((f->fmt.pix.width == 1280) && (f->fmt.pix.height == 720)) {
} else if ((mf->width == 1280) && (mf->height == 1024)) {
ret = true;
} else if ((f->fmt.pix.width == 1280) && (f->fmt.pix.height == 1024)) {
} else if ((mf->width == 1600) && (mf->height == 1200)) {
ret = true;
} else if ((f->fmt.pix.width == 1600) && (f->fmt.pix.height == 1200)) {
} else if ((mf->width == 2048) && (mf->height == 1536)) {
ret = true;
} else if ((f->fmt.pix.width == 2048) && (f->fmt.pix.height == 1536)) {
ret = true;
} else if ((f->fmt.pix.width == 2592) && (f->fmt.pix.height == 1944)) {
} else if ((mf->width == 2592) && (mf->height == 1944)) {
ret = true;
}
if (ret == true)
SENSOR_DG("%s %dx%d is capture format\n", __FUNCTION__, f->fmt.pix.width, f->fmt.pix.height);
SENSOR_DG("%s %dx%d is capture format\n", __FUNCTION__, mf->width, mf->height);
return ret;
}
static bool sensor_fmt_videochk(struct v4l2_subdev *sd, struct v4l2_format *f)
static bool sensor_fmt_videochk(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf)
{
bool ret = false;
if ((f->fmt.pix.width == 1280) && (f->fmt.pix.height == 720)) {
if ((mf->width == 1280) && (mf->height == 720)) {
ret = true;
} else if ((f->fmt.pix.width == 1920) && (f->fmt.pix.height == 1080)) {
} else if ((mf->width == 1920) && (mf->height == 1080)) {
ret = true;
}
if (ret == true)
SENSOR_DG("%s %dx%d is video format\n", __FUNCTION__, f->fmt.pix.width, f->fmt.pix.height);
SENSOR_DG("%s %dx%d is video format\n", __FUNCTION__, mf->width, mf->height);
return ret;
}
static int sensor_s_fmt(struct v4l2_subdev *sd, struct v4l2_format *f)
static int sensor_s_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);
const struct sensor_datafmt *fmt;
struct sensor *sensor = to_sensor(client);
struct v4l2_pix_format *pix = &f->fmt.pix;
const struct v4l2_queryctrl *qctrl;
struct soc_camera_device *icd = client->dev.platform_data;
const struct v4l2_queryctrl *qctrl;
struct soc_camera_device *icd = client->dev.platform_data;
struct reginfo *winseqe_set_addr=NULL;
int ret=0, set_w,set_h;
if (sensor->info_priv.pixfmt != pix->pixelformat) {
switch (pix->pixelformat)
fmt = sensor_find_datafmt(mf->code, sensor_colour_fmts,
ARRAY_SIZE(sensor_colour_fmts));
if (!fmt) {
ret = -EINVAL;
goto sensor_s_fmt_end;
}
if (sensor->info_priv.fmt.code != mf->code) {
switch (mf->code)
{
case V4L2_PIX_FMT_YUYV:
case V4L2_MBUS_FMT_YUYV8_2X8:
{
winseqe_set_addr = sensor_ClrFmt_YUYV;
break;
}
case V4L2_PIX_FMT_UYVY:
case V4L2_MBUS_FMT_UYVY8_2X8:
{
winseqe_set_addr = sensor_ClrFmt_UYVY;
break;
@ -1878,16 +1903,16 @@ static int sensor_s_fmt(struct v4l2_subdev *sd, struct v4l2_format *f)
}
if (winseqe_set_addr != NULL) {
sensor_write_array(client, winseqe_set_addr);
sensor->info_priv.pixfmt = pix->pixelformat;
SENSOR_DG("%s Pixelformat(0x%x) set success!\n", SENSOR_NAME_STRING(),pix->pixelformat);
sensor->info_priv.fmt.code = mf->code;
sensor->info_priv.fmt.colorspace= mf->colorspace;
SENSOR_DG("%s v4l2_mbus_code:%d set success!\n", SENSOR_NAME_STRING(),mf->code);
} else {
SENSOR_TR("%s Pixelformat(0x%x) is invalidate!\n", SENSOR_NAME_STRING(),pix->pixelformat);
SENSOR_TR("%s v4l2_mbus_code:%d is invalidate!\n", SENSOR_NAME_STRING(),mf->code);
}
}
set_w = pix->width;
set_h = pix->height;
set_w = mf->width;
set_h = mf->height;
if (((set_w <= 176) && (set_h <= 144)) && sensor_qcif[0].reg!=0xff)
{
@ -1936,12 +1961,12 @@ static int sensor_s_fmt(struct v4l2_subdev *sd, struct v4l2_format *f)
winseqe_set_addr = SENSOR_INIT_WINSEQADR; /* ddl@rock-chips.com : Sensor output smallest size if isn't support app */
set_w = SENSOR_INIT_WIDTH;
set_h = SENSOR_INIT_HEIGHT;
SENSOR_TR("\n %s..%s Format is Invalidate. pix->width = %d.. pix->height = %d\n",SENSOR_NAME_STRING(),__FUNCTION__,pix->width,pix->height);
SENSOR_TR("\n %s..%s Format is Invalidate. pix->width = %d.. pix->height = %d\n",SENSOR_NAME_STRING(),__FUNCTION__,mf->width,mf->height);
}
if ((int)winseqe_set_addr != sensor->info_priv.winseqe_cur_addr) {
#if CONFIG_SENSOR_Flash
if (sensor_fmt_capturechk(sd,f) == true) { /* ddl@rock-chips.com : Capture */
if (sensor_fmt_capturechk(sd,mf) == true) { /* ddl@rock-chips.com : Capture */
if ((sensor->info_priv.flash == 1) || (sensor->info_priv.flash == 2)) {
sensor_ioctrl(icd, Sensor_Flash, Flash_On);
SENSOR_DG("%s flash on in capture!\n", SENSOR_NAME_STRING());
@ -1957,7 +1982,7 @@ static int sensor_s_fmt(struct v4l2_subdev *sd, struct v4l2_format *f)
if (ret != 0) {
SENSOR_TR("%s set format capability failed\n", SENSOR_NAME_STRING());
#if CONFIG_SENSOR_Flash
if (sensor_fmt_capturechk(sd,f) == true) {
if (sensor_fmt_capturechk(sd,mf) == true) {
if ((sensor->info_priv.flash == 1) || (sensor->info_priv.flash == 2)) {
sensor_ioctrl(icd, Sensor_Flash, Flash_Off);
SENSOR_TR("%s Capture format set fail, flash off !\n", SENSOR_NAME_STRING());
@ -1969,7 +1994,7 @@ static int sensor_s_fmt(struct v4l2_subdev *sd, struct v4l2_format *f)
sensor->info_priv.winseqe_cur_addr = (int)winseqe_set_addr;
if (sensor_fmt_capturechk(sd,f) == true) { /* ddl@rock-chips.com : Capture */
if (sensor_fmt_capturechk(sd,mf) == true) { /* ddl@rock-chips.com : Capture */
qctrl = soc_camera_find_qctrl(&sensor_ops, V4L2_CID_EFFECT);
sensor_set_effect(icd, qctrl,sensor->info_priv.effect);
if (sensor->info_priv.whiteBalance != 0) {
@ -1977,7 +2002,7 @@ static int sensor_s_fmt(struct v4l2_subdev *sd, struct v4l2_format *f)
sensor_set_whiteBalance(icd, qctrl,sensor->info_priv.whiteBalance);
}
sensor->info_priv.snap2preview = true;
} else if (sensor_fmt_videochk(sd,f) == true) { /* ddl@rock-chips.com : Video */
} else if (sensor_fmt_videochk(sd,mf) == true) { /* ddl@rock-chips.com : Video */
qctrl = soc_camera_find_qctrl(&sensor_ops, V4L2_CID_EFFECT);
sensor_set_effect(icd, qctrl,sensor->info_priv.effect);
qctrl = soc_camera_find_qctrl(&sensor_ops, V4L2_CID_DO_WHITE_BALANCE);
@ -1999,44 +2024,45 @@ static int sensor_s_fmt(struct v4l2_subdev *sd, struct v4l2_format *f)
SENSOR_DG("\n %s .. Current Format is validate. icd->width = %d.. icd->height %d\n",SENSOR_NAME_STRING(),set_w,set_h);
}
pix->width = set_w;
pix->height = set_h;
mf->width = set_w;
mf->height = set_h;
sensor_s_fmt_end:
return ret;
}
static int sensor_try_fmt(struct v4l2_subdev *sd, struct v4l2_format *f)
static int sensor_try_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf)
{
struct v4l2_pix_format *pix = &f->fmt.pix;
bool bayer = pix->pixelformat == V4L2_PIX_FMT_UYVY ||
pix->pixelformat == V4L2_PIX_FMT_YUYV;
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct sensor *sensor = to_sensor(client);
const struct sensor_datafmt *fmt;
int ret = 0;
fmt = sensor_find_datafmt(mf->code, sensor_colour_fmts,
ARRAY_SIZE(sensor_colour_fmts));
if (fmt == NULL) {
fmt = &sensor->info_priv.fmt;
mf->code = fmt->code;
}
/*
* With Bayer format enforce even side lengths, but let the user play
* with the starting pixel
*/
if (mf->height > SENSOR_MAX_HEIGHT)
mf->height = SENSOR_MAX_HEIGHT;
else if (mf->height < SENSOR_MIN_HEIGHT)
mf->height = SENSOR_MIN_HEIGHT;
if (pix->height > SENSOR_MAX_HEIGHT)
pix->height = SENSOR_MAX_HEIGHT;
else if (pix->height < SENSOR_MIN_HEIGHT)
pix->height = SENSOR_MIN_HEIGHT;
else if (bayer)
pix->height = ALIGN(pix->height, 2);
if (mf->width > SENSOR_MAX_WIDTH)
mf->width = SENSOR_MAX_WIDTH;
else if (mf->width < SENSOR_MIN_WIDTH)
mf->width = SENSOR_MIN_WIDTH;
if (pix->width > SENSOR_MAX_WIDTH)
pix->width = SENSOR_MAX_WIDTH;
else if (pix->width < SENSOR_MIN_WIDTH)
pix->width = SENSOR_MIN_WIDTH;
else if (bayer)
pix->width = ALIGN(pix->width, 2);
return 0;
mf->colorspace = fmt->colorspace;
return ret;
}
static int sensor_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_dbg_chip_ident *id)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);;
if (id->match.type != V4L2_CHIP_MATCH_I2C_ADDR)
return -EINVAL;
@ -2320,7 +2346,7 @@ static int sensor_set_flash(struct soc_camera_device *icd, const struct v4l2_que
static int sensor_g_control(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);;
struct sensor *sensor = to_sensor(client);
const struct v4l2_queryctrl *qctrl;
@ -2379,7 +2405,7 @@ static int sensor_g_control(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
static int sensor_s_control(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);;
struct sensor *sensor = to_sensor(client);
struct soc_camera_device *icd = client->dev.platform_data;
const struct v4l2_queryctrl *qctrl;
@ -2669,7 +2695,7 @@ static int sensor_s_ext_control(struct soc_camera_device *icd, struct v4l2_ext_c
static int sensor_g_ext_controls(struct v4l2_subdev *sd, struct v4l2_ext_controls *ext_ctrl)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);;
struct soc_camera_device *icd = client->dev.platform_data;
int i, error_cnt=0, error_idx=-1;
@ -2694,7 +2720,7 @@ static int sensor_g_ext_controls(struct v4l2_subdev *sd, struct v4l2_ext_control
static int sensor_s_ext_controls(struct v4l2_subdev *sd, struct v4l2_ext_controls *ext_ctrl)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);;
struct soc_camera_device *icd = client->dev.platform_data;
int i, error_cnt=0, error_idx=-1;
@ -2767,8 +2793,6 @@ static int sensor_video_probe(struct soc_camera_device *icd,
goto sensor_video_probe_err;
}
icd->formats = sensor_colour_formats;
icd->num_formats = ARRAY_SIZE(sensor_colour_formats);
return 0;
@ -2779,7 +2803,7 @@ static int sensor_video_probe(struct soc_camera_device *icd,
static long sensor_ioctl(struct v4l2_subdev *sd, unsigned int cmd, void *arg)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);;
struct soc_camera_device *icd = client->dev.platform_data;
struct sensor *sensor = to_sensor(client);
int ret = 0;
@ -2839,6 +2863,15 @@ static long sensor_ioctl(struct v4l2_subdev *sd, unsigned int cmd, void *arg)
return ret;
}
static int sensor_enum_fmt(struct v4l2_subdev *sd, unsigned int index,
enum v4l2_mbus_pixelcode *code)
{
if (index >= ARRAY_SIZE(sensor_colour_fmts))
return -EINVAL;
*code = sensor_colour_fmts[index].code;
return 0;
}
static struct v4l2_subdev_core_ops sensor_subdev_core_ops = {
.init = sensor_init,
.g_ctrl = sensor_g_control,
@ -2850,9 +2883,10 @@ static struct v4l2_subdev_core_ops sensor_subdev_core_ops = {
};
static struct v4l2_subdev_video_ops sensor_subdev_video_ops = {
.s_fmt = sensor_s_fmt,
.g_fmt = sensor_g_fmt,
.try_fmt = sensor_try_fmt,
.s_mbus_fmt = sensor_s_fmt,
.g_mbus_fmt = sensor_g_fmt,
.try_mbus_fmt = sensor_try_fmt,
.enum_mbus_fmt = sensor_enum_fmt,
};
static struct v4l2_subdev_ops sensor_subdev_ops = {
@ -2895,7 +2929,7 @@ static int sensor_probe(struct i2c_client *client,
/* Second stage probe - when a capture adapter is there */
icd->ops = &sensor_ops;
icd->y_skip_top = 0;
sensor->info_priv.fmt = sensor_colour_fmts[0];
#if CONFIG_SENSOR_I2C_NOSCHED
atomic_set(&sensor->tasklock_cnt,0);
#endif

View File

@ -1491,7 +1491,7 @@ static int sensor_ioctrl(struct soc_camera_device *icd,enum rk29sensor_power_cmd
static int sensor_init(struct v4l2_subdev *sd, u32 val)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct soc_camera_device *icd = client->dev.platform_data;
struct sensor *sensor = to_sensor(client);
const struct v4l2_queryctrl *qctrl;
@ -1673,7 +1673,7 @@ static unsigned long sensor_query_bus_param(struct soc_camera_device *icd)
static int sensor_g_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct soc_camera_device *icd = client->dev.platform_data;
struct sensor *sensor = to_sensor(client);
@ -1722,7 +1722,7 @@ static bool sensor_fmt_videochk(struct v4l2_subdev *sd, struct v4l2_mbus_framefm
}
static int sensor_s_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);
const struct sensor_datafmt *fmt;
struct sensor *sensor = to_sensor(client);
const struct v4l2_queryctrl *qctrl;
@ -1880,7 +1880,7 @@ static int sensor_s_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf)
static int sensor_try_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct sensor *sensor = to_sensor(client);
const struct sensor_datafmt *fmt;
int ret = 0;
@ -1909,7 +1909,7 @@ static int sensor_try_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf)
static int sensor_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_dbg_chip_ident *id)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);
if (id->match.type != V4L2_CHIP_MATCH_I2C_ADDR)
return -EINVAL;
@ -2193,7 +2193,7 @@ static int sensor_set_flash(struct soc_camera_device *icd, const struct v4l2_que
static int sensor_g_control(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct sensor *sensor = to_sensor(client);
const struct v4l2_queryctrl *qctrl;
@ -2252,7 +2252,7 @@ static int sensor_g_control(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
static int sensor_s_control(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct sensor *sensor = to_sensor(client);
struct soc_camera_device *icd = client->dev.platform_data;
const struct v4l2_queryctrl *qctrl;
@ -2542,7 +2542,7 @@ static int sensor_s_ext_control(struct soc_camera_device *icd, struct v4l2_ext_c
static int sensor_g_ext_controls(struct v4l2_subdev *sd, struct v4l2_ext_controls *ext_ctrl)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct soc_camera_device *icd = client->dev.platform_data;
int i, error_cnt=0, error_idx=-1;
@ -2567,7 +2567,7 @@ static int sensor_g_ext_controls(struct v4l2_subdev *sd, struct v4l2_ext_control
static int sensor_s_ext_controls(struct v4l2_subdev *sd, struct v4l2_ext_controls *ext_ctrl)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct soc_camera_device *icd = client->dev.platform_data;
int i, error_cnt=0, error_idx=-1;
@ -2645,7 +2645,7 @@ static int sensor_video_probe(struct soc_camera_device *icd,
static long sensor_ioctl(struct v4l2_subdev *sd, unsigned int cmd, void *arg)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct soc_camera_device *icd = client->dev.platform_data;
struct sensor *sensor = to_sensor(client);
int ret = 0;

View File

@ -59,7 +59,7 @@ module_param(debug, int, S_IRUGO|S_IWUSR);
#define CONFIG_SENSOR_Brightness 0
#define CONFIG_SENSOR_Contrast 0
#define CONFIG_SENSOR_Saturation 0
#define CONFIG_SENSOR_Effect 1
#define CONFIG_SENSOR_Effect 1
#define CONFIG_SENSOR_Scene 1
#define CONFIG_SENSOR_DigitalZoom 0
#define CONFIG_SENSOR_Focus 0
@ -1565,7 +1565,6 @@ static int sensor_init(struct v4l2_subdev *sd, u32 val)
static int sensor_deactivate(struct i2c_client *client)
{
struct soc_camera_device *icd = client->dev.platform_data;
u8 reg_val;
struct sensor *sensor = to_sensor(client);
SENSOR_DG("\n%s..%s.. Enter\n",SENSOR_NAME_STRING(),__FUNCTION__);

View File

@ -1599,7 +1599,7 @@ static int sensor_ioctrl(struct soc_camera_device *icd,enum rk29sensor_power_cmd
}
static int sensor_init(struct v4l2_subdev *sd, u32 val)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct soc_camera_device *icd = client->dev.platform_data;
struct sensor *sensor = to_sensor(client);
const struct v4l2_queryctrl *qctrl;
@ -1808,7 +1808,7 @@ static unsigned long sensor_query_bus_param(struct soc_camera_device *icd)
static int sensor_g_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct soc_camera_device *icd = client->dev.platform_data;
struct sensor *sensor = to_sensor(client);
@ -1857,7 +1857,7 @@ static bool sensor_fmt_videochk(struct v4l2_subdev *sd, struct v4l2_mbus_framefm
}
static int sensor_s_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);
const struct sensor_datafmt *fmt;
struct sensor *sensor = to_sensor(client);
const struct v4l2_queryctrl *qctrl;
@ -2037,7 +2037,7 @@ static int sensor_s_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf)
static int sensor_try_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct sensor *sensor = to_sensor(client);
const struct sensor_datafmt *fmt;
int ret = 0;
@ -2066,7 +2066,7 @@ static int sensor_try_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf)
static int sensor_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_dbg_chip_ident *id)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);
if (id->match.type != V4L2_CHIP_MATCH_I2C_ADDR)
return -EINVAL;
@ -2350,7 +2350,7 @@ static int sensor_set_flash(struct soc_camera_device *icd, const struct v4l2_que
static int sensor_g_control(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct sensor *sensor = to_sensor(client);
const struct v4l2_queryctrl *qctrl;
@ -2409,7 +2409,7 @@ static int sensor_g_control(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
static int sensor_s_control(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct sensor *sensor = to_sensor(client);
struct soc_camera_device *icd = client->dev.platform_data;
const struct v4l2_queryctrl *qctrl;
@ -2699,7 +2699,7 @@ static int sensor_s_ext_control(struct soc_camera_device *icd, struct v4l2_ext_c
static int sensor_g_ext_controls(struct v4l2_subdev *sd, struct v4l2_ext_controls *ext_ctrl)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct soc_camera_device *icd = client->dev.platform_data;
int i, error_cnt=0, error_idx=-1;
@ -2724,7 +2724,7 @@ static int sensor_g_ext_controls(struct v4l2_subdev *sd, struct v4l2_ext_control
static int sensor_s_ext_controls(struct v4l2_subdev *sd, struct v4l2_ext_controls *ext_ctrl)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct soc_camera_device *icd = client->dev.platform_data;
int i, error_cnt=0, error_idx=-1;
@ -2811,7 +2811,7 @@ static int sensor_video_probe(struct soc_camera_device *icd,
}
static long sensor_ioctl(struct v4l2_subdev *sd, unsigned int cmd, void *arg)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct soc_camera_device *icd = client->dev.platform_data;
struct sensor *sensor = to_sensor(client);
int ret = 0;

View File

@ -2246,7 +2246,7 @@ static int sensor_ioctrl(struct soc_camera_device *icd,enum rk29sensor_power_cmd
static int sensor_init(struct v4l2_subdev *sd, u32 val)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct soc_camera_device *icd = client->dev.platform_data;
struct sensor *sensor = to_sensor(client);
const struct v4l2_queryctrl *qctrl;
@ -2463,7 +2463,7 @@ static unsigned long sensor_query_bus_param(struct soc_camera_device *icd)
static int sensor_g_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct soc_camera_device *icd = client->dev.platform_data;
struct sensor *sensor = to_sensor(client);
@ -2512,7 +2512,7 @@ static bool sensor_fmt_videochk(struct v4l2_subdev *sd, struct v4l2_mbus_framefm
}
static int sensor_s_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);
const struct sensor_datafmt *fmt;
struct sensor *sensor = to_sensor(client);
const struct v4l2_queryctrl *qctrl;
@ -2676,7 +2676,7 @@ static int sensor_s_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf)
static int sensor_try_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct sensor *sensor = to_sensor(client);
const struct sensor_datafmt *fmt;
int ret = 0;
@ -2705,7 +2705,7 @@ static int sensor_try_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf)
static int sensor_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_dbg_chip_ident *id)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);
if (id->match.type != V4L2_CHIP_MATCH_I2C_ADDR)
return -EINVAL;
@ -2989,7 +2989,7 @@ static int sensor_set_flash(struct soc_camera_device *icd, const struct v4l2_que
static int sensor_g_control(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct sensor *sensor = to_sensor(client);
const struct v4l2_queryctrl *qctrl;
@ -3048,7 +3048,7 @@ static int sensor_g_control(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
static int sensor_s_control(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct sensor *sensor = to_sensor(client);
struct soc_camera_device *icd = client->dev.platform_data;
const struct v4l2_queryctrl *qctrl;
@ -3338,7 +3338,7 @@ static int sensor_s_ext_control(struct soc_camera_device *icd, struct v4l2_ext_c
static int sensor_g_ext_controls(struct v4l2_subdev *sd, struct v4l2_ext_controls *ext_ctrl)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct soc_camera_device *icd = client->dev.platform_data;
int i, error_cnt=0, error_idx=-1;
@ -3363,7 +3363,7 @@ static int sensor_g_ext_controls(struct v4l2_subdev *sd, struct v4l2_ext_control
static int sensor_s_ext_controls(struct v4l2_subdev *sd, struct v4l2_ext_controls *ext_ctrl)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct soc_camera_device *icd = client->dev.platform_data;
int i, error_cnt=0, error_idx=-1;
@ -3450,7 +3450,7 @@ static int sensor_video_probe(struct soc_camera_device *icd,
}
static long sensor_ioctl(struct v4l2_subdev *sd, unsigned int cmd, void *arg)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct soc_camera_device *icd = client->dev.platform_data;
struct sensor *sensor = to_sensor(client);
#if CONFIG_SENSOR_Flash

View File

@ -2157,7 +2157,7 @@ static int sensor_ioctrl(struct soc_camera_device *icd,enum rk29sensor_power_cmd
}
static int sensor_init(struct v4l2_subdev *sd, u32 val)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct soc_camera_device *icd = client->dev.platform_data;
struct sensor *sensor = to_sensor(client);
const struct v4l2_queryctrl *qctrl;
@ -2356,7 +2356,7 @@ static unsigned long sensor_query_bus_param(struct soc_camera_device *icd)
static int sensor_g_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct soc_camera_device *icd = client->dev.platform_data;
struct sensor *sensor = to_sensor(client);
@ -2405,7 +2405,7 @@ static bool sensor_fmt_videochk(struct v4l2_subdev *sd, struct v4l2_mbus_framefm
}
static int sensor_s_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct sensor *sensor = to_sensor(client);
const struct sensor_datafmt *fmt;
const struct v4l2_queryctrl *qctrl;
@ -2587,7 +2587,7 @@ static int sensor_s_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf)
static int sensor_try_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct sensor *sensor = to_sensor(client);
const struct sensor_datafmt *fmt;
int ret = 0;
@ -2616,7 +2616,7 @@ static int sensor_try_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf)
static int sensor_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_dbg_chip_ident *id)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);
if (id->match.type != V4L2_CHIP_MATCH_I2C_ADDR)
return -EINVAL;
@ -2900,7 +2900,7 @@ static int sensor_set_flash(struct soc_camera_device *icd, const struct v4l2_que
static int sensor_g_control(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct sensor *sensor = to_sensor(client);
const struct v4l2_queryctrl *qctrl;
@ -2959,7 +2959,7 @@ static int sensor_g_control(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
static int sensor_s_control(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct sensor *sensor = to_sensor(client);
struct soc_camera_device *icd = client->dev.platform_data;
const struct v4l2_queryctrl *qctrl;
@ -3249,7 +3249,7 @@ static int sensor_s_ext_control(struct soc_camera_device *icd, struct v4l2_ext_c
static int sensor_g_ext_controls(struct v4l2_subdev *sd, struct v4l2_ext_controls *ext_ctrl)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct soc_camera_device *icd = client->dev.platform_data;
int i, error_cnt=0, error_idx=-1;
@ -3274,7 +3274,7 @@ static int sensor_g_ext_controls(struct v4l2_subdev *sd, struct v4l2_ext_control
static int sensor_s_ext_controls(struct v4l2_subdev *sd, struct v4l2_ext_controls *ext_ctrl)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct soc_camera_device *icd = client->dev.platform_data;
int i, error_cnt=0, error_idx=-1;
@ -3351,7 +3351,7 @@ static int sensor_video_probe(struct soc_camera_device *icd,
}
static long sensor_ioctl(struct v4l2_subdev *sd, unsigned int cmd, void *arg)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct soc_camera_device *icd = client->dev.platform_data;
struct sensor *sensor = to_sensor(client);
int ret = 0;

View File

@ -1635,7 +1635,7 @@ static int sensor_ioctrl(struct soc_camera_device *icd,enum rk29sensor_power_cmd
}
static int sensor_init(struct v4l2_subdev *sd, u32 val)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct soc_camera_device *icd = client->dev.platform_data;
struct sensor *sensor = to_sensor(client);
const struct v4l2_queryctrl *qctrl;
@ -1833,7 +1833,7 @@ static unsigned long sensor_query_bus_param(struct soc_camera_device *icd)
static int sensor_g_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct soc_camera_device *icd = client->dev.platform_data;
struct sensor *sensor = to_sensor(client);
@ -1882,7 +1882,7 @@ static bool sensor_fmt_videochk(struct v4l2_subdev *sd, struct v4l2_mbus_framefm
}
static int sensor_s_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct sensor *sensor = to_sensor(client);
const struct sensor_datafmt *fmt;
const struct v4l2_queryctrl *qctrl;
@ -2040,7 +2040,7 @@ static int sensor_s_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf)
static int sensor_try_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct sensor *sensor = to_sensor(client);
const struct sensor_datafmt *fmt;
int ret = 0;
@ -2069,7 +2069,7 @@ static int sensor_try_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf)
static int sensor_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_dbg_chip_ident *id)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);
if (id->match.type != V4L2_CHIP_MATCH_I2C_ADDR)
return -EINVAL;
@ -2353,7 +2353,7 @@ static int sensor_set_flash(struct soc_camera_device *icd, const struct v4l2_que
static int sensor_g_control(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct sensor *sensor = to_sensor(client);
const struct v4l2_queryctrl *qctrl;
@ -2412,7 +2412,7 @@ static int sensor_g_control(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
static int sensor_s_control(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct sensor *sensor = to_sensor(client);
struct soc_camera_device *icd = client->dev.platform_data;
const struct v4l2_queryctrl *qctrl;
@ -2702,7 +2702,7 @@ static int sensor_s_ext_control(struct soc_camera_device *icd, struct v4l2_ext_c
static int sensor_g_ext_controls(struct v4l2_subdev *sd, struct v4l2_ext_controls *ext_ctrl)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct soc_camera_device *icd = client->dev.platform_data;
int i, error_cnt=0, error_idx=-1;
@ -2727,7 +2727,7 @@ static int sensor_g_ext_controls(struct v4l2_subdev *sd, struct v4l2_ext_control
static int sensor_s_ext_controls(struct v4l2_subdev *sd, struct v4l2_ext_controls *ext_ctrl)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct soc_camera_device *icd = client->dev.platform_data;
int i, error_cnt=0, error_idx=-1;
@ -2805,7 +2805,7 @@ static int sensor_video_probe(struct soc_camera_device *icd,
}
static long sensor_ioctl(struct v4l2_subdev *sd, unsigned int cmd, void *arg)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct soc_camera_device *icd = client->dev.platform_data;
struct sensor *sensor = to_sensor(client);
int ret = 0;

View File

@ -56,7 +56,7 @@ module_param(debug, int, S_IRUGO|S_IWUSR);
#define SENSOR_INIT_WIDTH 640 /* Sensor pixel size for sensor_init_data array */
#define SENSOR_INIT_HEIGHT 480
#define SENSOR_INIT_WINSEQADR sensor_vga
#define SENSOR_INIT_PIXFMT V4L2_PIX_FMT_UYVY
#define SENSOR_INIT_PIXFMT V4L2_MBUS_FMT_UYVY8_2X8
#define CONFIG_SENSOR_WhiteBalance 1
#define CONFIG_SENSOR_Brightness 0
@ -96,6 +96,8 @@ module_param(debug, int, S_IRUGO|S_IWUSR);
#define SENSOR_AF_IS_ERR (0x00<<0)
#define SENSOR_AF_IS_OK (0x01<<0)
#define SENSOR_INIT_IS_ERR (0x00<<28)
#define SENSOR_INIT_IS_OK (0x01<<28)
#if CONFIG_SENSOR_Focus
#define SENSOR_AF_MODE_INFINITY 0
@ -1372,10 +1374,13 @@ static int sensor_suspend(struct soc_camera_device *icd, pm_message_t pm_msg);
static int sensor_resume(struct soc_camera_device *icd);
static int sensor_set_bus_param(struct soc_camera_device *icd,unsigned long flags);
static unsigned long sensor_query_bus_param(struct soc_camera_device *icd);
#if CONFIG_SENSOR_Effect
static int sensor_set_effect(struct soc_camera_device *icd, const struct v4l2_queryctrl *qctrl, int value);
#endif
#if CONFIG_SENSOR_WhiteBalance
static int sensor_set_whiteBalance(struct soc_camera_device *icd, const struct v4l2_queryctrl *qctrl, int value);
#endif
static int sensor_deactivate(struct i2c_client *client);
static struct soc_camera_ops sensor_ops =
{
.suspend = sensor_suspend,
@ -1387,17 +1392,28 @@ static struct soc_camera_ops sensor_ops =
.num_controls = ARRAY_SIZE(sensor_controls),
.num_menus = ARRAY_SIZE(sensor_menus),
};
/* only one fixed colorspace per pixelcode */
struct sensor_datafmt {
enum v4l2_mbus_pixelcode code;
enum v4l2_colorspace colorspace;
};
#define COL_FMT(_name, _depth, _fourcc, _colorspace) \
{ .name = _name, .depth = _depth, .fourcc = _fourcc, \
.colorspace = _colorspace }
/* Find a data format by a pixel code in an array */
static const struct sensor_datafmt *sensor_find_datafmt(
enum v4l2_mbus_pixelcode code, const struct sensor_datafmt *fmt,
int n)
{
int i;
for (i = 0; i < n; i++)
if (fmt[i].code == code)
return fmt + i;
#define JPG_FMT(_name, _depth, _fourcc) \
COL_FMT(_name, _depth, _fourcc, V4L2_COLORSPACE_JPEG)
return NULL;
}
static const struct soc_camera_data_format sensor_colour_formats[] = {
JPG_FMT(SENSOR_NAME_STRING(UYVY), 16, V4L2_PIX_FMT_UYVY),
JPG_FMT(SENSOR_NAME_STRING(YUYV), 16, V4L2_PIX_FMT_YUYV),
static const struct sensor_datafmt sensor_colour_fmts[] = {
{V4L2_MBUS_FMT_UYVY8_2X8, V4L2_COLORSPACE_JPEG},
{V4L2_MBUS_FMT_YUYV8_2X8, V4L2_COLORSPACE_JPEG}
};
enum sensor_work_state
{
@ -1434,7 +1450,7 @@ typedef struct sensor_info_priv_s
int preview_w;
int preview_h;
struct reginfo *winseqe_cur_addr;
unsigned int pixfmt;
struct sensor_datafmt fmt;
unsigned int enable;
unsigned int funmodule_state;
} sensor_info_priv_t;
@ -1754,10 +1770,11 @@ static int sensor_ioctrl(struct soc_camera_device *icd,enum rk29sensor_power_cmd
}
static int sensor_init(struct v4l2_subdev *sd, u32 val)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct soc_camera_device *icd = client->dev.platform_data;
struct sensor *sensor = to_sensor(client);
const struct v4l2_queryctrl *qctrl;
const struct sensor_datafmt *fmt;
int ret;
#if (SENSOR_ID_REG != SEQUENCE_END)
u16 pid = 0;
@ -1818,7 +1835,13 @@ static int sensor_init(struct v4l2_subdev *sd, u32 val)
sensor->info_priv.capture_w = SENSOR_MAX_WIDTH;
sensor->info_priv.capture_h = SENSOR_MAX_HEIGHT;
sensor->info_priv.winseqe_cur_addr = SENSOR_INIT_WINSEQADR;
sensor->info_priv.pixfmt = SENSOR_INIT_PIXFMT;
fmt = sensor_find_datafmt(SENSOR_INIT_PIXFMT,sensor_colour_fmts, ARRAY_SIZE(sensor_colour_fmts));
if (!fmt) {
SENSOR_TR("error: %s initial array colour fmts is not support!!",SENSOR_NAME_STRING());
ret = -EINVAL;
goto sensor_INIT_ERR;
}
sensor->info_priv.fmt = *fmt;
/* sensor sensor information for initialization */
qctrl = soc_camera_find_qctrl(&sensor_ops, V4L2_CID_DO_WHITE_BALANCE);
@ -1948,74 +1971,79 @@ static unsigned long sensor_query_bus_param(struct soc_camera_device *icd)
return soc_camera_apply_sensor_flags(icl, flags);
}
static int sensor_g_fmt(struct v4l2_subdev *sd, struct v4l2_format *f)
static int sensor_g_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct soc_camera_device *icd = client->dev.platform_data;
struct sensor *sensor = to_sensor(client);
struct v4l2_pix_format *pix = &f->fmt.pix;
pix->width = icd->user_width;
pix->height = icd->user_height;
pix->pixelformat = sensor->info_priv.pixfmt;
pix->field = V4L2_FIELD_NONE;
pix->colorspace = V4L2_COLORSPACE_JPEG;
mf->width = icd->user_width;
mf->height = icd->user_height;
mf->code = sensor->info_priv.fmt.code;
mf->colorspace = sensor->info_priv.fmt.colorspace;
mf->field = V4L2_FIELD_NONE;
return 0;
}
static bool sensor_fmt_capturechk(struct v4l2_subdev *sd, struct v4l2_format *f)
static bool sensor_fmt_capturechk(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf)
{
bool ret = false;
if ((f->fmt.pix.width == 1024) && (f->fmt.pix.height == 768)) {
if ((mf->width == 1024) && (mf->height == 768)) {
ret = true;
} else if ((f->fmt.pix.width == 1280) && (f->fmt.pix.height == 1024)) {
} else if ((mf->width == 1280) && (mf->height == 1024)) {
ret = true;
} else if ((f->fmt.pix.width == 1600) && (f->fmt.pix.height == 1200)) {
} else if ((mf->width == 1600) && (mf->height == 1200)) {
ret = true;
} else if ((f->fmt.pix.width == 2048) && (f->fmt.pix.height == 1536)) {
} else if ((mf->width == 2048) && (mf->height == 1536)) {
ret = true;
} else if ((f->fmt.pix.width == 2592) && (f->fmt.pix.height == 1944)) {
} else if ((mf->width == 2592) && (mf->height == 1944)) {
ret = true;
}
if (ret == true)
SENSOR_DG("%s %dx%d is capture format\n", __FUNCTION__, f->fmt.pix.width, f->fmt.pix.height);
SENSOR_DG("%s %dx%d is capture format\n", __FUNCTION__, mf->width, mf->height);
return ret;
}
static bool sensor_fmt_videochk(struct v4l2_subdev *sd, struct v4l2_format *f)
static bool sensor_fmt_videochk(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf)
{
bool ret = false;
if ((f->fmt.pix.width == 1280) && (f->fmt.pix.height == 720)) {
if ((mf->width == 1280) && (mf->height == 720)) {
ret = true;
} else if ((f->fmt.pix.width == 1920) && (f->fmt.pix.height == 1080)) {
} else if ((mf->width == 1920) && (mf->height == 1080)) {
ret = true;
}
if (ret == true)
SENSOR_DG("%s %dx%d is video format\n", __FUNCTION__, f->fmt.pix.width, f->fmt.pix.height);
SENSOR_DG("%s %dx%d is video format\n", __FUNCTION__, mf->width, mf->height);
return ret;
}
static int sensor_s_fmt(struct v4l2_subdev *sd, struct v4l2_format *f)
static int sensor_s_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct sensor *sensor = to_sensor(client);
struct v4l2_pix_format *pix = &f->fmt.pix;
const struct sensor_datafmt *fmt;
struct reginfo *winseqe_set_addr=NULL;
int ret = 0, set_w,set_h;
if (sensor->info_priv.pixfmt != pix->pixelformat) {
switch (pix->pixelformat)
fmt = sensor_find_datafmt(mf->code, sensor_colour_fmts,
ARRAY_SIZE(sensor_colour_fmts));
if (!fmt) {
ret = -EINVAL;
goto sensor_s_fmt_end;
}
if (sensor->info_priv.fmt.code != mf->code) {
switch (mf->code)
{
case V4L2_PIX_FMT_YUYV:
case V4L2_MBUS_FMT_YUYV8_2X8:
{
winseqe_set_addr = sensor_ClrFmt_YUYV;
break;
}
case V4L2_PIX_FMT_UYVY:
case V4L2_MBUS_FMT_UYVY8_2X8:
{
winseqe_set_addr = sensor_ClrFmt_UYVY;
break;
@ -2025,17 +2053,16 @@ static int sensor_s_fmt(struct v4l2_subdev *sd, struct v4l2_format *f)
}
if (winseqe_set_addr != NULL) {
sensor_write_array(client, winseqe_set_addr);
sensor->info_priv.pixfmt = pix->pixelformat;
SENSOR_DG("%s Pixelformat(0x%x) set success!\n", SENSOR_NAME_STRING(),pix->pixelformat);
sensor->info_priv.fmt.code = mf->code;
sensor->info_priv.fmt.colorspace= mf->colorspace;
SENSOR_DG("%s v4l2_mbus_code:%d set success!\n", SENSOR_NAME_STRING(),mf->code);
} else {
SENSOR_TR("%s Pixelformat(0x%x) is invalidate!\n", SENSOR_NAME_STRING(),pix->pixelformat);
SENSOR_TR("%s v4l2_mbus_code:%d is invalidate!\n", SENSOR_NAME_STRING(),mf->code);
}
}
set_w = pix->width;
set_h = pix->height;
set_w = mf->width;
set_h = mf->height;
if (((set_w <= 176) && (set_h <= 144)) && (sensor_qcif[0].reg!=SEQUENCE_END))
{
winseqe_set_addr = sensor_qcif;
@ -2133,57 +2160,58 @@ static int sensor_s_fmt(struct v4l2_subdev *sd, struct v4l2_format *f)
sensor->info_priv.capture_h = set_h;
sensor->info_priv.snap2preview = true;
} else if (sensor->info_priv.snap2preview == true) {
if (winseqe_set_addr || ((sensor->info_priv.preview_w == pix->width) && (sensor->info_priv.preview_h == pix->height))) {
if (winseqe_set_addr || ((sensor->info_priv.preview_w == mf->width) && (sensor->info_priv.preview_h == mf->height))) {
ret |= sensor_write_array(client, sensor_Capture2Preview);
if (ret != 0) {
SENSOR_TR("%s Capture 2 Preview failed\n", SENSOR_NAME_STRING());
goto sensor_s_fmt_end;
}
sensor->info_priv.preview_w = pix->width;
sensor->info_priv.preview_h = pix->height;
sensor->info_priv.preview_w = mf->width;
sensor->info_priv.preview_h = mf->height;
sensor->info_priv.snap2preview = false;
} else {
SENSOR_TR("\n %s..%s Format is Invalidate. pix->width = %d.. pix->height = %d\n",SENSOR_NAME_STRING(),__FUNCTION__,pix->width,pix->height);
SENSOR_TR("\n %s..%s Format is Invalidate. pix->width = %d.. pix->height = %d\n",SENSOR_NAME_STRING(),__FUNCTION__,mf->width,mf->height);
}
}
pix->width = set_w;
pix->height = set_h;
mf->width = set_w;
mf->height = set_h;
sensor_s_fmt_end:
return ret;
}
static int sensor_try_fmt(struct v4l2_subdev *sd, struct v4l2_format *f)
static int sensor_try_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf)
{
struct v4l2_pix_format *pix = &f->fmt.pix;
bool bayer = pix->pixelformat == V4L2_PIX_FMT_UYVY ||
pix->pixelformat == V4L2_PIX_FMT_YUYV;
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct sensor *sensor = to_sensor(client);
const struct sensor_datafmt *fmt;
int ret = 0;
fmt = sensor_find_datafmt(mf->code, sensor_colour_fmts,
ARRAY_SIZE(sensor_colour_fmts));
if (fmt == NULL) {
fmt = &sensor->info_priv.fmt;
mf->code = fmt->code;
}
/*
* With Bayer format enforce even side lengths, but let the user play
* with the starting pixel
*/
if (mf->height > SENSOR_MAX_HEIGHT)
mf->height = SENSOR_MAX_HEIGHT;
else if (mf->height < SENSOR_MIN_HEIGHT)
mf->height = SENSOR_MIN_HEIGHT;
if (pix->height > SENSOR_MAX_HEIGHT)
pix->height = SENSOR_MAX_HEIGHT;
else if (pix->height < SENSOR_MIN_HEIGHT)
pix->height = SENSOR_MIN_HEIGHT;
else if (bayer)
pix->height = ALIGN(pix->height, 2);
if (mf->width > SENSOR_MAX_WIDTH)
mf->width = SENSOR_MAX_WIDTH;
else if (mf->width < SENSOR_MIN_WIDTH)
mf->width = SENSOR_MIN_WIDTH;
if (pix->width > SENSOR_MAX_WIDTH)
pix->width = SENSOR_MAX_WIDTH;
else if (pix->width < SENSOR_MIN_WIDTH)
pix->width = SENSOR_MIN_WIDTH;
else if (bayer)
pix->width = ALIGN(pix->width, 2);
return 0;
mf->colorspace = fmt->colorspace;
return ret;
}
static int sensor_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_dbg_chip_ident *id)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);
if (id->match.type != V4L2_CHIP_MATCH_I2C_ADDR)
return -EINVAL;
@ -2571,7 +2599,7 @@ static int sensor_set_focus_mode(struct soc_camera_device *icd, const struct v4l
#endif
static int sensor_g_control(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct sensor *sensor = to_sensor(client);
const struct v4l2_queryctrl *qctrl;
@ -2630,7 +2658,7 @@ static int sensor_g_control(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
static int sensor_s_control(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct sensor *sensor = to_sensor(client);
struct soc_camera_device *icd = client->dev.platform_data;
const struct v4l2_queryctrl *qctrl;
@ -2947,7 +2975,7 @@ static int sensor_s_ext_control(struct soc_camera_device *icd, struct v4l2_ext_c
static int sensor_g_ext_controls(struct v4l2_subdev *sd, struct v4l2_ext_controls *ext_ctrl)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct soc_camera_device *icd = client->dev.platform_data;
int i, error_cnt=0, error_idx=-1;
@ -2972,7 +3000,7 @@ static int sensor_g_ext_controls(struct v4l2_subdev *sd, struct v4l2_ext_control
static int sensor_s_ext_controls(struct v4l2_subdev *sd, struct v4l2_ext_controls *ext_ctrl)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct soc_camera_device *icd = client->dev.platform_data;
int i, error_cnt=0, error_idx=-1;
@ -2996,7 +3024,7 @@ static int sensor_s_ext_controls(struct v4l2_subdev *sd, struct v4l2_ext_control
static int sensor_s_stream(struct v4l2_subdev *sd, int enable)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct sensor *sensor = to_sensor(client);
if (enable == 1) {
@ -3065,8 +3093,6 @@ static int sensor_video_probe(struct soc_camera_device *icd,
goto sensor_video_probe_err;
}
icd->formats = sensor_colour_formats;
icd->num_formats = ARRAY_SIZE(sensor_colour_formats);
return 0;
@ -3075,7 +3101,7 @@ static int sensor_video_probe(struct soc_camera_device *icd,
}
static long sensor_ioctl(struct v4l2_subdev *sd, unsigned int cmd, void *arg)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct soc_camera_device *icd = client->dev.platform_data;
struct sensor *sensor = to_sensor(client);
int ret = 0;
@ -3134,7 +3160,15 @@ static long sensor_ioctl(struct v4l2_subdev *sd, unsigned int cmd, void *arg)
return ret;
}
static int sensor_enum_fmt(struct v4l2_subdev *sd, unsigned int index,
enum v4l2_mbus_pixelcode *code)
{
if (index >= ARRAY_SIZE(sensor_colour_fmts))
return -EINVAL;
*code = sensor_colour_fmts[index].code;
return 0;
}
static struct v4l2_subdev_core_ops sensor_subdev_core_ops = {
.init = sensor_init,
.g_ctrl = sensor_g_control,
@ -3146,10 +3180,10 @@ static struct v4l2_subdev_core_ops sensor_subdev_core_ops = {
};
static struct v4l2_subdev_video_ops sensor_subdev_video_ops = {
.s_fmt = sensor_s_fmt,
.g_fmt = sensor_g_fmt,
.try_fmt = sensor_try_fmt,
.s_stream = sensor_s_stream,
.s_mbus_fmt = sensor_s_fmt,
.g_mbus_fmt = sensor_g_fmt,
.try_mbus_fmt = sensor_try_fmt,
.enum_mbus_fmt = sensor_enum_fmt,
};
static struct v4l2_subdev_ops sensor_subdev_ops = {
@ -3192,7 +3226,7 @@ static int sensor_probe(struct i2c_client *client,
/* Second stage probe - when a capture adapter is there */
icd->ops = &sensor_ops;
icd->y_skip_top = 0;
sensor->info_priv.fmt = sensor_colour_fmts[0];
#if CONFIG_SENSOR_I2C_NOSCHED
atomic_set(&sensor->tasklock_cnt,0);
#endif

View File

@ -59,7 +59,7 @@ module_param(debug, int, S_IRUGO|S_IWUSR);
#define SENSOR_INIT_WIDTH 800 /* Sensor pixel size for sensor_init_data array */
#define SENSOR_INIT_HEIGHT 600
#define SENSOR_INIT_WINSEQADR sensor_init_data
#define SENSOR_INIT_PIXFMT V4L2_PIX_FMT_UYVY
#define SENSOR_INIT_PIXFMT V4L2_MBUS_FMT_UYVY8_2X8
#define CONFIG_SENSOR_WhiteBalance 0
#define CONFIG_SENSOR_Brightness 0
@ -1119,16 +1119,28 @@ static struct soc_camera_ops sensor_ops =
.num_menus = ARRAY_SIZE(sensor_menus),
};
#define COL_FMT(_name, _depth, _fourcc, _colorspace) \
{ .name = _name, .depth = _depth, .fourcc = _fourcc, \
.colorspace = _colorspace }
/* only one fixed colorspace per pixelcode */
struct sensor_datafmt {
enum v4l2_mbus_pixelcode code;
enum v4l2_colorspace colorspace;
};
#define JPG_FMT(_name, _depth, _fourcc) \
COL_FMT(_name, _depth, _fourcc, V4L2_COLORSPACE_JPEG)
/* Find a data format by a pixel code in an array */
static const struct sensor_datafmt *sensor_find_datafmt(
enum v4l2_mbus_pixelcode code, const struct sensor_datafmt *fmt,
int n)
{
int i;
for (i = 0; i < n; i++)
if (fmt[i].code == code)
return fmt + i;
static const struct soc_camera_data_format sensor_colour_formats[] = {
JPG_FMT(SENSOR_NAME_STRING(UYVY), 16, V4L2_PIX_FMT_UYVY),
JPG_FMT(SENSOR_NAME_STRING(YUYV), 16, V4L2_PIX_FMT_YUYV),
return NULL;
}
static const struct sensor_datafmt sensor_colour_fmts[] = {
{V4L2_MBUS_FMT_UYVY8_2X8, V4L2_COLORSPACE_JPEG},
{V4L2_MBUS_FMT_YUYV8_2X8, V4L2_COLORSPACE_JPEG}
};
enum sensor_work_state
{
@ -1165,7 +1177,7 @@ typedef struct sensor_info_priv_s
int preview_w;
int preview_h;
struct reginfo *winseqe_cur_addr;
unsigned int pixfmt;
struct sensor_datafmt fmt;
unsigned int enable;
unsigned int funmodule_state;
} sensor_info_priv_t;
@ -1552,10 +1564,11 @@ static int sensor_ioctrl(struct soc_camera_device *icd,enum rk29sensor_power_cmd
}
static int sensor_init(struct v4l2_subdev *sd, u32 val)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct soc_camera_device *icd = client->dev.platform_data;
struct sensor *sensor = to_sensor(client);
const struct v4l2_queryctrl *qctrl;
const struct sensor_datafmt *fmt;
int ret;
u16 pid = 0;
@ -1624,7 +1637,13 @@ static int sensor_init(struct v4l2_subdev *sd, u32 val)
sensor->info_priv.capture_w = SENSOR_MAX_WIDTH;
sensor->info_priv.capture_h = SENSOR_MAX_HEIGHT;
sensor->info_priv.winseqe_cur_addr = SENSOR_INIT_WINSEQADR;
sensor->info_priv.pixfmt = SENSOR_INIT_PIXFMT;
fmt = sensor_find_datafmt(SENSOR_INIT_PIXFMT,sensor_colour_fmts, ARRAY_SIZE(sensor_colour_fmts));
if (!fmt) {
SENSOR_TR("error: %s initial array colour fmts is not support!!",SENSOR_NAME_STRING());
ret = -EINVAL;
goto sensor_INIT_ERR;
}
sensor->info_priv.fmt = *fmt;
/* sensor sensor information for initialization */
qctrl = soc_camera_find_qctrl(&sensor_ops, V4L2_CID_DO_WHITE_BALANCE);
@ -1758,58 +1777,55 @@ static unsigned long sensor_query_bus_param(struct soc_camera_device *icd)
return soc_camera_apply_sensor_flags(icl, flags);
}
static int sensor_g_fmt(struct v4l2_subdev *sd, struct v4l2_format *f)
static int sensor_g_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct soc_camera_device *icd = client->dev.platform_data;
struct sensor *sensor = to_sensor(client);
struct v4l2_pix_format *pix = &f->fmt.pix;
pix->width = icd->user_width;
pix->height = icd->user_height;
pix->pixelformat = sensor->info_priv.pixfmt;
pix->field = V4L2_FIELD_NONE;
pix->colorspace = V4L2_COLORSPACE_JPEG;
mf->width = icd->user_width;
mf->height = icd->user_height;
mf->code = sensor->info_priv.fmt.code;
mf->colorspace = sensor->info_priv.fmt.colorspace;
mf->field = V4L2_FIELD_NONE;
return 0;
}
static bool sensor_fmt_capturechk(struct v4l2_subdev *sd, struct v4l2_format *f)
static bool sensor_fmt_capturechk(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf)
{
bool ret = false;
if ((f->fmt.pix.width == 1024) && (f->fmt.pix.height == 768)) {
if ((mf->width == 1024) && (mf->height == 768)) {
ret = true;
} else if ((f->fmt.pix.width == 1280) && (f->fmt.pix.height == 1024)) {
} else if ((mf->width == 1280) && (mf->height == 1024)) {
ret = true;
} else if ((f->fmt.pix.width == 1600) && (f->fmt.pix.height == 1200)) {
} else if ((mf->width == 1600) && (mf->height == 1200)) {
ret = true;
} else if ((f->fmt.pix.width == 2048) && (f->fmt.pix.height == 1536)) {
} else if ((mf->width == 2048) && (mf->height == 1536)) {
ret = true;
} else if ((f->fmt.pix.width == 2592) && (f->fmt.pix.height == 1944)) {
} else if ((mf->width == 2592) && (mf->height == 1944)) {
ret = true;
}
if (ret == true)
SENSOR_DG("%s %dx%d is capture format\n", __FUNCTION__, f->fmt.pix.width, f->fmt.pix.height);
SENSOR_DG("%s %dx%d is capture format\n", __FUNCTION__, mf->width, mf->height);
return ret;
}
static bool sensor_fmt_videochk(struct v4l2_subdev *sd, struct v4l2_format *f)
static bool sensor_fmt_videochk(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf)
{
bool ret = false;
if ((f->fmt.pix.width == 1280) && (f->fmt.pix.height == 720)) {
ret = true; //true zyw
} else if ((f->fmt.pix.width == 1920) && (f->fmt.pix.height == 1080)) {
ret = true; //true zyw
if ((mf->width == 1280) && (mf->height == 720)) {
ret = true;
} else if ((mf->width == 1920) && (mf->height == 1080)) {
ret = true;
}
if (ret == true)
SENSOR_DG("%s %dx%d is video format\n", __FUNCTION__, f->fmt.pix.width, f->fmt.pix.height);
SENSOR_DG("%s %dx%d is video format\n", __FUNCTION__, mf->width, mf->height);
return ret;
}
static struct reginfo* sensor_fmt_catch(int set_w, int set_h, int *ret_w, int *ret_h)
{
struct reginfo *winseqe_set_addr = NULL;
@ -1870,25 +1886,32 @@ static struct reginfo* sensor_fmt_catch(int set_w, int set_h, int *ret_w, int *r
return winseqe_set_addr;
}
static int sensor_s_fmt(struct v4l2_subdev *sd, struct v4l2_format *f)
static int sensor_s_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct sensor *sensor = to_sensor(client);
struct v4l2_pix_format *pix = &f->fmt.pix;
const struct sensor_datafmt *fmt;
struct reginfo *winseqe_set_addr=NULL;
int ret = 0, set_w,set_h;
SENSOR_TR("%s pix->width=%d,pix->height=%d\n",__FUNCTION__,pix->width,pix->height);
SENSOR_TR("%s pix->width=%d,pix->height=%d\n",__FUNCTION__,mf->width,mf->height);
if (sensor->info_priv.pixfmt != pix->pixelformat) {
switch (pix->pixelformat)
fmt = sensor_find_datafmt(mf->code, sensor_colour_fmts,
ARRAY_SIZE(sensor_colour_fmts));
if (!fmt) {
ret = -EINVAL;
goto sensor_s_fmt_end;
}
if (sensor->info_priv.fmt.code != mf->code) {
switch (mf->code)
{
case V4L2_PIX_FMT_YUYV:
case V4L2_MBUS_FMT_YUYV8_2X8:
{
winseqe_set_addr = sensor_ClrFmt_YUYV;
break;
}
case V4L2_PIX_FMT_UYVY:
case V4L2_MBUS_FMT_UYVY8_2X8:
{
winseqe_set_addr = sensor_ClrFmt_UYVY;
break;
@ -1898,16 +1921,16 @@ static int sensor_s_fmt(struct v4l2_subdev *sd, struct v4l2_format *f)
}
if (winseqe_set_addr != NULL) {
sensor_write_array(client, winseqe_set_addr);
sensor->info_priv.pixfmt = pix->pixelformat;
SENSOR_DG("%s Pixelformat(0x%x) set success!\n", SENSOR_NAME_STRING(),pix->pixelformat);
sensor->info_priv.fmt.code = mf->code;
sensor->info_priv.fmt.colorspace= mf->colorspace;
SENSOR_DG("%s v4l2_mbus_code:%d set success!\n", SENSOR_NAME_STRING(),mf->code);
} else {
SENSOR_TR("%s Pixelformat(0x%x) is invalidate!\n", SENSOR_NAME_STRING(),pix->pixelformat);
SENSOR_TR("%s v4l2_mbus_code:%d is invalidate!\n", SENSOR_NAME_STRING(),mf->code);
}
}
set_w = pix->width;
set_h = pix->height;
set_w = mf->width;
set_h = mf->height;
winseqe_set_addr = sensor_fmt_catch(set_w, set_h, &set_w, &set_h);
@ -1922,8 +1945,8 @@ static int sensor_s_fmt(struct v4l2_subdev *sd, struct v4l2_format *f)
SENSOR_DG("\n%s..%s..Capture icd->width = %d.. icd->height %d\n",SENSOR_NAME_STRING(),__FUNCTION__,set_w,set_h);
} else {
SENSOR_DG("\n%s..%s..Video icd->width = %d.. icd->height %d\n",SENSOR_NAME_STRING(),__FUNCTION__,set_w,set_h);
sensor->info_priv.preview_w = pix->width;
sensor->info_priv.preview_h = pix->height;
sensor->info_priv.preview_w = mf->width;
sensor->info_priv.preview_h = mf->height;
}
}
@ -1937,58 +1960,61 @@ static int sensor_s_fmt(struct v4l2_subdev *sd, struct v4l2_format *f)
sensor->info_priv.capture_h = set_h;
sensor->info_priv.snap2preview = true;
} else if (sensor->info_priv.snap2preview == true) {
if (winseqe_set_addr || ((sensor->info_priv.preview_w == pix->width) && (sensor->info_priv.preview_h == pix->height))) {
if (winseqe_set_addr || ((sensor->info_priv.preview_w == mf->width) && (sensor->info_priv.preview_h == mf->height))) {
ret |= sensor_write_array(client, sensor_Capture2Preview);
if (ret != 0) {
SENSOR_TR("%s Capture 2 Preview failed\n", SENSOR_NAME_STRING());
goto sensor_s_fmt_end;
}
sensor->info_priv.preview_w = pix->width;
sensor->info_priv.preview_h = pix->height;
sensor->info_priv.preview_w = mf->width;
sensor->info_priv.preview_h = mf->height;
sensor->info_priv.snap2preview = false;
} else {
SENSOR_TR("\n %s..%s Format is Invalidate. pix->width = %d.. pix->height = %d\n",SENSOR_NAME_STRING(),__FUNCTION__,pix->width,pix->height);
SENSOR_TR("\n %s..%s Format is Invalidate. mf->width = %d.. mf->height = %d\n",SENSOR_NAME_STRING(),__FUNCTION__,mf->width,mf->height);
}
}
pix->width = set_w;
pix->height = set_h;
mf->width = set_w;
mf->height = set_h;
sensor_s_fmt_end:
return ret;
}
static int sensor_try_fmt(struct v4l2_subdev *sd, struct v4l2_format *f)
static int sensor_try_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf)
{
int ret = 0;
struct v4l2_pix_format *pix = &f->fmt.pix;
bool bayer = pix->pixelformat == V4L2_PIX_FMT_UYVY ||
pix->pixelformat == V4L2_PIX_FMT_YUYV;
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct sensor *sensor = to_sensor(client);
const struct sensor_datafmt *fmt;
fmt = sensor_find_datafmt(mf->code, sensor_colour_fmts,
ARRAY_SIZE(sensor_colour_fmts));
if (fmt == NULL) {
fmt = &sensor->info_priv.fmt;
mf->code = fmt->code;
}
SENSOR_TR("%s pix->width=%d,pix->height=%d\n",__FUNCTION__,pix->width,pix->height);
SENSOR_TR("%s pix->width=%d,pix->height=%d\n",__FUNCTION__,mf->width,mf->height);
/*
* With Bayer format enforce even side lengths, but let the user play
* with the starting pixel
*/
if (pix->height > SENSOR_MAX_HEIGHT)
pix->height = SENSOR_MAX_HEIGHT;
else if (pix->height < SENSOR_MIN_HEIGHT)
pix->height = SENSOR_MIN_HEIGHT;
else if (bayer)
pix->height = ALIGN(pix->height, 2);
if (mf->height > SENSOR_MAX_HEIGHT)
mf->height = SENSOR_MAX_HEIGHT;
else if (mf->height < SENSOR_MIN_HEIGHT)
mf->height = SENSOR_MIN_HEIGHT;
if (pix->width > SENSOR_MAX_WIDTH)
pix->width = SENSOR_MAX_WIDTH;
else if (pix->width < SENSOR_MIN_WIDTH)
pix->width = SENSOR_MIN_WIDTH;
else if (bayer)
pix->width = ALIGN(pix->width, 2);
if (mf->width > SENSOR_MAX_WIDTH)
mf->width = SENSOR_MAX_WIDTH;
else if (mf->width < SENSOR_MIN_WIDTH)
mf->width = SENSOR_MIN_WIDTH;
if (sensor_fmt_catch(pix->width, pix->height, &pix->width, &pix->height) == NULL) {
if (sensor_fmt_catch(mf->width, mf->height, &mf->width, &mf->height) == NULL) {
printk("%s[%d] ERR!!!!!!",__FUNCTION__,__LINE__);
pix->width = 0;
pix->height = 0;
mf->width = 0;
mf->height = 0;
}
return ret;
@ -1996,7 +2022,7 @@ static int sensor_try_fmt(struct v4l2_subdev *sd, struct v4l2_format *f)
static int sensor_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_dbg_chip_ident *id)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);
if (id->match.type != V4L2_CHIP_MATCH_I2C_ADDR)
return -EINVAL;
@ -2388,7 +2414,7 @@ static int sensor_set_focus_mode(struct soc_camera_device *icd, const struct v4l
#endif
static int sensor_g_control(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct sensor *sensor = to_sensor(client);
const struct v4l2_queryctrl *qctrl;
@ -2447,7 +2473,7 @@ static int sensor_g_control(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
static int sensor_s_control(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);
const struct v4l2_queryctrl *qctrl;
struct sensor *sensor = to_sensor(client);
struct soc_camera_device *icd = client->dev.platform_data;
@ -2761,7 +2787,7 @@ static int sensor_s_ext_control(struct soc_camera_device *icd, struct v4l2_ext_c
static int sensor_g_ext_controls(struct v4l2_subdev *sd, struct v4l2_ext_controls *ext_ctrl)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct soc_camera_device *icd = client->dev.platform_data;
int i, error_cnt=0, error_idx=-1;
@ -2786,7 +2812,7 @@ static int sensor_g_ext_controls(struct v4l2_subdev *sd, struct v4l2_ext_control
static int sensor_s_ext_controls(struct v4l2_subdev *sd, struct v4l2_ext_controls *ext_ctrl)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct soc_camera_device *icd = client->dev.platform_data;
int i, error_cnt=0, error_idx=-1;
@ -2810,7 +2836,7 @@ static int sensor_s_ext_controls(struct v4l2_subdev *sd, struct v4l2_ext_control
static int sensor_s_stream(struct v4l2_subdev *sd, int enable)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct sensor *sensor = to_sensor(client);
if (enable == 1) {
@ -2882,8 +2908,7 @@ static int sensor_video_probe(struct soc_camera_device *icd,
goto sensor_video_probe_err;
}
icd->formats = sensor_colour_formats;
icd->num_formats = ARRAY_SIZE(sensor_colour_formats);
return 0;
@ -2893,7 +2918,7 @@ static int sensor_video_probe(struct soc_camera_device *icd,
}
static long sensor_ioctl(struct v4l2_subdev *sd, unsigned int cmd, void *arg)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct soc_camera_device *icd = client->dev.platform_data;
struct sensor *sensor = to_sensor(client);
int ret = 0;
@ -2950,7 +2975,15 @@ static long sensor_ioctl(struct v4l2_subdev *sd, unsigned int cmd, void *arg)
return ret;
}
static int sensor_enum_fmt(struct v4l2_subdev *sd, unsigned int index,
enum v4l2_mbus_pixelcode *code)
{
if (index >= ARRAY_SIZE(sensor_colour_fmts))
return -EINVAL;
*code = sensor_colour_fmts[index].code;
return 0;
}
static struct v4l2_subdev_core_ops sensor_subdev_core_ops = {
.init = sensor_init,
.g_ctrl = sensor_g_control,
@ -2962,12 +2995,11 @@ static struct v4l2_subdev_core_ops sensor_subdev_core_ops = {
};
static struct v4l2_subdev_video_ops sensor_subdev_video_ops = {
.s_fmt = sensor_s_fmt,
.g_fmt = sensor_g_fmt,
.try_fmt = sensor_try_fmt,
.s_stream = sensor_s_stream,
.s_mbus_fmt = sensor_s_fmt,
.g_mbus_fmt = sensor_g_fmt,
.try_mbus_fmt = sensor_try_fmt,
.enum_mbus_fmt = sensor_enum_fmt,
};
static struct v4l2_subdev_ops sensor_subdev_ops = {
.core = &sensor_subdev_core_ops,
.video = &sensor_subdev_video_ops,
@ -3008,7 +3040,7 @@ static int sensor_probe(struct i2c_client *client,
/* Second stage probe - when a capture adapter is there */
icd->ops = &sensor_ops;
icd->y_skip_top = 0;
sensor->info_priv.fmt = sensor_colour_fmts[0];
#if CONFIG_SENSOR_I2C_NOSCHED
atomic_set(&sensor->tasklock_cnt,0);
#endif

View File

@ -2861,7 +2861,7 @@ static int sensor_ioctrl(struct soc_camera_device *icd,enum rk29sensor_power_cmd
}
static int sensor_init(struct v4l2_subdev *sd, u32 val)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct soc_camera_device *icd = client->dev.platform_data;
struct sensor *sensor = to_sensor(client);
#if (ADJUST_OPTIMIZE_TIME_FALG == 0)
@ -3144,7 +3144,7 @@ static unsigned long sensor_query_bus_param(struct soc_camera_device *icd)
static int sensor_g_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct soc_camera_device *icd = client->dev.platform_data;
struct sensor *sensor = to_sensor(client);
@ -3492,7 +3492,7 @@ static int sensor_cb(void *arg)
static int sensor_s_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct soc_camera_device *icd = client->dev.platform_data;
struct sensor *sensor = to_sensor(client);
const struct sensor_datafmt *fmt;
@ -3681,7 +3681,7 @@ static int sensor_s_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf)
static int sensor_try_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct sensor *sensor = to_sensor(client);
const struct sensor_datafmt *fmt;
int ret = 0;
@ -3709,7 +3709,7 @@ static int sensor_try_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf)
}
static int sensor_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_dbg_chip_ident *id)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);
if (id->match.type != V4L2_CHIP_MATCH_I2C_ADDR)
return -EINVAL;
@ -4107,7 +4107,7 @@ static int sensor_set_focus_mode(struct soc_camera_device *icd, const struct v4l
#endif
static int sensor_g_control(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct sensor *sensor = to_sensor(client);
const struct v4l2_queryctrl *qctrl;
SENSOR_DG("\n%s..%s.. \n",__FUNCTION__,SENSOR_NAME_STRING());
@ -4167,7 +4167,7 @@ static int sensor_g_control(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
static int sensor_s_control(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct sensor *sensor = to_sensor(client);
struct soc_camera_device *icd = client->dev.platform_data;
const struct v4l2_queryctrl *qctrl;
@ -4487,7 +4487,7 @@ static int sensor_s_ext_control(struct soc_camera_device *icd, struct v4l2_ext_c
static int sensor_g_ext_controls(struct v4l2_subdev *sd, struct v4l2_ext_controls *ext_ctrl)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct soc_camera_device *icd = client->dev.platform_data;
int i, error_cnt=0, error_idx=-1;
@ -4514,7 +4514,7 @@ static int sensor_g_ext_controls(struct v4l2_subdev *sd, struct v4l2_ext_control
static int sensor_s_ext_controls(struct v4l2_subdev *sd, struct v4l2_ext_controls *ext_ctrl)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct soc_camera_device *icd = client->dev.platform_data;
int i, error_cnt=0, error_idx=-1;
@ -4540,7 +4540,7 @@ static int sensor_s_ext_controls(struct v4l2_subdev *sd, struct v4l2_ext_control
static int sensor_s_stream(struct v4l2_subdev *sd, int enable)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct sensor *sensor = to_sensor(client);
if (enable == 1) {
@ -4618,7 +4618,7 @@ static int sensor_video_probe(struct soc_camera_device *icd,
}
static long sensor_ioctl(struct v4l2_subdev *sd, unsigned int cmd, void *arg)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct soc_camera_device *icd = client->dev.platform_data;
struct sensor *sensor = to_sensor(client);
#if CONFIG_SENSOR_Flash

View File

@ -1446,7 +1446,7 @@ static int sensor_ioctrl(struct soc_camera_device *icd,enum rk29sensor_power_cmd
}
static int sensor_init(struct v4l2_subdev *sd, u32 val)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct soc_camera_device *icd = client->dev.platform_data;
struct sensor *sensor = to_sensor(client);
const struct v4l2_queryctrl *qctrl;
@ -1661,7 +1661,7 @@ static unsigned long sensor_query_bus_param(struct soc_camera_device *icd)
static int sensor_g_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct soc_camera_device *icd = client->dev.platform_data;
struct sensor *sensor = to_sensor(client);
@ -1710,7 +1710,7 @@ static bool sensor_fmt_videochk(struct v4l2_subdev *sd, struct v4l2_mbus_framefm
}
static int sensor_s_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);
const struct sensor_datafmt *fmt;
struct sensor *sensor = to_sensor(client);
struct reginfo *winseqe_set_addr=NULL;
@ -1915,7 +1915,7 @@ static int sensor_s_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf)
static int sensor_try_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct sensor *sensor = to_sensor(client);
const struct sensor_datafmt *fmt;
int ret = 0;
@ -1948,7 +1948,7 @@ static int sensor_try_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf)
static int sensor_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_dbg_chip_ident *id)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);
if (id->match.type != V4L2_CHIP_MATCH_I2C_ADDR)
return -EINVAL;
@ -2232,7 +2232,7 @@ static int sensor_set_flash(struct soc_camera_device *icd, const struct v4l2_que
static int sensor_g_control(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct sensor *sensor = to_sensor(client);
const struct v4l2_queryctrl *qctrl;
@ -2291,7 +2291,7 @@ static int sensor_g_control(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
static int sensor_s_control(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct sensor *sensor = to_sensor(client);
struct soc_camera_device *icd = client->dev.platform_data;
const struct v4l2_queryctrl *qctrl;
@ -2581,7 +2581,7 @@ static int sensor_s_ext_control(struct soc_camera_device *icd, struct v4l2_ext_c
static int sensor_g_ext_controls(struct v4l2_subdev *sd, struct v4l2_ext_controls *ext_ctrl)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct soc_camera_device *icd = client->dev.platform_data;
int i, error_cnt=0, error_idx=-1;
@ -2606,7 +2606,7 @@ static int sensor_g_ext_controls(struct v4l2_subdev *sd, struct v4l2_ext_control
static int sensor_s_ext_controls(struct v4l2_subdev *sd, struct v4l2_ext_controls *ext_ctrl)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct soc_camera_device *icd = client->dev.platform_data;
int i, error_cnt=0, error_idx=-1;
@ -2693,7 +2693,7 @@ static int sensor_video_probe(struct soc_camera_device *icd,
}
static long sensor_ioctl(struct v4l2_subdev *sd, unsigned int cmd, void *arg)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct soc_camera_device *icd = client->dev.platform_data;
struct sensor *sensor = to_sensor(client);
int ret = 0;

2956
drivers/media/video/ov2640_rk.c Executable file

File diff suppressed because it is too large Load Diff

View File

@ -1385,7 +1385,7 @@ static int sensor_ioctrl(struct soc_camera_device *icd,enum rk29sensor_power_cmd
}
static int sensor_init(struct v4l2_subdev *sd, u32 val)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct soc_camera_device *icd = client->dev.platform_data;
struct sensor *sensor = to_sensor(client);
const struct v4l2_queryctrl *qctrl;
@ -1562,7 +1562,7 @@ static unsigned long sensor_query_bus_param(struct soc_camera_device *icd)
static int sensor_g_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct soc_camera_device *icd = client->dev.platform_data;
struct sensor *sensor = to_sensor(client);
@ -1611,7 +1611,7 @@ static bool sensor_fmt_videochk(struct v4l2_subdev *sd, struct v4l2_mbus_framefm
}
static int sensor_s_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct sensor *sensor = to_sensor(client);
const struct sensor_datafmt *fmt;
const struct v4l2_queryctrl *qctrl;
@ -1789,7 +1789,7 @@ static int sensor_s_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf)
static int sensor_try_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct sensor *sensor = to_sensor(client);
const struct sensor_datafmt *fmt;
int ret = 0;
@ -1818,7 +1818,7 @@ static int sensor_try_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf)
static int sensor_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_dbg_chip_ident *id)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);
if (id->match.type != V4L2_CHIP_MATCH_I2C_ADDR)
return -EINVAL;
@ -2102,7 +2102,7 @@ static int sensor_set_flash(struct soc_camera_device *icd, const struct v4l2_que
static int sensor_g_control(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct sensor *sensor = to_sensor(client);
const struct v4l2_queryctrl *qctrl;
@ -2161,9 +2161,7 @@ static int sensor_g_control(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
static int sensor_s_control(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
{
struct i2c_client *client = sd->priv;
struct sensor *sensor = to_sensor(client);
struct soc_camera_device *icd = client->dev.platform_data;
struct i2c_client *client = v4l2_get_subdevdata(sd);
const struct v4l2_queryctrl *qctrl;
qctrl = soc_camera_find_qctrl(&sensor_ops, ctrl->id);
@ -2450,7 +2448,7 @@ static int sensor_s_ext_control(struct soc_camera_device *icd, struct v4l2_ext_c
static int sensor_g_ext_controls(struct v4l2_subdev *sd, struct v4l2_ext_controls *ext_ctrl)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct soc_camera_device *icd = client->dev.platform_data;
int i, error_cnt=0, error_idx=-1;
@ -2475,7 +2473,7 @@ static int sensor_g_ext_controls(struct v4l2_subdev *sd, struct v4l2_ext_control
static int sensor_s_ext_controls(struct v4l2_subdev *sd, struct v4l2_ext_controls *ext_ctrl)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct soc_camera_device *icd = client->dev.platform_data;
int i, error_cnt=0, error_idx=-1;
@ -2552,7 +2550,7 @@ static int sensor_video_probe(struct soc_camera_device *icd,
static long sensor_ioctl(struct v4l2_subdev *sd, unsigned int cmd, void *arg)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct soc_camera_device *icd = client->dev.platform_data;
struct sensor *sensor = to_sensor(client);
int ret = 0;

View File

@ -3313,7 +3313,7 @@ static int sensor_ioctrl(struct soc_camera_device *icd,enum rk29sensor_power_cmd
static int sensor_init(struct v4l2_subdev *sd, u32 val)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct soc_camera_device *icd = client->dev.platform_data;
struct sensor *sensor = to_sensor(client);
const struct v4l2_queryctrl *qctrl;
@ -3584,7 +3584,7 @@ static unsigned long sensor_query_bus_param(struct soc_camera_device *icd)
static int sensor_g_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct soc_camera_device *icd = client->dev.platform_data;
struct sensor *sensor = to_sensor(client);
@ -3712,7 +3712,7 @@ static struct reginfo* sensor_fmt_catch(int set_w, int set_h, int *ret_w, int *r
static int sensor_s_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);
const struct sensor_datafmt *fmt;
struct sensor *sensor = to_sensor(client);
struct reginfo *winseqe_set_addr=NULL;
@ -3801,7 +3801,7 @@ static int sensor_s_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf)
static int sensor_try_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct sensor *sensor = to_sensor(client);
const struct sensor_datafmt *fmt;
int ret = 0;
@ -3830,7 +3830,7 @@ static int sensor_try_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf)
static int sensor_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_dbg_chip_ident *id)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);
if (id->match.type != V4L2_CHIP_MATCH_I2C_ADDR)
return -EINVAL;
@ -4117,7 +4117,7 @@ static int sensor_set_flash(struct soc_camera_device *icd, const struct v4l2_que
#endif
static int sensor_g_control(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct sensor *sensor = to_sensor(client);
const struct v4l2_queryctrl *qctrl;
@ -4176,7 +4176,7 @@ static int sensor_g_control(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
static int sensor_s_control(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct sensor *sensor = to_sensor(client);
struct soc_camera_device *icd = client->dev.platform_data;
const struct v4l2_queryctrl *qctrl;
@ -4466,7 +4466,7 @@ static int sensor_s_ext_control(struct soc_camera_device *icd, struct v4l2_ext_c
static int sensor_g_ext_controls(struct v4l2_subdev *sd, struct v4l2_ext_controls *ext_ctrl)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct soc_camera_device *icd = client->dev.platform_data;
int i, error_cnt=0, error_idx=-1;
@ -4491,7 +4491,7 @@ static int sensor_g_ext_controls(struct v4l2_subdev *sd, struct v4l2_ext_control
static int sensor_s_ext_controls(struct v4l2_subdev *sd, struct v4l2_ext_controls *ext_ctrl)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct soc_camera_device *icd = client->dev.platform_data;
int i, error_cnt=0, error_idx=-1;
@ -4515,7 +4515,7 @@ static int sensor_s_ext_controls(struct v4l2_subdev *sd, struct v4l2_ext_control
}
static int sensor_s_stream(struct v4l2_subdev *sd, int enable)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct sensor *sensor = to_sensor(client);
if (enable == 1) {
@ -4587,7 +4587,7 @@ static int sensor_video_probe(struct soc_camera_device *icd,
}
static long sensor_ioctl(struct v4l2_subdev *sd, unsigned int cmd, void *arg)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct soc_camera_device *icd = client->dev.platform_data;
struct sensor *sensor = to_sensor(client);
int ret = 0;

View File

@ -1676,13 +1676,12 @@ static int sensor_ioctrl(struct soc_camera_device *icd,enum rk29sensor_power_cmd
}
static int sensor_init(struct v4l2_subdev *sd, u32 val)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct soc_camera_device *icd = client->dev.platform_data;
struct sensor *sensor = to_sensor(client);
const struct v4l2_queryctrl *qctrl;
const struct sensor_datafmt *fmt;
char value;
int ret,pid = 0;
int ret;
SENSOR_DG("\n%s..%s.. \n",SENSOR_NAME_STRING(),__FUNCTION__);
@ -1899,7 +1898,7 @@ static unsigned long sensor_query_bus_param(struct soc_camera_device *icd)
static int sensor_g_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct soc_camera_device *icd = client->dev.platform_data;
struct sensor *sensor = to_sensor(client);
@ -1948,7 +1947,7 @@ static bool sensor_fmt_videochk(struct v4l2_subdev *sd, struct v4l2_mbus_framefm
}
static int sensor_s_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct sensor *sensor = to_sensor(client);
const struct sensor_datafmt *fmt;
const struct v4l2_queryctrl *qctrl;
@ -2128,7 +2127,7 @@ static int sensor_s_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf)
static int sensor_try_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct sensor *sensor = to_sensor(client);
const struct sensor_datafmt *fmt;
int ret = 0;
@ -2157,7 +2156,7 @@ static int sensor_try_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf)
static int sensor_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_dbg_chip_ident *id)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);
if (id->match.type != V4L2_CHIP_MATCH_I2C_ADDR)
return -EINVAL;
@ -2441,7 +2440,7 @@ static int sensor_set_flash(struct soc_camera_device *icd, const struct v4l2_que
static int sensor_g_control(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct sensor *sensor = to_sensor(client);
const struct v4l2_queryctrl *qctrl;
@ -2500,7 +2499,7 @@ static int sensor_g_control(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
static int sensor_s_control(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct sensor *sensor = to_sensor(client);
struct soc_camera_device *icd = client->dev.platform_data;
const struct v4l2_queryctrl *qctrl;
@ -2790,7 +2789,7 @@ static int sensor_s_ext_control(struct soc_camera_device *icd, struct v4l2_ext_c
static int sensor_g_ext_controls(struct v4l2_subdev *sd, struct v4l2_ext_controls *ext_ctrl)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct soc_camera_device *icd = client->dev.platform_data;
int i, error_cnt=0, error_idx=-1;
@ -2815,7 +2814,7 @@ static int sensor_g_ext_controls(struct v4l2_subdev *sd, struct v4l2_ext_control
static int sensor_s_ext_controls(struct v4l2_subdev *sd, struct v4l2_ext_controls *ext_ctrl)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct soc_camera_device *icd = client->dev.platform_data;
int i, error_cnt=0, error_idx=-1;
@ -2843,9 +2842,8 @@ static int sensor_s_ext_controls(struct v4l2_subdev *sd, struct v4l2_ext_control
static int sensor_video_probe(struct soc_camera_device *icd,
struct i2c_client *client)
{
char value;
int ret,pid = 0;
struct sensor *sensor = to_sensor(client);
int ret;
/* We must have a parent by now. And it cannot be a wrong one.
* So this entire test is completely redundant. */
@ -2902,7 +2900,7 @@ static int sensor_video_probe(struct soc_camera_device *icd,
}
static long sensor_ioctl(struct v4l2_subdev *sd, unsigned int cmd, void *arg)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct soc_camera_device *icd = client->dev.platform_data;
struct sensor *sensor = to_sensor(client);
int ret = 0;

View File

@ -1460,7 +1460,7 @@ static int sensor_ioctrl(struct soc_camera_device *icd,enum rk29sensor_power_cmd
static int sensor_init(struct v4l2_subdev *sd, u32 val)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct soc_camera_device *icd = client->dev.platform_data;
struct sensor *sensor = to_sensor(client);
const struct v4l2_queryctrl *qctrl;
@ -1649,7 +1649,7 @@ static unsigned long sensor_query_bus_param(struct soc_camera_device *icd)
static int sensor_g_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct soc_camera_device *icd = client->dev.platform_data;
struct sensor *sensor = to_sensor(client);
@ -1698,7 +1698,7 @@ static bool sensor_fmt_videochk(struct v4l2_subdev *sd, struct v4l2_mbus_framefm
}
static int sensor_s_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct sensor *sensor = to_sensor(client);
const struct sensor_datafmt *fmt;
struct reginfo *winseqe_set_addr=NULL;
@ -1811,7 +1811,7 @@ static int sensor_s_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf)
static int sensor_try_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct sensor *sensor = to_sensor(client);
const struct sensor_datafmt *fmt;
int ret = 0;
@ -1839,7 +1839,7 @@ static int sensor_try_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf)
}
static int sensor_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_dbg_chip_ident *id)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);
if (id->match.type != V4L2_CHIP_MATCH_I2C_ADDR)
return -EINVAL;
@ -2136,7 +2136,7 @@ static int sensor_set_flash(struct soc_camera_device *icd, const struct v4l2_que
static int sensor_g_control(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct sensor *sensor = to_sensor(client);
const struct v4l2_queryctrl *qctrl;
@ -2195,7 +2195,7 @@ static int sensor_g_control(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
static int sensor_s_control(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct sensor *sensor = to_sensor(client);
struct soc_camera_device *icd = client->dev.platform_data;
const struct v4l2_queryctrl *qctrl;
@ -2485,7 +2485,7 @@ static int sensor_s_ext_control(struct soc_camera_device *icd, struct v4l2_ext_c
static int sensor_g_ext_controls(struct v4l2_subdev *sd, struct v4l2_ext_controls *ext_ctrl)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct soc_camera_device *icd = client->dev.platform_data;
int i, error_cnt=0, error_idx=-1;
@ -2510,7 +2510,7 @@ static int sensor_g_ext_controls(struct v4l2_subdev *sd, struct v4l2_ext_control
static int sensor_s_ext_controls(struct v4l2_subdev *sd, struct v4l2_ext_controls *ext_ctrl)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct soc_camera_device *icd = client->dev.platform_data;
int i, error_cnt=0, error_idx=-1;
@ -2588,7 +2588,7 @@ static int sensor_video_probe(struct soc_camera_device *icd,
static long sensor_ioctl(struct v4l2_subdev *sd, unsigned int cmd, void *arg)
{
struct i2c_client *client = sd->priv;
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct soc_camera_device *icd = client->dev.platform_data;
struct sensor *sensor = to_sensor(client);
int ret = 0;