xref: /openbmc/linux/drivers/video/console/dummycon.c (revision 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2)
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/tty.h>
11 #include <linux/console.h>
12 #include <linux/vt_kern.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	ORIG_VIDEO_COLS
22 #define DUMMY_ROWS	ORIG_VIDEO_LINES
23 #elif defined(__hppa__)
24 /* set by Kconfig. Use 80x25 for 640x480 and 160x64 for 1280x1024 */
25 #include <linux/config.h>
26 #define DUMMY_COLUMNS	CONFIG_DUMMY_CONSOLE_COLUMNS
27 #define DUMMY_ROWS	CONFIG_DUMMY_CONSOLE_ROWS
28 #else
29 #define DUMMY_COLUMNS	80
30 #define DUMMY_ROWS	25
31 #endif
32 
33 static const char *dummycon_startup(void)
34 {
35     return "dummy device";
36 }
37 
38 static void dummycon_init(struct vc_data *vc, int init)
39 {
40     vc->vc_can_do_color = 1;
41     if (init) {
42 	vc->vc_cols = DUMMY_COLUMNS;
43 	vc->vc_rows = DUMMY_ROWS;
44     } else
45 	vc_resize(vc, DUMMY_COLUMNS, DUMMY_ROWS);
46 }
47 
48 static int dummycon_dummy(void)
49 {
50     return 0;
51 }
52 
53 #define DUMMY	(void *)dummycon_dummy
54 
55 /*
56  *  The console `switch' structure for the dummy console
57  *
58  *  Most of the operations are dummies.
59  */
60 
61 const struct consw dummy_con = {
62     .owner =		THIS_MODULE,
63     .con_startup =	dummycon_startup,
64     .con_init =		dummycon_init,
65     .con_deinit =	DUMMY,
66     .con_clear =	DUMMY,
67     .con_putc =		DUMMY,
68     .con_putcs =	DUMMY,
69     .con_cursor =	DUMMY,
70     .con_scroll =	DUMMY,
71     .con_bmove =	DUMMY,
72     .con_switch =	DUMMY,
73     .con_blank =	DUMMY,
74     .con_font_set =	DUMMY,
75     .con_font_get =	DUMMY,
76     .con_font_default =	DUMMY,
77     .con_font_copy =	DUMMY,
78     .con_set_palette =	DUMMY,
79     .con_scrolldelta =	DUMMY,
80 };
81