Linux Media Controller development
 help / color / mirror / Atom feed
From: Jai Luthra <jai.luthra@ideasonboard.com>
To: "sakari.ailus@linux.intel.com" <sakari.ailus@linux.intel.com>,
	Himanshu Bhavani <himanshu.bhavani@siliconsignals.io>
Cc: Hardevsinh Palaniya <hardevsinh.palaniya@siliconsignals.io>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Bjorn Andersson <andersson@kernel.org>,
	Konrad Dybcio <konradybcio@kernel.org>,
	Hans Verkuil <hverkuil+cisco@kernel.org>,
	Hans de Goede <johannes.goede@oss.qualcomm.com>,
	Vladimir Zapolskiy <vladimir.zapolskiy@linaro.org>,
	Mehdi Djait <mehdi.djait@linux.intel.com>,
	Elgin Perumbilly <elgin.perumbilly@siliconsignals.io>,
	Xiaolei Wang <xiaolei.wang@windriver.com>,
	Kate Hsuan <hpa@redhat.com>,
	Walter Werner Schneider <contact@schnwalter.eu>,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>,
	"linux-media@vger.kernel.org" <linux-media@vger.kernel.org>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-arm-msm@vger.kernel.org" <linux-ar m-msm@vger.kernel.org>
Subject: Re: [PATCH v3 2/3] media: i2c: add imx576 image sensor driver
Date: Wed, 12 Aug 2026 11:46:53 +0530	[thread overview]
Message-ID: <178651541361.128734.17813607544541448526@freya> (raw)
In-Reply-To: <PN0P287MB201968EA50C12E941A58AABE9ADD2@PN0P287MB2019.INDP287.PROD.OUTLOOK.COM>

Hi Himanshu,

Quoting Himanshu Bhavani (2026-08-11 14:44:12)
> Hi Jai,
> 
> >Hi Himanshu,
> >
> >Thanks for the patch.
> >
> >Not a full review, but just a few comments on the PLL programming.
> >
> >Quoting Himanshu Bhavani (2026-08-06 17:32:08)
> >> Add a v4l2 subdevice driver for the Sony imx576 sensor.
> >>
> >> The Sony IMX576 image sensor with an active
> >> array size of 5760 x 4312
> >>
> >> The following features are supported:
> >> - Manual exposure an gain control support
> >> - vblank/hblank control support
> >> - Supported resolution: 5760 x 4312 30fps (SRGGB10)
> >>
> >> Signed-off-by: Himanshu Bhavani <himanshu.bhavani@siliconsignals.io>
> >
> >[...]
> >
> >> +#define IMX576_INCLK_RATE              (24 * HZ_PER_MHZ)
> >> +
> >> +#define IMX576_REG_CHIP_ID             CCI_REG16(0x0016)
> >> +#define IMX576_CHIP_ID                 0x0576
> >> +
> >> +#define IMX576_REG_MODE_SELECT         CCI_REG8(0x0100)
> >> +#define IMX576_MODE_STANDBY            0x00
> >> +#define IMX576_MODE_STREAMING          0x01
> >> +
> >> +#define IMX576_REG_HOLD                        CCI_REG8(0x0104)
> >> +
> >> +#define IMX576_REG_EXPOSURE            CCI_REG16(0x0202)
> >> +#define IMX576_EXPOSURE_MIN            8
> >> +#define IMX576_EXPOSURE_OFFSET         22
> >> +#define IMX576_EXPOSURE_STEP           1
> >> +#define IMX576_EXPOSURE_DEFAULT                0x0648
> >> +
> >> +#define IMX576_REG_ANALOG_GAIN         CCI_REG16(0x0204)
> >> +#define IMX576_ANA_GAIN_MIN            0
> >> +#define IMX576_ANA_GAIN_MAX            978
> >> +#define IMX576_ANA_GAIN_STEP           1
> >> +#define IMX576_ANA_GAIN_DEFAULT                0
> >> +
> >> +#define IMX576_REG_IVT_PXCK_DIV                CCI_REG8(0x0301)
> >> +#define IMX576_REG_IVT_SYCK_DIV                CCI_REG8(0x0303)
> >> +#define IMX576_REG_IVT_PREPLLCK_DIV    CCI_REG8(0x0305)
> >> +#define IMX576_REG_IVT_PLL_MPY         CCI_REG16(0x0306)
> >> +#define IMX576_REG_IOP_SYCK_DIV                CCI_REG8(0x030b)
> >> +#define IMX576_REG_IOP_PREPLLCK_DIV    CCI_REG8(0x030d)
> >> +#define IMX576_REG_IOP_PLL_MPY         CCI_REG16(0x030e)
> >> +#define IMX576_REG_PLL_MULT_DRIV       CCI_REG8(0x0310)
> >> +
> >> +#define IMX576_REG_FRM_LENGTH_LINES    CCI_REG16(0x0340)
> >> +#define IMX576_REG_LINE_LENGTH_PCK     CCI_REG16(0x0342)
> >> +#define IMX576_LINE_LENGTH             6144
> >> +#define IMX576_VBLANK_DEF              4387
> >> +
> >> +/* FIXME: Exact VBLANK limit unknown (no datasheet). */
> >> +#define IMX576_VBLANK_MAX              32420
> >> +
> >> +#define IMX576_REG_X_ADD_STA           CCI_REG16(0x0344)
> >> +#define IMX576_REG_Y_ADD_STA           CCI_REG16(0x0346)
> >> +#define IMX576_REG_X_ADD_END           CCI_REG16(0x0348)
> >> +#define IMX576_REG_Y_ADD_END           CCI_REG16(0x034a)
> >> +#define IMX576_REG_X_OUTPUT_SIZE       CCI_REG16(0x034c)
> >> +#define IMX576_REG_Y_OUTPUT_SIZE       CCI_REG16(0x034e)
> >> +
> >> +#define IMX576_REG_DIG_CROP_X_OFFSET   CCI_REG16(0x0408)
> >> +#define IMX576_REG_DIG_CROP_Y_OFFSET   CCI_REG16(0x040a)
> >> +#define IMX576_REG_DIG_CROP_WIDTH      CCI_REG16(0x040c)
> >> +#define IMX576_REG_DIG_CROP_HEIGHT     CCI_REG16(0x040e)
> >
> >This sensor's registers seem quite similar to the MIPI CCS specification.
> 
> Yes, you are right some registers seems to be similar I will address it.
> 

That's good to know. Did you check if the sensor itself advertises itself
as compliant to a particular version of the CCS standard? You can read the
below register:

#define CCS_R_MIPI_CCS_VERSION					CCI_REG8(0x0007)

In general it might help to take a dump of all the CCS registers to see if
the ranges given in datasheet match what the sensor's registers say.

> 
> >Please check if the sensor is CCS compatible. Even if it is not, I think
> >the PLL programming is compatible, so you can use the helpers from
> >ccs-pll.c.
> 
> Most PLL values are derived from the limited IMX576 datasheet information
> available.
> 
> For the unknown values, I referred to out of tree driver and validated
> and assumed them based on the PLL configuration.
> 
> Should I proceed with the PLL programming as it is, or drop the PLL
> approach and retain only the CCS-supported registers?
> 

I'm not sure I fully understand your question.

If you can support more than 1 link frequency using the ccs_pll_calculate()
helper, then my suggestion would be to do that, even if it's just 2
well-tested frequencies today.

That leaves the driver in much better shape for future (for use with a
different input clock or frequency). At least that's what I have done for
my IMX708 series, which was similar to this sensor.

Thanks,
    Jai

> static const struct ccs_pll_limits imx576_pll_limits = {
>         .min_ext_clk_freq_hz = 6000000,
>         .max_ext_clk_freq_hz = 27000000,
> 
>         .vt_fr = {
>                 /* Confirmed values as per datasheet */
> 
>                 .min_pre_pll_clk_div = 1,
>                 .max_pre_pll_clk_div = 4,
>                 .min_pll_ip_clk_freq_hz = 6000000,
>                 .max_pll_ip_clk_freq_hz = 12000000,
>                 .min_pll_multiplier = 87,
>                 .max_pll_multiplier = 350,
>                 .min_pll_op_clk_freq_hz = 1050000000,
>                 .max_pll_op_clk_freq_hz = 2100000000,
>         },
> 
>         .vt_bk = {
>                 /* here the sys_clk_div (IVT_SYCK_DIV -> 0303) value as per out of tree driver they are using div as 2 or 4  */
> 
>                 .min_sys_clk_div = 2,
>                 .max_sys_clk_div = 4,
>                 .min_sys_clk_freq_hz = 262500000,
>                 .max_sys_clk_freq_hz = 1050000000,
> 
>                 /* pix_clk_div also being used as an Fixed to 5 */
>                 .min_pix_clk_div = 5,
>                 .max_pix_clk_div = 5,
>                 .min_pix_clk_freq_hz = 52500000,
>                 .max_pix_clk_freq_hz = 210000000,
>         },
>         .op_fr = {
> 
>                 /* Confirmed values as per datasheet */
> 
>                 .min_pre_pll_clk_div = 1,
>                 .max_pre_pll_clk_div = 15,
>                 .min_pll_ip_clk_freq_hz = 6000000,
>                 .max_pll_ip_clk_freq_hz = 12000000,
>                 .min_pll_multiplier = 47,
>                 .max_pll_multiplier = 2300,
>                 .min_pll_op_clk_freq_hz = 1250000000,
>                 .max_pll_op_clk_freq_hz = 2300000000,
>         },
>         .op_bk = {
> 
>                  /* Similarly here also (OP_SYS_CLK_DIV -> 030b) value being used is 1,2,4 in out of tree driver
>                   * But as per ccs-limits { CCS_R_MAX_OP_SYS_CLK_DIV = 2 }
>                   */
> 
>                 .min_sys_clk_div = 1,
>                 .max_sys_clk_div = 2,
>                 .min_sys_clk_freq_hz = 625000000,
>                 .max_sys_clk_freq_hz = 2300000000,
> 
>                 /* (RAW8 and RAW10) */
>                 .min_pix_clk_div = 8,
>                 .max_pix_clk_div = 10,
>                 .min_pix_clk_freq_hz = 62500000,
>                 .max_pix_clk_freq_hz = 2300000000,
>         },
> 
> >> +
> >> +#define IMX576_REG_BINNING_MODE                CCI_REG8(0x0900)
> >> +#define IMX576_REG_BINNING_TYPE                CCI_REG8(0x0901)
> >> +#define IMX576_REG_BINNING_WEIGHT      CCI_REG8(0x0902)
> >> +
> >> +#define IMX576_PIXEL_RATE              813600000
> >> +#define IMX576_NUM_DATA_LANES          4
> >> +
> >> +/* IMX576 native and active pixel array size */
> >> +static const struct v4l2_rect imx576_native_area = {
> >> +       .top = 0,
> >> +       .left = 0,
> >> +       .width = 5792,
> >> +       .height = 4464,
> >> +};
> >> +
> >> +static const struct v4l2_rect imx576_active_area = {
> >> +       .top = 136,
> >> +       .left = 16,
> >> +       .width = 5760,
> >> +       .height = 4312,
> >> +};
> >> +
> >> +static const char * const imx576_supply_names[] = {
> >> +       "vana",         /* Analog Power */
> >> +       "vif",          /* Interface Power */
> >> +       "vdig",         /* Digital Power */
> >> +};
> >> +
> >> +static const struct cci_reg_sequence imx576_common_regs[] = {
> >
> >[...]
> >
> >> +       { IMX576_REG_IVT_PXCK_DIV, 0x05 },
> >> +       { IMX576_REG_IVT_SYCK_DIV, 0x02 },
> >> +       { IMX576_REG_IVT_PREPLLCK_DIV, 0x04 },
> >> +       { IMX576_REG_IVT_PLL_MPY, 0x0154 },
> >> +       { IMX576_REG_IOP_SYCK_DIV, 0x01 },
> >> +       { IMX576_REG_IOP_PREPLLCK_DIV, 0x04 },
> >> +       { IMX576_REG_PLL_MULT_DRIV, 0x01 },
> >
> >I think when Laurent asked to make the PLL configurable for different link
> >frequencies, he meant deriving these and the OP_PLL_MPY value instead of
> >hardcoding all of them and only supporting one link freq.
> >> +       { CCI_REG8(0x0b06), 0x01 },
> >> +       { CCI_REG8(0x3620), 0x01 },
> >> +       { CCI_REG8(0x3f0c), 0x00 },
> >> +};
> >> +
> >
> >Thanks,
> >    Jai
> 
> 
> Best Regards,
> Himanshu

  reply	other threads:[~2026-08-12  6:17 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-06 12:02 [PATCH v3 0/3] media: i2c: Add imx576 camera sensor driver Himanshu Bhavani
2026-08-06 12:02 ` [PATCH v3 1/3] dt-bindings: media: i2c: Add imx576 sensor Himanshu Bhavani
2026-08-06 12:02 ` [PATCH v3 2/3] media: i2c: add imx576 image sensor driver Himanshu Bhavani
2026-08-07  7:00   ` Jai Luthra
2026-08-11  9:14     ` Himanshu Bhavani
2026-08-12  6:16       ` Jai Luthra [this message]
2026-08-14 11:35         ` Himanshu Bhavani
2026-08-14 12:52           ` Jai Luthra
2026-08-06 12:02 ` [PATCH v3 3/3] arm64: dts: qcom: sm7225-fairphone-fp4: Add Sony IMX576 front camera support Himanshu Bhavani
2026-08-07  6:55   ` Jai Luthra
2026-08-11  9:16     ` Himanshu Bhavani
2026-08-24  9:46   ` Konrad Dybcio

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=178651541361.128734.17813607544541448526@freya \
    --to=jai.luthra@ideasonboard.com \
    --cc=andersson@kernel.org \
    --cc=bartosz.golaszewski@oss.qualcomm.com \
    --cc=conor+dt@kernel.org \
    --cc=contact@schnwalter.eu \
    --cc=devicetree@vger.kernel.org \
    --cc=elgin.perumbilly@siliconsignals.io \
    --cc=hardevsinh.palaniya@siliconsignals.io \
    --cc=himanshu.bhavani@siliconsignals.io \
    --cc=hpa@redhat.com \
    --cc=hverkuil+cisco@kernel.org \
    --cc=johannes.goede@oss.qualcomm.com \
    --cc=konradybcio@kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=mehdi.djait@linux.intel.com \
    --cc=robh@kernel.org \
    --cc=sakari.ailus@linux.intel.com \
    --cc=vladimir.zapolskiy@linaro.org \
    --cc=xiaolei.wang@windriver.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