All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
To: linux-media@vger.kernel.org, sakari.ailus@linux.intel.com,
	Jacopo Mondi <jacopo+renesas@jmondi.org>,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	niklas.soderlund+renesas@ragnatech.se,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Hans Verkuil <hverkuil-cisco@xs4all.nl>,
	Pratyush Yadav <p.yadav@ti.com>
Cc: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Subject: [PATCH v6 0/8] v4l: subdev active state
Date: Thu, 24 Mar 2022 10:00:22 +0200	[thread overview]
Message-ID: <20220324080030.216716-1-tomi.valkeinen@ideasonboard.com> (raw)

Hi,

v6 of the subdev active state series. v5 can be found from:

https://lore.kernel.org/all/20220301105548.305191-1-tomi.valkeinen@ideasonboard.com/

Changes since v5:

- Fix code-block in docs
- State management wrappers (DEFINE_STATE_WRAPPER). These wrappers will handle
  the cases where the caller does not pass the active state properly.
- Added v4l2_subdev_get_fmt(). This can be used by state-enabled subdev drivers for
  v4l2_subdev_pad_ops.get_fmt.
- Drop the legacy .h file and have v4l2_subdev_call_state_active() in
  v4l2-subdev.h. The macro is now part of the "add subdev state locking" patch
  as it is used there.
- Added v4l2_subdev_get_pad_* helpers. These are temporary helpers to get rid of
  the "try" word. The v4l2_subdev_get_try_* functions should later be renamed and
  these temporary macros dropped.
- Rename v4l2_subdev_get_active_state() to v4l2_subdev_get_unlocked_active_state()
- Fix v4l2_subdev_lock_and_get_active_state() when there is no active state

I have pushed my work/test branch to:

git://git.kernel.org/pub/scm/linux/kernel/git/tomba/linux.git streams/state-work

It contains this series, ov5640 series from Jacopo, and a some hacks/fixes I
needed. The important part there is the topmost commit: "ov5640: convert to
active state", which shows how a sensor driver can be changed to support active
state.

A few notes about that patch:
- It could perhaps be cleaner if the state was passed around in certain
  functions instead of calling v4l2_subdev_get_locked_active_state() in
  multiple places.
- The driver has a private mutex, which was shared with the control handler. The
  same mutex is now also used for the states. There are not many places where
  the private mutex is used as it were, and those could be converted to just
  lock the active state.
- Only the format is handled via the state. The driver also has some
  crop/selection code, but I wasn't sure how that works.
- ov5640_get_fmt() goes away as we can just use the v4l2_subdev_get_fmt()
- The driver uses the new helper macro to get the format, instead of the "try" version, e.g.
  "fmt = v4l2_subdev_get_pad_format(&sensor->sd, state, 0);" to get the format
  for pad 0 in the given state.

 Tomi

Tomi Valkeinen (8):
  media: subdev: rename subdev-state alloc & free
  media: subdev: add active state to struct v4l2_subdev
  media: subdev: add v4l2_subdev_get_pad_* helpers
  media: subdev: pass also the active state to subdevs from ioctls
  media: subdev: add subdev state locking
  media: subdev: add locking wrappers to subdev op wrappers
  media: subdev: add v4l2_subdev_get_fmt() helper function
  media: Documentation: add documentation about subdev state

 .../driver-api/media/v4l2-subdev.rst          |  75 ++++++
 .../platform/renesas/rcar-vin/rcar-v4l2.c     |   9 +-
 .../media/platform/renesas/vsp1/vsp1_entity.c |  10 +-
 drivers/media/v4l2-core/v4l2-subdev.c         | 194 ++++++++++++---
 drivers/staging/media/tegra-video/vi.c        |  10 +-
 include/media/v4l2-subdev.h                   | 220 +++++++++++++++++-
 6 files changed, 480 insertions(+), 38 deletions(-)

-- 
2.25.1


             reply	other threads:[~2022-03-24  8:01 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-24  8:00 Tomi Valkeinen [this message]
2022-03-24  8:00 ` [PATCH v6 1/8] media: subdev: rename subdev-state alloc & free Tomi Valkeinen
2022-03-24  8:00 ` [PATCH v6 2/8] media: subdev: add active state to struct v4l2_subdev Tomi Valkeinen
2022-03-24  8:00 ` [PATCH v6 3/8] media: subdev: add v4l2_subdev_get_pad_* helpers Tomi Valkeinen
2022-04-06 13:36   ` Hans Verkuil
2022-04-06 13:52     ` Hans Verkuil
2022-04-07  5:22       ` Tomi Valkeinen
2022-03-24  8:00 ` [PATCH v6 4/8] media: subdev: pass also the active state to subdevs from ioctls Tomi Valkeinen
2022-03-24  8:00 ` [PATCH v6 5/8] media: subdev: add subdev state locking Tomi Valkeinen
2022-04-06 13:39   ` Hans Verkuil
2022-03-24  8:00 ` [PATCH v6 6/8] media: subdev: add locking wrappers to subdev op wrappers Tomi Valkeinen
2022-04-06 13:44   ` Hans Verkuil
2022-03-24  8:00 ` [PATCH v6 7/8] media: subdev: add v4l2_subdev_get_fmt() helper function Tomi Valkeinen
2022-04-06 13:51   ` Hans Verkuil
2022-04-07  7:23     ` Tomi Valkeinen
2022-04-07  7:29       ` Hans Verkuil
2022-03-24  8:00 ` [PATCH v6 8/8] media: Documentation: add documentation about subdev state Tomi Valkeinen
2022-04-06 14:01   ` Hans Verkuil
2022-04-07  7:42     ` Tomi Valkeinen

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=20220324080030.216716-1-tomi.valkeinen@ideasonboard.com \
    --to=tomi.valkeinen@ideasonboard.com \
    --cc=hverkuil-cisco@xs4all.nl \
    --cc=jacopo+renesas@jmondi.org \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=niklas.soderlund+renesas@ragnatech.se \
    --cc=p.yadav@ti.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.