From patchwork Thu Feb 16 18:21: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: 9578023 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 36E9E60209 for ; Thu, 16 Feb 2017 18:22:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 297482863C for ; Thu, 16 Feb 2017 18:22:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1D65D2865A; Thu, 16 Feb 2017 18:22:42 +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 921392863C for ; Thu, 16 Feb 2017 18:22:41 +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=ariNHV7eLMLkU2aF1n7vggyrUc1yw8TM3KajHzGYryk=; b=quBo6dlECL/TJepNsARj1Q9S3X ZrXUkhp6qomklj1bz6NKVeDvS81w++ObTdUpklMow8pJ0aLfa89BNBj/QWzYpy1vlZ895+V2DCBSf qIcd9nnGk+BcYUzrvQEZPOBenVzH+d+KOm9ri7joyiA1ZfRdEc+caKrNt0/LnMtm0hQLdD2pjQKrk HKQ/inyfur2ZynfafCaBeGgUujOAwJM2Mm6axdOrfkVNaqogj9ViRvVqWTvAcIQB++N+0ndRSxBTO qvDjaZwcDZD7Qgi7tAY8W9RUWtEcHnaVeqeSQZKtbhXoGl4ke+E9k9iSwQWuSZgC205q2LQqBtohR 4TdOcEag==; 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 1ceQhO-0002MW-5p; Thu, 16 Feb 2017 18:22:34 +0000 Received: from mail-wr0-x234.google.com ([2a00:1450:400c:c0c::234]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1ceQgn-0001i6-L9 for linux-arm-kernel@lists.infradead.org; Thu, 16 Feb 2017 18:22:05 +0000 Received: by mail-wr0-x234.google.com with SMTP id c4so17469356wrd.2 for ; Thu, 16 Feb 2017 10:21:37 -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=3ddxGoI16CA0MCAEyMBsM5GuSIwpZaHAcWy5fuCbyDI=; b=bfljT6FmjLSmNdH72vsZl6lklqPeWmOLiJyZN9duqekSqlKYib2pHaQTvg3JmybrPb Neomls6ktMqtK+stjtvUguh+it441ZNvgwqBNCT0YlHiLKgT9Gjmiz2DsKUnTWihS0zP CexLQb9KxYe4jclJF1AECkz/Fr94Y6XgF4lyFCl7eOH6NFN2kB/T4zOEGWGPIMWHm5b7 sX16sbRSRkETD2V05A5IQw/8cmtSN9HQDrwCQVCLJRCtx+qngZbBq2srFArZQkSqvWue lTxy5jv35rZAFUJV5+S8dhbNVdpY0M444gwW56Y6reWjH91gqFBE02rlbqxiycmIbCaT l1cA== 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=3ddxGoI16CA0MCAEyMBsM5GuSIwpZaHAcWy5fuCbyDI=; b=UtEW7O2WflsUmPBX39ObuwwaabTVTOJ1+EvxsLBfCqKPLnFZFu9GL/fTnHBN7SpKch tRBf7SqFWS4g9JMjyMcrNkewXR501eszCPG/RSF8FunhT576dtvvqez2WAP4GfwSgTkj 11rP1bCxfOReJEpVbix36Z7DY590lUzKPpcuNOfRTAcaJSy9WUdmKLg93jNdtgDczCpR rjzoJ9rConeBHufY7Ii6dqlc5aU4pSywSA8ceCHmfsXqmdUURhrf/Hhh1NgYT5i8UltE 1SisK1cC9IdQX+8arbug3IZ/K6zdwBH6wyaGCmLG6JN3AH+JJ+TU8Hr2gF34WOXP2diB pGvg== X-Gm-Message-State: AMke39mdaWOksInO8Gx9sf3952xEP6aT2tBoJH2UiqFLTvcvCfLXr/D8zvy+IH8Eiiv1hJrC X-Received: by 10.223.130.46 with SMTP id 43mr3453967wrb.41.1487269295589; Thu, 16 Feb 2017 10:21:35 -0800 (PST) Received: from localhost.localdomain ([90.63.244.31]) by smtp.gmail.com with ESMTPSA id w30sm9949774wrb.5.2017.02.16.10.21.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 16 Feb 2017 10:21:35 -0800 (PST) From: Bartosz Golaszewski To: Sekhar Nori , David Lechner , Kevin Hilman , Michael Turquette , Patrick Titiano , Laurent Pinchart , Russell King Subject: [PATCH 2/4] ARM: davinci: da8xx: add pdata-quirks for VPIF capture Date: Thu, 16 Feb 2017 19:21:22 +0100 Message-Id: <1487269285-6948-3-git-send-email-bgolaszewski@baylibre.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1487269285-6948-1-git-send-email-bgolaszewski@baylibre.com> References: <1487269285-6948-1-git-send-email-bgolaszewski@baylibre.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170216_102158_433990_4767A31A X-CRM114-Status: GOOD ( 15.21 ) 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: 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 --- arch/arm/mach-davinci/da8xx-dt.c | 1 + arch/arm/mach-davinci/pdata-quirks.c | 111 +++++++++++++++++++++++++++++++++++ 2 files changed, 112 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 5b57da4..3ca773f 100644 --- a/arch/arm/mach-davinci/pdata-quirks.c +++ b/arch/arm/mach-davinci/pdata-quirks.c @@ -10,13 +10,118 @@ #include #include +#include + #include +#include struct pdata_init { const char *compatible; void (*fn)(void); }; +#if IS_ENABLED(CONFIG_VIDEO_DAVINCI_VPIF_CAPTURE) + +#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); +} +#endif + static void pdata_quirks_check(struct pdata_init *quirks) { while (quirks->compatible) { @@ -30,6 +135,12 @@ static void pdata_quirks_check(struct pdata_init *quirks) } static struct pdata_init pdata_quirks[] __initdata = { +#if IS_ENABLED(CONFIG_VIDEO_DAVINCI_VPIF_CAPTURE) + { "ti,da850-lcdk", da850_vpif_legacy_init, }, +#if defined(CONFIG_DA850_UI_SD_VIDEO_PORT) + { "ti,da850-evm", da850_vpif_legacy_init, }, +#endif +#endif { /* sentinel */ }, };