| @@ -567,29 +567,26 @@ void R128GetPanelInfoFromBIOS(xf86Output | | | @@ -567,29 +567,26 @@ void R128GetPanelInfoFromBIOS(xf86Output |
567 | r128_output->PanelXRes = R128_BIOS16(info->FPBIOSstart + 25); | | 567 | r128_output->PanelXRes = R128_BIOS16(info->FPBIOSstart + 25); |
568 | if (!r128_output->PanelYRes) | | 568 | if (!r128_output->PanelYRes) |
569 | r128_output->PanelYRes = R128_BIOS16(info->FPBIOSstart + 27); | | 569 | r128_output->PanelYRes = R128_BIOS16(info->FPBIOSstart + 27); |
570 | xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Panel size: %dx%d\n", | | 570 | xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Panel size: %dx%d\n", |
571 | r128_output->PanelXRes, r128_output->PanelYRes); | | 571 | r128_output->PanelXRes, r128_output->PanelYRes); |
572 | | | 572 | |
573 | r128_output->PanelPwrDly = R128_BIOS8(info->FPBIOSstart + 56); | | 573 | r128_output->PanelPwrDly = R128_BIOS8(info->FPBIOSstart + 56); |
574 | | | 574 | |
575 | if (!r128_output->PanelXRes || !r128_output->PanelYRes) { | | 575 | if (!r128_output->PanelXRes || !r128_output->PanelYRes) { |
576 | info->HasPanelRegs = FALSE; | | 576 | info->HasPanelRegs = FALSE; |
577 | xf86DrvMsg(pScrn->scrnIndex, X_WARNING, | | 577 | xf86DrvMsg(pScrn->scrnIndex, X_WARNING, |
578 | "Can't determine panel dimensions, and none specified.\n" | | 578 | "Can't determine panel dimensions, and none specified.\n" |
579 | "\tDisabling programming of FP registers.\n"); | | 579 | "\tDisabling programming of FP registers.\n"); |
580 | } else { | | | |
581 | xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Panel size: %dx%d\n", | | | |
582 | info->PanelXRes, info->PanelYRes); | | | |
583 | } | | 580 | } |
584 | | | 581 | |
585 | xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Panel ID: "); | | 582 | xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Panel ID: "); |
586 | for (i = 1; i <= 24; i++) | | 583 | for (i = 1; i <= 24; i++) |
587 | ErrorF("%c", R128_BIOS8(info->FPBIOSstart + i)); | | 584 | ErrorF("%c", R128_BIOS8(info->FPBIOSstart + i)); |
588 | | | 585 | |
589 | ErrorF("\n"); | | 586 | ErrorF("\n"); |
590 | | | 587 | |
591 | xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Panel Type: "); | | 588 | xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Panel Type: "); |
592 | i = R128_BIOS16(info->FPBIOSstart + 29); | | 589 | i = R128_BIOS16(info->FPBIOSstart + 29); |
593 | if (i & 1) ErrorF("Color, "); | | 590 | if (i & 1) ErrorF("Color, "); |
594 | else ErrorF("Monochrome, "); | | 591 | else ErrorF("Monochrome, "); |
595 | if (i & 2) ErrorF("Dual(split), "); | | 592 | if (i & 2) ErrorF("Dual(split), "); |
| @@ -1706,36 +1703,26 @@ Bool R128ScreenInit(SCREEN_INIT_ARGS_DEC | | | @@ -1706,36 +1703,26 @@ Bool R128ScreenInit(SCREEN_INIT_ARGS_DEC |
1706 | if (!R128MapMem(pScrn)) return FALSE; | | 1703 | if (!R128MapMem(pScrn)) return FALSE; |
1707 | pScrn->fbOffset = 0; | | 1704 | pScrn->fbOffset = 0; |
1708 | //if(info->IsSecondary) pScrn->fbOffset = pScrn->videoRam * 1024; | | 1705 | //if(info->IsSecondary) pScrn->fbOffset = pScrn->videoRam * 1024; |
1709 | #ifdef R128DRI | | 1706 | #ifdef R128DRI |
1710 | info->fbX = 0; | | 1707 | info->fbX = 0; |
1711 | info->fbY = 0; | | 1708 | info->fbY = 0; |
1712 | info->frontOffset = 0; | | 1709 | info->frontOffset = 0; |
1713 | info->frontPitch = pScrn->displayWidth; | | 1710 | info->frontPitch = pScrn->displayWidth; |
1714 | #endif | | 1711 | #endif |
1715 | | | 1712 | |
1716 | info->PaletteSavedOnVT = FALSE; | | 1713 | info->PaletteSavedOnVT = FALSE; |
1717 | | | 1714 | |
1718 | R128Save(pScrn); | | 1715 | R128Save(pScrn); |
1719 | #ifndef AVOID_FBDEV | | | |
1720 | if (info->FBDev) { | | | |
1721 | if (!fbdevHWModeInit(pScrn, pScrn->currentMode)) return FALSE; | | | |
1722 | } else { | | | |
1723 | #endif | | | |
1724 | if (!R128ModeInit(pScrn, pScrn->currentMode)) return FALSE; | | | |
1725 | } | | | |
1726 | | | | |
1727 | R128SaveScreen(pScreen, SCREEN_SAVER_ON); | | | |
1728 | pScrn->AdjustFrame(ADJUST_FRAME_ARGS(pScrn, pScrn->frameX0, pScrn->frameY0)); | | | |
1729 | | | 1716 | |
1730 | /* Visual setup */ | | 1717 | /* Visual setup */ |
1731 | miClearVisualTypes(); | | 1718 | miClearVisualTypes(); |
1732 | if (!miSetVisualTypes(pScrn->depth, | | 1719 | if (!miSetVisualTypes(pScrn->depth, |
1733 | miGetDefaultVisualMask(pScrn->depth), | | 1720 | miGetDefaultVisualMask(pScrn->depth), |
1734 | pScrn->rgbBits, | | 1721 | pScrn->rgbBits, |
1735 | pScrn->defaultVisual)) return FALSE; | | 1722 | pScrn->defaultVisual)) return FALSE; |
1736 | miSetPixmapDepths (); | | 1723 | miSetPixmapDepths (); |
1737 | | | 1724 | |
1738 | noAccel = xf86ReturnOptValBool(info->Options, OPTION_NOACCEL, FALSE); | | 1725 | noAccel = xf86ReturnOptValBool(info->Options, OPTION_NOACCEL, FALSE); |
1739 | if (noAccel) info->useEXA = FALSE; | | 1726 | if (noAccel) info->useEXA = FALSE; |
1740 | | | 1727 | |
1741 | #ifdef R128DRI | | 1728 | #ifdef R128DRI |
| @@ -2091,31 +2078,35 @@ Bool R128ScreenInit(SCREEN_INIT_ARGS_DEC | | | @@ -2091,31 +2078,35 @@ Bool R128ScreenInit(SCREEN_INIT_ARGS_DEC |
2091 | xf86DrvMsg(pScrn->scrnIndex, X_INFO, | | 2078 | xf86DrvMsg(pScrn->scrnIndex, X_INFO, |
2092 | "Filled in offs\n"); | | 2079 | "Filled in offs\n"); |
2093 | | | 2080 | |
2094 | info->ExaDriver->memorySize = info->FbMapSize; | | 2081 | info->ExaDriver->memorySize = info->FbMapSize; |
2095 | R128VerboseInitEXA(pScreen); | | 2082 | R128VerboseInitEXA(pScreen); |
2096 | } | | 2083 | } |
2097 | #endif | | 2084 | #endif |
2098 | } | | 2085 | } |
2099 | | | 2086 | |
2100 | pScrn->vtSema = TRUE; | | 2087 | pScrn->vtSema = TRUE; |
2101 | /* xf86CrtcRotate accesses pScrn->pScreen */ | | 2088 | /* xf86CrtcRotate accesses pScrn->pScreen */ |
2102 | pScrn->pScreen = pScreen; | | 2089 | pScrn->pScreen = pScreen; |
2103 | | | 2090 | |
| | | 2091 | #ifndef AVOID_FBDEV |
2104 | if (info->FBDev) { | | 2092 | if (info->FBDev) { |
2105 | if (!fbdevHWModeInit(pScrn, pScrn->currentMode)) return FALSE; | | 2093 | if (!fbdevHWModeInit(pScrn, pScrn->currentMode)) return FALSE; |
2106 | } else { | | 2094 | } else { |
| | | 2095 | #endif |
2107 | if (!xf86SetDesiredModes(pScrn)) return FALSE; | | 2096 | if (!xf86SetDesiredModes(pScrn)) return FALSE; |
| | | 2097 | #ifndef AVOID_FBDEV |
2108 | } | | 2098 | } |
| | | 2099 | #endif |
2109 | | | 2100 | |
2110 | R128SaveScreen(pScreen, SCREEN_SAVER_ON); | | 2101 | R128SaveScreen(pScreen, SCREEN_SAVER_ON); |
2111 | //pScrn->AdjustFrame(ADJUST_FRAME_ARGS(pScrn, pScrn->frameX0, pScrn->frameY0)); | | 2102 | //pScrn->AdjustFrame(ADJUST_FRAME_ARGS(pScrn, pScrn->frameX0, pScrn->frameY0)); |
2112 | | | 2103 | |
2113 | /* DGA setup */ | | 2104 | /* DGA setup */ |
2114 | #ifdef XFreeXDGA | | 2105 | #ifdef XFreeXDGA |
2115 | xf86DiDGAInit(pScreen, info->LinearAddr + pScrn->fbOffset); | | 2106 | xf86DiDGAInit(pScreen, info->LinearAddr + pScrn->fbOffset); |
2116 | #endif | | 2107 | #endif |
2117 | | | 2108 | |
2118 | /* Backing store setup */ | | 2109 | /* Backing store setup */ |
2119 | xf86SetBackingStore(pScreen); | | 2110 | xf86SetBackingStore(pScreen); |
2120 | | | 2111 | |
2121 | /* Set Silken Mouse */ | | 2112 | /* Set Silken Mouse */ |
| @@ -2139,39 +2130,30 @@ Bool R128ScreenInit(SCREEN_INIT_ARGS_DEC | | | @@ -2139,39 +2130,30 @@ Bool R128ScreenInit(SCREEN_INIT_ARGS_DEC |
2139 | xf86DrvMsg(pScrn->scrnIndex, X_ERROR, | | 2130 | xf86DrvMsg(pScrn->scrnIndex, X_ERROR, |
2140 | "Hardware cursor initialization failed\n"); | | 2131 | "Hardware cursor initialization failed\n"); |
2141 | xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Using software cursor\n"); | | 2132 | xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Using software cursor\n"); |
2142 | } | | 2133 | } |
2143 | } else { | | 2134 | } else { |
2144 | xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Using software cursor\n"); | | 2135 | xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Using software cursor\n"); |
2145 | } | | 2136 | } |
2146 | | | 2137 | |
2147 | /* DPMS setup - FIXME: also for mirror mode in non-fbdev case? - Michel */ | | 2138 | /* DPMS setup - FIXME: also for mirror mode in non-fbdev case? - Michel */ |
2148 | #ifndef AVOID_FBDEV | | 2139 | #ifndef AVOID_FBDEV |
2149 | if (info->FBDev) | | 2140 | if (info->FBDev) |
2150 | xf86DPMSInit(pScreen, fbdevHWDPMSSetWeak(), 0); | | 2141 | xf86DPMSInit(pScreen, fbdevHWDPMSSetWeak(), 0); |
2151 | else | | 2142 | else |
2152 | xf86DPMSInit(pScreen, xf86DPMSSet, 0); | | | |
2153 | | | | |
2154 | else | | | |
2155 | #endif | | 2143 | #endif |
2156 | { | | 2144 | xf86DPMSInit(pScreen, xf86DPMSSet, 0); |
2157 | if (info->DisplayType == MT_LCD) | | | |
2158 | xf86DPMSInit(pScreen, R128DisplayPowerManagementSetLCD, 0); | | | |
2159 | else | | | |
2160 | xf86DPMSInit(pScreen, R128DisplayPowerManagementSet, 0); | | | |
2161 | } | | | |
2162 | | | 2145 | |
2163 | if (!info->IsSecondary) | | 2146 | R128InitVideo(pScreen); |
2164 | R128InitVideo(pScreen); | | | |
2165 | | | 2147 | |
2166 | /* Provide SaveScreen */ | | 2148 | /* Provide SaveScreen */ |
2167 | pScreen->SaveScreen = R128SaveScreen; | | 2149 | pScreen->SaveScreen = R128SaveScreen; |
2168 | | | 2150 | |
2169 | /* Wrap CloseScreen */ | | 2151 | /* Wrap CloseScreen */ |
2170 | info->CloseScreen = pScreen->CloseScreen; | | 2152 | info->CloseScreen = pScreen->CloseScreen; |
2171 | pScreen->CloseScreen = R128CloseScreen; | | 2153 | pScreen->CloseScreen = R128CloseScreen; |
2172 | | | 2154 | |
2173 | /* Note unused options */ | | 2155 | /* Note unused options */ |
2174 | if (serverGeneration == 1) | | 2156 | if (serverGeneration == 1) |
2175 | xf86ShowUnusedOptions(pScrn->scrnIndex, pScrn->options); | | 2157 | xf86ShowUnusedOptions(pScrn->scrnIndex, pScrn->options); |
2176 | | | 2158 | |
2177 | #ifdef R128DRI | | 2159 | #ifdef R128DRI |
| @@ -2777,33 +2759,35 @@ static void R128Restore(ScrnInfoPtr pScr | | | @@ -2777,33 +2759,35 @@ static void R128Restore(ScrnInfoPtr pScr |
2777 | if (pR128Ent->HasCRTC2) { | | 2759 | if (pR128Ent->HasCRTC2) { |
2778 | R128RestoreDDA2Registers(pScrn, restore); | | 2760 | R128RestoreDDA2Registers(pScrn, restore); |
2779 | R128RestoreCrtc2Registers(pScrn, restore); | | 2761 | R128RestoreCrtc2Registers(pScrn, restore); |
2780 | R128RestorePLL2Registers(pScrn, restore); | | 2762 | R128RestorePLL2Registers(pScrn, restore); |
2781 | } | | 2763 | } |
2782 | R128RestoreDDARegisters(pScrn, restore); | | 2764 | R128RestoreDDARegisters(pScrn, restore); |
2783 | R128RestoreCrtcRegisters(pScrn, restore); | | 2765 | R128RestoreCrtcRegisters(pScrn, restore); |
2784 | R128RestorePLLRegisters(pScrn, restore); | | 2766 | R128RestorePLLRegisters(pScrn, restore); |
2785 | R128RestoreDACRegisters(pScrn, restore); | | 2767 | R128RestoreDACRegisters(pScrn, restore); |
2786 | R128RestoreRMXRegisters(pScrn, restore); | | 2768 | R128RestoreRMXRegisters(pScrn, restore); |
2787 | R128RestoreFPRegisters(pScrn, restore); | | 2769 | R128RestoreFPRegisters(pScrn, restore); |
2788 | R128RestoreLVDSRegisters(pScrn, restore); | | 2770 | R128RestoreLVDSRegisters(pScrn, restore); |
2789 | | | 2771 | |
| | | 2772 | #if 0 |
2790 | if (!info->IsSecondary) { | | 2773 | if (!info->IsSecondary) { |
2791 | OUTREG(R128_AMCGPIO_MASK, restore->amcgpio_mask); | | 2774 | OUTREG(R128_AMCGPIO_MASK, restore->amcgpio_mask); |
2792 | OUTREG(R128_AMCGPIO_EN_REG, restore->amcgpio_en_reg); | | 2775 | OUTREG(R128_AMCGPIO_EN_REG, restore->amcgpio_en_reg); |
2793 | OUTREG(R128_CLOCK_CNTL_INDEX, restore->clock_cntl_index); | | 2776 | OUTREG(R128_CLOCK_CNTL_INDEX, restore->clock_cntl_index); |
2794 | OUTREG(R128_GEN_RESET_CNTL, restore->gen_reset_cntl); | | 2777 | OUTREG(R128_GEN_RESET_CNTL, restore->gen_reset_cntl); |
2795 | OUTREG(R128_DP_DATATYPE, restore->dp_datatype); | | 2778 | OUTREG(R128_DP_DATATYPE, restore->dp_datatype); |
2796 | } | | 2779 | } |
| | | 2780 | #endif |
2797 | | | 2781 | |
2798 | #ifdef WITH_VGAHW | | 2782 | #ifdef WITH_VGAHW |
2799 | if (info->VGAAccess) { | | 2783 | if (info->VGAAccess) { |
2800 | vgaHWPtr hwp = VGAHWPTR(pScrn); | | 2784 | vgaHWPtr hwp = VGAHWPTR(pScrn); |
2801 | vgaHWUnlock(hwp); | | 2785 | vgaHWUnlock(hwp); |
2802 | # if defined(__powerpc__) | | 2786 | # if defined(__powerpc__) |
2803 | /* Temporary hack to prevent crashing on PowerMacs when trying to | | 2787 | /* Temporary hack to prevent crashing on PowerMacs when trying to |
2804 | * write VGA fonts, will find a better solution in the future | | 2788 | * write VGA fonts, will find a better solution in the future |
2805 | */ | | 2789 | */ |
2806 | vgaHWRestore(pScrn, &hwp->SavedReg, VGA_SR_MODE ); | | 2790 | vgaHWRestore(pScrn, &hwp->SavedReg, VGA_SR_MODE ); |
2807 | # else | | 2791 | # else |
2808 | vgaHWRestore(pScrn, &hwp->SavedReg, VGA_SR_MODE | VGA_SR_FONTS ); | | 2792 | vgaHWRestore(pScrn, &hwp->SavedReg, VGA_SR_MODE | VGA_SR_FONTS ); |
2809 | # endif | | 2793 | # endif |
| @@ -3619,34 +3603,32 @@ void R128AdjustFrame(ADJUST_FRAME_ARGS_D | | | @@ -3619,34 +3603,32 @@ void R128AdjustFrame(ADJUST_FRAME_ARGS_D |
3619 | /* Called when VT switching back to the X server. Reinitialize the video | | 3603 | /* Called when VT switching back to the X server. Reinitialize the video |
3620 | mode. */ | | 3604 | mode. */ |
3621 | Bool R128EnterVT(VT_FUNC_ARGS_DECL) | | 3605 | Bool R128EnterVT(VT_FUNC_ARGS_DECL) |
3622 | { | | 3606 | { |
3623 | SCRN_INFO_PTR(arg); | | 3607 | SCRN_INFO_PTR(arg); |
3624 | R128InfoPtr info = R128PTR(pScrn); | | 3608 | R128InfoPtr info = R128PTR(pScrn); |
3625 | | | 3609 | |
3626 | R128TRACE(("R128EnterVT\n")); | | 3610 | R128TRACE(("R128EnterVT\n")); |
3627 | | | 3611 | |
3628 | pScrn->vtSema = TRUE; | | 3612 | pScrn->vtSema = TRUE; |
3629 | #ifndef AVOID_FBDEV | | 3613 | #ifndef AVOID_FBDEV |
3630 | if (info->FBDev) { | | 3614 | if (info->FBDev) { |
3631 | if (!fbdevHWEnterVT(VT_FUNC_ARGS)) return FALSE; | | 3615 | if (!fbdevHWEnterVT(VT_FUNC_ARGS)) return FALSE; |
3632 | } else | | 3616 | } else { |
3633 | #endif | | 3617 | #endif |
3634 | if (!R128ModeInit(pScrn, pScrn->currentMode)) return FALSE; | | 3618 | if (!xf86SetDesiredModes(pScrn)) return FALSE; |
3635 | else { | | 3619 | #ifndef AVOID_FBDEV |
3636 | if (!xf86SetDesiredModes(pScrn)) return FALSE; | | | |
3637 | } | | 3620 | } |
3638 | | | 3621 | #endif |
3639 | //if (!R128ModeInit(pScrn, pScrn->currentMode)) return FALSE; | | | |
3640 | | | 3622 | |
3641 | if (info->accelOn) | | 3623 | if (info->accelOn) |
3642 | R128EngineInit(pScrn); | | 3624 | R128EngineInit(pScrn); |
3643 | | | 3625 | |
3644 | #ifdef R128DRI | | 3626 | #ifdef R128DRI |
3645 | if (info->directRenderingEnabled) { | | 3627 | if (info->directRenderingEnabled) { |
3646 | if (info->irq) { | | 3628 | if (info->irq) { |
3647 | /* Need to make sure interrupts are enabled */ | | 3629 | /* Need to make sure interrupts are enabled */ |
3648 | unsigned char *R128MMIO = info->MMIO; | | 3630 | unsigned char *R128MMIO = info->MMIO; |
3649 | OUTREG(R128_GEN_INT_CNTL, info->gen_int_cntl); | | 3631 | OUTREG(R128_GEN_INT_CNTL, info->gen_int_cntl); |
3650 | } | | 3632 | } |
3651 | R128CCE_START(pScrn, info); | | 3633 | R128CCE_START(pScrn, info); |
3652 | DRIUnlock(pScrn->pScreen); | | 3634 | DRIUnlock(pScrn->pScreen); |
| @@ -3745,139 +3727,13 @@ void R128FreeScreen(FREE_SCREEN_ARGS_DEC | | | @@ -3745,139 +3727,13 @@ void R128FreeScreen(FREE_SCREEN_ARGS_DEC |
3745 | { | | 3727 | { |
3746 | SCRN_INFO_PTR(arg); | | 3728 | SCRN_INFO_PTR(arg); |
3747 | R128InfoPtr info = R128PTR(pScrn); | | 3729 | R128InfoPtr info = R128PTR(pScrn); |
3748 | | | 3730 | |
3749 | R128TRACE(("R128FreeScreen\n")); | | 3731 | R128TRACE(("R128FreeScreen\n")); |
3750 | if (info == NULL) | | 3732 | if (info == NULL) |
3751 | return; | | 3733 | return; |
3752 | #ifdef WITH_VGAHW | | 3734 | #ifdef WITH_VGAHW |
3753 | if (info->VGAAccess && xf86LoaderCheckSymbol("vgaHWFreeHWRec")) | | 3735 | if (info->VGAAccess && xf86LoaderCheckSymbol("vgaHWFreeHWRec")) |
3754 | vgaHWFreeHWRec(pScrn); | | 3736 | vgaHWFreeHWRec(pScrn); |
3755 | #endif | | 3737 | #endif |
3756 | R128FreeRec(pScrn); | | 3738 | R128FreeRec(pScrn); |
3757 | } | | 3739 | } |
3758 | | | | |
3759 | /* Sets VESA Display Power Management Signaling (DPMS) Mode. */ | | | |
3760 | static void R128DisplayPowerManagementSet(ScrnInfoPtr pScrn, | | | |
3761 | int PowerManagementMode, int flags) | | | |
3762 | { | | | |
3763 | R128InfoPtr info = R128PTR(pScrn); | | | |
3764 | unsigned char *R128MMIO = info->MMIO; | | | |
3765 | int mask = (R128_CRTC_DISPLAY_DIS | | | |
3766 | | R128_CRTC_HSYNC_DIS | | | |
3767 | | R128_CRTC_VSYNC_DIS); | | | |
3768 | int mask2 = R128_CRTC2_DISP_DIS; | | | |
3769 | | | | |
3770 | switch (PowerManagementMode) { | | | |
3771 | case DPMSModeOn: | | | |
3772 | /* Screen: On; HSync: On, VSync: On */ | | | |
3773 | if (info->IsSecondary) | | | |
3774 | OUTREGP(R128_CRTC2_GEN_CNTL, 0, ~mask2); | | | |
3775 | else | | | |
3776 | OUTREGP(R128_CRTC_EXT_CNTL, 0, ~mask); | | | |
3777 | break; | | | |
3778 | case DPMSModeStandby: | | | |
3779 | /* Screen: Off; HSync: Off, VSync: On */ | | | |
3780 | if (info->IsSecondary) | | | |
3781 | OUTREGP(R128_CRTC2_GEN_CNTL, R128_CRTC2_DISP_DIS, ~mask2); | | | |
3782 | else | | | |
3783 | OUTREGP(R128_CRTC_EXT_CNTL, | | | |
3784 | R128_CRTC_DISPLAY_DIS | R128_CRTC_HSYNC_DIS, ~mask); | | | |
3785 | break; | | | |
3786 | case DPMSModeSuspend: | | | |
3787 | /* Screen: Off; HSync: On, VSync: Off */ | | | |
3788 | if (info->IsSecondary) | | | |
3789 | OUTREGP(R128_CRTC2_GEN_CNTL, R128_CRTC2_DISP_DIS, ~mask2); | | | |
3790 | else | | | |
3791 | OUTREGP(R128_CRTC_EXT_CNTL, | | | |
3792 | R128_CRTC_DISPLAY_DIS | R128_CRTC_VSYNC_DIS, ~mask); | | | |
3793 | break; | | | |
3794 | case DPMSModeOff: | | | |
3795 | /* Screen: Off; HSync: Off, VSync: Off */ | | | |
3796 | if (info->IsSecondary) | | | |
3797 | OUTREGP(R128_CRTC2_GEN_CNTL, mask2, ~mask2); | | | |
3798 | else | | | |
3799 | OUTREGP(R128_CRTC_EXT_CNTL, mask, ~mask); | | | |
3800 | break; | | | |
3801 | } | | | |
3802 | if(info->isDFP) { | | | |
3803 | switch (PowerManagementMode) { | | | |
3804 | case DPMSModeOn: | | | |
3805 | OUTREG(R128_FP_GEN_CNTL, INREG(R128_FP_GEN_CNTL) | (R128_FP_FPON | R128_FP_TDMS_EN)); | | | |
3806 | break; | | | |
3807 | case DPMSModeStandby: | | | |
3808 | case DPMSModeSuspend: | | | |
3809 | case DPMSModeOff: | | | |
3810 | OUTREG(R128_FP_GEN_CNTL, INREG(R128_FP_GEN_CNTL) & ~(R128_FP_FPON | R128_FP_TDMS_EN)); | | | |
3811 | break; | | | |
3812 | } | | | |
3813 | } | | | |
3814 | } | | | |
3815 | | | | |
3816 | static int r128_set_backlight_enable(ScrnInfoPtr pScrn, int on); | | | |
3817 | | | | |
3818 | static void R128DisplayPowerManagementSetLCD(ScrnInfoPtr pScrn, | | | |
3819 | int PowerManagementMode, int flags) | | | |
3820 | { | | | |
3821 | R128InfoPtr info = R128PTR(pScrn); | | | |
3822 | unsigned char *R128MMIO = info->MMIO; | | | |
3823 | int mask = R128_LVDS_DISPLAY_DIS; | | | |
3824 | | | | |
3825 | switch (PowerManagementMode) { | | | |
3826 | case DPMSModeOn: | | | |
3827 | /* Screen: On; HSync: On, VSync: On */ | | | |
3828 | OUTREGP(R128_LVDS_GEN_CNTL, 0, ~mask); | | | |
3829 | r128_set_backlight_enable(pScrn, 1); | | | |
3830 | break; | | | |
3831 | case DPMSModeStandby: | | | |
3832 | /* Fall through */ | | | |
3833 | case DPMSModeSuspend: | | | |
3834 | /* Fall through */ | | | |
3835 | case DPMSModeOff: | | | |
3836 | /* Screen: Off; HSync: Off, VSync: Off */ | | | |
3837 | OUTREGP(R128_LVDS_GEN_CNTL, mask, ~mask); | | | |
3838 | r128_set_backlight_enable(pScrn, 0); | | | |
3839 | break; | | | |
3840 | } | | | |
3841 | } | | | |
3842 | | | | |
3843 | static int r128_set_backlight_enable(ScrnInfoPtr pScrn, int on) | | | |
3844 | { | | | |
3845 | R128InfoPtr info = R128PTR(pScrn); | | | |
3846 | unsigned char *R128MMIO = info->MMIO; | | | |
3847 | unsigned int lvds_gen_cntl = INREG(R128_LVDS_GEN_CNTL); | | | |
3848 | | | | |
3849 | lvds_gen_cntl |= (/*R128_LVDS_BL_MOD_EN |*/ R128_LVDS_BLON); | | | |
3850 | if (on) { | | | |
3851 | lvds_gen_cntl |= R128_LVDS_DIGON; | | | |
3852 | if (!(lvds_gen_cntl & R128_LVDS_ON)) { | | | |
3853 | lvds_gen_cntl &= ~R128_LVDS_BLON; | | | |
3854 | OUTREG(R128_LVDS_GEN_CNTL, lvds_gen_cntl); | | | |
3855 | (void)INREG(R128_LVDS_GEN_CNTL); | | | |
3856 | usleep(10000); | | | |
3857 | lvds_gen_cntl |= R128_LVDS_BLON; | | | |
3858 | OUTREG(R128_LVDS_GEN_CNTL, lvds_gen_cntl); | | | |
3859 | } | | | |
3860 | #if 0 | | | |
3861 | lvds_gen_cntl &= ~R128_LVDS_BL_MOD_LEVEL_MASK; | | | |
3862 | lvds_gen_cntl |= (0xFF /* backlight_conv[level] */ << | | | |
3863 | R128_LVDS_BL_MOD_LEVEL_SHIFT); | | | |
3864 | #endif | | | |
3865 | lvds_gen_cntl |= (R128_LVDS_ON | R128_LVDS_EN); | | | |
3866 | lvds_gen_cntl &= ~R128_LVDS_DISPLAY_DIS; | | | |
3867 | } else { | | | |
3868 | #if 0 | | | |
3869 | lvds_gen_cntl &= ~R128_LVDS_BL_MOD_LEVEL_MASK; | | | |
3870 | lvds_gen_cntl |= (0xFF /* backlight_conv[0] */ << | | | |
3871 | R128_LVDS_BL_MOD_LEVEL_SHIFT); | | | |
3872 | #endif | | | |
3873 | lvds_gen_cntl |= R128_LVDS_DISPLAY_DIS; | | | |
3874 | OUTREG(R128_LVDS_GEN_CNTL, lvds_gen_cntl); | | | |
3875 | usleep(10); | | | |
3876 | lvds_gen_cntl &= ~(R128_LVDS_ON | R128_LVDS_EN | R128_LVDS_BLON | | | |
3877 | | R128_LVDS_DIGON); | | | |
3878 | } | | | |
3879 | | | | |
3880 | OUTREG(R128_LVDS_GEN_CNTL, lvds_gen_cntl); | | | |
3881 | | | | |
3882 | return 0; | | | |
3883 | } | | | |