Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 10 | #include <linux/console.h> |
| 11 | #include <linux/vt_kern.h> |
Jon Smirl | 894673e | 2006-07-10 04:44:13 -0700 | [diff] [blame] | 12 | #include <linux/screen_info.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13 | #include <linux/init.h> |
| 14 | #include <linux/module.h> |
| 15 | |
| 16 | /* |
| 17 | * Dummy console driver |
| 18 | */ |
| 19 | |
| 20 | #if defined(__arm__) |
H. Peter Anvin | 3ea3351 | 2007-10-16 22:36:04 -0700 | [diff] [blame] | 21 | #define DUMMY_COLUMNS screen_info.orig_video_cols |
| 22 | #define DUMMY_ROWS screen_info.orig_video_lines |
Geert Uytterhoeven | 8f5b1e6 | 2015-01-12 21:17:02 +0100 | [diff] [blame] | 23 | #else |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 24 | /* set by Kconfig. Use 80x25 for 640x480 and 160x64 for 1280x1024 */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 25 | #define DUMMY_COLUMNS CONFIG_DUMMY_CONSOLE_COLUMNS |
| 26 | #define DUMMY_ROWS CONFIG_DUMMY_CONSOLE_ROWS |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 27 | #endif |
| 28 | |
| 29 | static const char *dummycon_startup(void) |
| 30 | { |
| 31 | return "dummy device"; |
| 32 | } |
| 33 | |
| 34 | static void dummycon_init(struct vc_data *vc, int init) |
| 35 | { |
| 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); |
| 42 | } |
| 43 | |
Sami Tolvanen | d93a963 | 2017-05-11 15:05:07 -0700 | [diff] [blame] | 44 | static void dummycon_deinit(struct vc_data *vc) |
| 45 | { |
| 46 | } |
| 47 | |
| 48 | static void dummycon_clear(struct vc_data *vc, int a, int b, int c, int d) |
| 49 | { |
| 50 | } |
| 51 | |
| 52 | static void dummycon_putc(struct vc_data *vc, int a, int b, int c) |
| 53 | { |
| 54 | } |
| 55 | |
| 56 | static void dummycon_putcs(struct vc_data *vc, const unsigned short *s, int a, int b, int c) |
| 57 | { |
| 58 | } |
| 59 | |
| 60 | static void dummycon_cursor(struct vc_data *vc, int a) |
| 61 | { |
| 62 | } |
| 63 | |
| 64 | static int dummycon_scroll(struct vc_data *vc, int a, int b, int c, int d) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 65 | { |
| 66 | return 0; |
| 67 | } |
| 68 | |
Sami Tolvanen | d93a963 | 2017-05-11 15:05:07 -0700 | [diff] [blame] | 69 | static int dummycon_switch(struct vc_data *vc) |
| 70 | { |
| 71 | return 0; |
| 72 | } |
| 73 | |
| 74 | static int dummycon_blank(struct vc_data *vc, int a, int b) |
| 75 | { |
| 76 | return 0; |
| 77 | } |
| 78 | |
| 79 | static int dummycon_font_set(struct vc_data *vc, struct console_font *f, unsigned u) |
| 80 | { |
| 81 | return 0; |
| 82 | } |
| 83 | |
| 84 | static int dummycon_font_default(struct vc_data *vc, struct console_font *f, char *c) |
| 85 | { |
| 86 | return 0; |
| 87 | } |
| 88 | |
| 89 | static int dummycon_font_copy(struct vc_data *vc, int a) |
| 90 | { |
| 91 | return 0; |
| 92 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 93 | |
| 94 | /* |
| 95 | * The console `switch' structure for the dummy console |
| 96 | * |
| 97 | * Most of the operations are dummies. |
| 98 | */ |
| 99 | |
| 100 | const struct consw dummy_con = { |
| 101 | .owner = THIS_MODULE, |
| 102 | .con_startup = dummycon_startup, |
| 103 | .con_init = dummycon_init, |
Sami Tolvanen | d93a963 | 2017-05-11 15:05:07 -0700 | [diff] [blame] | 104 | .con_deinit = dummycon_deinit, |
| 105 | .con_clear = dummycon_clear, |
| 106 | .con_putc = dummycon_putc, |
| 107 | .con_putcs = dummycon_putcs, |
| 108 | .con_cursor = dummycon_cursor, |
| 109 | .con_scroll = dummycon_scroll, |
| 110 | .con_switch = dummycon_switch, |
| 111 | .con_blank = dummycon_blank, |
| 112 | .con_font_set = dummycon_font_set, |
| 113 | .con_font_default = dummycon_font_default, |
| 114 | .con_font_copy = dummycon_font_copy, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 115 | }; |
Daniel Vetter | a4de052 | 2014-06-05 16:20:46 +0200 | [diff] [blame] | 116 | EXPORT_SYMBOL_GPL(dummy_con); |