From: Robert Ijtsma via B4 Relay <devnull+robertijtsma.gmail.com@kernel.org>
To: Sakari Ailus <sakari.ailus@linux.intel.com>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
Jacopo Mondi <jacopo@jmondi.org>,
Todor Tomov <todor.too@gmail.com>
Cc: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>,
linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
Robert Ijtsma <robertijtsma@gmail.com>
Subject: [PATCH 4/4] media: i2c: ov7251: add V4L2_CID_FLASH_STROBE_OE control
Date: Fri, 27 Nov 2026 21:30:16 +0100 [thread overview]
Message-ID: <20261127-ov7251-strobe-ncont-v1-4-cefa8c6c020b@gmail.com> (raw)
In-Reply-To: <20261127-ov7251-strobe-ncont-v1-0-cefa8c6c020b@gmail.com>
From: Robert Ijtsma <robertijtsma@gmail.com>
Devices such as the Microsoft Surface Pro X wire the OV7251 sensor's
hardware STROBE output pin to an 850 nm IR illuminator for synchronized
frame-exposure illumination.
Expose V4L2_CID_FLASH_STROBE_OE (default disabled) to drive the sensor's
STROBE pin (0x3005, 0x3027, 0x3b81, 0x3b8e..0x3b8f) while streaming, and
disable the strobe output when stopping the stream.
Signed-off-by: Robert Ijtsma <robertijtsma@gmail.com>
---
drivers/media/i2c/ov7251.c | 47 +++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 46 insertions(+), 1 deletion(-)
diff --git a/drivers/media/i2c/ov7251.c b/drivers/media/i2c/ov7251.c
index 13fcc4cdb31a5e7350bcc0b15d186f4912b074be..e6007708139964c423c68dae86e7c07c26349fea 100644
--- a/drivers/media/i2c/ov7251.c
+++ b/drivers/media/i2c/ov7251.c
@@ -30,7 +30,15 @@
#define OV7251_CHIP_ID_HIGH_BYTE 0x77
#define OV7251_CHIP_ID_LOW 0x300b
#define OV7251_CHIP_ID_LOW_BYTE 0x50
+#define OV7251_SC_IO_CTRL1 0x3005
+#define OV7251_IO_CTRL1_STROBE_EN BIT(3)
+#define OV7251_SC_GP_IO_SEL1 0x3027
#define OV7251_SC_GP_IO_IN1 0x3029
+#define OV7251_STROBE_PATTERN 0x3b81
+#define OV7251_STROBE_PATTERN_ALL 0xff
+#define OV7251_STROBE_SPAN_H 0x3b8e
+#define OV7251_STROBE_SPAN_L 0x3b8f
+#define OV7251_STROBE_SPAN_DEFAULT 0x0200
#define OV7251_AEC_EXPO_0 0x3500
#define OV7251_AEC_EXPO_1 0x3501
#define OV7251_AEC_EXPO_2 0x3502
@@ -979,6 +987,37 @@ static int ov7251_set_hflip(struct ov7251 *ov7251, s32 value)
return ret;
}
+static int ov7251_set_strobe(struct ov7251 *ov7251, bool enable)
+{
+ int ret;
+
+ if (enable) {
+ ret = ov7251_write_reg(ov7251, OV7251_STROBE_PATTERN,
+ OV7251_STROBE_PATTERN_ALL);
+ if (ret)
+ return ret;
+
+ ret = ov7251_write_reg(ov7251, OV7251_STROBE_SPAN_H,
+ OV7251_STROBE_SPAN_DEFAULT >> 8);
+ if (ret)
+ return ret;
+
+ ret = ov7251_write_reg(ov7251, OV7251_STROBE_SPAN_L,
+ OV7251_STROBE_SPAN_DEFAULT & 0xff);
+ if (ret)
+ return ret;
+
+ ret = ov7251_write_reg(ov7251, OV7251_SC_GP_IO_SEL1, 0x00);
+ if (ret)
+ return ret;
+
+ return ov7251_write_reg(ov7251, OV7251_SC_IO_CTRL1,
+ OV7251_IO_CTRL1_STROBE_EN);
+ }
+
+ return ov7251_write_reg(ov7251, OV7251_SC_IO_CTRL1, 0x00);
+}
+
static int ov7251_set_vflip(struct ov7251 *ov7251, s32 value)
{
u8 val = ov7251->timing_format1;
@@ -1072,6 +1111,9 @@ static int ov7251_s_ctrl(struct v4l2_ctrl *ctrl)
case V4L2_CID_VBLANK:
ret = ov7251_vts_configure(ov7251, ctrl->val);
break;
+ case V4L2_CID_FLASH_STROBE_OE:
+ ret = ov7251_set_strobe(ov7251, ctrl->val);
+ break;
default:
ret = -EINVAL;
break;
@@ -1394,6 +1436,7 @@ static int ov7251_s_stream(struct v4l2_subdev *subdev, int enable)
if (ret)
goto err_power_down;
} else {
+ ov7251_set_strobe(ov7251, false);
ret = ov7251_write_reg(ov7251, OV7251_SC_MODE_SELECT,
OV7251_SC_MODE_SELECT_SW_STANDBY);
pm_runtime_mark_last_busy(ov7251->dev);
@@ -1594,7 +1637,7 @@ static int ov7251_init_ctrls(struct ov7251 *ov7251)
s64 pixel_rate;
int hblank;
- v4l2_ctrl_handler_init(&ov7251->ctrls, 7);
+ v4l2_ctrl_handler_init(&ov7251->ctrls, 8);
ov7251->ctrls.lock = &ov7251->lock;
v4l2_ctrl_new_std(&ov7251->ctrls, &ov7251_ctrl_ops,
@@ -1609,6 +1652,8 @@ static int ov7251_init_ctrls(struct ov7251 *ov7251)
V4L2_CID_TEST_PATTERN,
ARRAY_SIZE(ov7251_test_pattern_menu) - 1,
0, 0, ov7251_test_pattern_menu);
+ v4l2_ctrl_new_std(&ov7251->ctrls, &ov7251_ctrl_ops,
+ V4L2_CID_FLASH_STROBE_OE, 0, 1, 1, 0);
pixel_rate = pixel_rates[ov7251->link_freq_idx];
ov7251->pixel_clock = v4l2_ctrl_new_std(&ov7251->ctrls,
--
2.47.3
next prev parent reply other threads:[~2026-11-27 20:30 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-27 20:30 [PATCH 0/4] media: i2c: ov7251: runtime PM, non-continuous MIPI clock, and strobe OE Robert Ijtsma via B4 Relay
2026-11-27 20:30 ` [PATCH 1/4] media: i2c: ov7251: wait for software reset settle in power-on Robert Ijtsma via B4 Relay
2026-11-27 20:30 ` [PATCH 2/4] media: i2c: ov7251: use pm_runtime_put_autosuspend() Robert Ijtsma via B4 Relay
2026-11-27 20:30 ` [PATCH 3/4] media: i2c: ov7251: support non-continuous MIPI clock mode Robert Ijtsma via B4 Relay
2026-11-27 20:30 ` Robert Ijtsma via B4 Relay [this message]
2026-11-27 21:16 ` [PATCH 0/4] media: i2c: ov7251: runtime PM, non-continuous MIPI clock, and strobe OE Antoine Pichot
2026-11-27 21:55 ` Robert IJtsma
2026-11-27 22:45 ` 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=20261127-ov7251-strobe-ncont-v1-4-cefa8c6c020b@gmail.com \
--to=devnull+robertijtsma.gmail.com@kernel.org \
--cc=jacopo@jmondi.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab+samsung@kernel.org \
--cc=mchehab@kernel.org \
--cc=robertijtsma@gmail.com \
--cc=sakari.ailus@linux.intel.com \
--cc=todor.too@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®