From: Sakari Ailus <sakari.ailus@linux.intel.com>
To: Daniel Scally <djrscally@gmail.com>
Cc: linux-media@vger.kernel.org, libcamera-devel@lists.libcamera.org,
laurent.pinchart@ideasonboard.com, hanlinchen@chromium.org,
tfiga@chromium.org, hdegoede@redhat.com,
kieran.bingham@ideasonboard.com, hpa@redhat.com
Subject: Re: [PATCH 4/5] media: entity: Add support for ancillary links
Date: Tue, 14 Dec 2021 23:25:45 +0200 [thread overview]
Message-ID: <YbkL2V24TFdA5KHx@paasikivi.fi.intel.com> (raw)
In-Reply-To: <20211213232849.40071-5-djrscally@gmail.com>
Hi Daniel,
On Mon, Dec 13, 2021 at 11:28:48PM +0000, Daniel Scally wrote:
> Add functions to create and destroy ancillary links, so that they
> don't need to be manually created by users.
>
> Signed-off-by: Daniel Scally <djrscally@gmail.com>
> ---
> Changes since the rfc:
>
> - (Laurent) Set gobj0 and gobj1 directly instead of the other union
> members
> - (Laurent) Added MEDIA_LNK_FL_IMMUTABLE to the kerneldoc for the new
> create function
>
> drivers/media/mc/mc-entity.c | 30 ++++++++++++++++++++++++++++++
> include/media/media-entity.h | 29 +++++++++++++++++++++++++++++
> 2 files changed, 59 insertions(+)
>
> diff --git a/drivers/media/mc/mc-entity.c b/drivers/media/mc/mc-entity.c
> index aeddc3f6310e..4e39e100ea03 100644
> --- a/drivers/media/mc/mc-entity.c
> +++ b/drivers/media/mc/mc-entity.c
> @@ -1052,3 +1052,33 @@ void media_remove_intf_links(struct media_interface *intf)
> mutex_unlock(&mdev->graph_mutex);
> }
> EXPORT_SYMBOL_GPL(media_remove_intf_links);
> +
> +struct media_link *media_create_ancillary_link(struct media_entity *primary,
> + struct media_entity *ancillary,
> + u32 flags)
> +{
> + struct media_link *link;
> +
> + link = media_add_link(&primary->links);
> + if (!link)
> + return ERR_PTR(-ENOMEM);
> +
> + link->gobj0 = &primary->graph_obj;
> + link->gobj1 = &ancillary->graph_obj;
> + link->flags = flags | MEDIA_LNK_FL_ANCILLARY_LINK;
> +
> + /* Initialize graph object embedded at the new link */
> + media_gobj_create(primary->graph_obj.mdev, MEDIA_GRAPH_LINK,
> + &link->graph_obj);
> +
> + return link;
> +}
> +EXPORT_SYMBOL_GPL(media_create_ancillary_link);
> +
> +void media_remove_ancillary_link(struct media_link *link)
> +{
> + list_del(&link->list);
> + media_gobj_destroy(&link->graph_obj);
> + kfree(link);
> +}
> +EXPORT_SYMBOL_GPL(media_remove_ancillary_link);
> diff --git a/include/media/media-entity.h b/include/media/media-entity.h
> index fea489f03d57..f7b1738cef88 100644
> --- a/include/media/media-entity.h
> +++ b/include/media/media-entity.h
> @@ -1104,6 +1104,35 @@ void media_remove_intf_links(struct media_interface *intf);
> * it will issue a call to @operation\(@entity, @args\).
> */
>
> +/**
> + * media_create_ancillary_link() - creates a link between two entities
> + *
> + * @primary: pointer to the primary &media_entity
> + * @ancillary: pointer to the ancillary &media_entity
> + * @flags: Link flags, as defined in
> + * :ref:`include/uapi/linux/media.h <media_header>`
> + * ( seek for ``MEDIA_LNK_FL_*``)
> + *
> + *
> + * Valid values for flags:
> + *
> + * %MEDIA_LNK_FL_ENABLED
> + * Indicates that the two entities are connected pieces of hardware that form
> + * a single logical unit.
> + *
> + * A typical example is a camera lens being linked to the sensor that it is
> + * supporting.
> + *
> + * %MEDIA_LNK_FL_IMMUTABLE
> + * Indicates that the link enabled state can't be modified at runtime. If
> + * %MEDIA_LNK_FL_IMMUTABLE is set, then %MEDIA_LNK_FL_ENABLED must also be
> + * set, since an immutable link is always enabled.
What's the use case for both of the flags?
I know the flags are there but what will they mean in practice for
ancillary links?
> + */
> +struct media_link *
> +media_create_ancillary_link(struct media_entity *primary,
> + struct media_entity *ancillary,
> + u32 flags);
> +
> #define media_entity_call(entity, operation, args...) \
> (((entity)->ops && (entity)->ops->operation) ? \
> (entity)->ops->operation((entity) , ##args) : -ENOIOCTLCMD)
--
Kind regards,
Sakari Ailus
next prev parent reply other threads:[~2021-12-14 21:26 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-13 23:28 [PATCH 0/5] Introduce ancillary links Daniel Scally
2021-12-13 23:28 ` [PATCH 1/5] media: media.h: Add new media link type Daniel Scally
2021-12-14 21:50 ` Laurent Pinchart
2021-12-14 21:52 ` Daniel Scally
2021-12-13 23:28 ` [PATCH 2/5] media: entity: Add link_type() helper Daniel Scally
2021-12-14 21:54 ` Laurent Pinchart
2021-12-14 21:57 ` Daniel Scally
2021-12-13 23:28 ` [PATCH 3/5] media: entity: Skip non-data links in graph iteration Daniel Scally
2021-12-14 15:01 ` Sakari Ailus
2021-12-14 16:14 ` Daniel Scally
2021-12-14 21:22 ` Sakari Ailus
2021-12-14 21:37 ` Daniel Scally
2021-12-14 22:05 ` Laurent Pinchart
2021-12-13 23:28 ` [PATCH 4/5] media: entity: Add support for ancillary links Daniel Scally
2021-12-14 4:06 ` kernel test robot
2021-12-14 21:25 ` Sakari Ailus [this message]
2021-12-14 21:54 ` Daniel Scally
2021-12-14 22:14 ` Laurent Pinchart
2022-01-16 23:52 ` Daniel Scally
2021-12-13 23:28 ` [PATCH 5/5] media: v4l2-async: Create links during v4l2_async_match_notify() Daniel Scally
2021-12-14 22:22 ` Laurent Pinchart
2021-12-14 22:36 ` Daniel Scally
2021-12-14 23:01 ` Laurent Pinchart
2021-12-14 23:41 ` Daniel Scally
2021-12-15 9:04 ` Laurent Pinchart
2021-12-15 9:44 ` Sakari Ailus
2021-12-15 9:55 ` Laurent Pinchart
2021-12-15 23:10 ` Daniel Scally
2021-12-15 23:14 ` Laurent Pinchart
2022-01-16 0:01 ` Daniel Scally
2021-12-16 11:10 ` kernel test robot
2021-12-16 11:14 ` Daniel Scally
2021-12-15 9:25 ` [PATCH 0/5] Introduce ancillary links Mauro Carvalho Chehab
2021-12-15 9:36 ` Daniel Scally
2021-12-15 9:52 ` Laurent Pinchart
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=YbkL2V24TFdA5KHx@paasikivi.fi.intel.com \
--to=sakari.ailus@linux.intel.com \
--cc=djrscally@gmail.com \
--cc=hanlinchen@chromium.org \
--cc=hdegoede@redhat.com \
--cc=hpa@redhat.com \
--cc=kieran.bingham@ideasonboard.com \
--cc=laurent.pinchart@ideasonboard.com \
--cc=libcamera-devel@lists.libcamera.org \
--cc=linux-media@vger.kernel.org \
--cc=tfiga@chromium.org \
/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