public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Kieran Bingham <kbingham@kernel.org>
To: laurent.pinchart@ideasonboard.com, niklas.soderlund@ragnatech.se,
	sakari.ailus@iki.fi
Cc: linux-media@vger.kernel.org, linux-renesas-soc@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Subject: [PATCH 2/5] rcar-vin: Match sources against ports if specified.
Date: Thu, 27 Apr 2017 19:26:01 +0100	[thread overview]
Message-ID: <1493317564-18026-3-git-send-email-kbingham@kernel.org> (raw)
In-Reply-To: <1493317564-18026-1-git-send-email-kbingham@kernel.org>

From: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>

If an endpoint source specifies a port number, then it may have
multiple entities provided by one DT node. In this event, match
against both the DT node and it's relevant port.

Signed-off-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
---
 drivers/media/platform/rcar-vin/rcar-core.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/drivers/media/platform/rcar-vin/rcar-core.c b/drivers/media/platform/rcar-vin/rcar-core.c
index a530dc388b95..afe382c9a55d 100644
--- a/drivers/media/platform/rcar-vin/rcar-core.c
+++ b/drivers/media/platform/rcar-vin/rcar-core.c
@@ -782,7 +782,8 @@ static int rvin_group_notify_bound(struct v4l2_async_notifier *notifier,
 			return 0;
 		}
 
-		if (vin->group->source[i].asd.match.of.node == new) {
+		if (vin->group->source[i].asd.match.of.node == new &&
+		    subdev->port == vin->group->source[i].asd.match.of.port) {
 			vin_dbg(vin, "Bound source %s\n", subdev->name);
 			vin->group->source[i].subdev = subdev;
 			mutex_unlock(&vin->group->lock);
@@ -820,7 +821,7 @@ static struct device_node *rvin_group_get_bridge(struct rvin_dev *vin,
 static struct device_node *
 rvin_group_get_source(struct rvin_dev *vin,
 		      struct device_node *bridge,
-		      unsigned int *remote_pad)
+		      unsigned int *remote_port)
 {
 	struct device_node *source, *ep, *rp;
 	struct v4l2_mbus_config mbus_cfg;
@@ -844,7 +845,7 @@ rvin_group_get_source(struct rvin_dev *vin,
 	rp = of_graph_get_remote_port(ep);
 	of_graph_parse_endpoint(rp, &endpoint);
 	of_node_put(rp);
-	*remote_pad = endpoint.id;
+	*remote_port = endpoint.id;
 
 	source = of_graph_get_remote_port_parent(ep);
 	of_node_put(ep);
@@ -861,7 +862,7 @@ rvin_group_get_source(struct rvin_dev *vin,
 static int rvin_group_graph_parse(struct rvin_dev *vin, unsigned long *bitmap)
 {
 	struct device_node *ep, *bridge, *source;
-	unsigned int i, remote_pad = 0;
+	unsigned int i, remote_port = 0;
 	u32 val;
 	int ret;
 
@@ -910,7 +911,7 @@ static int rvin_group_graph_parse(struct rvin_dev *vin, unsigned long *bitmap)
 		if (bridge == NULL)
 			continue;
 
-		source = rvin_group_get_source(vin, bridge, &remote_pad);
+		source = rvin_group_get_source(vin, bridge, &remote_port);
 		of_node_put(bridge);
 		if (IS_ERR(source))
 			return PTR_ERR(source);
@@ -922,14 +923,14 @@ static int rvin_group_graph_parse(struct rvin_dev *vin, unsigned long *bitmap)
 		vin->group->bridge[i].asd.match.of.node = bridge;
 		vin->group->bridge[i].asd.match_type = V4L2_ASYNC_MATCH_OF;
 		vin->group->source[i].asd.match.of.node = source;
+		vin->group->source[i].asd.match.of.port = remote_port;
 		vin->group->source[i].asd.match_type = V4L2_ASYNC_MATCH_OF;
-		vin->group->source[i].source_pad = remote_pad;
 
 		*bitmap |= BIT(i);
 
 		vin_dbg(vin, "Handle bridge %s and source %s pad %d\n",
 			of_node_full_name(bridge), of_node_full_name(source),
-			remote_pad);
+			remote_port);
 	}
 
 	/* All our sources are CSI-2 */
-- 
2.7.4

  parent reply	other threads:[~2017-04-27 18:27 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-27 18:25 [PATCH 0/5] RFC: ADV748x HDMI/Analog video receiver Kieran Bingham
2017-04-27 18:26 ` [PATCH 1/5] v4l2-subdev: Provide a port mapping for asynchronous subdevs Kieran Bingham
2017-04-27 21:43   ` Sakari Ailus
2017-04-27 22:13     ` Kieran Bingham
2017-04-27 22:49       ` Sakari Ailus
2017-04-28  0:00         ` Kieran Bingham
2017-04-27 18:26 ` Kieran Bingham [this message]
2017-04-27 18:26 ` [PATCH 3/5] media: i2c: adv748x: add adv748x driver Kieran Bingham
2017-04-27 18:26 ` [PATCH 4/5] arm64: dts: r8a7795: salvator-x: enable VIN, CSI and ADV7482 Kieran Bingham
2017-04-28  8:52   ` Sergei Shtylyov
2017-04-28 10:04     ` Geert Uytterhoeven
2017-04-28 10:05       ` Kieran Bingham
2017-04-27 18:26 ` [PATCH 5/5] arm64: dts: r8a7796: " Kieran Bingham
2017-04-28  7:09 ` [PATCH 0/5] RFC: ADV748x HDMI/Analog video receiver Simon Horman
2017-04-28  8:47   ` Kieran Bingham
2017-05-01  8:32     ` Simon Horman

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=1493317564-18026-3-git-send-email-kbingham@kernel.org \
    --to=kbingham@kernel.org \
    --cc=kieran.bingham+renesas@ideasonboard.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=niklas.soderlund@ragnatech.se \
    --cc=sakari.ailus@iki.fi \
    /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