diff options
author | Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> | 2013-06-28 18:01:28 +0800 |
---|---|---|
committer | Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> | 2013-06-28 18:01:28 +0800 |
commit | 19fd7441e9cc29b6c6d73c5469b3c93aa245fbb5 (patch) | |
tree | ab5e98ae677baecab3155b34983d97ffd08281c0 /drivers/video | |
parent | b75bf98b5d2b7fdb876d3dd7eaec8246d4cc7174 (diff) | |
parent | 464d8a54a0ca7827a2278e2122e5eb22462ae044 (diff) |
Merge tag 'fbdev-3.11-2' of git://gitorious.org/linux-omap-dss2/linux into fbdev/for-next
Various fbdev changes for 3.11
* xilinxfb updates
* Small cleanups and fixes to multiple drivers
Diffstat (limited to 'drivers/video')
34 files changed, 112 insertions, 136 deletions
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig index 2e937bdace6f..2c301f8441e9 100644 --- a/drivers/video/Kconfig +++ b/drivers/video/Kconfig @@ -2188,7 +2188,7 @@ config FB_PS3_DEFAULT_SIZE_M config FB_XILINX tristate "Xilinx frame buffer support" - depends on FB && (XILINX_VIRTEX || MICROBLAZE) + depends on FB && (XILINX_VIRTEX || MICROBLAZE || ARCH_ZYNQ) select FB_CFB_FILLRECT select FB_CFB_COPYAREA select FB_CFB_IMAGEBLIT diff --git a/drivers/video/aty/aty128fb.c b/drivers/video/aty/aty128fb.c index 8c55011313dc..a4dfe8cb0a0a 100644 --- a/drivers/video/aty/aty128fb.c +++ b/drivers/video/aty/aty128fb.c @@ -2016,7 +2016,7 @@ static int aty128_init(struct pci_dev *pdev, const struct pci_device_id *ent) aty128_init_engine(par); - par->pm_reg = pci_find_capability(pdev, PCI_CAP_ID_PM); + par->pm_reg = pdev->pm_cap; par->pdev = pdev; par->asleep = 0; par->lock_blank = 0; diff --git a/drivers/video/aty/atyfb_base.c b/drivers/video/aty/atyfb_base.c index 4f27fdc58d84..a89c15de9f45 100644 --- a/drivers/video/aty/atyfb_base.c +++ b/drivers/video/aty/atyfb_base.c @@ -58,6 +58,7 @@ #include <linux/slab.h> #include <linux/vmalloc.h> #include <linux/delay.h> +#include <linux/compiler.h> #include <linux/console.h> #include <linux/fb.h> #include <linux/init.h> @@ -434,8 +435,8 @@ static int correct_chipset(struct atyfb_par *par) const char *name; int i; - for (i = ARRAY_SIZE(aty_chips) - 1; i >= 0; i--) - if (par->pci_id == aty_chips[i].pci_id) + for (i = ARRAY_SIZE(aty_chips); i > 0; i--) + if (par->pci_id == aty_chips[i - 1].pci_id) break; if (i < 0) @@ -531,8 +532,8 @@ static int correct_chipset(struct atyfb_par *par) return 0; } -static char ram_dram[] = "DRAM"; -static char ram_resv[] = "RESV"; +static char ram_dram[] __maybe_unused = "DRAM"; +static char ram_resv[] __maybe_unused = "RESV"; #ifdef CONFIG_FB_ATY_GX static char ram_vram[] = "VRAM"; #endif /* CONFIG_FB_ATY_GX */ diff --git a/drivers/video/aty/radeon_pm.c b/drivers/video/aty/radeon_pm.c index 92bda5848516..f7091ece580d 100644 --- a/drivers/video/aty/radeon_pm.c +++ b/drivers/video/aty/radeon_pm.c @@ -2805,7 +2805,7 @@ static void radeonfb_early_resume(void *data) void radeonfb_pm_init(struct radeonfb_info *rinfo, int dynclk, int ignore_devlist, int force_sleep) { /* Find PM registers in config space if any*/ - rinfo->pm_reg = pci_find_capability(rinfo->pdev, PCI_CAP_ID_PM); + rinfo->pm_reg = rinfo->pdev->pm_cap; /* Enable/Disable dynamic clocks: TODO add sysfs access */ if (rinfo->family == CHIP_FAMILY_RS480) diff --git a/drivers/video/au1100fb.c b/drivers/video/au1100fb.c index 700cac067b46..606a3babe792 100644 --- a/drivers/video/au1100fb.c +++ b/drivers/video/au1100fb.c @@ -579,7 +579,6 @@ failed: if (fbdev->info.cmap.len != 0) { fb_dealloc_cmap(&fbdev->info.cmap); } - platform_set_drvdata(dev, NULL); return -ENODEV; } diff --git a/drivers/video/bf54x-lq043fb.c b/drivers/video/bf54x-lq043fb.c index 2726a5b66741..87f288bfc58c 100644 --- a/drivers/video/bf54x-lq043fb.c +++ b/drivers/video/bf54x-lq043fb.c @@ -681,7 +681,6 @@ out3: out2: free_dma(CH_EPPI0); out1: - platform_set_drvdata(pdev, NULL); return ret; } diff --git a/drivers/video/bfin-lq035q1-fb.c b/drivers/video/bfin-lq035q1-fb.c index 29d8c0443a1f..b594a58ff21d 100644 --- a/drivers/video/bfin-lq035q1-fb.c +++ b/drivers/video/bfin-lq035q1-fb.c @@ -170,16 +170,19 @@ static int lq035q1_spidev_remove(struct spi_device *spi) return lq035q1_control(spi, LQ035_SHUT_CTL, LQ035_SHUT); } -#ifdef CONFIG_PM -static int lq035q1_spidev_suspend(struct spi_device *spi, pm_message_t state) +#ifdef CONFIG_PM_SLEEP +static int lq035q1_spidev_suspend(struct device *dev) { + struct spi_device *spi = to_spi_device(dev); + return lq035q1_control(spi, LQ035_SHUT_CTL, LQ035_SHUT); } -static int lq035q1_spidev_resume(struct spi_device *spi) +static int lq035q1_spidev_resume(struct device *dev) { - int ret; + struct spi_device *spi = to_spi_device(dev); struct spi_control *ctl = spi_get_drvdata(spi); + int ret; ret = lq035q1_control(spi, LQ035_DRIVER_OUTPUT_CTL, ctl->mode); if (ret) @@ -187,9 +190,13 @@ static int lq035q1_spidev_resume(struct spi_device *spi) return lq035q1_control(spi, LQ035_SHUT_CTL, LQ035_ON); } + +static SIMPLE_DEV_PM_OPS(lq035q1_spidev_pm_ops, lq035q1_spidev_suspend, + lq035q1_spidev_resume); +#define LQ035Q1_SPIDEV_PM_OPS (&lq035q1_spidev_pm_ops) + #else -# define lq035q1_spidev_suspend NULL -# define lq035q1_spidev_resume NULL +#define LQ035Q1_SPIDEV_PM_OPS NULL #endif /* Power down all displays on reboot, poweroff or halt */ @@ -708,8 +715,7 @@ static int bfin_lq035q1_probe(struct platform_device *pdev) info->spidrv.probe = lq035q1_spidev_probe; info->spidrv.remove = lq035q1_spidev_remove; info->spidrv.shutdown = lq035q1_spidev_shutdown; - info->spidrv.suspend = lq035q1_spidev_suspend; - info->spidrv.resume = lq035q1_spidev_resume; + info->spidrv.driver.pm = LQ035Q1_SPIDEV_PM_OPS; ret = spi_register_driver(&info->spidrv); if (ret < 0) { @@ -759,7 +765,6 @@ static int bfin_lq035q1_probe(struct platform_device *pdev) out2: free_dma(CH_PPI); out1: - platform_set_drvdata(pdev, NULL); return ret; } @@ -788,7 +793,6 @@ static int bfin_lq035q1_remove(struct platform_device *pdev) bfin_lq035q1_free_ports(info->disp_info->ppi_mode == USE_RGB565_16_BIT_PPI); - platform_set_drvdata(pdev, NULL); framebuffer_release(fbinfo); dev_info(&pdev->dev, "unregistered LCD driver\n"); diff --git a/drivers/video/bfin-t350mcqb-fb.c b/drivers/video/bfin-t350mcqb-fb.c index d46da01c31ae..48c0c4e38a62 100644 --- a/drivers/video/bfin-t350mcqb-fb.c +++ b/drivers/video/bfin-t350mcqb-fb.c @@ -578,7 +578,6 @@ out3: out2: free_dma(CH_PPI); out1: - platform_set_drvdata(pdev, NULL); return ret; } @@ -608,7 +607,6 @@ static int bfin_t350mcqb_remove(struct platform_device *pdev) bfin_t350mcqb_request_ports(0); - platform_set_drvdata(pdev, NULL); framebuffer_release(fbinfo); printk(KERN_INFO DRIVER_NAME ": Unregister LCD driver.\n"); diff --git a/drivers/video/ep93xx-fb.c b/drivers/video/ep93xx-fb.c index ee1ee5401544..28a837dfddd1 100644 --- a/drivers/video/ep93xx-fb.c +++ b/drivers/video/ep93xx-fb.c @@ -595,7 +595,6 @@ failed_videomem: fb_dealloc_cmap(&info->cmap); failed_cmap: kfree(info); - platform_set_drvdata(pdev, NULL); return err; } @@ -614,7 +613,6 @@ static int ep93xxfb_remove(struct platform_device *pdev) fbi->mach_info->teardown(pdev); kfree(info); - platform_set_drvdata(pdev, NULL); return 0; } diff --git a/drivers/video/fbmem.c b/drivers/video/fbmem.c index d8d5779145db..36e1fe21b9b5 100644 --- a/drivers/video/fbmem.c +++ b/drivers/video/fbmem.c @@ -1305,7 +1305,9 @@ static int do_fscreeninfo_to_user(struct fb_fix_screeninfo *fix, err |= copy_to_user(fix32->reserved, fix->reserved, sizeof(fix->reserved)); - return err; + if (err) + return -EFAULT; + return 0; } static int fb_get_fscreeninfo(struct fb_info *info, unsigned int cmd, diff --git a/drivers/video/fsl-diu-fb.c b/drivers/video/fsl-diu-fb.c index 6c278056fc60..6dd72250111e 100644 --- a/drivers/video/fsl-diu-fb.c +++ b/drivers/video/fsl-diu-fb.c @@ -469,7 +469,7 @@ static enum fsl_diu_monitor_port fsl_diu_name_to_port(const char *s) unsigned long val; if (s) { - if (!strict_strtoul(s, 10, &val) && (val <= 2)) + if (!kstrtoul(s, 10, &val) && (val <= 2)) port = (enum fsl_diu_monitor_port) val; else if (strncmp(s, "lvds", 4) == 0) port = FSL_DIU_PORT_LVDS; @@ -1853,7 +1853,7 @@ static int __init fsl_diu_setup(char *options) if (!strncmp(opt, "monitor=", 8)) { monitor_port = fsl_diu_name_to_port(opt + 8); } else if (!strncmp(opt, "bpp=", 4)) { - if (!strict_strtoul(opt + 4, 10, &val)) + if (!kstrtoul(opt + 4, 10, &val)) default_bpp = val; } else fb_mode = opt; diff --git a/drivers/video/i740fb.c b/drivers/video/i740fb.c index cfd0c52e8f73..6c4838818950 100644 --- a/drivers/video/i740fb.c +++ b/drivers/video/i740fb.c @@ -1302,7 +1302,7 @@ static int __init i740fb_setup(char *options) } #endif -int __init i740fb_init(void) +static int __init i740fb_init(void) { #ifndef MODULE char *option = NULL; diff --git a/drivers/video/imxfb.c b/drivers/video/imxfb.c index 0abf2bf20836..12af22ba4d92 100644 --- a/drivers/video/imxfb.c +++ b/drivers/video/imxfb.c @@ -923,7 +923,6 @@ failed_getclock: failed_req: kfree(info->pseudo_palette); failed_init: - platform_set_drvdata(pdev, NULL); framebuffer_release(info); return ret; } @@ -955,12 +954,10 @@ static int imxfb_remove(struct platform_device *pdev) iounmap(fbi->regs); release_mem_region(res->start, resource_size(res)); - platform_set_drvdata(pdev, NULL); - return 0; } -void imxfb_shutdown(struct platform_device * dev) +static void imxfb_shutdown(struct platform_device *dev) { struct fb_info *info = platform_get_drvdata(dev); struct imxfb_info *fbi = info->par; @@ -999,7 +996,7 @@ static int imxfb_setup(void) return 0; } -int __init imxfb_init(void) +static int __init imxfb_init(void) { int ret = imxfb_setup(); diff --git a/drivers/video/jz4740_fb.c b/drivers/video/jz4740_fb.c index 36979b4131ab..2c49112fdd6c 100644 --- a/drivers/video/jz4740_fb.c +++ b/drivers/video/jz4740_fb.c @@ -737,8 +737,6 @@ static int jzfb_remove(struct platform_device *pdev) fb_dealloc_cmap(&jzfb->fb->cmap); jzfb_free_devmem(jzfb); - platform_set_drvdata(pdev, NULL); - framebuffer_release(jzfb->fb); return 0; diff --git a/drivers/video/mmp/fb/mmpfb.c b/drivers/video/mmp/fb/mmpfb.c index 6d1fa96c5cc3..4ab95b8daed3 100644 --- a/drivers/video/mmp/fb/mmpfb.c +++ b/drivers/video/mmp/fb/mmpfb.c @@ -659,7 +659,6 @@ failed_destroy_mutex: mutex_destroy(&fbi->access_ok); failed: dev_err(fbi->dev, "mmp-fb: frame buffer device init failed\n"); - platform_set_drvdata(pdev, NULL); framebuffer_release(info); diff --git a/drivers/video/mmp/hw/mmp_ctrl.c b/drivers/video/mmp/hw/mmp_ctrl.c index 8612590ea943..75dca19bf214 100644 --- a/drivers/video/mmp/hw/mmp_ctrl.c +++ b/drivers/video/mmp/hw/mmp_ctrl.c @@ -566,7 +566,6 @@ failed: devm_kfree(ctrl->dev, ctrl); } - platform_set_drvdata(pdev, NULL); dev_err(&pdev->dev, "device init failed\n"); return ret; diff --git a/drivers/video/mxsfb.c b/drivers/video/mxsfb.c index 21223d475b39..3ba37713b1f9 100644 --- a/drivers/video/mxsfb.c +++ b/drivers/video/mxsfb.c @@ -899,7 +899,6 @@ static int mxsfb_probe(struct platform_device *pdev) host->base = devm_ioremap_resource(&pdev->dev, res); if (IS_ERR(host->base)) { - dev_err(&pdev->dev, "ioremap failed\n"); ret = PTR_ERR(host->base); goto fb_release; } @@ -986,8 +985,6 @@ static int mxsfb_remove(struct platform_device *pdev) framebuffer_release(fb_info); - platform_set_drvdata(pdev, NULL); - return 0; } diff --git a/drivers/video/nuc900fb.c b/drivers/video/nuc900fb.c index 32581c72ad09..8c527e5b293c 100644 --- a/drivers/video/nuc900fb.c +++ b/drivers/video/nuc900fb.c @@ -707,7 +707,6 @@ static int nuc900fb_remove(struct platform_device *pdev) release_resource(fbi->mem); kfree(fbi->mem); - platform_set_drvdata(pdev, NULL); framebuffer_release(fbinfo); return 0; diff --git a/drivers/video/omap2/displays/panel-taal.c b/drivers/video/omap2/displays/panel-taal.c index c731d3c068b4..54a07da8587a 100644 --- a/drivers/video/omap2/displays/panel-taal.c +++ b/drivers/video/omap2/displays/panel-taal.c @@ -573,7 +573,7 @@ static ssize_t taal_store_esd_interval(struct device *dev, unsigned long t; int r; - r = strict_strtoul(buf, 10, &t); + r = kstrtoul(buf, 10, &t); if (r) return r; @@ -611,7 +611,7 @@ static ssize_t taal_store_ulps(struct device *dev, unsigned long t; int r; - r = strict_strtoul(buf, 10, &t); + r = kstrtoul(buf, 10, &t); if (r) return r; @@ -660,7 +660,7 @@ static ssize_t taal_store_ulps_timeout(struct device *dev, unsigned long t; int r; - r = strict_strtoul(buf, 10, &t); + r = kstrtoul(buf, 10, &t); if (r) return r; diff --git a/drivers/video/omap2/dss/dpi.c b/drivers/video/omap2/dss/dpi.c index 6433eab6bcf2..a6b331ef7763 100644 --- a/drivers/video/omap2/dss/dpi.c +++ b/drivers/video/omap2/dss/dpi.c @@ -131,7 +131,7 @@ static bool dpi_calc_dispc_cb(int lckd, int pckd, unsigned long lck, * shifted. So skip all odd dividers when the pixel clock is on the * higher side. */ - if (ctx->pck_min >= 1000000) { + if (ctx->pck_min >= 100000000) { if (lckd > 1 && lckd % 2 != 0) return false; @@ -158,7 +158,7 @@ static bool dpi_calc_hsdiv_cb(int regm_dispc, unsigned long dispc, * shifted. So skip all odd dividers when the pixel clock is on the * higher side. */ - if (regm_dispc > 1 && regm_dispc % 2 != 0 && ctx->pck_min >= 1000000) + if (regm_dispc > 1 && regm_dispc % 2 != 0 && ctx->pck_min >= 100000000) return false; ctx->dsi_cinfo.regm_dispc = regm_dispc; diff --git a/drivers/video/pxa3xx-gcu.c b/drivers/video/pxa3xx-gcu.c index 97563c55af63..95c3c4ae81cc 100644 --- a/drivers/video/pxa3xx-gcu.c +++ b/drivers/video/pxa3xx-gcu.c @@ -711,7 +711,6 @@ err_misc_deregister: misc_deregister(&priv->misc_dev); err_free_priv: - platform_set_drvdata(dev, NULL); free_buffers(dev, priv); kfree(priv); return ret; @@ -729,7 +728,6 @@ static int pxa3xx_gcu_remove(struct platform_device *dev) priv->shared, priv->shared_phys); iounmap(priv->mmio_base); release_mem_region(r->start, resource_size(r)); - platform_set_drvdata(dev, NULL); clk_disable(priv->clk); free_buffers(dev, priv); kfree(priv); diff --git a/drivers/video/pxafb.c b/drivers/video/pxafb.c index 580f80cc586f..eca2de45f7a6 100644 --- a/drivers/video/pxafb.c +++ b/drivers/video/pxafb.c @@ -2256,7 +2256,6 @@ failed_free_res: release_mem_region(r->start, resource_size(r)); failed_fbi: clk_put(fbi->clk); - platform_set_drvdata(dev, NULL); kfree(fbi); failed: return ret; diff --git a/drivers/video/s3c2410fb.c b/drivers/video/s3c2410fb.c index 76a0e7fbd692..21a32adbb8ea 100644 --- a/drivers/video/s3c2410fb.c +++ b/drivers/video/s3c2410fb.c @@ -1005,7 +1005,6 @@ release_regs: release_mem: release_mem_region(res->start, size); dealloc_fb: - platform_set_drvdata(pdev, NULL); framebuffer_release(fbinfo); return ret; } @@ -1051,7 +1050,6 @@ static int s3c2410fb_remove(struct platform_device *pdev) release_mem_region(info->mem->start, resource_size(info->mem)); - platform_set_drvdata(pdev, NULL); framebuffer_release(fbinfo); return 0; diff --git a/drivers/video/sa1100fb.c b/drivers/video/sa1100fb.c index f34c858642e8..de76da0c6429 100644 --- a/drivers/video/sa1100fb.c +++ b/drivers/video/sa1100fb.c @@ -1271,7 +1271,6 @@ static int sa1100fb_probe(struct platform_device *pdev) failed: if (fbi) iounmap(fbi->base); - platform_set_drvdata(pdev, NULL); kfree(fbi); release_mem_region(res->start, resource_size(res)); return ret; diff --git a/drivers/video/sh7760fb.c b/drivers/video/sh7760fb.c index 5fbb0c7ab0c8..a8c6c43a4658 100644 --- a/drivers/video/sh7760fb.c +++ b/drivers/video/sh7760fb.c @@ -571,7 +571,6 @@ static int sh7760fb_remove(struct platform_device *dev) iounmap(par->base); release_mem_region(par->ioarea->start, resource_size(par->ioarea)); framebuffer_release(info); - platform_set_drvdata(dev, NULL); return 0; } diff --git a/drivers/video/sh_mipi_dsi.c b/drivers/video/sh_mipi_dsi.c index 6cad53075e99..8f6e8ff620d4 100644 --- a/drivers/video/sh_mipi_dsi.c +++ b/drivers/video/sh_mipi_dsi.c @@ -567,7 +567,6 @@ static int sh_mipi_remove(struct platform_device *pdev) iounmap(mipi->base); if (res) release_mem_region(res->start, resource_size(res)); - platform_set_drvdata(pdev, NULL); kfree(mipi); return 0; diff --git a/drivers/video/smscufx.c b/drivers/video/smscufx.c index b2b33fc1ac3f..e188ada2ffd1 100644 --- a/drivers/video/smscufx.c +++ b/drivers/video/smscufx.c @@ -1622,7 +1622,7 @@ static int ufx_usb_probe(struct usb_interface *interface, { struct usb_device *usbdev; struct ufx_data *dev; - struct fb_info *info = 0; + struct fb_info *info = NULL; int retval = -ENOMEM; u32 id_rev, fpga_rev; diff --git a/drivers/video/tmiofb.c b/drivers/video/tmiofb.c index dc4fb8620156..deb8733f3c70 100644 --- a/drivers/video/tmiofb.c +++ b/drivers/video/tmiofb.c @@ -794,7 +794,6 @@ err_hw_init: cell->disable(dev); err_enable: err_find_mode: - platform_set_drvdata(dev, NULL); free_irq(irq, info); err_request_irq: iounmap(info->screen_base); @@ -823,8 +822,6 @@ static int tmiofb_remove(struct platform_device *dev) if (cell->disable) cell->disable(dev); - platform_set_drvdata(dev, NULL); - free_irq(irq, info); iounmap(info->screen_base); diff --git a/drivers/video/udlfb.c b/drivers/video/udlfb.c index ec03e726c940..d2e5bc3cf969 100644 --- a/drivers/video/udlfb.c +++ b/drivers/video/udlfb.c @@ -434,10 +434,10 @@ static void dlfb_compress_hline( while ((pixel_end > pixel) && (cmd_buffer_end - MIN_RLX_CMD_BYTES > cmd)) { - uint8_t *raw_pixels_count_byte = 0; - uint8_t *cmd_pixels_count_byte = 0; - const uint16_t *raw_pixel_start = 0; - const uint16_t *cmd_pixel_start, *cmd_pixel_end = 0; + uint8_t *raw_pixels_count_byte = NULL; + uint8_t *cmd_pixels_count_byte = NULL; + const uint16_t *raw_pixel_start = NULL; + const uint16_t *cmd_pixel_start, *cmd_pixel_end = NULL; prefetchw((void *) cmd); /* pull in one cache line at least */ @@ -573,7 +573,7 @@ static int dlfb_render_hline(struct dlfb_data *dev, struct urb **urb_ptr, return 0; } -int dlfb_handle_damage(struct dlfb_data *dev, int x, int y, +static int dlfb_handle_damage(struct dlfb_data *dev, int x, int y, int width, int height, char *data) { int i, ret; @@ -1588,7 +1588,7 @@ static int dlfb_usb_probe(struct usb_interface *interface, const struct usb_device_id *id) { struct usb_device *usbdev; - struct dlfb_data *dev = 0; + struct dlfb_data *dev = NULL; int retval = -ENOMEM; /* usb initialization */ diff --git a/drivers/video/uvesafb.c b/drivers/video/uvesafb.c index e328a61b64ba..10138b60fd70 100644 --- a/drivers/video/uvesafb.c +++ b/drivers/video/uvesafb.c @@ -819,8 +819,8 @@ static int uvesafb_vbe_init(struct fb_info *info) if (par->pmi_setpal || par->ypan) { if (__supported_pte_mask & _PAGE_NX) { par->pmi_setpal = par->ypan = 0; - printk(KERN_WARNING "uvesafb: NX protection is actively." - "We have better not to use the PMI.\n"); + printk(KERN_WARNING "uvesafb: NX protection is active, " + "better not use the PMI.\n"); } else { uvesafb_vbe_getpmi(task, par); } diff --git a/drivers/video/vga16fb.c b/drivers/video/vga16fb.c index 545faeccdb44..830ded45fd47 100644 --- a/drivers/video/vga16fb.c +++ b/drivers/video/vga16fb.c @@ -1269,7 +1269,6 @@ static void vga16fb_destroy(struct fb_info *info) iounmap(info->screen_base); fb_dealloc_cmap(&info->cmap); /* XXX unshare VGA regions */ - platform_set_drvdata(dev, NULL); framebuffer_release(info); } diff --git a/drivers/video/vt8500lcdfb.c b/drivers/video/vt8500lcdfb.c index 9547e1831e03..897484903c30 100644 --- a/drivers/video/vt8500lcdfb.c +++ b/drivers/video/vt8500lcdfb.c @@ -448,7 +448,6 @@ failed_free_io: failed_free_res: release_mem_region(res->start, resource_size(res)); failed_fbi: - platform_set_drvdata(pdev, NULL); kfree(fbi); failed: return ret; diff --git a/drivers/video/wm8505fb.c b/drivers/video/wm8505fb.c index 01f9ace068e2..3072f30cad19 100644 --- a/drivers/video/wm8505fb.c +++ b/drivers/video/wm8505fb.c @@ -173,7 +173,7 @@ static ssize_t contrast_store(struct device *dev, struct wm8505fb_info *fbi = to_wm8505fb_info(info); unsigned long tmp; - if (strict_strtoul(buf, 10, &tmp) || (tmp > 0xff)) + if (kstrtoul(buf, 10, &tmp) || (tmp > 0xff)) return -EINVAL; fbi->contrast = tmp; diff --git a/drivers/video/xilinxfb.c b/drivers/video/xilinxfb.c index af0b4fdf9aa9..f3d4a69e1e4e 100644 --- a/drivers/video/xilinxfb.c +++ b/drivers/video/xilinxfb.c @@ -44,7 +44,7 @@ /* - * Xilinx calls it "PLB TFT LCD Controller" though it can also be used for + * Xilinx calls it "TFT LCD Controller" though it can also be used for * the VGA port on the Xilinx ML40x board. This is a hardware display * controller for a 640x480 resolution TFT or VGA screen. * @@ -54,11 +54,11 @@ * don't start thinking about scrolling). The second allows the LCD to * be turned on or off as well as rotated 180 degrees. * - * In case of direct PLB access the second control register will be at + * In case of direct BUS access the second control register will be at * an offset of 4 as compared to the DCR access where the offset is 1 * i.e. REG_CTRL. So this is taken care in the function - * xilinx_fb_out_be32 where it left shifts the offset 2 times in case of - * direct PLB access. + * xilinx_fb_out32 where it left shifts the offset 2 times in case of + * direct BUS access. */ #define NUM_REGS 2 #define REG_FB_ADDR 0 @@ -116,7 +116,8 @@ static struct fb_var_screeninfo xilinx_fb_var = { }; -#define PLB_ACCESS_FLAG 0x1 /* 1 = PLB, 0 = DCR */ +#define BUS_ACCESS_FLAG 0x1 /* 1 = BUS, 0 = DCR */ +#define LITTLE_ENDIAN_ACCESS 0x2 /* LITTLE ENDIAN IO functions */ struct xilinxfb_drvdata { @@ -146,21 +147,40 @@ struct xilinxfb_drvdata { container_of(_info, struct xilinxfb_drvdata, info) /* - * The XPS TFT Controller can be accessed through PLB or DCR interface. + * The XPS TFT Controller can be accessed through BUS or DCR interface. * To perform the read/write on the registers we need to check on * which bus its connected and call the appropriate write API. */ -static void xilinx_fb_out_be32(struct xilinxfb_drvdata *drvdata, u32 offset, +static void xilinx_fb_out32(struct xilinxfb_drvdata *drvdata, u32 offset, u32 val) { - if (drvdata->flags & PLB_ACCESS_FLAG) - out_be32(drvdata->regs + (offset << 2), val); + if (drvdata->flags & BUS_ACCESS_FLAG) { + if (drvdata->flags & LITTLE_ENDIAN_ACCESS) + iowrite32(val, drvdata->regs + (offset << 2)); + else + iowrite32be(val, drvdata->regs + (offset << 2)); + } #ifdef CONFIG_PPC_DCR else dcr_write(drvdata->dcr_host, offset, val); #endif } +static u32 xilinx_fb_in32(struct xilinxfb_drvdata *drvdata, u32 offset) +{ + if (drvdata->flags & BUS_ACCESS_FLAG) { + if (drvdata->flags & LITTLE_ENDIAN_ACCESS) + return ioread32(drvdata->regs + (offset << 2)); + else + return ioread32be(drvdata->regs + (offset << 2)); + } +#ifdef CONFIG_PPC_DCR + else + return dcr_read(drvdata->dcr_host, offset); +#endif + return 0; +} + static int xilinx_fb_setcolreg(unsigned regno, unsigned red, unsigned green, unsigned blue, unsigned transp, struct fb_info *fbi) @@ -197,7 +217,7 @@ xilinx_fb_blank(int blank_mode, struct fb_info *fbi) switch (blank_mode) { case FB_BLANK_UNBLANK: /* turn on panel */ - xilinx_fb_out_be32(drvdata, REG_CTRL, drvdata->reg_ctrl_default); + xilinx_fb_out32(drvdata, REG_CTRL, drvdata->reg_ctrl_default); break; case FB_BLANK_NORMAL: @@ -205,7 +225,7 @@ xilinx_fb_blank(int blank_mode, struct fb_info *fbi) case FB_BLANK_HSYNC_SUSPEND: case FB_BLANK_POWERDOWN: /* turn off panel */ - xilinx_fb_out_be32(drvdata, REG_CTRL, 0); + xilinx_fb_out32(drvdata, REG_CTRL, 0); default: break; @@ -227,33 +247,23 @@ static struct fb_ops xilinxfb_ops = * Bus independent setup/teardown */ -static int xilinxfb_assign(struct device *dev, +static int xilinxfb_assign(struct platform_device *pdev, struct xilinxfb_drvdata *drvdata, - unsigned long physaddr, struct xilinxfb_platform_data *pdata) { int rc; + struct device *dev = &pdev->dev; int fbsize = pdata->xvirt * pdata->yvirt * BYTES_PER_PIXEL; - if (drvdata->flags & PLB_ACCESS_FLAG) { - /* - * Map the control registers in if the controller - * is on direct PLB interface. - */ - if (!request_mem_region(physaddr, 8, DRIVER_NAME)) { - dev_err(dev, "Couldn't lock memory region at 0x%08lX\n", - physaddr); - rc = -ENODEV; - goto err_region; - } + if (drvdata->flags & BUS_ACCESS_FLAG) { + struct resource *res; - drvdata->regs_phys = physaddr; - drvdata->regs = ioremap(physaddr, 8); + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + drvdata->regs_phys = res->start; + drvdata->regs = devm_request_and_ioremap(&pdev->dev, res); if (!drvdata->regs) { - dev_err(dev, "Couldn't lock memory region at 0x%08lX\n", - physaddr); - rc = -ENODEV; - goto err_map; + rc = -EADDRNOTAVAIL; + goto err_region; } } @@ -270,7 +280,7 @@ static int xilinxfb_assign(struct device *dev, if (!drvdata->fb_virt) { dev_err(dev, "Could not allocate frame buffer memory\n"); rc = -ENOMEM; - if (drvdata->flags & PLB_ACCESS_FLAG) + if (drvdata->flags & BUS_ACCESS_FLAG) goto err_fbmem; else goto err_region; @@ -280,13 +290,19 @@ static int xilinxfb_assign(struct device *dev, memset_io((void __iomem *)drvdata->fb_virt, 0, fbsize); /* Tell the hardware where the frame buffer is */ - xilinx_fb_out_be32(drvdata, REG_FB_ADDR, drvdata->fb_phys); + xilinx_fb_out32(drvdata, REG_FB_ADDR, drvdata->fb_phys); + rc = xilinx_fb_in32(drvdata, REG_FB_ADDR); + /* Endianess detection */ + if (rc != drvdata->fb_phys) { + drvdata->flags |= LITTLE_ENDIAN_ACCESS; + xilinx_fb_out32(drvdata, REG_FB_ADDR, drvdata->fb_phys); + } /* Turn on the display */ drvdata->reg_ctrl_default = REG_CTRL_ENABLE; if (pdata->rotate_screen) drvdata->reg_ctrl_default |= REG_CTRL_ROTATE; - xilinx_fb_out_be32(drvdata, REG_CTRL, + xilinx_fb_out32(drvdata, REG_CTRL, drvdata->reg_ctrl_default); /* Fill struct fb_info */ @@ -323,9 +339,9 @@ static int xilinxfb_assign(struct device *dev, goto err_regfb; } - if (drvdata->flags & PLB_ACCESS_FLAG) { + if (drvdata->flags & BUS_ACCESS_FLAG) { /* Put a banner in the log (for DEBUG) */ - dev_dbg(dev, "regs: phys=%lx, virt=%p\n", physaddr, + dev_dbg(dev, "regs: phys=%x, virt=%p\n", drvdata->regs_phys, drvdata->regs); } /* Put a banner in the log (for DEBUG) */ @@ -345,15 +361,11 @@ err_cmap: iounmap(drvdata->fb_virt); /* Turn off the display */ - xilinx_fb_out_be32(drvdata, REG_CTRL, 0); + xilinx_fb_out32(drvdata, REG_CTRL, 0); err_fbmem: - if (drvdata->flags & PLB_ACCESS_FLAG) - iounmap(drvdata->regs); - -err_map: - if (drvdata->flags & PLB_ACCESS_FLAG) - release_mem_region(physaddr, 8); + if (drvdata->flags & BUS_ACCESS_FLAG) + devm_iounmap(dev, drvdata->regs); err_region: kfree(drvdata); @@ -381,13 +393,11 @@ static int xilinxfb_release(struct device *dev) iounmap(drvdata->fb_virt); /* Turn off the display */ - xilinx_fb_out_be32(drvdata, REG_CTRL, 0); + xilinx_fb_out32(drvdata, REG_CTRL, 0); /* Release the resources, as allocated based on interface */ - if (drvdata->flags & PLB_ACCESS_FLAG) { - iounmap(drvdata->regs); - release_mem_region(drvdata->regs_phys, 8); - } + if (drvdata->flags & BUS_ACCESS_FLAG) + devm_iounmap(dev, drvdata->regs); #ifdef CONFIG_PPC_DCR else dcr_unmap(drvdata->dcr_host, drvdata->dcr_len); @@ -406,11 +416,9 @@ static int xilinxfb_release(struct device *dev) static int xilinxfb_of_probe(struct platform_device *op) { const u32 *prop; - u32 *p; - u32 tft_access; + u32 tft_access = 0; struct xilinxfb_platform_data pdata; - struct resource res; - int size, rc; + int size; struct xilinxfb_drvdata *drvdata; /* Copy with the default pdata (not a ptr reference!) */ @@ -424,34 +432,29 @@ static int xilinxfb_of_probe(struct platform_device *op) } /* - * To check whether the core is connected directly to DCR or PLB + * To check whether the core is connected directly to DCR or BUS * interface and initialize the tft_access accordingly. */ - p = (u32 *)of_get_property(op->dev.of_node, "xlnx,dcr-splb-slave-if", NULL); - tft_access = p ? *p : 0; + of_property_read_u32(op->dev.of_node, "xlnx,dcr-splb-slave-if", + &tft_access); /* - * Fill the resource structure if its direct PLB interface + * Fill the resource structure if its direct BUS interface * otherwise fill the dcr_host structure. */ if (tft_access) { - drvdata->flags |= PLB_ACCESS_FLAG; - rc = of_address_to_resource(op->dev.of_node, 0, &res); - if (rc) { - dev_err(&op->dev, "invalid address\n"); - goto err; - } + drvdata->flags |= BUS_ACCESS_FLAG; } #ifdef CONFIG_PPC_DCR else { int start; - res.start = 0; start = dcr_resource_start(op->dev.of_node, 0); drvdata->dcr_len = dcr_resource_len(op->dev.of_node, 0); drvdata->dcr_host = dcr_map(op->dev.of_node, start, drvdata->dcr_len); if (!DCR_MAP_OK(drvdata->dcr_host)) { dev_err(&op->dev, "invalid DCR address\n"); - goto err; + kfree(drvdata); + return -ENODEV; } } #endif @@ -478,11 +481,7 @@ static int xilinxfb_of_probe(struct platform_device *op) pdata.rotate_screen = 1; dev_set_drvdata(&op->dev, drvdata); - return xilinxfb_assign(&op->dev, drvdata, res.start, &pdata); - - err: - kfree(drvdata); - return -ENODEV; + return xilinxfb_assign(op, drvdata, &pdata); } static int xilinxfb_of_remove(struct platform_device *op) |