diff options
Diffstat (limited to 'drivers/video')
-rw-r--r-- | drivers/video/atmel_lcdfb.c | 94 | ||||
-rw-r--r-- | drivers/video/bf54x-lq043fb.c | 2 | ||||
-rw-r--r-- | drivers/video/cirrusfb.c | 59 | ||||
-rw-r--r-- | drivers/video/tdfxfb.c | 9 |
4 files changed, 78 insertions, 86 deletions
diff --git a/drivers/video/atmel_lcdfb.c b/drivers/video/atmel_lcdfb.c index 9c5925927ece..75dac578104f 100644 --- a/drivers/video/atmel_lcdfb.c +++ b/drivers/video/atmel_lcdfb.c | |||
@@ -208,6 +208,36 @@ static unsigned long compute_hozval(unsigned long xres, unsigned long lcdcon2) | |||
208 | return value; | 208 | return value; |
209 | } | 209 | } |
210 | 210 | ||
211 | static void atmel_lcdfb_stop_nowait(struct atmel_lcdfb_info *sinfo) | ||
212 | { | ||
213 | /* Turn off the LCD controller and the DMA controller */ | ||
214 | lcdc_writel(sinfo, ATMEL_LCDC_PWRCON, | ||
215 | sinfo->guard_time << ATMEL_LCDC_GUARDT_OFFSET); | ||
216 | |||
217 | /* Wait for the LCDC core to become idle */ | ||
218 | while (lcdc_readl(sinfo, ATMEL_LCDC_PWRCON) & ATMEL_LCDC_BUSY) | ||
219 | msleep(10); | ||
220 | |||
221 | lcdc_writel(sinfo, ATMEL_LCDC_DMACON, 0); | ||
222 | } | ||
223 | |||
224 | static void atmel_lcdfb_stop(struct atmel_lcdfb_info *sinfo) | ||
225 | { | ||
226 | atmel_lcdfb_stop_nowait(sinfo); | ||
227 | |||
228 | /* Wait for DMA engine to become idle... */ | ||
229 | while (lcdc_readl(sinfo, ATMEL_LCDC_DMACON) & ATMEL_LCDC_DMABUSY) | ||
230 | msleep(10); | ||
231 | } | ||
232 | |||
233 | static void atmel_lcdfb_start(struct atmel_lcdfb_info *sinfo) | ||
234 | { | ||
235 | lcdc_writel(sinfo, ATMEL_LCDC_DMACON, sinfo->default_dmacon); | ||
236 | lcdc_writel(sinfo, ATMEL_LCDC_PWRCON, | ||
237 | (sinfo->guard_time << ATMEL_LCDC_GUARDT_OFFSET) | ||
238 | | ATMEL_LCDC_PWR); | ||
239 | } | ||
240 | |||
211 | static void atmel_lcdfb_update_dma(struct fb_info *info, | 241 | static void atmel_lcdfb_update_dma(struct fb_info *info, |
212 | struct fb_var_screeninfo *var) | 242 | struct fb_var_screeninfo *var) |
213 | { | 243 | { |
@@ -420,26 +450,8 @@ static void atmel_lcdfb_reset(struct atmel_lcdfb_info *sinfo) | |||
420 | { | 450 | { |
421 | might_sleep(); | 451 | might_sleep(); |
422 | 452 | ||
423 | /* LCD power off */ | 453 | atmel_lcdfb_stop(sinfo); |
424 | lcdc_writel(sinfo, ATMEL_LCDC_PWRCON, sinfo->guard_time << ATMEL_LCDC_GUARDT_OFFSET); | 454 | atmel_lcdfb_start(sinfo); |
425 | |||
426 | /* wait for the LCDC core to become idle */ | ||
427 | while (lcdc_readl(sinfo, ATMEL_LCDC_PWRCON) & ATMEL_LCDC_BUSY) | ||
428 | msleep(10); | ||
429 | |||
430 | /* DMA disable */ | ||
431 | lcdc_writel(sinfo, ATMEL_LCDC_DMACON, 0); | ||
432 | |||
433 | /* wait for DMA engine to become idle */ | ||
434 | while (lcdc_readl(sinfo, ATMEL_LCDC_DMACON) & ATMEL_LCDC_DMABUSY) | ||
435 | msleep(10); | ||
436 | |||
437 | /* LCD power on */ | ||
438 | lcdc_writel(sinfo, ATMEL_LCDC_PWRCON, | ||
439 | (sinfo->guard_time << ATMEL_LCDC_GUARDT_OFFSET) | ATMEL_LCDC_PWR); | ||
440 | |||
441 | /* DMA enable */ | ||
442 | lcdc_writel(sinfo, ATMEL_LCDC_DMACON, sinfo->default_dmacon); | ||
443 | } | 455 | } |
444 | 456 | ||
445 | /** | 457 | /** |
@@ -471,14 +483,7 @@ static int atmel_lcdfb_set_par(struct fb_info *info) | |||
471 | info->var.xres, info->var.yres, | 483 | info->var.xres, info->var.yres, |
472 | info->var.xres_virtual, info->var.yres_virtual); | 484 | info->var.xres_virtual, info->var.yres_virtual); |
473 | 485 | ||
474 | /* Turn off the LCD controller and the DMA controller */ | 486 | atmel_lcdfb_stop_nowait(sinfo); |
475 | lcdc_writel(sinfo, ATMEL_LCDC_PWRCON, sinfo->guard_time << ATMEL_LCDC_GUARDT_OFFSET); | ||
476 | |||
477 | /* Wait for the LCDC core to become idle */ | ||
478 | while (lcdc_readl(sinfo, ATMEL_LCDC_PWRCON) & ATMEL_LCDC_BUSY) | ||
479 | msleep(10); | ||
480 | |||
481 | lcdc_writel(sinfo, ATMEL_LCDC_DMACON, 0); | ||
482 | 487 | ||
483 | if (info->var.bits_per_pixel == 1) | 488 | if (info->var.bits_per_pixel == 1) |
484 | info->fix.visual = FB_VISUAL_MONO01; | 489 | info->fix.visual = FB_VISUAL_MONO01; |
@@ -583,13 +588,7 @@ static int atmel_lcdfb_set_par(struct fb_info *info) | |||
583 | while (lcdc_readl(sinfo, ATMEL_LCDC_DMACON) & ATMEL_LCDC_DMABUSY) | 588 | while (lcdc_readl(sinfo, ATMEL_LCDC_DMACON) & ATMEL_LCDC_DMABUSY) |
584 | msleep(10); | 589 | msleep(10); |
585 | 590 | ||
586 | dev_dbg(info->device, " * re-enable DMA engine\n"); | 591 | atmel_lcdfb_start(sinfo); |
587 | /* ...and enable it with updated configuration */ | ||
588 | lcdc_writel(sinfo, ATMEL_LCDC_DMACON, sinfo->default_dmacon); | ||
589 | |||
590 | dev_dbg(info->device, " * re-enable LCDC core\n"); | ||
591 | lcdc_writel(sinfo, ATMEL_LCDC_PWRCON, | ||
592 | (sinfo->guard_time << ATMEL_LCDC_GUARDT_OFFSET) | ATMEL_LCDC_PWR); | ||
593 | 592 | ||
594 | dev_dbg(info->device, " * DONE\n"); | 593 | dev_dbg(info->device, " * DONE\n"); |
595 | 594 | ||
@@ -939,7 +938,7 @@ static int __init atmel_lcdfb_probe(struct platform_device *pdev) | |||
939 | ret = register_framebuffer(info); | 938 | ret = register_framebuffer(info); |
940 | if (ret < 0) { | 939 | if (ret < 0) { |
941 | dev_err(dev, "failed to register framebuffer device: %d\n", ret); | 940 | dev_err(dev, "failed to register framebuffer device: %d\n", ret); |
942 | goto free_cmap; | 941 | goto reset_drvdata; |
943 | } | 942 | } |
944 | 943 | ||
945 | /* add selected videomode to modelist */ | 944 | /* add selected videomode to modelist */ |
@@ -955,7 +954,8 @@ static int __init atmel_lcdfb_probe(struct platform_device *pdev) | |||
955 | 954 | ||
956 | return 0; | 955 | return 0; |
957 | 956 | ||
958 | 957 | reset_drvdata: | |
958 | dev_set_drvdata(dev, NULL); | ||
959 | free_cmap: | 959 | free_cmap: |
960 | fb_dealloc_cmap(&info->cmap); | 960 | fb_dealloc_cmap(&info->cmap); |
961 | unregister_irqs: | 961 | unregister_irqs: |
@@ -992,10 +992,11 @@ static int __exit atmel_lcdfb_remove(struct platform_device *pdev) | |||
992 | { | 992 | { |
993 | struct device *dev = &pdev->dev; | 993 | struct device *dev = &pdev->dev; |
994 | struct fb_info *info = dev_get_drvdata(dev); | 994 | struct fb_info *info = dev_get_drvdata(dev); |
995 | struct atmel_lcdfb_info *sinfo = info->par; | 995 | struct atmel_lcdfb_info *sinfo; |
996 | 996 | ||
997 | if (!sinfo) | 997 | if (!info || !info->par) |
998 | return 0; | 998 | return 0; |
999 | sinfo = info->par; | ||
999 | 1000 | ||
1000 | cancel_work_sync(&sinfo->task); | 1001 | cancel_work_sync(&sinfo->task); |
1001 | exit_backlight(sinfo); | 1002 | exit_backlight(sinfo); |
@@ -1030,11 +1031,20 @@ static int atmel_lcdfb_suspend(struct platform_device *pdev, pm_message_t mesg) | |||
1030 | struct fb_info *info = platform_get_drvdata(pdev); | 1031 | struct fb_info *info = platform_get_drvdata(pdev); |
1031 | struct atmel_lcdfb_info *sinfo = info->par; | 1032 | struct atmel_lcdfb_info *sinfo = info->par; |
1032 | 1033 | ||
1034 | /* | ||
1035 | * We don't want to handle interrupts while the clock is | ||
1036 | * stopped. It may take forever. | ||
1037 | */ | ||
1038 | lcdc_writel(sinfo, ATMEL_LCDC_IDR, ~0UL); | ||
1039 | |||
1033 | sinfo->saved_lcdcon = lcdc_readl(sinfo, ATMEL_LCDC_CONTRAST_VAL); | 1040 | sinfo->saved_lcdcon = lcdc_readl(sinfo, ATMEL_LCDC_CONTRAST_VAL); |
1034 | lcdc_writel(sinfo, ATMEL_LCDC_CONTRAST_CTR, 0); | 1041 | lcdc_writel(sinfo, ATMEL_LCDC_CONTRAST_CTR, 0); |
1035 | if (sinfo->atmel_lcdfb_power_control) | 1042 | if (sinfo->atmel_lcdfb_power_control) |
1036 | sinfo->atmel_lcdfb_power_control(0); | 1043 | sinfo->atmel_lcdfb_power_control(0); |
1044 | |||
1045 | atmel_lcdfb_stop(sinfo); | ||
1037 | atmel_lcdfb_stop_clock(sinfo); | 1046 | atmel_lcdfb_stop_clock(sinfo); |
1047 | |||
1038 | return 0; | 1048 | return 0; |
1039 | } | 1049 | } |
1040 | 1050 | ||
@@ -1044,9 +1054,15 @@ static int atmel_lcdfb_resume(struct platform_device *pdev) | |||
1044 | struct atmel_lcdfb_info *sinfo = info->par; | 1054 | struct atmel_lcdfb_info *sinfo = info->par; |
1045 | 1055 | ||
1046 | atmel_lcdfb_start_clock(sinfo); | 1056 | atmel_lcdfb_start_clock(sinfo); |
1057 | atmel_lcdfb_start(sinfo); | ||
1047 | if (sinfo->atmel_lcdfb_power_control) | 1058 | if (sinfo->atmel_lcdfb_power_control) |
1048 | sinfo->atmel_lcdfb_power_control(1); | 1059 | sinfo->atmel_lcdfb_power_control(1); |
1049 | lcdc_writel(sinfo, ATMEL_LCDC_CONTRAST_CTR, sinfo->saved_lcdcon); | 1060 | lcdc_writel(sinfo, ATMEL_LCDC_CONTRAST_CTR, sinfo->saved_lcdcon); |
1061 | |||
1062 | /* Enable FIFO & DMA errors */ | ||
1063 | lcdc_writel(sinfo, ATMEL_LCDC_IER, ATMEL_LCDC_UFLWI | ||
1064 | | ATMEL_LCDC_OWRI | ATMEL_LCDC_MERI); | ||
1065 | |||
1050 | return 0; | 1066 | return 0; |
1051 | } | 1067 | } |
1052 | 1068 | ||
diff --git a/drivers/video/bf54x-lq043fb.c b/drivers/video/bf54x-lq043fb.c index 6d5aa806777e..7644ed249564 100644 --- a/drivers/video/bf54x-lq043fb.c +++ b/drivers/video/bf54x-lq043fb.c | |||
@@ -58,7 +58,7 @@ | |||
58 | #include <asm/gpio.h> | 58 | #include <asm/gpio.h> |
59 | #include <asm/portmux.h> | 59 | #include <asm/portmux.h> |
60 | 60 | ||
61 | #include <asm/mach/bf54x-lq043.h> | 61 | #include <mach/bf54x-lq043.h> |
62 | 62 | ||
63 | #define NO_BL_SUPPORT | 63 | #define NO_BL_SUPPORT |
64 | 64 | ||
diff --git a/drivers/video/cirrusfb.c b/drivers/video/cirrusfb.c index c14b2435d23e..e729fb279645 100644 --- a/drivers/video/cirrusfb.c +++ b/drivers/video/cirrusfb.c | |||
@@ -628,27 +628,18 @@ static long cirrusfb_get_mclk(long freq, int bpp, long *div) | |||
628 | static int cirrusfb_check_var(struct fb_var_screeninfo *var, | 628 | static int cirrusfb_check_var(struct fb_var_screeninfo *var, |
629 | struct fb_info *info) | 629 | struct fb_info *info) |
630 | { | 630 | { |
631 | int nom, den; /* translyting from pixels->bytes */ | 631 | int yres; |
632 | int yres, i; | 632 | /* memory size in pixels */ |
633 | static struct { int xres, yres; } modes[] = | 633 | unsigned pixels = info->screen_size * 8 / var->bits_per_pixel; |
634 | { { 1600, 1280 }, | ||
635 | { 1280, 1024 }, | ||
636 | { 1024, 768 }, | ||
637 | { 800, 600 }, | ||
638 | { 640, 480 }, | ||
639 | { -1, -1 } }; | ||
640 | 634 | ||
641 | switch (var->bits_per_pixel) { | 635 | switch (var->bits_per_pixel) { |
642 | case 1: | 636 | case 1: |
643 | nom = 4; | 637 | pixels /= 4; |
644 | den = 8; | ||
645 | break; /* 8 pixel per byte, only 1/4th of mem usable */ | 638 | break; /* 8 pixel per byte, only 1/4th of mem usable */ |
646 | case 8: | 639 | case 8: |
647 | case 16: | 640 | case 16: |
648 | case 24: | 641 | case 24: |
649 | case 32: | 642 | case 32: |
650 | nom = var->bits_per_pixel / 8; | ||
651 | den = 1; | ||
652 | break; /* 1 pixel == 1 byte */ | 643 | break; /* 1 pixel == 1 byte */ |
653 | default: | 644 | default: |
654 | printk(KERN_ERR "cirrusfb: mode %dx%dx%d rejected..." | 645 | printk(KERN_ERR "cirrusfb: mode %dx%dx%d rejected..." |
@@ -658,43 +649,29 @@ static int cirrusfb_check_var(struct fb_var_screeninfo *var, | |||
658 | return -EINVAL; | 649 | return -EINVAL; |
659 | } | 650 | } |
660 | 651 | ||
661 | if (var->xres * nom / den * var->yres > info->screen_size) { | 652 | if (var->xres_virtual < var->xres) |
662 | printk(KERN_ERR "cirrusfb: mode %dx%dx%d rejected..." | 653 | var->xres_virtual = var->xres; |
663 | "resolution too high to fit into video memory!\n", | ||
664 | var->xres, var->yres, var->bits_per_pixel); | ||
665 | DPRINTK("EXIT - EINVAL error\n"); | ||
666 | return -EINVAL; | ||
667 | } | ||
668 | |||
669 | /* use highest possible virtual resolution */ | 654 | /* use highest possible virtual resolution */ |
670 | if (var->xres_virtual == -1 && | 655 | if (var->yres_virtual == -1) { |
671 | var->yres_virtual == -1) { | 656 | var->yres_virtual = pixels / var->xres_virtual; |
672 | printk(KERN_INFO | ||
673 | "cirrusfb: using maximum available virtual resolution\n"); | ||
674 | for (i = 0; modes[i].xres != -1; i++) { | ||
675 | int size = modes[i].xres * nom / den * modes[i].yres; | ||
676 | if (size < info->screen_size / 2) | ||
677 | break; | ||
678 | } | ||
679 | if (modes[i].xres == -1) { | ||
680 | printk(KERN_ERR "cirrusfb: could not find a virtual " | ||
681 | "resolution that fits into video memory!!\n"); | ||
682 | DPRINTK("EXIT - EINVAL error\n"); | ||
683 | return -EINVAL; | ||
684 | } | ||
685 | var->xres_virtual = modes[i].xres; | ||
686 | var->yres_virtual = modes[i].yres; | ||
687 | 657 | ||
688 | printk(KERN_INFO "cirrusfb: virtual resolution set to " | 658 | printk(KERN_INFO "cirrusfb: virtual resolution set to " |
689 | "maximum of %dx%d\n", var->xres_virtual, | 659 | "maximum of %dx%d\n", var->xres_virtual, |
690 | var->yres_virtual); | 660 | var->yres_virtual); |
691 | } | 661 | } |
692 | |||
693 | if (var->xres_virtual < var->xres) | ||
694 | var->xres_virtual = var->xres; | ||
695 | if (var->yres_virtual < var->yres) | 662 | if (var->yres_virtual < var->yres) |
696 | var->yres_virtual = var->yres; | 663 | var->yres_virtual = var->yres; |
697 | 664 | ||
665 | if (var->xres_virtual * var->yres_virtual > pixels) { | ||
666 | printk(KERN_ERR "cirrusfb: mode %dx%dx%d rejected... " | ||
667 | "virtual resolution too high to fit into video memory!\n", | ||
668 | var->xres_virtual, var->yres_virtual, | ||
669 | var->bits_per_pixel); | ||
670 | DPRINTK("EXIT - EINVAL error\n"); | ||
671 | return -EINVAL; | ||
672 | } | ||
673 | |||
674 | |||
698 | if (var->xoffset < 0) | 675 | if (var->xoffset < 0) |
699 | var->xoffset = 0; | 676 | var->xoffset = 0; |
700 | if (var->yoffset < 0) | 677 | if (var->yoffset < 0) |
diff --git a/drivers/video/tdfxfb.c b/drivers/video/tdfxfb.c index 77aafcfae037..4599a4385bc9 100644 --- a/drivers/video/tdfxfb.c +++ b/drivers/video/tdfxfb.c | |||
@@ -95,7 +95,6 @@ static inline int mtrr_del(int reg, unsigned long base, | |||
95 | #define VOODOO5_MAX_PIXCLOCK 350000 | 95 | #define VOODOO5_MAX_PIXCLOCK 350000 |
96 | 96 | ||
97 | static struct fb_fix_screeninfo tdfx_fix __devinitdata = { | 97 | static struct fb_fix_screeninfo tdfx_fix __devinitdata = { |
98 | .id = "3Dfx", | ||
99 | .type = FB_TYPE_PACKED_PIXELS, | 98 | .type = FB_TYPE_PACKED_PIXELS, |
100 | .visual = FB_VISUAL_PSEUDOCOLOR, | 99 | .visual = FB_VISUAL_PSEUDOCOLOR, |
101 | .ypanstep = 1, | 100 | .ypanstep = 1, |
@@ -426,7 +425,7 @@ static unsigned long do_lfb_size(struct tdfx_par *par, unsigned short dev_id) | |||
426 | if (dev_id < PCI_DEVICE_ID_3DFX_VOODOO5) { | 425 | if (dev_id < PCI_DEVICE_ID_3DFX_VOODOO5) { |
427 | /* Banshee/Voodoo3 */ | 426 | /* Banshee/Voodoo3 */ |
428 | chip_size = 2; | 427 | chip_size = 2; |
429 | if (has_sgram && (draminit0 & DRAMINIT0_SGRAM_TYPE)) | 428 | if (has_sgram && !(draminit0 & DRAMINIT0_SGRAM_TYPE)) |
430 | chip_size = 1; | 429 | chip_size = 1; |
431 | } else { | 430 | } else { |
432 | /* Voodoo4/5 */ | 431 | /* Voodoo4/5 */ |
@@ -1200,15 +1199,15 @@ static int __devinit tdfxfb_probe(struct pci_dev *pdev, | |||
1200 | /* Configure the default fb_fix_screeninfo first */ | 1199 | /* Configure the default fb_fix_screeninfo first */ |
1201 | switch (pdev->device) { | 1200 | switch (pdev->device) { |
1202 | case PCI_DEVICE_ID_3DFX_BANSHEE: | 1201 | case PCI_DEVICE_ID_3DFX_BANSHEE: |
1203 | strcat(tdfx_fix.id, " Banshee"); | 1202 | strcpy(tdfx_fix.id, "3Dfx Banshee"); |
1204 | default_par->max_pixclock = BANSHEE_MAX_PIXCLOCK; | 1203 | default_par->max_pixclock = BANSHEE_MAX_PIXCLOCK; |
1205 | break; | 1204 | break; |
1206 | case PCI_DEVICE_ID_3DFX_VOODOO3: | 1205 | case PCI_DEVICE_ID_3DFX_VOODOO3: |
1207 | strcat(tdfx_fix.id, " Voodoo3"); | 1206 | strcpy(tdfx_fix.id, "3Dfx Voodoo3"); |
1208 | default_par->max_pixclock = VOODOO3_MAX_PIXCLOCK; | 1207 | default_par->max_pixclock = VOODOO3_MAX_PIXCLOCK; |
1209 | break; | 1208 | break; |
1210 | case PCI_DEVICE_ID_3DFX_VOODOO5: | 1209 | case PCI_DEVICE_ID_3DFX_VOODOO5: |
1211 | strcat(tdfx_fix.id, " Voodoo5"); | 1210 | strcpy(tdfx_fix.id, "3Dfx Voodoo5"); |
1212 | default_par->max_pixclock = VOODOO5_MAX_PIXCLOCK; | 1211 | default_par->max_pixclock = VOODOO5_MAX_PIXCLOCK; |
1213 | break; | 1212 | break; |
1214 | } | 1213 | } |