Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 107031
b: refs/heads/master
c: 8d0b1c5
h: refs/heads/master
i:
  107029: d9ceabd
  107027: b47ad4d
  107023: c3660ef
v: v3
  • Loading branch information
Thomas Bogendoerfer authored and Linus Torvalds committed Jul 30, 2008
1 parent a7406b9 commit 48add18
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 17 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: 6af8bf3d86d55c98af6e453cb920ddc30867e5c7
refs/heads/master: 8d0b1c51eb8375f88c0886d2e9f71881e19d42a7
50 changes: 34 additions & 16 deletions trunk/drivers/video/gbefb.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ static int gbe_revision;
static int ypan, ywrap;

static uint32_t pseudo_palette[16];
static uint32_t gbe_cmap[256];
static int gbe_turned_on; /* 0 turned off, 1 turned on */

static char *mode_option __initdata = NULL;

Expand Down Expand Up @@ -208,6 +210,8 @@ void gbe_turn_off(void)
int i;
unsigned int val, x, y, vpixen_off;

gbe_turned_on = 0;

/* check if pixel counter is on */
val = gbe->vt_xy;
if (GET_GBE_FIELD(VT_XY, FREEZE, val) == 1)
Expand Down Expand Up @@ -371,6 +375,22 @@ static void gbe_turn_on(void)
}
if (i == 10000)
printk(KERN_ERR "gbefb: turn on DMA timed out\n");

gbe_turned_on = 1;
}

static void gbe_loadcmap(void)
{
int i, j;

for (i = 0; i < 256; i++) {
for (j = 0; j < 1000 && gbe->cm_fifo >= 63; j++)
udelay(10);
if (j == 1000)
printk(KERN_ERR "gbefb: cmap FIFO timeout\n");

gbe->cmap[i] = gbe_cmap[i];
}
}

/*
Expand All @@ -382,6 +402,7 @@ static int gbefb_blank(int blank, struct fb_info *info)
switch (blank) {
case FB_BLANK_UNBLANK: /* unblank */
gbe_turn_on();
gbe_loadcmap();
break;

case FB_BLANK_NORMAL: /* blank */
Expand Down Expand Up @@ -796,16 +817,10 @@ static int gbefb_set_par(struct fb_info *info)
gbe->gmap[i] = (i << 24) | (i << 16) | (i << 8);

/* Initialize the color map */
for (i = 0; i < 256; i++) {
int j;

for (j = 0; j < 1000 && gbe->cm_fifo >= 63; j++)
udelay(10);
if (j == 1000)
printk(KERN_ERR "gbefb: cmap FIFO timeout\n");
for (i = 0; i < 256; i++)
gbe_cmap[i] = (i << 8) | (i << 16) | (i << 24);

gbe->cmap[i] = (i << 8) | (i << 16) | (i << 24);
}
gbe_loadcmap();

return 0;
}
Expand Down Expand Up @@ -855,14 +870,17 @@ static int gbefb_setcolreg(unsigned regno, unsigned red, unsigned green,
blue >>= 8;

if (info->var.bits_per_pixel <= 8) {
/* wait for the color map FIFO to have a free entry */
for (i = 0; i < 1000 && gbe->cm_fifo >= 63; i++)
udelay(10);
if (i == 1000) {
printk(KERN_ERR "gbefb: cmap FIFO timeout\n");
return 1;
gbe_cmap[regno] = (red << 24) | (green << 16) | (blue << 8);
if (gbe_turned_on) {
/* wait for the color map FIFO to have a free entry */
for (i = 0; i < 1000 && gbe->cm_fifo >= 63; i++)
udelay(10);
if (i == 1000) {
printk(KERN_ERR "gbefb: cmap FIFO timeout\n");
return 1;
}
gbe->cmap[regno] = gbe_cmap[regno];
}
gbe->cmap[regno] = (red << 24) | (green << 16) | (blue << 8);
} else if (regno < 16) {
switch (info->var.bits_per_pixel) {
case 15:
Expand Down

0 comments on commit 48add18

Please sign in to comment.