Re: [PATCH v4 20/27] rcar-vin: register a media pad if running in media controller mode

2017-05-04 Thread Sakari Ailus
On Fri, Apr 28, 2017 at 12:41:56AM +0200, Niklas Söderlund wrote:
> When running in media controller mode a media pad is needed, register
> one.
> 
> Signed-off-by: Niklas Söderlund 
> ---
>  drivers/media/platform/rcar-vin/rcar-core.c | 9 +
>  drivers/media/platform/rcar-vin/rcar-vin.h  | 4 
>  2 files changed, 13 insertions(+)
> 
> diff --git a/drivers/media/platform/rcar-vin/rcar-core.c 
> b/drivers/media/platform/rcar-vin/rcar-core.c
> index 7aaa01dee014d64b..f560d27449b84882 100644
> --- a/drivers/media/platform/rcar-vin/rcar-core.c
> +++ b/drivers/media/platform/rcar-vin/rcar-core.c
> @@ -267,7 +267,16 @@ static int rvin_group_init(struct rvin_dev *vin)
>   if (ret)
>   return ret;
>  
> + vin->pad.flags = MEDIA_PAD_FL_SINK;
> + ret = media_entity_pads_init(>vdev->entity, 1, >pad);
> + if (ret)
> + goto error_v4l2;
> +
>   return 0;

This would benefit from an extra newline.

> +error_v4l2:
> + rvin_v4l2_mc_remove(vin);
> +
> + return ret;
>  }
>  
>  /* 
> -
> diff --git a/drivers/media/platform/rcar-vin/rcar-vin.h 
> b/drivers/media/platform/rcar-vin/rcar-vin.h
> index 6f2b1e28381678a9..06934313950253f4 100644
> --- a/drivers/media/platform/rcar-vin/rcar-vin.h
> +++ b/drivers/media/platform/rcar-vin/rcar-vin.h
> @@ -103,6 +103,8 @@ struct rvin_info {
>   * @notifier:V4L2 asynchronous subdevs notifier
>   * @digital: entity in the DT for local digital subdevice
>   *
> + * @pad: pad for media controller
> + *
>   * @lock:protects @queue
>   * @queue:   vb2 buffers queue
>   *
> @@ -132,6 +134,8 @@ struct rvin_dev {
>   struct v4l2_async_notifier notifier;
>   struct rvin_graph_entity digital;
>  
> + struct media_pad pad;
> +
>   struct mutex lock;
>   struct vb2_queue queue;
>  

-- 
Sakari Ailus
e-mail: sakari.ai...@iki.fi XMPP: sai...@retiisi.org.uk


[PATCH v4 20/27] rcar-vin: register a media pad if running in media controller mode

2017-04-27 Thread Niklas Söderlund
When running in media controller mode a media pad is needed, register
one.

Signed-off-by: Niklas Söderlund 
---
 drivers/media/platform/rcar-vin/rcar-core.c | 9 +
 drivers/media/platform/rcar-vin/rcar-vin.h  | 4 
 2 files changed, 13 insertions(+)

diff --git a/drivers/media/platform/rcar-vin/rcar-core.c 
b/drivers/media/platform/rcar-vin/rcar-core.c
index 7aaa01dee014d64b..f560d27449b84882 100644
--- a/drivers/media/platform/rcar-vin/rcar-core.c
+++ b/drivers/media/platform/rcar-vin/rcar-core.c
@@ -267,7 +267,16 @@ static int rvin_group_init(struct rvin_dev *vin)
if (ret)
return ret;
 
+   vin->pad.flags = MEDIA_PAD_FL_SINK;
+   ret = media_entity_pads_init(>vdev->entity, 1, >pad);
+   if (ret)
+   goto error_v4l2;
+
return 0;
+error_v4l2:
+   rvin_v4l2_mc_remove(vin);
+
+   return ret;
 }
 
 /* 
-
diff --git a/drivers/media/platform/rcar-vin/rcar-vin.h 
b/drivers/media/platform/rcar-vin/rcar-vin.h
index 6f2b1e28381678a9..06934313950253f4 100644
--- a/drivers/media/platform/rcar-vin/rcar-vin.h
+++ b/drivers/media/platform/rcar-vin/rcar-vin.h
@@ -103,6 +103,8 @@ struct rvin_info {
  * @notifier:  V4L2 asynchronous subdevs notifier
  * @digital:   entity in the DT for local digital subdevice
  *
+ * @pad:   pad for media controller
+ *
  * @lock:  protects @queue
  * @queue: vb2 buffers queue
  *
@@ -132,6 +134,8 @@ struct rvin_dev {
struct v4l2_async_notifier notifier;
struct rvin_graph_entity digital;
 
+   struct media_pad pad;
+
struct mutex lock;
struct vb2_queue queue;
 
-- 
2.12.2