From: Jai Luthra <jai.luthra@ideasonboard.com>
To: Mauro Carvalho Chehab <mchehab@kernel.org>,
Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Sakari Ailus <sakari.ailus@linux.intel.com>
Cc: Dave Stevenson <dave.stevenson@raspberrypi.com>,
Naushir Patuck <naush@raspberrypi.com>,
David Plowman <david.plowman@raspberrypi.com>,
Kieran Bingham <kieran.bingham@ideasonboard.com>,
Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
linux-media@vger.kernel.org, devicetree@vger.kernel.org,
Raspberry Pi Kernel Maintenance <kernel-list@raspberrypi.com>,
Jai Luthra <jai.luthra@ideasonboard.com>
Subject: [PATCH v2 2/3] media: ccs-pll: Support optional input for VT pixel rate
Date: Fri, 07 Aug 2026 18:25:19 +0530 [thread overview]
Message-ID: <20260807-imx708-v2-2-7d3d7b57779d@ideasonboard.com> (raw)
In-Reply-To: <20260807-imx708-v2-0-7d3d7b57779d@ideasonboard.com>
When the PLL is configured in DUAL_MODE (separate VT and OP trees) and
the sensor's FIFOs allow derating and/or overrating, the VT pixel rate
might be higher or lower than OP pixel rate.
Support such usecases by allowing an optional input for the target VT
pixel rate.
Signed-off-by: Jai Luthra <jai.luthra@ideasonboard.com>
---
drivers/media/i2c/ccs-pll.c | 13 +++++++++++--
drivers/media/i2c/ccs-pll.h | 4 +++-
2 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/drivers/media/i2c/ccs-pll.c b/drivers/media/i2c/ccs-pll.c
index 1605cfa5db19..9aa164994cc7 100644
--- a/drivers/media/i2c/ccs-pll.c
+++ b/drivers/media/i2c/ccs-pll.c
@@ -388,6 +388,14 @@ __ccs_pll_calculate_vt_tree(struct device *dev,
return 0;
}
+static inline u32 ccs_pll_vt_pixel_rate(const struct ccs_pll *pll)
+{
+ if (pll->pixel_rate_pixel_array)
+ return pll->pixel_rate_pixel_array;
+
+ return pll->pixel_rate_csi;
+}
+
static int ccs_pll_calculate_vt_tree(struct device *dev,
const struct ccs_pll_limits *lim,
struct ccs_pll *pll)
@@ -396,11 +404,12 @@ static int ccs_pll_calculate_vt_tree(struct device *dev,
struct ccs_pll_branch_fr *pll_fr = &pll->vt_fr;
u16 min_pre_pll_clk_div = lim_fr->min_pre_pll_clk_div;
u16 max_pre_pll_clk_div = lim_fr->max_pre_pll_clk_div;
+ u32 vt_pixel_rate = ccs_pll_vt_pixel_rate(pll);
u32 pre_mul, pre_div;
- pre_div = gcd(pll->pixel_rate_csi,
+ pre_div = gcd(vt_pixel_rate,
pll->ext_clk_freq_hz * pll->vt_lanes);
- pre_mul = pll->pixel_rate_csi / pre_div;
+ pre_mul = vt_pixel_rate / pre_div;
pre_div = pll->ext_clk_freq_hz * pll->vt_lanes / pre_div;
/* Make sure PLL input frequency is within limits */
diff --git a/drivers/media/i2c/ccs-pll.h b/drivers/media/i2c/ccs-pll.h
index e22903931e72..5c00a72c41df 100644
--- a/drivers/media/i2c/ccs-pll.h
+++ b/drivers/media/i2c/ccs-pll.h
@@ -114,7 +114,9 @@ struct ccs_pll_branch_bk {
* @op_bk: Operational timing back-end configuration (output)
* @pixel_rate_csi: Pixel rate on the output data bus (output)
* @pixel_rate_pixel_array: Nominal pixel rate in the sensor's pixel array
- * (output)
+ * (input/output). It is a valid input only when
+ * FLAG_DUAL_PLL is set, serving as a target rate
+ * for the VT tree.
*/
struct ccs_pll {
/* input values */
--
2.54.0
next prev parent reply other threads:[~2026-08-07 12:56 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-07 12:55 [PATCH v2 0/3] media: Add bindings and driver for Sony IMX708 Jai Luthra
2026-08-07 12:55 ` [PATCH v2 1/3] dt-bindings: media: i2c: Add imx708 image sensor Jai Luthra
2026-08-07 13:04 ` sashiko-bot
2026-08-07 12:55 ` Jai Luthra [this message]
2026-08-07 13:15 ` [PATCH v2 2/3] media: ccs-pll: Support optional input for VT pixel rate sashiko-bot
2026-08-07 12:55 ` [PATCH v2 3/3] media: i2c: Add a driver for Sony IMX708 Jai Luthra
2026-08-07 13:12 ` sashiko-bot
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=20260807-imx708-v2-2-7d3d7b57779d@ideasonboard.com \
--to=jai.luthra@ideasonboard.com \
--cc=conor+dt@kernel.org \
--cc=dave.stevenson@raspberrypi.com \
--cc=david.plowman@raspberrypi.com \
--cc=devicetree@vger.kernel.org \
--cc=kernel-list@raspberrypi.com \
--cc=kieran.bingham@ideasonboard.com \
--cc=krzk+dt@kernel.org \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=naush@raspberrypi.com \
--cc=robh@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