[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <attkqzfqwxjrozx27utbyh2q2jfci3ytjsq2we4db3nhf22l3e@7uv3j2imledv>
Date: Fri, 21 Feb 2025 16:07:13 +0530
From: Jai Luthra <jai.luthra@...asonboard.com>
To: Jacopo Mondi <jacopo.mondi@...asonboard.com>
Cc: Sakari Ailus <sakari.ailus@...ux.intel.com>,
Dave Stevenson <dave.stevenson@...pberrypi.com>, Mauro Carvalho Chehab <mchehab@...nel.org>,
linux-media@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/3] media: i2c: imx219: Only use higher LLP_MIN for
binned resolutions
Hi Jacopo,
Thanks for the review.
On Feb 21, 2025 at 10:28:40 +0100, Jacopo Mondi wrote:
> Hi Jai
>
> On Wed, Feb 19, 2025 at 05:16:43PM +0530, Jai Luthra wrote:
> > The LLP_MIN of 3560 is only needed to fix artefacts seen with binned
> > resolutions. As increasing the LLP reduces the highest possible
> > framerate by ~3%, use the default minimum of 3448 for non-binned
> > resolutions.
> >
>
> Also restore the fll_def value for non-binned modes in the modes definition
> to restore the default mode framerate to 30fps.
>
Will add in v2.
> > Suggested-by: Dave Stevenson <dave.stevenson@...pberrypi.com>
> > Link: https://lore.kernel.org/linux-media/CAPY8ntC1-S6zKtDvmc6EgyxP+j6rTShuG8Dr8PKb9XQr2PeS_w@mail.gmail.com/
> > Signed-off-by: Jai Luthra <jai.luthra@...asonboard.com>
> > ---
> > drivers/media/i2c/imx219.c | 24 ++++++++++++++++--------
> > 1 file changed, 16 insertions(+), 8 deletions(-)
> >
> > diff --git a/drivers/media/i2c/imx219.c b/drivers/media/i2c/imx219.c
> > index f662c9d755114265aad46c5cc7f5031b9bc0dbba..6e51a7af5e2a05cacefb201d96a9fbdc349f17d8 100644
> > --- a/drivers/media/i2c/imx219.c
> > +++ b/drivers/media/i2c/imx219.c
> > @@ -74,7 +74,8 @@
> > #define IMX219_FLL_MAX 0xffff
> > #define IMX219_VBLANK_MIN 32
> > #define IMX219_REG_LINE_LENGTH_A CCI_REG16(0x0162)
> > -#define IMX219_LLP_MIN 0x0de8
> > +#define IMX219_LLP_MIN 0x0d78
> > +#define IMX219_BINNED_LLP_MIN 0x0de8
> > #define IMX219_LLP_MAX 0x7ff0
> >
> > #define IMX219_REG_X_ADD_STA_A CCI_REG16(0x0164)
> > @@ -317,13 +318,13 @@ static const struct imx219_mode supported_modes[] = {
> > /* 8MPix 15fps mode */
> > .width = 3280,
> > .height = 2464,
> > - .fll_def = 3415,
> > + .fll_def = 3526,
> > },
> > {
> > /* 1080P 30fps cropped */
> > .width = 1920,
> > .height = 1080,
> > - .fll_def = 1707,
> > + .fll_def = 1763,
> > },
> > {
> > /* 2x2 binned 60fps mode */
> > @@ -901,7 +902,7 @@ static int imx219_set_pad_format(struct v4l2_subdev *sd,
> > if (fmt->which == V4L2_SUBDEV_FORMAT_ACTIVE) {
> > int exposure_max;
> > int exposure_def;
> > - int hblank;
> > + int hblank, llp_min;
> > int pixel_rate;
> >
> > /* Update limits and set FPS to default */
> > @@ -918,6 +919,17 @@ static int imx219_set_pad_format(struct v4l2_subdev *sd,
> > imx219->exposure->minimum,
> > exposure_max, imx219->exposure->step,
> > exposure_def);
> > +
> > + /*
> > + * With analog binning the default minimum line length of 3448
> > + * can cause artefacts because the ADC operates on two lines
> > + * together. Switch to higher minimum of 3560 if we are binning.
> > + */
> > + llp_min = (bin_h || bin_v) ? IMX219_BINNED_LLP_MIN :
>
> As you know, this is always true.
>
Oops my bad. Will fix in v2.
I realized it would be cleaner to use the new version of
imx219_get_binning() to check if analog binning is used before updating
the minimum.
> > + IMX219_LLP_MIN;
> > + __v4l2_ctrl_modify_range(imx219->hblank, llp_min - mode->width,
> > + IMX219_LLP_MAX - mode->width, 1,
> > + llp_min - mode->width);
> > /*
> > * Retain PPL setting from previous mode so that the
> > * line time does not change on a mode change.
> > @@ -926,10 +938,6 @@ static int imx219_set_pad_format(struct v4l2_subdev *sd,
> > * mode width subtracted.
> > */
> > hblank = prev_line_len - mode->width;
> > - __v4l2_ctrl_modify_range(imx219->hblank,
> > - IMX219_LLP_MIN - mode->width,
> > - IMX219_LLP_MAX - mode->width, 1,
> > - IMX219_LLP_MIN - mode->width);
> > __v4l2_ctrl_s_ctrl(imx219->hblank, hblank);
> >
> > /* Scale the pixel rate based on the mode specific factor */
> >
> > --
> > 2.48.1
> >
--
Thanks,
Jai
Powered by blists - more mailing lists