From: Antoine Pichot <antoine.pichot@gmail.com>
To: linux-media@vger.kernel.org
Cc: sakari.ailus@linux.intel.com, mchehab@kernel.org,
hansg@kernel.org, andriy.shevchenko@linux.intel.com,
dan.scally@ideasonboard.com, djrscally@gmail.com,
dmanresa@gmail.com, dave.stevenson@raspberrypi.com,
linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: [PATCH v2 3/9] media: i2c: ov7251: Report the pixel array rate for both link frequencies
Date: Wed, 28 Oct 2026 20:21:48 +0900 [thread overview]
Message-ID: <20261028112154.855185-4-antoine.pichot@gmail.com> (raw)
In-Reply-To: <20261028112154.855185-1-antoine.pichot@gmail.com>
pixel_rates[] gives V4L2_CID_PIXEL_RATE 48 MHz for the 240 MHz link and
63.84 MHz for the 319.2 MHz link, which is the CSI-2 bus rate of each
link (one lane, 10 bits per pixel). The control is the pixel array rate,
and Documentation/driver-api/media/tx-rx.rst says the bus rate "is not
the same thing as the pixel rate on the camera sensor's pixel array
which is indicated by the V4L2_CID_PIXEL_RATE control".
The pixel array runs from PLL2's 48 MHz system clock at both link
frequencies: the PLL2 registers are the same in both tables, and the
measured frame rate is 48000000 / (928 x VTS) with either link. On a
Surface Book 2 at 319.2 MHz, VTS 1724 gives 30.0 fps; 63.84 MHz would
give 39.9 fps. A Surface Pro 7+ measures 30.01, 60.16 and 90.45 fps at
VTS 1724, 860 and 572, the same 48 MHz. Dave Stevenson saw the same on
a Raspberry Pi with a 24 MHz clock, where libcamera asked for 100 fps
and got 75, the ratio of the two rates.
Report 48 MHz for both link frequencies and drop the table.
Fixes: ed9566ce1946 ("media: i2c: Add support for new frequencies to ov7251")
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/linux-media/CAPY8ntBFJJPg3y46gC=bNq_55QifC7mKmeq8+pAEDVN42fGUXw@mail.gmail.com/
Signed-off-by: Antoine Pichot <antoine.pichot@gmail.com>
---
drivers/media/i2c/ov7251.c | 15 ++++++---------
1 file changed, 6 insertions(+), 9 deletions(-)
diff --git a/drivers/media/i2c/ov7251.c b/drivers/media/i2c/ov7251.c
index 1f30a01c85b3..2db6c28a6e34 100644
--- a/drivers/media/i2c/ov7251.c
+++ b/drivers/media/i2c/ov7251.c
@@ -22,6 +22,9 @@
#include <media/v4l2-fwnode.h>
#include <media/v4l2-subdev.h>
+/* PLL2 sys_clk: the pixel array clock at both link frequencies */
+#define OV7251_PIXEL_CLOCK 48000000
+
#define OV7251_SC_MODE_SELECT 0x0100
#define OV7251_SC_MODE_SELECT_SW_STANDBY 0x0
#define OV7251_SC_MODE_SELECT_STREAMING 0x1
@@ -633,11 +636,6 @@ static const s64 link_freq[] = {
[OV7251_LINK_FREQ_319_2_MHZ] = 319200000,
};
-static const s64 pixel_rates[] = {
- [OV7251_LINK_FREQ_240_MHZ] = 48000000,
- [OV7251_LINK_FREQ_319_2_MHZ] = 63840000,
-};
-
static const struct ov7251_mode_info ov7251_mode_info_data[] = {
{
.width = 640,
@@ -1567,7 +1565,6 @@ static int ov7251_detect_chip(struct ov7251 *ov7251)
static int ov7251_init_ctrls(struct ov7251 *ov7251)
{
int vblank_max, vblank_def;
- s64 pixel_rate;
int hblank;
v4l2_ctrl_handler_init(&ov7251->ctrls, 7);
@@ -1586,12 +1583,12 @@ static int ov7251_init_ctrls(struct ov7251 *ov7251)
ARRAY_SIZE(ov7251_test_pattern_menu) - 1,
0, 0, ov7251_test_pattern_menu);
- pixel_rate = pixel_rates[ov7251->link_freq_idx];
ov7251->pixel_clock = v4l2_ctrl_new_std(&ov7251->ctrls,
&ov7251_ctrl_ops,
V4L2_CID_PIXEL_RATE,
- pixel_rate, INT_MAX,
- pixel_rate, pixel_rate);
+ OV7251_PIXEL_CLOCK, INT_MAX,
+ OV7251_PIXEL_CLOCK,
+ OV7251_PIXEL_CLOCK);
ov7251->link_freq = v4l2_ctrl_new_int_menu(&ov7251->ctrls,
&ov7251_ctrl_ops,
V4L2_CID_LINK_FREQ,
--
2.56.0
next prev parent reply other threads:[~2026-10-28 11:22 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-28 11:21 [PATCH v2 0/9] media: i2c: ov7251: fixes and infrared strobe for Surface Book 2 Antoine Pichot
2026-10-28 11:21 ` [PATCH v2 1/9] media: i2c: ov7251: Use in-range PLL1 dividers for the 319.2 MHz link Antoine Pichot
2026-10-29 13:57 ` Andy Shevchenko
2026-10-29 19:06 ` Dave Stevenson
2026-10-28 11:21 ` [PATCH v2 2/9] media: i2c: ov7251: Fix link frequency index Antoine Pichot
2026-10-28 11:21 ` Antoine Pichot [this message]
2026-10-29 13:59 ` [PATCH v2 3/9] media: i2c: ov7251: Report the pixel array rate for both link frequencies Andy Shevchenko
2026-10-28 11:21 ` [PATCH v2 4/9] media: i2c: ov7251: Reset vblank when the frame interval changes Antoine Pichot
2026-10-28 11:21 ` [PATCH v2 5/9] media: i2c: ov7251: Use sub-device active state Antoine Pichot
2026-10-29 14:02 ` Andy Shevchenko
2026-10-28 11:21 ` [PATCH v2 6/9] media: i2c: ov7251: Add orientation and rotation controls Antoine Pichot
2026-10-28 11:21 ` [PATCH v2 7/9] media: i2c: ov7251: Move the strobe registers out of the mode tables Antoine Pichot
2026-10-28 11:21 ` [PATCH v2 8/9] media: i2c: ov7251: Add strobe output enable control Antoine Pichot
2026-10-28 11:21 ` [PATCH v2 9/9] media: ipu-bridge: Add a rotation quirk for the Surface Book 2 and Pro 7+ Antoine Pichot
2026-10-29 14:04 ` Andy Shevchenko
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=20261028112154.855185-4-antoine.pichot@gmail.com \
--to=antoine.pichot@gmail.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=dan.scally@ideasonboard.com \
--cc=dave.stevenson@raspberrypi.com \
--cc=djrscally@gmail.com \
--cc=dmanresa@gmail.com \
--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 \
--cc=stable@vger.kernel.org \
/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®