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 6/9] media: i2c: ov7251: Add orientation and rotation controls
Date: Fri, 13 Nov 2026 11:40:56 +0900 [thread overview]
Message-ID: <20261113024059.1087031-7-antoine.pichot@gmail.com> (raw)
In-Reply-To: <20261113024059.1087031-1-antoine.pichot@gmail.com>
Parse the firmware device properties and register the
V4L2_CID_CAMERA_ORIENTATION and V4L2_CID_CAMERA_SENSOR_ROTATION
controls, as documented in
Documentation/driver-api/media/camera-sensor.rst. libcamera uses them to
place the camera and to correct the image orientation.
While at it, bump the control handler size hint to the number of
controls the driver now creates.
On the Microsoft Surface Book 2 the ACPI _PLD (via ipu-bridge) reports
the IR sensor as front facing with no rotation.
Signed-off-by: Antoine Pichot <antoine.pichot@gmail.com>
Tested-by: D. Manresa <dmanresa@gmail.com> # Surface Pro 7+, IPU6 (8086:9a19)
---
drivers/media/i2c/ov7251.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/drivers/media/i2c/ov7251.c b/drivers/media/i2c/ov7251.c
index c7489c6305aa..834420f2f843 100644
--- a/drivers/media/i2c/ov7251.c
+++ b/drivers/media/i2c/ov7251.c
@@ -1513,10 +1513,16 @@ static int ov7251_detect_chip(struct ov7251 *ov7251)
static int ov7251_init_ctrls(struct ov7251 *ov7251)
{
const struct ov7251_mode_info *mode = ov7251->current_mode;
+ struct v4l2_fwnode_device_properties props;
int vblank_max, vblank_def;
int hblank;
+ int ret;
- v4l2_ctrl_handler_init(&ov7251->ctrls, 7);
+ ret = v4l2_fwnode_device_parse(ov7251->dev, &props);
+ if (ret)
+ return ret;
+
+ v4l2_ctrl_handler_init(&ov7251->ctrls, 11);
v4l2_ctrl_new_std(&ov7251->ctrls, &ov7251_ctrl_ops,
V4L2_CID_HFLIP, 0, 1, 1, 0);
@@ -1564,6 +1570,9 @@ static int ov7251_init_ctrls(struct ov7251 *ov7251)
OV7251_TIMING_MIN_VTS, vblank_max, 1,
vblank_def);
+ v4l2_ctrl_new_fwnode_properties(&ov7251->ctrls, &ov7251_ctrl_ops,
+ &props);
+
ov7251->sd.ctrl_handler = &ov7251->ctrls;
if (ov7251->ctrls.error) {
--
2.56.0
next prev parent reply other threads:[~2026-11-13 2:41 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 ` Antoine Pichot [this message]
2026-11-13 2:40 ` [PATCH v3 7/9] media: i2c: ov7251: Move the common registers into the global init table Antoine Pichot
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-7-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®