linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/7] Lager board HDMI input support
@ 2016-04-14 16:17 Ulrich Hecht
  2016-04-14 16:17 ` [PATCH v3 1/7] v4l: subdev: Add pad config allocator and init Ulrich Hecht
                   ` (6 more replies)
  0 siblings, 7 replies; 15+ messages in thread
From: Ulrich Hecht @ 2016-04-14 16:17 UTC (permalink / raw)
  To: hans.verkuil, niklas.soderlund
  Cc: linux-media, linux-renesas-soc, magnus.damm, laurent.pinchart,
	ian.molton, lars, william.towle, Ulrich Hecht

Hi!

This series implements Lager HDMI input support on top of version 4 of
Niklas's rcar-vin rewrite ("[PATCHv4] [media] rcar-vin: add Renesas R-Car
VIN driver").

Apart from rebasing, this revision removes one patch that has since been
picked up, squashes the DT changes into one patch and adjusts its subject
line slightly.

CU
Uli


Changes since v2:
- rebased on top of rcar-vin driver v4
- removed "adv7604: fix SPA register location for ADV7612" (picked up)
- changed prefix of dts patch to "ARM: dts: lager: "


Laurent Pinchart (1):
  v4l: subdev: Add pad config allocator and init

Ulrich Hecht (4):
  media: rcar_vin: Use correct pad number in try_fmt
  media: rcar-vin: pad-aware driver initialisation
  media: rcar-vin: add DV timings support
  media: rcar-vin: initialize EDID data

William Towle (2):
  media: adv7604: automatic "default-input" selection
  ARM: dts: lager: Add entries for VIN HDMI input support

 arch/arm/boot/dts/r8a7790-lager.dts         |  41 +++++++-
 drivers/media/i2c/adv7604.c                 |  18 +++-
 drivers/media/platform/rcar-vin/rcar-v4l2.c | 145 +++++++++++++++++++++++++++-
 drivers/media/platform/rcar-vin/rcar-vin.h  |   2 +
 drivers/media/v4l2-core/v4l2-subdev.c       |  19 +++-
 include/media/v4l2-subdev.h                 |  10 ++
 6 files changed, 229 insertions(+), 6 deletions(-)

-- 
2.7.4


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH v3 1/7] v4l: subdev: Add pad config allocator and init
  2016-04-14 16:17 [PATCH v3 0/7] Lager board HDMI input support Ulrich Hecht
@ 2016-04-14 16:17 ` Ulrich Hecht
  2016-04-14 16:17 ` [PATCH v3 2/7] media: adv7604: automatic "default-input" selection Ulrich Hecht
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 15+ messages in thread
From: Ulrich Hecht @ 2016-04-14 16:17 UTC (permalink / raw)
  To: hans.verkuil, niklas.soderlund
  Cc: linux-media, linux-renesas-soc, magnus.damm, laurent.pinchart,
	ian.molton, lars, william.towle, Laurent Pinchart

From: Laurent Pinchart <laurent.pinchart@linaro.org>

Add a new subdev operation to initialize a subdev pad config array, and
a helper function to allocate and initialize the array. This can be used
by bridge drivers to implement try format based on subdev pad
operations.

Signed-off-by: Laurent Pinchart <laurent.pinchart@linaro.org>
Acked-by: Vaibhav Hiremath <vaibhav.hiremath@linaro.org>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
---
 drivers/media/v4l2-core/v4l2-subdev.c | 19 ++++++++++++++++++-
 include/media/v4l2-subdev.h           | 10 ++++++++++
 2 files changed, 28 insertions(+), 1 deletion(-)

diff --git a/drivers/media/v4l2-core/v4l2-subdev.c b/drivers/media/v4l2-core/v4l2-subdev.c
index d630838..f32ac0d 100644
--- a/drivers/media/v4l2-core/v4l2-subdev.c
+++ b/drivers/media/v4l2-core/v4l2-subdev.c
@@ -35,7 +35,7 @@
 static int subdev_fh_init(struct v4l2_subdev_fh *fh, struct v4l2_subdev *sd)
 {
 #if defined(CONFIG_VIDEO_V4L2_SUBDEV_API)
-	fh->pad = kzalloc(sizeof(*fh->pad) * sd->entity.num_pads, GFP_KERNEL);
+	fh->pad = v4l2_subdev_alloc_pad_config(sd);
 	if (fh->pad == NULL)
 		return -ENOMEM;
 #endif
@@ -569,6 +569,23 @@ int v4l2_subdev_link_validate(struct media_link *link)
 		sink, link, &source_fmt, &sink_fmt);
 }
 EXPORT_SYMBOL_GPL(v4l2_subdev_link_validate);
+
+struct v4l2_subdev_pad_config *v4l2_subdev_alloc_pad_config(struct v4l2_subdev *sd)
+{
+	struct v4l2_subdev_pad_config *cfg;
+
+	if (!sd->entity.num_pads)
+		return NULL;
+
+	cfg = kcalloc(sd->entity.num_pads, sizeof(*cfg), GFP_KERNEL);
+	if (!cfg)
+		return NULL;
+
+	v4l2_subdev_call(sd, pad, init_cfg, cfg);
+
+	return cfg;
+}
+EXPORT_SYMBOL_GPL(v4l2_subdev_alloc_pad_config);
 #endif /* CONFIG_MEDIA_CONTROLLER */
 
 void v4l2_subdev_init(struct v4l2_subdev *sd, const struct v4l2_subdev_ops *ops)
diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h
index 11e2dfe..6c47cdd 100644
--- a/include/media/v4l2-subdev.h
+++ b/include/media/v4l2-subdev.h
@@ -607,6 +607,8 @@ struct v4l2_subdev_pad_config {
  *                  may be adjusted by the subdev driver to device capabilities.
  */
 struct v4l2_subdev_pad_ops {
+	void (*init_cfg)(struct v4l2_subdev *sd,
+			 struct v4l2_subdev_pad_config *cfg);
 	int (*enum_mbus_code)(struct v4l2_subdev *sd,
 			      struct v4l2_subdev_pad_config *cfg,
 			      struct v4l2_subdev_mbus_code_enum *code);
@@ -801,7 +803,15 @@ int v4l2_subdev_link_validate_default(struct v4l2_subdev *sd,
 				      struct v4l2_subdev_format *source_fmt,
 				      struct v4l2_subdev_format *sink_fmt);
 int v4l2_subdev_link_validate(struct media_link *link);
+
+struct v4l2_subdev_pad_config *v4l2_subdev_alloc_pad_config(struct v4l2_subdev *sd);
+
+static inline void v4l2_subdev_free_pad_config(struct v4l2_subdev_pad_config *cfg)
+{
+	kfree(cfg);
+}
 #endif /* CONFIG_MEDIA_CONTROLLER */
+
 void v4l2_subdev_init(struct v4l2_subdev *sd,
 		      const struct v4l2_subdev_ops *ops);
 
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH v3 2/7] media: adv7604: automatic "default-input" selection
  2016-04-14 16:17 [PATCH v3 0/7] Lager board HDMI input support Ulrich Hecht
  2016-04-14 16:17 ` [PATCH v3 1/7] v4l: subdev: Add pad config allocator and init Ulrich Hecht
@ 2016-04-14 16:17 ` Ulrich Hecht
  2016-04-14 16:17 ` [PATCH v3 3/7] media: rcar_vin: Use correct pad number in try_fmt Ulrich Hecht
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 15+ messages in thread
From: Ulrich Hecht @ 2016-04-14 16:17 UTC (permalink / raw)
  To: hans.verkuil, niklas.soderlund
  Cc: linux-media, linux-renesas-soc, magnus.damm, laurent.pinchart,
	ian.molton, lars, william.towle, Ulrich Hecht

From: William Towle <william.towle@codethink.co.uk>

Add logic such that the "default-input" property becomes unnecessary
for chips that only have one suitable input (ADV7611 by design, and
ADV7612 due to commit 7111cddd518f ("[media] media: adv7604: reduce
support to first (digital) input").

Additionally, Ian's documentation in commit bf9c82278c34 ("[media]
media: adv7604: ability to read default input port from DT") states
that the "default-input" property should reside directly in the node
for adv7612. Hence, also adjust the parsing to make the implementation
consistent with this.

Signed-off-by: William Towle <william.towle@codethink.co.uk>
Signed-off-by: Ulrich Hecht <ulrich.hecht+renesas@gmail.com>
---
 drivers/media/i2c/adv7604.c | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
index 41a1bfc..d722c16 100644
--- a/drivers/media/i2c/adv7604.c
+++ b/drivers/media/i2c/adv7604.c
@@ -2788,7 +2788,7 @@ static int adv76xx_parse_dt(struct adv76xx_state *state)
 	struct device_node *np;
 	unsigned int flags;
 	int ret;
-	u32 v;
+	u32 v = -1;
 
 	np = state->i2c_clients[ADV76XX_PAGE_IO]->dev.of_node;
 
@@ -2810,6 +2810,22 @@ static int adv76xx_parse_dt(struct adv76xx_state *state)
 
 	of_node_put(endpoint);
 
+	if (of_property_read_u32(np, "default-input", &v)) {
+		/* not specified ... can we choose automatically? */
+		switch (state->info->type) {
+		case ADV7611:
+			v = 0;
+			break;
+		case ADV7612:
+			if (state->info->max_port == ADV76XX_PAD_HDMI_PORT_A)
+				v = 0;
+			/* else is unhobbled, leave unspecified */
+		default:
+			break;
+		}
+	}
+	state->pdata.default_input = v;
+
 	flags = bus_cfg.bus.parallel.flags;
 
 	if (flags & V4L2_MBUS_HSYNC_ACTIVE_HIGH)
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH v3 3/7] media: rcar_vin: Use correct pad number in try_fmt
  2016-04-14 16:17 [PATCH v3 0/7] Lager board HDMI input support Ulrich Hecht
  2016-04-14 16:17 ` [PATCH v3 1/7] v4l: subdev: Add pad config allocator and init Ulrich Hecht
  2016-04-14 16:17 ` [PATCH v3 2/7] media: adv7604: automatic "default-input" selection Ulrich Hecht
@ 2016-04-14 16:17 ` Ulrich Hecht
  2016-04-14 16:17 ` [PATCH v3 4/7] media: rcar-vin: pad-aware driver initialisation Ulrich Hecht
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 15+ messages in thread
From: Ulrich Hecht @ 2016-04-14 16:17 UTC (permalink / raw)
  To: hans.verkuil, niklas.soderlund
  Cc: linux-media, linux-renesas-soc, magnus.damm, laurent.pinchart,
	ian.molton, lars, william.towle, Ulrich Hecht

Fix rcar_vin_try_fmt's use of an inappropriate pad number when calling
the subdev set_fmt function - for the ADV7612, IDs should be non-zero.

Signed-off-by: William Towle <william.towle@codethink.co.uk>
Reviewed-by: Rob Taylor <rob.taylor@codethink.co.uk>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
[uli: adapted to rcar-vin rewrite]
Signed-off-by: Ulrich Hecht <ulrich.hecht+renesas@gmail.com>
---
 drivers/media/platform/rcar-vin/rcar-v4l2.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/drivers/media/platform/rcar-vin/rcar-v4l2.c b/drivers/media/platform/rcar-vin/rcar-v4l2.c
index a752171..43aec3c 100644
--- a/drivers/media/platform/rcar-vin/rcar-v4l2.c
+++ b/drivers/media/platform/rcar-vin/rcar-v4l2.c
@@ -97,7 +97,7 @@ static int __rvin_try_format_sensor(struct rvin_dev *vin,
 					struct rvin_sensor *sensor)
 {
 	struct v4l2_subdev *sd;
-	struct v4l2_subdev_pad_config pad_cfg;
+	struct v4l2_subdev_pad_config *pad_cfg;
 	struct v4l2_subdev_format format = {
 		.which = which,
 	};
@@ -105,12 +105,18 @@ static int __rvin_try_format_sensor(struct rvin_dev *vin,
 
 	sd = vin_to_sd(vin);
 
+	pad_cfg = v4l2_subdev_alloc_pad_config(sd);
+	if (pad_cfg == NULL)
+		return -ENOMEM;
+
 	v4l2_fill_mbus_format(&format.format, pix, vin->sensor.code);
 
+	format.pad = vin->src_pad_idx;
+
 	ret = v4l2_device_call_until_err(sd->v4l2_dev, 0, pad, set_fmt,
-					 &pad_cfg, &format);
+					 pad_cfg, &format);
 	if (ret < 0)
-		return ret;
+		goto cleanup;
 
 	v4l2_fill_pix_format(pix, &format.format);
 
@@ -119,6 +125,8 @@ static int __rvin_try_format_sensor(struct rvin_dev *vin,
 
 	vin_dbg(vin, "Sensor format: %ux%u\n", sensor->width, sensor->height);
 
+cleanup:
+	v4l2_subdev_free_pad_config(pad_cfg);
 	return 0;
 }
 
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH v3 4/7] media: rcar-vin: pad-aware driver initialisation
  2016-04-14 16:17 [PATCH v3 0/7] Lager board HDMI input support Ulrich Hecht
                   ` (2 preceding siblings ...)
  2016-04-14 16:17 ` [PATCH v3 3/7] media: rcar_vin: Use correct pad number in try_fmt Ulrich Hecht
@ 2016-04-14 16:17 ` Ulrich Hecht
  2016-04-14 16:17 ` [PATCH v3 5/7] media: rcar-vin: add DV timings support Ulrich Hecht
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 15+ messages in thread
From: Ulrich Hecht @ 2016-04-14 16:17 UTC (permalink / raw)
  To: hans.verkuil, niklas.soderlund
  Cc: linux-media, linux-renesas-soc, magnus.damm, laurent.pinchart,
	ian.molton, lars, william.towle, Ulrich Hecht, Rob Taylor

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@codethink.co.uk>
Signed-off-by: Rob Taylor <rob.taylor@codethink.co.uk>
[uli: adapted to rcar-vin rewrite]
Signed-off-by: Ulrich Hecht <ulrich.hecht+renesas@gmail.com>
---
 drivers/media/platform/rcar-vin/rcar-v4l2.c | 16 ++++++++++++++++
 drivers/media/platform/rcar-vin/rcar-vin.h  |  2 ++
 2 files changed, 18 insertions(+)

diff --git a/drivers/media/platform/rcar-vin/rcar-v4l2.c b/drivers/media/platform/rcar-vin/rcar-v4l2.c
index 43aec3c..d8d5f3a 100644
--- a/drivers/media/platform/rcar-vin/rcar-v4l2.c
+++ b/drivers/media/platform/rcar-vin/rcar-v4l2.c
@@ -659,6 +659,9 @@ int rvin_v4l2_probe(struct rvin_dev *vin)
 	struct v4l2_mbus_framefmt *mf = &fmt.format;
 	struct video_device *vdev = &vin->vdev;
 	struct v4l2_subdev *sd = vin_to_sd(vin);
+#if defined(CONFIG_MEDIA_CONTROLLER)
+	int pad_idx;
+#endif
 	int ret;
 
 	v4l2_set_subdev_hostdata(sd, vin);
@@ -701,6 +704,19 @@ int rvin_v4l2_probe(struct rvin_dev *vin)
 	vdev->lock = &vin->lock;
 	vdev->ctrl_handler = &vin->ctrl_handler;
 
+	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)
+		return -EINVAL;
+
+	vin->src_pad_idx = pad_idx;
+#endif
+	fmt.pad = vin->src_pad_idx;
+
 	/* Try to improve our guess of a reasonable window format */
 	ret = v4l2_subdev_call(sd, pad, get_fmt, NULL, &fmt);
 	if (ret) {
diff --git a/drivers/media/platform/rcar-vin/rcar-vin.h b/drivers/media/platform/rcar-vin/rcar-vin.h
index 01c5086..959f5da 100644
--- a/drivers/media/platform/rcar-vin/rcar-vin.h
+++ b/drivers/media/platform/rcar-vin/rcar-vin.h
@@ -87,6 +87,7 @@ struct rvin_graph_entity {
  *
  * @vdev:		V4L2 video device associated with VIN
  * @v4l2_dev:		V4L2 device
+ * @src_pad_idx:	source pad index for media controller drivers
  * @ctrl_handler:	V4L2 control handler
  * @notifier:		V4L2 asynchronous subdevs notifier
  * @entity:		entity in the DT for subdevice
@@ -118,6 +119,7 @@ struct rvin_dev {
 
 	struct video_device vdev;
 	struct v4l2_device v4l2_dev;
+	int src_pad_idx;
 	struct v4l2_ctrl_handler ctrl_handler;
 	struct v4l2_async_notifier notifier;
 	struct rvin_graph_entity entity;
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH v3 5/7] media: rcar-vin: add DV timings support
  2016-04-14 16:17 [PATCH v3 0/7] Lager board HDMI input support Ulrich Hecht
                   ` (3 preceding siblings ...)
  2016-04-14 16:17 ` [PATCH v3 4/7] media: rcar-vin: pad-aware driver initialisation Ulrich Hecht
@ 2016-04-14 16:17 ` Ulrich Hecht
  2016-04-18 10:04   ` Hans Verkuil
                     ` (2 more replies)
  2016-04-14 16:17 ` [PATCH v3 6/7] media: rcar-vin: initialize EDID data Ulrich Hecht
  2016-04-14 16:17 ` [PATCH v3 7/7] ARM: dts: lager: Add entries for VIN HDMI input support Ulrich Hecht
  6 siblings, 3 replies; 15+ messages in thread
From: Ulrich Hecht @ 2016-04-14 16:17 UTC (permalink / raw)
  To: hans.verkuil, niklas.soderlund
  Cc: linux-media, linux-renesas-soc, magnus.damm, laurent.pinchart,
	ian.molton, lars, william.towle, Ulrich Hecht

Adds ioctls DV_TIMINGS_CAP, ENUM_DV_TIMINGS, G_DV_TIMINGS, S_DV_TIMINGS,
and QUERY_DV_TIMINGS.

Signed-off-by: Ulrich Hecht <ulrich.hecht+renesas@gmail.com>
---
 drivers/media/platform/rcar-vin/rcar-v4l2.c | 69 +++++++++++++++++++++++++++++
 1 file changed, 69 insertions(+)

diff --git a/drivers/media/platform/rcar-vin/rcar-v4l2.c b/drivers/media/platform/rcar-vin/rcar-v4l2.c
index d8d5f3a..ba2ed4e 100644
--- a/drivers/media/platform/rcar-vin/rcar-v4l2.c
+++ b/drivers/media/platform/rcar-vin/rcar-v4l2.c
@@ -413,12 +413,17 @@ static int rvin_enum_input(struct file *file, void *priv,
 			   struct v4l2_input *i)
 {
 	struct rvin_dev *vin = video_drvdata(file);
+	struct v4l2_subdev *sd = vin_to_sd(vin);
 
 	if (i->index != 0)
 		return -EINVAL;
 
 	i->type = V4L2_INPUT_TYPE_CAMERA;
 	i->std = vin->vdev.tvnorms;
+
+	if (v4l2_subdev_has_op(sd, pad, dv_timings_cap))
+		i->capabilities = V4L2_IN_CAP_DV_TIMINGS;
+
 	strlcpy(i->name, "Camera", sizeof(i->name));
 
 	return 0;
@@ -461,6 +466,64 @@ static int rvin_g_std(struct file *file, void *priv, v4l2_std_id *a)
 	return v4l2_subdev_call(sd, video, g_std, a);
 }
 
+static int rvin_enum_dv_timings(struct file *file, void *priv_fh,
+				    struct v4l2_enum_dv_timings *timings)
+{
+	struct rvin_dev *vin = video_drvdata(file);
+	struct v4l2_subdev *sd = vin_to_sd(vin);
+
+	timings->pad = 0;
+	return v4l2_subdev_call(sd,
+			pad, enum_dv_timings, timings);
+}
+
+static int rvin_s_dv_timings(struct file *file, void *priv_fh,
+				    struct v4l2_dv_timings *timings)
+{
+	struct rvin_dev *vin = video_drvdata(file);
+	struct v4l2_subdev *sd = vin_to_sd(vin);
+	int err;
+
+	err = v4l2_subdev_call(sd,
+			video, s_dv_timings, timings);
+	if (!err) {
+		vin->sensor.width = timings->bt.width;
+		vin->sensor.height = timings->bt.height;
+	}
+	return err;
+}
+
+static int rvin_g_dv_timings(struct file *file, void *priv_fh,
+				    struct v4l2_dv_timings *timings)
+{
+	struct rvin_dev *vin = video_drvdata(file);
+	struct v4l2_subdev *sd = vin_to_sd(vin);
+
+	return v4l2_subdev_call(sd,
+			video, g_dv_timings, timings);
+}
+
+static int rvin_query_dv_timings(struct file *file, void *priv_fh,
+				    struct v4l2_dv_timings *timings)
+{
+	struct rvin_dev *vin = video_drvdata(file);
+	struct v4l2_subdev *sd = vin_to_sd(vin);
+
+	return v4l2_subdev_call(sd,
+			video, query_dv_timings, timings);
+}
+
+static int rvin_dv_timings_cap(struct file *file, void *priv_fh,
+				    struct v4l2_dv_timings_cap *cap)
+{
+	struct rvin_dev *vin = video_drvdata(file);
+	struct v4l2_subdev *sd = vin_to_sd(vin);
+
+	cap->pad = 0;
+	return v4l2_subdev_call(sd,
+			pad, dv_timings_cap, cap);
+}
+
 static const struct v4l2_ioctl_ops rvin_ioctl_ops = {
 	.vidioc_querycap		= rvin_querycap,
 	.vidioc_try_fmt_vid_cap		= rvin_try_fmt_vid_cap,
@@ -477,6 +540,12 @@ static const struct v4l2_ioctl_ops rvin_ioctl_ops = {
 	.vidioc_g_input			= rvin_g_input,
 	.vidioc_s_input			= rvin_s_input,
 
+	.vidioc_dv_timings_cap		= rvin_dv_timings_cap,
+	.vidioc_enum_dv_timings		= rvin_enum_dv_timings,
+	.vidioc_g_dv_timings		= rvin_g_dv_timings,
+	.vidioc_s_dv_timings		= rvin_s_dv_timings,
+	.vidioc_query_dv_timings	= rvin_query_dv_timings,
+
 	.vidioc_querystd		= rvin_querystd,
 	.vidioc_g_std			= rvin_g_std,
 	.vidioc_s_std			= rvin_s_std,
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH v3 6/7] media: rcar-vin: initialize EDID data
  2016-04-14 16:17 [PATCH v3 0/7] Lager board HDMI input support Ulrich Hecht
                   ` (4 preceding siblings ...)
  2016-04-14 16:17 ` [PATCH v3 5/7] media: rcar-vin: add DV timings support Ulrich Hecht
@ 2016-04-14 16:17 ` Ulrich Hecht
  2016-04-18 10:13   ` Hans Verkuil
  2016-04-14 16:17 ` [PATCH v3 7/7] ARM: dts: lager: Add entries for VIN HDMI input support Ulrich Hecht
  6 siblings, 1 reply; 15+ messages in thread
From: Ulrich Hecht @ 2016-04-14 16:17 UTC (permalink / raw)
  To: hans.verkuil, niklas.soderlund
  Cc: linux-media, linux-renesas-soc, magnus.damm, laurent.pinchart,
	ian.molton, lars, william.towle, Ulrich Hecht

Initializes the decoder subdevice with a fixed EDID blob.

Signed-off-by: Ulrich Hecht <ulrich.hecht+renesas@gmail.com>
---
 drivers/media/platform/rcar-vin/rcar-v4l2.c | 46 +++++++++++++++++++++++++++++
 1 file changed, 46 insertions(+)

diff --git a/drivers/media/platform/rcar-vin/rcar-v4l2.c b/drivers/media/platform/rcar-vin/rcar-v4l2.c
index ba2ed4e..5b32105 100644
--- a/drivers/media/platform/rcar-vin/rcar-v4l2.c
+++ b/drivers/media/platform/rcar-vin/rcar-v4l2.c
@@ -720,6 +720,41 @@ void rvin_v4l2_remove(struct rvin_dev *vin)
 	video_unregister_device(&vin->vdev);
 }
 
+static u8 edid[256] = {
+	0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00,
+	0x48, 0xAE, 0x9C, 0x27, 0x00, 0x00, 0x00, 0x00,
+	0x19, 0x12, 0x01, 0x03, 0x80, 0x00, 0x00, 0x78,
+	0x0E, 0x00, 0xB2, 0xA0, 0x57, 0x49, 0x9B, 0x26,
+	0x10, 0x48, 0x4F, 0x2F, 0xCF, 0x00, 0x31, 0x59,
+	0x45, 0x59, 0x61, 0x59, 0x81, 0x99, 0x01, 0x01,
+	0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x3A,
+	0x80, 0x18, 0x71, 0x38, 0x2D, 0x40, 0x58, 0x2C,
+	0x46, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1E,
+	0x00, 0x00, 0x00, 0xFD, 0x00, 0x31, 0x55, 0x18,
+	0x5E, 0x11, 0x00, 0x0A, 0x20, 0x20, 0x20, 0x20,
+	0x20, 0x20, 0x00, 0x00, 0x00, 0xFC, 0x00, 0x43,
+	0x20, 0x39, 0x30, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A,
+	0x0A, 0x0A, 0x0A, 0x0A, 0x00, 0x00, 0x00, 0x10,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x68,
+	0x02, 0x03, 0x1a, 0xc0, 0x48, 0xa2, 0x10, 0x04,
+	0x02, 0x01, 0x21, 0x14, 0x13, 0x23, 0x09, 0x07,
+	0x07, 0x65, 0x03, 0x0c, 0x00, 0x10, 0x00, 0xe2,
+	0x00, 0x2a, 0x01, 0x1d, 0x00, 0x80, 0x51, 0xd0,
+	0x1c, 0x20, 0x40, 0x80, 0x35, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x1e, 0x8c, 0x0a, 0xd0, 0x8a,
+	0x20, 0xe0, 0x2d, 0x10, 0x10, 0x3e, 0x96, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd7
+};
+
 int rvin_v4l2_probe(struct rvin_dev *vin)
 {
 	struct v4l2_subdev_format fmt = {
@@ -821,5 +856,16 @@ int rvin_v4l2_probe(struct rvin_dev *vin)
 	v4l2_info(&vin->v4l2_dev, "Device registered as %s\n",
 		  video_device_node_name(&vin->vdev));
 
+	{
+		struct v4l2_subdev_edid rvin_edid = {
+			.pad = 0,
+			.start_block = 0,
+			.blocks = 2,
+			.edid = edid,
+		};
+		v4l2_subdev_call(sd, pad, set_edid,
+				&rvin_edid);
+	}
+
 	return ret;
 }
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH v3 7/7] ARM: dts: lager: Add entries for VIN HDMI input support
  2016-04-14 16:17 [PATCH v3 0/7] Lager board HDMI input support Ulrich Hecht
                   ` (5 preceding siblings ...)
  2016-04-14 16:17 ` [PATCH v3 6/7] media: rcar-vin: initialize EDID data Ulrich Hecht
@ 2016-04-14 16:17 ` Ulrich Hecht
  6 siblings, 0 replies; 15+ messages in thread
From: Ulrich Hecht @ 2016-04-14 16:17 UTC (permalink / raw)
  To: hans.verkuil, niklas.soderlund
  Cc: linux-media, linux-renesas-soc, magnus.damm, laurent.pinchart,
	ian.molton, lars, william.towle, Rob Taylor, Ulrich Hecht

From: William Towle <william.towle@codethink.co.uk>

Add DT entries for vin0, vin0_pins, and adv7612.

Sets the 'default-input' property for ADV7612, enabling image and video
capture without the need to have userspace specifying routing.

Signed-off-by: William Towle <william.towle@codethink.co.uk>
Signed-off-by: Rob Taylor <rob.taylor@codethink.co.uk>
[uli: added interrupt, renamed endpoint, merged default-input]
Signed-off-by: Ulrich Hecht <ulrich.hecht+renesas@gmail.com>
---
 arch/arm/boot/dts/r8a7790-lager.dts | 41 ++++++++++++++++++++++++++++++++++++-
 1 file changed, 40 insertions(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/r8a7790-lager.dts b/arch/arm/boot/dts/r8a7790-lager.dts
index aa6ca92..eed0974 100644
--- a/arch/arm/boot/dts/r8a7790-lager.dts
+++ b/arch/arm/boot/dts/r8a7790-lager.dts
@@ -414,7 +414,12 @@
 		renesas,function = "usb2";
 	};
 
-	vin1_pins: vin {
+	vin0_pins: vin0 {
+		renesas,groups = "vin0_data24", "vin0_sync", "vin0_clkenb", "vin0_clk";
+		renesas,function = "vin0";
+	};
+
+	vin1_pins: vin1 {
 		renesas,groups = "vin1_data8", "vin1_clk";
 		renesas,function = "vin1";
 	};
@@ -590,6 +595,21 @@
 		reg = <0x12>;
 	};
 
+	hdmi-in@4c {
+		compatible = "adi,adv7612";
+		reg = <0x4c>;
+		interrupt-parent = <&gpio1>;
+		interrupts = <20 IRQ_TYPE_LEVEL_LOW>;
+		remote = <&vin0>;
+		default-input = <0>;
+
+		port {
+			adv7612: endpoint {
+				remote-endpoint = <&vin0ep0>;
+			};
+		};
+	};
+
 	composite-in@20 {
 		compatible = "adi,adv7180";
 		reg = <0x20>;
@@ -705,6 +725,25 @@
 	status = "okay";
 };
 
+/* HDMI video input */
+&vin0 {
+	pinctrl-0 = <&vin0_pins>;
+	pinctrl-names = "default";
+
+	status = "ok";
+
+	port {
+		vin0ep0: endpoint {
+			remote-endpoint = <&adv7612>;
+			bus-width = <24>;
+			hsync-active = <0>;
+			vsync-active = <0>;
+			pclk-sample = <1>;
+			data-active = <1>;
+		};
+	};
+};
+
 /* composite video input */
 &vin1 {
 	pinctrl-0 = <&vin1_pins>;
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* Re: [PATCH v3 5/7] media: rcar-vin: add DV timings support
  2016-04-14 16:17 ` [PATCH v3 5/7] media: rcar-vin: add DV timings support Ulrich Hecht
@ 2016-04-18 10:04   ` Hans Verkuil
  2016-04-20 16:24     ` Ulrich Hecht
  2016-04-22 12:37   ` Hans Verkuil
  2016-04-22 14:07   ` Hans Verkuil
  2 siblings, 1 reply; 15+ messages in thread
From: Hans Verkuil @ 2016-04-18 10:04 UTC (permalink / raw)
  To: Ulrich Hecht, hans.verkuil, niklas.soderlund
  Cc: linux-media, linux-renesas-soc, magnus.damm, laurent.pinchart,
	ian.molton, lars, william.towle

Hi Ulrich,

This isn't right: this just overwrites the adv7180 input with an HDMI input.

I assume the intention is to have support for both adv7180 and HDMI input and
to use VIDIOC_S_INPUT to select between the two.

This really needs some more work, I'm afraid.

Regards,

	Hans

On 04/14/2016 06:17 PM, Ulrich Hecht wrote:
> Adds ioctls DV_TIMINGS_CAP, ENUM_DV_TIMINGS, G_DV_TIMINGS, S_DV_TIMINGS,
> and QUERY_DV_TIMINGS.
> 
> Signed-off-by: Ulrich Hecht <ulrich.hecht+renesas@gmail.com>
> ---
>  drivers/media/platform/rcar-vin/rcar-v4l2.c | 69 +++++++++++++++++++++++++++++
>  1 file changed, 69 insertions(+)
> 
> diff --git a/drivers/media/platform/rcar-vin/rcar-v4l2.c b/drivers/media/platform/rcar-vin/rcar-v4l2.c
> index d8d5f3a..ba2ed4e 100644
> --- a/drivers/media/platform/rcar-vin/rcar-v4l2.c
> +++ b/drivers/media/platform/rcar-vin/rcar-v4l2.c
> @@ -413,12 +413,17 @@ static int rvin_enum_input(struct file *file, void *priv,
>  			   struct v4l2_input *i)
>  {
>  	struct rvin_dev *vin = video_drvdata(file);
> +	struct v4l2_subdev *sd = vin_to_sd(vin);
>  
>  	if (i->index != 0)
>  		return -EINVAL;
>  
>  	i->type = V4L2_INPUT_TYPE_CAMERA;
>  	i->std = vin->vdev.tvnorms;
> +
> +	if (v4l2_subdev_has_op(sd, pad, dv_timings_cap))
> +		i->capabilities = V4L2_IN_CAP_DV_TIMINGS;
> +
>  	strlcpy(i->name, "Camera", sizeof(i->name));
>  
>  	return 0;
> @@ -461,6 +466,64 @@ static int rvin_g_std(struct file *file, void *priv, v4l2_std_id *a)
>  	return v4l2_subdev_call(sd, video, g_std, a);
>  }
>  
> +static int rvin_enum_dv_timings(struct file *file, void *priv_fh,
> +				    struct v4l2_enum_dv_timings *timings)
> +{
> +	struct rvin_dev *vin = video_drvdata(file);
> +	struct v4l2_subdev *sd = vin_to_sd(vin);
> +
> +	timings->pad = 0;
> +	return v4l2_subdev_call(sd,
> +			pad, enum_dv_timings, timings);
> +}
> +
> +static int rvin_s_dv_timings(struct file *file, void *priv_fh,
> +				    struct v4l2_dv_timings *timings)
> +{
> +	struct rvin_dev *vin = video_drvdata(file);
> +	struct v4l2_subdev *sd = vin_to_sd(vin);
> +	int err;
> +
> +	err = v4l2_subdev_call(sd,
> +			video, s_dv_timings, timings);
> +	if (!err) {
> +		vin->sensor.width = timings->bt.width;
> +		vin->sensor.height = timings->bt.height;
> +	}
> +	return err;
> +}
> +
> +static int rvin_g_dv_timings(struct file *file, void *priv_fh,
> +				    struct v4l2_dv_timings *timings)
> +{
> +	struct rvin_dev *vin = video_drvdata(file);
> +	struct v4l2_subdev *sd = vin_to_sd(vin);
> +
> +	return v4l2_subdev_call(sd,
> +			video, g_dv_timings, timings);
> +}
> +
> +static int rvin_query_dv_timings(struct file *file, void *priv_fh,
> +				    struct v4l2_dv_timings *timings)
> +{
> +	struct rvin_dev *vin = video_drvdata(file);
> +	struct v4l2_subdev *sd = vin_to_sd(vin);
> +
> +	return v4l2_subdev_call(sd,
> +			video, query_dv_timings, timings);
> +}
> +
> +static int rvin_dv_timings_cap(struct file *file, void *priv_fh,
> +				    struct v4l2_dv_timings_cap *cap)
> +{
> +	struct rvin_dev *vin = video_drvdata(file);
> +	struct v4l2_subdev *sd = vin_to_sd(vin);
> +
> +	cap->pad = 0;
> +	return v4l2_subdev_call(sd,
> +			pad, dv_timings_cap, cap);
> +}
> +
>  static const struct v4l2_ioctl_ops rvin_ioctl_ops = {
>  	.vidioc_querycap		= rvin_querycap,
>  	.vidioc_try_fmt_vid_cap		= rvin_try_fmt_vid_cap,
> @@ -477,6 +540,12 @@ static const struct v4l2_ioctl_ops rvin_ioctl_ops = {
>  	.vidioc_g_input			= rvin_g_input,
>  	.vidioc_s_input			= rvin_s_input,
>  
> +	.vidioc_dv_timings_cap		= rvin_dv_timings_cap,
> +	.vidioc_enum_dv_timings		= rvin_enum_dv_timings,
> +	.vidioc_g_dv_timings		= rvin_g_dv_timings,
> +	.vidioc_s_dv_timings		= rvin_s_dv_timings,
> +	.vidioc_query_dv_timings	= rvin_query_dv_timings,
> +
>  	.vidioc_querystd		= rvin_querystd,
>  	.vidioc_g_std			= rvin_g_std,
>  	.vidioc_s_std			= rvin_s_std,
> 


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH v3 6/7] media: rcar-vin: initialize EDID data
  2016-04-14 16:17 ` [PATCH v3 6/7] media: rcar-vin: initialize EDID data Ulrich Hecht
@ 2016-04-18 10:13   ` Hans Verkuil
  2016-04-20 16:24     ` Ulrich Hecht
  0 siblings, 1 reply; 15+ messages in thread
From: Hans Verkuil @ 2016-04-18 10:13 UTC (permalink / raw)
  To: Ulrich Hecht, niklas.soderlund
  Cc: linux-media, linux-renesas-soc, magnus.damm, laurent.pinchart,
	ian.molton, lars, william.towle

On 04/14/2016 06:17 PM, Ulrich Hecht wrote:
> Initializes the decoder subdevice with a fixed EDID blob.
> 
> Signed-off-by: Ulrich Hecht <ulrich.hecht+renesas@gmail.com>
> ---
>  drivers/media/platform/rcar-vin/rcar-v4l2.c | 46 +++++++++++++++++++++++++++++
>  1 file changed, 46 insertions(+)
> 
> diff --git a/drivers/media/platform/rcar-vin/rcar-v4l2.c b/drivers/media/platform/rcar-vin/rcar-v4l2.c
> index ba2ed4e..5b32105 100644
> --- a/drivers/media/platform/rcar-vin/rcar-v4l2.c
> +++ b/drivers/media/platform/rcar-vin/rcar-v4l2.c
> @@ -720,6 +720,41 @@ void rvin_v4l2_remove(struct rvin_dev *vin)
>  	video_unregister_device(&vin->vdev);
>  }
>  
> +static u8 edid[256] = {
> +	0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00,
> +	0x48, 0xAE, 0x9C, 0x27, 0x00, 0x00, 0x00, 0x00,
> +	0x19, 0x12, 0x01, 0x03, 0x80, 0x00, 0x00, 0x78,
> +	0x0E, 0x00, 0xB2, 0xA0, 0x57, 0x49, 0x9B, 0x26,
> +	0x10, 0x48, 0x4F, 0x2F, 0xCF, 0x00, 0x31, 0x59,
> +	0x45, 0x59, 0x61, 0x59, 0x81, 0x99, 0x01, 0x01,
> +	0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x3A,
> +	0x80, 0x18, 0x71, 0x38, 0x2D, 0x40, 0x58, 0x2C,
> +	0x46, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1E,
> +	0x00, 0x00, 0x00, 0xFD, 0x00, 0x31, 0x55, 0x18,
> +	0x5E, 0x11, 0x00, 0x0A, 0x20, 0x20, 0x20, 0x20,
> +	0x20, 0x20, 0x00, 0x00, 0x00, 0xFC, 0x00, 0x43,
> +	0x20, 0x39, 0x30, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A,
> +	0x0A, 0x0A, 0x0A, 0x0A, 0x00, 0x00, 0x00, 0x10,
> +	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> +	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x68,
> +	0x02, 0x03, 0x1a, 0xc0, 0x48, 0xa2, 0x10, 0x04,
> +	0x02, 0x01, 0x21, 0x14, 0x13, 0x23, 0x09, 0x07,
> +	0x07, 0x65, 0x03, 0x0c, 0x00, 0x10, 0x00, 0xe2,
> +	0x00, 0x2a, 0x01, 0x1d, 0x00, 0x80, 0x51, 0xd0,
> +	0x1c, 0x20, 0x40, 0x80, 0x35, 0x00, 0x00, 0x00,
> +	0x00, 0x00, 0x00, 0x1e, 0x8c, 0x0a, 0xd0, 0x8a,
> +	0x20, 0xe0, 0x2d, 0x10, 0x10, 0x3e, 0x96, 0x00,
> +	0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00,
> +	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> +	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> +	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> +	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> +	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> +	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> +	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> +	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd7
> +};

Where does this EDID come from? I'm just wondering if it has been
adjusted for the capabilities of the adv.

BTW, it is useful if userspace can read the EDID via VIDIOC_G_EDID.

In general I am of two minds whether the EDID should be set in the driver
or whether it should be left to userspace. The EDID contains vendor IDs
and things like that, which are generally better left to userspace for
embedded systems.

Note that the v4l2-ctl utility has support to fill the edid to a standard HDMI
EDID. See v4l2-ctl --help-edid.

My feeling is that it is better to add G/S_EDID support to the r-car driver
and not initialize the EDID at all.

Regards,

	Hans

> +
>  int rvin_v4l2_probe(struct rvin_dev *vin)
>  {
>  	struct v4l2_subdev_format fmt = {
> @@ -821,5 +856,16 @@ int rvin_v4l2_probe(struct rvin_dev *vin)
>  	v4l2_info(&vin->v4l2_dev, "Device registered as %s\n",
>  		  video_device_node_name(&vin->vdev));
>  
> +	{
> +		struct v4l2_subdev_edid rvin_edid = {
> +			.pad = 0,
> +			.start_block = 0,
> +			.blocks = 2,
> +			.edid = edid,
> +		};
> +		v4l2_subdev_call(sd, pad, set_edid,
> +				&rvin_edid);
> +	}
> +
>  	return ret;
>  }
> 


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH v3 5/7] media: rcar-vin: add DV timings support
  2016-04-18 10:04   ` Hans Verkuil
@ 2016-04-20 16:24     ` Ulrich Hecht
  2016-04-22 12:05       ` Hans Verkuil
  0 siblings, 1 reply; 15+ messages in thread
From: Ulrich Hecht @ 2016-04-20 16:24 UTC (permalink / raw)
  To: Hans Verkuil
  Cc: hans.verkuil, Niklas Söderlund, Linux Media Mailing List,
	linux-renesas-soc, Magnus Damm, Laurent, ian.molton, lars,
	William Towle

On Mon, Apr 18, 2016 at 12:04 PM, Hans Verkuil <hverkuil@xs4all.nl> wrote:
> Hi Ulrich,
>
> This isn't right: this just overwrites the adv7180 input with an HDMI input.
>
> I assume the intention is to have support for both adv7180 and HDMI input and
> to use VIDIOC_S_INPUT to select between the two.

I'm not quite sure what you mean.  The inputs are always hardwired to
one specific decoder, no switching possible.

CU
Uli

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH v3 6/7] media: rcar-vin: initialize EDID data
  2016-04-18 10:13   ` Hans Verkuil
@ 2016-04-20 16:24     ` Ulrich Hecht
  0 siblings, 0 replies; 15+ messages in thread
From: Ulrich Hecht @ 2016-04-20 16:24 UTC (permalink / raw)
  To: Hans Verkuil
  Cc: Niklas Söderlund, Linux Media Mailing List,
	linux-renesas-soc, Magnus Damm, Laurent, ian.molton, lars,
	William Towle

On Mon, Apr 18, 2016 at 12:13 PM, Hans Verkuil <hverkuil@xs4all.nl> wrote:
> Where does this EDID come from? I'm just wondering if it has been
> adjusted for the capabilities of the adv.

It's from the cobalt driver, with only the vendor ID changed.

CU
Uli

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH v3 5/7] media: rcar-vin: add DV timings support
  2016-04-20 16:24     ` Ulrich Hecht
@ 2016-04-22 12:05       ` Hans Verkuil
  0 siblings, 0 replies; 15+ messages in thread
From: Hans Verkuil @ 2016-04-22 12:05 UTC (permalink / raw)
  To: Ulrich Hecht
  Cc: hans.verkuil, Niklas Söderlund, Linux Media Mailing List,
	linux-renesas-soc, Magnus Damm, Laurent, ian.molton, lars,
	William Towle

On 04/20/2016 06:24 PM, Ulrich Hecht wrote:
> On Mon, Apr 18, 2016 at 12:04 PM, Hans Verkuil <hverkuil@xs4all.nl> wrote:
>> Hi Ulrich,
>>
>> This isn't right: this just overwrites the adv7180 input with an HDMI input.
>>
>> I assume the intention is to have support for both adv7180 and HDMI input and
>> to use VIDIOC_S_INPUT to select between the two.
> 
> I'm not quite sure what you mean.  The inputs are always hardwired to
> one specific decoder, no switching possible.

Never mind, I thought the composite and hdmi inputs where muxed to the same
rcar-vin instance, but each goes to the same instance.

I'll re-review the patch with that in mind.

Regards,

	Hans


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH v3 5/7] media: rcar-vin: add DV timings support
  2016-04-14 16:17 ` [PATCH v3 5/7] media: rcar-vin: add DV timings support Ulrich Hecht
  2016-04-18 10:04   ` Hans Verkuil
@ 2016-04-22 12:37   ` Hans Verkuil
  2016-04-22 14:07   ` Hans Verkuil
  2 siblings, 0 replies; 15+ messages in thread
From: Hans Verkuil @ 2016-04-22 12:37 UTC (permalink / raw)
  To: Ulrich Hecht, hans.verkuil, niklas.soderlund
  Cc: linux-media, linux-renesas-soc, magnus.damm, laurent.pinchart,
	ian.molton, lars, william.towle

New review of this code. Ignore the previous one.

On 04/14/2016 06:17 PM, Ulrich Hecht wrote:
> Adds ioctls DV_TIMINGS_CAP, ENUM_DV_TIMINGS, G_DV_TIMINGS, S_DV_TIMINGS,
> and QUERY_DV_TIMINGS.
> 
> Signed-off-by: Ulrich Hecht <ulrich.hecht+renesas@gmail.com>
> ---
>  drivers/media/platform/rcar-vin/rcar-v4l2.c | 69 +++++++++++++++++++++++++++++
>  1 file changed, 69 insertions(+)
> 
> diff --git a/drivers/media/platform/rcar-vin/rcar-v4l2.c b/drivers/media/platform/rcar-vin/rcar-v4l2.c
> index d8d5f3a..ba2ed4e 100644
> --- a/drivers/media/platform/rcar-vin/rcar-v4l2.c
> +++ b/drivers/media/platform/rcar-vin/rcar-v4l2.c
> @@ -413,12 +413,17 @@ static int rvin_enum_input(struct file *file, void *priv,
>  			   struct v4l2_input *i)
>  {
>  	struct rvin_dev *vin = video_drvdata(file);
> +	struct v4l2_subdev *sd = vin_to_sd(vin);
>  
>  	if (i->index != 0)
>  		return -EINVAL;
>  
>  	i->type = V4L2_INPUT_TYPE_CAMERA;
>  	i->std = vin->vdev.tvnorms;
> +
> +	if (v4l2_subdev_has_op(sd, pad, dv_timings_cap))
> +		i->capabilities = V4L2_IN_CAP_DV_TIMINGS;
> +
>  	strlcpy(i->name, "Camera", sizeof(i->name));

I think it is better to use "HDMI" as the name.

>  
>  	return 0;
> @@ -461,6 +466,64 @@ static int rvin_g_std(struct file *file, void *priv, v4l2_std_id *a)
>  	return v4l2_subdev_call(sd, video, g_std, a);
>  }
>  
> +static int rvin_enum_dv_timings(struct file *file, void *priv_fh,
> +				    struct v4l2_enum_dv_timings *timings)
> +{
> +	struct rvin_dev *vin = video_drvdata(file);
> +	struct v4l2_subdev *sd = vin_to_sd(vin);
> +
> +	timings->pad = 0;

You should use vin->src_pad_idx here instead of 0.

> +	return v4l2_subdev_call(sd,
> +			pad, enum_dv_timings, timings);

The original pad value should be restored.

> +}
> +
> +static int rvin_s_dv_timings(struct file *file, void *priv_fh,
> +				    struct v4l2_dv_timings *timings)
> +{
> +	struct rvin_dev *vin = video_drvdata(file);
> +	struct v4l2_subdev *sd = vin_to_sd(vin);
> +	int err;
> +
> +	err = v4l2_subdev_call(sd,
> +			video, s_dv_timings, timings);
> +	if (!err) {
> +		vin->sensor.width = timings->bt.width;
> +		vin->sensor.height = timings->bt.height;
> +	}
> +	return err;
> +}
> +
> +static int rvin_g_dv_timings(struct file *file, void *priv_fh,
> +				    struct v4l2_dv_timings *timings)
> +{
> +	struct rvin_dev *vin = video_drvdata(file);
> +	struct v4l2_subdev *sd = vin_to_sd(vin);
> +
> +	return v4l2_subdev_call(sd,
> +			video, g_dv_timings, timings);
> +}
> +
> +static int rvin_query_dv_timings(struct file *file, void *priv_fh,
> +				    struct v4l2_dv_timings *timings)
> +{
> +	struct rvin_dev *vin = video_drvdata(file);
> +	struct v4l2_subdev *sd = vin_to_sd(vin);
> +
> +	return v4l2_subdev_call(sd,
> +			video, query_dv_timings, timings);
> +}
> +
> +static int rvin_dv_timings_cap(struct file *file, void *priv_fh,
> +				    struct v4l2_dv_timings_cap *cap)
> +{
> +	struct rvin_dev *vin = video_drvdata(file);
> +	struct v4l2_subdev *sd = vin_to_sd(vin);
> +
> +	cap->pad = 0;
> +	return v4l2_subdev_call(sd,
> +			pad, dv_timings_cap, cap);

The comments for enum_dv_timings apply here as well.

> +}
> +
>  static const struct v4l2_ioctl_ops rvin_ioctl_ops = {
>  	.vidioc_querycap		= rvin_querycap,
>  	.vidioc_try_fmt_vid_cap		= rvin_try_fmt_vid_cap,
> @@ -477,6 +540,12 @@ static const struct v4l2_ioctl_ops rvin_ioctl_ops = {
>  	.vidioc_g_input			= rvin_g_input,
>  	.vidioc_s_input			= rvin_s_input,
>  
> +	.vidioc_dv_timings_cap		= rvin_dv_timings_cap,
> +	.vidioc_enum_dv_timings		= rvin_enum_dv_timings,
> +	.vidioc_g_dv_timings		= rvin_g_dv_timings,
> +	.vidioc_s_dv_timings		= rvin_s_dv_timings,
> +	.vidioc_query_dv_timings	= rvin_query_dv_timings,
> +
>  	.vidioc_querystd		= rvin_querystd,
>  	.vidioc_g_std			= rvin_g_std,
>  	.vidioc_s_std			= rvin_s_std,
> 

You also need to support the SOURCE_CHANGE event, but I will post a patch for
that myself later.

Regards,

	Hans

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH v3 5/7] media: rcar-vin: add DV timings support
  2016-04-14 16:17 ` [PATCH v3 5/7] media: rcar-vin: add DV timings support Ulrich Hecht
  2016-04-18 10:04   ` Hans Verkuil
  2016-04-22 12:37   ` Hans Verkuil
@ 2016-04-22 14:07   ` Hans Verkuil
  2 siblings, 0 replies; 15+ messages in thread
From: Hans Verkuil @ 2016-04-22 14:07 UTC (permalink / raw)
  To: Ulrich Hecht, hans.verkuil, niklas.soderlund
  Cc: linux-media, linux-renesas-soc, magnus.damm, laurent.pinchart,
	ian.molton, lars, william.towle

On 04/14/2016 06:17 PM, Ulrich Hecht wrote:
> Adds ioctls DV_TIMINGS_CAP, ENUM_DV_TIMINGS, G_DV_TIMINGS, S_DV_TIMINGS,
> and QUERY_DV_TIMINGS.
> 
> Signed-off-by: Ulrich Hecht <ulrich.hecht+renesas@gmail.com>
> ---
>  drivers/media/platform/rcar-vin/rcar-v4l2.c | 69 +++++++++++++++++++++++++++++
>  1 file changed, 69 insertions(+)
> 
> diff --git a/drivers/media/platform/rcar-vin/rcar-v4l2.c b/drivers/media/platform/rcar-vin/rcar-v4l2.c
> index d8d5f3a..ba2ed4e 100644
> --- a/drivers/media/platform/rcar-vin/rcar-v4l2.c
> +++ b/drivers/media/platform/rcar-vin/rcar-v4l2.c
> @@ -413,12 +413,17 @@ static int rvin_enum_input(struct file *file, void *priv,
>  			   struct v4l2_input *i)
>  {
>  	struct rvin_dev *vin = video_drvdata(file);
> +	struct v4l2_subdev *sd = vin_to_sd(vin);
>  
>  	if (i->index != 0)
>  		return -EINVAL;
>  
>  	i->type = V4L2_INPUT_TYPE_CAMERA;
>  	i->std = vin->vdev.tvnorms;
> +
> +	if (v4l2_subdev_has_op(sd, pad, dv_timings_cap))
> +		i->capabilities = V4L2_IN_CAP_DV_TIMINGS;
> +
>  	strlcpy(i->name, "Camera", sizeof(i->name));
>  
>  	return 0;
> @@ -461,6 +466,64 @@ static int rvin_g_std(struct file *file, void *priv, v4l2_std_id *a)
>  	return v4l2_subdev_call(sd, video, g_std, a);
>  }
>  
> +static int rvin_enum_dv_timings(struct file *file, void *priv_fh,
> +				    struct v4l2_enum_dv_timings *timings)
> +{
> +	struct rvin_dev *vin = video_drvdata(file);
> +	struct v4l2_subdev *sd = vin_to_sd(vin);
> +
> +	timings->pad = 0;
> +	return v4l2_subdev_call(sd,
> +			pad, enum_dv_timings, timings);
> +}
> +
> +static int rvin_s_dv_timings(struct file *file, void *priv_fh,
> +				    struct v4l2_dv_timings *timings)
> +{
> +	struct rvin_dev *vin = video_drvdata(file);
> +	struct v4l2_subdev *sd = vin_to_sd(vin);
> +	int err;
> +
> +	err = v4l2_subdev_call(sd,
> +			video, s_dv_timings, timings);
> +	if (!err) {
> +		vin->sensor.width = timings->bt.width;
> +		vin->sensor.height = timings->bt.height;

This updates the sensor w and h, but it should do the same with
vin->format.width and height.

Regards,

	Hans


^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2016-04-22 14:08 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-14 16:17 [PATCH v3 0/7] Lager board HDMI input support Ulrich Hecht
2016-04-14 16:17 ` [PATCH v3 1/7] v4l: subdev: Add pad config allocator and init Ulrich Hecht
2016-04-14 16:17 ` [PATCH v3 2/7] media: adv7604: automatic "default-input" selection Ulrich Hecht
2016-04-14 16:17 ` [PATCH v3 3/7] media: rcar_vin: Use correct pad number in try_fmt Ulrich Hecht
2016-04-14 16:17 ` [PATCH v3 4/7] media: rcar-vin: pad-aware driver initialisation Ulrich Hecht
2016-04-14 16:17 ` [PATCH v3 5/7] media: rcar-vin: add DV timings support Ulrich Hecht
2016-04-18 10:04   ` Hans Verkuil
2016-04-20 16:24     ` Ulrich Hecht
2016-04-22 12:05       ` Hans Verkuil
2016-04-22 12:37   ` Hans Verkuil
2016-04-22 14:07   ` Hans Verkuil
2016-04-14 16:17 ` [PATCH v3 6/7] media: rcar-vin: initialize EDID data Ulrich Hecht
2016-04-18 10:13   ` Hans Verkuil
2016-04-20 16:24     ` Ulrich Hecht
2016-04-14 16:17 ` [PATCH v3 7/7] ARM: dts: lager: Add entries for VIN HDMI input support Ulrich Hecht

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).