mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-08 03:40:35 +09:00
media: rk-isp10: add enum_frame_size support
Change-Id: Iaf0bdac9608fd66f8a1155732c3f7f7d7ebb4701 Signed-off-by: Lin Jinhan <troy.lin@rock-chips.com>
This commit is contained in:
@@ -205,3 +205,14 @@ int cif_isp10_img_src_g_frame_interval(
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
int cif_isp10_img_src_enum_frame_size(
|
||||
struct cif_isp10_img_src *img_src,
|
||||
void *fse)
|
||||
{
|
||||
if (img_src)
|
||||
return img_src->ops->enum_frame_size(
|
||||
img_src->img_src,
|
||||
fse);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
||||
@@ -92,4 +92,8 @@ int cif_isp10_img_src_g_frame_interval(
|
||||
struct cif_isp10_img_src *img_src,
|
||||
struct cif_isp10_frm_intrvl *frm_intrvl);
|
||||
|
||||
int cif_isp10_img_src_enum_frame_size(
|
||||
struct cif_isp10_img_src *img_src,
|
||||
void *fse);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -59,6 +59,9 @@ struct cif_isp10_img_src_ops {
|
||||
int (*g_frame_interval)(
|
||||
void *img_src,
|
||||
struct cif_isp10_frm_intrvl *frm_intrvl);
|
||||
int (*enum_frame_size)(
|
||||
void *img_src,
|
||||
void *fse);
|
||||
};
|
||||
|
||||
const struct {
|
||||
@@ -92,6 +95,8 @@ const struct {
|
||||
cif_isp10_img_src_v4l2_subdev_s_frame_interval,
|
||||
.g_frame_interval =
|
||||
cif_isp10_img_src_v4l2_subdev_g_frame_interval,
|
||||
.enum_frame_size =
|
||||
cif_isp10_img_src_v4l2_subdev_enum_frame_size,
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
@@ -546,3 +546,13 @@ err:
|
||||
return ret;
|
||||
}
|
||||
|
||||
int cif_isp10_img_src_v4l2_subdev_enum_frame_size(
|
||||
void *img_src,
|
||||
struct v4l2_subdev_frame_size_enum *fse)
|
||||
{
|
||||
struct v4l2_subdev *subdev = img_src;
|
||||
|
||||
return v4l2_subdev_call(subdev, pad,
|
||||
enum_frame_size, NULL, fse);
|
||||
}
|
||||
|
||||
|
||||
@@ -70,4 +70,8 @@ int cif_isp10_img_src_v4l2_subdev_g_frame_interval(
|
||||
void *img_src,
|
||||
struct cif_isp10_frm_intrvl *frm_intrvl);
|
||||
|
||||
int cif_isp10_img_src_v4l2_subdev_enum_frame_size(
|
||||
void *img_src,
|
||||
void *fse);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -852,6 +852,7 @@ static int cif_isp10_v4l2_enum_framesizes(
|
||||
int ret;
|
||||
struct vb2_queue *queue = to_vb2_queue(file);
|
||||
struct cif_isp10_device *dev = to_cif_isp10_device(queue);
|
||||
struct v4l2_subdev_frame_size_enum fse;
|
||||
|
||||
if (IS_ERR_OR_NULL(dev->img_src)) {
|
||||
cif_isp10_pltfrm_pr_err(NULL,
|
||||
@@ -860,9 +861,20 @@ static int cif_isp10_v4l2_enum_framesizes(
|
||||
goto err;
|
||||
}
|
||||
|
||||
return -EINVAL;
|
||||
memset(&fse, 0x00, sizeof(fse));
|
||||
fse.index = fsize->index;
|
||||
|
||||
ret = cif_isp10_img_src_enum_frame_size(dev->img_src, &fse);
|
||||
if (IS_ERR_VALUE(ret))
|
||||
goto err;
|
||||
|
||||
fsize->type = V4L2_FRMSIZE_TYPE_DISCRETE;
|
||||
|
||||
fsize->discrete.width = fse.max_width;
|
||||
fsize->discrete.height = fse.max_height;
|
||||
|
||||
return 0;
|
||||
err:
|
||||
cif_isp10_pltfrm_pr_err(NULL, "failed with error %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user