valkyriefb.h 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  1. /* SPDX-License-Identifier: GPL-2.0-or-later */
  2. /*
  3. * valkyriefb.h: Constants of all sorts for valkyriefb
  4. *
  5. * Created 8 August 1998 by
  6. * Martin Costabel <[email protected]> and Kevin Schoedel
  7. *
  8. * Vmode-switching changes and vmode 15/17 modifications created 29 August
  9. * 1998 by Barry K. Nathan <[email protected]>.
  10. *
  11. * vmode 10 changed by Steven Borley <[email protected]>, 14 mai 2000
  12. *
  13. * Ported to 68k Macintosh by David Huggins-Daines <[email protected]>
  14. *
  15. * Based directly on:
  16. *
  17. * controlfb.h: Constants of all sorts for controlfb
  18. * Copyright (C) 1998 Daniel Jacobowitz <[email protected]>
  19. *
  20. * pmc-valkyrie.h: Console support for PowerMac "control" display adaptor.
  21. * Copyright (C) 1997 Paul Mackerras.
  22. *
  23. * pmc-valkyrie.c: Console support for PowerMac "control" display adaptor.
  24. * Copyright (C) 1997 Paul Mackerras.
  25. *
  26. * and indirectly from:
  27. *
  28. * pmc-control.h: Console support for PowerMac "control" display adaptor.
  29. * Copyright (C) 1997 Paul Mackerras.
  30. *
  31. * pmc-control.c: Console support for PowerMac "control" display adaptor.
  32. * Copyright (C) 1996 Paul Mackerras.
  33. *
  34. * platinumfb.c: Console support for PowerMac "platinum" display adaptor.
  35. * Copyright (C) 1998 Jon Howell
  36. */
  37. #ifdef CONFIG_MAC
  38. /* Valkyrie registers are word-aligned on m68k */
  39. #define VALKYRIE_REG_PADSIZE 3
  40. #else
  41. #define VALKYRIE_REG_PADSIZE 7
  42. #endif
  43. /*
  44. * Structure of the registers for the Valkyrie colormap registers.
  45. */
  46. struct cmap_regs {
  47. unsigned char addr;
  48. char pad1[VALKYRIE_REG_PADSIZE];
  49. unsigned char lut;
  50. };
  51. /*
  52. * Structure of the registers for the "valkyrie" display adaptor.
  53. */
  54. struct vpreg { /* padded register */
  55. unsigned char r;
  56. char pad[VALKYRIE_REG_PADSIZE];
  57. };
  58. struct valkyrie_regs {
  59. struct vpreg mode;
  60. struct vpreg depth;
  61. struct vpreg status;
  62. struct vpreg reg3;
  63. struct vpreg intr;
  64. struct vpreg reg5;
  65. struct vpreg intr_enb;
  66. struct vpreg msense;
  67. };
  68. /*
  69. * Register initialization tables for the valkyrie display.
  70. *
  71. * Dot clock rate is
  72. * 3.9064MHz * 2**clock_params[2] * clock_params[1] / clock_params[0].
  73. */
  74. struct valkyrie_regvals {
  75. unsigned char mode;
  76. unsigned char clock_params[3];
  77. int pitch[2]; /* bytes/line, indexed by color_mode */
  78. int hres;
  79. int vres;
  80. };
  81. #ifndef CONFIG_MAC
  82. /* Register values for 1024x768, 75Hz mode (17) */
  83. /* I'm not sure which mode this is (16 or 17), so I'm defining it as 17,
  84. * since the equivalent mode in controlfb (which I adapted this from) is
  85. * also 17. Just because MacOS can't do this on Valkyrie doesn't mean we
  86. * can't! :)
  87. *
  88. * I was going to use 12, 31, 3, which I found by myself, but instead I'm
  89. * using 11, 28, 3 like controlfb, for consistency's sake.
  90. */
  91. static struct valkyrie_regvals valkyrie_reg_init_17 = {
  92. 15,
  93. { 11, 28, 3 }, /* pixel clock = 79.55MHz for V=74.50Hz */
  94. { 1024, 0 },
  95. 1024, 768
  96. };
  97. /* Register values for 1024x768, 72Hz mode (15) */
  98. /* This used to be 12, 30, 3 for pixel clock = 78.12MHz for V=72.12Hz, but
  99. * that didn't match MacOS in the same video mode on this chip, and it also
  100. * caused the 15" Apple Studio Display to not work in this mode. While this
  101. * mode still doesn't match MacOS exactly (as far as I can tell), it's a lot
  102. * closer now, and it works with the Apple Studio Display.
  103. *
  104. * Yes, even though MacOS calls it "72Hz", in reality it's about 70Hz.
  105. */
  106. static struct valkyrie_regvals valkyrie_reg_init_15 = {
  107. 15,
  108. { 12, 29, 3 }, /* pixel clock = 75.52MHz for V=69.71Hz? */
  109. /* I interpolated the V=69.71 from the vmode 14 and old 15
  110. * numbers. Is this result correct?
  111. */
  112. { 1024, 0 },
  113. 1024, 768
  114. };
  115. /* Register values for 1024x768, 60Hz mode (14) */
  116. static struct valkyrie_regvals valkyrie_reg_init_14 = {
  117. 14,
  118. { 15, 31, 3 }, /* pixel clock = 64.58MHz for V=59.62Hz */
  119. { 1024, 0 },
  120. 1024, 768
  121. };
  122. #endif /* !defined CONFIG_MAC */
  123. /* Register values for 832x624, 75Hz mode (13) */
  124. static struct valkyrie_regvals valkyrie_reg_init_13 = {
  125. 9,
  126. { 23, 42, 3 }, /* pixel clock = 57.07MHz for V=74.27Hz */
  127. { 832, 0 },
  128. 832, 624
  129. };
  130. /* Register values for 800x600, 72Hz mode (11) */
  131. static struct valkyrie_regvals valkyrie_reg_init_11 = {
  132. 13,
  133. { 17, 27, 3 }, /* pixel clock = 49.63MHz for V=71.66Hz */
  134. { 800, 0 },
  135. 800, 600
  136. };
  137. /* Register values for 800x600, 60Hz mode (10) */
  138. static struct valkyrie_regvals valkyrie_reg_init_10 = {
  139. 12,
  140. { 25, 32, 3 }, /* pixel clock = 40.0015MHz,
  141. used to be 20,53,2, pixel clock 41.41MHz for V=59.78Hz */
  142. { 800, 1600 },
  143. 800, 600
  144. };
  145. /* Register values for 640x480, 67Hz mode (6) */
  146. static struct valkyrie_regvals valkyrie_reg_init_6 = {
  147. 6,
  148. { 14, 27, 2 }, /* pixel clock = 30.13MHz for V=66.43Hz */
  149. { 640, 1280 },
  150. 640, 480
  151. };
  152. /* Register values for 640x480, 60Hz mode (5) */
  153. static struct valkyrie_regvals valkyrie_reg_init_5 = {
  154. 11,
  155. { 23, 37, 2 }, /* pixel clock = 25.14MHz for V=59.85Hz */
  156. { 640, 1280 },
  157. 640, 480
  158. };
  159. static struct valkyrie_regvals *valkyrie_reg_init[VMODE_MAX] = {
  160. NULL,
  161. NULL,
  162. NULL,
  163. NULL,
  164. &valkyrie_reg_init_5,
  165. &valkyrie_reg_init_6,
  166. NULL,
  167. NULL,
  168. NULL,
  169. &valkyrie_reg_init_10,
  170. &valkyrie_reg_init_11,
  171. NULL,
  172. &valkyrie_reg_init_13,
  173. #ifndef CONFIG_MAC
  174. &valkyrie_reg_init_14,
  175. &valkyrie_reg_init_15,
  176. NULL,
  177. &valkyrie_reg_init_17,
  178. #endif
  179. };