diff options
author | Tony Prisk <linux@prisktech.co.nz> | 2013-04-02 14:20:38 -0400 |
---|---|---|
committer | Tomi Valkeinen <tomi.valkeinen@ti.com> | 2013-04-04 06:07:34 -0400 |
commit | 7ab0a48420c95dc4099d1777a5a24dffad102cf1 (patch) | |
tree | 197ad4145337b68fbc4cd90a771163c530bbe18f /drivers/video | |
parent | de68efced121eda500792b42547847636066525e (diff) |
video: fb: vt8500: Convert framebuffer drivers to standardized binding
Now that a display timing binding is available, convert our almost identical
binding to use the standard binding.
This patch converts the vt8500 and wm8505 framebuffer drivers and
associated dts/dtsi files to use the standard binding as defined in
bindings/video/display-timing.txt.
There are two side-effects of making this conversion:
1) The fb node should now be in the board file, rather than the soc file as
the display-timing node is a child of the fb node.
2) We still require a bits per pixel property to initialize the framebuffer
for the different lcd panels. Rather than including this as part of the
display timing, it is moved into the framebuffer node.
I have also taken the opportunity to alphabetise the includes of each
driver to avoid double-ups.
Signed-off-by: Tony Prisk <linux@prisktech.co.nz>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Diffstat (limited to 'drivers/video')
-rw-r--r-- | drivers/video/Kconfig | 6 | ||||
-rw-r--r-- | drivers/video/vt8500lcdfb.c | 53 | ||||
-rw-r--r-- | drivers/video/wm8505fb.c | 67 |
3 files changed, 53 insertions, 73 deletions
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig index ad762ed2c5aa..d0c932a86115 100644 --- a/drivers/video/Kconfig +++ b/drivers/video/Kconfig | |||
@@ -1794,6 +1794,9 @@ config FB_VT8500 | |||
1794 | select FB_SYS_FILLRECT if (!FB_WMT_GE_ROPS) | 1794 | select FB_SYS_FILLRECT if (!FB_WMT_GE_ROPS) |
1795 | select FB_SYS_COPYAREA if (!FB_WMT_GE_ROPS) | 1795 | select FB_SYS_COPYAREA if (!FB_WMT_GE_ROPS) |
1796 | select FB_SYS_IMAGEBLIT | 1796 | select FB_SYS_IMAGEBLIT |
1797 | select FB_MODE_HELPERS | ||
1798 | select OF_DISPLAY_TIMING | ||
1799 | select OF_VIDEOMODE | ||
1797 | help | 1800 | help |
1798 | This is the framebuffer driver for VIA VT8500 integrated LCD | 1801 | This is the framebuffer driver for VIA VT8500 integrated LCD |
1799 | controller. | 1802 | controller. |
@@ -1804,6 +1807,9 @@ config FB_WM8505 | |||
1804 | select FB_SYS_FILLRECT if (!FB_WMT_GE_ROPS) | 1807 | select FB_SYS_FILLRECT if (!FB_WMT_GE_ROPS) |
1805 | select FB_SYS_COPYAREA if (!FB_WMT_GE_ROPS) | 1808 | select FB_SYS_COPYAREA if (!FB_WMT_GE_ROPS) |
1806 | select FB_SYS_IMAGEBLIT | 1809 | select FB_SYS_IMAGEBLIT |
1810 | select FB_MODE_HELPERS | ||
1811 | select OF_DISPLAY_TIMING | ||
1812 | select OF_VIDEOMODE | ||
1807 | help | 1813 | help |
1808 | This is the framebuffer driver for WonderMedia WM8xxx-series | 1814 | This is the framebuffer driver for WonderMedia WM8xxx-series |
1809 | integrated LCD controller. This driver covers the WM8505, WM8650 | 1815 | integrated LCD controller. This driver covers the WM8505, WM8650 |
diff --git a/drivers/video/vt8500lcdfb.c b/drivers/video/vt8500lcdfb.c index 2ff2312a16ac..9547e1831e03 100644 --- a/drivers/video/vt8500lcdfb.c +++ b/drivers/video/vt8500lcdfb.c | |||
@@ -15,20 +15,21 @@ | |||
15 | * GNU General Public License for more details. | 15 | * GNU General Public License for more details. |
16 | */ | 16 | */ |
17 | 17 | ||
18 | #include <linux/module.h> | ||
19 | #include <linux/kernel.h> | ||
20 | #include <linux/errno.h> | ||
21 | #include <linux/string.h> | ||
22 | #include <linux/mm.h> | ||
23 | #include <linux/slab.h> | ||
24 | #include <linux/delay.h> | 18 | #include <linux/delay.h> |
19 | #include <linux/dma-mapping.h> | ||
20 | #include <linux/errno.h> | ||
25 | #include <linux/fb.h> | 21 | #include <linux/fb.h> |
26 | #include <linux/init.h> | 22 | #include <linux/init.h> |
27 | #include <linux/interrupt.h> | 23 | #include <linux/interrupt.h> |
28 | #include <linux/io.h> | 24 | #include <linux/io.h> |
29 | #include <linux/dma-mapping.h> | 25 | #include <linux/kernel.h> |
26 | #include <linux/mm.h> | ||
27 | #include <linux/module.h> | ||
30 | #include <linux/platform_device.h> | 28 | #include <linux/platform_device.h> |
29 | #include <linux/slab.h> | ||
30 | #include <linux/string.h> | ||
31 | #include <linux/wait.h> | 31 | #include <linux/wait.h> |
32 | #include <video/of_display_timing.h> | ||
32 | 33 | ||
33 | #include "vt8500lcdfb.h" | 34 | #include "vt8500lcdfb.h" |
34 | #include "wmt_ge_rops.h" | 35 | #include "wmt_ge_rops.h" |
@@ -275,11 +276,11 @@ static int vt8500lcd_probe(struct platform_device *pdev) | |||
275 | { | 276 | { |
276 | struct vt8500lcd_info *fbi; | 277 | struct vt8500lcd_info *fbi; |
277 | struct resource *res; | 278 | struct resource *res; |
279 | struct display_timings *disp_timing; | ||
278 | void *addr; | 280 | void *addr; |
279 | int irq, ret; | 281 | int irq, ret; |
280 | 282 | ||
281 | struct fb_videomode of_mode; | 283 | struct fb_videomode of_mode; |
282 | struct device_node *np; | ||
283 | u32 bpp; | 284 | u32 bpp; |
284 | dma_addr_t fb_mem_phys; | 285 | dma_addr_t fb_mem_phys; |
285 | unsigned long fb_mem_len; | 286 | unsigned long fb_mem_len; |
@@ -344,32 +345,18 @@ static int vt8500lcd_probe(struct platform_device *pdev) | |||
344 | goto failed_free_res; | 345 | goto failed_free_res; |
345 | } | 346 | } |
346 | 347 | ||
347 | np = of_parse_phandle(pdev->dev.of_node, "default-mode", 0); | 348 | disp_timing = of_get_display_timings(pdev->dev.of_node); |
348 | if (!np) { | 349 | if (!disp_timing) |
349 | pr_err("%s: No display description in Device Tree\n", __func__); | 350 | return -EINVAL; |
350 | ret = -EINVAL; | ||
351 | goto failed_free_res; | ||
352 | } | ||
353 | 351 | ||
354 | /* | 352 | ret = of_get_fb_videomode(pdev->dev.of_node, &of_mode, |
355 | * This code is copied from Sascha Hauer's of_videomode helper | 353 | OF_USE_NATIVE_MODE); |
356 | * and can be replaced with a call to the helper once mainlined | 354 | if (ret) |
357 | */ | 355 | return ret; |
358 | ret = 0; | 356 | |
359 | ret |= of_property_read_u32(np, "hactive", &of_mode.xres); | 357 | ret = of_property_read_u32(pdev->dev.of_node, "bits-per-pixel", &bpp); |
360 | ret |= of_property_read_u32(np, "vactive", &of_mode.yres); | 358 | if (ret) |
361 | ret |= of_property_read_u32(np, "hback-porch", &of_mode.left_margin); | 359 | return ret; |
362 | ret |= of_property_read_u32(np, "hfront-porch", &of_mode.right_margin); | ||
363 | ret |= of_property_read_u32(np, "hsync-len", &of_mode.hsync_len); | ||
364 | ret |= of_property_read_u32(np, "vback-porch", &of_mode.upper_margin); | ||
365 | ret |= of_property_read_u32(np, "vfront-porch", &of_mode.lower_margin); | ||
366 | ret |= of_property_read_u32(np, "vsync-len", &of_mode.vsync_len); | ||
367 | ret |= of_property_read_u32(np, "bpp", &bpp); | ||
368 | if (ret) { | ||
369 | pr_err("%s: Unable to read display properties\n", __func__); | ||
370 | goto failed_free_res; | ||
371 | } | ||
372 | of_mode.vmode = FB_VMODE_NONINTERLACED; | ||
373 | 360 | ||
374 | /* try allocating the framebuffer */ | 361 | /* try allocating the framebuffer */ |
375 | fb_mem_len = of_mode.xres * of_mode.yres * 2 * (bpp / 8); | 362 | fb_mem_len = of_mode.xres * of_mode.yres * 2 * (bpp / 8); |
diff --git a/drivers/video/wm8505fb.c b/drivers/video/wm8505fb.c index e3be1e37d2b3..19e2e7ff492a 100644 --- a/drivers/video/wm8505fb.c +++ b/drivers/video/wm8505fb.c | |||
@@ -14,23 +14,24 @@ | |||
14 | * GNU General Public License for more details. | 14 | * GNU General Public License for more details. |
15 | */ | 15 | */ |
16 | 16 | ||
17 | #include <linux/module.h> | ||
18 | #include <linux/kernel.h> | ||
19 | #include <linux/errno.h> | ||
20 | #include <linux/string.h> | ||
21 | #include <linux/mm.h> | ||
22 | #include <linux/slab.h> | ||
23 | #include <linux/delay.h> | 17 | #include <linux/delay.h> |
18 | #include <linux/dma-mapping.h> | ||
24 | #include <linux/fb.h> | 19 | #include <linux/fb.h> |
20 | #include <linux/errno.h> | ||
25 | #include <linux/init.h> | 21 | #include <linux/init.h> |
26 | #include <linux/interrupt.h> | 22 | #include <linux/interrupt.h> |
27 | #include <linux/io.h> | 23 | #include <linux/io.h> |
28 | #include <linux/dma-mapping.h> | 24 | #include <linux/kernel.h> |
29 | #include <linux/platform_device.h> | 25 | #include <linux/memblock.h> |
30 | #include <linux/wait.h> | 26 | #include <linux/mm.h> |
27 | #include <linux/module.h> | ||
31 | #include <linux/of.h> | 28 | #include <linux/of.h> |
32 | #include <linux/of_fdt.h> | 29 | #include <linux/of_fdt.h> |
33 | #include <linux/memblock.h> | 30 | #include <linux/platform_device.h> |
31 | #include <linux/slab.h> | ||
32 | #include <linux/string.h> | ||
33 | #include <linux/wait.h> | ||
34 | #include <video/of_display_timing.h> | ||
34 | 35 | ||
35 | #include "wm8505fb_regs.h" | 36 | #include "wm8505fb_regs.h" |
36 | #include "wmt_ge_rops.h" | 37 | #include "wmt_ge_rops.h" |
@@ -261,12 +262,12 @@ static struct fb_ops wm8505fb_ops = { | |||
261 | static int wm8505fb_probe(struct platform_device *pdev) | 262 | static int wm8505fb_probe(struct platform_device *pdev) |
262 | { | 263 | { |
263 | struct wm8505fb_info *fbi; | 264 | struct wm8505fb_info *fbi; |
264 | struct resource *res; | 265 | struct resource *res; |
266 | struct display_timings *disp_timing; | ||
265 | void *addr; | 267 | void *addr; |
266 | int ret; | 268 | int ret; |
267 | 269 | ||
268 | struct fb_videomode of_mode; | 270 | struct fb_videomode mode; |
269 | struct device_node *np; | ||
270 | u32 bpp; | 271 | u32 bpp; |
271 | dma_addr_t fb_mem_phys; | 272 | dma_addr_t fb_mem_phys; |
272 | unsigned long fb_mem_len; | 273 | unsigned long fb_mem_len; |
@@ -306,33 +307,19 @@ static int wm8505fb_probe(struct platform_device *pdev) | |||
306 | if (fbi->regbase == NULL) | 307 | if (fbi->regbase == NULL) |
307 | return -EBUSY; | 308 | return -EBUSY; |
308 | 309 | ||
309 | np = of_parse_phandle(pdev->dev.of_node, "default-mode", 0); | 310 | disp_timing = of_get_display_timings(pdev->dev.of_node); |
310 | if (!np) { | 311 | if (!disp_timing) |
311 | pr_err("%s: No display description in Device Tree\n", __func__); | ||
312 | return -EINVAL; | 312 | return -EINVAL; |
313 | } | ||
314 | 313 | ||
315 | /* | 314 | ret = of_get_fb_videomode(pdev->dev.of_node, &mode, OF_USE_NATIVE_MODE); |
316 | * This code is copied from Sascha Hauer's of_videomode helper | 315 | if (ret) |
317 | * and can be replaced with a call to the helper once mainlined | 316 | return ret; |
318 | */ | 317 | |
319 | ret = 0; | 318 | ret = of_property_read_u32(pdev->dev.of_node, "bits-per-pixel", &bpp); |
320 | ret |= of_property_read_u32(np, "hactive", &of_mode.xres); | 319 | if (ret) |
321 | ret |= of_property_read_u32(np, "vactive", &of_mode.yres); | 320 | return ret; |
322 | ret |= of_property_read_u32(np, "hback-porch", &of_mode.left_margin); | ||
323 | ret |= of_property_read_u32(np, "hfront-porch", &of_mode.right_margin); | ||
324 | ret |= of_property_read_u32(np, "hsync-len", &of_mode.hsync_len); | ||
325 | ret |= of_property_read_u32(np, "vback-porch", &of_mode.upper_margin); | ||
326 | ret |= of_property_read_u32(np, "vfront-porch", &of_mode.lower_margin); | ||
327 | ret |= of_property_read_u32(np, "vsync-len", &of_mode.vsync_len); | ||
328 | ret |= of_property_read_u32(np, "bpp", &bpp); | ||
329 | if (ret) { | ||
330 | pr_err("%s: Unable to read display properties\n", __func__); | ||
331 | return -EINVAL; | ||
332 | } | ||
333 | 321 | ||
334 | of_mode.vmode = FB_VMODE_NONINTERLACED; | 322 | fb_videomode_to_var(&fbi->fb.var, &mode); |
335 | fb_videomode_to_var(&fbi->fb.var, &of_mode); | ||
336 | 323 | ||
337 | fbi->fb.var.nonstd = 0; | 324 | fbi->fb.var.nonstd = 0; |
338 | fbi->fb.var.activate = FB_ACTIVATE_NOW; | 325 | fbi->fb.var.activate = FB_ACTIVATE_NOW; |
@@ -341,7 +328,7 @@ static int wm8505fb_probe(struct platform_device *pdev) | |||
341 | fbi->fb.var.width = -1; | 328 | fbi->fb.var.width = -1; |
342 | 329 | ||
343 | /* try allocating the framebuffer */ | 330 | /* try allocating the framebuffer */ |
344 | fb_mem_len = of_mode.xres * of_mode.yres * 2 * (bpp / 8); | 331 | fb_mem_len = mode.xres * mode.yres * 2 * (bpp / 8); |
345 | fb_mem_virt = dmam_alloc_coherent(&pdev->dev, fb_mem_len, &fb_mem_phys, | 332 | fb_mem_virt = dmam_alloc_coherent(&pdev->dev, fb_mem_len, &fb_mem_phys, |
346 | GFP_KERNEL); | 333 | GFP_KERNEL); |
347 | if (!fb_mem_virt) { | 334 | if (!fb_mem_virt) { |
@@ -349,8 +336,8 @@ static int wm8505fb_probe(struct platform_device *pdev) | |||
349 | return -ENOMEM; | 336 | return -ENOMEM; |
350 | } | 337 | } |
351 | 338 | ||
352 | fbi->fb.var.xres_virtual = of_mode.xres; | 339 | fbi->fb.var.xres_virtual = mode.xres; |
353 | fbi->fb.var.yres_virtual = of_mode.yres * 2; | 340 | fbi->fb.var.yres_virtual = mode.yres * 2; |
354 | fbi->fb.var.bits_per_pixel = bpp; | 341 | fbi->fb.var.bits_per_pixel = bpp; |
355 | 342 | ||
356 | fbi->fb.fix.smem_start = fb_mem_phys; | 343 | fbi->fb.fix.smem_start = fb_mem_phys; |