4 * Copyright 1998-2006 VIA Technologies, Inc. All Rights Reserved.
5 * Copyright 2001-2006 S3 Graphics, Inc. All Rights Reserved.
7 * Permission is hereby granted, free of charge, to any person obtaining a
8 * copy of this software and associated documentation files (the "Software"),
9 * to deal in the Software without restriction, including without limitation
10 * the rights to use, copy, modify, merge, publish, distribute, sub license,
11 * and/or sell copies of the Software, and to permit persons to whom the
12 * Software is furnished to do so, subject to the following conditions:
14 * The above copyright notice and this permission notice (including the
15 * next paragraph) shall be included in all copies or substantial portions
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
21 * THE AUTHOR(S) OR COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
22 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
23 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
24 * DEALINGS IN THE SOFTWARE.
27 #ifndef _DEV_PCI_UNICHROMEREG_H
28 #define _DEV_PCI_UNICHROMEREG_H
30 /* Define Return Value */
34 /* S.T.Chen[2005.12.26]: Define Boolean Value */
51 /* Define Bit Field */
61 /* Video Memory Size */
62 #define VIDEO_MEMORY_SIZE_16M 0x1000000
64 // Definition Mode Index
65 #define VIA_RES_640X480 0
66 #define VIA_RES_800X600 1
67 #define VIA_RES_1024X768 2
68 #define VIA_RES_1152X864 3
69 #define VIA_RES_1280X1024 4
70 #define VIA_RES_1600X1200 5
71 #define VIA_RES_1440X1050 6
72 #define VIA_RES_1280X768 7
73 #define VIA_RES_1280X960 8
74 #define VIA_RES_1920X1440 9
75 #define VIA_RES_848X480 10
76 #define VIA_RES_1400X1050 11
77 #define VIA_RES_720X480 12
78 #define VIA_RES_720X576 13
79 #define VIA_RES_1024X512 14
80 #define VIA_RES_856X480 15
81 #define VIA_RES_1024X576 16
82 #define VIA_RES_640X400 17
83 #define VIA_RES_1280X720 18
84 #define VIA_RES_1920X1080 19
85 #define VIA_RES_800X480 20
86 #define VIA_RES_1366X768 21
87 #define VIA_RES_INVALID 255
90 // standard VGA IO port
91 #define VIA_REGBASE 0x3C0
93 #define VIARMisc 0x00C
94 #define VIAWMisc 0x002
95 #define VIAStatus 0x01A
112 /* Define Color Depth */
122 /* Sequencer Registers */
162 /* CRT Controller Registers */
189 /* Extend CRT Controller Registers */
311 #define LUT_DATA 0x09 /* DACDATA */
312 #define LUT_INDEX_READ 0x07 /* DACRX */
313 #define LUT_INDEX_WRITE 0x08 /* DACWX */
316 /* Definition Device */
317 #define DEVICE_CRT 0x01
318 #define DEVICE_TV 0x02
319 #define DEVICE_DVI 0x03
320 #define DEVICE_LCD 0x04
322 /* Device output interface */
323 #define INTERFACE_NONE 0x00
324 #define INTERFACE_ANALOG_RGB 0x01
325 #define INTERFACE_DVP0 0x02
326 #define INTERFACE_DVP1 0x03
327 #define INTERFACE_DFP_HIGH 0x04
328 #define INTERFACE_DFP_LOW 0x05
329 #define INTERFACE_DFP 0x06
330 #define INTERFACE_LVDS0 0x07
331 #define INTERFACE_LVDS1 0x08
332 #define INTERFACE_LVDS0LVDS1 0x09
333 #define INTERFACE_TMDS 0x0A
335 /* Definition Refresh Rate */
336 #define REFRESH_60 60
337 #define REFRESH_75 75
338 #define REFRESH_85 85
339 #define REFRESH_100 100
340 #define REFRESH_120 120
342 /* Definition Sync Polarity*/
346 //640x480@60 Sync Polarity (VESA Mode)
347 #define M640X480_R60_HSP NEGATIVE
348 #define M640X480_R60_VSP NEGATIVE
350 //640x480@75 Sync Polarity (VESA Mode)
351 #define M640X480_R75_HSP NEGATIVE
352 #define M640X480_R75_VSP NEGATIVE
354 //640x480@85 Sync Polarity (VESA Mode)
355 #define M640X480_R85_HSP NEGATIVE
356 #define M640X480_R85_VSP NEGATIVE
358 //640x480@100 Sync Polarity (GTF Mode)
359 #define M640X480_R100_HSP NEGATIVE
360 #define M640X480_R100_VSP POSITIVE
362 //640x480@120 Sync Polarity (GTF Mode)
363 #define M640X480_R120_HSP NEGATIVE
364 #define M640X480_R120_VSP POSITIVE
366 //720x480@60 Sync Polarity (GTF Mode)
367 #define M720X480_R60_HSP NEGATIVE
368 #define M720X480_R60_VSP POSITIVE
370 //720x576@60 Sync Polarity (GTF Mode)
371 #define M720X576_R60_HSP NEGATIVE
372 #define M720X576_R60_VSP POSITIVE
374 //800x600@60 Sync Polarity (VESA Mode)
375 #define M800X600_R60_HSP POSITIVE
376 #define M800X600_R60_VSP POSITIVE
378 //800x600@75 Sync Polarity (VESA Mode)
379 #define M800X600_R75_HSP POSITIVE
380 #define M800X600_R75_VSP POSITIVE
382 //800x600@85 Sync Polarity (VESA Mode)
383 #define M800X600_R85_HSP POSITIVE
384 #define M800X600_R85_VSP POSITIVE
386 //800x600@100 Sync Polarity (GTF Mode)
387 #define M800X600_R100_HSP NEGATIVE
388 #define M800X600_R100_VSP POSITIVE
390 //800x600@120 Sync Polarity (GTF Mode)
391 #define M800X600_R120_HSP NEGATIVE
392 #define M800X600_R120_VSP POSITIVE
394 //800x480@60 Sync Polarity (GTF Mode)
395 #define M800X480_R60_HSP NEGATIVE
396 #define M800X480_R60_VSP POSITIVE
398 //848x480@60 Sync Polarity (GTF Mode)
399 #define M848X480_R60_HSP NEGATIVE
400 #define M848X480_R60_VSP POSITIVE
402 //852x480@60 Sync Polarity (GTF Mode)
403 #define M852X480_R60_HSP NEGATIVE
404 #define M852X480_R60_VSP POSITIVE
406 //1024x512@60 Sync Polarity (GTF Mode)
407 #define M1024X512_R60_HSP NEGATIVE
408 #define M1024X512_R60_VSP POSITIVE
410 //1024x768@60 Sync Polarity (VESA Mode)
411 #define M1024X768_R60_HSP NEGATIVE
412 #define M1024X768_R60_VSP NEGATIVE
414 //1024x768@75 Sync Polarity (VESA Mode)
415 #define M1024X768_R75_HSP POSITIVE
416 #define M1024X768_R75_VSP POSITIVE
418 //1024x768@85 Sync Polarity (VESA Mode)
419 #define M1024X768_R85_HSP POSITIVE
420 #define M1024X768_R85_VSP POSITIVE
422 //1024x768@100 Sync Polarity (GTF Mode)
423 #define M1024X768_R100_HSP NEGATIVE
424 #define M1024X768_R100_VSP POSITIVE
426 //1152x864@75 Sync Polarity (VESA Mode)
427 #define M1152X864_R75_HSP POSITIVE
428 #define M1152X864_R75_VSP POSITIVE
430 //1280x720@60 Sync Polarity (GTF Mode)
431 #define M1280X720_R60_HSP NEGATIVE
432 #define M1280X720_R60_VSP POSITIVE
434 //1280x768@60 Sync Polarity (GTF Mode)
435 #define M1280X768_R60_HSP NEGATIVE
436 #define M1280X768_R60_VSP POSITIVE
438 //1280x960@60 Sync Polarity (VESA Mode)
439 #define M1280X960_R60_HSP POSITIVE
440 #define M1280X960_R60_VSP POSITIVE
442 //1280x1024@60 Sync Polarity (VESA Mode)
443 #define M1280X1024_R60_HSP POSITIVE
444 #define M1280X1024_R60_VSP POSITIVE
446 /* 1368x768@60 Sync Polarity (VESA Mode) */
447 #define M1368X768_R60_HSP NEGATIVE
448 #define M1368X768_R60_VSP POSITIVE
450 //1280x1024@75 Sync Polarity (VESA Mode)
451 #define M1280X1024_R75_HSP POSITIVE
452 #define M1280X1024_R75_VSP POSITIVE
454 //1280x1024@85 Sync Polarity (VESA Mode)
455 #define M1280X1024_R85_HSP POSITIVE
456 #define M1280X1024_R85_VSP POSITIVE
458 //1440x1050@60 Sync Polarity (GTF Mode)
459 #define M1440X1050_R60_HSP NEGATIVE
460 #define M1440X1050_R60_VSP POSITIVE
462 //1600x1200@60 Sync Polarity (VESA Mode)
463 #define M1600X1200_R60_HSP POSITIVE
464 #define M1600X1200_R60_VSP POSITIVE
466 //1600x1200@75 Sync Polarity (VESA Mode)
467 #define M1600X1200_R75_HSP POSITIVE
468 #define M1600X1200_R75_VSP POSITIVE
470 //1920x1080@60 Sync Polarity (GTF Mode)
471 #define M1920X1080_R60_HSP NEGATIVE
472 #define M1920X1080_R60_VSP POSITIVE
474 //1920x1440@60 Sync Polarity (VESA Mode)
475 #define M1920X1440_R60_HSP NEGATIVE
476 #define M1920X1440_R60_VSP POSITIVE
478 //1920x1440@75 Sync Polarity (VESA Mode)
479 #define M1920X1440_R75_HSP NEGATIVE
480 #define M1920X1440_R75_VSP POSITIVE
482 /* 1400x1050@60 Sync Polarity (VESA Mode) */
483 #define M1400X1050_R60_HSP NEGATIVE
484 #define M1400X1050_R60_VSP NEGATIVE
487 /* define PLL index: */
488 #define CLK_25_175M 25175000
489 #define CLK_26_880M 26880000
490 #define CLK_29_581M 29581000
491 #define CLK_31_490M 31490000
492 #define CLK_31_500M 31500000
493 #define CLK_31_728M 31728000
494 #define CLK_32_668M 32688000
495 #define CLK_36_000M 36000000
496 #define CLK_40_000M 40000000
497 #define CLK_41_291M 41291000
498 #define CLK_43_163M 43163000
499 //#define CLK_46_996M 46996000
500 #define CLK_49_500M 49500000
501 #define CLK_52_406M 52406000
502 #define CLK_56_250M 56250000
503 #define CLK_65_000M 65000000
504 #define CLK_68_179M 68179000
505 #define CLK_78_750M 78750000
506 #define CLK_80_136M 80136000
507 #define CLK_83_950M 83950000
508 #define CLK_85_860M 85860000
509 #define CLK_94_500M 94500000
510 #define CLK_108_000M 108000000
511 #define CLK_125_104M 125104000
512 #define CLK_133_308M 133308000
513 #define CLK_135_000M 135000000
514 //#define CLK_148_500M 148500000
515 #define CLK_157_500M 157500000
516 #define CLK_162_000M 162000000
517 #define CLK_202_500M 202500000
518 #define CLK_234_000M 234000000
519 #define CLK_297_500M 297500000
520 #define CLK_74_481M 74481000
521 #define CLK_172_798M 172798000
525 #define CLE266_PLL_25_175M 0x0000C763
526 #define CLE266_PLL_26_880M 0x0000440F
527 #define CLE266_PLL_29_581M 0x00008421
528 #define CLE266_PLL_31_490M 0x00004721
529 #define CLE266_PLL_31_500M 0x0000C3B5
530 #define CLE266_PLL_31_728M 0x0000471F
531 #define CLE266_PLL_32_668M 0x0000C449
532 #define CLE266_PLL_36_000M 0x0000C5E5
533 #define CLE266_PLL_40_000M 0x0000C459
534 #define CLE266_PLL_41_291M 0x00004417
535 #define CLE266_PLL_43_163M 0x0000C579
536 //#define CLE266_PLL_46_996M 0x0000C4E9
537 #define CLE266_PLL_49_500M 0x00008653
538 #define CLE266_PLL_52_406M 0x0000C475
539 #define CLE266_PLL_56_250M 0x000047B7
540 #define CLE266_PLL_65_000M 0x000086ED
541 #define CLE266_PLL_68_179M 0x00000413
542 #define CLE266_PLL_78_750M 0x00004321
543 #define CLE266_PLL_80_136M 0x0000051C
544 #define CLE266_PLL_83_950M 0x00000729
545 #define CLE266_PLL_85_860M 0x00004754
546 #define CLE266_PLL_94_500M 0x00000521
547 #define CLE266_PLL_108_000M 0x00008479
548 #define CLE266_PLL_125_104M 0x000006B5
549 #define CLE266_PLL_133_308M 0x0000465F
550 #define CLE266_PLL_135_000M 0x0000455E
551 //#define CLE266_PLL_148_500M 0x0000
552 #define CLE266_PLL_157_500M 0x000005B7
553 #define CLE266_PLL_162_000M 0x00004571
554 #define CLE266_PLL_202_500M 0x00000763
555 #define CLE266_PLL_234_000M 0x00000662
556 #define CLE266_PLL_297_500M 0x000005E6
557 #define CLE266_PLL_74_481M 0x0000051A
558 #define CLE266_PLL_172_798M 0x00004579
561 #define K800_PLL_25_175M 0x00539001
562 #define K800_PLL_26_880M 0x001C8C80
563 #define K800_PLL_29_581M 0x00409080
564 #define K800_PLL_31_490M 0x006F9001
565 #define K800_PLL_31_500M 0x008B9002
566 #define K800_PLL_31_728M 0x00AF9003
567 #define K800_PLL_32_668M 0x00909002
568 #define K800_PLL_36_000M 0x009F9002
569 #define K800_PLL_40_000M 0x00578C02
570 #define K800_PLL_41_291M 0x00438C01
571 #define K800_PLL_43_163M 0x00778C03
572 //#define K800_PLL_46_996M 0x00000000
573 #define K800_PLL_49_500M 0x00518C01
574 #define K800_PLL_52_406M 0x00738C02
575 #define K800_PLL_56_250M 0x007C8C02
576 #define K800_PLL_65_000M 0x006B8C01
577 #define K800_PLL_68_179M 0x00708C01
578 #define K800_PLL_78_750M 0x00408801
579 #define K800_PLL_80_136M 0x00428801
580 #define K800_PLL_83_950M 0x00738803
581 #define K800_PLL_85_860M 0x00768883
582 #define K800_PLL_94_500M 0x00828803
583 #define K800_PLL_108_000M 0x00778882
584 #define K800_PLL_125_104M 0x00688801
585 #define K800_PLL_133_308M 0x005D8801
586 #define K800_PLL_135_000M 0x001A4081
587 //#define K800_PLL_148_500M 0x0000
588 #define K800_PLL_157_500M 0x00142080
589 #define K800_PLL_162_000M 0x006F8483
590 #define K800_PLL_202_500M 0x00538481
591 #define K800_PLL_234_000M 0x00608401
592 #define K800_PLL_297_500M 0x00A48402
593 #define K800_PLL_74_481M 0x007B8C81
594 #define K800_PLL_172_798M 0x00778483
597 #define CX700_25_175M 0x008B1003
598 #define CX700_26_719M 0x00931003
599 #define CX700_26_880M 0x00941003
600 #define CX700_29_581M 0x00A49003
601 #define CX700_31_490M 0x00AE1003
602 #define CX700_31_500M 0x00AE1003
603 #define CX700_31_728M 0x00AF1003
604 #define CX700_32_668M 0x00B51003
605 #define CX700_36_000M 0x00C81003
606 #define CX700_40_000M 0x006E0C03
607 #define CX700_41_291M 0x00710C03
608 #define CX700_43_163M 0x00770C03
609 #define CX700_49_500M 0x00880C03
610 #define CX700_52_406M 0x00730C02
611 #define CX700_56_250M 0x009B0C03
612 #define CX700_65_000M 0x006B0C01
613 #define CX700_68_179M 0x00BC0C03
614 #define CX700_74_481M 0x00CE0C03
615 #define CX700_78_750M 0x006C0803
616 #define CX700_80_136M 0x006E0803
617 #define CX700_83_375M 0x005B0882
618 #define CX700_83_950M 0x00730803
619 #define CX700_85_860M 0x00760803
620 #define CX700_94_500M 0x00820803
621 #define CX700_108_000M 0x00950803
622 #define CX700_125_104M 0x00AD0803
623 #define CX700_133_308M 0x00930802
624 #define CX700_135_000M 0x00950802
625 #define CX700_157_500M 0x006C0403
626 #define CX700_162_000M 0x006F0403
627 #define CX700_172_798M 0x00770403
628 #define CX700_202_500M 0x008C0403
629 #define CX700_234_000M 0x00600401
630 #define CX700_297_500M 0x00CE0403
632 /* Definition CRTC Timing Index */
633 #define H_TOTAL_INDEX 0
634 #define H_ADDR_INDEX 1
635 #define H_BLANK_START_INDEX 2
636 #define H_BLANK_END_INDEX 3
637 #define H_SYNC_START_INDEX 4
638 #define H_SYNC_END_INDEX 5
639 #define V_TOTAL_INDEX 6
640 #define V_ADDR_INDEX 7
641 #define V_BLANK_START_INDEX 8
642 #define V_BLANK_END_INDEX 9
643 #define V_SYNC_START_INDEX 10
644 #define V_SYNC_END_INDEX 11
645 #define H_TOTAL_SHADOW_INDEX 12
646 #define H_BLANK_END_SHADOW_INDEX 13
647 #define V_TOTAL_SHADOW_INDEX 14
648 #define V_ADDR_SHADOW_INDEX 15
649 #define V_BLANK_SATRT_SHADOW_INDEX 16
650 #define V_BLANK_END_SHADOW_INDEX 17
651 #define V_SYNC_SATRT_SHADOW_INDEX 18
652 #define V_SYNC_END_SHADOW_INDEX 19
654 // Definition Video Mode Pixel Clock (picoseconds)
655 #define RES_640X480_60HZ_PIXCLOCK 39722
656 #define RES_640X480_75HZ_PIXCLOCK 31747
657 #define RES_640X480_85HZ_PIXCLOCK 27777
658 #define RES_640X480_100HZ_PIXCLOCK 23168
659 #define RES_640X480_120HZ_PIXCLOCK 19081
660 #define RES_720X480_60HZ_PIXCLOCK 37020
661 #define RES_720X576_60HZ_PIXCLOCK 30611
662 #define RES_800X600_60HZ_PIXCLOCK 25000
663 #define RES_800X600_75HZ_PIXCLOCK 20203
664 #define RES_800X600_85HZ_PIXCLOCK 17777
665 #define RES_800X600_100HZ_PIXCLOCK 14815
666 #define RES_800X600_120HZ_PIXCLOCK 11912
667 #define RES_800X480_60HZ_PIXCLOCK 33805
668 #define RES_848X480_60HZ_PIXCLOCK 31756
669 #define RES_856X480_60HZ_PIXCLOCK 31518
670 #define RES_1024X512_60HZ_PIXCLOCK 24218
671 #define RES_1024X768_60HZ_PIXCLOCK 15385
672 #define RES_1024X768_75HZ_PIXCLOCK 12699
673 #define RES_1024X768_85HZ_PIXCLOCK 10582
674 #define RES_1024X768_100HZ_PIXCLOCK 9091
675 #define RES_1152X864_70HZ_PIXCLOCK 10000
676 #define RES_1152X864_75HZ_PIXCLOCK 9091
677 #define RES_1280X768_60HZ_PIXCLOCK 12480
678 #define RES_1280X960_60HZ_PIXCLOCK 9259
679 #define RES_1280X1024_60HZ_PIXCLOCK 9260
680 #define RES_1280X1024_75HZ_PIXCLOCK 7408
681 #define RES_1280X768_85HZ_PIXCLOCK 6349
682 #define RES_1440X1050_60HZ_PIXCLOCK 7993
683 #define RES_1600X1200_60HZ_PIXCLOCK 6411
684 #define RES_1600X1200_75HZ_PIXCLOCK 4938
685 #define RES_1280X720_60HZ_PIXCLOCK 13426
686 #define RES_1920X1080_60HZ_PIXCLOCK 5787
687 #define RES_1400X1050_60HZ_PIXCLOCK 9260
688 #define RES_1366X768_60HZ_PIXCLOCK 11647
690 // LCD display method
691 #define LCD_EXPANDSION 0x00
692 #define LCD_CENTERING 0x01
694 // Define display timing
696 struct display_timing
{
699 uint16_t hor_blank_start
;
700 uint16_t hor_blank_end
;
701 uint16_t hor_sync_start
;
702 uint16_t hor_sync_end
;
705 uint16_t ver_blank_start
;
706 uint16_t ver_blank_end
;
707 uint16_t ver_sync_start
;
708 uint16_t ver_sync_end
;
711 struct crt_mode_table
{
716 struct display_timing crtc
;
726 #endif /* _DEV_PCI_UNICHROMEREG_H */