aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/video')
-rw-r--r--drivers/video/Kconfig3
-rw-r--r--drivers/video/aty/atyfb_base.c2
-rw-r--r--drivers/video/aty/radeon_base.c4
-rw-r--r--drivers/video/cirrusfb.c6
-rw-r--r--drivers/video/console/fbcon.c4
-rw-r--r--drivers/video/display/display-sysfs.c10
-rw-r--r--drivers/video/fsl-diu-fb.c33
-rw-r--r--drivers/video/hgafb.c26
-rw-r--r--drivers/video/leo.c58
-rw-r--r--drivers/video/matrox/matroxfb_base.h2
-rw-r--r--drivers/video/modedb.c2
-rw-r--r--drivers/video/pxafb.c59
-rw-r--r--drivers/video/s3c2410fb.c130
-rw-r--r--drivers/video/s3c2410fb.h20
-rw-r--r--drivers/video/sis/sis_main.c2
-rw-r--r--drivers/video/sm501fb.c8
-rw-r--r--drivers/video/w100fb.c1
-rw-r--r--drivers/video/xen-fbfront.c211
18 files changed, 348 insertions, 233 deletions
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
index 002b61b4f0f6..e0c5f96b273d 100644
--- a/drivers/video/Kconfig
+++ b/drivers/video/Kconfig
@@ -1825,12 +1825,13 @@ config FB_FSL_DIU
1825 1825
1826config FB_W100 1826config FB_W100
1827 tristate "W100 frame buffer support" 1827 tristate "W100 frame buffer support"
1828 depends on FB && PXA_SHARPSL 1828 depends on FB && ARCH_PXA
1829 select FB_CFB_FILLRECT 1829 select FB_CFB_FILLRECT
1830 select FB_CFB_COPYAREA 1830 select FB_CFB_COPYAREA
1831 select FB_CFB_IMAGEBLIT 1831 select FB_CFB_IMAGEBLIT
1832 ---help--- 1832 ---help---
1833 Frame buffer driver for the w100 as found on the Sharp SL-Cxx series. 1833 Frame buffer driver for the w100 as found on the Sharp SL-Cxx series.
1834 It can also drive the w3220 chip found on iPAQ hx4700.
1834 1835
1835 This driver is also available as a module ( = code which can be 1836 This driver is also available as a module ( = code which can be
1836 inserted and removed from the running kernel whenever you want). The 1837 inserted and removed from the running kernel whenever you want). The
diff --git a/drivers/video/aty/atyfb_base.c b/drivers/video/aty/atyfb_base.c
index e4bcf5376a99..bd4ac0bafecb 100644
--- a/drivers/video/aty/atyfb_base.c
+++ b/drivers/video/aty/atyfb_base.c
@@ -3356,7 +3356,7 @@ static int __devinit atyfb_setup_generic(struct pci_dev *pdev, struct fb_info *i
3356 3356
3357 info->fix.mmio_start = raddr; 3357 info->fix.mmio_start = raddr;
3358 par->ati_regbase = ioremap(info->fix.mmio_start, 0x1000); 3358 par->ati_regbase = ioremap(info->fix.mmio_start, 0x1000);
3359 if (par->ati_regbase == 0) 3359 if (par->ati_regbase == NULL)
3360 return -ENOMEM; 3360 return -ENOMEM;
3361 3361
3362 info->fix.mmio_start += par->aux_start ? 0x400 : 0xc00; 3362 info->fix.mmio_start += par->aux_start ? 0x400 : 0xc00;
diff --git a/drivers/video/aty/radeon_base.c b/drivers/video/aty/radeon_base.c
index 72cd0d2f14ec..400e9264e456 100644
--- a/drivers/video/aty/radeon_base.c
+++ b/drivers/video/aty/radeon_base.c
@@ -2277,8 +2277,8 @@ static int __devinit radeonfb_pci_register (struct pci_dev *pdev,
2277 do { 2277 do {
2278 rinfo->fb_base = ioremap (rinfo->fb_base_phys, 2278 rinfo->fb_base = ioremap (rinfo->fb_base_phys,
2279 rinfo->mapped_vram); 2279 rinfo->mapped_vram);
2280 } while ( rinfo->fb_base == 0 && 2280 } while (rinfo->fb_base == NULL &&
2281 ((rinfo->mapped_vram /=2) >= MIN_MAPPED_VRAM) ); 2281 ((rinfo->mapped_vram /= 2) >= MIN_MAPPED_VRAM));
2282 2282
2283 if (rinfo->fb_base == NULL) { 2283 if (rinfo->fb_base == NULL) {
2284 printk (KERN_ERR "radeonfb (%s): cannot map FB\n", 2284 printk (KERN_ERR "radeonfb (%s): cannot map FB\n",
diff --git a/drivers/video/cirrusfb.c b/drivers/video/cirrusfb.c
index 35ac9d956b3d..c14b2435d23e 100644
--- a/drivers/video/cirrusfb.c
+++ b/drivers/video/cirrusfb.c
@@ -2432,9 +2432,9 @@ static int cirrusfb_pci_register(struct pci_dev *pdev,
2432 info->screen_size = board_size; 2432 info->screen_size = board_size;
2433 cinfo->unmap = cirrusfb_pci_unmap; 2433 cinfo->unmap = cirrusfb_pci_unmap;
2434 2434
2435 printk(KERN_INFO " RAM (%lu kB) at 0xx%lx, ", 2435 printk(KERN_INFO "RAM (%lu kB) at 0x%lx, Cirrus "
2436 info->screen_size >> 10, board_addr); 2436 "Logic chipset on PCI bus\n",
2437 printk(KERN_INFO "Cirrus Logic chipset on PCI bus\n"); 2437 info->screen_size >> 10, board_addr);
2438 pci_set_drvdata(pdev, info); 2438 pci_set_drvdata(pdev, info);
2439 2439
2440 ret = cirrusfb_register(info); 2440 ret = cirrusfb_register(info);
diff --git a/drivers/video/console/fbcon.c b/drivers/video/console/fbcon.c
index 5fa8b76673cb..97aff8db10bf 100644
--- a/drivers/video/console/fbcon.c
+++ b/drivers/video/console/fbcon.c
@@ -2275,9 +2275,7 @@ static int fbcon_switch(struct vc_data *vc)
2275 * in fb_set_var() 2275 * in fb_set_var()
2276 */ 2276 */
2277 info->var.activate = var.activate; 2277 info->var.activate = var.activate;
2278 var.yoffset = info->var.yoffset; 2278 var.vmode |= info->var.vmode & ~FB_VMODE_MASK;
2279 var.xoffset = info->var.xoffset;
2280 var.vmode = info->var.vmode;
2281 fb_set_var(info, &var); 2279 fb_set_var(info, &var);
2282 ops->var = info->var; 2280 ops->var = info->var;
2283 2281
diff --git a/drivers/video/display/display-sysfs.c b/drivers/video/display/display-sysfs.c
index 35477177bef4..6ef800bdf482 100644
--- a/drivers/video/display/display-sysfs.c
+++ b/drivers/video/display/display-sysfs.c
@@ -26,6 +26,7 @@
26#include <linux/ctype.h> 26#include <linux/ctype.h>
27#include <linux/idr.h> 27#include <linux/idr.h>
28#include <linux/err.h> 28#include <linux/err.h>
29#include <linux/kdev_t.h>
29 30
30static ssize_t display_show_name(struct device *dev, 31static ssize_t display_show_name(struct device *dev,
31 struct device_attribute *attr, char *buf) 32 struct device_attribute *attr, char *buf)
@@ -152,10 +153,13 @@ struct display_device *display_device_register(struct display_driver *driver,
152 mutex_unlock(&allocated_dsp_lock); 153 mutex_unlock(&allocated_dsp_lock);
153 154
154 if (!ret) { 155 if (!ret) {
155 new_dev->dev = device_create(display_class, parent, 0, 156 new_dev->dev = device_create_drvdata(display_class,
156 "display%d", new_dev->idx); 157 parent,
158 MKDEV(0,0),
159 new_dev,
160 "display%d",
161 new_dev->idx);
157 if (!IS_ERR(new_dev->dev)) { 162 if (!IS_ERR(new_dev->dev)) {
158 dev_set_drvdata(new_dev->dev, new_dev);
159 new_dev->parent = parent; 163 new_dev->parent = parent;
160 new_dev->driver = driver; 164 new_dev->driver = driver;
161 mutex_init(&new_dev->lock); 165 mutex_init(&new_dev->lock);
diff --git a/drivers/video/fsl-diu-fb.c b/drivers/video/fsl-diu-fb.c
index b50bb03cb5ab..712dabc6269f 100644
--- a/drivers/video/fsl-diu-fb.c
+++ b/drivers/video/fsl-diu-fb.c
@@ -286,7 +286,7 @@ static struct diu_pool pool;
286 * rheap and make the furture large allocation fail. 286 * rheap and make the furture large allocation fail.
287 */ 287 */
288 288
289void *fsl_diu_alloc(unsigned long size, phys_addr_t *phys) 289static void *fsl_diu_alloc(unsigned long size, phys_addr_t *phys)
290{ 290{
291 void *virt; 291 void *virt;
292 292
@@ -311,12 +311,12 @@ void *fsl_diu_alloc(unsigned long size, phys_addr_t *phys)
311 memset(virt, 0, size); 311 memset(virt, 0, size);
312 } 312 }
313 313
314 pr_debug("rh virt=%p phys=%lx\n", virt, *phys); 314 pr_debug("rh virt=%p phys=%llx\n", virt, (unsigned long long)*phys);
315 315
316 return virt; 316 return virt;
317} 317}
318 318
319void fsl_diu_free(void *p, unsigned long size) 319static void fsl_diu_free(void *p, unsigned long size)
320{ 320{
321 pr_debug("p=%p size=%lu\n", p, size); 321 pr_debug("p=%p size=%lu\n", p, size);
322 322
@@ -770,7 +770,7 @@ static int map_video_memory(struct fb_info *info)
770 info->fix.smem_len = info->fix.line_length * info->var.yres_virtual; 770 info->fix.smem_len = info->fix.line_length * info->var.yres_virtual;
771 pr_debug("MAP_VIDEO_MEMORY: smem_len = %d\n", info->fix.smem_len); 771 pr_debug("MAP_VIDEO_MEMORY: smem_len = %d\n", info->fix.smem_len);
772 info->screen_base = fsl_diu_alloc(info->fix.smem_len, &phys); 772 info->screen_base = fsl_diu_alloc(info->fix.smem_len, &phys);
773 if (info->screen_base == 0) { 773 if (info->screen_base == NULL) {
774 printk(KERN_ERR "Unable to allocate fb memory\n"); 774 printk(KERN_ERR "Unable to allocate fb memory\n");
775 return -ENOMEM; 775 return -ENOMEM;
776 } 776 }
@@ -788,7 +788,7 @@ static int map_video_memory(struct fb_info *info)
788static void unmap_video_memory(struct fb_info *info) 788static void unmap_video_memory(struct fb_info *info)
789{ 789{
790 fsl_diu_free(info->screen_base, info->fix.smem_len); 790 fsl_diu_free(info->screen_base, info->fix.smem_len);
791 info->screen_base = 0; 791 info->screen_base = NULL;
792 info->fix.smem_start = 0; 792 info->fix.smem_start = 0;
793 info->fix.smem_len = 0; 793 info->fix.smem_len = 0;
794} 794}
@@ -1158,7 +1158,7 @@ static int init_fbinfo(struct fb_info *info)
1158 return 0; 1158 return 0;
1159} 1159}
1160 1160
1161static int install_fb(struct fb_info *info) 1161static int __devinit install_fb(struct fb_info *info)
1162{ 1162{
1163 int rc; 1163 int rc;
1164 struct mfb_info *mfbi = info->par; 1164 struct mfb_info *mfbi = info->par;
@@ -1233,7 +1233,7 @@ static int install_fb(struct fb_info *info)
1233 return 0; 1233 return 0;
1234} 1234}
1235 1235
1236static void __exit uninstall_fb(struct fb_info *info) 1236static void uninstall_fb(struct fb_info *info)
1237{ 1237{
1238 struct mfb_info *mfbi = info->par; 1238 struct mfb_info *mfbi = info->par;
1239 1239
@@ -1287,7 +1287,7 @@ static int request_irq_local(int irq)
1287 /* Read to clear the status */ 1287 /* Read to clear the status */
1288 status = in_be32(&hw->int_status); 1288 status = in_be32(&hw->int_status);
1289 1289
1290 ret = request_irq(irq, fsl_diu_isr, 0, "diu", 0); 1290 ret = request_irq(irq, fsl_diu_isr, 0, "diu", NULL);
1291 if (ret) 1291 if (ret)
1292 pr_info("Request diu IRQ failed.\n"); 1292 pr_info("Request diu IRQ failed.\n");
1293 else { 1293 else {
@@ -1312,7 +1312,7 @@ static void free_irq_local(int irq)
1312 /* Disable all LCDC interrupt */ 1312 /* Disable all LCDC interrupt */
1313 out_be32(&hw->int_mask, 0x1f); 1313 out_be32(&hw->int_mask, 0x1f);
1314 1314
1315 free_irq(irq, 0); 1315 free_irq(irq, NULL);
1316} 1316}
1317 1317
1318#ifdef CONFIG_PM 1318#ifdef CONFIG_PM
@@ -1320,21 +1320,21 @@ static void free_irq_local(int irq)
1320 * Power management hooks. Note that we won't be called from IRQ context, 1320 * Power management hooks. Note that we won't be called from IRQ context,
1321 * unlike the blank functions above, so we may sleep. 1321 * unlike the blank functions above, so we may sleep.
1322 */ 1322 */
1323static int fsl_diu_suspend(struct of_device *dev, pm_message_t state) 1323static int fsl_diu_suspend(struct of_device *ofdev, pm_message_t state)
1324{ 1324{
1325 struct fsl_diu_data *machine_data; 1325 struct fsl_diu_data *machine_data;
1326 1326
1327 machine_data = dev_get_drvdata(&ofdev->dev); 1327 machine_data = dev_get_drvdata(&dev->dev);
1328 disable_lcdc(machine_data->fsl_diu_info[0]); 1328 disable_lcdc(machine_data->fsl_diu_info[0]);
1329 1329
1330 return 0; 1330 return 0;
1331} 1331}
1332 1332
1333static int fsl_diu_resume(struct of_device *dev) 1333static int fsl_diu_resume(struct of_device *ofdev)
1334{ 1334{
1335 struct fsl_diu_data *machine_data; 1335 struct fsl_diu_data *machine_data;
1336 1336
1337 machine_data = dev_get_drvdata(&ofdev->dev); 1337 machine_data = dev_get_drvdata(&dev->dev);
1338 enable_lcdc(machine_data->fsl_diu_info[0]); 1338 enable_lcdc(machine_data->fsl_diu_info[0]);
1339 1339
1340 return 0; 1340 return 0;
@@ -1353,7 +1353,8 @@ static int allocate_buf(struct diu_addr *buf, u32 size, u32 bytes_align)
1353 dma_addr_t paddr = 0; 1353 dma_addr_t paddr = 0;
1354 1354
1355 ssize = size + bytes_align; 1355 ssize = size + bytes_align;
1356 buf->vaddr = dma_alloc_coherent(0, ssize, &paddr, GFP_DMA | __GFP_ZERO); 1356 buf->vaddr = dma_alloc_coherent(NULL, ssize, &paddr, GFP_DMA |
1357 __GFP_ZERO);
1357 if (!buf->vaddr) 1358 if (!buf->vaddr)
1358 return -ENOMEM; 1359 return -ENOMEM;
1359 1360
@@ -1371,7 +1372,7 @@ static int allocate_buf(struct diu_addr *buf, u32 size, u32 bytes_align)
1371 1372
1372static void free_buf(struct diu_addr *buf, u32 size, u32 bytes_align) 1373static void free_buf(struct diu_addr *buf, u32 size, u32 bytes_align)
1373{ 1374{
1374 dma_free_coherent(0, size + bytes_align, 1375 dma_free_coherent(NULL, size + bytes_align,
1375 buf->vaddr, (buf->paddr - buf->offset)); 1376 buf->vaddr, (buf->paddr - buf->offset));
1376 return; 1377 return;
1377} 1378}
@@ -1411,7 +1412,7 @@ static ssize_t show_monitor(struct device *device,
1411 return diu_ops.show_monitor_port(machine_data->monitor_port, buf); 1412 return diu_ops.show_monitor_port(machine_data->monitor_port, buf);
1412} 1413}
1413 1414
1414static int fsl_diu_probe(struct of_device *ofdev, 1415static int __devinit fsl_diu_probe(struct of_device *ofdev,
1415 const struct of_device_id *match) 1416 const struct of_device_id *match)
1416{ 1417{
1417 struct device_node *np = ofdev->node; 1418 struct device_node *np = ofdev->node;
diff --git a/drivers/video/hgafb.c b/drivers/video/hgafb.c
index fb9e67228543..c18880d9db1f 100644
--- a/drivers/video/hgafb.c
+++ b/drivers/video/hgafb.c
@@ -279,7 +279,7 @@ static void hga_blank(int blank_mode)
279 279
280static int __init hga_card_detect(void) 280static int __init hga_card_detect(void)
281{ 281{
282 int count=0; 282 int count = 0;
283 void __iomem *p, *q; 283 void __iomem *p, *q;
284 unsigned short p_save, q_save; 284 unsigned short p_save, q_save;
285 285
@@ -303,20 +303,18 @@ static int __init hga_card_detect(void)
303 writew(0x55aa, p); if (readw(p) == 0x55aa) count++; 303 writew(0x55aa, p); if (readw(p) == 0x55aa) count++;
304 writew(p_save, p); 304 writew(p_save, p);
305 305
306 if (count != 2) { 306 if (count != 2)
307 return 0; 307 goto error;
308 }
309 308
310 /* Ok, there is definitely a card registering at the correct 309 /* Ok, there is definitely a card registering at the correct
311 * memory location, so now we do an I/O port test. 310 * memory location, so now we do an I/O port test.
312 */ 311 */
313 312
314 if (!test_hga_b(0x66, 0x0f)) { /* cursor low register */ 313 if (!test_hga_b(0x66, 0x0f)) /* cursor low register */
315 return 0; 314 goto error;
316 } 315
317 if (!test_hga_b(0x99, 0x0f)) { /* cursor low register */ 316 if (!test_hga_b(0x99, 0x0f)) /* cursor low register */
318 return 0; 317 goto error;
319 }
320 318
321 /* See if the card is a Hercules, by checking whether the vsync 319 /* See if the card is a Hercules, by checking whether the vsync
322 * bit of the status register is changing. This test lasts for 320 * bit of the status register is changing. This test lasts for
@@ -331,7 +329,7 @@ static int __init hga_card_detect(void)
331 } 329 }
332 330
333 if (p_save == q_save) 331 if (p_save == q_save)
334 return 0; 332 goto error;
335 333
336 switch (inb_p(HGA_STATUS_PORT) & 0x70) { 334 switch (inb_p(HGA_STATUS_PORT) & 0x70) {
337 case 0x10: 335 case 0x10:
@@ -348,6 +346,12 @@ static int __init hga_card_detect(void)
348 break; 346 break;
349 } 347 }
350 return 1; 348 return 1;
349error:
350 if (release_io_ports)
351 release_region(0x3b0, 12);
352 if (release_io_port)
353 release_region(0x3bf, 1);
354 return 0;
351} 355}
352 356
353/** 357/**
diff --git a/drivers/video/leo.c b/drivers/video/leo.c
index 8bc46e930340..13fea61d6ae4 100644
--- a/drivers/video/leo.c
+++ b/drivers/video/leo.c
@@ -17,8 +17,8 @@
17#include <linux/fb.h> 17#include <linux/fb.h>
18#include <linux/mm.h> 18#include <linux/mm.h>
19#include <linux/of_device.h> 19#include <linux/of_device.h>
20#include <linux/io.h>
20 21
21#include <asm/io.h>
22#include <asm/fbio.h> 22#include <asm/fbio.h>
23 23
24#include "sbuslib.h" 24#include "sbuslib.h"
@@ -33,7 +33,6 @@ static int leo_blank(int, struct fb_info *);
33 33
34static int leo_mmap(struct fb_info *, struct vm_area_struct *); 34static int leo_mmap(struct fb_info *, struct vm_area_struct *);
35static int leo_ioctl(struct fb_info *, unsigned int, unsigned long); 35static int leo_ioctl(struct fb_info *, unsigned int, unsigned long);
36static int leo_pan_display(struct fb_var_screeninfo *, struct fb_info *);
37 36
38/* 37/*
39 * Frame buffer operations 38 * Frame buffer operations
@@ -43,7 +42,6 @@ static struct fb_ops leo_ops = {
43 .owner = THIS_MODULE, 42 .owner = THIS_MODULE,
44 .fb_setcolreg = leo_setcolreg, 43 .fb_setcolreg = leo_setcolreg,
45 .fb_blank = leo_blank, 44 .fb_blank = leo_blank,
46 .fb_pan_display = leo_pan_display,
47 .fb_fillrect = cfb_fillrect, 45 .fb_fillrect = cfb_fillrect,
48 .fb_copyarea = cfb_copyarea, 46 .fb_copyarea = cfb_copyarea,
49 .fb_imageblit = cfb_imageblit, 47 .fb_imageblit = cfb_imageblit,
@@ -78,7 +76,7 @@ static struct fb_ops leo_ops = {
78#define LEO_CUR_TYPE_CMAP 0x00000050 76#define LEO_CUR_TYPE_CMAP 0x00000050
79 77
80struct leo_cursor { 78struct leo_cursor {
81 u8 xxx0[16]; 79 u8 xxx0[16];
82 u32 cur_type; 80 u32 cur_type;
83 u32 cur_misc; 81 u32 cur_misc;
84 u32 cur_cursxy; 82 u32 cur_cursxy;
@@ -105,7 +103,7 @@ struct leo_lx_krn {
105 103
106struct leo_lc_ss0_krn { 104struct leo_lc_ss0_krn {
107 u32 misc; 105 u32 misc;
108 u8 xxx0[0x800-4]; 106 u8 xxx0[0x800-4];
109 u32 rev; 107 u32 rev;
110}; 108};
111 109
@@ -116,7 +114,7 @@ struct leo_lc_ss0_usr {
116 u32 fontt; 114 u32 fontt;
117 u32 extent; 115 u32 extent;
118 u32 src; 116 u32 src;
119 u32 dst; 117 u32 dst;
120 u32 copy; 118 u32 copy;
121 u32 fill; 119 u32 fill;
122}; 120};
@@ -129,8 +127,8 @@ struct leo_lc_ss1_usr {
129 u8 unknown; 127 u8 unknown;
130}; 128};
131 129
132struct leo_ld { 130struct leo_ld_ss0 {
133 u8 xxx0[0xe00]; 131 u8 xxx0[0xe00];
134 u32 csr; 132 u32 csr;
135 u32 wid; 133 u32 wid;
136 u32 wmask; 134 u32 wmask;
@@ -144,13 +142,13 @@ struct leo_ld {
144 u32 src; /* Copy/Scroll (SS0 only) */ 142 u32 src; /* Copy/Scroll (SS0 only) */
145 u32 dst; /* Copy/Scroll/Fill (SS0 only) */ 143 u32 dst; /* Copy/Scroll/Fill (SS0 only) */
146 u32 extent; /* Copy/Scroll/Fill size (SS0 only) */ 144 u32 extent; /* Copy/Scroll/Fill size (SS0 only) */
147 u32 xxx1[3]; 145 u32 xxx1[3];
148 u32 setsem; /* SS1 only */ 146 u32 setsem; /* SS1 only */
149 u32 clrsem; /* SS1 only */ 147 u32 clrsem; /* SS1 only */
150 u32 clrpick; /* SS1 only */ 148 u32 clrpick; /* SS1 only */
151 u32 clrdat; /* SS1 only */ 149 u32 clrdat; /* SS1 only */
152 u32 alpha; /* SS1 only */ 150 u32 alpha; /* SS1 only */
153 u8 xxx2[0x2c]; 151 u8 xxx2[0x2c];
154 u32 winbg; 152 u32 winbg;
155 u32 planemask; 153 u32 planemask;
156 u32 rop; 154 u32 rop;
@@ -199,11 +197,12 @@ struct leo_par {
199static void leo_wait(struct leo_lx_krn __iomem *lx_krn) 197static void leo_wait(struct leo_lx_krn __iomem *lx_krn)
200{ 198{
201 int i; 199 int i;
202 200
203 for (i = 0; 201 for (i = 0;
204 (sbus_readl(&lx_krn->krn_csr) & LEO_KRN_CSR_PROGRESS) && i < 300000; 202 (sbus_readl(&lx_krn->krn_csr) & LEO_KRN_CSR_PROGRESS) &&
203 i < 300000;
205 i++) 204 i++)
206 udelay (1); /* Busy wait at most 0.3 sec */ 205 udelay(1); /* Busy wait at most 0.3 sec */
207 return; 206 return;
208} 207}
209 208
@@ -221,7 +220,7 @@ static int leo_setcolreg(unsigned regno,
221 unsigned transp, struct fb_info *info) 220 unsigned transp, struct fb_info *info)
222{ 221{
223 struct leo_par *par = (struct leo_par *) info->par; 222 struct leo_par *par = (struct leo_par *) info->par;
224 struct leo_lx_krn __iomem *lx_krn = par->lx_krn; 223 struct leo_lx_krn __iomem *lx_krn = par->lx_krn;
225 unsigned long flags; 224 unsigned long flags;
226 u32 val; 225 u32 val;
227 int i; 226 int i;
@@ -408,7 +407,7 @@ static void leo_wid_put(struct fb_info *info, struct fb_wid_list *wl)
408 leo_wait(lx_krn); 407 leo_wait(lx_krn);
409 408
410 for (i = 0, wi = wl->wl_list; i < wl->wl_count; i++, wi++) { 409 for (i = 0, wi = wl->wl_list; i < wl->wl_count; i++, wi++) {
411 switch(wi->wi_type) { 410 switch (wi->wi_type) {
412 case FB_WID_DBL_8: 411 case FB_WID_DBL_8:
413 j = (wi->wi_index & 0xf) + 0x40; 412 j = (wi->wi_index & 0xf) + 0x40;
414 break; 413 break;
@@ -453,13 +452,12 @@ static void leo_init_wids(struct fb_info *info)
453 wi.wi_index = 1; 452 wi.wi_index = 1;
454 wi.wi_values [0] = 0x30; 453 wi.wi_values [0] = 0x30;
455 leo_wid_put(info, &wl); 454 leo_wid_put(info, &wl);
456
457} 455}
458 456
459static void leo_switch_from_graph(struct fb_info *info) 457static void leo_switch_from_graph(struct fb_info *info)
460{ 458{
461 struct leo_par *par = (struct leo_par *) info->par; 459 struct leo_par *par = (struct leo_par *) info->par;
462 struct leo_ld __iomem *ss = (struct leo_ld __iomem *) par->ld_ss0; 460 struct leo_ld_ss0 __iomem *ss = par->ld_ss0;
463 unsigned long flags; 461 unsigned long flags;
464 u32 val; 462 u32 val;
465 463
@@ -485,19 +483,13 @@ static void leo_switch_from_graph(struct fb_info *info)
485 val = sbus_readl(&par->lc_ss0_usr->csr); 483 val = sbus_readl(&par->lc_ss0_usr->csr);
486 } while (val & 0x20000000); 484 } while (val & 0x20000000);
487 485
488 spin_unlock_irqrestore(&par->lock, flags); 486 /* setup screen buffer for cfb_* functions */
489} 487 sbus_writel(1, &ss->wid);
490 488 sbus_writel(0x00ffffff, &ss->planemask);
491static int leo_pan_display(struct fb_var_screeninfo *var, struct fb_info *info) 489 sbus_writel(0x310b90, &ss->rop);
492{ 490 sbus_writel(0, &par->lc_ss0_usr->addrspace);
493 /* We just use this to catch switches out of
494 * graphics mode.
495 */
496 leo_switch_from_graph(info);
497 491
498 if (var->xoffset || var->yoffset || var->vmode) 492 spin_unlock_irqrestore(&par->lock, flags);
499 return -EINVAL;
500 return 0;
501} 493}
502 494
503static void leo_init_hw(struct fb_info *info) 495static void leo_init_hw(struct fb_info *info)
@@ -542,7 +534,8 @@ static void leo_unmap_regs(struct of_device *op, struct fb_info *info,
542 of_iounmap(&op->resource[0], info->screen_base, 0x800000); 534 of_iounmap(&op->resource[0], info->screen_base, 0x800000);
543} 535}
544 536
545static int __devinit leo_probe(struct of_device *op, const struct of_device_id *match) 537static int __devinit leo_probe(struct of_device *op,
538 const struct of_device_id *match)
546{ 539{
547 struct device_node *dp = op->node; 540 struct device_node *dp = op->node;
548 struct fb_info *info; 541 struct fb_info *info;
@@ -594,8 +587,9 @@ static int __devinit leo_probe(struct of_device *op, const struct of_device_id *
594 !info->screen_base) 587 !info->screen_base)
595 goto out_unmap_regs; 588 goto out_unmap_regs;
596 589
597 info->flags = FBINFO_DEFAULT | FBINFO_HWACCEL_YPAN; 590 info->flags = FBINFO_DEFAULT;
598 info->fbops = &leo_ops; 591 info->fbops = &leo_ops;
592 info->pseudo_palette = par->clut_data;
599 593
600 leo_init_wids(info); 594 leo_init_wids(info);
601 leo_init_hw(info); 595 leo_init_hw(info);
@@ -649,7 +643,7 @@ static int __devexit leo_remove(struct of_device *op)
649 643
650static struct of_device_id leo_match[] = { 644static struct of_device_id leo_match[] = {
651 { 645 {
652 .name = "leo", 646 .name = "SUNW,leo",
653 }, 647 },
654 {}, 648 {},
655}; 649};
diff --git a/drivers/video/matrox/matroxfb_base.h b/drivers/video/matrox/matroxfb_base.h
index f3107ad7e545..95883236c0cd 100644
--- a/drivers/video/matrox/matroxfb_base.h
+++ b/drivers/video/matrox/matroxfb_base.h
@@ -200,7 +200,7 @@ static inline int mga_ioremap(unsigned long phys, unsigned long size, int flags,
200 virt->vaddr = ioremap_nocache(phys, size); 200 virt->vaddr = ioremap_nocache(phys, size);
201 else 201 else
202 virt->vaddr = ioremap(phys, size); 202 virt->vaddr = ioremap(phys, size);
203 return (virt->vaddr == 0); /* 0, !0... 0, error_code in future */ 203 return (virt->vaddr == NULL); /* 0, !0... 0, error_code in future */
204} 204}
205 205
206static inline void mga_iounmap(vaddr_t va) { 206static inline void mga_iounmap(vaddr_t va) {
diff --git a/drivers/video/modedb.c b/drivers/video/modedb.c
index 473562191586..d3c3af53a290 100644
--- a/drivers/video/modedb.c
+++ b/drivers/video/modedb.c
@@ -28,6 +28,7 @@
28#endif 28#endif
29 29
30const char *fb_mode_option; 30const char *fb_mode_option;
31EXPORT_SYMBOL_GPL(fb_mode_option);
31 32
32 /* 33 /*
33 * Standard video mode definitions (taken from XFree86) 34 * Standard video mode definitions (taken from XFree86)
@@ -590,6 +591,7 @@ done:
590 "", (margins) ? " with margins" : "", (interlace) ? 591 "", (margins) ? " with margins" : "", (interlace) ?
591 " interlaced" : ""); 592 " interlaced" : "");
592 593
594 memset(&cvt_mode, 0, sizeof(cvt_mode));
593 cvt_mode.xres = xres; 595 cvt_mode.xres = xres;
594 cvt_mode.yres = yres; 596 cvt_mode.yres = yres;
595 cvt_mode.refresh = (refresh) ? refresh : 60; 597 cvt_mode.refresh = (refresh) ? refresh : 60;
diff --git a/drivers/video/pxafb.c b/drivers/video/pxafb.c
index 3ee314beacc1..fafe7db20d6d 100644
--- a/drivers/video/pxafb.c
+++ b/drivers/video/pxafb.c
@@ -573,8 +573,8 @@ static int setup_frame_dma(struct pxafb_info *fbi, int dma, int pal,
573 dma_desc->fdadr = fbi->dma_buff_phys + dma_desc_off; 573 dma_desc->fdadr = fbi->dma_buff_phys + dma_desc_off;
574 fbi->fdadr[dma] = fbi->dma_buff_phys + dma_desc_off; 574 fbi->fdadr[dma] = fbi->dma_buff_phys + dma_desc_off;
575 } else { 575 } else {
576 pal_desc = &fbi->dma_buff->pal_desc[dma]; 576 pal_desc = &fbi->dma_buff->pal_desc[pal];
577 pal_desc_off = offsetof(struct pxafb_dma_buff, dma_desc[pal]); 577 pal_desc_off = offsetof(struct pxafb_dma_buff, pal_desc[pal]);
578 578
579 pal_desc->fsadr = fbi->dma_buff_phys + pal * PALETTE_SIZE; 579 pal_desc->fsadr = fbi->dma_buff_phys + pal * PALETTE_SIZE;
580 pal_desc->fidr = 0; 580 pal_desc->fidr = 0;
@@ -1246,7 +1246,7 @@ static int pxafb_resume(struct platform_device *dev)
1246 * cache. Once this area is remapped, all virtual memory 1246 * cache. Once this area is remapped, all virtual memory
1247 * access to the video memory should occur at the new region. 1247 * access to the video memory should occur at the new region.
1248 */ 1248 */
1249static int __init pxafb_map_video_memory(struct pxafb_info *fbi) 1249static int __devinit pxafb_map_video_memory(struct pxafb_info *fbi)
1250{ 1250{
1251 /* 1251 /*
1252 * We reserve one page for the palette, plus the size 1252 * We reserve one page for the palette, plus the size
@@ -1276,6 +1276,8 @@ static int __init pxafb_map_video_memory(struct pxafb_info *fbi)
1276 fbi->dma_buff_phys = fbi->map_dma; 1276 fbi->dma_buff_phys = fbi->map_dma;
1277 fbi->palette_cpu = (u16 *) fbi->dma_buff->palette; 1277 fbi->palette_cpu = (u16 *) fbi->dma_buff->palette;
1278 1278
1279 pr_debug("pxafb: palette_mem_size = 0x%08lx\n", fbi->palette_size*sizeof(u16));
1280
1279#ifdef CONFIG_FB_PXA_SMARTPANEL 1281#ifdef CONFIG_FB_PXA_SMARTPANEL
1280 fbi->smart_cmds = (uint16_t *) fbi->dma_buff->cmd_buff; 1282 fbi->smart_cmds = (uint16_t *) fbi->dma_buff->cmd_buff;
1281 fbi->n_smart_cmds = 0; 1283 fbi->n_smart_cmds = 0;
@@ -1346,12 +1348,11 @@ decode_mode:
1346 pxafb_decode_mode_info(fbi, inf->modes, inf->num_modes); 1348 pxafb_decode_mode_info(fbi, inf->modes, inf->num_modes);
1347} 1349}
1348 1350
1349static struct pxafb_info * __init pxafb_init_fbinfo(struct device *dev) 1351static struct pxafb_info * __devinit pxafb_init_fbinfo(struct device *dev)
1350{ 1352{
1351 struct pxafb_info *fbi; 1353 struct pxafb_info *fbi;
1352 void *addr; 1354 void *addr;
1353 struct pxafb_mach_info *inf = dev->platform_data; 1355 struct pxafb_mach_info *inf = dev->platform_data;
1354 struct pxafb_mode_info *mode = inf->modes;
1355 1356
1356 /* Alloc the pxafb_info and pseudo_palette in one step */ 1357 /* Alloc the pxafb_info and pseudo_palette in one step */
1357 fbi = kmalloc(sizeof(struct pxafb_info) + sizeof(u32) * 16, GFP_KERNEL); 1358 fbi = kmalloc(sizeof(struct pxafb_info) + sizeof(u32) * 16, GFP_KERNEL);
@@ -1409,7 +1410,7 @@ static struct pxafb_info * __init pxafb_init_fbinfo(struct device *dev)
1409} 1410}
1410 1411
1411#ifdef CONFIG_FB_PXA_PARAMETERS 1412#ifdef CONFIG_FB_PXA_PARAMETERS
1412static int __init parse_opt_mode(struct device *dev, const char *this_opt) 1413static int __devinit parse_opt_mode(struct device *dev, const char *this_opt)
1413{ 1414{
1414 struct pxafb_mach_info *inf = dev->platform_data; 1415 struct pxafb_mach_info *inf = dev->platform_data;
1415 1416
@@ -1468,7 +1469,7 @@ done:
1468 return 0; 1469 return 0;
1469} 1470}
1470 1471
1471static int __init parse_opt(struct device *dev, char *this_opt) 1472static int __devinit parse_opt(struct device *dev, char *this_opt)
1472{ 1473{
1473 struct pxafb_mach_info *inf = dev->platform_data; 1474 struct pxafb_mach_info *inf = dev->platform_data;
1474 struct pxafb_mode_info *mode = &inf->modes[0]; 1475 struct pxafb_mode_info *mode = &inf->modes[0];
@@ -1566,7 +1567,7 @@ static int __init parse_opt(struct device *dev, char *this_opt)
1566 return 0; 1567 return 0;
1567} 1568}
1568 1569
1569static int __init pxafb_parse_options(struct device *dev, char *options) 1570static int __devinit pxafb_parse_options(struct device *dev, char *options)
1570{ 1571{
1571 char *this_opt; 1572 char *this_opt;
1572 int ret; 1573 int ret;
@@ -1587,8 +1588,8 @@ static int __init pxafb_parse_options(struct device *dev, char *options)
1587 1588
1588static char g_options[256] __devinitdata = ""; 1589static char g_options[256] __devinitdata = "";
1589 1590
1590#ifndef CONFIG_MODULES 1591#ifndef MODULE
1591static int __devinit pxafb_setup_options(void) 1592static int __init pxafb_setup_options(void)
1592{ 1593{
1593 char *options = NULL; 1594 char *options = NULL;
1594 1595
@@ -1612,7 +1613,7 @@ MODULE_PARM_DESC(options, "LCD parameters (see Documentation/fb/pxafb.txt)");
1612#define pxafb_setup_options() (0) 1613#define pxafb_setup_options() (0)
1613#endif 1614#endif
1614 1615
1615static int __init pxafb_probe(struct platform_device *dev) 1616static int __devinit pxafb_probe(struct platform_device *dev)
1616{ 1617{
1617 struct pxafb_info *fbi; 1618 struct pxafb_info *fbi;
1618 struct pxafb_mach_info *inf; 1619 struct pxafb_mach_info *inf;
@@ -1684,14 +1685,14 @@ static int __init pxafb_probe(struct platform_device *dev)
1684 if (r == NULL) { 1685 if (r == NULL) {
1685 dev_err(&dev->dev, "no I/O memory resource defined\n"); 1686 dev_err(&dev->dev, "no I/O memory resource defined\n");
1686 ret = -ENODEV; 1687 ret = -ENODEV;
1687 goto failed; 1688 goto failed_fbi;
1688 } 1689 }
1689 1690
1690 r = request_mem_region(r->start, r->end - r->start + 1, dev->name); 1691 r = request_mem_region(r->start, r->end - r->start + 1, dev->name);
1691 if (r == NULL) { 1692 if (r == NULL) {
1692 dev_err(&dev->dev, "failed to request I/O memory\n"); 1693 dev_err(&dev->dev, "failed to request I/O memory\n");
1693 ret = -EBUSY; 1694 ret = -EBUSY;
1694 goto failed; 1695 goto failed_fbi;
1695 } 1696 }
1696 1697
1697 fbi->mmio_base = ioremap(r->start, r->end - r->start + 1); 1698 fbi->mmio_base = ioremap(r->start, r->end - r->start + 1);
@@ -1734,8 +1735,17 @@ static int __init pxafb_probe(struct platform_device *dev)
1734 * This makes sure that our colour bitfield 1735 * This makes sure that our colour bitfield
1735 * descriptors are correctly initialised. 1736 * descriptors are correctly initialised.
1736 */ 1737 */
1737 pxafb_check_var(&fbi->fb.var, &fbi->fb); 1738 ret = pxafb_check_var(&fbi->fb.var, &fbi->fb);
1738 pxafb_set_par(&fbi->fb); 1739 if (ret) {
1740 dev_err(&dev->dev, "failed to get suitable mode\n");
1741 goto failed_free_irq;
1742 }
1743
1744 ret = pxafb_set_par(&fbi->fb);
1745 if (ret) {
1746 dev_err(&dev->dev, "Failed to set parameters\n");
1747 goto failed_free_irq;
1748 }
1739 1749
1740 platform_set_drvdata(dev, fbi); 1750 platform_set_drvdata(dev, fbi);
1741 1751
@@ -1743,7 +1753,7 @@ static int __init pxafb_probe(struct platform_device *dev)
1743 if (ret < 0) { 1753 if (ret < 0) {
1744 dev_err(&dev->dev, 1754 dev_err(&dev->dev,
1745 "Failed to register framebuffer device: %d\n", ret); 1755 "Failed to register framebuffer device: %d\n", ret);
1746 goto failed_free_irq; 1756 goto failed_free_cmap;
1747 } 1757 }
1748 1758
1749#ifdef CONFIG_CPU_FREQ 1759#ifdef CONFIG_CPU_FREQ
@@ -1762,18 +1772,23 @@ static int __init pxafb_probe(struct platform_device *dev)
1762 1772
1763 return 0; 1773 return 0;
1764 1774
1775failed_free_cmap:
1776 if (fbi->fb.cmap.len)
1777 fb_dealloc_cmap(&fbi->fb.cmap);
1765failed_free_irq: 1778failed_free_irq:
1766 free_irq(irq, fbi); 1779 free_irq(irq, fbi);
1767failed_free_res:
1768 release_mem_region(r->start, r->end - r->start + 1);
1769failed_free_io:
1770 iounmap(fbi->mmio_base);
1771failed_free_mem: 1780failed_free_mem:
1772 dma_free_writecombine(&dev->dev, fbi->map_size, 1781 dma_free_writecombine(&dev->dev, fbi->map_size,
1773 fbi->map_cpu, fbi->map_dma); 1782 fbi->map_cpu, fbi->map_dma);
1774failed: 1783failed_free_io:
1784 iounmap(fbi->mmio_base);
1785failed_free_res:
1786 release_mem_region(r->start, r->end - r->start + 1);
1787failed_fbi:
1788 clk_put(fbi->clk);
1775 platform_set_drvdata(dev, NULL); 1789 platform_set_drvdata(dev, NULL);
1776 kfree(fbi); 1790 kfree(fbi);
1791failed:
1777 return ret; 1792 return ret;
1778} 1793}
1779 1794
@@ -1786,7 +1801,7 @@ static struct platform_driver pxafb_driver = {
1786 }, 1801 },
1787}; 1802};
1788 1803
1789static int __devinit pxafb_init(void) 1804static int __init pxafb_init(void)
1790{ 1805{
1791 if (pxafb_setup_options()) 1806 if (pxafb_setup_options())
1792 return -EINVAL; 1807 return -EINVAL;
diff --git a/drivers/video/s3c2410fb.c b/drivers/video/s3c2410fb.c
index 13b38cbbe4cf..f0598961c6b0 100644
--- a/drivers/video/s3c2410fb.c
+++ b/drivers/video/s3c2410fb.c
@@ -1,75 +1,15 @@
1/* 1/* linux/drivers/video/s3c2410fb.c
2 * linux/drivers/video/s3c2410fb.c 2 * Copyright (c) 2004,2005 Arnaud Patard
3 * Copyright (c) Arnaud Patard, Ben Dooks 3 * Copyright (c) 2004-2008 Ben Dooks
4 *
5 * S3C2410 LCD Framebuffer Driver
4 * 6 *
5 * This file is subject to the terms and conditions of the GNU General Public 7 * This file is subject to the terms and conditions of the GNU General Public
6 * License. See the file COPYING in the main directory of this archive for 8 * License. See the file COPYING in the main directory of this archive for
7 * more details. 9 * more details.
8 * 10 *
9 * S3C2410 LCD Controller Frame Buffer Driver 11 * Driver based on skeletonfb.c, sa1100fb.c and others.
10 * based on skeletonfb.c, sa1100fb.c and others 12*/
11 *
12 * ChangeLog
13 * 2005-04-07: Arnaud Patard <arnaud.patard@rtp-net.org>
14 * - u32 state -> pm_message_t state
15 * - S3C2410_{VA,SZ}_LCD -> S3C24XX
16 *
17 * 2005-03-15: Arnaud Patard <arnaud.patard@rtp-net.org>
18 * - Removed the ioctl
19 * - use readl/writel instead of __raw_writel/__raw_readl
20 *
21 * 2004-12-04: Arnaud Patard <arnaud.patard@rtp-net.org>
22 * - Added the possibility to set on or off the
23 * debugging messages
24 * - Replaced 0 and 1 by on or off when reading the
25 * /sys files
26 *
27 * 2005-03-23: Ben Dooks <ben-linux@fluff.org>
28 * - added non 16bpp modes
29 * - updated platform information for range of x/y/bpp
30 * - add code to ensure palette is written correctly
31 * - add pixel clock divisor control
32 *
33 * 2004-11-11: Arnaud Patard <arnaud.patard@rtp-net.org>
34 * - Removed the use of currcon as it no more exists
35 * - Added LCD power sysfs interface
36 *
37 * 2004-11-03: Ben Dooks <ben-linux@fluff.org>
38 * - minor cleanups
39 * - add suspend/resume support
40 * - s3c2410fb_setcolreg() not valid in >8bpp modes
41 * - removed last CONFIG_FB_S3C2410_FIXED
42 * - ensure lcd controller stopped before cleanup
43 * - added sysfs interface for backlight power
44 * - added mask for gpio configuration
45 * - ensured IRQs disabled during GPIO configuration
46 * - disable TPAL before enabling video
47 *
48 * 2004-09-20: Arnaud Patard <arnaud.patard@rtp-net.org>
49 * - Suppress command line options
50 *
51 * 2004-09-15: Arnaud Patard <arnaud.patard@rtp-net.org>
52 * - code cleanup
53 *
54 * 2004-09-07: Arnaud Patard <arnaud.patard@rtp-net.org>
55 * - Renamed from h1940fb.c to s3c2410fb.c
56 * - Add support for different devices
57 * - Backlight support
58 *
59 * 2004-09-05: Herbert Pötzl <herbert@13thfloor.at>
60 * - added clock (de-)allocation code
61 * - added fixem fbmem option
62 *
63 * 2004-07-27: Arnaud Patard <arnaud.patard@rtp-net.org>
64 * - code cleanup
65 * - added a forgotten return in h1940fb_init
66 *
67 * 2004-07-19: Herbert Pötzl <herbert@13thfloor.at>
68 * - code cleanup and extended debugging
69 *
70 * 2004-07-15: Arnaud Patard <arnaud.patard@rtp-net.org>
71 * - First version
72 */
73 13
74#include <linux/module.h> 14#include <linux/module.h>
75#include <linux/kernel.h> 15#include <linux/kernel.h>
@@ -580,6 +520,27 @@ static int s3c2410fb_setcolreg(unsigned regno,
580 return 0; 520 return 0;
581} 521}
582 522
523/* s3c2410fb_lcd_enable
524 *
525 * shutdown the lcd controller
526 */
527static void s3c2410fb_lcd_enable(struct s3c2410fb_info *fbi, int enable)
528{
529 unsigned long flags;
530
531 local_irq_save(flags);
532
533 if (enable)
534 fbi->regs.lcdcon1 |= S3C2410_LCDCON1_ENVID;
535 else
536 fbi->regs.lcdcon1 &= ~S3C2410_LCDCON1_ENVID;
537
538 writel(fbi->regs.lcdcon1, fbi->io + S3C2410_LCDCON1);
539
540 local_irq_restore(flags);
541}
542
543
583/* 544/*
584 * s3c2410fb_blank 545 * s3c2410fb_blank
585 * @blank_mode: the blank mode we want. 546 * @blank_mode: the blank mode we want.
@@ -589,9 +550,6 @@ static int s3c2410fb_setcolreg(unsigned regno,
589 * blanking succeeded, != 0 if un-/blanking failed due to e.g. a 550 * blanking succeeded, != 0 if un-/blanking failed due to e.g. a
590 * video mode which doesn't support it. Implements VESA suspend 551 * video mode which doesn't support it. Implements VESA suspend
591 * and powerdown modes on hardware that supports disabling hsync/vsync: 552 * and powerdown modes on hardware that supports disabling hsync/vsync:
592 * blank_mode == 2: suspend vsync
593 * blank_mode == 3: suspend hsync
594 * blank_mode == 4: powerdown
595 * 553 *
596 * Returns negative errno on error, or zero on success. 554 * Returns negative errno on error, or zero on success.
597 * 555 *
@@ -605,6 +563,12 @@ static int s3c2410fb_blank(int blank_mode, struct fb_info *info)
605 563
606 tpal_reg += is_s3c2412(fbi) ? S3C2412_TPAL : S3C2410_TPAL; 564 tpal_reg += is_s3c2412(fbi) ? S3C2412_TPAL : S3C2410_TPAL;
607 565
566 if (blank_mode == FB_BLANK_POWERDOWN) {
567 s3c2410fb_lcd_enable(fbi, 0);
568 } else {
569 s3c2410fb_lcd_enable(fbi, 1);
570 }
571
608 if (blank_mode == FB_BLANK_UNBLANK) 572 if (blank_mode == FB_BLANK_UNBLANK)
609 writel(0x0, tpal_reg); 573 writel(0x0, tpal_reg);
610 else { 574 else {
@@ -948,7 +912,10 @@ static int __init s3c24xxfb_probe(struct platform_device *pdev,
948 } 912 }
949 913
950 /* create device files */ 914 /* create device files */
951 device_create_file(&pdev->dev, &dev_attr_debug); 915 ret = device_create_file(&pdev->dev, &dev_attr_debug);
916 if (ret) {
917 printk(KERN_ERR "failed to add debug attribute\n");
918 }
952 919
953 printk(KERN_INFO "fb%d: %s frame buffer device\n", 920 printk(KERN_INFO "fb%d: %s frame buffer device\n",
954 fbinfo->node, fbinfo->fix.id); 921 fbinfo->node, fbinfo->fix.id);
@@ -983,21 +950,6 @@ static int __init s3c2412fb_probe(struct platform_device *pdev)
983 return s3c24xxfb_probe(pdev, DRV_S3C2412); 950 return s3c24xxfb_probe(pdev, DRV_S3C2412);
984} 951}
985 952
986/* s3c2410fb_stop_lcd
987 *
988 * shutdown the lcd controller
989 */
990static void s3c2410fb_stop_lcd(struct s3c2410fb_info *fbi)
991{
992 unsigned long flags;
993
994 local_irq_save(flags);
995
996 fbi->regs.lcdcon1 &= ~S3C2410_LCDCON1_ENVID;
997 writel(fbi->regs.lcdcon1, fbi->io + S3C2410_LCDCON1);
998
999 local_irq_restore(flags);
1000}
1001 953
1002/* 954/*
1003 * Cleanup 955 * Cleanup
@@ -1010,7 +962,7 @@ static int s3c2410fb_remove(struct platform_device *pdev)
1010 962
1011 unregister_framebuffer(fbinfo); 963 unregister_framebuffer(fbinfo);
1012 964
1013 s3c2410fb_stop_lcd(info); 965 s3c2410fb_lcd_enable(info, 0);
1014 msleep(1); 966 msleep(1);
1015 967
1016 s3c2410fb_unmap_video_memory(fbinfo); 968 s3c2410fb_unmap_video_memory(fbinfo);
@@ -1043,7 +995,7 @@ static int s3c2410fb_suspend(struct platform_device *dev, pm_message_t state)
1043 struct fb_info *fbinfo = platform_get_drvdata(dev); 995 struct fb_info *fbinfo = platform_get_drvdata(dev);
1044 struct s3c2410fb_info *info = fbinfo->par; 996 struct s3c2410fb_info *info = fbinfo->par;
1045 997
1046 s3c2410fb_stop_lcd(info); 998 s3c2410fb_lcd_enable(info, 0);
1047 999
1048 /* sleep before disabling the clock, we need to ensure 1000 /* sleep before disabling the clock, we need to ensure
1049 * the LCD DMA engine is not going to get back on the bus 1001 * the LCD DMA engine is not going to get back on the bus
@@ -1118,3 +1070,5 @@ MODULE_AUTHOR("Arnaud Patard <arnaud.patard@rtp-net.org>, "
1118 "Ben Dooks <ben-linux@fluff.org>"); 1070 "Ben Dooks <ben-linux@fluff.org>");
1119MODULE_DESCRIPTION("Framebuffer driver for the s3c2410"); 1071MODULE_DESCRIPTION("Framebuffer driver for the s3c2410");
1120MODULE_LICENSE("GPL"); 1072MODULE_LICENSE("GPL");
1073MODULE_ALIAS("platform:s3c2410-lcd");
1074MODULE_ALIAS("platform:s3c2412-lcd");
diff --git a/drivers/video/s3c2410fb.h b/drivers/video/s3c2410fb.h
index dbb73b95e2ef..9a6ba3e9d1b8 100644
--- a/drivers/video/s3c2410fb.h
+++ b/drivers/video/s3c2410fb.h
@@ -1,26 +1,14 @@
1/* 1/*
2 * linux/drivers/video/s3c2410fb.h 2 * linux/drivers/video/s3c2410fb.h
3 * Copyright (c) Arnaud Patard 3 * Copyright (c) 2004 Arnaud Patard
4 *
5 * S3C2410 LCD Framebuffer Driver
4 * 6 *
5 * This file is subject to the terms and conditions of the GNU General Public 7 * This file is subject to the terms and conditions of the GNU General Public
6 * License. See the file COPYING in the main directory of this archive for 8 * License. See the file COPYING in the main directory of this archive for
7 * more details. 9 * more details.
8 * 10 *
9 * S3C2410 LCD Controller Frame Buffer Driver 11*/
10 * based on skeletonfb.c, sa1100fb.h
11 *
12 * ChangeLog
13 *
14 * 2004-12-04: Arnaud Patard <arnaud.patard@rtp-net.org>
15 * - Moved dprintk to s3c2410fb.c
16 *
17 * 2004-09-07: Arnaud Patard <arnaud.patard@rtp-net.org>
18 * - Renamed from h1940fb.h to s3c2410fb.h
19 * - Changed h1940 to s3c2410
20 *
21 * 2004-07-15: Arnaud Patard <arnaud.patard@rtp-net.org>
22 * - First version
23 */
24 12
25#ifndef __S3C2410FB_H 13#ifndef __S3C2410FB_H
26#define __S3C2410FB_H 14#define __S3C2410FB_H
diff --git a/drivers/video/sis/sis_main.c b/drivers/video/sis/sis_main.c
index 73803624c131..b9343844cd1f 100644
--- a/drivers/video/sis/sis_main.c
+++ b/drivers/video/sis/sis_main.c
@@ -5787,7 +5787,7 @@ sisfb_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
5787 } else { 5787 } else {
5788 struct sis_video_info *countvideo = card_list; 5788 struct sis_video_info *countvideo = card_list;
5789 ivideo->cardnumber = 1; 5789 ivideo->cardnumber = 1;
5790 while((countvideo = countvideo->next) != 0) 5790 while((countvideo = countvideo->next) != NULL)
5791 ivideo->cardnumber++; 5791 ivideo->cardnumber++;
5792 } 5792 }
5793 5793
diff --git a/drivers/video/sm501fb.c b/drivers/video/sm501fb.c
index 742b5c656d66..15d4a768b1f6 100644
--- a/drivers/video/sm501fb.c
+++ b/drivers/video/sm501fb.c
@@ -663,14 +663,14 @@ static void sm501fb_panel_power(struct sm501fb_info *fbi, int to)
663 sm501fb_sync_regs(fbi); 663 sm501fb_sync_regs(fbi);
664 mdelay(10); 664 mdelay(10);
665 665
666 if (pd->flags & SM501FB_FLAG_PANEL_USE_VBIASEN) { 666 if (!(pd->flags & SM501FB_FLAG_PANEL_NO_VBIASEN)) {
667 control |= SM501_DC_PANEL_CONTROL_BIAS; /* VBIASEN */ 667 control |= SM501_DC_PANEL_CONTROL_BIAS; /* VBIASEN */
668 writel(control, ctrl_reg); 668 writel(control, ctrl_reg);
669 sm501fb_sync_regs(fbi); 669 sm501fb_sync_regs(fbi);
670 mdelay(10); 670 mdelay(10);
671 } 671 }
672 672
673 if (pd->flags & SM501FB_FLAG_PANEL_USE_FPEN) { 673 if (!(pd->flags & SM501FB_FLAG_PANEL_NO_FPEN)) {
674 control |= SM501_DC_PANEL_CONTROL_FPEN; 674 control |= SM501_DC_PANEL_CONTROL_FPEN;
675 writel(control, ctrl_reg); 675 writel(control, ctrl_reg);
676 sm501fb_sync_regs(fbi); 676 sm501fb_sync_regs(fbi);
@@ -678,14 +678,14 @@ static void sm501fb_panel_power(struct sm501fb_info *fbi, int to)
678 } 678 }
679 } else if (!to && (control & SM501_DC_PANEL_CONTROL_VDD) != 0) { 679 } else if (!to && (control & SM501_DC_PANEL_CONTROL_VDD) != 0) {
680 /* disable panel power */ 680 /* disable panel power */
681 if (pd->flags & SM501FB_FLAG_PANEL_USE_FPEN) { 681 if (!(pd->flags & SM501FB_FLAG_PANEL_NO_FPEN)) {
682 control &= ~SM501_DC_PANEL_CONTROL_FPEN; 682 control &= ~SM501_DC_PANEL_CONTROL_FPEN;
683 writel(control, ctrl_reg); 683 writel(control, ctrl_reg);
684 sm501fb_sync_regs(fbi); 684 sm501fb_sync_regs(fbi);
685 mdelay(10); 685 mdelay(10);
686 } 686 }
687 687
688 if (pd->flags & SM501FB_FLAG_PANEL_USE_VBIASEN) { 688 if (!(pd->flags & SM501FB_FLAG_PANEL_NO_VBIASEN)) {
689 control &= ~SM501_DC_PANEL_CONTROL_BIAS; 689 control &= ~SM501_DC_PANEL_CONTROL_BIAS;
690 writel(control, ctrl_reg); 690 writel(control, ctrl_reg);
691 sm501fb_sync_regs(fbi); 691 sm501fb_sync_regs(fbi);
diff --git a/drivers/video/w100fb.c b/drivers/video/w100fb.c
index 30469bf906e5..d0674f1e3f10 100644
--- a/drivers/video/w100fb.c
+++ b/drivers/video/w100fb.c
@@ -1003,6 +1003,7 @@ static struct w100_pll_info xtal_14318000[] = {
1003static struct w100_pll_info xtal_16000000[] = { 1003static struct w100_pll_info xtal_16000000[] = {
1004 /*freq M N_int N_fac tfgoal lock_time */ 1004 /*freq M N_int N_fac tfgoal lock_time */
1005 { 72, 1, 8, 0, 0xe0, 48}, /* tfgoal guessed */ 1005 { 72, 1, 8, 0, 0xe0, 48}, /* tfgoal guessed */
1006 { 80, 1, 9, 0, 0xe0, 13}, /* tfgoal guessed */
1006 { 95, 1, 10, 7, 0xe0, 38}, /* tfgoal guessed */ 1007 { 95, 1, 10, 7, 0xe0, 38}, /* tfgoal guessed */
1007 { 96, 1, 11, 0, 0xe0, 36}, /* tfgoal guessed */ 1008 { 96, 1, 11, 0, 0xe0, 36}, /* tfgoal guessed */
1008 { 0, 0, 0, 0, 0, 0}, 1009 { 0, 0, 0, 0, 0, 0},
diff --git a/drivers/video/xen-fbfront.c b/drivers/video/xen-fbfront.c
index 619a6f8d65a2..47ed39b52f9c 100644
--- a/drivers/video/xen-fbfront.c
+++ b/drivers/video/xen-fbfront.c
@@ -18,6 +18,7 @@
18 * frame buffer. 18 * frame buffer.
19 */ 19 */
20 20
21#include <linux/console.h>
21#include <linux/kernel.h> 22#include <linux/kernel.h>
22#include <linux/errno.h> 23#include <linux/errno.h>
23#include <linux/fb.h> 24#include <linux/fb.h>
@@ -42,37 +43,68 @@ struct xenfb_info {
42 struct xenfb_page *page; 43 struct xenfb_page *page;
43 unsigned long *mfns; 44 unsigned long *mfns;
44 int update_wanted; /* XENFB_TYPE_UPDATE wanted */ 45 int update_wanted; /* XENFB_TYPE_UPDATE wanted */
46 int feature_resize; /* XENFB_TYPE_RESIZE ok */
47 struct xenfb_resize resize; /* protected by resize_lock */
48 int resize_dpy; /* ditto */
49 spinlock_t resize_lock;
45 50
46 struct xenbus_device *xbdev; 51 struct xenbus_device *xbdev;
47}; 52};
48 53
49static u32 xenfb_mem_len = XENFB_WIDTH * XENFB_HEIGHT * XENFB_DEPTH / 8; 54#define XENFB_DEFAULT_FB_LEN (XENFB_WIDTH * XENFB_HEIGHT * XENFB_DEPTH / 8)
50 55
56enum { KPARAM_MEM, KPARAM_WIDTH, KPARAM_HEIGHT, KPARAM_CNT };
57static int video[KPARAM_CNT] = { 2, XENFB_WIDTH, XENFB_HEIGHT };
58module_param_array(video, int, NULL, 0);
59MODULE_PARM_DESC(video,
60 "Video memory size in MB, width, height in pixels (default 2,800,600)");
61
62static void xenfb_make_preferred_console(void);
51static int xenfb_remove(struct xenbus_device *); 63static int xenfb_remove(struct xenbus_device *);
52static void xenfb_init_shared_page(struct xenfb_info *); 64static void xenfb_init_shared_page(struct xenfb_info *, struct fb_info *);
53static int xenfb_connect_backend(struct xenbus_device *, struct xenfb_info *); 65static int xenfb_connect_backend(struct xenbus_device *, struct xenfb_info *);
54static void xenfb_disconnect_backend(struct xenfb_info *); 66static void xenfb_disconnect_backend(struct xenfb_info *);
55 67
68static void xenfb_send_event(struct xenfb_info *info,
69 union xenfb_out_event *event)
70{
71 u32 prod;
72
73 prod = info->page->out_prod;
74 /* caller ensures !xenfb_queue_full() */
75 mb(); /* ensure ring space available */
76 XENFB_OUT_RING_REF(info->page, prod) = *event;
77 wmb(); /* ensure ring contents visible */
78 info->page->out_prod = prod + 1;
79
80 notify_remote_via_irq(info->irq);
81}
82
56static void xenfb_do_update(struct xenfb_info *info, 83static void xenfb_do_update(struct xenfb_info *info,
57 int x, int y, int w, int h) 84 int x, int y, int w, int h)
58{ 85{
59 union xenfb_out_event event; 86 union xenfb_out_event event;
60 u32 prod;
61 87
88 memset(&event, 0, sizeof(event));
62 event.type = XENFB_TYPE_UPDATE; 89 event.type = XENFB_TYPE_UPDATE;
63 event.update.x = x; 90 event.update.x = x;
64 event.update.y = y; 91 event.update.y = y;
65 event.update.width = w; 92 event.update.width = w;
66 event.update.height = h; 93 event.update.height = h;
67 94
68 prod = info->page->out_prod;
69 /* caller ensures !xenfb_queue_full() */ 95 /* caller ensures !xenfb_queue_full() */
70 mb(); /* ensure ring space available */ 96 xenfb_send_event(info, &event);
71 XENFB_OUT_RING_REF(info->page, prod) = event; 97}
72 wmb(); /* ensure ring contents visible */
73 info->page->out_prod = prod + 1;
74 98
75 notify_remote_via_irq(info->irq); 99static void xenfb_do_resize(struct xenfb_info *info)
100{
101 union xenfb_out_event event;
102
103 memset(&event, 0, sizeof(event));
104 event.resize = info->resize;
105
106 /* caller ensures !xenfb_queue_full() */
107 xenfb_send_event(info, &event);
76} 108}
77 109
78static int xenfb_queue_full(struct xenfb_info *info) 110static int xenfb_queue_full(struct xenfb_info *info)
@@ -84,12 +116,28 @@ static int xenfb_queue_full(struct xenfb_info *info)
84 return prod - cons == XENFB_OUT_RING_LEN; 116 return prod - cons == XENFB_OUT_RING_LEN;
85} 117}
86 118
119static void xenfb_handle_resize_dpy(struct xenfb_info *info)
120{
121 unsigned long flags;
122
123 spin_lock_irqsave(&info->resize_lock, flags);
124 if (info->resize_dpy) {
125 if (!xenfb_queue_full(info)) {
126 info->resize_dpy = 0;
127 xenfb_do_resize(info);
128 }
129 }
130 spin_unlock_irqrestore(&info->resize_lock, flags);
131}
132
87static void xenfb_refresh(struct xenfb_info *info, 133static void xenfb_refresh(struct xenfb_info *info,
88 int x1, int y1, int w, int h) 134 int x1, int y1, int w, int h)
89{ 135{
90 unsigned long flags; 136 unsigned long flags;
91 int y2 = y1 + h - 1;
92 int x2 = x1 + w - 1; 137 int x2 = x1 + w - 1;
138 int y2 = y1 + h - 1;
139
140 xenfb_handle_resize_dpy(info);
93 141
94 if (!info->update_wanted) 142 if (!info->update_wanted)
95 return; 143 return;
@@ -222,6 +270,57 @@ static ssize_t xenfb_write(struct fb_info *p, const char __user *buf,
222 return res; 270 return res;
223} 271}
224 272
273static int
274xenfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
275{
276 struct xenfb_info *xenfb_info;
277 int required_mem_len;
278
279 xenfb_info = info->par;
280
281 if (!xenfb_info->feature_resize) {
282 if (var->xres == video[KPARAM_WIDTH] &&
283 var->yres == video[KPARAM_HEIGHT] &&
284 var->bits_per_pixel == xenfb_info->page->depth) {
285 return 0;
286 }
287 return -EINVAL;
288 }
289
290 /* Can't resize past initial width and height */
291 if (var->xres > video[KPARAM_WIDTH] || var->yres > video[KPARAM_HEIGHT])
292 return -EINVAL;
293
294 required_mem_len = var->xres * var->yres * xenfb_info->page->depth / 8;
295 if (var->bits_per_pixel == xenfb_info->page->depth &&
296 var->xres <= info->fix.line_length / (XENFB_DEPTH / 8) &&
297 required_mem_len <= info->fix.smem_len) {
298 var->xres_virtual = var->xres;
299 var->yres_virtual = var->yres;
300 return 0;
301 }
302 return -EINVAL;
303}
304
305static int xenfb_set_par(struct fb_info *info)
306{
307 struct xenfb_info *xenfb_info;
308 unsigned long flags;
309
310 xenfb_info = info->par;
311
312 spin_lock_irqsave(&xenfb_info->resize_lock, flags);
313 xenfb_info->resize.type = XENFB_TYPE_RESIZE;
314 xenfb_info->resize.width = info->var.xres;
315 xenfb_info->resize.height = info->var.yres;
316 xenfb_info->resize.stride = info->fix.line_length;
317 xenfb_info->resize.depth = info->var.bits_per_pixel;
318 xenfb_info->resize.offset = 0;
319 xenfb_info->resize_dpy = 1;
320 spin_unlock_irqrestore(&xenfb_info->resize_lock, flags);
321 return 0;
322}
323
225static struct fb_ops xenfb_fb_ops = { 324static struct fb_ops xenfb_fb_ops = {
226 .owner = THIS_MODULE, 325 .owner = THIS_MODULE,
227 .fb_read = fb_sys_read, 326 .fb_read = fb_sys_read,
@@ -230,6 +329,8 @@ static struct fb_ops xenfb_fb_ops = {
230 .fb_fillrect = xenfb_fillrect, 329 .fb_fillrect = xenfb_fillrect,
231 .fb_copyarea = xenfb_copyarea, 330 .fb_copyarea = xenfb_copyarea,
232 .fb_imageblit = xenfb_imageblit, 331 .fb_imageblit = xenfb_imageblit,
332 .fb_check_var = xenfb_check_var,
333 .fb_set_par = xenfb_set_par,
233}; 334};
234 335
235static irqreturn_t xenfb_event_handler(int rq, void *dev_id) 336static irqreturn_t xenfb_event_handler(int rq, void *dev_id)
@@ -258,6 +359,8 @@ static int __devinit xenfb_probe(struct xenbus_device *dev,
258{ 359{
259 struct xenfb_info *info; 360 struct xenfb_info *info;
260 struct fb_info *fb_info; 361 struct fb_info *fb_info;
362 int fb_size;
363 int val;
261 int ret; 364 int ret;
262 365
263 info = kzalloc(sizeof(*info), GFP_KERNEL); 366 info = kzalloc(sizeof(*info), GFP_KERNEL);
@@ -265,18 +368,35 @@ static int __devinit xenfb_probe(struct xenbus_device *dev,
265 xenbus_dev_fatal(dev, -ENOMEM, "allocating info structure"); 368 xenbus_dev_fatal(dev, -ENOMEM, "allocating info structure");
266 return -ENOMEM; 369 return -ENOMEM;
267 } 370 }
371
372 /* Limit kernel param videoram amount to what is in xenstore */
373 if (xenbus_scanf(XBT_NIL, dev->otherend, "videoram", "%d", &val) == 1) {
374 if (val < video[KPARAM_MEM])
375 video[KPARAM_MEM] = val;
376 }
377
378 /* If requested res does not fit in available memory, use default */
379 fb_size = video[KPARAM_MEM] * 1024 * 1024;
380 if (video[KPARAM_WIDTH] * video[KPARAM_HEIGHT] * XENFB_DEPTH / 8
381 > fb_size) {
382 video[KPARAM_WIDTH] = XENFB_WIDTH;
383 video[KPARAM_HEIGHT] = XENFB_HEIGHT;
384 fb_size = XENFB_DEFAULT_FB_LEN;
385 }
386
268 dev->dev.driver_data = info; 387 dev->dev.driver_data = info;
269 info->xbdev = dev; 388 info->xbdev = dev;
270 info->irq = -1; 389 info->irq = -1;
271 info->x1 = info->y1 = INT_MAX; 390 info->x1 = info->y1 = INT_MAX;
272 spin_lock_init(&info->dirty_lock); 391 spin_lock_init(&info->dirty_lock);
392 spin_lock_init(&info->resize_lock);
273 393
274 info->fb = vmalloc(xenfb_mem_len); 394 info->fb = vmalloc(fb_size);
275 if (info->fb == NULL) 395 if (info->fb == NULL)
276 goto error_nomem; 396 goto error_nomem;
277 memset(info->fb, 0, xenfb_mem_len); 397 memset(info->fb, 0, fb_size);
278 398
279 info->nr_pages = (xenfb_mem_len + PAGE_SIZE - 1) >> PAGE_SHIFT; 399 info->nr_pages = (fb_size + PAGE_SIZE - 1) >> PAGE_SHIFT;
280 400
281 info->mfns = vmalloc(sizeof(unsigned long) * info->nr_pages); 401 info->mfns = vmalloc(sizeof(unsigned long) * info->nr_pages);
282 if (!info->mfns) 402 if (!info->mfns)
@@ -287,8 +407,6 @@ static int __devinit xenfb_probe(struct xenbus_device *dev,
287 if (!info->page) 407 if (!info->page)
288 goto error_nomem; 408 goto error_nomem;
289 409
290 xenfb_init_shared_page(info);
291
292 /* abusing framebuffer_alloc() to allocate pseudo_palette */ 410 /* abusing framebuffer_alloc() to allocate pseudo_palette */
293 fb_info = framebuffer_alloc(sizeof(u32) * 256, NULL); 411 fb_info = framebuffer_alloc(sizeof(u32) * 256, NULL);
294 if (fb_info == NULL) 412 if (fb_info == NULL)
@@ -301,9 +419,9 @@ static int __devinit xenfb_probe(struct xenbus_device *dev,
301 fb_info->screen_base = info->fb; 419 fb_info->screen_base = info->fb;
302 420
303 fb_info->fbops = &xenfb_fb_ops; 421 fb_info->fbops = &xenfb_fb_ops;
304 fb_info->var.xres_virtual = fb_info->var.xres = info->page->width; 422 fb_info->var.xres_virtual = fb_info->var.xres = video[KPARAM_WIDTH];
305 fb_info->var.yres_virtual = fb_info->var.yres = info->page->height; 423 fb_info->var.yres_virtual = fb_info->var.yres = video[KPARAM_HEIGHT];
306 fb_info->var.bits_per_pixel = info->page->depth; 424 fb_info->var.bits_per_pixel = XENFB_DEPTH;
307 425
308 fb_info->var.red = (struct fb_bitfield){16, 8, 0}; 426 fb_info->var.red = (struct fb_bitfield){16, 8, 0};
309 fb_info->var.green = (struct fb_bitfield){8, 8, 0}; 427 fb_info->var.green = (struct fb_bitfield){8, 8, 0};
@@ -315,9 +433,9 @@ static int __devinit xenfb_probe(struct xenbus_device *dev,
315 fb_info->var.vmode = FB_VMODE_NONINTERLACED; 433 fb_info->var.vmode = FB_VMODE_NONINTERLACED;
316 434
317 fb_info->fix.visual = FB_VISUAL_TRUECOLOR; 435 fb_info->fix.visual = FB_VISUAL_TRUECOLOR;
318 fb_info->fix.line_length = info->page->line_length; 436 fb_info->fix.line_length = fb_info->var.xres * XENFB_DEPTH / 8;
319 fb_info->fix.smem_start = 0; 437 fb_info->fix.smem_start = 0;
320 fb_info->fix.smem_len = xenfb_mem_len; 438 fb_info->fix.smem_len = fb_size;
321 strcpy(fb_info->fix.id, "xen"); 439 strcpy(fb_info->fix.id, "xen");
322 fb_info->fix.type = FB_TYPE_PACKED_PIXELS; 440 fb_info->fix.type = FB_TYPE_PACKED_PIXELS;
323 fb_info->fix.accel = FB_ACCEL_NONE; 441 fb_info->fix.accel = FB_ACCEL_NONE;
@@ -334,6 +452,8 @@ static int __devinit xenfb_probe(struct xenbus_device *dev,
334 fb_info->fbdefio = &xenfb_defio; 452 fb_info->fbdefio = &xenfb_defio;
335 fb_deferred_io_init(fb_info); 453 fb_deferred_io_init(fb_info);
336 454
455 xenfb_init_shared_page(info, fb_info);
456
337 ret = register_framebuffer(fb_info); 457 ret = register_framebuffer(fb_info);
338 if (ret) { 458 if (ret) {
339 fb_deferred_io_cleanup(fb_info); 459 fb_deferred_io_cleanup(fb_info);
@@ -348,6 +468,7 @@ static int __devinit xenfb_probe(struct xenbus_device *dev,
348 if (ret < 0) 468 if (ret < 0)
349 goto error; 469 goto error;
350 470
471 xenfb_make_preferred_console();
351 return 0; 472 return 0;
352 473
353 error_nomem: 474 error_nomem:
@@ -358,12 +479,34 @@ static int __devinit xenfb_probe(struct xenbus_device *dev,
358 return ret; 479 return ret;
359} 480}
360 481
482static __devinit void
483xenfb_make_preferred_console(void)
484{
485 struct console *c;
486
487 if (console_set_on_cmdline)
488 return;
489
490 acquire_console_sem();
491 for (c = console_drivers; c; c = c->next) {
492 if (!strcmp(c->name, "tty") && c->index == 0)
493 break;
494 }
495 release_console_sem();
496 if (c) {
497 unregister_console(c);
498 c->flags |= CON_CONSDEV;
499 c->flags &= ~CON_PRINTBUFFER; /* don't print again */
500 register_console(c);
501 }
502}
503
361static int xenfb_resume(struct xenbus_device *dev) 504static int xenfb_resume(struct xenbus_device *dev)
362{ 505{
363 struct xenfb_info *info = dev->dev.driver_data; 506 struct xenfb_info *info = dev->dev.driver_data;
364 507
365 xenfb_disconnect_backend(info); 508 xenfb_disconnect_backend(info);
366 xenfb_init_shared_page(info); 509 xenfb_init_shared_page(info, info->fb_info);
367 return xenfb_connect_backend(dev, info); 510 return xenfb_connect_backend(dev, info);
368} 511}
369 512
@@ -391,20 +534,23 @@ static unsigned long vmalloc_to_mfn(void *address)
391 return pfn_to_mfn(vmalloc_to_pfn(address)); 534 return pfn_to_mfn(vmalloc_to_pfn(address));
392} 535}
393 536
394static void xenfb_init_shared_page(struct xenfb_info *info) 537static void xenfb_init_shared_page(struct xenfb_info *info,
538 struct fb_info *fb_info)
395{ 539{
396 int i; 540 int i;
541 int epd = PAGE_SIZE / sizeof(info->mfns[0]);
397 542
398 for (i = 0; i < info->nr_pages; i++) 543 for (i = 0; i < info->nr_pages; i++)
399 info->mfns[i] = vmalloc_to_mfn(info->fb + i * PAGE_SIZE); 544 info->mfns[i] = vmalloc_to_mfn(info->fb + i * PAGE_SIZE);
400 545
401 info->page->pd[0] = vmalloc_to_mfn(info->mfns); 546 for (i = 0; i * epd < info->nr_pages; i++)
402 info->page->pd[1] = 0; 547 info->page->pd[i] = vmalloc_to_mfn(&info->mfns[i * epd]);
403 info->page->width = XENFB_WIDTH; 548
404 info->page->height = XENFB_HEIGHT; 549 info->page->width = fb_info->var.xres;
405 info->page->depth = XENFB_DEPTH; 550 info->page->height = fb_info->var.yres;
406 info->page->line_length = (info->page->depth / 8) * info->page->width; 551 info->page->depth = fb_info->var.bits_per_pixel;
407 info->page->mem_length = xenfb_mem_len; 552 info->page->line_length = fb_info->fix.line_length;
553 info->page->mem_length = fb_info->fix.smem_len;
408 info->page->in_cons = info->page->in_prod = 0; 554 info->page->in_cons = info->page->in_prod = 0;
409 info->page->out_cons = info->page->out_prod = 0; 555 info->page->out_cons = info->page->out_prod = 0;
410} 556}
@@ -504,6 +650,11 @@ InitWait:
504 val = 0; 650 val = 0;
505 if (val) 651 if (val)
506 info->update_wanted = 1; 652 info->update_wanted = 1;
653
654 if (xenbus_scanf(XBT_NIL, dev->otherend,
655 "feature-resize", "%d", &val) < 0)
656 val = 0;
657 info->feature_resize = val;
507 break; 658 break;
508 659
509 case XenbusStateClosing: 660 case XenbusStateClosing:
@@ -547,4 +698,6 @@ static void __exit xenfb_cleanup(void)
547module_init(xenfb_init); 698module_init(xenfb_init);
548module_exit(xenfb_cleanup); 699module_exit(xenfb_cleanup);
549 700
701MODULE_DESCRIPTION("Xen virtual framebuffer device frontend");
550MODULE_LICENSE("GPL"); 702MODULE_LICENSE("GPL");
703MODULE_ALIAS("xen:vfb");