From patchwork Tue Feb 28 16:01:58 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 9596149 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 2059460453 for ; Tue, 28 Feb 2017 16:17:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0FE32284A5 for ; Tue, 28 Feb 2017 16:17:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 01930284EF; Tue, 28 Feb 2017 16:17:50 +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=ham 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 2AF67284A5 for ; Tue, 28 Feb 2017 16:17:49 +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=cRu5UlClWTanHF0st4N8Jz0LX3hu8ePq8yVxKwQk6Cs=; b=ngPYqwK5WlUTjb9qO34SsLhGYn 7jRYhK6875rm8RKXwidi5Osi31qpFOwbIST33zybHItQFyweU1nsNLLjkBOM2nkINBna23zrG6LI1 D5ku6bDZWt8DoGMVK9LSgeEtAofZB5A6u20cQimjKX16o6OjWOKgatAoUPhHb7PxnQgYwgIbd701p XBRhx2saPWEg6gs3OkkrCgiGPxSlxXNpWUjwqB8Yro1zJ1IhfPBKkVoBd/QzHwgISG7osPIlQqH67 VQrxF+Kpr6lfFcl917Wdr5N4VCXaeKfkQMRZG3VGrvGCsYK4dIns1t2GlmqnO6324T+iqwB3TtKe4 SgYJVZnQ==; 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 1cikTD-0005bv-OJ; Tue, 28 Feb 2017 16:17:47 +0000 Received: from mail-wm0-x234.google.com ([2a00:1450:400c:c09::234]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cikER-0004Fj-Je for linux-arm-kernel@lists.infradead.org; Tue, 28 Feb 2017 16:02:36 +0000 Received: by mail-wm0-x234.google.com with SMTP id v77so88746541wmv.1 for ; Tue, 28 Feb 2017 08:02:11 -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=i5V9WyqhvrJvKj2IxLHL3NBxMNO/PLt1gAf4PF06DIg=; b=wIRy1gNixNQwd6gEZZoaTO66JrpEIsnQ3nz16NWDsoLK+K7mLIgy2WDNTi4J6cyWHC 8cXMW67qoD3Zw7E6U4YfAFBx2VeKGC80c07+mKilBQ/I1TQ7MoPDYCf7Txs+GBquZJ8d +KLUYhHnPQSmlrVrTcjYY350Qo1BCArzZkngs/BDBUsL5JXGx1yQb53iYEd3lJKXtKdf jd4AWrx8MEzFzuPojKXLYK65QyGAmKelobmgkSeZSAjtHZoZ10UOCKCey/mFO+vvyl5N h3tG5iWdDWT7zrRX2ZOwiW/YrnO/SFC2yRyq6GYSQwuc5+EvebzSbrpVyzWZAseA6Yg0 2n1Q== 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=i5V9WyqhvrJvKj2IxLHL3NBxMNO/PLt1gAf4PF06DIg=; b=NshWQPvvZGQRTWik4bT24GJ4KaYdKUzgT9/jx2lLKLW0TK/d5nJDsTQhSaewrwRU7X oHPcDv0HdHCneYArF1ePFuNc0g69w4HVYdPegxw5Tb5LuQRRU+odGpvZF6/N9AqJpdZH d8BAHFTZkugF5r9jQk18ByGcjgruVg4y+Sx5uwz6QdSKXwayqkQl7GsO+U/0gCYdsiBf 7XlK4fH6l8nqFWpykfUCUaxvlg/MrcOlELRY9lyB27ZO16i6dtq8Im8QvTfrjLRRAATF jbrScghhmjLULAxlVRFnOhRZ92RmzaAAKXdiJ0pPsFzsqjpJzuiL0YrOyyIkIf+/s7fo 3niw== X-Gm-Message-State: AMke39nnLsdHpeid1j7XzBxAMootHK6sW/ZJF9YZq6cY2wDPkmURvcKdzNVjjMAJkXeYltIQ X-Received: by 10.28.66.11 with SMTP id p11mr3375470wma.38.1488297729670; Tue, 28 Feb 2017 08:02:09 -0800 (PST) Received: from localhost.localdomain ([90.63.244.31]) by smtp.gmail.com with ESMTPSA id k8sm2887327wre.19.2017.02.28.08.02.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 28 Feb 2017 08:02:09 -0800 (PST) From: Bartosz Golaszewski To: Sekhar Nori , David Lechner , Kevin Hilman , Michael Turquette , Patrick Titiano , Laurent Pinchart , Russell King Subject: [PATCH v4 4/6] ARM: davinci: da8xx: add pdata-quirks for VPIF capture Date: Tue, 28 Feb 2017 17:01:58 +0100 Message-Id: <1488297720-4558-5-git-send-email-bgolaszewski@baylibre.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1488297720-4558-1-git-send-email-bgolaszewski@baylibre.com> References: <1488297720-4558-1-git-send-email-bgolaszewski@baylibre.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170228_080231_963195_AFB7B557 X-CRM114-Status: GOOD ( 14.58 ) 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 - split the init function into two separate routines for the lcdk and evm boards] Signed-off-by: Bartosz Golaszewski --- arch/arm/mach-davinci/pdata-quirks.c | 111 +++++++++++++++++++++++++++++++++++ 1 file changed, 111 insertions(+) diff --git a/arch/arm/mach-davinci/pdata-quirks.c b/arch/arm/mach-davinci/pdata-quirks.c index 36fb217..4a9603d 100644 --- a/arch/arm/mach-davinci/pdata-quirks.c +++ b/arch/arm/mach-davinci/pdata-quirks.c @@ -10,13 +10,122 @@ #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_register_capture(void) +{ + int ret; + + ret = da850_register_vpif_capture(&da850_vpif_capture_config); + if (ret) + pr_warn("%s: VPIF capture setup failed: %d\n", + __func__, ret); +} + +static void __init da850_vpif_capture_legacy_init_lcdk(void) +{ + da850_vpif_capture_config.subdev_count = 1; + da850_vpif_legacy_register_capture(); +} + +static void __init da850_vpif_capture_legacy_init_evm(void) +{ + da850_vpif_legacy_register_capture(); +} + static void pdata_quirks_check(struct pdata_init *quirks) { while (quirks->compatible) { @@ -29,6 +138,8 @@ static void pdata_quirks_check(struct pdata_init *quirks) } static struct pdata_init pdata_quirks[] __initdata = { + { "ti,da850-lcdk", da850_vpif_capture_legacy_init_lcdk, }, + { "ti,da850-evm", da850_vpif_capture_legacy_init_evm, }, { /* sentinel */ }, };