diff options
author | Francisco Jerez <currojerez@gmail.com> | 2008-12-22 17:28:35 +0100 |
---|---|---|
committer | Paulo Cesar Pereira de Andrade <pcpa@mandriva.com.br> | 2008-12-29 13:52:18 -0200 |
commit | 439adf4455c651926040eeeec52a092f14f3196b (patch) | |
tree | a5a0ef2a1e32a8228405270d7938134a3a86e4dc | |
parent | 2b3fa385a6da4be5ad6719dd115834b96d1ea3e3 (diff) |
Add support for clone mode on Lynx chipsets.
-rw-r--r-- | src/smi_crtc.c | 3 | ||||
-rw-r--r-- | src/smilynx_crtc.c | 32 | ||||
-rw-r--r-- | src/smilynx_output.c | 76 |
3 files changed, 66 insertions, 45 deletions
diff --git a/src/smi_crtc.c b/src/smi_crtc.c index 5bcc471..bccf9b2 100644 --- a/src/smi_crtc.c +++ b/src/smi_crtc.c @@ -85,6 +85,9 @@ static void SMI_CrtcCommit(xf86CrtcPtr crtc) { ENTER(); + + crtc->funcs->dpms(crtc,DPMSModeOn); + LEAVE(); } diff --git a/src/smilynx_crtc.c b/src/smilynx_crtc.c index 616cb81..508184f 100644 --- a/src/smilynx_crtc.c +++ b/src/smilynx_crtc.c @@ -822,6 +822,25 @@ SMILynx_CrtcLoadCursorImage_crt (xf86CrtcPtr crtc, CARD8 *image) LEAVE(); } +static void +SMILynx_CrtcDPMS_crt(xf86CrtcPtr crtc, int mode) +{ + ScrnInfoPtr pScrn = crtc->scrn; + SMIPtr pSmi = SMIPTR(pScrn); + SMIRegPtr reg = pSmi->mode; + + ENTER(); + + if(mode == DPMSModeOff) + reg->SR21 |= 0x88; /* Disable DAC and color palette RAM */ + else + reg->SR21 &= ~0x88; /* Enable DAC and color palette RAM */ + + VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x21, reg->SR21); + + LEAVE(); +} + Bool SMILynx_CrtcPreInit(ScrnInfoPtr pScrn) { @@ -840,10 +859,12 @@ SMILynx_CrtcPreInit(ScrnInfoPtr pScrn) SMI_CrtcFuncsInit_base(&crtcFuncs, &crtcPriv); - if(pSmi->useBIOS) + if(pSmi->useBIOS){ crtcFuncs->mode_set = SMILynx_CrtcModeSet_bios; - else + }else{ + crtcFuncs->dpms = SMILynx_CrtcDPMS_crt; crtcFuncs->mode_set = SMILynx_CrtcModeSet_vga; + } crtcPriv->adjust_frame = SMILynx_CrtcAdjustFrame; crtcPriv->video_init = SMI730_CrtcVideoInit; @@ -875,6 +896,7 @@ SMILynx_CrtcPreInit(ScrnInfoPtr pScrn) /* CRTC1 is CRT */ SMI_CrtcFuncsInit_base(&crtcFuncs, &crtcPriv); + crtcFuncs->dpms = SMILynx_CrtcDPMS_crt; crtcFuncs->mode_set = SMILynx_CrtcModeSet_crt; crtcPriv->adjust_frame = SMILynx_CrtcAdjustFrame; crtcPriv->video_init = SMILynx_CrtcVideoInit_crt; @@ -889,10 +911,12 @@ SMILynx_CrtcPreInit(ScrnInfoPtr pScrn) it is controlled through the primary VGA registers */ SMI_CrtcFuncsInit_base(&crtcFuncs, &crtcPriv); - if(pSmi->useBIOS) + if(pSmi->useBIOS){ crtcFuncs->mode_set = SMILynx_CrtcModeSet_bios; - else + }else{ + crtcFuncs->dpms = SMILynx_CrtcDPMS_crt; crtcFuncs->mode_set = SMILynx_CrtcModeSet_vga; + } crtcPriv->adjust_frame = SMILynx_CrtcAdjustFrame; crtcPriv->video_init = SMILynx_CrtcVideoInit_crt; diff --git a/src/smilynx_output.c b/src/smilynx_output.c index 4974d2c..aba6db5 100644 --- a/src/smilynx_output.c +++ b/src/smilynx_output.c @@ -46,22 +46,18 @@ SMILynx_OutputDPMS_crt(xf86OutputPtr output, int mode) switch (mode) { case DPMSModeOn: - reg->SR21 &= ~0x88; /* Enable DAC and color palette RAM */ reg->SR31 |= 0x02; /* Enable CRT display*/ reg->SR22 = (reg->SR22 & ~0x30) | 0x00; /* Set DPMS state*/ break; case DPMSModeStandby: - reg->SR21 |= 0x88; /* Disable DAC and color palette RAM */ reg->SR31 |= 0x02; /* Enable CRT display*/ reg->SR22 = (reg->SR22 & ~0x30) | 0x10; /* Set DPMS state*/ break; case DPMSModeSuspend: - reg->SR21 |= 0x88; /* Disable DAC and color palette RAM */ reg->SR31 |= 0x02; /* Enable CRT display*/ reg->SR22 = (reg->SR22 & ~0x30) | 0x20; /* Set DPMS state*/ break; case DPMSModeOff: - reg->SR21 |= 0x88; /* Disable DAC and color palette RAM */ reg->SR31 &= ~0x02; /* Disable CRT display*/ reg->SR22 = (reg->SR22 & ~0x30) | 0x30; /* Set DPMS state*/ break; @@ -73,7 +69,6 @@ SMILynx_OutputDPMS_crt(xf86OutputPtr output, int mode) while (!(hwp->readST01(hwp) & 0x8)) ; /* Write the registers */ - VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x21, reg->SR21); VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x22, reg->SR22); VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x31, reg->SR31); @@ -81,7 +76,6 @@ SMILynx_OutputDPMS_crt(xf86OutputPtr output, int mode) } - static void SMILynx_OutputDPMS_lcd(xf86OutputPtr output, int mode) { @@ -210,13 +204,13 @@ SMILynx_OutputDetect_crt(xf86OutputPtr output) SR7D = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x7D); - VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x21, mode->SR21 & ~0x80); /* Enable DAC */ + VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x21, mode->SR21 & ~0x88); /* Enable DAC and color palette RAM */ VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x7B, 0x40); /* "TV and RAMDAC Testing Power", Green component */ VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x7D, SR7D | 0x10); /* Enable monitor detect */ /* Wait for vertical retrace */ - while (hwp->readST01(hwp) & 0x8) ; while (!(hwp->readST01(hwp) & 0x8)) ; + while (hwp->readST01(hwp) & 0x8) ; status = MMIO_IN8(pSmi->IOBase, 0x3C2) & 0x10; @@ -240,9 +234,14 @@ SMILynx_OutputPreInit(ScrnInfoPtr pScrn) ENTER(); if(pSmi->Chipset == SMI_COUGAR3DR){ - /* CRTC0 is LCD */ + /* Output 0 is LCD */ SMI_OutputFuncsInit_base(&outputFuncs); - outputFuncs->dpms = SMILynx_OutputDPMS_lcd; + + if(pSmi->useBIOS) + outputFuncs->dpms = SMILynx_OutputDPMS_bios; + else + outputFuncs->dpms = SMILynx_OutputDPMS_lcd; + outputFuncs->get_modes = SMI_OutputGetModes_native; outputFuncs->detect = SMI_OutputDetect_lcd; @@ -254,22 +253,30 @@ SMILynx_OutputPreInit(ScrnInfoPtr pScrn) output->interlaceAllowed = FALSE; output->doubleScanAllowed = FALSE; }else{ - if(pSmi->Dualhead){ - /* CRTC0 is LCD*/ - SMI_OutputFuncsInit_base(&outputFuncs); + /* Output 0 is LCD */ + SMI_OutputFuncsInit_base(&outputFuncs); + + if(pSmi->useBIOS) + outputFuncs->dpms = SMILynx_OutputDPMS_bios; + else outputFuncs->dpms = SMILynx_OutputDPMS_lcd; - outputFuncs->get_modes = SMI_OutputGetModes_native; - outputFuncs->detect = SMI_OutputDetect_lcd; - if(! (output = xf86OutputCreate(pScrn,outputFuncs,"LVDS"))) - LEAVE(FALSE); + outputFuncs->get_modes = SMI_OutputGetModes_native; + outputFuncs->detect = SMI_OutputDetect_lcd; + + if(! (output = xf86OutputCreate(pScrn,outputFuncs,"LVDS"))) + LEAVE(FALSE); - output->possible_crtcs = 1 << 0; + output->interlaceAllowed = FALSE; + output->doubleScanAllowed = FALSE; + output->possible_crtcs = 1 << 0; + if(pSmi->Dualhead) output->possible_clones = 0; - output->interlaceAllowed = FALSE; - output->doubleScanAllowed = FALSE; + else + output->possible_clones = 1 << 1; - /* CRTC1 is CRT*/ + if(!pSmi->useBIOS){ + /* Output 1 is CRT */ SMI_OutputFuncsInit_base(&outputFuncs); outputFuncs->dpms = SMILynx_OutputDPMS_crt; outputFuncs->get_modes = SMILynx_OutputGetModes_crt; @@ -278,29 +285,16 @@ SMILynx_OutputPreInit(ScrnInfoPtr pScrn) if(! (output = xf86OutputCreate(pScrn,outputFuncs,"VGA"))) LEAVE(FALSE); - output->possible_crtcs = 1 << 1; - output->possible_clones = 0; output->interlaceAllowed = FALSE; output->doubleScanAllowed = FALSE; - }else{ - /* CRTC0 is LCD */ - SMI_OutputFuncsInit_base(&outputFuncs); - - if(pSmi->useBIOS) - outputFuncs->dpms = SMILynx_OutputDPMS_bios; - else - outputFuncs->dpms = SMILynx_OutputDPMS_lcd; - outputFuncs->get_modes = SMI_OutputGetModes_native; - outputFuncs->detect = SMI_OutputDetect_lcd; - - if(! (output = xf86OutputCreate(pScrn,outputFuncs,"LVDS"))) - LEAVE(FALSE); - - output->possible_crtcs = 1 << 0; - output->possible_clones = 0; - output->interlaceAllowed = FALSE; - output->doubleScanAllowed = FALSE; + if(pSmi->Dualhead){ + output->possible_crtcs = 1 << 1; + output->possible_clones = 0; + }else{ + output->possible_crtcs = 1 << 0; + output->possible_clones = 1 << 0; + } } } |