Linux Media Controller development
 help / color / mirror / Atom feed
* [PATCH v2] media: i2c: mira016: Use the 12-bit format as default
@ 2026-11-23  5:32 David Carlier
  2026-11-23 16:24 ` Jacopo Mondi
  0 siblings, 1 reply; 2+ messages in thread
From: David Carlier @ 2026-11-23  5:32 UTC (permalink / raw)
  To: jacopo.mondi, philippebaetens
  Cc: mchehab, linux-media, linux-kernel, David Carlier

The analogue gain control is created with a 1..1 range, which is only
valid for the 12-bit format, while init_state applies the 8-bit format.
The gain cannot be changed until userspace sets the active format.

Make the 12-bit format the default, and initialise row_length to the
matching value so the blanking, pixel rate and exposure limits are
computed for it.

The issue was found by code inspection with an LLM, build tested only.

Signed-off-by: David Carlier <devnexen@gmail.com>
---

Notes:
    v2: make 12-bit the default format instead of widening the gain range,
        drop the Fixes tag (Jacopo)

 drivers/media/i2c/mira016.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/media/i2c/mira016.c b/drivers/media/i2c/mira016.c
index 082442ffad28..d6db922f01b6 100644
--- a/drivers/media/i2c/mira016.c
+++ b/drivers/media/i2c/mira016.c
@@ -1630,7 +1630,7 @@ static int mira016_init_state(struct v4l2_subdev *sd,
 		.which = V4L2_SUBDEV_FORMAT_TRY,
 		.pad = 0,
 		.format = {
-			.code = MEDIA_BUS_FMT_Y8_1X8,
+			.code = MEDIA_BUS_FMT_Y12_1X12,
 			.width = MIRA016_PIXEL_ARRAY_WIDTH,
 			.height = MIRA016_PIXEL_ARRAY_HEIGHT
 		},
@@ -2254,7 +2254,7 @@ static int mira016_probe(struct i2c_client *client)
 	 */
 	mira016_pll_calc(mira016);
 	mira016_timings_calc(mira016);
-	mira016->timings.row_length = 1062;
+	mira016->timings.row_length = 1504;
 
 	ret = mira016_power_on(dev);
 	if (ret)
-- 
2.55.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] media: i2c: mira016: Use the 12-bit format as default
  2026-11-23  5:32 [PATCH v2] media: i2c: mira016: Use the 12-bit format as default David Carlier
@ 2026-11-23 16:24 ` Jacopo Mondi
  0 siblings, 0 replies; 2+ messages in thread
From: Jacopo Mondi @ 2026-11-23 16:24 UTC (permalink / raw)
  To: David Carlier
  Cc: jacopo.mondi, philippebaetens, mchehab, linux-media, linux-kernel

On Mon, Nov 23, 2026 at 05:32:12AM +0000, David Carlier wrote:
> The analogue gain control is created with a 1..1 range, which is only
> valid for the 12-bit format, while init_state applies the 8-bit format.
> The gain cannot be changed until userspace sets the active format.
>
> Make the 12-bit format the default, and initialise row_length to the
> matching value so the blanking, pixel rate and exposure limits are
> computed for it.
>
> The issue was found by code inspection with an LLM, build tested only.
>
> Signed-off-by: David Carlier <devnexen@gmail.com>

Thanks, I'll make sure it gets in together with the driver in 7.5

Acked-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>

> ---
>
> Notes:
>     v2: make 12-bit the default format instead of widening the gain range,
>         drop the Fixes tag (Jacopo)
>
>  drivers/media/i2c/mira016.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/media/i2c/mira016.c b/drivers/media/i2c/mira016.c
> index 082442ffad28..d6db922f01b6 100644
> --- a/drivers/media/i2c/mira016.c
> +++ b/drivers/media/i2c/mira016.c
> @@ -1630,7 +1630,7 @@ static int mira016_init_state(struct v4l2_subdev *sd,
>  		.which = V4L2_SUBDEV_FORMAT_TRY,
>  		.pad = 0,
>  		.format = {
> -			.code = MEDIA_BUS_FMT_Y8_1X8,
> +			.code = MEDIA_BUS_FMT_Y12_1X12,
>  			.width = MIRA016_PIXEL_ARRAY_WIDTH,
>  			.height = MIRA016_PIXEL_ARRAY_HEIGHT
>  		},
> @@ -2254,7 +2254,7 @@ static int mira016_probe(struct i2c_client *client)
>  	 */
>  	mira016_pll_calc(mira016);
>  	mira016_timings_calc(mira016);
> -	mira016->timings.row_length = 1062;
> +	mira016->timings.row_length = 1504;
>
>  	ret = mira016_power_on(dev);
>  	if (ret)
> --
> 2.55.0
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-23 16:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-23  5:32 [PATCH v2] media: i2c: mira016: Use the 12-bit format as default David Carlier
2026-11-23 16:24 ` Jacopo Mondi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox