From patchwork Thu Mar 28 20:06:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 10875921 X-Patchwork-Delegate: kieran@bingham.xyz Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2002314DE for ; Thu, 28 Mar 2019 20:06:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0B50C28E34 for ; Thu, 28 Mar 2019 20:06:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F37D328F53; Thu, 28 Mar 2019 20:06: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=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, 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 9FB7D28F21 for ; Thu, 28 Mar 2019 20:06:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727018AbfC1UGa (ORCPT ); Thu, 28 Mar 2019 16:06:30 -0400 Received: from relay4-d.mail.gandi.net ([217.70.183.196]:33975 "EHLO relay4-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726257AbfC1UGa (ORCPT ); Thu, 28 Mar 2019 16:06:30 -0400 X-Originating-IP: 2.224.242.101 Received: from uno.lan (2-224-242-101.ip172.fastwebnet.it [2.224.242.101]) (Authenticated sender: jacopo@jmondi.org) by relay4-d.mail.gandi.net (Postfix) with ESMTPSA id 2110EE0015; Thu, 28 Mar 2019 20:06:26 +0000 (UTC) From: Jacopo Mondi To: sakari.ailus@linux.intel.com, laurent.pinchart@ideasonboard.com, niklas.soderlund+renesas@ragnatech.se Cc: Jacopo Mondi , luca@lucaceresoli.net, ian.arkver.dev@gmail.com, linux-media@vger.kernel.org, linux-renesas-soc@vger.kernel.org Subject: [PATCH v4 28/31] adv748x: afe: Implement has_route() Date: Thu, 28 Mar 2019 21:06:05 +0100 Message-Id: <20190328200608.9463-29-jacopo+renesas@jmondi.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190328200608.9463-1-jacopo+renesas@jmondi.org> References: <20190328200608.9463-1-jacopo+renesas@jmondi.org> MIME-Version: 1.0 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 Now that the adv748x subdevice supports internal routing, add an has_route() operation used during media graph traversal. Signed-off-by: Jacopo Mondi --- drivers/media/i2c/adv748x/adv748x-afe.c | 26 +++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/drivers/media/i2c/adv748x/adv748x-afe.c b/drivers/media/i2c/adv748x/adv748x-afe.c index 3f770f71413f..1ba78d45abd5 100644 --- a/drivers/media/i2c/adv748x/adv748x-afe.c +++ b/drivers/media/i2c/adv748x/adv748x-afe.c @@ -463,6 +463,30 @@ static const struct v4l2_subdev_ops adv748x_afe_ops = { .pad = &adv748x_afe_pad_ops, }; +/* ----------------------------------------------------------------------------- + * media_entity_operations + */ + +static bool adv748x_afe_has_route(struct media_entity *entity, + unsigned int pad0, unsigned int pad1) +{ + struct v4l2_subdev *sd = media_entity_to_v4l2_subdev(entity); + struct adv748x_afe *afe = adv748x_sd_to_afe(sd); + + /* Only consider direct sink->source routes. */ + if (pad0 > ADV748X_AFE_SINK_AIN7 || pad1 != ADV748X_AFE_SOURCE) + return false; + + if (pad0 != afe->input) + return false; + + return true; +} + +static const struct media_entity_operations adv748x_afe_entity_ops = { + .has_route = adv748x_afe_has_route, +}; + /* ----------------------------------------------------------------------------- * Controls */ @@ -595,6 +619,8 @@ int adv748x_afe_init(struct adv748x_afe *afe) afe->pads[ADV748X_AFE_SOURCE].flags = MEDIA_PAD_FL_SOURCE; + afe->sd.entity.ops = &adv748x_afe_entity_ops; + ret = media_entity_pads_init(&afe->sd.entity, ADV748X_AFE_NR_PADS, afe->pads); if (ret)