Rockchip: vip: support cif controller

Transplant from kernel v3.10.

Change-Id: I8b1f8d664ebcaad435132f260250204255793b66
Signed-off-by: Peng Zhou <benjo.zhou@rock-chips.com>
This commit is contained in:
Peng Zhou 2017-10-11 16:35:15 +08:00 committed by Huang, Tao
commit 016f7ec166
39 changed files with 10737 additions and 577 deletions

View file

@ -493,14 +493,15 @@ static int soc_camera_init_user_formats(struct soc_camera_device *icd)
struct soc_camera_host *ici = to_soc_camera_host(icd->parent);
unsigned int i, fmts = 0, raw_fmts = 0;
int ret;
struct v4l2_subdev_mbus_code_enum code = {
.which = V4L2_SUBDEV_FORMAT_ACTIVE,
};
u32 code;
while (!v4l2_subdev_call(sd, pad, enum_mbus_code, NULL, &code)) {
while (!v4l2_subdev_call(sd, video, enum_mbus_fmt, raw_fmts, &code))
raw_fmts++;
code.index++;
}
if (!raw_fmts)
dev_err(icd->pdev,
"%s(%d): raw_fmts is NULL\n",
__func__, __LINE__);
if (!ici->ops->get_formats)
/*
@ -534,12 +535,11 @@ static int soc_camera_init_user_formats(struct soc_camera_device *icd)
fmts = 0;
for (i = 0; i < raw_fmts; i++)
if (!ici->ops->get_formats) {
code.index = i;
v4l2_subdev_call(sd, pad, enum_mbus_code, NULL, &code);
v4l2_subdev_call(sd, video, enum_mbus_fmt, i, &code);
icd->user_formats[fmts].host_fmt =
soc_mbus_get_fmtdesc(code.code);
soc_mbus_get_fmtdesc(code);
if (icd->user_formats[fmts].host_fmt)
icd->user_formats[fmts++].code = code.code;
icd->user_formats[fmts++].code = code;
} else {
ret = ici->ops->get_formats(icd, i,
&icd->user_formats[fmts]);
@ -914,6 +914,31 @@ static int soc_camera_s_fmt_vid_cap(struct file *file, void *priv,
return ret;
}
/*
* ddl@rock-chips.com :
* Add ioctrl - VIDIOC_ENUM_FRAMEINTERVALS for soc-camera.
*/
static int soc_camera_enum_frameintervals(struct file *file, void *priv,
struct v4l2_frmivalenum *fival)
{
struct soc_camera_device *icd = file->private_data;
struct soc_camera_host *ici = to_soc_camera_host(icd->parent);
struct v4l2_subdev *sd = soc_camera_to_subdev(icd);
int ret;
WARN_ON(priv != file->private_data);
ret = v4l2_subdev_call(sd, video, enum_frameintervals, fival);
if (ret == -ENOIOCTLCMD) {
if (ici->ops->enum_frameinervals)
ret = ici->ops->enum_frameinervals(icd, fival);
else
ret = -ENOIOCTLCMD;
}
return ret;
}
static int soc_camera_enum_fmt_vid_cap(struct file *file, void *priv,
struct v4l2_fmtdesc *f)
{
@ -937,6 +962,7 @@ static int soc_camera_g_fmt_vid_cap(struct file *file, void *priv,
struct v4l2_format *f)
{
struct soc_camera_device *icd = file->private_data;
struct soc_camera_host *ici = to_soc_camera_host(icd->parent);
struct v4l2_pix_format *pix = &f->fmt.pix;
WARN_ON(priv != file->private_data);
@ -953,6 +979,8 @@ static int soc_camera_g_fmt_vid_cap(struct file *file, void *priv,
pix->colorspace = icd->colorspace;
dev_dbg(icd->pdev, "current_fmt->fourcc: 0x%08x\n",
icd->current_fmt->host_fmt->fourcc);
ici->ops->get_fmt(icd, f);
return 0;
}
@ -990,8 +1018,12 @@ static int soc_camera_streamon(struct file *file, void *priv,
else
ret = vb2_streamon(&icd->vb2_vidq, i);
if (!ret)
if (!ret) {
v4l2_subdev_call(sd, video, s_stream, 1);
if (ici->ops->s_stream)
/* ddl@rock-chips.com : Add stream control for host */
ici->ops->s_stream(icd, 1);
}
return ret;
}
@ -1012,6 +1044,11 @@ static int soc_camera_streamoff(struct file *file, void *priv,
if (icd->streamer != file)
return -EBUSY;
/* ddl@rock-chips.com: v0.1.1 */
v4l2_subdev_call(sd, video, s_stream, 0);
if (ici->ops->s_stream)
ici->ops->s_stream(icd, 0);
/*
* This calls buf_release from host driver's videobuf_queue_ops for all
* remaining buffers. When the last buffer is freed, stop capture
@ -1026,6 +1063,183 @@ static int soc_camera_streamoff(struct file *file, void *priv,
return ret;
}
static int soc_camera_queryctrl(struct file *file, void *priv,
struct v4l2_queryctrl *qc)
{
struct soc_camera_device *icd = file->private_data;
struct soc_camera_host *ici = to_soc_camera_host(icd->parent);
int i;
WARN_ON(priv != file->private_data);
if (!qc->id)
return -EINVAL;
/* first device controls
* if device support digital zoom ,first use it to do zoom,zyc
*/
for (i = 0; i < icd->ops->num_controls; i++)
if (qc->id == icd->ops->controls[i].id) {
memcpy(qc, &icd->ops->controls[i], sizeof(*qc));
return 0;
}
/* then check host controls */
for (i = 0; i < ici->ops->num_controls; i++)
if (qc->id == ici->ops->controls[i].id) {
memcpy(qc, &ici->ops->controls[i], sizeof(*qc));
return 0;
}
return -EINVAL;
}
/* ddl@rock-chips.com : Add ioctrl -VIDIOC_QUERYMENU */
static int soc_camera_querymenu(struct file *file, void *priv,
struct v4l2_querymenu *qm)
{
struct soc_camera_device *icd = file->private_data;
struct v4l2_queryctrl qctrl;
int i, j;
qctrl.id = qm->id;
if (soc_camera_queryctrl(file, priv, &qctrl))
return -EINVAL;
for (i = 0; i < icd->ops->num_menus; i++) {
if (qm->id == icd->ops->menus[i].id) {
for (j = 0; j <= (qctrl.maximum - qctrl.minimum); j++) {
if (qm->index == icd->ops->menus[i].index) {
snprintf(qm->name, sizeof(qm->name),
icd->ops->menus[i].name);
qm->reserved = 0;
return 0;
} else {
i++;
if (i >= icd->ops->num_menus)
return -EINVAL;
}
}
}
}
return 0;
}
static int soc_camera_g_ctrl(struct file *file, void *priv,
struct v4l2_control *ctrl)
{
struct soc_camera_device *icd = file->private_data;
struct soc_camera_host *ici = to_soc_camera_host(icd->parent);
struct v4l2_subdev *sd = soc_camera_to_subdev(icd);
int ret;
WARN_ON(priv != file->private_data);
if (ici->ops->get_ctrl) {
ret = ici->ops->get_ctrl(icd, ctrl);
if (ret != -ENOIOCTLCMD)
return ret;
}
return v4l2_subdev_call(sd, core, g_ctrl, ctrl);
}
static int soc_camera_s_ctrl(struct file *file, void *priv,
struct v4l2_control *ctrl)
{
struct soc_camera_device *icd = file->private_data;
struct soc_camera_host *ici = to_soc_camera_host(icd->parent);
struct v4l2_subdev *sd = soc_camera_to_subdev(icd);
int ret;
WARN_ON(priv != file->private_data);
if (ici->ops->set_ctrl) {
ret = ici->ops->set_ctrl(icd, ctrl);
if (ret != -ENOIOCTLCMD)
return ret;
}
return v4l2_subdev_call(sd, core, s_ctrl, ctrl);
}
/* ddl@rock-chips.com : Add ioctrl -VIDIOC_XXX_ext_ctrl for soc-camera */
static int soc_camera_try_ext_ctrl(struct file *file, void *priv,
struct v4l2_ext_controls *ctrl)
{
struct soc_camera_device *icd = file->private_data;
const struct v4l2_queryctrl *qctrl;
int i;
WARN_ON(priv != file->private_data);
/*current kernel version don't define
*this member for struct v4l2_ext_control.
*/
/*
*if (ctrl->ctrl_class != V4L2_CTRL_CLASS_CAMERA)
* return -EINVAL;
*/
for (i = 0; i < ctrl->count; i++) {
qctrl = soc_camera_find_qctrl(icd->ops, ctrl->controls[i].id);
if (!qctrl)
return -EINVAL;
if ((ctrl->controls[i].value < qctrl->minimum) ||
(ctrl->controls[i].value > qctrl->minimum))
return -ERANGE;
}
return 0;
}
/* ddl@rock-chips.com : Add ioctrl -VIDIOC_XXX_ext_ctrl for soc-camera */
static int soc_camera_g_ext_ctrl(struct file *file, void *priv,
struct v4l2_ext_controls *ctrl)
{
struct soc_camera_device *icd = file->private_data;
struct v4l2_subdev *sd = soc_camera_to_subdev(icd);
WARN_ON(priv != file->private_data);
/*current kernel version don't define
*this member for struct v4l2_ext_control.
*/
/*
*if (ctrl->ctrl_class != V4L2_CTRL_CLASS_CAMERA)
* return -EINVAL;
*/
return v4l2_subdev_call(sd, core, g_ext_ctrls, ctrl);
}
/* ddl@rock-chips.com : Add ioctrl -VIDIOC_XXX_ext_ctrl for soc-camera */
static int soc_camera_s_ext_ctrl(struct file *file, void *priv,
struct v4l2_ext_controls *ctrl)
{
struct soc_camera_device *icd = file->private_data;
struct v4l2_subdev *sd = soc_camera_to_subdev(icd);
WARN_ON(priv != file->private_data);
/*current kernel version don't define
*this member for struct v4l2_ext_control.
*/
/*
*if (ctrl->ctrl_class != V4L2_CTRL_CLASS_CAMERA)
* return -EINVAL;
*/
return v4l2_subdev_call(sd, core, s_ext_ctrls, ctrl);
}
static int soc_camera_cropcap(struct file *file, void *fh,
struct v4l2_cropcap *a)
{
@ -1339,6 +1553,7 @@ static int soc_camera_probe_finish(struct soc_camera_device *icd)
icd->colorspace = mf->colorspace;
icd->field = mf->field;
}
soc_camera_remove_device(icd);
return 0;
@ -1748,6 +1963,7 @@ static int soc_camera_probe(struct soc_camera_host *ici,
{
struct soc_camera_desc *sdesc = to_soc_camera_desc(icd);
struct soc_camera_host_desc *shd = &sdesc->host_desc;
struct soc_camera_subdev_desc *ssdd = &sdesc->subdev_desc;
struct device *control = NULL;
int ret;
@ -1764,11 +1980,15 @@ static int soc_camera_probe(struct soc_camera_host *ici,
if (ret < 0)
return ret;
ret = soc_camera_power_on(icd->pdev, ssdd, NULL);
if (ret < 0)
goto eadd;
/* Must have icd->vdev before registering the device */
ret = video_dev_create(icd);
if (ret < 0)
goto evdc;
ssdd->socdev = icd;
/*
* ..._video_start() will create a device node, video_register_device()
* itself is protected against concurrent open() calls, but we also have
@ -2124,6 +2344,21 @@ static const struct v4l2_ioctl_ops soc_camera_ioctl_ops = {
.vidioc_expbuf = soc_camera_expbuf,
.vidioc_streamon = soc_camera_streamon,
.vidioc_streamoff = soc_camera_streamoff,
.vidioc_queryctrl = soc_camera_queryctrl,
/* ddl@rock-chips.com: Add ioctrl - vidioc_querymenu for soc-camera */
.vidioc_querymenu = soc_camera_querymenu,
.vidioc_g_ctrl = soc_camera_g_ctrl,
.vidioc_s_ctrl = soc_camera_s_ctrl,
/* ddl@rock-chips.com: Add ioctrl - vidioc_g_ext_ctrls for soc-camera */
.vidioc_g_ext_ctrls = soc_camera_g_ext_ctrl,
/* ddl@rock-chips.com: Add ioctrl - vidioc_s_ext_ctrls for soc-camera */
.vidioc_s_ext_ctrls = soc_camera_s_ext_ctrl,
/* ddl@rock-chips.com: Add ioctrl - vidioc_try_ext_ctrls for soc-camera */
.vidioc_try_ext_ctrls = soc_camera_try_ext_ctrl,
/* ddl@rock-chips.com: Add ioctrl - VIDIOC_ENUM_FRAMEINTERVALS for soc-camera */
.vidioc_enum_frameintervals = soc_camera_enum_frameintervals,
.vidioc_cropcap = soc_camera_cropcap,
.vidioc_g_crop = soc_camera_g_crop,
.vidioc_s_crop = soc_camera_s_crop,
@ -2143,6 +2378,7 @@ static int video_dev_create(struct soc_camera_device *icd)
strlcpy(vdev->name, ici->drv_name, sizeof(vdev->name));
vdev->dev_parent = icd->pdev;
vdev->v4l2_dev = &ici->v4l2_dev;
vdev->fops = &soc_camera_fops;
vdev->ioctl_ops = &soc_camera_ioctl_ops;

View file

@ -265,6 +265,8 @@ static int __videobuf_iolock(struct videobuf_queue *q,
return -ENOMEM;
break;
case V4L2_MEMORY_OVERLAY:
/* ddl@rock-chips.com : nzy modify V4L2_MEMORY_OVERLAY */
break;
default:
dev_dbg(q->dev, "%s memory method OVERLAY/unknown\n", __func__);
return -EINVAL;

View file

@ -1,36 +1,44 @@
obj-$(CONFIG_RK30_CAMERA_PINGPONG) += rk30_camera_pingpong.o generic_sensor.o \
gc0307.o \
gc0308.o \
gc0309.o \
gc0328.o \
gc0329.o \
gc2015.o \
gc2035.o \
gt2005.o \
hm2057.o \
hm5065.o \
mt9p111.o \
nt99160_2way.o \
nt99240_2way.o \
ov2659.o \
ov5640.o \
sp0838.o \
sp2518.o
obj-$(CONFIG_RK30_CAMERA_ONEFRAME) += rk30_camera_oneframe.o generic_sensor.o \
gc0307.o \
gc0308.o \
gc0309.o \
gc0328.o \
gc0329.o \
gc2015.o \
gc2035.o \
gt2005.o \
hm2057.o \
hm5065.o \
mt9p111.o \
nt99160_2way.o \
nt99240_2way.o \
ov2659.o \
ov5640.o \
sp0838.o \
sp2518.o
obj-$(CONFIG_RK30_CAMERA_PINGPONG) += rk30_camera_pingpong.o generic_sensor.o \
gc0307.o \
gc0308.o \
gc0309.o \
gc0328.o \
gc0329.o \
gc2015.o \
gc2035.o \
gc2145.o \
gc2155.o \
gt2005.o \
hm2057.o \
hm5065.o \
mt9p111.o \
nt99160_2way.o \
nt99240_2way.o \
ov2659.o \
ov5640.o \
sp0838.o \
sp2518.o \
tp2825.o \
adv7181.o
obj-$(CONFIG_RK30_CAMERA_ONEFRAME) += rk30_camera_oneframe.o generic_sensor.o \
gc0307.o \
gc0308.o \
gc0309.o \
gc0328.o \
gc0329.o \
gc2015.o \
gc2035.o \
gc2145.o \
gc2155.o \
gt2005.o \
hm2057.o \
hm5065.o \
mt9p111.o \
nt99160_2way.o \
nt99240_2way.o \
ov2659.o \
ov5640.o \
sp0838.o \
sp2518.o \
tp2825.o \
adv7181.o

File diff suppressed because it is too large Load diff

15
drivers/media/video/gc0307.c Executable file → Normal file
View file

@ -1,3 +1,16 @@
/*
* drivers/media/video/gc0307.c
*
* Copyright (C) ROCKCHIP, Inc.
* This software is licensed under the terms of the GNU General Public
* License version 2, as published by the Free Software Foundation, and
* may be copied, distributed, and modified under those terms.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include "generic_sensor.h"
@ -1022,7 +1035,7 @@ static struct sensor_v4l2ctrl_usr_s sensor_controls[] =
//MUST define the current used format as the first item
static struct rk_sensor_datafmt sensor_colour_fmts[] = {
{V4L2_MBUS_FMT_YUYV8_2X8, V4L2_COLORSPACE_JPEG}
{MEDIA_BUS_FMT_YUYV8_2X8, V4L2_COLORSPACE_JPEG}
};
/*static struct soc_camera_ops sensor_ops;*/

15
drivers/media/video/gc0308.c Executable file → Normal file
View file

@ -1,3 +1,16 @@
/*
* drivers/media/video/gc0308.c
*
* Copyright (C) ROCKCHIP, Inc.
* This software is licensed under the terms of the GNU General Public
* License version 2, as published by the Free Software Foundation, and
* may be copied, distributed, and modified under those terms.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include "generic_sensor.h"
/*
@ -910,7 +923,7 @@ static struct sensor_v4l2ctrl_usr_s sensor_controls[] =
//MUST define the current used format as the first item
static struct rk_sensor_datafmt sensor_colour_fmts[] = {
{V4L2_MBUS_FMT_YUYV8_2X8, V4L2_COLORSPACE_JPEG}
{MEDIA_BUS_FMT_YUYV8_2X8, V4L2_COLORSPACE_JPEG}
};
/*static struct soc_camera_ops sensor_ops;*/

15
drivers/media/video/gc0309.c Executable file → Normal file
View file

@ -1,3 +1,16 @@
/*
* drivers/media/video/gc0309.c
*
* Copyright (C) ROCKCHIP, Inc.
* This software is licensed under the terms of the GNU General Public
* License version 2, as published by the Free Software Foundation, and
* may be copied, distributed, and modified under those terms.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include "generic_sensor.h"
@ -860,7 +873,7 @@ static struct sensor_v4l2ctrl_usr_s sensor_controls[] =
//MUST define the current used format as the first item
static struct rk_sensor_datafmt sensor_colour_fmts[] = {
{V4L2_MBUS_FMT_YUYV8_2X8, V4L2_COLORSPACE_JPEG}
{MEDIA_BUS_FMT_YUYV8_2X8, V4L2_COLORSPACE_JPEG}
};
/*static struct soc_camera_ops sensor_ops;*/

15
drivers/media/video/gc0328.c Executable file → Normal file
View file

@ -1,3 +1,16 @@
/*
* drivers/media/video/gc0328.c
*
* Copyright (C) ROCKCHIP, Inc.
* This software is licensed under the terms of the GNU General Public
* License version 2, as published by the Free Software Foundation, and
* may be copied, distributed, and modified under those terms.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include "generic_sensor.h"
@ -769,7 +782,7 @@ static struct sensor_v4l2ctrl_usr_s sensor_controls[] =
//MUST define the current used format as the first item
static struct rk_sensor_datafmt sensor_colour_fmts[] = {
{V4L2_MBUS_FMT_YUYV8_2X8, V4L2_COLORSPACE_JPEG}
{MEDIA_BUS_FMT_YUYV8_2X8, V4L2_COLORSPACE_JPEG}
};
/*static struct soc_camera_ops sensor_ops;*/

15
drivers/media/video/gc0329.c Executable file → Normal file
View file

@ -1,3 +1,16 @@
/*
* drivers/media/video/gc0329.c
*
* Copyright (C) ROCKCHIP, Inc.
* This software is licensed under the terms of the GNU General Public
* License version 2, as published by the Free Software Foundation, and
* may be copied, distributed, and modified under those terms.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include "generic_sensor.h"
@ -844,7 +857,7 @@ static struct sensor_v4l2ctrl_usr_s sensor_controls[] =
//MUST define the current used format as the first item
static struct rk_sensor_datafmt sensor_colour_fmts[] = {
{V4L2_MBUS_FMT_YUYV8_2X8, V4L2_COLORSPACE_JPEG}
{MEDIA_BUS_FMT_YUYV8_2X8, V4L2_COLORSPACE_JPEG}
};
//static struct soc_camera_ops sensor_ops;

15
drivers/media/video/gc2015.c Executable file → Normal file
View file

@ -1,3 +1,16 @@
/*
* drivers/media/video/gc2015.c
*
* Copyright (C) ROCKCHIP, Inc.
* This software is licensed under the terms of the GNU General Public
* License version 2, as published by the Free Software Foundation, and
* may be copied, distributed, and modified under those terms.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include "generic_sensor.h"
/*
@ -833,7 +846,7 @@ static struct sensor_v4l2ctrl_usr_s sensor_controls[] =
//MUST define the current used format as the first item
static struct rk_sensor_datafmt sensor_colour_fmts[] = {
{V4L2_MBUS_FMT_UYVY8_2X8, V4L2_COLORSPACE_JPEG}
{MEDIA_BUS_FMT_UYVY8_2X8, V4L2_COLORSPACE_JPEG}
};
/*static struct soc_camera_ops sensor_ops;*/

15
drivers/media/video/gc2035.c Executable file → Normal file
View file

@ -1,3 +1,16 @@
/*
* drivers/media/video/gc2035.c
*
* Copyright (C) ROCKCHIP, Inc.
* This software is licensed under the terms of the GNU General Public
* License version 2, as published by the Free Software Foundation, and
* may be copied, distributed, and modified under those terms.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include "generic_sensor.h"
@ -1190,7 +1203,7 @@ static struct sensor_v4l2ctrl_usr_s sensor_controls[] =
//MUST define the current used format as the first item
static struct rk_sensor_datafmt sensor_colour_fmts[] = {
{V4L2_MBUS_FMT_UYVY8_2X8, V4L2_COLORSPACE_JPEG}
{MEDIA_BUS_FMT_UYVY8_2X8, V4L2_COLORSPACE_JPEG}
};
/*static struct soc_camera_ops sensor_ops;*/

1699
drivers/media/video/gc2145.c Normal file

File diff suppressed because it is too large Load diff

1622
drivers/media/video/gc2155.c Normal file

File diff suppressed because it is too large Load diff

203
drivers/media/video/generic_sensor.c Executable file → Normal file
View file

@ -1,3 +1,15 @@
/*
* Copyright (C) ROCKCHIP, Inc.
* This software is licensed under the terms of the GNU General Public
* License version 2, as published by the Free Software Foundation, and
* may be copied, distributed, and modified under those terms.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include <linux/videodev2.h>
#include <linux/slab.h>
#include <linux/i2c.h>
@ -60,7 +72,7 @@ module_param(debug, int, S_IRUGO|S_IWUSR);
#define CONFIG_SENSOR_I2C_RDWRCHK 0
static const struct rk_sensor_datafmt *generic_sensor_find_datafmt(
enum v4l2_mbus_pixelcode code, const struct rk_sensor_datafmt *fmt,
u32 code, const struct rk_sensor_datafmt *fmt,
int n);
int sensor_write_reg2val1(struct i2c_client *client, u16 reg,u8 val){
@ -112,10 +124,7 @@ int generic_sensor_write(struct i2c_client *client,struct rk_sensor_reg* sensor_
int err,cnt = 0,i;
u8 buf[6];
struct i2c_msg msg[1];
u32 i2c_speed;
struct generic_sensor *sensor = to_generic_sensor(client);
i2c_speed = sensor->info_priv.gI2c_speed;
err = 0;
switch(sensor_reg->reg){
@ -144,7 +153,6 @@ int generic_sensor_write(struct i2c_client *client,struct rk_sensor_reg* sensor_
msg->addr = client->addr;
msg->flags = client->flags;
msg->buf = buf;
msg->scl_rate = i2c_speed; /* ddl@rock-chips.com : 100kHz */
// msg->read_type = 0; /* fpga i2c:0==I2C_NORMAL : direct use number not enum for don't want include spi_fpga.h */
msg->len = cnt;
cnt = 3;
@ -153,7 +161,6 @@ int generic_sensor_write(struct i2c_client *client,struct rk_sensor_reg* sensor_
debug_printk( "/___________/msg->addr = %x \n",msg->addr);
debug_printk( "/___________/msg->flags = %x\n",msg->flags);
debug_printk( "/___________/msg->buf = %d\n",msg->buf);
debug_printk( "/___________/msg->scl_rate = %d\n",msg->scl_rate);
debug_printk( "/___________/msg->len = %d\n",msg->len);
debug_printk( "/___________/client->adapter = %p\n",client->adapter);
*/
@ -185,7 +192,6 @@ int generic_sensor_writebuf(struct i2c_client *client, char *buf, int buf_size)
msg->addr = client->addr;
msg->flags = client->flags;
msg->buf = buf;
msg->scl_rate = sensor->info_priv.gI2c_speed; /* ddl@rock-chips.com : 100kHz */
//msg->read_type = 0;
msg->len = buf_size;
cnt = 3;
@ -281,11 +287,9 @@ int generic_sensor_read(struct i2c_client *client, struct rk_sensor_reg* sensor_
u8 buf_reg[3];
u8 buf_val[3];
struct i2c_msg msg[2];
u32 i2c_speed;
struct generic_sensor *sensor = to_generic_sensor(client);
struct generic_sensor *sensor = to_generic_sensor(client);
debug_printk( "/$$$$$$$$$$$$$$$$$$$$$$//n Here I am: %s:%i-------%s()\n", __FILE__, __LINE__,__FUNCTION__);
i2c_speed = sensor->info_priv.gI2c_speed;
cnt=0;
for (i=2; i>=0; i--) {
if((sensor_reg->reg_mask) & (0xff<<(i*8))) {
@ -296,7 +300,6 @@ int generic_sensor_read(struct i2c_client *client, struct rk_sensor_reg* sensor_
msg[0].addr = client->addr;
msg[0].flags = client->flags;
msg[0].buf = buf_reg;
msg[0].scl_rate = i2c_speed; /* ddl@rock-chips.com : 100kHz */
//msg[0].read_type = 2; /* fpga i2c:0==I2C_NO_STOP : direct use number not enum for don't want include spi_fpga.h */
msg[0].len = cnt;
@ -312,7 +315,6 @@ int generic_sensor_read(struct i2c_client *client, struct rk_sensor_reg* sensor_
msg[1].flags = client->flags|I2C_M_RD;
msg[1].buf = buf_val;
msg[1].len = cnt;
msg[1].scl_rate = i2c_speed; /* ddl@rock-chips.com : 100kHz */
//msg[1].read_type = 2; /* fpga i2c:0==I2C_NO_STOP : direct use number not enum for don't want include spi_fpga.h */
cnt = 1;
@ -512,7 +514,7 @@ static int sensor_try_fmt(struct i2c_client *client,unsigned int *set_w,unsigned
*set_h = tmp_h;
//only has the init array
if((tmp_w == 10000) && (tmp_index != -1)){
SENSOR_TR("have not other series meet the requirement except init_serie,array_index = %d",tmp_index);
SENSOR_DG("have not other series meet the requirement except init_serie,array_index = %d", tmp_index);
*set_w = sensor->info_priv.sensor_series[tmp_index].gSeq_info.w;
*set_h = sensor->info_priv.sensor_series[tmp_index].gSeq_info.h;
goto try_end;
@ -560,14 +562,15 @@ int generic_sensor_try_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf
fmt = &(sensor->info_priv.curfmt);
mf->code = fmt->code;
}
/* ddl@rock-chips.com : It is query max resolution only. */
if (mf->reserved[6] == 0xfefe5a5a) {
mf->height = sensor->info_priv.max_res.h ;
mf->width = sensor->info_priv.max_res.w;
ret = 0;
SENSOR_DG("Query resolution: %dx%d",mf->width, mf->height);
goto generic_sensor_try_fmt_end;
}
/* ddl@rock-chips.com : It is query max resolution only. */
if (mf->reserved[6] == 0xfe5a) {
mf->height = sensor->info_priv.max_res.h;
mf->width = sensor->info_priv.max_res.w;
ret = 0;
SENSOR_DG("Query resolution: %dx%d", mf->width, mf->height);
goto generic_sensor_try_fmt_end;
}
//use this to filter unsupported resolutions
if (sensor->sensor_cb.sensor_try_fmt_cb_th){
ret = sensor->sensor_cb.sensor_try_fmt_cb_th(client, mf);
@ -596,19 +599,18 @@ generic_sensor_try_fmt_end:
int generic_sensor_cropcap(struct v4l2_subdev *sd, struct v4l2_cropcap *cc)
{
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct generic_sensor *sensor = to_generic_sensor(client);
int ret=0;
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct generic_sensor *sensor = to_generic_sensor(client);
cc->bounds.left = 0;
cc->bounds.top = 0;
cc->bounds.width = sensor->info_priv.max_res.w;
cc->bounds.height = sensor->info_priv.max_res.h;
cc->pixelaspect.denominator = sensor->info_priv.max_res.w;
cc->pixelaspect.numerator = sensor->info_priv.max_res.h;
cc->bounds.left = 0;
cc->bounds.top = 0;
cc->bounds.width = sensor->info_priv.max_res.w;
cc->bounds.height = sensor->info_priv.max_res.h;
return ret;
cc->pixelaspect.denominator = sensor->info_priv.max_res.w;
cc->pixelaspect.numerator = sensor->info_priv.max_res.h;
return 0;
}
int generic_sensor_enum_frameintervals(struct v4l2_subdev *sd, struct v4l2_frmivalenum *fival){
@ -618,7 +620,8 @@ int generic_sensor_enum_frameintervals(struct v4l2_subdev *sd, struct v4l2_frmiv
struct generic_sensor *sensor = to_generic_sensor(client);
if (fival->height > sensor->info_priv.max_res.h|| fival->width > sensor->info_priv.max_res.w){
SENSOR_TR("this resolution(%dx%d) isn't support!",fival->width,fival->height);
SENSOR_DG("this resolution(%dx%d) isn't support!",
fival->width, fival->height);
err = -1;
goto enum_frameintervals_end;
}
@ -630,7 +633,10 @@ int generic_sensor_enum_frameintervals(struct v4l2_subdev *sd, struct v4l2_frmiv
fival->reserved[1] = (set_w<<16)|set_h;
fival->type = V4L2_FRMIVAL_TYPE_DISCRETE;
SENSOR_DG("%dx%d(real:%dx%d) framerate: %d",fival->width,fival->height,set_w,set_h,fival->discrete.denominator);
SENSOR_DG("%dx%d(real:%dx%d) framerate: %d",
fival->width, fival->height,
set_w, set_h,
fival->discrete.denominator);
enum_frameintervals_end:
return err;
}
@ -643,7 +649,7 @@ static enum hrtimer_restart generic_flash_off_func(struct hrtimer *timer){
}
/* Find a data format by a pixel code in an array */
static const struct rk_sensor_datafmt *generic_sensor_find_datafmt(
enum v4l2_mbus_pixelcode code, const struct rk_sensor_datafmt *fmt,
u32 code, const struct rk_sensor_datafmt *fmt,
int n)
{
int i;
@ -811,7 +817,6 @@ int generic_sensor_init(struct v4l2_subdev *sd, u32 val)
/* ddl@rock-chips.com : i2c speed is config in new_camera_device_ex macro */
if (sensor_device) {
sensor->info_priv.gI2c_speed = sensor_device->i2c_rate;
sensor->info_priv.mirror = sensor_device->mirror;
}
@ -912,7 +917,8 @@ int generic_sensor_s_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf)
struct generic_sensor *sensor = to_generic_sensor(client);
struct rk_sensor_sequence *winseqe_set_addr=NULL;
struct sensor_v4l2ctrl_info_s *v4l2ctrl_info=NULL;
bool is_capture=(mf->reserved[0]==0xfefe5a5a)?true:false; /* ddl@rock-chips.com : v0.1.5 */
/* ddl@rock-chips.com : v0.1.5 */
bool is_capture = (mf->reserved[0] == 0xfe5a) ? true : false;
int ret=0;
fmt =generic_sensor_find_datafmt(mf->code, sensor->info_priv.datafmt,
@ -961,23 +967,7 @@ sensor_s_fmt_end:
Sensor_CropSet(mf,sensor->crop_percent); /* ddl@rock-chips.com: v0.1.b */
return ret;
}
int generic_sensor_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_dbg_chip_ident *id)
{
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct generic_sensor *sensor = to_generic_sensor(client);
if (id->match.type != V4L2_CHIP_MATCH_I2C_ADDR)
return -EINVAL;
if (id->match.addr != client->addr)
return -ENODEV;
id->ident = sensor->info_priv.chip_ident; /* ddl@rock-chips.com : Return OV2655 identifier */
id->revision = 0;
return 0;
}
int generic_sensor_g_control(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
{
struct i2c_client *client = v4l2_get_subdevdata(sd);
@ -1013,32 +1003,32 @@ int generic_sensor_g_control(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
int generic_sensor_s_control(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
{
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct generic_sensor *sensor = to_generic_sensor(client);
struct soc_camera_subdev_desc *ssdd = client->dev.platform_data;
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct generic_sensor *sensor = to_generic_sensor(client);
struct soc_camera_subdev_desc *ssdd = client->dev.platform_data;
struct soc_camera_device *icd = ssdd->socdev;
struct sensor_v4l2ctrl_info_s *ctrl_info;
struct v4l2_ext_control ext_ctrl;
int ret = 0;
struct sensor_v4l2ctrl_info_s *ctrl_info;
struct v4l2_ext_control ext_ctrl;
int ret = 0;
ctrl_info = sensor_find_ctrl(sensor->ctrls,ctrl->id);
if (!ctrl_info) {
SENSOR_TR("v4l2_control id(0x%x) is invalidate",ctrl->id);
ret = -EINVAL;
} else {
ctrl_info = sensor_find_ctrl(sensor->ctrls, ctrl->id);
if (!ctrl_info) {
SENSOR_DG("v4l2_control id(0x%x) is invalidate", ctrl->id);
ret = -EINVAL;
} else {
ext_ctrl.id = ctrl->id;
ext_ctrl.value = ctrl->value;
ext_ctrl.id = ctrl->id;
ext_ctrl.value = ctrl->value;
if (ctrl_info->cb) {
ret = (ctrl_info->cb)(icd,ctrl_info, &ext_ctrl,true);
} else {
SENSOR_TR("v4l2_control id(0x%x) callback isn't exist",ctrl->id);
ret = -EINVAL;
}
}
if (ctrl_info->cb) {
ret = ctrl_info->cb(icd, ctrl_info, &ext_ctrl, true);
} else {
SENSOR_TR("v4l2_control id(0x%x) callback isn't exist",
ctrl->id);
ret = -EINVAL;
}
}
return ret;
return ret;
}
int generic_sensor_g_ext_control(struct soc_camera_device *icd , struct v4l2_ext_control *ext_ctrl)
@ -1066,26 +1056,30 @@ int generic_sensor_g_ext_control(struct soc_camera_device *icd , struct v4l2_ext
return ret;
}
int generic_sensor_s_ext_control(struct soc_camera_device *icd, struct v4l2_ext_control *ext_ctrl)
int generic_sensor_s_ext_control(struct soc_camera_device *icd,
struct v4l2_ext_control *ext_ctrl)
{
struct i2c_client *client = to_i2c_client(to_soc_camera_control(icd));
struct generic_sensor *sensor = to_generic_sensor(client);
struct sensor_v4l2ctrl_info_s *ctrl_info;
int ret = 0;
ctrl_info = sensor_find_ctrl(sensor->ctrls,ext_ctrl->id);
if (!ctrl_info) {
SENSOR_TR("v4l2_ext_control id(0x%x) is invalidate",ext_ctrl->id);
ret = -EINVAL;
} else {
if (ctrl_info->cb) {
ret = (ctrl_info->cb)(icd,ctrl_info, ext_ctrl,true);
} else {
SENSOR_TR("v4l2_ext_control id(0x%x) callback isn't exist",ext_ctrl->id);
ret = -EINVAL;
}
}
return 0;
struct i2c_client *client = to_i2c_client(to_soc_camera_control(icd));
struct generic_sensor *sensor = to_generic_sensor(client);
struct sensor_v4l2ctrl_info_s *ctrl_info;
int ret = 0;
ctrl_info = sensor_find_ctrl(sensor->ctrls, ext_ctrl->id);
if (!ctrl_info) {
SENSOR_DG("v4l2_ext_control id(0x%x) is invalidate",
ext_ctrl->id);
ret = -EINVAL;
} else {
if (ctrl_info->cb) {
ret = ctrl_info->cb(icd, ctrl_info, ext_ctrl, true);
} else {
SENSOR_TR("v4l2_ext_control id(0x%x) callback isn't exist",
ext_ctrl->id);
ret = -EINVAL;
}
}
return 0;
}
int generic_sensor_g_ext_controls(struct v4l2_subdev *sd, struct v4l2_ext_controls *ext_ctrl)
{
@ -1175,7 +1169,7 @@ long generic_sensor_ioctl(struct v4l2_subdev *sd, unsigned int cmd, void *arg)
/* ddl@rock-chips.com : if gpio_flash havn't been set in board-xxx.c, sensor driver must notify is not support flash control
for this project */
if (sensor->sensor_gpio_res) {
if (sensor->sensor_gpio_res->gpio_flash == INVALID_GPIO) {
if (sensor->sensor_gpio_res->gpio_flash) {
flash_attach = false;
} else {
flash_attach = true;
@ -1210,9 +1204,18 @@ long generic_sensor_ioctl(struct v4l2_subdev *sd, unsigned int cmd, void *arg)
}
break;
}
case RK29_CAM_SUBDEV_GET_INTERFACE:
{
memcpy(arg, &sensor->info_priv.dev_sig_cnf,
sizeof(sensor->info_priv.dev_sig_cnf));
SENSOR_DG("%s ioctl get src fmt: %s", __func__,
(char *)arg);
break;
}
default:
{
SENSOR_TR("%s cmd(0x%x) is unknown !\n",__FUNCTION__,cmd);
SENSOR_DG("%s cmd(0x%x) is unknown !\n",__FUNCTION__,cmd);
break;
}
}
@ -1231,7 +1234,7 @@ int generic_sensor_s_power(struct v4l2_subdev *sd, int on)
debug_printk( "/$$$$$$$$$$$$$$$$$$$$$$//n Here I am: %s:%i-------%s()\n", __FILE__, __LINE__,__FUNCTION__);
if(on)
{
ret = soc_camera_power_on(icd->pdev,ssdd);
ret = soc_camera_power_on(icd->pdev, ssdd, NULL);
if(ret < 0)
SENSOR_TR("%s(%d)power_on fail !\n",__FUNCTION__,__LINE__);
@ -1240,7 +1243,7 @@ int generic_sensor_s_power(struct v4l2_subdev *sd, int on)
{
v4l2_subdev_call(sd, core, ioctl, RK29_CAM_SUBDEV_DEACTIVATE,NULL);
soc_camera_power_off(icd->pdev,ssdd);
soc_camera_power_off(icd->pdev, ssdd, NULL);
if(ret < 0)
SENSOR_TR("%s(%d)power_off fail !\n",__FUNCTION__,__LINE__);
@ -1251,7 +1254,7 @@ int generic_sensor_s_power(struct v4l2_subdev *sd, int on)
int generic_sensor_enum_fmt(struct v4l2_subdev *sd, unsigned int index,
enum v4l2_mbus_pixelcode *code)
u32 *code)
{
struct i2c_client *client = v4l2_get_subdevdata(sd);

40
drivers/media/video/generic_sensor.h Executable file → Normal file
View file

@ -1,3 +1,15 @@
/*
* Copyright (C) ROCKCHIP, Inc.
* This software is licensed under the terms of the GNU General Public
* License version 2, as published by the Free Software Foundation, and
* may be copied, distributed, and modified under those terms.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#ifndef __ASM_ARCH_GENERIC_SENSOR_RK_H_
#include <linux/videodev2.h>
#include <linux/slab.h>
@ -13,7 +25,7 @@
#include <media/soc_camera.h>
#include <linux/vmalloc.h>
#include <linux/module.h>
#include "../../../arch/arm/mach-rockchip/rk30_camera.h"
#include "../../../drivers/soc/rockchip/rk30_camera.h"
#include <linux/kernel.h>
/* Camera Sensor driver */
@ -100,7 +112,7 @@ struct rk_sensor_sequence {
/* only one fixed colorspace per pixelcode */
struct rk_sensor_datafmt {
enum v4l2_mbus_pixelcode code;
u32 code;
enum v4l2_colorspace colorspace;
};
@ -201,10 +213,10 @@ typedef struct rk_sensor_priv_s
int chip_ident;
unsigned int gReg_mask;
unsigned int gVal_mask;
unsigned int gI2c_speed;
bool stream;
struct rk_camera_device_signal_config dev_sig_cnf;
struct dentry *debugfs_dir;
int video_state;
bool stream;
} rk_sensor_info_priv_t;
struct sensor_v4l2ctrl_info_s {
@ -245,6 +257,11 @@ struct rk_flash_timer{
struct hrtimer timer;
};
struct rk_state_check_work {
struct workqueue_struct *state_check_wq;
struct delayed_work work;
};
struct generic_sensor
{
char dev_name[32];
@ -254,6 +271,9 @@ struct generic_sensor
int model; /* V4L2_IDENT_OV* codes from v4l2-chip-ident.h */
int crop_percent;
int irq;
struct rk_state_check_work state_check_work;
int channel_id;
bool is_need_tasklock;
atomic_t tasklock_cnt;
@ -298,9 +318,8 @@ extern int generic_sensor_g_ext_controls(struct v4l2_subdev *sd, struct v4l2_ext
extern int generic_sensor_s_ext_controls(struct v4l2_subdev *sd, struct v4l2_ext_controls *ext_ctrl);
extern long generic_sensor_ioctl(struct v4l2_subdev *sd, unsigned int cmd, void *arg);
extern int generic_sensor_s_power(struct v4l2_subdev *sd, int on);/*yzm*/
extern int generic_sensor_enum_fmt(struct v4l2_subdev *sd, unsigned int index,enum v4l2_mbus_pixelcode *code);
extern int generic_sensor_enum_fmt(struct v4l2_subdev *sd, unsigned int index, u32 *code);
extern int generic_sensor_s_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf);
extern int generic_sensor_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_dbg_chip_ident *id);
extern int generic_sensor_af_workqueue_set(struct soc_camera_device *icd, enum rk_sensor_focus_wq_cmd cmd, int var, bool wait);
extern int generic_sensor_s_stream(struct v4l2_subdev *sd, int enable);
extern int generic_sensor_writebuf(struct i2c_client *client, char *buf, int buf_size);
@ -776,7 +795,6 @@ static inline int sensor_v4l2ctrl_flip_default_cb(struct soc_camera_device *icd,
spsensor->common_sensor.info_priv.gReg_mask |= (0xff<<(i*8)); \
for (i=0; i<SENSOR_VALUE_LEN; i++) \
spsensor->common_sensor.info_priv.gVal_mask |= (0xff<<(i*8)); \
spsensor->common_sensor.info_priv.gI2c_speed = 100000; \
if (sensor_regarray_check(sensor_softreset_data, sizeof(sensor_softreset_data)/sizeof(struct rk_sensor_reg))==0) { \
spsensor->common_sensor.info_priv.sensor_SfRstSeqe = sensor_softreset_data; \
} else { \
@ -1226,7 +1244,6 @@ static inline int sensor_v4l2ctrl_flip_default_cb(struct soc_camera_device *icd,
.s_ctrl = generic_sensor_s_control,\
.g_ext_ctrls = generic_sensor_g_ext_controls,\
.s_ext_ctrls = generic_sensor_s_ext_controls,\
.g_chip_ident = generic_sensor_g_chip_ident,\
.ioctl = generic_sensor_ioctl,\
.s_power = generic_sensor_s_power,\
};\
@ -1293,6 +1310,7 @@ MODULE_DEVICE_TABLE(i2c, sensor_id);
\
v4l2_i2c_subdev_init(&spsensor->common_sensor.subdev, client, &sensor_subdev_ops);\
sensor_init_parameters(spsensor,icd);\
spsensor->common_sensor.client = client;\
\
ret = sensor_video_probe(icd, client);\
\
@ -1311,7 +1329,6 @@ sensor_probe_end:\
icd->ops = NULL;\
}\
i2c_set_clientdata(client, NULL);\
client->driver = NULL;\
if (spsensor) {\
kfree(spsensor);\
}\
@ -1348,7 +1365,6 @@ sensor_probe_end:\
icd->ops = NULL;\
}\
i2c_set_clientdata(client, NULL);\
client->driver = NULL;\
if (spsensor) {\
kfree(spsensor);\
}\

16
drivers/media/video/gt2005.c Executable file → Normal file
View file

@ -1,3 +1,17 @@
/*
* drivers/media/video/gt2005.c
*
* Copyright (C) ROCKCHIP, Inc.
* This software is licensed under the terms of the GNU General Public
* License version 2, as published by the Free Software Foundation, and
* may be copied, distributed, and modified under those terms.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include "generic_sensor.h"
/*
* Driver Version Note
@ -1017,7 +1031,7 @@ static struct sensor_v4l2ctrl_usr_s sensor_controls[] =
//MUST define the current used format as the first item
static struct rk_sensor_datafmt sensor_colour_fmts[] = {
{V4L2_MBUS_FMT_UYVY8_2X8, V4L2_COLORSPACE_JPEG}
{MEDIA_BUS_FMT_UYVY8_2X8, V4L2_COLORSPACE_JPEG}
};
/*static struct soc_camera_ops sensor_ops;*/

15
drivers/media/video/hm2057.c Executable file → Normal file
View file

@ -1,3 +1,16 @@
/*
* drivers/media/video/hm2057.c
*
* Copyright (C) ROCKCHIP, Inc.
* This software is licensed under the terms of the GNU General Public
* License version 2, as published by the Free Software Foundation, and
* may be copied, distributed, and modified under those terms.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include "generic_sensor.h"
@ -1036,7 +1049,7 @@ static struct sensor_v4l2ctrl_usr_s sensor_controls[] =
//MUST define the current used format as the first item
static struct rk_sensor_datafmt sensor_colour_fmts[] = {
{V4L2_MBUS_FMT_UYVY8_2X8, V4L2_COLORSPACE_JPEG}
{MEDIA_BUS_FMT_UYVY8_2X8, V4L2_COLORSPACE_JPEG}
};
/*static struct soc_camera_ops sensor_ops;*/

16
drivers/media/video/hm5065.c Executable file → Normal file
View file

@ -1,3 +1,17 @@
/*
* drivers/media/video/hm5065.c
*
* Copyright (C) ROCKCHIP, Inc.
* This software is licensed under the terms of the GNU General Public
* License version 2, as published by the Free Software Foundation, and
* may be copied, distributed, and modified under those terms.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include "generic_sensor.h"
/*
@ -2822,7 +2836,7 @@ static struct sensor_v4l2ctrl_usr_s sensor_controls[] =
//MUST define the current used format as the first item
static struct rk_sensor_datafmt sensor_colour_fmts[] = {
{V4L2_MBUS_FMT_UYVY8_2X8, V4L2_COLORSPACE_JPEG}
{MEDIA_BUS_FMT_UYVY8_2X8, V4L2_COLORSPACE_JPEG}
};

17
drivers/media/video/mt9p111.c Executable file → Normal file
View file

@ -1,3 +1,16 @@
/*
* drivers/media/video/mt9p111.c
*
* Copyright (C) ROCKCHIP, Inc.
* This software is licensed under the terms of the GNU General Public
* License version 2, as published by the Free Software Foundation, and
* may be copied, distributed, and modified under those terms.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include "generic_sensor.h"
/*
@ -2080,8 +2093,8 @@ static struct sensor_v4l2ctrl_usr_s sensor_controls[] =
//MUST define the current used format as the first item
static struct rk_sensor_datafmt sensor_colour_fmts[] = {
{V4L2_MBUS_FMT_UYVY8_2X8, V4L2_COLORSPACE_JPEG},
{V4L2_MBUS_FMT_YUYV8_2X8, V4L2_COLORSPACE_JPEG}
{MEDIA_BUS_FMT_UYVY8_2X8, V4L2_COLORSPACE_JPEG},
{MEDIA_BUS_FMT_YUYV8_2X8, V4L2_COLORSPACE_JPEG}
};
/*static struct soc_camera_ops sensor_ops;*/

17
drivers/media/video/nt99160_2way.c Executable file → Normal file
View file

@ -1,3 +1,16 @@
/*
* drivers/media/video/nt99160_2way.c
*
* Copyright (C) ROCKCHIP, Inc.
* This software is licensed under the terms of the GNU General Public
* License version 2, as published by the Free Software Foundation, and
* may be copied, distributed, and modified under those terms.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include "generic_sensor.h"
@ -1008,8 +1021,8 @@ static struct sensor_v4l2ctrl_usr_s sensor_controls[] =
//MUST define the current used format as the first item
static struct rk_sensor_datafmt sensor_colour_fmts[] = {
{V4L2_MBUS_FMT_UYVY8_2X8, V4L2_COLORSPACE_JPEG},
{V4L2_MBUS_FMT_YUYV8_2X8, V4L2_COLORSPACE_JPEG}
{MEDIA_BUS_FMT_UYVY8_2X8, V4L2_COLORSPACE_JPEG},
{MEDIA_BUS_FMT_YUYV8_2X8, V4L2_COLORSPACE_JPEG}
};
/*static struct soc_camera_ops sensor_ops;*/

17
drivers/media/video/nt99240_2way.c Executable file → Normal file
View file

@ -1,3 +1,16 @@
/*
* drivers/media/video/nt99240_2way.c
*
* Copyright (C) ROCKCHIP, Inc.
* This software is licensed under the terms of the GNU General Public
* License version 2, as published by the Free Software Foundation, and
* may be copied, distributed, and modified under those terms.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include "generic_sensor.h"
/*
@ -813,8 +826,8 @@ static struct sensor_v4l2ctrl_usr_s sensor_controls[] =
//MUST define the current used format as the first item
static struct rk_sensor_datafmt sensor_colour_fmts[] = {
{V4L2_MBUS_FMT_YUYV8_2X8, V4L2_COLORSPACE_JPEG},
{V4L2_MBUS_FMT_UYVY8_2X8, V4L2_COLORSPACE_JPEG}
{MEDIA_BUS_FMT_YUYV8_2X8, V4L2_COLORSPACE_JPEG},
{MEDIA_BUS_FMT_UYVY8_2X8, V4L2_COLORSPACE_JPEG}
};
/*static struct soc_camera_ops sensor_ops;*/

17
drivers/media/video/ov2659.c Executable file → Normal file
View file

@ -1,3 +1,16 @@
/*
* drivers/media/video/ov2659.c
*
* Copyright (C) ROCKCHIP, Inc.
* This software is licensed under the terms of the GNU General Public
* License version 2, as published by the Free Software Foundation, and
* may be copied, distributed, and modified under those terms.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include "generic_sensor.h"
#include <linux/moduleparam.h>
@ -719,8 +732,8 @@ static struct sensor_v4l2ctrl_usr_s sensor_controls[] =
//MUST define the current used format as the first item
static struct rk_sensor_datafmt sensor_colour_fmts[] = {
{V4L2_MBUS_FMT_UYVY8_2X8, V4L2_COLORSPACE_JPEG},
{V4L2_MBUS_FMT_YUYV8_2X8, V4L2_COLORSPACE_JPEG}
{MEDIA_BUS_FMT_UYVY8_2X8, V4L2_COLORSPACE_JPEG},
{MEDIA_BUS_FMT_YUYV8_2X8, V4L2_COLORSPACE_JPEG}
};
//static struct soc_camera_ops sensor_ops;//yzm

18
drivers/media/video/ov5640.c Executable file → Normal file
View file

@ -1,4 +1,18 @@
#include "generic_sensor.h"
/*
* drivers/media/video/ov5640.c
*
* Copyright (C) ROCKCHIP, Inc.
* This software is licensed under the terms of the GNU General Public
* License version 2, as published by the Free Software Foundation, and
* may be copied, distributed, and modified under those terms.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include "generic_sensor.h"
/*
* Driver Version Note
@ -981,7 +995,7 @@ static struct sensor_v4l2ctrl_usr_s sensor_controls[] =
//MUST define the current used format as the first item
static struct rk_sensor_datafmt sensor_colour_fmts[] = {
{V4L2_MBUS_FMT_UYVY8_2X8, V4L2_COLORSPACE_JPEG}
{MEDIA_BUS_FMT_UYVY8_2X8, V4L2_COLORSPACE_JPEG}
};
/*static struct soc_camera_ops sensor_ops;*/

21
drivers/media/video/rk30_camera.c Executable file → Normal file
View file

@ -1,11 +1,28 @@
/*
* rk30_camera.c - PXA camera driver file
*
* Copyright (C) 2003, Intel Corporation
* Copyright (C) 2008, Guennadi Liakhovetski <kernel@pengutronix.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include <media/soc_camera.h>
#include <media/camsys_head.h>
#include <linux/android_pmem.h>
#include <linux/i2c.h>
#include <linux/of.h>
#include <linux/of_irq.h>
#include "../../../arch/arm/mach-rockchip/rk30_camera.h"/*yzm*/
#include "../../../arch/arm/mach-rockchip/rk_camera.h"/*yzm*/
#include "../../../drivers/soc/rockchip/rk30_camera.h"/*yzm*/
#include "../../../drivers/soc/rockchip/rk_camera.h"/*yzm*/
//**********yzm***********//
#include <linux/kernel.h>
#include <linux/of_address.h>

1079
drivers/media/video/rk30_camera_oneframe.c Executable file → Normal file

File diff suppressed because it is too large Load diff

18
drivers/media/video/rk30_camera_pingpong.c Executable file → Normal file
View file

@ -1,3 +1,15 @@
/*
* Copyright (C) ROCKCHIP, Inc.
* This software is licensed under the terms of the GNU General Public
* License version 2, as published by the Free Software Foundation, and
* may be copied, distributed, and modified under those terms.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include <linux/init.h>
#include <linux/module.h>
#include <linux/io.h>
@ -28,7 +40,7 @@
#include <linux/rockchip/iomap.h>
#include "../../video/rockchip/rga/rga.h"
#include "../../../arch/arm/mach-rockchip/rk30_camera.h"/*yzm*/
#include "../../../drivers/soc/rockchip/rk30_camera.h"/*yzm*/
#include <linux/rockchip/cru.h>
/*******yzm*********
@ -161,8 +173,8 @@ module_param(debug, int, S_IRUGO|S_IWUSR);
#define CIF_F0_READY (0x01<<0)
#define CIF_F1_READY (0x01<<1)
extern unsigned long rk_cif_grf_base;
extern unsigned long rk_cif_cru_base;
extern void __iomem *rk_cif_grf_base;
extern void __iomem *rk_cif_cru_base;
#define MIN(x,y) ((x<y) ? x: y)
#define MAX(x,y) ((x>y) ? x: y)

17
drivers/media/video/sp0838.c Executable file → Normal file
View file

@ -1,4 +1,17 @@
//#include <linux/gpio.h>
/*
* drivers/media/video/sp0838.c
*
* Copyright (C) ROCKCHIP, Inc.
* This software is licensed under the terms of the GNU General Public
* License version 2, as published by the Free Software Foundation, and
* may be copied, distributed, and modified under those terms.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include "generic_sensor.h"
/*
* Driver Version Note
@ -1351,7 +1364,7 @@ static struct sensor_v4l2ctrl_usr_s sensor_controls[] =
//MUST define the current used format as the first item
static struct rk_sensor_datafmt sensor_colour_fmts[] = {
{V4L2_MBUS_FMT_YUYV8_2X8, V4L2_COLORSPACE_JPEG}
{MEDIA_BUS_FMT_YUYV8_2X8, V4L2_COLORSPACE_JPEG}
};
//static struct soc_camera_ops sensor_ops;

15
drivers/media/video/sp2518.c Executable file → Normal file
View file

@ -1,3 +1,16 @@
/*
* drivers/media/video/sp2518.c
*
* Copyright (C) ROCKCHIP, Inc.
* This software is licensed under the terms of the GNU General Public
* License version 2, as published by the Free Software Foundation, and
* may be copied, distributed, and modified under those terms.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include "generic_sensor.h"
/*
@ -1051,7 +1064,7 @@ static struct sensor_v4l2ctrl_usr_s sensor_controls[] =
//MUST define the current used format as the first item
static struct rk_sensor_datafmt sensor_colour_fmts[] = {
{V4L2_MBUS_FMT_YUYV8_2X8, V4L2_COLORSPACE_JPEG}
{MEDIA_BUS_FMT_YUYV8_2X8, V4L2_COLORSPACE_JPEG}
};
/*static struct soc_camera_ops sensor_ops;*/

1846
drivers/media/video/tp2825.c Normal file

File diff suppressed because it is too large Load diff

View file

@ -9,6 +9,7 @@ obj-$(CONFIG_FIQ_DEBUGGER) += rk_fiq_debugger.o
obj-$(CONFIG_MMC_DW_ROCKCHIP) += sdmmc_vendor_storage.o
obj-$(CONFIG_ROCKCHIP_PVTM) += rockchip_pvtm.o
obj-$(CONFIG_ROCKCHIP_SUSPEND_MODE) += rockchip_pm_config.o
obj-$(CONFIG_ROCK_CHIP_SOC_CAMERA) += rk_camera.o
obj-y += rk_vendor_storage.o
obj-y += rockchip-system-status.o

View file

@ -0,0 +1,49 @@
/*
* rk30_camera.h - PXA camera driver header file
*
* Copyright (C) 2003, Intel Corporation
* Copyright (C) 2008, Guennadi Liakhovetski <kernel@pengutronix.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#ifndef _RK30_CAMERA_H
#define _RK30_CAMERA_H
#define RK29_CAM_DRV_NAME "rk312x-camera"
#define RK_SUPPORT_CIF0 1
#define RK_SUPPORT_CIF1 0
#define RK_CIF_NAME "rk_cif"
#define RK_SENSOR_NAME "rk_sensor"
#include "rk_camera.h"
#include <dt-bindings/pinctrl/rockchip-rk3288.h>
#define CONFIG_CAMERA_INPUT_FMT_SUPPORT (RK_CAM_INPUT_FMT_YUV422)
#ifdef CONFIG_SOC_RK3028
#define CONFIG_CAMERA_SCALE_CROP_MACHINE RK_CAM_SCALE_CROP_ARM
#else
#define CONFIG_CAMERA_SCALE_CROP_MACHINE RK_CAM_SCALE_CROP_IPP
#endif
#if (CONFIG_CAMERA_SCALE_CROP_MACHINE == RK_CAM_SCALE_CROP_ARM)
#define CAMERA_SCALE_CROP_MACHINE "arm"
#elif (CONFIG_CAMERA_SCALE_CROP_MACHINE == RK_CAM_SCALE_CROP_IPP)
#define CAMERA_SCALE_CROP_MACHINE "ipp"
#elif (CONFIG_CAMERA_SCALE_CROP_MACHINE == RK_CAM_SCALE_CROP_RGA)
#define CAMERA_SCALE_CROP_MACHINE "rga"
#elif (CONFIG_CAMERA_SCALE_CROP_MACHINE == RK_CAM_SCALE_CROP_PP)
#define CAMERA_SCALE_CROP_MACHINE "pp"
#endif
#define CAMERA_VIDEOBUF_ARM_ACCESS 0
#endif

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,320 @@
/*
* camera.h - PXA camera driver header file
*
* Copyright (C) 2003, Intel Corporation
* Copyright (C) 2008, Guennadi Liakhovetski <kernel@pengutronix.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#ifndef _RK_CAMERA_H
#define _RK_CAMERA_H
#include <linux/videodev2.h>
#include <media/soc_camera.h>
#include <linux/i2c.h>
#include <linux/platform_device.h>
#include <linux/v4l2-mediabus.h>
#include "rk_camera_sensor_info.h"
#define RK29_CAM_PLATFORM_DEV_ID 33
#define RK_CAM_PLATFORM_DEV_ID_0 RK29_CAM_PLATFORM_DEV_ID
#define RK_CAM_PLATFORM_DEV_ID_1 (RK_CAM_PLATFORM_DEV_ID_0+1)
#define INVALID_VALUE -1
#ifndef INVALID_GPIO
#define INVALID_GPIO INVALID_VALUE
#endif
#define RK29_CAM_IO_SUCCESS 0
#define RK29_CAM_EIO_INVALID -3
#define RK29_CAM_EIO_REQUESTFAIL -2
#define RK29_CAM_POWERACTIVE_BITPOS 0x00
#define RK29_CAM_RESETACTIVE_BITPOS 0x01
#define RK29_CAM_POWERDNACTIVE_BITPOS 0x02
#define RK29_CAM_FLASHACTIVE_BITPOS 0x03
#define RK29_CAM_AFACTIVE_BITPOS 0x04
#define RK_CAM_SUPPORT_RESOLUTION 0x800000
#define _CONS(a,b) a##b
#define CONS(a,b) _CONS(a,b)
#define _CONS4(a,b,c,d) a##b##c##d
#define CONS4(a,b,c,d) _CONS4(a,b,c,d)
#define __STR(x) #x
#define _STR(x) __STR(x)
#define STR(x) _STR(x)
/*---------------- Camera Sensor Must Define Macro Begin ------------------------*/
/*
* move to rk_camera_sensor_info.h yzm
*/
/*---------------- Camera Sensor Must Define Macro End ------------------------*/
//#define RK29_CAM_POWERACTIVE_BITPOS 0x00
#define RK29_CAM_POWERACTIVE_MASK (1<<RK29_CAM_POWERACTIVE_BITPOS)
#define RK29_CAM_POWERACTIVE_H (0x01<<RK29_CAM_POWERACTIVE_BITPOS)
#define RK29_CAM_POWERACTIVE_L (0x00<<RK29_CAM_POWERACTIVE_BITPOS)
//#define RK29_CAM_RESETACTIVE_BITPOS 0x01
#define RK29_CAM_RESETACTIVE_MASK (1<<RK29_CAM_RESETACTIVE_BITPOS)
#define RK29_CAM_RESETACTIVE_H (0x01<<RK29_CAM_RESETACTIVE_BITPOS)
#define RK29_CAM_RESETACTIVE_L (0x00<<RK29_CAM_RESETACTIVE_BITPOS)
//#define RK29_CAM_POWERDNACTIVE_BITPOS 0x02
#define RK29_CAM_POWERDNACTIVE_MASK (1<<RK29_CAM_POWERDNACTIVE_BITPOS)
#define RK29_CAM_POWERDNACTIVE_H (0x01<<RK29_CAM_POWERDNACTIVE_BITPOS)
#define RK29_CAM_POWERDNACTIVE_L (0x00<<RK29_CAM_POWERDNACTIVE_BITPOS)
//#define RK29_CAM_FLASHACTIVE_BITPOS 0x03
#define RK29_CAM_FLASHACTIVE_MASK (1<<RK29_CAM_FLASHACTIVE_BITPOS)
#define RK29_CAM_FLASHACTIVE_H (0x01<<RK29_CAM_FLASHACTIVE_BITPOS)
#define RK29_CAM_FLASHACTIVE_L (0x00<<RK29_CAM_FLASHACTIVE_BITPOS)
//#define RK29_CAM_AFACTIVE_BITPOS 0x04
#define RK29_CAM_AFACTIVE_MASK (1<<RK29_CAM_AFACTIVE_BITPOS)
#define RK29_CAM_AFACTIVE_H (0x01<<RK29_CAM_AFACTIVE_BITPOS)
#define RK29_CAM_AFACTIVE_L (0x00<<RK29_CAM_AFACTIVE_BITPOS)
#define RK_CAM_SCALE_CROP_ARM 0
#define RK_CAM_SCALE_CROP_IPP 1
#define RK_CAM_SCALE_CROP_RGA 2
#define RK_CAM_SCALE_CROP_PP 3
#define RK_CAM_INPUT_FMT_YUV422 (1<<0)
#define RK_CAM_INPUT_FMT_RAW10 (1<<1)
#define RK_CAM_INPUT_FMT_RAW12 (1<<2)
#define RK_CAM_INPUT_VIDEO_STATE_LOSS 0x01
#define RK_CAM_INPUT_VIDEO_STATE_LOCKED 0x00 //default video state value is 0x00
/* v4l2_subdev_core_ops.ioctl ioctl_cmd macro */
#define RK29_CAM_SUBDEV_ACTIVATE 0x00
#define RK29_CAM_SUBDEV_DEACTIVATE 0x01
#define RK29_CAM_SUBDEV_IOREQUEST 0x02
#define RK29_CAM_SUBDEV_CB_REGISTER 0x03
#define RK29_CAM_SUBDEV_GET_INTERFACE 0x04
#define RK29_CAM_SUBDEV_GET_VIDEO_STATE 0x05
#define Sensor_HasBeen_PwrOff(a) (a&0x01)
#define Sensor_Support_DirectResume(a) ((a&0x10)==0x10)
#define Sensor_CropSet(a,b) a->reserved[1] = b;
#define Sensor_CropGet(a) a->reserved[1]
#define RK29_CAM_SUBDEV_HDR_EXPOSURE 0x04
#define RK_VIDEOBUF_HDR_EXPOSURE_MINUS_1 0x00
#define RK_VIDEOBUF_HDR_EXPOSURE_NORMAL 0x01
#define RK_VIDEOBUF_HDR_EXPOSURE_PLUS_1 0x02
#define RK_VIDEOBUF_HDR_EXPOSURE_FINISH 0x03
#define RK_VIDEOBUF_CODE_SET(rk_code,type) rk_code = (('R'<<24)|('K'<<16)|type)
#define RK_VIDEOBUF_CODE_CHK(rk_code) ((rk_code&(('R'<<24)|('K'<<16)))==(('R'<<24)|('K'<<16)))
enum rk29camera_ioctrl_cmd
{
Cam_Power,
Cam_Reset,
Cam_PowerDown,
Cam_Flash,
Cam_Mclk,
Cam_Af
};
enum rk29sensor_power_cmd
{
Sensor_Power,
Sensor_Reset,
Sensor_PowerDown,
Sensor_Flash,
Sensor_Af
};
enum rk29camera_flash_cmd
{
Flash_Off,
Flash_On,
Flash_Torch
};
struct rk29camera_gpio_res {
struct gpio_desc *gpio_reset;
struct gpio_desc *gpio_power;
struct gpio_desc *gpio_powerdown;
struct gpio_desc *gpio_flash;
struct gpio_desc *gpio_af;
struct gpio_desc *gpio_irq;
unsigned int gpio_flag;
unsigned int gpio_init;
const char *dev_name;
};
struct rk29camera_mem_res {
const char *name;
unsigned int start;
unsigned int size;
void __iomem *vbase; //指向IO空间的指针为了驱动程序的通用性考虑
};
struct rk29camera_info {
const char *dev_name;
unsigned int orientation;
struct v4l2_frmivalenum fival[10];
};
struct reginfo_t
{
u16 reg;
u16 val;
u16 reg_len;
u16 rev;
};
typedef struct rk_sensor_user_init_data{
int rk_sensor_init_width;
int rk_sensor_init_height;
unsigned long rk_sensor_init_bus_param;
//enum v4l2_mbus_pixelcode rk_sensor_init_pixelcode;
struct reginfo_t * rk_sensor_init_data;
int rk_sensor_winseq_size;
struct reginfo_t * rk_sensor_init_winseq;
int rk_sensor_init_data_size;
}rk_sensor_user_init_data_s;
typedef struct rk_camera_device_register_info {
struct i2c_board_info i2c_cam_info;
struct soc_camera_desc desc_info;/*yzm*/
struct platform_device device_info;
}rk_camera_device_register_info_t;
enum rk_camera_signal_polarity {
RK_CAMERA_DEVICE_SIGNAL_HIGH_LEVEL = 1,
RK_CAMERA_DEVICE_SIGNAL_LOW_LEVEL = 0,
};
enum rk_camera_device_type {
RK_CAMERA_DEVICE_BT601_PIONGPONG = 0x10000010,
RK_CAMERA_DEVICE_BT601_8 = 0x10000011,
RK_CAMERA_DEVICE_BT601_10 = 0x10000012,
RK_CAMERA_DEVICE_BT601_12 = 0x10000014,
RK_CAMERA_DEVICE_BT601_16 = 0x10000018,
RK_CAMERA_DEVICE_BT656_8 = 0x10000021,
RK_CAMERA_DEVICE_BT656_10 = 0x10000022,
RK_CAMERA_DEVICE_BT656_12 = 0x10000024,
RK_CAMERA_DEVICE_BT656_16 = 0x10000028,
RK_CAMERA_DEVICE_CVBS_NTSC = 0x20000001,
RK_CAMERA_DEVICE_CVBS_PAL = 0x20000002,
RK_CAMERA_DEVICE_CVBS_DEINTERLACE = 0x20000003,
};
struct rk_camera_dvp_config {
enum rk_camera_signal_polarity vsync;
enum rk_camera_signal_polarity hsync;
};
struct rk_camera_device_signal_config {
enum rk_camera_device_type type;
u32 code;
struct rk_camera_dvp_config dvp;
struct v4l2_rect crop;
};
struct rk_camera_device_defrect {
unsigned int width;
unsigned int height;
struct v4l2_rect defrect;
const char *interface;
};
struct rk_camera_device_channel_info {
unsigned int channel_total;
unsigned int default_id;
const char *channel_info[5];
};
struct rkcamera_platform_data {
rk_camera_device_register_info_t dev;
char dev_name[32];
struct rk29camera_gpio_res io;
int orientation;
int resolution;
int mirror; /* bit0: 0: mirror off
1: mirror on
bit1: 0: flip off
1: flip on
*/
bool flash; /* true: the sensor attached flash;
false: the sensor haven't attach flash;
*/
int pwdn_info; /* bit4: 1: sensor isn't need to be init after exit stanby, it can streaming directly
0: sensor must be init after exit standby;
bit0: 1: sensor power have been turn off;
0: sensor power is always on;
*/
long powerup_sequence; /*
bit0-bit3 --- power up sequence first step;
bit4-bit7 --- power up sequence second step;
.....
*/
int mclk_rate; /* MHz : 24/48 */
int fov_h; /* fied of view horizontal */
int fov_v; /* fied of view vertical */
int if_powerdown; /* Whether to control powerdown pin when enter/exit camera;
true: control; false: don't control;*/
const char *power_pmu_name1;
const char *power_pmu_name2;
const char *powerdown_pmu_name;
int power_pmu_voltage1;
int power_pmu_voltage2;
int powerdown_pmu_voltage;
struct device_node *of_node;
struct rkcamera_platform_data *next_camera;/*yzm*/
struct rk_camera_device_defrect defrects[4];
struct rk_camera_device_channel_info channel_info;
};
struct rk29camera_platform_data {
int (*io_init)(void);
int (*io_deinit)(int sensor);
int (*sensor_ioctrl)(struct device *dev,enum rk29camera_ioctrl_cmd cmd,int on);
int (*sensor_register)(void);
int (*sensor_mclk)(int cif_idx, int on, int clk_rate);
struct rkcamera_platform_data *register_dev_new; //sensor
struct device *cif_dev;/*yzm host*/
const char *rockchip_name;
int iommu_enabled;
};
struct rk29camera_platform_ioctl_cb {
int (*sensor_power_cb)(struct rk29camera_gpio_res *res, int on);
int (*sensor_reset_cb)(struct rk29camera_gpio_res *res, int on);
int (*sensor_powerdown_cb)(struct rk29camera_gpio_res *res, int on);
int (*sensor_flash_cb)(struct rk29camera_gpio_res *res, int on);
int (*sensor_af_cb)(struct rk29camera_gpio_res *res, int on);
};
typedef struct rk29_camera_sensor_cb {
int (*sensor_cb)(void *arg);
int (*scale_crop_cb)(struct work_struct *work);
}rk29_camera_sensor_cb_s;
#endif /* _RK_CAMERA_H */

View file

@ -0,0 +1,414 @@
/*
* rk_camera_sensor_info.h - PXA camera driver header file
*
* Copyright (C) 2003, Intel Corporation
* Copyright (C) 2008, Guennadi Liakhovetski <kernel@pengutronix.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#ifndef __RK_CAMERA_SENSOR_INFO_H_
#define __RK_CAMERA_SENSOR_INFO_H_
/* Camera Sensor Must Define Macro Begin */
#define RK29_CAM_SENSOR_OV7675 ov7675
#define RK29_CAM_SENSOR_OV9650 ov9650
#define RK29_CAM_SENSOR_OV2640 ov2640
#define RK29_CAM_SENSOR_OV2655 ov2655
#define RK29_CAM_SENSOR_OV2659 ov2659
#define RK29_CAM_SENSOR_GC2145 gc2145
#define RK29_CAM_SENSOR_GC2155 gc2155
#define RK29_CAM_SENSOR_OV7690 ov7690
#define RK29_CAM_SENSOR_OV3640 ov3640
#define RK29_CAM_SENSOR_OV3660 ov3660
#define RK29_CAM_SENSOR_OV5640 ov5640
#define RK29_CAM_SENSOR_OV5642 ov5642
#define RK29_CAM_SENSOR_S5K6AA s5k6aa
#define RK29_CAM_SENSOR_MT9D112 mt9d112
#define RK29_CAM_SENSOR_MT9D113 mt9d113
#define RK29_CAM_SENSOR_MT9P111 mt9p111
#define RK29_CAM_SENSOR_MT9T111 mt9t111
#define RK29_CAM_SENSOR_GT2005 gt2005
#define RK29_CAM_SENSOR_GC0307 gc0307
#define RK29_CAM_SENSOR_GC0308 gc0308
#define RK29_CAM_SENSOR_GC0309 gc0309
#define RK29_CAM_SENSOR_GC2015 gc2015
#define RK29_CAM_SENSOR_GC0328 gc0328
#define RK29_CAM_SENSOR_GC0329 gc0329
#define RK29_CAM_SENSOR_GC2035 gc2035
#define RK29_CAM_SENSOR_SIV120B siv120b
#define RK29_CAM_SENSOR_SIV121D siv121d
#define RK29_CAM_SENSOR_SID130B sid130B
#define RK29_CAM_SENSOR_HI253 hi253
#define RK29_CAM_SENSOR_HI704 hi704
#define RK29_CAM_SENSOR_NT99250 nt99250
#define RK29_CAM_SENSOR_SP0718 sp0718
#define RK29_CAM_SENSOR_SP0838 sp0838
#define RK29_CAM_SENSOR_SP2518 sp2518
#define RK29_CAM_SENSOR_S5K5CA s5k5ca
#define RK29_CAM_ISP_MTK9335 mtk9335isp
#define RK29_CAM_SENSOR_HM2057 hm2057
#define RK29_CAM_SENSOR_HM5065 hm5065
#define RK29_CAM_SENSOR_NT99160 nt99160
#define RK29_CAM_SENSOR_NT99240 nt99240
#define RK29_CAM_SENSOR_NT99252 nt99252
#define RK29_CAM_SENSOR_NT99340 nt99340
#define RK29_CAM_ISP_ICATCH7002_MI1040 icatchmi1040
#define RK29_CAM_ISP_ICATCH7002_OV5693 icatchov5693
#define RK29_CAM_ISP_ICATCH7002_OV8825 icatchov8825
#define RK29_CAM_ISP_ICATCH7002_OV2720 icatchov2720
#define RK29_CAM_SENSOR_TP2825 tp2825 /* benjo.zhou#rock-chips.com */
#define RK29_CAM_SENSOR_ADV7181 adv7181
#define RK29_CAM_SENSOR_NAME_OV7675 "ov7675"
#define RK29_CAM_SENSOR_NAME_OV9650 "ov9650"
#define RK29_CAM_SENSOR_NAME_OV2640 "ov2640"
#define RK29_CAM_SENSOR_NAME_OV2655 "ov2655"
#define RK29_CAM_SENSOR_NAME_OV2659 "ov2659"
#define RK29_CAM_SENSOR_NAME_OV7690 "ov7690"
#define RK29_CAM_SENSOR_NAME_OV3640 "ov3640"
#define RK29_CAM_SENSOR_NAME_OV3660 "ov3660"
#define RK29_CAM_SENSOR_NAME_OV5640 "ov5640"
#define RK29_CAM_SENSOR_NAME_OV5642 "ov5642"
#define RK29_CAM_SENSOR_NAME_S5K6AA "s5k6aa"
#define RK29_CAM_SENSOR_NAME_MT9D112 "mt9d112"
#define RK29_CAM_SENSOR_NAME_MT9D113 "mt9d113"
#define RK29_CAM_SENSOR_NAME_MT9P111 "mt9p111"
#define RK29_CAM_SENSOR_NAME_MT9T111 "mt9t111"
#define RK29_CAM_SENSOR_NAME_GT2005 "gt2005"
#define RK29_CAM_SENSOR_NAME_GC0307 "gc0307"
#define RK29_CAM_SENSOR_NAME_GC0308 "gc0308"
#define RK29_CAM_SENSOR_NAME_GC0309 "gc0309"
#define RK29_CAM_SENSOR_NAME_GC2015 "gc2015"
#define RK29_CAM_SENSOR_NAME_GC0328 "gc0328"
#define RK29_CAM_SENSOR_NAME_GC2035 "gc2035"
#define RK29_CAM_SENSOR_NAME_GC2145 "gc2145"
#define RK29_CAM_SENSOR_NAME_GC2155 "gc2155"
#define RK29_CAM_SENSOR_NAME_GC0329 "gc0329"
#define RK29_CAM_SENSOR_NAME_SIV120B "siv120b"
#define RK29_CAM_SENSOR_NAME_SIV121D "siv121d"
#define RK29_CAM_SENSOR_NAME_SID130B "sid130B"
#define RK29_CAM_SENSOR_NAME_HI253 "hi253"
#define RK29_CAM_SENSOR_NAME_HI704 "hi704"
#define RK29_CAM_SENSOR_NAME_NT99250 "nt99250"
#define RK29_CAM_SENSOR_NAME_SP0718 "sp0718"
#define RK29_CAM_SENSOR_NAME_SP0838 "sp0838"
#define RK29_CAM_SENSOR_NAME_SP2518 "sp2518"
#define RK29_CAM_SENSOR_NAME_S5K5CA "s5k5ca"
#define RK29_CAM_ISP_NAME_MTK9335ISP "mtk9335isp"
#define RK29_CAM_SENSOR_NAME_HM2057 "hm2057"
#define RK29_CAM_SENSOR_NAME_HM5065 "hm5065"
#define RK29_CAM_ISP_NAME_ICATCH7002_MI1040 "icatchmi1040"
#define RK29_CAM_ISP_NAME_ICATCH7002_OV5693 "icatchov5693"
#define RK29_CAM_ISP_NAME_ICATCH7002_OV8825 "icatchov8825"
#define RK29_CAM_ISP_NAME_ICATCH7002_OV2720 "icatchov2720"
#define RK29_CAM_SENSOR_NAME_TP2825 "tp2825"
#define RK29_CAM_SENSOR_NAME_ADV7181 "adv7181"
/* Sensor full resolution define */
#define ov7675_FULL_RESOLUTION 0x30000 /* 0.3 megapixel */
#define ov9650_FULL_RESOLUTION 0x130000 /* 1.3 megapixel */
#define ov2640_FULL_RESOLUTION 0x200000 /* 2 megapixel */
#define ov2655_FULL_RESOLUTION 0x200000
#define ov2659_FULL_RESOLUTION 0x200000
#define gc2145_FULL_RESOLUTION 0x200000
#define gc2155_FULL_RESOLUTION 0x200000
#define ov2660_FULL_RESOLUTION 0x200000
#define ov7690_FULL_RESOLUTION 0x300000
#define ov3640_FULL_RESOLUTION 0x300000
#define ov3660_FULL_RESOLUTION 0x300000
#define ov5640_FULL_RESOLUTION 0x500000
#if defined(CONFIG_SOC_CAMERA_OV5642_INTERPOLATION_8M)
#define ov5642_FULL_RESOLUTION 0x800000
#else
#define ov5642_FULL_RESOLUTION 0x500000
#endif
#define s5k6aa_FULL_RESOLUTION 0x130000
#define mt9d112_FULL_RESOLUTION 0x200000
#define mt9d113_FULL_RESOLUTION 0x200000
#define mt9t111_FULL_RESOLUTION 0x300000
#define mt9p111_FULL_RESOLUTION 0x500000
#define gt2005_FULL_RESOLUTION 0x200000
#if defined(CONFIG_SOC_CAMERA_GC0308_INTERPOLATION_5M)
#define gc0308_FULL_RESOLUTION 0x500000
#elif defined(CONFIG_SOC_CAMERA_GC0308_INTERPOLATION_3M)
#define gc0308_FULL_RESOLUTION 0x300000
#elif defined(CONFIG_SOC_CAMERA_GC0308_INTERPOLATION_2M)
#define gc0308_FULL_RESOLUTION 0x200000
#else
#define gc0308_FULL_RESOLUTION 0x30000
#endif
#define gc0328_FULL_RESOLUTION 0x30000
#define gc0307_FULL_RESOLUTION 0x30000
#define gc0309_FULL_RESOLUTION 0x30000
#define gc2015_FULL_RESOLUTION 0x200000
#define siv120b_FULL_RESOLUTION 0x30000
#define siv121d_FULL_RESOLUTION 0x30000
#define sid130B_FULL_RESOLUTION 0x200000
#if defined(CONFIG_SOC_CAMERA_HI253_INTERPOLATION_5M)
#define hi253_FULL_RESOLUTION 0x500000
#elif defined(CONFIG_SOC_CAMERA_HI253_INTERPOLATION_3M)
#define hi253_FULL_RESOLUTION 0x300000
#else
#define hi253_FULL_RESOLUTION 0x200000
#endif
#define hi704_FULL_RESOLUTION 0x30000
#define nt99250_FULL_RESOLUTION 0x200000
#define sp0718_FULL_RESOLUTION 0x30000
#define sp0838_FULL_RESOLUTION 0x30000
#define sp2518_FULL_RESOLUTION 0x200000
#define gc0329_FULL_RESOLUTION 0x30000
#define s5k5ca_FULL_RESOLUTION 0x300000
#define mtk9335isp_FULL_RESOLUTION 0x500000
#define gc2035_FULL_RESOLUTION 0x200000
#define hm2057_FULL_RESOLUTION 0x200000
#define hm5065_FULL_RESOLUTION 0x500000
#define nt99160_FULL_RESOLUTION 0x100000
#define nt99240_FULL_RESOLUTION 0x200000
#define nt99252_FULL_RESOLUTION 0x200000
#define nt99340_FULL_RESOLUTION 0x300000
#define icatchmi1040_FULL_RESOLUTION 0x200000
#define icatchov5693_FULL_RESOLUTION 0x500000
#define icatchov8825_FULL_RESOLUTION 0x800000
#define icatchov2720_FULL_RESOLUTION 0x210000
#define tp2825_FULL_RESOLUTION 0x100000
#define adv7181_FULL_RESOLUTION 0x100000
#define end_FULL_RESOLUTION 0x00
/* Sensor i2c addr define */
#define ov7675_I2C_ADDR 0x78
#define ov9650_I2C_ADDR 0x60
#define ov2640_I2C_ADDR 0x60
#define ov2655_I2C_ADDR 0x60
#define ov2659_I2C_ADDR 0x60
#define gc2145_I2C_ADDR 0x78
#define gc2155_I2C_ADDR 0x78
#define ov7690_I2C_ADDR 0x42
#define ov3640_I2C_ADDR 0x78
#define ov3660_I2C_ADDR 0x78
#define ov5640_I2C_ADDR 0x78
#define ov5642_I2C_ADDR 0x78
#define s5k6aa_I2C_ADDR 0x78
#define s5k5ca_I2C_ADDR 0x78
#define mt9d112_I2C_ADDR 0x78
#define mt9d113_I2C_ADDR 0x78
#define mt9t111_I2C_ADDR 0x78
#define mt9p111_I2C_ADDR 0x78
#define gt2005_I2C_ADDR 0x78
#define gc0307_I2C_ADDR 0x42
#define gc0328_I2C_ADDR 0x42
#define gc0308_I2C_ADDR 0x42
#define gc0309_I2C_ADDR 0x42
#define gc0329_I2C_ADDR 0x62
#define gc2015_I2C_ADDR 0x60
#define gc2035_I2C_ADDR 0x78
#define siv120b_I2C_ADDR INVALID_VALUE
#define siv121d_I2C_ADDR INVALID_VALUE
#define sid130B_I2C_ADDR 0x37
#define hi253_I2C_ADDR 0x40
#define hi704_I2C_ADDR 0x60
#define nt99160_I2C_ADDR 0x54
#define nt99240_I2C_ADDR 0x6c
#define nt99250_I2C_ADDR 0x6c
#define nt99252_I2C_ADDR 0x6c
#define nt99340_I2C_ADDR 0x76
#define sp0718_I2C_ADDR 0x42
#define sp0838_I2C_ADDR 0x30
#define sp0a19_I2C_ADDR 0x7a
#define sp1628_I2C_ADDR 0x78
#define sp2518_I2C_ADDR 0x60
#define mtk9335isp_I2C_ADDR 0x50
#define hm2057_I2C_ADDR 0x48
#define hm5065_I2C_ADDR 0x3e
#define icatchmi1040_I2C_ADDR 0x78
#define icatchov5693_I2C_ADDR 0x78
#define icatchov8825_I2C_ADDR 0x78
#define icatchov2720_I2C_ADDR 0x78
#define tp2825_I2C_ADDR 0x88
#define adv7181_I2C_ADDR 0x42
#define end_I2C_ADDR INVALID_VALUE
/* Sensor power active level define */
#define PWR_ACTIVE_HIGH 0x01
#define PWR_ACTIVE_LOW 0x0
/* Sensor power down active level define */
#define ov7675_PWRDN_ACTIVE 0x01
#define ov9650_PWRDN_ACTIVE 0x01
#define ov2640_PWRDN_ACTIVE 0x01
#define ov2655_PWRDN_ACTIVE 0x01
#define ov2659_PWRDN_ACTIVE 0x01
#define gc2145_PWRDN_ACTIVE 0x01
#define gc2155_PWRDN_ACTIVE 0x01
#define ov7690_PWRDN_ACTIVE 0x01
#define ov3640_PWRDN_ACTIVE 0x01
#define ov3660_PWRDN_ACTIVE 0x01
#define ov5640_PWRDN_ACTIVE 0x01
#define ov5642_PWRDN_ACTIVE 0x01
#define s5k6aa_PWRDN_ACTIVE 0x00
#define s5k5ca_PWRDN_ACTIVE 0x00
#define mt9d112_PWRDN_ACTIVE 0x01
#define mt9d113_PWRDN_ACTIVE 0x01
#define mt9t111_PWRDN_ACTIVE 0x01
#define mt9p111_PWRDN_ACTIVE 0x01
#define gt2005_PWRDN_ACTIVE 0x00
#define gc0307_PWRDN_ACTIVE 0x01
#define gc0308_PWRDN_ACTIVE 0x01
#define gc0328_PWRDN_ACTIVE 0x01
#define gc0309_PWRDN_ACTIVE 0x01
#define gc0329_PWRDN_ACTIVE 0x01
#define gc2015_PWRDN_ACTIVE 0x01
#define gc2035_PWRDN_ACTIVE 0x01
#define siv120b_PWRDN_ACTIVE INVALID_VALUE
#define siv121d_PWRDN_ACTIVE INVALID_VALUE
#define sid130B_PWRDN_ACTIVE 0x37
#define hi253_PWRDN_ACTIVE 0x01
#define hi704_PWRDN_ACTIVE 0x01
#define nt99160_PWRDN_ACTIVE 0x01
#define nt99240_PWRDN_ACTIVE 0x01
#define nt99250_PWRDN_ACTIVE 0x01
#define nt99252_PWRDN_ACTIVE 0x01
#define nt99340_PWRDN_ACTIVE 0x01
#define sp0718_PWRDN_ACTIVE 0x01
#define sp0838_PWRDN_ACTIVE 0x01
#define sp0a19_PWRDN_ACTIVE 0x01
#define sp1628_PWRDN_ACTIVE 0x01
#define sp2518_PWRDN_ACTIVE 0x01
#define hm2057_PWRDN_ACTIVE 0x01
#define hm5065_PWRDN_ACTIVE 0x00
#define mtk9335isp_PWRDN_ACTIVE 0x01
#define tp2825_PWRDN_ACTIVE 0x00
#define adv7181_PWRDN_ACTIVE 0x00
#define end_PWRDN_ACTIVE INVALID_VALUE
/* Sensor power up sequence define */
/* type: bit0-bit4 */
#define SENSOR_PWRSEQ_BEGIN 0x00
#define SENSOR_PWRSEQ_AVDD 0x01
#define SENSOR_PWRSEQ_DOVDD 0x02
#define SENSOR_PWRSEQ_DVDD 0x03
#define SENSOR_PWRSEQ_PWR 0x04
#define SENSOR_PWRSEQ_HWRST 0x05
#define SENSOR_PWRSEQ_PWRDN 0x06
#define SENSOR_PWRSEQ_CLKIN 0x07
#define SENSOR_PWRSEQ_END 0x0F
#define SENSOR_PWRSEQ_SET(type, idx) (type << (idx * 4))
#define SENSOR_PWRSEQ_GET(seq, idx) ((seq >> (idx * 4)) & 0x0f)
#define sensor_PWRSEQ_DEFAULT \
(SENSOR_PWRSEQ_SET(SENSOR_PWRSEQ_PWR, 0) |\
SENSOR_PWRSEQ_SET(SENSOR_PWRSEQ_HWRST, 1) |\
SENSOR_PWRSEQ_SET(SENSOR_PWRSEQ_PWRDN, 2) |\
SENSOR_PWRSEQ_SET(SENSOR_PWRSEQ_CLKIN, 3))
#define ov7675_PWRSEQ sensor_PWRSEQ_DEFAULT
#define ov9650_PWRSEQ sensor_PWRSEQ_DEFAULT
#define ov2640_PWRSEQ sensor_PWRSEQ_DEFAULT
#define ov2655_PWRSEQ sensor_PWRSEQ_DEFAULT
#define ov2659_PWRSEQ sensor_PWRSEQ_DEFAULT
#define ov7690_PWRSEQ sensor_PWRSEQ_DEFAULT
#define ov3640_PWRSEQ sensor_PWRSEQ_DEFAULT
#define ov3660_PWRSEQ sensor_PWRSEQ_DEFAULT
#define ov5640_PWRSEQ sensor_PWRSEQ_DEFAULT
#define ov5642_PWRSEQ sensor_PWRSEQ_DEFAULT
#define gc2145_PWRSEQ sensor_PWRSEQ_DEFAULT
#define gc2155_PWRSEQ sensor_PWRSEQ_DEFAULT
#define s5k6aa_PWRSEQ sensor_PWRSEQ_DEFAULT
#define s5k5ca_PWRSEQ sensor_PWRSEQ_DEFAULT
#define mt9d112_PWRSEQ sensor_PWRSEQ_DEFAULT
#define mt9d113_PWRSEQ sensor_PWRSEQ_DEFAULT
#define mt9t111_PWRSEQ sensor_PWRSEQ_DEFAULT
#define mt9p111_PWRSEQ sensor_PWRSEQ_DEFAULT
#define gt2005_PWRSEQ sensor_PWRSEQ_DEFAULT
#define gc0307_PWRSEQ sensor_PWRSEQ_DEFAULT
#define gc0308_PWRSEQ sensor_PWRSEQ_DEFAULT
#define gc0328_PWRSEQ sensor_PWRSEQ_DEFAULT
#define gc0309_PWRSEQ sensor_PWRSEQ_DEFAULT
#define gc0329_PWRSEQ sensor_PWRSEQ_DEFAULT
#define gc2015_PWRSEQ sensor_PWRSEQ_DEFAULT
#define gc2035_PWRSEQ sensor_PWRSEQ_DEFAULT
#define siv120b_PWRSEQ sensor_PWRSEQ_DEFAULT
#define siv121d_PWRSEQ sensor_PWRSEQ_DEFAULT
#define sid130B_PWRSEQ sensor_PWRSEQ_DEFAULT
#define hi253_PWRSEQ sensor_PWRSEQ_DEFAULT
#define hi704_PWRSEQ sensor_PWRSEQ_DEFAULT
#define nt99160_PWRSEQ sensor_PWRSEQ_DEFAULT
#define nt99240_PWRSEQ sensor_PWRSEQ_DEFAULT
#define nt99250_PWRSEQ sensor_PWRSEQ_DEFAULT
#define nt99252_PWRSEQ sensor_PWRSEQ_DEFAULT
#define nt99340_PWRSEQ sensor_PWRSEQ_DEFAULT
#define sp0718_PWRSEQ sensor_PWRSEQ_DEFAULT
#define sp0838_PWRSEQ sensor_PWRSEQ_DEFAULT
#define sp0a19_PWRSEQ sensor_PWRSEQ_DEFAULT
#define sp1628_PWRSEQ sensor_PWRSEQ_DEFAULT
#define sp2518_PWRSEQ sensor_PWRSEQ_DEFAULT
#define hm2057_PWRSEQ sensor_PWRSEQ_DEFAULT
#define hm5065_PWRSEQ \
(SENSOR_PWRSEQ_SET(SENSOR_PWRSEQ_PWR, 1) |\
SENSOR_PWRSEQ_SET(SENSOR_PWRSEQ_HWRST, 2) |\
SENSOR_PWRSEQ_SET(SENSOR_PWRSEQ_PWRDN, 0) |\
SENSOR_PWRSEQ_SET(SENSOR_PWRSEQ_CLKIN, 3))
#define mtk9335isp_PWRSEQ sensor_PWRSEQ_DEFAULT
#define icatchov5693_PWRSEQ \
(SENSOR_PWRSEQ_SET(SENSOR_PWRSEQ_PWR, 0) |\
SENSOR_PWRSEQ_SET(SENSOR_PWRSEQ_HWRST, 2) |\
SENSOR_PWRSEQ_SET(SENSOR_PWRSEQ_CLKIN, 1))
#define icatchov8825_PWRSEQ \
(SENSOR_PWRSEQ_SET(SENSOR_PWRSEQ_PWR, 0) |\
SENSOR_PWRSEQ_SET(SENSOR_PWRSEQ_HWRST, 2) |\
SENSOR_PWRSEQ_SET(SENSOR_PWRSEQ_CLKIN, 1))
#define icatchov2720_PWRSEQ \
(SENSOR_PWRSEQ_SET(SENSOR_PWRSEQ_PWR, 0) |\
SENSOR_PWRSEQ_SET(SENSOR_PWRSEQ_HWRST, 2) |\
SENSOR_PWRSEQ_SET(SENSOR_PWRSEQ_CLKIN, 1))
#define icatchmi1040_PWRSEQ \
(SENSOR_PWRSEQ_SET(SENSOR_PWRSEQ_PWR, 0) |\
SENSOR_PWRSEQ_SET(SENSOR_PWRSEQ_HWRST, 2) |\
SENSOR_PWRSEQ_SET(SENSOR_PWRSEQ_CLKIN, 1))
#define tp2825_PWRSEQ sensor_PWRSEQ_DEFAULT
#define adv7181_PWRSEQ sensor_PWRSEQ_DEFAULT
#define end_PWRSEQ 0xffffffff
/* Camera Sensor Must Define Macro End */
#endif

View file

@ -41,6 +41,10 @@ struct soc_camera_device {
unsigned char iface; /* Host number */
unsigned char devnum; /* Device number per host */
struct soc_camera_sense *sense; /* See comment in struct definition */
struct soc_camera_ops *ops;/*yzm*/
struct mutex video_lock;/*yzm*/
struct video_device *vdev;
struct v4l2_ctrl_handler ctrl_handler;
const struct soc_camera_format_xlate *current_fmt;
@ -94,6 +98,20 @@ struct soc_camera_host_ops {
struct module *owner;
int (*add)(struct soc_camera_device *);
void (*remove)(struct soc_camera_device *);
int (*suspend)(struct soc_camera_device *, pm_message_t);
int (*resume)(struct soc_camera_device *);
/* ddl@rock-chips.com :
* Add ioctrl - VIDIOC_ENUM_FRAMEINTERVALS for soc-camera
*/
int (*enum_frameinervals)(struct soc_camera_device *,
struct v4l2_frmivalenum *);
int (*get_ctrl)(struct soc_camera_device *, struct v4l2_control *);
int (*set_ctrl)(struct soc_camera_device *, struct v4l2_control *);
int (*s_stream)(struct soc_camera_device *, int enable);
const struct v4l2_queryctrl *controls;
int num_controls;
int (*clock_start)(struct soc_camera_host *);
void (*clock_stop)(struct soc_camera_host *);
/*
@ -115,6 +133,7 @@ struct soc_camera_host_ops {
* to change the output sizes
*/
int (*set_livecrop)(struct soc_camera_device *, const struct v4l2_crop *);
int (*get_fmt)(struct soc_camera_device *, struct v4l2_format *);
int (*set_fmt)(struct soc_camera_device *, struct v4l2_format *);
int (*try_fmt)(struct soc_camera_device *, struct v4l2_format *);
void (*init_videobuf)(struct videobuf_queue *,
@ -145,6 +164,7 @@ struct soc_camera_subdev_desc {
/* sensor driver private platform data */
void *drv_priv;
struct soc_camera_device *socdev;/*yzm*/
/*
* Set unbalanced_power to true to deal with legacy drivers, failing to
@ -159,6 +179,8 @@ struct soc_camera_subdev_desc {
int (*power)(struct device *, int);
int (*reset)(struct device *);
int (*powerdown)(struct device *, int);/*yzm*/
/*
* some platforms may support different data widths than the sensors
* native ones due to different data line routing. Let the board code
@ -209,7 +231,7 @@ struct soc_camera_link {
unsigned long flags;
void *priv;
void *priv_usr;
/* Set by platforms to handle misbehaving drivers */
bool unbalanced_power;
/* Used by soc-camera helper functions */
@ -218,6 +240,7 @@ struct soc_camera_link {
/* Optional callbacks to power on or off and reset the sensor */
int (*power)(struct device *, int);
int (*reset)(struct device *);
int (*powerdown)(struct device *, int); /*yzm*/
/*
* some platforms may support different data widths than the sensors
* native ones due to different data line routing. Let the board code
@ -300,6 +323,18 @@ struct soc_camera_format_xlate {
const struct soc_mbus_pixelfmt *host_fmt;
};
struct soc_camera_ops {
int (*suspend)(struct soc_camera_device *, pm_message_t state);
int (*resume)(struct soc_camera_device *);
unsigned long (*query_bus_param)(struct soc_camera_device *);
int (*set_bus_param)(struct soc_camera_device *, unsigned long);
int (*enum_input)(struct soc_camera_device *, struct v4l2_input *);
const struct v4l2_queryctrl *controls;
struct v4l2_querymenu *menus;
int num_controls;
int num_menus;
};
#define SOCAM_SENSE_PCLK_CHANGED (1 << 0)
/**
@ -326,6 +361,18 @@ struct soc_camera_sense {
unsigned long pixel_clock;
};
static inline struct v4l2_queryctrl const *soc_camera_find_qctrl(
struct soc_camera_ops *ops, int id)
{
int i;
for (i = 0; i < ops->num_controls; i++)
if (ops->controls[i].id == id)
return &ops->controls[i];
return NULL;
}
#define SOCAM_DATAWIDTH(x) BIT((x) - 1)
#define SOCAM_DATAWIDTH_4 SOCAM_DATAWIDTH(4)
#define SOCAM_DATAWIDTH_8 SOCAM_DATAWIDTH(8)
@ -336,7 +383,8 @@ struct soc_camera_sense {
#define SOCAM_DATAWIDTH_16 SOCAM_DATAWIDTH(16)
#define SOCAM_DATAWIDTH_18 SOCAM_DATAWIDTH(18)
#define SOCAM_DATAWIDTH_24 SOCAM_DATAWIDTH(24)
#define SOCAM_MCLK_24MHZ BIT(29)
#define SOCAM_MCLK_48MHZ BIT(31)
#define SOCAM_DATAWIDTH_MASK (SOCAM_DATAWIDTH_4 | SOCAM_DATAWIDTH_8 | \
SOCAM_DATAWIDTH_9 | SOCAM_DATAWIDTH_10 | \
SOCAM_DATAWIDTH_12 | SOCAM_DATAWIDTH_15 | \

View file

@ -0,0 +1,413 @@
/*
v4l2 chip identifiers header
This header provides a list of chip identifiers that can be returned
through the VIDIOC_DBG_G_CHIP_IDENT ioctl.
Copyright (C) 2007 Hans Verkuil <hverkuil@xs4all.nl>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef V4L2_CHIP_IDENT_H_
#define V4L2_CHIP_IDENT_H_
/* VIDIOC_DBG_G_CHIP_IDENT: identifies the actual chip installed on the board */
/* KEEP THIS LIST ORDERED BY ID!
Otherwise it will be hard to see which ranges are already in use when
adding support to a new chip family. */
enum {
/* general idents: reserved range 0-49 */
V4L2_IDENT_NONE = 0, /* No chip matched */
V4L2_IDENT_AMBIGUOUS = 1, /* Match too general, multiple chips matched */
V4L2_IDENT_UNKNOWN = 2, /* Chip found, but cannot identify */
/* module tvaudio: reserved range 50-99 */
V4L2_IDENT_TVAUDIO = 50, /* A tvaudio chip, unknown which it is exactly */
/* Sony IMX074 */
V4L2_IDENT_IMX074 = 74,
/* module saa7110: just ident 100 */
V4L2_IDENT_SAA7110 = 100,
/* module saa7115: reserved range 101-149 */
V4L2_IDENT_SAA7111 = 101,
V4L2_IDENT_SAA7111A = 102,
V4L2_IDENT_SAA7113 = 103,
V4L2_IDENT_SAA7114 = 104,
V4L2_IDENT_SAA7115 = 105,
V4L2_IDENT_SAA7118 = 108,
/* module saa7127: reserved range 150-199 */
V4L2_IDENT_SAA7127 = 157,
V4L2_IDENT_SAA7129 = 159,
/* module cx25840: reserved range 200-249 */
V4L2_IDENT_CX25836 = 236,
V4L2_IDENT_CX25837 = 237,
V4L2_IDENT_CX25840 = 240,
V4L2_IDENT_CX25841 = 241,
V4L2_IDENT_CX25842 = 242,
V4L2_IDENT_CX25843 = 243,
/* OmniVision sensors: reserved range 250-299 */
V4L2_IDENT_OV7670 = 250,
V4L2_IDENT_OV7720 = 251,
V4L2_IDENT_OV7725 = 252,
V4L2_IDENT_OV7660 = 253,
V4L2_IDENT_OV9650 = 254,
V4L2_IDENT_OV9655 = 255,
V4L2_IDENT_SOI968 = 256,
V4L2_IDENT_OV9640 = 257,
V4L2_IDENT_OV6650 = 258,
V4L2_IDENT_OV2640 = 259,
V4L2_IDENT_OV9740 = 260,
V4L2_IDENT_OV5642 = 261,
/***********yzm**********/
V4L2_IDENT_OV2655 = 262, /* ddl@rock-chips.com : ov2655 support */
V4L2_IDENT_OV2659 = 263,
V4L2_IDENT_OV3640 = 264,
V4L2_IDENT_OV5640 = 265,
V4L2_IDENT_OV7675 = 266,
V4L2_IDENT_OV7690 = 267,
V4L2_IDENT_OV3660 = 268,
V4L2_IDENT_TP2825 = 269,
V4L2_IDENT_GC2155 = 270,
V4L2_IDENT_ADV7181 = 271,
V4L2_IDENT_GC2145 = 272,
/***********yzm********end*/
/* module saa7146: reserved range 300-309 */
V4L2_IDENT_SAA7146 = 300,
/***********yzm*************/
/* Samsung sensors: reserved range 310-319 */
V4L2_IDENT_S5K66A = 310, /* ddl@rock-chips.com : s5k66a support */
V4L2_IDENT_S5K5CA = 311, /* ddl@rock-chips.com : s5k5ca support */
V4L2_IDENT_MTK9335ISP = 320, /* ddl@rock-chips.com : MTK9335ISP support */
V4L2_IDENT_ICATCH7002_MI1040 = 321,
V4L2_IDENT_ICATCH7002_OV5693 =322,
V4L2_IDENT_ICATCH7002_OV8825 = 323, //zyt
V4L2_IDENT_ICATCH7002_OV2720 = 324, //zyt
/************yzm************end*/
/* Conexant MPEG encoder/decoders: reserved range 400-420 */
V4L2_IDENT_CX23418_843 = 403, /* Integrated A/V Decoder on the '418 */
V4L2_IDENT_CX23415 = 415,
V4L2_IDENT_CX23416 = 416,
V4L2_IDENT_CX23417 = 417,
V4L2_IDENT_CX23418 = 418,
/* module bt819: reserved range 810-819 */
V4L2_IDENT_BT815A = 815,
V4L2_IDENT_BT817A = 817,
V4L2_IDENT_BT819A = 819,
/* module au0828 */
V4L2_IDENT_AU0828 = 828,
/* module bttv: ident 848 + 849 */
V4L2_IDENT_BT848 = 848,
V4L2_IDENT_BT849 = 849,
/* module bt856: just ident 856 */
V4L2_IDENT_BT856 = 856,
/* module bt866: just ident 866 */
V4L2_IDENT_BT866 = 866,
/* module bttv: ident 878 + 879 */
V4L2_IDENT_BT878 = 878,
V4L2_IDENT_BT879 = 879,
/* module ks0127: reserved range 1120-1129 */
V4L2_IDENT_KS0122S = 1122,
V4L2_IDENT_KS0127 = 1127,
V4L2_IDENT_KS0127B = 1128,
/* module indycam: just ident 2000 */
V4L2_IDENT_INDYCAM = 2000,
/* module vp27smpx: just ident 2700 */
V4L2_IDENT_VP27SMPX = 2700,
/* module vpx3220: reserved range: 3210-3229 */
V4L2_IDENT_VPX3214C = 3214,
V4L2_IDENT_VPX3216B = 3216,
V4L2_IDENT_VPX3220A = 3220,
/* VX855 just ident 3409 */
/* Other via devs could use 3314, 3324, 3327, 3336, 3364, 3353 */
V4L2_IDENT_VIA_VX855 = 3409,
/* module tvp5150 */
V4L2_IDENT_TVP5150 = 5150,
/* module saa5246a: just ident 5246 */
V4L2_IDENT_SAA5246A = 5246,
/* module saa5249: just ident 5249 */
V4L2_IDENT_SAA5249 = 5249,
/* module cs5345: just ident 5345 */
V4L2_IDENT_CS5345 = 5345,
/* module tea6415c: just ident 6415 */
V4L2_IDENT_TEA6415C = 6415,
/* module tea6420: just ident 6420 */
V4L2_IDENT_TEA6420 = 6420,
/* module saa6588: just ident 6588 */
V4L2_IDENT_SAA6588 = 6588,
/* module vs6624: just ident 6624 */
V4L2_IDENT_VS6624 = 6624,
/* module saa6752hs: reserved range 6750-6759 */
V4L2_IDENT_SAA6752HS = 6752,
V4L2_IDENT_SAA6752HS_AC3 = 6753,
/* modules tef6862: just ident 6862 */
V4L2_IDENT_TEF6862 = 6862,
/* module tvp7002: just ident 7002 */
V4L2_IDENT_TVP7002 = 7002,
/* module adv7170: just ident 7170 */
V4L2_IDENT_ADV7170 = 7170,
/* module adv7175: just ident 7175 */
V4L2_IDENT_ADV7175 = 7175,
/* module adv7180: just ident 7180 */
V4L2_IDENT_ADV7180 = 7180,
/* module adv7183: just ident 7183 */
V4L2_IDENT_ADV7183 = 7183,
/* module saa7185: just ident 7185 */
V4L2_IDENT_SAA7185 = 7185,
/* module saa7191: just ident 7191 */
V4L2_IDENT_SAA7191 = 7191,
/* module ths7303: just ident 7303 */
V4L2_IDENT_THS7303 = 7303,
/* module adv7343: just ident 7343 */
V4L2_IDENT_ADV7343 = 7343,
/* module ths7353: just ident 7353 */
V4L2_IDENT_THS7353 = 7353,
/* module adv7393: just ident 7393 */
V4L2_IDENT_ADV7393 = 7393,
/* module adv7604: just ident 7604 */
V4L2_IDENT_ADV7604 = 7604,
/* module saa7706h: just ident 7706 */
V4L2_IDENT_SAA7706H = 7706,
/* module mt9v011, just ident 8243 */
V4L2_IDENT_MT9V011 = 8243,
/* module wm8739: just ident 8739 */
V4L2_IDENT_WM8739 = 8739,
/* module wm8775: just ident 8775 */
V4L2_IDENT_WM8775 = 8775,
/* Marvell controllers starting at 8801 */
V4L2_IDENT_CAFE = 8801,
V4L2_IDENT_ARMADA610 = 8802,
/* AKM AK8813/AK8814 */
V4L2_IDENT_AK8813 = 8813,
V4L2_IDENT_AK8814 = 8814,
/* module cx23885 and cx25840 */
V4L2_IDENT_CX23885 = 8850,
V4L2_IDENT_CX23885_AV = 8851, /* Integrated A/V decoder */
V4L2_IDENT_CX23887 = 8870,
V4L2_IDENT_CX23887_AV = 8871, /* Integrated A/V decoder */
V4L2_IDENT_CX23888 = 8880,
V4L2_IDENT_CX23888_AV = 8881, /* Integrated A/V decoder */
V4L2_IDENT_CX23888_IR = 8882, /* Integrated infrared controller */
/* module ad9389b: just ident 9389 */
V4L2_IDENT_AD9389B = 9389,
/* module tda9840: just ident 9840 */
V4L2_IDENT_TDA9840 = 9840,
/* module tw9910: just ident 9910 */
V4L2_IDENT_TW9910 = 9910,
/* module sn9c20x: just ident 10000 */
V4L2_IDENT_SN9C20X = 10000,
/* Siliconfile sensors: reserved range 10100 - 10199 */
V4L2_IDENT_NOON010PC30 = 10100,/*yzm*/
/* module cx231xx and cx25840 */
V4L2_IDENT_CX2310X_AV = 23099, /* Integrated A/V decoder; not in '100 */
V4L2_IDENT_CX23100 = 23100,
V4L2_IDENT_CX23101 = 23101,
V4L2_IDENT_CX23102 = 23102,
/* module msp3400: reserved range 34000-34999 for msp34xx */
V4L2_IDENT_MSPX4XX = 34000, /* generic MSPX4XX identifier, only
use internally (tveeprom.c). */
V4L2_IDENT_MSP3400B = 34002,
V4L2_IDENT_MSP3400C = 34003,
V4L2_IDENT_MSP3400D = 34004,
V4L2_IDENT_MSP3400G = 34007,
V4L2_IDENT_MSP3401G = 34017,
V4L2_IDENT_MSP3402G = 34027,
V4L2_IDENT_MSP3405D = 34054,
V4L2_IDENT_MSP3405G = 34057,
V4L2_IDENT_MSP3407D = 34074,
V4L2_IDENT_MSP3407G = 34077,
V4L2_IDENT_MSP3410B = 34102,
V4L2_IDENT_MSP3410C = 34103,
V4L2_IDENT_MSP3410D = 34104,
V4L2_IDENT_MSP3410G = 34107,
V4L2_IDENT_MSP3411G = 34117,
V4L2_IDENT_MSP3412G = 34127,
V4L2_IDENT_MSP3415D = 34154,
V4L2_IDENT_MSP3415G = 34157,
V4L2_IDENT_MSP3417D = 34174,
V4L2_IDENT_MSP3417G = 34177,
V4L2_IDENT_MSP3420G = 34207,
V4L2_IDENT_MSP3421G = 34217,
V4L2_IDENT_MSP3422G = 34227,
V4L2_IDENT_MSP3425G = 34257,
V4L2_IDENT_MSP3427G = 34277,
V4L2_IDENT_MSP3430G = 34307,
V4L2_IDENT_MSP3431G = 34317,
V4L2_IDENT_MSP3435G = 34357,
V4L2_IDENT_MSP3437G = 34377,
V4L2_IDENT_MSP3440G = 34407,
V4L2_IDENT_MSP3441G = 34417,
V4L2_IDENT_MSP3442G = 34427,
V4L2_IDENT_MSP3445G = 34457,
V4L2_IDENT_MSP3447G = 34477,
V4L2_IDENT_MSP3450G = 34507,
V4L2_IDENT_MSP3451G = 34517,
V4L2_IDENT_MSP3452G = 34527,
V4L2_IDENT_MSP3455G = 34557,
V4L2_IDENT_MSP3457G = 34577,
V4L2_IDENT_MSP3460G = 34607,
V4L2_IDENT_MSP3461G = 34617,
V4L2_IDENT_MSP3465G = 34657,
V4L2_IDENT_MSP3467G = 34677,
/* module msp3400: reserved range 44000-44999 for msp44xx */
V4L2_IDENT_MSP4400G = 44007,
V4L2_IDENT_MSP4408G = 44087,
V4L2_IDENT_MSP4410G = 44107,
V4L2_IDENT_MSP4418G = 44187,
V4L2_IDENT_MSP4420G = 44207,
V4L2_IDENT_MSP4428G = 44287,
V4L2_IDENT_MSP4440G = 44407,
V4L2_IDENT_MSP4448G = 44487,
V4L2_IDENT_MSP4450G = 44507,
V4L2_IDENT_MSP4458G = 44587,
/* Micron CMOS sensor chips: 45000-45099 */
V4L2_IDENT_MT9M001C12ST = 45000,
V4L2_IDENT_MT9M001C12STM = 45005,
V4L2_IDENT_MT9M111 = 45007,
V4L2_IDENT_MT9M112 = 45008,
V4L2_IDENT_MT9D112 = 45009, /* ddl@rock-chips.com : MT9D112 support */
V4L2_IDENT_MT9V022IX7ATC = 45010, /* No way to detect "normal" I77ATx */
V4L2_IDENT_MT9V022IX7ATM = 45015, /* and "lead free" IA7ATx chips */
V4L2_IDENT_MT9T031 = 45020,
V4L2_IDENT_MT9T111 = 45021,
V4L2_IDENT_MT9T112 = 45022,
V4L2_IDENT_MT9V111 = 45031,
V4L2_IDENT_MT9V112 = 45032,
V4L2_IDENT_MT9P111 = 45033, /* ddl@rock-chips.com : MT9P111 support */
V4L2_IDENT_MT9D113 = 45034, /* ddl@rock-chips.com : MT9D113 support */
/* HV7131R CMOS sensor: just ident 46000 */
V4L2_IDENT_HV7131R = 46000,
/* Sharp RJ54N1CB0C, 0xCB0C = 51980 */
V4L2_IDENT_RJ54N1CB0C = 51980,
/* module m52790: just ident 52790 */
V4L2_IDENT_M52790 = 52790,
/* module cs53132a: just ident 53132 */
V4L2_IDENT_CS53l32A = 53132,
/* modules upd61151 MPEG2 encoder: just ident 54000 */
V4L2_IDENT_UPD61161 = 54000,
/* modules upd61152 MPEG2 encoder with AC3: just ident 54001 */
V4L2_IDENT_UPD61162 = 54001,
/* module upd64031a: just ident 64031 */
V4L2_IDENT_UPD64031A = 64031,
/* module upd64083: just ident 64083 */
V4L2_IDENT_UPD64083 = 64083,
/*************yzm************/
V4L2_IDENT_NT99250 = 64100, /* ddl@rock-chips.com : nt99250 support */
V4L2_IDENT_SID130B = 64101, /* ddl@rock-chips.com : sid130B support */
V4L2_IDENT_GT2005 = 64110, /* ddl@rock-chips.com : GT2005 support */
V4L2_IDENT_GC0307 = 64111, /* ddl@rock-chips.com : GC0308 support */
V4L2_IDENT_GC0308 = 64112, /* ddl@rock-chips.com : GC0308 support */
V4L2_IDENT_GC0309 = 64113, /* ddl@rock-chips.com : GC0309 support */
V4L2_IDENT_GC2015 = 64114, /* ddl@rock-chips.com : gc2015 support */
V4L2_IDENT_GC0329 = 64115, /* ddl@rock-chips.com : GC0329 support */
V4L2_IDENT_GC2035= 64116, /* ddl@rock-chips.com : GC0329 support */
V4L2_IDENT_GC0328 = 64117,
V4L2_IDENT_SP0838 = 64120, /* ddl@rock-chips.com : SP0838 support */
V4L2_IDENT_SP2518 = 64121, /* ddl@rock-chips.com : SP2518 support */
V4L2_IDENT_SP0718 = 64122, /* ddl@rock-chips.com : SP0718 support */
V4L2_IDENT_HI253 = 64130, /* ddl@rock-chips.com : hi253 support */
V4L2_IDENT_HI704 = 64131, /* ddl@rock-chips.com : hi704 support */
V4L2_IDENT_SIV120B = 64140, /* ddl@rock-chips.com : siv120b support */
V4L2_IDENT_SIV121D= 64141, /* ddl@rock-chips.com : sid130B support */
V4L2_IDENT_HM2057 = 64150,
V4L2_IDENT_HM5065 = 64151,
V4L2_IDENT_NT99160 = 64161, /* oyyf@rock-chips.com : nt99160 support */
V4L2_IDENT_NT99340 = 64162, /* oyyf@rock-chips.com : nt99340 support */
V4L2_IDENT_NT99252 = 64163, /* oyyf@rock-chips.com : nt99252 support */
V4L2_IDENT_NT99240 = 64164, /* oyyf@rock-chips.com : nt99252 support */
/***********yzm***********end*/
/* Don't just add new IDs at the end: KEEP THIS LIST ORDERED BY ID! */
};
#endif

View file

@ -409,12 +409,30 @@ struct v4l2_subdev_video_ops {
struct v4l2_subdev_frame_interval *interval);
int (*s_frame_interval)(struct v4l2_subdev *sd,
struct v4l2_subdev_frame_interval *interval);
int (*enum_framesizes)(struct v4l2_subdev *sd,
struct v4l2_frmsizeenum *fsize);
int (*enum_frameintervals)(struct v4l2_subdev *sd,
struct v4l2_frmivalenum *fival);
int (*s_dv_timings)(struct v4l2_subdev *sd,
struct v4l2_dv_timings *timings);
int (*g_dv_timings)(struct v4l2_subdev *sd,
struct v4l2_dv_timings *timings);
int (*query_dv_timings)(struct v4l2_subdev *sd,
struct v4l2_dv_timings *timings);
int (*enum_mbus_fmt)(struct v4l2_subdev *sd, unsigned int index,
u32 *code);
int (*enum_mbus_fsizes)(struct v4l2_subdev *sd,
struct v4l2_frmsizeenum *fsize);
int (*g_mbus_fmt)(struct v4l2_subdev *sd,
struct v4l2_mbus_framefmt *fmt);
int (*try_mbus_fmt)(struct v4l2_subdev *sd,
struct v4l2_mbus_framefmt *fmt);
int (*s_mbus_fmt)(struct v4l2_subdev *sd,
struct v4l2_mbus_framefmt *fmt);
int (*g_mbus_config)(struct v4l2_subdev *sd,
struct v4l2_mbus_config *cfg);
int (*s_mbus_config)(struct v4l2_subdev *sd,

View file

@ -683,6 +683,27 @@ enum v4l2_exposure_auto_type {
#define V4L2_CID_FOCUS_RELATIVE (V4L2_CID_CAMERA_CLASS_BASE+11)
#define V4L2_CID_FOCUS_AUTO (V4L2_CID_CAMERA_CLASS_BASE+12)
/* ddl@rock-chips.com : Add ioctrl - V4L2_CID_SCENE for camera scene control */
#define V4L2_CID_CAMERA_CLASS_BASE_ROCK (V4L2_CID_CAMERA_CLASS_BASE + 40)
#define V4L2_CID_SCENE (V4L2_CID_CAMERA_CLASS_BASE_ROCK + 1)
#define V4L2_CID_EFFECT (V4L2_CID_CAMERA_CLASS_BASE_ROCK + 2)
#define V4L2_CID_FLASH (V4L2_CID_CAMERA_CLASS_BASE_ROCK + 3)
#define V4L2_CID_FOCUS_CONTINUOUS (V4L2_CID_CAMERA_CLASS_BASE_ROCK + 4)
#define V4L2_CID_FOCUSZONE (V4L2_CID_CAMERA_CLASS_BASE_ROCK + 5)
#define V4L2_CID_FACEDETECT (V4L2_CID_CAMERA_CLASS_BASE_ROCK + 6)
#define V4L2_CID_HDR (V4L2_CID_CAMERA_CLASS_BASE_ROCK + 7)
#define V4L2_CID_ISO (V4L2_CID_CAMERA_CLASS_BASE_ROCK + 8)
#define V4L2_CID_ANTIBANDING (V4L2_CID_CAMERA_CLASS_BASE_ROCK + 9)
#define V4L2_CID_WHITEBALANCE_LOCK (V4L2_CID_CAMERA_CLASS_BASE_ROCK + 10)
#define V4L2_CID_EXPOSURE_LOCK (V4L2_CID_CAMERA_CLASS_BASE_ROCK + 11)
#define V4L2_CID_METERING_AREAS (V4L2_CID_CAMERA_CLASS_BASE_ROCK + 12)
#define V4L2_CID_WDR (V4L2_CID_CAMERA_CLASS_BASE_ROCK + 13)
#define V4L2_CID_EDGE (V4L2_CID_CAMERA_CLASS_BASE_ROCK + 14)
#define V4L2_CID_JPEG_EXIF (V4L2_CID_CAMERA_CLASS_BASE_ROCK + 15)
#define V4L2_CID_DEINTERLACE (V4L2_CID_CAMERA_CLASS_BASE_ROCK + 16)
#define V4L2_CID_CHANNEL (V4L2_CID_CAMERA_CLASS_BASE_ROCK + 17)
#define V4L2_CID_VIDEO_STATE (V4L2_CID_CAMERA_CLASS_BASE_ROCK + 18)
#define V4L2_CID_ZOOM_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE+13)
#define V4L2_CID_ZOOM_RELATIVE (V4L2_CID_CAMERA_CLASS_BASE+14)
#define V4L2_CID_ZOOM_CONTINUOUS (V4L2_CID_CAMERA_CLASS_BASE+15)

View file

@ -1485,6 +1485,7 @@ struct v4l2_ext_control {
struct v4l2_ctrl_vp8_frame_hdr __user *p_vp8_frame_hdr;
void __user *ptr;
};
__s32 rect[4];/*rockchip add for focus zone*/
} __attribute__ ((packed));
struct v4l2_ext_controls {