diff options
author | Qing Xu <qingx@marvell.com> | 2011-01-20 03:19:40 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2011-03-21 19:32:13 -0400 |
commit | ed5b65dc362d488958075381d97931d865e77259 (patch) | |
tree | e273587ec244a43dc99b179f16479b7b8d3d21f8 /drivers | |
parent | 03519b7e7ea531f5425be9d9bfe5f114e80951a0 (diff) |
[media] V4L: soc-camera: add enum-frame-size ioctl
add vidioc_enum_framesizes implementation, follow default_g_parm()
and g_mbus_fmt() method
Signed-off-by: Qing Xu <qingx@marvell.com>
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/media/video/soc_camera.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/drivers/media/video/soc_camera.c b/drivers/media/video/soc_camera.c index a66811b43710..a7820a549f1b 100644 --- a/drivers/media/video/soc_camera.c +++ b/drivers/media/video/soc_camera.c | |||
@@ -191,6 +191,15 @@ static int soc_camera_s_std(struct file *file, void *priv, v4l2_std_id *a) | |||
191 | return v4l2_subdev_call(sd, core, s_std, *a); | 191 | return v4l2_subdev_call(sd, core, s_std, *a); |
192 | } | 192 | } |
193 | 193 | ||
194 | static int soc_camera_enum_fsizes(struct file *file, void *fh, | ||
195 | struct v4l2_frmsizeenum *fsize) | ||
196 | { | ||
197 | struct soc_camera_device *icd = file->private_data; | ||
198 | struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); | ||
199 | |||
200 | return ici->ops->enum_fsizes(icd, fsize); | ||
201 | } | ||
202 | |||
194 | static int soc_camera_reqbufs(struct file *file, void *priv, | 203 | static int soc_camera_reqbufs(struct file *file, void *priv, |
195 | struct v4l2_requestbuffers *p) | 204 | struct v4l2_requestbuffers *p) |
196 | { | 205 | { |
@@ -1175,6 +1184,31 @@ static int default_s_parm(struct soc_camera_device *icd, | |||
1175 | return v4l2_subdev_call(sd, video, s_parm, parm); | 1184 | return v4l2_subdev_call(sd, video, s_parm, parm); |
1176 | } | 1185 | } |
1177 | 1186 | ||
1187 | static int default_enum_fsizes(struct soc_camera_device *icd, | ||
1188 | struct v4l2_frmsizeenum *fsize) | ||
1189 | { | ||
1190 | int ret; | ||
1191 | struct v4l2_subdev *sd = soc_camera_to_subdev(icd); | ||
1192 | const struct soc_camera_format_xlate *xlate; | ||
1193 | __u32 pixfmt = fsize->pixel_format; | ||
1194 | struct v4l2_frmsizeenum fsize_mbus = *fsize; | ||
1195 | |||
1196 | xlate = soc_camera_xlate_by_fourcc(icd, pixfmt); | ||
1197 | if (!xlate) | ||
1198 | return -EINVAL; | ||
1199 | /* map xlate-code to pixel_format, sensor only handle xlate-code*/ | ||
1200 | fsize_mbus.pixel_format = xlate->code; | ||
1201 | |||
1202 | ret = v4l2_subdev_call(sd, video, enum_mbus_fsizes, &fsize_mbus); | ||
1203 | if (ret < 0) | ||
1204 | return ret; | ||
1205 | |||
1206 | *fsize = fsize_mbus; | ||
1207 | fsize->pixel_format = pixfmt; | ||
1208 | |||
1209 | return 0; | ||
1210 | } | ||
1211 | |||
1178 | static void soc_camera_device_init(struct device *dev, void *pdata) | 1212 | static void soc_camera_device_init(struct device *dev, void *pdata) |
1179 | { | 1213 | { |
1180 | dev->platform_data = pdata; | 1214 | dev->platform_data = pdata; |
@@ -1210,6 +1244,8 @@ int soc_camera_host_register(struct soc_camera_host *ici) | |||
1210 | ici->ops->set_parm = default_s_parm; | 1244 | ici->ops->set_parm = default_s_parm; |
1211 | if (!ici->ops->get_parm) | 1245 | if (!ici->ops->get_parm) |
1212 | ici->ops->get_parm = default_g_parm; | 1246 | ici->ops->get_parm = default_g_parm; |
1247 | if (!ici->ops->enum_fsizes) | ||
1248 | ici->ops->enum_fsizes = default_enum_fsizes; | ||
1213 | 1249 | ||
1214 | mutex_lock(&list_lock); | 1250 | mutex_lock(&list_lock); |
1215 | list_for_each_entry(ix, &hosts, list) { | 1251 | list_for_each_entry(ix, &hosts, list) { |
@@ -1317,6 +1353,7 @@ static const struct v4l2_ioctl_ops soc_camera_ioctl_ops = { | |||
1317 | .vidioc_g_input = soc_camera_g_input, | 1353 | .vidioc_g_input = soc_camera_g_input, |
1318 | .vidioc_s_input = soc_camera_s_input, | 1354 | .vidioc_s_input = soc_camera_s_input, |
1319 | .vidioc_s_std = soc_camera_s_std, | 1355 | .vidioc_s_std = soc_camera_s_std, |
1356 | .vidioc_enum_framesizes = soc_camera_enum_fsizes, | ||
1320 | .vidioc_reqbufs = soc_camera_reqbufs, | 1357 | .vidioc_reqbufs = soc_camera_reqbufs, |
1321 | .vidioc_try_fmt_vid_cap = soc_camera_try_fmt_vid_cap, | 1358 | .vidioc_try_fmt_vid_cap = soc_camera_try_fmt_vid_cap, |
1322 | .vidioc_querybuf = soc_camera_querybuf, | 1359 | .vidioc_querybuf = soc_camera_querybuf, |