Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 241898
b: refs/heads/master
c: ed5b65d
h: refs/heads/master
v: v3
  • Loading branch information
Qing Xu authored and Mauro Carvalho Chehab committed Mar 21, 2011
1 parent 6bcfff5 commit 3f13aaa
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 03519b7e7ea531f5425be9d9bfe5f114e80951a0
refs/heads/master: ed5b65dc362d488958075381d97931d865e77259
37 changes: 37 additions & 0 deletions trunk/drivers/media/video/soc_camera.c
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,15 @@ static int soc_camera_s_std(struct file *file, void *priv, v4l2_std_id *a)
return v4l2_subdev_call(sd, core, s_std, *a);
}

static int soc_camera_enum_fsizes(struct file *file, void *fh,
struct v4l2_frmsizeenum *fsize)
{
struct soc_camera_device *icd = file->private_data;
struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent);

return ici->ops->enum_fsizes(icd, fsize);
}

static int soc_camera_reqbufs(struct file *file, void *priv,
struct v4l2_requestbuffers *p)
{
Expand Down Expand Up @@ -1175,6 +1184,31 @@ static int default_s_parm(struct soc_camera_device *icd,
return v4l2_subdev_call(sd, video, s_parm, parm);
}

static int default_enum_fsizes(struct soc_camera_device *icd,
struct v4l2_frmsizeenum *fsize)
{
int ret;
struct v4l2_subdev *sd = soc_camera_to_subdev(icd);
const struct soc_camera_format_xlate *xlate;
__u32 pixfmt = fsize->pixel_format;
struct v4l2_frmsizeenum fsize_mbus = *fsize;

xlate = soc_camera_xlate_by_fourcc(icd, pixfmt);
if (!xlate)
return -EINVAL;
/* map xlate-code to pixel_format, sensor only handle xlate-code*/
fsize_mbus.pixel_format = xlate->code;

ret = v4l2_subdev_call(sd, video, enum_mbus_fsizes, &fsize_mbus);
if (ret < 0)
return ret;

*fsize = fsize_mbus;
fsize->pixel_format = pixfmt;

return 0;
}

static void soc_camera_device_init(struct device *dev, void *pdata)
{
dev->platform_data = pdata;
Expand Down Expand Up @@ -1210,6 +1244,8 @@ int soc_camera_host_register(struct soc_camera_host *ici)
ici->ops->set_parm = default_s_parm;
if (!ici->ops->get_parm)
ici->ops->get_parm = default_g_parm;
if (!ici->ops->enum_fsizes)
ici->ops->enum_fsizes = default_enum_fsizes;

mutex_lock(&list_lock);
list_for_each_entry(ix, &hosts, list) {
Expand Down Expand Up @@ -1317,6 +1353,7 @@ static const struct v4l2_ioctl_ops soc_camera_ioctl_ops = {
.vidioc_g_input = soc_camera_g_input,
.vidioc_s_input = soc_camera_s_input,
.vidioc_s_std = soc_camera_s_std,
.vidioc_enum_framesizes = soc_camera_enum_fsizes,
.vidioc_reqbufs = soc_camera_reqbufs,
.vidioc_try_fmt_vid_cap = soc_camera_try_fmt_vid_cap,
.vidioc_querybuf = soc_camera_querybuf,
Expand Down
1 change: 1 addition & 0 deletions trunk/include/media/soc_camera.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ struct soc_camera_host_ops {
int (*set_ctrl)(struct soc_camera_device *, struct v4l2_control *);
int (*get_parm)(struct soc_camera_device *, struct v4l2_streamparm *);
int (*set_parm)(struct soc_camera_device *, struct v4l2_streamparm *);
int (*enum_fsizes)(struct soc_camera_device *, struct v4l2_frmsizeenum *);
unsigned int (*poll)(struct file *, poll_table *);
const struct v4l2_queryctrl *controls;
int num_controls;
Expand Down

0 comments on commit 3f13aaa

Please sign in to comment.