From patchwork Wed Feb 17 15:48:41 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulrich Hecht X-Patchwork-Id: 8340541 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: X-Original-To: patchwork-linux-renesas-soc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 13544C0553 for ; Wed, 17 Feb 2016 15:49:20 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5D012203B1 for ; Wed, 17 Feb 2016 15:49:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A1DD2203FB for ; Wed, 17 Feb 2016 15:49:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1161652AbcBQPtQ (ORCPT ); Wed, 17 Feb 2016 10:49:16 -0500 Received: from mail-wm0-f49.google.com ([74.125.82.49]:36803 "EHLO mail-wm0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1161621AbcBQPtP (ORCPT ); Wed, 17 Feb 2016 10:49:15 -0500 Received: by mail-wm0-f49.google.com with SMTP id g62so167060300wme.1; Wed, 17 Feb 2016 07:49:14 -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=9DuPsMHELiPQex3HbMSxj0Qqu169+u/M/XkVsv0fB+U=; b=UC5D1QdOU7y8d08GGA/OSRP/VMdG1UrJNYGE5H9R+V5N1x+5ZbXp+qiYeY0oXS16ya hbaFPGSQRZN697ir3hA3HFTrfrFNk3X0vAzdCgExMAFeYExDE1Cu3JzrcPgjAxGk2IBF ypqbhU30OCicAEnpeNMqWJPAndaA5dBx7r23hcTEQV7as91JD+zSJQ0SaM+JsfJ2rttF 2GRpvcqZHVkCP3zQ/7ahY26XF5kiCjPI7VH74eapwlgsxju6weVKTXopvWGnCoQl4DPI HYY11tIP2S9c2vjX+cTMPU1sz0bKTIOqsUk6+FiOlprebqtihAs2Ylc4BHjKtKlgI2i4 DU4A== 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=9DuPsMHELiPQex3HbMSxj0Qqu169+u/M/XkVsv0fB+U=; b=gt6/7sJdths/kkUcB/Fxxk2mHl2MP+GIkGZFih+6OjCUN6JP9IIxYovAyBe4Sf2HhQ NYobK3Eg5i7qplHUSRUNTJO50ar3K0qKC39yvtl6/uSjT4Y4olz5VgvA6bsrLSmNRMtx qvyrd1CaI3SLrmGLCbf77ThyAGdGYtKkQU+IdFzeXqK+nBsO0durA/rH3GhCb72vy1Gv eLiBKo4QgCrDcCzhZbXJw0xuFdEM27mH+phfXLLBeX9K419XMlyk5RQ6hxygNG5qDtPx JTGdmOcgVQmnA0qtil6omWPY6EuD618ZxtQz+SseDYoAqMby1YJvXG3a8BhRb0ytAgSs nvTg== X-Gm-Message-State: AG10YOSv7GxgdvDl4hfhEVSsKtot2J6nkWpIMcS7KJgZYEYbIvLz+VJxt7QQqyRxfgZ0Mg== X-Received: by 10.194.189.211 with SMTP id gk19mr2573864wjc.63.1455724153800; Wed, 17 Feb 2016 07:49:13 -0800 (PST) Received: from groucho.site (ip9234e209.dynamic.kabel-deutschland.de. [146.52.226.9]) by smtp.gmail.com with ESMTPSA id u4sm2136725wjz.4.2016.02.17.07.49.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 17 Feb 2016 07:49:12 -0800 (PST) From: Ulrich Hecht To: linux-renesas-soc@vger.kernel.org, niklas.soderlund@ragnatech.se Cc: linux-media@vger.kernel.org, magnus.damm@gmail.com, laurent.pinchart@ideasonboard.com, hans.verkuil@cisco.com, ian.molton@codethink.co.uk, lars@metafoo.de, william.towle@codethink.co.uk, Ulrich Hecht , Rob Taylor Subject: [PATCH/RFC 5/9] media: rcar-vin: pad-aware driver initialisation Date: Wed, 17 Feb 2016 16:48:41 +0100 Message-Id: <1455724125-13004-6-git-send-email-ulrich.hecht+renesas@gmail.com> X-Mailer: git-send-email 2.6.4 In-Reply-To: <1455724125-13004-1-git-send-email-ulrich.hecht+renesas@gmail.com> References: <1455724125-13004-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 | 15 +++++++++++++++ drivers/media/platform/rcar-vin/rcar-vin.h | 1 + 2 files changed, 16 insertions(+) diff --git a/drivers/media/platform/rcar-vin/rcar-dma.c b/drivers/media/platform/rcar-vin/rcar-dma.c index 70dc928..6b23c968 100644 --- a/drivers/media/platform/rcar-vin/rcar-dma.c +++ b/drivers/media/platform/rcar-vin/rcar-dma.c @@ -891,6 +891,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); @@ -924,6 +927,18 @@ int rvin_dma_on(struct rvin_dev *vin) /* TODO: ret = rvin_sensor_setup(vin, pix, ...); */ + 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 + vin->format.field = V4L2_FIELD_ANY; video_set_drvdata(&vin->vdev, vin); diff --git a/drivers/media/platform/rcar-vin/rcar-vin.h b/drivers/media/platform/rcar-vin/rcar-vin.h index 99141d7..f127f5d 100644 --- a/drivers/media/platform/rcar-vin/rcar-vin.h +++ b/drivers/media/platform/rcar-vin/rcar-vin.h @@ -106,6 +106,7 @@ struct rvin_dev { enum chip_id chip; struct v4l2_device v4l2_dev; + int src_pad_idx; /* For media-controller drivers */ struct v4l2_ctrl_handler ctrl_handler; struct video_device vdev;