mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-02 08:39:08 -04:00
media: atomisp: implement enum framesize/frameinterval
Add logic to enumerate sensor's frame size and interval. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
This commit is contained in:
@@ -766,6 +766,57 @@ static int atomisp_s_input(struct file *file, void *fh, unsigned int input)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int atomisp_enum_framesizes(struct file *file, void *priv,
|
||||
struct v4l2_frmsizeenum *fsize)
|
||||
{
|
||||
struct video_device *vdev = video_devdata(file);
|
||||
struct atomisp_device *isp = video_get_drvdata(vdev);
|
||||
struct atomisp_sub_device *asd = atomisp_to_video_pipe(vdev)->asd;
|
||||
struct v4l2_subdev_frame_size_enum fse = {
|
||||
.index = fsize->index,
|
||||
.which = V4L2_SUBDEV_FORMAT_ACTIVE,
|
||||
};
|
||||
int ret;
|
||||
|
||||
ret = v4l2_subdev_call(isp->inputs[asd->input_curr].camera,
|
||||
pad, enum_frame_size, NULL, &fse);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
fsize->type = V4L2_FRMSIZE_TYPE_DISCRETE;
|
||||
fsize->discrete.width = fse.max_width - pad_w;
|
||||
fsize->discrete.height = fse.max_height - pad_h;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int atomisp_enum_frameintervals(struct file *file, void *priv,
|
||||
struct v4l2_frmivalenum *fival)
|
||||
{
|
||||
struct video_device *vdev = video_devdata(file);
|
||||
struct atomisp_device *isp = video_get_drvdata(vdev);
|
||||
struct atomisp_sub_device *asd = atomisp_to_video_pipe(vdev)->asd;
|
||||
struct v4l2_subdev_frame_interval_enum fie = {
|
||||
.code = atomisp_in_fmt_conv[0].code,
|
||||
.index = fival->index,
|
||||
.width = fival->width,
|
||||
.height = fival->height,
|
||||
.which = V4L2_SUBDEV_FORMAT_ACTIVE,
|
||||
};
|
||||
int ret;
|
||||
|
||||
ret = v4l2_subdev_call(isp->inputs[asd->input_curr].camera,
|
||||
pad, enum_frame_interval, NULL,
|
||||
&fie);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
fival->type = V4L2_FRMIVAL_TYPE_DISCRETE;
|
||||
fival->discrete = fie.interval;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int atomisp_enum_fmt_cap(struct file *file, void *fh,
|
||||
struct v4l2_fmtdesc *f)
|
||||
{
|
||||
@@ -3214,6 +3265,8 @@ const struct v4l2_ioctl_ops atomisp_ioctl_ops = {
|
||||
.vidioc_g_ctrl = atomisp_g_ctrl,
|
||||
.vidioc_s_ext_ctrls = atomisp_s_ext_ctrls,
|
||||
.vidioc_g_ext_ctrls = atomisp_g_ext_ctrls,
|
||||
.vidioc_enum_framesizes = atomisp_enum_framesizes,
|
||||
.vidioc_enum_frameintervals = atomisp_enum_frameintervals,
|
||||
.vidioc_enum_fmt_vid_cap = atomisp_enum_fmt_cap,
|
||||
.vidioc_try_fmt_vid_cap = atomisp_try_fmt_cap,
|
||||
.vidioc_g_fmt_vid_cap = atomisp_g_fmt_cap,
|
||||
|
||||
Reference in New Issue
Block a user