[U-Boot] [PATCH v6 03/11] samsung: common: Add file for common functions, draw_logo() cleanup.

Przemyslaw Marczak p.marczak at samsung.com
Wed Jan 22 11:24:12 CET 2014


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 at samsung.com>
---
Changes v2:
- change CONFIG_SAMSUNG to CONFIG_MISC_INIT_R

Changes v3:
- fix merge conflict in board/samsung/common/Makefile

Changes v4:
- none

Changes v5:
- add acked-by

Changes v6:
- move board/samsung/common/misc.h to include/samsung/misc.h
- squash with v5 commit: "samsung: misc: move display logo function
  to misc.c file."
- change config name to CONFIG_MISC_COMMON in board/samsung/common/Makefile
- trats, trats2, universal - call draw logo() in misc_init_r()

 board/samsung/common/Makefile            |    1 +
 board/samsung/common/misc.c              |   41 ++++++++++++++++++++++++++++++
 board/samsung/trats/trats.c              |   11 ++++++++
 board/samsung/trats2/trats2.c            |    4 +++
 board/samsung/universal_c210/universal.c |   11 ++++++++
 drivers/video/exynos_fb.c                |   28 --------------------
 include/configs/s5pc210_universal.h      |    5 ++++
 include/configs/trats.h                  |    5 ++++
 include/configs/trats2.h                 |    6 ++++-
 include/samsung/misc.h                   |    8 ++++++
 10 files changed, 91 insertions(+), 29 deletions(-)
 create mode 100644 board/samsung/common/misc.c
 create mode 100644 include/samsung/misc.h

diff --git a/board/samsung/common/Makefile b/board/samsung/common/Makefile
index 22bd6b1..7d2bb8c 100644
--- a/board/samsung/common/Makefile
+++ b/board/samsung/common/Makefile
@@ -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
index 0000000..f6be891
--- /dev/null
+++ b/board/samsung/common/misc.c
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2013 Samsung Electronics
+ * Przemyslaw Marczak <p.marczak at 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 */
diff --git a/board/samsung/trats/trats.c b/board/samsung/trats/trats.c
index 640a193..a644b60 100644
--- a/board/samsung/trats/trats.c
+++ b/board/samsung/trats/trats.c
@@ -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
diff --git a/board/samsung/trats2/trats2.c b/board/samsung/trats2/trats2.c
index feb6c4c..4834f90 100644
--- a/board/samsung/trats2/trats2.c
+++ b/board/samsung/trats2/trats2.c
@@ -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
diff --git a/board/samsung/universal_c210/universal.c b/board/samsung/universal_c210/universal.c
index 54d0e1e..1c8b8b8 100644
--- a/board/samsung/universal_c210/universal.c
+++ b/board/samsung/universal_c210/universal.c
@@ -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
diff --git a/drivers/video/exynos_fb.c b/drivers/video/exynos_fb.c
index 7d4c6e0..00a0a11 100644
--- a/drivers/video/exynos_fb.c
+++ b/drivers/video/exynos_fb.c
@@ -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);
diff --git a/include/configs/s5pc210_universal.h b/include/configs/s5pc210_universal.h
index 02a1c99..6b98bed 100644
--- a/include/configs/s5pc210_universal.h
+++ b/include/configs/s5pc210_universal.h
@@ -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
  */
diff --git a/include/configs/trats.h b/include/configs/trats.h
index 6480424..0b93e03 100644
--- a/include/configs/trats.h
+++ b/include/configs/trats.h
@@ -302,6 +302,11 @@
 #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/configs/trats2.h b/include/configs/trats2.h
index c9ce828..8ba8a0f 100644
--- a/include/configs/trats2.h
+++ b/include/configs/trats2.h
@@ -272,7 +272,6 @@
 #define CONFIG_EFI_PARTITION
 #define CONFIG_PARTITION_UUIDS
 
-#define CONFIG_MISC_INIT_R
 #define CONFIG_BOARD_EARLY_INIT_F
 
 /* I2C */
@@ -313,6 +312,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
index 0000000..8ea9223
--- /dev/null
+++ b/include/samsung/misc.h
@@ -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__ */
-- 
1.7.9.5



More information about the U-Boot mailing list