From patchwork Mon Jun 19 17:04:42 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 9796945 X-Patchwork-Delegate: geert@linux-m68k.org 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 6B5EF6020B for ; Mon, 19 Jun 2017 17:05:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 508E41FE5F for ; Mon, 19 Jun 2017 17:05:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4583A26256; Mon, 19 Jun 2017 17:05:37 +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 18A0E1FE5F for ; Mon, 19 Jun 2017 17:05:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752662AbdFSRFe (ORCPT ); Mon, 19 Jun 2017 13:05:34 -0400 Received: from relay4-d.mail.gandi.net ([217.70.183.196]:37466 "EHLO relay4-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752088AbdFSRFc (ORCPT ); Mon, 19 Jun 2017 13:05:32 -0400 Received: from w540.lan (unknown [IPv6:2001:b07:6442:1ac4:44f0:b1d4:5e6a:3ac1]) (Authenticated sender: jacopo@jmondi.org) by relay4-d.mail.gandi.net (Postfix) with ESMTPSA id B6D231720E7; Mon, 19 Jun 2017 19:05:30 +0200 (CEST) From: Jacopo Mondi To: laurent.pinchart@ideasonboard.com, niklas.soderlund@ragnatech.se Cc: Jacopo Mondi , linux-renesas-soc@vger.kernel.org Subject: [PATCH v1 05/12] media: rcar: vin: Prepare to parse Gen3 digital input Date: Mon, 19 Jun 2017 19:04:42 +0200 Message-Id: <1497891889-8038-6-git-send-email-jacopo+renesas@jmondi.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1497891889-8038-1-git-send-email-jacopo+renesas@jmondi.org> References: <1497891889-8038-1-git-send-email-jacopo+renesas@jmondi.org> Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Support parsing digital input on configurable port id and reg properties. Also make the function return -ENOENT when no subdevice is found. This change is needed to support parsing digital input on Gen3. Signed-off-by: Jacopo Mondi --- drivers/media/platform/rcar-vin/rcar-core.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/drivers/media/platform/rcar-vin/rcar-core.c b/drivers/media/platform/rcar-vin/rcar-core.c index 175f138..ef61bcc 100644 --- a/drivers/media/platform/rcar-vin/rcar-core.c +++ b/drivers/media/platform/rcar-vin/rcar-core.c @@ -511,7 +511,9 @@ static int rvin_digital_notify_bound(struct v4l2_async_notifier *notifier, return 0; } -static int rvin_digital_graph_parse(struct rvin_dev *vin) +static int rvin_digital_graph_parse(struct rvin_dev *vin, + unsigned int port, + unsigned int reg) { struct device_node *ep, *np; int ret; @@ -519,13 +521,9 @@ static int rvin_digital_graph_parse(struct rvin_dev *vin) vin->digital.asd.match.fwnode.fwnode = NULL; vin->digital.subdev = NULL; - /* - * Port 0 id 0 is local digital input, try to get it. - * Not all instances can or will have this, that is OK - */ - ep = of_graph_get_endpoint_by_regs(vin->dev->of_node, 0, 0); + ep = of_graph_get_endpoint_by_regs(vin->dev->of_node, port, reg); if (!ep) - return 0; + return -ENOENT; np = of_graph_get_remote_port_parent(ep); if (!np) { @@ -555,11 +553,15 @@ static int rvin_digital_graph_init(struct rvin_dev *vin) if (ret) return ret; - ret = rvin_digital_graph_parse(vin); - if (ret) + /* + * Port 0 id 0 is local digital input, try to get it. + * Not all instances can or will have this, that is OK + */ + ret = rvin_digital_graph_parse(vin, 0, 0); + if (ret && ret != -ENOENT) return ret; - if (!vin->digital.asd.match.fwnode.fwnode) { + if (ret == -ENOENT) { vin_dbg(vin, "No digital subdevice found\n"); return -ENODEV; }