From patchwork Wed Nov 2 13:23:17 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Niklas_S=C3=B6derlund?= X-Patchwork-Id: 9409159 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 1E51860723 for ; Wed, 2 Nov 2016 13:30:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0BF882A17C for ; Wed, 2 Nov 2016 13:30:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 00B532A17E; Wed, 2 Nov 2016 13:30:30 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 313652A17D for ; Wed, 2 Nov 2016 13:30:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754692AbcKBNaN (ORCPT ); Wed, 2 Nov 2016 09:30:13 -0400 Received: from smtp-4.sys.kth.se ([130.237.48.193]:49578 "EHLO smtp-4.sys.kth.se" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754524AbcKBN3o (ORCPT ); Wed, 2 Nov 2016 09:29:44 -0400 Received: from smtp-4.sys.kth.se (localhost.localdomain [127.0.0.1]) by smtp-4.sys.kth.se (Postfix) with ESMTP id 3F804329A; Wed, 2 Nov 2016 14:29:43 +0100 (CET) X-Virus-Scanned: by amavisd-new at kth.se Received: from smtp-4.sys.kth.se ([127.0.0.1]) by smtp-4.sys.kth.se (smtp-4.sys.kth.se [127.0.0.1]) (amavisd-new, port 10024) with LMTP id cQhXjy3aCb1x; Wed, 2 Nov 2016 14:29:42 +0100 (CET) X-KTH-Auth: niso [89.233.230.99] X-KTH-mail-from: niklas.soderlund+renesas@ragnatech.se Received: from bismarck.berto.se (unknown [89.233.230.99]) by smtp-4.sys.kth.se (Postfix) with ESMTPSA id 296E03209; Wed, 2 Nov 2016 14:29:42 +0100 (CET) From: =?UTF-8?q?Niklas=20S=C3=B6derlund?= To: Laurent Pinchart , Hans Verkuil Cc: linux-media@vger.kernel.org, linux-renesas-soc@vger.kernel.org, tomoharu.fukawa.eb@renesas.com, Sakari Ailus , =?UTF-8?q?Niklas=20S=C3=B6derlund?= Subject: [PATCH 20/32] media: rcar-vin: expose a sink pad if we are on Gen3 Date: Wed, 2 Nov 2016 14:23:17 +0100 Message-Id: <20161102132329.436-21-niklas.soderlund+renesas@ragnatech.se> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20161102132329.436-1-niklas.soderlund+renesas@ragnatech.se> References: <20161102132329.436-1-niklas.soderlund+renesas@ragnatech.se> MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Refactor the probe code path to look for the digital subdevice, if one is found use it just like the driver did before (Gen2 mode) but if it's not found prepare for a Gen3 mode by registering a pad for the media controller API to use. Signed-off-by: Niklas Söderlund --- drivers/media/platform/rcar-vin/rcar-core.c | 21 ++++++++++++++++++++- drivers/media/platform/rcar-vin/rcar-vin.h | 9 +++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/rcar-vin/rcar-core.c b/drivers/media/platform/rcar-vin/rcar-core.c index f961957..ce8b59a 100644 --- a/drivers/media/platform/rcar-vin/rcar-core.c +++ b/drivers/media/platform/rcar-vin/rcar-core.c @@ -308,6 +308,25 @@ static const struct of_device_id rvin_of_id_table[] = { }; MODULE_DEVICE_TABLE(of, rvin_of_id_table); +static int rvin_graph_init(struct rvin_dev *vin) +{ + int ret; + + /* Try to get digital video pipe */ + ret = rvin_digital_graph_init(vin); + + /* No digital pipe and we are on Gen3 try to joint CSI2 group */ + if (ret == -ENODEV && vin->info->chip == RCAR_GEN3) { + + vin->pads[RVIN_SINK].flags = MEDIA_PAD_FL_SINK; + ret = media_entity_pads_init(&vin->vdev.entity, 1, vin->pads); + if (ret) + return ret; + } + + return ret; +} + static int rcar_vin_probe(struct platform_device *pdev) { const struct of_device_id *match; @@ -343,7 +362,7 @@ static int rcar_vin_probe(struct platform_device *pdev) if (ret) return ret; - ret = rvin_digital_graph_init(vin); + ret = rvin_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 a6a49a96..8ed43be 100644 --- a/drivers/media/platform/rcar-vin/rcar-vin.h +++ b/drivers/media/platform/rcar-vin/rcar-vin.h @@ -36,6 +36,11 @@ enum chip_id { RCAR_GEN3, }; +enum rvin_pads { + RVIN_SINK, + RVIN_PAD_MAX, +}; + /** * STOPPED - No operation in progress * RUNNING - Operation in progress have buffers @@ -115,6 +120,8 @@ struct rvin_info { * @notifier: V4L2 asynchronous subdevs notifier * @digital: entity in the DT for local digital subdevice * + * @pads: pads for media controller + * * @lock: protects @queue * @queue: vb2 buffers queue * @@ -144,6 +151,8 @@ struct rvin_dev { struct v4l2_async_notifier notifier; struct rvin_graph_entity digital; + struct media_pad pads[RVIN_PAD_MAX]; + struct mutex lock; struct vb2_queue queue;