[PATCH/RFC 5/9] media: rcar-vin: pad-aware driver initialisation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Add detection of source pad number for drivers aware of the media controller
API, so that rcar-vin can create device nodes to support modern drivers such
as adv7604.c (for HDMI on Lager) and the converted adv7180.c (for composite)
underneath.

Building rcar_vin gains a dependency on CONFIG_MEDIA_CONTROLLER, in
line with requirements for building the drivers associated with it.

Signed-off-by: William Towle <william.towle@xxxxxxxxxxxxxxx>
Signed-off-by: Rob Taylor <rob.taylor@xxxxxxxxxxxxxxx>
[uli: adapted to rcar-vin rewrite]
Signed-off-by: Ulrich Hecht <ulrich.hecht+renesas@xxxxxxxxx>
---
 drivers/media/platform/rcar-vin/rcar-dma.c | 15 +++++++++++++++
 drivers/media/platform/rcar-vin/rcar-vin.h |  1 +
 2 files changed, 16 insertions(+)

diff --git a/drivers/media/platform/rcar-vin/rcar-dma.c b/drivers/media/platform/rcar-vin/rcar-dma.c
index 70dc928..6b23c968 100644
--- a/drivers/media/platform/rcar-vin/rcar-dma.c
+++ b/drivers/media/platform/rcar-vin/rcar-dma.c
@@ -891,6 +891,9 @@ int rvin_dma_on(struct rvin_dev *vin)
 		.which = V4L2_SUBDEV_FORMAT_ACTIVE,
 	};
 	struct v4l2_mbus_framefmt *mf = &fmt.format;
+#if defined(CONFIG_MEDIA_CONTROLLER)
+	int pad_idx;
+#endif
 	int ret;
 
 	sd = vin_to_sd(vin);
@@ -924,6 +927,18 @@ int rvin_dma_on(struct rvin_dev *vin)
 
 	/* TODO: ret = rvin_sensor_setup(vin, pix, ...); */
 
+	vin->src_pad_idx = 0;
+#if defined(CONFIG_MEDIA_CONTROLLER)
+	for (pad_idx = 0; pad_idx < sd->entity.num_pads; pad_idx++)
+		if (sd->entity.pads[pad_idx].flags
+				== MEDIA_PAD_FL_SOURCE)
+			break;
+	if (pad_idx >= sd->entity.num_pads)
+		goto remove_device;
+
+	vin->src_pad_idx = pad_idx;
+#endif
+
 	vin->format.field = V4L2_FIELD_ANY;
 
 	video_set_drvdata(&vin->vdev, vin);
diff --git a/drivers/media/platform/rcar-vin/rcar-vin.h b/drivers/media/platform/rcar-vin/rcar-vin.h
index 99141d7..f127f5d 100644
--- a/drivers/media/platform/rcar-vin/rcar-vin.h
+++ b/drivers/media/platform/rcar-vin/rcar-vin.h
@@ -106,6 +106,7 @@ struct rvin_dev {
 	enum chip_id chip;
 
 	struct v4l2_device v4l2_dev;
+	int src_pad_idx;	/* For media-controller drivers */
 	struct v4l2_ctrl_handler ctrl_handler;
 
 	struct video_device vdev;
-- 
2.6.4




[Index of Archives]     [Linux Samsung SOC]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux