aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/via/dvi.c
diff options
context:
space:
mode:
authorFlorian Tobias Schandinat <FlorianSchandinat@gmx.de>2010-08-11 18:22:54 -0400
committerFlorian Tobias Schandinat <FlorianSchandinat@gmx.de>2010-09-23 22:14:58 -0400
commitcd7e9103e983ff0f518ac0e85cee265027ccbfa4 (patch)
tree3a87b00683aee3adc2c4670b0cb85a15b5d7dbb0 /drivers/video/via/dvi.c
parentbc6848875152f3df860d0f54a2323cc7615527d9 (diff)
viafb: merge the remaining output path with enable functions
This patch merges the remaining functionality of the output path function in the associated enabling functions. This is very natural as most of the remaining code does actually enable the device. Just some more or less intelligent code merge. If no stupid mistakes occured there should be no regressions. Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de> Cc: Joseph Chan <JosephChan@via.com.tw>
Diffstat (limited to 'drivers/video/via/dvi.c')
-rw-r--r--drivers/video/via/dvi.c146
1 files changed, 108 insertions, 38 deletions
diff --git a/drivers/video/via/dvi.c b/drivers/video/via/dvi.c
index ab6145da1a2f..7c82f6fda918 100644
--- a/drivers/video/via/dvi.c
+++ b/drivers/video/via/dvi.c
@@ -496,38 +496,103 @@ void viafb_dvi_disable(void)
496 viafb_read_reg(VIACR, CRD2) | 0x08); 496 viafb_read_reg(VIACR, CRD2) | 0x08);
497} 497}
498 498
499static void dvi_patch_skew_dvp0(void)
500{
501 /* Reset data driving first: */
502 viafb_write_reg_mask(SR1B, VIASR, 0, BIT1);
503 viafb_write_reg_mask(SR2A, VIASR, 0, BIT4);
504
505 switch (viaparinfo->chip_info->gfx_chip_name) {
506 case UNICHROME_P4M890:
507 {
508 if ((viaparinfo->tmds_setting_info->h_active == 1600) &&
509 (viaparinfo->tmds_setting_info->v_active ==
510 1200))
511 viafb_write_reg_mask(CR96, VIACR, 0x03,
512 BIT0 + BIT1 + BIT2);
513 else
514 viafb_write_reg_mask(CR96, VIACR, 0x07,
515 BIT0 + BIT1 + BIT2);
516 break;
517 }
518
519 case UNICHROME_P4M900:
520 {
521 viafb_write_reg_mask(CR96, VIACR, 0x07,
522 BIT0 + BIT1 + BIT2 + BIT3);
523 viafb_write_reg_mask(SR1B, VIASR, 0x02, BIT1);
524 viafb_write_reg_mask(SR2A, VIASR, 0x10, BIT4);
525 break;
526 }
527
528 default:
529 {
530 break;
531 }
532 }
533}
534
535static void dvi_patch_skew_dvp_low(void)
536{
537 switch (viaparinfo->chip_info->gfx_chip_name) {
538 case UNICHROME_K8M890:
539 {
540 viafb_write_reg_mask(CR99, VIACR, 0x03, BIT0 + BIT1);
541 break;
542 }
543
544 case UNICHROME_P4M900:
545 {
546 viafb_write_reg_mask(CR99, VIACR, 0x08,
547 BIT0 + BIT1 + BIT2 + BIT3);
548 break;
549 }
550
551 case UNICHROME_P4M890:
552 {
553 viafb_write_reg_mask(CR99, VIACR, 0x0F,
554 BIT0 + BIT1 + BIT2 + BIT3);
555 break;
556 }
557
558 default:
559 {
560 break;
561 }
562 }
563}
564
499/* If Enable DVI, turn off pad */ 565/* If Enable DVI, turn off pad */
500void viafb_dvi_enable(void) 566void viafb_dvi_enable(void)
501{ 567{
502 u8 data; 568 u8 data;
503 569
504 if (viaparinfo->chip_info-> 570 switch (viaparinfo->chip_info->tmds_chip_info.output_interface) {
505 tmds_chip_info.output_interface == INTERFACE_DVP0) { 571 case INTERFACE_DVP0:
506 viafb_write_reg(SR1E, VIASR, 572 viafb_write_reg_mask(CR6B, VIACR, 0x01, BIT0);
507 viafb_read_reg(VIASR, SR1E) | 0xC0); 573 viafb_write_reg_mask(CR6C, VIACR, 0x21, BIT0 + BIT5);
574 viafb_write_reg_mask(SR1E, VIASR, 0xC0, BIT7 + BIT6);
575 dvi_patch_skew_dvp0();
508 if (viaparinfo->chip_info->gfx_chip_name == UNICHROME_CLE266) 576 if (viaparinfo->chip_info->gfx_chip_name == UNICHROME_CLE266)
509 tmds_register_write(0x88, 0x3b); 577 tmds_register_write(0x88, 0x3b);
510 else 578 else
511 /*clear CR91[5] to direct on display period 579 /*clear CR91[5] to direct on display period
512 in the secondary diplay path */ 580 in the secondary diplay path */
513 viafb_write_reg(CR91, VIACR, 581 via_write_reg_mask(VIACR, 0x91, 0x00, 0x20);
514 viafb_read_reg(VIACR, CR91) & 0xDF); 582 break;
515 }
516 583
517 if (viaparinfo->chip_info-> 584 case INTERFACE_DVP1:
518 tmds_chip_info.output_interface == INTERFACE_DVP1) { 585 if (viaparinfo->chip_info->gfx_chip_name == UNICHROME_CLE266)
519 viafb_write_reg(SR1E, VIASR, 586 viafb_write_reg_mask(CR93, VIACR, 0x21, BIT0 + BIT5);
520 viafb_read_reg(VIASR, SR1E) | 0x30);
521 587
588 viafb_write_reg_mask(SR1E, VIASR, 0x30, BIT4 + BIT5);
522 /*fix dvi cann't be enabled with MB VT5718C4 - Al Zhang */ 589 /*fix dvi cann't be enabled with MB VT5718C4 - Al Zhang */
523 if (viaparinfo->chip_info->gfx_chip_name == UNICHROME_CLE266) { 590 if (viaparinfo->chip_info->gfx_chip_name == UNICHROME_CLE266)
524 tmds_register_write(0x88, 0x3b); 591 tmds_register_write(0x88, 0x3b);
525 } else { 592 else
526 /*clear CR91[5] to direct on display period 593 /*clear CR91[5] to direct on display period
527 in the secondary diplay path */ 594 in the secondary diplay path */
528 viafb_write_reg(CR91, VIACR, 595 via_write_reg_mask(VIACR, 0x91, 0x00, 0x20);
529 viafb_read_reg(VIACR, CR91) & 0xDF);
530 }
531 596
532 /*fix DVI cannot enable on EPIA-M board */ 597 /*fix DVI cannot enable on EPIA-M board */
533 if (viafb_platform_epia_dvi == 1) { 598 if (viafb_platform_epia_dvi == 1) {
@@ -539,36 +604,41 @@ void viafb_dvi_enable(void)
539 else 604 else
540 data = 0x37; 605 data = 0x37;
541 viafb_i2c_writebyte(viaparinfo->chip_info-> 606 viafb_i2c_writebyte(viaparinfo->chip_info->
542 tmds_chip_info.i2c_port, 607 tmds_chip_info.i2c_port,
543 viaparinfo->chip_info-> 608 viaparinfo->chip_info->
544 tmds_chip_info.tmds_chip_slave_addr, 609 tmds_chip_info.tmds_chip_slave_addr,
545 0x08, data); 610 0x08, data);
546 } 611 }
547 } 612 }
548 } 613 break;
549 614
550 if (viaparinfo->chip_info-> 615 case INTERFACE_DFP_HIGH:
551 tmds_chip_info.output_interface == INTERFACE_DFP_HIGH) { 616 if (viaparinfo->chip_info->gfx_chip_name != UNICHROME_CLE266)
552 viafb_write_reg(SR2A, VIASR, 617 via_write_reg_mask(VIACR, CR97, 0x03, 0x03);
553 viafb_read_reg(VIASR, SR2A) | 0x0C);
554 viafb_write_reg(CR91, VIACR,
555 viafb_read_reg(VIACR, CR91) & 0xDF);
556 }
557 618
558 if (viaparinfo->chip_info-> 619 viafb_write_reg_mask(SR2A, VIASR, 0x0C, BIT2 + BIT3);
559 tmds_chip_info.output_interface == INTERFACE_DFP_LOW) { 620 via_write_reg_mask(VIACR, 0x91, 0x00, 0x20);
560 viafb_write_reg(SR2A, VIASR, 621 break;
561 viafb_read_reg(VIASR, SR2A) | 0x03); 622
562 viafb_write_reg(CR91, VIACR, 623 case INTERFACE_DFP_LOW:
563 viafb_read_reg(VIACR, CR91) & 0xDF); 624 if (viaparinfo->chip_info->gfx_chip_name == UNICHROME_CLE266)
564 } 625 break;
565 if (viaparinfo->chip_info-> 626 viafb_write_reg_mask(SR2A, VIASR, 0x03, BIT0 + BIT1);
566 tmds_chip_info.output_interface == INTERFACE_TMDS) { 627 dvi_patch_skew_dvp_low();
628 via_write_reg_mask(VIACR, 0x91, 0x00, 0x20);
629 break;
630
631 case INTERFACE_TMDS:
567 /* Turn on Display period in the panel path. */ 632 /* Turn on Display period in the panel path. */
568 viafb_write_reg_mask(CR91, VIACR, 0, BIT7); 633 viafb_write_reg_mask(CR91, VIACR, 0, BIT7);
569 634
570 /* Turn on TMDS power. */ 635 /* Turn on TMDS power. */
571 viafb_write_reg_mask(CRD2, VIACR, 0, BIT3); 636 viafb_write_reg_mask(CRD2, VIACR, 0, BIT3);
637 break;
572 } 638 }
573}
574 639
640 if (viaparinfo->tmds_setting_info->iga_path == IGA2) {
641 /* Disable LCD Scaling */
642 viafb_write_reg_mask(CR79, VIACR, 0x00, BIT0);
643 }
644}