aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/devicetree/bindings/video/via,vt8500-fb.txt48
-rw-r--r--Documentation/devicetree/bindings/video/wm,wm8505-fb.txt32
-rw-r--r--arch/arm/boot/dts/vt8500-bv07.dts34
-rw-r--r--arch/arm/boot/dts/vt8500.dtsi4
-rw-r--r--arch/arm/boot/dts/wm8505-ref.dts34
-rw-r--r--arch/arm/boot/dts/wm8505.dtsi4
-rw-r--r--arch/arm/boot/dts/wm8650-mid.dts36
-rw-r--r--arch/arm/boot/dts/wm8650.dtsi4
-rw-r--r--arch/arm/boot/dts/wm8850-w70v2.dts40
-rw-r--r--arch/arm/boot/dts/wm8850.dtsi4
-rw-r--r--drivers/video/Kconfig6
-rw-r--r--drivers/video/vt8500lcdfb.c53
-rw-r--r--drivers/video/wm8505fb.c67
13 files changed, 154 insertions, 212 deletions
diff --git a/Documentation/devicetree/bindings/video/via,vt8500-fb.txt b/Documentation/devicetree/bindings/video/via,vt8500-fb.txt
index c870b6478ec8..2871e218a0fb 100644
--- a/Documentation/devicetree/bindings/video/via,vt8500-fb.txt
+++ b/Documentation/devicetree/bindings/video/via,vt8500-fb.txt
@@ -5,58 +5,32 @@ Required properties:
5- compatible : "via,vt8500-fb" 5- compatible : "via,vt8500-fb"
6- reg : Should contain 1 register ranges(address and length) 6- reg : Should contain 1 register ranges(address and length)
7- interrupts : framebuffer controller interrupt 7- interrupts : framebuffer controller interrupt
8- display: a phandle pointing to the display node 8- bits-per-pixel : bit depth of framebuffer (16 or 32)
9 9
10Required nodes: 10Required subnodes:
11- display: a display node is required to initialize the lcd panel 11- display-timings: see display-timing.txt for information
12 This should be in the board dts.
13- default-mode: a videomode within the display with timing parameters
14 as specified below.
15 12
16Example: 13Example:
17 14
18 fb@d800e400 { 15 fb@d8050800 {
19 compatible = "via,vt8500-fb"; 16 compatible = "via,vt8500-fb";
20 reg = <0xd800e400 0x400>; 17 reg = <0xd800e400 0x400>;
21 interrupts = <12>; 18 interrupts = <12>;
22 display = <&display>; 19 bits-per-pixel = <16>;
23 default-mode = <&mode0>;
24 };
25
26VIA VT8500 Display
27-----------------------------------------------------
28Required properties (as per of_videomode_helper):
29
30 - hactive, vactive: Display resolution
31 - hfront-porch, hback-porch, hsync-len: Horizontal Display timing parameters
32 in pixels
33 vfront-porch, vback-porch, vsync-len: Vertical display timing parameters in
34 lines
35 - clock: displayclock in Hz
36 - bpp: lcd panel bit-depth.
37 <16> for RGB565, <32> for RGB888
38
39Optional properties (as per of_videomode_helper):
40 - width-mm, height-mm: Display dimensions in mm
41 - hsync-active-high (bool): Hsync pulse is active high
42 - vsync-active-high (bool): Vsync pulse is active high
43 - interlaced (bool): This is an interlaced mode
44 - doublescan (bool): This is a doublescan mode
45 20
46Example: 21 display-timings {
47 display: display@0 { 22 native-mode = <&timing0>;
48 modes { 23 timing0: 800x480 {
49 mode0: mode@0 { 24 clock-frequency = <0>; /* unused but required */
50 hactive = <800>; 25 hactive = <800>;
51 vactive = <480>; 26 vactive = <480>;
52 hback-porch = <88>;
53 hfront-porch = <40>; 27 hfront-porch = <40>;
28 hback-porch = <88>;
54 hsync-len = <0>; 29 hsync-len = <0>;
55 vback-porch = <32>; 30 vback-porch = <32>;
56 vfront-porch = <11>; 31 vfront-porch = <11>;
57 vsync-len = <1>; 32 vsync-len = <1>;
58 clock = <0>; /* unused but required */
59 bpp = <16>; /* non-standard but required */
60 }; 33 };
61 }; 34 };
62 }; 35 };
36
diff --git a/Documentation/devicetree/bindings/video/wm,wm8505-fb.txt b/Documentation/devicetree/bindings/video/wm,wm8505-fb.txt
index 3d325e1d11ee..0bcadb2840a5 100644
--- a/Documentation/devicetree/bindings/video/wm,wm8505-fb.txt
+++ b/Documentation/devicetree/bindings/video/wm,wm8505-fb.txt
@@ -4,20 +4,30 @@ Wondermedia WM8505 Framebuffer
4Required properties: 4Required properties:
5- compatible : "wm,wm8505-fb" 5- compatible : "wm,wm8505-fb"
6- reg : Should contain 1 register ranges(address and length) 6- reg : Should contain 1 register ranges(address and length)
7- via,display: a phandle pointing to the display node 7- bits-per-pixel : bit depth of framebuffer (16 or 32)
8 8
9Required nodes: 9Required subnodes:
10- display: a display node is required to initialize the lcd panel 10- display-timings: see display-timing.txt for information
11 This should be in the board dts. See definition in
12 Documentation/devicetree/bindings/video/via,vt8500-fb.txt
13- default-mode: a videomode node as specified in
14 Documentation/devicetree/bindings/video/via,vt8500-fb.txt
15 11
16Example: 12Example:
17 13
18 fb@d8050800 { 14 fb@d8051700 {
19 compatible = "wm,wm8505-fb"; 15 compatible = "wm,wm8505-fb";
20 reg = <0xd8050800 0x200>; 16 reg = <0xd8051700 0x200>;
21 display = <&display>; 17 bits-per-pixel = <16>;
22 default-mode = <&mode0>; 18
19 display-timings {
20 native-mode = <&timing0>;
21 timing0: 800x480 {
22 clock-frequency = <0>; /* unused but required */
23 hactive = <800>;
24 vactive = <480>;
25 hfront-porch = <40>;
26 hback-porch = <88>;
27 hsync-len = <0>;
28 vback-porch = <32>;
29 vfront-porch = <11>;
30 vsync-len = <1>;
31 };
32 };
23 }; 33 };
diff --git a/arch/arm/boot/dts/vt8500-bv07.dts b/arch/arm/boot/dts/vt8500-bv07.dts
index 567cf4e8ab84..877b33afa7ed 100644
--- a/arch/arm/boot/dts/vt8500-bv07.dts
+++ b/arch/arm/boot/dts/vt8500-bv07.dts
@@ -11,26 +11,22 @@
11 11
12/ { 12/ {
13 model = "Benign BV07 Netbook"; 13 model = "Benign BV07 Netbook";
14};
14 15
15 /* 16&fb {
16 * Display node is based on Sascha Hauer's patch on dri-devel. 17 bits-per-pixel = <16>;
17 * Added a bpp property to calculate the size of the framebuffer 18 display-timings {
18 * until the binding is formalized. 19 native-mode = <&timing0>;
19 */ 20 timing0: 800x480 {
20 display: display@0 { 21 clock-frequency = <0>; /* unused but required */
21 modes { 22 hactive = <800>;
22 mode0: mode@0 { 23 vactive = <480>;
23 hactive = <800>; 24 hfront-porch = <40>;
24 vactive = <480>; 25 hback-porch = <88>;
25 hback-porch = <88>; 26 hsync-len = <0>;
26 hfront-porch = <40>; 27 vback-porch = <32>;
27 hsync-len = <0>; 28 vfront-porch = <11>;
28 vback-porch = <32>; 29 vsync-len = <1>;
29 vfront-porch = <11>;
30 vsync-len = <1>;
31 clock = <0>; /* unused but required */
32 bpp = <16>; /* non-standard but required */
33 };
34 }; 30 };
35 }; 31 };
36}; 32};
diff --git a/arch/arm/boot/dts/vt8500.dtsi b/arch/arm/boot/dts/vt8500.dtsi
index cf31ced46602..68c8dc644383 100644
--- a/arch/arm/boot/dts/vt8500.dtsi
+++ b/arch/arm/boot/dts/vt8500.dtsi
@@ -98,12 +98,10 @@
98 interrupts = <43>; 98 interrupts = <43>;
99 }; 99 };
100 100
101 fb@d800e400 { 101 fb: fb@d8050800 {
102 compatible = "via,vt8500-fb"; 102 compatible = "via,vt8500-fb";
103 reg = <0xd800e400 0x400>; 103 reg = <0xd800e400 0x400>;
104 interrupts = <12>; 104 interrupts = <12>;
105 display = <&display>;
106 default-mode = <&mode0>;
107 }; 105 };
108 106
109 ge_rops@d8050400 { 107 ge_rops@d8050400 {
diff --git a/arch/arm/boot/dts/wm8505-ref.dts b/arch/arm/boot/dts/wm8505-ref.dts
index fd4e248074c6..edd2cec3d37f 100644
--- a/arch/arm/boot/dts/wm8505-ref.dts
+++ b/arch/arm/boot/dts/wm8505-ref.dts
@@ -11,26 +11,22 @@
11 11
12/ { 12/ {
13 model = "Wondermedia WM8505 Netbook"; 13 model = "Wondermedia WM8505 Netbook";
14};
14 15
15 /* 16&fb {
16 * Display node is based on Sascha Hauer's patch on dri-devel. 17 bits-per-pixel = <32>;
17 * Added a bpp property to calculate the size of the framebuffer 18 display-timings {
18 * until the binding is formalized. 19 native-mode = <&timing0>;
19 */ 20 timing0: 800x480 {
20 display: display@0 { 21 clock-frequency = <0>; /* unused but required */
21 modes { 22 hactive = <800>;
22 mode0: mode@0 { 23 vactive = <480>;
23 hactive = <800>; 24 hfront-porch = <40>;
24 vactive = <480>; 25 hback-porch = <88>;
25 hback-porch = <88>; 26 hsync-len = <0>;
26 hfront-porch = <40>; 27 vback-porch = <32>;
27 hsync-len = <0>; 28 vfront-porch = <11>;
28 vback-porch = <32>; 29 vsync-len = <1>;
29 vfront-porch = <11>;
30 vsync-len = <1>;
31 clock = <0>; /* unused but required */
32 bpp = <32>; /* non-standard but required */
33 };
34 }; 30 };
35 }; 31 };
36}; 32};
diff --git a/arch/arm/boot/dts/wm8505.dtsi b/arch/arm/boot/dts/wm8505.dtsi
index e74a1c0fb9a2..bcf668d31b28 100644
--- a/arch/arm/boot/dts/wm8505.dtsi
+++ b/arch/arm/boot/dts/wm8505.dtsi
@@ -128,11 +128,9 @@
128 interrupts = <0>; 128 interrupts = <0>;
129 }; 129 };
130 130
131 fb@d8050800 { 131 fb: fb@d8050800 {
132 compatible = "wm,wm8505-fb"; 132 compatible = "wm,wm8505-fb";
133 reg = <0xd8050800 0x200>; 133 reg = <0xd8050800 0x200>;
134 display = <&display>;
135 default-mode = <&mode0>;
136 }; 134 };
137 135
138 ge_rops@d8050400 { 136 ge_rops@d8050400 {
diff --git a/arch/arm/boot/dts/wm8650-mid.dts b/arch/arm/boot/dts/wm8650-mid.dts
index cefd938f842f..61671a0d9ede 100644
--- a/arch/arm/boot/dts/wm8650-mid.dts
+++ b/arch/arm/boot/dts/wm8650-mid.dts
@@ -11,26 +11,24 @@
11 11
12/ { 12/ {
13 model = "Wondermedia WM8650-MID Tablet"; 13 model = "Wondermedia WM8650-MID Tablet";
14};
15
16&fb {
17 bits-per-pixel = <16>;
14 18
15 /* 19 display-timings {
16 * Display node is based on Sascha Hauer's patch on dri-devel. 20 native-mode = <&timing0>;
17 * Added a bpp property to calculate the size of the framebuffer 21 timing0: 800x480 {
18 * until the binding is formalized. 22 clock-frequency = <0>; /* unused but required */
19 */ 23 hactive = <800>;
20 display: display@0 { 24 vactive = <480>;
21 modes { 25 hfront-porch = <40>;
22 mode0: mode@0 { 26 hback-porch = <88>;
23 hactive = <800>; 27 hsync-len = <0>;
24 vactive = <480>; 28 vback-porch = <32>;
25 hback-porch = <88>; 29 vfront-porch = <11>;
26 hfront-porch = <40>; 30 vsync-len = <1>;
27 hsync-len = <0>;
28 vback-porch = <32>;
29 vfront-porch = <11>;
30 vsync-len = <1>;
31 clock = <0>; /* unused but required */
32 bpp = <16>; /* non-standard but required */
33 };
34 }; 31 };
35 }; 32 };
36}; 33};
34
diff --git a/arch/arm/boot/dts/wm8650.dtsi b/arch/arm/boot/dts/wm8650.dtsi
index db3c0a12e052..9313407bbc30 100644
--- a/arch/arm/boot/dts/wm8650.dtsi
+++ b/arch/arm/boot/dts/wm8650.dtsi
@@ -128,11 +128,9 @@
128 interrupts = <43>; 128 interrupts = <43>;
129 }; 129 };
130 130
131 fb@d8050800 { 131 fb: fb@d8050800 {
132 compatible = "wm,wm8505-fb"; 132 compatible = "wm,wm8505-fb";
133 reg = <0xd8050800 0x200>; 133 reg = <0xd8050800 0x200>;
134 display = <&display>;
135 default-mode = <&mode0>;
136 }; 134 };
137 135
138 ge_rops@d8050400 { 136 ge_rops@d8050400 {
diff --git a/arch/arm/boot/dts/wm8850-w70v2.dts b/arch/arm/boot/dts/wm8850-w70v2.dts
index fcc660c89540..32d22532cd6c 100644
--- a/arch/arm/boot/dts/wm8850-w70v2.dts
+++ b/arch/arm/boot/dts/wm8850-w70v2.dts
@@ -15,28 +15,6 @@
15/ { 15/ {
16 model = "Wondermedia WM8850-W70v2 Tablet"; 16 model = "Wondermedia WM8850-W70v2 Tablet";
17 17
18 /*
19 * Display node is based on Sascha Hauer's patch on dri-devel.
20 * Added a bpp property to calculate the size of the framebuffer
21 * until the binding is formalized.
22 */
23 display: display@0 {
24 modes {
25 mode0: mode@0 {
26 hactive = <800>;
27 vactive = <480>;
28 hback-porch = <88>;
29 hfront-porch = <40>;
30 hsync-len = <0>;
31 vback-porch = <32>;
32 vfront-porch = <11>;
33 vsync-len = <1>;
34 clock = <0>; /* unused but required */
35 bpp = <16>; /* non-standard but required */
36 };
37 };
38 };
39
40 backlight { 18 backlight {
41 compatible = "pwm-backlight"; 19 compatible = "pwm-backlight";
42 pwms = <&pwm 0 50000 1>; /* duty inverted */ 20 pwms = <&pwm 0 50000 1>; /* duty inverted */
@@ -45,3 +23,21 @@
45 default-brightness-level = <5>; 23 default-brightness-level = <5>;
46 }; 24 };
47}; 25};
26
27&fb {
28 bits-per-pixel = <16>;
29 display-timings {
30 native-mode = <&timing0>;
31 timing0: 800x480 {
32 clock-frequency = <0>; /* unused but required */
33 hactive = <800>;
34 vactive = <480>;
35 hfront-porch = <40>;
36 hback-porch = <88>;
37 hsync-len = <0>;
38 vback-porch = <32>;
39 vfront-porch = <11>;
40 vsync-len = <1>;
41 };
42 };
43};
diff --git a/arch/arm/boot/dts/wm8850.dtsi b/arch/arm/boot/dts/wm8850.dtsi
index e8cbfdc87bba..7149cd13e3b9 100644
--- a/arch/arm/boot/dts/wm8850.dtsi
+++ b/arch/arm/boot/dts/wm8850.dtsi
@@ -135,11 +135,9 @@
135 }; 135 };
136 }; 136 };
137 137
138 fb@d8051700 { 138 fb: fb@d8051700 {
139 compatible = "wm,wm8505-fb"; 139 compatible = "wm,wm8505-fb";
140 reg = <0xd8051700 0x200>; 140 reg = <0xd8051700 0x200>;
141 display = <&display>;
142 default-mode = <&mode0>;
143 }; 141 };
144 142
145 ge_rops@d8050400 { 143 ge_rops@d8050400 {
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 = {
261static int wm8505fb_probe(struct platform_device *pdev) 262static 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;