xref: /openbmc/linux/drivers/video/console/dummycon.c (revision b34e08d5)
1 /*
2  *  linux/drivers/video/dummycon.c -- A dummy console driver
3  *
4  *  To be used if there's no other console driver (e.g. for plain VGA text)
5  *  available, usually until fbcon takes console over.
6  */
7 
8 #include <linux/types.h>
9 #include <linux/kdev_t.h>
10 #include <linux/console.h>
11 #include <linux/vt_kern.h>
12 #include <linux/screen_info.h>
13 #include <linux/init.h>
14 #include <linux/module.h>
15 
16 /*
17  *  Dummy console driver
18  */
19 
20 #if defined(__arm__)
21 #define DUMMY_COLUMNS	screen_info.orig_video_cols
22 #define DUMMY_ROWS	screen_info.orig_video_lines
23 #elif defined(__hppa__)
24 /* set by Kconfig. Use 80x25 for 640x480 and 160x64 for 1280x1024 */
25 #define DUMMY_COLUMNS	CONFIG_DUMMY_CONSOLE_COLUMNS
26 #define DUMMY_ROWS	CONFIG_DUMMY_CONSOLE_ROWS
27 #else
28 #define DUMMY_COLUMNS	80
29 #define DUMMY_ROWS	25
30 #endif
31 
32 static const char *dummycon_startup(void)
33 {
34     return "dummy device";
35 }
36 
37 static void dummycon_init(struct vc_data *vc, int init)
38 {
39     vc->vc_can_do_color = 1;
40     if (init) {
41 	vc->vc_cols = DUMMY_COLUMNS;
42 	vc->vc_rows = DUMMY_ROWS;
43     } else
44 	vc_resize(vc, DUMMY_COLUMNS, DUMMY_ROWS);
45 }
46 
47 static int dummycon_dummy(void)
48 {
49     return 0;
50 }
51 
52 #define DUMMY	(void *)dummycon_dummy
53 
54 /*
55  *  The console `switch' structure for the dummy console
56  *
57  *  Most of the operations are dummies.
58  */
59 
60 const struct consw dummy_con = {
61     .owner =		THIS_MODULE,
62     .con_startup =	dummycon_startup,
63     .con_init =		dummycon_init,
64     .con_deinit =	DUMMY,
65     .con_clear =	DUMMY,
66     .con_putc =		DUMMY,
67     .con_putcs =	DUMMY,
68     .con_cursor =	DUMMY,
69     .con_scroll =	DUMMY,
70     .con_bmove =	DUMMY,
71     .con_switch =	DUMMY,
72     .con_blank =	DUMMY,
73     .con_font_set =	DUMMY,
74     .con_font_get =	DUMMY,
75     .con_font_default =	DUMMY,
76     .con_font_copy =	DUMMY,
77     .con_set_palette =	DUMMY,
78     .con_scrolldelta =	DUMMY,
79 };
80