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
Subject: [PATCH v3 7/9] media: i2c: ov7251: Move the common registers into the global init table
Date: Fri, 13 Nov 2026 11:40:57 +0900 [thread overview]
Message-ID: <20261113024059.1087031-8-antoine.pichot@gmail.com> (raw)
In-Reply-To: <20261113024059.1087031-1-antoine.pichot@gmail.com>
From: Dave Stevenson <dave.stevenson@raspberrypi.com>
The three mode tables write the same 117 registers. Only the six clock
control registers 0x3016 to 0x301c differ between the 30 fps table and
the 60 and 90 fps ones, and the frame length (0x380e and 0x380f), which
the V4L2_CID_VBLANK handler writes anyway.
Move the common registers into ov7251_global_init_setting, written after
the software reset by ov7251_set_power_on(), and drop the frame length
from the mode tables, which keep the clock control registers only.
The common registers are thus written once per power-on instead of at
every stream start. The sensor keeps its register values in software
standby (datasheet table 2-8), so a stream restarted, or switched to
another mode, before the runtime PM autosuspend powers the sensor down
gets the same settings as a stream started from power-on.
One value on the bus changes: 0x3820 (TIMING_FORMAT1). The mode tables
wrote 0x40 (bit 6, vflip_blc) at stream start, but the vertical flip
control, applied after the table, rewrote the register from the value
probe had read right after the reset, 0x00, so the sensor streamed with
bit 6 clear. Probe now reads 0x40 from the init table and the control
keeps bit 6 set, as the mode tables have always asked for.
Tested on a Surface Book 2 (19.2 MHz clock, 319.2 MHz link): the clock,
timing, PLL, flip and strobe registers read back while streaming at
30, 60 and 90 fps are identical to those of the driver before this
change, except 0x3820, which reads 0x40 instead of 0x00 as described
above; stream restarts and mode switches on a sensor kept in software
standby give valid frames from the first one, at the expected rates.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
[antoine.pichot@gmail.com: subject and commit message, 0x3820 note]
Signed-off-by: Antoine Pichot <antoine.pichot@gmail.com>
---
drivers/media/i2c/ov7251.c | 258 ++-----------------------------------
1 file changed, 9 insertions(+), 249 deletions(-)
diff --git a/drivers/media/i2c/ov7251.c b/drivers/media/i2c/ov7251.c
index 834420f2f843..2abf1b112351 100644
--- a/drivers/media/i2c/ov7251.c
+++ b/drivers/media/i2c/ov7251.c
@@ -238,19 +238,10 @@ static const struct ov7251_pll_cfgs *ov7251_pll_cfgs[] = {
static const struct reg_value ov7251_global_init_setting[] = {
{ 0x0103, 0x01 },
{ 0x303b, 0x02 },
-};
-
-static const struct reg_value ov7251_setting_vga_30fps[] = {
{ 0x3005, 0x00 },
{ 0x3012, 0xc0 },
{ 0x3013, 0xd2 },
{ 0x3014, 0x04 },
- { 0x3016, 0xf0 },
- { 0x3017, 0xf0 },
- { 0x3018, 0xf0 },
- { 0x301a, 0xf0 },
- { 0x301b, 0xf0 },
- { 0x301c, 0xf0 },
{ 0x3023, 0x05 },
{ 0x3037, 0xf0 },
{ 0x3106, 0xda },
@@ -298,8 +289,6 @@ static const struct reg_value ov7251_setting_vga_30fps[] = {
{ 0x380b, 0xe0 }, /* height low */
{ 0x380c, 0x03 }, /* total horiz timing high */
{ 0x380d, 0xa0 }, /* total horiz timing low */
- { 0x380e, 0x06 }, /* total vertical timing high */
- { 0x380f, 0xbc }, /* total vertical timing low */
{ 0x3810, 0x00 },
{ 0x3811, 0x04 },
{ 0x3812, 0x00 },
@@ -368,260 +357,31 @@ static const struct reg_value ov7251_setting_vga_30fps[] = {
{ 0x5001, 0x80 },
};
+static const struct reg_value ov7251_setting_vga_30fps[] = {
+ { 0x3016, 0xf0 },
+ { 0x3017, 0xf0 },
+ { 0x3018, 0xf0 },
+ { 0x301a, 0xf0 },
+ { 0x301b, 0xf0 },
+ { 0x301c, 0xf0 },
+};
+
static const struct reg_value ov7251_setting_vga_60fps[] = {
- { 0x3005, 0x00 },
- { 0x3012, 0xc0 },
- { 0x3013, 0xd2 },
- { 0x3014, 0x04 },
{ 0x3016, 0x10 },
{ 0x3017, 0x00 },
{ 0x3018, 0x00 },
{ 0x301a, 0x00 },
{ 0x301b, 0x00 },
{ 0x301c, 0x00 },
- { 0x3023, 0x05 },
- { 0x3037, 0xf0 },
- { 0x3106, 0xda },
- { 0x3503, 0x07 },
- { 0x3509, 0x10 },
- { 0x3600, 0x1c },
- { 0x3602, 0x62 },
- { 0x3620, 0xb7 },
- { 0x3622, 0x04 },
- { 0x3626, 0x21 },
- { 0x3627, 0x30 },
- { 0x3630, 0x44 },
- { 0x3631, 0x35 },
- { 0x3634, 0x60 },
- { 0x3636, 0x00 },
- { 0x3662, 0x01 },
- { 0x3663, 0x70 },
- { 0x3664, 0x50 },
- { 0x3666, 0x0a },
- { 0x3669, 0x1a },
- { 0x366a, 0x00 },
- { 0x366b, 0x50 },
- { 0x3673, 0x01 },
- { 0x3674, 0xff },
- { 0x3675, 0x03 },
- { 0x3705, 0xc1 },
- { 0x3709, 0x40 },
- { 0x373c, 0x08 },
- { 0x3742, 0x00 },
- { 0x3757, 0xb3 },
- { 0x3788, 0x00 },
- { 0x37a8, 0x01 },
- { 0x37a9, 0xc0 },
- { 0x3800, 0x00 },
- { 0x3801, 0x04 },
- { 0x3802, 0x00 },
- { 0x3803, 0x04 },
- { 0x3804, 0x02 },
- { 0x3805, 0x8b },
- { 0x3806, 0x01 },
- { 0x3807, 0xeb },
- { 0x3808, 0x02 }, /* width high */
- { 0x3809, 0x80 }, /* width low */
- { 0x380a, 0x01 }, /* height high */
- { 0x380b, 0xe0 }, /* height low */
- { 0x380c, 0x03 }, /* total horiz timing high */
- { 0x380d, 0xa0 }, /* total horiz timing low */
- { 0x380e, 0x03 }, /* total vertical timing high */
- { 0x380f, 0x5c }, /* total vertical timing low */
- { 0x3810, 0x00 },
- { 0x3811, 0x04 },
- { 0x3812, 0x00 },
- { 0x3813, 0x05 },
- { 0x3814, 0x11 },
- { 0x3815, 0x11 },
- { 0x3820, 0x40 },
- { 0x3821, 0x00 },
- { 0x382f, 0x0e },
- { 0x3832, 0x00 },
- { 0x3833, 0x05 },
- { 0x3834, 0x00 },
- { 0x3835, 0x0c },
- { 0x3837, 0x00 },
- { 0x3b80, 0x00 },
- { 0x3b81, 0xa5 },
- { 0x3b82, 0x10 },
- { 0x3b83, 0x00 },
- { 0x3b84, 0x08 },
- { 0x3b85, 0x00 },
- { 0x3b86, 0x01 },
- { 0x3b87, 0x00 },
- { 0x3b88, 0x00 },
- { 0x3b89, 0x00 },
- { 0x3b8a, 0x00 },
- { 0x3b8b, 0x05 },
- { 0x3b8c, 0x00 },
- { 0x3b8d, 0x00 },
- { 0x3b8e, 0x00 },
- { 0x3b8f, 0x1a },
- { 0x3b94, 0x05 },
- { 0x3b95, 0xf2 },
- { 0x3b96, 0x40 },
- { 0x3c00, 0x89 },
- { 0x3c01, 0x63 },
- { 0x3c02, 0x01 },
- { 0x3c03, 0x00 },
- { 0x3c04, 0x00 },
- { 0x3c05, 0x03 },
- { 0x3c06, 0x00 },
- { 0x3c07, 0x06 },
- { 0x3c0c, 0x01 },
- { 0x3c0d, 0xd0 },
- { 0x3c0e, 0x02 },
- { 0x3c0f, 0x0a },
- { 0x4001, 0x42 },
- { 0x4004, 0x04 },
- { 0x4005, 0x00 },
- { 0x404e, 0x01 },
- { 0x4300, 0xff },
- { 0x4301, 0x00 },
- { 0x4315, 0x00 },
- { 0x4501, 0x48 },
- { 0x4600, 0x00 },
- { 0x4601, 0x4e },
- { 0x4801, 0x0f },
- { 0x4806, 0x0f },
- { 0x4819, 0xaa },
- { 0x4823, 0x3e },
- { 0x4837, 0x19 },
- { 0x4a0d, 0x00 },
- { 0x4a47, 0x7f },
- { 0x4a49, 0xf0 },
- { 0x4a4b, 0x30 },
- { 0x5000, 0x85 },
- { 0x5001, 0x80 },
};
static const struct reg_value ov7251_setting_vga_90fps[] = {
- { 0x3005, 0x00 },
- { 0x3012, 0xc0 },
- { 0x3013, 0xd2 },
- { 0x3014, 0x04 },
{ 0x3016, 0x10 },
{ 0x3017, 0x00 },
{ 0x3018, 0x00 },
{ 0x301a, 0x00 },
{ 0x301b, 0x00 },
{ 0x301c, 0x00 },
- { 0x3023, 0x05 },
- { 0x3037, 0xf0 },
- { 0x3106, 0xda },
- { 0x3503, 0x07 },
- { 0x3509, 0x10 },
- { 0x3600, 0x1c },
- { 0x3602, 0x62 },
- { 0x3620, 0xb7 },
- { 0x3622, 0x04 },
- { 0x3626, 0x21 },
- { 0x3627, 0x30 },
- { 0x3630, 0x44 },
- { 0x3631, 0x35 },
- { 0x3634, 0x60 },
- { 0x3636, 0x00 },
- { 0x3662, 0x01 },
- { 0x3663, 0x70 },
- { 0x3664, 0x50 },
- { 0x3666, 0x0a },
- { 0x3669, 0x1a },
- { 0x366a, 0x00 },
- { 0x366b, 0x50 },
- { 0x3673, 0x01 },
- { 0x3674, 0xff },
- { 0x3675, 0x03 },
- { 0x3705, 0xc1 },
- { 0x3709, 0x40 },
- { 0x373c, 0x08 },
- { 0x3742, 0x00 },
- { 0x3757, 0xb3 },
- { 0x3788, 0x00 },
- { 0x37a8, 0x01 },
- { 0x37a9, 0xc0 },
- { 0x3800, 0x00 },
- { 0x3801, 0x04 },
- { 0x3802, 0x00 },
- { 0x3803, 0x04 },
- { 0x3804, 0x02 },
- { 0x3805, 0x8b },
- { 0x3806, 0x01 },
- { 0x3807, 0xeb },
- { 0x3808, 0x02 }, /* width high */
- { 0x3809, 0x80 }, /* width low */
- { 0x380a, 0x01 }, /* height high */
- { 0x380b, 0xe0 }, /* height low */
- { 0x380c, 0x03 }, /* total horiz timing high */
- { 0x380d, 0xa0 }, /* total horiz timing low */
- { 0x380e, 0x02 }, /* total vertical timing high */
- { 0x380f, 0x3c }, /* total vertical timing low */
- { 0x3810, 0x00 },
- { 0x3811, 0x04 },
- { 0x3812, 0x00 },
- { 0x3813, 0x05 },
- { 0x3814, 0x11 },
- { 0x3815, 0x11 },
- { 0x3820, 0x40 },
- { 0x3821, 0x00 },
- { 0x382f, 0x0e },
- { 0x3832, 0x00 },
- { 0x3833, 0x05 },
- { 0x3834, 0x00 },
- { 0x3835, 0x0c },
- { 0x3837, 0x00 },
- { 0x3b80, 0x00 },
- { 0x3b81, 0xa5 },
- { 0x3b82, 0x10 },
- { 0x3b83, 0x00 },
- { 0x3b84, 0x08 },
- { 0x3b85, 0x00 },
- { 0x3b86, 0x01 },
- { 0x3b87, 0x00 },
- { 0x3b88, 0x00 },
- { 0x3b89, 0x00 },
- { 0x3b8a, 0x00 },
- { 0x3b8b, 0x05 },
- { 0x3b8c, 0x00 },
- { 0x3b8d, 0x00 },
- { 0x3b8e, 0x00 },
- { 0x3b8f, 0x1a },
- { 0x3b94, 0x05 },
- { 0x3b95, 0xf2 },
- { 0x3b96, 0x40 },
- { 0x3c00, 0x89 },
- { 0x3c01, 0x63 },
- { 0x3c02, 0x01 },
- { 0x3c03, 0x00 },
- { 0x3c04, 0x00 },
- { 0x3c05, 0x03 },
- { 0x3c06, 0x00 },
- { 0x3c07, 0x06 },
- { 0x3c0c, 0x01 },
- { 0x3c0d, 0xd0 },
- { 0x3c0e, 0x02 },
- { 0x3c0f, 0x0a },
- { 0x4001, 0x42 },
- { 0x4004, 0x04 },
- { 0x4005, 0x00 },
- { 0x404e, 0x01 },
- { 0x4300, 0xff },
- { 0x4301, 0x00 },
- { 0x4315, 0x00 },
- { 0x4501, 0x48 },
- { 0x4600, 0x00 },
- { 0x4601, 0x4e },
- { 0x4801, 0x0f },
- { 0x4806, 0x0f },
- { 0x4819, 0xaa },
- { 0x4823, 0x3e },
- { 0x4837, 0x19 },
- { 0x4a0d, 0x00 },
- { 0x4a47, 0x7f },
- { 0x4a49, 0xf0 },
- { 0x4a4b, 0x30 },
- { 0x5000, 0x85 },
- { 0x5001, 0x80 },
};
static const unsigned long supported_xclk_rates[] = {
--
2.56.0
next prev parent reply other threads:[~2026-11-13 2:42 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-13 2:40 [PATCH v3 0/9] media: i2c: ov7251: fixes and infrared strobe for Surface Book 2 Antoine Pichot
2026-11-13 2:40 ` [PATCH v3 1/9] media: i2c: ov7251: Use in-range PLL1 dividers for the 319.2 MHz link Antoine Pichot
2026-11-13 2:40 ` [PATCH v3 2/9] media: i2c: ov7251: Fix link frequency index Antoine Pichot
2026-11-13 2:40 ` [PATCH v3 3/9] media: i2c: ov7251: Report the pixel array rate for both link frequencies Antoine Pichot
2026-11-13 2:40 ` [PATCH v3 4/9] media: i2c: ov7251: Reset vblank when the frame interval changes Antoine Pichot
2026-11-13 2:40 ` [PATCH v3 5/9] media: i2c: ov7251: Use sub-device active state Antoine Pichot
2026-11-13 2:40 ` [PATCH v3 6/9] media: i2c: ov7251: Add orientation and rotation controls Antoine Pichot
2026-11-13 2:40 ` Antoine Pichot [this message]
2026-11-13 2:40 ` [PATCH v3 8/9] media: i2c: ov7251: Add strobe output enable control Antoine Pichot
2026-11-13 2:40 ` [PATCH v3 9/9] media: ipu-bridge: Add a rotation quirk for the Surface Book 2 and Pro 7+ Antoine Pichot
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=20261113024059.1087031-8-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 \
/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®