From patchwork Mon Jun 19 17:04:49 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 9796963 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 6E5FB6020B for ; Mon, 19 Jun 2017 17:05:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 516C81FF20 for ; Mon, 19 Jun 2017 17:05:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4632026E97; Mon, 19 Jun 2017 17:05:42 +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 E8A9E1FF20 for ; Mon, 19 Jun 2017 17:05:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751082AbdFSRFl (ORCPT ); Mon, 19 Jun 2017 13:05:41 -0400 Received: from relay4-d.mail.gandi.net ([217.70.183.196]:42781 "EHLO relay4-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750863AbdFSRFk (ORCPT ); Mon, 19 Jun 2017 13:05:40 -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 C326C1720FD; Mon, 19 Jun 2017 19:05:38 +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 12/12] media: rcar: vin: Link digital subdev to VIN instance Date: Mon, 19 Jun 2017 19:04:49 +0200 Message-Id: <1497891889-8038-13-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 Link digital subdevice to the current VIN instance if the instance support it and we are currently using media controller API. Signed-off-by: Jacopo Mondi --- drivers/media/platform/rcar-vin/rcar-core.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/rcar-vin/rcar-core.c b/drivers/media/platform/rcar-vin/rcar-core.c index 67494ee..503c905 100644 --- a/drivers/media/platform/rcar-vin/rcar-core.c +++ b/drivers/media/platform/rcar-vin/rcar-core.c @@ -26,6 +26,12 @@ #include "rcar-vin.h" +static int rvin_group_add_link(struct rvin_dev *vin, + struct media_entity *source, + unsigned int source_idx, + struct media_entity *sink, + unsigned int sink_idx, + u32 flags); /* ----------------------------------------------------------------------------- * Media Controller link notification */ @@ -418,6 +424,7 @@ static int rvin_digital_notify_complete(struct v4l2_async_notifier *notifier) { struct rvin_dev *vin = notifier_to_vin(notifier); struct v4l2_subdev *sd = vin_to_source(vin); + struct media_entity *source, *sink; int ret; /* Verify subdevices mbus format */ @@ -464,7 +471,20 @@ static int rvin_digital_notify_complete(struct v4l2_async_notifier *notifier) v4l2_disable_ioctl(&vin->vdev, VIDIOC_ENUMSTD); } - return rvin_reset_format(vin); + ret = rvin_reset_format(vin); + if (ret) + return ret; + + /* Link the digital subdev with the VIN instance, if supported */ + if (vin->info->use_mc && (vin->info->din_mask & BIT(vin->id))) { + source = &vin->digital.subdev->entity; + sink = &vin->group->vin[vin->id]->vdev.entity; + + ret = rvin_group_add_link(vin, source, 0, sink, 0, + MEDIA_LNK_FL_ENABLED); + } + + return ret; } static void rvin_digital_notify_unbind(struct v4l2_async_notifier *notifier,