From 5717b9a050a123d3e1eafa7c0883810847e74d2c Mon Sep 17 00:00:00 2001 From: Gerard Salvatella Date: Fri, 31 Aug 2018 09:47:44 +0200 Subject: board: toradex: turn off lcd backlight before OS handover U-Boot typically tears down the display controller before handing control over to Linux. On LCD displays disabling pixel clock leads to a fading out effect with vertical/horizontal lines. Make sure to disable back light before booting Linux. Signed-off-by: Gerard Salvatella Acked-by: Marcel Ziswiler --- board/toradex/apalis-tk1/apalis-tk1.c | 9 +++++++++ board/toradex/apalis_imx6/apalis_imx6.c | 9 +++++++++ board/toradex/apalis_t30/apalis_t30.c | 9 +++++++++ board/toradex/colibri-imx6ull/colibri_imx6ull.c | 9 +++++++++ board/toradex/colibri_imx6/colibri_imx6.c | 11 +++++++++-- board/toradex/colibri_imx7/colibri_imx7.c | 9 +++++++++ board/toradex/colibri_t20/colibri_t20.c | 9 +++++++++ board/toradex/colibri_t30/colibri_t30.c | 9 +++++++++ board/toradex/colibri_vf/colibri_vf.c | 10 ++++++++++ 9 files changed, 82 insertions(+), 2 deletions(-) diff --git a/board/toradex/apalis-tk1/apalis-tk1.c b/board/toradex/apalis-tk1/apalis-tk1.c index a6a3897a75..92ce1a9592 100644 --- a/board/toradex/apalis-tk1/apalis-tk1.c +++ b/board/toradex/apalis-tk1/apalis-tk1.c @@ -281,3 +281,12 @@ void start_cpu_fan(void) gpio_request(FAN_EN, "FAN_EN"); gpio_direction_output(FAN_EN, 1); } + +/* + * Backlight off before OS handover + */ +void board_preboot_os(void) +{ + gpio_request(TEGRA_GPIO(BB, 5), "BL_ON"); + gpio_direction_output(TEGRA_GPIO(BB, 5), 0); +} diff --git a/board/toradex/apalis_imx6/apalis_imx6.c b/board/toradex/apalis_imx6/apalis_imx6.c index 5ceecb352d..e42d9bd253 100644 --- a/board/toradex/apalis_imx6/apalis_imx6.c +++ b/board/toradex/apalis_imx6/apalis_imx6.c @@ -756,6 +756,15 @@ static void setup_display(void) gpio_direction_output(RGB_BACKLIGHTPWM_OE, 0); gpio_direction_output(RGB_BACKLIGHT_GP, 1); } + +/* + * Backlight off before OS handover + */ +void board_preboot_os(void) +{ + gpio_direction_output(RGB_BACKLIGHTPWM_GP, 1); + gpio_direction_output(RGB_BACKLIGHT_GP, 0); +} #endif /* defined(CONFIG_VIDEO_IPUV3) */ int board_early_init_f(void) diff --git a/board/toradex/apalis_t30/apalis_t30.c b/board/toradex/apalis_t30/apalis_t30.c index 7dcd6648e3..a03bc22ab5 100644 --- a/board/toradex/apalis_t30/apalis_t30.c +++ b/board/toradex/apalis_t30/apalis_t30.c @@ -213,3 +213,12 @@ void tegra_pcie_board_port_reset(struct tegra_pcie_port *port) #endif /* CONFIG_APALIS_T30_PCIE_EVALBOARD_INIT */ } #endif /* CONFIG_PCI_TEGRA */ + +/* + * Backlight off before OS handover + */ +void board_preboot_os(void) +{ + gpio_request(TEGRA_GPIO(V, 2), "BKL1_ON"); + gpio_direction_output(TEGRA_GPIO(V, 2), 0); +} diff --git a/board/toradex/colibri-imx6ull/colibri_imx6ull.c b/board/toradex/colibri-imx6ull/colibri_imx6ull.c index b1558f0b72..cf9e90559d 100644 --- a/board/toradex/colibri-imx6ull/colibri_imx6ull.c +++ b/board/toradex/colibri-imx6ull/colibri_imx6ull.c @@ -166,6 +166,15 @@ static int setup_lcd(void) return 0; } + +/* + * Backlight off before OS handover + */ +void board_preboot_os(void) +{ + gpio_direction_output(GPIO_PWM_A, 1); + gpio_direction_output(GPIO_BL_ON, 0); +} #endif #ifdef CONFIG_FEC_MXC diff --git a/board/toradex/colibri_imx6/colibri_imx6.c b/board/toradex/colibri_imx6/colibri_imx6.c index 5a3678e506..f97e292f01 100644 --- a/board/toradex/colibri_imx6/colibri_imx6.c +++ b/board/toradex/colibri_imx6/colibri_imx6.c @@ -507,8 +507,6 @@ static void enable_rgb(struct display_info_t const *dev) imx_iomux_v3_setup_multiple_pads( rgb_pads, ARRAY_SIZE(rgb_pads)); - gpio_direction_output(RGB_BACKLIGHT_GP, 1); - gpio_direction_output(RGB_BACKLIGHTPWM_GP, 0); } static int detect_default(struct display_info_t const *dev) @@ -634,6 +632,15 @@ static void setup_display(void) gpio_direction_output(RGB_BACKLIGHTPWM_GP, 0); gpio_direction_output(RGB_BACKLIGHT_GP, 1); } + +/* + * Backlight off before OS handover + */ +void board_preboot_os(void) +{ + gpio_direction_output(RGB_BACKLIGHTPWM_GP, 1); + gpio_direction_output(RGB_BACKLIGHT_GP, 0); +} #endif /* defined(CONFIG_VIDEO_IPUV3) */ int board_early_init_f(void) diff --git a/board/toradex/colibri_imx7/colibri_imx7.c b/board/toradex/colibri_imx7/colibri_imx7.c index ca28f1cc5d..e9f81a53f5 100644 --- a/board/toradex/colibri_imx7/colibri_imx7.c +++ b/board/toradex/colibri_imx7/colibri_imx7.c @@ -188,6 +188,15 @@ static int setup_lcd(void) return 0; } + +/* + * Backlight off before OS handover + */ +void board_preboot_os(void) +{ + gpio_direction_output(GPIO_PWM_A, 1); + gpio_direction_output(GPIO_BL_ON, 0); +} #endif #ifdef CONFIG_FEC_MXC diff --git a/board/toradex/colibri_t20/colibri_t20.c b/board/toradex/colibri_t20/colibri_t20.c index 15ab2f586c..67b21d67f6 100644 --- a/board/toradex/colibri_t20/colibri_t20.c +++ b/board/toradex/colibri_t20/colibri_t20.c @@ -232,4 +232,13 @@ void pin_mux_display(void) pinmux_set_func(PMUX_PINGRP_SDC, PMUX_FUNC_PWM); pinmux_tristate_disable(PMUX_PINGRP_SDC); } + +/* + * Backlight off before OS handover + */ +void board_preboot_os(void) +{ + gpio_request(TEGRA_GPIO(T, 4), "BL_ON"); + gpio_direction_output(TEGRA_GPIO(T, 4), 0); +} #endif diff --git a/board/toradex/colibri_t30/colibri_t30.c b/board/toradex/colibri_t30/colibri_t30.c index 7d07247d5e..8d79e12e78 100644 --- a/board/toradex/colibri_t30/colibri_t30.c +++ b/board/toradex/colibri_t30/colibri_t30.c @@ -81,3 +81,12 @@ void pin_mux_usb(void) udelay(5); gpio_set_value(TEGRA_GPIO(DD, 0), 1); } + +/* + * Backlight off before OS handover + */ +void board_preboot_os(void) +{ + gpio_request(TEGRA_GPIO(V, 2), "BL_ON"); + gpio_direction_output(TEGRA_GPIO(V, 2), 0); +} diff --git a/board/toradex/colibri_vf/colibri_vf.c b/board/toradex/colibri_vf/colibri_vf.c index 02997e18a8..025eefc784 100644 --- a/board/toradex/colibri_vf/colibri_vf.c +++ b/board/toradex/colibri_vf/colibri_vf.c @@ -42,6 +42,7 @@ DECLARE_GLOBAL_DATA_PTR; #define USB_PEN_GPIO 83 #define USB_CDET_GPIO 102 +#define PTC0_GPIO_45 45 static struct ddrmc_cr_setting colibri_vf_cr_settings[] = { { DDRMC_CR79_CTLUPD_AREF(1), 79 }, @@ -650,3 +651,12 @@ int board_usb_phy_mode(int port) } } #endif + +/* + * Backlight off before OS handover + */ +void board_preboot_os(void) +{ + gpio_request(PTC0_GPIO_45, "BL_ON"); + gpio_direction_output(PTC0_GPIO_45, 0); +} -- cgit v1.2.3