* [PATCH v3 0/4] media: i2c: ov7251: software reset settle, autosuspend, and non-continuous clock
@ 2026-11-30 20:10 Robert Ijtsma via B4 Relay
2026-11-30 20:10 ` [PATCH v3 1/4] media: i2c: ov7251: wait for software reset before global init Robert Ijtsma via B4 Relay
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Robert Ijtsma via B4 Relay @ 2026-11-30 20:10 UTC (permalink / raw)
To: Sakari Ailus, Mauro Carvalho Chehab, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Jacopo Mondi, Todor Tomov,
Daniel Scally, Andy Shevchenko
Cc: Antoine Pichot, Dave Stevenson, linux-media, devicetree,
linux-kernel, Robert Ijtsma, Mauro Carvalho Chehab
This series adds four small fixes and Qualcomm SC8180X enablement
changes for the OmniVision OV7251 sensor binding and driver, rebased on
top of Antoine Pichot's v3 OV7251 series [1]:
1. Issue software reset (0x0103 = 0x01) explicitly in
ov7251_set_power_on() and wait 5-10 ms before writing
ov7251_global_init_setting[] so the sensor settles before the common
register block is programmed.
2. Use pm_runtime_put_autosuspend() in ov7251_s_ctrl() and
ov7251_s_stream() so the 1000 ms autosuspend window configured in
probe is actually honored across stream restarts (preserving the
common register state introduced in [1]).
3. Allow clock-noncontinuous on the CSI-2 endpoint in the ovti,ov7251
Devicetree binding.
4. Support V4L2_MBUS_CSI2_NONCONTINUOUS_CLOCK by setting
CLOCK_LANE_GATE (BIT(5)) in OV7251_MIPI_CTRL00 (0x4800) during
power-on when requested by the CSI-2 endpoint.
[1] https://lore.kernel.org/linux-media/20261113024059.1087031-1-antoine.pichot@gmail.com/
Signed-off-by: Robert Ijtsma <robertijtsma@gmail.com>
---
Changes in v3:
- Add patch 3/4 documenting clock-noncontinuous on the ovti,ov7251
CSI-2 endpoint binding (Sakari Ailus).
- Collect Antoine Pichot's Tested-by tag on patch 2/4.
- Link to v2: https://patch.msgid.link/20261128-ov7251-strobe-ncont-v2-0-9428bbb6347e@gmail.com
Based-on: 20261113024059.1087031-1-antoine.pichot@gmail.com
Changes in v2:
- Rebase onto Antoine Pichot's v3 OV7251 series and drop patch 4/4
(V4L2_CID_FLASH_STROBE_OE) in favor of Antoine's strobe control patch
(Antoine Pichot).
- Move the software reset (0x0103 = 0x01) out of
ov7251_global_init_setting[] and wait 5-10 ms before writing the
global init table rather than after it (Antoine Pichot).
- Drop redundant pm_runtime_mark_last_busy() calls before
pm_runtime_put_autosuspend() and point Fixes tag at commit
207f4162f1c9 (Antoine Pichot).
- Program OV7251_MIPI_CTRL00 non-continuous clock gating once per
power-on alongside the global init registers.
- Link to v1: https://patch.msgid.link/20261127-ov7251-strobe-ncont-v1-0-cefa8c6c020b@gmail.com
To: Sakari Ailus <sakari.ailus@linux.intel.com>
To: Mauro Carvalho Chehab <mchehab@kernel.org>
To: Jacopo Mondi <jacopo@jmondi.org>
To: Todor Tomov <todor.too@gmail.com>
To: Daniel Scally <djrscally@gmail.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Rob Herring <robh@kernel.org>
To: Krzysztof Kozlowski <krzk+dt@kernel.org>
To: Conor Dooley <conor+dt@kernel.org>
Cc: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Cc: linux-media@vger.kernel.org
Cc: devicetree@vger.kernel.org
---
Robert Ijtsma (4):
media: i2c: ov7251: wait for software reset before global init
media: i2c: ov7251: use pm_runtime_put_autosuspend()
media: dt-bindings: ovti,ov7251: allow clock-noncontinuous
media: i2c: ov7251: support non-continuous MIPI clock mode
.../devicetree/bindings/media/i2c/ovti,ov7251.yaml | 2 +
drivers/media/i2c/ov7251.c | 45 ++++++++++++++++++----
2 files changed, 39 insertions(+), 8 deletions(-)
---
base-commit: 299860c8390892ac175e8d3e13aa5b086c735dd1
change-id: 20261127-ov7251-strobe-ncont-188241b553be
Best regards,
--
Robert Ijtsma <robertijtsma@gmail.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v3 1/4] media: i2c: ov7251: wait for software reset before global init
2026-11-30 20:10 [PATCH v3 0/4] media: i2c: ov7251: software reset settle, autosuspend, and non-continuous clock Robert Ijtsma via B4 Relay
@ 2026-11-30 20:10 ` Robert Ijtsma via B4 Relay
2026-11-30 20:10 ` [PATCH v3 2/4] media: i2c: ov7251: use pm_runtime_put_autosuspend() Robert Ijtsma via B4 Relay
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Robert Ijtsma via B4 Relay @ 2026-11-30 20:10 UTC (permalink / raw)
To: Sakari Ailus, Mauro Carvalho Chehab, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Jacopo Mondi, Todor Tomov,
Daniel Scally, Andy Shevchenko
Cc: Antoine Pichot, Dave Stevenson, linux-media, devicetree,
linux-kernel, Robert Ijtsma, Mauro Carvalho Chehab
From: Robert Ijtsma <robertijtsma@gmail.com>
ov7251_set_power_on() writes software reset (0x0103 = 0x01) as the first
entry of ov7251_global_init_setting[] and immediately follows it with
the remaining common initialization registers.
Issue OV7251_SC_SOFTWARE_RESET explicitly and wait 5-10 ms for the
sensor to finish resetting before writing ov7251_global_init_setting[]
so subsequent I2C writes are not NACKed or lost during reset.
Fixes: d30bb512da3d ("media: Add a driver for the ov7251 camera sensor")
Signed-off-by: Robert Ijtsma <robertijtsma@gmail.com>
---
drivers/media/i2c/ov7251.c | 21 ++++++++++++++++-----
1 file changed, 16 insertions(+), 5 deletions(-)
diff --git a/drivers/media/i2c/ov7251.c b/drivers/media/i2c/ov7251.c
index 9e9bbee998ad..393260929f29 100644
--- a/drivers/media/i2c/ov7251.c
+++ b/drivers/media/i2c/ov7251.c
@@ -30,6 +30,8 @@
#define OV7251_SC_MODE_SELECT 0x0100
#define OV7251_SC_MODE_SELECT_SW_STANDBY 0x0
#define OV7251_SC_MODE_SELECT_STREAMING 0x1
+#define OV7251_SC_SOFTWARE_RESET 0x0103
+#define OV7251_SC_SOFTWARE_RESET_ASSERT 0x01
#define OV7251_CHIP_ID_HIGH 0x300a
#define OV7251_CHIP_ID_HIGH_BYTE 0x77
@@ -248,7 +250,6 @@ static const struct ov7251_pll_cfgs *ov7251_pll_cfgs[] = {
};
static const struct reg_value ov7251_global_init_setting[] = {
- { 0x0103, 0x01 },
{ 0x303b, 0x02 },
{ 0x3005, 0x00 },
{ 0x3012, 0xc0 },
@@ -698,17 +699,27 @@ static int ov7251_set_power_on(struct device *dev)
DIV_ROUND_UP(ov7251->xclk_freq, 1000));
usleep_range(wait_us, wait_us + 1000);
+ ret = ov7251_write_reg(ov7251, OV7251_SC_SOFTWARE_RESET,
+ OV7251_SC_SOFTWARE_RESET_ASSERT);
+ if (ret < 0)
+ goto err_power_off;
+
+ usleep_range(5000, 10000);
+
ret = ov7251_set_register_array(ov7251,
ov7251_global_init_setting,
ARRAY_SIZE(ov7251_global_init_setting));
if (ret < 0) {
dev_err(ov7251->dev, "error during global init\n");
- gpiod_set_value_cansleep(ov7251->enable_gpio, 0);
- clk_disable_unprepare(ov7251->xclk);
- ov7251_regulators_disable(ov7251);
- return ret;
+ goto err_power_off;
}
+ return 0;
+
+err_power_off:
+ gpiod_set_value_cansleep(ov7251->enable_gpio, 0);
+ clk_disable_unprepare(ov7251->xclk);
+ ov7251_regulators_disable(ov7251);
return ret;
}
--
2.56.0
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v3 2/4] media: i2c: ov7251: use pm_runtime_put_autosuspend()
2026-11-30 20:10 [PATCH v3 0/4] media: i2c: ov7251: software reset settle, autosuspend, and non-continuous clock Robert Ijtsma via B4 Relay
2026-11-30 20:10 ` [PATCH v3 1/4] media: i2c: ov7251: wait for software reset before global init Robert Ijtsma via B4 Relay
@ 2026-11-30 20:10 ` Robert Ijtsma via B4 Relay
2026-11-30 20:10 ` [PATCH v3 3/4] media: dt-bindings: ovti,ov7251: allow clock-noncontinuous Robert Ijtsma via B4 Relay
2026-11-30 20:10 ` [PATCH v3 4/4] media: i2c: ov7251: support non-continuous MIPI clock mode Robert Ijtsma via B4 Relay
3 siblings, 0 replies; 5+ messages in thread
From: Robert Ijtsma via B4 Relay @ 2026-11-30 20:10 UTC (permalink / raw)
To: Sakari Ailus, Mauro Carvalho Chehab, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Jacopo Mondi, Todor Tomov,
Daniel Scally, Andy Shevchenko
Cc: Antoine Pichot, Dave Stevenson, linux-media, devicetree,
linux-kernel, Robert Ijtsma, Mauro Carvalho Chehab
From: Robert Ijtsma <robertijtsma@gmail.com>
ov7251_probe() configures runtime PM autosuspend with a 1000 ms delay,
but ov7251_s_ctrl() and ov7251_s_stream() call pm_runtime_put(),
immediately powering down the sensor on stream stop or control writes
instead of keeping it in software standby across the autosuspend window.
Use pm_runtime_put_autosuspend() in ov7251_s_ctrl() and
ov7251_s_stream().
Fixes: 207f4162f1c9 ("media: i2c: Add pm_runtime support to ov7251")
Tested-by: Antoine Pichot <antoine.pichot@gmail.com> # Surface Book 2 (IPU3)
Signed-off-by: Robert Ijtsma <robertijtsma@gmail.com>
---
drivers/media/i2c/ov7251.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/media/i2c/ov7251.c b/drivers/media/i2c/ov7251.c
index 393260929f29..8c6e610586cd 100644
--- a/drivers/media/i2c/ov7251.c
+++ b/drivers/media/i2c/ov7251.c
@@ -905,7 +905,7 @@ static int ov7251_s_ctrl(struct v4l2_ctrl *ctrl)
break;
}
- pm_runtime_put(ov7251->dev);
+ pm_runtime_put_autosuspend(ov7251->dev);
return ret;
}
@@ -1153,14 +1153,14 @@ static int ov7251_s_stream(struct v4l2_subdev *subdev, int enable)
} else {
ret = ov7251_write_reg(ov7251, OV7251_SC_MODE_SELECT,
OV7251_SC_MODE_SELECT_SW_STANDBY);
- pm_runtime_put(ov7251->dev);
+ pm_runtime_put_autosuspend(ov7251->dev);
}
v4l2_subdev_unlock_state(state);
return ret;
err_power_down:
- pm_runtime_put(ov7251->dev);
+ pm_runtime_put_autosuspend(ov7251->dev);
v4l2_subdev_unlock_state(state);
return ret;
}
--
2.56.0
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v3 3/4] media: dt-bindings: ovti,ov7251: allow clock-noncontinuous
2026-11-30 20:10 [PATCH v3 0/4] media: i2c: ov7251: software reset settle, autosuspend, and non-continuous clock Robert Ijtsma via B4 Relay
2026-11-30 20:10 ` [PATCH v3 1/4] media: i2c: ov7251: wait for software reset before global init Robert Ijtsma via B4 Relay
2026-11-30 20:10 ` [PATCH v3 2/4] media: i2c: ov7251: use pm_runtime_put_autosuspend() Robert Ijtsma via B4 Relay
@ 2026-11-30 20:10 ` Robert Ijtsma via B4 Relay
2026-11-30 20:10 ` [PATCH v3 4/4] media: i2c: ov7251: support non-continuous MIPI clock mode Robert Ijtsma via B4 Relay
3 siblings, 0 replies; 5+ messages in thread
From: Robert Ijtsma via B4 Relay @ 2026-11-30 20:10 UTC (permalink / raw)
To: Sakari Ailus, Mauro Carvalho Chehab, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Jacopo Mondi, Todor Tomov,
Daniel Scally, Andy Shevchenko
Cc: Antoine Pichot, Dave Stevenson, linux-media, devicetree,
linux-kernel, Robert Ijtsma, Mauro Carvalho Chehab
From: Robert Ijtsma <robertijtsma@gmail.com>
The OV7251 supports gating its MIPI CSI-2 clock lane in LP-11 during
blanking intervals, which is required by CSI-2 receivers such as
Qualcomm CAMSS on SC8180X.
Allow the standard clock-noncontinuous property on the sensor's CSI-2
endpoint.
Signed-off-by: Robert Ijtsma <robertijtsma@gmail.com>
---
Documentation/devicetree/bindings/media/i2c/ovti,ov7251.yaml | 2 ++
1 file changed, 2 insertions(+)
diff --git a/Documentation/devicetree/bindings/media/i2c/ovti,ov7251.yaml b/Documentation/devicetree/bindings/media/i2c/ovti,ov7251.yaml
index 922996da59b2..8aee4c9799ae 100644
--- a/Documentation/devicetree/bindings/media/i2c/ovti,ov7251.yaml
+++ b/Documentation/devicetree/bindings/media/i2c/ovti,ov7251.yaml
@@ -60,6 +60,8 @@ properties:
clock-lanes:
maximum: 1
+ clock-noncontinuous: true
+
data-lanes:
maxItems: 1
--
2.56.0
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v3 4/4] media: i2c: ov7251: support non-continuous MIPI clock mode
2026-11-30 20:10 [PATCH v3 0/4] media: i2c: ov7251: software reset settle, autosuspend, and non-continuous clock Robert Ijtsma via B4 Relay
` (2 preceding siblings ...)
2026-11-30 20:10 ` [PATCH v3 3/4] media: dt-bindings: ovti,ov7251: allow clock-noncontinuous Robert Ijtsma via B4 Relay
@ 2026-11-30 20:10 ` Robert Ijtsma via B4 Relay
3 siblings, 0 replies; 5+ messages in thread
From: Robert Ijtsma via B4 Relay @ 2026-11-30 20:10 UTC (permalink / raw)
To: Sakari Ailus, Mauro Carvalho Chehab, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Jacopo Mondi, Todor Tomov,
Daniel Scally, Andy Shevchenko
Cc: Antoine Pichot, Dave Stevenson, linux-media, devicetree,
linux-kernel, Robert Ijtsma, Mauro Carvalho Chehab
From: Robert Ijtsma <robertijtsma@gmail.com>
Check V4L2_MBUS_CSI2_NONCONTINUOUS_CLOCK from the parsed CSI-2 endpoint
in ov7251_check_hwcfg() and set BIT(5) (CLOCK_LANE_GATE) in
OV7251_MIPI_CTRL00 (0x4800) during power-on when non-continuous clock
mode is configured, allowing the sensor to gate the MIPI clock lane in
LP-11 idle periods (required by Qualcomm SC8180X CSIPHY).
Signed-off-by: Robert Ijtsma <robertijtsma@gmail.com>
---
drivers/media/i2c/ov7251.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/drivers/media/i2c/ov7251.c b/drivers/media/i2c/ov7251.c
index 8c6e610586cd..f4ba9e000a66 100644
--- a/drivers/media/i2c/ov7251.c
+++ b/drivers/media/i2c/ov7251.c
@@ -81,6 +81,8 @@
#define OV7251_TIMING_VTS_REG 0x380e
#define OV7251_TIMING_MIN_VTS 1
#define OV7251_TIMING_MAX_VTS 0xffff
+#define OV7251_MIPI_CTRL00 0x4800
+#define OV7251_MIPI_CTRL00_CLOCK_LANE_GATE BIT(5)
#define OV7251_INTEGRATION_MARGIN 20
struct reg_value {
@@ -171,6 +173,7 @@ struct ov7251 {
u8 timing_format2;
bool power_on;
+ bool clock_ncont;
struct gpio_desc *enable_gpio;
};
@@ -714,6 +717,19 @@ static int ov7251_set_power_on(struct device *dev)
goto err_power_off;
}
+ if (ov7251->clock_ncont) {
+ u8 val;
+
+ ret = ov7251_read_reg(ov7251, OV7251_MIPI_CTRL00, &val);
+ if (ret < 0)
+ goto err_power_off;
+
+ ret = ov7251_write_reg(ov7251, OV7251_MIPI_CTRL00,
+ val | OV7251_MIPI_CTRL00_CLOCK_LANE_GATE);
+ if (ret < 0)
+ goto err_power_off;
+ }
+
return 0;
err_power_off:
@@ -1309,6 +1325,8 @@ static int ov7251_check_hwcfg(struct ov7251 *ov7251)
}
ov7251->link_freq_idx = j;
+ ov7251->clock_ncont = bus_cfg.bus.mipi_csi2.flags &
+ V4L2_MBUS_CSI2_NONCONTINUOUS_CLOCK;
out_free_bus_cfg:
v4l2_fwnode_endpoint_free(&bus_cfg);
--
2.56.0
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-11-30 20:10 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-30 20:10 [PATCH v3 0/4] media: i2c: ov7251: software reset settle, autosuspend, and non-continuous clock Robert Ijtsma via B4 Relay
2026-11-30 20:10 ` [PATCH v3 1/4] media: i2c: ov7251: wait for software reset before global init Robert Ijtsma via B4 Relay
2026-11-30 20:10 ` [PATCH v3 2/4] media: i2c: ov7251: use pm_runtime_put_autosuspend() Robert Ijtsma via B4 Relay
2026-11-30 20:10 ` [PATCH v3 3/4] media: dt-bindings: ovti,ov7251: allow clock-noncontinuous Robert Ijtsma via B4 Relay
2026-11-30 20:10 ` [PATCH v3 4/4] media: i2c: ov7251: support non-continuous MIPI clock mode Robert Ijtsma via B4 Relay
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®