valkyriefb.h 5.4 KB

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