[U-Boot] [PATCH 09/28] video: Drop unused console functions

Simon Glass sjg at chromium.org
Wed Sep 9 06:32:32 CEST 2015


CONFIG_CONSOLE_CURSOR, CONFIG_SYS_CONSOLE_BLINK_COUNT and
CONFIG_CONSOLE_TIME are not used by any board. The implementation is not
great and stands in the way of a refactor of i8042. Drop these for now.
They can be re-introduced quite easily later, perhaps with driver model
RTC support.

When reintroducing, it might be useful to make a few changes:
- Blink time would be more useful than blink count
- The confusing #ifdefs should be avoided
- The time functions should support driver model
- It would be best keyed off console_tstc() or some similar idle loop
    rather than a particular input driver (i8042 in this case)

Signed-off-by: Simon Glass <sjg at chromium.org>
---

 README                        |  7 -----
 drivers/input/i8042.c         | 23 ----------------
 drivers/video/cfb_console.c   | 62 +++++++------------------------------------
 include/configs/MPC8536DS.h   |  1 -
 include/configs/MPC8544DS.h   |  1 -
 include/configs/MPC8572DS.h   |  1 -
 include/configs/MPC8641HPCN.h |  1 -
 7 files changed, 9 insertions(+), 87 deletions(-)

diff --git a/README b/README
index 08f2f70..54c1d08 100644
--- a/README
+++ b/README
@@ -890,13 +890,6 @@ The following options need to be configured:
 						(i.e. i8042_tstc)
 			VIDEO_GETC_FCT		get char fct
 						(i.e. i8042_getc)
-			CONFIG_CONSOLE_CURSOR	cursor drawing on/off
-						(requires blink timer
-						cf. i8042.c)
-			CONFIG_SYS_CONSOLE_BLINK_COUNT blink interval (cf. i8042.c)
-			CONFIG_CONSOLE_TIME	display time/date info in
-						upper right corner
-						(requires CONFIG_CMD_DATE)
 			CONFIG_VIDEO_LOGO	display Linux logo in
 						upper left corner
 			CONFIG_VIDEO_BMP_LOGO	use bmp_logo.h instead of
diff --git a/drivers/input/i8042.c b/drivers/input/i8042.c
index 9b5fa32..7b95b21 100644
--- a/drivers/input/i8042.c
+++ b/drivers/input/i8042.c
@@ -17,12 +17,6 @@
 #define in8(p)		inb(p)
 #define out8(p, v)	outb(v, p)
 
-#ifdef CONFIG_CONSOLE_CURSOR
-extern void console_cursor(int state);
-static int blink_count = CONFIG_SYS_CONSOLE_BLINK_COUNT;
-static int cursor_state;
-#endif
-
 /* locals */
 
 static int kbd_input = -1;		/* no input yet */
@@ -598,15 +592,6 @@ int i8042_tstc(struct stdio_dev *dev)
 {
 	unsigned char scan_code = 0;
 
-#ifdef CONFIG_CONSOLE_CURSOR
-	if (--blink_count == 0) {
-		cursor_state ^= 1;
-		console_cursor(cursor_state);
-		blink_count = CONFIG_SYS_CONSOLE_BLINK_COUNT;
-		udelay(10);
-	}
-#endif
-
 	if ((in8(I8042_STS_REG) & STATUS_OBF) == 0) {
 		return 0;
 	} else {
@@ -635,14 +620,6 @@ int i8042_getc(struct stdio_dev *dev)
 
 	while (kbd_input == -1) {
 		while ((in8(I8042_STS_REG) & STATUS_OBF) == 0) {
-#ifdef CONFIG_CONSOLE_CURSOR
-			if (--blink_count == 0) {
-				cursor_state ^= 1;
-				console_cursor(cursor_state);
-				blink_count = CONFIG_SYS_CONSOLE_BLINK_COUNT;
-			}
-			udelay(10);
-#endif
 		}
 		scan_code = in8(I8042_DATA_REG);
 		if (scan_code != 0xfa)
diff --git a/drivers/video/cfb_console.c b/drivers/video/cfb_console.c
index aa7ca86..1b5c3e0 100644
--- a/drivers/video/cfb_console.c
+++ b/drivers/video/cfb_console.c
@@ -43,13 +43,6 @@
  * VIDEO_TSTC_FCT	      - keyboard_tstc function
  * VIDEO_GETC_FCT	      - keyboard_getc function
  *
- * CONFIG_CONSOLE_CURSOR      - on/off drawing cursor is done with
- *				delay loop in VIDEO_TSTC_FCT (i8042)
- *
- * CONFIG_SYS_CONSOLE_BLINK_COUNT - value for delay loop - blink rate
- * CONFIG_CONSOLE_TIME	      - display time/date in upper right
- *				corner, needs CONFIG_CMD_DATE and
- *				CONFIG_CONSOLE_CURSOR
  * CONFIG_VIDEO_LOGO	      - display Linux Logo in upper left corner.
  *				Use CONFIG_SPLASH_SCREEN_ALIGN with
  *				environment variable "splashpos" to place
@@ -198,9 +191,6 @@
 
 /*
  * Cursor definition:
- * CONFIG_CONSOLE_CURSOR:  Uses a timer function (see drivers/input/i8042.c)
- *			   to let the cursor blink. Uses the macros
- *			   CURSOR_OFF and CURSOR_ON.
  * CONFIG_VIDEO_SW_CURSOR: Draws a cursor after the last character. No
  *			   blinking is provided. Uses the macros CURSOR_SET
  *			   and CURSOR_OFF.
@@ -210,42 +200,29 @@
  *			   must disable the hardware register of the graphic
  *			   chip. Otherwise a blinking field is displayed
  */
-#if !defined(CONFIG_CONSOLE_CURSOR) && \
-    !defined(CONFIG_VIDEO_SW_CURSOR) && \
-    !defined(CONFIG_VIDEO_HW_CURSOR)
+#if !defined(CONFIG_VIDEO_SW_CURSOR) && !defined(CONFIG_VIDEO_HW_CURSOR)
 /* no Cursor defined */
 #define CURSOR_ON
 #define CURSOR_OFF
 #define CURSOR_SET
 #endif
 
-#if defined(CONFIG_CONSOLE_CURSOR) || defined(CONFIG_VIDEO_SW_CURSOR)
-#if defined(CURSOR_ON) || \
-	(defined(CONFIG_CONSOLE_CURSOR) && defined(CONFIG_VIDEO_SW_CURSOR))
-#error	only one of CONFIG_CONSOLE_CURSOR, CONFIG_VIDEO_SW_CURSOR, \
-	or CONFIG_VIDEO_HW_CURSOR can be defined
+#if defined(CONFIG_VIDEO_SW_CURSOR)
+#if defined(CONFIG_VIDEO_HW_CURSOR)
+#error	only one of CONFIG_VIDEO_SW_CURSOR or CONFIG_VIDEO_HW_CURSOR can be \
+	defined
 #endif
 void console_cursor(int state);
 
 #define CURSOR_ON  console_cursor(1)
 #define CURSOR_OFF console_cursor(0)
 #define CURSOR_SET video_set_cursor()
-#endif /* CONFIG_CONSOLE_CURSOR || CONFIG_VIDEO_SW_CURSOR */
-
-#ifdef	CONFIG_CONSOLE_CURSOR
-#ifndef	CONFIG_CONSOLE_TIME
-#error	CONFIG_CONSOLE_CURSOR must be defined for CONFIG_CONSOLE_TIME
-#endif
-#ifndef CONFIG_I8042_KBD
-#warning Cursor drawing on/off needs timer function s.a. drivers/input/i8042.c
-#endif
-#endif /* CONFIG_CONSOLE_CURSOR */
-
+#endif /* CONFIG_VIDEO_SW_CURSOR */
 
 #ifdef CONFIG_VIDEO_HW_CURSOR
 #ifdef	CURSOR_ON
-#error	only one of CONFIG_CONSOLE_CURSOR, CONFIG_VIDEO_SW_CURSOR, \
-	or CONFIG_VIDEO_HW_CURSOR can be defined
+#error	only one of CONFIG_VIDEO_SW_CURSOR or CONFIG_VIDEO_HW_CURSOR can be \
+	defined
 #endif
 #define CURSOR_ON
 #define CURSOR_OFF
@@ -626,7 +603,7 @@ static void video_putchar(int xx, int yy, unsigned char c)
 	video_drawchars(xx, yy + video_logo_height, &c, 1);
 }
 
-#if defined(CONFIG_CONSOLE_CURSOR) || defined(CONFIG_VIDEO_SW_CURSOR)
+#if defined(CONFIG_VIDEO_SW_CURSOR)
 static void video_set_cursor(void)
 {
 	if (cursor_state)
@@ -651,27 +628,6 @@ static void video_invertchar(int xx, int yy)
 
 void console_cursor(int state)
 {
-#ifdef CONFIG_CONSOLE_TIME
-	struct rtc_time tm;
-	char info[16];
-
-	/* time update only if cursor is on (faster scroll) */
-	if (state) {
-		rtc_get(&tm);
-
-		sprintf(info, " %02d:%02d:%02d ", tm.tm_hour, tm.tm_min,
-			tm.tm_sec);
-		video_drawstring(VIDEO_VISIBLE_COLS - 10 * VIDEO_FONT_WIDTH,
-				 VIDEO_INFO_Y, (uchar *) info);
-
-		sprintf(info, "%02d.%02d.%04d", tm.tm_mday, tm.tm_mon,
-			tm.tm_year);
-		video_drawstring(VIDEO_VISIBLE_COLS - 10 * VIDEO_FONT_WIDTH,
-				 VIDEO_INFO_Y + 1 * VIDEO_FONT_HEIGHT,
-				 (uchar *) info);
-	}
-#endif
-
 	if (cursor_state != state) {
 		if (cursor_state) {
 			/* turn off the cursor */
diff --git a/include/configs/MPC8536DS.h b/include/configs/MPC8536DS.h
index 1312438..fad7215 100644
--- a/include/configs/MPC8536DS.h
+++ b/include/configs/MPC8536DS.h
@@ -533,7 +533,6 @@
 #define CONFIG_VGA_AS_SINGLE_DEVICE
 #define CONFIG_ATI_RADEON_FB
 #define CONFIG_VIDEO_LOGO
-/*#define CONFIG_CONSOLE_CURSOR*/
 #define CONFIG_SYS_ISA_IO_BASE_ADDRESS CONFIG_SYS_PCIE3_IO_VIRT
 #endif
 
diff --git a/include/configs/MPC8544DS.h b/include/configs/MPC8544DS.h
index 67fac70..79f402e 100644
--- a/include/configs/MPC8544DS.h
+++ b/include/configs/MPC8544DS.h
@@ -298,7 +298,6 @@ extern unsigned long get_board_sys_clk(unsigned long dummy);
 #define CONFIG_VGA_AS_SINGLE_DEVICE
 #define CONFIG_ATI_RADEON_FB
 #define CONFIG_VIDEO_LOGO
-/*#define CONFIG_CONSOLE_CURSOR*/
 #define CONFIG_SYS_ISA_IO_BASE_ADDRESS VIDEO_IO_OFFSET
 #endif
 
diff --git a/include/configs/MPC8572DS.h b/include/configs/MPC8572DS.h
index f3334ad..d1f2e66 100644
--- a/include/configs/MPC8572DS.h
+++ b/include/configs/MPC8572DS.h
@@ -496,7 +496,6 @@
 #define CONFIG_VGA_AS_SINGLE_DEVICE
 #define CONFIG_ATI_RADEON_FB
 #define CONFIG_VIDEO_LOGO
-/*#define CONFIG_CONSOLE_CURSOR*/
 #define CONFIG_SYS_ISA_IO_BASE_ADDRESS VIDEO_IO_OFFSET
 #endif
 
diff --git a/include/configs/MPC8641HPCN.h b/include/configs/MPC8641HPCN.h
index f20ee79..3e23bcf 100644
--- a/include/configs/MPC8641HPCN.h
+++ b/include/configs/MPC8641HPCN.h
@@ -404,7 +404,6 @@ extern unsigned long get_board_sys_clk(unsigned long dummy);
 #define CONFIG_VGA_AS_SINGLE_DEVICE
 #define CONFIG_ATI_RADEON_FB
 #define CONFIG_VIDEO_LOGO
-/*#define CONFIG_CONSOLE_CURSOR*/
 #define CONFIG_SYS_ISA_IO_BASE_ADDRESS CONFIG_SYS_PCIE2_IO_VIRT
 #endif
 
-- 
2.6.0.rc0.131.gf624c3d



More information about the U-Boot mailing list