From patchwork Wed Mar 2 17:16:33 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulrich Hecht X-Patchwork-Id: 8484081 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: X-Original-To: patchwork-linux-renesas-soc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 3DF379F2F0 for ; Wed, 2 Mar 2016 17:17:11 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8B1812015A for ; Wed, 2 Mar 2016 17:17:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CA82020383 for ; Wed, 2 Mar 2016 17:17:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754519AbcCBRRH (ORCPT ); Wed, 2 Mar 2016 12:17:07 -0500 Received: from mail-wm0-f67.google.com ([74.125.82.67]:34141 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753504AbcCBRRE (ORCPT ); Wed, 2 Mar 2016 12:17:04 -0500 Received: by mail-wm0-f67.google.com with SMTP id p65so10758474wmp.1; Wed, 02 Mar 2016 09:17:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=7ZovppeJkWdxfgviq708tlbr6nAKm7aHKDRpdPV63lI=; b=EuFvMEx2gzIzeKeAIOH57U5rCuCNdGddj8SxZ81in61U/SN79DAXHcreOkV4hkP2YL HaUCdGGafrjaECk66cCoJI9bQOct7L0Zl0ysRi79NTsRem/NS9HbOz9q3RqORXwDyBfh kOPuqfkdtGoZxjChNBjOezy2D/VC55JSQbfyT9A69aynYRKG33Li//timpLIz8NmffyV TReN2oQJjcOwjJBXLUhyItJAdUKCvV3JgbIUL+h8nFmKniMWaFsMgLvcBlkbUN2P3VH6 LKXdiPpTXNXdJ94wPkUTzYJmz48tkHp49M3t8fSE2WDSBFx7MRzoTv+GPcbOSrZIzHp8 s4Gw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=7ZovppeJkWdxfgviq708tlbr6nAKm7aHKDRpdPV63lI=; b=Zqzq19dLQmojAnDsvYML6Qxayw1ahUO4F+EG5nhfIdhDswQ4fqfMYOWaz9caX76RIM WMDmkVNKXpX1CU/5dIqEupf7FO+og97LgJ6kH0uncAfBZK+YufaFAUASWqH0s2CFRLtU zX0uIrr+L4RJNTlEzrhBgC3FIRaf4wkeBSY6LShHUsKNtttTK32WOe9bKisNSH8V/gqu hhdUv58fezHQzFJm9zeTpnHeoORb+FL1AUrLP+kQe0pDlEcHVtVtAi+UGbRc6Ylq1y2b 38jPWkZZZEmcNOi5mlFRuXcgEKljtvEMVM/KjktInzkBRLgCBL74ft/0FetAt85RfXkB Le5A== X-Gm-Message-State: AD7BkJKHb3gor+meDokSBHejEi00nKhiGVgtijsdJml2dSukOCN4aJQpWP3baYGga/dAtQ== X-Received: by 10.194.248.200 with SMTP id yo8mr27262412wjc.38.1456939023306; Wed, 02 Mar 2016 09:17:03 -0800 (PST) Received: from groucho.site (ip9234e209.dynamic.kabel-deutschland.de. [146.52.226.9]) by smtp.gmail.com with ESMTPSA id ka7sm36741410wjb.8.2016.03.02.09.17.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 02 Mar 2016 09:17:02 -0800 (PST) From: Ulrich Hecht To: linux-renesas-soc@vger.kernel.org, laurent.pinchart@ideasonboard.com, niklas.soderlund@ragnatech.se Cc: linux-media@vger.kernel.org, magnus.damm@gmail.com, hans.verkuil@cisco.com, ian.molton@codethink.co.uk, lars@metafoo.de, william.towle@codethink.co.uk, Ulrich Hecht , Rob Taylor Subject: [PATCH v2 5/9] media: rcar-vin: pad-aware driver initialisation Date: Wed, 2 Mar 2016 18:16:33 +0100 Message-Id: <1456938997-29971-6-git-send-email-ulrich.hecht+renesas@gmail.com> X-Mailer: git-send-email 2.6.4 In-Reply-To: <1456938997-29971-1-git-send-email-ulrich.hecht+renesas@gmail.com> References: <1456938997-29971-1-git-send-email-ulrich.hecht+renesas@gmail.com> Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add detection of source pad number for drivers aware of the media controller API, so that rcar-vin can create device nodes to support modern drivers such as adv7604.c (for HDMI on Lager) and the converted adv7180.c (for composite) underneath. Building rcar_vin gains a dependency on CONFIG_MEDIA_CONTROLLER, in line with requirements for building the drivers associated with it. Signed-off-by: William Towle Signed-off-by: Rob Taylor [uli: adapted to rcar-vin rewrite] Signed-off-by: Ulrich Hecht --- drivers/media/platform/rcar-vin/rcar-dma.c | 16 ++++++++++++++++ drivers/media/platform/rcar-vin/rcar-vin.h | 1 + 2 files changed, 17 insertions(+) diff --git a/drivers/media/platform/rcar-vin/rcar-dma.c b/drivers/media/platform/rcar-vin/rcar-dma.c index 15a67f7..3d957dc 100644 --- a/drivers/media/platform/rcar-vin/rcar-dma.c +++ b/drivers/media/platform/rcar-vin/rcar-dma.c @@ -1008,6 +1008,9 @@ int rvin_dma_on(struct rvin_dev *vin) .which = V4L2_SUBDEV_FORMAT_ACTIVE, }; struct v4l2_mbus_framefmt *mf = &fmt.format; +#if defined(CONFIG_MEDIA_CONTROLLER) + int pad_idx; +#endif int ret; sd = vin_to_sd(vin); @@ -1040,6 +1043,19 @@ int rvin_dma_on(struct rvin_dev *vin) return ret; } + vin->src_pad_idx = 0; +#if defined(CONFIG_MEDIA_CONTROLLER) + for (pad_idx = 0; pad_idx < sd->entity.num_pads; pad_idx++) + if (sd->entity.pads[pad_idx].flags + == MEDIA_PAD_FL_SOURCE) + break; + if (pad_idx >= sd->entity.num_pads) + goto remove_device; + + vin->src_pad_idx = pad_idx; +#endif + fmt.pad = vin->src_pad_idx; + vin->format.field = V4L2_FIELD_ANY; /* Try to improve our guess of a reasonable window format */ diff --git a/drivers/media/platform/rcar-vin/rcar-vin.h b/drivers/media/platform/rcar-vin/rcar-vin.h index f07cd7c..c6f6e44 100644 --- a/drivers/media/platform/rcar-vin/rcar-vin.h +++ b/drivers/media/platform/rcar-vin/rcar-vin.h @@ -121,6 +121,7 @@ struct rvin_dev { struct video_device vdev; struct v4l2_device v4l2_dev; + int src_pad_idx; /* For media-controller drivers */ struct v4l2_ctrl_handler ctrl_handler; struct v4l2_async_notifier notifier; struct rvin_graph_entity entity;