lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <3frejdi5imq4kq6d4mycgtn2milxxptgaspn6fciwp62hmowdv@tepoa2ri3yha>
Date: Mon, 1 Dec 2025 16:18:16 +0100
From: Jacopo Mondi <jacopo.mondi@...asonboard.com>
To: Jai Luthra <jai.luthra@...asonboard.com>
Cc: Sakari Ailus <sakari.ailus@...ux.intel.com>, 
	Dave Stevenson <dave.stevenson@...pberrypi.com>, Jacopo Mondi <jacopo@...ndi.org>, 
	Mauro Carvalho Chehab <mchehab@...nel.org>, Naushir Patuck <naush@...pberrypi.com>, 
	Rob Herring <robh@...nel.org>, Krzysztof Kozlowski <krzk+dt@...nel.org>, 
	Conor Dooley <conor+dt@...nel.org>, linux-media@...r.kernel.org, linux-kernel@...r.kernel.org, 
	devicetree@...r.kernel.org, Mauro Carvalho Chehab <mchehab+huawei@...nel.org>, 
	Kieran Bingham <kieran.bingham@...asonboard.com>, David Plowman <david.plowman@...pberrypi.com>, 
	Laurent Pinchart <laurent.pinchart@...asonboard.com>, Peter Robinson <pbrobinson@...il.com>, 
	Stefan Wahren <wahrenst@....net>, "Ivan T. Ivanov" <iivanov@...e.de>, 
	Jacopo Mondi <jacopo.mondi@...asonboard.com>
Subject: Re: [PATCH v2 11/16] media: i2c: ov5647: Add control of
 V4L2_CID_HBLANK

Hi Jai

On Tue, Nov 18, 2025 at 05:33:04PM +0530, Jai Luthra wrote:
> From: Dave Stevenson <dave.stevenson@...pberrypi.com>
>
> The driver did expose V4L2_CID_HBLANK, but as a READ_ONLY control.
>
> The sensor only uses the HTS register to control the line length,
> so convert this control to read/write, with the appropriate ranges.
> Adopt the old fixed values as the minimum values permitted in each
> mode to avoid issues of it not streaming.
>
> This should allow exposure times up to ~3 seconds (up from ~1sec).
>
> Signed-off-by: Dave Stevenson <dave.stevenson@...pberrypi.com>
> Signed-off-by: Jai Luthra <jai.luthra@...asonboard.com>

Reviewed-by: Jacopo Mondi <jacopo.mondi@...asonboard.com>

Thanks
  j

> ---
>  drivers/media/i2c/ov5647.c | 26 +++++++++++++-------------
>  1 file changed, 13 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/media/i2c/ov5647.c b/drivers/media/i2c/ov5647.c
> index 9b5a1275c29877dff99c74aa8d49605c02fa6ed6..48c0e302319d724a20aa7885a62e517d515c6191 100644
> --- a/drivers/media/i2c/ov5647.c
> +++ b/drivers/media/i2c/ov5647.c
> @@ -53,6 +53,8 @@
>  #define OV5647_REG_AEC_AGC		0x3503
>  #define OV5647_REG_GAIN_HI		0x350a
>  #define OV5647_REG_GAIN_LO		0x350b
> +#define OV5647_REG_HTS_HI		0x380c
> +#define OV5647_REG_HTS_LO		0x380d
>  #define OV5647_REG_VTS_HI		0x380e
>  #define OV5647_REG_VTS_LO		0x380f
>  #define OV5647_REG_TIMING_TC_V		0x3820
> @@ -79,6 +81,8 @@
>  #define OV5647_VBLANK_MIN		24
>  #define OV5647_VTS_MAX			32767
>
> +#define OV5647_HTS_MAX			0x1fff
> +
>  #define OV5647_EXPOSURE_MIN		4
>  #define OV5647_EXPOSURE_STEP		1
>  #define OV5647_EXPOSURE_DEFAULT		1000
> @@ -187,8 +191,6 @@ static struct regval_list ov5647_2592x1944_10bpp[] = {
>  	{0x3a19, 0xf8},
>  	{0x3c01, 0x80},
>  	{0x3b07, 0x0c},
> -	{0x380c, 0x0b},
> -	{0x380d, 0x1c},
>  	{0x3814, 0x11},
>  	{0x3815, 0x11},
>  	{0x3708, 0x64},
> @@ -276,8 +278,6 @@ static struct regval_list ov5647_1080p30_10bpp[] = {
>  	{0x3a19, 0xf8},
>  	{0x3c01, 0x80},
>  	{0x3b07, 0x0c},
> -	{0x380c, 0x09},
> -	{0x380d, 0x70},
>  	{0x3814, 0x11},
>  	{0x3815, 0x11},
>  	{0x3708, 0x64},
> @@ -375,8 +375,6 @@ static struct regval_list ov5647_2x2binned_10bpp[] = {
>  	{0x3809, 0x10},
>  	{0x380a, 0x03},
>  	{0x380b, 0xcc},
> -	{0x380c, 0x07},
> -	{0x380d, 0x68},
>  	{0x3811, 0x0c},
>  	{0x3813, 0x06},
>  	{0x3814, 0x31},
> @@ -450,8 +448,6 @@ static struct regval_list ov5647_640x480_10bpp[] = {
>  	{0x3a19, 0xf8},
>  	{0x3c01, 0x80},
>  	{0x3b07, 0x0c},
> -	{0x380c, 0x07},
> -	{0x380d, 0x3c},
>  	{0x3814, 0x35},
>  	{0x3815, 0x35},
>  	{0x3708, 0x64},
> @@ -1063,7 +1059,8 @@ static int ov5647_set_pad_fmt(struct v4l2_subdev *sd,
>  					 mode->pixel_rate, 1, mode->pixel_rate);
>
>  		hblank = mode->hts - mode->format.width;
> -		__v4l2_ctrl_modify_range(sensor->hblank, hblank, hblank, 1,
> +		__v4l2_ctrl_modify_range(sensor->hblank, hblank,
> +					 OV5647_HTS_MAX - mode->format.width, 1,
>  					 hblank);
>
>  		vblank = mode->vts - mode->format.height;
> @@ -1338,6 +1335,10 @@ static int ov5647_s_ctrl(struct v4l2_ctrl *ctrl)
>  		ret = ov5647_write16(sd, OV5647_REG_VTS_HI,
>  				     sensor->mode->format.height + ctrl->val);
>  		break;
> +	case V4L2_CID_HBLANK:
> +		ret = ov5647_write16(sd, OV5647_REG_HTS_HI,
> +				     sensor->mode->format.width + ctrl->val);
> +		break;
>  	case V4L2_CID_TEST_PATTERN:
>  		ret = ov5647_write(sd, OV5647_REG_ISPCTRL3D,
>  				   ov5647_test_pattern_val[ctrl->val]);
> @@ -1345,7 +1346,6 @@ static int ov5647_s_ctrl(struct v4l2_ctrl *ctrl)
>
>  	/* Read-only, but we adjust it based on mode. */
>  	case V4L2_CID_PIXEL_RATE:
> -	case V4L2_CID_HBLANK:
>  		/* Read-only, but we adjust it based on mode. */
>  		break;
>
> @@ -1421,10 +1421,11 @@ static int ov5647_init_controls(struct ov5647 *sensor)
>  					       sensor->mode->pixel_rate, 1,
>  					       sensor->mode->pixel_rate);
>
> -	/* By default, HBLANK is read only, but it does change per mode. */
>  	hblank = sensor->mode->hts - sensor->mode->format.width;
>  	sensor->hblank = v4l2_ctrl_new_std(&sensor->ctrls, &ov5647_ctrl_ops,
> -					   V4L2_CID_HBLANK, hblank, hblank, 1,
> +					   V4L2_CID_HBLANK, hblank,
> +					   OV5647_HTS_MAX -
> +					   sensor->mode->format.width, 1,
>  					   hblank);
>
>  	sensor->vblank = v4l2_ctrl_new_std(&sensor->ctrls, &ov5647_ctrl_ops,
> @@ -1454,7 +1455,6 @@ static int ov5647_init_controls(struct ov5647 *sensor)
>  		goto handler_free;
>
>  	sensor->pixel_rate->flags |= V4L2_CTRL_FLAG_READ_ONLY;
> -	sensor->hblank->flags |= V4L2_CTRL_FLAG_READ_ONLY;
>  	sensor->sd.ctrl_handler = &sensor->ctrls;
>
>  	return 0;
>
> --
> 2.51.1
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ