linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hans de Goede <hansg@kernel.org>
To: Bingbu Cao <bingbu.cao@intel.com>,
	Sakari Ailus <sakari.ailus@linux.intel.com>
Cc: Hans de Goede <hansg@kernel.org>, linux-media@vger.kernel.org
Subject: [PATCH 25/25] media: i2c: ov01a10: Register tweaks for ov01a1s model
Date: Tue, 14 Oct 2025 19:40:33 +0200	[thread overview]
Message-ID: <20251014174033.20534-26-hansg@kernel.org> (raw)
In-Reply-To: <20251014174033.20534-1-hansg@kernel.org>

The out of tree drivers from:
https://github.com/intel/ipu6-drivers/tree/master/drivers/media/i2c

Have a separate driver for the ov01a1s. This driver is 95% the same as
the ov01a10 driver (same sensor, different color-filters) but there are
a couple of registers for which the out of tree ov01a1s driver uses
different values.

Add a per model reg_sequence to struct ov01a10_sensor_cfg and apply
the register tweaks from the out of tree driver to the ov01a1s model.

Signed-off-by: Hans de Goede <hansg@kernel.org>
---
 drivers/media/i2c/ov01a10.c | 28 ++++++++++++++++++++++++++--
 1 file changed, 26 insertions(+), 2 deletions(-)

diff --git a/drivers/media/i2c/ov01a10.c b/drivers/media/i2c/ov01a10.c
index 058ff311a289..08cab1e4be1d 100644
--- a/drivers/media/i2c/ov01a10.c
+++ b/drivers/media/i2c/ov01a10.c
@@ -161,7 +161,6 @@ static const struct reg_sequence ov01a10_global_setting[] = {
 	{0x3815, 0x01},
 	{0x3816, 0x01},
 	{0x3817, 0x01},
-	{0x3822, 0x13},
 	{0x3832, 0x28},
 	{0x3833, 0x10},
 	{0x3b00, 0x00},
@@ -186,7 +185,6 @@ static const struct reg_sequence ov01a10_global_setting[] = {
 	{0x4800, 0x64},
 	{0x481f, 0x34},
 	{0x4825, 0x33},
-	{0x4837, 0x11},
 	{0x4881, 0x40},
 	{0x4883, 0x01},
 	{0x4890, 0x00},
@@ -203,6 +201,17 @@ static const struct reg_sequence ov01a10_global_setting[] = {
 	{0x0325, 0xc2},
 };
 
+static const struct reg_sequence ov01a10_regs[] = {
+	{0x3822, 0x13},
+	{0x4837, 0x11},
+};
+
+static const struct reg_sequence ov01a1s_regs[] = {
+	{0x3822, 0x03},
+	{0x4837, 0x14},
+	{0x373d, 0x24},
+};
+
 static const char * const ov01a10_test_pattern_menu[] = {
 	"Disabled",
 	"Color Bar",
@@ -237,6 +246,8 @@ static const char * const ov01a10_supply_names[] = {
 
 struct ov01a10_sensor_cfg {
 	const char *model;
+	const struct reg_sequence *regs;
+	int regs_len;
 	u32 bus_fmt;
 	int pattern_size;
 	int border_size;
@@ -551,6 +562,7 @@ static int ov01a10_set_mode(struct ov01a10 *ov01a10)
 
 static int ov01a10_start_streaming(struct ov01a10 *ov01a10)
 {
+	const struct ov01a10_sensor_cfg *cfg = ov01a10->cfg;
 	const struct ov01a10_link_freq_config *freq_cfg;
 	int ret;
 
@@ -569,6 +581,12 @@ static int ov01a10_start_streaming(struct ov01a10 *ov01a10)
 		return ret;
 	}
 
+	ret = regmap_multi_reg_write(ov01a10->regmap, cfg->regs, cfg->regs_len);
+	if (ret) {
+		dev_err(ov01a10->dev, "failed to write sensor regs\n");
+		return ret;
+	}
+
 	ret = ov01a10_set_mode(ov01a10);
 	if (ret) {
 		dev_err(ov01a10->dev, "failed to set mode\n");
@@ -1095,6 +1113,8 @@ static DEFINE_RUNTIME_DEV_PM_OPS(ov01a10_pm_ops, ov01a10_power_off,
  */
 static const struct ov01a10_sensor_cfg ov01a10_cfg = {
 	.model = "ov01a10",
+	.regs = ov01a10_regs,
+	.regs_len = ARRAY_SIZE(ov01a10_regs),
 	.bus_fmt = MEDIA_BUS_FMT_SBGGR10_1X10,
 	.pattern_size = 2, /* 2x2 */
 	.border_size = 2,
@@ -1105,6 +1125,8 @@ static const struct ov01a10_sensor_cfg ov01a10_cfg = {
 
 static const struct ov01a10_sensor_cfg ov01a1b_cfg = {
 	.model = "ov01a1b",
+	.regs = ov01a10_regs,
+	.regs_len = ARRAY_SIZE(ov01a10_regs),
 	.bus_fmt = MEDIA_BUS_FMT_Y10_1X10,
 	.pattern_size = 2, /* Keep coordinates aligned to a multiple of 2 */
 	.border_size = 0,
@@ -1119,6 +1141,8 @@ static const struct ov01a10_sensor_cfg ov01a1b_cfg = {
  */
 static const struct ov01a10_sensor_cfg ov01a1s_cfg = {
 	.model = "ov01a1s",
+	.regs = ov01a1s_regs,
+	.regs_len = ARRAY_SIZE(ov01a1s_regs),
 	/*
 	 * FIXME this obviously is wrong, this needs to be changed to
 	 * MEDIA_BUS_FMT_RAW10_1x10 + reporting the proper bayer-order through
-- 
2.51.0


  parent reply	other threads:[~2025-10-14 17:41 UTC|newest]

Thread overview: 65+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-14 17:40 [PATCH 00/25] media: i2c: ov01a10: Add crop, ov01a1b and ov01a1s support Hans de Goede
2025-10-14 17:40 ` [PATCH 01/25] media: i2c: ov01a10: Fix the horizontal flip control Hans de Goede
2025-10-27 19:00   ` Mehdi Djait
2025-10-14 17:40 ` [PATCH 02/25] media: i2c: ov01a10: Fix reported pixel-rate value Hans de Goede
2025-10-27 19:03   ` Mehdi Djait
2025-10-14 17:40 ` [PATCH 03/25] media: i2c: ov01a10: Fix gain range Hans de Goede
2025-10-27 19:14   ` Mehdi Djait
2025-10-14 17:40 ` [PATCH 04/25] media: i2c: ov01a10: Add missing v4l2_subdev_cleanup() calls Hans de Goede
2025-10-15  2:37   ` Bingbu Cao
2025-10-15  2:46   ` Bingbu Cao
2025-10-28 11:24   ` Mehdi Djait
2025-10-14 17:40 ` [PATCH 05/25] media: i2c: ov01a10: Fix passing stream instead of pad to v4l2_subdev_state_get_format() Hans de Goede
2025-10-28 11:40   ` Mehdi Djait
2025-10-14 17:40 ` [PATCH 06/25] media: i2c: ov01a10: Fix test-pattern disabling Hans de Goede
2025-10-15  2:34   ` Bingbu Cao
2025-10-28 12:08   ` Mehdi Djait
2025-10-28 14:38     ` Hans de Goede
2025-10-28 15:38       ` Mehdi Djait
2025-10-28 15:52         ` Hans de Goede
2025-10-29 17:44           ` Mehdi Djait
2025-10-14 17:40 ` [PATCH 07/25] media: i2c: ov01a10: Change default vblank value to a vblank resulting in 30 fps Hans de Goede
2025-10-28 16:57   ` Mehdi Djait
2025-10-14 17:40 ` [PATCH 08/25] media: i2c: ov01a10: Convert to new CCI register access helpers Hans de Goede
2025-10-28 17:01   ` Mehdi Djait
2025-10-14 17:40 ` [PATCH 09/25] media: i2c: ov01a10: Remove overly verbose probe() error reporting Hans de Goede
2025-10-28 17:02   ` Mehdi Djait
2025-10-14 17:40 ` [PATCH 10/25] media: i2c: ov01a10: Store dev pointer in struct ov01a10 Hans de Goede
2025-10-28 17:18   ` Mehdi Djait
2025-10-14 17:40 ` [PATCH 11/25] media: i2c: ov01a10: Add ov01a10_check_hwcfg() function Hans de Goede
2025-10-28 17:29   ` Mehdi Djait
2025-10-28 20:09     ` Hans de Goede
2025-10-29 17:30       ` Mehdi Djait
2025-10-14 17:40 ` [PATCH 12/25] media: i2c: ov01a10: Add power on/off sequencing support Hans de Goede
2025-10-28 18:06   ` Mehdi Djait
2025-10-14 17:40 ` [PATCH 13/25] media: i2c: ov01a10: Don't update pixel_rate and link_freq from set_fmt Hans de Goede
2025-10-28 18:15   ` Mehdi Djait
2025-10-14 17:40 ` [PATCH 14/25] media: i2c: ov01a10: Move setting of ctrl->flags to after checking ctrl_hdlr->error Hans de Goede
2025-10-28 18:18   ` Mehdi Djait
2025-10-14 17:40 ` [PATCH 15/25] media: i2c: ov01a10: Use native and default for pixel-array size names Hans de Goede
2025-10-28 19:01   ` Mehdi Djait
2025-10-28 20:19     ` Hans de Goede
2025-10-14 17:40 ` [PATCH 16/25] media: i2c: ov01a10: Add cropping support / allow arbitrary sizes Hans de Goede
2025-11-06 15:28   ` Mehdi Djait
2025-10-14 17:40 ` [PATCH 17/25] media: i2c: ov01a10: Remove struct ov01a10_reg_list Hans de Goede
2025-10-28 19:13   ` Mehdi Djait
2025-10-14 17:40 ` [PATCH 18/25] media: i2c: ov01a10: Replace exposure->min/step with direct define use Hans de Goede
2025-10-28 19:19   ` Mehdi Djait
2025-10-14 17:40 ` [PATCH 19/25] media: i2c: ov01a10: Only set register 0x0305 once Hans de Goede
2025-10-28 19:25   ` Mehdi Djait
2025-10-14 17:40 ` [PATCH 20/25] media: i2c: ov01a10: Remove values set by controls from global_setting[] Hans de Goede
2025-10-29 17:50   ` Mehdi Djait
2025-10-14 17:40 ` [PATCH 21/25] media: i2c: ov01a10: Add ov01a10_sensor_cfg struct Hans de Goede
2025-11-06 15:33   ` Mehdi Djait
2025-10-14 17:40 ` [PATCH 22/25] media: i2c: ov01a10: Optimize setting h/vflip values Hans de Goede
2025-11-06 15:54   ` Mehdi Djait
2025-10-14 17:40 ` [PATCH 23/25] media: i2c: ov01a10: Add ov01a1b support Hans de Goede
2025-11-06 16:16   ` Mehdi Djait
2025-10-14 17:40 ` [PATCH 24/25] media: i2c: ov01a10: Add ov01a1s support Hans de Goede
2025-11-06 16:17   ` Mehdi Djait
2025-10-14 17:40 ` Hans de Goede [this message]
2025-10-15 10:45   ` [PATCH 25/25] media: i2c: ov01a10: Register tweaks for ov01a1s model kernel test robot
2025-11-07  9:17   ` Mehdi Djait
2025-11-13  9:54     ` Hans de Goede
2025-11-17  8:17       ` Mehdi Djait
2025-10-28 20:06 ` [PATCH 00/25] media: i2c: ov01a10: Add crop, ov01a1b and ov01a1s support Hans de Goede

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=20251014174033.20534-26-hansg@kernel.org \
    --to=hansg@kernel.org \
    --cc=bingbu.cao@intel.com \
    --cc=linux-media@vger.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;
as well as URLs for NNTP newsgroup(s).