aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/video')
-rw-r--r--drivers/video/atmel_lcdfb.c2
-rw-r--r--drivers/video/aty/atyfb_base.c4
-rw-r--r--drivers/video/aty/mach64_cursor.c2
-rw-r--r--drivers/video/au1200fb.c2
-rw-r--r--drivers/video/backlight/corgi_lcd.c2
-rw-r--r--drivers/video/backlight/locomolcd.c2
-rw-r--r--drivers/video/bfin-lq035q1-fb.c4
-rw-r--r--drivers/video/bfin_adv7393fb.h24
-rw-r--r--drivers/video/console/fbcon.c2
-rw-r--r--drivers/video/console/font_mini_4x6.c2
-rw-r--r--drivers/video/da8xx-fb.c2
-rw-r--r--drivers/video/display/display-sysfs.c2
-rw-r--r--drivers/video/efifb.c154
-rw-r--r--drivers/video/ep93xx-fb.c2
-rw-r--r--drivers/video/fb-puv3.c28
-rw-r--r--drivers/video/fbmem.c2
-rw-r--r--drivers/video/fbsysfs.c2
-rw-r--r--drivers/video/fm2fb.c2
-rw-r--r--drivers/video/fsl-diu-fb.c2
-rw-r--r--drivers/video/gbefb.c2
-rw-r--r--drivers/video/geode/lxfb.h2
-rw-r--r--drivers/video/i810/i810_accel.c2
-rw-r--r--drivers/video/kyro/STG4000OverlayDevice.c2
-rw-r--r--drivers/video/kyro/STG4000Reg.h2
-rw-r--r--drivers/video/matrox/matroxfb_DAC1064.h2
-rw-r--r--drivers/video/matrox/matroxfb_Ti3026.c4
-rw-r--r--drivers/video/matrox/matroxfb_base.c2
-rw-r--r--drivers/video/matrox/matroxfb_base.h2
-rw-r--r--drivers/video/nuc900fb.h2
-rw-r--r--drivers/video/omap/Kconfig2
-rw-r--r--drivers/video/omap2/dss/hdmi.c2
-rw-r--r--drivers/video/pxa3xx-gcu.c2
-rw-r--r--drivers/video/pxafb.c136
-rw-r--r--drivers/video/pxafb.h3
-rw-r--r--drivers/video/s3c-fb.c8
-rw-r--r--drivers/video/s3fb.c48
-rw-r--r--drivers/video/savage/savagefb-i2c.c14
-rw-r--r--drivers/video/savage/savagefb.h2
-rw-r--r--drivers/video/savage/savagefb_driver.c4
-rw-r--r--drivers/video/sh_mobile_lcdcfb.c52
-rw-r--r--drivers/video/sh_mobile_lcdcfb.h1
-rw-r--r--drivers/video/sm501fb.c4
-rw-r--r--drivers/video/sstfb.c8
-rw-r--r--drivers/video/sticore.h2
-rw-r--r--drivers/video/tdfxfb.c18
-rw-r--r--drivers/video/tmiofb.c2
-rw-r--r--drivers/video/udlfb.c2
-rw-r--r--drivers/video/vga16fb.c2
-rw-r--r--drivers/video/via/chip.h1
-rw-r--r--drivers/video/via/hw.c17
-rw-r--r--drivers/video/via/hw.h3
-rw-r--r--drivers/video/via/via_utility.c2
-rw-r--r--drivers/video/via/via_utility.h2
-rw-r--r--drivers/video/via/viafbdev.c76
-rw-r--r--drivers/video/w100fb.c2
55 files changed, 412 insertions, 267 deletions
diff --git a/drivers/video/atmel_lcdfb.c b/drivers/video/atmel_lcdfb.c
index ccecf9974587..4484c721f0f9 100644
--- a/drivers/video/atmel_lcdfb.c
+++ b/drivers/video/atmel_lcdfb.c
@@ -637,7 +637,7 @@ static inline unsigned int chan_to_field(unsigned int chan, const struct fb_bitf
637 * magnitude which needs to be scaled in this function for the hardware. 637 * magnitude which needs to be scaled in this function for the hardware.
638 * Things to take into consideration are how many color registers, if 638 * Things to take into consideration are how many color registers, if
639 * any, are supported with the current color visual. With truecolor mode 639 * any, are supported with the current color visual. With truecolor mode
640 * no color palettes are supported. Here a psuedo palette is created 640 * no color palettes are supported. Here a pseudo palette is created
641 * which we store the value in pseudo_palette in struct fb_info. For 641 * which we store the value in pseudo_palette in struct fb_info. For
642 * pseudocolor mode we have a limited color palette. To deal with this 642 * pseudocolor mode we have a limited color palette. To deal with this
643 * we can program what color is displayed for a particular pixel value. 643 * we can program what color is displayed for a particular pixel value.
diff --git a/drivers/video/aty/atyfb_base.c b/drivers/video/aty/atyfb_base.c
index d437b3daf1f5..ebb893c49e90 100644
--- a/drivers/video/aty/atyfb_base.c
+++ b/drivers/video/aty/atyfb_base.c
@@ -3124,12 +3124,12 @@ static int __devinit atyfb_setup_sparc(struct pci_dev *pdev,
3124 M = pll_regs[2]; 3124 M = pll_regs[2];
3125 3125
3126 /* 3126 /*
3127 * PLL Feedback Divider N (Dependant on CLOCK_CNTL): 3127 * PLL Feedback Divider N (Dependent on CLOCK_CNTL):
3128 */ 3128 */
3129 N = pll_regs[7 + (clock_cntl & 3)]; 3129 N = pll_regs[7 + (clock_cntl & 3)];
3130 3130
3131 /* 3131 /*
3132 * PLL Post Divider P (Dependant on CLOCK_CNTL): 3132 * PLL Post Divider P (Dependent on CLOCK_CNTL):
3133 */ 3133 */
3134 P = 1 << (pll_regs[6] >> ((clock_cntl & 3) << 1)); 3134 P = 1 << (pll_regs[6] >> ((clock_cntl & 3) << 1));
3135 3135
diff --git a/drivers/video/aty/mach64_cursor.c b/drivers/video/aty/mach64_cursor.c
index 2ba8b3c421a1..46f72ed53510 100644
--- a/drivers/video/aty/mach64_cursor.c
+++ b/drivers/video/aty/mach64_cursor.c
@@ -51,7 +51,7 @@
51 * to a larger number and saturate CUR_HORZ_POSN to zero. 51 * to a larger number and saturate CUR_HORZ_POSN to zero.
52 * 52 *
53 * if Y becomes negative, CUR_VERT_OFFSET must be adjusted to a larger number, 53 * if Y becomes negative, CUR_VERT_OFFSET must be adjusted to a larger number,
54 * CUR_OFFSET must be adjusted to a point to the appropraite line in the cursor 54 * CUR_OFFSET must be adjusted to a point to the appropriate line in the cursor
55 * definitation and CUR_VERT_POSN must be saturated to zero. 55 * definitation and CUR_VERT_POSN must be saturated to zero.
56 */ 56 */
57 57
diff --git a/drivers/video/au1200fb.c b/drivers/video/au1200fb.c
index 4ea187d93768..5dff32ac8044 100644
--- a/drivers/video/au1200fb.c
+++ b/drivers/video/au1200fb.c
@@ -1572,7 +1572,7 @@ static int au1200fb_init_fbinfo(struct au1200fb_device *fbdev)
1572 /* Copy monitor specs from panel data */ 1572 /* Copy monitor specs from panel data */
1573 /* fixme: we're setting up LCD controller windows, so these dont give a 1573 /* fixme: we're setting up LCD controller windows, so these dont give a
1574 damn as to what the monitor specs are (the panel itself does, but that 1574 damn as to what the monitor specs are (the panel itself does, but that
1575 isnt done here...so maybe need a generic catchall monitor setting??? */ 1575 isn't done here...so maybe need a generic catchall monitor setting??? */
1576 memcpy(&fbi->monspecs, &panel->monspecs, sizeof(struct fb_monspecs)); 1576 memcpy(&fbi->monspecs, &panel->monspecs, sizeof(struct fb_monspecs));
1577 1577
1578 /* We first try the user mode passed in argument. If that failed, 1578 /* We first try the user mode passed in argument. If that failed,
diff --git a/drivers/video/backlight/corgi_lcd.c b/drivers/video/backlight/corgi_lcd.c
index af6098396fe6..c6533bad26f8 100644
--- a/drivers/video/backlight/corgi_lcd.c
+++ b/drivers/video/backlight/corgi_lcd.c
@@ -109,7 +109,7 @@ static unsigned long corgibl_flags;
109#define CORGIBL_BATTLOW 0x02 109#define CORGIBL_BATTLOW 0x02
110 110
111/* 111/*
112 * This is only a psuedo I2C interface. We can't use the standard kernel 112 * This is only a pseudo I2C interface. We can't use the standard kernel
113 * routines as the interface is write only. We just assume the data is acked... 113 * routines as the interface is write only. We just assume the data is acked...
114 */ 114 */
115static void lcdtg_ssp_i2c_send(struct corgi_lcd *lcd, uint8_t data) 115static void lcdtg_ssp_i2c_send(struct corgi_lcd *lcd, uint8_t data)
diff --git a/drivers/video/backlight/locomolcd.c b/drivers/video/backlight/locomolcd.c
index bbca3127071e..be20b5cbe26c 100644
--- a/drivers/video/backlight/locomolcd.c
+++ b/drivers/video/backlight/locomolcd.c
@@ -6,7 +6,7 @@
6 * GPL v2 6 * GPL v2
7 * 7 *
8 * This driver assumes single CPU. That's okay, because collie is 8 * This driver assumes single CPU. That's okay, because collie is
9 * slightly old hardware, and noone is going to retrofit second CPU to 9 * slightly old hardware, and no one is going to retrofit second CPU to
10 * old PDA. 10 * old PDA.
11 */ 11 */
12 12
diff --git a/drivers/video/bfin-lq035q1-fb.c b/drivers/video/bfin-lq035q1-fb.c
index c8e1f04941bd..23b6c4b62c78 100644
--- a/drivers/video/bfin-lq035q1-fb.c
+++ b/drivers/video/bfin-lq035q1-fb.c
@@ -154,8 +154,10 @@ static int __devinit lq035q1_spidev_probe(struct spi_device *spi)
154 154
155 ret = lq035q1_control(spi, LQ035_SHUT_CTL, LQ035_ON); 155 ret = lq035q1_control(spi, LQ035_SHUT_CTL, LQ035_ON);
156 ret |= lq035q1_control(spi, LQ035_DRIVER_OUTPUT_CTL, ctl->mode); 156 ret |= lq035q1_control(spi, LQ035_DRIVER_OUTPUT_CTL, ctl->mode);
157 if (ret) 157 if (ret) {
158 kfree(ctl);
158 return ret; 159 return ret;
160 }
159 161
160 spi_set_drvdata(spi, ctl); 162 spi_set_drvdata(spi, ctl);
161 163
diff --git a/drivers/video/bfin_adv7393fb.h b/drivers/video/bfin_adv7393fb.h
index 8c7f9e4fc6eb..cd591b5152a5 100644
--- a/drivers/video/bfin_adv7393fb.h
+++ b/drivers/video/bfin_adv7393fb.h
@@ -87,12 +87,12 @@ static const u8 init_NTSC_TESTPATTERN[] = {
87 87
88static const u8 init_NTSC[] = { 88static const u8 init_NTSC[] = {
89 0x00, 0x1E, /* Power up all DACs and PLL */ 89 0x00, 0x1E, /* Power up all DACs and PLL */
90 0xC3, 0x26, /* Program RGB->YCrCb Color Space convertion matrix */ 90 0xC3, 0x26, /* Program RGB->YCrCb Color Space conversion matrix */
91 0xC5, 0x12, /* Program RGB->YCrCb Color Space convertion matrix */ 91 0xC5, 0x12, /* Program RGB->YCrCb Color Space conversion matrix */
92 0xC2, 0x4A, /* Program RGB->YCrCb Color Space convertion matrix */ 92 0xC2, 0x4A, /* Program RGB->YCrCb Color Space conversion matrix */
93 0xC6, 0x5E, /* Program RGB->YCrCb Color Space convertion matrix */ 93 0xC6, 0x5E, /* Program RGB->YCrCb Color Space conversion matrix */
94 0xBD, 0x19, /* Program RGB->YCrCb Color Space convertion matrix */ 94 0xBD, 0x19, /* Program RGB->YCrCb Color Space conversion matrix */
95 0xBF, 0x42, /* Program RGB->YCrCb Color Space convertion matrix */ 95 0xBF, 0x42, /* Program RGB->YCrCb Color Space conversion matrix */
96 0x8C, 0x1F, /* NTSC Subcarrier Frequency */ 96 0x8C, 0x1F, /* NTSC Subcarrier Frequency */
97 0x8D, 0x7C, /* NTSC Subcarrier Frequency */ 97 0x8D, 0x7C, /* NTSC Subcarrier Frequency */
98 0x8E, 0xF0, /* NTSC Subcarrier Frequency */ 98 0x8E, 0xF0, /* NTSC Subcarrier Frequency */
@@ -109,12 +109,12 @@ static const u8 init_NTSC[] = {
109 109
110static const u8 init_PAL[] = { 110static const u8 init_PAL[] = {
111 0x00, 0x1E, /* Power up all DACs and PLL */ 111 0x00, 0x1E, /* Power up all DACs and PLL */
112 0xC3, 0x26, /* Program RGB->YCrCb Color Space convertion matrix */ 112 0xC3, 0x26, /* Program RGB->YCrCb Color Space conversion matrix */
113 0xC5, 0x12, /* Program RGB->YCrCb Color Space convertion matrix */ 113 0xC5, 0x12, /* Program RGB->YCrCb Color Space conversion matrix */
114 0xC2, 0x4A, /* Program RGB->YCrCb Color Space convertion matrix */ 114 0xC2, 0x4A, /* Program RGB->YCrCb Color Space conversion matrix */
115 0xC6, 0x5E, /* Program RGB->YCrCb Color Space convertion matrix */ 115 0xC6, 0x5E, /* Program RGB->YCrCb Color Space conversion matrix */
116 0xBD, 0x19, /* Program RGB->YCrCb Color Space convertion matrix */ 116 0xBD, 0x19, /* Program RGB->YCrCb Color Space conversion matrix */
117 0xBF, 0x42, /* Program RGB->YCrCb Color Space convertion matrix */ 117 0xBF, 0x42, /* Program RGB->YCrCb Color Space conversion matrix */
118 0x8C, 0xCB, /* PAL Subcarrier Frequency */ 118 0x8C, 0xCB, /* PAL Subcarrier Frequency */
119 0x8D, 0x8A, /* PAL Subcarrier Frequency */ 119 0x8D, 0x8A, /* PAL Subcarrier Frequency */
120 0x8E, 0x09, /* PAL Subcarrier Frequency */ 120 0x8E, 0x09, /* PAL Subcarrier Frequency */
diff --git a/drivers/video/console/fbcon.c b/drivers/video/console/fbcon.c
index c58393402da2..8745637e4b7e 100644
--- a/drivers/video/console/fbcon.c
+++ b/drivers/video/console/fbcon.c
@@ -370,7 +370,6 @@ static void fb_flashcursor(struct work_struct *work)
370{ 370{
371 struct fb_info *info = container_of(work, struct fb_info, queue); 371 struct fb_info *info = container_of(work, struct fb_info, queue);
372 struct fbcon_ops *ops = info->fbcon_par; 372 struct fbcon_ops *ops = info->fbcon_par;
373 struct display *p;
374 struct vc_data *vc = NULL; 373 struct vc_data *vc = NULL;
375 int c; 374 int c;
376 int mode; 375 int mode;
@@ -386,7 +385,6 @@ static void fb_flashcursor(struct work_struct *work)
386 return; 385 return;
387 } 386 }
388 387
389 p = &fb_display[vc->vc_num];
390 c = scr_readw((u16 *) vc->vc_pos); 388 c = scr_readw((u16 *) vc->vc_pos);
391 mode = (!ops->cursor_flash || ops->cursor_state.enable) ? 389 mode = (!ops->cursor_flash || ops->cursor_state.enable) ?
392 CM_ERASE : CM_DRAW; 390 CM_ERASE : CM_DRAW;
diff --git a/drivers/video/console/font_mini_4x6.c b/drivers/video/console/font_mini_4x6.c
index a19a7f33133e..fa6e698e63c4 100644
--- a/drivers/video/console/font_mini_4x6.c
+++ b/drivers/video/console/font_mini_4x6.c
@@ -1,5 +1,5 @@
1 1
2/* Hand composed "Miniscule" 4x6 font, with binary data generated using 2/* Hand composed "Minuscule" 4x6 font, with binary data generated using
3 * Perl stub. 3 * Perl stub.
4 * 4 *
5 * Use 'perl -x mini_4x6.c < mini_4x6.c > new_version.c' to regenerate 5 * Use 'perl -x mini_4x6.c < mini_4x6.c > new_version.c' to regenerate
diff --git a/drivers/video/da8xx-fb.c b/drivers/video/da8xx-fb.c
index 8d61ef96eedd..8b7d47386f39 100644
--- a/drivers/video/da8xx-fb.c
+++ b/drivers/video/da8xx-fb.c
@@ -763,7 +763,7 @@ static int fb_wait_for_vsync(struct fb_info *info)
763 763
764 /* 764 /*
765 * Set flag to 0 and wait for isr to set to 1. It would seem there is a 765 * Set flag to 0 and wait for isr to set to 1. It would seem there is a
766 * race condition here where the ISR could have occured just before or 766 * race condition here where the ISR could have occurred just before or
767 * just after this set. But since we are just coarsely waiting for 767 * just after this set. But since we are just coarsely waiting for
768 * a frame to complete then that's OK. i.e. if the frame completed 768 * a frame to complete then that's OK. i.e. if the frame completed
769 * just before this code executed then we have to wait another full 769 * just before this code executed then we have to wait another full
diff --git a/drivers/video/display/display-sysfs.c b/drivers/video/display/display-sysfs.c
index f6a09ab0dac6..0c647d7af0ee 100644
--- a/drivers/video/display/display-sysfs.c
+++ b/drivers/video/display/display-sysfs.c
@@ -182,7 +182,7 @@ void display_device_unregister(struct display_device *ddev)
182 mutex_lock(&ddev->lock); 182 mutex_lock(&ddev->lock);
183 device_unregister(ddev->dev); 183 device_unregister(ddev->dev);
184 mutex_unlock(&ddev->lock); 184 mutex_unlock(&ddev->lock);
185 // Mark device index as avaliable 185 // Mark device index as available
186 mutex_lock(&allocated_dsp_lock); 186 mutex_lock(&allocated_dsp_lock);
187 idr_remove(&allocated_dsp, ddev->idx); 187 idr_remove(&allocated_dsp, ddev->idx);
188 mutex_unlock(&allocated_dsp_lock); 188 mutex_unlock(&allocated_dsp_lock);
diff --git a/drivers/video/efifb.c b/drivers/video/efifb.c
index 70477c2e4b61..4eb38db36e4b 100644
--- a/drivers/video/efifb.c
+++ b/drivers/video/efifb.c
@@ -53,6 +53,7 @@ enum {
53 M_MB_7_1, /* MacBook, 7th rev. */ 53 M_MB_7_1, /* MacBook, 7th rev. */
54 M_MB_SR, /* MacBook, 2nd gen, (Santa Rosa) */ 54 M_MB_SR, /* MacBook, 2nd gen, (Santa Rosa) */
55 M_MBA, /* MacBook Air */ 55 M_MBA, /* MacBook Air */
56 M_MBA_3, /* Macbook Air, 3rd rev */
56 M_MBP, /* MacBook Pro */ 57 M_MBP, /* MacBook Pro */
57 M_MBP_2, /* MacBook Pro 2nd gen */ 58 M_MBP_2, /* MacBook Pro 2nd gen */
58 M_MBP_2_2, /* MacBook Pro 2,2nd gen */ 59 M_MBP_2_2, /* MacBook Pro 2,2nd gen */
@@ -64,43 +65,54 @@ enum {
64 M_MBP_6_1, /* MacBook Pro, 6,1th gen */ 65 M_MBP_6_1, /* MacBook Pro, 6,1th gen */
65 M_MBP_6_2, /* MacBook Pro, 6,2th gen */ 66 M_MBP_6_2, /* MacBook Pro, 6,2th gen */
66 M_MBP_7_1, /* MacBook Pro, 7,1th gen */ 67 M_MBP_7_1, /* MacBook Pro, 7,1th gen */
68 M_MBP_8_2, /* MacBook Pro, 8,2nd gen */
67 M_UNKNOWN /* placeholder */ 69 M_UNKNOWN /* placeholder */
68}; 70};
69 71
72#define OVERRIDE_NONE 0x0
73#define OVERRIDE_BASE 0x1
74#define OVERRIDE_STRIDE 0x2
75#define OVERRIDE_HEIGHT 0x4
76#define OVERRIDE_WIDTH 0x8
77
70static struct efifb_dmi_info { 78static struct efifb_dmi_info {
71 char *optname; 79 char *optname;
72 unsigned long base; 80 unsigned long base;
73 int stride; 81 int stride;
74 int width; 82 int width;
75 int height; 83 int height;
84 int flags;
76} dmi_list[] __initdata = { 85} dmi_list[] __initdata = {
77 [M_I17] = { "i17", 0x80010000, 1472 * 4, 1440, 900 }, 86 [M_I17] = { "i17", 0x80010000, 1472 * 4, 1440, 900, OVERRIDE_NONE },
78 [M_I20] = { "i20", 0x80010000, 1728 * 4, 1680, 1050 }, /* guess */ 87 [M_I20] = { "i20", 0x80010000, 1728 * 4, 1680, 1050, OVERRIDE_NONE }, /* guess */
79 [M_I20_SR] = { "imac7", 0x40010000, 1728 * 4, 1680, 1050 }, 88 [M_I20_SR] = { "imac7", 0x40010000, 1728 * 4, 1680, 1050, OVERRIDE_NONE },
80 [M_I24] = { "i24", 0x80010000, 2048 * 4, 1920, 1200 }, /* guess */ 89 [M_I24] = { "i24", 0x80010000, 2048 * 4, 1920, 1200, OVERRIDE_NONE }, /* guess */
81 [M_I24_8_1] = { "imac8", 0xc0060000, 2048 * 4, 1920, 1200 }, 90 [M_I24_8_1] = { "imac8", 0xc0060000, 2048 * 4, 1920, 1200, OVERRIDE_NONE },
82 [M_I24_10_1] = { "imac10", 0xc0010000, 2048 * 4, 1920, 1080 }, 91 [M_I24_10_1] = { "imac10", 0xc0010000, 2048 * 4, 1920, 1080, OVERRIDE_NONE },
83 [M_I27_11_1] = { "imac11", 0xc0010000, 2560 * 4, 2560, 1440 }, 92 [M_I27_11_1] = { "imac11", 0xc0010000, 2560 * 4, 2560, 1440, OVERRIDE_NONE },
84 [M_MINI]= { "mini", 0x80000000, 2048 * 4, 1024, 768 }, 93 [M_MINI]= { "mini", 0x80000000, 2048 * 4, 1024, 768, OVERRIDE_NONE },
85 [M_MINI_3_1] = { "mini31", 0x40010000, 1024 * 4, 1024, 768 }, 94 [M_MINI_3_1] = { "mini31", 0x40010000, 1024 * 4, 1024, 768, OVERRIDE_NONE },
86 [M_MINI_4_1] = { "mini41", 0xc0010000, 2048 * 4, 1920, 1200 }, 95 [M_MINI_4_1] = { "mini41", 0xc0010000, 2048 * 4, 1920, 1200, OVERRIDE_NONE },
87 [M_MB] = { "macbook", 0x80000000, 2048 * 4, 1280, 800 }, 96 [M_MB] = { "macbook", 0x80000000, 2048 * 4, 1280, 800, OVERRIDE_NONE },
88 [M_MB_5_1] = { "macbook51", 0x80010000, 2048 * 4, 1280, 800 }, 97 [M_MB_5_1] = { "macbook51", 0x80010000, 2048 * 4, 1280, 800, OVERRIDE_NONE },
89 [M_MB_6_1] = { "macbook61", 0x80010000, 2048 * 4, 1280, 800 }, 98 [M_MB_6_1] = { "macbook61", 0x80010000, 2048 * 4, 1280, 800, OVERRIDE_NONE },
90 [M_MB_7_1] = { "macbook71", 0x80010000, 2048 * 4, 1280, 800 }, 99 [M_MB_7_1] = { "macbook71", 0x80010000, 2048 * 4, 1280, 800, OVERRIDE_NONE },
91 [M_MBA] = { "mba", 0x80000000, 2048 * 4, 1280, 800 }, 100 [M_MBA] = { "mba", 0x80000000, 2048 * 4, 1280, 800, OVERRIDE_NONE },
92 [M_MBP] = { "mbp", 0x80010000, 1472 * 4, 1440, 900 }, 101 /* 11" Macbook Air 3,1 passes the wrong stride */
93 [M_MBP_2] = { "mbp2", 0, 0, 0, 0 }, /* placeholder */ 102 [M_MBA_3] = { "mba3", 0, 2048 * 4, 0, 0, OVERRIDE_STRIDE },
94 [M_MBP_2_2] = { "mbp22", 0x80010000, 1472 * 4, 1440, 900 }, 103 [M_MBP] = { "mbp", 0x80010000, 1472 * 4, 1440, 900, OVERRIDE_NONE },
95 [M_MBP_SR] = { "mbp3", 0x80030000, 2048 * 4, 1440, 900 }, 104 [M_MBP_2] = { "mbp2", 0, 0, 0, 0, OVERRIDE_NONE }, /* placeholder */
96 [M_MBP_4] = { "mbp4", 0xc0060000, 2048 * 4, 1920, 1200 }, 105 [M_MBP_2_2] = { "mbp22", 0x80010000, 1472 * 4, 1440, 900, OVERRIDE_NONE },
97 [M_MBP_5_1] = { "mbp51", 0xc0010000, 2048 * 4, 1440, 900 }, 106 [M_MBP_SR] = { "mbp3", 0x80030000, 2048 * 4, 1440, 900, OVERRIDE_NONE },
98 [M_MBP_5_2] = { "mbp52", 0xc0010000, 2048 * 4, 1920, 1200 }, 107 [M_MBP_4] = { "mbp4", 0xc0060000, 2048 * 4, 1920, 1200, OVERRIDE_NONE },
99 [M_MBP_5_3] = { "mbp53", 0xd0010000, 2048 * 4, 1440, 900 }, 108 [M_MBP_5_1] = { "mbp51", 0xc0010000, 2048 * 4, 1440, 900, OVERRIDE_NONE },
100 [M_MBP_6_1] = { "mbp61", 0x90030000, 2048 * 4, 1920, 1200 }, 109 [M_MBP_5_2] = { "mbp52", 0xc0010000, 2048 * 4, 1920, 1200, OVERRIDE_NONE },
101 [M_MBP_6_2] = { "mbp62", 0x90030000, 2048 * 4, 1680, 1050 }, 110 [M_MBP_5_3] = { "mbp53", 0xd0010000, 2048 * 4, 1440, 900, OVERRIDE_NONE },
102 [M_MBP_7_1] = { "mbp71", 0xc0010000, 2048 * 4, 1280, 800 }, 111 [M_MBP_6_1] = { "mbp61", 0x90030000, 2048 * 4, 1920, 1200, OVERRIDE_NONE },
103 [M_UNKNOWN] = { NULL, 0, 0, 0, 0 } 112 [M_MBP_6_2] = { "mbp62", 0x90030000, 2048 * 4, 1680, 1050, OVERRIDE_NONE },
113 [M_MBP_7_1] = { "mbp71", 0xc0010000, 2048 * 4, 1280, 800, OVERRIDE_NONE },
114 [M_MBP_8_2] = { "mbp82", 0x90010000, 1472 * 4, 1440, 900, OVERRIDE_NONE },
115 [M_UNKNOWN] = { NULL, 0, 0, 0, 0, OVERRIDE_NONE }
104}; 116};
105 117
106static int set_system(const struct dmi_system_id *id); 118static int set_system(const struct dmi_system_id *id);
@@ -138,6 +150,7 @@ static const struct dmi_system_id dmi_system_table[] __initconst = {
138 EFIFB_DMI_SYSTEM_ID("Apple Inc.", "MacBook6,1", M_MB_6_1), 150 EFIFB_DMI_SYSTEM_ID("Apple Inc.", "MacBook6,1", M_MB_6_1),
139 EFIFB_DMI_SYSTEM_ID("Apple Inc.", "MacBook7,1", M_MB_7_1), 151 EFIFB_DMI_SYSTEM_ID("Apple Inc.", "MacBook7,1", M_MB_7_1),
140 EFIFB_DMI_SYSTEM_ID("Apple Inc.", "MacBookAir1,1", M_MBA), 152 EFIFB_DMI_SYSTEM_ID("Apple Inc.", "MacBookAir1,1", M_MBA),
153 EFIFB_DMI_SYSTEM_ID("Apple Inc.", "MacBookAir3,1", M_MBA_3),
141 EFIFB_DMI_SYSTEM_ID("Apple Computer, Inc.", "MacBookPro1,1", M_MBP), 154 EFIFB_DMI_SYSTEM_ID("Apple Computer, Inc.", "MacBookPro1,1", M_MBP),
142 EFIFB_DMI_SYSTEM_ID("Apple Computer, Inc.", "MacBookPro2,1", M_MBP_2), 155 EFIFB_DMI_SYSTEM_ID("Apple Computer, Inc.", "MacBookPro2,1", M_MBP_2),
143 EFIFB_DMI_SYSTEM_ID("Apple Computer, Inc.", "MacBookPro2,2", M_MBP_2_2), 156 EFIFB_DMI_SYSTEM_ID("Apple Computer, Inc.", "MacBookPro2,2", M_MBP_2_2),
@@ -151,19 +164,26 @@ static const struct dmi_system_id dmi_system_table[] __initconst = {
151 EFIFB_DMI_SYSTEM_ID("Apple Inc.", "MacBookPro6,1", M_MBP_6_1), 164 EFIFB_DMI_SYSTEM_ID("Apple Inc.", "MacBookPro6,1", M_MBP_6_1),
152 EFIFB_DMI_SYSTEM_ID("Apple Inc.", "MacBookPro6,2", M_MBP_6_2), 165 EFIFB_DMI_SYSTEM_ID("Apple Inc.", "MacBookPro6,2", M_MBP_6_2),
153 EFIFB_DMI_SYSTEM_ID("Apple Inc.", "MacBookPro7,1", M_MBP_7_1), 166 EFIFB_DMI_SYSTEM_ID("Apple Inc.", "MacBookPro7,1", M_MBP_7_1),
167 EFIFB_DMI_SYSTEM_ID("Apple Inc.", "MacBookPro8,2", M_MBP_8_2),
154 {}, 168 {},
155}; 169};
156 170
171#define choose_value(dmivalue, fwvalue, field, flags) ({ \
172 typeof(fwvalue) _ret_ = fwvalue; \
173 if ((flags) & (field)) \
174 _ret_ = dmivalue; \
175 else if ((fwvalue) == 0) \
176 _ret_ = dmivalue; \
177 _ret_; \
178 })
179
157static int set_system(const struct dmi_system_id *id) 180static int set_system(const struct dmi_system_id *id)
158{ 181{
159 struct efifb_dmi_info *info = id->driver_data; 182 struct efifb_dmi_info *info = id->driver_data;
160 if (info->base == 0)
161 return 0;
162 183
163 printk(KERN_INFO "efifb: dmi detected %s - framebuffer at %p " 184 if (info->base == 0 && info->height == 0 && info->width == 0
164 "(%dx%d, stride %d)\n", id->ident, 185 && info->stride == 0)
165 (void *)info->base, info->width, info->height, 186 return 0;
166 info->stride);
167 187
168 /* Trust the bootloader over the DMI tables */ 188 /* Trust the bootloader over the DMI tables */
169 if (screen_info.lfb_base == 0) { 189 if (screen_info.lfb_base == 0) {
@@ -171,40 +191,47 @@ static int set_system(const struct dmi_system_id *id)
171 struct pci_dev *dev = NULL; 191 struct pci_dev *dev = NULL;
172 int found_bar = 0; 192 int found_bar = 0;
173#endif 193#endif
174 screen_info.lfb_base = info->base; 194 if (info->base) {
195 screen_info.lfb_base = choose_value(info->base,
196 screen_info.lfb_base, OVERRIDE_BASE,
197 info->flags);
175 198
176#if defined(CONFIG_PCI) 199#if defined(CONFIG_PCI)
177 /* make sure that the address in the table is actually on a 200 /* make sure that the address in the table is actually
178 * VGA device's PCI BAR */ 201 * on a VGA device's PCI BAR */
179 202
180 for_each_pci_dev(dev) { 203 for_each_pci_dev(dev) {
181 int i; 204 int i;
182 if ((dev->class >> 8) != PCI_CLASS_DISPLAY_VGA) 205 if ((dev->class >> 8) != PCI_CLASS_DISPLAY_VGA)
183 continue; 206 continue;
184 for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) { 207 for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) {
185 resource_size_t start, end; 208 resource_size_t start, end;
186 209
187 start = pci_resource_start(dev, i); 210 start = pci_resource_start(dev, i);
188 if (start == 0) 211 if (start == 0)
189 break; 212 break;
190 end = pci_resource_end(dev, i); 213 end = pci_resource_end(dev, i);
191 if (screen_info.lfb_base >= start && 214 if (screen_info.lfb_base >= start &&
192 screen_info.lfb_base < end) { 215 screen_info.lfb_base < end) {
193 found_bar = 1; 216 found_bar = 1;
217 }
194 } 218 }
195 } 219 }
196 } 220 if (!found_bar)
197 if (!found_bar) 221 screen_info.lfb_base = 0;
198 screen_info.lfb_base = 0;
199#endif 222#endif
223 }
200 } 224 }
201 if (screen_info.lfb_base) { 225 if (screen_info.lfb_base) {
202 if (screen_info.lfb_linelength == 0) 226 screen_info.lfb_linelength = choose_value(info->stride,
203 screen_info.lfb_linelength = info->stride; 227 screen_info.lfb_linelength, OVERRIDE_STRIDE,
204 if (screen_info.lfb_width == 0) 228 info->flags);
205 screen_info.lfb_width = info->width; 229 screen_info.lfb_width = choose_value(info->width,
206 if (screen_info.lfb_height == 0) 230 screen_info.lfb_width, OVERRIDE_WIDTH,
207 screen_info.lfb_height = info->height; 231 info->flags);
232 screen_info.lfb_height = choose_value(info->height,
233 screen_info.lfb_height, OVERRIDE_HEIGHT,
234 info->flags);
208 if (screen_info.orig_video_isVGA == 0) 235 if (screen_info.orig_video_isVGA == 0)
209 screen_info.orig_video_isVGA = VIDEO_TYPE_EFI; 236 screen_info.orig_video_isVGA = VIDEO_TYPE_EFI;
210 } else { 237 } else {
@@ -214,6 +241,13 @@ static int set_system(const struct dmi_system_id *id)
214 screen_info.orig_video_isVGA = 0; 241 screen_info.orig_video_isVGA = 0;
215 return 0; 242 return 0;
216 } 243 }
244
245 printk(KERN_INFO "efifb: dmi detected %s - framebuffer at %p "
246 "(%dx%d, stride %d)\n", id->ident,
247 (void *)screen_info.lfb_base, screen_info.lfb_width,
248 screen_info.lfb_height, screen_info.lfb_linelength);
249
250
217 return 1; 251 return 1;
218} 252}
219 253
diff --git a/drivers/video/ep93xx-fb.c b/drivers/video/ep93xx-fb.c
index b358d045f130..cbdb1bd77c21 100644
--- a/drivers/video/ep93xx-fb.c
+++ b/drivers/video/ep93xx-fb.c
@@ -456,7 +456,7 @@ static int __init ep93xxfb_alloc_videomem(struct fb_info *info)
456 * There is a bug in the ep93xx framebuffer which causes problems 456 * There is a bug in the ep93xx framebuffer which causes problems
457 * if bit 27 of the physical address is set. 457 * if bit 27 of the physical address is set.
458 * See: http://marc.info/?l=linux-arm-kernel&m=110061245502000&w=2 458 * See: http://marc.info/?l=linux-arm-kernel&m=110061245502000&w=2
459 * There does not seem to be any offical errata for this, but I 459 * There does not seem to be any official errata for this, but I
460 * have confirmed the problem exists on my hardware (ep9315) at 460 * have confirmed the problem exists on my hardware (ep9315) at
461 * least. 461 * least.
462 */ 462 */
diff --git a/drivers/video/fb-puv3.c b/drivers/video/fb-puv3.c
index dbd2dc4745d1..27f2c57e06e9 100644
--- a/drivers/video/fb-puv3.c
+++ b/drivers/video/fb-puv3.c
@@ -13,7 +13,6 @@
13#include <linux/module.h> 13#include <linux/module.h>
14#include <linux/kernel.h> 14#include <linux/kernel.h>
15#include <linux/errno.h> 15#include <linux/errno.h>
16#include <linux/vmalloc.h>
17#include <linux/platform_device.h> 16#include <linux/platform_device.h>
18#include <linux/clk.h> 17#include <linux/clk.h>
19#include <linux/fb.h> 18#include <linux/fb.h>
@@ -531,7 +530,7 @@ static int unifb_set_par(struct fb_info *info)
531 return -EINVAL; 530 return -EINVAL;
532 } 531 }
533 532
534 writel(PKUNITY_UNIGFX_MMAP_BASE, UDE_FSA); 533 writel(info->fix.smem_start, UDE_FSA);
535 writel(info->var.yres, UDE_LS); 534 writel(info->var.yres, UDE_LS);
536 writel(get_line_length(info->var.xres, 535 writel(get_line_length(info->var.xres,
537 info->var.bits_per_pixel) >> 3, UDE_PS); 536 info->var.bits_per_pixel) >> 3, UDE_PS);
@@ -680,13 +679,27 @@ static int unifb_probe(struct platform_device *dev)
680 struct fb_info *info; 679 struct fb_info *info;
681 u32 unifb_regs[UNIFB_REGS_NUM]; 680 u32 unifb_regs[UNIFB_REGS_NUM];
682 int retval = -ENOMEM; 681 int retval = -ENOMEM;
683 struct resource *iomem, *mapmem; 682 struct resource *iomem;
683 void *videomemory;
684
685 videomemory = (void *)__get_free_pages(GFP_KERNEL | __GFP_COMP,
686 get_order(UNIFB_MEMSIZE));
687 if (!videomemory)
688 goto err;
689
690 memset(videomemory, 0, UNIFB_MEMSIZE);
691
692 unifb_fix.smem_start = virt_to_phys(videomemory);
693 unifb_fix.smem_len = UNIFB_MEMSIZE;
694
695 iomem = platform_get_resource(dev, IORESOURCE_MEM, 0);
696 unifb_fix.mmio_start = iomem->start;
684 697
685 info = framebuffer_alloc(sizeof(u32)*256, &dev->dev); 698 info = framebuffer_alloc(sizeof(u32)*256, &dev->dev);
686 if (!info) 699 if (!info)
687 goto err; 700 goto err;
688 701
689 info->screen_base = (char __iomem *)KUSER_UNIGFX_BASE; 702 info->screen_base = (char __iomem *)videomemory;
690 info->fbops = &unifb_ops; 703 info->fbops = &unifb_ops;
691 704
692 retval = fb_find_mode(&info->var, info, NULL, 705 retval = fb_find_mode(&info->var, info, NULL,
@@ -695,13 +708,6 @@ static int unifb_probe(struct platform_device *dev)
695 if (!retval || (retval == 4)) 708 if (!retval || (retval == 4))
696 info->var = unifb_default; 709 info->var = unifb_default;
697 710
698 iomem = platform_get_resource(dev, IORESOURCE_MEM, 0);
699 unifb_fix.mmio_start = iomem->start;
700
701 mapmem = platform_get_resource(dev, IORESOURCE_MEM, 1);
702 unifb_fix.smem_start = mapmem->start;
703 unifb_fix.smem_len = UNIFB_MEMSIZE;
704
705 info->fix = unifb_fix; 711 info->fix = unifb_fix;
706 info->pseudo_palette = info->par; 712 info->pseudo_palette = info->par;
707 info->par = NULL; 713 info->par = NULL;
diff --git a/drivers/video/fbmem.c b/drivers/video/fbmem.c
index e2bf95370e40..e0c2284924b6 100644
--- a/drivers/video/fbmem.c
+++ b/drivers/video/fbmem.c
@@ -1507,7 +1507,7 @@ void remove_conflicting_framebuffers(struct apertures_struct *a,
1507 (primary && gen_aper && gen_aper->count && 1507 (primary && gen_aper && gen_aper->count &&
1508 gen_aper->ranges[0].base == VGA_FB_PHYS)) { 1508 gen_aper->ranges[0].base == VGA_FB_PHYS)) {
1509 1509
1510 printk(KERN_ERR "fb: conflicting fb hw usage " 1510 printk(KERN_INFO "fb: conflicting fb hw usage "
1511 "%s vs %s - removing generic driver\n", 1511 "%s vs %s - removing generic driver\n",
1512 name, registered_fb[i]->fix.id); 1512 name, registered_fb[i]->fix.id);
1513 unregister_framebuffer(registered_fb[i]); 1513 unregister_framebuffer(registered_fb[i]);
diff --git a/drivers/video/fbsysfs.c b/drivers/video/fbsysfs.c
index f4a32779168b..04251ce89184 100644
--- a/drivers/video/fbsysfs.c
+++ b/drivers/video/fbsysfs.c
@@ -33,7 +33,7 @@
33 * for driver private data (info->par). info->par (if any) will be 33 * for driver private data (info->par). info->par (if any) will be
34 * aligned to sizeof(long). 34 * aligned to sizeof(long).
35 * 35 *
36 * Returns the new structure, or NULL if an error occured. 36 * Returns the new structure, or NULL if an error occurred.
37 * 37 *
38 */ 38 */
39struct fb_info *framebuffer_alloc(size_t size, struct device *dev) 39struct fb_info *framebuffer_alloc(size_t size, struct device *dev)
diff --git a/drivers/video/fm2fb.c b/drivers/video/fm2fb.c
index 1b0feb8e7244..d0533b7aad79 100644
--- a/drivers/video/fm2fb.c
+++ b/drivers/video/fm2fb.c
@@ -45,7 +45,7 @@
45 * buffer needs an amount of memory of 1.769.472 bytes which 45 * buffer needs an amount of memory of 1.769.472 bytes which
46 * is near to 2 MByte (the allocated address space of Zorro2). 46 * is near to 2 MByte (the allocated address space of Zorro2).
47 * The memory is channel interleaved. That means every channel 47 * The memory is channel interleaved. That means every channel
48 * owns four VRAMs. Unfortunatly most FrameMasters II are 48 * owns four VRAMs. Unfortunately most FrameMasters II are
49 * not assembled with memory for the alpha channel. In this 49 * not assembled with memory for the alpha channel. In this
50 * case it could be possible to add the frame buffer into the 50 * case it could be possible to add the frame buffer into the
51 * normal memory pool. 51 * normal memory pool.
diff --git a/drivers/video/fsl-diu-fb.c b/drivers/video/fsl-diu-fb.c
index 9048f87fa8c1..bedf5be27f05 100644
--- a/drivers/video/fsl-diu-fb.c
+++ b/drivers/video/fsl-diu-fb.c
@@ -882,7 +882,7 @@ static inline __u32 CNVT_TOHW(__u32 val, __u32 width)
882 * which needs to be scaled in this function for the hardware. Things to take 882 * which needs to be scaled in this function for the hardware. Things to take
883 * into consideration are how many color registers, if any, are supported with 883 * into consideration are how many color registers, if any, are supported with
884 * the current color visual. With truecolor mode no color palettes are 884 * the current color visual. With truecolor mode no color palettes are
885 * supported. Here a psuedo palette is created which we store the value in 885 * supported. Here a pseudo palette is created which we store the value in
886 * pseudo_palette in struct fb_info. For pseudocolor mode we have a limited 886 * pseudo_palette in struct fb_info. For pseudocolor mode we have a limited
887 * color palette. 887 * color palette.
888 */ 888 */
diff --git a/drivers/video/gbefb.c b/drivers/video/gbefb.c
index 933899dca33a..7e7b7a9ba274 100644
--- a/drivers/video/gbefb.c
+++ b/drivers/video/gbefb.c
@@ -721,7 +721,7 @@ static int gbefb_set_par(struct fb_info *info)
721 721
722 Tiles have the advantage that they can be allocated individually in 722 Tiles have the advantage that they can be allocated individually in
723 memory. However, this mapping is not linear at all, which is not 723 memory. However, this mapping is not linear at all, which is not
724 really convienient. In order to support linear addressing, the GBE 724 really convenient. In order to support linear addressing, the GBE
725 DMA hardware is fooled into thinking the screen is only one tile 725 DMA hardware is fooled into thinking the screen is only one tile
726 large and but has a greater height, so that the DMA transfer covers 726 large and but has a greater height, so that the DMA transfer covers
727 the same region. 727 the same region.
diff --git a/drivers/video/geode/lxfb.h b/drivers/video/geode/lxfb.h
index be8ccb47ebe0..cfcd8090f313 100644
--- a/drivers/video/geode/lxfb.h
+++ b/drivers/video/geode/lxfb.h
@@ -117,7 +117,7 @@ enum gp_registers {
117}; 117};
118 118
119#define GP_BLT_STATUS_CE (1 << 4) /* cmd buf empty */ 119#define GP_BLT_STATUS_CE (1 << 4) /* cmd buf empty */
120#define GP_BLT_STATUS_PB (1 << 0) /* primative busy */ 120#define GP_BLT_STATUS_PB (1 << 0) /* primitive busy */
121 121
122 122
123/* Display Controller registers (table 6-47 from the data book) */ 123/* Display Controller registers (table 6-47 from the data book) */
diff --git a/drivers/video/i810/i810_accel.c b/drivers/video/i810/i810_accel.c
index f5bedee4310a..7672d2ea9b35 100644
--- a/drivers/video/i810/i810_accel.c
+++ b/drivers/video/i810/i810_accel.c
@@ -112,7 +112,7 @@ static inline int wait_for_engine_idle(struct fb_info *info)
112 * @par: pointer to i810fb_par structure 112 * @par: pointer to i810fb_par structure
113 * 113 *
114 * DESCRIPTION: 114 * DESCRIPTION:
115 * Checks/waits for sufficent space in ringbuffer of size 115 * Checks/waits for sufficient space in ringbuffer of size
116 * space. Returns the tail of the buffer 116 * space. Returns the tail of the buffer
117 */ 117 */
118static inline u32 begin_iring(struct fb_info *info, u32 space) 118static inline u32 begin_iring(struct fb_info *info, u32 space)
diff --git a/drivers/video/kyro/STG4000OverlayDevice.c b/drivers/video/kyro/STG4000OverlayDevice.c
index a8c9713413e6..0aeeaa10708b 100644
--- a/drivers/video/kyro/STG4000OverlayDevice.c
+++ b/drivers/video/kyro/STG4000OverlayDevice.c
@@ -417,7 +417,7 @@ int SetOverlayViewPort(volatile STG4000REG __iomem *pSTGReg,
417 /***************** Horizontal decimation/scaling ***************************/ 417 /***************** Horizontal decimation/scaling ***************************/
418 418
419 /* 419 /*
420 * Now we handle the horizontal case, this is a simplified verison of 420 * Now we handle the horizontal case, this is a simplified version of
421 * the vertical case in that we decimate by factors of 2. as we are 421 * the vertical case in that we decimate by factors of 2. as we are
422 * working in words we should always be able to decimate by these 422 * working in words we should always be able to decimate by these
423 * factors. as we always have to have a buffer which is aligned to a 423 * factors. as we always have to have a buffer which is aligned to a
diff --git a/drivers/video/kyro/STG4000Reg.h b/drivers/video/kyro/STG4000Reg.h
index 244549e61368..5d6269882589 100644
--- a/drivers/video/kyro/STG4000Reg.h
+++ b/drivers/video/kyro/STG4000Reg.h
@@ -16,7 +16,7 @@
16 16
17/* 17/*
18 * Macros that access memory mapped card registers in PCI space 18 * Macros that access memory mapped card registers in PCI space
19 * Add an appropraite section for your OS or processor architecture. 19 * Add an appropriate section for your OS or processor architecture.
20 */ 20 */
21#if defined(__KERNEL__) 21#if defined(__KERNEL__)
22#include <asm/page.h> 22#include <asm/page.h>
diff --git a/drivers/video/matrox/matroxfb_DAC1064.h b/drivers/video/matrox/matroxfb_DAC1064.h
index c6ed7801efe2..1e6e45b57b78 100644
--- a/drivers/video/matrox/matroxfb_DAC1064.h
+++ b/drivers/video/matrox/matroxfb_DAC1064.h
@@ -46,7 +46,7 @@ void DAC1064_global_restore(struct matrox_fb_info *minfo);
46#define M1064_XDVICLKCTRL_DVILOOPCTL 0x30 46#define M1064_XDVICLKCTRL_DVILOOPCTL 0x30
47 /* CRTC2 pixel clock allowed to(0)/blocked from(1) driving CRTC2 */ 47 /* CRTC2 pixel clock allowed to(0)/blocked from(1) driving CRTC2 */
48#define M1064_XDVICLKCTRL_C2DVICLKEN 0x40 48#define M1064_XDVICLKCTRL_C2DVICLKEN 0x40
49 /* P1PLL loop filter bandwith selection */ 49 /* P1PLL loop filter bandwidth selection */
50#define M1064_XDVICLKCTRL_P1LOOPBWDTCTL 0x80 50#define M1064_XDVICLKCTRL_P1LOOPBWDTCTL 0x80
51#define M1064_XCURCOL0RED 0x08 51#define M1064_XCURCOL0RED 0x08
52#define M1064_XCURCOL0GREEN 0x09 52#define M1064_XCURCOL0GREEN 0x09
diff --git a/drivers/video/matrox/matroxfb_Ti3026.c b/drivers/video/matrox/matroxfb_Ti3026.c
index 835aaaae6b96..9a44cec394b5 100644
--- a/drivers/video/matrox/matroxfb_Ti3026.c
+++ b/drivers/video/matrox/matroxfb_Ti3026.c
@@ -387,7 +387,7 @@ static int Ti3026_init(struct matrox_fb_info *minfo, struct my_timming *m)
387 hw->DACreg[POS3026_XMISCCTRL] = TVP3026_XMISCCTRL_DAC_PUP | TVP3026_XMISCCTRL_DAC_8BIT | TVP3026_XMISCCTRL_PSEL_DIS | TVP3026_XMISCCTRL_PSEL_LOW; 387 hw->DACreg[POS3026_XMISCCTRL] = TVP3026_XMISCCTRL_DAC_PUP | TVP3026_XMISCCTRL_DAC_8BIT | TVP3026_XMISCCTRL_PSEL_DIS | TVP3026_XMISCCTRL_PSEL_LOW;
388 break; 388 break;
389 case 16: 389 case 16:
390 /* XLATCHCTRL should be _4_1 / _2_1... Why is not? (_2_1 is used everytime) */ 390 /* XLATCHCTRL should be _4_1 / _2_1... Why is not? (_2_1 is used every time) */
391 hw->DACreg[POS3026_XTRUECOLORCTRL] = (minfo->fbcon.var.green.length == 5) ? (TVP3026_XTRUECOLORCTRL_DIRECTCOLOR | TVP3026_XTRUECOLORCTRL_ORGB_1555) : (TVP3026_XTRUECOLORCTRL_DIRECTCOLOR | TVP3026_XTRUECOLORCTRL_RGB_565); 391 hw->DACreg[POS3026_XTRUECOLORCTRL] = (minfo->fbcon.var.green.length == 5) ? (TVP3026_XTRUECOLORCTRL_DIRECTCOLOR | TVP3026_XTRUECOLORCTRL_ORGB_1555) : (TVP3026_XTRUECOLORCTRL_DIRECTCOLOR | TVP3026_XTRUECOLORCTRL_RGB_565);
392 hw->DACreg[POS3026_XMUXCTRL] = muxctrl | TVP3026_XMUXCTRL_PIXEL_16BIT; 392 hw->DACreg[POS3026_XMUXCTRL] = muxctrl | TVP3026_XMUXCTRL_PIXEL_16BIT;
393 hw->DACreg[POS3026_XCLKCTRL] = TVP3026_XCLKCTRL_SRC_PLL | TVP3026_XCLKCTRL_DIV2; 393 hw->DACreg[POS3026_XCLKCTRL] = TVP3026_XCLKCTRL_SRC_PLL | TVP3026_XCLKCTRL_DIV2;
@@ -399,7 +399,7 @@ static int Ti3026_init(struct matrox_fb_info *minfo, struct my_timming *m)
399 hw->DACreg[POS3026_XCLKCTRL] = TVP3026_XCLKCTRL_SRC_PLL | TVP3026_XCLKCTRL_DIV4; 399 hw->DACreg[POS3026_XCLKCTRL] = TVP3026_XCLKCTRL_SRC_PLL | TVP3026_XCLKCTRL_DIV4;
400 break; 400 break;
401 case 32: 401 case 32:
402 /* XLATCHCTRL should be _2_1 / _1_1... Why is not? (_2_1 is used everytime) */ 402 /* XLATCHCTRL should be _2_1 / _1_1... Why is not? (_2_1 is used every time) */
403 hw->DACreg[POS3026_XMUXCTRL] = muxctrl | TVP3026_XMUXCTRL_PIXEL_32BIT; 403 hw->DACreg[POS3026_XMUXCTRL] = muxctrl | TVP3026_XMUXCTRL_PIXEL_32BIT;
404 break; 404 break;
405 default: 405 default:
diff --git a/drivers/video/matrox/matroxfb_base.c b/drivers/video/matrox/matroxfb_base.c
index 5ce6fa6e59f0..44bf8d4a216b 100644
--- a/drivers/video/matrox/matroxfb_base.c
+++ b/drivers/video/matrox/matroxfb_base.c
@@ -621,7 +621,7 @@ static int matroxfb_decode_var(const struct matrox_fb_info *minfo,
621 var->yoffset = var->yres_virtual - var->yres; 621 var->yoffset = var->yres_virtual - var->yres;
622 622
623 if (bpp == 16 && var->green.length == 5) { 623 if (bpp == 16 && var->green.length == 5) {
624 bpp--; /* an artifical value - 15 */ 624 bpp--; /* an artificial value - 15 */
625 } 625 }
626 626
627 for (rgbt = table; rgbt->bpp < bpp; rgbt++); 627 for (rgbt = table; rgbt->bpp < bpp; rgbt++);
diff --git a/drivers/video/matrox/matroxfb_base.h b/drivers/video/matrox/matroxfb_base.h
index f96a471cb1a8..11ed57bb704e 100644
--- a/drivers/video/matrox/matroxfb_base.h
+++ b/drivers/video/matrox/matroxfb_base.h
@@ -12,7 +12,7 @@
12#undef MATROXFB_DEBUG 12#undef MATROXFB_DEBUG
13 13
14/* heavy debugging: */ 14/* heavy debugging: */
15/* -- logs putc[s], so everytime a char is displayed, it's logged */ 15/* -- logs putc[s], so every time a char is displayed, it's logged */
16#undef MATROXFB_DEBUG_HEAVY 16#undef MATROXFB_DEBUG_HEAVY
17 17
18/* This one _could_ cause infinite loops */ 18/* This one _could_ cause infinite loops */
diff --git a/drivers/video/nuc900fb.h b/drivers/video/nuc900fb.h
index 6c23aa3d3b89..bc7c9300f276 100644
--- a/drivers/video/nuc900fb.h
+++ b/drivers/video/nuc900fb.h
@@ -8,7 +8,7 @@
8 * the Free Software Foundation; either version 2 of the License, or 8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version. 9 * (at your option) any later version.
10 * 10 *
11 * Auther: 11 * Author:
12 * Wang Qiang(rurality.linux@gmail.com) 2009/12/16 12 * Wang Qiang(rurality.linux@gmail.com) 2009/12/16
13 */ 13 */
14 14
diff --git a/drivers/video/omap/Kconfig b/drivers/video/omap/Kconfig
index 15e7f1912af9..196fa2e7f438 100644
--- a/drivers/video/omap/Kconfig
+++ b/drivers/video/omap/Kconfig
@@ -64,7 +64,7 @@ config FB_OMAP_MANUAL_UPDATE
64 depends on FB_OMAP && FB_OMAP_LCDC_EXTERNAL 64 depends on FB_OMAP && FB_OMAP_LCDC_EXTERNAL
65 help 65 help
66 Say Y here, if your user-space applications are capable of 66 Say Y here, if your user-space applications are capable of
67 notifying the frame buffer driver when a change has occured in 67 notifying the frame buffer driver when a change has occurred in
68 the frame buffer content and thus a reload of the image data to 68 the frame buffer content and thus a reload of the image data to
69 the external frame buffer is required. If unsure, say N. 69 the external frame buffer is required. If unsure, say N.
70 70
diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c
index 0d44f070ef36..a981def8099a 100644
--- a/drivers/video/omap2/dss/hdmi.c
+++ b/drivers/video/omap2/dss/hdmi.c
@@ -587,7 +587,7 @@ static void get_edid_timing_data(u8 *edid)
587 struct hdmi_cm cm; 587 struct hdmi_cm cm;
588 struct omap_video_timings edid_timings; 588 struct omap_video_timings edid_timings;
589 589
590 /* seach block 0, there are 4 DTDs arranged in priority order */ 590 /* search block 0, there are 4 DTDs arranged in priority order */
591 for (count = 0; count < EDID_SIZE_BLOCK0_TIMING_DESCRIPTOR; count++) { 591 for (count = 0; count < EDID_SIZE_BLOCK0_TIMING_DESCRIPTOR; count++) {
592 current_descriptor_addrs = 592 current_descriptor_addrs =
593 EDID_DESCRIPTOR_BLOCK0_ADDRESS + 593 EDID_DESCRIPTOR_BLOCK0_ADDRESS +
diff --git a/drivers/video/pxa3xx-gcu.c b/drivers/video/pxa3xx-gcu.c
index cf4beb9dc9bb..0283c7021090 100644
--- a/drivers/video/pxa3xx-gcu.c
+++ b/drivers/video/pxa3xx-gcu.c
@@ -25,7 +25,7 @@
25 25
26/* 26/*
27 * WARNING: This controller is attached to System Bus 2 of the PXA which 27 * WARNING: This controller is attached to System Bus 2 of the PXA which
28 * needs its arbiter to be enabled explictly (CKENB & 1<<9). 28 * needs its arbiter to be enabled explicitly (CKENB & 1<<9).
29 * There is currently no way to do this from Linux, so you need to teach 29 * There is currently no way to do this from Linux, so you need to teach
30 * your bootloader for now. 30 * your bootloader for now.
31 */ 31 */
diff --git a/drivers/video/pxafb.c b/drivers/video/pxafb.c
index 825b665245bb..a2e5b5100ab4 100644
--- a/drivers/video/pxafb.c
+++ b/drivers/video/pxafb.c
@@ -627,7 +627,12 @@ static void overlay1fb_enable(struct pxafb_layer *ofb)
627 627
628static void overlay1fb_disable(struct pxafb_layer *ofb) 628static void overlay1fb_disable(struct pxafb_layer *ofb)
629{ 629{
630 uint32_t lccr5 = lcd_readl(ofb->fbi, LCCR5); 630 uint32_t lccr5;
631
632 if (!(lcd_readl(ofb->fbi, OVL1C1) & OVLxC1_OEN))
633 return;
634
635 lccr5 = lcd_readl(ofb->fbi, LCCR5);
631 636
632 lcd_writel(ofb->fbi, OVL1C1, ofb->control[0] & ~OVLxC1_OEN); 637 lcd_writel(ofb->fbi, OVL1C1, ofb->control[0] & ~OVLxC1_OEN);
633 638
@@ -685,7 +690,12 @@ static void overlay2fb_enable(struct pxafb_layer *ofb)
685 690
686static void overlay2fb_disable(struct pxafb_layer *ofb) 691static void overlay2fb_disable(struct pxafb_layer *ofb)
687{ 692{
688 uint32_t lccr5 = lcd_readl(ofb->fbi, LCCR5); 693 uint32_t lccr5;
694
695 if (!(lcd_readl(ofb->fbi, OVL2C1) & OVLxC1_OEN))
696 return;
697
698 lccr5 = lcd_readl(ofb->fbi, LCCR5);
689 699
690 lcd_writel(ofb->fbi, OVL2C1, ofb->control[0] & ~OVLxC1_OEN); 700 lcd_writel(ofb->fbi, OVL2C1, ofb->control[0] & ~OVLxC1_OEN);
691 701
@@ -720,12 +730,10 @@ static int overlayfb_open(struct fb_info *info, int user)
720 if (user == 0) 730 if (user == 0)
721 return -ENODEV; 731 return -ENODEV;
722 732
723 /* allow only one user at a time */ 733 if (ofb->usage++ == 0)
724 if (atomic_inc_and_test(&ofb->usage)) 734 /* unblank the base framebuffer */
725 return -EBUSY; 735 fb_blank(&ofb->fbi->fb, FB_BLANK_UNBLANK);
726 736
727 /* unblank the base framebuffer */
728 fb_blank(&ofb->fbi->fb, FB_BLANK_UNBLANK);
729 return 0; 737 return 0;
730} 738}
731 739
@@ -733,12 +741,15 @@ static int overlayfb_release(struct fb_info *info, int user)
733{ 741{
734 struct pxafb_layer *ofb = (struct pxafb_layer*) info; 742 struct pxafb_layer *ofb = (struct pxafb_layer*) info;
735 743
736 atomic_dec(&ofb->usage); 744 if (ofb->usage == 1) {
737 ofb->ops->disable(ofb); 745 ofb->ops->disable(ofb);
746 ofb->fb.var.height = -1;
747 ofb->fb.var.width = -1;
748 ofb->fb.var.xres = ofb->fb.var.xres_virtual = 0;
749 ofb->fb.var.yres = ofb->fb.var.yres_virtual = 0;
738 750
739 free_pages_exact(ofb->video_mem, ofb->video_mem_size); 751 ofb->usage--;
740 ofb->video_mem = NULL; 752 }
741 ofb->video_mem_size = 0;
742 return 0; 753 return 0;
743} 754}
744 755
@@ -750,7 +761,7 @@ static int overlayfb_check_var(struct fb_var_screeninfo *var,
750 int xpos, ypos, pfor, bpp; 761 int xpos, ypos, pfor, bpp;
751 762
752 xpos = NONSTD_TO_XPOS(var->nonstd); 763 xpos = NONSTD_TO_XPOS(var->nonstd);
753 ypos = NONSTD_TO_XPOS(var->nonstd); 764 ypos = NONSTD_TO_YPOS(var->nonstd);
754 pfor = NONSTD_TO_PFOR(var->nonstd); 765 pfor = NONSTD_TO_PFOR(var->nonstd);
755 766
756 bpp = pxafb_var_to_bpp(var); 767 bpp = pxafb_var_to_bpp(var);
@@ -794,7 +805,7 @@ static int overlayfb_check_var(struct fb_var_screeninfo *var,
794 return 0; 805 return 0;
795} 806}
796 807
797static int overlayfb_map_video_memory(struct pxafb_layer *ofb) 808static int overlayfb_check_video_memory(struct pxafb_layer *ofb)
798{ 809{
799 struct fb_var_screeninfo *var = &ofb->fb.var; 810 struct fb_var_screeninfo *var = &ofb->fb.var;
800 int pfor = NONSTD_TO_PFOR(var->nonstd); 811 int pfor = NONSTD_TO_PFOR(var->nonstd);
@@ -812,27 +823,11 @@ static int overlayfb_map_video_memory(struct pxafb_layer *ofb)
812 823
813 size = PAGE_ALIGN(ofb->fb.fix.line_length * var->yres_virtual); 824 size = PAGE_ALIGN(ofb->fb.fix.line_length * var->yres_virtual);
814 825
815 /* don't re-allocate if the original video memory is enough */
816 if (ofb->video_mem) { 826 if (ofb->video_mem) {
817 if (ofb->video_mem_size >= size) 827 if (ofb->video_mem_size >= size)
818 return 0; 828 return 0;
819
820 free_pages_exact(ofb->video_mem, ofb->video_mem_size);
821 } 829 }
822 830 return -EINVAL;
823 ofb->video_mem = alloc_pages_exact(size, GFP_KERNEL | __GFP_ZERO);
824 if (ofb->video_mem == NULL)
825 return -ENOMEM;
826
827 ofb->video_mem_phys = virt_to_phys(ofb->video_mem);
828 ofb->video_mem_size = size;
829
830 mutex_lock(&ofb->fb.mm_lock);
831 ofb->fb.fix.smem_start = ofb->video_mem_phys;
832 ofb->fb.fix.smem_len = ofb->fb.fix.line_length * var->yres_virtual;
833 mutex_unlock(&ofb->fb.mm_lock);
834 ofb->fb.screen_base = ofb->video_mem;
835 return 0;
836} 831}
837 832
838static int overlayfb_set_par(struct fb_info *info) 833static int overlayfb_set_par(struct fb_info *info)
@@ -841,13 +836,13 @@ static int overlayfb_set_par(struct fb_info *info)
841 struct fb_var_screeninfo *var = &info->var; 836 struct fb_var_screeninfo *var = &info->var;
842 int xpos, ypos, pfor, bpp, ret; 837 int xpos, ypos, pfor, bpp, ret;
843 838
844 ret = overlayfb_map_video_memory(ofb); 839 ret = overlayfb_check_video_memory(ofb);
845 if (ret) 840 if (ret)
846 return ret; 841 return ret;
847 842
848 bpp = pxafb_var_to_bpp(var); 843 bpp = pxafb_var_to_bpp(var);
849 xpos = NONSTD_TO_XPOS(var->nonstd); 844 xpos = NONSTD_TO_XPOS(var->nonstd);
850 ypos = NONSTD_TO_XPOS(var->nonstd); 845 ypos = NONSTD_TO_YPOS(var->nonstd);
851 pfor = NONSTD_TO_PFOR(var->nonstd); 846 pfor = NONSTD_TO_PFOR(var->nonstd);
852 847
853 ofb->control[0] = OVLxC1_PPL(var->xres) | OVLxC1_LPO(var->yres) | 848 ofb->control[0] = OVLxC1_PPL(var->xres) | OVLxC1_LPO(var->yres) |
@@ -891,7 +886,7 @@ static void __devinit init_pxafb_overlay(struct pxafb_info *fbi,
891 886
892 ofb->id = id; 887 ofb->id = id;
893 ofb->ops = &ofb_ops[id]; 888 ofb->ops = &ofb_ops[id];
894 atomic_set(&ofb->usage, 0); 889 ofb->usage = 0;
895 ofb->fbi = fbi; 890 ofb->fbi = fbi;
896 init_completion(&ofb->branch_done); 891 init_completion(&ofb->branch_done);
897} 892}
@@ -904,29 +899,60 @@ static inline int pxafb_overlay_supported(void)
904 return 0; 899 return 0;
905} 900}
906 901
907static int __devinit pxafb_overlay_init(struct pxafb_info *fbi) 902static int __devinit pxafb_overlay_map_video_memory(struct pxafb_info *pxafb,
903 struct pxafb_layer *ofb)
904{
905 /* We assume that user will use at most video_mem_size for overlay fb,
906 * anyway, it's useless to use 16bpp main plane and 24bpp overlay
907 */
908 ofb->video_mem = alloc_pages_exact(PAGE_ALIGN(pxafb->video_mem_size),
909 GFP_KERNEL | __GFP_ZERO);
910 if (ofb->video_mem == NULL)
911 return -ENOMEM;
912
913 ofb->video_mem_phys = virt_to_phys(ofb->video_mem);
914 ofb->video_mem_size = PAGE_ALIGN(pxafb->video_mem_size);
915
916 mutex_lock(&ofb->fb.mm_lock);
917 ofb->fb.fix.smem_start = ofb->video_mem_phys;
918 ofb->fb.fix.smem_len = pxafb->video_mem_size;
919 mutex_unlock(&ofb->fb.mm_lock);
920
921 ofb->fb.screen_base = ofb->video_mem;
922
923 return 0;
924}
925
926static void __devinit pxafb_overlay_init(struct pxafb_info *fbi)
908{ 927{
909 int i, ret; 928 int i, ret;
910 929
911 if (!pxafb_overlay_supported()) 930 if (!pxafb_overlay_supported())
912 return 0; 931 return;
913 932
914 for (i = 0; i < 2; i++) { 933 for (i = 0; i < 2; i++) {
915 init_pxafb_overlay(fbi, &fbi->overlay[i], i); 934 struct pxafb_layer *ofb = &fbi->overlay[i];
916 ret = register_framebuffer(&fbi->overlay[i].fb); 935 init_pxafb_overlay(fbi, ofb, i);
936 ret = register_framebuffer(&ofb->fb);
917 if (ret) { 937 if (ret) {
918 dev_err(fbi->dev, "failed to register overlay %d\n", i); 938 dev_err(fbi->dev, "failed to register overlay %d\n", i);
919 return ret; 939 continue;
920 } 940 }
941 ret = pxafb_overlay_map_video_memory(fbi, ofb);
942 if (ret) {
943 dev_err(fbi->dev,
944 "failed to map video memory for overlay %d\n",
945 i);
946 unregister_framebuffer(&ofb->fb);
947 continue;
948 }
949 ofb->registered = 1;
921 } 950 }
922 951
923 /* mask all IU/BS/EOF/SOF interrupts */ 952 /* mask all IU/BS/EOF/SOF interrupts */
924 lcd_writel(fbi, LCCR5, ~0); 953 lcd_writel(fbi, LCCR5, ~0);
925 954
926 /* place overlay(s) on top of base */
927 fbi->lccr0 |= LCCR0_OUC;
928 pr_info("PXA Overlay driver loaded successfully!\n"); 955 pr_info("PXA Overlay driver loaded successfully!\n");
929 return 0;
930} 956}
931 957
932static void __devexit pxafb_overlay_exit(struct pxafb_info *fbi) 958static void __devexit pxafb_overlay_exit(struct pxafb_info *fbi)
@@ -936,8 +962,15 @@ static void __devexit pxafb_overlay_exit(struct pxafb_info *fbi)
936 if (!pxafb_overlay_supported()) 962 if (!pxafb_overlay_supported())
937 return; 963 return;
938 964
939 for (i = 0; i < 2; i++) 965 for (i = 0; i < 2; i++) {
940 unregister_framebuffer(&fbi->overlay[i].fb); 966 struct pxafb_layer *ofb = &fbi->overlay[i];
967 if (ofb->registered) {
968 if (ofb->video_mem)
969 free_pages_exact(ofb->video_mem,
970 ofb->video_mem_size);
971 unregister_framebuffer(&ofb->fb);
972 }
973 }
941} 974}
942#else 975#else
943static inline void pxafb_overlay_init(struct pxafb_info *fbi) {} 976static inline void pxafb_overlay_init(struct pxafb_info *fbi) {}
@@ -1368,7 +1401,8 @@ static int pxafb_activate_var(struct fb_var_screeninfo *var,
1368 (lcd_readl(fbi, LCCR3) != fbi->reg_lccr3) || 1401 (lcd_readl(fbi, LCCR3) != fbi->reg_lccr3) ||
1369 (lcd_readl(fbi, LCCR4) != fbi->reg_lccr4) || 1402 (lcd_readl(fbi, LCCR4) != fbi->reg_lccr4) ||
1370 (lcd_readl(fbi, FDADR0) != fbi->fdadr[0]) || 1403 (lcd_readl(fbi, FDADR0) != fbi->fdadr[0]) ||
1371 (lcd_readl(fbi, FDADR1) != fbi->fdadr[1])) 1404 ((fbi->lccr0 & LCCR0_SDS) &&
1405 (lcd_readl(fbi, FDADR1) != fbi->fdadr[1])))
1372 pxafb_schedule_work(fbi, C_REENABLE); 1406 pxafb_schedule_work(fbi, C_REENABLE);
1373 1407
1374 return 0; 1408 return 0;
@@ -1420,7 +1454,8 @@ static void pxafb_enable_controller(struct pxafb_info *fbi)
1420 lcd_writel(fbi, LCCR0, fbi->reg_lccr0 & ~LCCR0_ENB); 1454 lcd_writel(fbi, LCCR0, fbi->reg_lccr0 & ~LCCR0_ENB);
1421 1455
1422 lcd_writel(fbi, FDADR0, fbi->fdadr[0]); 1456 lcd_writel(fbi, FDADR0, fbi->fdadr[0]);
1423 lcd_writel(fbi, FDADR1, fbi->fdadr[1]); 1457 if (fbi->lccr0 & LCCR0_SDS)
1458 lcd_writel(fbi, FDADR1, fbi->fdadr[1]);
1424 lcd_writel(fbi, LCCR0, fbi->reg_lccr0 | LCCR0_ENB); 1459 lcd_writel(fbi, LCCR0, fbi->reg_lccr0 | LCCR0_ENB);
1425} 1460}
1426 1461
@@ -1613,7 +1648,8 @@ pxafb_freq_transition(struct notifier_block *nb, unsigned long val, void *data)
1613 1648
1614 switch (val) { 1649 switch (val) {
1615 case CPUFREQ_PRECHANGE: 1650 case CPUFREQ_PRECHANGE:
1616 set_ctrlr_state(fbi, C_DISABLE_CLKCHANGE); 1651 if (!fbi->overlay[0].usage && !fbi->overlay[1].usage)
1652 set_ctrlr_state(fbi, C_DISABLE_CLKCHANGE);
1617 break; 1653 break;
1618 1654
1619 case CPUFREQ_POSTCHANGE: 1655 case CPUFREQ_POSTCHANGE:
@@ -1806,6 +1842,12 @@ static struct pxafb_info * __devinit pxafb_init_fbinfo(struct device *dev)
1806 1842
1807 pxafb_decode_mach_info(fbi, inf); 1843 pxafb_decode_mach_info(fbi, inf);
1808 1844
1845#ifdef CONFIG_FB_PXA_OVERLAY
1846 /* place overlay(s) on top of base */
1847 if (pxafb_overlay_supported())
1848 fbi->lccr0 |= LCCR0_OUC;
1849#endif
1850
1809 init_waitqueue_head(&fbi->ctrlr_wait); 1851 init_waitqueue_head(&fbi->ctrlr_wait);
1810 INIT_WORK(&fbi->task, pxafb_task); 1852 INIT_WORK(&fbi->task, pxafb_task);
1811 mutex_init(&fbi->ctrlr_lock); 1853 mutex_init(&fbi->ctrlr_lock);
diff --git a/drivers/video/pxafb.h b/drivers/video/pxafb.h
index 2353521c5c8c..26ba9fa3f737 100644
--- a/drivers/video/pxafb.h
+++ b/drivers/video/pxafb.h
@@ -92,7 +92,8 @@ struct pxafb_layer_ops {
92struct pxafb_layer { 92struct pxafb_layer {
93 struct fb_info fb; 93 struct fb_info fb;
94 int id; 94 int id;
95 atomic_t usage; 95 int registered;
96 uint32_t usage;
96 uint32_t control[2]; 97 uint32_t control[2];
97 98
98 struct pxafb_layer_ops *ops; 99 struct pxafb_layer_ops *ops;
diff --git a/drivers/video/s3c-fb.c b/drivers/video/s3c-fb.c
index 6817d187d46e..3b6cdcac8f1a 100644
--- a/drivers/video/s3c-fb.c
+++ b/drivers/video/s3c-fb.c
@@ -48,7 +48,7 @@
48#undef writel 48#undef writel
49#define writel(v, r) do { \ 49#define writel(v, r) do { \
50 printk(KERN_DEBUG "%s: %08x => %p\n", __func__, (unsigned int)v, r); \ 50 printk(KERN_DEBUG "%s: %08x => %p\n", __func__, (unsigned int)v, r); \
51 __raw_writel(v, r); } while(0) 51 __raw_writel(v, r); } while (0)
52#endif /* FB_S3C_DEBUG_REGWRITE */ 52#endif /* FB_S3C_DEBUG_REGWRITE */
53 53
54/* irq_flags bits */ 54/* irq_flags bits */
@@ -518,7 +518,7 @@ static int s3c_fb_set_par(struct fb_info *info)
518 518
519 data = VIDTCON2_LINEVAL(var->yres - 1) | 519 data = VIDTCON2_LINEVAL(var->yres - 1) |
520 VIDTCON2_HOZVAL(var->xres - 1); 520 VIDTCON2_HOZVAL(var->xres - 1);
521 writel(data, regs +sfb->variant.vidtcon + 8 ); 521 writel(data, regs + sfb->variant.vidtcon + 8);
522 } 522 }
523 523
524 /* write the buffer address */ 524 /* write the buffer address */
@@ -1304,6 +1304,7 @@ static void s3c_fb_clear_win(struct s3c_fb *sfb, int win)
1304 1304
1305static int __devinit s3c_fb_probe(struct platform_device *pdev) 1305static int __devinit s3c_fb_probe(struct platform_device *pdev)
1306{ 1306{
1307 const struct platform_device_id *platid;
1307 struct s3c_fb_driverdata *fbdrv; 1308 struct s3c_fb_driverdata *fbdrv;
1308 struct device *dev = &pdev->dev; 1309 struct device *dev = &pdev->dev;
1309 struct s3c_fb_platdata *pd; 1310 struct s3c_fb_platdata *pd;
@@ -1312,7 +1313,8 @@ static int __devinit s3c_fb_probe(struct platform_device *pdev)
1312 int win; 1313 int win;
1313 int ret = 0; 1314 int ret = 0;
1314 1315
1315 fbdrv = (struct s3c_fb_driverdata *)platform_get_device_id(pdev)->driver_data; 1316 platid = platform_get_device_id(pdev);
1317 fbdrv = (struct s3c_fb_driverdata *)platid->driver_data;
1316 1318
1317 if (fbdrv->variant.nr_windows > S3C_FB_MAX_WIN) { 1319 if (fbdrv->variant.nr_windows > S3C_FB_MAX_WIN) {
1318 dev_err(dev, "too many windows, cannot attach\n"); 1320 dev_err(dev, "too many windows, cannot attach\n");
diff --git a/drivers/video/s3fb.c b/drivers/video/s3fb.c
index ddedad9cd069..c4482f2e5799 100644
--- a/drivers/video/s3fb.c
+++ b/drivers/video/s3fb.c
@@ -71,9 +71,9 @@ static const int s3_memsizes[] = {4096, 0, 3072, 8192, 2048, 6144, 1024, 512};
71 71
72static const char * const s3_names[] = {"S3 Unknown", "S3 Trio32", "S3 Trio64", "S3 Trio64V+", 72static const char * const s3_names[] = {"S3 Unknown", "S3 Trio32", "S3 Trio64", "S3 Trio64V+",
73 "S3 Trio64UV+", "S3 Trio64V2/DX", "S3 Trio64V2/GX", 73 "S3 Trio64UV+", "S3 Trio64V2/DX", "S3 Trio64V2/GX",
74 "S3 Plato/PX", "S3 Aurora64VP", "S3 Virge", 74 "S3 Plato/PX", "S3 Aurora64V+", "S3 Virge",
75 "S3 Virge/VX", "S3 Virge/DX", "S3 Virge/GX", 75 "S3 Virge/VX", "S3 Virge/DX", "S3 Virge/GX",
76 "S3 Virge/GX2", "S3 Virge/GX2P", "S3 Virge/GX2P", 76 "S3 Virge/GX2", "S3 Virge/GX2+", "",
77 "S3 Trio3D/1X", "S3 Trio3D/2X", "S3 Trio3D/2X", 77 "S3 Trio3D/1X", "S3 Trio3D/2X", "S3 Trio3D/2X",
78 "S3 Trio3D"}; 78 "S3 Trio3D"};
79 79
@@ -90,9 +90,8 @@ static const char * const s3_names[] = {"S3 Unknown", "S3 Trio32", "S3 Trio64",
90#define CHIP_988_VIRGE_VX 0x0A 90#define CHIP_988_VIRGE_VX 0x0A
91#define CHIP_375_VIRGE_DX 0x0B 91#define CHIP_375_VIRGE_DX 0x0B
92#define CHIP_385_VIRGE_GX 0x0C 92#define CHIP_385_VIRGE_GX 0x0C
93#define CHIP_356_VIRGE_GX2 0x0D 93#define CHIP_357_VIRGE_GX2 0x0D
94#define CHIP_357_VIRGE_GX2P 0x0E 94#define CHIP_359_VIRGE_GX2P 0x0E
95#define CHIP_359_VIRGE_GX2P 0x0F
96#define CHIP_360_TRIO3D_1X 0x10 95#define CHIP_360_TRIO3D_1X 0x10
97#define CHIP_362_TRIO3D_2X 0x11 96#define CHIP_362_TRIO3D_2X 0x11
98#define CHIP_368_TRIO3D_2X 0x12 97#define CHIP_368_TRIO3D_2X 0x12
@@ -359,7 +358,9 @@ static void s3_set_pixclock(struct fb_info *info, u32 pixclock)
359 vga_w(par->state.vgabase, VGA_MIS_W, regval | VGA_MIS_ENB_PLL_LOAD); 358 vga_w(par->state.vgabase, VGA_MIS_W, regval | VGA_MIS_ENB_PLL_LOAD);
360 359
361 /* Set S3 clock registers */ 360 /* Set S3 clock registers */
362 if (par->chip == CHIP_360_TRIO3D_1X || 361 if (par->chip == CHIP_357_VIRGE_GX2 ||
362 par->chip == CHIP_359_VIRGE_GX2P ||
363 par->chip == CHIP_360_TRIO3D_1X ||
363 par->chip == CHIP_362_TRIO3D_2X || 364 par->chip == CHIP_362_TRIO3D_2X ||
364 par->chip == CHIP_368_TRIO3D_2X) { 365 par->chip == CHIP_368_TRIO3D_2X) {
365 vga_wseq(par->state.vgabase, 0x12, (n - 2) | ((r & 3) << 6)); /* n and two bits of r */ 366 vga_wseq(par->state.vgabase, 0x12, (n - 2) | ((r & 3) << 6)); /* n and two bits of r */
@@ -560,7 +561,9 @@ static int s3fb_set_par(struct fb_info *info)
560 pr_debug("fb%d: offset register : %d\n", info->node, offset_value); 561 pr_debug("fb%d: offset register : %d\n", info->node, offset_value);
561 svga_wcrt_multi(par->state.vgabase, s3_offset_regs, offset_value); 562 svga_wcrt_multi(par->state.vgabase, s3_offset_regs, offset_value);
562 563
563 if (par->chip != CHIP_360_TRIO3D_1X && 564 if (par->chip != CHIP_357_VIRGE_GX2 &&
565 par->chip != CHIP_359_VIRGE_GX2P &&
566 par->chip != CHIP_360_TRIO3D_1X &&
564 par->chip != CHIP_362_TRIO3D_2X && 567 par->chip != CHIP_362_TRIO3D_2X &&
565 par->chip != CHIP_368_TRIO3D_2X) { 568 par->chip != CHIP_368_TRIO3D_2X) {
566 vga_wcrt(par->state.vgabase, 0x54, 0x18); /* M parameter */ 569 vga_wcrt(par->state.vgabase, 0x54, 0x18); /* M parameter */
@@ -604,7 +607,9 @@ static int s3fb_set_par(struct fb_info *info)
604 vga_wcrt(par->state.vgabase, 0x66, 0x90); 607 vga_wcrt(par->state.vgabase, 0x66, 0x90);
605 } 608 }
606 609
607 if (par->chip == CHIP_360_TRIO3D_1X || 610 if (par->chip == CHIP_357_VIRGE_GX2 ||
611 par->chip == CHIP_359_VIRGE_GX2P ||
612 par->chip == CHIP_360_TRIO3D_1X ||
608 par->chip == CHIP_362_TRIO3D_2X || 613 par->chip == CHIP_362_TRIO3D_2X ||
609 par->chip == CHIP_368_TRIO3D_2X || 614 par->chip == CHIP_368_TRIO3D_2X ||
610 par->chip == CHIP_365_TRIO3D || 615 par->chip == CHIP_365_TRIO3D ||
@@ -617,8 +622,7 @@ static int s3fb_set_par(struct fb_info *info)
617 vga_wcrt(par->state.vgabase, 0x66, 0x81); 622 vga_wcrt(par->state.vgabase, 0x66, 0x81);
618 } 623 }
619 624
620 if (par->chip == CHIP_356_VIRGE_GX2 || 625 if (par->chip == CHIP_357_VIRGE_GX2 ||
621 par->chip == CHIP_357_VIRGE_GX2P ||
622 par->chip == CHIP_359_VIRGE_GX2P || 626 par->chip == CHIP_359_VIRGE_GX2P ||
623 par->chip == CHIP_360_TRIO3D_1X || 627 par->chip == CHIP_360_TRIO3D_1X ||
624 par->chip == CHIP_362_TRIO3D_2X || 628 par->chip == CHIP_362_TRIO3D_2X ||
@@ -674,6 +678,8 @@ static int s3fb_set_par(struct fb_info *info)
674 pr_debug("fb%d: 8 bit pseudocolor\n", info->node); 678 pr_debug("fb%d: 8 bit pseudocolor\n", info->node);
675 svga_wcrt_mask(par->state.vgabase, 0x50, 0x00, 0x30); 679 svga_wcrt_mask(par->state.vgabase, 0x50, 0x00, 0x30);
676 if (info->var.pixclock > 20000 || 680 if (info->var.pixclock > 20000 ||
681 par->chip == CHIP_357_VIRGE_GX2 ||
682 par->chip == CHIP_359_VIRGE_GX2P ||
677 par->chip == CHIP_360_TRIO3D_1X || 683 par->chip == CHIP_360_TRIO3D_1X ||
678 par->chip == CHIP_362_TRIO3D_2X || 684 par->chip == CHIP_362_TRIO3D_2X ||
679 par->chip == CHIP_368_TRIO3D_2X) 685 par->chip == CHIP_368_TRIO3D_2X)
@@ -702,7 +708,9 @@ static int s3fb_set_par(struct fb_info *info)
702 } else { 708 } else {
703 svga_wcrt_mask(par->state.vgabase, 0x50, 0x10, 0x30); 709 svga_wcrt_mask(par->state.vgabase, 0x50, 0x10, 0x30);
704 svga_wcrt_mask(par->state.vgabase, 0x67, 0x30, 0xF0); 710 svga_wcrt_mask(par->state.vgabase, 0x67, 0x30, 0xF0);
705 if (par->chip != CHIP_360_TRIO3D_1X && 711 if (par->chip != CHIP_357_VIRGE_GX2 &&
712 par->chip != CHIP_359_VIRGE_GX2P &&
713 par->chip != CHIP_360_TRIO3D_1X &&
706 par->chip != CHIP_362_TRIO3D_2X && 714 par->chip != CHIP_362_TRIO3D_2X &&
707 par->chip != CHIP_368_TRIO3D_2X) 715 par->chip != CHIP_368_TRIO3D_2X)
708 hmul = 2; 716 hmul = 2;
@@ -727,7 +735,9 @@ static int s3fb_set_par(struct fb_info *info)
727 } else { 735 } else {
728 svga_wcrt_mask(par->state.vgabase, 0x50, 0x10, 0x30); 736 svga_wcrt_mask(par->state.vgabase, 0x50, 0x10, 0x30);
729 svga_wcrt_mask(par->state.vgabase, 0x67, 0x50, 0xF0); 737 svga_wcrt_mask(par->state.vgabase, 0x67, 0x50, 0xF0);
730 if (par->chip != CHIP_360_TRIO3D_1X && 738 if (par->chip != CHIP_357_VIRGE_GX2 &&
739 par->chip != CHIP_359_VIRGE_GX2P &&
740 par->chip != CHIP_360_TRIO3D_1X &&
731 par->chip != CHIP_362_TRIO3D_2X && 741 par->chip != CHIP_362_TRIO3D_2X &&
732 par->chip != CHIP_368_TRIO3D_2X) 742 par->chip != CHIP_368_TRIO3D_2X)
733 hmul = 2; 743 hmul = 2;
@@ -1069,6 +1079,16 @@ static int __devinit s3_pci_probe(struct pci_dev *dev, const struct pci_device_i
1069 info->screen_size = 2 << 20; 1079 info->screen_size = 2 << 20;
1070 break; 1080 break;
1071 } 1081 }
1082 } else if (par->chip == CHIP_357_VIRGE_GX2 ||
1083 par->chip == CHIP_359_VIRGE_GX2P) {
1084 switch ((regval & 0xC0) >> 6) {
1085 case 1: /* 4MB */
1086 info->screen_size = 4 << 20;
1087 break;
1088 case 3: /* 2MB */
1089 info->screen_size = 2 << 20;
1090 break;
1091 }
1072 } else 1092 } else
1073 info->screen_size = s3_memsizes[regval >> 5] << 10; 1093 info->screen_size = s3_memsizes[regval >> 5] << 10;
1074 info->fix.smem_len = info->screen_size; 1094 info->fix.smem_len = info->screen_size;
@@ -1268,8 +1288,8 @@ static struct pci_device_id s3_devices[] __devinitdata = {
1268 {PCI_DEVICE(PCI_VENDOR_ID_S3, 0x5631), .driver_data = CHIP_325_VIRGE}, 1288 {PCI_DEVICE(PCI_VENDOR_ID_S3, 0x5631), .driver_data = CHIP_325_VIRGE},
1269 {PCI_DEVICE(PCI_VENDOR_ID_S3, 0x883D), .driver_data = CHIP_988_VIRGE_VX}, 1289 {PCI_DEVICE(PCI_VENDOR_ID_S3, 0x883D), .driver_data = CHIP_988_VIRGE_VX},
1270 {PCI_DEVICE(PCI_VENDOR_ID_S3, 0x8A01), .driver_data = CHIP_XXX_VIRGE_DXGX}, 1290 {PCI_DEVICE(PCI_VENDOR_ID_S3, 0x8A01), .driver_data = CHIP_XXX_VIRGE_DXGX},
1271 {PCI_DEVICE(PCI_VENDOR_ID_S3, 0x8A10), .driver_data = CHIP_356_VIRGE_GX2}, 1291 {PCI_DEVICE(PCI_VENDOR_ID_S3, 0x8A10), .driver_data = CHIP_357_VIRGE_GX2},
1272 {PCI_DEVICE(PCI_VENDOR_ID_S3, 0x8A11), .driver_data = CHIP_357_VIRGE_GX2P}, 1292 {PCI_DEVICE(PCI_VENDOR_ID_S3, 0x8A11), .driver_data = CHIP_359_VIRGE_GX2P},
1273 {PCI_DEVICE(PCI_VENDOR_ID_S3, 0x8A12), .driver_data = CHIP_359_VIRGE_GX2P}, 1293 {PCI_DEVICE(PCI_VENDOR_ID_S3, 0x8A12), .driver_data = CHIP_359_VIRGE_GX2P},
1274 {PCI_DEVICE(PCI_VENDOR_ID_S3, 0x8A13), .driver_data = CHIP_36X_TRIO3D_1X_2X}, 1294 {PCI_DEVICE(PCI_VENDOR_ID_S3, 0x8A13), .driver_data = CHIP_36X_TRIO3D_1X_2X},
1275 {PCI_DEVICE(PCI_VENDOR_ID_S3, 0x8904), .driver_data = CHIP_365_TRIO3D}, 1295 {PCI_DEVICE(PCI_VENDOR_ID_S3, 0x8904), .driver_data = CHIP_365_TRIO3D},
diff --git a/drivers/video/savage/savagefb-i2c.c b/drivers/video/savage/savagefb-i2c.c
index b16e6138fdd4..bb71fea07284 100644
--- a/drivers/video/savage/savagefb-i2c.c
+++ b/drivers/video/savage/savagefb-i2c.c
@@ -159,8 +159,7 @@ static int savage_setup_i2c_bus(struct savagefb_i2c_chan *chan,
159 else 159 else
160 dev_warn(&chan->par->pcidev->dev, 160 dev_warn(&chan->par->pcidev->dev,
161 "Failed to register I2C bus %s.\n", name); 161 "Failed to register I2C bus %s.\n", name);
162 } else 162 }
163 chan->par = NULL;
164 163
165 return rc; 164 return rc;
166} 165}
@@ -170,9 +169,8 @@ void savagefb_create_i2c_busses(struct fb_info *info)
170 struct savagefb_par *par = info->par; 169 struct savagefb_par *par = info->par;
171 par->chan.par = par; 170 par->chan.par = par;
172 171
173 switch(info->fix.accel) { 172 switch (par->chip) {
174 case FB_ACCEL_PROSAVAGE_DDRK: 173 case S3_PROSAVAGE:
175 case FB_ACCEL_PROSAVAGE_PM:
176 par->chan.reg = CR_SERIAL2; 174 par->chan.reg = CR_SERIAL2;
177 par->chan.ioaddr = par->mmio.vbase; 175 par->chan.ioaddr = par->mmio.vbase;
178 par->chan.algo.setsda = prosavage_gpio_setsda; 176 par->chan.algo.setsda = prosavage_gpio_setsda;
@@ -180,7 +178,7 @@ void savagefb_create_i2c_busses(struct fb_info *info)
180 par->chan.algo.getsda = prosavage_gpio_getsda; 178 par->chan.algo.getsda = prosavage_gpio_getsda;
181 par->chan.algo.getscl = prosavage_gpio_getscl; 179 par->chan.algo.getscl = prosavage_gpio_getscl;
182 break; 180 break;
183 case FB_ACCEL_SAVAGE4: 181 case S3_SAVAGE4:
184 par->chan.reg = CR_SERIAL1; 182 par->chan.reg = CR_SERIAL1;
185 if (par->pcidev->revision > 1 && !(VGArCR(0xa6, par) & 0x40)) 183 if (par->pcidev->revision > 1 && !(VGArCR(0xa6, par) & 0x40))
186 par->chan.reg = CR_SERIAL2; 184 par->chan.reg = CR_SERIAL2;
@@ -190,8 +188,8 @@ void savagefb_create_i2c_busses(struct fb_info *info)
190 par->chan.algo.getsda = prosavage_gpio_getsda; 188 par->chan.algo.getsda = prosavage_gpio_getsda;
191 par->chan.algo.getscl = prosavage_gpio_getscl; 189 par->chan.algo.getscl = prosavage_gpio_getscl;
192 break; 190 break;
193 case FB_ACCEL_SAVAGE2000: 191 case S3_SAVAGE2000:
194 par->chan.reg = 0xff20; 192 par->chan.reg = MM_SERIAL1;
195 par->chan.ioaddr = par->mmio.vbase; 193 par->chan.ioaddr = par->mmio.vbase;
196 par->chan.algo.setsda = savage4_gpio_setsda; 194 par->chan.algo.setsda = savage4_gpio_setsda;
197 par->chan.algo.setscl = savage4_gpio_setscl; 195 par->chan.algo.setscl = savage4_gpio_setscl;
diff --git a/drivers/video/savage/savagefb.h b/drivers/video/savage/savagefb.h
index e4c3f214eb8e..4e9490c19d7d 100644
--- a/drivers/video/savage/savagefb.h
+++ b/drivers/video/savage/savagefb.h
@@ -153,7 +153,7 @@ struct savage_reg {
153 unsigned char CRTC[25]; /* Crtc Controller */ 153 unsigned char CRTC[25]; /* Crtc Controller */
154 unsigned char Sequencer[5]; /* Video Sequencer */ 154 unsigned char Sequencer[5]; /* Video Sequencer */
155 unsigned char Graphics[9]; /* Video Graphics */ 155 unsigned char Graphics[9]; /* Video Graphics */
156 unsigned char Attribute[21]; /* Video Atribute */ 156 unsigned char Attribute[21]; /* Video Attribute */
157 157
158 unsigned int mode, refresh; 158 unsigned int mode, refresh;
159 unsigned char SR08, SR0E, SR0F; 159 unsigned char SR08, SR0E, SR0F;
diff --git a/drivers/video/savage/savagefb_driver.c b/drivers/video/savage/savagefb_driver.c
index 487911e2926c..a2dc1a7ec758 100644
--- a/drivers/video/savage/savagefb_driver.c
+++ b/drivers/video/savage/savagefb_driver.c
@@ -385,7 +385,7 @@ SavageSetup2DEngine(struct savagefb_par *par)
385 BCI_SEND(GlobalBitmapDescriptor); 385 BCI_SEND(GlobalBitmapDescriptor);
386 386
387 /* 387 /*
388 * I don't know why, sending this twice fixes the intial black screen, 388 * I don't know why, sending this twice fixes the initial black screen,
389 * prevents X from crashing at least in Toshiba laptops with SavageIX. 389 * prevents X from crashing at least in Toshiba laptops with SavageIX.
390 * --Tony 390 * --Tony
391 */ 391 */
@@ -2211,7 +2211,7 @@ static int __devinit savagefb_probe(struct pci_dev* dev,
2211 goto failed_mmio; 2211 goto failed_mmio;
2212 2212
2213 video_len = savage_init_hw(par); 2213 video_len = savage_init_hw(par);
2214 /* FIXME: cant be negative */ 2214 /* FIXME: can't be negative */
2215 if (video_len < 0) { 2215 if (video_len < 0) {
2216 err = video_len; 2216 err = video_len;
2217 goto failed_mmio; 2217 goto failed_mmio;
diff --git a/drivers/video/sh_mobile_lcdcfb.c b/drivers/video/sh_mobile_lcdcfb.c
index 757665bc500f..9bcc61b4ef14 100644
--- a/drivers/video/sh_mobile_lcdcfb.c
+++ b/drivers/video/sh_mobile_lcdcfb.c
@@ -643,7 +643,7 @@ static int sh_mobile_lcdc_start(struct sh_mobile_lcdc_priv *priv)
643 continue; 643 continue;
644 644
645 board_cfg = &ch->cfg.board_cfg; 645 board_cfg = &ch->cfg.board_cfg;
646 if (try_module_get(board_cfg->owner) && board_cfg->display_on) { 646 if (board_cfg->display_on && try_module_get(board_cfg->owner)) {
647 board_cfg->display_on(board_cfg->board_data, ch->info); 647 board_cfg->display_on(board_cfg->board_data, ch->info);
648 module_put(board_cfg->owner); 648 module_put(board_cfg->owner);
649 } 649 }
@@ -688,7 +688,7 @@ static void sh_mobile_lcdc_stop(struct sh_mobile_lcdc_priv *priv)
688 } 688 }
689 689
690 board_cfg = &ch->cfg.board_cfg; 690 board_cfg = &ch->cfg.board_cfg;
691 if (try_module_get(board_cfg->owner) && board_cfg->display_off) { 691 if (board_cfg->display_off && try_module_get(board_cfg->owner)) {
692 board_cfg->display_off(board_cfg->board_data); 692 board_cfg->display_off(board_cfg->board_data);
693 module_put(board_cfg->owner); 693 module_put(board_cfg->owner);
694 } 694 }
@@ -1032,6 +1032,49 @@ static int sh_mobile_check_var(struct fb_var_screeninfo *var, struct fb_info *in
1032 return 0; 1032 return 0;
1033} 1033}
1034 1034
1035/*
1036 * Screen blanking. Behavior is as follows:
1037 * FB_BLANK_UNBLANK: screen unblanked, clocks enabled
1038 * FB_BLANK_NORMAL: screen blanked, clocks enabled
1039 * FB_BLANK_VSYNC,
1040 * FB_BLANK_HSYNC,
1041 * FB_BLANK_POWEROFF: screen blanked, clocks disabled
1042 */
1043static int sh_mobile_lcdc_blank(int blank, struct fb_info *info)
1044{
1045 struct sh_mobile_lcdc_chan *ch = info->par;
1046 struct sh_mobile_lcdc_priv *p = ch->lcdc;
1047
1048 /* blank the screen? */
1049 if (blank > FB_BLANK_UNBLANK && ch->blank_status == FB_BLANK_UNBLANK) {
1050 struct fb_fillrect rect = {
1051 .width = info->var.xres,
1052 .height = info->var.yres,
1053 };
1054 sh_mobile_lcdc_fillrect(info, &rect);
1055 }
1056 /* turn clocks on? */
1057 if (blank <= FB_BLANK_NORMAL && ch->blank_status > FB_BLANK_NORMAL) {
1058 sh_mobile_lcdc_clk_on(p);
1059 }
1060 /* turn clocks off? */
1061 if (blank > FB_BLANK_NORMAL && ch->blank_status <= FB_BLANK_NORMAL) {
1062 /* make sure the screen is updated with the black fill before
1063 * switching the clocks off. one vsync is not enough since
1064 * blanking may occur in the middle of a refresh. deferred io
1065 * mode will reenable the clocks and update the screen in time,
1066 * so it does not need this. */
1067 if (!info->fbdefio) {
1068 sh_mobile_wait_for_vsync(info);
1069 sh_mobile_wait_for_vsync(info);
1070 }
1071 sh_mobile_lcdc_clk_off(p);
1072 }
1073
1074 ch->blank_status = blank;
1075 return 0;
1076}
1077
1035static struct fb_ops sh_mobile_lcdc_ops = { 1078static struct fb_ops sh_mobile_lcdc_ops = {
1036 .owner = THIS_MODULE, 1079 .owner = THIS_MODULE,
1037 .fb_setcolreg = sh_mobile_lcdc_setcolreg, 1080 .fb_setcolreg = sh_mobile_lcdc_setcolreg,
@@ -1040,6 +1083,7 @@ static struct fb_ops sh_mobile_lcdc_ops = {
1040 .fb_fillrect = sh_mobile_lcdc_fillrect, 1083 .fb_fillrect = sh_mobile_lcdc_fillrect,
1041 .fb_copyarea = sh_mobile_lcdc_copyarea, 1084 .fb_copyarea = sh_mobile_lcdc_copyarea,
1042 .fb_imageblit = sh_mobile_lcdc_imageblit, 1085 .fb_imageblit = sh_mobile_lcdc_imageblit,
1086 .fb_blank = sh_mobile_lcdc_blank,
1043 .fb_pan_display = sh_mobile_fb_pan_display, 1087 .fb_pan_display = sh_mobile_fb_pan_display,
1044 .fb_ioctl = sh_mobile_ioctl, 1088 .fb_ioctl = sh_mobile_ioctl,
1045 .fb_open = sh_mobile_open, 1089 .fb_open = sh_mobile_open,
@@ -1254,7 +1298,7 @@ static int sh_mobile_lcdc_notify(struct notifier_block *nb,
1254 1298
1255 switch(action) { 1299 switch(action) {
1256 case FB_EVENT_SUSPEND: 1300 case FB_EVENT_SUSPEND:
1257 if (try_module_get(board_cfg->owner) && board_cfg->display_off) { 1301 if (board_cfg->display_off && try_module_get(board_cfg->owner)) {
1258 board_cfg->display_off(board_cfg->board_data); 1302 board_cfg->display_off(board_cfg->board_data);
1259 module_put(board_cfg->owner); 1303 module_put(board_cfg->owner);
1260 } 1304 }
@@ -1267,7 +1311,7 @@ static int sh_mobile_lcdc_notify(struct notifier_block *nb,
1267 mutex_unlock(&ch->open_lock); 1311 mutex_unlock(&ch->open_lock);
1268 1312
1269 /* HDMI must be enabled before LCDC configuration */ 1313 /* HDMI must be enabled before LCDC configuration */
1270 if (try_module_get(board_cfg->owner) && board_cfg->display_on) { 1314 if (board_cfg->display_on && try_module_get(board_cfg->owner)) {
1271 board_cfg->display_on(board_cfg->board_data, info); 1315 board_cfg->display_on(board_cfg->board_data, info);
1272 module_put(board_cfg->owner); 1316 module_put(board_cfg->owner);
1273 } 1317 }
diff --git a/drivers/video/sh_mobile_lcdcfb.h b/drivers/video/sh_mobile_lcdcfb.h
index 4635eed63eee..f16cb5645a13 100644
--- a/drivers/video/sh_mobile_lcdcfb.h
+++ b/drivers/video/sh_mobile_lcdcfb.h
@@ -37,6 +37,7 @@ struct sh_mobile_lcdc_chan {
37 struct completion vsync_completion; 37 struct completion vsync_completion;
38 struct fb_var_screeninfo display_var; 38 struct fb_var_screeninfo display_var;
39 int use_count; 39 int use_count;
40 int blank_status;
40 struct mutex open_lock; /* protects the use counter */ 41 struct mutex open_lock; /* protects the use counter */
41}; 42};
42 43
diff --git a/drivers/video/sm501fb.c b/drivers/video/sm501fb.c
index 46d1a64fe80d..56ef6b3a9851 100644
--- a/drivers/video/sm501fb.c
+++ b/drivers/video/sm501fb.c
@@ -265,7 +265,7 @@ static unsigned long sm501fb_ps_to_hz(unsigned long psvalue)
265 return (unsigned long)numerator; 265 return (unsigned long)numerator;
266} 266}
267 267
268/* sm501fb_hz_to_ps is identical to the oposite transform */ 268/* sm501fb_hz_to_ps is identical to the opposite transform */
269 269
270#define sm501fb_hz_to_ps(x) sm501fb_ps_to_hz(x) 270#define sm501fb_hz_to_ps(x) sm501fb_ps_to_hz(x)
271 271
@@ -1719,7 +1719,7 @@ static int sm501fb_init_fb(struct fb_info *fb,
1719 (head == HEAD_CRT) ? &sm501fb_ops_crt : &sm501fb_ops_pnl, 1719 (head == HEAD_CRT) ? &sm501fb_ops_crt : &sm501fb_ops_pnl,
1720 sizeof(struct fb_ops)); 1720 sizeof(struct fb_ops));
1721 1721
1722 /* update ops dependant on what we've been passed */ 1722 /* update ops dependent on what we've been passed */
1723 1723
1724 if ((pd->flags & SM501FB_FLAG_USE_HWCURSOR) == 0) 1724 if ((pd->flags & SM501FB_FLAG_USE_HWCURSOR) == 0)
1725 par->ops.fb_cursor = NULL; 1725 par->ops.fb_cursor = NULL;
diff --git a/drivers/video/sstfb.c b/drivers/video/sstfb.c
index 2ab704118c44..2301c275d63a 100644
--- a/drivers/video/sstfb.c
+++ b/drivers/video/sstfb.c
@@ -221,7 +221,7 @@ static int __sst_wait_idle(u8 __iomem *vbase)
221 while(1) { 221 while(1) {
222 if (__sst_read(vbase, STATUS) & STATUS_FBI_BUSY) { 222 if (__sst_read(vbase, STATUS) & STATUS_FBI_BUSY) {
223 f_dddprintk("status: busy\n"); 223 f_dddprintk("status: busy\n");
224/* FIXME basicaly, this is a busy wait. maybe not that good. oh well; 224/* FIXME basically, this is a busy wait. maybe not that good. oh well;
225 * this is a small loop after all. 225 * this is a small loop after all.
226 * Or maybe we should use mdelay() or udelay() here instead ? */ 226 * Or maybe we should use mdelay() or udelay() here instead ? */
227 count = 0; 227 count = 0;
@@ -501,7 +501,7 @@ static int sstfb_set_par(struct fb_info *info)
501 } 501 }
502 502
503 if (IS_VOODOO2(par)) { 503 if (IS_VOODOO2(par)) {
504 /* voodoo2 has 32 pixel wide tiles , BUT stange things 504 /* voodoo2 has 32 pixel wide tiles , BUT strange things
505 happen with odd number of tiles */ 505 happen with odd number of tiles */
506 par->tiles_in_X = (info->var.xres + 63 ) / 64 * 2; 506 par->tiles_in_X = (info->var.xres + 63 ) / 64 * 2;
507 } else { 507 } else {
@@ -920,11 +920,11 @@ static int __devinit sst_detect_ti(struct fb_info *info)
920 * we get the 1st byte (M value) of preset f1,f7 and fB 920 * we get the 1st byte (M value) of preset f1,f7 and fB
921 * why those 3 ? mmmh... for now, i'll do it the glide way... 921 * why those 3 ? mmmh... for now, i'll do it the glide way...
922 * and ask questions later. anyway, it seems that all the freq registers are 922 * and ask questions later. anyway, it seems that all the freq registers are
923 * realy at their default state (cf specs) so i ask again, why those 3 regs ? 923 * really at their default state (cf specs) so i ask again, why those 3 regs ?
924 * mmmmh.. it seems that's much more ugly than i thought. we use f0 and fA for 924 * mmmmh.. it seems that's much more ugly than i thought. we use f0 and fA for
925 * pll programming, so in fact, we *hope* that the f1, f7 & fB won't be 925 * pll programming, so in fact, we *hope* that the f1, f7 & fB won't be
926 * touched... 926 * touched...
927 * is it realy safe ? how can i reset this ramdac ? geee... 927 * is it really safe ? how can i reset this ramdac ? geee...
928 */ 928 */
929static int __devinit sst_detect_ics(struct fb_info *info) 929static int __devinit sst_detect_ics(struct fb_info *info)
930{ 930{
diff --git a/drivers/video/sticore.h b/drivers/video/sticore.h
index 7fe5be4bc70e..addf7b615ef8 100644
--- a/drivers/video/sticore.h
+++ b/drivers/video/sticore.h
@@ -79,7 +79,7 @@ struct sti_glob_cfg_ext {
79 u8 curr_mon; /* current monitor configured */ 79 u8 curr_mon; /* current monitor configured */
80 u8 friendly_boot; /* in friendly boot mode */ 80 u8 friendly_boot; /* in friendly boot mode */
81 s16 power; /* power calculation (in Watts) */ 81 s16 power; /* power calculation (in Watts) */
82 s32 freq_ref; /* frequency refrence */ 82 s32 freq_ref; /* frequency reference */
83 u32 sti_mem_addr; /* pointer to global sti memory (size=sti_mem_request) */ 83 u32 sti_mem_addr; /* pointer to global sti memory (size=sti_mem_request) */
84 u32 future_ptr; /* pointer to future data */ 84 u32 future_ptr; /* pointer to future data */
85}; 85};
diff --git a/drivers/video/tdfxfb.c b/drivers/video/tdfxfb.c
index 3ee5e63cfa4f..a99b994c9b6b 100644
--- a/drivers/video/tdfxfb.c
+++ b/drivers/video/tdfxfb.c
@@ -877,12 +877,12 @@ static void tdfxfb_fillrect(struct fb_info *info,
877 else 877 else
878 tdfx_rop = TDFX_ROP_XOR; 878 tdfx_rop = TDFX_ROP_XOR;
879 879
880 /* asume always rect->height < 4096 */ 880 /* assume always rect->height < 4096 */
881 if (dy + rect->height > 4095) { 881 if (dy + rect->height > 4095) {
882 dstbase = stride * dy; 882 dstbase = stride * dy;
883 dy = 0; 883 dy = 0;
884 } 884 }
885 /* asume always rect->width < 4096 */ 885 /* assume always rect->width < 4096 */
886 if (dx + rect->width > 4095) { 886 if (dx + rect->width > 4095) {
887 dstbase += dx * bpp >> 3; 887 dstbase += dx * bpp >> 3;
888 dx = 0; 888 dx = 0;
@@ -915,22 +915,22 @@ static void tdfxfb_copyarea(struct fb_info *info,
915 u32 dstbase = 0; 915 u32 dstbase = 0;
916 u32 srcbase = 0; 916 u32 srcbase = 0;
917 917
918 /* asume always area->height < 4096 */ 918 /* assume always area->height < 4096 */
919 if (sy + area->height > 4095) { 919 if (sy + area->height > 4095) {
920 srcbase = stride * sy; 920 srcbase = stride * sy;
921 sy = 0; 921 sy = 0;
922 } 922 }
923 /* asume always area->width < 4096 */ 923 /* assume always area->width < 4096 */
924 if (sx + area->width > 4095) { 924 if (sx + area->width > 4095) {
925 srcbase += sx * bpp >> 3; 925 srcbase += sx * bpp >> 3;
926 sx = 0; 926 sx = 0;
927 } 927 }
928 /* asume always area->height < 4096 */ 928 /* assume always area->height < 4096 */
929 if (dy + area->height > 4095) { 929 if (dy + area->height > 4095) {
930 dstbase = stride * dy; 930 dstbase = stride * dy;
931 dy = 0; 931 dy = 0;
932 } 932 }
933 /* asume always area->width < 4096 */ 933 /* assume always area->width < 4096 */
934 if (dx + area->width > 4095) { 934 if (dx + area->width > 4095) {
935 dstbase += dx * bpp >> 3; 935 dstbase += dx * bpp >> 3;
936 dx = 0; 936 dx = 0;
@@ -1003,12 +1003,12 @@ static void tdfxfb_imageblit(struct fb_info *info, const struct fb_image *image)
1003#else 1003#else
1004 srcfmt = 0x400000; 1004 srcfmt = 0x400000;
1005#endif 1005#endif
1006 /* asume always image->height < 4096 */ 1006 /* assume always image->height < 4096 */
1007 if (dy + image->height > 4095) { 1007 if (dy + image->height > 4095) {
1008 dstbase = stride * dy; 1008 dstbase = stride * dy;
1009 dy = 0; 1009 dy = 0;
1010 } 1010 }
1011 /* asume always image->width < 4096 */ 1011 /* assume always image->width < 4096 */
1012 if (dx + image->width > 4095) { 1012 if (dx + image->width > 4095) {
1013 dstbase += dx * bpp >> 3; 1013 dstbase += dx * bpp >> 3;
1014 dx = 0; 1014 dx = 0;
@@ -1124,7 +1124,7 @@ static int tdfxfb_cursor(struct fb_info *info, struct fb_cursor *cursor)
1124 * lower half (least significant 64 bits) of a 128 bit word 1124 * lower half (least significant 64 bits) of a 128 bit word
1125 * and pattern 1 the upper half. If you examine the data of 1125 * and pattern 1 the upper half. If you examine the data of
1126 * the cursor image the graphics card uses then from the 1126 * the cursor image the graphics card uses then from the
1127 * begining you see line one of pattern 0, line one of 1127 * beginning you see line one of pattern 0, line one of
1128 * pattern 1, line two of pattern 0, line two of pattern 1, 1128 * pattern 1, line two of pattern 0, line two of pattern 1,
1129 * etc etc. The linear stride for the cursor is always 16 bytes 1129 * etc etc. The linear stride for the cursor is always 16 bytes
1130 * (128 bits) which is the maximum cursor width times two for 1130 * (128 bits) which is the maximum cursor width times two for
diff --git a/drivers/video/tmiofb.c b/drivers/video/tmiofb.c
index 9710bf8caeae..0c341d739604 100644
--- a/drivers/video/tmiofb.c
+++ b/drivers/video/tmiofb.c
@@ -359,7 +359,7 @@ tmiofb_acc_wait(struct fb_info *info, unsigned int ccs)
359{ 359{
360 struct tmiofb_par *par = info->par; 360 struct tmiofb_par *par = info->par;
361 /* 361 /*
362 * This code can be called whith interrupts disabled. 362 * This code can be called with interrupts disabled.
363 * So instead of relaying on irq to trigger the event, 363 * So instead of relaying on irq to trigger the event,
364 * poll the state till the necessary command is executed. 364 * poll the state till the necessary command is executed.
365 */ 365 */
diff --git a/drivers/video/udlfb.c b/drivers/video/udlfb.c
index 2c8364e9b632..68041d9dc260 100644
--- a/drivers/video/udlfb.c
+++ b/drivers/video/udlfb.c
@@ -769,7 +769,7 @@ static int dlfb_ops_ioctl(struct fb_info *info, unsigned int cmd,
769 769
770 /* 770 /*
771 * If we have a damage-aware client, turn fb_defio "off" 771 * If we have a damage-aware client, turn fb_defio "off"
772 * To avoid perf imact of unecessary page fault handling. 772 * To avoid perf imact of unnecessary page fault handling.
773 * Done by resetting the delay for this fb_info to a very 773 * Done by resetting the delay for this fb_info to a very
774 * long period. Pages will become writable and stay that way. 774 * long period. Pages will become writable and stay that way.
775 * Reset to normal value when all clients have closed this fb. 775 * Reset to normal value when all clients have closed this fb.
diff --git a/drivers/video/vga16fb.c b/drivers/video/vga16fb.c
index 28ccab44a391..53b2c5aae067 100644
--- a/drivers/video/vga16fb.c
+++ b/drivers/video/vga16fb.c
@@ -152,7 +152,7 @@ static inline int setop(int op)
152} 152}
153 153
154/* Set the Enable Set/Reset Register and return its old value. 154/* Set the Enable Set/Reset Register and return its old value.
155 The code here always uses value 0xf for thsi register. */ 155 The code here always uses value 0xf for this register. */
156static inline int setsr(int sr) 156static inline int setsr(int sr)
157{ 157{
158 int oldsr; 158 int oldsr;
diff --git a/drivers/video/via/chip.h b/drivers/video/via/chip.h
index 781f3aa66b42..29d70244a21f 100644
--- a/drivers/video/via/chip.h
+++ b/drivers/video/via/chip.h
@@ -139,7 +139,6 @@ struct chip_information {
139 139
140struct crt_setting_information { 140struct crt_setting_information {
141 int iga_path; 141 int iga_path;
142 int refresh_rate;
143}; 142};
144 143
145struct tmds_setting_information { 144struct tmds_setting_information {
diff --git a/drivers/video/via/hw.c b/drivers/video/via/hw.c
index 5728fd76bc11..dc4c778877ce 100644
--- a/drivers/video/via/hw.c
+++ b/drivers/video/via/hw.c
@@ -2002,13 +2002,15 @@ void viafb_fill_crtc_timing(struct crt_mode_table *crt_table,
2002 int i; 2002 int i;
2003 int index = 0; 2003 int index = 0;
2004 int h_addr, v_addr; 2004 int h_addr, v_addr;
2005 u32 pll_D_N, clock; 2005 u32 pll_D_N, clock, refresh = viafb_refresh;
2006
2007 if (viafb_SAMM_ON && set_iga == IGA2)
2008 refresh = viafb_refresh1;
2006 2009
2007 for (i = 0; i < video_mode->mode_array; i++) { 2010 for (i = 0; i < video_mode->mode_array; i++) {
2008 index = i; 2011 index = i;
2009 2012
2010 if (crt_table[i].refresh_rate == viaparinfo-> 2013 if (crt_table[i].refresh_rate == refresh)
2011 crt_setting_info->refresh_rate)
2012 break; 2014 break;
2013 } 2015 }
2014 2016
@@ -2019,7 +2021,7 @@ void viafb_fill_crtc_timing(struct crt_mode_table *crt_table,
2019 if ((viafb_LCD_ON | viafb_DVI_ON) 2021 if ((viafb_LCD_ON | viafb_DVI_ON)
2020 && video_mode->crtc[0].crtc.hor_addr == 640 2022 && video_mode->crtc[0].crtc.hor_addr == 640
2021 && video_mode->crtc[0].crtc.ver_addr == 480 2023 && video_mode->crtc[0].crtc.ver_addr == 480
2022 && viaparinfo->crt_setting_info->refresh_rate == 60) { 2024 && refresh == 60) {
2023 /* The border is 8 pixels. */ 2025 /* The border is 8 pixels. */
2024 crt_reg.hor_blank_start = crt_reg.hor_blank_start - 8; 2026 crt_reg.hor_blank_start = crt_reg.hor_blank_start - 8;
2025 2027
@@ -2070,7 +2072,6 @@ void __devinit viafb_init_chip_info(int chip_type)
2070 init_lvds_chip_info(); 2072 init_lvds_chip_info();
2071 2073
2072 viaparinfo->crt_setting_info->iga_path = IGA1; 2074 viaparinfo->crt_setting_info->iga_path = IGA1;
2073 viaparinfo->crt_setting_info->refresh_rate = viafb_refresh;
2074 2075
2075 /*Set IGA path for each device */ 2076 /*Set IGA path for each device */
2076 viafb_set_iga_path(); 2077 viafb_set_iga_path();
@@ -2083,13 +2084,9 @@ void __devinit viafb_init_chip_info(int chip_type)
2083 viaparinfo->lvds_setting_info->lcd_mode; 2084 viaparinfo->lvds_setting_info->lcd_mode;
2084} 2085}
2085 2086
2086void viafb_update_device_setting(int hres, int vres, 2087void viafb_update_device_setting(int hres, int vres, int bpp, int flag)
2087 int bpp, int vmode_refresh, int flag)
2088{ 2088{
2089 if (flag == 0) { 2089 if (flag == 0) {
2090 viaparinfo->crt_setting_info->refresh_rate =
2091 vmode_refresh;
2092
2093 viaparinfo->tmds_setting_info->h_active = hres; 2090 viaparinfo->tmds_setting_info->h_active = hres;
2094 viaparinfo->tmds_setting_info->v_active = vres; 2091 viaparinfo->tmds_setting_info->v_active = vres;
2095 2092
diff --git a/drivers/video/via/hw.h b/drivers/video/via/hw.h
index 7295263299f7..8858593405aa 100644
--- a/drivers/video/via/hw.h
+++ b/drivers/video/via/hw.h
@@ -949,8 +949,7 @@ void __devinit viafb_init_chip_info(int chip_type);
949void __devinit viafb_init_dac(int set_iga); 949void __devinit viafb_init_dac(int set_iga);
950int viafb_get_pixclock(int hres, int vres, int vmode_refresh); 950int viafb_get_pixclock(int hres, int vres, int vmode_refresh);
951int viafb_get_refresh(int hres, int vres, u32 float_refresh); 951int viafb_get_refresh(int hres, int vres, u32 float_refresh);
952void viafb_update_device_setting(int hres, int vres, int bpp, 952void viafb_update_device_setting(int hres, int vres, int bpp, int flag);
953 int vmode_refresh, int flag);
954 953
955void viafb_set_iga_path(void); 954void viafb_set_iga_path(void);
956void viafb_set_primary_color_register(u8 index, u8 red, u8 green, u8 blue); 955void viafb_set_primary_color_register(u8 index, u8 red, u8 green, u8 blue);
diff --git a/drivers/video/via/via_utility.c b/drivers/video/via/via_utility.c
index d05ccb62b55f..35458a5eadc8 100644
--- a/drivers/video/via/via_utility.c
+++ b/drivers/video/via/via_utility.c
@@ -174,7 +174,7 @@ void viafb_set_gamma_table(int bpp, unsigned int *gamma_table)
174 } 174 }
175 175
176 /* If adjust Gamma value in SAMM, fill IGA1, 176 /* If adjust Gamma value in SAMM, fill IGA1,
177 IGA2 Gamma table simultanous. */ 177 IGA2 Gamma table simultaneous. */
178 /* Switch to IGA2 Gamma Table */ 178 /* Switch to IGA2 Gamma Table */
179 if ((active_device_amount > 1) && 179 if ((active_device_amount > 1) &&
180 !((viaparinfo->chip_info->gfx_chip_name == 180 !((viaparinfo->chip_info->gfx_chip_name ==
diff --git a/drivers/video/via/via_utility.h b/drivers/video/via/via_utility.h
index 1670ba82143f..f23be1708c14 100644
--- a/drivers/video/via/via_utility.h
+++ b/drivers/video/via/via_utility.h
@@ -21,7 +21,7 @@
21#ifndef __VIAUTILITY_H__ 21#ifndef __VIAUTILITY_H__
22#define __VIAUTILITY_H__ 22#define __VIAUTILITY_H__
23 23
24/* These functions are used to get infomation about device's state */ 24/* These functions are used to get information about device's state */
25void viafb_get_device_support_state(u32 *support_state); 25void viafb_get_device_support_state(u32 *support_state);
26void viafb_get_device_connect_state(u32 *connect_state); 26void viafb_get_device_connect_state(u32 *connect_state);
27bool viafb_lcd_get_support_expand_state(u32 xres, u32 yres); 27bool viafb_lcd_get_support_expand_state(u32 xres, u32 yres);
diff --git a/drivers/video/via/viafbdev.c b/drivers/video/via/viafbdev.c
index f555b891cc72..a542bed086e2 100644
--- a/drivers/video/via/viafbdev.c
+++ b/drivers/video/via/viafbdev.c
@@ -182,13 +182,24 @@ static int viafb_release(struct fb_info *info, int user)
182 return 0; 182 return 0;
183} 183}
184 184
185static inline int get_var_refresh(struct fb_var_screeninfo *var)
186{
187 u32 htotal, vtotal;
188
189 htotal = var->left_margin + var->xres + var->right_margin
190 + var->hsync_len;
191 vtotal = var->upper_margin + var->yres + var->lower_margin
192 + var->vsync_len;
193 return PICOS2KHZ(var->pixclock) * 1000 / (htotal * vtotal);
194}
195
185static int viafb_check_var(struct fb_var_screeninfo *var, 196static int viafb_check_var(struct fb_var_screeninfo *var,
186 struct fb_info *info) 197 struct fb_info *info)
187{ 198{
188 int htotal, vtotal, depth; 199 int depth, refresh;
189 struct VideoModeTable *vmode_entry; 200 struct VideoModeTable *vmode_entry;
190 struct viafb_par *ppar = info->par; 201 struct viafb_par *ppar = info->par;
191 u32 long_refresh, line; 202 u32 line;
192 203
193 DEBUG_MSG(KERN_INFO "viafb_check_var!\n"); 204 DEBUG_MSG(KERN_INFO "viafb_check_var!\n");
194 /* Sanity check */ 205 /* Sanity check */
@@ -231,17 +242,11 @@ static int viafb_check_var(struct fb_var_screeninfo *var,
231 /* Based on var passed in to calculate the refresh, 242 /* Based on var passed in to calculate the refresh,
232 * because our driver use some modes special. 243 * because our driver use some modes special.
233 */ 244 */
234 htotal = var->xres + var->left_margin + 245 refresh = viafb_get_refresh(var->xres, var->yres,
235 var->right_margin + var->hsync_len; 246 get_var_refresh(var));
236 vtotal = var->yres + var->upper_margin +
237 var->lower_margin + var->vsync_len;
238 long_refresh = 1000000000UL / var->pixclock * 1000;
239 long_refresh /= (htotal * vtotal);
240
241 viafb_refresh = viafb_get_refresh(var->xres, var->yres, long_refresh);
242 247
243 /* Adjust var according to our driver's own table */ 248 /* Adjust var according to our driver's own table */
244 viafb_fill_var_timing_info(var, viafb_refresh, vmode_entry); 249 viafb_fill_var_timing_info(var, refresh, vmode_entry);
245 if (var->accel_flags & FB_ACCELF_TEXT && 250 if (var->accel_flags & FB_ACCELF_TEXT &&
246 !ppar->shared->vdev->engine_mmio) 251 !ppar->shared->vdev->engine_mmio)
247 var->accel_flags = 0; 252 var->accel_flags = 0;
@@ -253,12 +258,13 @@ static int viafb_set_par(struct fb_info *info)
253{ 258{
254 struct viafb_par *viapar = info->par; 259 struct viafb_par *viapar = info->par;
255 struct VideoModeTable *vmode_entry, *vmode_entry1 = NULL; 260 struct VideoModeTable *vmode_entry, *vmode_entry1 = NULL;
261 int refresh;
256 DEBUG_MSG(KERN_INFO "viafb_set_par!\n"); 262 DEBUG_MSG(KERN_INFO "viafb_set_par!\n");
257 263
258 viafb_update_fix(info); 264 viafb_update_fix(info);
259 viapar->depth = fb_get_color_depth(&info->var, &info->fix); 265 viapar->depth = fb_get_color_depth(&info->var, &info->fix);
260 viafb_update_device_setting(viafbinfo->var.xres, viafbinfo->var.yres, 266 viafb_update_device_setting(viafbinfo->var.xres, viafbinfo->var.yres,
261 viafbinfo->var.bits_per_pixel, viafb_refresh, 0); 267 viafbinfo->var.bits_per_pixel, 0);
262 268
263 vmode_entry = viafb_get_mode(viafbinfo->var.xres, viafbinfo->var.yres); 269 vmode_entry = viafb_get_mode(viafbinfo->var.xres, viafbinfo->var.yres);
264 if (viafb_dual_fb) { 270 if (viafb_dual_fb) {
@@ -266,7 +272,7 @@ static int viafb_set_par(struct fb_info *info)
266 viafbinfo1->var.yres); 272 viafbinfo1->var.yres);
267 viafb_update_device_setting(viafbinfo1->var.xres, 273 viafb_update_device_setting(viafbinfo1->var.xres,
268 viafbinfo1->var.yres, viafbinfo1->var.bits_per_pixel, 274 viafbinfo1->var.yres, viafbinfo1->var.bits_per_pixel,
269 viafb_refresh1, 1); 275 1);
270 } else if (viafb_SAMM_ON == 1) { 276 } else if (viafb_SAMM_ON == 1) {
271 DEBUG_MSG(KERN_INFO 277 DEBUG_MSG(KERN_INFO
272 "viafb_second_xres = %d, viafb_second_yres = %d, bpp = %d\n", 278 "viafb_second_xres = %d, viafb_second_yres = %d, bpp = %d\n",
@@ -275,14 +281,19 @@ static int viafb_set_par(struct fb_info *info)
275 viafb_second_yres); 281 viafb_second_yres);
276 282
277 viafb_update_device_setting(viafb_second_xres, 283 viafb_update_device_setting(viafb_second_xres,
278 viafb_second_yres, viafb_bpp1, viafb_refresh1, 1); 284 viafb_second_yres, viafb_bpp1, 1);
279 } 285 }
280 286
287 refresh = viafb_get_refresh(info->var.xres, info->var.yres,
288 get_var_refresh(&info->var));
281 if (vmode_entry) { 289 if (vmode_entry) {
282 if (viafb_dual_fb && viapar->iga_path == IGA2) 290 if (viafb_dual_fb && viapar->iga_path == IGA2) {
283 viafb_bpp1 = info->var.bits_per_pixel; 291 viafb_bpp1 = info->var.bits_per_pixel;
284 else 292 viafb_refresh1 = refresh;
293 } else {
285 viafb_bpp = info->var.bits_per_pixel; 294 viafb_bpp = info->var.bits_per_pixel;
295 viafb_refresh = refresh;
296 }
286 297
287 if (info->var.accel_flags & FB_ACCELF_TEXT) 298 if (info->var.accel_flags & FB_ACCELF_TEXT)
288 info->flags &= ~FBINFO_HWACCEL_DISABLED; 299 info->flags &= ~FBINFO_HWACCEL_DISABLED;
@@ -1795,14 +1806,9 @@ int __devinit via_fb_pci_probe(struct viafb_dev *vdev)
1795 default_var.xres_virtual = default_xres; 1806 default_var.xres_virtual = default_xres;
1796 default_var.yres_virtual = default_yres; 1807 default_var.yres_virtual = default_yres;
1797 default_var.bits_per_pixel = viafb_bpp; 1808 default_var.bits_per_pixel = viafb_bpp;
1798 default_var.pixclock = 1809 viafb_fill_var_timing_info(&default_var, viafb_get_refresh(
1799 viafb_get_pixclock(default_xres, default_yres, viafb_refresh); 1810 default_var.xres, default_var.yres, viafb_refresh),
1800 default_var.left_margin = (default_xres >> 3) & 0xf8; 1811 viafb_get_mode(default_var.xres, default_var.yres));
1801 default_var.right_margin = 32;
1802 default_var.upper_margin = 16;
1803 default_var.lower_margin = 4;
1804 default_var.hsync_len = default_var.left_margin;
1805 default_var.vsync_len = 4;
1806 viafb_setup_fixinfo(&viafbinfo->fix, viaparinfo); 1812 viafb_setup_fixinfo(&viafbinfo->fix, viaparinfo);
1807 viafbinfo->var = default_var; 1813 viafbinfo->var = default_var;
1808 1814
@@ -1841,15 +1847,9 @@ int __devinit via_fb_pci_probe(struct viafb_dev *vdev)
1841 default_var.xres_virtual = viafb_second_virtual_xres; 1847 default_var.xres_virtual = viafb_second_virtual_xres;
1842 default_var.yres_virtual = viafb_second_virtual_yres; 1848 default_var.yres_virtual = viafb_second_virtual_yres;
1843 default_var.bits_per_pixel = viafb_bpp1; 1849 default_var.bits_per_pixel = viafb_bpp1;
1844 default_var.pixclock = 1850 viafb_fill_var_timing_info(&default_var, viafb_get_refresh(
1845 viafb_get_pixclock(viafb_second_xres, viafb_second_yres, 1851 default_var.xres, default_var.yres, viafb_refresh1),
1846 viafb_refresh); 1852 viafb_get_mode(default_var.xres, default_var.yres));
1847 default_var.left_margin = (viafb_second_xres >> 3) & 0xf8;
1848 default_var.right_margin = 32;
1849 default_var.upper_margin = 16;
1850 default_var.lower_margin = 4;
1851 default_var.hsync_len = default_var.left_margin;
1852 default_var.vsync_len = 4;
1853 1853
1854 viafb_setup_fixinfo(&viafbinfo1->fix, viaparinfo1); 1854 viafb_setup_fixinfo(&viafbinfo1->fix, viaparinfo1);
1855 viafb_check_var(&default_var, viafbinfo1); 1855 viafb_check_var(&default_var, viafbinfo1);
@@ -2004,22 +2004,24 @@ static int __init viafb_setup(char *options)
2004 */ 2004 */
2005int __init viafb_init(void) 2005int __init viafb_init(void)
2006{ 2006{
2007 u32 dummy; 2007 u32 dummy_x, dummy_y;
2008#ifndef MODULE 2008#ifndef MODULE
2009 char *option = NULL; 2009 char *option = NULL;
2010 if (fb_get_options("viafb", &option)) 2010 if (fb_get_options("viafb", &option))
2011 return -ENODEV; 2011 return -ENODEV;
2012 viafb_setup(option); 2012 viafb_setup(option);
2013#endif 2013#endif
2014 if (parse_mode(viafb_mode, &dummy, &dummy) 2014 if (parse_mode(viafb_mode, &dummy_x, &dummy_y)
2015 || parse_mode(viafb_mode1, &dummy, &dummy) 2015 || !viafb_get_mode(dummy_x, dummy_y)
2016 || parse_mode(viafb_mode1, &dummy_x, &dummy_y)
2017 || !viafb_get_mode(dummy_x, dummy_y)
2016 || viafb_bpp < 0 || viafb_bpp > 32 2018 || viafb_bpp < 0 || viafb_bpp > 32
2017 || viafb_bpp1 < 0 || viafb_bpp1 > 32 2019 || viafb_bpp1 < 0 || viafb_bpp1 > 32
2018 || parse_active_dev()) 2020 || parse_active_dev())
2019 return -EINVAL; 2021 return -EINVAL;
2020 2022
2021 printk(KERN_INFO 2023 printk(KERN_INFO
2022 "VIA Graphics Intergration Chipset framebuffer %d.%d initializing\n", 2024 "VIA Graphics Integration Chipset framebuffer %d.%d initializing\n",
2023 VERSION_MAJOR, VERSION_MINOR); 2025 VERSION_MAJOR, VERSION_MINOR);
2024 return 0; 2026 return 0;
2025} 2027}
diff --git a/drivers/video/w100fb.c b/drivers/video/w100fb.c
index d8b12c32e3ef..c8be8af0cc6d 100644
--- a/drivers/video/w100fb.c
+++ b/drivers/video/w100fb.c
@@ -1306,7 +1306,7 @@ static void w100_init_lcd(struct w100fb_par *par)
1306 union graphic_v_disp_u graphic_v_disp; 1306 union graphic_v_disp_u graphic_v_disp;
1307 union crtc_total_u crtc_total; 1307 union crtc_total_u crtc_total;
1308 1308
1309 /* w3200 doesnt like undefined bits being set so zero register values first */ 1309 /* w3200 doesn't like undefined bits being set so zero register values first */
1310 1310
1311 active_h_disp.val = 0; 1311 active_h_disp.val = 0;
1312 active_h_disp.f.active_h_start=mode->left_margin; 1312 active_h_disp.f.active_h_start=mode->left_margin;