samsung: common: Add file for common functions, draw_logo() cleanup.
authorPrzemyslaw Marczak <p.marczak@samsung.com>
Wed, 22 Jan 2014 10:24:12 +0000 (11:24 +0100)
committerMinkyu Kang <mk7.kang@samsung.com>
Mon, 3 Feb 2014 06:36:14 +0000 (15:36 +0900)
Changes:

new file:
- board/samsung/common/misc.c
  depends on: CONFIG_MISC_COMMON
- move draw_logo() to misc.c

configs: trats, trats2, universal:
- enable CONFIG_MISC_COMMON,
- enable CONFIG_MISC_INIT_R,
- add misc_init_r() and call draw_logo() in it.

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
board/samsung/common/Makefile
board/samsung/common/misc.c [new file with mode: 0644]
board/samsung/trats/trats.c
board/samsung/trats2/trats2.c
board/samsung/universal_c210/universal.c
drivers/video/exynos_fb.c
include/configs/s5pc210_universal.h
include/configs/trats.h
include/configs/trats2.h
include/samsung/misc.h [new file with mode: 0644]

index 22bd6b197e5a954ce734c2cc76a2fac8ff7bff9e..7d2bb8c4a2f3f9c0d041ce83fc5669e488166a09 100644 (file)
@@ -8,6 +8,7 @@
 obj-$(CONFIG_SOFT_I2C_MULTI_BUS) += multi_i2c.o
 obj-$(CONFIG_THOR_FUNCTION) += thor.o
 obj-$(CONFIG_CMD_USB_MASS_STORAGE) += ums.o
+obj-$(CONFIG_MISC_COMMON) += misc.o
 
 ifndef CONFIG_SPL_BUILD
 obj-$(CONFIG_BOARD_COMMON)     += board.o
diff --git a/board/samsung/common/misc.c b/board/samsung/common/misc.c
new file mode 100644 (file)
index 0000000..f6be891
--- /dev/null
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2013 Samsung Electronics
+ * Przemyslaw Marczak <p.marczak@samsung.com>
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
+#include <common.h>
+#include <lcd.h>
+#include <libtizen.h>
+#include <samsung/misc.h>
+
+#ifdef CONFIG_CMD_BMP
+void draw_logo(void)
+{
+       int x, y;
+       ulong addr;
+
+       addr = panel_info.logo_addr;
+       if (!addr) {
+               error("There is no logo data.");
+               return;
+       }
+
+       if (panel_info.vl_width >= panel_info.logo_width) {
+               x = ((panel_info.vl_width - panel_info.logo_width) >> 1);
+       } else {
+               x = 0;
+               printf("Warning: image width is bigger than display width\n");
+       }
+
+       if (panel_info.vl_height >= panel_info.logo_height) {
+               y = ((panel_info.vl_height - panel_info.logo_height) >> 1);
+       } else {
+               y = 0;
+               printf("Warning: image height is bigger than display height\n");
+       }
+
+       bmp_display(addr, x, y);
+}
+#endif /* CONFIG_CMD_BMP */
index 640a193dc21bb92d91b4814e049c12c35df1638a..a644b608cdb4dfe83bee1e905bcb8dff827bce20 100644 (file)
@@ -786,3 +786,14 @@ void init_panel_info(vidinfo_t *vid)
 
        setenv("lcdinfo", "lcd=s6e8ax0");
 }
+
+#ifdef CONFIG_MISC_INIT_R
+int misc_init_r(void)
+{
+#ifdef CONFIG_CMD_BMP
+       if (panel_info.logo_on)
+               draw_logo();
+#endif
+       return 0;
+}
+#endif
index feb6c4cccd237744f3d42d51a372a37bd38e761d..4834f9010d74139e3cee463f409ba31027542b9c 100644 (file)
@@ -615,6 +615,10 @@ void init_panel_info(vidinfo_t *vid)
 #ifdef CONFIG_MISC_INIT_R
 int misc_init_r(void)
 {
+#ifdef CONFIG_CMD_BMP
+       if (panel_info.logo_on)
+               draw_logo();
+#endif
        return 0;
 }
 #endif
index 3feef3f7777381ed75b39fb7d01848c16c61cfa0..2b8c69be1d0952d237ab942e6fec4e12c2846c9b 100644 (file)
@@ -511,3 +511,14 @@ int board_init(void)
 
        return 0;
 }
+
+#ifdef CONFIG_MISC_INIT_R
+int misc_init_r(void)
+{
+#ifdef CONFIG_CMD_BMP
+       if (panel_info.logo_on)
+               draw_logo();
+#endif
+       return 0;
+}
+#endif
index 7d4c6e092df53c7ba339036e0701af9aa6894beb..00a0a11ed4e750ad62eec9b5c5f0ceba7d9fd2e8 100644 (file)
@@ -62,31 +62,6 @@ static void exynos_lcd_init(vidinfo_t *vid)
        lcd_set_flush_dcache(1);
 }
 
-#ifdef CONFIG_CMD_BMP
-static void draw_logo(void)
-{
-       int x, y;
-       ulong addr;
-
-       if (panel_width >= panel_info.logo_width) {
-               x = ((panel_width - panel_info.logo_width) >> 1);
-       } else {
-               x = 0;
-               printf("Warning: image width is bigger than display width\n");
-       }
-
-       if (panel_height >= panel_info.logo_height) {
-               y = ((panel_height - panel_info.logo_height) >> 1) - 4;
-       } else {
-               y = 0;
-               printf("Warning: image height is bigger than display height\n");
-       }
-
-       addr = panel_info.logo_addr;
-       bmp_display(addr, x, y);
-}
-#endif
-
 void __exynos_cfg_lcd_gpio(void)
 {
 }
@@ -323,9 +298,6 @@ void lcd_enable(void)
        if (panel_info.logo_on) {
                memset((void *) gd->fb_base, 0, panel_width * panel_height *
                                (NBITS(panel_info.vl_bpix) >> 3));
-#ifdef CONFIG_CMD_BMP
-               draw_logo();
-#endif
        }
 
        lcd_panel_on(&panel_info);
index 02a1c99a831455ca960bd66c9f7bef9a6549ec2e..6b98bed7b4f5be5291d3c3224457ea0c5d5db24e 100644 (file)
@@ -269,6 +269,11 @@ void universal_spi_sda(int bit);
 int universal_spi_read(void);
 #endif
 
+/* Common misc for Samsung */
+#define CONFIG_MISC_COMMON
+
+#define CONFIG_MISC_INIT_R
+
 /*
  * LCD Settings
  */
index 9a927837963e71d20805ee1ed1775391f9e876a4..7a9c60b34914d6d53f36fa0fe238ee3311bdd268 100644 (file)
 #define CONFIG_USB_GADGET_VBUS_DRAW    2
 #define CONFIG_USB_CABLE_CHECK
 
+/* Common misc for Samsung */
+#define CONFIG_MISC_COMMON
+
+#define CONFIG_MISC_INIT_R
+
 /* LCD */
 #define CONFIG_EXYNOS_FB
 #define CONFIG_LCD
index 83633b074d5012114c2c7c25508e6a378ec6a3a7..b4ca1ff8570e8e61198c1af186e88abe05f8c955 100644 (file)
 #define CONFIG_EFI_PARTITION
 #define CONFIG_PARTITION_UUIDS
 
-#define CONFIG_MISC_INIT_R
 #define CONFIG_BOARD_EARLY_INIT_F
 
 /* I2C */
@@ -318,6 +317,11 @@ int get_soft_i2c_sda_pin(void);
 #define CONFIG_USB_GADGET_VBUS_DRAW    2
 #define CONFIG_USB_CABLE_CHECK
 
+/* Common misc for Samsung */
+#define CONFIG_MISC_COMMON
+
+#define CONFIG_MISC_INIT_R
+
 /* LCD */
 #define CONFIG_EXYNOS_FB
 #define CONFIG_LCD
diff --git a/include/samsung/misc.h b/include/samsung/misc.h
new file mode 100644 (file)
index 0000000..8ea9223
--- /dev/null
@@ -0,0 +1,8 @@
+#ifndef __SAMSUNG_MISC_COMMON_H__
+#define __SAMSUNG_MISC_COMMON_H__
+
+#ifdef CONFIG_CMD_BMP
+void draw_logo(void);
+#endif
+
+#endif /* __SAMSUNG_MISC_COMMON_H__ */