From 287f5452f37ed208f27ad4c11161feb93a2f2e81 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Lothar=20Wa=C3=9Fmann?= Date: Mon, 21 Oct 2013 15:34:37 +0200 Subject: [PATCH] karo: tx53: update video mode handling code --- board/karo/tx53/tx53.c | 39 +++++++++++++++++++++++++++++++-------- 1 file changed, 31 insertions(+), 8 deletions(-) diff --git a/board/karo/tx53/tx53.c b/board/karo/tx53/tx53.c index 1a66b5ab7c..2684bd9611 100644 --- a/board/karo/tx53/tx53.c +++ b/board/karo/tx53/tx53.c @@ -479,14 +479,12 @@ static const struct gpio stk5_gpios[] = { }; #ifdef CONFIG_LCD -static ushort tx53_cmap[256]; vidinfo_t panel_info = { /* set to max. size supported by SoC */ .vl_col = 1600, .vl_row = 1200, .vl_bpix = LCD_COLOR24, /* Bits per pixel, 0: 1bpp, 1: 2bpp, 2: 4bpp, 3: 8bpp ... */ - .cmap = tx53_cmap, }; static struct fb_videomode tx53_fb_modes[] = { @@ -632,8 +630,9 @@ void lcd_enable(void) */ lcd_is_enabled = 0; - karo_load_splashimage(1); if (lcd_enabled) { + karo_load_splashimage(1); + debug("Switching LCD on\n"); gpio_set_value(TX53_LCD_PWR_GPIO, 1); udelay(100); @@ -645,7 +644,10 @@ void lcd_enable(void) void lcd_disable(void) { - printf("Disabling LCD\n"); + if (lcd_enabled) { + printf("Disabling LCD\n"); + ipuv3_fb_shutdown(); + } } void lcd_panel_disable(void) @@ -736,6 +738,7 @@ void lcd_ctrl_init(void *lcdbase) if (tstc() || (wrsr & WRSR_TOUT)) { debug("Disabling LCD\n"); lcd_enabled = 0; + setenv("splashimage", NULL); return; } @@ -868,6 +871,18 @@ void lcd_ctrl_init(void *lcdbase) PICOS2KHZ(p->pixclock) / 1000, PICOS2KHZ(p->pixclock) % 1000); + if (p != &fb_mode) { + int ret; + char *modename = getenv("video_mode"); + + printf("Creating new display-timing node from '%s'\n", + modename); + ret = karo_fdt_create_fb_mode(working_fdt, modename, p); + if (ret) + printf("Failed to create new display-timing node from '%s': %d\n", + modename, ret); + } + gpio_request_array(stk5_lcd_gpios, ARRAY_SIZE(stk5_lcd_gpios)); imx_iomux_v3_setup_multiple_pads(stk5_lcd_pads, ARRAY_SIZE(stk5_lcd_pads)); @@ -888,8 +903,16 @@ void lcd_ctrl_init(void *lcdbase) } if (karo_load_splashimage(0) == 0) { + int ret; + + gd->arch.ipu_hw_rev = IPUV3_HW_REV_IPUV3M; + debug("Initializing LCD controller\n"); - ipuv3_fb_init(p, 0, pix_fmt, di_clk_parent, di_clk_rate, -1); + ret = ipuv3_fb_init(p, 0, pix_fmt, di_clk_parent, di_clk_rate, -1); + if (ret) { + printf("Failed to initialize FB driver: %d\n", ret); + lcd_enabled = 0; + } } else { debug("Skipping initialization of LCD controller\n"); } @@ -1016,17 +1039,17 @@ void tx53_fixup_rtc(void *blob) static inline void tx53_fixup_rtc(void *blob) { } -#endif +#endif /* CONFIG_SYS_TX53_HWREV_2 */ void ft_board_setup(void *blob, bd_t *bd) { fdt_fixup_mtdparts(blob, nodes, ARRAY_SIZE(nodes)); fdt_fixup_ethernet(blob); - karo_fdt_enable_node(blob, "ipu", getenv("video_mode") != NULL); karo_fdt_fixup_touchpanel(blob); karo_fdt_fixup_usb_otg(blob, "fsl,imx-otg", "fsl,usbphy"); tx53_fixup_flexcan(blob); tx53_fixup_rtc(blob); + karo_fdt_update_fb_mode(blob, getenv("video_mode")); } -#endif +#endif /* CONFIG_OF_BOARD_SETUP */ -- 2.39.2