Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 30279
b: refs/heads/master
c: f8020dc
h: refs/heads/master
i:
  30277: 793d378
  30275: 0edadf1
  30271: 9144775
v: v3
  • Loading branch information
Antonino A. Daplas authored and Linus Torvalds committed Jun 26, 2006
1 parent 200c5b2 commit 3046d79
Show file tree
Hide file tree
Showing 2 changed files with 192 additions and 19 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 2356614b08bf8769790c4f1f55c83d95f802bc51
refs/heads/master: f8020dc560fde089becc05de1d0ada1f7f46dc51
209 changes: 191 additions & 18 deletions trunk/drivers/video/savage/savagefb_driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ savage2000_waitidle(struct savagefb_par *par)
while ((savage_in32(0x48C60, par) & 0x009fffff));
}


#ifdef CONFIG_FB_SAVAGE_ACCEL
static void
SavageSetup2DEngine (struct savagefb_par *par)
{
Expand Down Expand Up @@ -388,6 +388,22 @@ SavageSetup2DEngine (struct savagefb_par *par)
BCI_SEND( GlobalBitmapDescriptor );
}

static void savagefb_set_clip(struct fb_info *info)
{
struct savagefb_par *par = info->par;
int cmd;

cmd = BCI_CMD_NOP | BCI_CMD_CLIP_NEW;
par->bci_ptr = 0;
par->SavageWaitFifo(par,3);
BCI_SEND(cmd);
BCI_SEND(BCI_CLIP_TL(0, 0));
BCI_SEND(BCI_CLIP_BR(0xfff, 0xfff));
}
#else
static void SavageSetup2DEngine (struct savagefb_par *par) {}

#endif

static void SavageCalcClock(long freq, int min_m, int min_n1, int max_n1,
int min_n2, int max_n2, long freq_min,
Expand Down Expand Up @@ -666,6 +682,159 @@ static void savage_get_default_par(struct savagefb_par *par, struct savage_reg *
vga_out8 (0x3d5, cr66, par);
}

static void savage_set_default_par(struct savagefb_par *par,
struct savage_reg *reg)
{
unsigned char cr3a, cr53, cr66;

vga_out16(0x3d4, 0x4838, par);
vga_out16(0x3d4, 0xa039, par);
vga_out16(0x3c4, 0x0608, par);

vga_out8(0x3d4, 0x66, par);
cr66 = vga_in8(0x3d5, par);
vga_out8(0x3d5, cr66 | 0x80, par);
vga_out8(0x3d4, 0x3a, par);
cr3a = vga_in8(0x3d5, par);
vga_out8(0x3d5, cr3a | 0x80, par);
vga_out8(0x3d4, 0x53, par);
cr53 = vga_in8(0x3d5, par);
vga_out8(0x3d5, cr53 & 0x7f, par);

vga_out8(0x3d4, 0x66, par);
vga_out8(0x3d5, cr66, par);
vga_out8(0x3d4, 0x3a, par);
vga_out8(0x3d5, cr3a, par);

vga_out8(0x3d4, 0x66, par);
vga_out8(0x3d5, cr66, par);
vga_out8(0x3d4, 0x3a, par);
vga_out8(0x3d5, cr3a, par);

/* unlock extended seq regs */
vga_out8(0x3c4, 0x08, par);
vga_out8(0x3c5, reg->SR08, par);
vga_out8(0x3c5, 0x06, par);

/* now restore all the extended regs we need */
vga_out8(0x3d4, 0x31, par);
vga_out8(0x3d5, reg->CR31, par);
vga_out8(0x3d4, 0x32, par);
vga_out8(0x3d5, reg->CR32, par);
vga_out8(0x3d4, 0x34, par);
vga_out8(0x3d5, reg->CR34, par);
vga_out8(0x3d4, 0x36, par);
vga_out8(0x3d5,reg->CR36, par);
vga_out8(0x3d4, 0x3a, par);
vga_out8(0x3d5, reg->CR3A, par);
vga_out8(0x3d4, 0x40, par);
vga_out8(0x3d5, reg->CR40, par);
vga_out8(0x3d4, 0x42, par);
vga_out8(0x3d5, reg->CR42, par);
vga_out8(0x3d4, 0x45, par);
vga_out8(0x3d5, reg->CR45, par);
vga_out8(0x3d4, 0x50, par);
vga_out8(0x3d5, reg->CR50, par);
vga_out8(0x3d4, 0x51, par);
vga_out8(0x3d5, reg->CR51, par);
vga_out8(0x3d4, 0x53, par);
vga_out8(0x3d5, reg->CR53, par);
vga_out8(0x3d4, 0x58, par);
vga_out8(0x3d5, reg->CR58, par);
vga_out8(0x3d4, 0x60, par);
vga_out8(0x3d5, reg->CR60, par);
vga_out8(0x3d4, 0x66, par);
vga_out8(0x3d5, reg->CR66, par);
vga_out8(0x3d4, 0x67, par);
vga_out8(0x3d5, reg->CR67, par);
vga_out8(0x3d4, 0x68, par);
vga_out8(0x3d5, reg->CR68, par);
vga_out8(0x3d4, 0x69, par);
vga_out8(0x3d5, reg->CR69, par);
vga_out8(0x3d4, 0x6f, par);
vga_out8(0x3d5, reg->CR6F, par);

vga_out8(0x3d4, 0x33, par);
vga_out8(0x3d5, reg->CR33, par);
vga_out8(0x3d4, 0x86, par);
vga_out8(0x3d5, reg->CR86, par);
vga_out8(0x3d4, 0x88, par);
vga_out8(0x3d5, reg->CR88, par);
vga_out8(0x3d4, 0x90, par);
vga_out8(0x3d5, reg->CR90, par);
vga_out8(0x3d4, 0x91, par);
vga_out8(0x3d5, reg->CR91, par);
vga_out8(0x3d4, 0xb0, par);
vga_out8(0x3d5, reg->CRB0, par);

/* extended mode timing regs */
vga_out8(0x3d4, 0x3b, par);
vga_out8(0x3d5, reg->CR3B, par);
vga_out8(0x3d4, 0x3c, par);
vga_out8(0x3d5, reg->CR3C, par);
vga_out8(0x3d4, 0x43, par);
vga_out8(0x3d5, reg->CR43, par);
vga_out8(0x3d4, 0x5d, par);
vga_out8(0x3d5, reg->CR5D, par);
vga_out8(0x3d4, 0x5e, par);
vga_out8(0x3d5, reg->CR5E, par);
vga_out8(0x3d4, 0x65, par);
vga_out8(0x3d5, reg->CR65, par);

/* save seq extended regs for DCLK PLL programming */
vga_out8(0x3c4, 0x0e, par);
vga_out8(0x3c5, reg->SR0E, par);
vga_out8(0x3c4, 0x0f, par);
vga_out8(0x3c5, reg->SR0F, par);
vga_out8(0x3c4, 0x10, par);
vga_out8(0x3c5, reg->SR10, par);
vga_out8(0x3c4, 0x11, par);
vga_out8(0x3c5, reg->SR11, par);
vga_out8(0x3c4, 0x12, par);
vga_out8(0x3c5, reg->SR12, par);
vga_out8(0x3c4, 0x13, par);
vga_out8(0x3c5, reg->SR13, par);
vga_out8(0x3c4, 0x29, par);
vga_out8(0x3c5, reg->SR29, par);

vga_out8(0x3c4, 0x15, par);
vga_out8(0x3c5, reg->SR15, par);
vga_out8(0x3c4, 0x30, par);
vga_out8(0x3c5, reg->SR30, par);
vga_out8(0x3c4, 0x18, par);
vga_out8(0x3c5, reg->SR18, par);

/* Save flat panel expansion regsters. */
if (par->chip == S3_SAVAGE_MX) {
int i;

for (i = 0; i < 8; i++) {
vga_out8(0x3c4, 0x54+i, par);
vga_out8(0x3c5, reg->SR54[i], par);
}
}

vga_out8(0x3d4, 0x66, par);
cr66 = vga_in8(0x3d5, par);
vga_out8(0x3d5, cr66 | 0x80, par);
vga_out8(0x3d4, 0x3a, par);
cr3a = vga_in8(0x3d5, par);
vga_out8(0x3d5, cr3a | 0x80, par);

/* now save MIU regs */
if (par->chip != S3_SAVAGE_MX) {
savage_out32(FIFO_CONTROL_REG, reg->MMPR0, par);
savage_out32(MIU_CONTROL_REG, reg->MMPR1, par);
savage_out32(STREAMS_TIMEOUT_REG, reg->MMPR2, par);
savage_out32(MISC_TIMEOUT_REG, reg->MMPR3, par);
}

vga_out8(0x3d4, 0x3a, par);
vga_out8(0x3d5, cr3a, par);
vga_out8(0x3d4, 0x66, par);
vga_out8(0x3d5, cr66, par);
}

static void savage_update_var(struct fb_var_screeninfo *var, struct fb_videomode *modedb)
{
var->xres = var->xres_virtual = modedb->xres;
Expand Down Expand Up @@ -1327,21 +1496,6 @@ static void savagefb_set_fix(struct fb_info *info)

}

#if defined(CONFIG_FB_SAVAGE_ACCEL)
static void savagefb_set_clip(struct fb_info *info)
{
struct savagefb_par *par = info->par;
int cmd;

cmd = BCI_CMD_NOP | BCI_CMD_CLIP_NEW;
par->bci_ptr = 0;
par->SavageWaitFifo(par,3);
BCI_SEND(cmd);
BCI_SEND(BCI_CLIP_TL(0, 0));
BCI_SEND(BCI_CLIP_BR(0xfff, 0xfff));
}
#endif

static int savagefb_set_par (struct fb_info *info)
{
struct savagefb_par *par = info->par;
Expand Down Expand Up @@ -1442,13 +1596,31 @@ static int savagefb_blank(int blank, struct fb_info *info)
return (blank == FB_BLANK_NORMAL) ? 1 : 0;
}

static void savagefb_save_state(struct fb_info *info)
{
struct savagefb_par *par = info->par;

savage_get_default_par(par, &par->save);
}

static void savagefb_restore_state(struct fb_info *info)
{
struct savagefb_par *par = info->par;

savagefb_blank(FB_BLANK_POWERDOWN, info);
savage_set_default_par(par, &par->save);
savagefb_blank(FB_BLANK_UNBLANK, info);
}

static struct fb_ops savagefb_ops = {
.owner = THIS_MODULE,
.fb_check_var = savagefb_check_var,
.fb_set_par = savagefb_set_par,
.fb_setcolreg = savagefb_setcolreg,
.fb_pan_display = savagefb_pan_display,
.fb_blank = savagefb_blank,
.fb_save_state = savagefb_save_state,
.fb_restore_state = savagefb_restore_state,
#if defined(CONFIG_FB_SAVAGE_ACCEL)
.fb_fillrect = savagefb_fillrect,
.fb_copyarea = savagefb_copyarea,
Expand Down Expand Up @@ -2180,6 +2352,7 @@ static int savagefb_suspend (struct pci_dev* dev, pm_message_t state)
info->fbops->fb_sync(info);

savagefb_blank(FB_BLANK_POWERDOWN, info);
savage_set_default_par(par, &par->save);
savage_disable_mmio(par);
pci_save_state(dev);
pci_disable_device(dev);
Expand Down Expand Up @@ -2219,9 +2392,9 @@ static int savagefb_resume (struct pci_dev* dev)
pci_set_master(dev);
savage_enable_mmio(par);
savage_init_hw(par);
savagefb_set_par (info);
savagefb_blank(FB_BLANK_UNBLANK, info);
savagefb_set_par(info);
fb_set_suspend (info, 0);
savagefb_blank(FB_BLANK_UNBLANK, info);
release_console_sem();

return 0;
Expand Down

0 comments on commit 3046d79

Please sign in to comment.