From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Antoine Pichot <antoine.pichot@gmail.com>
Cc: linux-media@vger.kernel.org, sakari.ailus@linux.intel.com,
mchehab@kernel.org, hansg@kernel.org,
dan.scally@ideasonboard.com, djrscally@gmail.com,
dmanresa@gmail.com, dave.stevenson@raspberrypi.com,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 5/9] media: i2c: ov7251: Use sub-device active state
Date: Thu, 29 Oct 2026 16:02:47 +0200 [thread overview]
Message-ID: <auNSB_yCjo8KVGJF@ashevche-desk.local> (raw)
In-Reply-To: <20261028112154.855185-6-antoine.pichot@gmail.com>
On Wed, Oct 28, 2026 at 08:21:50PM +0900, Antoine Pichot wrote:
> Port the ov7251 driver to the sub-device active state.
>
> The driver kept its own copies of the active format and crop rectangle
> and selected between them and the try state with a pair of helpers
> switching on the format's "which" field. Move the format and the crop
> rectangle to the sub-device state for both the try and the active case,
> drop the helpers and the private copies, and use the v4l2_subdev_get_fmt
> helper for get_fmt. The init_state operation now fills whichever state
> it is given through set_fmt, so the explicit ov7251_init_state() call at
> the end of probe goes away; the exposure control gets the default mode's
> range at creation instead of being adjusted by that call.
>
> The driver mutex went away with it. The control handler's own lock now
> serves as the state lock as well, so the control framework and the
> sub-device core serialise the pad operations, the control operations
> and the stream start between them; s_stream takes the active state lock
> itself. The mode pointer, which the frame interval operations still
> select by frame rate, stays and is protected by the same lock.
>
> Behaviour is unchanged for applications. As a side effect the core now
> reports V4L2_SUBDEV_FL_HAS_EVENTS for the sub-device and handles control
> event subscription, so v4l2-compliance's VIDIOC_(UN)SUBSCRIBE_EVENT test
> passes without the driver having to declare the event operations.
...
> - mutex_lock(&ov7251->lock);
> + state = v4l2_subdev_lock_and_get_active_state(subdev);
>
> if (enable) {
> ret = pm_runtime_resume_and_get(ov7251->dev);
> if (ret) {
> - mutex_unlock(&ov7251->lock);
> + v4l2_subdev_unlock_state(state);
> return ret;
> }
> pm_runtime_put(ov7251->dev);
> }
>
> - mutex_unlock(&ov7251->lock);
> + v4l2_subdev_unlock_state(state);
> return ret;
>
> err_power_down:
> pm_runtime_put(ov7251->dev);
> - mutex_unlock(&ov7251->lock);
> + v4l2_subdev_unlock_state(state);
> return ret;
I'm wondering if v4l2 provides the set of conditional guards and hence some
kind of ACQUIRE() macro.
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2026-10-29 14:02 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-28 11:21 [PATCH v2 0/9] media: i2c: ov7251: fixes and infrared strobe for Surface Book 2 Antoine Pichot
2026-10-28 11:21 ` [PATCH v2 1/9] media: i2c: ov7251: Use in-range PLL1 dividers for the 319.2 MHz link Antoine Pichot
2026-10-29 13:57 ` Andy Shevchenko
2026-10-29 19:06 ` Dave Stevenson
2026-10-28 11:21 ` [PATCH v2 2/9] media: i2c: ov7251: Fix link frequency index Antoine Pichot
2026-10-28 11:21 ` [PATCH v2 3/9] media: i2c: ov7251: Report the pixel array rate for both link frequencies Antoine Pichot
2026-10-29 13:59 ` Andy Shevchenko
2026-10-28 11:21 ` [PATCH v2 4/9] media: i2c: ov7251: Reset vblank when the frame interval changes Antoine Pichot
2026-10-28 11:21 ` [PATCH v2 5/9] media: i2c: ov7251: Use sub-device active state Antoine Pichot
2026-10-29 14:02 ` Andy Shevchenko [this message]
2026-10-28 11:21 ` [PATCH v2 6/9] media: i2c: ov7251: Add orientation and rotation controls Antoine Pichot
2026-10-28 11:21 ` [PATCH v2 7/9] media: i2c: ov7251: Move the strobe registers out of the mode tables Antoine Pichot
2026-10-28 11:21 ` [PATCH v2 8/9] media: i2c: ov7251: Add strobe output enable control Antoine Pichot
2026-10-28 11:21 ` [PATCH v2 9/9] media: ipu-bridge: Add a rotation quirk for the Surface Book 2 and Pro 7+ Antoine Pichot
2026-10-29 14:04 ` Andy Shevchenko
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=auNSB_yCjo8KVGJF@ashevche-desk.local \
--to=andriy.shevchenko@linux.intel.com \
--cc=antoine.pichot@gmail.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®