matroxfb_g450.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641
  1. /*
  2. *
  3. * Hardware accelerated Matrox Millennium I, II, Mystique, G100, G200, G400 and G450.
  4. *
  5. * (c) 1998-2002 Petr Vandrovec <vandrove@vc.cvut.cz>
  6. *
  7. * Portions Copyright (c) 2001 Matrox Graphics Inc.
  8. *
  9. * Version: 1.65 2002/08/14
  10. *
  11. * See matroxfb_base.c for contributors.
  12. *
  13. */
  14. #include "matroxfb_base.h"
  15. #include "matroxfb_misc.h"
  16. #include "matroxfb_DAC1064.h"
  17. #include "g450_pll.h"
  18. #include <linux/matroxfb.h>
  19. #include <asm/div64.h>
  20. #include "matroxfb_g450.h"
  21. /* Definition of the various controls */
  22. struct mctl {
  23. struct v4l2_queryctrl desc;
  24. size_t control;
  25. };
  26. #define BLMIN 0xF3
  27. #define WLMAX 0x3FF
  28. static const struct mctl g450_controls[] =
  29. { { { V4L2_CID_BRIGHTNESS, V4L2_CTRL_TYPE_INTEGER,
  30. "brightness",
  31. 0, WLMAX-BLMIN, 1, 370-BLMIN,
  32. 0,
  33. }, offsetof(struct matrox_fb_info, altout.tvo_params.brightness) },
  34. { { V4L2_CID_CONTRAST, V4L2_CTRL_TYPE_INTEGER,
  35. "contrast",
  36. 0, 1023, 1, 127,
  37. 0,
  38. }, offsetof(struct matrox_fb_info, altout.tvo_params.contrast) },
  39. { { V4L2_CID_SATURATION, V4L2_CTRL_TYPE_INTEGER,
  40. "saturation",
  41. 0, 255, 1, 165,
  42. 0,
  43. }, offsetof(struct matrox_fb_info, altout.tvo_params.saturation) },
  44. { { V4L2_CID_HUE, V4L2_CTRL_TYPE_INTEGER,
  45. "hue",
  46. 0, 255, 1, 0,
  47. 0,
  48. }, offsetof(struct matrox_fb_info, altout.tvo_params.hue) },
  49. { { MATROXFB_CID_TESTOUT, V4L2_CTRL_TYPE_BOOLEAN,
  50. "test output",
  51. 0, 1, 1, 0,
  52. 0,
  53. }, offsetof(struct matrox_fb_info, altout.tvo_params.testout) },
  54. };
  55. #define G450CTRLS ARRAY_SIZE(g450_controls)
  56. /* Return: positive number: id found
  57. -EINVAL: id not found, return failure
  58. -ENOENT: id not found, create fake disabled control */
  59. static int get_ctrl_id(__u32 v4l2_id) {
  60. int i;
  61. for (i = 0; i < G450CTRLS; i++) {
  62. if (v4l2_id < g450_controls[i].desc.id) {
  63. if (g450_controls[i].desc.id == 0x08000000) {
  64. return -EINVAL;
  65. }
  66. return -ENOENT;
  67. }
  68. if (v4l2_id == g450_controls[i].desc.id) {
  69. return i;
  70. }
  71. }
  72. return -EINVAL;
  73. }
  74. static inline int *get_ctrl_ptr(struct matrox_fb_info *minfo, unsigned int idx)
  75. {
  76. return (int*)((char*)minfo + g450_controls[idx].control);
  77. }
  78. static void tvo_fill_defaults(struct matrox_fb_info *minfo)
  79. {
  80. unsigned int i;
  81. for (i = 0; i < G450CTRLS; i++) {
  82. *get_ctrl_ptr(minfo, i) = g450_controls[i].desc.default_value;
  83. }
  84. }
  85. static int cve2_get_reg(struct matrox_fb_info *minfo, int reg)
  86. {
  87. unsigned long flags;
  88. int val;
  89. matroxfb_DAC_lock_irqsave(flags);
  90. matroxfb_DAC_out(minfo, 0x87, reg);
  91. val = matroxfb_DAC_in(minfo, 0x88);
  92. matroxfb_DAC_unlock_irqrestore(flags);
  93. return val;
  94. }
  95. static void cve2_set_reg(struct matrox_fb_info *minfo, int reg, int val)
  96. {
  97. unsigned long flags;
  98. matroxfb_DAC_lock_irqsave(flags);
  99. matroxfb_DAC_out(minfo, 0x87, reg);
  100. matroxfb_DAC_out(minfo, 0x88, val);
  101. matroxfb_DAC_unlock_irqrestore(flags);
  102. }
  103. static void cve2_set_reg10(struct matrox_fb_info *minfo, int reg, int val)
  104. {
  105. unsigned long flags;
  106. matroxfb_DAC_lock_irqsave(flags);
  107. matroxfb_DAC_out(minfo, 0x87, reg);
  108. matroxfb_DAC_out(minfo, 0x88, val >> 2);
  109. matroxfb_DAC_out(minfo, 0x87, reg + 1);
  110. matroxfb_DAC_out(minfo, 0x88, val & 3);
  111. matroxfb_DAC_unlock_irqrestore(flags);
  112. }
  113. static void g450_compute_bwlevel(const struct matrox_fb_info *minfo, int *bl,
  114. int *wl)
  115. {
  116. const int b = minfo->altout.tvo_params.brightness + BLMIN;
  117. const int c = minfo->altout.tvo_params.contrast;
  118. *bl = max(b - c, BLMIN);
  119. *wl = min(b + c, WLMAX);
  120. }
  121. static int g450_query_ctrl(void* md, struct v4l2_queryctrl *p) {
  122. int i;
  123. i = get_ctrl_id(p->id);
  124. if (i >= 0) {
  125. *p = g450_controls[i].desc;
  126. return 0;
  127. }
  128. if (i == -ENOENT) {
  129. static const struct v4l2_queryctrl disctrl =
  130. { .flags = V4L2_CTRL_FLAG_DISABLED };
  131. i = p->id;
  132. *p = disctrl;
  133. p->id = i;
  134. sprintf(p->name, "Ctrl #%08X", i);
  135. return 0;
  136. }
  137. return -EINVAL;
  138. }
  139. static int g450_set_ctrl(void* md, struct v4l2_control *p) {
  140. int i;
  141. struct matrox_fb_info *minfo = md;
  142. i = get_ctrl_id(p->id);
  143. if (i < 0) return -EINVAL;
  144. /*
  145. * Check if changed.
  146. */
  147. if (p->value == *get_ctrl_ptr(minfo, i)) return 0;
  148. /*
  149. * Check limits.
  150. */
  151. if (p->value > g450_controls[i].desc.maximum) return -EINVAL;
  152. if (p->value < g450_controls[i].desc.minimum) return -EINVAL;
  153. /*
  154. * Store new value.
  155. */
  156. *get_ctrl_ptr(minfo, i) = p->value;
  157. switch (p->id) {
  158. case V4L2_CID_BRIGHTNESS:
  159. case V4L2_CID_CONTRAST:
  160. {
  161. int blacklevel, whitelevel;
  162. g450_compute_bwlevel(minfo, &blacklevel, &whitelevel);
  163. cve2_set_reg10(minfo, 0x0e, blacklevel);
  164. cve2_set_reg10(minfo, 0x1e, whitelevel);
  165. }
  166. break;
  167. case V4L2_CID_SATURATION:
  168. cve2_set_reg(minfo, 0x20, p->value);
  169. cve2_set_reg(minfo, 0x22, p->value);
  170. break;
  171. case V4L2_CID_HUE:
  172. cve2_set_reg(minfo, 0x25, p->value);
  173. break;
  174. case MATROXFB_CID_TESTOUT:
  175. {
  176. unsigned char val = cve2_get_reg(minfo, 0x05);
  177. if (p->value) val |= 0x02;
  178. else val &= ~0x02;
  179. cve2_set_reg(minfo, 0x05, val);
  180. }
  181. break;
  182. }
  183. return 0;
  184. }
  185. static int g450_get_ctrl(void* md, struct v4l2_control *p) {
  186. int i;
  187. struct matrox_fb_info *minfo = md;
  188. i = get_ctrl_id(p->id);
  189. if (i < 0) return -EINVAL;
  190. p->value = *get_ctrl_ptr(minfo, i);
  191. return 0;
  192. }
  193. struct output_desc {
  194. unsigned int h_vis;
  195. unsigned int h_f_porch;
  196. unsigned int h_sync;
  197. unsigned int h_b_porch;
  198. unsigned long long int chromasc;
  199. unsigned int burst;
  200. unsigned int v_total;
  201. };
  202. static void computeRegs(struct matrox_fb_info *minfo, struct mavenregs *r,
  203. struct my_timming *mt, const struct output_desc *outd)
  204. {
  205. u_int32_t chromasc;
  206. u_int32_t hlen;
  207. u_int32_t hsl;
  208. u_int32_t hbp;
  209. u_int32_t hfp;
  210. u_int32_t hvis;
  211. unsigned int pixclock;
  212. unsigned long long piic;
  213. int mnp;
  214. int over;
  215. r->regs[0x80] = 0x03; /* | 0x40 for SCART */
  216. hvis = ((mt->HDisplay << 1) + 3) & ~3;
  217. if (hvis >= 2048) {
  218. hvis = 2044;
  219. }
  220. piic = 1000000000ULL * hvis;
  221. do_div(piic, outd->h_vis);
  222. dprintk(KERN_DEBUG "Want %u kHz pixclock\n", (unsigned int)piic);
  223. mnp = matroxfb_g450_setclk(minfo, piic, M_VIDEO_PLL);
  224. mt->mnp = mnp;
  225. mt->pixclock = g450_mnp2f(minfo, mnp);
  226. dprintk(KERN_DEBUG "MNP=%08X\n", mnp);
  227. pixclock = 1000000000U / mt->pixclock;
  228. dprintk(KERN_DEBUG "Got %u ps pixclock\n", pixclock);
  229. piic = outd->chromasc;
  230. do_div(piic, mt->pixclock);
  231. chromasc = piic;
  232. dprintk(KERN_DEBUG "Chroma is %08X\n", chromasc);
  233. r->regs[0] = piic >> 24;
  234. r->regs[1] = piic >> 16;
  235. r->regs[2] = piic >> 8;
  236. r->regs[3] = piic >> 0;
  237. hbp = (((outd->h_b_porch + pixclock) / pixclock)) & ~1;
  238. hfp = (((outd->h_f_porch + pixclock) / pixclock)) & ~1;
  239. hsl = (((outd->h_sync + pixclock) / pixclock)) & ~1;
  240. hlen = hvis + hfp + hsl + hbp;
  241. over = hlen & 0x0F;
  242. dprintk(KERN_DEBUG "WL: vis=%u, hf=%u, hs=%u, hb=%u, total=%u\n", hvis, hfp, hsl, hbp, hlen);
  243. if (over) {
  244. hfp -= over;
  245. hlen -= over;
  246. if (over <= 2) {
  247. } else if (over < 10) {
  248. hfp += 4;
  249. hlen += 4;
  250. } else {
  251. hfp += 16;
  252. hlen += 16;
  253. }
  254. }
  255. /* maybe cve2 has requirement 800 < hlen < 1184 */
  256. r->regs[0x08] = hsl;
  257. r->regs[0x09] = (outd->burst + pixclock - 1) / pixclock; /* burst length */
  258. r->regs[0x0A] = hbp;
  259. r->regs[0x2C] = hfp;
  260. r->regs[0x31] = hvis / 8;
  261. r->regs[0x32] = hvis & 7;
  262. dprintk(KERN_DEBUG "PG: vis=%04X, hf=%02X, hs=%02X, hb=%02X, total=%04X\n", hvis, hfp, hsl, hbp, hlen);
  263. r->regs[0x84] = 1; /* x sync point */
  264. r->regs[0x85] = 0;
  265. hvis = hvis >> 1;
  266. hlen = hlen >> 1;
  267. dprintk(KERN_DEBUG "hlen=%u hvis=%u\n", hlen, hvis);
  268. mt->interlaced = 1;
  269. mt->HDisplay = hvis & ~7;
  270. mt->HSyncStart = mt->HDisplay + 8;
  271. mt->HSyncEnd = (hlen & ~7) - 8;
  272. mt->HTotal = hlen;
  273. {
  274. int upper;
  275. unsigned int vtotal;
  276. unsigned int vsyncend;
  277. unsigned int vdisplay;
  278. vtotal = mt->VTotal;
  279. vsyncend = mt->VSyncEnd;
  280. vdisplay = mt->VDisplay;
  281. if (vtotal < outd->v_total) {
  282. unsigned int yovr = outd->v_total - vtotal;
  283. vsyncend += yovr >> 1;
  284. } else if (vtotal > outd->v_total) {
  285. vdisplay = outd->v_total - 4;
  286. vsyncend = outd->v_total;
  287. }
  288. upper = (outd->v_total - vsyncend) >> 1; /* in field lines */
  289. r->regs[0x17] = outd->v_total / 4;
  290. r->regs[0x18] = outd->v_total & 3;
  291. r->regs[0x33] = upper - 1; /* upper blanking */
  292. r->regs[0x82] = upper; /* y sync point */
  293. r->regs[0x83] = upper >> 8;
  294. mt->VDisplay = vdisplay;
  295. mt->VSyncStart = outd->v_total - 2;
  296. mt->VSyncEnd = outd->v_total;
  297. mt->VTotal = outd->v_total;
  298. }
  299. }
  300. static void cve2_init_TVdata(int norm, struct mavenregs* data, const struct output_desc** outd) {
  301. static const struct output_desc paloutd = {
  302. .h_vis = 52148148, // ps
  303. .h_f_porch = 1407407, // ps
  304. .h_sync = 4666667, // ps
  305. .h_b_porch = 5777778, // ps
  306. .chromasc = 19042247534182ULL, // 4433618.750 Hz
  307. .burst = 2518518, // ps
  308. .v_total = 625,
  309. };
  310. static const struct output_desc ntscoutd = {
  311. .h_vis = 52888889, // ps
  312. .h_f_porch = 1333333, // ps
  313. .h_sync = 4666667, // ps
  314. .h_b_porch = 4666667, // ps
  315. .chromasc = 15374030659475ULL, // 3579545.454 Hz
  316. .burst = 2418418, // ps
  317. .v_total = 525, // lines
  318. };
  319. static const struct mavenregs palregs = { {
  320. 0x2A, 0x09, 0x8A, 0xCB, /* 00: chroma subcarrier */
  321. 0x00,
  322. 0x00, /* test */
  323. 0xF9, /* modified by code (F9 written...) */
  324. 0x00, /* ? not written */
  325. 0x7E, /* 08 */
  326. 0x44, /* 09 */
  327. 0x9C, /* 0A */
  328. 0x2E, /* 0B */
  329. 0x21, /* 0C */
  330. 0x00, /* ? not written */
  331. // 0x3F, 0x03, /* 0E-0F */
  332. 0x3C, 0x03,
  333. 0x3C, 0x03, /* 10-11 */
  334. 0x1A, /* 12 */
  335. 0x2A, /* 13 */
  336. 0x1C, 0x3D, 0x14, /* 14-16 */
  337. 0x9C, 0x01, /* 17-18 */
  338. 0x00, /* 19 */
  339. 0xFE, /* 1A */
  340. 0x7E, /* 1B */
  341. 0x60, /* 1C */
  342. 0x05, /* 1D */
  343. // 0x89, 0x03, /* 1E-1F */
  344. 0xAD, 0x03,
  345. // 0x72, /* 20 */
  346. 0xA5,
  347. 0x07, /* 21 */
  348. // 0x72, /* 22 */
  349. 0xA5,
  350. 0x00, /* 23 */
  351. 0x00, /* 24 */
  352. 0x00, /* 25 */
  353. 0x08, /* 26 */
  354. 0x04, /* 27 */
  355. 0x00, /* 28 */
  356. 0x1A, /* 29 */
  357. 0x55, 0x01, /* 2A-2B */
  358. 0x26, /* 2C */
  359. 0x07, 0x7E, /* 2D-2E */
  360. 0x02, 0x54, /* 2F-30 */
  361. 0xB0, 0x00, /* 31-32 */
  362. 0x14, /* 33 */
  363. 0x49, /* 34 */
  364. 0x00, /* 35 written multiple times */
  365. 0x00, /* 36 not written */
  366. 0xA3, /* 37 */
  367. 0xC8, /* 38 */
  368. 0x22, /* 39 */
  369. 0x02, /* 3A */
  370. 0x22, /* 3B */
  371. 0x3F, 0x03, /* 3C-3D */
  372. 0x00, /* 3E written multiple times */
  373. 0x00, /* 3F not written */
  374. } };
  375. static struct mavenregs ntscregs = { {
  376. 0x21, 0xF0, 0x7C, 0x1F, /* 00: chroma subcarrier */
  377. 0x00,
  378. 0x00, /* test */
  379. 0xF9, /* modified by code (F9 written...) */
  380. 0x00, /* ? not written */
  381. 0x7E, /* 08 */
  382. 0x43, /* 09 */
  383. 0x7E, /* 0A */
  384. 0x3D, /* 0B */
  385. 0x00, /* 0C */
  386. 0x00, /* ? not written */
  387. 0x41, 0x00, /* 0E-0F */
  388. 0x3C, 0x00, /* 10-11 */
  389. 0x17, /* 12 */
  390. 0x21, /* 13 */
  391. 0x1B, 0x1B, 0x24, /* 14-16 */
  392. 0x83, 0x01, /* 17-18 */
  393. 0x00, /* 19 */
  394. 0x0F, /* 1A */
  395. 0x0F, /* 1B */
  396. 0x60, /* 1C */
  397. 0x05, /* 1D */
  398. //0x89, 0x02, /* 1E-1F */
  399. 0xC0, 0x02, /* 1E-1F */
  400. //0x5F, /* 20 */
  401. 0x9C, /* 20 */
  402. 0x04, /* 21 */
  403. //0x5F, /* 22 */
  404. 0x9C, /* 22 */
  405. 0x01, /* 23 */
  406. 0x02, /* 24 */
  407. 0x00, /* 25 */
  408. 0x0A, /* 26 */
  409. 0x05, /* 27 */
  410. 0x00, /* 28 */
  411. 0x10, /* 29 */
  412. 0xFF, 0x03, /* 2A-2B */
  413. 0x24, /* 2C */
  414. 0x0F, 0x78, /* 2D-2E */
  415. 0x00, 0x00, /* 2F-30 */
  416. 0xB2, 0x04, /* 31-32 */
  417. 0x14, /* 33 */
  418. 0x02, /* 34 */
  419. 0x00, /* 35 written multiple times */
  420. 0x00, /* 36 not written */
  421. 0xA3, /* 37 */
  422. 0xC8, /* 38 */
  423. 0x15, /* 39 */
  424. 0x05, /* 3A */
  425. 0x3B, /* 3B */
  426. 0x3C, 0x00, /* 3C-3D */
  427. 0x00, /* 3E written multiple times */
  428. 0x00, /* never written */
  429. } };
  430. if (norm == MATROXFB_OUTPUT_MODE_PAL) {
  431. *data = palregs;
  432. *outd = &paloutd;
  433. } else {
  434. *data = ntscregs;
  435. *outd = &ntscoutd;
  436. }
  437. return;
  438. }
  439. #define LR(x) cve2_set_reg(minfo, (x), m->regs[(x)])
  440. static void cve2_init_TV(struct matrox_fb_info *minfo,
  441. const struct mavenregs *m)
  442. {
  443. int i;
  444. LR(0x80);
  445. LR(0x82); LR(0x83);
  446. LR(0x84); LR(0x85);
  447. cve2_set_reg(minfo, 0x3E, 0x01);
  448. for (i = 0; i < 0x3E; i++) {
  449. LR(i);
  450. }
  451. cve2_set_reg(minfo, 0x3E, 0x00);
  452. }
  453. static int matroxfb_g450_compute(void* md, struct my_timming* mt) {
  454. struct matrox_fb_info *minfo = md;
  455. dprintk(KERN_DEBUG "Computing, mode=%u\n", minfo->outputs[1].mode);
  456. if (mt->crtc == MATROXFB_SRC_CRTC2 &&
  457. minfo->outputs[1].mode != MATROXFB_OUTPUT_MODE_MONITOR) {
  458. const struct output_desc* outd;
  459. cve2_init_TVdata(minfo->outputs[1].mode, &minfo->hw.maven, &outd);
  460. {
  461. int blacklevel, whitelevel;
  462. g450_compute_bwlevel(minfo, &blacklevel, &whitelevel);
  463. minfo->hw.maven.regs[0x0E] = blacklevel >> 2;
  464. minfo->hw.maven.regs[0x0F] = blacklevel & 3;
  465. minfo->hw.maven.regs[0x1E] = whitelevel >> 2;
  466. minfo->hw.maven.regs[0x1F] = whitelevel & 3;
  467. minfo->hw.maven.regs[0x20] =
  468. minfo->hw.maven.regs[0x22] = minfo->altout.tvo_params.saturation;
  469. minfo->hw.maven.regs[0x25] = minfo->altout.tvo_params.hue;
  470. if (minfo->altout.tvo_params.testout) {
  471. minfo->hw.maven.regs[0x05] |= 0x02;
  472. }
  473. }
  474. computeRegs(minfo, &minfo->hw.maven, mt, outd);
  475. } else if (mt->mnp < 0) {
  476. /* We must program clocks before CRTC2, otherwise interlaced mode
  477. startup may fail */
  478. mt->mnp = matroxfb_g450_setclk(minfo, mt->pixclock, (mt->crtc == MATROXFB_SRC_CRTC1) ? M_PIXEL_PLL_C : M_VIDEO_PLL);
  479. mt->pixclock = g450_mnp2f(minfo, mt->mnp);
  480. }
  481. dprintk(KERN_DEBUG "Pixclock = %u\n", mt->pixclock);
  482. return 0;
  483. }
  484. static int matroxfb_g450_program(void* md) {
  485. struct matrox_fb_info *minfo = md;
  486. if (minfo->outputs[1].mode != MATROXFB_OUTPUT_MODE_MONITOR) {
  487. cve2_init_TV(minfo, &minfo->hw.maven);
  488. }
  489. return 0;
  490. }
  491. static int matroxfb_g450_verify_mode(void* md, u_int32_t arg) {
  492. switch (arg) {
  493. case MATROXFB_OUTPUT_MODE_PAL:
  494. case MATROXFB_OUTPUT_MODE_NTSC:
  495. case MATROXFB_OUTPUT_MODE_MONITOR:
  496. return 0;
  497. }
  498. return -EINVAL;
  499. }
  500. static int g450_dvi_compute(void* md, struct my_timming* mt) {
  501. struct matrox_fb_info *minfo = md;
  502. if (mt->mnp < 0) {
  503. mt->mnp = matroxfb_g450_setclk(minfo, mt->pixclock, (mt->crtc == MATROXFB_SRC_CRTC1) ? M_PIXEL_PLL_C : M_VIDEO_PLL);
  504. mt->pixclock = g450_mnp2f(minfo, mt->mnp);
  505. }
  506. return 0;
  507. }
  508. static struct matrox_altout matroxfb_g450_altout = {
  509. .name = "Secondary output",
  510. .compute = matroxfb_g450_compute,
  511. .program = matroxfb_g450_program,
  512. .verifymode = matroxfb_g450_verify_mode,
  513. .getqueryctrl = g450_query_ctrl,
  514. .getctrl = g450_get_ctrl,
  515. .setctrl = g450_set_ctrl,
  516. };
  517. static struct matrox_altout matroxfb_g450_dvi = {
  518. .name = "DVI output",
  519. .compute = g450_dvi_compute,
  520. };
  521. void matroxfb_g450_connect(struct matrox_fb_info *minfo)
  522. {
  523. if (minfo->devflags.g450dac) {
  524. down_write(&minfo->altout.lock);
  525. tvo_fill_defaults(minfo);
  526. minfo->outputs[1].src = minfo->outputs[1].default_src;
  527. minfo->outputs[1].data = minfo;
  528. minfo->outputs[1].output = &matroxfb_g450_altout;
  529. minfo->outputs[1].mode = MATROXFB_OUTPUT_MODE_MONITOR;
  530. minfo->outputs[2].src = minfo->outputs[2].default_src;
  531. minfo->outputs[2].data = minfo;
  532. minfo->outputs[2].output = &matroxfb_g450_dvi;
  533. minfo->outputs[2].mode = MATROXFB_OUTPUT_MODE_MONITOR;
  534. up_write(&minfo->altout.lock);
  535. }
  536. }
  537. void matroxfb_g450_shutdown(struct matrox_fb_info *minfo)
  538. {
  539. if (minfo->devflags.g450dac) {
  540. down_write(&minfo->altout.lock);
  541. minfo->outputs[1].src = MATROXFB_SRC_NONE;
  542. minfo->outputs[1].output = NULL;
  543. minfo->outputs[1].data = NULL;
  544. minfo->outputs[1].mode = MATROXFB_OUTPUT_MODE_MONITOR;
  545. minfo->outputs[2].src = MATROXFB_SRC_NONE;
  546. minfo->outputs[2].output = NULL;
  547. minfo->outputs[2].data = NULL;
  548. minfo->outputs[2].mode = MATROXFB_OUTPUT_MODE_MONITOR;
  549. up_write(&minfo->altout.lock);
  550. }
  551. }
  552. EXPORT_SYMBOL(matroxfb_g450_connect);
  553. EXPORT_SYMBOL(matroxfb_g450_shutdown);
  554. MODULE_AUTHOR("(c) 2000-2002 Petr Vandrovec <vandrove@vc.cvut.cz>");
  555. MODULE_DESCRIPTION("Matrox G450/G550 output driver");
  556. MODULE_LICENSE("GPL");