Lines Matching +full:tft +full:- +full:lcd

2  * Xilinx TFT frame buffer driver
7 * 2002-2007 (c) MontaVista Software, Inc.
32 #include <linux/dma-mapping.h>
44 * Xilinx calls it "TFT LCD Controller" though it can also be used for
46 * controller for a 640x480 resolution TFT or VGA screen.
49 * control registers. The first tells the LCD interface where in memory
51 * don't start thinking about scrolling). The second allows the LCD to
71 * significant bits are the blue level. Each row of the LCD uses 1024
92 /* Physical address of framebuffer memory; If non-zero, driver
162 * The XPS TFT Controller can be accessed through BUS or DCR interface.
169 if (drvdata->flags & BUS_ACCESS_FLAG) { in xilinx_fb_out32()
170 if (drvdata->flags & LITTLE_ENDIAN_ACCESS) in xilinx_fb_out32()
171 iowrite32(val, drvdata->regs + (offset << 2)); in xilinx_fb_out32()
173 iowrite32be(val, drvdata->regs + (offset << 2)); in xilinx_fb_out32()
177 dcr_write(drvdata->dcr_host, offset, val); in xilinx_fb_out32()
183 if (drvdata->flags & BUS_ACCESS_FLAG) { in xilinx_fb_in32()
184 if (drvdata->flags & LITTLE_ENDIAN_ACCESS) in xilinx_fb_in32()
185 return ioread32(drvdata->regs + (offset << 2)); in xilinx_fb_in32()
187 return ioread32be(drvdata->regs + (offset << 2)); in xilinx_fb_in32()
191 return dcr_read(drvdata->dcr_host, offset); in xilinx_fb_in32()
200 u32 *palette = fbi->pseudo_palette; in xilinx_fb_setcolreg()
203 return -EINVAL; in xilinx_fb_setcolreg()
205 if (fbi->var.grayscale) { in xilinx_fb_setcolreg()
214 /* fbi->fix.visual is always FB_VISUAL_TRUECOLOR */ in xilinx_fb_setcolreg()
234 xilinx_fb_out32(drvdata, REG_CTRL, drvdata->reg_ctrl_default); in xilinx_fb_blank()
258 /* ---------------------------------------------------------------------
267 struct device *dev = &pdev->dev; in xilinxfb_assign()
268 int fbsize = pdata->xvirt * pdata->yvirt * BYTES_PER_PIXEL; in xilinxfb_assign()
270 if (drvdata->flags & BUS_ACCESS_FLAG) { in xilinxfb_assign()
273 drvdata->regs = devm_platform_get_and_ioremap_resource(pdev, 0, &res); in xilinxfb_assign()
274 if (IS_ERR(drvdata->regs)) in xilinxfb_assign()
275 return PTR_ERR(drvdata->regs); in xilinxfb_assign()
277 drvdata->regs_phys = res->start; in xilinxfb_assign()
281 if (pdata->fb_phys) { in xilinxfb_assign()
282 drvdata->fb_phys = pdata->fb_phys; in xilinxfb_assign()
283 drvdata->fb_virt = ioremap(pdata->fb_phys, fbsize); in xilinxfb_assign()
285 drvdata->fb_alloced = 1; in xilinxfb_assign()
286 drvdata->fb_virt = dma_alloc_coherent(dev, PAGE_ALIGN(fbsize), in xilinxfb_assign()
287 &drvdata->fb_phys, in xilinxfb_assign()
291 if (!drvdata->fb_virt) { in xilinxfb_assign()
293 return -ENOMEM; in xilinxfb_assign()
297 memset_io((void __iomem *)drvdata->fb_virt, 0, fbsize); in xilinxfb_assign()
300 xilinx_fb_out32(drvdata, REG_FB_ADDR, drvdata->fb_phys); in xilinxfb_assign()
303 if (rc != drvdata->fb_phys) { in xilinxfb_assign()
304 drvdata->flags |= LITTLE_ENDIAN_ACCESS; in xilinxfb_assign()
305 xilinx_fb_out32(drvdata, REG_FB_ADDR, drvdata->fb_phys); in xilinxfb_assign()
309 drvdata->reg_ctrl_default = REG_CTRL_ENABLE; in xilinxfb_assign()
310 if (pdata->rotate_screen) in xilinxfb_assign()
311 drvdata->reg_ctrl_default |= REG_CTRL_ROTATE; in xilinxfb_assign()
312 xilinx_fb_out32(drvdata, REG_CTRL, drvdata->reg_ctrl_default); in xilinxfb_assign()
315 drvdata->info.device = dev; in xilinxfb_assign()
316 drvdata->info.screen_base = (void __iomem *)drvdata->fb_virt; in xilinxfb_assign()
317 drvdata->info.fbops = &xilinxfb_ops; in xilinxfb_assign()
318 drvdata->info.fix = xilinx_fb_fix; in xilinxfb_assign()
319 drvdata->info.fix.smem_start = drvdata->fb_phys; in xilinxfb_assign()
320 drvdata->info.fix.smem_len = fbsize; in xilinxfb_assign()
321 drvdata->info.fix.line_length = pdata->xvirt * BYTES_PER_PIXEL; in xilinxfb_assign()
323 drvdata->info.pseudo_palette = drvdata->pseudo_palette; in xilinxfb_assign()
324 drvdata->info.var = xilinx_fb_var; in xilinxfb_assign()
325 drvdata->info.var.height = pdata->screen_height_mm; in xilinxfb_assign()
326 drvdata->info.var.width = pdata->screen_width_mm; in xilinxfb_assign()
327 drvdata->info.var.xres = pdata->xres; in xilinxfb_assign()
328 drvdata->info.var.yres = pdata->yres; in xilinxfb_assign()
329 drvdata->info.var.xres_virtual = pdata->xvirt; in xilinxfb_assign()
330 drvdata->info.var.yres_virtual = pdata->yvirt; in xilinxfb_assign()
333 rc = fb_alloc_cmap(&drvdata->info.cmap, PALETTE_ENTRIES_NO, 0); in xilinxfb_assign()
341 rc = register_framebuffer(&drvdata->info); in xilinxfb_assign()
347 if (drvdata->flags & BUS_ACCESS_FLAG) { in xilinxfb_assign()
350 &drvdata->regs_phys, drvdata->regs); in xilinxfb_assign()
354 (unsigned long long)drvdata->fb_phys, drvdata->fb_virt, fbsize); in xilinxfb_assign()
359 fb_dealloc_cmap(&drvdata->info.cmap); in xilinxfb_assign()
362 if (drvdata->fb_alloced) in xilinxfb_assign()
363 dma_free_coherent(dev, PAGE_ALIGN(fbsize), drvdata->fb_virt, in xilinxfb_assign()
364 drvdata->fb_phys); in xilinxfb_assign()
366 iounmap(drvdata->fb_virt); in xilinxfb_assign()
379 xilinx_fb_blank(VESA_POWERDOWN, &drvdata->info); in xilinxfb_release()
382 unregister_framebuffer(&drvdata->info); in xilinxfb_release()
384 fb_dealloc_cmap(&drvdata->info.cmap); in xilinxfb_release()
386 if (drvdata->fb_alloced) in xilinxfb_release()
387 dma_free_coherent(dev, PAGE_ALIGN(drvdata->info.fix.smem_len), in xilinxfb_release()
388 drvdata->fb_virt, drvdata->fb_phys); in xilinxfb_release()
390 iounmap(drvdata->fb_virt); in xilinxfb_release()
397 if (!(drvdata->flags & BUS_ACCESS_FLAG)) in xilinxfb_release()
398 dcr_unmap(drvdata->dcr_host, drvdata->dcr_len); in xilinxfb_release()
402 /* ---------------------------------------------------------------------
418 drvdata = devm_kzalloc(&pdev->dev, sizeof(*drvdata), GFP_KERNEL); in xilinxfb_of_probe()
420 return -ENOMEM; in xilinxfb_of_probe()
426 of_property_read_u32(pdev->dev.of_node, "xlnx,dcr-splb-slave-if", in xilinxfb_of_probe()
434 drvdata->flags |= BUS_ACCESS_FLAG; in xilinxfb_of_probe()
439 start = dcr_resource_start(pdev->dev.of_node, 0); in xilinxfb_of_probe()
440 drvdata->dcr_len = dcr_resource_len(pdev->dev.of_node, 0); in xilinxfb_of_probe()
441 drvdata->dcr_host = dcr_map(pdev->dev.of_node, start, drvdata->dcr_len); in xilinxfb_of_probe()
442 if (!DCR_MAP_OK(drvdata->dcr_host)) { in xilinxfb_of_probe()
443 dev_err(&pdev->dev, "invalid DCR address\n"); in xilinxfb_of_probe()
444 return -ENODEV; in xilinxfb_of_probe()
449 prop = of_get_property(pdev->dev.of_node, "phys-size", &size); in xilinxfb_of_probe()
455 prop = of_get_property(pdev->dev.of_node, "resolution", &size); in xilinxfb_of_probe()
461 prop = of_get_property(pdev->dev.of_node, "virtual-resolution", &size); in xilinxfb_of_probe()
467 pdata.rotate_screen = of_property_read_bool(pdev->dev.of_node, "rotate-display"); in xilinxfb_of_probe()
475 xilinxfb_release(&op->dev); in xilinxfb_of_remove()
480 { .compatible = "xlnx,xps-tft-1.00.a", },
481 { .compatible = "xlnx,xps-tft-2.00.a", },
482 { .compatible = "xlnx,xps-tft-2.01.a", },
483 { .compatible = "xlnx,plb-tft-cntlr-ref-1.00.a", },
484 { .compatible = "xlnx,plb-dvi-cntlr-ref-1.00.c", },
501 MODULE_DESCRIPTION("Xilinx TFT frame buffer driver");