diff options
Diffstat (limited to 'drivers/video')
-rw-r--r-- | drivers/video/aty/aty128fb.c | 2 | ||||
-rw-r--r-- | drivers/video/aty/atyfb_base.c | 2 | ||||
-rw-r--r-- | drivers/video/aty/radeon_backlight.c | 2 | ||||
-rw-r--r-- | drivers/video/backlight/backlight.c | 7 | ||||
-rw-r--r-- | drivers/video/backlight/corgi_bl.c | 2 | ||||
-rw-r--r-- | drivers/video/backlight/hp680_bl.c | 2 | ||||
-rw-r--r-- | drivers/video/backlight/locomolcd.c | 2 | ||||
-rw-r--r-- | drivers/video/bw2.c | 18 | ||||
-rw-r--r-- | drivers/video/cg14.c | 28 | ||||
-rw-r--r-- | drivers/video/cg3.c | 22 | ||||
-rw-r--r-- | drivers/video/cg6.c | 33 | ||||
-rw-r--r-- | drivers/video/ffb.c | 25 | ||||
-rw-r--r-- | drivers/video/gxt4500.c | 95 | ||||
-rw-r--r-- | drivers/video/leo.c | 29 | ||||
-rw-r--r-- | drivers/video/nvidia/nv_backlight.c | 2 | ||||
-rw-r--r-- | drivers/video/p9100.c | 25 | ||||
-rw-r--r-- | drivers/video/pxafb.c | 40 | ||||
-rw-r--r-- | drivers/video/riva/fbdev.c | 2 | ||||
-rw-r--r-- | drivers/video/sa1100fb.c | 6 | ||||
-rw-r--r-- | drivers/video/tcx.c | 33 |
20 files changed, 222 insertions, 155 deletions
diff --git a/drivers/video/aty/aty128fb.c b/drivers/video/aty/aty128fb.c index 3feddf89d10..2e976ffcde0 100644 --- a/drivers/video/aty/aty128fb.c +++ b/drivers/video/aty/aty128fb.c @@ -1834,7 +1834,7 @@ static void aty128_bl_init(struct aty128fb_par *par) snprintf(name, sizeof(name), "aty128bl%d", info->node); - bd = backlight_device_register(name, par, &aty128_bl_data); + bd = backlight_device_register(name, info->dev, par, &aty128_bl_data); if (IS_ERR(bd)) { info->bl_dev = NULL; printk(KERN_WARNING "aty128: Backlight registration failed\n"); diff --git a/drivers/video/aty/atyfb_base.c b/drivers/video/aty/atyfb_base.c index 09684d7a7ce..f2ebdd88008 100644 --- a/drivers/video/aty/atyfb_base.c +++ b/drivers/video/aty/atyfb_base.c @@ -2211,7 +2211,7 @@ static void aty_bl_init(struct atyfb_par *par) snprintf(name, sizeof(name), "atybl%d", info->node); - bd = backlight_device_register(name, par, &aty_bl_data); + bd = backlight_device_register(name, info->dev, par, &aty_bl_data); if (IS_ERR(bd)) { info->bl_dev = NULL; printk(KERN_WARNING "aty: Backlight registration failed\n"); diff --git a/drivers/video/aty/radeon_backlight.c b/drivers/video/aty/radeon_backlight.c index 585eb7b9e63..3abfd4a380c 100644 --- a/drivers/video/aty/radeon_backlight.c +++ b/drivers/video/aty/radeon_backlight.c @@ -163,7 +163,7 @@ void radeonfb_bl_init(struct radeonfb_info *rinfo) snprintf(name, sizeof(name), "radeonbl%d", rinfo->info->node); - bd = backlight_device_register(name, pdata, &radeon_bl_data); + bd = backlight_device_register(name, rinfo->info->dev, pdata, &radeon_bl_data); if (IS_ERR(bd)) { rinfo->info->bl_dev = NULL; printk("radeonfb: Backlight registration failed\n"); diff --git a/drivers/video/backlight/backlight.c b/drivers/video/backlight/backlight.c index db8c191b120..9601bfe309a 100644 --- a/drivers/video/backlight/backlight.c +++ b/drivers/video/backlight/backlight.c @@ -216,8 +216,10 @@ static const struct class_device_attribute bl_class_device_attributes[] = { * Creates and registers new backlight class_device. Returns either an * ERR_PTR() or a pointer to the newly allocated device. */ -struct backlight_device *backlight_device_register(const char *name, void *devdata, - struct backlight_properties *bp) +struct backlight_device *backlight_device_register(const char *name, + struct device *dev, + void *devdata, + struct backlight_properties *bp) { int i, rc; struct backlight_device *new_bd; @@ -232,6 +234,7 @@ struct backlight_device *backlight_device_register(const char *name, void *devda new_bd->props = bp; memset(&new_bd->class_dev, 0, sizeof(new_bd->class_dev)); new_bd->class_dev.class = &backlight_class; + new_bd->class_dev.dev = dev; strlcpy(new_bd->class_dev.class_id, name, KOBJ_NAME_LEN); class_set_devdata(&new_bd->class_dev, devdata); diff --git a/drivers/video/backlight/corgi_bl.c b/drivers/video/backlight/corgi_bl.c index 61587ca2cdb..fde1d951812 100644 --- a/drivers/video/backlight/corgi_bl.c +++ b/drivers/video/backlight/corgi_bl.c @@ -121,7 +121,7 @@ static int corgibl_probe(struct platform_device *pdev) machinfo->limit_mask = -1; corgi_backlight_device = backlight_device_register ("corgi-bl", - NULL, &corgibl_data); + &pdev->dev, NULL, &corgibl_data); if (IS_ERR (corgi_backlight_device)) return PTR_ERR (corgi_backlight_device); diff --git a/drivers/video/backlight/hp680_bl.c b/drivers/video/backlight/hp680_bl.c index 1c569fb543a..c07d8207fb5 100644 --- a/drivers/video/backlight/hp680_bl.c +++ b/drivers/video/backlight/hp680_bl.c @@ -105,7 +105,7 @@ static struct backlight_properties hp680bl_data = { static int __init hp680bl_probe(struct platform_device *dev) { hp680_backlight_device = backlight_device_register ("hp680-bl", - NULL, &hp680bl_data); + &dev->dev, NULL, &hp680bl_data); if (IS_ERR (hp680_backlight_device)) return PTR_ERR (hp680_backlight_device); diff --git a/drivers/video/backlight/locomolcd.c b/drivers/video/backlight/locomolcd.c index 2d7905410b2..fc812d96c31 100644 --- a/drivers/video/backlight/locomolcd.c +++ b/drivers/video/backlight/locomolcd.c @@ -184,7 +184,7 @@ static int locomolcd_probe(struct locomo_dev *ldev) local_irq_restore(flags); - locomolcd_bl_device = backlight_device_register("locomo-bl", NULL, &locomobl_data); + locomolcd_bl_device = backlight_device_register("locomo-bl", &ldev->dev, NULL, &locomobl_data); if (IS_ERR (locomolcd_bl_device)) return PTR_ERR (locomolcd_bl_device); diff --git a/drivers/video/bw2.c b/drivers/video/bw2.c index c66e3d52cbf..9bb6257d691 100644 --- a/drivers/video/bw2.c +++ b/drivers/video/bw2.c @@ -320,7 +320,7 @@ static int __devinit bw2_init_one(struct of_device *op) all->info.fbops = &bw2_ops; all->info.screen_base = - sbus_ioremap(&op->resource[0], 0, all->par.fbsize, "bw2 ram"); + of_ioremap(&op->resource[0], 0, all->par.fbsize, "bw2 ram"); all->info.par = &all->par; bw2_blank(0, &all->info); @@ -329,8 +329,10 @@ static int __devinit bw2_init_one(struct of_device *op) err= register_framebuffer(&all->info); if (err < 0) { - of_iounmap(all->par.regs, sizeof(struct bw2_regs)); - of_iounmap(all->info.screen_base, all->par.fbsize); + of_iounmap(&op->resource[0], + all->par.regs, sizeof(struct bw2_regs)); + of_iounmap(&op->resource[0], + all->info.screen_base, all->par.fbsize); kfree(all); return err; } @@ -351,18 +353,18 @@ static int __devinit bw2_probe(struct of_device *dev, const struct of_device_id return bw2_init_one(op); } -static int __devexit bw2_remove(struct of_device *dev) +static int __devexit bw2_remove(struct of_device *op) { - struct all_info *all = dev_get_drvdata(&dev->dev); + struct all_info *all = dev_get_drvdata(&op->dev); unregister_framebuffer(&all->info); - of_iounmap(all->par.regs, sizeof(struct bw2_regs)); - of_iounmap(all->info.screen_base, all->par.fbsize); + of_iounmap(&op->resource[0], all->par.regs, sizeof(struct bw2_regs)); + of_iounmap(&op->resource[0], all->info.screen_base, all->par.fbsize); kfree(all); - dev_set_drvdata(&dev->dev, NULL); + dev_set_drvdata(&op->dev, NULL); return 0; } diff --git a/drivers/video/cg14.c b/drivers/video/cg14.c index 7f926c619b6..ec6a51a5822 100644 --- a/drivers/video/cg14.c +++ b/drivers/video/cg14.c @@ -452,16 +452,20 @@ struct all_info { struct cg14_par par; }; -static void cg14_unmap_regs(struct all_info *all) +static void cg14_unmap_regs(struct of_device *op, struct all_info *all) { if (all->par.regs) - of_iounmap(all->par.regs, sizeof(struct cg14_regs)); + of_iounmap(&op->resource[0], + all->par.regs, sizeof(struct cg14_regs)); if (all->par.clut) - of_iounmap(all->par.clut, sizeof(struct cg14_clut)); + of_iounmap(&op->resource[0], + all->par.clut, sizeof(struct cg14_clut)); if (all->par.cursor) - of_iounmap(all->par.cursor, sizeof(struct cg14_cursor)); + of_iounmap(&op->resource[0], + all->par.cursor, sizeof(struct cg14_cursor)); if (all->info.screen_base) - of_iounmap(all->info.screen_base, all->par.fbsize); + of_iounmap(&op->resource[1], + all->info.screen_base, all->par.fbsize); } static int __devinit cg14_init_one(struct of_device *op) @@ -506,7 +510,7 @@ static int __devinit cg14_init_one(struct of_device *op) if (!all->par.regs || !all->par.clut || !all->par.cursor || !all->info.screen_base) - cg14_unmap_regs(all); + cg14_unmap_regs(op, all); is_8mb = (((op->resource[1].end - op->resource[1].start) + 1) == (8 * 1024 * 1024)); @@ -541,7 +545,7 @@ static int __devinit cg14_init_one(struct of_device *op) __cg14_reset(&all->par); if (fb_alloc_cmap(&all->info.cmap, 256, 0)) { - cg14_unmap_regs(all); + cg14_unmap_regs(op, all); kfree(all); return -ENOMEM; } @@ -552,7 +556,7 @@ static int __devinit cg14_init_one(struct of_device *op) err = register_framebuffer(&all->info); if (err < 0) { fb_dealloc_cmap(&all->info.cmap); - cg14_unmap_regs(all); + cg14_unmap_regs(op, all); kfree(all); return err; } @@ -574,18 +578,18 @@ static int __devinit cg14_probe(struct of_device *dev, const struct of_device_id return cg14_init_one(op); } -static int __devexit cg14_remove(struct of_device *dev) +static int __devexit cg14_remove(struct of_device *op) { - struct all_info *all = dev_get_drvdata(&dev->dev); + struct all_info *all = dev_get_drvdata(&op->dev); unregister_framebuffer(&all->info); fb_dealloc_cmap(&all->info.cmap); - cg14_unmap_regs(all); + cg14_unmap_regs(op, all); kfree(all); - dev_set_drvdata(&dev->dev, NULL); + dev_set_drvdata(&op->dev, NULL); return 0; } diff --git a/drivers/video/cg3.c b/drivers/video/cg3.c index 9c8c753ef45..ada6f7e3a89 100644 --- a/drivers/video/cg3.c +++ b/drivers/video/cg3.c @@ -403,8 +403,10 @@ static int __devinit cg3_init_one(struct of_device *op) cg3_do_default_mode(&all->par); if (fb_alloc_cmap(&all->info.cmap, 256, 0)) { - of_iounmap(all->par.regs, sizeof(struct cg3_regs)); - of_iounmap(all->info.screen_base, all->par.fbsize); + of_iounmap(&op->resource[0], + all->par.regs, sizeof(struct cg3_regs)); + of_iounmap(&op->resource[0], + all->info.screen_base, all->par.fbsize); kfree(all); return -ENOMEM; } @@ -415,8 +417,10 @@ static int __devinit cg3_init_one(struct of_device *op) err = register_framebuffer(&all->info); if (err < 0) { fb_dealloc_cmap(&all->info.cmap); - of_iounmap(all->par.regs, sizeof(struct cg3_regs)); - of_iounmap(all->info.screen_base, all->par.fbsize); + of_iounmap(&op->resource[0], + all->par.regs, sizeof(struct cg3_regs)); + of_iounmap(&op->resource[0], + all->info.screen_base, all->par.fbsize); kfree(all); return err; } @@ -436,19 +440,19 @@ static int __devinit cg3_probe(struct of_device *dev, const struct of_device_id return cg3_init_one(op); } -static int __devexit cg3_remove(struct of_device *dev) +static int __devexit cg3_remove(struct of_device *op) { - struct all_info *all = dev_get_drvdata(&dev->dev); + struct all_info *all = dev_get_drvdata(&op->dev); unregister_framebuffer(&all->info); fb_dealloc_cmap(&all->info.cmap); - of_iounmap(all->par.regs, sizeof(struct cg3_regs)); - of_iounmap(all->info.screen_base, all->par.fbsize); + of_iounmap(&op->resource[0], all->par.regs, sizeof(struct cg3_regs)); + of_iounmap(&op->resource[0], all->info.screen_base, all->par.fbsize); kfree(all); - dev_set_drvdata(&dev->dev, NULL); + dev_set_drvdata(&op->dev, NULL); return 0; } diff --git a/drivers/video/cg6.c b/drivers/video/cg6.c index 64146be2eeb..4dad23a28f5 100644 --- a/drivers/video/cg6.c +++ b/drivers/video/cg6.c @@ -658,21 +658,26 @@ struct all_info { struct cg6_par par; }; -static void cg6_unmap_regs(struct all_info *all) +static void cg6_unmap_regs(struct of_device *op, struct all_info *all) { if (all->par.fbc) - of_iounmap(all->par.fbc, 4096); + of_iounmap(&op->resource[0], all->par.fbc, 4096); if (all->par.tec) - of_iounmap(all->par.tec, sizeof(struct cg6_tec)); + of_iounmap(&op->resource[0], + all->par.tec, sizeof(struct cg6_tec)); if (all->par.thc) - of_iounmap(all->par.thc, sizeof(struct cg6_thc)); + of_iounmap(&op->resource[0], + all->par.thc, sizeof(struct cg6_thc)); if (all->par.bt) - of_iounmap(all->par.bt, sizeof(struct bt_regs)); + of_iounmap(&op->resource[0], + all->par.bt, sizeof(struct bt_regs)); if (all->par.fhc) - of_iounmap(all->par.fhc, sizeof(u32)); + of_iounmap(&op->resource[0], + all->par.fhc, sizeof(u32)); if (all->info.screen_base) - of_iounmap(all->info.screen_base, all->par.fbsize); + of_iounmap(&op->resource[0], + all->info.screen_base, all->par.fbsize); } static int __devinit cg6_init_one(struct of_device *op) @@ -720,7 +725,7 @@ static int __devinit cg6_init_one(struct of_device *op) all->par.fbsize, "cgsix ram"); if (!all->par.fbc || !all->par.tec || !all->par.thc || !all->par.bt || !all->par.fhc || !all->info.screen_base) { - cg6_unmap_regs(all); + cg6_unmap_regs(op, all); kfree(all); return -ENOMEM; } @@ -734,7 +739,7 @@ static int __devinit cg6_init_one(struct of_device *op) cg6_blank(0, &all->info); if (fb_alloc_cmap(&all->info.cmap, 256, 0)) { - cg6_unmap_regs(all); + cg6_unmap_regs(op, all); kfree(all); return -ENOMEM; } @@ -744,7 +749,7 @@ static int __devinit cg6_init_one(struct of_device *op) err = register_framebuffer(&all->info); if (err < 0) { - cg6_unmap_regs(all); + cg6_unmap_regs(op, all); fb_dealloc_cmap(&all->info.cmap); kfree(all); return err; @@ -767,18 +772,18 @@ static int __devinit cg6_probe(struct of_device *dev, const struct of_device_id return cg6_init_one(op); } -static int __devexit cg6_remove(struct of_device *dev) +static int __devexit cg6_remove(struct of_device *op) { - struct all_info *all = dev_get_drvdata(&dev->dev); + struct all_info *all = dev_get_drvdata(&op->dev); unregister_framebuffer(&all->info); fb_dealloc_cmap(&all->info.cmap); - cg6_unmap_regs(all); + cg6_unmap_regs(op, all); kfree(all); - dev_set_drvdata(&dev->dev, NULL); + dev_set_drvdata(&op->dev, NULL); return 0; } diff --git a/drivers/video/ffb.c b/drivers/video/ffb.c index 949141bd44d..15854aec318 100644 --- a/drivers/video/ffb.c +++ b/drivers/video/ffb.c @@ -910,7 +910,8 @@ static int ffb_init_one(struct of_device *op) all->par.dac = of_ioremap(&op->resource[1], 0, sizeof(struct ffb_dac), "ffb dac"); if (!all->par.dac) { - of_iounmap(all->par.fbc, sizeof(struct ffb_fbc)); + of_iounmap(&op->resource[2], + all->par.fbc, sizeof(struct ffb_fbc)); kfree(all); return -ENOMEM; } @@ -968,8 +969,10 @@ static int ffb_init_one(struct of_device *op) if (fb_alloc_cmap(&all->info.cmap, 256, 0)) { printk(KERN_ERR "ffb: Could not allocate color map.\n"); - of_iounmap(all->par.fbc, sizeof(struct ffb_fbc)); - of_iounmap(all->par.dac, sizeof(struct ffb_dac)); + of_iounmap(&op->resource[2], + all->par.fbc, sizeof(struct ffb_fbc)); + of_iounmap(&op->resource[1], + all->par.dac, sizeof(struct ffb_dac)); kfree(all); return -ENOMEM; } @@ -980,8 +983,10 @@ static int ffb_init_one(struct of_device *op) if (err < 0) { printk(KERN_ERR "ffb: Could not register framebuffer.\n"); fb_dealloc_cmap(&all->info.cmap); - of_iounmap(all->par.fbc, sizeof(struct ffb_fbc)); - of_iounmap(all->par.dac, sizeof(struct ffb_dac)); + of_iounmap(&op->resource[2], + all->par.fbc, sizeof(struct ffb_fbc)); + of_iounmap(&op->resource[1], + all->par.dac, sizeof(struct ffb_dac)); kfree(all); return err; } @@ -1003,19 +1008,19 @@ static int __devinit ffb_probe(struct of_device *dev, const struct of_device_id return ffb_init_one(op); } -static int __devexit ffb_remove(struct of_device *dev) +static int __devexit ffb_remove(struct of_device *op) { - struct all_info *all = dev_get_drvdata(&dev->dev); + struct all_info *all = dev_get_drvdata(&op->dev); unregister_framebuffer(&all->info); fb_dealloc_cmap(&all->info.cmap); - of_iounmap(all->par.fbc, sizeof(struct ffb_fbc)); - of_iounmap(all->par.dac, sizeof(struct ffb_dac)); + of_iounmap(&op->resource[2], all->par.fbc, sizeof(struct ffb_fbc)); + of_iounmap(&op->resource[1], all->par.dac, sizeof(struct ffb_dac)); kfree(all); - dev_set_drvdata(&dev->dev, NULL); + dev_set_drvdata(&op->dev, NULL); return 0; } diff --git a/drivers/video/gxt4500.c b/drivers/video/gxt4500.c index 3adf6ab0768..23a6bcc3e3c 100644 --- a/drivers/video/gxt4500.c +++ b/drivers/video/gxt4500.c @@ -1,5 +1,5 @@ /* - * Frame buffer device for IBM GXT4500P display adaptor + * Frame buffer device for IBM GXT4500P and GXT6000P display adaptors * * Copyright (C) 2006 Paul Mackerras, IBM Corp. <paulus@samba.org> */ @@ -11,8 +11,10 @@ #include <linux/pci.h> #include <linux/pci_ids.h> #include <linux/delay.h> +#include <linux/string.h> #define PCI_DEVICE_ID_IBM_GXT4500P 0x21c +#define PCI_DEVICE_ID_IBM_GXT6000P 0x170 /* GXT4500P registers */ @@ -94,6 +96,7 @@ static const unsigned char pixsize[] = { #define PLL_M 0x4040 #define PLL_N 0x4044 #define PLL_POSTDIV 0x4048 +#define PLL_C 0x404c /* Hardware cursor */ #define CURSOR_X 0x4078 @@ -140,6 +143,7 @@ struct gxt4500_par { int pixfmt; /* pixel format, see DFA_PIX_* values */ /* PLL parameters */ + int refclk_ps; /* ref clock period in picoseconds */ int pll_m; /* ref clock divisor */ int pll_n; /* VCO divisor */ int pll_pd1; /* first post-divisor */ @@ -166,6 +170,21 @@ static const struct fb_videomode defaultmode __devinitdata = { .vmode = FB_VMODE_NONINTERLACED }; +/* List of supported cards */ +enum gxt_cards { + GXT4500P, + GXT6000P +}; + +/* Card-specific information */ +static const struct cardinfo { + int refclk_ps; /* period of PLL reference clock in ps */ + const char *cardname; +} cardinfo[] = { + [GXT4500P] = { .refclk_ps = 9259, .cardname = "IBM GXT4500P" }, + [GXT6000P] = { .refclk_ps = 40000, .cardname = "IBM GXT6000P" }, +}; + /* * The refclk and VCO dividers appear to use a linear feedback shift * register, which gets reloaded when it reaches a terminal value, at @@ -203,27 +222,16 @@ static const unsigned char ndivtab[] = { /* 130 */ 0x9e, 0x4f, 0x27, 0x93, 0xc9, 0xe4, 0x72, 0x39, 0x1c, 0x0e, /* 140 */ 0x87, 0xc3, 0x61, 0x30, 0x18, 0x8c, 0xc6, 0x63, 0x31, 0x98, /* 150 */ 0xcc, 0xe6, 0x73, 0xb9, 0x5c, 0x2e, 0x97, 0x4b, 0xa5, 0xd2, -/* 160 */ 0x69, 0xb4, 0xda, 0xed, 0x76, 0xbb, 0x5d, 0xae, 0xd7, 0x6b, -/* 170 */ 0xb5, 0x5a, 0xad, 0x56, 0xab, 0xd5, 0x6a, 0x35, 0x1a, 0x8d, -/* 180 */ 0x46, 0x23, 0x11, 0x88, 0x44, 0x22, 0x91, 0xc8, 0x64, 0x32, -/* 190 */ 0x19, 0x0c, 0x86, 0x43, 0x21, 0x10, 0x08, 0x04, 0x02, 0x81, -/* 200 */ 0x40, 0xa0, 0xd0, 0x68, 0x34, 0x9a, 0xcd, 0x66, 0x33, 0x99, -/* 210 */ 0x4c, 0xa6, 0x53, 0xa9, 0xd4, 0xea, 0x75, 0x3a, 0x9d, 0xce, -/* 220 */ 0xe7, 0xf3, 0xf9, 0x7c, 0x3e, 0x1f, 0x8f, 0x47, 0xa3, 0x51, -/* 230 */ 0xa8, 0x54, 0xaa, 0x55, 0x2a, 0x15, 0x0a, 0x05, 0x82, 0xc1, -/* 240 */ 0x60, 0xb0, 0x58, 0xac, 0xd6, 0xeb, 0xf5, 0x7a, 0xbd, 0xde, -/* 250 */ 0x6f, 0x37, 0x1b, 0x0d, 0x06, 0x03, 0x01, +/* 160 */ 0x69, }; -#define REF_PERIOD_PS 9259 /* period of reference clock in ps */ - static int calc_pll(int period_ps, struct gxt4500_par *par) { int m, n, pdiv1, pdiv2, postdiv; - int pll_period, best_error, t; + int pll_period, best_error, t, intf; - /* only deal with range 1MHz - 400MHz */ - if (period_ps < 2500 || period_ps > 1000000) + /* only deal with range 5MHz - 300MHz */ + if (period_ps < 3333 || period_ps > 200000) return -1; best_error = 1000000; @@ -231,14 +239,17 @@ static int calc_pll(int period_ps, struct gxt4500_par *par) for (pdiv2 = 1; pdiv2 <= pdiv1; ++pdiv2) { postdiv = pdiv1 * pdiv2; pll_period = (period_ps + postdiv - 1) / postdiv; - /* keep pll in range 500..1250 MHz */ - if (pll_period < 800 || pll_period > 2000) + /* keep pll in range 350..600 MHz */ + if (pll_period < 1666 || pll_period > 2857) continue; - for (m = 3; m <= 40; ++m) { - n = REF_PERIOD_PS * m * postdiv / period_ps; - if (n < 5 || n > 256) + for (m = 1; m <= 64; ++m) { + intf = m * par->refclk_ps; + if (intf > 500000) + break; + n = intf * postdiv / period_ps; + if (n < 3 || n > 160) continue; - t = REF_PERIOD_PS * m * postdiv / n; + t = par->refclk_ps * m * postdiv / n; t -= period_ps; if (t >= 0 && t < best_error) { par->pll_m = m; @@ -257,7 +268,7 @@ static int calc_pll(int period_ps, struct gxt4500_par *par) static int calc_pixclock(struct gxt4500_par *par) { - return REF_PERIOD_PS * par->pll_m * par->pll_pd1 * par->pll_pd2 + return par->refclk_ps * par->pll_m * par->pll_pd1 * par->pll_pd2 / par->pll_n; } @@ -357,7 +368,7 @@ static int gxt4500_set_par(struct fb_info *info) struct gxt4500_par *par = info->par; struct fb_var_screeninfo *var = &info->var; int err; - u32 ctrlreg; + u32 ctrlreg, tmp; unsigned int dfa_ctl, pixfmt, stride; unsigned int wid_tiles, i; unsigned int prefetch_pix, htot; @@ -376,10 +387,25 @@ static int gxt4500_set_par(struct fb_info *info) writereg(par, DTG_CONTROL, ctrlreg); /* set PLL registers */ + tmp = readreg(par, PLL_C) & ~0x7f; + if (par->pll_n < 38) + tmp |= 0x29; + if (par->pll_n < 69) + tmp |= 0x35; + else if (par->pll_n < 100) + tmp |= 0x76; + else + tmp |= 0x7e; + writereg(par, PLL_C, tmp); writereg(par, PLL_M, mdivtab[par->pll_m - 1]); writereg(par, PLL_N, ndivtab[par->pll_n - 2]); - writereg(par, PLL_POSTDIV, - ((8 - par->pll_pd1) << 3) | (8 - par->pll_pd2)); + tmp = ((8 - par->pll_pd2) << 3) | (8 - par->pll_pd1); + if (par->pll_pd1 == 8 || par->pll_pd2 == 8) { + /* work around erratum */ + writereg(par, PLL_POSTDIV, tmp | 0x9); + udelay(1); + } + writereg(par, PLL_POSTDIV, tmp); msleep(20); /* turn off hardware cursor */ @@ -483,8 +509,8 @@ static int gxt4500_setcolreg(unsigned int reg, unsigned int red, if (reg > 1023) return 1; - cmap_entry = ((transp & 0xff00) << 16) | ((blue & 0xff00) << 8) | - (green & 0xff00) | (red >> 8); + cmap_entry = ((transp & 0xff00) << 16) | ((red & 0xff00) << 8) | + (green & 0xff00) | (blue >> 8); writereg(par, CMAP + reg * 4, cmap_entry); if (reg < 16 && par->pixfmt != DFA_PIX_8BIT) { @@ -585,6 +611,7 @@ static int __devinit gxt4500_probe(struct pci_dev *pdev, struct gxt4500_par *par; struct fb_info *info; struct fb_var_screeninfo var; + enum gxt_cards cardtype; err = pci_enable_device(pdev); if (err) { @@ -613,7 +640,11 @@ static int __devinit gxt4500_probe(struct pci_dev *pdev, goto err_free_fb; } par = info->par; + cardtype = ent->driver_data; + par->refclk_ps = cardinfo[cardtype].refclk_ps; info->fix = gxt4500_fix; + strlcpy(info->fix.id, cardinfo[cardtype].cardname, + sizeof(info->fix.id)); info->pseudo_palette = par->pseudo_palette; info->fix.mmio_start = reg_phys; @@ -703,8 +734,10 @@ static void __devexit gxt4500_remove(struct pci_dev *pdev) /* supported chipsets */ static const struct pci_device_id gxt4500_pci_tbl[] = { - { PCI_VENDOR_ID_IBM, PCI_DEVICE_ID_IBM_GXT4500P, - PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, + { PCI_DEVICE(PCI_VENDOR_ID_IBM, PCI_DEVICE_ID_IBM_GXT4500P), + .driver_data = GXT4500P }, + { PCI_DEVICE(PCI_VENDOR_ID_IBM, PCI_DEVICE_ID_IBM_GXT6000P), + .driver_data = GXT6000P }, { 0 } }; @@ -735,7 +768,7 @@ static void __exit gxt4500_exit(void) module_exit(gxt4500_exit); MODULE_AUTHOR("Paul Mackerras <paulus@samba.org>"); -MODULE_DESCRIPTION("FBDev driver for IBM GXT4500P"); +MODULE_DESCRIPTION("FBDev driver for IBM GXT4500P/6000P"); MODULE_LICENSE("GPL"); module_param(mode_option, charp, 0); MODULE_PARM_DESC(mode_option, "Specify resolution as \"<xres>x<yres>[-<bpp>][@<refresh>]\""); diff --git a/drivers/video/leo.c b/drivers/video/leo.c index f3a24338d9a..a038aa5a9e1 100644 --- a/drivers/video/leo.c +++ b/drivers/video/leo.c @@ -530,20 +530,21 @@ struct all_info { struct leo_par par; }; -static void leo_unmap_regs(struct all_info *all) +static void leo_unmap_regs(struct of_device *op, struct all_info *all) { if (all->par.lc_ss0_usr) - of_iounmap(all->par.lc_ss0_usr, 0x1000); + of_iounmap(&op->resource[0], all->par.lc_ss0_usr, 0x1000); if (all->par.ld_ss0) - of_iounmap(all->par.ld_ss0, 0x1000); + of_iounmap(&op->resource[0], all->par.ld_ss0, 0x1000); if (all->par.ld_ss1) - of_iounmap(all->par.ld_ss1, 0x1000); + of_iounmap(&op->resource[0], all->par.ld_ss1, 0x1000); if (all->par.lx_krn) - of_iounmap(all->par.lx_krn, 0x1000); + of_iounmap(&op->resource[0], all->par.lx_krn, 0x1000); if (all->par.cursor) - of_iounmap(all->par.cursor, sizeof(struct leo_cursor)); + of_iounmap(&op->resource[0], + all->par.cursor, sizeof(struct leo_cursor)); if (all->info.screen_base) - of_iounmap(all->info.screen_base, 0x800000); + of_iounmap(&op->resource[0], all->info.screen_base, 0x800000); } static int __devinit leo_init_one(struct of_device *op) @@ -592,7 +593,7 @@ static int __devinit leo_init_one(struct of_device *op) !all->par.lx_krn || !all->par.cursor || !all->info.screen_base) { - leo_unmap_regs(all); + leo_unmap_regs(op, all); kfree(all); return -ENOMEM; } @@ -607,7 +608,7 @@ static int __devinit leo_init_one(struct of_device *op) leo_blank(0, &all->info); if (fb_alloc_cmap(&all->info.cmap, 256, 0)) { - leo_unmap_regs(all); + leo_unmap_regs(op, all); kfree(all); return -ENOMEM;; } @@ -617,7 +618,7 @@ static int __devinit leo_init_one(struct of_device *op) err = register_framebuffer(&all->info); if (err < 0) { fb_dealloc_cmap(&all->info.cmap); - leo_unmap_regs(all); + leo_unmap_regs(op, all); kfree(all); return err; } @@ -638,18 +639,18 @@ static int __devinit leo_probe(struct of_device *dev, const struct of_device_id return leo_init_one(op); } -static int __devexit leo_remove(struct of_device *dev) +static int __devexit leo_remove(struct of_device *op) { - struct all_info *all = dev_get_drvdata(&dev->dev); + struct all_info *all = dev_get_drvdata(&op->dev); unregister_framebuffer(&all->info); fb_dealloc_cmap(&all->info.cmap); - leo_unmap_regs(all); + leo_unmap_regs(op, all); kfree(all); - dev_set_drvdata(&dev->dev, NULL); + dev_set_drvdata(&op->dev, NULL); return 0; } diff --git a/drivers/video/nvidia/nv_backlight.c b/drivers/video/nvidia/nv_backlight.c index 5b75ae4e945..df934bd2189 100644 --- a/drivers/video/nvidia/nv_backlight.c +++ b/drivers/video/nvidia/nv_backlight.c @@ -141,7 +141,7 @@ void nvidia_bl_init(struct nvidia_par *par) snprintf(name, sizeof(name), "nvidiabl%d", info->node); - bd = backlight_device_register(name, par, &nvidia_bl_data); + bd = backlight_device_register(name, info->dev, par, &nvidia_bl_data); if (IS_ERR(bd)) { info->bl_dev = NULL; printk(KERN_WARNING "nvidia: Backlight registration failed\n"); diff --git a/drivers/video/p9100.c b/drivers/video/p9100.c index 56ac51d6a7f..637b78bb4bf 100644 --- a/drivers/video/p9100.c +++ b/drivers/video/p9100.c @@ -297,7 +297,8 @@ static int __devinit p9100_init_one(struct of_device *op) all->info.screen_base = of_ioremap(&op->resource[2], 0, all->par.fbsize, "p9100 ram"); if (!all->info.screen_base) { - of_iounmap(all->par.regs, sizeof(struct p9100_regs)); + of_iounmap(&op->resource[0], + all->par.regs, sizeof(struct p9100_regs)); kfree(all); return -ENOMEM; } @@ -306,8 +307,10 @@ static int __devinit p9100_init_one(struct of_device *op) p9100_blank(0, &all->info); if (fb_alloc_cmap(&all->info.cmap, 256, 0)) { - of_iounmap(all->par.regs, sizeof(struct p9100_regs)); - of_iounmap(all->info.screen_base, all->par.fbsize); + of_iounmap(&op->resource[0], + all->par.regs, sizeof(struct p9100_regs)); + of_iounmap(&op->resource[2], + all->info.screen_base, all->par.fbsize); kfree(all); return -ENOMEM; } @@ -317,8 +320,10 @@ static int __devinit p9100_init_one(struct of_device *op) err = register_framebuffer(&all->info); if (err < 0) { fb_dealloc_cmap(&all->info.cmap); - of_iounmap(all->par.regs, sizeof(struct p9100_regs)); - of_iounmap(all->info.screen_base, all->par.fbsize); + of_iounmap(&op->resource[0], + all->par.regs, sizeof(struct p9100_regs)); + of_iounmap(&op->resource[2], + all->info.screen_base, all->par.fbsize); kfree(all); return err; } @@ -340,19 +345,19 @@ static int __devinit p9100_probe(struct of_device *dev, const struct of_device_i return p9100_init_one(op); } -static int __devexit p9100_remove(struct of_device *dev) +static int __devexit p9100_remove(struct of_device *op) { - struct all_info *all = dev_get_drvdata(&dev->dev); + struct all_info *all = dev_get_drvdata(&op->dev); unregister_framebuffer(&all->info); fb_dealloc_cmap(&all->info.cmap); - of_iounmap(all->par.regs, sizeof(struct p9100_regs)); - of_iounmap(all->info.screen_base, all->par.fbsize); + of_iounmap(&op->resource[0], all->par.regs, sizeof(struct p9100_regs)); + of_iounmap(&op->resource[2], all->info.screen_base, all->par.fbsize); kfree(all); - dev_set_drvdata(&dev->dev, NULL); + dev_set_drvdata(&op->dev, NULL); return 0; } diff --git a/drivers/video/pxafb.c b/drivers/video/pxafb.c index 38eb0b69c2d..b4947c81070 100644 --- a/drivers/video/pxafb.c +++ b/drivers/video/pxafb.c @@ -1216,7 +1216,7 @@ static int __init pxafb_parse_options(struct device *dev, char *options) done: if (res_specified) { dev_info(dev, "overriding resolution: %dx%d\n", xres, yres); - inf->xres = xres; inf->yres = yres; + inf->modes[0].xres = xres; inf->modes[0].yres = yres; } if (bpp_specified) switch (bpp) { @@ -1225,48 +1225,48 @@ static int __init pxafb_parse_options(struct device *dev, char *options) case 4: case 8: case 16: - inf->bpp = bpp; + inf->modes[0].bpp = bpp; dev_info(dev, "overriding bit depth: %d\n", bpp); break; default: dev_err(dev, "Depth %d is not valid\n", bpp); } } else if (!strncmp(this_opt, "pixclock:", 9)) { - inf->pixclock = simple_strtoul(this_opt+9, NULL, 0); - dev_info(dev, "override pixclock: %ld\n", inf->pixclock); + inf->modes[0].pixclock = simple_strtoul(this_opt+9, NULL, 0); + dev_info(dev, "override pixclock: %ld\n", inf->modes[0].pixclock); } else if (!strncmp(this_opt, "left:", 5)) { - inf->left_margin = simple_strtoul(this_opt+5, NULL, 0); - dev_info(dev, "override left: %u\n", inf->left_margin); + inf->modes[0].left_margin = simple_strtoul(this_opt+5, NULL, 0); + dev_info(dev, "override left: %u\n", inf->modes[0].left_margin); } else if (!strncmp(this_opt, "right:", 6)) { - inf->right_margin = simple_strtoul(this_opt+6, NULL, 0); - dev_info(dev, "override right: %u\n", inf->right_margin); + inf->modes[0].right_margin = simple_strtoul(this_opt+6, NULL, 0); + dev_info(dev, "override right: %u\n", inf->modes[0].right_margin); } else if (!strncmp(this_opt, "upper:", 6)) { - inf->upper_margin = simple_strtoul(this_opt+6, NULL, 0); - dev_info(dev, "override upper: %u\n", inf->upper_margin); + inf->modes[0].upper_margin = simple_strtoul(this_opt+6, NULL, 0); + dev_info(dev, "override upper: %u\n", inf->modes[0].upper_margin); } else if (!strncmp(this_opt, "lower:", 6)) { - inf->lower_margin = simple_strtoul(this_opt+6, NULL, 0); - dev_info(dev, "override lower: %u\n", inf->lower_margin); + inf->modes[0].lower_margin = simple_strtoul(this_opt+6, NULL, 0); + dev_info(dev, "override lower: %u\n", inf->modes[0].lower_margin); } else if (!strncmp(this_opt, "hsynclen:", 9)) { - inf->hsync_len = simple_strtoul(this_opt+9, NULL, 0); - dev_info(dev, "override hsynclen: %u\n", inf->hsync_len); + inf->modes[0].hsync_len = simple_strtoul(this_opt+9, NULL, 0); + dev_info(dev, "override hsynclen: %u\n", inf->modes[0].hsync_len); } else if (!strncmp(this_opt, "vsynclen:", 9)) { - inf->vsync_len = simple_strtoul(this_opt+9, NULL, 0); - dev_info(dev, "override vsynclen: %u\n", inf->vsync_len); + inf->modes[0].vsync_len = simple_strtoul(this_opt+9, NULL, 0); + dev_info(dev, "override vsynclen: %u\n", inf->modes[0].vsync_len); } else if (!strncmp(this_opt, "hsync:", 6)) { if (simple_strtoul(this_opt+6, NULL, 0) == 0) { dev_info(dev, "override hsync: Active Low\n"); - inf->sync &= ~FB_SYNC_HOR_HIGH_ACT; + inf->modes[0].sync &= ~FB_SYNC_HOR_HIGH_ACT; } else { dev_info(dev, "override hsync: Active High\n"); - inf->sync |= FB_SYNC_HOR_HIGH_ACT; + inf->modes[0].sync |= FB_SYNC_HOR_HIGH_ACT; } } else if (!strncmp(this_opt, "vsync:", 6)) { if (simple_strtoul(this_opt+6, NULL, 0) == 0) { dev_info(dev, "override vsync: Active Low\n"); - inf->sync &= ~FB_SYNC_VERT_HIGH_ACT; + inf->modes[0].sync &= ~FB_SYNC_VERT_HIGH_ACT; } else { dev_info(dev, "override vsync: Active High\n"); - inf->sync |= FB_SYNC_VERT_HIGH_ACT; + inf->modes[0].sync |= FB_SYNC_VERT_HIGH_ACT; } } else if (!strncmp(this_opt, "dpc:", 4)) { if (simple_strtoul(this_opt+4, NULL, 0) == 0) { diff --git a/drivers/video/riva/fbdev.c b/drivers/video/riva/fbdev.c index 345e8b1c1af..1a13966b7d5 100644 --- a/drivers/video/riva/fbdev.c +++ b/drivers/video/riva/fbdev.c @@ -384,7 +384,7 @@ static void riva_bl_init(struct riva_par *par) snprintf(name, sizeof(name), "rivabl%d", info->node); - bd = backlight_device_register(name, par, &riva_bl_data); + bd = backlight_device_register(name, info->dev, par, &riva_bl_data); if (IS_ERR(bd)) { info->bl_dev = NULL; printk(KERN_WARNING "riva: Backlight registration failed\n"); diff --git a/drivers/video/sa1100fb.c b/drivers/video/sa1100fb.c index cd10b18150b..5d2a4a4b731 100644 --- a/drivers/video/sa1100fb.c +++ b/drivers/video/sa1100fb.c @@ -1200,9 +1200,9 @@ static void set_ctrlr_state(struct sa1100fb_info *fbi, u_int state) * Our LCD controller task (which is called when we blank or unblank) * via keventd. */ -static void sa1100fb_task(void *dummy) +static void sa1100fb_task(struct work_struct *w) { - struct sa1100fb_info *fbi = dummy; + struct sa1100fb_info *fbi = container_of(w, struct sa1100fb_info, task); u_int state = xchg(&fbi->task_state, -1); set_ctrlr_state(fbi, state); @@ -1444,7 +1444,7 @@ static struct sa1100fb_info * __init sa1100fb_init_fbinfo(struct device *dev) fbi->max_bpp / 8; init_waitqueue_head(&fbi->ctrlr_wait); - INIT_WORK(&fbi->task, sa1100fb_task, fbi); + INIT_WORK(&fbi->task, sa1100fb_task); init_MUTEX(&fbi->ctrlr_sem); return fbi; diff --git a/drivers/video/tcx.c b/drivers/video/tcx.c index 6990ab11cd0..5a99669232c 100644 --- a/drivers/video/tcx.c +++ b/drivers/video/tcx.c @@ -350,18 +350,23 @@ struct all_info { struct tcx_par par; }; -static void tcx_unmap_regs(struct all_info *all) +static void tcx_unmap_regs(struct of_device *op, struct all_info *all) { if (all->par.tec) - of_iounmap(all->par.tec, sizeof(struct tcx_tec)); + of_iounmap(&op->resource[7], + all->par.tec, sizeof(struct tcx_tec)); if (all->par.thc) - of_iounmap(all->par.thc, sizeof(struct tcx_thc)); + of_iounmap(&op->resource[9], + all->par.thc, sizeof(struct tcx_thc)); if (all->par.bt) - of_iounmap(all->par.bt, sizeof(struct bt_regs)); + of_iounmap(&op->resource[8], + all->par.bt, sizeof(struct bt_regs)); if (all->par.cplane) - of_iounmap(all->par.cplane, all->par.fbsize * sizeof(u32)); + of_iounmap(&op->resource[4], + all->par.cplane, all->par.fbsize * sizeof(u32)); if (all->info.screen_base) - of_iounmap(all->info.screen_base, all->par.fbsize); + of_iounmap(&op->resource[0], + all->info.screen_base, all->par.fbsize); } static int __devinit tcx_init_one(struct of_device *op) @@ -398,7 +403,7 @@ static int __devinit tcx_init_one(struct of_device *op) all->par.fbsize, "tcx ram"); if (!all->par.tec || !all->par.thc || !all->par.bt || !all->info.screen_base) { - tcx_unmap_regs(all); + tcx_unmap_regs(op, all); kfree(all); return -ENOMEM; } @@ -409,7 +414,7 @@ static int __devinit tcx_init_one(struct of_device *op) all->par.fbsize * sizeof(u32), "tcx cplane"); if (!all->par.cplane) { - tcx_unmap_regs(all); + tcx_unmap_regs(op, all); kfree(all); return -ENOMEM; } @@ -461,7 +466,7 @@ static int __devinit tcx_init_one(struct of_device *op) tcx_blank(FB_BLANK_UNBLANK, &all->info); if (fb_alloc_cmap(&all->info.cmap, 256, 0)) { - tcx_unmap_regs(all); + tcx_unmap_regs(op, all); kfree(all); return -ENOMEM; } @@ -472,7 +477,7 @@ static int __devinit tcx_init_one(struct of_device *op) err = register_framebuffer(&all->info); if (err < 0) { fb_dealloc_cmap(&all->info.cmap); - tcx_unmap_regs(all); + tcx_unmap_regs(op, all); kfree(all); return err; } @@ -495,18 +500,18 @@ static int __devinit tcx_probe(struct of_device *dev, const struct of_device_id return tcx_init_one(op); } -static int __devexit tcx_remove(struct of_device *dev) +static int __devexit tcx_remove(struct of_device *op) { - struct all_info *all = dev_get_drvdata(&dev->dev); + struct all_info *all = dev_get_drvdata(&op->dev); unregister_framebuffer(&all->info); fb_dealloc_cmap(&all->info.cmap); - tcx_unmap_regs(all); + tcx_unmap_regs(op, all); kfree(all); - dev_set_drvdata(&dev->dev, NULL); + dev_set_drvdata(&op->dev, NULL); return 0; } |