public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: "Niklas Söderlund" <niklas.soderlund+renesas@ragnatech.se>
To: Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	Hans Verkuil <hverkuil@xs4all.nl>
Cc: linux-media@vger.kernel.org, linux-renesas-soc@vger.kernel.org,
	tomoharu.fukawa.eb@renesas.com,
	"Sakari Ailus" <sakari.ailus@linux.intel.com>,
	"Geert Uytterhoeven" <geert@linux-m68k.org>,
	"Niklas Söderlund" <niklas.soderlund+renesas@ragnatech.se>,
	"Michal Simek" <michal.simek@xilinx.com>
Subject: [PATCH v3 03/27] media: entity: Add media_entity_has_route() function
Date: Tue, 14 Mar 2017 20:02:44 +0100	[thread overview]
Message-ID: <20170314190308.25790-4-niklas.soderlund+renesas@ragnatech.se> (raw)
In-Reply-To: <20170314190308.25790-1-niklas.soderlund+renesas@ragnatech.se>

From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

This is a wrapper around the media entity has_route operation.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
---
 drivers/media/media-entity.c | 16 ++++++++++++++++
 include/media/media-entity.h | 16 ++++++++++++++++
 2 files changed, 32 insertions(+)

diff --git a/drivers/media/media-entity.c b/drivers/media/media-entity.c
index 5640ca29da8c9bbc..ccd991d2d3450ab3 100644
--- a/drivers/media/media-entity.c
+++ b/drivers/media/media-entity.c
@@ -244,6 +244,22 @@ EXPORT_SYMBOL_GPL(media_entity_pads_init);
  * Graph traversal
  */
 
+bool media_entity_has_route(struct media_entity *entity, unsigned int pad0,
+			    unsigned int pad1)
+{
+	if (pad0 >= entity->num_pads || pad1 >= entity->num_pads)
+		return false;
+
+	if (pad0 == pad1)
+		return true;
+
+	if (!entity->ops || !entity->ops->has_route)
+		return true;
+
+	return entity->ops->has_route(entity, pad0, pad1);
+}
+EXPORT_SYMBOL_GPL(media_entity_has_route);
+
 static struct media_entity *
 media_entity_other(struct media_entity *entity, struct media_link *link)
 {
diff --git a/include/media/media-entity.h b/include/media/media-entity.h
index bcb08c1f8c6265e8..b896827b4ebdfaa6 100644
--- a/include/media/media-entity.h
+++ b/include/media/media-entity.h
@@ -830,6 +830,22 @@ __must_check int media_graph_walk_init(
 	struct media_graph *graph, struct media_device *mdev);
 
 /**
+ * media_entity_has_route - Check if two entity pads are connected internally
+ *
+ * @entity: The entity
+ * @pad0: The first pad index
+ * @pad1: The second pad index
+ *
+ * This function can be used to check whether two pads of an entity are
+ * connected internally in the entity.
+ *
+ * The caller must hold entity->graph_obj.mdev->mutex.
+ *
+ * Return: true if the pads are connected internally and false otherwise.
+ */
+bool media_entity_has_route(struct media_entity *entity, unsigned int pad0,
+			    unsigned int pad1);
+/**
  * media_graph_walk_cleanup - Release resources used by graph walk.
  *
  * @graph: Media graph structure that will be used to walk the graph
-- 
2.12.0

  parent reply	other threads:[~2017-03-14 19:06 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-14 19:02 [PATCH v3 00/27] rcar-vin: Add Gen3 with media controller support Niklas Söderlund
2017-03-14 19:02 ` [PATCH v3 01/27] rcar-vin: add Gen3 devicetree bindings documentation Niklas Söderlund
2017-03-14 19:02 ` [PATCH v3 02/27] media: entity: Add has_route entity operation Niklas Söderlund
2017-03-14 19:02 ` Niklas Söderlund [this message]
2017-03-14 19:02 ` [PATCH v3 04/27] media: entity: Swap pads if route is checked from source to sink Niklas Söderlund
2017-03-14 19:02 ` [PATCH v3 05/27] rcar-vin: move chip information to own struct Niklas Söderlund
2017-03-14 19:02 ` [PATCH v3 06/27] rcar-vin: move max width and height information to chip information Niklas Söderlund
2017-03-15  9:37   ` Sergei Shtylyov
2017-03-14 19:02 ` [PATCH v3 07/27] rcar-vin: change name of video device Niklas Söderlund
2017-03-14 19:02 ` [PATCH v3 08/27] rcar-vin: move functions regarding scaling Niklas Söderlund
2017-03-14 19:02 ` [PATCH v3 09/27] rcar-vin: all Gen2 boards can scale simplify logic Niklas Söderlund
2017-03-14 19:02 ` [PATCH v3 10/27] rcar-vin: do not reset crop and compose when setting format Niklas Söderlund
2017-03-14 19:02 ` [PATCH v3 11/27] rcar-vin: do not allow changing scaling and composing while streaming Niklas Söderlund
2017-03-14 19:02 ` [PATCH v3 12/27] rcar-vin: read subdevice format for crop only when needed Niklas Söderlund
2017-03-14 19:02 ` [PATCH v3 13/27] rcar-vin: do not cut height in two for top, bottom or alternate fields Niklas Söderlund
2017-03-14 19:02 ` [PATCH v3 14/27] rcar-vin: move media bus configuration to struct rvin_info Niklas Söderlund
2017-03-14 19:02 ` [PATCH v3 15/27] rcar-vin: enable Gen3 hardware configuration Niklas Söderlund
2017-03-14 19:02 ` [PATCH v3 16/27] rcar-vin: add functions to manipulate Gen3 CHSEL value Niklas Söderlund
2017-03-14 19:02 ` [PATCH v3 17/27] rcar-vin: prepare digital notifier for group notifier Niklas Söderlund
2017-03-14 19:02 ` [PATCH v3 18/27] rcar-vin: add flag to switch to media controller mode Niklas Söderlund
2017-03-14 19:03 ` [PATCH v3 19/27] rcar-vin: use different v4l2 operations in " Niklas Söderlund
2017-03-14 19:03 ` [PATCH v3 20/27] rcar-vin: register a media pad if running " Niklas Söderlund
2017-03-14 19:03 ` [PATCH v3 21/27] rcar-vin: add group allocator functions Niklas Söderlund
2017-03-14 19:03 ` [PATCH v3 22/27] rcar-vin: add chsel information to rvin_info Niklas Söderlund
2017-03-14 19:03 ` [PATCH v3 23/27] rcar-vin: parse Gen3 OF and setup media graph Niklas Söderlund
2017-03-14 19:03 ` [PATCH v3 24/27] rcar-vin: add link notify for Gen3 Niklas Söderlund
2017-03-14 19:03 ` [PATCH v3 25/27] rcar-vin: extend {start,stop}_streaming to work with media controller Niklas Söderlund
2017-03-14 19:03 ` [PATCH v3 26/27] rcar-vin: enable support for r8a7795 Niklas Söderlund
2017-03-14 19:03 ` [PATCH v3 27/27] rcar-vin: enable support for r8a7796 Niklas Söderlund
2017-03-16  8:36   ` Geert Uytterhoeven
2017-03-16  9:17     ` Niklas Söderlund
2017-04-24 18:14 ` [PATCH 2/2] rcar-vin: group: use correct of_node Kieran Bingham
2017-04-25 14:30   ` Niklas Söderlund
2017-04-25 14:33     ` Kieran Bingham

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=20170314190308.25790-4-niklas.soderlund+renesas@ragnatech.se \
    --to=niklas.soderlund+renesas@ragnatech.se \
    --cc=geert@linux-m68k.org \
    --cc=hverkuil@xs4all.nl \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=michal.simek@xilinx.com \
    --cc=sakari.ailus@linux.intel.com \
    --cc=tomoharu.fukawa.eb@renesas.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