[PATCH 9/9] media: sun6i-isp: capture: Implement enum_framesizes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Report available frame sizes as a continuous range between the
hardware min/max limits.

Signed-off-by: Paul Kocialkowski <paul.kocialkowski@xxxxxxxxxxx>
Co-authored-by: Adam Pigg <adam@xxxxxxxxxxx>
Signed-off-by: Adam Pigg <adam@xxxxxxxxxxx>
---
 .../media/sunxi/sun6i-isp/sun6i_isp_capture.c | 26 +++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/drivers/staging/media/sunxi/sun6i-isp/sun6i_isp_capture.c b/drivers/staging/media/sunxi/sun6i-isp/sun6i_isp_capture.c
index 5160b93b69ff..a368f90a9beb 100644
--- a/drivers/staging/media/sunxi/sun6i-isp/sun6i_isp_capture.c
+++ b/drivers/staging/media/sunxi/sun6i-isp/sun6i_isp_capture.c
@@ -487,6 +487,30 @@ static int sun6i_isp_capture_try_fmt(struct file *file, void *private,
 	return 0;
 }
 
+static int
+sun6i_isp_capture_enum_framesizes(struct file *file, void *fh,
+				  struct v4l2_frmsizeenum *frmsizeenum)
+{
+	const struct sun6i_isp_capture_format *format;
+
+	if (frmsizeenum->index > 0)
+		return -EINVAL;
+
+	format = sun6i_isp_capture_format_find(frmsizeenum->pixel_format);
+	if (!format)
+		return -EINVAL;
+
+	frmsizeenum->type = V4L2_FRMSIZE_TYPE_CONTINUOUS;
+	frmsizeenum->stepwise.min_width = SUN6I_ISP_CAPTURE_WIDTH_MIN;
+	frmsizeenum->stepwise.max_width = SUN6I_ISP_CAPTURE_WIDTH_MAX;
+	frmsizeenum->stepwise.min_height = SUN6I_ISP_CAPTURE_HEIGHT_MIN;
+	frmsizeenum->stepwise.max_height = SUN6I_ISP_CAPTURE_HEIGHT_MAX;
+	frmsizeenum->stepwise.step_width = 1;
+	frmsizeenum->stepwise.step_height = 1;
+
+	return 0;
+}
+
 static int sun6i_isp_capture_enum_input(struct file *file, void *private,
 					struct v4l2_input *input)
 {
@@ -524,6 +548,8 @@ static const struct v4l2_ioctl_ops sun6i_isp_capture_ioctl_ops = {
 	.vidioc_s_fmt_vid_cap		= sun6i_isp_capture_s_fmt,
 	.vidioc_try_fmt_vid_cap		= sun6i_isp_capture_try_fmt,
 
+	.vidioc_enum_framesizes		= sun6i_isp_capture_enum_framesizes,
+
 	.vidioc_enum_input		= sun6i_isp_capture_enum_input,
 	.vidioc_g_input			= sun6i_isp_capture_g_input,
 	.vidioc_s_input			= sun6i_isp_capture_s_input,
-- 
2.39.2




[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux