Lynx framebuffers multidomain implementation.
[linux/elbrus.git] / drivers / video / lynxfb / ddk750_display.c
blob967d4f1fe9b4c2bc772443ac89c8c6e0c57cbfaa
1 /*******************************************************************
2 *Copyright (c) 2012 by Silicon Motion, Inc. (SMI)
3 *Permission is hereby granted, free of charge, to any person obtaining a copy
4 *of this software and associated documentation files (the "Software"), to deal
5 *in the Software without restriction, including without limitation the rights to
6 *use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
7 *of the Software, and to permit persons to whom the Software is furnished to
8 *do so, subject to the following conditions:
10 *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
11 *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
12 *OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
13 *NONINFRINGEMENT. IN NO EVENT SHALL Mill.Chen and Monk.Liu OR COPYRIGHT
14 *HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
15 *WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
16 *FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
17 *OTHER DEALINGS IN THE SOFTWARE.
18 *******************************************************************/
19 #include "ddk750_reg.h"
20 #include "ddk750_help.h"
21 #include "ddk750_display.h"
22 #include "ddk750_power.h"
23 #include "ddk750_dvi.h"
25 #ifdef CONFIG_FB_LYNXFB_DOMAINS
26 #define primaryWaitVerticalSync(delay, domain) waitNextVerticalSync(0, delay, domain)
28 static void setDisplayControl(int ctrl, int dispState, int domain)
30 /* state != 0 means turn on both timing & plane en_bit */
31 unsigned long ulDisplayCtrlReg, ulReservedBits = 0;
32 int cnt;
34 cnt = 0;
36 /* Set the primary display control */
37 if (!ctrl) {
38 ulDisplayCtrlReg = PEEK32(PANEL_DISPLAY_CTRL, domain);
39 /* Turn on/off the Panel display control */
40 if (dispState) {
41 /* Timing should be enabled first before enabling the plane
42 * because changing at the same time does not guarantee that
43 * the plane will also enabled or disabled.
45 ulDisplayCtrlReg =
46 ulDisplayCtrlReg | (1 <<
47 PANEL_DISPLAY_CTRL_TIMING_LSB);
48 POKE32(PANEL_DISPLAY_CTRL, ulDisplayCtrlReg, domain);
50 ulDisplayCtrlReg =
51 ulDisplayCtrlReg | (1 <<
52 PANEL_DISPLAY_CTRL_PLANE_LSB);
53 /* Added some masks to mask out the reserved bits.
54 * Sometimes, the reserved bits are set/reset randomly when
55 * writing to the PRIMARY_DISPLAY_CTRL, therefore, the register
56 * reserved bits are needed to be masked out.
58 ulReservedBits =
59 (3 << PANEL_DISPLAY_CTRL_RESERVED_1_MASK_LSB) |
60 (15 << PANEL_DISPLAY_CTRL_RESERVED_2_MASK_LSB)
61 | (1 <<
62 PANEL_DISPLAY_CTRL_RESERVED_3_MASK_LSB);
64 /* Somehow the register value on the plane is not set
65 * until a few delay. Need to write
66 * and read it a couple times
68 do {
69 cnt++;
70 POKE32(PANEL_DISPLAY_CTRL,
71 ulDisplayCtrlReg, domain);
72 } while ((PEEK32(PANEL_DISPLAY_CTRL, domain) &
73 ~ulReservedBits) !=
74 (ulDisplayCtrlReg & ~ulReservedBits));
75 /* printk
76 * ("Set Panel Plane enbit:after tried %d times\n",
77 * cnt);
79 } else {
80 /* When turning off, there is no rule on the programming
81 * sequence since whenever the clock is off, then it does not
82 * matter whether the plane is enabled or disabled.
83 * Note: Modifying the plane bit will take effect on the
84 * next vertical sync. Need to find out if it is necessary to
85 * wait for 1 vsync before modifying the timing enable bit.
86 * */
87 ulDisplayCtrlReg =
88 ulDisplayCtrlReg &
89 (~(1 << PANEL_DISPLAY_CTRL_PLANE_LSB));
90 POKE32(PANEL_DISPLAY_CTRL, ulDisplayCtrlReg, domain);
92 ulDisplayCtrlReg =
93 ulDisplayCtrlReg &
94 (~(1 << PANEL_DISPLAY_CTRL_TIMING_LSB));
95 POKE32(PANEL_DISPLAY_CTRL, ulDisplayCtrlReg, domain);
98 } else {
99 /* Set the secondary display control */
100 ulDisplayCtrlReg = PEEK32(CRT_DISPLAY_CTRL, domain);
102 if (dispState) {
103 /* Timing should be enabled first before enabling the plane because changing at the
104 same time does not guarantee that the plane will also enabled or disabled.
106 ulDisplayCtrlReg =
107 ulDisplayCtrlReg | (1 <<
108 CRT_DISPLAY_CTRL_TIMING_LSB);
109 POKE32(CRT_DISPLAY_CTRL, ulDisplayCtrlReg, domain);
111 ulDisplayCtrlReg =
112 ulDisplayCtrlReg | (1 <<
113 CRT_DISPLAY_CTRL_PLANE_LSB);
115 /* Added some masks to mask out the reserved bits.
116 * Sometimes, the reserved bits are set/reset randomly when
117 * writing to the PRIMARY_DISPLAY_CTRL, therefore, the register
118 * reserved bits are needed to be masked out.
121 ulReservedBits =
122 (0X1F << CRT_DISPLAY_CTRL_RESERVED_1_MASK_LSB)
123 | (3 << CRT_DISPLAY_CTRL_RESERVED_2_MASK_LSB) |
124 (1 << CRT_DISPLAY_CTRL_RESERVED_3_MASK_LSB) |
125 (1 << CRT_DISPLAY_CTRL_RESERVED_4_MASK_LSB);
126 do {
127 cnt++;
128 POKE32(CRT_DISPLAY_CTRL, ulDisplayCtrlReg, domain);
129 } while ((PEEK32(CRT_DISPLAY_CTRL, domain) &
130 ~ulReservedBits) !=
131 (ulDisplayCtrlReg & ~ulReservedBits));
132 printk
133 ("Set Crt Plane enbit:after tried %d times\n",
134 cnt);
135 } else {
136 /* When turning off, there is no rule on the programming
137 * sequence since whenever the clock is off, then it does not
138 * matter whether the plane is enabled or disabled.
139 * Note: Modifying the plane bit will take effect on the next
140 * vertical sync. Need to find out if it is necessary to
141 * wait for 1 vsync before modifying the timing enable bit.
143 ulDisplayCtrlReg =
144 ulDisplayCtrlReg &
145 (~(1 << CRT_DISPLAY_CTRL_PLANE_LSB));
146 POKE32(CRT_DISPLAY_CTRL, ulDisplayCtrlReg, domain);
148 ulDisplayCtrlReg =
149 ulDisplayCtrlReg &
150 (~(1 << CRT_DISPLAY_CTRL_TIMING_LSB));
151 POKE32(CRT_DISPLAY_CTRL, ulDisplayCtrlReg, domain);
157 static void waitNextVerticalSync(int ctrl, int delay, int domain)
159 unsigned int status;
160 if (!ctrl) {
161 /* primary controller */
163 /* Do not wait when the Primary PLL is off or display control is already off.
164 This will prevent the software to wait forever. */
165 if (((1 &
166 (PEEK32(PANEL_PLL_CTRL, domain) >> PANEL_PLL_CTRL_POWER_LSB))
167 == PANEL_PLL_CTRL_POWER_OFF)
169 ((1 &
170 (PEEK32(PANEL_DISPLAY_CTRL, domain) >>
171 PANEL_DISPLAY_CTRL_TIMING_LSB)) ==
172 PANEL_DISPLAY_CTRL_TIMING_DISABLE)) {
173 return;
175 while (delay-- > 0) {
176 /* Wait for end of vsync. */
177 do {
178 status =
179 1 & (PEEK32(SYSTEM_CTRL, domain) >>
180 SYSTEM_CTRL_PANEL_VSYNC_LSB);
181 } while (status == SYSTEM_CTRL_PANEL_VSYNC_ACTIVE);
183 /* Wait for start of vsync. */
184 do {
185 status =
186 1 & (PEEK32(SYSTEM_CTRL, domain) >>
187 SYSTEM_CTRL_PANEL_VSYNC_LSB);
188 } while (status ==
189 SYSTEM_CTRL_PANEL_VSYNC_INACTIVE);
192 } else {
194 /* Do not wait when the Primary PLL is off or display control is already off.
195 This will prevent the software to wait forever. */
196 if (((1 & (PEEK32(CRT_PLL_CTRL, domain) >> CRT_PLL_CTRL_POWER_LSB))
197 == CRT_PLL_CTRL_POWER_OFF)
198 || ((1 & (PEEK32(CRT_DISPLAY_CTRL, domain) >>
199 CRT_DISPLAY_CTRL_TIMING_LSB)) ==
200 CRT_DISPLAY_CTRL_TIMING_DISABLE)) {
201 return;
204 while (delay-- > 0) {
205 /* Wait for end of vsync. */
206 do {
207 status =
208 1 & (PEEK32(SYSTEM_CTRL, domain) >>
209 SYSTEM_CTRL_CRT_VSYNC_LSB);
210 } while (status == SYSTEM_CTRL_CRT_VSYNC_ACTIVE);
212 /* Wait for start of vsync. */
213 do {
214 status =
215 1 & (PEEK32(SYSTEM_CTRL, domain) >>
216 SYSTEM_CTRL_CRT_VSYNC_LSB);
217 } while (status == SYSTEM_CTRL_CRT_VSYNC_INACTIVE);
222 static void inline swPanelPowerSequence_sm750le(int disp, int delay, int domain)
224 unsigned int reg;
225 reg = PEEK32(DISPLAY_CONTROL_750LE, domain);
226 if (disp)
227 reg |= 0xf;
228 else
229 reg &= ~0xf;
230 POKE32(DISPLAY_CONTROL_750LE, reg, domain);
233 static void swPanelPowerSequence(int disp, int delay, int domain)
235 unsigned int reg;
237 /* disp should be 1 to open sequence */
238 reg = PEEK32(PANEL_DISPLAY_CTRL, domain);
239 reg &= ~(1 << PANEL_DISPLAY_CTRL_FPEN_LSB);
240 reg = reg | (disp << PANEL_DISPLAY_CTRL_FPEN_LSB);
241 POKE32(PANEL_DISPLAY_CTRL, reg, domain);
242 primaryWaitVerticalSync(delay, domain);
244 reg = PEEK32(PANEL_DISPLAY_CTRL, domain);
245 reg &= ~(1 << PANEL_DISPLAY_CTRL_DATA_LSB);
246 reg = reg | (disp << PANEL_DISPLAY_CTRL_DATA_LSB);
247 POKE32(PANEL_DISPLAY_CTRL, reg, domain);
248 primaryWaitVerticalSync(delay, domain);
250 reg = PEEK32(PANEL_DISPLAY_CTRL, domain);
251 reg &= ~(1 << PANEL_DISPLAY_CTRL_VBIASEN_LSB);
252 reg = reg | (disp << PANEL_DISPLAY_CTRL_VBIASEN_LSB);
253 POKE32(PANEL_DISPLAY_CTRL, reg, domain);
254 primaryWaitVerticalSync(delay, domain);
256 reg = PEEK32(PANEL_DISPLAY_CTRL, domain);
257 reg &= ~(1 << PANEL_DISPLAY_CTRL_FPEN_LSB);
258 reg = reg | (disp << PANEL_DISPLAY_CTRL_FPEN_LSB);
259 POKE32(PANEL_DISPLAY_CTRL, reg, domain);
260 primaryWaitVerticalSync(delay, domain);
264 void ddk750_setLogicalDispOut(disp_output_t output, int domain)
266 unsigned int reg;
267 if (output & PNL_2_USAGE) {
268 /* set panel path controller select */
269 reg = PEEK32(PANEL_DISPLAY_CTRL, domain);
270 reg &= ~(3 << PANEL_DISPLAY_CTRL_SELECT_LSB);
271 reg =
272 reg | ((output & PNL_2_MASK) >> PNL_2_OFFSET) <<
273 PANEL_DISPLAY_CTRL_SELECT_LSB;
274 POKE32(PANEL_DISPLAY_CTRL, reg, domain);
277 if (output & CRT_2_USAGE) {
278 /* set crt path controller select */
279 reg = PEEK32(CRT_DISPLAY_CTRL, domain);
280 reg &= ~(3 << CRT_DISPLAY_CTRL_SELECT_LSB);
281 reg =
282 reg | ((output & CRT_2_MASK) >> CRT_2_OFFSET) <<
283 CRT_DISPLAY_CTRL_SELECT_LSB;
284 /*se blank off */
285 reg = reg & (~(1 << CRT_DISPLAY_CTRL_BLANK_LSB));
286 POKE32(CRT_DISPLAY_CTRL, reg, domain);
288 if (output & PRI_TP_USAGE) {
289 /* set primary timing and plane en_bit */
290 setDisplayControl(0,
291 (output & PRI_TP_MASK) >> PRI_TP_OFFSET, domain);
294 if (output & SEC_TP_USAGE) {
295 /* set secondary timing and plane en_bit */
296 setDisplayControl(1,
297 (output & SEC_TP_MASK) >> SEC_TP_OFFSET, domain);
300 if (output & PNL_SEQ_USAGE) {
301 /* set panel sequence */
302 swPanelPowerSequence((output & PNL_SEQ_MASK) >>
303 PNL_SEQ_OFFSET, 4, domain);
306 if (output & DAC_USAGE)
307 setDAC((output & DAC_MASK) >> DAC_OFFSET, domain);
309 if (output & DPMS_USAGE)
310 ddk750_setDPMS((output & DPMS_MASK) >> DPMS_OFFSET, domain);
313 int ddk750_initDVIDisp(int domain)
315 /* Initialize DVI. If the dviInit fail and the VendorID or the DeviceID are
316 not zeroed, then set the failure flag. If it is zeroe, it might mean
317 that the system is in Dual CRT Monitor configuration. */
319 /* De-skew enabled with default 111b value.
320 This will fix some artifacts problem in some mode on board 2.2.
321 Somehow this fix does not affect board 2.1.
323 if ((dviInit(1, /* Select Rising Edge */
324 1, /* Select 24-bit bus */
325 0, /* Select Single Edge clock */
326 1, /* Enable HSync as is */
327 1, /* Enable VSync as is */
328 1, /* Enable De-skew */
329 7, /* Set the de-skew setting to maximum setup */
330 1, /* Enable continuous Sync */
331 1, /* Enable PLL Filter */
332 4, /* Use the recommended value for PLL Filter value */
333 domain
334 ) != 0) && (dviGetVendorID(domain) != 0x0000)
335 && (dviGetDeviceID(domain) != 0x0000)) {
336 return -1;
339 /* TODO: Initialize other display component */
341 /* Success */
342 return 0;
346 #else /* !CONFIG_FB_LYNXFB_DOMAINS: */
347 #define primaryWaitVerticalSync(delay) waitNextVerticalSync(0, delay)
349 static void setDisplayControl(int ctrl, int dispState)
351 /* state != 0 means turn on both timing & plane en_bit */
352 unsigned long ulDisplayCtrlReg, ulReservedBits = 0;
353 int cnt;
355 cnt = 0;
357 /* Set the primary display control */
358 if (!ctrl) {
359 ulDisplayCtrlReg = PEEK32(PANEL_DISPLAY_CTRL);
360 /* Turn on/off the Panel display control */
361 if (dispState) {
362 /* Timing should be enabled first before enabling the plane
363 * because changing at the same time does not guarantee that
364 * the plane will also enabled or disabled.
366 ulDisplayCtrlReg =
367 ulDisplayCtrlReg | (1 <<
368 PANEL_DISPLAY_CTRL_TIMING_LSB);
369 POKE32(PANEL_DISPLAY_CTRL, ulDisplayCtrlReg);
371 ulDisplayCtrlReg =
372 ulDisplayCtrlReg | (1 <<
373 PANEL_DISPLAY_CTRL_PLANE_LSB);
374 /* Added some masks to mask out the reserved bits.
375 * Sometimes, the reserved bits are set/reset randomly when
376 * writing to the PRIMARY_DISPLAY_CTRL, therefore, the register
377 * reserved bits are needed to be masked out.
379 ulReservedBits =
380 (3 << PANEL_DISPLAY_CTRL_RESERVED_1_MASK_LSB) |
381 (15 << PANEL_DISPLAY_CTRL_RESERVED_2_MASK_LSB)
382 | (1 <<
383 PANEL_DISPLAY_CTRL_RESERVED_3_MASK_LSB);
385 /* Somehow the register value on the plane is not set
386 * until a few delay. Need to write
387 * and read it a couple times
389 do {
390 cnt++;
391 POKE32(PANEL_DISPLAY_CTRL,
392 ulDisplayCtrlReg);
393 } while ((PEEK32(PANEL_DISPLAY_CTRL) &
394 ~ulReservedBits) !=
395 (ulDisplayCtrlReg & ~ulReservedBits));
396 printk
397 ("Set Panel Plane enbit:after tried %d times\n",
398 cnt);
399 } else {
400 /* When turning off, there is no rule on the programming
401 * sequence since whenever the clock is off, then it does not
402 * matter whether the plane is enabled or disabled.
403 * Note: Modifying the plane bit will take effect on the
404 * next vertical sync. Need to find out if it is necessary to
405 * wait for 1 vsync before modifying the timing enable bit.
406 * */
407 ulDisplayCtrlReg =
408 ulDisplayCtrlReg &
409 (~(1 << PANEL_DISPLAY_CTRL_PLANE_LSB));
410 POKE32(PANEL_DISPLAY_CTRL, ulDisplayCtrlReg);
412 ulDisplayCtrlReg =
413 ulDisplayCtrlReg &
414 (~(1 << PANEL_DISPLAY_CTRL_TIMING_LSB));
415 POKE32(PANEL_DISPLAY_CTRL, ulDisplayCtrlReg);
418 } else {
419 /* Set the secondary display control */
420 ulDisplayCtrlReg = PEEK32(CRT_DISPLAY_CTRL);
422 if (dispState) {
423 /* Timing should be enabled first before enabling the plane because changing at the
424 same time does not guarantee that the plane will also enabled or disabled.
426 ulDisplayCtrlReg =
427 ulDisplayCtrlReg | (1 <<
428 CRT_DISPLAY_CTRL_TIMING_LSB);
429 POKE32(CRT_DISPLAY_CTRL, ulDisplayCtrlReg);
431 ulDisplayCtrlReg =
432 ulDisplayCtrlReg | (1 <<
433 CRT_DISPLAY_CTRL_PLANE_LSB);
435 /* Added some masks to mask out the reserved bits.
436 * Sometimes, the reserved bits are set/reset randomly when
437 * writing to the PRIMARY_DISPLAY_CTRL, therefore, the register
438 * reserved bits are needed to be masked out.
441 ulReservedBits =
442 (0X1F << CRT_DISPLAY_CTRL_RESERVED_1_MASK_LSB)
443 | (3 << CRT_DISPLAY_CTRL_RESERVED_2_MASK_LSB) |
444 (1 << CRT_DISPLAY_CTRL_RESERVED_3_MASK_LSB) |
445 (1 << CRT_DISPLAY_CTRL_RESERVED_4_MASK_LSB);
446 do {
447 cnt++;
448 POKE32(CRT_DISPLAY_CTRL, ulDisplayCtrlReg);
449 } while ((PEEK32(CRT_DISPLAY_CTRL) &
450 ~ulReservedBits) !=
451 (ulDisplayCtrlReg & ~ulReservedBits));
452 printk
453 ("Set Crt Plane enbit:after tried %d times\n",
454 cnt);
455 } else {
456 /* When turning off, there is no rule on the programming
457 * sequence since whenever the clock is off, then it does not
458 * matter whether the plane is enabled or disabled.
459 * Note: Modifying the plane bit will take effect on the next
460 * vertical sync. Need to find out if it is necessary to
461 * wait for 1 vsync before modifying the timing enable bit.
463 ulDisplayCtrlReg =
464 ulDisplayCtrlReg &
465 (~(1 << CRT_DISPLAY_CTRL_PLANE_LSB));
466 POKE32(CRT_DISPLAY_CTRL, ulDisplayCtrlReg);
468 ulDisplayCtrlReg =
469 ulDisplayCtrlReg &
470 (~(1 << CRT_DISPLAY_CTRL_TIMING_LSB));
471 POKE32(CRT_DISPLAY_CTRL, ulDisplayCtrlReg);
477 static void waitNextVerticalSync(int ctrl, int delay)
479 unsigned int status;
480 if (!ctrl) {
481 /* primary controller */
483 /* Do not wait when the Primary PLL is off or display control is already off.
484 This will prevent the software to wait forever. */
485 if (((1 &
486 (PEEK32(PANEL_PLL_CTRL) >> PANEL_PLL_CTRL_POWER_LSB))
487 == PANEL_PLL_CTRL_POWER_OFF)
489 ((1 &
490 (PEEK32(PANEL_DISPLAY_CTRL) >>
491 PANEL_DISPLAY_CTRL_TIMING_LSB)) ==
492 PANEL_DISPLAY_CTRL_TIMING_DISABLE)) {
493 return;
495 while (delay-- > 0) {
496 /* Wait for end of vsync. */
497 do {
498 status =
499 1 & (PEEK32(SYSTEM_CTRL) >>
500 SYSTEM_CTRL_PANEL_VSYNC_LSB);
501 } while (status == SYSTEM_CTRL_PANEL_VSYNC_ACTIVE);
503 /* Wait for start of vsync. */
504 do {
505 status =
506 1 & (PEEK32(SYSTEM_CTRL) >>
507 SYSTEM_CTRL_PANEL_VSYNC_LSB);
508 } while (status ==
509 SYSTEM_CTRL_PANEL_VSYNC_INACTIVE);
512 } else {
514 /* Do not wait when the Primary PLL is off or display control is already off.
515 This will prevent the software to wait forever. */
516 if (((1 & (PEEK32(CRT_PLL_CTRL) >> CRT_PLL_CTRL_POWER_LSB))
517 == CRT_PLL_CTRL_POWER_OFF)
518 || ((1 & (PEEK32(CRT_DISPLAY_CTRL) >>
519 CRT_DISPLAY_CTRL_TIMING_LSB)) ==
520 CRT_DISPLAY_CTRL_TIMING_DISABLE)) {
521 return;
524 while (delay-- > 0) {
525 /* Wait for end of vsync. */
526 do {
527 status =
528 1 & (PEEK32(SYSTEM_CTRL) >>
529 SYSTEM_CTRL_CRT_VSYNC_LSB);
530 } while (status == SYSTEM_CTRL_CRT_VSYNC_ACTIVE);
532 /* Wait for start of vsync. */
533 do {
534 status =
535 1 & (PEEK32(SYSTEM_CTRL) >>
536 SYSTEM_CTRL_CRT_VSYNC_LSB);
537 } while (status == SYSTEM_CTRL_CRT_VSYNC_INACTIVE);
542 static void inline swPanelPowerSequence_sm750le(int disp, int delay)
544 unsigned int reg;
545 reg = PEEK32(DISPLAY_CONTROL_750LE);
546 if (disp)
547 reg |= 0xf;
548 else
549 reg &= ~0xf;
550 POKE32(DISPLAY_CONTROL_750LE, reg);
553 static void swPanelPowerSequence(int disp, int delay)
555 unsigned int reg;
557 /* disp should be 1 to open sequence */
558 reg = PEEK32(PANEL_DISPLAY_CTRL);
559 reg &= ~(1 << PANEL_DISPLAY_CTRL_FPEN_LSB);
560 reg = reg | (disp << PANEL_DISPLAY_CTRL_FPEN_LSB);
561 POKE32(PANEL_DISPLAY_CTRL, reg);
562 primaryWaitVerticalSync(delay);
564 reg = PEEK32(PANEL_DISPLAY_CTRL);
565 reg &= ~(1 << PANEL_DISPLAY_CTRL_DATA_LSB);
566 reg = reg | (disp << PANEL_DISPLAY_CTRL_DATA_LSB);
567 POKE32(PANEL_DISPLAY_CTRL, reg);
568 primaryWaitVerticalSync(delay);
570 reg = PEEK32(PANEL_DISPLAY_CTRL);
571 reg &= ~(1 << PANEL_DISPLAY_CTRL_VBIASEN_LSB);
572 reg = reg | (disp << PANEL_DISPLAY_CTRL_VBIASEN_LSB);
573 POKE32(PANEL_DISPLAY_CTRL, reg);
574 primaryWaitVerticalSync(delay);
576 reg = PEEK32(PANEL_DISPLAY_CTRL);
577 reg &= ~(1 << PANEL_DISPLAY_CTRL_FPEN_LSB);
578 reg = reg | (disp << PANEL_DISPLAY_CTRL_FPEN_LSB);
579 POKE32(PANEL_DISPLAY_CTRL, reg);
580 primaryWaitVerticalSync(delay);
584 void ddk750_setLogicalDispOut(disp_output_t output)
586 unsigned int reg;
587 if (output & PNL_2_USAGE) {
588 /* set panel path controller select */
589 reg = PEEK32(PANEL_DISPLAY_CTRL);
590 reg &= ~(3 << PANEL_DISPLAY_CTRL_SELECT_LSB);
591 reg =
592 reg | ((output & PNL_2_MASK) >> PNL_2_OFFSET) <<
593 PANEL_DISPLAY_CTRL_SELECT_LSB;
594 POKE32(PANEL_DISPLAY_CTRL, reg);
597 if (output & CRT_2_USAGE) {
598 /* set crt path controller select */
599 reg = PEEK32(CRT_DISPLAY_CTRL);
600 reg &= ~(3 << CRT_DISPLAY_CTRL_SELECT_LSB);
601 reg =
602 reg | ((output & CRT_2_MASK) >> CRT_2_OFFSET) <<
603 CRT_DISPLAY_CTRL_SELECT_LSB;
604 /*se blank off */
605 reg = reg & (~(1 << CRT_DISPLAY_CTRL_BLANK_LSB));
606 POKE32(CRT_DISPLAY_CTRL, reg);
608 if (output & PRI_TP_USAGE) {
609 /* set primary timing and plane en_bit */
610 setDisplayControl(0,
611 (output & PRI_TP_MASK) >> PRI_TP_OFFSET);
614 if (output & SEC_TP_USAGE) {
615 /* set secondary timing and plane en_bit */
616 setDisplayControl(1,
617 (output & SEC_TP_MASK) >> SEC_TP_OFFSET);
620 if (output & PNL_SEQ_USAGE) {
621 /* set panel sequence */
622 swPanelPowerSequence((output & PNL_SEQ_MASK) >>
623 PNL_SEQ_OFFSET, 4);
626 if (output & DAC_USAGE)
627 setDAC((output & DAC_MASK) >> DAC_OFFSET);
629 if (output & DPMS_USAGE)
630 ddk750_setDPMS((output & DPMS_MASK) >> DPMS_OFFSET);
633 int ddk750_initDVIDisp()
635 /* Initialize DVI. If the dviInit fail and the VendorID or the DeviceID are
636 not zeroed, then set the failure flag. If it is zeroe, it might mean
637 that the system is in Dual CRT Monitor configuration. */
639 /* De-skew enabled with default 111b value.
640 This will fix some artifacts problem in some mode on board 2.2.
641 Somehow this fix does not affect board 2.1.
643 if ((dviInit(1, /* Select Rising Edge */
644 1, /* Select 24-bit bus */
645 0, /* Select Single Edge clock */
646 1, /* Enable HSync as is */
647 1, /* Enable VSync as is */
648 1, /* Enable De-skew */
649 7, /* Set the de-skew setting to maximum setup */
650 1, /* Enable continuous Sync */
651 1, /* Enable PLL Filter */
652 4 /* Use the recommended value for PLL Filter value */
653 ) != 0) && (dviGetVendorID() != 0x0000)
654 && (dviGetDeviceID() != 0x0000)) {
655 return -1;
658 /* TODO: Initialize other display component */
660 /* Success */
661 return 0;
664 #endif /* !CONFIG_FB_LYNXFB_DOMAINS */