aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/pxafb.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/video/pxafb.c')
-rw-r--r--drivers/video/pxafb.c108
1 files changed, 105 insertions, 3 deletions
diff --git a/drivers/video/pxafb.c b/drivers/video/pxafb.c
index fafe7db20d6d..bb2514369507 100644
--- a/drivers/video/pxafb.c
+++ b/drivers/video/pxafb.c
@@ -227,6 +227,22 @@ static int pxafb_bpp_to_lccr3(struct fb_var_screeninfo *var)
227 case 4: ret = LCCR3_4BPP; break; 227 case 4: ret = LCCR3_4BPP; break;
228 case 8: ret = LCCR3_8BPP; break; 228 case 8: ret = LCCR3_8BPP; break;
229 case 16: ret = LCCR3_16BPP; break; 229 case 16: ret = LCCR3_16BPP; break;
230 case 24:
231 switch (var->red.length + var->green.length +
232 var->blue.length + var->transp.length) {
233 case 18: ret = LCCR3_18BPP_P | LCCR3_PDFOR_3; break;
234 case 19: ret = LCCR3_19BPP_P; break;
235 }
236 break;
237 case 32:
238 switch (var->red.length + var->green.length +
239 var->blue.length + var->transp.length) {
240 case 18: ret = LCCR3_18BPP | LCCR3_PDFOR_3; break;
241 case 19: ret = LCCR3_19BPP; break;
242 case 24: ret = LCCR3_24BPP | LCCR3_PDFOR_3; break;
243 case 25: ret = LCCR3_25BPP; break;
244 }
245 break;
230 } 246 }
231 return ret; 247 return ret;
232} 248}
@@ -345,6 +361,41 @@ static int pxafb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
345 var->green.offset = 5; var->green.length = 6; 361 var->green.offset = 5; var->green.length = 6;
346 var->blue.offset = 0; var->blue.length = 5; 362 var->blue.offset = 0; var->blue.length = 5;
347 var->transp.offset = var->transp.length = 0; 363 var->transp.offset = var->transp.length = 0;
364 } else if (var->bits_per_pixel > 16) {
365 struct pxafb_mode_info *mode;
366
367 mode = pxafb_getmode(inf, var);
368 if (!mode)
369 return -EINVAL;
370
371 switch (mode->depth) {
372 case 18: /* RGB666 */
373 var->transp.offset = var->transp.length = 0;
374 var->red.offset = 12; var->red.length = 6;
375 var->green.offset = 6; var->green.length = 6;
376 var->blue.offset = 0; var->blue.length = 6;
377 break;
378 case 19: /* RGBT666 */
379 var->transp.offset = 18; var->transp.length = 1;
380 var->red.offset = 12; var->red.length = 6;
381 var->green.offset = 6; var->green.length = 6;
382 var->blue.offset = 0; var->blue.length = 6;
383 break;
384 case 24: /* RGB888 */
385 var->transp.offset = var->transp.length = 0;
386 var->red.offset = 16; var->red.length = 8;
387 var->green.offset = 8; var->green.length = 8;
388 var->blue.offset = 0; var->blue.length = 8;
389 break;
390 case 25: /* RGBT888 */
391 var->transp.offset = 24; var->transp.length = 1;
392 var->red.offset = 16; var->red.length = 8;
393 var->green.offset = 8; var->green.length = 8;
394 var->blue.offset = 0; var->blue.length = 8;
395 break;
396 default:
397 return -EINVAL;
398 }
348 } else { 399 } else {
349 var->red.offset = var->green.offset = 0; 400 var->red.offset = var->green.offset = 0;
350 var->blue.offset = var->transp.offset = 0; 401 var->blue.offset = var->transp.offset = 0;
@@ -376,7 +427,7 @@ static int pxafb_set_par(struct fb_info *info)
376 struct pxafb_info *fbi = (struct pxafb_info *)info; 427 struct pxafb_info *fbi = (struct pxafb_info *)info;
377 struct fb_var_screeninfo *var = &info->var; 428 struct fb_var_screeninfo *var = &info->var;
378 429
379 if (var->bits_per_pixel == 16) 430 if (var->bits_per_pixel >= 16)
380 fbi->fb.fix.visual = FB_VISUAL_TRUECOLOR; 431 fbi->fb.fix.visual = FB_VISUAL_TRUECOLOR;
381 else if (!fbi->cmap_static) 432 else if (!fbi->cmap_static)
382 fbi->fb.fix.visual = FB_VISUAL_PSEUDOCOLOR; 433 fbi->fb.fix.visual = FB_VISUAL_PSEUDOCOLOR;
@@ -391,7 +442,7 @@ static int pxafb_set_par(struct fb_info *info)
391 442
392 fbi->fb.fix.line_length = var->xres_virtual * 443 fbi->fb.fix.line_length = var->xres_virtual *
393 var->bits_per_pixel / 8; 444 var->bits_per_pixel / 8;
394 if (var->bits_per_pixel == 16) 445 if (var->bits_per_pixel >= 16)
395 fbi->palette_size = 0; 446 fbi->palette_size = 0;
396 else 447 else
397 fbi->palette_size = var->bits_per_pixel == 1 ? 448 fbi->palette_size = var->bits_per_pixel == 1 ?
@@ -404,7 +455,7 @@ static int pxafb_set_par(struct fb_info *info)
404 */ 455 */
405 pxafb_set_truecolor(fbi->fb.fix.visual == FB_VISUAL_TRUECOLOR); 456 pxafb_set_truecolor(fbi->fb.fix.visual == FB_VISUAL_TRUECOLOR);
406 457
407 if (fbi->fb.var.bits_per_pixel == 16) 458 if (fbi->fb.var.bits_per_pixel >= 16)
408 fb_dealloc_cmap(&fbi->fb.cmap); 459 fb_dealloc_cmap(&fbi->fb.cmap);
409 else 460 else
410 fb_alloc_cmap(&fbi->fb.cmap, 1<<fbi->fb.var.bits_per_pixel, 0); 461 fb_alloc_cmap(&fbi->fb.cmap, 1<<fbi->fb.var.bits_per_pixel, 0);
@@ -831,6 +882,8 @@ static int pxafb_activate_var(struct fb_var_screeninfo *var,
831 case 4: 882 case 4:
832 case 8: 883 case 8:
833 case 16: 884 case 16:
885 case 24:
886 case 32:
834 break; 887 break;
835 default: 888 default:
836 printk(KERN_ERR "%s: invalid bit depth %d\n", 889 printk(KERN_ERR "%s: invalid bit depth %d\n",
@@ -968,6 +1021,11 @@ static void pxafb_setup_gpio(struct pxafb_info *fbi)
968 1021
969 for (gpio = 58; ldd_bits; gpio++, ldd_bits--) 1022 for (gpio = 58; ldd_bits; gpio++, ldd_bits--)
970 pxa_gpio_mode(gpio | GPIO_ALT_FN_2_OUT); 1023 pxa_gpio_mode(gpio | GPIO_ALT_FN_2_OUT);
1024 /* 18 bit interface */
1025 if (fbi->fb.var.bits_per_pixel > 16) {
1026 pxa_gpio_mode(86 | GPIO_ALT_FN_2_OUT);
1027 pxa_gpio_mode(87 | GPIO_ALT_FN_2_OUT);
1028 }
971 pxa_gpio_mode(GPIO74_LCD_FCLK_MD); 1029 pxa_gpio_mode(GPIO74_LCD_FCLK_MD);
972 pxa_gpio_mode(GPIO75_LCD_LCLK_MD); 1030 pxa_gpio_mode(GPIO75_LCD_LCLK_MD);
973 pxa_gpio_mode(GPIO76_LCD_PCLK_MD); 1031 pxa_gpio_mode(GPIO76_LCD_PCLK_MD);
@@ -1792,11 +1850,49 @@ failed:
1792 return ret; 1850 return ret;
1793} 1851}
1794 1852
1853static int __devexit pxafb_remove(struct platform_device *dev)
1854{
1855 struct pxafb_info *fbi = platform_get_drvdata(dev);
1856 struct resource *r;
1857 int irq;
1858 struct fb_info *info;
1859
1860 if (!fbi)
1861 return 0;
1862
1863 info = &fbi->fb;
1864
1865 unregister_framebuffer(info);
1866
1867 pxafb_disable_controller(fbi);
1868
1869 if (fbi->fb.cmap.len)
1870 fb_dealloc_cmap(&fbi->fb.cmap);
1871
1872 irq = platform_get_irq(dev, 0);
1873 free_irq(irq, fbi);
1874
1875 dma_free_writecombine(&dev->dev, fbi->map_size,
1876 fbi->map_cpu, fbi->map_dma);
1877
1878 iounmap(fbi->mmio_base);
1879
1880 r = platform_get_resource(dev, IORESOURCE_MEM, 0);
1881 release_mem_region(r->start, r->end - r->start + 1);
1882
1883 clk_put(fbi->clk);
1884 kfree(fbi);
1885
1886 return 0;
1887}
1888
1795static struct platform_driver pxafb_driver = { 1889static struct platform_driver pxafb_driver = {
1796 .probe = pxafb_probe, 1890 .probe = pxafb_probe,
1891 .remove = pxafb_remove,
1797 .suspend = pxafb_suspend, 1892 .suspend = pxafb_suspend,
1798 .resume = pxafb_resume, 1893 .resume = pxafb_resume,
1799 .driver = { 1894 .driver = {
1895 .owner = THIS_MODULE,
1800 .name = "pxa2xx-fb", 1896 .name = "pxa2xx-fb",
1801 }, 1897 },
1802}; 1898};
@@ -1809,7 +1905,13 @@ static int __init pxafb_init(void)
1809 return platform_driver_register(&pxafb_driver); 1905 return platform_driver_register(&pxafb_driver);
1810} 1906}
1811 1907
1908static void __exit pxafb_exit(void)
1909{
1910 platform_driver_unregister(&pxafb_driver);
1911}
1912
1812module_init(pxafb_init); 1913module_init(pxafb_init);
1914module_exit(pxafb_exit);
1813 1915
1814MODULE_DESCRIPTION("loadable framebuffer driver for PXA"); 1916MODULE_DESCRIPTION("loadable framebuffer driver for PXA");
1815MODULE_LICENSE("GPL"); 1917MODULE_LICENSE("GPL");