diff mbox

[v1,08/12] media: rcar: vin: Parse digital input after CSI on Gen3

Message ID 1497891889-8038-9-git-send-email-jacopo+renesas@jmondi.org (mailing list archive)
State Changes Requested
Delegated to: Geert Uytterhoeven
Headers show

Commit Message

Jacopo Mondi June 19, 2017, 5:04 p.m. UTC
When parsing available inputs on Gen3 boards, add parsing of digital
input enpoints to the already in-place CSI-2 node parsing.

Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
---
 drivers/media/platform/rcar-vin/rcar-core.c | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)
diff mbox

Patch

diff --git a/drivers/media/platform/rcar-vin/rcar-core.c b/drivers/media/platform/rcar-vin/rcar-core.c
index 6738825..78ca232 100644
--- a/drivers/media/platform/rcar-vin/rcar-core.c
+++ b/drivers/media/platform/rcar-vin/rcar-core.c
@@ -777,7 +777,9 @@  static int rvin_group_graph_parse(struct rvin_dev *vin, unsigned long *bitmap)
 	vin_dbg(vin, "I'm VIN number %u", val);
 	vin->group->vin[val] = vin;
 
-	/* Parse all CSI-2 nodes */
+	/* Parse all endpoints on Port@1 (CSI-2) and eventually on Port@2 */
+	vin->mbus_cfg.type = 0;
+	vin->mbus_cfg.flags = 0;
 	for (i = 0; i < RVIN_CSI_MAX; i++) {
 
 		/* Check if instance is connected to the CSI-2 */
@@ -804,15 +806,21 @@  static int rvin_group_graph_parse(struct rvin_dev *vin, unsigned long *bitmap)
 		vin->group->csi[i].asd.match_type = V4L2_ASYNC_MATCH_FWNODE;
 
 		*bitmap |= BIT(i);
+		vin->mbus_cfg.type = V4L2_MBUS_CSI2;
 
 		vin_dbg(vin, "Handle CSI-2 %s\n", of_node_full_name(csi));
 	}
 
-	/* All our sources are CSI-2 */
-	vin->mbus_cfg.type = V4L2_MBUS_CSI2;
-	vin->mbus_cfg.flags = 0;
+	/* Done with at least one CSI-2 port registered */
+	if (vin->mbus_cfg.type)
+		return 0;
 
-	return 0;
+	/* Check if any digital input is connected to this instance's Port@2 */
+	ret = rvin_digital_graph_parse(vin, 2, -1);
+	if (!ret)
+		*bitmap |=  BIT(RVIN_PARALLEL_IN);
+
+	return (!ret || (ret == -ENOENT)) ? 0 : ret;
 }
 
 /* group lock should be held when calling this function */