From: Tim Harvey Date: Wed, 29 Sep 2021 22:04:21 +0000 (-0700) Subject: imx: ventana: update LVDS support X-Git-Url: http://git.dujemihanovic.xyz/img/sics.gif?a=commitdiff_plain;h=397d697fd4707043511fdad34f2f75274a4a54d0;p=u-boot.git imx: ventana: update LVDS support 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 --- 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 */