All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/2] [media] tvp5150: Add MC support
@ 2016-01-26 12:46 Javier Martinez Canillas
  2016-01-26 12:46 ` [PATCH v3 1/2] [media] tvp5150: fix tvp5150_fill_fmt() Javier Martinez Canillas
  2016-01-26 12:46 ` [PATCH v3 2/2] [media] tvp5150: Add pad-level subdev operations Javier Martinez Canillas
  0 siblings, 2 replies; 5+ messages in thread
From: Javier Martinez Canillas @ 2016-01-26 12:46 UTC (permalink / raw)
  To: linux-kernel
  Cc: Javier Martinez Canillas, Mauro Carvalho Chehab,
	Guennadi Liakhovetski, Krzysztof Kozlowski, Eduard Gavin,
	Laurent Pinchart, Hans Verkuil, linux-media

Hello,

This series is a split of patch [0] that was part of this series [1].

All patches in that series were picked besides [0] that Mauro asked
to split in two different patches.

I kept the version number of the previous series (v2) so the patches
are marked as v3.

[0]: http://lkml.iu.edu/hypermail/linux/kernel/1601.0/00923.html
[1]: http://lkml.iu.edu/hypermail/linux/kernel/1601.0/00910.html

Best regards,
Javier

Changes in v3:
- Split the format fix and the MC support in different patches.
  Suggested by Mauro Carvalho Chehab.

Changes in v2:
- Embed mbus_type into struct tvp5150. Suggested by Laurent Pinchart.
- Remove platform data support. Suggested by Laurent Pinchart.
- Check if the hsync, vsync and field even active properties are correct.
  Suggested by Laurent Pinchart.

Laurent Pinchart (2):
  [media] tvp5150: fix tvp5150_fill_fmt()
  [media] tvp5150: Add pad-level subdev operations

 drivers/media/i2c/tvp5150.c | 25 ++++++++++++-------------
 1 file changed, 12 insertions(+), 13 deletions(-)

-- 
2.5.0

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

* [PATCH v3 1/2] [media] tvp5150: fix tvp5150_fill_fmt()
  2016-01-26 12:46 [PATCH v3 0/2] [media] tvp5150: Add MC support Javier Martinez Canillas
@ 2016-01-26 12:46 ` Javier Martinez Canillas
  2016-01-26 12:46 ` [PATCH v3 2/2] [media] tvp5150: Add pad-level subdev operations Javier Martinez Canillas
  1 sibling, 0 replies; 5+ messages in thread
From: Javier Martinez Canillas @ 2016-01-26 12:46 UTC (permalink / raw)
  To: linux-kernel
  Cc: Laurent Pinchart, Javier Martinez Canillas,
	Mauro Carvalho Chehab, Guennadi Liakhovetski,
	Krzysztof Kozlowski, Hans Verkuil, linux-media

From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

The tvp5150 output video is interlaced so mark the format
field as alternate and reduce the height to the half.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
[javier: split patch and write commit message]
Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>

---

Changes in v3: None
Changes in v2: None

 drivers/media/i2c/tvp5150.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/media/i2c/tvp5150.c b/drivers/media/i2c/tvp5150.c
index 9b83fc9ee8d1..37853bc3f0b3 100644
--- a/drivers/media/i2c/tvp5150.c
+++ b/drivers/media/i2c/tvp5150.c
@@ -852,10 +852,10 @@ static int tvp5150_fill_fmt(struct v4l2_subdev *sd,
 	tvp5150_reset(sd, 0);
 
 	f->width = decoder->rect.width;
-	f->height = decoder->rect.height;
+	f->height = decoder->rect.height / 2;
 
 	f->code = MEDIA_BUS_FMT_UYVY8_2X8;
-	f->field = V4L2_FIELD_SEQ_TB;
+	f->field = V4L2_FIELD_ALTERNATE;
 	f->colorspace = V4L2_COLORSPACE_SMPTE170M;
 
 	v4l2_dbg(1, debug, sd, "width = %d, height = %d\n", f->width,
-- 
2.5.0

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

* [PATCH v3 2/2] [media] tvp5150: Add pad-level subdev operations
  2016-01-26 12:46 [PATCH v3 0/2] [media] tvp5150: Add MC support Javier Martinez Canillas
  2016-01-26 12:46 ` [PATCH v3 1/2] [media] tvp5150: fix tvp5150_fill_fmt() Javier Martinez Canillas
@ 2016-01-26 12:46 ` Javier Martinez Canillas
  2016-01-27  9:38   ` Mauro Carvalho Chehab
  1 sibling, 1 reply; 5+ messages in thread
From: Javier Martinez Canillas @ 2016-01-26 12:46 UTC (permalink / raw)
  To: linux-kernel
  Cc: Laurent Pinchart, Javier Martinez Canillas,
	Mauro Carvalho Chehab, Guennadi Liakhovetski, Eduard Gavin,
	Hans Verkuil, linux-media

From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

This patch enables the tvp5150 decoder driver to be used with the media
controller framework by adding pad-level subdev operations and init the
media entity pad.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>

---

Changes in v3:
- Split the format fix and the MC support in different patches.
  Suggested by Mauro Carvalho Chehab.

Changes in v2:
- Embed mbus_type into struct tvp5150. Suggested by Laurent Pinchart.
- Remove platform data support. Suggested by Laurent Pinchart.
- Check if the hsync, vsync and field even active properties are correct.
  Suggested by Laurent Pinchart.

 drivers/media/i2c/tvp5150.c | 21 ++++++++++-----------
 1 file changed, 10 insertions(+), 11 deletions(-)

diff --git a/drivers/media/i2c/tvp5150.c b/drivers/media/i2c/tvp5150.c
index 37853bc3f0b3..e48b529c53b4 100644
--- a/drivers/media/i2c/tvp5150.c
+++ b/drivers/media/i2c/tvp5150.c
@@ -37,6 +37,7 @@ MODULE_PARM_DESC(debug, "Debug level (0-2)");
 
 struct tvp5150 {
 	struct v4l2_subdev sd;
+	struct media_pad pad;
 	struct v4l2_ctrl_handler hdl;
 	struct v4l2_rect rect;
 
@@ -826,17 +827,6 @@ static v4l2_std_id tvp5150_read_std(struct v4l2_subdev *sd)
 	}
 }
 
-static int tvp5150_enum_mbus_code(struct v4l2_subdev *sd,
-		struct v4l2_subdev_pad_config *cfg,
-		struct v4l2_subdev_mbus_code_enum *code)
-{
-	if (code->pad || code->index)
-		return -EINVAL;
-
-	code->code = MEDIA_BUS_FMT_UYVY8_2X8;
-	return 0;
-}
-
 static int tvp5150_fill_fmt(struct v4l2_subdev *sd,
 		struct v4l2_subdev_pad_config *cfg,
 		struct v4l2_subdev_format *format)
@@ -1165,6 +1155,7 @@ static const struct v4l2_subdev_vbi_ops tvp5150_vbi_ops = {
 
 static const struct v4l2_subdev_pad_ops tvp5150_pad_ops = {
 	.enum_mbus_code = tvp5150_enum_mbus_code,
+	.enum_frame_size = tvp5150_enum_frame_size,
 	.set_fmt = tvp5150_fill_fmt,
 	.get_fmt = tvp5150_fill_fmt,
 };
@@ -1320,6 +1311,14 @@ static int tvp5150_probe(struct i2c_client *c,
 	}
 
 	v4l2_i2c_subdev_init(sd, c, &tvp5150_ops);
+	sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
+
+#if defined(CONFIG_MEDIA_CONTROLLER)
+	core->pad.flags = MEDIA_PAD_FL_SOURCE;
+	res = media_entity_pads_init(&sd->entity, 1, &core->pad);
+	if (res < 0)
+		return res;
+#endif
 
 	res = tvp5150_detect_version(core);
 	if (res < 0)
-- 
2.5.0

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

* Re: [PATCH v3 2/2] [media] tvp5150: Add pad-level subdev operations
  2016-01-26 12:46 ` [PATCH v3 2/2] [media] tvp5150: Add pad-level subdev operations Javier Martinez Canillas
@ 2016-01-27  9:38   ` Mauro Carvalho Chehab
  2016-01-27 11:22     ` Javier Martinez Canillas
  0 siblings, 1 reply; 5+ messages in thread
From: Mauro Carvalho Chehab @ 2016-01-27  9:38 UTC (permalink / raw)
  To: Javier Martinez Canillas
  Cc: linux-kernel, Laurent Pinchart, Guennadi Liakhovetski,
	Eduard Gavin, Hans Verkuil, linux-media

Em Tue, 26 Jan 2016 09:46:24 -0300
Javier Martinez Canillas <javier@osg.samsung.com> escreveu:

> From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> 
> This patch enables the tvp5150 decoder driver to be used with the media
> controller framework by adding pad-level subdev operations and init the
> media entity pad.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
> 
> ---
> 
> Changes in v3:
> - Split the format fix and the MC support in different patches.
>   Suggested by Mauro Carvalho Chehab.
> 
> Changes in v2:
> - Embed mbus_type into struct tvp5150. Suggested by Laurent Pinchart.
> - Remove platform data support. Suggested by Laurent Pinchart.
> - Check if the hsync, vsync and field even active properties are correct.
>   Suggested by Laurent Pinchart.
> 
>  drivers/media/i2c/tvp5150.c | 21 ++++++++++-----------
>  1 file changed, 10 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/media/i2c/tvp5150.c b/drivers/media/i2c/tvp5150.c
> index 37853bc3f0b3..e48b529c53b4 100644
> --- a/drivers/media/i2c/tvp5150.c
> +++ b/drivers/media/i2c/tvp5150.c
> @@ -37,6 +37,7 @@ MODULE_PARM_DESC(debug, "Debug level (0-2)");
>  
>  struct tvp5150 {
>  	struct v4l2_subdev sd;
> +	struct media_pad pad;
>  	struct v4l2_ctrl_handler hdl;
>  	struct v4l2_rect rect;
>  
> @@ -826,17 +827,6 @@ static v4l2_std_id tvp5150_read_std(struct v4l2_subdev *sd)
>  	}
>  }
>  
> -static int tvp5150_enum_mbus_code(struct v4l2_subdev *sd,
> -		struct v4l2_subdev_pad_config *cfg,
> -		struct v4l2_subdev_mbus_code_enum *code)
> -{
> -	if (code->pad || code->index)
> -		return -EINVAL;
> -
> -	code->code = MEDIA_BUS_FMT_UYVY8_2X8;
> -	return 0;
> -}
> -

Huh! Why are you removing this? It is causing compilation breakages!

>  static int tvp5150_fill_fmt(struct v4l2_subdev *sd,
>  		struct v4l2_subdev_pad_config *cfg,
>  		struct v4l2_subdev_format *format)
> @@ -1165,6 +1155,7 @@ static const struct v4l2_subdev_vbi_ops tvp5150_vbi_ops = {
>  
>  static const struct v4l2_subdev_pad_ops tvp5150_pad_ops = {
>  	.enum_mbus_code = tvp5150_enum_mbus_code,
> +	.enum_frame_size = tvp5150_enum_frame_size,

Also, you forgot to add tvp5150_enum_frame_size here!

drivers/media/i2c/tvp5150.c:1124:20: error: 'tvp5150_enum_mbus_code' undeclared here (not in a function)
  .enum_mbus_code = tvp5150_enum_mbus_code,
                    ^
drivers/media/i2c/tvp5150.c:1125:21: error: 'tvp5150_enum_frame_size' undeclared here (not in a function)
  .enum_frame_size = tvp5150_enum_frame_size,
                     ^
Regards,
Mauro

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

* Re: [PATCH v3 2/2] [media] tvp5150: Add pad-level subdev operations
  2016-01-27  9:38   ` Mauro Carvalho Chehab
@ 2016-01-27 11:22     ` Javier Martinez Canillas
  0 siblings, 0 replies; 5+ messages in thread
From: Javier Martinez Canillas @ 2016-01-27 11:22 UTC (permalink / raw)
  To: Mauro Carvalho Chehab
  Cc: linux-kernel, Laurent Pinchart, Guennadi Liakhovetski,
	Eduard Gavin, Hans Verkuil, linux-media

Hello Mauro,

On 01/27/2016 06:38 AM, Mauro Carvalho Chehab wrote:
> Em Tue, 26 Jan 2016 09:46:24 -0300
> Javier Martinez Canillas <javier@osg.samsung.com> escreveu:
>
>> From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
>>
>> This patch enables the tvp5150 decoder driver to be used with the media
>> controller framework by adding pad-level subdev operations and init the
>> media entity pad.
>>
>> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
>> Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
>>
>> ---
>>
>> Changes in v3:
>> - Split the format fix and the MC support in different patches.
>>    Suggested by Mauro Carvalho Chehab.
>>
>> Changes in v2:
>> - Embed mbus_type into struct tvp5150. Suggested by Laurent Pinchart.
>> - Remove platform data support. Suggested by Laurent Pinchart.
>> - Check if the hsync, vsync and field even active properties are correct.
>>    Suggested by Laurent Pinchart.
>>
>>   drivers/media/i2c/tvp5150.c | 21 ++++++++++-----------
>>   1 file changed, 10 insertions(+), 11 deletions(-)
>>
>> diff --git a/drivers/media/i2c/tvp5150.c b/drivers/media/i2c/tvp5150.c
>> index 37853bc3f0b3..e48b529c53b4 100644
>> --- a/drivers/media/i2c/tvp5150.c
>> +++ b/drivers/media/i2c/tvp5150.c
>> @@ -37,6 +37,7 @@ MODULE_PARM_DESC(debug, "Debug level (0-2)");
>>
>>   struct tvp5150 {
>>   	struct v4l2_subdev sd;
>> +	struct media_pad pad;
>>   	struct v4l2_ctrl_handler hdl;
>>   	struct v4l2_rect rect;
>>
>> @@ -826,17 +827,6 @@ static v4l2_std_id tvp5150_read_std(struct v4l2_subdev *sd)
>>   	}
>>   }
>>
>> -static int tvp5150_enum_mbus_code(struct v4l2_subdev *sd,
>> -		struct v4l2_subdev_pad_config *cfg,
>> -		struct v4l2_subdev_mbus_code_enum *code)
>> -{
>> -	if (code->pad || code->index)
>> -		return -EINVAL;
>> -
>> -	code->code = MEDIA_BUS_FMT_UYVY8_2X8;
>> -	return 0;
>> -}
>> -
>
> Huh! Why are you removing this? It is causing compilation breakages!
>

Sigh, somehow I managed to post the wrong patch... I'm so sorry about that.

Laurent's patch moves this function so the V4L2 subdev pad ops are grouped
together. That's was the idea, not to remove it.
  
>>   static int tvp5150_fill_fmt(struct v4l2_subdev *sd,
>>   		struct v4l2_subdev_pad_config *cfg,
>>   		struct v4l2_subdev_format *format)
>> @@ -1165,6 +1155,7 @@ static const struct v4l2_subdev_vbi_ops tvp5150_vbi_ops = {
>>
>>   static const struct v4l2_subdev_pad_ops tvp5150_pad_ops = {
>>   	.enum_mbus_code = tvp5150_enum_mbus_code,
>> +	.enum_frame_size = tvp5150_enum_frame_size,
>
> Also, you forgot to add tvp5150_enum_frame_size here!
>

Yes, this is also missing in the posted patch. Following [0] is the correct
one, please let me know if you want me to resend or sharing here is enough.

> drivers/media/i2c/tvp5150.c:1124:20: error: 'tvp5150_enum_mbus_code' undeclared here (not in a function)
>    .enum_mbus_code = tvp5150_enum_mbus_code,
>                      ^
> drivers/media/i2c/tvp5150.c:1125:21: error: 'tvp5150_enum_frame_size' undeclared here (not in a function)
>    .enum_frame_size = tvp5150_enum_frame_size,
>                       ^
> Regards,
> Mauro
>

[0]:
 From 3436139006fd4adc2cf195b60c10a3f7598b3e08 Mon Sep 17 00:00:00 2001
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Date: Sun, 18 May 2014 17:53:06 +0200
Subject: [PATCH v3 2/2] [media] tvp5150: Add pad-level subdev operations

This patch enables the tvp5150 decoder driver to be used with the media
controller framework by adding pad-level subdev operations and init the
media entity pad.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>

---

Changes in v3:
- Split the format fix and the MC support in different patches.
   Suggested by Mauro Carvalho Chehab.

Changes in v2:
- Embed mbus_type into struct tvp5150. Suggested by Laurent Pinchart.
- Remove platform data support. Suggested by Laurent Pinchart.
- Check if the hsync, vsync and field even active properties are correct.
   Suggested by Laurent Pinchart.

  drivers/media/i2c/tvp5150.c | 54 ++++++++++++++++++++++++++++++++++++---------
  1 file changed, 43 insertions(+), 11 deletions(-)

diff --git a/drivers/media/i2c/tvp5150.c b/drivers/media/i2c/tvp5150.c
index 97d19de1b051..8e4f4fa5cfdc 100644
--- a/drivers/media/i2c/tvp5150.c
+++ b/drivers/media/i2c/tvp5150.c
@@ -37,6 +37,7 @@ MODULE_PARM_DESC(debug, "Debug level (0-2)");
  
  struct tvp5150 {
  	struct v4l2_subdev sd;
+	struct media_pad pad;
  	struct v4l2_ctrl_handler hdl;
  	struct v4l2_rect rect;
  
@@ -826,17 +827,6 @@ static v4l2_std_id tvp5150_read_std(struct v4l2_subdev *sd)
  	}
  }
  
-static int tvp5150_enum_mbus_code(struct v4l2_subdev *sd,
-		struct v4l2_subdev_pad_config *cfg,
-		struct v4l2_subdev_mbus_code_enum *code)
-{
-	if (code->pad || code->index)
-		return -EINVAL;
-
-	code->code = MEDIA_BUS_FMT_UYVY8_2X8;
-	return 0;
-}
-
  static int tvp5150_fill_fmt(struct v4l2_subdev *sd,
  		struct v4l2_subdev_pad_config *cfg,
  		struct v4l2_subdev_format *format)
@@ -968,6 +958,39 @@ static int tvp5150_g_mbus_config(struct v4l2_subdev *sd,
  	return 0;
  }
  
+ /****************************************************************************
+			V4L2 subdev pad ops
+ ****************************************************************************/
+
+static int tvp5150_enum_mbus_code(struct v4l2_subdev *sd,
+				  struct v4l2_subdev_pad_config *cfg,
+				  struct v4l2_subdev_mbus_code_enum *code)
+{
+	if (code->index)
+		return -EINVAL;
+
+	code->code = MEDIA_BUS_FMT_UYVY8_2X8;
+	return 0;
+}
+
+static int tvp5150_enum_frame_size(struct v4l2_subdev *sd,
+				   struct v4l2_subdev_pad_config *cfg,
+				   struct v4l2_subdev_frame_size_enum *fse)
+{
+	struct tvp5150 *decoder = to_tvp5150(sd);
+
+	if (fse->index >= 8 || fse->code != MEDIA_BUS_FMT_UYVY8_2X8)
+		return -EINVAL;
+
+	fse->code = MEDIA_BUS_FMT_UYVY8_2X8;
+	fse->min_width = decoder->rect.width;
+	fse->max_width = decoder->rect.width;
+	fse->min_height = decoder->rect.height / 2;
+	fse->max_height = decoder->rect.height / 2;
+
+	return 0;
+}
+
  /****************************************************************************
  			I2C Command
   ****************************************************************************/
@@ -1131,6 +1154,7 @@ static const struct v4l2_subdev_vbi_ops tvp5150_vbi_ops = {
  
  static const struct v4l2_subdev_pad_ops tvp5150_pad_ops = {
  	.enum_mbus_code = tvp5150_enum_mbus_code,
+	.enum_frame_size = tvp5150_enum_frame_size,
  	.set_fmt = tvp5150_fill_fmt,
  	.get_fmt = tvp5150_fill_fmt,
  };
@@ -1286,6 +1310,14 @@ static int tvp5150_probe(struct i2c_client *c,
  	}
  
  	v4l2_i2c_subdev_init(sd, c, &tvp5150_ops);
+	sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
+
+#if defined(CONFIG_MEDIA_CONTROLLER)
+	core->pad.flags = MEDIA_PAD_FL_SOURCE;
+	res = media_entity_pads_init(&sd->entity, 1, &core->pad);
+	if (res < 0)
+		return res;
+#endif
  
  	res = tvp5150_detect_version(core);
  	if (res < 0)
-- 
2.5.0

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

end of thread, other threads:[~2016-01-27 11:22 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-26 12:46 [PATCH v3 0/2] [media] tvp5150: Add MC support Javier Martinez Canillas
2016-01-26 12:46 ` [PATCH v3 1/2] [media] tvp5150: fix tvp5150_fill_fmt() Javier Martinez Canillas
2016-01-26 12:46 ` [PATCH v3 2/2] [media] tvp5150: Add pad-level subdev operations Javier Martinez Canillas
2016-01-27  9:38   ` Mauro Carvalho Chehab
2016-01-27 11:22     ` Javier Martinez Canillas

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.