mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jai Luthra <jai.luthra@ideasonboard.com>
To: Dave Stevenson <dave.stevenson@raspberrypi.com>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Sakari Ailus <sakari.ailus@linux.intel.com>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	Alexander Shiyan <eagle.alexander923@gmail.com>,
	linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
	Dave Stevenson <dave.stevenson@raspberrypi.com>
Subject: Re: [PATCH RFC 2/4] media: i2c: imx678: Parameterise the configuration to allow for other models
Date: Thu, 03 Sep 2026 09:45:46 +0530	[thread overview]
Message-ID: <178840894612.11722.991560430853331683@freya> (raw)
In-Reply-To: <20260805-media-starvis2-v1-2-91e8e4eae44f@raspberrypi.com>

Quoting Dave Stevenson (2026-08-05 21:39:17)
> Several of the Sony Starvis 2 sensors are identical in the
> majority of their programming, but differ largely only in the
> size of pixel array and some timing parameters.
> 
> Parameterise those parameters in preparation for supporting other
> variants.
> 
> Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
> ---
>  drivers/media/i2c/imx678.c | 161 +++++++++++++++++++++++++++++----------------
>  1 file changed, 106 insertions(+), 55 deletions(-)
> 
> diff --git a/drivers/media/i2c/imx678.c b/drivers/media/i2c/imx678.c
> index f7b988dca2ac..40ba6661b366 100644
> --- a/drivers/media/i2c/imx678.c
> +++ b/drivers/media/i2c/imx678.c
> @@ -148,32 +148,11 @@
>  /* Subdev pads */
>  #define IMX678_SOURCE_PAD              0
>  
> -/* IMX678 native and active pixel array size. */
> -static const struct v4l2_rect imx678_native_area = {
> -       .top = 0,
> -       .left = 0,
> -       .width = 3857,
> -       .height = 2201,
> -};
> -
> -static const struct v4l2_rect imx678_active_area = {
> -       .top = 20,
> -       .left = 0,
> -       .width = 3856,
> -       .height = 2180,
> -};
> -
>  enum imx678_type {
>         IMX678_COLOR = 0,
>         IMX678_MONOCHROME = 1,
>  };
>  
> -struct imx678_model_info {
> -       enum imx678_type type;
> -       const u32 *codes;
> -       unsigned int num_codes;
> -};
> -
>  enum imx678_lanemode {
>         IMX678_LANEMODE_2L = 1,
>         IMX678_LANEMODE_4L = 3,
> @@ -213,7 +192,7 @@ static const u64 link_freqs[] = {
>         [IMX678_LINK_FREQ_1188MHZ] = 1188000000,
>  };
>  
> -static const u16 min_hmax_4lane[] = {
> +static const u16 imx678_min_hmax_4lane[] = {
>         [IMX678_LINK_FREQ_297MHZ] = 1584,
>         [IMX678_LINK_FREQ_360MHZ] = 1320,
>         [IMX678_LINK_FREQ_445MHZ] = 1100,
> @@ -273,7 +252,7 @@ static const int imx678_tpg_val[] = {
>  };
>  
>  /* Common configuration */
> -static const struct cci_reg_sequence common_regs[] = {
> +static const struct cci_reg_sequence imx678_common_regs[] = {
>         { IMX678_REG_THIN_V_EN, 0x00 },
>         { IMX678_REG_VCMODE, 0x01 },
>         { CCI_REG8(0x306b), 0x00 },
> @@ -656,16 +635,72 @@ static const u32 codes_monochrome[] = {
>         MEDIA_BUS_FMT_Y12_1X12,
>  };
>  
> +struct imx678_variant {
> +       const char *name;
> +       u32 id_reg;
> +       u32 id_value;
> +       struct v4l2_rect native_area;
> +       struct v4l2_rect active_area;
> +       u64 pixel_rate;
> +       unsigned int pix_per_clk;
> +       const struct cci_reg_sequence *common_regs;
> +       unsigned int num_common_regs;
> +       unsigned int vmax_default;
> +       const u16 *hmax_min;
> +};
> +
> +const struct imx678_variant imx678_variant_def = {
> +       .name = "imx678",
> +       .id_reg = IMX678_REG_MODULE_ID,
> +       .id_value = IMX678_ID,
> +       .native_area = {
> +               .top = 0,
> +               .left = 0,
> +               .width = 3857,
> +               .height = 2201,
> +       },
> +       .active_area = {
> +               .top = 20,
> +               .left = 0,
> +               .width = 3856,
> +               .height = 2180,
> +       },
> +       .pixel_rate = IMX678_PIXEL_RATE,
> +       .pix_per_clk = IMX678_PIX_PER_CLK,
> +       .common_regs = imx678_common_regs,
> +       .num_common_regs = ARRAY_SIZE(imx678_common_regs),
> +       .vmax_default = IMX678_VMAX_DEFAULT,

There are a couple of places where IMX678_PIX_PER_CLK and
IMX678_VMAX_DEFAULT were still being used. I've fixed those in my branch:
https://github.com/jailuthra/linux/commit/3c656e370e06ceb41e69ba0406f685d4556133d0

Thanks,
Jai

[...]

  reply	other threads:[~2026-09-03  4:15 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-05 16:09 [PATCH RFC 0/4] Update imx678 to act as a common Sony Starvis 2 driver Dave Stevenson
2026-08-05 16:09 ` [PATCH RFC 1/4] media: i2c: imx678: Always program the sensor in window mode Dave Stevenson
2026-09-03  4:16   ` Jai Luthra
2026-08-05 16:09 ` [PATCH RFC 2/4] media: i2c: imx678: Parameterise the configuration to allow for other models Dave Stevenson
2026-09-03  4:15   ` Jai Luthra [this message]
2026-08-05 16:09 ` [PATCH RFC 3/4] media: i2c: imx678: Add imx662 support to the driver Dave Stevenson
2026-09-03  4:20   ` Jai Luthra
2026-09-03 11:46     ` Dave Stevenson
2026-08-05 16:09 ` [PATCH RFC 4/4] media: i2c: imx678: Add imx675 " Dave Stevenson
2026-09-03  4:22   ` Jai Luthra
2026-09-03 11:54     ` Dave Stevenson
2026-09-03 12:24       ` Jai Luthra
2026-09-03  4:13 ` [PATCH RFC 0/4] Update imx678 to act as a common Sony Starvis 2 driver Jai Luthra
2026-09-03 11:55   ` Dave Stevenson
2026-09-03 12:25     ` Jai Luthra

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=178840894612.11722.991560430853331683@freya \
    --to=jai.luthra@ideasonboard.com \
    --cc=dave.stevenson@raspberrypi.com \
    --cc=eagle.alexander923@gmail.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=sakari.ailus@linux.intel.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

all inboxes | Powered by JetHome®