From: Felipe Calliari <calliarifelipe@gmail.com>
To: linux-media@vger.kernel.org
Cc: Sakari Ailus <sakari.ailus@linux.intel.com>,
Hans de Goede <hansg@kernel.org>,
Bryan O'Donoghue <bod@kernel.org>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
Dan Scally <dan.scally@ideasonboard.com>,
Tomas Moro <tmorolias@gmail.com>,
linux-kernel@vger.kernel.org,
Felipe Calliari <calliarifelipe@gmail.com>
Subject: [PATCH v4 3/5] media: ov02c10: Split the PLL registers off the mode tables
Date: Mon, 26 Oct 2026 00:50:13 -0300 [thread overview]
Message-ID: <20261026035015.110903-4-calliarifelipe@gmail.com> (raw)
In-Reply-To: <20261026035015.110903-1-calliarifelipe@gmail.com>
Both per-lane tables end with the same "plls" block, which sets 0x0303,
0x0305 and 0x0316 to 0x05, 0x90 and 0x90, overriding the 0x06 and 0xe0
that the common mode table writes to 0x0303 and 0x0305.
These PLL settings determine the link frequency and the pixel rate, not
the lane count. Move the block into a table of its own, and tie it to
the link frequency through a new link_freq_configs[] array, indexed like
link_freq_menu_items[]. Write the table right after the common table,
so it still overrides 0x0303 and 0x0305, and before the per-lane table,
so 0x3016 is still written after it.
This prepares for link frequencies obtained from other external clock
rates than 19.2 MHz.
No functional change intended: the same values are written to the same
registers, and the common table is left unchanged. Only the per-lane
registers other than 0x3016 are now written after the PLL registers
instead of before them.
Signed-off-by: Felipe Calliari <calliarifelipe@gmail.com>
---
Notes:
Changes in v4:
- Tie the PLL table to the link frequency, through a link_freq_configs[]
array indexed like link_freq_menu_items[], instead of naming it after
the 19.2 MHz external clock (Sakari).
- Leave the common table alone, including its 0x0303 = 0x06 and
0x0305 = 0xe0 writes, and only move the "plls" block of the per-lane
tables, so every register write is kept (Sakari).
Changes in v3:
- New patch, as asked by Sakari.
drivers/media/i2c/ov02c10.c | 35 +++++++++++++++++++++++++++++------
1 file changed, 29 insertions(+), 6 deletions(-)
diff --git a/drivers/media/i2c/ov02c10.c b/drivers/media/i2c/ov02c10.c
index e24cd8705..62ea20dc5 100644
--- a/drivers/media/i2c/ov02c10.c
+++ b/drivers/media/i2c/ov02c10.c
@@ -303,10 +303,6 @@ static const struct reg_sequence sensor_1928x1092_30fps_1lane_setting[] = {
{0x394e, 0x0b},
{0x4800, 0x24},
{0x5000, 0xf5},
- /* plls */
- {0x0303, 0x05},
- {0x0305, 0x90},
- {0x0316, 0x90},
{0x3016, 0x12},
};
@@ -330,11 +326,14 @@ static const struct reg_sequence sensor_1928x1092_30fps_2lane_setting[] = {
{0x4d0d, 0x00},
{0x5000, 0xfd},
{0x481f, 0x30},
- /* plls */
+ {0x3016, 0x32},
+};
+
+/* 400 MHz link frequency from a 19.2 MHz external clock */
+static const struct reg_sequence sensor_pll_400mhz_setting[] = {
{0x0303, 0x05},
{0x0305, 0x90},
{0x0316, 0x90},
- {0x3016, 0x32},
};
static const char * const ov02c10_test_pattern_menu[] = {
@@ -349,6 +348,20 @@ static const s64 link_freq_menu_items[] = {
OV02C10_LINK_FREQ_400MHZ,
};
+struct ov02c10_link_freq_config {
+ /* PLL register settings, which set the link frequency */
+ const struct reg_sequence *pll_settings;
+ int pll_settings_length;
+};
+
+/* Indexed like link_freq_menu_items[] */
+static const struct ov02c10_link_freq_config link_freq_configs[] = {
+ {
+ .pll_settings = sensor_pll_400mhz_setting,
+ .pll_settings_length = ARRAY_SIZE(sensor_pll_400mhz_setting),
+ },
+};
+
static const struct ov02c10_mode supported_modes[] = {
{
.width = 1928,
@@ -594,6 +607,8 @@ static int ov02c10_enable_streams(struct v4l2_subdev *sd,
{
const struct ov02c10_mode *mode = &supported_modes[0];
struct ov02c10 *ov02c10 = to_ov02c10(sd);
+ const struct ov02c10_link_freq_config *link_freq_config =
+ &link_freq_configs[ov02c10->link_freq_index];
const struct reg_sequence *reg_sequence;
int ret, sequence_length;
@@ -610,6 +625,14 @@ static int ov02c10_enable_streams(struct v4l2_subdev *sd,
goto out;
}
+ ret = regmap_multi_reg_write(ov02c10->regmap,
+ link_freq_config->pll_settings,
+ link_freq_config->pll_settings_length);
+ if (ret) {
+ dev_err(ov02c10->dev, "failed to write PLL settings\n");
+ goto out;
+ }
+
reg_sequence = mode->lane_settings[ov02c10->mipi_lanes - 1];
sequence_length = mode->lane_settings_length[ov02c10->mipi_lanes - 1];
ret = regmap_multi_reg_write(ov02c10->regmap,
--
2.56.0
next prev parent reply other threads:[~2026-10-26 3:50 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <Tms-fUHfw0sPf1-YX_rgSNq7z1MNyvtfCImHXhxAUQAoTq-fwKvZF-p8a3ozCxAJ7kJCo-lKEU_JSkfUJy6oIA==@protonmail.internalid>
2026-09-05 3:07 ` [PATCH 1/3] media: ov02c10: Drop duplicate register write Felipe Calliari
2026-09-05 3:07 ` [PATCH 2/3] media: ov02c10: Implement get_selection Felipe Calliari
2026-09-08 9:07 ` Bryan O'Donoghue
2026-09-05 3:07 ` [PATCH 3/3] media: ov02c10: Accept a 26 MHz external clock Felipe Calliari
2026-09-08 8:06 ` Sakari Ailus
2026-09-09 2:55 ` Felipe Calliari
2026-09-08 9:21 ` Bryan O'Donoghue
2026-09-22 6:35 ` Tomas Moro
2026-09-08 9:04 ` [PATCH 1/3] media: ov02c10: Drop duplicate register write Bryan O'Donoghue
2026-09-23 14:42 ` [PATCH v2 0/3] media: ov02c10: get_selection and 26 MHz clock support Felipe Calliari
2026-09-23 14:42 ` [PATCH v2 1/3] media: ov02c10: Drop duplicate register write Felipe Calliari
2026-09-23 14:42 ` [PATCH v2 2/3] media: ov02c10: Implement get_selection Felipe Calliari
2026-09-23 14:42 ` [PATCH v2 3/3] media: ov02c10: Accept a 26 MHz external clock Felipe Calliari
2026-09-23 20:54 ` Sakari Ailus
2026-09-23 23:40 ` [PATCH v3 0/5] media: ov02c10: get_selection and 26 MHz clock support Felipe Calliari
2026-09-23 23:40 ` [PATCH v3 1/5] media: ov02c10: Drop duplicate register write Felipe Calliari
2026-09-23 23:40 ` [PATCH v3 2/5] media: ov02c10: Implement get_selection Felipe Calliari
2026-09-23 23:40 ` [PATCH v3 3/5] media: ov02c10: Split the PLL registers off the mode tables Felipe Calliari
2026-10-02 20:46 ` Sakari Ailus
2026-10-26 3:44 ` Felipe Calliari
2026-09-23 23:40 ` [PATCH v3 4/5] media: ipu-bridge: Add the OV02C10 26 MHz link frequency Felipe Calliari
2026-09-23 23:41 ` [PATCH v3 5/5] media: ov02c10: Add support for a 26 MHz external clock Felipe Calliari
2026-10-26 3:50 ` [PATCH v4 0/5] media: ov02c10: get_selection and 26 MHz clock support Felipe Calliari
2026-10-26 3:50 ` [PATCH v4 1/5] media: ov02c10: Drop duplicate register write Felipe Calliari
2026-10-26 3:50 ` [PATCH v4 2/5] media: ov02c10: Implement get_selection Felipe Calliari
2026-10-26 3:50 ` Felipe Calliari [this message]
2026-10-26 3:50 ` [PATCH v4 4/5] media: ipu-bridge: Add the OV02C10 26 MHz link frequency Felipe Calliari
2026-10-26 3:50 ` [PATCH v4 5/5] media: ov02c10: Add support for a 26 MHz external clock Felipe Calliari
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=20261026035015.110903-4-calliarifelipe@gmail.com \
--to=calliarifelipe@gmail.com \
--cc=bod@kernel.org \
--cc=dan.scally@ideasonboard.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=tmorolias@gmail.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®