]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
media: v4l2-mc: Add link flags to v4l2_create_fwnode_links_to_pad()
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Mon, 15 Feb 2021 04:27:20 +0000 (05:27 +0100)
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Thu, 11 Mar 2021 10:59:52 +0000 (11:59 +0100)
Add a flags argument to the v4l2_create_fwnode_links_to_pad() function
to specify the link flags. This allows drivers to create immutable links
for instance.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Rui Miguel Silva <rmfrfs@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
drivers/media/v4l2-core/v4l2-mc.c
drivers/staging/media/imx/imx-media-csi.c
drivers/staging/media/imx/imx6-mipi-csi2.c
drivers/staging/media/imx/imx7-media-csi.c
drivers/staging/media/imx/imx7-mipi-csis.c
include/media/v4l2-mc.h

index ba2f2b8dcc8c3e7ad0eba269491b0bcc0806c122..cba3d8e0bc4a97d2667c79673da379b863c24709 100644 (file)
@@ -310,7 +310,7 @@ int v4l_vb2q_enable_media_source(struct vb2_queue *q)
 EXPORT_SYMBOL_GPL(v4l_vb2q_enable_media_source);
 
 int v4l2_create_fwnode_links_to_pad(struct v4l2_subdev *src_sd,
-                                   struct media_pad *sink)
+                                   struct media_pad *sink, u32 flags)
 {
        struct fwnode_handle *endpoint;
        struct v4l2_subdev *sink_sd;
@@ -367,7 +367,7 @@ int v4l2_create_fwnode_links_to_pad(struct v4l2_subdev *src_sd,
                        sink_sd->entity.name, sink_idx);
 
                ret = media_create_pad_link(&src_sd->entity, src_idx,
-                                           &sink_sd->entity, sink_idx, 0);
+                                           &sink_sd->entity, sink_idx, flags);
                if (ret) {
                        dev_err(sink_sd->dev,
                                "link %s:%d -> %s:%d failed with %d\n",
@@ -395,7 +395,7 @@ int v4l2_create_fwnode_links(struct v4l2_subdev *src_sd,
                if (!(pad->flags & MEDIA_PAD_FL_SINK))
                        continue;
 
-               ret = v4l2_create_fwnode_links_to_pad(src_sd, pad);
+               ret = v4l2_create_fwnode_links_to_pad(src_sd, pad, 0);
                if (ret)
                        return ret;
        }
index 8d02939aaa23a51b0615cc3e8ad5dfebc6e89bee..e3bfd635a89aefa664a087bab1b665cf4bbce5d5 100644 (file)
@@ -1894,7 +1894,7 @@ static int imx_csi_notify_bound(struct v4l2_async_notifier *notifier,
        if (sd->entity.function == MEDIA_ENT_F_VID_MUX)
                sd->grp_id = IMX_MEDIA_GRP_ID_CSI_MUX;
 
-       return v4l2_create_fwnode_links_to_pad(sd, sink);
+       return v4l2_create_fwnode_links_to_pad(sd, sink, 0);
 }
 
 static const struct v4l2_async_notifier_operations csi_notify_ops = {
index 9020541edb89438ef98cfa201ed4baaaf7efc4ed..fc2378ac04b74a0f79e0cdd4585d0c36b6303488 100644 (file)
@@ -621,7 +621,7 @@ static int csi2_notify_bound(struct v4l2_async_notifier *notifier,
 
        dev_dbg(csi2->dev, "Bound %s pad: %d\n", sd->name, pad);
 
-       return v4l2_create_fwnode_links_to_pad(sd, sink);
+       return v4l2_create_fwnode_links_to_pad(sd, sink, 0);
 }
 
 static void csi2_notify_unbind(struct v4l2_async_notifier *notifier,
index 7632354474224a79f5489711c6bfae9fa195eacc..69eac1cb45992330f61895b4e0375c886190cd02 100644 (file)
@@ -1128,7 +1128,7 @@ static int imx7_csi_notify_bound(struct v4l2_async_notifier *notifier,
        if (sd->entity.function == MEDIA_ENT_F_VID_MUX)
                sd->grp_id = IMX_MEDIA_GRP_ID_CSI_MUX;
 
-       return v4l2_create_fwnode_links_to_pad(sd, sink);
+       return v4l2_create_fwnode_links_to_pad(sd, sink, 0);
 }
 
 static const struct v4l2_async_notifier_operations imx7_csi_notify_ops = {
index a01a7364b4b94ce20ad8f29d6d6def2894dea2ea..8cf860544b0a7edce2cf9341cf113d3363406634 100644 (file)
@@ -962,7 +962,7 @@ static int mipi_csis_notify_bound(struct v4l2_async_notifier *notifier,
        struct csi_state *state = mipi_notifier_to_csis_state(notifier);
        struct media_pad *sink = &state->mipi_sd.entity.pads[CSIS_PAD_SINK];
 
-       return v4l2_create_fwnode_links_to_pad(sd, sink);
+       return v4l2_create_fwnode_links_to_pad(sd, sink, 0);
 }
 
 static const struct v4l2_async_notifier_operations mipi_csis_notify_ops = {
index bdaa5f2f8ca21ec12bbf04c7ae9b5eb0fa669329..c181685923d526aa405f3d1c5167ae7aa94aadd5 100644 (file)
@@ -91,6 +91,7 @@ int v4l_vb2q_enable_media_source(struct vb2_queue *q);
  *
  * @src_sd: pointer to a source subdev
  * @sink:  pointer to a subdev sink pad
+ * @flags: the link flags
  *
  * This function searches for fwnode endpoint connections from a source
  * subdevice to a single sink pad, and if suitable connections are found,
@@ -98,6 +99,11 @@ int v4l_vb2q_enable_media_source(struct vb2_queue *q);
  * called by the sink subdevice, in its v4l2-async notifier subdev bound
  * callback, to create links from a bound source subdevice.
  *
+ * The @flags argument specifies the link flags. The caller shall ensure that
+ * the flags are valid regardless of the number of links that may be created.
+ * For instance, setting the MEDIA_LNK_FL_ENABLED flag will cause all created
+ * links to be enabled, which isn't valid if more than one link is created.
+ *
  * .. note::
  *
  *    Any sink subdevice that calls this function must implement the
@@ -107,7 +113,7 @@ int v4l_vb2q_enable_media_source(struct vb2_queue *q);
  * Return 0 on success or a negative error code on failure.
  */
 int v4l2_create_fwnode_links_to_pad(struct v4l2_subdev *src_sd,
-                                   struct media_pad *sink);
+                                   struct media_pad *sink, u32 flags);
 
 /**
  * v4l2_create_fwnode_links - Create fwnode-based links from a source