[U-Boot] [PATCH v2 11/29] Convert CONFIG_SYS_CONSOLE_BG_COL et al to Kconfig

Simon Glass sjg at chromium.org
Sun Sep 25 02:17:07 CEST 2016


This converts the following to Kconfig:
   CONFIG_SYS_CONSOLE_BG_COL
   CONFIG_SYS_CONSOLE_FG_COL

Signed-off-by: Simon Glass <sjg at chromium.org>
Reviewed-by: Tom Rini <trini at konsulko.com>
---

Changes in v2: None

 README                       |  5 ---
 configs/pxm2_defconfig       |  2 +
 configs/rut_defconfig        |  2 +
 drivers/video/Kconfig        | 22 ++++++++++
 drivers/video/cfb_console.c  | 98 ++++++++++++++++++++++----------------------
 drivers/video/ct69000.c      |  3 +-
 include/configs/pxm2.h       |  2 -
 include/configs/rut.h        |  2 -
 include/video_fb.h           |  8 ----
 scripts/config_whitelist.txt |  2 -
 10 files changed, 78 insertions(+), 68 deletions(-)

diff --git a/README b/README
index 5df8b6b..e1d4dfc 100644
--- a/README
+++ b/README
@@ -810,11 +810,6 @@ The following options need to be configured:
 		port routines must be defined elsewhere
 		(i.e. serial_init(), serial_getc(), ...)
 
-		CONFIG_SYS_CONSOLE_BG_COL: define the backgroundcolor, default
-			is 0x00.
-		CONFIG_SYS_CONSOLE_FG_COL: define the foregroundcolor, default
-			is 0xa0.
-
 - Console Baudrate:
 		CONFIG_BAUDRATE - in bps
 		Select one of the baudrates listed in
diff --git a/configs/pxm2_defconfig b/configs/pxm2_defconfig
index bc7245c..bfac212 100644
--- a/configs/pxm2_defconfig
+++ b/configs/pxm2_defconfig
@@ -56,3 +56,5 @@ CONFIG_G_DNL_MANUFACTURER="Siemens AG"
 CONFIG_G_DNL_VENDOR_NUM=0x0908
 CONFIG_G_DNL_PRODUCT_NUM=0x02d2
 CONFIG_CFB_CONSOLE=y
+CONFIG_SYS_CONSOLE_BG_COL=0xff
+CONFIG_SYS_CONSOLE_FG_COL=0x00
diff --git a/configs/rut_defconfig b/configs/rut_defconfig
index 870f928..eda5d7b 100644
--- a/configs/rut_defconfig
+++ b/configs/rut_defconfig
@@ -56,3 +56,5 @@ CONFIG_G_DNL_MANUFACTURER="Siemens AG"
 CONFIG_G_DNL_VENDOR_NUM=0x0908
 CONFIG_G_DNL_PRODUCT_NUM=0x02d2
 CONFIG_CFB_CONSOLE=y
+CONFIG_SYS_CONSOLE_BG_COL=0xff
+CONFIG_SYS_CONSOLE_FG_COL=0x00
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
index 20ae11e..de6f419 100644
--- a/drivers/video/Kconfig
+++ b/drivers/video/Kconfig
@@ -498,4 +498,26 @@ config VIDEO_CT69000
 		- "videomode=bootargs" all the video parameters are parsed
 		from the bootargs. (See drivers/video/videomodes.c)
 
+config SYS_CONSOLE_BG_COL
+	hex "Background colour"
+	depends on CFB_CONSOLE || VIDEO_CT69000
+	default 0x00
+	help
+	  Defines the background colour for the console. The value is from
+	  0x00 to 0xff and the meaning depends on the graphics card.
+	  Typically, 0x00 means black and 0xff means white. Do not set
+	  the background and foreground to the same colour or you will see
+	  nothing.
+
+config SYS_CONSOLE_FG_COL
+	hex "Foreground colour"
+	depends on CFB_CONSOLE || VIDEO_CT69000
+	default 0xa0
+	help
+	  Defines the foreground colour for the console. The value is from
+	  0x00 to 0xff and the meaning depends on the graphics card.
+	  Typically, 0x00 means black and 0xff means white. Do not set
+	  the background and foreground to the same colour or you will see
+	  nothing.
+
 endmenu
diff --git a/drivers/video/cfb_console.c b/drivers/video/cfb_console.c
index 30b53db..949187c 100644
--- a/drivers/video/cfb_console.c
+++ b/drivers/video/cfb_console.c
@@ -2093,70 +2093,72 @@ static int video_init(void)
 	/* Init drawing pats */
 	switch (VIDEO_DATA_FORMAT) {
 	case GDF__8BIT_INDEX:
-		video_set_lut(0x01, CONSOLE_FG_COL, CONSOLE_FG_COL,
-			      CONSOLE_FG_COL);
-		video_set_lut(0x00, CONSOLE_BG_COL, CONSOLE_BG_COL,
-			      CONSOLE_BG_COL);
+		video_set_lut(0x01, CONFIG_SYS_CONSOLE_FG_COL,
+			      CONFIG_SYS_CONSOLE_FG_COL,
+			      CONFIG_SYS_CONSOLE_FG_COL);
+		video_set_lut(0x00, CONFIG_SYS_CONSOLE_BG_COL,
+			      CONFIG_SYS_CONSOLE_BG_COL,
+			      CONFIG_SYS_CONSOLE_BG_COL);
 		fgx = 0x01010101;
 		bgx = 0x00000000;
 		break;
 	case GDF__8BIT_332RGB:
-		color8 = ((CONSOLE_FG_COL & 0xe0) |
-			  ((CONSOLE_FG_COL >> 3) & 0x1c) |
-			  CONSOLE_FG_COL >> 6);
+		color8 = ((CONFIG_SYS_CONSOLE_FG_COL & 0xe0) |
+			  ((CONFIG_SYS_CONSOLE_FG_COL >> 3) & 0x1c) |
+			  CONFIG_SYS_CONSOLE_FG_COL >> 6);
 		fgx = (color8 << 24) | (color8 << 16) | (color8 << 8) |
 			color8;
-		color8 = ((CONSOLE_BG_COL & 0xe0) |
-			  ((CONSOLE_BG_COL >> 3) & 0x1c) |
-			  CONSOLE_BG_COL >> 6);
+		color8 = ((CONFIG_SYS_CONSOLE_BG_COL & 0xe0) |
+			  ((CONFIG_SYS_CONSOLE_BG_COL >> 3) & 0x1c) |
+			  CONFIG_SYS_CONSOLE_BG_COL >> 6);
 		bgx = (color8 << 24) | (color8 << 16) | (color8 << 8) |
 			color8;
 		break;
 	case GDF_15BIT_555RGB:
-		fgx = (((CONSOLE_FG_COL >> 3) << 26) |
-		       ((CONSOLE_FG_COL >> 3) << 21) |
-		       ((CONSOLE_FG_COL >> 3) << 16) |
-		       ((CONSOLE_FG_COL >> 3) << 10) |
-		       ((CONSOLE_FG_COL >> 3) <<  5) |
-			(CONSOLE_FG_COL >> 3));
-		bgx = (((CONSOLE_BG_COL >> 3) << 26) |
-		       ((CONSOLE_BG_COL >> 3) << 21) |
-		       ((CONSOLE_BG_COL >> 3) << 16) |
-		       ((CONSOLE_BG_COL >> 3) << 10) |
-		       ((CONSOLE_BG_COL >> 3) <<  5) |
-			(CONSOLE_BG_COL >> 3));
+		fgx = (((CONFIG_SYS_CONSOLE_FG_COL >> 3) << 26) |
+		       ((CONFIG_SYS_CONSOLE_FG_COL >> 3) << 21) |
+		       ((CONFIG_SYS_CONSOLE_FG_COL >> 3) << 16) |
+		       ((CONFIG_SYS_CONSOLE_FG_COL >> 3) << 10) |
+		       ((CONFIG_SYS_CONSOLE_FG_COL >> 3) <<  5) |
+			(CONFIG_SYS_CONSOLE_FG_COL >> 3));
+		bgx = (((CONFIG_SYS_CONSOLE_BG_COL >> 3) << 26) |
+		       ((CONFIG_SYS_CONSOLE_BG_COL >> 3) << 21) |
+		       ((CONFIG_SYS_CONSOLE_BG_COL >> 3) << 16) |
+		       ((CONFIG_SYS_CONSOLE_BG_COL >> 3) << 10) |
+		       ((CONFIG_SYS_CONSOLE_BG_COL >> 3) <<  5) |
+			(CONFIG_SYS_CONSOLE_BG_COL >> 3));
 		break;
 	case GDF_16BIT_565RGB:
-		fgx = (((CONSOLE_FG_COL >> 3) << 27) |
-		       ((CONSOLE_FG_COL >> 2) << 21) |
-		       ((CONSOLE_FG_COL >> 3) << 16) |
-		       ((CONSOLE_FG_COL >> 3) << 11) |
-		       ((CONSOLE_FG_COL >> 2) <<  5) |
-			(CONSOLE_FG_COL >> 3));
-		bgx = (((CONSOLE_BG_COL >> 3) << 27) |
-		       ((CONSOLE_BG_COL >> 2) << 21) |
-		       ((CONSOLE_BG_COL >> 3) << 16) |
-		       ((CONSOLE_BG_COL >> 3) << 11) |
-		       ((CONSOLE_BG_COL >> 2) <<  5) |
-			(CONSOLE_BG_COL >> 3));
+		fgx = (((CONFIG_SYS_CONSOLE_FG_COL >> 3) << 27) |
+		       ((CONFIG_SYS_CONSOLE_FG_COL >> 2) << 21) |
+		       ((CONFIG_SYS_CONSOLE_FG_COL >> 3) << 16) |
+		       ((CONFIG_SYS_CONSOLE_FG_COL >> 3) << 11) |
+		       ((CONFIG_SYS_CONSOLE_FG_COL >> 2) <<  5) |
+			(CONFIG_SYS_CONSOLE_FG_COL >> 3));
+		bgx = (((CONFIG_SYS_CONSOLE_BG_COL >> 3) << 27) |
+		       ((CONFIG_SYS_CONSOLE_BG_COL >> 2) << 21) |
+		       ((CONFIG_SYS_CONSOLE_BG_COL >> 3) << 16) |
+		       ((CONFIG_SYS_CONSOLE_BG_COL >> 3) << 11) |
+		       ((CONFIG_SYS_CONSOLE_BG_COL >> 2) <<  5) |
+			(CONFIG_SYS_CONSOLE_BG_COL >> 3));
 		break;
 	case GDF_32BIT_X888RGB:
-		fgx =	(CONSOLE_FG_COL << 16) |
-			(CONSOLE_FG_COL <<  8) |
-			 CONSOLE_FG_COL;
-		bgx =	(CONSOLE_BG_COL << 16) |
-			(CONSOLE_BG_COL <<  8) |
-			 CONSOLE_BG_COL;
+		fgx =	(CONFIG_SYS_CONSOLE_FG_COL << 16) |
+			(CONFIG_SYS_CONSOLE_FG_COL <<  8) |
+			 CONFIG_SYS_CONSOLE_FG_COL;
+		bgx =	(CONFIG_SYS_CONSOLE_BG_COL << 16) |
+			(CONFIG_SYS_CONSOLE_BG_COL <<  8) |
+			 CONFIG_SYS_CONSOLE_BG_COL;
 		break;
 	case GDF_24BIT_888RGB:
-		fgx =	(CONSOLE_FG_COL << 24) |
-			(CONSOLE_FG_COL << 16) |
-			(CONSOLE_FG_COL <<  8) |
-			 CONSOLE_FG_COL;
-		bgx =	(CONSOLE_BG_COL << 24) |
-			(CONSOLE_BG_COL << 16) |
-			(CONSOLE_BG_COL <<  8) |
-			 CONSOLE_BG_COL;
+		fgx =	(CONFIG_SYS_CONSOLE_FG_COL << 24) |
+			(CONFIG_SYS_CONSOLE_FG_COL << 16) |
+			(CONFIG_SYS_CONSOLE_FG_COL <<  8) |
+			 CONFIG_SYS_CONSOLE_FG_COL;
+		bgx =	(CONFIG_SYS_CONSOLE_BG_COL << 24) |
+			(CONFIG_SYS_CONSOLE_BG_COL << 16) |
+			(CONFIG_SYS_CONSOLE_BG_COL <<  8) |
+			 CONFIG_SYS_CONSOLE_BG_COL;
 		break;
 	}
 	eorx = fgx ^ bgx;
diff --git a/drivers/video/ct69000.c b/drivers/video/ct69000.c
index 22b3441..349da5e 100644
--- a/drivers/video/ct69000.c
+++ b/drivers/video/ct69000.c
@@ -870,7 +870,8 @@ video_init_hw_cursor (int font_width, int font_height)
 	xr_80 = ctRead_i (CT_XR_O, 0x80);
 	xr_80 |= 0x1;		/* alternate palette select */
 	ctWrite_i (CT_XR_O, 0x80, xr_80);
-	video_set_lut (4, CONSOLE_FG_COL, CONSOLE_FG_COL, CONSOLE_FG_COL);
+	video_set_lut(4, CONFIG_SYS_CONSOLE_FG_COL, CONFIG_SYS_CONSOLE_FG_COL,
+		      CONFIG_SYS_CONSOLE_FG_COL);
 	/* position 4 is color 0 cursor 0 */
 	xr_80 &= 0xfe;		/* normal palette select */
 	ctWrite_i (CT_XR_O, 0x80, xr_80);
diff --git a/include/configs/pxm2.h b/include/configs/pxm2.h
index ba14593..6cc8d6c 100644
--- a/include/configs/pxm2.h
+++ b/include/configs/pxm2.h
@@ -136,8 +136,6 @@
 #define DA8XX_LCD_CNTL_BASE	LCD_CNTL_BASE
 #define PWM_TICKS	0x1388
 #define PWM_DUTY	0x200
-#define CONFIG_SYS_CONSOLE_BG_COL	0xff
-#define CONFIG_SYS_CONSOLE_FG_COL	0x00
 #endif
 
 #endif	/* ! __CONFIG_PXM2_H */
diff --git a/include/configs/rut.h b/include/configs/rut.h
index ca812e4..11f9a25 100644
--- a/include/configs/rut.h
+++ b/include/configs/rut.h
@@ -136,8 +136,6 @@
 #define CONFIG_ARCH_EARLY_INIT_R
 #define CONFIG_FORMIKE
 #define DISPL_PLL_SPREAD_SPECTRUM
-#define CONFIG_SYS_CONSOLE_BG_COL	0xff
-#define CONFIG_SYS_CONSOLE_FG_COL	0x00
 #endif
 
 #endif	/* ! __CONFIG_RUT_H */
diff --git a/include/video_fb.h b/include/video_fb.h
index 55ec24d..b7e3aee 100644
--- a/include/video_fb.h
+++ b/include/video_fb.h
@@ -18,14 +18,6 @@
 #ifndef _VIDEO_FB_H_
 #define _VIDEO_FB_H_
 
-#if defined(CONFIG_SYS_CONSOLE_FG_COL) && defined(CONFIG_SYS_CONSOLE_BG_COL)
-#define CONSOLE_BG_COL            CONFIG_SYS_CONSOLE_BG_COL
-#define CONSOLE_FG_COL            CONFIG_SYS_CONSOLE_FG_COL
-#else
-#define CONSOLE_BG_COL            0x00
-#define CONSOLE_FG_COL            0xa0
-#endif
-
 /*
  * Graphic Data Format (GDF) bits for VIDEO_DATA_FORMAT
  */
diff --git a/scripts/config_whitelist.txt b/scripts/config_whitelist.txt
index e5730b3..7eca0f4 100644
--- a/scripts/config_whitelist.txt
+++ b/scripts/config_whitelist.txt
@@ -4620,9 +4620,7 @@ CONFIG_SYS_CMXFCR_VALUE1
 CONFIG_SYS_CMXFCR_VALUE2
 CONFIG_SYS_CMXFCR_VALUE3
 CONFIG_SYS_CMXSCR_VALUE
-CONFIG_SYS_CONSOLE_BG_COL
 CONFIG_SYS_CONSOLE_ENV_OVERWRITE
-CONFIG_SYS_CONSOLE_FG_COL
 CONFIG_SYS_CONSOLE_INFO_QUIET
 CONFIG_SYS_CONSOLE_OVERWRITE_ROUTINE
 CONFIG_SYS_CORE_SRAM
-- 
2.8.0.rc3.226.g39d4020



More information about the U-Boot mailing list