diff options
-rw-r--r-- | drivers/video/gbefb.c | 50 |
1 files changed, 34 insertions, 16 deletions
diff --git a/drivers/video/gbefb.c b/drivers/video/gbefb.c index 2e552d5bbb5d..f89c3cce1e0c 100644 --- a/drivers/video/gbefb.c +++ b/drivers/video/gbefb.c | |||
@@ -87,6 +87,8 @@ static int gbe_revision; | |||
87 | static int ypan, ywrap; | 87 | static int ypan, ywrap; |
88 | 88 | ||
89 | static uint32_t pseudo_palette[16]; | 89 | static uint32_t pseudo_palette[16]; |
90 | static uint32_t gbe_cmap[256]; | ||
91 | static int gbe_turned_on; /* 0 turned off, 1 turned on */ | ||
90 | 92 | ||
91 | static char *mode_option __initdata = NULL; | 93 | static char *mode_option __initdata = NULL; |
92 | 94 | ||
@@ -208,6 +210,8 @@ void gbe_turn_off(void) | |||
208 | int i; | 210 | int i; |
209 | unsigned int val, x, y, vpixen_off; | 211 | unsigned int val, x, y, vpixen_off; |
210 | 212 | ||
213 | gbe_turned_on = 0; | ||
214 | |||
211 | /* check if pixel counter is on */ | 215 | /* check if pixel counter is on */ |
212 | val = gbe->vt_xy; | 216 | val = gbe->vt_xy; |
213 | if (GET_GBE_FIELD(VT_XY, FREEZE, val) == 1) | 217 | if (GET_GBE_FIELD(VT_XY, FREEZE, val) == 1) |
@@ -371,6 +375,22 @@ static void gbe_turn_on(void) | |||
371 | } | 375 | } |
372 | if (i == 10000) | 376 | if (i == 10000) |
373 | printk(KERN_ERR "gbefb: turn on DMA timed out\n"); | 377 | printk(KERN_ERR "gbefb: turn on DMA timed out\n"); |
378 | |||
379 | gbe_turned_on = 1; | ||
380 | } | ||
381 | |||
382 | static void gbe_loadcmap(void) | ||
383 | { | ||
384 | int i, j; | ||
385 | |||
386 | for (i = 0; i < 256; i++) { | ||
387 | for (j = 0; j < 1000 && gbe->cm_fifo >= 63; j++) | ||
388 | udelay(10); | ||
389 | if (j == 1000) | ||
390 | printk(KERN_ERR "gbefb: cmap FIFO timeout\n"); | ||
391 | |||
392 | gbe->cmap[i] = gbe_cmap[i]; | ||
393 | } | ||
374 | } | 394 | } |
375 | 395 | ||
376 | /* | 396 | /* |
@@ -382,6 +402,7 @@ static int gbefb_blank(int blank, struct fb_info *info) | |||
382 | switch (blank) { | 402 | switch (blank) { |
383 | case FB_BLANK_UNBLANK: /* unblank */ | 403 | case FB_BLANK_UNBLANK: /* unblank */ |
384 | gbe_turn_on(); | 404 | gbe_turn_on(); |
405 | gbe_loadcmap(); | ||
385 | break; | 406 | break; |
386 | 407 | ||
387 | case FB_BLANK_NORMAL: /* blank */ | 408 | case FB_BLANK_NORMAL: /* blank */ |
@@ -796,16 +817,10 @@ static int gbefb_set_par(struct fb_info *info) | |||
796 | gbe->gmap[i] = (i << 24) | (i << 16) | (i << 8); | 817 | gbe->gmap[i] = (i << 24) | (i << 16) | (i << 8); |
797 | 818 | ||
798 | /* Initialize the color map */ | 819 | /* Initialize the color map */ |
799 | for (i = 0; i < 256; i++) { | 820 | for (i = 0; i < 256; i++) |
800 | int j; | 821 | gbe_cmap[i] = (i << 8) | (i << 16) | (i << 24); |
801 | |||
802 | for (j = 0; j < 1000 && gbe->cm_fifo >= 63; j++) | ||
803 | udelay(10); | ||
804 | if (j == 1000) | ||
805 | printk(KERN_ERR "gbefb: cmap FIFO timeout\n"); | ||
806 | 822 | ||
807 | gbe->cmap[i] = (i << 8) | (i << 16) | (i << 24); | 823 | gbe_loadcmap(); |
808 | } | ||
809 | 824 | ||
810 | return 0; | 825 | return 0; |
811 | } | 826 | } |
@@ -855,14 +870,17 @@ static int gbefb_setcolreg(unsigned regno, unsigned red, unsigned green, | |||
855 | blue >>= 8; | 870 | blue >>= 8; |
856 | 871 | ||
857 | if (info->var.bits_per_pixel <= 8) { | 872 | if (info->var.bits_per_pixel <= 8) { |
858 | /* wait for the color map FIFO to have a free entry */ | 873 | gbe_cmap[regno] = (red << 24) | (green << 16) | (blue << 8); |
859 | for (i = 0; i < 1000 && gbe->cm_fifo >= 63; i++) | 874 | if (gbe_turned_on) { |
860 | udelay(10); | 875 | /* wait for the color map FIFO to have a free entry */ |
861 | if (i == 1000) { | 876 | for (i = 0; i < 1000 && gbe->cm_fifo >= 63; i++) |
862 | printk(KERN_ERR "gbefb: cmap FIFO timeout\n"); | 877 | udelay(10); |
863 | return 1; | 878 | if (i == 1000) { |
879 | printk(KERN_ERR "gbefb: cmap FIFO timeout\n"); | ||
880 | return 1; | ||
881 | } | ||
882 | gbe->cmap[regno] = gbe_cmap[regno]; | ||
864 | } | 883 | } |
865 | gbe->cmap[regno] = (red << 24) | (green << 16) | (blue << 8); | ||
866 | } else if (regno < 16) { | 884 | } else if (regno < 16) { |
867 | switch (info->var.bits_per_pixel) { | 885 | switch (info->var.bits_per_pixel) { |
868 | case 15: | 886 | case 15: |