From patchwork Wed Sep 29 22:04:21 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tim Harvey X-Patchwork-Id: 1534562 X-Patchwork-Delegate: sbabic@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HKVnB2x5cz9t1C for ; Thu, 30 Sep 2021 08:05:50 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 84F1B812D8; Thu, 30 Sep 2021 00:05:27 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=gateworks.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id A2D7B80D28; Thu, 30 Sep 2021 00:04:46 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.2 Received: from finn.localdomain (finn.gateworks.com [108.161.129.64]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id E334581197 for ; Thu, 30 Sep 2021 00:04:29 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=gateworks.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=tharvey@gateworks.com Received: from 068-189-091-139.biz.spectrum.com ([68.189.91.139] helo=tharvey.pdc.gateworks.com) by finn.localdomain with esmtp (Exim 4.93) (envelope-from ) id 1mVhgh-0070bJ-6c; Wed, 29 Sep 2021 22:04:27 +0000 From: Tim Harvey To: u-boot@lists.denx.de, Stefano Babic , Fabio Estevam , "NXP i . MX U-Boot Team" Cc: Tim Harvey Subject: [PATCH 6/7] imx: ventana: update LVDS support Date: Wed, 29 Sep 2021 15:04:21 -0700 Message-Id: <20210929220422.13661-6-tharvey@gateworks.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210929220422.13661-1-tharvey@gateworks.com> References: <20210929220422.13661-1-tharvey@gateworks.com> X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean Enable LVDS display detection and panel-specific configuration Make I2C based LVDS detection and configuration model specific: - not all boards support LVDS connectors; fail detection that do not support LVDS to avoid misdetecting an I2C device as a display - GPIO configuration is panel specific; use panel name where needed Signed-off-by: Tim Harvey --- board/gateworks/gw_ventana/gw_ventana.c | 59 ++++++++++++++++++------- 1 file changed, 42 insertions(+), 17 deletions(-) diff --git a/board/gateworks/gw_ventana/gw_ventana.c b/board/gateworks/gw_ventana/gw_ventana.c index 16468060f7..1c82bd5067 100644 --- a/board/gateworks/gw_ventana/gw_ventana.c +++ b/board/gateworks/gw_ventana/gw_ventana.c @@ -158,25 +158,54 @@ static void enable_hdmi(struct display_info_t const *dev) imx_enable_hdmi_phy(); } -static int detect_i2c(struct display_info_t const *dev) +static int detect_lvds(struct display_info_t const *dev) { + /* only the following boards support LVDS connectors */ + switch (board_type) { + case GW52xx: + case GW53xx: + case GW54xx: + case GW560x: + case GW5905: + case GW5909: + break; + default: + return 0; + } + return i2c_set_bus_num(dev->bus) == 0 && i2c_probe(dev->addr) == 0; } static void enable_lvds(struct display_info_t const *dev) { - struct iomuxc *iomux = (struct iomuxc *) - IOMUXC_BASE_ADDR; + struct iomuxc *iomux = (struct iomuxc *)IOMUXC_BASE_ADDR; /* set CH0 data width to 24bit (IOMUXC_GPR2:5 0=18bit, 1=24bit) */ u32 reg = readl(&iomux->gpr[2]); reg |= IOMUXC_GPR2_DATA_WIDTH_CH0_24BIT; writel(reg, &iomux->gpr[2]); - /* Enable Backlight */ - gpio_request(IMX_GPIO_NR(1, 10), "bklt_gpio"); - gpio_direction_output(IMX_GPIO_NR(1, 10), 0); + /* Configure GPIO */ + switch (board_type) { + case GW52xx: + case GW53xx: + case GW54xx: + if (!strncmp(dev->mode.name, "Hannstar", 8)) { + SETUP_IOMUX_PAD(PAD_SD2_CLK__GPIO1_IO10 | DIO_PAD_CFG); + gpio_request(IMX_GPIO_NR(1, 10), "cabc"); + gpio_direction_output(IMX_GPIO_NR(1, 10), 0); + } else if (!strncmp(dev->mode.name, "DLC", 3)) { + SETUP_IOMUX_PAD(PAD_SD2_CLK__GPIO1_IO10 | DIO_PAD_CFG); + gpio_request(IMX_GPIO_NR(1, 10), "touch_rst#"); + gpio_direction_output(IMX_GPIO_NR(1, 10), 1); + } + break; + default: + break; + } + + /* Configure backlight */ gpio_request(IMX_GPIO_NR(1, 18), "bklt_en"); SETUP_IOMUX_PAD(PAD_SD1_CMD__GPIO1_IO18 | DIO_PAD_CFG); gpio_direction_output(IMX_GPIO_NR(1, 18), 1); @@ -208,7 +237,7 @@ struct display_info_t const displays[] = {{ .bus = 2, .addr = 0x4, .pixfmt = IPU_PIX_FMT_LVDS666, - .detect = detect_i2c, + .detect = detect_lvds, .enable = enable_lvds, .mode = { .name = "Hannstar-XGA", @@ -228,7 +257,7 @@ struct display_info_t const displays[] = {{ /* DLC700JMG-T-4 */ .bus = 2, .addr = 0x38, - .detect = NULL, + .detect = detect_lvds, .enable = enable_lvds, .pixfmt = IPU_PIX_FMT_LVDS666, .mode = { @@ -247,9 +276,9 @@ struct display_info_t const displays[] = {{ .vmode = FB_VMODE_NONINTERLACED } }, { /* DLC0700XDP21LF-C-1 */ - .bus = 0, - .addr = 0, - .detect = NULL, + .bus = 2, + .addr = 0x38, + .detect = detect_lvds, .enable = enable_lvds, .pixfmt = IPU_PIX_FMT_LVDS666, .mode = { @@ -270,7 +299,7 @@ struct display_info_t const displays[] = {{ /* DLC800FIG-T-3 */ .bus = 2, .addr = 0x14, - .detect = NULL, + .detect = detect_lvds, .enable = enable_lvds, .pixfmt = IPU_PIX_FMT_LVDS666, .mode = { @@ -290,7 +319,7 @@ struct display_info_t const displays[] = {{ } }, { .bus = 2, .addr = 0x5d, - .detect = detect_i2c, + .detect = detect_lvds, .enable = enable_lvds, .pixfmt = IPU_PIX_FMT_LVDS666, .mode = { @@ -358,10 +387,6 @@ static void setup_display(void) | (IOMUXC_GPR3_MUX_SRC_IPU1_DI0 <gpr[3]); - - /* LVDS Backlight GPIO on LVDS connector - output low */ - SETUP_IOMUX_PAD(PAD_SD2_CLK__GPIO1_IO10 | DIO_PAD_CFG); - gpio_direction_output(IMX_GPIO_NR(1, 10), 0); } #endif /* CONFIG_VIDEO_IPUV3 */