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

Hi!

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

A couple of the included patches are pushed or have been picked up elsewhere
already and are included here for ease of testing.

The EDID initialization blob has been lifted wholesale from the cobalt
driver, with only the vendor ID adjusted to "REN".

(Note for testing: To get up-to-date DV timings, you have to use a client
that does QUERY_DV_TIMINGS/S_DV_TIMINGS.  Few do.)

CU
Uli


Ian Molton (1):
  ARM: shmobile: lager dts: specify default-input for ADV7612

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

Ulrich Hecht (5):
  adv7604: fix SPA register location for ADV7612
  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: shmobile: lager dts: Add entries for VIN HDMI input support

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

-- 
2.6.4


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

* [PATCH/RFC 1/9] v4l: subdev: Add pad config allocator and init
  2016-02-17 15:48 [PATCH/RFC 0/9] Lager board HDMI input support Ulrich Hecht
@ 2016-02-17 15:48 ` Ulrich Hecht
  2016-02-17 15:48 ` [PATCH/RFC 2/9] media: adv7604: automatic "default-input" selection Ulrich Hecht
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Ulrich Hecht @ 2016-02-17 15:48 UTC (permalink / raw)
  To: linux-renesas-soc, niklas.soderlund
  Cc: linux-media, magnus.damm, laurent.pinchart, hans.verkuil,
	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 b273cf9..e1e25fa 100644
--- a/include/media/v4l2-subdev.h
+++ b/include/media/v4l2-subdev.h
@@ -604,6 +604,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);
@@ -798,7 +800,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.6.4


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

* [PATCH/RFC 2/9] media: adv7604: automatic "default-input" selection
  2016-02-17 15:48 [PATCH/RFC 0/9] Lager board HDMI input support Ulrich Hecht
  2016-02-17 15:48 ` [PATCH/RFC 1/9] v4l: subdev: Add pad config allocator and init Ulrich Hecht
@ 2016-02-17 15:48 ` Ulrich Hecht
  2016-02-17 15:48 ` [PATCH/RFC 3/9] adv7604: fix SPA register location for ADV7612 Ulrich Hecht
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Ulrich Hecht @ 2016-02-17 15:48 UTC (permalink / raw)
  To: linux-renesas-soc, niklas.soderlund
  Cc: linux-media, magnus.damm, laurent.pinchart, hans.verkuil,
	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 7111cddd "[media] media: adv7604: reduce support
to first (digital) input").

Additionally, Ian's documentation in commit bf9c8227 ("[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 | 24 +++++++++++++++++-------
 1 file changed, 17 insertions(+), 7 deletions(-)

diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
index f8dd750..2097c48 100644
--- a/drivers/media/i2c/adv7604.c
+++ b/drivers/media/i2c/adv7604.c
@@ -2799,7 +2799,7 @@ static int adv76xx_parse_dt(struct adv76xx_state *state)
 	struct device_node *endpoint;
 	struct device_node *np;
 	unsigned int flags;
-	u32 v;
+	u32 v = -1;
 
 	np = state->i2c_clients[ADV76XX_PAGE_IO]->dev.of_node;
 
@@ -2809,14 +2809,24 @@ static int adv76xx_parse_dt(struct adv76xx_state *state)
 		return -EINVAL;
 
 	v4l2_of_parse_endpoint(endpoint, &bus_cfg);
-
-	if (!of_property_read_u32(endpoint, "default-input", &v))
-		state->pdata.default_input = v;
-	else
-		state->pdata.default_input = -1;
-
 	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.6.4


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

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

SPA location LSB register is at 0x70.

Signed-off-by: Ulrich Hecht <ulrich.hecht+renesas@gmail.com>
---
 drivers/media/i2c/adv7604.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
index 2097c48..1680c0e 100644
--- a/drivers/media/i2c/adv7604.c
+++ b/drivers/media/i2c/adv7604.c
@@ -2110,7 +2110,8 @@ static int adv76xx_set_edid(struct v4l2_subdev *sd, struct v4l2_edid *edid)
 		rep_write(sd, 0x76, spa_loc & 0xff);
 		rep_write_clr_set(sd, 0x77, 0x40, (spa_loc & 0x100) >> 2);
 	} else {
-		/* FIXME: Where is the SPA location LSB register ? */
+		/* ADV7612 Software Manual Rev. A, p. 15 */
+		rep_write(sd, 0x70, spa_loc & 0xff);
 		rep_write_clr_set(sd, 0x71, 0x01, (spa_loc & 0x100) >> 8);
 	}
 
-- 
2.6.4


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

* [PATCH/RFC 4/9] media: rcar_vin: Use correct pad number in try_fmt
  2016-02-17 15:48 [PATCH/RFC 0/9] Lager board HDMI input support Ulrich Hecht
                   ` (2 preceding siblings ...)
  2016-02-17 15:48 ` [PATCH/RFC 3/9] adv7604: fix SPA register location for ADV7612 Ulrich Hecht
@ 2016-02-17 15:48 ` Ulrich Hecht
  2016-02-17 15:48 ` [PATCH/RFC 5/9] media: rcar-vin: pad-aware driver initialisation Ulrich Hecht
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Ulrich Hecht @ 2016-02-17 15:48 UTC (permalink / raw)
  To: linux-renesas-soc, niklas.soderlund
  Cc: linux-media, magnus.damm, laurent.pinchart, hans.verkuil,
	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-dma.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/drivers/media/platform/rcar-vin/rcar-dma.c b/drivers/media/platform/rcar-vin/rcar-dma.c
index c667ce5..70dc928 100644
--- a/drivers/media/platform/rcar-vin/rcar-dma.c
+++ b/drivers/media/platform/rcar-vin/rcar-dma.c
@@ -294,7 +294,7 @@ static int __rvin_dma_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,
 	};
@@ -303,15 +303,20 @@ static int __rvin_dma_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;
+
 	/* Requested */
 	rwidth = pix->width;
 	rheight = pix->height;
 
 	v4l2_fill_mbus_format(&format.format, pix, info->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);
 
 	/* Sensor */
@@ -325,7 +330,7 @@ static int __rvin_dma_try_format_sensor(struct rvin_dev *vin,
 		vin_dbg(vin, "sensor format mismatch, see if we can scale\n");
 		ret = rvin_scale_try(vin, pix, rwidth, rheight);
 		if (ret)
-			return ret;
+			goto cleanup;
 	}
 
 	/* Store sensor output format */
@@ -334,6 +339,8 @@ static int __rvin_dma_try_format_sensor(struct rvin_dev *vin,
 		sensor->height = sheight;
 	}
 
+cleanup:
+	v4l2_subdev_free_pad_config(pad_cfg);
 	return 0;
 }
 
-- 
2.6.4


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

* [PATCH/RFC 5/9] media: rcar-vin: pad-aware driver initialisation
  2016-02-17 15:48 [PATCH/RFC 0/9] Lager board HDMI input support Ulrich Hecht
                   ` (3 preceding siblings ...)
  2016-02-17 15:48 ` [PATCH/RFC 4/9] media: rcar_vin: Use correct pad number in try_fmt Ulrich Hecht
@ 2016-02-17 15:48 ` Ulrich Hecht
  2016-02-17 15:48 ` [PATCH/RFC 6/9] media: rcar-vin: add DV timings support Ulrich Hecht
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Ulrich Hecht @ 2016-02-17 15:48 UTC (permalink / raw)
  To: linux-renesas-soc, niklas.soderlund
  Cc: linux-media, magnus.damm, laurent.pinchart, hans.verkuil,
	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-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


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

* [PATCH/RFC 6/9] media: rcar-vin: add DV timings support
  2016-02-17 15:48 [PATCH/RFC 0/9] Lager board HDMI input support Ulrich Hecht
                   ` (4 preceding siblings ...)
  2016-02-17 15:48 ` [PATCH/RFC 5/9] media: rcar-vin: pad-aware driver initialisation Ulrich Hecht
@ 2016-02-17 15:48 ` Ulrich Hecht
  2016-02-17 15:48 ` [PATCH/RFC 7/9] media: rcar-vin: initialize EDID data Ulrich Hecht
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Ulrich Hecht @ 2016-02-17 15:48 UTC (permalink / raw)
  To: linux-renesas-soc, niklas.soderlund
  Cc: linux-media, magnus.damm, laurent.pinchart, hans.verkuil,
	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-dma.c | 69 ++++++++++++++++++++++++++++++
 1 file changed, 69 insertions(+)

diff --git a/drivers/media/platform/rcar-vin/rcar-dma.c b/drivers/media/platform/rcar-vin/rcar-dma.c
index 6b23c968..d40b39b 100644
--- a/drivers/media/platform/rcar-vin/rcar-dma.c
+++ b/drivers/media/platform/rcar-vin/rcar-dma.c
@@ -511,12 +511,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;
@@ -572,6 +577,64 @@ static int rvin_streamoff(struct file *file, void *priv, enum v4l2_buf_type i)
 	return ret;
 }
 
+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,
@@ -588,6 +651,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_reqbufs			= vb2_ioctl_reqbufs,
 	.vidioc_create_bufs		= vb2_ioctl_create_bufs,
 	.vidioc_querybuf		= vb2_ioctl_querybuf,
-- 
2.6.4


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

* [PATCH/RFC 7/9] media: rcar-vin: initialize EDID data
  2016-02-17 15:48 [PATCH/RFC 0/9] Lager board HDMI input support Ulrich Hecht
                   ` (5 preceding siblings ...)
  2016-02-17 15:48 ` [PATCH/RFC 6/9] media: rcar-vin: add DV timings support Ulrich Hecht
@ 2016-02-17 15:48 ` Ulrich Hecht
  2016-02-17 15:48 ` [PATCH/RFC 8/9] ARM: shmobile: lager dts: Add entries for VIN HDMI input support Ulrich Hecht
  2016-02-17 15:48 ` [PATCH/RFC 9/9] ARM: shmobile: lager dts: specify default-input for ADV7612 Ulrich Hecht
  8 siblings, 0 replies; 10+ messages in thread
From: Ulrich Hecht @ 2016-02-17 15:48 UTC (permalink / raw)
  To: linux-renesas-soc, niklas.soderlund
  Cc: linux-media, magnus.damm, laurent.pinchart, hans.verkuil,
	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-dma.c | 46 ++++++++++++++++++++++++++++++
 1 file changed, 46 insertions(+)

diff --git a/drivers/media/platform/rcar-vin/rcar-dma.c b/drivers/media/platform/rcar-vin/rcar-dma.c
index d40b39b..4f93a3d 100644
--- a/drivers/media/platform/rcar-vin/rcar-dma.c
+++ b/drivers/media/platform/rcar-vin/rcar-dma.c
@@ -953,6 +953,41 @@ error:
 	return ret;
 }
 
+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_dma_on(struct rvin_dev *vin)
 {
 	struct v4l2_subdev *sd;
@@ -1029,6 +1064,17 @@ int rvin_dma_on(struct rvin_dev *vin)
 		vin->format.field	= mf->field;
 	}
 
+	{
+		struct v4l2_subdev_edid rvin_edid = {
+			.pad = 0,
+			.start_block = 0,
+			.blocks = 2,
+			.edid = edid,
+		};
+		v4l2_subdev_call(sd, pad, set_edid,
+				&rvin_edid);
+	}
+
 remove_device:
 	rvin_remove_device(vin);
 
-- 
2.6.4


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

* [PATCH/RFC 8/9] ARM: shmobile: lager dts: Add entries for VIN HDMI input support
  2016-02-17 15:48 [PATCH/RFC 0/9] Lager board HDMI input support Ulrich Hecht
                   ` (6 preceding siblings ...)
  2016-02-17 15:48 ` [PATCH/RFC 7/9] media: rcar-vin: initialize EDID data Ulrich Hecht
@ 2016-02-17 15:48 ` Ulrich Hecht
  2016-02-17 15:48 ` [PATCH/RFC 9/9] ARM: shmobile: lager dts: specify default-input for ADV7612 Ulrich Hecht
  8 siblings, 0 replies; 10+ messages in thread
From: Ulrich Hecht @ 2016-02-17 15:48 UTC (permalink / raw)
  To: linux-renesas-soc, niklas.soderlund
  Cc: linux-media, magnus.damm, laurent.pinchart, hans.verkuil,
	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.

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]
Signed-off-by: Ulrich Hecht <ulrich.hecht+renesas@gmail.com>
---
 arch/arm/boot/dts/r8a7790-lager.dts | 40 ++++++++++++++++++++++++++++++++++++-
 1 file changed, 39 insertions(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/r8a7790-lager.dts b/arch/arm/boot/dts/r8a7790-lager.dts
index cdc0414..920205e 100644
--- a/arch/arm/boot/dts/r8a7790-lager.dts
+++ b/arch/arm/boot/dts/r8a7790-lager.dts
@@ -390,7 +390,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";
 	};
@@ -562,6 +567,20 @@
 		reg = <0x12>;
 	};
 
+	hdmi-in@4c {
+		compatible = "adi,adv7612";
+		reg = <0x4c>;
+		interrupt-parent = <&gpio1>;
+		interrupts = <20 IRQ_TYPE_LEVEL_LOW>;
+		remote = <&vin0>;
+
+		port {
+			adv7612: endpoint {
+				remote-endpoint = <&vin0ep0>;
+			};
+		};
+	};
+
 	composite-in@20 {
 		compatible = "adi,adv7180";
 		reg = <0x20>;
@@ -677,6 +696,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.6.4


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

* [PATCH/RFC 9/9] ARM: shmobile: lager dts: specify default-input for ADV7612
  2016-02-17 15:48 [PATCH/RFC 0/9] Lager board HDMI input support Ulrich Hecht
                   ` (7 preceding siblings ...)
  2016-02-17 15:48 ` [PATCH/RFC 8/9] ARM: shmobile: lager dts: Add entries for VIN HDMI input support Ulrich Hecht
@ 2016-02-17 15:48 ` Ulrich Hecht
  8 siblings, 0 replies; 10+ messages in thread
From: Ulrich Hecht @ 2016-02-17 15:48 UTC (permalink / raw)
  To: linux-renesas-soc, niklas.soderlund
  Cc: linux-media, magnus.damm, laurent.pinchart, hans.verkuil,
	ian.molton, lars, william.towle, Ulrich Hecht

From: Ian Molton <ian.molton@codethink.co.uk>

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

(This version places the property in the adv7612 node, in line with
Ian's documentation)

Signed-off-by: Ian Molton <ian.molton@codethink.co.uk>
Signed-off-by: William Towle <william.towle@codethink.co.uk>
Signed-off-by: Ulrich Hecht <ulrich.hecht+renesas@gmail.com>
---
 arch/arm/boot/dts/r8a7790-lager.dts | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/boot/dts/r8a7790-lager.dts b/arch/arm/boot/dts/r8a7790-lager.dts
index 920205e..30371bb 100644
--- a/arch/arm/boot/dts/r8a7790-lager.dts
+++ b/arch/arm/boot/dts/r8a7790-lager.dts
@@ -573,6 +573,7 @@
 		interrupt-parent = <&gpio1>;
 		interrupts = <20 IRQ_TYPE_LEVEL_LOW>;
 		remote = <&vin0>;
+		default-input = <0>;
 
 		port {
 			adv7612: endpoint {
-- 
2.6.4


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

end of thread, other threads:[~2016-02-17 15:49 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-17 15:48 [PATCH/RFC 0/9] Lager board HDMI input support Ulrich Hecht
2016-02-17 15:48 ` [PATCH/RFC 1/9] v4l: subdev: Add pad config allocator and init Ulrich Hecht
2016-02-17 15:48 ` [PATCH/RFC 2/9] media: adv7604: automatic "default-input" selection Ulrich Hecht
2016-02-17 15:48 ` [PATCH/RFC 3/9] adv7604: fix SPA register location for ADV7612 Ulrich Hecht
2016-02-17 15:48 ` [PATCH/RFC 4/9] media: rcar_vin: Use correct pad number in try_fmt Ulrich Hecht
2016-02-17 15:48 ` [PATCH/RFC 5/9] media: rcar-vin: pad-aware driver initialisation Ulrich Hecht
2016-02-17 15:48 ` [PATCH/RFC 6/9] media: rcar-vin: add DV timings support Ulrich Hecht
2016-02-17 15:48 ` [PATCH/RFC 7/9] media: rcar-vin: initialize EDID data Ulrich Hecht
2016-02-17 15:48 ` [PATCH/RFC 8/9] ARM: shmobile: lager dts: Add entries for VIN HDMI input support Ulrich Hecht
2016-02-17 15:48 ` [PATCH/RFC 9/9] ARM: shmobile: lager dts: specify default-input for ADV7612 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).