All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v9 0/2] rcar-vin EDID control ioctls
@ 2016-09-15 17:33 Ulrich Hecht
  2016-09-15 17:33 ` [PATCH v9 1/2] rcar-vin: implement " Ulrich Hecht
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Ulrich Hecht @ 2016-09-15 17:33 UTC (permalink / raw)
  To: hans.verkuil, niklas.soderlund
  Cc: linux-media, linux-renesas-soc, magnus.damm,
	ulrich.hecht+renesas, laurent.pinchart, william.towle

Hi!

This revision sits on top of Hans's rcar branch and adds pad sanity checks
for g_edid and s_edid, the sink pad fix for the DV timings suggested by
Niklas, and documents sink_pad_idx. Good night!

CU
Uli


Changes since v8:
- dumped merged default-input patch
- added pad sanity check
- added DV timings sink pad fix
- documented sink_pad_idx
- added Acked-By

Changes since v7:
- do not fail if there is no sink pad

Changes since v6:
- work without subdev abstraction layer
- split off DT parts, to be handled separately

Changes since v5:
- implement vin/subdev pad translation
- move i2c devices

Changes since v4:
- drop merged patches
- adv7604: always fall back to input 0 if nothing else is specified
- rcar-vin: implement G_EDID, S_EDID in place of hard-coded EDID blob

Changes since v3:
- rvin_enum_dv_timings(): use vin->src_pad_idx
- rvin_dv_timings_cap(): likewise
- rvin_s_dv_timings(): update vin->format
- add Koelsch support

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: "


Ulrich Hecht (2):
  rcar-vin: implement EDID control ioctls
  media: rcar-vin: use sink pad index for DV timings

 drivers/media/platform/rcar-vin/rcar-v4l2.c | 52 +++++++++++++++++++++++++++--
 drivers/media/platform/rcar-vin/rcar-vin.h  |  2 ++
 2 files changed, 52 insertions(+), 2 deletions(-)

-- 
2.9.3


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

* [PATCH v9 1/2] rcar-vin: implement EDID control ioctls
  2016-09-15 17:33 [PATCH v9 0/2] rcar-vin EDID control ioctls Ulrich Hecht
@ 2016-09-15 17:33 ` Ulrich Hecht
  2016-09-15 17:57   ` Laurent Pinchart
  2016-09-15 17:33 ` [PATCH v9 2/2] media: rcar-vin: use sink pad index for DV timings Ulrich Hecht
  2016-09-15 17:44 ` [PATCH v9 0/2] rcar-vin EDID control ioctls Hans Verkuil
  2 siblings, 1 reply; 6+ messages in thread
From: Ulrich Hecht @ 2016-09-15 17:33 UTC (permalink / raw)
  To: hans.verkuil, niklas.soderlund
  Cc: linux-media, linux-renesas-soc, magnus.damm,
	ulrich.hecht+renesas, laurent.pinchart, william.towle

Adds G_EDID and S_EDID.

Signed-off-by: Ulrich Hecht <ulrich.hecht+renesas@gmail.com>
Acked-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
---
 drivers/media/platform/rcar-vin/rcar-v4l2.c | 48 +++++++++++++++++++++++++++++
 drivers/media/platform/rcar-vin/rcar-vin.h  |  2 ++
 2 files changed, 50 insertions(+)

diff --git a/drivers/media/platform/rcar-vin/rcar-v4l2.c b/drivers/media/platform/rcar-vin/rcar-v4l2.c
index 61e9b59..f35005c 100644
--- a/drivers/media/platform/rcar-vin/rcar-v4l2.c
+++ b/drivers/media/platform/rcar-vin/rcar-v4l2.c
@@ -613,6 +613,44 @@ static int rvin_dv_timings_cap(struct file *file, void *priv_fh,
 	return ret;
 }
 
+static int rvin_g_edid(struct file *file, void *fh, struct v4l2_edid *edid)
+{
+	struct rvin_dev *vin = video_drvdata(file);
+	struct v4l2_subdev *sd = vin_to_source(vin);
+	int input, ret;
+
+	if (edid->pad)
+		return -EINVAL;
+
+	input = edid->pad;
+	edid->pad = vin->sink_pad_idx;
+
+	ret = v4l2_subdev_call(sd, pad, get_edid, edid);
+
+	edid->pad = input;
+
+	return ret;
+}
+
+static int rvin_s_edid(struct file *file, void *fh, struct v4l2_edid *edid)
+{
+	struct rvin_dev *vin = video_drvdata(file);
+	struct v4l2_subdev *sd = vin_to_source(vin);
+	int input, ret;
+
+	if (edid->pad)
+		return -EINVAL;
+
+	input = edid->pad;
+	edid->pad = vin->sink_pad_idx;
+
+	ret = v4l2_subdev_call(sd, pad, set_edid, edid);
+
+	edid->pad = input;
+
+	return ret;
+}
+
 static const struct v4l2_ioctl_ops rvin_ioctl_ops = {
 	.vidioc_querycap		= rvin_querycap,
 	.vidioc_try_fmt_vid_cap		= rvin_try_fmt_vid_cap,
@@ -635,6 +673,9 @@ static const struct v4l2_ioctl_ops rvin_ioctl_ops = {
 	.vidioc_s_dv_timings		= rvin_s_dv_timings,
 	.vidioc_query_dv_timings	= rvin_query_dv_timings,
 
+	.vidioc_g_edid			= rvin_g_edid,
+	.vidioc_s_edid			= rvin_s_edid,
+
 	.vidioc_querystd		= rvin_querystd,
 	.vidioc_g_std			= rvin_g_std,
 	.vidioc_s_std			= rvin_s_std,
@@ -883,6 +924,13 @@ int rvin_v4l2_probe(struct rvin_dev *vin)
 
 	vin->src_pad_idx = pad_idx;
 
+	vin->sink_pad_idx = 0;
+	for (pad_idx = 0; pad_idx < sd->entity.num_pads; pad_idx++)
+		if (sd->entity.pads[pad_idx].flags == MEDIA_PAD_FL_SINK) {
+			vin->sink_pad_idx = pad_idx;
+			break;
+		}
+
 	vin->format.pixelformat	= RVIN_DEFAULT_FORMAT;
 	rvin_reset_format(vin);
 
diff --git a/drivers/media/platform/rcar-vin/rcar-vin.h b/drivers/media/platform/rcar-vin/rcar-vin.h
index 793184d..727e215 100644
--- a/drivers/media/platform/rcar-vin/rcar-vin.h
+++ b/drivers/media/platform/rcar-vin/rcar-vin.h
@@ -92,6 +92,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
+ * @sink_pad_idx:	sink pad index for media controller drivers
  * @ctrl_handler:	V4L2 control handler
  * @notifier:		V4L2 asynchronous subdevs notifier
  * @digital:		entity in the DT for local digital subdevice
@@ -121,6 +122,7 @@ struct rvin_dev {
 	struct video_device vdev;
 	struct v4l2_device v4l2_dev;
 	int src_pad_idx;
+	int sink_pad_idx;
 	struct v4l2_ctrl_handler ctrl_handler;
 	struct v4l2_async_notifier notifier;
 	struct rvin_graph_entity digital;
-- 
2.9.3


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

* [PATCH v9 2/2] media: rcar-vin: use sink pad index for DV timings
  2016-09-15 17:33 [PATCH v9 0/2] rcar-vin EDID control ioctls Ulrich Hecht
  2016-09-15 17:33 ` [PATCH v9 1/2] rcar-vin: implement " Ulrich Hecht
@ 2016-09-15 17:33 ` Ulrich Hecht
  2016-09-15 17:57   ` Laurent Pinchart
  2016-09-15 17:44 ` [PATCH v9 0/2] rcar-vin EDID control ioctls Hans Verkuil
  2 siblings, 1 reply; 6+ messages in thread
From: Ulrich Hecht @ 2016-09-15 17:33 UTC (permalink / raw)
  To: hans.verkuil, niklas.soderlund
  Cc: linux-media, linux-renesas-soc, magnus.damm,
	ulrich.hecht+renesas, laurent.pinchart, william.towle

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

diff --git a/drivers/media/platform/rcar-vin/rcar-v4l2.c b/drivers/media/platform/rcar-vin/rcar-v4l2.c
index f35005c..2bbe6d4 100644
--- a/drivers/media/platform/rcar-vin/rcar-v4l2.c
+++ b/drivers/media/platform/rcar-vin/rcar-v4l2.c
@@ -550,7 +550,7 @@ static int rvin_enum_dv_timings(struct file *file, void *priv_fh,
 	int pad, ret;
 
 	pad = timings->pad;
-	timings->pad = vin->src_pad_idx;
+	timings->pad = vin->sink_pad_idx;
 
 	ret = v4l2_subdev_call(sd, pad, enum_dv_timings, timings);
 
@@ -604,7 +604,7 @@ static int rvin_dv_timings_cap(struct file *file, void *priv_fh,
 	int pad, ret;
 
 	pad = cap->pad;
-	cap->pad = vin->src_pad_idx;
+	cap->pad = vin->sink_pad_idx;
 
 	ret = v4l2_subdev_call(sd, pad, dv_timings_cap, cap);
 
-- 
2.9.3


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

* Re: [PATCH v9 0/2] rcar-vin EDID control ioctls
  2016-09-15 17:33 [PATCH v9 0/2] rcar-vin EDID control ioctls Ulrich Hecht
  2016-09-15 17:33 ` [PATCH v9 1/2] rcar-vin: implement " Ulrich Hecht
  2016-09-15 17:33 ` [PATCH v9 2/2] media: rcar-vin: use sink pad index for DV timings Ulrich Hecht
@ 2016-09-15 17:44 ` Hans Verkuil
  2 siblings, 0 replies; 6+ messages in thread
From: Hans Verkuil @ 2016-09-15 17:44 UTC (permalink / raw)
  To: Ulrich Hecht, hans.verkuil, niklas.soderlund
  Cc: linux-media, linux-renesas-soc, magnus.damm, laurent.pinchart,
	william.towle



On 09/15/2016 07:33 PM, Ulrich Hecht wrote:
> Hi!
> 
> This revision sits on top of Hans's rcar branch and adds pad sanity checks
> for g_edid and s_edid, the sink pad fix for the DV timings suggested by
> Niklas, and documents sink_pad_idx. Good night!
> 
> CU
> Uli
> 
> 
> Changes since v8:
> - dumped merged default-input patch

I've 'unmerged' this due to a comment from Laurent.

Can you look at Laurent's reply?

	Hans

> - added pad sanity check
> - added DV timings sink pad fix
> - documented sink_pad_idx
> - added Acked-By
> 
> Changes since v7:
> - do not fail if there is no sink pad
> 
> Changes since v6:
> - work without subdev abstraction layer
> - split off DT parts, to be handled separately
> 
> Changes since v5:
> - implement vin/subdev pad translation
> - move i2c devices
> 
> Changes since v4:
> - drop merged patches
> - adv7604: always fall back to input 0 if nothing else is specified
> - rcar-vin: implement G_EDID, S_EDID in place of hard-coded EDID blob
> 
> Changes since v3:
> - rvin_enum_dv_timings(): use vin->src_pad_idx
> - rvin_dv_timings_cap(): likewise
> - rvin_s_dv_timings(): update vin->format
> - add Koelsch support
> 
> 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: "
> 
> 
> Ulrich Hecht (2):
>   rcar-vin: implement EDID control ioctls
>   media: rcar-vin: use sink pad index for DV timings
> 
>  drivers/media/platform/rcar-vin/rcar-v4l2.c | 52 +++++++++++++++++++++++++++--
>  drivers/media/platform/rcar-vin/rcar-vin.h  |  2 ++
>  2 files changed, 52 insertions(+), 2 deletions(-)
> 

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

* Re: [PATCH v9 1/2] rcar-vin: implement EDID control ioctls
  2016-09-15 17:33 ` [PATCH v9 1/2] rcar-vin: implement " Ulrich Hecht
@ 2016-09-15 17:57   ` Laurent Pinchart
  0 siblings, 0 replies; 6+ messages in thread
From: Laurent Pinchart @ 2016-09-15 17:57 UTC (permalink / raw)
  To: Ulrich Hecht
  Cc: hans.verkuil, niklas.soderlund, linux-media, linux-renesas-soc,
	magnus.damm, william.towle

Hi Ulrich,

Thank you for the patch.

On Thursday 15 Sep 2016 19:33:23 Ulrich Hecht wrote:
> Adds G_EDID and S_EDID.
> 
> Signed-off-by: Ulrich Hecht <ulrich.hecht+renesas@gmail.com>
> Acked-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>

Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> ---
>  drivers/media/platform/rcar-vin/rcar-v4l2.c | 48 ++++++++++++++++++++++++++
>  drivers/media/platform/rcar-vin/rcar-vin.h  |  2 ++
>  2 files changed, 50 insertions(+)
> 
> diff --git a/drivers/media/platform/rcar-vin/rcar-v4l2.c
> b/drivers/media/platform/rcar-vin/rcar-v4l2.c index 61e9b59..f35005c 100644
> --- a/drivers/media/platform/rcar-vin/rcar-v4l2.c
> +++ b/drivers/media/platform/rcar-vin/rcar-v4l2.c
> @@ -613,6 +613,44 @@ static int rvin_dv_timings_cap(struct file *file, void
> *priv_fh, return ret;
>  }
> 
> +static int rvin_g_edid(struct file *file, void *fh, struct v4l2_edid *edid)
> +{
> +	struct rvin_dev *vin = video_drvdata(file);
> +	struct v4l2_subdev *sd = vin_to_source(vin);
> +	int input, ret;
> +
> +	if (edid->pad)
> +		return -EINVAL;
> +
> +	input = edid->pad;
> +	edid->pad = vin->sink_pad_idx;
> +
> +	ret = v4l2_subdev_call(sd, pad, get_edid, edid);
> +
> +	edid->pad = input;
> +
> +	return ret;
> +}
> +
> +static int rvin_s_edid(struct file *file, void *fh, struct v4l2_edid *edid)
> +{
> +	struct rvin_dev *vin = video_drvdata(file);
> +	struct v4l2_subdev *sd = vin_to_source(vin);
> +	int input, ret;
> +
> +	if (edid->pad)
> +		return -EINVAL;
> +
> +	input = edid->pad;
> +	edid->pad = vin->sink_pad_idx;
> +
> +	ret = v4l2_subdev_call(sd, pad, set_edid, edid);
> +
> +	edid->pad = input;
> +
> +	return ret;
> +}
> +
>  static const struct v4l2_ioctl_ops rvin_ioctl_ops = {
>  	.vidioc_querycap		= rvin_querycap,
>  	.vidioc_try_fmt_vid_cap		= rvin_try_fmt_vid_cap,
> @@ -635,6 +673,9 @@ static const struct v4l2_ioctl_ops rvin_ioctl_ops = {
>  	.vidioc_s_dv_timings		= rvin_s_dv_timings,
>  	.vidioc_query_dv_timings	= rvin_query_dv_timings,
> 
> +	.vidioc_g_edid			= rvin_g_edid,
> +	.vidioc_s_edid			= rvin_s_edid,
> +
>  	.vidioc_querystd		= rvin_querystd,
>  	.vidioc_g_std			= rvin_g_std,
>  	.vidioc_s_std			= rvin_s_std,
> @@ -883,6 +924,13 @@ int rvin_v4l2_probe(struct rvin_dev *vin)
> 
>  	vin->src_pad_idx = pad_idx;
> 
> +	vin->sink_pad_idx = 0;
> +	for (pad_idx = 0; pad_idx < sd->entity.num_pads; pad_idx++)
> +		if (sd->entity.pads[pad_idx].flags == MEDIA_PAD_FL_SINK) {
> +			vin->sink_pad_idx = pad_idx;
> +			break;
> +		}
> +
>  	vin->format.pixelformat	= RVIN_DEFAULT_FORMAT;
>  	rvin_reset_format(vin);
> 
> diff --git a/drivers/media/platform/rcar-vin/rcar-vin.h
> b/drivers/media/platform/rcar-vin/rcar-vin.h index 793184d..727e215 100644
> --- a/drivers/media/platform/rcar-vin/rcar-vin.h
> +++ b/drivers/media/platform/rcar-vin/rcar-vin.h
> @@ -92,6 +92,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
> + * @sink_pad_idx:	sink pad index for media controller drivers
>   * @ctrl_handler:	V4L2 control handler
>   * @notifier:		V4L2 asynchronous subdevs notifier
>   * @digital:		entity in the DT for local digital subdevice
> @@ -121,6 +122,7 @@ struct rvin_dev {
>  	struct video_device vdev;
>  	struct v4l2_device v4l2_dev;
>  	int src_pad_idx;
> +	int sink_pad_idx;
>  	struct v4l2_ctrl_handler ctrl_handler;
>  	struct v4l2_async_notifier notifier;
>  	struct rvin_graph_entity digital;

-- 
Regards,

Laurent Pinchart


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

* Re: [PATCH v9 2/2] media: rcar-vin: use sink pad index for DV timings
  2016-09-15 17:33 ` [PATCH v9 2/2] media: rcar-vin: use sink pad index for DV timings Ulrich Hecht
@ 2016-09-15 17:57   ` Laurent Pinchart
  0 siblings, 0 replies; 6+ messages in thread
From: Laurent Pinchart @ 2016-09-15 17:57 UTC (permalink / raw)
  To: Ulrich Hecht
  Cc: hans.verkuil, niklas.soderlund, linux-media, linux-renesas-soc,
	magnus.damm, william.towle

Hi Ulrich,

Thank you for the patch.

On Thursday 15 Sep 2016 19:33:24 Ulrich Hecht wrote:
> Signed-off-by: Ulrich Hecht <ulrich.hecht+renesas@gmail.com>

With a commit message explaining why this is needed,

Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> ---
>  drivers/media/platform/rcar-vin/rcar-v4l2.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/media/platform/rcar-vin/rcar-v4l2.c
> b/drivers/media/platform/rcar-vin/rcar-v4l2.c index f35005c..2bbe6d4 100644
> --- a/drivers/media/platform/rcar-vin/rcar-v4l2.c
> +++ b/drivers/media/platform/rcar-vin/rcar-v4l2.c
> @@ -550,7 +550,7 @@ static int rvin_enum_dv_timings(struct file *file, void
> *priv_fh, int pad, ret;
> 
>  	pad = timings->pad;
> -	timings->pad = vin->src_pad_idx;
> +	timings->pad = vin->sink_pad_idx;
> 
>  	ret = v4l2_subdev_call(sd, pad, enum_dv_timings, timings);
> 
> @@ -604,7 +604,7 @@ static int rvin_dv_timings_cap(struct file *file, void
> *priv_fh, int pad, ret;
> 
>  	pad = cap->pad;
> -	cap->pad = vin->src_pad_idx;
> +	cap->pad = vin->sink_pad_idx;
> 
>  	ret = v4l2_subdev_call(sd, pad, dv_timings_cap, cap);

-- 
Regards,

Laurent Pinchart


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

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

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-15 17:33 [PATCH v9 0/2] rcar-vin EDID control ioctls Ulrich Hecht
2016-09-15 17:33 ` [PATCH v9 1/2] rcar-vin: implement " Ulrich Hecht
2016-09-15 17:57   ` Laurent Pinchart
2016-09-15 17:33 ` [PATCH v9 2/2] media: rcar-vin: use sink pad index for DV timings Ulrich Hecht
2016-09-15 17:57   ` Laurent Pinchart
2016-09-15 17:44 ` [PATCH v9 0/2] rcar-vin EDID control ioctls Hans Verkuil

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.