From patchwork Thu Apr 27 22:41:53 2017 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: 9703637 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 7466F60225 for ; Thu, 27 Apr 2017 22:43:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3848A2846F for ; Thu, 27 Apr 2017 22:43:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2D3C728649; Thu, 27 Apr 2017 22:43:31 +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 D5CC32846F for ; Thu, 27 Apr 2017 22:43:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1035051AbdD0Wn1 (ORCPT ); Thu, 27 Apr 2017 18:43:27 -0400 Received: from smtp-4.sys.kth.se ([130.237.48.193]:57417 "EHLO smtp-4.sys.kth.se" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1032505AbdD0Wm4 (ORCPT ); Thu, 27 Apr 2017 18:42:56 -0400 Received: from smtp-4.sys.kth.se (localhost.localdomain [127.0.0.1]) by smtp-4.sys.kth.se (Postfix) with ESMTP id 86E7A3324; Fri, 28 Apr 2017 00:42:54 +0200 (CEST) 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 wGKDEU6wL2AK; Fri, 28 Apr 2017 00:42:53 +0200 (CEST) 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 865DC3338; Fri, 28 Apr 2017 00:42:53 +0200 (CEST) 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?= , Kieran Bingham Subject: [PATCH v4 17/27] rcar-vin: prepare digital notifier for group notifier Date: Fri, 28 Apr 2017 00:41:53 +0200 Message-Id: <20170427224203.14611-18-niklas.soderlund+renesas@ragnatech.se> X-Mailer: git-send-email 2.12.2 In-Reply-To: <20170427224203.14611-1-niklas.soderlund+renesas@ragnatech.se> References: <20170427224203.14611-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 The media bus parsing functions used by the digital subdevice V4L2 notifier can be shared with the upcoming CSI-2 notifier. To prepare for this move and rename the function to reflect it's generic. Signed-off-by: Niklas Söderlund --- drivers/media/platform/rcar-vin/rcar-core.c | 70 +++++++++++++++-------------- 1 file changed, 37 insertions(+), 33 deletions(-) diff --git a/drivers/media/platform/rcar-vin/rcar-core.c b/drivers/media/platform/rcar-vin/rcar-core.c index ed99b1abb99e9ef9..adc38696a0ba70b9 100644 --- a/drivers/media/platform/rcar-vin/rcar-core.c +++ b/drivers/media/platform/rcar-vin/rcar-core.c @@ -45,6 +45,42 @@ static int rvin_find_pad(struct v4l2_subdev *sd, int direction) return -EINVAL; } +static int rvin_parse_v4l2(struct rvin_dev *vin, + struct device_node *ep, + struct v4l2_mbus_config *mbus_cfg) +{ + struct v4l2_of_endpoint v4l2_ep; + int ret; + + ret = v4l2_of_parse_endpoint(ep, &v4l2_ep); + if (ret) { + vin_err(vin, "Could not parse v4l2 endpoint\n"); + return -EINVAL; + } + + mbus_cfg->type = v4l2_ep.bus_type; + + switch (mbus_cfg->type) { + case V4L2_MBUS_PARALLEL: + vin_dbg(vin, "Found PARALLEL media bus\n"); + mbus_cfg->flags = v4l2_ep.bus.parallel.flags; + break; + case V4L2_MBUS_BT656: + vin_dbg(vin, "Found BT656 media bus\n"); + mbus_cfg->flags = 0; + break; + default: + vin_err(vin, "Unknown media bus type\n"); + return -EINVAL; + } + + return 0; +} + +/* ----------------------------------------------------------------------------- + * Digital async notifier + */ + static bool rvin_mbus_supported(struct rvin_dev *vin) { struct v4l2_subdev *sd = vin->digital.subdev; @@ -145,38 +181,6 @@ static int rvin_digital_notify_bound(struct v4l2_async_notifier *notifier, return -EINVAL; } -static int rvin_digitial_parse_v4l2(struct rvin_dev *vin, - struct device_node *ep, - struct v4l2_mbus_config *mbus_cfg) -{ - struct v4l2_of_endpoint v4l2_ep; - int ret; - - ret = v4l2_of_parse_endpoint(ep, &v4l2_ep); - if (ret) { - vin_err(vin, "Could not parse v4l2 endpoint\n"); - return -EINVAL; - } - - mbus_cfg->type = v4l2_ep.bus_type; - - switch (mbus_cfg->type) { - case V4L2_MBUS_PARALLEL: - vin_dbg(vin, "Found PARALLEL media bus\n"); - mbus_cfg->flags = v4l2_ep.bus.parallel.flags; - break; - case V4L2_MBUS_BT656: - vin_dbg(vin, "Found BT656 media bus\n"); - mbus_cfg->flags = 0; - break; - default: - vin_err(vin, "Unknown media bus type\n"); - return -EINVAL; - } - - return 0; -} - static int rvin_digital_graph_parse(struct rvin_dev *vin) { struct device_node *ep, *np; @@ -201,7 +205,7 @@ static int rvin_digital_graph_parse(struct rvin_dev *vin) } of_node_put(np); - ret = rvin_digitial_parse_v4l2(vin, ep, &vin->mbus_cfg); + ret = rvin_parse_v4l2(vin, ep, &vin->mbus_cfg); of_node_put(ep); if (ret) return ret;