dummycon.c 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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. #include <linux/types.h>
  8. #include <linux/kdev_t.h>
  9. #include <linux/console.h>
  10. #include <linux/vt_kern.h>
  11. #include <linux/screen_info.h>
  12. #include <linux/init.h>
  13. #include <linux/module.h>
  14. /*
  15. * Dummy console driver
  16. */
  17. #if defined(__arm__)
  18. #define DUMMY_COLUMNS screen_info.orig_video_cols
  19. #define DUMMY_ROWS screen_info.orig_video_lines
  20. #else
  21. /* set by Kconfig. Use 80x25 for 640x480 and 160x64 for 1280x1024 */
  22. #define DUMMY_COLUMNS CONFIG_DUMMY_CONSOLE_COLUMNS
  23. #define DUMMY_ROWS CONFIG_DUMMY_CONSOLE_ROWS
  24. #endif
  25. static const char *dummycon_startup(void)
  26. {
  27. return "dummy device";
  28. }
  29. static void dummycon_init(struct vc_data *vc, int init)
  30. {
  31. vc->vc_can_do_color = 1;
  32. if (init) {
  33. vc->vc_cols = DUMMY_COLUMNS;
  34. vc->vc_rows = DUMMY_ROWS;
  35. } else
  36. vc_resize(vc, DUMMY_COLUMNS, DUMMY_ROWS);
  37. }
  38. static int dummycon_dummy(void)
  39. {
  40. return 0;
  41. }
  42. #define DUMMY (void *)dummycon_dummy
  43. /*
  44. * The console `switch' structure for the dummy console
  45. *
  46. * Most of the operations are dummies.
  47. */
  48. const struct consw dummy_con = {
  49. .owner = THIS_MODULE,
  50. .con_startup = dummycon_startup,
  51. .con_init = dummycon_init,
  52. .con_deinit = DUMMY,
  53. .con_clear = DUMMY,
  54. .con_putc = DUMMY,
  55. .con_putcs = DUMMY,
  56. .con_cursor = DUMMY,
  57. .con_scroll = DUMMY,
  58. .con_switch = DUMMY,
  59. .con_blank = DUMMY,
  60. .con_font_set = DUMMY,
  61. .con_font_get = DUMMY,
  62. .con_font_default = DUMMY,
  63. .con_font_copy = DUMMY,
  64. };
  65. EXPORT_SYMBOL_GPL(dummy_con);