2 * Copyright (C) 2012 Samsung Electronics
4 * Author: InKi Dae <inki.dae@samsung.com>
5 * Author: Donghwa Lee <dh09.lee@samsung.com>
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License as
9 * published by the Free Software Foundation; either version 2 of
10 * the License, or (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
27 #include <asm/arch/cpu.h>
28 #include <asm/arch/clock.h>
29 #include <asm/arch/clk.h>
30 #include <asm/arch/mipi_dsim.h>
31 #include <asm/arch/dp_info.h>
32 #include <asm/arch/system.h>
34 #include "exynos_fb.h"
39 void *lcd_console_address;
44 static unsigned int panel_width, panel_height;
46 static void exynos_lcd_init_mem(void *lcdbase, vidinfo_t *vid)
48 unsigned long palette_size;
51 fb_size = vid->vl_row * vid->vl_col * (NBITS(vid->vl_bpix) >> 3);
55 palette_size = NBITS(vid->vl_bpix) == 8 ? 256 : 16;
57 exynos_fimd_lcd_init_mem((unsigned long)lcd_base,
58 (unsigned long)fb_size, palette_size);
61 static void exynos_lcd_init(vidinfo_t *vid)
63 exynos_fimd_lcd_init(vid);
65 /* Enable flushing after LCD writes if requested */
66 lcd_set_flush_dcache(1);
70 static void draw_logo(void)
75 if (panel_width >= panel_info.logo_width) {
76 x = ((panel_width - panel_info.logo_width) >> 1);
79 printf("Warning: image width is bigger than display width\n");
82 if (panel_height >= panel_info.logo_height) {
83 y = ((panel_height - panel_info.logo_height) >> 1) - 4;
86 printf("Warning: image height is bigger than display height\n");
89 addr = panel_info.logo_addr;
90 bmp_display(addr, x, y);
94 static void lcd_panel_on(vidinfo_t *vid)
96 udelay(vid->init_delay);
98 if (vid->backlight_reset)
99 vid->backlight_reset();
104 if (vid->lcd_power_on)
107 udelay(vid->power_on_delay);
112 if (vid->reset_lcd) {
114 udelay(vid->reset_delay);
117 if (vid->backlight_on)
118 vid->backlight_on(1);
126 if (vid->mipi_enabled)
127 exynos_mipi_dsi_init();
130 void lcd_ctrl_init(void *lcdbase)
132 set_system_display_ctrl();
135 /* initialize parameters which is specific to panel. */
136 init_panel_info(&panel_info);
138 panel_width = panel_info.vl_width;
139 panel_height = panel_info.vl_height;
141 exynos_lcd_init_mem(lcdbase, &panel_info);
143 exynos_lcd_init(&panel_info);
146 void lcd_enable(void)
148 if (panel_info.logo_on) {
149 memset(lcd_base, 0, panel_width * panel_height *
150 (NBITS(panel_info.vl_bpix) >> 3));
151 #ifdef CONFIG_CMD_BMP
156 lcd_panel_on(&panel_info);
160 void lcd_setcolreg(ushort regno, ushort red, ushort green, ushort blue)