From patchwork Tue Feb 21 15:49:30 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 9584961 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 5F493600C1 for ; Tue, 21 Feb 2017 15:54:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4BDFF28304 for ; Tue, 21 Feb 2017 15:54:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 409E128613; Tue, 21 Feb 2017 15:54: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 BA29528304 for ; Tue, 21 Feb 2017 15:54: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=pruJIZgP2AHmR2ZCKFkNjvwPKn //NDoOLD1jW6T24Xac8IeTwNOM1ci2FxlUw/kNvS0DYq1wi+li58+vTppQiJnBwhXfMeyfFB8FwGT GJJao5nAB94MJMfMFWHkLDX7bmJkzMgx37r7ulMtX1WcpsXMAhYXVEXGaBCdUFOqcg6jLNr/EmTM3 YlqCWd2leDO+R3xRDheCXwyVCGUOo/sPqLhhT8Ivd/sq6AQ45FXCn33SaKddhpIenvUtA2cBKWQbm mOezoLhIYjJm+B/omegn8F1OvkYprL/JJuvcbiKUcGKiTCBjWO0LEe+Ox8sqK1U6g+soZBL5ofxtn HRcfclBA==; 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 1cgClY-0002Ni-AH; Tue, 21 Feb 2017 15:54:12 +0000 Received: from mail-wm0-x22a.google.com ([2a00:1450:400c:c09::22a]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cgChv-00089M-MO for linux-arm-kernel@lists.infradead.org; Tue, 21 Feb 2017 15:50:39 +0000 Received: by mail-wm0-x22a.google.com with SMTP id r141so79129179wmg.1 for ; Tue, 21 Feb 2017 07:50:07 -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=uqhvjistQAS5yJXJtakE4R75B/UZoSvwR3cezIBnkLzr+wZ0uFVpDZCZoZ/nKwpbCr EMmJgHTTQ6vvmy9NZmv9G9wWZ0/7b1eRPKk14/TxTvUXt1ln15MvD5u/DgYmF+lUdvfy 2pKXpm3IGLCUBj4T7ozSdRlH6+JichBJnJphpEGQMlwytRqmgPtIyWNnizk1/uRshsTe u0h8NwhUu37Xl5dQB/Fu4El5zq5at4GLhX7d0BDBFacYXH98+esjiWtWo4fiO5daNzG3 leRzvgRtRLe2zRQiNQAmdH8IUizUp3JRuyWggjHKA2OpU9MjKhtXzudK92seklt235FM SSKQ== 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=WL9mW1hKuYBVReqMvKQpFikEvYOHqpZkEikhoLSz32+mbPRqEjruVO60IYU1cPkNDy BY6BYel21zLBuCy/hcBmm/gRINaELhhVvXkN8cPWdPCUG43yRrD5WlpZ3YAsFvhM2WFV Fm58kBDvccnx4L2uozN5Va/qVPYNrvwv9UOBxNzDvtAbuYRvpIVs0bohapZtqGiT7h7l jkntM/ylQnN/qiVD1hFjL780GPg+wzONZRiZ5aE0eZZEYizhJS3Onpz0OAgilfBFOrEx Ax4+BGehe0bIi9FEGsXSDpkGXtpNWx2GgMB+HQOhoFar4JSbRGT1n1qoapH7ptU7Ylvg KpPw== X-Gm-Message-State: AMke39nYwnkPTcQvBN4tHR5z2bILPPku1jUVP45+xaR3M/K5gXoiEjw5qmIgPYKsXR73T0RT X-Received: by 10.28.134.76 with SMTP id i73mr26348673wmd.51.1487692205905; Tue, 21 Feb 2017 07:50:05 -0800 (PST) Received: from localhost.localdomain ([90.63.244.31]) by smtp.gmail.com with ESMTPSA id 8sm19246179wmg.1.2017.02.21.07.50.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 21 Feb 2017 07:50:05 -0800 (PST) From: Bartosz Golaszewski To: Sekhar Nori , David Lechner , Kevin Hilman , Michael Turquette , Patrick Titiano , Laurent Pinchart , Russell King Subject: [PATCH v2 3/5] ARM: davinci: da8xx: add pdata-quirks for VPIF capture Date: Tue, 21 Feb 2017 16:49:30 +0100 Message-Id: <1487692172-11772-4-git-send-email-bgolaszewski@baylibre.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1487692172-11772-1-git-send-email-bgolaszewski@baylibre.com> References: <1487692172-11772-1-git-send-email-bgolaszewski@baylibre.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170221_075028_532691_8FFE84BF X-CRM114-Status: GOOD ( 14.93 ) 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 */ }, };