| From 15af81a3abe0be590d2f6c6b1e5776c8bf4725dd Mon Sep 17 00:00:00 2001 |
| From: =?UTF-8?q?Niklas=20S=C3=B6derlund?= |
| <niklas.soderlund+renesas@ragnatech.se> |
| Date: Sat, 14 Apr 2018 07:57:17 -0400 |
| Subject: [PATCH 1303/1795] media: rcar-vin: prepare for media controller mode |
| initialization |
| MIME-Version: 1.0 |
| Content-Type: text/plain; charset=UTF-8 |
| Content-Transfer-Encoding: 8bit |
| |
| Prepare for media controller by calling a different initialization then |
| when running in device centric mode. Add trivial configuration of |
| the mbus and creation of the media pad for the video device entity. |
| |
| While we are at it clearly mark the digital device centric notifier |
| functions with a comment. |
| |
| Signed-off-by: Niklas Sรถderlund <niklas.soderlund+renesas@ragnatech.se> |
| Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> |
| Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> |
| Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com> |
| (cherry picked from commit 68ee48d66648f8c800a640733ce774d0bdc06329) |
| Signed-off-by: Simon Horman <horms+renesas@verge.net.au> |
| Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> |
| --- |
| drivers/media/platform/rcar-vin/rcar-core.c | 20 ++++++++++++++++++-- |
| drivers/media/platform/rcar-vin/rcar-vin.h | 4 ++++ |
| 2 files changed, 22 insertions(+), 2 deletions(-) |
| |
| diff --git a/drivers/media/platform/rcar-vin/rcar-core.c b/drivers/media/platform/rcar-vin/rcar-core.c |
| index 9d5b1d152286..9e31c771917f 100644 |
| --- a/drivers/media/platform/rcar-vin/rcar-core.c |
| +++ b/drivers/media/platform/rcar-vin/rcar-core.c |
| @@ -46,6 +46,10 @@ static int rvin_find_pad(struct v4l2_subdev *sd, int direction) |
| return -EINVAL; |
| } |
| |
| +/* ----------------------------------------------------------------------------- |
| + * Digital async notifier |
| + */ |
| + |
| /* The vin lock should be held when calling the subdevice attach and detach */ |
| static int rvin_digital_subdevice_attach(struct rvin_dev *vin, |
| struct v4l2_subdev *subdev) |
| @@ -243,6 +247,16 @@ static int rvin_digital_graph_init(struct rvin_dev *vin) |
| return 0; |
| } |
| |
| +static int rvin_mc_init(struct rvin_dev *vin) |
| +{ |
| + /* All our sources are CSI-2 */ |
| + vin->mbus_cfg.type = V4L2_MBUS_CSI2; |
| + vin->mbus_cfg.flags = 0; |
| + |
| + vin->pad.flags = MEDIA_PAD_FL_SINK; |
| + return media_entity_pads_init(&vin->vdev.entity, 1, &vin->pad); |
| +} |
| + |
| /* ----------------------------------------------------------------------------- |
| * Platform Device Driver |
| */ |
| @@ -331,8 +345,10 @@ static int rcar_vin_probe(struct platform_device *pdev) |
| return ret; |
| |
| platform_set_drvdata(pdev, vin); |
| - |
| - ret = rvin_digital_graph_init(vin); |
| + if (vin->info->use_mc) |
| + ret = rvin_mc_init(vin); |
| + else |
| + ret = rvin_digital_graph_init(vin); |
| if (ret < 0) |
| goto error; |
| |
| diff --git a/drivers/media/platform/rcar-vin/rcar-vin.h b/drivers/media/platform/rcar-vin/rcar-vin.h |
| index e5668c1120a6..5102ad254bff 100644 |
| --- a/drivers/media/platform/rcar-vin/rcar-vin.h |
| +++ b/drivers/media/platform/rcar-vin/rcar-vin.h |
| @@ -99,6 +99,8 @@ struct rvin_info { |
| * @notifier: V4L2 asynchronous subdevs notifier |
| * @digital: entity in the DT for local digital subdevice |
| * |
| + * @pad: media pad for the video device entity |
| + * |
| * @lock: protects @queue |
| * @queue: vb2 buffers queue |
| * @scratch: cpu address for scratch buffer |
| @@ -131,6 +133,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; |
| void *scratch; |
| -- |
| 2.19.0 |
| |