From: Kate Hsuan <hpa@redhat.com>
To: Mauro Carvalho Chehab <mchehab@kernel.org>,
Hans de Goede <hansg@kernel.org>,
Sakari Ailus <sakari.ailus@linux.intel.com>,
Christian Murphy <christian@themurphys.eu>
Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
Kate Hsuan <hpa@redhat.com>
Subject: [PATCH v3 3/3] media: i2c: imx471: Derive pixel rate from PLL configuration
Date: Wed, 7 Oct 2026 13:01:40 +0800 [thread overview]
Message-ID: <20261007050140.26604-4-hpa@redhat.com> (raw)
In-Reply-To: <20261007050140.26604-1-hpa@redhat.com>
Derive the pixel rate from the sensor's external clock frequency and
active PLL settings.
The discussion of pixel rate can be found at the URL
Link: https://lore.kernel.org/linux-media/CAEth8oHj1Jon9m_4aFzRGoKcdopUMym+MyV0JxTo6F+AUFOLoQ@mail.gmail.com/
Signed-off-by: Kate Hsuan <hpa@redhat.com>
---
drivers/media/i2c/imx471.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/drivers/media/i2c/imx471.c b/drivers/media/i2c/imx471.c
index b469fef7eef9..fc6a12943991 100644
--- a/drivers/media/i2c/imx471.c
+++ b/drivers/media/i2c/imx471.c
@@ -65,7 +65,7 @@
/* default link frequency and external clock */
#define IMX471_LINK_FREQ_DEFAULT 200000000LL
-#define IMX471_EXT_CLK 19200000
+#define IMX471_EXT_CLK 19200000LL
/* PLL */
#define IMX471_REG_VTPXCK_DIV CCI_REG16(0x0300)
@@ -704,9 +704,15 @@ static int imx471_init_controls(struct imx471 *sensor)
ARRAY_SIZE(link_freq_menu_items) - 1,
0,
link_freq_menu_items);
-
- /* pixel_rate = link_freq * 2 * nr_of_lanes / bits_per_sample */
- pixel_rate = div_u64(IMX471_LINK_FREQ_DEFAULT * 2 * 4, 10);
+ /*
+ * The sensor runs in the dual mode so the pixel rate is defined as
+ * follows:
+ * (ext_freq * IVT_PLL_MPY * num_of_vt_lanes) /
+ * (VT_PREPLLCK_DIV * IVT_SYCK_DIV * IVT_PXCK_DIV)
+ */
+ pixel_rate = (IMX471_EXT_CLK * IMX471_PLL_VT_MPY * 4) /
+ (IMX471_PREPLLCK_VT_DIV * IMX471_VTSYCK_DIV *
+ IMX471_VTPXCK_DIV);
v4l2_ctrl_new_std(ctrl_hdlr, &imx471_ctrl_ops,
V4L2_CID_PIXEL_RATE, pixel_rate,
--
2.55.0
prev parent reply other threads:[~2026-10-07 5:02 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-07 5:01 [PATCH v3 0/3] media: i2c: imx471: Add line length PCK setting and derive " Kate Hsuan
2026-10-07 5:01 ` [PATCH v3 1/3] media: i2c: imx471: Configure line length PCK via hblank control Kate Hsuan
2026-10-07 5:01 ` [PATCH v3 2/3] media: i2c: imx471: Define symbolic names for PLL registers Kate Hsuan
2026-10-07 5:01 ` Kate Hsuan [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=20261007050140.26604-4-hpa@redhat.com \
--to=hpa@redhat.com \
--cc=christian@themurphys.eu \
--cc=hansg@kernel.org \
--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®