exynos_fb: Remove usage of static defines
authorAjay Kumar <ajaykumar.rs@samsung.com>
Fri, 5 Sep 2014 11:23:30 +0000 (16:53 +0530)
committerMinkyu Kang <mk7.kang@samsung.com>
Fri, 5 Sep 2014 11:37:07 +0000 (20:37 +0900)
Previously, we used to statically assign values for vl_col, vl_row and
vl_bpix using #defines like LCD_XRES, LCD_YRES and LCD_COLOR16.

Introducing the function exynos_lcd_early_init() would take care of this
assignment on the fly by parsing FIMD DT properties, thereby allowing us
to remove LCD_XRES and LCD_YRES from the main config file.

Signed-off-by: Ajay Kumar <ajaykumar.rs@samsung.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
arch/arm/include/asm/arch-exynos/system.h
board/samsung/common/board.c
drivers/video/exynos_fb.c
include/configs/exynos5250-dt.h
include/configs/s5pc210_universal.h
include/configs/trats.h
include/configs/trats2.h

index 7e2057ca6277977be41fc54b45398564650352fa..4968d3dd2e6cd732f4f49482a78464bea8c0d50f 100644 (file)
@@ -39,5 +39,6 @@ struct exynos5_sysreg {
 
 void set_usbhost_mode(unsigned int mode);
 void set_system_display_ctrl(void);
+int exynos_lcd_early_init(const void *blob);
 
 #endif /* _EXYNOS4_SYSTEM_H */
index 3d1cf437faab31e1159307c619661948c4738cb1..5c3c5bb9254b0bc427ab493033844f5fb1083086 100644 (file)
@@ -20,6 +20,7 @@
 #include <asm/arch/mmc.h>
 #include <asm/arch/pinmux.h>
 #include <asm/arch/power.h>
+#include <asm/arch/system.h>
 #include <power/pmic.h>
 #include <asm/arch/sromc.h>
 #include <lcd.h>
@@ -149,6 +150,21 @@ int board_early_init_f(void)
 #ifdef CONFIG_SYS_I2C_INIT_BOARD
        board_i2c_init(gd->fdt_blob);
 #endif
+
+#if defined(CONFIG_OF_CONTROL) && defined(CONFIG_EXYNOS_FB)
+/*
+ * board_init_f(arch/arm/lib/board.c) calls lcd_setmem() which needs
+ * panel_info.vl_col, panel_info.vl_row and panel_info.vl_bpix, to reserve
+ * FB memory at a very early stage. So, we need to fill panel_info.vl_col,
+ * panel_info.vl_row and panel_info.vl_bpix before lcd_setmem() is called.
+ */
+       err = exynos_lcd_early_init(gd->fdt_blob);
+       if (err) {
+               debug("LCD early init failed\n");
+               return err;
+       }
+#endif
+
        return exynos_early_init_f();
 }
 #endif
index e1e0d802f657279585a50f2410e02784d49034cd..180a3b41499dba25c9815adb57345678772482fa 100644 (file)
@@ -27,17 +27,13 @@ DECLARE_GLOBAL_DATA_PTR;
 
 static unsigned int panel_width, panel_height;
 
-/*
- * board_init_f(arch/arm/lib/board.c) calls lcd_setmem() which needs
- * panel_info.vl_col, panel_info.vl_row and panel_info.vl_bpix to reserve
- * FB memory at a very early stage, i.e even before exynos_fimd_parse_dt()
- * is called. So, we are forced to statically assign it.
- */
 #ifdef CONFIG_OF_CONTROL
 vidinfo_t panel_info  = {
-       .vl_col = LCD_XRES,
-       .vl_row = LCD_YRES,
-       .vl_bpix = LCD_COLOR16,
+       /*
+        * Insert a value here so that we don't end up in the BSS
+        * Reference: drivers/video/tegra.c
+        */
+       .vl_col = -1,
 };
 #endif
 
@@ -141,7 +137,7 @@ static void lcd_panel_on(vidinfo_t *vid)
 }
 
 #ifdef CONFIG_OF_CONTROL
-int exynos_fimd_parse_dt(const void *blob)
+int exynos_lcd_early_init(const void *blob)
 {
        unsigned int node;
        node = fdtdec_next_compatible(blob, 0, COMPAT_SAMSUNG_EXYNOS_FIMD);
@@ -286,8 +282,6 @@ void lcd_ctrl_init(void *lcdbase)
        set_lcd_clk();
 
 #ifdef CONFIG_OF_CONTROL
-       if (exynos_fimd_parse_dt(gd->fdt_blob))
-               debug("Can't get proper panel info\n");
 #ifdef CONFIG_EXYNOS_MIPI_DSIM
        exynos_init_dsim_platform_data(&panel_info);
 #endif
index 74e72a5dc1ce478ca8ff17ae98ec712f2097e608..c24984bd2b9a7f6831fae5ac991ab4dc2fb783d8 100644 (file)
@@ -61,8 +61,6 @@
 #ifdef CONFIG_LCD
 #define CONFIG_EXYNOS_FB
 #define CONFIG_EXYNOS_DP
-#define LCD_XRES                       2560
-#define LCD_YRES                       1600
 #define LCD_BPP                        LCD_COLOR16
 #endif
 
index eb046cdac92aa403197c7808b62bf2d3312a07fd..20985da9a0e4df6c2625369be434b0887d97f0a6 100644 (file)
@@ -247,7 +247,4 @@ int universal_spi_read(void);
 #define CONFIG_VIDEO_BMP_GZIP
 #define CONFIG_SYS_VIDEO_LOGO_MAX_SIZE ((500 * 160 * 4) + 54)
 
-#define LCD_XRES       480
-#define LCD_YRES       800
-
 #endif /* __CONFIG_H */
index 7db1db6074224590ea2f7119c61b8dc3ce85143c..6fa646bb8cfecd0f19ef46ac26624b315a3d193d 100644 (file)
 #define CONFIG_VIDEO_BMP_GZIP
 #define CONFIG_SYS_VIDEO_LOGO_MAX_SIZE  ((500 * 160 * 4) + 54)
 
-#define LCD_XRES       720
-#define LCD_YRES       1280
-
 #endif /* __CONFIG_H */
index f537e4fdc4c93889aaba2f80227a18b5ef61893d..14508650e46acd3455150e831f227c6a82167e6e 100644 (file)
@@ -241,7 +241,4 @@ int get_soft_i2c_sda_pin(void);
 #define CONFIG_VIDEO_BMP_GZIP
 #define CONFIG_SYS_VIDEO_LOGO_MAX_SIZE ((500 * 160 * 4) + 54)
 
-#define LCD_XRES       720
-#define LCD_YRES       1280
-
 #endif /* __CONFIG_H */