Various fbdev changes for 3.11

* xilinxfb updates
 * Small cleanups and fixes to multiple drivers
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.12 (GNU/Linux)
 
 iQIcBAABAgAGBQJRy/7gAAoJEPo9qoy8lh71vfEQAKr7rkOCvzXfPjtq5Rh/vpNm
 H/1NU8nBdChwvBk3Anvi0gUpXahT4hItfS5+2/FpAyoI9Kms9kCT4BXck94+Hbjf
 DHkSE6SXN6djbiuXvkR6e9ruL8XSXo6mG1Yu9WzFPVBvUUEvnds/Q0QjwaLPMDhW
 Wajkuk2E0x0NgmdUV3QeapFuTsq6JV3aDLH9Rx8ziiQSkr59+PyJ6bL8P24VqIaR
 MOC4avjUjs1aA81oEsPVo5HJpdkk+/YhYVfCJf2QvtjppyH4mjNbapN9kOyjz6kF
 dslzbjI9/veWvzgvA3ViuflSxp0qsccts+D40YxW7KbMZh5M8gSd51pci3VfQQQt
 Q//FaVSYP0BBhZp7+LHD8h41eKIYNYAstL25bbvTJ6IXPVJWU278+wIK7KpeRqyB
 MKJjJKWjUPSVqsZkA8f97fevjB2nDX2gdriCiGYJysDAUEsgBaseNVUkOEFkd/v3
 npO5NpcqKaOgv2Vplasi4US5jwCgOairraL3LMyjIYdYGkwezqISL8aXO4jipce/
 PfA2Z7OMH1/658gsefDfPCSChksnnF38IxS07cylgxTqsAqFkea+u3ULWwWBvCtN
 eBbxqSZEh+N5SzQYwOJDurCIMeVnFY4fkxZiw+MvcLBzUuqkC/I/pvvmBPAxQFzy
 HTr+YkDY6eUILAbBMHWs
 =KFzn
 -----END PGP SIGNATURE-----

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
This commit is contained in:
Jean-Christophe PLAGNIOL-VILLARD 2013-06-28 18:01:28 +08:00
commit 19fd7441e9
35 changed files with 113 additions and 136 deletions

View File

@ -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

View File

@ -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;

View File

@ -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 */

View File

@ -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)

View File

@ -579,7 +579,6 @@ static int au1100fb_drv_probe(struct platform_device *dev)
if (fbdev->info.cmap.len != 0) {
fb_dealloc_cmap(&fbdev->info.cmap);
}
platform_set_drvdata(dev, NULL);
return -ENODEV;
}

View File

@ -681,7 +681,6 @@ static int bfin_bf54x_probe(struct platform_device *pdev)
out2:
free_dma(CH_EPPI0);
out1:
platform_set_drvdata(pdev, NULL);
return ret;
}

View File

@ -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");

View File

@ -578,7 +578,6 @@ static int bfin_t350mcqb_probe(struct platform_device *pdev)
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");

View File

@ -595,7 +595,6 @@ static int ep93xxfb_probe(struct platform_device *pdev)
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;
}

View File

@ -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,

View File

@ -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;

View File

@ -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;

View File

@ -923,7 +923,6 @@ static int __init imxfb_probe(struct platform_device *pdev)
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();

View File

@ -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;

View File

@ -659,7 +659,6 @@ static int mmpfb_probe(struct platform_device *pdev)
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);

View File

@ -566,7 +566,6 @@ static int mmphw_probe(struct platform_device *pdev)
devm_kfree(ctrl->dev, ctrl);
}
platform_set_drvdata(pdev, NULL);
dev_err(&pdev->dev, "device init failed\n");
return ret;

View File

@ -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;
}

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -711,7 +711,6 @@ static int pxa3xx_gcu_probe(struct platform_device *dev)
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);

View File

@ -2256,7 +2256,6 @@ static int pxafb_probe(struct platform_device *dev)
release_mem_region(r->start, resource_size(r));
failed_fbi:
clk_put(fbi->clk);
platform_set_drvdata(dev, NULL);
kfree(fbi);
failed:
return ret;

View File

@ -1005,7 +1005,6 @@ static int s3c24xxfb_probe(struct platform_device *pdev,
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;

View File

@ -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;

View File

@ -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;
}

View File

@ -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;

View File

@ -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;

View File

@ -794,7 +794,6 @@ static int tmiofb_probe(struct platform_device *dev)
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);

View File

@ -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 */

View File

@ -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);
}

View File

@ -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);
}

View File

@ -448,7 +448,6 @@ static int vt8500lcd_probe(struct platform_device *pdev)
failed_free_res:
release_mem_region(res->start, resource_size(res));
failed_fbi:
platform_set_drvdata(pdev, NULL);
kfree(fbi);
failed:
return ret;

View File

@ -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;

View File

@ -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 @@ static int xilinxfb_assign(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);
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)

View File

@ -10,6 +10,7 @@
#define __LINUX_OF_DISPLAY_TIMING_H
struct device_node;
struct display_timing;
struct display_timings;
#define OF_USE_NATIVE_MODE -1