From e3b5e28f52c3e70ecfc72c6d4f805842cf6869c2 Mon Sep 17 00:00:00 2001 From: Afzal Mohammed <afzal@ti.com> Date: Mon, 31 Dec 2012 00:31:14 +0530 Subject: [PATCH 13/51] video: da8xx-fb: obtain fb_videomode info from dt Obtain fb_videomode details for the connected lcd panel using the display timing details present in DT. Signed-off-by: Afzal Mohammed <afzal@ti.com> --- Documentation/devicetree/bindings/video/fb-da8xx.txt | 21 +++++++++++++++++++ drivers/video/da8xx-fb.c | 17 +++++++++++++++ 2 files changed, 38 insertions(+) Index: linux-3.12.36-rt50-r4s2/Documentation/devicetree/bindings/video/fb-da8xx.txt =================================================================== @ linux-3.12.36-rt50-r4s2/Documentation/devicetree/bindings/video/fb-da8xx.txt:9 @ Required properties: AM335x SoC's - "ti,am3352-lcdc", "ti,da830-lcdc" - reg: Address range of lcdc register set - interrupts: lcdc interrupt +- display-timings: typical videomode of lcd panel, represented as child. + Refer Documentation/devicetree/bindings/video/display-timing.txt for + display timing binding details. If multiple videomodes are mentioned + in display timings node, typical videomode has to be mentioned as the + native mode or it has to be first child (driver cares only for native + videomode). Example: @ linux-3.12.36-rt50-r4s2/Documentation/devicetree/bindings/video/fb-da8xx.txt:22 @ lcdc@4830e000 { compatible = "ti,am3352-lcdc", "ti,da830-lcdc"; reg = <0x4830e000 0x1000>; interrupts = <36>; + display-timings { + 800x480p62 { + clock-frequency = <30000000>; + hactive = <800>; + vactive = <480>; + hfront-porch = <39>; + hback-porch = <39>; + hsync-len = <47>; + vback-porch = <29>; + vfront-porch = <13>; + vsync-len = <2>; + hsync-active = <1>; + vsync-active = <1>; + }; + }; }; Index: linux-3.12.36-rt50-r4s2/drivers/video/da8xx-fb.c =================================================================== --- linux-3.12.36-rt50-r4s2.orig/drivers/video/da8xx-fb.c +++ linux-3.12.36-rt50-r4s2/drivers/video/da8xx-fb.c @ linux-3.12.36-rt50-r4s2/Documentation/devicetree/bindings/video/fb-da8xx.txt:39 @ #include <linux/slab.h> #include <linux/delay.h> #include <linux/lcm.h> +#include <video/of_display_timing.h> #include <video/da8xx-fb.h> #include <asm/div64.h> @ linux-3.12.36-rt50-r4s2/Documentation/devicetree/bindings/video/fb-da8xx.txt:1319 @ static struct fb_videomode *da8xx_fb_get { struct da8xx_lcdc_platform_data *fb_pdata = dev->dev.platform_data; struct fb_videomode *lcdc_info; + struct device_node *np = dev->dev.of_node; int i; + if (np) { + lcdc_info = devm_kzalloc(&dev->dev, + sizeof(struct fb_videomode), + GFP_KERNEL); + if (!lcdc_info) { + dev_err(&dev->dev, "memory allocation failed\n"); + return NULL; + } + if (of_get_fb_videomode(np, lcdc_info, OF_USE_NATIVE_MODE)) { + dev_err(&dev->dev, "timings not available in DT\n"); + return NULL; + } + return lcdc_info; + } + for (i = 0, lcdc_info = known_lcd_panels; i < ARRAY_SIZE(known_lcd_panels); i++, lcdc_info++) { if (strcmp(fb_pdata->type, lcdc_info->name) == 0)