aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/platform/soc_camera
diff options
context:
space:
mode:
authorHans Verkuil <hans.verkuil@cisco.com>2015-03-04 04:48:00 -0500
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>2015-03-23 15:01:15 -0400
commit17bef885249db5db921ac8cf6e23938a91a6cd7b (patch)
tree23f58ecb46904cc3fbe4f5f4fbbe53a6dc4c9735 /drivers/media/platform/soc_camera
parentd3e4bd8e10cd70d35a59854dcdcd7280c5ed240c (diff)
[media] v4l2-subdev: add support for the new enum_frame_interval 'which' field
Support the new 'which' field in the enum_frame_interval ops. Most drivers do not need to be changed since they always returns the same enumeration regardless of the 'which' field. Tested for ov7670 and marvell-ccic on a OLPC XO-1 laptop. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Acked-by: Jonathan Corbet <corbet@lwn.net> Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Tested-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Diffstat (limited to 'drivers/media/platform/soc_camera')
-rw-r--r--drivers/media/platform/soc_camera/soc_camera.c30
1 files changed, 21 insertions, 9 deletions
diff --git a/drivers/media/platform/soc_camera/soc_camera.c b/drivers/media/platform/soc_camera/soc_camera.c
index cee7b56f8404..1ed0a0bc8d44 100644
--- a/drivers/media/platform/soc_camera/soc_camera.c
+++ b/drivers/media/platform/soc_camera/soc_camera.c
@@ -1888,22 +1888,34 @@ static int default_enum_framesizes(struct soc_camera_device *icd,
1888 int ret; 1888 int ret;
1889 struct v4l2_subdev *sd = soc_camera_to_subdev(icd); 1889 struct v4l2_subdev *sd = soc_camera_to_subdev(icd);
1890 const struct soc_camera_format_xlate *xlate; 1890 const struct soc_camera_format_xlate *xlate;
1891 __u32 pixfmt = fsize->pixel_format; 1891 struct v4l2_subdev_frame_size_enum fse = {
1892 struct v4l2_frmsizeenum fsize_mbus = *fsize; 1892 .index = fsize->index,
1893 .which = V4L2_SUBDEV_FORMAT_ACTIVE,
1894 };
1893 1895
1894 xlate = soc_camera_xlate_by_fourcc(icd, pixfmt); 1896 xlate = soc_camera_xlate_by_fourcc(icd, fsize->pixel_format);
1895 if (!xlate) 1897 if (!xlate)
1896 return -EINVAL; 1898 return -EINVAL;
1897 /* map xlate-code to pixel_format, sensor only handle xlate-code*/ 1899 fse.code = xlate->code;
1898 fsize_mbus.pixel_format = xlate->code;
1899 1900
1900 ret = v4l2_subdev_call(sd, video, enum_framesizes, &fsize_mbus); 1901 ret = v4l2_subdev_call(sd, pad, enum_frame_size, NULL, &fse);
1901 if (ret < 0) 1902 if (ret < 0)
1902 return ret; 1903 return ret;
1903 1904
1904 *fsize = fsize_mbus; 1905 if (fse.min_width == fse.max_width &&
1905 fsize->pixel_format = pixfmt; 1906 fse.min_height == fse.max_height) {
1906 1907 fsize->type = V4L2_FRMSIZE_TYPE_DISCRETE;
1908 fsize->discrete.width = fse.min_width;
1909 fsize->discrete.height = fse.min_height;
1910 return 0;
1911 }
1912 fsize->type = V4L2_FRMSIZE_TYPE_CONTINUOUS;
1913 fsize->stepwise.min_width = fse.min_width;
1914 fsize->stepwise.max_width = fse.max_width;
1915 fsize->stepwise.min_height = fse.min_height;
1916 fsize->stepwise.max_height = fse.max_height;
1917 fsize->stepwise.step_width = 1;
1918 fsize->stepwise.step_height = 1;
1907 return 0; 1919 return 0;
1908} 1920}
1909 1921