diff options
Diffstat (limited to 'drivers/video')
-rw-r--r-- | drivers/video/Kconfig | 6 | ||||
-rw-r--r-- | drivers/video/vt8500lcdfb.c | 79 | ||||
-rw-r--r-- | drivers/video/wm8505fb.c | 97 | ||||
-rw-r--r-- | drivers/video/wmt_ge_rops.c | 9 |
4 files changed, 161 insertions, 30 deletions
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig index 0217f7415ef5..b66d951b8e32 100644 --- a/drivers/video/Kconfig +++ b/drivers/video/Kconfig | |||
@@ -1788,7 +1788,7 @@ config FB_AU1200 | |||
1788 | 1788 | ||
1789 | config FB_VT8500 | 1789 | config FB_VT8500 |
1790 | bool "VT8500 LCD Driver" | 1790 | bool "VT8500 LCD Driver" |
1791 | depends on (FB = y) && ARM && ARCH_VT8500 && VTWM_VERSION_VT8500 | 1791 | depends on (FB = y) && ARM && ARCH_VT8500 |
1792 | select FB_WMT_GE_ROPS | 1792 | select FB_WMT_GE_ROPS |
1793 | select FB_SYS_IMAGEBLIT | 1793 | select FB_SYS_IMAGEBLIT |
1794 | help | 1794 | help |
@@ -1797,11 +1797,11 @@ config FB_VT8500 | |||
1797 | 1797 | ||
1798 | config FB_WM8505 | 1798 | config FB_WM8505 |
1799 | bool "WM8505 frame buffer support" | 1799 | bool "WM8505 frame buffer support" |
1800 | depends on (FB = y) && ARM && ARCH_VT8500 && VTWM_VERSION_WM8505 | 1800 | depends on (FB = y) && ARM && ARCH_VT8500 |
1801 | select FB_WMT_GE_ROPS | 1801 | select FB_WMT_GE_ROPS |
1802 | select FB_SYS_IMAGEBLIT | 1802 | select FB_SYS_IMAGEBLIT |
1803 | help | 1803 | help |
1804 | This is the framebuffer driver for WonderMedia WM8505 | 1804 | This is the framebuffer driver for WonderMedia WM8505/WM8650 |
1805 | integrated LCD controller. | 1805 | integrated LCD controller. |
1806 | 1806 | ||
1807 | source "drivers/video/geode/Kconfig" | 1807 | source "drivers/video/geode/Kconfig" |
diff --git a/drivers/video/vt8500lcdfb.c b/drivers/video/vt8500lcdfb.c index 2a5fe6ede845..d24595cd0c9b 100644 --- a/drivers/video/vt8500lcdfb.c +++ b/drivers/video/vt8500lcdfb.c | |||
@@ -35,6 +35,13 @@ | |||
35 | #include "vt8500lcdfb.h" | 35 | #include "vt8500lcdfb.h" |
36 | #include "wmt_ge_rops.h" | 36 | #include "wmt_ge_rops.h" |
37 | 37 | ||
38 | #ifdef CONFIG_OF | ||
39 | #include <linux/of.h> | ||
40 | #include <linux/of_fdt.h> | ||
41 | #include <linux/memblock.h> | ||
42 | #endif | ||
43 | |||
44 | |||
38 | #define to_vt8500lcd_info(__info) container_of(__info, \ | 45 | #define to_vt8500lcd_info(__info) container_of(__info, \ |
39 | struct vt8500lcd_info, fb) | 46 | struct vt8500lcd_info, fb) |
40 | 47 | ||
@@ -270,15 +277,21 @@ static int __devinit vt8500lcd_probe(struct platform_device *pdev) | |||
270 | { | 277 | { |
271 | struct vt8500lcd_info *fbi; | 278 | struct vt8500lcd_info *fbi; |
272 | struct resource *res; | 279 | struct resource *res; |
273 | struct vt8500fb_platform_data *pdata = pdev->dev.platform_data; | ||
274 | void *addr; | 280 | void *addr; |
275 | int irq, ret; | 281 | int irq, ret; |
276 | 282 | ||
283 | struct fb_videomode of_mode; | ||
284 | struct device_node *np; | ||
285 | u32 bpp; | ||
286 | dma_addr_t fb_mem_phys; | ||
287 | unsigned long fb_mem_len; | ||
288 | void *fb_mem_virt; | ||
289 | |||
277 | ret = -ENOMEM; | 290 | ret = -ENOMEM; |
278 | fbi = NULL; | 291 | fbi = NULL; |
279 | 292 | ||
280 | fbi = kzalloc(sizeof(struct vt8500lcd_info) + sizeof(u32) * 16, | 293 | fbi = devm_kzalloc(&pdev->dev, sizeof(struct vt8500lcd_info) |
281 | GFP_KERNEL); | 294 | + sizeof(u32) * 16, GFP_KERNEL); |
282 | if (!fbi) { | 295 | if (!fbi) { |
283 | dev_err(&pdev->dev, "Failed to initialize framebuffer device\n"); | 296 | dev_err(&pdev->dev, "Failed to initialize framebuffer device\n"); |
284 | ret = -ENOMEM; | 297 | ret = -ENOMEM; |
@@ -333,9 +346,45 @@ static int __devinit vt8500lcd_probe(struct platform_device *pdev) | |||
333 | goto failed_free_res; | 346 | goto failed_free_res; |
334 | } | 347 | } |
335 | 348 | ||
336 | fbi->fb.fix.smem_start = pdata->video_mem_phys; | 349 | np = of_parse_phandle(pdev->dev.of_node, "default-mode", 0); |
337 | fbi->fb.fix.smem_len = pdata->video_mem_len; | 350 | if (!np) { |
338 | fbi->fb.screen_base = pdata->video_mem_virt; | 351 | pr_err("%s: No display description in Device Tree\n", __func__); |
352 | ret = -EINVAL; | ||
353 | goto failed_free_res; | ||
354 | } | ||
355 | |||
356 | /* | ||
357 | * This code is copied from Sascha Hauer's of_videomode helper | ||
358 | * and can be replaced with a call to the helper once mainlined | ||
359 | */ | ||
360 | ret = 0; | ||
361 | ret |= of_property_read_u32(np, "hactive", &of_mode.xres); | ||
362 | ret |= of_property_read_u32(np, "vactive", &of_mode.yres); | ||
363 | ret |= of_property_read_u32(np, "hback-porch", &of_mode.left_margin); | ||
364 | ret |= of_property_read_u32(np, "hfront-porch", &of_mode.right_margin); | ||
365 | ret |= of_property_read_u32(np, "hsync-len", &of_mode.hsync_len); | ||
366 | ret |= of_property_read_u32(np, "vback-porch", &of_mode.upper_margin); | ||
367 | ret |= of_property_read_u32(np, "vfront-porch", &of_mode.lower_margin); | ||
368 | ret |= of_property_read_u32(np, "vsync-len", &of_mode.vsync_len); | ||
369 | ret |= of_property_read_u32(np, "bpp", &bpp); | ||
370 | if (ret) { | ||
371 | pr_err("%s: Unable to read display properties\n", __func__); | ||
372 | goto failed_free_res; | ||
373 | } | ||
374 | of_mode.vmode = FB_VMODE_NONINTERLACED; | ||
375 | |||
376 | /* try allocating the framebuffer */ | ||
377 | fb_mem_len = of_mode.xres * of_mode.yres * 2 * (bpp / 8); | ||
378 | fb_mem_virt = dma_alloc_coherent(&pdev->dev, fb_mem_len, &fb_mem_phys, | ||
379 | GFP_KERNEL); | ||
380 | if (!fb_mem_virt) { | ||
381 | pr_err("%s: Failed to allocate framebuffer\n", __func__); | ||
382 | return -ENOMEM; | ||
383 | }; | ||
384 | |||
385 | fbi->fb.fix.smem_start = fb_mem_phys; | ||
386 | fbi->fb.fix.smem_len = fb_mem_len; | ||
387 | fbi->fb.screen_base = fb_mem_virt; | ||
339 | 388 | ||
340 | fbi->palette_size = PAGE_ALIGN(512); | 389 | fbi->palette_size = PAGE_ALIGN(512); |
341 | fbi->palette_cpu = dma_alloc_coherent(&pdev->dev, | 390 | fbi->palette_cpu = dma_alloc_coherent(&pdev->dev, |
@@ -370,10 +419,11 @@ static int __devinit vt8500lcd_probe(struct platform_device *pdev) | |||
370 | goto failed_free_irq; | 419 | goto failed_free_irq; |
371 | } | 420 | } |
372 | 421 | ||
373 | fb_videomode_to_var(&fbi->fb.var, &pdata->mode); | 422 | fb_videomode_to_var(&fbi->fb.var, &of_mode); |
374 | fbi->fb.var.bits_per_pixel = pdata->bpp; | 423 | |
375 | fbi->fb.var.xres_virtual = pdata->xres_virtual; | 424 | fbi->fb.var.xres_virtual = of_mode.xres; |
376 | fbi->fb.var.yres_virtual = pdata->yres_virtual; | 425 | fbi->fb.var.yres_virtual = of_mode.yres * 2; |
426 | fbi->fb.var.bits_per_pixel = bpp; | ||
377 | 427 | ||
378 | ret = vt8500lcd_set_par(&fbi->fb); | 428 | ret = vt8500lcd_set_par(&fbi->fb); |
379 | if (ret) { | 429 | if (ret) { |
@@ -448,12 +498,18 @@ static int __devexit vt8500lcd_remove(struct platform_device *pdev) | |||
448 | return 0; | 498 | return 0; |
449 | } | 499 | } |
450 | 500 | ||
501 | static const struct of_device_id via_dt_ids[] = { | ||
502 | { .compatible = "via,vt8500-fb", }, | ||
503 | {} | ||
504 | }; | ||
505 | |||
451 | static struct platform_driver vt8500lcd_driver = { | 506 | static struct platform_driver vt8500lcd_driver = { |
452 | .probe = vt8500lcd_probe, | 507 | .probe = vt8500lcd_probe, |
453 | .remove = __devexit_p(vt8500lcd_remove), | 508 | .remove = __devexit_p(vt8500lcd_remove), |
454 | .driver = { | 509 | .driver = { |
455 | .owner = THIS_MODULE, | 510 | .owner = THIS_MODULE, |
456 | .name = "vt8500-lcd", | 511 | .name = "vt8500-lcd", |
512 | .of_match_table = of_match_ptr(via_dt_ids), | ||
457 | }, | 513 | }, |
458 | }; | 514 | }; |
459 | 515 | ||
@@ -461,4 +517,5 @@ module_platform_driver(vt8500lcd_driver); | |||
461 | 517 | ||
462 | MODULE_AUTHOR("Alexey Charkov <alchark@gmail.com>"); | 518 | MODULE_AUTHOR("Alexey Charkov <alchark@gmail.com>"); |
463 | MODULE_DESCRIPTION("LCD controller driver for VIA VT8500"); | 519 | MODULE_DESCRIPTION("LCD controller driver for VIA VT8500"); |
464 | MODULE_LICENSE("GPL"); | 520 | MODULE_LICENSE("GPL v2"); |
521 | MODULE_DEVICE_TABLE(of, via_dt_ids); | ||
diff --git a/drivers/video/wm8505fb.c b/drivers/video/wm8505fb.c index c8703bd61b74..ec4742442103 100644 --- a/drivers/video/wm8505fb.c +++ b/drivers/video/wm8505fb.c | |||
@@ -28,6 +28,9 @@ | |||
28 | #include <linux/dma-mapping.h> | 28 | #include <linux/dma-mapping.h> |
29 | #include <linux/platform_device.h> | 29 | #include <linux/platform_device.h> |
30 | #include <linux/wait.h> | 30 | #include <linux/wait.h> |
31 | #include <linux/of.h> | ||
32 | #include <linux/of_fdt.h> | ||
33 | #include <linux/memblock.h> | ||
31 | 34 | ||
32 | #include <mach/vt8500fb.h> | 35 | #include <mach/vt8500fb.h> |
33 | 36 | ||
@@ -59,8 +62,12 @@ static int wm8505fb_init_hw(struct fb_info *info) | |||
59 | writel(fbi->fb.fix.smem_start, fbi->regbase + WMT_GOVR_FBADDR); | 62 | writel(fbi->fb.fix.smem_start, fbi->regbase + WMT_GOVR_FBADDR); |
60 | writel(fbi->fb.fix.smem_start, fbi->regbase + WMT_GOVR_FBADDR1); | 63 | writel(fbi->fb.fix.smem_start, fbi->regbase + WMT_GOVR_FBADDR1); |
61 | 64 | ||
62 | /* Set in-memory picture format to RGB 32bpp */ | 65 | /* |
63 | writel(0x1c, fbi->regbase + WMT_GOVR_COLORSPACE); | 66 | * Set in-memory picture format to RGB |
67 | * 0x31C sets the correct color mode (RGB565) for WM8650 | ||
68 | * Bit 8+9 (0x300) are ignored on WM8505 as reserved | ||
69 | */ | ||
70 | writel(0x31c, fbi->regbase + WMT_GOVR_COLORSPACE); | ||
64 | writel(1, fbi->regbase + WMT_GOVR_COLORSPACE1); | 71 | writel(1, fbi->regbase + WMT_GOVR_COLORSPACE1); |
65 | 72 | ||
66 | /* Virtual buffer size */ | 73 | /* Virtual buffer size */ |
@@ -127,6 +134,18 @@ static int wm8505fb_set_par(struct fb_info *info) | |||
127 | info->var.blue.msb_right = 0; | 134 | info->var.blue.msb_right = 0; |
128 | info->fix.visual = FB_VISUAL_TRUECOLOR; | 135 | info->fix.visual = FB_VISUAL_TRUECOLOR; |
129 | info->fix.line_length = info->var.xres_virtual << 2; | 136 | info->fix.line_length = info->var.xres_virtual << 2; |
137 | } else if (info->var.bits_per_pixel == 16) { | ||
138 | info->var.red.offset = 11; | ||
139 | info->var.red.length = 5; | ||
140 | info->var.red.msb_right = 0; | ||
141 | info->var.green.offset = 5; | ||
142 | info->var.green.length = 6; | ||
143 | info->var.green.msb_right = 0; | ||
144 | info->var.blue.offset = 0; | ||
145 | info->var.blue.length = 5; | ||
146 | info->var.blue.msb_right = 0; | ||
147 | info->fix.visual = FB_VISUAL_TRUECOLOR; | ||
148 | info->fix.line_length = info->var.xres_virtual << 1; | ||
130 | } | 149 | } |
131 | 150 | ||
132 | wm8505fb_set_timing(info); | 151 | wm8505fb_set_timing(info); |
@@ -246,16 +265,20 @@ static int __devinit wm8505fb_probe(struct platform_device *pdev) | |||
246 | struct wm8505fb_info *fbi; | 265 | struct wm8505fb_info *fbi; |
247 | struct resource *res; | 266 | struct resource *res; |
248 | void *addr; | 267 | void *addr; |
249 | struct vt8500fb_platform_data *pdata; | ||
250 | int ret; | 268 | int ret; |
251 | 269 | ||
252 | pdata = pdev->dev.platform_data; | 270 | struct fb_videomode of_mode; |
271 | struct device_node *np; | ||
272 | u32 bpp; | ||
273 | dma_addr_t fb_mem_phys; | ||
274 | unsigned long fb_mem_len; | ||
275 | void *fb_mem_virt; | ||
253 | 276 | ||
254 | ret = -ENOMEM; | 277 | ret = -ENOMEM; |
255 | fbi = NULL; | 278 | fbi = NULL; |
256 | 279 | ||
257 | fbi = kzalloc(sizeof(struct wm8505fb_info) + sizeof(u32) * 16, | 280 | fbi = devm_kzalloc(&pdev->dev, sizeof(struct wm8505fb_info) + |
258 | GFP_KERNEL); | 281 | sizeof(u32) * 16, GFP_KERNEL); |
259 | if (!fbi) { | 282 | if (!fbi) { |
260 | dev_err(&pdev->dev, "Failed to initialize framebuffer device\n"); | 283 | dev_err(&pdev->dev, "Failed to initialize framebuffer device\n"); |
261 | ret = -ENOMEM; | 284 | ret = -ENOMEM; |
@@ -305,21 +328,58 @@ static int __devinit wm8505fb_probe(struct platform_device *pdev) | |||
305 | goto failed_free_res; | 328 | goto failed_free_res; |
306 | } | 329 | } |
307 | 330 | ||
308 | fb_videomode_to_var(&fbi->fb.var, &pdata->mode); | 331 | np = of_parse_phandle(pdev->dev.of_node, "default-mode", 0); |
332 | if (!np) { | ||
333 | pr_err("%s: No display description in Device Tree\n", __func__); | ||
334 | ret = -EINVAL; | ||
335 | goto failed_free_res; | ||
336 | } | ||
337 | |||
338 | /* | ||
339 | * This code is copied from Sascha Hauer's of_videomode helper | ||
340 | * and can be replaced with a call to the helper once mainlined | ||
341 | */ | ||
342 | ret = 0; | ||
343 | ret |= of_property_read_u32(np, "hactive", &of_mode.xres); | ||
344 | ret |= of_property_read_u32(np, "vactive", &of_mode.yres); | ||
345 | ret |= of_property_read_u32(np, "hback-porch", &of_mode.left_margin); | ||
346 | ret |= of_property_read_u32(np, "hfront-porch", &of_mode.right_margin); | ||
347 | ret |= of_property_read_u32(np, "hsync-len", &of_mode.hsync_len); | ||
348 | ret |= of_property_read_u32(np, "vback-porch", &of_mode.upper_margin); | ||
349 | ret |= of_property_read_u32(np, "vfront-porch", &of_mode.lower_margin); | ||
350 | ret |= of_property_read_u32(np, "vsync-len", &of_mode.vsync_len); | ||
351 | ret |= of_property_read_u32(np, "bpp", &bpp); | ||
352 | if (ret) { | ||
353 | pr_err("%s: Unable to read display properties\n", __func__); | ||
354 | goto failed_free_res; | ||
355 | } | ||
356 | |||
357 | of_mode.vmode = FB_VMODE_NONINTERLACED; | ||
358 | fb_videomode_to_var(&fbi->fb.var, &of_mode); | ||
309 | 359 | ||
310 | fbi->fb.var.nonstd = 0; | 360 | fbi->fb.var.nonstd = 0; |
311 | fbi->fb.var.activate = FB_ACTIVATE_NOW; | 361 | fbi->fb.var.activate = FB_ACTIVATE_NOW; |
312 | 362 | ||
313 | fbi->fb.var.height = -1; | 363 | fbi->fb.var.height = -1; |
314 | fbi->fb.var.width = -1; | 364 | fbi->fb.var.width = -1; |
315 | fbi->fb.var.xres_virtual = pdata->xres_virtual; | ||
316 | fbi->fb.var.yres_virtual = pdata->yres_virtual; | ||
317 | fbi->fb.var.bits_per_pixel = pdata->bpp; | ||
318 | 365 | ||
319 | fbi->fb.fix.smem_start = pdata->video_mem_phys; | 366 | /* try allocating the framebuffer */ |
320 | fbi->fb.fix.smem_len = pdata->video_mem_len; | 367 | fb_mem_len = of_mode.xres * of_mode.yres * 2 * (bpp / 8); |
321 | fbi->fb.screen_base = pdata->video_mem_virt; | 368 | fb_mem_virt = dma_alloc_coherent(&pdev->dev, fb_mem_len, &fb_mem_phys, |
322 | fbi->fb.screen_size = pdata->video_mem_len; | 369 | GFP_KERNEL); |
370 | if (!fb_mem_virt) { | ||
371 | pr_err("%s: Failed to allocate framebuffer\n", __func__); | ||
372 | return -ENOMEM; | ||
373 | }; | ||
374 | |||
375 | fbi->fb.var.xres_virtual = of_mode.xres; | ||
376 | fbi->fb.var.yres_virtual = of_mode.yres * 2; | ||
377 | fbi->fb.var.bits_per_pixel = bpp; | ||
378 | |||
379 | fbi->fb.fix.smem_start = fb_mem_phys; | ||
380 | fbi->fb.fix.smem_len = fb_mem_len; | ||
381 | fbi->fb.screen_base = fb_mem_virt; | ||
382 | fbi->fb.screen_size = fb_mem_len; | ||
323 | 383 | ||
324 | if (fb_alloc_cmap(&fbi->fb.cmap, 256, 0) < 0) { | 384 | if (fb_alloc_cmap(&fbi->fb.cmap, 256, 0) < 0) { |
325 | dev_err(&pdev->dev, "Failed to allocate color map\n"); | 385 | dev_err(&pdev->dev, "Failed to allocate color map\n"); |
@@ -395,12 +455,18 @@ static int __devexit wm8505fb_remove(struct platform_device *pdev) | |||
395 | return 0; | 455 | return 0; |
396 | } | 456 | } |
397 | 457 | ||
458 | static const struct of_device_id wmt_dt_ids[] = { | ||
459 | { .compatible = "wm,wm8505-fb", }, | ||
460 | {} | ||
461 | }; | ||
462 | |||
398 | static struct platform_driver wm8505fb_driver = { | 463 | static struct platform_driver wm8505fb_driver = { |
399 | .probe = wm8505fb_probe, | 464 | .probe = wm8505fb_probe, |
400 | .remove = __devexit_p(wm8505fb_remove), | 465 | .remove = __devexit_p(wm8505fb_remove), |
401 | .driver = { | 466 | .driver = { |
402 | .owner = THIS_MODULE, | 467 | .owner = THIS_MODULE, |
403 | .name = DRIVER_NAME, | 468 | .name = DRIVER_NAME, |
469 | .of_match_table = of_match_ptr(wmt_dt_ids), | ||
404 | }, | 470 | }, |
405 | }; | 471 | }; |
406 | 472 | ||
@@ -408,4 +474,5 @@ module_platform_driver(wm8505fb_driver); | |||
408 | 474 | ||
409 | MODULE_AUTHOR("Ed Spiridonov <edo.rus@gmail.com>"); | 475 | MODULE_AUTHOR("Ed Spiridonov <edo.rus@gmail.com>"); |
410 | MODULE_DESCRIPTION("Framebuffer driver for WMT WM8505"); | 476 | MODULE_DESCRIPTION("Framebuffer driver for WMT WM8505"); |
411 | MODULE_LICENSE("GPL"); | 477 | MODULE_LICENSE("GPL v2"); |
478 | MODULE_DEVICE_TABLE(of, wmt_dt_ids); | ||
diff --git a/drivers/video/wmt_ge_rops.c b/drivers/video/wmt_ge_rops.c index 55be3865015b..ba025b4c7d09 100644 --- a/drivers/video/wmt_ge_rops.c +++ b/drivers/video/wmt_ge_rops.c | |||
@@ -158,12 +158,18 @@ static int __devexit wmt_ge_rops_remove(struct platform_device *pdev) | |||
158 | return 0; | 158 | return 0; |
159 | } | 159 | } |
160 | 160 | ||
161 | static const struct of_device_id wmt_dt_ids[] = { | ||
162 | { .compatible = "wm,prizm-ge-rops", }, | ||
163 | { /* sentinel */ } | ||
164 | }; | ||
165 | |||
161 | static struct platform_driver wmt_ge_rops_driver = { | 166 | static struct platform_driver wmt_ge_rops_driver = { |
162 | .probe = wmt_ge_rops_probe, | 167 | .probe = wmt_ge_rops_probe, |
163 | .remove = __devexit_p(wmt_ge_rops_remove), | 168 | .remove = __devexit_p(wmt_ge_rops_remove), |
164 | .driver = { | 169 | .driver = { |
165 | .owner = THIS_MODULE, | 170 | .owner = THIS_MODULE, |
166 | .name = "wmt_ge_rops", | 171 | .name = "wmt_ge_rops", |
172 | .of_match_table = of_match_ptr(wmt_dt_ids), | ||
167 | }, | 173 | }, |
168 | }; | 174 | }; |
169 | 175 | ||
@@ -172,4 +178,5 @@ module_platform_driver(wmt_ge_rops_driver); | |||
172 | MODULE_AUTHOR("Alexey Charkov <alchark@gmail.com"); | 178 | MODULE_AUTHOR("Alexey Charkov <alchark@gmail.com"); |
173 | MODULE_DESCRIPTION("Accelerators for raster operations using " | 179 | MODULE_DESCRIPTION("Accelerators for raster operations using " |
174 | "WonderMedia Graphics Engine"); | 180 | "WonderMedia Graphics Engine"); |
175 | MODULE_LICENSE("GPL"); | 181 | MODULE_LICENSE("GPL v2"); |
182 | MODULE_DEVICE_TABLE(of, wmt_dt_ids); | ||