media: imx: imx7-media-csi: Fix frame sizes enumeration
Enumeration of the minimum, maximum and step values for the image width does not take hardware constraints into account. Fix it. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Alexander Stein <alexander.stein@ew.tq-group.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
This commit is contained in:
parent
c2c0abbe86
commit
6308759ec6
|
@ -1074,6 +1074,7 @@ static int imx7_csi_video_enum_framesizes(struct file *file, void *fh,
|
||||||
struct v4l2_frmsizeenum *fsize)
|
struct v4l2_frmsizeenum *fsize)
|
||||||
{
|
{
|
||||||
const struct imx7_csi_pixfmt *cc;
|
const struct imx7_csi_pixfmt *cc;
|
||||||
|
u32 walign;
|
||||||
|
|
||||||
if (fsize->index > 0)
|
if (fsize->index > 0)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
@ -1083,16 +1084,17 @@ static int imx7_csi_video_enum_framesizes(struct file *file, void *fh,
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* TODO: The constraints are hardware-specific and may depend on the
|
* The width alignment is 8 bytes as indicated by the
|
||||||
* pixel format. This should come from the driver using
|
* CSI_IMAG_PARA.IMAGE_WIDTH documentation. Convert it to pixels.
|
||||||
* imx_media_capture.
|
|
||||||
*/
|
*/
|
||||||
|
walign = 8 * 8 / cc->bpp;
|
||||||
|
|
||||||
fsize->type = V4L2_FRMSIZE_TYPE_CONTINUOUS;
|
fsize->type = V4L2_FRMSIZE_TYPE_CONTINUOUS;
|
||||||
fsize->stepwise.min_width = 1;
|
fsize->stepwise.min_width = walign;
|
||||||
fsize->stepwise.max_width = 65535;
|
fsize->stepwise.max_width = round_down(65535U, walign);
|
||||||
fsize->stepwise.min_height = 1;
|
fsize->stepwise.min_height = 1;
|
||||||
fsize->stepwise.max_height = 65535;
|
fsize->stepwise.max_height = 65535;
|
||||||
fsize->stepwise.step_width = 1;
|
fsize->stepwise.step_width = walign;
|
||||||
fsize->stepwise.step_height = 1;
|
fsize->stepwise.step_height = 1;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in New Issue