Linux 4.18.10
[linux/fpc-iii.git] / drivers / video / console / dummycon.c
blobf2eafe2ed98066866d6006f05f5019ead3fdae34
1 /*
2 * linux/drivers/video/dummycon.c -- A dummy console driver
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 */
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>
17 * Dummy console driver
20 #if defined(__arm__)
21 #define DUMMY_COLUMNS screen_info.orig_video_cols
22 #define DUMMY_ROWS screen_info.orig_video_lines
23 #else
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 #endif
29 static const char *dummycon_startup(void)
31 return "dummy device";
34 static void dummycon_init(struct vc_data *vc, int init)
36 vc->vc_can_do_color = 1;
37 if (init) {
38 vc->vc_cols = DUMMY_COLUMNS;
39 vc->vc_rows = DUMMY_ROWS;
40 } else
41 vc_resize(vc, DUMMY_COLUMNS, DUMMY_ROWS);
44 static void dummycon_deinit(struct vc_data *vc) { }
45 static void dummycon_clear(struct vc_data *vc, int sy, int sx, int height,
46 int width) { }
47 static void dummycon_putc(struct vc_data *vc, int c, int ypos, int xpos) { }
48 static void dummycon_putcs(struct vc_data *vc, const unsigned short *s,
49 int count, int ypos, int xpos) { }
50 static void dummycon_cursor(struct vc_data *vc, int mode) { }
52 static bool dummycon_scroll(struct vc_data *vc, unsigned int top,
53 unsigned int bottom, enum con_scroll dir,
54 unsigned int lines)
56 return false;
59 static int dummycon_switch(struct vc_data *vc)
61 return 0;
64 static int dummycon_blank(struct vc_data *vc, int blank, int mode_switch)
66 return 0;
69 static int dummycon_font_set(struct vc_data *vc, struct console_font *font,
70 unsigned int flags)
72 return 0;
75 static int dummycon_font_default(struct vc_data *vc,
76 struct console_font *font, char *name)
78 return 0;
81 static int dummycon_font_copy(struct vc_data *vc, int con)
83 return 0;
87 * The console `switch' structure for the dummy console
89 * Most of the operations are dummies.
92 const struct consw dummy_con = {
93 .owner = THIS_MODULE,
94 .con_startup = dummycon_startup,
95 .con_init = dummycon_init,
96 .con_deinit = dummycon_deinit,
97 .con_clear = dummycon_clear,
98 .con_putc = dummycon_putc,
99 .con_putcs = dummycon_putcs,
100 .con_cursor = dummycon_cursor,
101 .con_scroll = dummycon_scroll,
102 .con_switch = dummycon_switch,
103 .con_blank = dummycon_blank,
104 .con_font_set = dummycon_font_set,
105 .con_font_default = dummycon_font_default,
106 .con_font_copy = dummycon_font_copy,
108 EXPORT_SYMBOL_GPL(dummy_con);