[1/2] media: imx: imx7-media-csi: Move stepwise framesize into a dedicated struct
Commit Message
This way these constraints can be reused later on.
No functional change intended.
Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com>
---
drivers/media/platform/nxp/imx7-media-csi.c | 26 ++++++++++++---------
1 file changed, 15 insertions(+), 11 deletions(-)
Comments
Hi Alexander,
Thank you for the patch.
On Thu, Jul 20, 2023 at 09:41:28AM +0200, Alexander Stein wrote:
> This way these constraints can be reused later on.
> No functional change intended.
>
> Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com>
> ---
> drivers/media/platform/nxp/imx7-media-csi.c | 26 ++++++++++++---------
> 1 file changed, 15 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/media/platform/nxp/imx7-media-csi.c b/drivers/media/platform/nxp/imx7-media-csi.c
> index 2f9302fc7570..73f8f2a35422 100644
> --- a/drivers/media/platform/nxp/imx7-media-csi.c
> +++ b/drivers/media/platform/nxp/imx7-media-csi.c
> @@ -260,6 +260,20 @@ imx7_csi_notifier_to_dev(struct v4l2_async_notifier *n)
> return container_of(n, struct imx7_csi, notifier);
> }
>
> +/*
> + * TODO: The constraints are hardware-specific and may depend on the
> + * pixel format. This should come from the driver using
> + * imx_media_capture.
Addressing this will not be possible with a single v4l2_frmsize_stepwise
instance, so I'd rather address the TODO first.
> + */
> +static const struct v4l2_frmsize_stepwise imx7_csi_frmsize_stepwise = {
> + .min_width = 1,
> + .min_height = 1,
> + .max_width = 65535,
> + .max_height = 65535,
> + .step_width = 1,
> + .step_height = 1,
> +};
> +
> /* -----------------------------------------------------------------------------
> * Hardware Configuration
> */
> @@ -1082,18 +1096,8 @@ static int imx7_csi_video_enum_framesizes(struct file *file, void *fh,
> if (!cc)
> return -EINVAL;
>
> - /*
> - * TODO: The constraints are hardware-specific and may depend on the
> - * pixel format. This should come from the driver using
> - * imx_media_capture.
> - */
> fsize->type = V4L2_FRMSIZE_TYPE_CONTINUOUS;
> - fsize->stepwise.min_width = 1;
> - fsize->stepwise.max_width = 65535;
> - fsize->stepwise.min_height = 1;
> - fsize->stepwise.max_height = 65535;
> - fsize->stepwise.step_width = 1;
> - fsize->stepwise.step_height = 1;
> + fsize->stepwise = imx7_csi_frmsize_stepwise;
>
> return 0;
> }
@@ -260,6 +260,20 @@ imx7_csi_notifier_to_dev(struct v4l2_async_notifier *n)
return container_of(n, struct imx7_csi, notifier);
}
+/*
+ * TODO: The constraints are hardware-specific and may depend on the
+ * pixel format. This should come from the driver using
+ * imx_media_capture.
+ */
+static const struct v4l2_frmsize_stepwise imx7_csi_frmsize_stepwise = {
+ .min_width = 1,
+ .min_height = 1,
+ .max_width = 65535,
+ .max_height = 65535,
+ .step_width = 1,
+ .step_height = 1,
+};
+
/* -----------------------------------------------------------------------------
* Hardware Configuration
*/
@@ -1082,18 +1096,8 @@ static int imx7_csi_video_enum_framesizes(struct file *file, void *fh,
if (!cc)
return -EINVAL;
- /*
- * TODO: The constraints are hardware-specific and may depend on the
- * pixel format. This should come from the driver using
- * imx_media_capture.
- */
fsize->type = V4L2_FRMSIZE_TYPE_CONTINUOUS;
- fsize->stepwise.min_width = 1;
- fsize->stepwise.max_width = 65535;
- fsize->stepwise.min_height = 1;
- fsize->stepwise.max_height = 65535;
- fsize->stepwise.step_width = 1;
- fsize->stepwise.step_height = 1;
+ fsize->stepwise = imx7_csi_frmsize_stepwise;
return 0;
}