From patchwork Wed Feb 22 14:13:22 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 9586901 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 0AE58602A7 for ; Wed, 22 Feb 2017 14:15:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0686A286A1 for ; Wed, 22 Feb 2017 14:15:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EF242286AB; Wed, 22 Feb 2017 14:15:23 +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=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 456AF286A1 for ; Wed, 22 Feb 2017 14:15:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=6N3DCu4ov4Jme7D3JitfXGfsPvylepjCaVRN6pRS1Z8=; b=ZKpZa0MLXrn6wjYU4gOVCDAy93 9Tnz4Ab5wHYq6QpiE1tdqQjM7/nildx9hZjdmFl0xrcd6rDpu6je7dT1+wm/9AQe36H7iaMOG0ePx LtrGz4RMG7a5/zmH3erwUrnv9yGeOMbHOyBivMpHABAyK/wOdtE0L6gwSfKBTdxkvser/OHSllJnk w99tuIkgQrQW4owq/wv3xpvxCW7PCPupjZBADqcx9po5ZJUJoGlYunrxgRqO0QMRMlBsfk/GXSyK9 vUvt5ccc0IQTw2VLaL4CTIsPaceo4hgsUMGqbUd7zQYs0e3HaWcLrQ6J6pr02hBQSFehsAx+ZRhJt FSENZiiA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cgXhQ-00035I-Q0; Wed, 22 Feb 2017 14:15:20 +0000 Received: from mail-wm0-x233.google.com ([2a00:1450:400c:c09::233]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cgXg6-0000pO-Pj for linux-arm-kernel@lists.infradead.org; Wed, 22 Feb 2017 14:14:00 +0000 Received: by mail-wm0-x233.google.com with SMTP id r141so2890525wmg.1 for ; Wed, 22 Feb 2017 06:13:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=DXoZ3eyG8dU4TQG4LRf/CyyAM6c2FsE+ptfgseG4WyE=; b=ablb0Pf9SKd4IY2dvMxxD8/LHuzmEn6g2MuN3Hkjj5WcuhODFirKMwkUJ5DIIdZCN1 95aaFndyqqi1wTG8LGlxVuLXsZRp9tUK3kaGWa1xG0SKJgrcO8fSzTFa1zwvVvGUKSUw n2dqeZF4Dje1GSmczBTiAGPHWD7DgihunSlLcKtad+Q0cOjS9YKVNFfwdB7pesoIo50m ujCCHVCJOuOcnRUwn8wXNcvm8wSFxHgtFWJt7kbebDMHi3Es9HT++Ozb/SMk95Rc3czy NYXIopRYEzhKuq3GUqE0iylPUTYlmcDmtaxPvmhGGUlV+ezNw0sNUlJlS+Bf7Ip4tgoy l3KA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=DXoZ3eyG8dU4TQG4LRf/CyyAM6c2FsE+ptfgseG4WyE=; b=nJyhpi530v1GOvlBLOS34i5k+Yyxuh3M+zhPjykxJ8Oci8n/iyLsYp9fgEENyj1IaR M3mISelFxOPNxCmNkJclzQOq6PqIbxS1bceFQTAClEth+aKGPSPRj7qmO69Xmx7Y0Bx3 43ZRycQ6yuxT/mHCziHJBxjHtSF+sCpJV4EZWbw3Vwx9HiL+fTr8dc1IvXbHbFH+OkmV Ou1VWNr4aYpni0e7CoOhQ+7dFZH1Ul3jhWl3+bjatC3vR1LSrJb56Tro6aPqekXUAaAq 9T4+P6ou6KfPtneXH2IGG3rRzUFt8MoECFRO1RpgUwuhuK0BCSxmcdtS+KuKNabJo2wi ONTw== X-Gm-Message-State: AMke39nUwZY4kL9SBbP04qoUg7NcxVQKtkweJi9Rec5DJjqdvKuQytrd6Sc7T6xWk3FWUGHY X-Received: by 10.28.238.140 with SMTP id j12mr2634255wmi.35.1487772816745; Wed, 22 Feb 2017 06:13:36 -0800 (PST) Received: from localhost.localdomain ([90.63.244.31]) by smtp.gmail.com with ESMTPSA id f50sm1889573wrf.69.2017.02.22.06.13.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 22 Feb 2017 06:13:36 -0800 (PST) From: Bartosz Golaszewski To: Sekhar Nori , David Lechner , Kevin Hilman , Michael Turquette , Patrick Titiano , Laurent Pinchart , Russell King Subject: [PATCH v3 3/6] ARM: davinci: da8xx: add pdata-quirks for VPIF capture Date: Wed, 22 Feb 2017 15:13:22 +0100 Message-Id: <1487772805-19021-4-git-send-email-bgolaszewski@baylibre.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1487772805-19021-1-git-send-email-bgolaszewski@baylibre.com> References: <1487772805-19021-1-git-send-email-bgolaszewski@baylibre.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170222_061359_089289_52B4CE6B X-CRM114-Status: GOOD ( 14.61 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Bartosz Golaszewski , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Kevin Hilman For da8xx DT platforms, use pdata-quirks to add legacy platform data for vpif_capture driver. Passing legacy platform_data is required until the V4L2 framework, and subdevice drivers (such as the tvp514x) grow a way of selecting input and output routing (c.f. V4L2 s_routing API) Signed-off-by: Kevin Hilman [Bartosz: removed unnecessary #ifdefs] Signed-off-by: Bartosz Golaszewski --- arch/arm/mach-davinci/da8xx-dt.c | 1 + arch/arm/mach-davinci/pdata-quirks.c | 104 +++++++++++++++++++++++++++++++++++ 2 files changed, 105 insertions(+) diff --git a/arch/arm/mach-davinci/da8xx-dt.c b/arch/arm/mach-davinci/da8xx-dt.c index e3cef50..5699ce3 100644 --- a/arch/arm/mach-davinci/da8xx-dt.c +++ b/arch/arm/mach-davinci/da8xx-dt.c @@ -53,6 +53,7 @@ static struct of_dev_auxdata da850_auxdata_lookup[] __initdata = { OF_DEV_AUXDATA("ti,da830-musb", 0x01e00000, "musb-da8xx", NULL), OF_DEV_AUXDATA("ti,da830-usb-phy", 0x01c1417c, "da8xx-usb-phy", NULL), OF_DEV_AUXDATA("ti,da850-ahci", 0x01e18000, "ahci_da850", NULL), + OF_DEV_AUXDATA("ti,da850-vpif", 0x01e17000, "vpif", NULL), {} }; diff --git a/arch/arm/mach-davinci/pdata-quirks.c b/arch/arm/mach-davinci/pdata-quirks.c index 36fb217..cf88195 100644 --- a/arch/arm/mach-davinci/pdata-quirks.c +++ b/arch/arm/mach-davinci/pdata-quirks.c @@ -10,13 +10,115 @@ #include #include +#include + #include +#include struct pdata_init { const char *compatible; void (*fn)(void); }; +#define TVP5147_CH0 "tvp514x-0" +#define TVP5147_CH1 "tvp514x-1" + +/* VPIF capture configuration */ +static struct tvp514x_platform_data tvp5146_pdata = { + .clk_polarity = 0, + .hs_polarity = 1, + .vs_polarity = 1, +}; + +#define TVP514X_STD_ALL (V4L2_STD_NTSC | V4L2_STD_PAL) + +static const struct vpif_input da850_ch0_inputs[] = { + { + .input = { + .index = 0, + .name = "Composite", + .type = V4L2_INPUT_TYPE_CAMERA, + .capabilities = V4L2_IN_CAP_STD, + .std = TVP514X_STD_ALL, + }, + .input_route = INPUT_CVBS_VI2B, + .output_route = OUTPUT_10BIT_422_EMBEDDED_SYNC, + .subdev_name = TVP5147_CH0, + }, +}; + +static const struct vpif_input da850_ch1_inputs[] = { + { + .input = { + .index = 0, + .name = "S-Video", + .type = V4L2_INPUT_TYPE_CAMERA, + .capabilities = V4L2_IN_CAP_STD, + .std = TVP514X_STD_ALL, + }, + .input_route = INPUT_SVIDEO_VI2C_VI1C, + .output_route = OUTPUT_10BIT_422_EMBEDDED_SYNC, + .subdev_name = TVP5147_CH1, + }, +}; + +static struct vpif_subdev_info da850_vpif_capture_sdev_info[] = { + { + .name = TVP5147_CH0, + .board_info = { + I2C_BOARD_INFO("tvp5146", 0x5d), + .platform_data = &tvp5146_pdata, + }, + }, + { + .name = TVP5147_CH1, + .board_info = { + I2C_BOARD_INFO("tvp5146", 0x5c), + .platform_data = &tvp5146_pdata, + }, + }, +}; + +static struct vpif_capture_config da850_vpif_capture_config = { + .subdev_info = da850_vpif_capture_sdev_info, + .subdev_count = ARRAY_SIZE(da850_vpif_capture_sdev_info), + .chan_config[0] = { + .inputs = da850_ch0_inputs, + .input_count = ARRAY_SIZE(da850_ch0_inputs), + .vpif_if = { + .if_type = VPIF_IF_BT656, + .hd_pol = 1, + .vd_pol = 1, + .fid_pol = 0, + }, + }, + .chan_config[1] = { + .inputs = da850_ch1_inputs, + .input_count = ARRAY_SIZE(da850_ch1_inputs), + .vpif_if = { + .if_type = VPIF_IF_BT656, + .hd_pol = 1, + .vd_pol = 1, + .fid_pol = 0, + }, + }, + .card_name = "DA850/OMAP-L138 Video Capture", +}; + +static void __init da850_vpif_legacy_init(void) +{ + int ret; + + /* LCDK doesn't have the 2nd TVP514x on CH1 */ + if (of_machine_is_compatible("ti,da850-lcdk")) + da850_vpif_capture_config.subdev_count = 1; + + ret = da850_register_vpif_capture(&da850_vpif_capture_config); + if (ret) + pr_warn("%s: VPIF capture setup failed: %d\n", + __func__, ret); +} + static void pdata_quirks_check(struct pdata_init *quirks) { while (quirks->compatible) { @@ -29,6 +131,8 @@ static void pdata_quirks_check(struct pdata_init *quirks) } static struct pdata_init pdata_quirks[] __initdata = { + { "ti,da850-lcdk", da850_vpif_legacy_init, }, + { "ti,da850-evm", da850_vpif_legacy_init, }, { /* sentinel */ }, };