From patchwork Mon Jan 9 20:55:30 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Hilman X-Patchwork-Id: 9505967 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 BFF58606E1 for ; Mon, 9 Jan 2017 20:57:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A7C00284DA for ; Mon, 9 Jan 2017 20:57:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9C6C328518; Mon, 9 Jan 2017 20:57:01 +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=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 320A1284DA for ; Mon, 9 Jan 2017 20:57:01 +0000 (UTC) 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 1cQgzy-0006mS-8p; Mon, 09 Jan 2017 20:56:58 +0000 Received: from mail-pf0-x22c.google.com ([2607:f8b0:400e:c00::22c]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cQgz0-00051g-Tm for linux-arm-kernel@lists.infradead.org; Mon, 09 Jan 2017 20:56:01 +0000 Received: by mail-pf0-x22c.google.com with SMTP id 127so33685015pfg.1 for ; Mon, 09 Jan 2017 12:55: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 :mime-version:content-transfer-encoding; bh=jGOxf7f+ShHHTZ5Hi48kQjO4rvGH+wOI0ehIdbpBFW4=; b=SQtfLxQqC/BnoAkXFXFgVh2Nc0tIOfT3/PJn7qcw3iL2XGd+06ccOZO/GWfWzAPezM zBKu5Zmo6r+GfsQHgtAc4aY+WUa+pMR5Lp7BveIoP+Ipn2HG/vAli4B6xRBU3KJgbFWb Mzr9Jj4oc2LgjD76WTWBIg0dwQ73rXPb2YBvnHFMk89fhm+4TdQiqMjGXYp/TTYi2i5F yoEbog3IS1wLItc0NsNBhnOvLz1wUTKDIbhvdY/1vnukzwim9tI51hJg0fP36fZHvFrX DeCgdVbvj5+RqnzaS3oIMOGKjqCDjbmfB7evwww7JDZARB7KqarY9k5grFy9OQOGQRPE dUWw== 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:mime-version:content-transfer-encoding; bh=jGOxf7f+ShHHTZ5Hi48kQjO4rvGH+wOI0ehIdbpBFW4=; b=pls0/vajlzn9lVuJuQX+hur9z3KxmoYTD9pkQFWiXYsJYKVeZZTnF/ow284nwv+v3u yXjCETAi5efGoojz/fd1yaFMT8597+IVx0CR6Rd0Q6JSPHPs6BKkHidcJGp2hC32qU/P j13m9oCEXjv5hWo4zq8PbhHTlsuwlQU0QBOOys3h1VWVe+G+H4nJLk9vY6JoztESWoUn GIwwefTuB7/J0UVV/cCoSZk0CYNXA5w0iKx1HQAGitf/tOfoBWxuysAGBwLJS9XA6B3D Nbqwxn5wxhifwF9HYedadJlK5AUf1/GhUobQSeKUWlp6IJreszqAHBSvrqY4MyijOlhX 0IRA== X-Gm-Message-State: AIkVDXLl8To6geqWhJFvnrZaK/dspazb31NF7qgCeJ8ZqWd3ZOGmN/k/aRCsIzWWGLafCAMj X-Received: by 10.98.153.155 with SMTP id t27mr3470691pfk.48.1483995338028; Mon, 09 Jan 2017 12:55:38 -0800 (PST) Received: from localhost (c-98-203-232-209.hsd1.wa.comcast.net. [98.203.232.209]) by smtp.gmail.com with ESMTPSA id s3sm149312380pfg.14.2017.01.09.12.55.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 09 Jan 2017 12:55:37 -0800 (PST) From: Kevin Hilman To: Sekhar Nori Subject: [PATCH v2 5/6] ARM: davinci: da8xx: add pdata-quirks, use for VPIF capture Date: Mon, 9 Jan 2017 12:55:30 -0800 Message-Id: <20170109205531.3435-6-khilman@baylibre.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170109205531.3435-1-khilman@baylibre.com> References: <20170109205531.3435-1-khilman@baylibre.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170109_125559_088945_B63B35D0 X-CRM114-Status: GOOD ( 15.37 ) 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: David Lechner , Axel Haslam , Fabien Parent , =?UTF-8?q?Bartosz=20Go=C5=82aszewski?= , Alexandre Bailon , Patrick Titiano , linux-arm-kernel@lists.infradead.org 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 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/Makefile | 2 +- arch/arm/mach-davinci/da8xx-dt.c | 2 + arch/arm/mach-davinci/pdata-quirks.c | 115 +++++++++++++++++++++++++++++++++++ 3 files changed, 118 insertions(+), 1 deletion(-) diff --git a/arch/arm/mach-davinci/Makefile b/arch/arm/mach-davinci/Makefile index 0a2e6da45f28..df96ca9eab6d 100644 --- a/arch/arm/mach-davinci/Makefile +++ b/arch/arm/mach-davinci/Makefile @@ -21,7 +21,7 @@ obj-$(CONFIG_AINTC) += irq.o obj-$(CONFIG_CP_INTC) += cp_intc.o # Board specific -obj-$(CONFIG_MACH_DA8XX_DT) += da8xx-dt.o +obj-$(CONFIG_MACH_DA8XX_DT) += da8xx-dt.o pdata-quirks.o obj-$(CONFIG_MACH_DAVINCI_EVM) += board-dm644x-evm.o obj-$(CONFIG_MACH_SFFSDR) += board-sffsdr.o obj-$(CONFIG_MACH_NEUROS_OSD2) += board-neuros-osd2.o diff --git a/arch/arm/mach-davinci/da8xx-dt.c b/arch/arm/mach-davinci/da8xx-dt.c index 9ee44da6eb7b..fe4a9e30d937 100644 --- a/arch/arm/mach-davinci/da8xx-dt.c +++ b/arch/arm/mach-davinci/da8xx-dt.c @@ -42,6 +42,7 @@ static struct of_dev_auxdata da850_auxdata_lookup[] __initdata = { OF_DEV_AUXDATA("ti,da830-ohci", 0x01e25000, "ohci-da8xx", NULL), 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-vpif", 0x01e17000, "vpif", NULL), {} }; @@ -62,6 +63,7 @@ static void __init da850_init_machine(void) of_platform_default_populate(NULL, da850_auxdata_lookup, NULL); davinci_pm_init(); + pdata_quirks_init(); } static const char *const da850_boards_compat[] __initconst = { diff --git a/arch/arm/mach-davinci/pdata-quirks.c b/arch/arm/mach-davinci/pdata-quirks.c index 5b57da475065..142a2684c445 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); }; +#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; + + /* EVM (UI card) uses i2c adapter 1 (not default: zero) */ + if (of_machine_is_compatible("ti,da850-evm")) + da850_vpif_capture_config.i2c_adapter_id = 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 +139,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 */ }, };