diff mbox series

[v5,2/5] media: i2c: imx219: Rename VTS to FRM_LENGTH

Message ID 20241230-imx219_fixes-v5-2-98446d816489@ideasonboard.com
State New
Headers show
Series media: i2c: imx219: Fixes for blanking, pixel rate and binning | expand

Commit Message

Jai Luthra Dec. 30, 2024, 6:11 a.m. UTC
The IMX219 datasheet uses the terms FRM_LENGTH and LINE_LENGTH instead
of VTS/HTS.

Signed-off-by: Jai Luthra <jai.luthra@ideasonboard.com>
---
 drivers/media/i2c/imx219.c | 31 +++++++++++++++----------------
 1 file changed, 15 insertions(+), 16 deletions(-)

Comments

Dave Stevenson Jan. 2, 2025, 4:37 p.m. UTC | #1
Hi Jai

Thanks for the patch

On Mon, 30 Dec 2024 at 06:12, Jai Luthra <jai.luthra@ideasonboard.com> wrote:
>
> The IMX219 datasheet uses the terms FRM_LENGTH and LINE_LENGTH instead
> of VTS/HTS.

nit: This patch doesn't make any changes to HTS / LINE_LENGTH as there
are no references to it (yet - that's patch 3/5)
Taken with the context of the commit subject, it's fine by me.

>
> Signed-off-by: Jai Luthra <jai.luthra@ideasonboard.com>

Reviewed-by: Dave Stevenson <dave.stevenson@raspberrypi.com>

> ---
>  drivers/media/i2c/imx219.c | 31 +++++++++++++++----------------
>  1 file changed, 15 insertions(+), 16 deletions(-)
>
> diff --git a/drivers/media/i2c/imx219.c b/drivers/media/i2c/imx219.c
> index 0486bbc046cb9c36afd911eb799c1b010a01d496..8565b1b030be2ee24bcc37415e99ee4ef83cc683 100644
> --- a/drivers/media/i2c/imx219.c
> +++ b/drivers/media/i2c/imx219.c
> @@ -70,9 +70,8 @@
>  #define IMX219_EXPOSURE_MAX            65535
>
>  /* V_TIMING internal */
> -#define IMX219_REG_VTS                 CCI_REG16(0x0160)
> -#define IMX219_VTS_MAX                 0xffff
> -
> +#define IMX219_REG_FRM_LENGTH          CCI_REG16(0x0160)
> +#define IMX219_FLL_MAX                 0xffff
>  #define IMX219_VBLANK_MIN              32
>
>  /* HBLANK control - read only */
> @@ -154,7 +153,7 @@ struct imx219_mode {
>         unsigned int height;
>
>         /* V-timing */
> -       unsigned int vts_def;
> +       unsigned int fll_def;
>  };
>
>  static const struct cci_reg_sequence imx219_common_regs[] = {
> @@ -289,25 +288,25 @@ static const struct imx219_mode supported_modes[] = {
>                 /* 8MPix 15fps mode */
>                 .width = 3280,
>                 .height = 2464,
> -               .vts_def = 3526,
> +               .fll_def = 3526,
>         },
>         {
>                 /* 1080P 30fps cropped */
>                 .width = 1920,
>                 .height = 1080,
> -               .vts_def = 1763,
> +               .fll_def = 1763,
>         },
>         {
>                 /* 2x2 binned 30fps mode */
>                 .width = 1640,
>                 .height = 1232,
> -               .vts_def = 1763,
> +               .fll_def = 1763,
>         },
>         {
>                 /* 640x480 30fps mode */
>                 .width = 640,
>                 .height = 480,
> -               .vts_def = 1763,
> +               .fll_def = 1763,
>         },
>  };
>
> @@ -418,7 +417,7 @@ static int imx219_set_ctrl(struct v4l2_ctrl *ctrl)
>                           imx219->hflip->val | imx219->vflip->val << 1, &ret);
>                 break;
>         case V4L2_CID_VBLANK:
> -               cci_write(imx219->regmap, IMX219_REG_VTS,
> +               cci_write(imx219->regmap, IMX219_REG_FRM_LENGTH,
>                           format->height + ctrl->val, &ret);
>                 break;
>         case V4L2_CID_TEST_PATTERN_RED:
> @@ -493,15 +492,15 @@ static int imx219_init_controls(struct imx219 *imx219)
>         /* Initial vblank/hblank/exposure parameters based on current mode */
>         imx219->vblank = v4l2_ctrl_new_std(ctrl_hdlr, &imx219_ctrl_ops,
>                                            V4L2_CID_VBLANK, IMX219_VBLANK_MIN,
> -                                          IMX219_VTS_MAX - mode->height, 1,
> -                                          mode->vts_def - mode->height);
> +                                          IMX219_FLL_MAX - mode->height, 1,
> +                                          mode->fll_def - mode->height);
>         hblank = IMX219_PPL_DEFAULT - mode->width;
>         imx219->hblank = v4l2_ctrl_new_std(ctrl_hdlr, &imx219_ctrl_ops,
>                                            V4L2_CID_HBLANK, hblank, hblank,
>                                            1, hblank);
>         if (imx219->hblank)
>                 imx219->hblank->flags |= V4L2_CTRL_FLAG_READ_ONLY;
> -       exposure_max = mode->vts_def - 4;
> +       exposure_max = mode->fll_def - 4;
>         exposure_def = (exposure_max < IMX219_EXPOSURE_DEFAULT) ?
>                 exposure_max : IMX219_EXPOSURE_DEFAULT;
>         imx219->exposure = v4l2_ctrl_new_std(ctrl_hdlr, &imx219_ctrl_ops,
> @@ -847,12 +846,12 @@ static int imx219_set_pad_format(struct v4l2_subdev *sd,
>
>                 /* Update limits and set FPS to default */
>                 __v4l2_ctrl_modify_range(imx219->vblank, IMX219_VBLANK_MIN,
> -                                        IMX219_VTS_MAX - mode->height, 1,
> -                                        mode->vts_def - mode->height);
> +                                        IMX219_FLL_MAX - mode->height, 1,
> +                                        mode->fll_def - mode->height);
>                 __v4l2_ctrl_s_ctrl(imx219->vblank,
> -                                  mode->vts_def - mode->height);
> +                                  mode->fll_def - mode->height);
>                 /* Update max exposure while meeting expected vblanking */
> -               exposure_max = mode->vts_def - 4;
> +               exposure_max = mode->fll_def - 4;
>                 exposure_def = (exposure_max < IMX219_EXPOSURE_DEFAULT) ?
>                         exposure_max : IMX219_EXPOSURE_DEFAULT;
>                 __v4l2_ctrl_modify_range(imx219->exposure,
>
> --
> 2.47.1
>
diff mbox series

Patch

diff --git a/drivers/media/i2c/imx219.c b/drivers/media/i2c/imx219.c
index 0486bbc046cb9c36afd911eb799c1b010a01d496..8565b1b030be2ee24bcc37415e99ee4ef83cc683 100644
--- a/drivers/media/i2c/imx219.c
+++ b/drivers/media/i2c/imx219.c
@@ -70,9 +70,8 @@ 
 #define IMX219_EXPOSURE_MAX		65535
 
 /* V_TIMING internal */
-#define IMX219_REG_VTS			CCI_REG16(0x0160)
-#define IMX219_VTS_MAX			0xffff
-
+#define IMX219_REG_FRM_LENGTH		CCI_REG16(0x0160)
+#define IMX219_FLL_MAX			0xffff
 #define IMX219_VBLANK_MIN		32
 
 /* HBLANK control - read only */
@@ -154,7 +153,7 @@  struct imx219_mode {
 	unsigned int height;
 
 	/* V-timing */
-	unsigned int vts_def;
+	unsigned int fll_def;
 };
 
 static const struct cci_reg_sequence imx219_common_regs[] = {
@@ -289,25 +288,25 @@  static const struct imx219_mode supported_modes[] = {
 		/* 8MPix 15fps mode */
 		.width = 3280,
 		.height = 2464,
-		.vts_def = 3526,
+		.fll_def = 3526,
 	},
 	{
 		/* 1080P 30fps cropped */
 		.width = 1920,
 		.height = 1080,
-		.vts_def = 1763,
+		.fll_def = 1763,
 	},
 	{
 		/* 2x2 binned 30fps mode */
 		.width = 1640,
 		.height = 1232,
-		.vts_def = 1763,
+		.fll_def = 1763,
 	},
 	{
 		/* 640x480 30fps mode */
 		.width = 640,
 		.height = 480,
-		.vts_def = 1763,
+		.fll_def = 1763,
 	},
 };
 
@@ -418,7 +417,7 @@  static int imx219_set_ctrl(struct v4l2_ctrl *ctrl)
 			  imx219->hflip->val | imx219->vflip->val << 1, &ret);
 		break;
 	case V4L2_CID_VBLANK:
-		cci_write(imx219->regmap, IMX219_REG_VTS,
+		cci_write(imx219->regmap, IMX219_REG_FRM_LENGTH,
 			  format->height + ctrl->val, &ret);
 		break;
 	case V4L2_CID_TEST_PATTERN_RED:
@@ -493,15 +492,15 @@  static int imx219_init_controls(struct imx219 *imx219)
 	/* Initial vblank/hblank/exposure parameters based on current mode */
 	imx219->vblank = v4l2_ctrl_new_std(ctrl_hdlr, &imx219_ctrl_ops,
 					   V4L2_CID_VBLANK, IMX219_VBLANK_MIN,
-					   IMX219_VTS_MAX - mode->height, 1,
-					   mode->vts_def - mode->height);
+					   IMX219_FLL_MAX - mode->height, 1,
+					   mode->fll_def - mode->height);
 	hblank = IMX219_PPL_DEFAULT - mode->width;
 	imx219->hblank = v4l2_ctrl_new_std(ctrl_hdlr, &imx219_ctrl_ops,
 					   V4L2_CID_HBLANK, hblank, hblank,
 					   1, hblank);
 	if (imx219->hblank)
 		imx219->hblank->flags |= V4L2_CTRL_FLAG_READ_ONLY;
-	exposure_max = mode->vts_def - 4;
+	exposure_max = mode->fll_def - 4;
 	exposure_def = (exposure_max < IMX219_EXPOSURE_DEFAULT) ?
 		exposure_max : IMX219_EXPOSURE_DEFAULT;
 	imx219->exposure = v4l2_ctrl_new_std(ctrl_hdlr, &imx219_ctrl_ops,
@@ -847,12 +846,12 @@  static int imx219_set_pad_format(struct v4l2_subdev *sd,
 
 		/* Update limits and set FPS to default */
 		__v4l2_ctrl_modify_range(imx219->vblank, IMX219_VBLANK_MIN,
-					 IMX219_VTS_MAX - mode->height, 1,
-					 mode->vts_def - mode->height);
+					 IMX219_FLL_MAX - mode->height, 1,
+					 mode->fll_def - mode->height);
 		__v4l2_ctrl_s_ctrl(imx219->vblank,
-				   mode->vts_def - mode->height);
+				   mode->fll_def - mode->height);
 		/* Update max exposure while meeting expected vblanking */
-		exposure_max = mode->vts_def - 4;
+		exposure_max = mode->fll_def - 4;
 		exposure_def = (exposure_max < IMX219_EXPOSURE_DEFAULT) ?
 			exposure_max : IMX219_EXPOSURE_DEFAULT;
 		__v4l2_ctrl_modify_range(imx219->exposure,