From: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
To: David Carlier <devnexen@gmail.com>
Cc: jacopo.mondi@ideasonboard.com, philippebaetens@gmail.com,
mchehab@kernel.org, linux-media@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] media: i2c: mira016: Fix analogue gain range for the default format
Date: Sun, 22 Nov 2026 18:48:54 +0100 [thread overview]
Message-ID: <awMqfTOFAiwUcxGs@zed> (raw)
In-Reply-To: <20261121195010.820752-1-devnexen@gmail.com>
Hi David
On Sat, Nov 21, 2026 at 07:50:10PM +0000, David Carlier wrote:
> The analogue gain control is created with a 1..1 range, and the range is
> only updated when an active format is set. The default 8-bit format is
> applied by init_state as a TRY format, so the gain cannot be changed
> until userspace sets the active format.
>
> Create the control with the 8-bit gain range to match the default format.
I'm surprised I used the 8-bits format as default. I thought it was 12
and clearly overlooked it.
Honestly, I would use the 12 bits format as a default as higher
bitdepths are maybe preferable ?
>
> The issue was found by code inspection with an LLM, build tested only.
>
> Fixes: ab4a4c39c611 ("media: i2c: mira016: Add driver for Mira016")
Do we need one ? The driver didn't land in any published kernel yet.
> Signed-off-by: David Carlier <devnexen@gmail.com>
> ---
> drivers/media/i2c/mira016.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/media/i2c/mira016.c b/drivers/media/i2c/mira016.c
> index 082442ffad28..076e8a22be82 100644
> --- a/drivers/media/i2c/mira016.c
> +++ b/drivers/media/i2c/mira016.c
> @@ -1917,9 +1917,11 @@ static int mira016_init_controls(struct mira016 *mira016)
> MIRA016_MAX_EXPOSURE, 1,
> def_exposure);
>
> + /* The gain range matches the default 8-bit format set in init_state. */
> mira016->gain = v4l2_ctrl_new_std(ctrl_hdlr, &mira016_ctrl_ops,
> - V4L2_CID_ANALOGUE_GAIN,
> - 1, 1, 1, 1);
> + V4L2_CID_ANALOGUE_GAIN, 1,
> + ARRAY_SIZE(mira016_gain_lut_8bit),
> + 1, 1);
>
> /*
> * Changing VFLIP requires re-programming the top point, hence we
> --
> 2.55.0
>
prev parent reply other threads:[~2026-11-22 17:49 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-21 19:50 [PATCH] media: i2c: mira016: Fix analogue gain range for the default format David Carlier
2026-11-22 17:48 ` Jacopo Mondi [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=awMqfTOFAiwUcxGs@zed \
--to=jacopo.mondi@ideasonboard.com \
--cc=devnexen@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=philippebaetens@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox