From patchwork Sat Nov 12 13:12:10 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: 9424133 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 C878B60720 for ; Sat, 12 Nov 2016 13:14:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BE2CF296F1 for ; Sat, 12 Nov 2016 13:14:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B33E7298C0; Sat, 12 Nov 2016 13:14:00 +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=ham 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 67AB6296E2 for ; Sat, 12 Nov 2016 13:14:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966149AbcKLNN5 (ORCPT ); Sat, 12 Nov 2016 08:13:57 -0500 Received: from smtp-4.sys.kth.se ([130.237.48.193]:33624 "EHLO smtp-4.sys.kth.se" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966096AbcKLNNy (ORCPT ); Sat, 12 Nov 2016 08:13:54 -0500 Received: from smtp-4.sys.kth.se (localhost.localdomain [127.0.0.1]) by smtp-4.sys.kth.se (Postfix) with ESMTP id 7419632AE; Sat, 12 Nov 2016 14:13:51 +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 T31736n4Wwmx; Sat, 12 Nov 2016 14:13:50 +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 89AAB32C7; Sat, 12 Nov 2016 14:13:49 +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 , Geert Uytterhoeven , =?UTF-8?q?Niklas=20S=C3=B6derlund?= Subject: [PATCHv2 26/32] media: rcar-vin: add helpers for bridge Date: Sat, 12 Nov 2016 14:12:10 +0100 Message-Id: <20161112131216.22635-27-niklas.soderlund+renesas@ragnatech.se> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20161112131216.22635-1-niklas.soderlund+renesas@ragnatech.se> References: <20161112131216.22635-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 On Gen3 there might be a CSI2 bridge between the video source and the VIN. Add helpers to check for this and to fetch the bridge subdevice. Signed-off-by: Niklas Söderlund --- drivers/media/platform/rcar-vin/rcar-core.c | 19 +++++++++++++++++++ drivers/media/platform/rcar-vin/rcar-vin.h | 2 ++ 2 files changed, 21 insertions(+) diff --git a/drivers/media/platform/rcar-vin/rcar-core.c b/drivers/media/platform/rcar-vin/rcar-core.c index 0b3882a..1efbb0a 100644 --- a/drivers/media/platform/rcar-vin/rcar-core.c +++ b/drivers/media/platform/rcar-vin/rcar-core.c @@ -373,6 +373,11 @@ static int rvin_group_vin_to_csi(struct rvin_dev *vin) return csi; } +bool vin_have_bridge(struct rvin_dev *vin) +{ + return vin->digital.subdev == NULL; +} + struct rvin_graph_entity *vin_to_entity(struct rvin_dev *vin) { int csi; @@ -403,6 +408,20 @@ struct v4l2_subdev *vin_to_source(struct rvin_dev *vin) return vin->group->source[csi].subdev; } +struct v4l2_subdev *vin_to_bridge(struct rvin_dev *vin) +{ + int csi; + + if (vin->digital.subdev) + return NULL; + + csi = rvin_group_vin_to_csi(vin); + if (csi < 0) + return NULL; + + return vin->group->bridge[csi].subdev; +} + /* ----------------------------------------------------------------------------- * Async notifier helpers */ diff --git a/drivers/media/platform/rcar-vin/rcar-vin.h b/drivers/media/platform/rcar-vin/rcar-vin.h index 2f1e087..acaed2b 100644 --- a/drivers/media/platform/rcar-vin/rcar-vin.h +++ b/drivers/media/platform/rcar-vin/rcar-vin.h @@ -206,8 +206,10 @@ struct rvin_dev { struct v4l2_rect compose; }; +bool vin_have_bridge(struct rvin_dev *vin); struct rvin_graph_entity *vin_to_entity(struct rvin_dev *vin); struct v4l2_subdev *vin_to_source(struct rvin_dev *vin); +struct v4l2_subdev *vin_to_bridge(struct rvin_dev *vin); /* Debug */ #define vin_dbg(d, fmt, arg...) dev_dbg(d->dev, fmt, ##arg)