diff options
54 files changed, 799 insertions, 728 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 | ||
10 | Required nodes: | 10 | Required 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 | ||
16 | Example: | 13 | Example: |
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 | |||
26 | VIA VT8500 Display | ||
27 | ----------------------------------------------------- | ||
28 | Required 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 | |||
39 | Optional 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 | ||
46 | Example: | 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 | |||
4 | Required properties: | 4 | Required 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 | ||
9 | Required nodes: | 9 | Required 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 | ||
16 | Example: | 12 | Example: |
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/arch/arm/plat-samsung/include/plat/fb.h b/arch/arm/plat-samsung/include/plat/fb.h index b885322717a1..9ae507270785 100644 --- a/arch/arm/plat-samsung/include/plat/fb.h +++ b/arch/arm/plat-samsung/include/plat/fb.h | |||
@@ -15,55 +15,7 @@ | |||
15 | #ifndef __PLAT_S3C_FB_H | 15 | #ifndef __PLAT_S3C_FB_H |
16 | #define __PLAT_S3C_FB_H __FILE__ | 16 | #define __PLAT_S3C_FB_H __FILE__ |
17 | 17 | ||
18 | /* S3C_FB_MAX_WIN | 18 | #include <linux/platform_data/video_s3c.h> |
19 | * Set to the maximum number of windows that any of the supported hardware | ||
20 | * can use. Since the platform data uses this for an array size, having it | ||
21 | * set to the maximum of any version of the hardware can do is safe. | ||
22 | */ | ||
23 | #define S3C_FB_MAX_WIN (5) | ||
24 | |||
25 | /** | ||
26 | * struct s3c_fb_pd_win - per window setup data | ||
27 | * @xres : The window X size. | ||
28 | * @yres : The window Y size. | ||
29 | * @virtual_x: The virtual X size. | ||
30 | * @virtual_y: The virtual Y size. | ||
31 | */ | ||
32 | struct s3c_fb_pd_win { | ||
33 | unsigned short default_bpp; | ||
34 | unsigned short max_bpp; | ||
35 | unsigned short xres; | ||
36 | unsigned short yres; | ||
37 | unsigned short virtual_x; | ||
38 | unsigned short virtual_y; | ||
39 | }; | ||
40 | |||
41 | /** | ||
42 | * struct s3c_fb_platdata - S3C driver platform specific information | ||
43 | * @setup_gpio: Setup the external GPIO pins to the right state to transfer | ||
44 | * the data from the display system to the connected display | ||
45 | * device. | ||
46 | * @vidcon0: The base vidcon0 values to control the panel data format. | ||
47 | * @vidcon1: The base vidcon1 values to control the panel data output. | ||
48 | * @vtiming: Video timing when connected to a RGB type panel. | ||
49 | * @win: The setup data for each hardware window, or NULL for unused. | ||
50 | * @display_mode: The LCD output display mode. | ||
51 | * | ||
52 | * The platform data supplies the video driver with all the information | ||
53 | * it requires to work with the display(s) attached to the machine. It | ||
54 | * controls the initial mode, the number of display windows (0 is always | ||
55 | * the base framebuffer) that are initialised etc. | ||
56 | * | ||
57 | */ | ||
58 | struct s3c_fb_platdata { | ||
59 | void (*setup_gpio)(void); | ||
60 | |||
61 | struct s3c_fb_pd_win *win[S3C_FB_MAX_WIN]; | ||
62 | struct fb_videomode *vtiming; | ||
63 | |||
64 | u32 vidcon0; | ||
65 | u32 vidcon1; | ||
66 | }; | ||
67 | 19 | ||
68 | /** | 20 | /** |
69 | * s3c_fb_set_platdata() - Setup the FB device with platform data. | 21 | * s3c_fb_set_platdata() - Setup the FB device with platform data. |
diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c index 04fa6f1808d1..f83f0719922e 100644 --- a/drivers/gpu/drm/drm_modes.c +++ b/drivers/gpu/drm/drm_modes.c | |||
@@ -506,7 +506,7 @@ drm_gtf_mode(struct drm_device *dev, int hdisplay, int vdisplay, int vrefresh, | |||
506 | } | 506 | } |
507 | EXPORT_SYMBOL(drm_gtf_mode); | 507 | EXPORT_SYMBOL(drm_gtf_mode); |
508 | 508 | ||
509 | #if IS_ENABLED(CONFIG_VIDEOMODE) | 509 | #ifdef CONFIG_VIDEOMODE_HELPERS |
510 | int drm_display_mode_from_videomode(const struct videomode *vm, | 510 | int drm_display_mode_from_videomode(const struct videomode *vm, |
511 | struct drm_display_mode *dmode) | 511 | struct drm_display_mode *dmode) |
512 | { | 512 | { |
@@ -523,26 +523,25 @@ int drm_display_mode_from_videomode(const struct videomode *vm, | |||
523 | dmode->clock = vm->pixelclock / 1000; | 523 | dmode->clock = vm->pixelclock / 1000; |
524 | 524 | ||
525 | dmode->flags = 0; | 525 | dmode->flags = 0; |
526 | if (vm->dmt_flags & VESA_DMT_HSYNC_HIGH) | 526 | if (vm->flags & DISPLAY_FLAGS_HSYNC_HIGH) |
527 | dmode->flags |= DRM_MODE_FLAG_PHSYNC; | 527 | dmode->flags |= DRM_MODE_FLAG_PHSYNC; |
528 | else if (vm->dmt_flags & VESA_DMT_HSYNC_LOW) | 528 | else if (vm->flags & DISPLAY_FLAGS_HSYNC_LOW) |
529 | dmode->flags |= DRM_MODE_FLAG_NHSYNC; | 529 | dmode->flags |= DRM_MODE_FLAG_NHSYNC; |
530 | if (vm->dmt_flags & VESA_DMT_VSYNC_HIGH) | 530 | if (vm->flags & DISPLAY_FLAGS_VSYNC_HIGH) |
531 | dmode->flags |= DRM_MODE_FLAG_PVSYNC; | 531 | dmode->flags |= DRM_MODE_FLAG_PVSYNC; |
532 | else if (vm->dmt_flags & VESA_DMT_VSYNC_LOW) | 532 | else if (vm->flags & DISPLAY_FLAGS_VSYNC_LOW) |
533 | dmode->flags |= DRM_MODE_FLAG_NVSYNC; | 533 | dmode->flags |= DRM_MODE_FLAG_NVSYNC; |
534 | if (vm->data_flags & DISPLAY_FLAGS_INTERLACED) | 534 | if (vm->flags & DISPLAY_FLAGS_INTERLACED) |
535 | dmode->flags |= DRM_MODE_FLAG_INTERLACE; | 535 | dmode->flags |= DRM_MODE_FLAG_INTERLACE; |
536 | if (vm->data_flags & DISPLAY_FLAGS_DOUBLESCAN) | 536 | if (vm->flags & DISPLAY_FLAGS_DOUBLESCAN) |
537 | dmode->flags |= DRM_MODE_FLAG_DBLSCAN; | 537 | dmode->flags |= DRM_MODE_FLAG_DBLSCAN; |
538 | drm_mode_set_name(dmode); | 538 | drm_mode_set_name(dmode); |
539 | 539 | ||
540 | return 0; | 540 | return 0; |
541 | } | 541 | } |
542 | EXPORT_SYMBOL_GPL(drm_display_mode_from_videomode); | 542 | EXPORT_SYMBOL_GPL(drm_display_mode_from_videomode); |
543 | #endif | ||
544 | 543 | ||
545 | #if IS_ENABLED(CONFIG_OF_VIDEOMODE) | 544 | #ifdef CONFIG_OF |
546 | /** | 545 | /** |
547 | * of_get_drm_display_mode - get a drm_display_mode from devicetree | 546 | * of_get_drm_display_mode - get a drm_display_mode from devicetree |
548 | * @np: device_node with the timing specification | 547 | * @np: device_node with the timing specification |
@@ -572,7 +571,8 @@ int of_get_drm_display_mode(struct device_node *np, | |||
572 | return 0; | 571 | return 0; |
573 | } | 572 | } |
574 | EXPORT_SYMBOL_GPL(of_get_drm_display_mode); | 573 | EXPORT_SYMBOL_GPL(of_get_drm_display_mode); |
575 | #endif | 574 | #endif /* CONFIG_OF */ |
575 | #endif /* CONFIG_VIDEOMODE_HELPERS */ | ||
576 | 576 | ||
577 | /** | 577 | /** |
578 | * drm_mode_set_name - set the name on a mode | 578 | * drm_mode_set_name - set the name on a mode |
diff --git a/drivers/gpu/drm/tilcdc/Kconfig b/drivers/gpu/drm/tilcdc/Kconfig index d24d04013476..e461e9972455 100644 --- a/drivers/gpu/drm/tilcdc/Kconfig +++ b/drivers/gpu/drm/tilcdc/Kconfig | |||
@@ -4,8 +4,7 @@ config DRM_TILCDC | |||
4 | select DRM_KMS_HELPER | 4 | select DRM_KMS_HELPER |
5 | select DRM_KMS_CMA_HELPER | 5 | select DRM_KMS_CMA_HELPER |
6 | select DRM_GEM_CMA_HELPER | 6 | select DRM_GEM_CMA_HELPER |
7 | select OF_VIDEOMODE | 7 | select VIDEOMODE_HELPERS |
8 | select OF_DISPLAY_TIMING | ||
9 | select BACKLIGHT_CLASS_DEVICE | 8 | select BACKLIGHT_CLASS_DEVICE |
10 | help | 9 | help |
11 | Choose this option if you have an TI SoC with LCDC display | 10 | Choose this option if you have an TI SoC with LCDC display |
diff --git a/drivers/gpu/drm/tilcdc/tilcdc_panel.c b/drivers/gpu/drm/tilcdc/tilcdc_panel.c index 580b74e2022b..90ee49786372 100644 --- a/drivers/gpu/drm/tilcdc/tilcdc_panel.c +++ b/drivers/gpu/drm/tilcdc/tilcdc_panel.c | |||
@@ -173,7 +173,7 @@ static int panel_connector_get_modes(struct drm_connector *connector) | |||
173 | struct drm_display_mode *mode = drm_mode_create(dev); | 173 | struct drm_display_mode *mode = drm_mode_create(dev); |
174 | struct videomode vm; | 174 | struct videomode vm; |
175 | 175 | ||
176 | if (videomode_from_timing(timings, &vm, i)) | 176 | if (videomode_from_timings(timings, &vm, i)) |
177 | break; | 177 | break; |
178 | 178 | ||
179 | drm_display_mode_from_videomode(&vm, mode); | 179 | drm_display_mode_from_videomode(&vm, mode); |
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig index 09394657926e..981c1c08c727 100644 --- a/drivers/video/Kconfig +++ b/drivers/video/Kconfig | |||
@@ -31,26 +31,8 @@ config VIDEO_OUTPUT_CONTROL | |||
31 | This framework adds support for low-level control of the video | 31 | This framework adds support for low-level control of the video |
32 | output switch. | 32 | output switch. |
33 | 33 | ||
34 | config DISPLAY_TIMING | 34 | config VIDEOMODE_HELPERS |
35 | bool | 35 | bool |
36 | |||
37 | config VIDEOMODE | ||
38 | bool | ||
39 | |||
40 | config OF_DISPLAY_TIMING | ||
41 | bool "Enable device tree display timing support" | ||
42 | depends on OF | ||
43 | select DISPLAY_TIMING | ||
44 | help | ||
45 | helper to parse display timings from the devicetree | ||
46 | |||
47 | config OF_VIDEOMODE | ||
48 | bool "Enable device tree videomode support" | ||
49 | depends on OF | ||
50 | select VIDEOMODE | ||
51 | select OF_DISPLAY_TIMING | ||
52 | help | ||
53 | helper to get videomodes from the devicetree | ||
54 | 36 | ||
55 | config HDMI | 37 | config HDMI |
56 | bool | 38 | bool |
@@ -212,14 +194,6 @@ config FB_SYS_FOPS | |||
212 | depends on FB | 194 | depends on FB |
213 | default n | 195 | default n |
214 | 196 | ||
215 | config FB_WMT_GE_ROPS | ||
216 | tristate | ||
217 | depends on FB | ||
218 | default n | ||
219 | ---help--- | ||
220 | Include functions for accelerated rectangle filling and area | ||
221 | copying using WonderMedia Graphics Engine operations. | ||
222 | |||
223 | config FB_DEFERRED_IO | 197 | config FB_DEFERRED_IO |
224 | bool | 198 | bool |
225 | depends on FB | 199 | depends on FB |
@@ -1797,22 +1771,37 @@ config FB_AU1200 | |||
1797 | option au1200fb:panel=<name>. | 1771 | option au1200fb:panel=<name>. |
1798 | 1772 | ||
1799 | config FB_VT8500 | 1773 | config FB_VT8500 |
1800 | bool "VT8500 LCD Driver" | 1774 | bool "VIA VT8500 framebuffer support" |
1801 | depends on (FB = y) && ARM && ARCH_VT8500 | 1775 | depends on (FB = y) && ARM && ARCH_VT8500 |
1802 | select FB_WMT_GE_ROPS | 1776 | select FB_SYS_FILLRECT if (!FB_WMT_GE_ROPS) |
1777 | select FB_SYS_COPYAREA if (!FB_WMT_GE_ROPS) | ||
1803 | select FB_SYS_IMAGEBLIT | 1778 | select FB_SYS_IMAGEBLIT |
1779 | select FB_MODE_HELPERS | ||
1780 | select VIDEOMODE_HELPERS | ||
1804 | help | 1781 | help |
1805 | This is the framebuffer driver for VIA VT8500 integrated LCD | 1782 | This is the framebuffer driver for VIA VT8500 integrated LCD |
1806 | controller. | 1783 | controller. |
1807 | 1784 | ||
1808 | config FB_WM8505 | 1785 | config FB_WM8505 |
1809 | bool "WM8505 frame buffer support" | 1786 | bool "Wondermedia WM8xxx-series frame buffer support" |
1810 | depends on (FB = y) && ARM && ARCH_VT8500 | 1787 | depends on (FB = y) && ARM && ARCH_VT8500 |
1811 | select FB_WMT_GE_ROPS | 1788 | select FB_SYS_FILLRECT if (!FB_WMT_GE_ROPS) |
1789 | select FB_SYS_COPYAREA if (!FB_WMT_GE_ROPS) | ||
1812 | select FB_SYS_IMAGEBLIT | 1790 | select FB_SYS_IMAGEBLIT |
1791 | select FB_MODE_HELPERS | ||
1792 | select VIDEOMODE_HELPERS | ||
1793 | help | ||
1794 | This is the framebuffer driver for WonderMedia WM8xxx-series | ||
1795 | integrated LCD controller. This driver covers the WM8505, WM8650 | ||
1796 | and WM8850 SoCs. | ||
1797 | |||
1798 | config FB_WMT_GE_ROPS | ||
1799 | bool "VT8500/WM8xxx accelerated raster ops support" | ||
1800 | depends on (FB = y) && (FB_VT8500 || FB_WM8505) | ||
1801 | default n | ||
1813 | help | 1802 | help |
1814 | This is the framebuffer driver for WonderMedia WM8505/WM8650 | 1803 | This adds support for accelerated raster operations on the |
1815 | integrated LCD controller. | 1804 | VIA VT8500 and Wondermedia 85xx series SoCs. |
1816 | 1805 | ||
1817 | source "drivers/video/geode/Kconfig" | 1806 | source "drivers/video/geode/Kconfig" |
1818 | 1807 | ||
diff --git a/drivers/video/Makefile b/drivers/video/Makefile index 9df387334cb7..e414378d6a51 100644 --- a/drivers/video/Makefile +++ b/drivers/video/Makefile | |||
@@ -171,7 +171,7 @@ obj-$(CONFIG_FB_VIRTUAL) += vfb.o | |||
171 | 171 | ||
172 | #video output switch sysfs driver | 172 | #video output switch sysfs driver |
173 | obj-$(CONFIG_VIDEO_OUTPUT_CONTROL) += output.o | 173 | obj-$(CONFIG_VIDEO_OUTPUT_CONTROL) += output.o |
174 | obj-$(CONFIG_DISPLAY_TIMING) += display_timing.o | 174 | obj-$(CONFIG_VIDEOMODE_HELPERS) += display_timing.o videomode.o |
175 | obj-$(CONFIG_OF_DISPLAY_TIMING) += of_display_timing.o | 175 | ifeq ($(CONFIG_OF),y) |
176 | obj-$(CONFIG_VIDEOMODE) += videomode.o | 176 | obj-$(CONFIG_VIDEOMODE_HELPERS) += of_display_timing.o of_videomode.o |
177 | obj-$(CONFIG_OF_VIDEOMODE) += of_videomode.o | 177 | endif |
diff --git a/drivers/video/amifb.c b/drivers/video/amifb.c index 7fa1bf823729..77cb4ffa1fe4 100644 --- a/drivers/video/amifb.c +++ b/drivers/video/amifb.c | |||
@@ -3788,19 +3788,7 @@ static struct platform_driver amifb_driver = { | |||
3788 | }, | 3788 | }, |
3789 | }; | 3789 | }; |
3790 | 3790 | ||
3791 | static int __init amifb_init(void) | 3791 | module_platform_driver_probe(amifb_driver, amifb_probe); |
3792 | { | ||
3793 | return platform_driver_probe(&amifb_driver, amifb_probe); | ||
3794 | } | ||
3795 | |||
3796 | module_init(amifb_init); | ||
3797 | |||
3798 | static void __exit amifb_exit(void) | ||
3799 | { | ||
3800 | platform_driver_unregister(&amifb_driver); | ||
3801 | } | ||
3802 | |||
3803 | module_exit(amifb_exit); | ||
3804 | 3792 | ||
3805 | MODULE_LICENSE("GPL"); | 3793 | MODULE_LICENSE("GPL"); |
3806 | MODULE_ALIAS("platform:amiga-video"); | 3794 | MODULE_ALIAS("platform:amiga-video"); |
diff --git a/drivers/video/atmel_lcdfb.c b/drivers/video/atmel_lcdfb.c index 025428e04c33..98348ec0b3ce 100644 --- a/drivers/video/atmel_lcdfb.c +++ b/drivers/video/atmel_lcdfb.c | |||
@@ -1158,18 +1158,7 @@ static struct platform_driver atmel_lcdfb_driver = { | |||
1158 | }, | 1158 | }, |
1159 | }; | 1159 | }; |
1160 | 1160 | ||
1161 | static int __init atmel_lcdfb_init(void) | 1161 | module_platform_driver_probe(atmel_lcdfb_driver, atmel_lcdfb_probe); |
1162 | { | ||
1163 | return platform_driver_probe(&atmel_lcdfb_driver, atmel_lcdfb_probe); | ||
1164 | } | ||
1165 | |||
1166 | static void __exit atmel_lcdfb_exit(void) | ||
1167 | { | ||
1168 | platform_driver_unregister(&atmel_lcdfb_driver); | ||
1169 | } | ||
1170 | |||
1171 | module_init(atmel_lcdfb_init); | ||
1172 | module_exit(atmel_lcdfb_exit); | ||
1173 | 1162 | ||
1174 | MODULE_DESCRIPTION("AT91/AT32 LCD Controller framebuffer driver"); | 1163 | MODULE_DESCRIPTION("AT91/AT32 LCD Controller framebuffer driver"); |
1175 | MODULE_AUTHOR("Nicolas Ferre <nicolas.ferre@atmel.com>"); | 1164 | MODULE_AUTHOR("Nicolas Ferre <nicolas.ferre@atmel.com>"); |
diff --git a/drivers/video/auo_k1900fb.c b/drivers/video/auo_k1900fb.c index 1a9ac6e1f4b3..f5b668e77af3 100644 --- a/drivers/video/auo_k1900fb.c +++ b/drivers/video/auo_k1900fb.c | |||
@@ -60,9 +60,12 @@ | |||
60 | 60 | ||
61 | static void auok1900_init(struct auok190xfb_par *par) | 61 | static void auok1900_init(struct auok190xfb_par *par) |
62 | { | 62 | { |
63 | struct device *dev = par->info->device; | ||
63 | struct auok190x_board *board = par->board; | 64 | struct auok190x_board *board = par->board; |
64 | u16 init_param = 0; | 65 | u16 init_param = 0; |
65 | 66 | ||
67 | pm_runtime_get_sync(dev); | ||
68 | |||
66 | init_param |= AUOK1900_INIT_TEMP_AVERAGE; | 69 | init_param |= AUOK1900_INIT_TEMP_AVERAGE; |
67 | init_param |= AUOK1900_INIT_ROTATE(par->rotation); | 70 | init_param |= AUOK1900_INIT_ROTATE(par->rotation); |
68 | init_param |= AUOK190X_INIT_INVERSE_WHITE; | 71 | init_param |= AUOK190X_INIT_INVERSE_WHITE; |
@@ -74,6 +77,9 @@ static void auok1900_init(struct auok190xfb_par *par) | |||
74 | 77 | ||
75 | /* let the controller finish */ | 78 | /* let the controller finish */ |
76 | board->wait_for_rdy(par); | 79 | board->wait_for_rdy(par); |
80 | |||
81 | pm_runtime_mark_last_busy(dev); | ||
82 | pm_runtime_put_autosuspend(dev); | ||
77 | } | 83 | } |
78 | 84 | ||
79 | static void auok1900_update_region(struct auok190xfb_par *par, int mode, | 85 | static void auok1900_update_region(struct auok190xfb_par *par, int mode, |
@@ -82,6 +88,7 @@ static void auok1900_update_region(struct auok190xfb_par *par, int mode, | |||
82 | struct device *dev = par->info->device; | 88 | struct device *dev = par->info->device; |
83 | unsigned char *buf = (unsigned char *)par->info->screen_base; | 89 | unsigned char *buf = (unsigned char *)par->info->screen_base; |
84 | int xres = par->info->var.xres; | 90 | int xres = par->info->var.xres; |
91 | int line_length = par->info->fix.line_length; | ||
85 | u16 args[4]; | 92 | u16 args[4]; |
86 | 93 | ||
87 | pm_runtime_get_sync(dev); | 94 | pm_runtime_get_sync(dev); |
@@ -100,9 +107,9 @@ static void auok1900_update_region(struct auok190xfb_par *par, int mode, | |||
100 | args[1] = y1 + 1; | 107 | args[1] = y1 + 1; |
101 | args[2] = xres; | 108 | args[2] = xres; |
102 | args[3] = y2 - y1; | 109 | args[3] = y2 - y1; |
103 | buf += y1 * xres; | 110 | buf += y1 * line_length; |
104 | auok190x_send_cmdargs_pixels(par, AUOK1900_CMD_PARTIALDISP, 4, args, | 111 | auok190x_send_cmdargs_pixels(par, AUOK1900_CMD_PARTIALDISP, 4, args, |
105 | ((y2 - y1) * xres)/2, (u16 *) buf); | 112 | ((y2 - y1) * line_length)/2, (u16 *) buf); |
106 | auok190x_send_command(par, AUOK190X_CMD_DATA_STOP); | 113 | auok190x_send_command(par, AUOK190X_CMD_DATA_STOP); |
107 | 114 | ||
108 | par->update_cnt++; | 115 | par->update_cnt++; |
diff --git a/drivers/video/auo_k1901fb.c b/drivers/video/auo_k1901fb.c index d1db1653cd88..12b9adcb75c5 100644 --- a/drivers/video/auo_k1901fb.c +++ b/drivers/video/auo_k1901fb.c | |||
@@ -101,9 +101,12 @@ | |||
101 | 101 | ||
102 | static void auok1901_init(struct auok190xfb_par *par) | 102 | static void auok1901_init(struct auok190xfb_par *par) |
103 | { | 103 | { |
104 | struct device *dev = par->info->device; | ||
104 | struct auok190x_board *board = par->board; | 105 | struct auok190x_board *board = par->board; |
105 | u16 init_param = 0; | 106 | u16 init_param = 0; |
106 | 107 | ||
108 | pm_runtime_get_sync(dev); | ||
109 | |||
107 | init_param |= AUOK190X_INIT_INVERSE_WHITE; | 110 | init_param |= AUOK190X_INIT_INVERSE_WHITE; |
108 | init_param |= AUOK190X_INIT_FORMAT0; | 111 | init_param |= AUOK190X_INIT_FORMAT0; |
109 | init_param |= AUOK1901_INIT_RESOLUTION(par->resolution); | 112 | init_param |= AUOK1901_INIT_RESOLUTION(par->resolution); |
@@ -113,6 +116,9 @@ static void auok1901_init(struct auok190xfb_par *par) | |||
113 | 116 | ||
114 | /* let the controller finish */ | 117 | /* let the controller finish */ |
115 | board->wait_for_rdy(par); | 118 | board->wait_for_rdy(par); |
119 | |||
120 | pm_runtime_mark_last_busy(dev); | ||
121 | pm_runtime_put_autosuspend(dev); | ||
116 | } | 122 | } |
117 | 123 | ||
118 | static void auok1901_update_region(struct auok190xfb_par *par, int mode, | 124 | static void auok1901_update_region(struct auok190xfb_par *par, int mode, |
@@ -121,6 +127,7 @@ static void auok1901_update_region(struct auok190xfb_par *par, int mode, | |||
121 | struct device *dev = par->info->device; | 127 | struct device *dev = par->info->device; |
122 | unsigned char *buf = (unsigned char *)par->info->screen_base; | 128 | unsigned char *buf = (unsigned char *)par->info->screen_base; |
123 | int xres = par->info->var.xres; | 129 | int xres = par->info->var.xres; |
130 | int line_length = par->info->fix.line_length; | ||
124 | u16 args[5]; | 131 | u16 args[5]; |
125 | 132 | ||
126 | pm_runtime_get_sync(dev); | 133 | pm_runtime_get_sync(dev); |
@@ -139,9 +146,9 @@ static void auok1901_update_region(struct auok190xfb_par *par, int mode, | |||
139 | args[1] = y1 + 1; | 146 | args[1] = y1 + 1; |
140 | args[2] = xres; | 147 | args[2] = xres; |
141 | args[3] = y2 - y1; | 148 | args[3] = y2 - y1; |
142 | buf += y1 * xres; | 149 | buf += y1 * line_length; |
143 | auok190x_send_cmdargs_pixels_nowait(par, AUOK1901_CMD_DMA_START, 4, | 150 | auok190x_send_cmdargs_pixels_nowait(par, AUOK1901_CMD_DMA_START, 4, |
144 | args, ((y2 - y1) * xres)/2, | 151 | args, ((y2 - y1) * line_length)/2, |
145 | (u16 *) buf); | 152 | (u16 *) buf); |
146 | auok190x_send_command_nowait(par, AUOK190X_CMD_DATA_STOP); | 153 | auok190x_send_command_nowait(par, AUOK190X_CMD_DATA_STOP); |
147 | 154 | ||
diff --git a/drivers/video/auo_k190x.c b/drivers/video/auo_k190x.c index 53846cb534d4..b1f19b266da7 100644 --- a/drivers/video/auo_k190x.c +++ b/drivers/video/auo_k190x.c | |||
@@ -40,6 +40,14 @@ static struct panel_info panel_table[] = { | |||
40 | .w = 1024, | 40 | .w = 1024, |
41 | .h = 768, | 41 | .h = 768, |
42 | }, | 42 | }, |
43 | [AUOK190X_RESOLUTION_600_800] = { | ||
44 | .w = 600, | ||
45 | .h = 800, | ||
46 | }, | ||
47 | [AUOK190X_RESOLUTION_768_1024] = { | ||
48 | .w = 768, | ||
49 | .h = 1024, | ||
50 | }, | ||
43 | }; | 51 | }; |
44 | 52 | ||
45 | /* | 53 | /* |
@@ -60,8 +68,48 @@ static void auok190x_issue_cmd(struct auok190xfb_par *par, u16 data) | |||
60 | par->board->set_ctl(par, AUOK190X_I80_DC, 1); | 68 | par->board->set_ctl(par, AUOK190X_I80_DC, 1); |
61 | } | 69 | } |
62 | 70 | ||
63 | static int auok190x_issue_pixels(struct auok190xfb_par *par, int size, | 71 | /** |
64 | u16 *data) | 72 | * Conversion of 16bit color to 4bit grayscale |
73 | * does roughly (0.3 * R + 0.6 G + 0.1 B) / 2 | ||
74 | */ | ||
75 | static inline int rgb565_to_gray4(u16 data, struct fb_var_screeninfo *var) | ||
76 | { | ||
77 | return ((((data & 0xF800) >> var->red.offset) * 77 + | ||
78 | ((data & 0x07E0) >> (var->green.offset + 1)) * 151 + | ||
79 | ((data & 0x1F) >> var->blue.offset) * 28) >> 8 >> 1); | ||
80 | } | ||
81 | |||
82 | static int auok190x_issue_pixels_rgb565(struct auok190xfb_par *par, int size, | ||
83 | u16 *data) | ||
84 | { | ||
85 | struct fb_var_screeninfo *var = &par->info->var; | ||
86 | struct device *dev = par->info->device; | ||
87 | int i; | ||
88 | u16 tmp; | ||
89 | |||
90 | if (size & 7) { | ||
91 | dev_err(dev, "issue_pixels: size %d must be a multiple of 8\n", | ||
92 | size); | ||
93 | return -EINVAL; | ||
94 | } | ||
95 | |||
96 | for (i = 0; i < (size >> 2); i++) { | ||
97 | par->board->set_ctl(par, AUOK190X_I80_WR, 0); | ||
98 | |||
99 | tmp = (rgb565_to_gray4(data[4*i], var) & 0x000F); | ||
100 | tmp |= (rgb565_to_gray4(data[4*i+1], var) << 4) & 0x00F0; | ||
101 | tmp |= (rgb565_to_gray4(data[4*i+2], var) << 8) & 0x0F00; | ||
102 | tmp |= (rgb565_to_gray4(data[4*i+3], var) << 12) & 0xF000; | ||
103 | |||
104 | par->board->set_hdb(par, tmp); | ||
105 | par->board->set_ctl(par, AUOK190X_I80_WR, 1); | ||
106 | } | ||
107 | |||
108 | return 0; | ||
109 | } | ||
110 | |||
111 | static int auok190x_issue_pixels_gray8(struct auok190xfb_par *par, int size, | ||
112 | u16 *data) | ||
65 | { | 113 | { |
66 | struct device *dev = par->info->device; | 114 | struct device *dev = par->info->device; |
67 | int i; | 115 | int i; |
@@ -91,6 +139,23 @@ static int auok190x_issue_pixels(struct auok190xfb_par *par, int size, | |||
91 | return 0; | 139 | return 0; |
92 | } | 140 | } |
93 | 141 | ||
142 | static int auok190x_issue_pixels(struct auok190xfb_par *par, int size, | ||
143 | u16 *data) | ||
144 | { | ||
145 | struct fb_info *info = par->info; | ||
146 | struct device *dev = par->info->device; | ||
147 | |||
148 | if (info->var.bits_per_pixel == 8 && info->var.grayscale) | ||
149 | auok190x_issue_pixels_gray8(par, size, data); | ||
150 | else if (info->var.bits_per_pixel == 16) | ||
151 | auok190x_issue_pixels_rgb565(par, size, data); | ||
152 | else | ||
153 | dev_err(dev, "unsupported color mode (bits: %d, gray: %d)\n", | ||
154 | info->var.bits_per_pixel, info->var.grayscale); | ||
155 | |||
156 | return 0; | ||
157 | } | ||
158 | |||
94 | static u16 auok190x_read_data(struct auok190xfb_par *par) | 159 | static u16 auok190x_read_data(struct auok190xfb_par *par) |
95 | { | 160 | { |
96 | u16 data; | 161 | u16 data; |
@@ -224,8 +289,8 @@ static void auok190xfb_dpy_deferred_io(struct fb_info *info, | |||
224 | { | 289 | { |
225 | struct fb_deferred_io *fbdefio = info->fbdefio; | 290 | struct fb_deferred_io *fbdefio = info->fbdefio; |
226 | struct auok190xfb_par *par = info->par; | 291 | struct auok190xfb_par *par = info->par; |
292 | u16 line_length = info->fix.line_length; | ||
227 | u16 yres = info->var.yres; | 293 | u16 yres = info->var.yres; |
228 | u16 xres = info->var.xres; | ||
229 | u16 y1 = 0, h = 0; | 294 | u16 y1 = 0, h = 0; |
230 | int prev_index = -1; | 295 | int prev_index = -1; |
231 | struct page *cur; | 296 | struct page *cur; |
@@ -254,7 +319,7 @@ static void auok190xfb_dpy_deferred_io(struct fb_info *info, | |||
254 | } | 319 | } |
255 | 320 | ||
256 | /* height increment is fixed per page */ | 321 | /* height increment is fixed per page */ |
257 | h_inc = DIV_ROUND_UP(PAGE_SIZE , xres); | 322 | h_inc = DIV_ROUND_UP(PAGE_SIZE , line_length); |
258 | 323 | ||
259 | /* calculate number of pages from pixel height */ | 324 | /* calculate number of pages from pixel height */ |
260 | threshold = par->consecutive_threshold / h_inc; | 325 | threshold = par->consecutive_threshold / h_inc; |
@@ -265,7 +330,7 @@ static void auok190xfb_dpy_deferred_io(struct fb_info *info, | |||
265 | list_for_each_entry(cur, &fbdefio->pagelist, lru) { | 330 | list_for_each_entry(cur, &fbdefio->pagelist, lru) { |
266 | if (prev_index < 0) { | 331 | if (prev_index < 0) { |
267 | /* just starting so assign first page */ | 332 | /* just starting so assign first page */ |
268 | y1 = (cur->index << PAGE_SHIFT) / xres; | 333 | y1 = (cur->index << PAGE_SHIFT) / line_length; |
269 | h = h_inc; | 334 | h = h_inc; |
270 | } else if ((cur->index - prev_index) <= threshold) { | 335 | } else if ((cur->index - prev_index) <= threshold) { |
271 | /* page is within our threshold for single updates */ | 336 | /* page is within our threshold for single updates */ |
@@ -275,7 +340,7 @@ static void auok190xfb_dpy_deferred_io(struct fb_info *info, | |||
275 | par->update_partial(par, y1, y1 + h); | 340 | par->update_partial(par, y1, y1 + h); |
276 | 341 | ||
277 | /* start over with our non consecutive page */ | 342 | /* start over with our non consecutive page */ |
278 | y1 = (cur->index << PAGE_SHIFT) / xres; | 343 | y1 = (cur->index << PAGE_SHIFT) / line_length; |
279 | h = h_inc; | 344 | h = h_inc; |
280 | } | 345 | } |
281 | prev_index = cur->index; | 346 | prev_index = cur->index; |
@@ -376,27 +441,127 @@ static void auok190xfb_imageblit(struct fb_info *info, | |||
376 | static int auok190xfb_check_var(struct fb_var_screeninfo *var, | 441 | static int auok190xfb_check_var(struct fb_var_screeninfo *var, |
377 | struct fb_info *info) | 442 | struct fb_info *info) |
378 | { | 443 | { |
379 | if (info->var.xres != var->xres || info->var.yres != var->yres || | 444 | struct device *dev = info->device; |
380 | info->var.xres_virtual != var->xres_virtual || | 445 | struct auok190xfb_par *par = info->par; |
381 | info->var.yres_virtual != var->yres_virtual) { | 446 | struct panel_info *panel = &panel_table[par->resolution]; |
382 | pr_info("%s: Resolution not supported: X%u x Y%u\n", | 447 | int size; |
383 | __func__, var->xres, var->yres); | 448 | |
449 | /* | ||
450 | * Color depth | ||
451 | */ | ||
452 | |||
453 | if (var->bits_per_pixel == 8 && var->grayscale == 1) { | ||
454 | /* | ||
455 | * For 8-bit grayscale, R, G, and B offset are equal. | ||
456 | */ | ||
457 | var->red.length = 8; | ||
458 | var->red.offset = 0; | ||
459 | var->red.msb_right = 0; | ||
460 | |||
461 | var->green.length = 8; | ||
462 | var->green.offset = 0; | ||
463 | var->green.msb_right = 0; | ||
464 | |||
465 | var->blue.length = 8; | ||
466 | var->blue.offset = 0; | ||
467 | var->blue.msb_right = 0; | ||
468 | |||
469 | var->transp.length = 0; | ||
470 | var->transp.offset = 0; | ||
471 | var->transp.msb_right = 0; | ||
472 | } else if (var->bits_per_pixel == 16) { | ||
473 | var->red.length = 5; | ||
474 | var->red.offset = 11; | ||
475 | var->red.msb_right = 0; | ||
476 | |||
477 | var->green.length = 6; | ||
478 | var->green.offset = 5; | ||
479 | var->green.msb_right = 0; | ||
480 | |||
481 | var->blue.length = 5; | ||
482 | var->blue.offset = 0; | ||
483 | var->blue.msb_right = 0; | ||
484 | |||
485 | var->transp.length = 0; | ||
486 | var->transp.offset = 0; | ||
487 | var->transp.msb_right = 0; | ||
488 | } else { | ||
489 | dev_warn(dev, "unsupported color mode (bits: %d, grayscale: %d)\n", | ||
490 | info->var.bits_per_pixel, info->var.grayscale); | ||
384 | return -EINVAL; | 491 | return -EINVAL; |
385 | } | 492 | } |
386 | 493 | ||
387 | /* | 494 | /* |
495 | * Dimensions | ||
496 | */ | ||
497 | |||
498 | switch (var->rotate) { | ||
499 | case FB_ROTATE_UR: | ||
500 | case FB_ROTATE_UD: | ||
501 | var->xres = panel->w; | ||
502 | var->yres = panel->h; | ||
503 | break; | ||
504 | case FB_ROTATE_CW: | ||
505 | case FB_ROTATE_CCW: | ||
506 | var->xres = panel->h; | ||
507 | var->yres = panel->w; | ||
508 | break; | ||
509 | default: | ||
510 | dev_dbg(dev, "Invalid rotation request\n"); | ||
511 | return -EINVAL; | ||
512 | } | ||
513 | |||
514 | var->xres_virtual = var->xres; | ||
515 | var->yres_virtual = var->yres; | ||
516 | |||
517 | /* | ||
388 | * Memory limit | 518 | * Memory limit |
389 | */ | 519 | */ |
390 | 520 | ||
391 | if ((info->fix.line_length * var->yres_virtual) > info->fix.smem_len) { | 521 | size = var->xres_virtual * var->yres_virtual * var->bits_per_pixel / 8; |
392 | pr_info("%s: Memory Limit requested yres_virtual = %u\n", | 522 | if (size > info->fix.smem_len) { |
393 | __func__, var->yres_virtual); | 523 | dev_err(dev, "Memory limit exceeded, requested %dK\n", |
524 | size >> 10); | ||
394 | return -ENOMEM; | 525 | return -ENOMEM; |
395 | } | 526 | } |
396 | 527 | ||
397 | return 0; | 528 | return 0; |
398 | } | 529 | } |
399 | 530 | ||
531 | static int auok190xfb_set_fix(struct fb_info *info) | ||
532 | { | ||
533 | struct fb_fix_screeninfo *fix = &info->fix; | ||
534 | struct fb_var_screeninfo *var = &info->var; | ||
535 | |||
536 | fix->line_length = var->xres_virtual * var->bits_per_pixel / 8; | ||
537 | |||
538 | fix->type = FB_TYPE_PACKED_PIXELS; | ||
539 | fix->accel = FB_ACCEL_NONE; | ||
540 | fix->visual = (var->grayscale) ? FB_VISUAL_STATIC_PSEUDOCOLOR | ||
541 | : FB_VISUAL_TRUECOLOR; | ||
542 | fix->xpanstep = 0; | ||
543 | fix->ypanstep = 0; | ||
544 | fix->ywrapstep = 0; | ||
545 | |||
546 | return 0; | ||
547 | } | ||
548 | |||
549 | static int auok190xfb_set_par(struct fb_info *info) | ||
550 | { | ||
551 | struct auok190xfb_par *par = info->par; | ||
552 | |||
553 | par->rotation = info->var.rotate; | ||
554 | auok190xfb_set_fix(info); | ||
555 | |||
556 | /* reinit the controller to honor the rotation */ | ||
557 | par->init(par); | ||
558 | |||
559 | /* wait for init to complete */ | ||
560 | par->board->wait_for_rdy(par); | ||
561 | |||
562 | return 0; | ||
563 | } | ||
564 | |||
400 | static struct fb_ops auok190xfb_ops = { | 565 | static struct fb_ops auok190xfb_ops = { |
401 | .owner = THIS_MODULE, | 566 | .owner = THIS_MODULE, |
402 | .fb_read = fb_sys_read, | 567 | .fb_read = fb_sys_read, |
@@ -405,6 +570,7 @@ static struct fb_ops auok190xfb_ops = { | |||
405 | .fb_copyarea = auok190xfb_copyarea, | 570 | .fb_copyarea = auok190xfb_copyarea, |
406 | .fb_imageblit = auok190xfb_imageblit, | 571 | .fb_imageblit = auok190xfb_imageblit, |
407 | .fb_check_var = auok190xfb_check_var, | 572 | .fb_check_var = auok190xfb_check_var, |
573 | .fb_set_par = auok190xfb_set_par, | ||
408 | }; | 574 | }; |
409 | 575 | ||
410 | /* | 576 | /* |
@@ -588,10 +754,16 @@ static int auok190x_power(struct auok190xfb_par *par, bool on) | |||
588 | 754 | ||
589 | static void auok190x_recover(struct auok190xfb_par *par) | 755 | static void auok190x_recover(struct auok190xfb_par *par) |
590 | { | 756 | { |
757 | struct device *dev = par->info->device; | ||
758 | |||
591 | auok190x_power(par, 0); | 759 | auok190x_power(par, 0); |
592 | msleep(100); | 760 | msleep(100); |
593 | auok190x_power(par, 1); | 761 | auok190x_power(par, 1); |
594 | 762 | ||
763 | /* after powercycling the device, it's always active */ | ||
764 | pm_runtime_set_active(dev); | ||
765 | par->standby = 0; | ||
766 | |||
595 | par->init(par); | 767 | par->init(par); |
596 | 768 | ||
597 | /* wait for init to complete */ | 769 | /* wait for init to complete */ |
@@ -875,42 +1047,17 @@ int auok190x_common_probe(struct platform_device *pdev, | |||
875 | /* initialise fix, var, resolution and rotation */ | 1047 | /* initialise fix, var, resolution and rotation */ |
876 | 1048 | ||
877 | strlcpy(info->fix.id, init->id, 16); | 1049 | strlcpy(info->fix.id, init->id, 16); |
878 | info->fix.type = FB_TYPE_PACKED_PIXELS; | ||
879 | info->fix.visual = FB_VISUAL_STATIC_PSEUDOCOLOR; | ||
880 | info->fix.xpanstep = 0; | ||
881 | info->fix.ypanstep = 0; | ||
882 | info->fix.ywrapstep = 0; | ||
883 | info->fix.accel = FB_ACCEL_NONE; | ||
884 | |||
885 | info->var.bits_per_pixel = 8; | 1050 | info->var.bits_per_pixel = 8; |
886 | info->var.grayscale = 1; | 1051 | info->var.grayscale = 1; |
887 | info->var.red.length = 8; | ||
888 | info->var.green.length = 8; | ||
889 | info->var.blue.length = 8; | ||
890 | 1052 | ||
891 | panel = &panel_table[board->resolution]; | 1053 | panel = &panel_table[board->resolution]; |
892 | 1054 | ||
893 | /* if 90 degree rotation, switch width and height */ | ||
894 | if (board->rotation & 1) { | ||
895 | info->var.xres = panel->h; | ||
896 | info->var.yres = panel->w; | ||
897 | info->var.xres_virtual = panel->h; | ||
898 | info->var.yres_virtual = panel->w; | ||
899 | info->fix.line_length = panel->h; | ||
900 | } else { | ||
901 | info->var.xres = panel->w; | ||
902 | info->var.yres = panel->h; | ||
903 | info->var.xres_virtual = panel->w; | ||
904 | info->var.yres_virtual = panel->h; | ||
905 | info->fix.line_length = panel->w; | ||
906 | } | ||
907 | |||
908 | par->resolution = board->resolution; | 1055 | par->resolution = board->resolution; |
909 | par->rotation = board->rotation; | 1056 | par->rotation = 0; |
910 | 1057 | ||
911 | /* videomemory handling */ | 1058 | /* videomemory handling */ |
912 | 1059 | ||
913 | videomemorysize = roundup((panel->w * panel->h), PAGE_SIZE); | 1060 | videomemorysize = roundup((panel->w * panel->h) * 2, PAGE_SIZE); |
914 | videomemory = vmalloc(videomemorysize); | 1061 | videomemory = vmalloc(videomemorysize); |
915 | if (!videomemory) { | 1062 | if (!videomemory) { |
916 | ret = -ENOMEM; | 1063 | ret = -ENOMEM; |
@@ -924,6 +1071,12 @@ int auok190x_common_probe(struct platform_device *pdev, | |||
924 | info->flags = FBINFO_FLAG_DEFAULT | FBINFO_VIRTFB; | 1071 | info->flags = FBINFO_FLAG_DEFAULT | FBINFO_VIRTFB; |
925 | info->fbops = &auok190xfb_ops; | 1072 | info->fbops = &auok190xfb_ops; |
926 | 1073 | ||
1074 | ret = auok190xfb_check_var(&info->var, info); | ||
1075 | if (ret) | ||
1076 | goto err_defio; | ||
1077 | |||
1078 | auok190xfb_set_fix(info); | ||
1079 | |||
927 | /* deferred io init */ | 1080 | /* deferred io init */ |
928 | 1081 | ||
929 | info->fbdefio = devm_kzalloc(info->device, | 1082 | info->fbdefio = devm_kzalloc(info->device, |
diff --git a/drivers/video/controlfb.c b/drivers/video/controlfb.c index 0c189b32a4c5..67b77b40aa7f 100644 --- a/drivers/video/controlfb.c +++ b/drivers/video/controlfb.c | |||
@@ -285,36 +285,26 @@ static int controlfb_pan_display(struct fb_var_screeninfo *var, | |||
285 | static int controlfb_mmap(struct fb_info *info, | 285 | static int controlfb_mmap(struct fb_info *info, |
286 | struct vm_area_struct *vma) | 286 | struct vm_area_struct *vma) |
287 | { | 287 | { |
288 | unsigned long off, start; | 288 | unsigned long mmio_pgoff; |
289 | u32 len; | 289 | unsigned long start; |
290 | 290 | u32 len; | |
291 | off = vma->vm_pgoff << PAGE_SHIFT; | 291 | |
292 | 292 | start = info->fix.smem_start; | |
293 | /* frame buffer memory */ | 293 | len = info->fix.smem_len; |
294 | start = info->fix.smem_start; | 294 | mmio_pgoff = PAGE_ALIGN((start & ~PAGE_MASK) + len) >> PAGE_SHIFT; |
295 | len = PAGE_ALIGN((start & ~PAGE_MASK)+info->fix.smem_len); | 295 | if (vma->vm_pgoff >= mmio_pgoff) { |
296 | if (off >= len) { | 296 | if (info->var.accel_flags) |
297 | /* memory mapped io */ | 297 | return -EINVAL; |
298 | off -= len; | 298 | vma->vm_pgoff -= mmio_pgoff; |
299 | if (info->var.accel_flags) | 299 | start = info->fix.mmio_start; |
300 | return -EINVAL; | 300 | len = info->fix.mmio_len; |
301 | start = info->fix.mmio_start; | 301 | vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); |
302 | len = PAGE_ALIGN((start & ~PAGE_MASK)+info->fix.mmio_len); | 302 | } else { |
303 | vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); | 303 | /* framebuffer */ |
304 | } else { | 304 | vma->vm_page_prot = pgprot_cached_wthru(vma->vm_page_prot); |
305 | /* framebuffer */ | 305 | } |
306 | vma->vm_page_prot = pgprot_cached_wthru(vma->vm_page_prot); | 306 | |
307 | } | 307 | return vm_iomap_memory(vma, start, len); |
308 | start &= PAGE_MASK; | ||
309 | if ((vma->vm_end - vma->vm_start + off) > len) | ||
310 | return -EINVAL; | ||
311 | off += start; | ||
312 | vma->vm_pgoff = off >> PAGE_SHIFT; | ||
313 | if (io_remap_pfn_range(vma, vma->vm_start, off >> PAGE_SHIFT, | ||
314 | vma->vm_end - vma->vm_start, vma->vm_page_prot)) | ||
315 | return -EAGAIN; | ||
316 | |||
317 | return 0; | ||
318 | } | 308 | } |
319 | 309 | ||
320 | static int controlfb_blank(int blank_mode, struct fb_info *info) | 310 | static int controlfb_blank(int blank_mode, struct fb_info *info) |
diff --git a/drivers/video/exynos/exynos_mipi_dsi.c b/drivers/video/exynos/exynos_mipi_dsi.c index fac7df6d1aba..3dd43ca2b95f 100644 --- a/drivers/video/exynos/exynos_mipi_dsi.c +++ b/drivers/video/exynos/exynos_mipi_dsi.c | |||
@@ -35,8 +35,6 @@ | |||
35 | 35 | ||
36 | #include <video/exynos_mipi_dsim.h> | 36 | #include <video/exynos_mipi_dsim.h> |
37 | 37 | ||
38 | #include <plat/fb.h> | ||
39 | |||
40 | #include "exynos_mipi_dsi_common.h" | 38 | #include "exynos_mipi_dsi_common.h" |
41 | #include "exynos_mipi_dsi_lowlevel.h" | 39 | #include "exynos_mipi_dsi_lowlevel.h" |
42 | 40 | ||
diff --git a/drivers/video/exynos/exynos_mipi_dsi_common.c b/drivers/video/exynos/exynos_mipi_dsi_common.c index c70cb8926df6..520fc9bd887b 100644 --- a/drivers/video/exynos/exynos_mipi_dsi_common.c +++ b/drivers/video/exynos/exynos_mipi_dsi_common.c | |||
@@ -31,8 +31,6 @@ | |||
31 | #include <video/mipi_display.h> | 31 | #include <video/mipi_display.h> |
32 | #include <video/exynos_mipi_dsim.h> | 32 | #include <video/exynos_mipi_dsim.h> |
33 | 33 | ||
34 | #include <mach/map.h> | ||
35 | |||
36 | #include "exynos_mipi_dsi_regs.h" | 34 | #include "exynos_mipi_dsi_regs.h" |
37 | #include "exynos_mipi_dsi_lowlevel.h" | 35 | #include "exynos_mipi_dsi_lowlevel.h" |
38 | #include "exynos_mipi_dsi_common.h" | 36 | #include "exynos_mipi_dsi_common.h" |
diff --git a/drivers/video/exynos/exynos_mipi_dsi_lowlevel.c b/drivers/video/exynos/exynos_mipi_dsi_lowlevel.c index 95cb99a1fe2d..15c5abd408dc 100644 --- a/drivers/video/exynos/exynos_mipi_dsi_lowlevel.c +++ b/drivers/video/exynos/exynos_mipi_dsi_lowlevel.c | |||
@@ -26,8 +26,6 @@ | |||
26 | 26 | ||
27 | #include <video/exynos_mipi_dsim.h> | 27 | #include <video/exynos_mipi_dsim.h> |
28 | 28 | ||
29 | #include <mach/map.h> | ||
30 | |||
31 | #include "exynos_mipi_dsi_regs.h" | 29 | #include "exynos_mipi_dsi_regs.h" |
32 | 30 | ||
33 | void exynos_mipi_dsi_func_reset(struct mipi_dsim_device *dsim) | 31 | void exynos_mipi_dsi_func_reset(struct mipi_dsim_device *dsim) |
diff --git a/drivers/video/fb-puv3.c b/drivers/video/fb-puv3.c index 7d106f1f4906..27fc956166fa 100644 --- a/drivers/video/fb-puv3.c +++ b/drivers/video/fb-puv3.c | |||
@@ -640,21 +640,9 @@ static int unifb_pan_display(struct fb_var_screeninfo *var, | |||
640 | int unifb_mmap(struct fb_info *info, | 640 | int unifb_mmap(struct fb_info *info, |
641 | struct vm_area_struct *vma) | 641 | struct vm_area_struct *vma) |
642 | { | 642 | { |
643 | unsigned long size = vma->vm_end - vma->vm_start; | ||
644 | unsigned long offset = vma->vm_pgoff << PAGE_SHIFT; | ||
645 | unsigned long pos = info->fix.smem_start + offset; | ||
646 | |||
647 | if (offset + size > info->fix.smem_len) | ||
648 | return -EINVAL; | ||
649 | |||
650 | vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); | 643 | vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); |
651 | 644 | ||
652 | if (io_remap_pfn_range(vma, vma->vm_start, pos >> PAGE_SHIFT, size, | 645 | return vm_iomap_memory(vma, info->fix.smem_start, info->fix.smem_len); |
653 | vma->vm_page_prot)) | ||
654 | return -EAGAIN; | ||
655 | |||
656 | /* VM_IO | VM_DONTEXPAND | VM_DONTDUMP are set by remap_pfn_range() */ | ||
657 | return 0; | ||
658 | } | 646 | } |
659 | 647 | ||
660 | static struct fb_ops unifb_ops = { | 648 | static struct fb_ops unifb_ops = { |
diff --git a/drivers/video/fbmem.c b/drivers/video/fbmem.c index 86291dcd964a..dcb669eb4532 100644 --- a/drivers/video/fbmem.c +++ b/drivers/video/fbmem.c | |||
@@ -1398,6 +1398,11 @@ fb_mmap(struct file *file, struct vm_area_struct * vma) | |||
1398 | len = info->fix.smem_len; | 1398 | len = info->fix.smem_len; |
1399 | mmio_pgoff = PAGE_ALIGN((start & ~PAGE_MASK) + len) >> PAGE_SHIFT; | 1399 | mmio_pgoff = PAGE_ALIGN((start & ~PAGE_MASK) + len) >> PAGE_SHIFT; |
1400 | if (vma->vm_pgoff >= mmio_pgoff) { | 1400 | if (vma->vm_pgoff >= mmio_pgoff) { |
1401 | if (info->var.accel_flags) { | ||
1402 | mutex_unlock(&info->mm_lock); | ||
1403 | return -EINVAL; | ||
1404 | } | ||
1405 | |||
1401 | vma->vm_pgoff -= mmio_pgoff; | 1406 | vma->vm_pgoff -= mmio_pgoff; |
1402 | start = info->fix.mmio_start; | 1407 | start = info->fix.mmio_start; |
1403 | len = info->fix.mmio_len; | 1408 | len = info->fix.mmio_len; |
diff --git a/drivers/video/fbmon.c b/drivers/video/fbmon.c index 7f6709991a5c..6103fa6fb54f 100644 --- a/drivers/video/fbmon.c +++ b/drivers/video/fbmon.c | |||
@@ -1376,7 +1376,7 @@ int fb_get_mode(int flags, u32 val, struct fb_var_screeninfo *var, struct fb_inf | |||
1376 | return err; | 1376 | return err; |
1377 | } | 1377 | } |
1378 | 1378 | ||
1379 | #if IS_ENABLED(CONFIG_VIDEOMODE) | 1379 | #ifdef CONFIG_VIDEOMODE_HELPERS |
1380 | int fb_videomode_from_videomode(const struct videomode *vm, | 1380 | int fb_videomode_from_videomode(const struct videomode *vm, |
1381 | struct fb_videomode *fbmode) | 1381 | struct fb_videomode *fbmode) |
1382 | { | 1382 | { |
@@ -1398,13 +1398,13 @@ int fb_videomode_from_videomode(const struct videomode *vm, | |||
1398 | 1398 | ||
1399 | fbmode->sync = 0; | 1399 | fbmode->sync = 0; |
1400 | fbmode->vmode = 0; | 1400 | fbmode->vmode = 0; |
1401 | if (vm->dmt_flags & VESA_DMT_HSYNC_HIGH) | 1401 | if (vm->flags & DISPLAY_FLAGS_HSYNC_HIGH) |
1402 | fbmode->sync |= FB_SYNC_HOR_HIGH_ACT; | 1402 | fbmode->sync |= FB_SYNC_HOR_HIGH_ACT; |
1403 | if (vm->dmt_flags & VESA_DMT_VSYNC_HIGH) | 1403 | if (vm->flags & DISPLAY_FLAGS_VSYNC_HIGH) |
1404 | fbmode->sync |= FB_SYNC_VERT_HIGH_ACT; | 1404 | fbmode->sync |= FB_SYNC_VERT_HIGH_ACT; |
1405 | if (vm->data_flags & DISPLAY_FLAGS_INTERLACED) | 1405 | if (vm->flags & DISPLAY_FLAGS_INTERLACED) |
1406 | fbmode->vmode |= FB_VMODE_INTERLACED; | 1406 | fbmode->vmode |= FB_VMODE_INTERLACED; |
1407 | if (vm->data_flags & DISPLAY_FLAGS_DOUBLESCAN) | 1407 | if (vm->flags & DISPLAY_FLAGS_DOUBLESCAN) |
1408 | fbmode->vmode |= FB_VMODE_DOUBLE; | 1408 | fbmode->vmode |= FB_VMODE_DOUBLE; |
1409 | fbmode->flag = 0; | 1409 | fbmode->flag = 0; |
1410 | 1410 | ||
@@ -1424,9 +1424,8 @@ int fb_videomode_from_videomode(const struct videomode *vm, | |||
1424 | return 0; | 1424 | return 0; |
1425 | } | 1425 | } |
1426 | EXPORT_SYMBOL_GPL(fb_videomode_from_videomode); | 1426 | EXPORT_SYMBOL_GPL(fb_videomode_from_videomode); |
1427 | #endif | ||
1428 | 1427 | ||
1429 | #if IS_ENABLED(CONFIG_OF_VIDEOMODE) | 1428 | #ifdef CONFIG_OF |
1430 | static inline void dump_fb_videomode(const struct fb_videomode *m) | 1429 | static inline void dump_fb_videomode(const struct fb_videomode *m) |
1431 | { | 1430 | { |
1432 | pr_debug("fb_videomode = %ux%u@%uHz (%ukHz) %u %u %u %u %u %u %u %u %u\n", | 1431 | pr_debug("fb_videomode = %ux%u@%uHz (%ukHz) %u %u %u %u %u %u %u %u %u\n", |
@@ -1465,7 +1464,8 @@ int of_get_fb_videomode(struct device_node *np, struct fb_videomode *fb, | |||
1465 | return 0; | 1464 | return 0; |
1466 | } | 1465 | } |
1467 | EXPORT_SYMBOL_GPL(of_get_fb_videomode); | 1466 | EXPORT_SYMBOL_GPL(of_get_fb_videomode); |
1468 | #endif | 1467 | #endif /* CONFIG_OF */ |
1468 | #endif /* CONFIG_VIDEOMODE_HELPERS */ | ||
1469 | 1469 | ||
1470 | #else | 1470 | #else |
1471 | int fb_parse_edid(unsigned char *edid, struct fb_var_screeninfo *var) | 1471 | int fb_parse_edid(unsigned char *edid, struct fb_var_screeninfo *var) |
diff --git a/drivers/video/fsl-diu-fb.c b/drivers/video/fsl-diu-fb.c index 41fbd9453c5f..6c278056fc60 100644 --- a/drivers/video/fsl-diu-fb.c +++ b/drivers/video/fsl-diu-fb.c | |||
@@ -375,7 +375,10 @@ struct fsl_diu_data { | |||
375 | struct diu_ad dummy_ad __aligned(8); | 375 | struct diu_ad dummy_ad __aligned(8); |
376 | struct diu_ad ad[NUM_AOIS] __aligned(8); | 376 | struct diu_ad ad[NUM_AOIS] __aligned(8); |
377 | u8 gamma[256 * 3] __aligned(32); | 377 | u8 gamma[256 * 3] __aligned(32); |
378 | u8 cursor[MAX_CURS * MAX_CURS * 2] __aligned(32); | 378 | /* It's easier to parse the cursor data as little-endian */ |
379 | __le16 cursor[MAX_CURS * MAX_CURS] __aligned(32); | ||
380 | /* Blank cursor data -- used to hide the cursor */ | ||
381 | __le16 blank_cursor[MAX_CURS * MAX_CURS] __aligned(32); | ||
379 | uint8_t edid_data[EDID_LENGTH]; | 382 | uint8_t edid_data[EDID_LENGTH]; |
380 | bool has_edid; | 383 | bool has_edid; |
381 | } __aligned(32); | 384 | } __aligned(32); |
@@ -824,7 +827,6 @@ static void update_lcdc(struct fb_info *info) | |||
824 | /* Program DIU registers */ | 827 | /* Program DIU registers */ |
825 | 828 | ||
826 | out_be32(&hw->gamma, DMA_ADDR(data, gamma)); | 829 | out_be32(&hw->gamma, DMA_ADDR(data, gamma)); |
827 | out_be32(&hw->cursor, DMA_ADDR(data, cursor)); | ||
828 | 830 | ||
829 | out_be32(&hw->bgnd, 0x007F7F7F); /* Set background to grey */ | 831 | out_be32(&hw->bgnd, 0x007F7F7F); /* Set background to grey */ |
830 | out_be32(&hw->disp_size, (var->yres << 16) | var->xres); | 832 | out_be32(&hw->disp_size, (var->yres << 16) | var->xres); |
@@ -968,6 +970,156 @@ static u32 fsl_diu_get_pixel_format(unsigned int bits_per_pixel) | |||
968 | } | 970 | } |
969 | 971 | ||
970 | /* | 972 | /* |
973 | * Copies a cursor image from user space to the proper place in driver | ||
974 | * memory so that the hardware can display the cursor image. | ||
975 | * | ||
976 | * Cursor data is represented as a sequence of 'width' bits packed into bytes. | ||
977 | * That is, the first 8 bits are in the first byte, the second 8 bits in the | ||
978 | * second byte, and so on. Therefore, the each row of the cursor is (width + | ||
979 | * 7) / 8 bytes of 'data' | ||
980 | * | ||
981 | * The DIU only supports cursors up to 32x32 (MAX_CURS). We reject cursors | ||
982 | * larger than this, so we already know that 'width' <= 32. Therefore, we can | ||
983 | * simplify our code by using a 32-bit big-endian integer ("line") to read in | ||
984 | * a single line of pixels, and only look at the top 'width' bits of that | ||
985 | * integer. | ||
986 | * | ||
987 | * This could result in an unaligned 32-bit read. For example, if the cursor | ||
988 | * is 24x24, then the first three bytes of 'image' contain the pixel data for | ||
989 | * the top line of the cursor. We do a 32-bit read of 'image', but we look | ||
990 | * only at the top 24 bits. Then we increment 'image' by 3 bytes. The next | ||
991 | * read is unaligned. The only problem is that we might read past the end of | ||
992 | * 'image' by 1-3 bytes, but that should not cause any problems. | ||
993 | */ | ||
994 | static void fsl_diu_load_cursor_image(struct fb_info *info, | ||
995 | const void *image, uint16_t bg, uint16_t fg, | ||
996 | unsigned int width, unsigned int height) | ||
997 | { | ||
998 | struct mfb_info *mfbi = info->par; | ||
999 | struct fsl_diu_data *data = mfbi->parent; | ||
1000 | __le16 *cursor = data->cursor; | ||
1001 | __le16 _fg = cpu_to_le16(fg); | ||
1002 | __le16 _bg = cpu_to_le16(bg); | ||
1003 | unsigned int h, w; | ||
1004 | |||
1005 | for (h = 0; h < height; h++) { | ||
1006 | uint32_t mask = 1 << 31; | ||
1007 | uint32_t line = be32_to_cpup(image); | ||
1008 | |||
1009 | for (w = 0; w < width; w++) { | ||
1010 | cursor[w] = (line & mask) ? _fg : _bg; | ||
1011 | mask >>= 1; | ||
1012 | } | ||
1013 | |||
1014 | cursor += MAX_CURS; | ||
1015 | image += DIV_ROUND_UP(width, 8); | ||
1016 | } | ||
1017 | } | ||
1018 | |||
1019 | /* | ||
1020 | * Set a hardware cursor. The image data for the cursor is passed via the | ||
1021 | * fb_cursor object. | ||
1022 | */ | ||
1023 | static int fsl_diu_cursor(struct fb_info *info, struct fb_cursor *cursor) | ||
1024 | { | ||
1025 | struct mfb_info *mfbi = info->par; | ||
1026 | struct fsl_diu_data *data = mfbi->parent; | ||
1027 | struct diu __iomem *hw = data->diu_reg; | ||
1028 | |||
1029 | if (cursor->image.width > MAX_CURS || cursor->image.height > MAX_CURS) | ||
1030 | return -EINVAL; | ||
1031 | |||
1032 | /* The cursor size has changed */ | ||
1033 | if (cursor->set & FB_CUR_SETSIZE) { | ||
1034 | /* | ||
1035 | * The DIU cursor is a fixed size, so when we get this | ||
1036 | * message, instead of resizing the cursor, we just clear | ||
1037 | * all the image data, in expectation of new data. However, | ||
1038 | * in tests this control does not appear to be normally | ||
1039 | * called. | ||
1040 | */ | ||
1041 | memset(data->cursor, 0, sizeof(data->cursor)); | ||
1042 | } | ||
1043 | |||
1044 | /* The cursor position has changed (cursor->image.dx|dy) */ | ||
1045 | if (cursor->set & FB_CUR_SETPOS) { | ||
1046 | uint32_t xx, yy; | ||
1047 | |||
1048 | yy = (cursor->image.dy - info->var.yoffset) & 0x7ff; | ||
1049 | xx = (cursor->image.dx - info->var.xoffset) & 0x7ff; | ||
1050 | |||
1051 | out_be32(&hw->curs_pos, yy << 16 | xx); | ||
1052 | } | ||
1053 | |||
1054 | /* | ||
1055 | * FB_CUR_SETIMAGE - the cursor image has changed | ||
1056 | * FB_CUR_SETCMAP - the cursor colors has changed | ||
1057 | * FB_CUR_SETSHAPE - the cursor bitmask has changed | ||
1058 | */ | ||
1059 | if (cursor->set & (FB_CUR_SETSHAPE | FB_CUR_SETCMAP | FB_CUR_SETIMAGE)) { | ||
1060 | unsigned int image_size = | ||
1061 | DIV_ROUND_UP(cursor->image.width, 8) * cursor->image.height; | ||
1062 | unsigned int image_words = | ||
1063 | DIV_ROUND_UP(image_size, sizeof(uint32_t)); | ||
1064 | unsigned int bg_idx = cursor->image.bg_color; | ||
1065 | unsigned int fg_idx = cursor->image.fg_color; | ||
1066 | uint8_t buffer[image_size]; | ||
1067 | uint32_t *image, *source, *mask; | ||
1068 | uint16_t fg, bg; | ||
1069 | unsigned int i; | ||
1070 | |||
1071 | if (info->state != FBINFO_STATE_RUNNING) | ||
1072 | return 0; | ||
1073 | |||
1074 | /* | ||
1075 | * Determine the size of the cursor image data. Normally, | ||
1076 | * it's 8x16. | ||
1077 | */ | ||
1078 | image_size = DIV_ROUND_UP(cursor->image.width, 8) * | ||
1079 | cursor->image.height; | ||
1080 | |||
1081 | bg = ((info->cmap.red[bg_idx] & 0xf8) << 7) | | ||
1082 | ((info->cmap.green[bg_idx] & 0xf8) << 2) | | ||
1083 | ((info->cmap.blue[bg_idx] & 0xf8) >> 3) | | ||
1084 | 1 << 15; | ||
1085 | |||
1086 | fg = ((info->cmap.red[fg_idx] & 0xf8) << 7) | | ||
1087 | ((info->cmap.green[fg_idx] & 0xf8) << 2) | | ||
1088 | ((info->cmap.blue[fg_idx] & 0xf8) >> 3) | | ||
1089 | 1 << 15; | ||
1090 | |||
1091 | /* Use 32-bit operations on the data to improve performance */ | ||
1092 | image = (uint32_t *)buffer; | ||
1093 | source = (uint32_t *)cursor->image.data; | ||
1094 | mask = (uint32_t *)cursor->mask; | ||
1095 | |||
1096 | if (cursor->rop == ROP_XOR) | ||
1097 | for (i = 0; i < image_words; i++) | ||
1098 | image[i] = source[i] ^ mask[i]; | ||
1099 | else | ||
1100 | for (i = 0; i < image_words; i++) | ||
1101 | image[i] = source[i] & mask[i]; | ||
1102 | |||
1103 | fsl_diu_load_cursor_image(info, image, bg, fg, | ||
1104 | cursor->image.width, cursor->image.height); | ||
1105 | }; | ||
1106 | |||
1107 | /* | ||
1108 | * Show or hide the cursor. The cursor data is always stored in the | ||
1109 | * 'cursor' memory block, and the actual cursor position is always in | ||
1110 | * the DIU's CURS_POS register. To hide the cursor, we redirect the | ||
1111 | * CURSOR register to a blank cursor. The show the cursor, we | ||
1112 | * redirect the CURSOR register to the real cursor data. | ||
1113 | */ | ||
1114 | if (cursor->enable) | ||
1115 | out_be32(&hw->cursor, DMA_ADDR(data, cursor)); | ||
1116 | else | ||
1117 | out_be32(&hw->cursor, DMA_ADDR(data, blank_cursor)); | ||
1118 | |||
1119 | return 0; | ||
1120 | } | ||
1121 | |||
1122 | /* | ||
971 | * Using the fb_var_screeninfo in fb_info we set the resolution of this | 1123 | * Using the fb_var_screeninfo in fb_info we set the resolution of this |
972 | * particular framebuffer. This function alters the fb_fix_screeninfo stored | 1124 | * particular framebuffer. This function alters the fb_fix_screeninfo stored |
973 | * in fb_info. It does not alter var in fb_info since we are using that | 1125 | * in fb_info. It does not alter var in fb_info since we are using that |
@@ -1312,6 +1464,7 @@ static struct fb_ops fsl_diu_ops = { | |||
1312 | .fb_ioctl = fsl_diu_ioctl, | 1464 | .fb_ioctl = fsl_diu_ioctl, |
1313 | .fb_open = fsl_diu_open, | 1465 | .fb_open = fsl_diu_open, |
1314 | .fb_release = fsl_diu_release, | 1466 | .fb_release = fsl_diu_release, |
1467 | .fb_cursor = fsl_diu_cursor, | ||
1315 | }; | 1468 | }; |
1316 | 1469 | ||
1317 | static int install_fb(struct fb_info *info) | 1470 | static int install_fb(struct fb_info *info) |
diff --git a/drivers/video/gbefb.c b/drivers/video/gbefb.c index bda5e3941510..ceab37020fff 100644 --- a/drivers/video/gbefb.c +++ b/drivers/video/gbefb.c | |||
@@ -1016,7 +1016,9 @@ static int gbefb_mmap(struct fb_info *info, | |||
1016 | /* check range */ | 1016 | /* check range */ |
1017 | if (vma->vm_pgoff > (~0UL >> PAGE_SHIFT)) | 1017 | if (vma->vm_pgoff > (~0UL >> PAGE_SHIFT)) |
1018 | return -EINVAL; | 1018 | return -EINVAL; |
1019 | if (offset + size > gbe_mem_size) | 1019 | if (size > gbe_mem_size) |
1020 | return -EINVAL; | ||
1021 | if (offset > gbe_mem_size - size) | ||
1020 | return -EINVAL; | 1022 | return -EINVAL; |
1021 | 1023 | ||
1022 | /* remap using the fastest write-through mode on architecture */ | 1024 | /* remap using the fastest write-through mode on architecture */ |
diff --git a/drivers/video/of_display_timing.c b/drivers/video/of_display_timing.c index 13ecd9897010..56009bc02b02 100644 --- a/drivers/video/of_display_timing.c +++ b/drivers/video/of_display_timing.c | |||
@@ -79,25 +79,24 @@ static struct display_timing *of_get_display_timing(struct device_node *np) | |||
79 | ret |= parse_timing_property(np, "vsync-len", &dt->vsync_len); | 79 | ret |= parse_timing_property(np, "vsync-len", &dt->vsync_len); |
80 | ret |= parse_timing_property(np, "clock-frequency", &dt->pixelclock); | 80 | ret |= parse_timing_property(np, "clock-frequency", &dt->pixelclock); |
81 | 81 | ||
82 | dt->dmt_flags = 0; | 82 | dt->flags = 0; |
83 | dt->data_flags = 0; | ||
84 | if (!of_property_read_u32(np, "vsync-active", &val)) | 83 | if (!of_property_read_u32(np, "vsync-active", &val)) |
85 | dt->dmt_flags |= val ? VESA_DMT_VSYNC_HIGH : | 84 | dt->flags |= val ? DISPLAY_FLAGS_VSYNC_HIGH : |
86 | VESA_DMT_VSYNC_LOW; | 85 | DISPLAY_FLAGS_VSYNC_LOW; |
87 | if (!of_property_read_u32(np, "hsync-active", &val)) | 86 | if (!of_property_read_u32(np, "hsync-active", &val)) |
88 | dt->dmt_flags |= val ? VESA_DMT_HSYNC_HIGH : | 87 | dt->flags |= val ? DISPLAY_FLAGS_HSYNC_HIGH : |
89 | VESA_DMT_HSYNC_LOW; | 88 | DISPLAY_FLAGS_HSYNC_LOW; |
90 | if (!of_property_read_u32(np, "de-active", &val)) | 89 | if (!of_property_read_u32(np, "de-active", &val)) |
91 | dt->data_flags |= val ? DISPLAY_FLAGS_DE_HIGH : | 90 | dt->flags |= val ? DISPLAY_FLAGS_DE_HIGH : |
92 | DISPLAY_FLAGS_DE_LOW; | 91 | DISPLAY_FLAGS_DE_LOW; |
93 | if (!of_property_read_u32(np, "pixelclk-active", &val)) | 92 | if (!of_property_read_u32(np, "pixelclk-active", &val)) |
94 | dt->data_flags |= val ? DISPLAY_FLAGS_PIXDATA_POSEDGE : | 93 | dt->flags |= val ? DISPLAY_FLAGS_PIXDATA_POSEDGE : |
95 | DISPLAY_FLAGS_PIXDATA_NEGEDGE; | 94 | DISPLAY_FLAGS_PIXDATA_NEGEDGE; |
96 | 95 | ||
97 | if (of_property_read_bool(np, "interlaced")) | 96 | if (of_property_read_bool(np, "interlaced")) |
98 | dt->data_flags |= DISPLAY_FLAGS_INTERLACED; | 97 | dt->flags |= DISPLAY_FLAGS_INTERLACED; |
99 | if (of_property_read_bool(np, "doublescan")) | 98 | if (of_property_read_bool(np, "doublescan")) |
100 | dt->data_flags |= DISPLAY_FLAGS_DOUBLESCAN; | 99 | dt->flags |= DISPLAY_FLAGS_DOUBLESCAN; |
101 | 100 | ||
102 | if (ret) { | 101 | if (ret) { |
103 | pr_err("%s: error reading timing properties\n", | 102 | pr_err("%s: error reading timing properties\n", |
diff --git a/drivers/video/of_videomode.c b/drivers/video/of_videomode.c index 5b8066cd397f..111c2d1911d3 100644 --- a/drivers/video/of_videomode.c +++ b/drivers/video/of_videomode.c | |||
@@ -43,7 +43,7 @@ int of_get_videomode(struct device_node *np, struct videomode *vm, | |||
43 | if (index == OF_USE_NATIVE_MODE) | 43 | if (index == OF_USE_NATIVE_MODE) |
44 | index = disp->native_mode; | 44 | index = disp->native_mode; |
45 | 45 | ||
46 | ret = videomode_from_timing(disp, vm, index); | 46 | ret = videomode_from_timings(disp, vm, index); |
47 | if (ret) | 47 | if (ret) |
48 | return ret; | 48 | return ret; |
49 | 49 | ||
diff --git a/drivers/video/omap/Kconfig b/drivers/video/omap/Kconfig index e512581300fc..0bc3a936ce2b 100644 --- a/drivers/video/omap/Kconfig +++ b/drivers/video/omap/Kconfig | |||
@@ -39,17 +39,6 @@ config FB_OMAP_LCD_MIPID | |||
39 | the Mobile Industry Processor Interface DBI-C/DCS | 39 | the Mobile Industry Processor Interface DBI-C/DCS |
40 | specification. (Supported LCDs: Philips LPH8923, Sharp LS041Y3) | 40 | specification. (Supported LCDs: Philips LPH8923, Sharp LS041Y3) |
41 | 41 | ||
42 | config FB_OMAP_CONSISTENT_DMA_SIZE | ||
43 | int "Consistent DMA memory size (MB)" | ||
44 | depends on FB_OMAP | ||
45 | range 1 14 | ||
46 | default 2 | ||
47 | help | ||
48 | Increase the DMA consistent memory size according to your video | ||
49 | memory needs, for example if you want to use multiple planes. | ||
50 | The size must be 2MB aligned. | ||
51 | If unsure say 1. | ||
52 | |||
53 | config FB_OMAP_DMA_TUNE | 42 | config FB_OMAP_DMA_TUNE |
54 | bool "Set DMA SDRAM access priority high" | 43 | bool "Set DMA SDRAM access priority high" |
55 | depends on FB_OMAP | 44 | depends on FB_OMAP |
diff --git a/drivers/video/omap2/omapfb/omapfb-main.c b/drivers/video/omap2/omapfb/omapfb-main.c index ca585ef37f25..717f13a93351 100644 --- a/drivers/video/omap2/omapfb/omapfb-main.c +++ b/drivers/video/omap2/omapfb/omapfb-main.c | |||
@@ -1101,41 +1101,25 @@ static int omapfb_mmap(struct fb_info *fbi, struct vm_area_struct *vma) | |||
1101 | struct omapfb_info *ofbi = FB2OFB(fbi); | 1101 | struct omapfb_info *ofbi = FB2OFB(fbi); |
1102 | struct fb_fix_screeninfo *fix = &fbi->fix; | 1102 | struct fb_fix_screeninfo *fix = &fbi->fix; |
1103 | struct omapfb2_mem_region *rg; | 1103 | struct omapfb2_mem_region *rg; |
1104 | unsigned long off; | ||
1105 | unsigned long start; | 1104 | unsigned long start; |
1106 | u32 len; | 1105 | u32 len; |
1107 | int r = -EINVAL; | 1106 | int r; |
1108 | |||
1109 | if (vma->vm_end - vma->vm_start == 0) | ||
1110 | return 0; | ||
1111 | if (vma->vm_pgoff > (~0UL >> PAGE_SHIFT)) | ||
1112 | return -EINVAL; | ||
1113 | off = vma->vm_pgoff << PAGE_SHIFT; | ||
1114 | 1107 | ||
1115 | rg = omapfb_get_mem_region(ofbi->region); | 1108 | rg = omapfb_get_mem_region(ofbi->region); |
1116 | 1109 | ||
1117 | start = omapfb_get_region_paddr(ofbi); | 1110 | start = omapfb_get_region_paddr(ofbi); |
1118 | len = fix->smem_len; | 1111 | len = fix->smem_len; |
1119 | if (off >= len) | ||
1120 | goto error; | ||
1121 | if ((vma->vm_end - vma->vm_start + off) > len) | ||
1122 | goto error; | ||
1123 | |||
1124 | off += start; | ||
1125 | 1112 | ||
1126 | DBG("user mmap region start %lx, len %d, off %lx\n", start, len, off); | 1113 | DBG("user mmap region start %lx, len %d, off %lx\n", start, len, |
1114 | vma->vm_pgoff << PAGE_SHIFT); | ||
1127 | 1115 | ||
1128 | vma->vm_pgoff = off >> PAGE_SHIFT; | ||
1129 | /* VM_IO | VM_DONTEXPAND | VM_DONTDUMP are set by remap_pfn_range() */ | ||
1130 | vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot); | 1116 | vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot); |
1131 | vma->vm_ops = &mmap_user_ops; | 1117 | vma->vm_ops = &mmap_user_ops; |
1132 | vma->vm_private_data = rg; | 1118 | vma->vm_private_data = rg; |
1133 | if (io_remap_pfn_range(vma, vma->vm_start, off >> PAGE_SHIFT, | 1119 | |
1134 | vma->vm_end - vma->vm_start, | 1120 | r = vm_iomap_memory(vma, start, len); |
1135 | vma->vm_page_prot)) { | 1121 | if (r) |
1136 | r = -EAGAIN; | ||
1137 | goto error; | 1122 | goto error; |
1138 | } | ||
1139 | 1123 | ||
1140 | /* vm_ops.open won't be called for mmap itself. */ | 1124 | /* vm_ops.open won't be called for mmap itself. */ |
1141 | atomic_inc(&rg->map_count); | 1125 | atomic_inc(&rg->map_count); |
@@ -1144,7 +1128,7 @@ static int omapfb_mmap(struct fb_info *fbi, struct vm_area_struct *vma) | |||
1144 | 1128 | ||
1145 | return 0; | 1129 | return 0; |
1146 | 1130 | ||
1147 | error: | 1131 | error: |
1148 | omapfb_put_mem_region(ofbi->region); | 1132 | omapfb_put_mem_region(ofbi->region); |
1149 | 1133 | ||
1150 | return r; | 1134 | return r; |
diff --git a/drivers/video/omap2/vrfb.c b/drivers/video/omap2/vrfb.c index 10560efeb35a..5261229c79af 100644 --- a/drivers/video/omap2/vrfb.c +++ b/drivers/video/omap2/vrfb.c | |||
@@ -397,18 +397,7 @@ static struct platform_driver vrfb_driver = { | |||
397 | .remove = __exit_p(vrfb_remove), | 397 | .remove = __exit_p(vrfb_remove), |
398 | }; | 398 | }; |
399 | 399 | ||
400 | static int __init vrfb_init(void) | 400 | module_platform_driver_probe(vrfb_driver, vrfb_probe); |
401 | { | ||
402 | return platform_driver_probe(&vrfb_driver, &vrfb_probe); | ||
403 | } | ||
404 | |||
405 | static void __exit vrfb_exit(void) | ||
406 | { | ||
407 | platform_driver_unregister(&vrfb_driver); | ||
408 | } | ||
409 | |||
410 | module_init(vrfb_init); | ||
411 | module_exit(vrfb_exit); | ||
412 | 401 | ||
413 | MODULE_AUTHOR("Tomi Valkeinen <tomi.valkeinen@ti.com>"); | 402 | MODULE_AUTHOR("Tomi Valkeinen <tomi.valkeinen@ti.com>"); |
414 | MODULE_DESCRIPTION("OMAP VRFB"); | 403 | MODULE_DESCRIPTION("OMAP VRFB"); |
diff --git a/drivers/video/ps3fb.c b/drivers/video/ps3fb.c index 920c27bf3947..d9f08c653d62 100644 --- a/drivers/video/ps3fb.c +++ b/drivers/video/ps3fb.c | |||
@@ -705,21 +705,15 @@ static int ps3fb_pan_display(struct fb_var_screeninfo *var, | |||
705 | 705 | ||
706 | static int ps3fb_mmap(struct fb_info *info, struct vm_area_struct *vma) | 706 | static int ps3fb_mmap(struct fb_info *info, struct vm_area_struct *vma) |
707 | { | 707 | { |
708 | unsigned long size, offset; | 708 | int r; |
709 | 709 | ||
710 | size = vma->vm_end - vma->vm_start; | 710 | r = vm_iomap_memory(vma, info->fix.smem_start, info->fix.smem_len); |
711 | offset = vma->vm_pgoff << PAGE_SHIFT; | ||
712 | if (offset + size > info->fix.smem_len) | ||
713 | return -EINVAL; | ||
714 | |||
715 | offset += info->fix.smem_start; | ||
716 | if (remap_pfn_range(vma, vma->vm_start, offset >> PAGE_SHIFT, | ||
717 | size, vma->vm_page_prot)) | ||
718 | return -EAGAIN; | ||
719 | 711 | ||
720 | dev_dbg(info->device, "ps3fb: mmap framebuffer P(%lx)->V(%lx)\n", | 712 | dev_dbg(info->device, "ps3fb: mmap framebuffer P(%lx)->V(%lx)\n", |
721 | offset, vma->vm_start); | 713 | info->fix.smem_start + vma->vm_pgoff << PAGE_SHIFT, |
722 | return 0; | 714 | vma->vm_start); |
715 | |||
716 | return r; | ||
723 | } | 717 | } |
724 | 718 | ||
725 | /* | 719 | /* |
diff --git a/drivers/video/s3c-fb.c b/drivers/video/s3c-fb.c index 968a62571df7..2e7991c7ca08 100644 --- a/drivers/video/s3c-fb.c +++ b/drivers/video/s3c-fb.c | |||
@@ -24,10 +24,9 @@ | |||
24 | #include <linux/uaccess.h> | 24 | #include <linux/uaccess.h> |
25 | #include <linux/interrupt.h> | 25 | #include <linux/interrupt.h> |
26 | #include <linux/pm_runtime.h> | 26 | #include <linux/pm_runtime.h> |
27 | #include <linux/platform_data/video_s3c.h> | ||
27 | 28 | ||
28 | #include <video/samsung_fimd.h> | 29 | #include <video/samsung_fimd.h> |
29 | #include <mach/map.h> | ||
30 | #include <plat/fb.h> | ||
31 | 30 | ||
32 | /* This driver will export a number of framebuffer interfaces depending | 31 | /* This driver will export a number of framebuffer interfaces depending |
33 | * on the configuration passed in via the platform data. Each fb instance | 32 | * on the configuration passed in via the platform data. Each fb instance |
diff --git a/drivers/video/sa1100fb.c b/drivers/video/sa1100fb.c index cfbde5e85cbf..f34c858642e8 100644 --- a/drivers/video/sa1100fb.c +++ b/drivers/video/sa1100fb.c | |||
@@ -556,7 +556,7 @@ static int sa1100fb_mmap(struct fb_info *info, | |||
556 | struct vm_area_struct *vma) | 556 | struct vm_area_struct *vma) |
557 | { | 557 | { |
558 | struct sa1100fb_info *fbi = (struct sa1100fb_info *)info; | 558 | struct sa1100fb_info *fbi = (struct sa1100fb_info *)info; |
559 | unsigned long start, len, off = vma->vm_pgoff << PAGE_SHIFT; | 559 | unsigned long off = vma->vm_pgoff << PAGE_SHIFT; |
560 | 560 | ||
561 | if (off < info->fix.smem_len) { | 561 | if (off < info->fix.smem_len) { |
562 | vma->vm_pgoff += 1; /* skip over the palette */ | 562 | vma->vm_pgoff += 1; /* skip over the palette */ |
@@ -564,19 +564,9 @@ static int sa1100fb_mmap(struct fb_info *info, | |||
564 | fbi->map_dma, fbi->map_size); | 564 | fbi->map_dma, fbi->map_size); |
565 | } | 565 | } |
566 | 566 | ||
567 | start = info->fix.mmio_start; | ||
568 | len = PAGE_ALIGN((start & ~PAGE_MASK) + info->fix.mmio_len); | ||
569 | |||
570 | if ((vma->vm_end - vma->vm_start + off) > len) | ||
571 | return -EINVAL; | ||
572 | |||
573 | off += start & PAGE_MASK; | ||
574 | vma->vm_pgoff = off >> PAGE_SHIFT; | ||
575 | vma->vm_flags |= VM_IO; | ||
576 | vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); | 567 | vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); |
577 | return io_remap_pfn_range(vma, vma->vm_start, off >> PAGE_SHIFT, | 568 | |
578 | vma->vm_end - vma->vm_start, | 569 | return vm_iomap_memory(vma, info->fix.mmio_start, info->fix.mmio_len); |
579 | vma->vm_page_prot); | ||
580 | } | 570 | } |
581 | 571 | ||
582 | static struct fb_ops sa1100fb_ops = { | 572 | static struct fb_ops sa1100fb_ops = { |
diff --git a/drivers/video/sgivwfb.c b/drivers/video/sgivwfb.c index 2331fadc272b..b2a8912f6435 100644 --- a/drivers/video/sgivwfb.c +++ b/drivers/video/sgivwfb.c | |||
@@ -705,23 +705,17 @@ static int sgivwfb_setcolreg(u_int regno, u_int red, u_int green, | |||
705 | static int sgivwfb_mmap(struct fb_info *info, | 705 | static int sgivwfb_mmap(struct fb_info *info, |
706 | struct vm_area_struct *vma) | 706 | struct vm_area_struct *vma) |
707 | { | 707 | { |
708 | unsigned long size = vma->vm_end - vma->vm_start; | 708 | int r; |
709 | unsigned long offset = vma->vm_pgoff << PAGE_SHIFT; | ||
710 | 709 | ||
711 | if (vma->vm_pgoff > (~0UL >> PAGE_SHIFT)) | ||
712 | return -EINVAL; | ||
713 | if (offset + size > sgivwfb_mem_size) | ||
714 | return -EINVAL; | ||
715 | offset += sgivwfb_mem_phys; | ||
716 | pgprot_val(vma->vm_page_prot) = | 710 | pgprot_val(vma->vm_page_prot) = |
717 | pgprot_val(vma->vm_page_prot) | _PAGE_PCD; | 711 | pgprot_val(vma->vm_page_prot) | _PAGE_PCD; |
718 | vma->vm_flags |= VM_IO; | 712 | |
719 | if (remap_pfn_range(vma, vma->vm_start, offset >> PAGE_SHIFT, | 713 | r = vm_iomap_memory(vma, sgivwfb_mem_phys, sgivwfb_mem_size); |
720 | size, vma->vm_page_prot)) | 714 | |
721 | return -EAGAIN; | ||
722 | printk(KERN_DEBUG "sgivwfb: mmap framebuffer P(%lx)->V(%lx)\n", | 715 | printk(KERN_DEBUG "sgivwfb: mmap framebuffer P(%lx)->V(%lx)\n", |
723 | offset, vma->vm_start); | 716 | offset, vma->vm_start); |
724 | return 0; | 717 | |
718 | return r; | ||
725 | } | 719 | } |
726 | 720 | ||
727 | int __init sgivwfb_setup(char *options) | 721 | int __init sgivwfb_setup(char *options) |
diff --git a/drivers/video/sh_mipi_dsi.c b/drivers/video/sh_mipi_dsi.c index 701b461cf8a9..6cad53075e99 100644 --- a/drivers/video/sh_mipi_dsi.c +++ b/drivers/video/sh_mipi_dsi.c | |||
@@ -581,17 +581,7 @@ static struct platform_driver sh_mipi_driver = { | |||
581 | }, | 581 | }, |
582 | }; | 582 | }; |
583 | 583 | ||
584 | static int __init sh_mipi_init(void) | 584 | module_platform_driver_probe(sh_mipi_driver, sh_mipi_probe); |
585 | { | ||
586 | return platform_driver_probe(&sh_mipi_driver, sh_mipi_probe); | ||
587 | } | ||
588 | module_init(sh_mipi_init); | ||
589 | |||
590 | static void __exit sh_mipi_exit(void) | ||
591 | { | ||
592 | platform_driver_unregister(&sh_mipi_driver); | ||
593 | } | ||
594 | module_exit(sh_mipi_exit); | ||
595 | 585 | ||
596 | MODULE_AUTHOR("Guennadi Liakhovetski <g.liakhovetski@gmx.de>"); | 586 | MODULE_AUTHOR("Guennadi Liakhovetski <g.liakhovetski@gmx.de>"); |
597 | MODULE_DESCRIPTION("SuperH / ARM-shmobile MIPI DSI driver"); | 587 | MODULE_DESCRIPTION("SuperH / ARM-shmobile MIPI DSI driver"); |
diff --git a/drivers/video/sh_mobile_hdmi.c b/drivers/video/sh_mobile_hdmi.c index 930e550e752a..bfe4728480fd 100644 --- a/drivers/video/sh_mobile_hdmi.c +++ b/drivers/video/sh_mobile_hdmi.c | |||
@@ -1445,17 +1445,7 @@ static struct platform_driver sh_hdmi_driver = { | |||
1445 | }, | 1445 | }, |
1446 | }; | 1446 | }; |
1447 | 1447 | ||
1448 | static int __init sh_hdmi_init(void) | 1448 | module_platform_driver_probe(sh_hdmi_driver, sh_hdmi_probe); |
1449 | { | ||
1450 | return platform_driver_probe(&sh_hdmi_driver, sh_hdmi_probe); | ||
1451 | } | ||
1452 | module_init(sh_hdmi_init); | ||
1453 | |||
1454 | static void __exit sh_hdmi_exit(void) | ||
1455 | { | ||
1456 | platform_driver_unregister(&sh_hdmi_driver); | ||
1457 | } | ||
1458 | module_exit(sh_hdmi_exit); | ||
1459 | 1449 | ||
1460 | MODULE_AUTHOR("Guennadi Liakhovetski <g.liakhovetski@gmx.de>"); | 1450 | MODULE_AUTHOR("Guennadi Liakhovetski <g.liakhovetski@gmx.de>"); |
1461 | MODULE_DESCRIPTION("SuperH / ARM-shmobile HDMI driver"); | 1451 | MODULE_DESCRIPTION("SuperH / ARM-shmobile HDMI driver"); |
diff --git a/drivers/video/smscufx.c b/drivers/video/smscufx.c index 97bd6620c364..b2b33fc1ac3f 100644 --- a/drivers/video/smscufx.c +++ b/drivers/video/smscufx.c | |||
@@ -782,7 +782,11 @@ static int ufx_ops_mmap(struct fb_info *info, struct vm_area_struct *vma) | |||
782 | unsigned long offset = vma->vm_pgoff << PAGE_SHIFT; | 782 | unsigned long offset = vma->vm_pgoff << PAGE_SHIFT; |
783 | unsigned long page, pos; | 783 | unsigned long page, pos; |
784 | 784 | ||
785 | if (offset + size > info->fix.smem_len) | 785 | if (vma->vm_pgoff > (~0UL >> PAGE_SHIFT)) |
786 | return -EINVAL; | ||
787 | if (size > info->fix.smem_len) | ||
788 | return -EINVAL; | ||
789 | if (offset > info->fix.smem_len - size) | ||
786 | return -EINVAL; | 790 | return -EINVAL; |
787 | 791 | ||
788 | pos = (unsigned long)info->fix.smem_start + offset; | 792 | pos = (unsigned long)info->fix.smem_start + offset; |
diff --git a/drivers/video/udlfb.c b/drivers/video/udlfb.c index 86d449ea3169..ec03e726c940 100644 --- a/drivers/video/udlfb.c +++ b/drivers/video/udlfb.c | |||
@@ -324,7 +324,11 @@ static int dlfb_ops_mmap(struct fb_info *info, struct vm_area_struct *vma) | |||
324 | unsigned long offset = vma->vm_pgoff << PAGE_SHIFT; | 324 | unsigned long offset = vma->vm_pgoff << PAGE_SHIFT; |
325 | unsigned long page, pos; | 325 | unsigned long page, pos; |
326 | 326 | ||
327 | if (offset + size > info->fix.smem_len) | 327 | if (vma->vm_pgoff > (~0UL >> PAGE_SHIFT)) |
328 | return -EINVAL; | ||
329 | if (size > info->fix.smem_len) | ||
330 | return -EINVAL; | ||
331 | if (offset > info->fix.smem_len - size) | ||
328 | return -EINVAL; | 332 | return -EINVAL; |
329 | 333 | ||
330 | pos = (unsigned long)info->fix.smem_start + offset; | 334 | pos = (unsigned long)info->fix.smem_start + offset; |
diff --git a/drivers/video/vermilion/vermilion.c b/drivers/video/vermilion/vermilion.c index 0aa516fc59cd..09a136633f35 100644 --- a/drivers/video/vermilion/vermilion.c +++ b/drivers/video/vermilion/vermilion.c | |||
@@ -1003,24 +1003,18 @@ static int vmlfb_setcolreg(u_int regno, u_int red, u_int green, u_int blue, | |||
1003 | static int vmlfb_mmap(struct fb_info *info, struct vm_area_struct *vma) | 1003 | static int vmlfb_mmap(struct fb_info *info, struct vm_area_struct *vma) |
1004 | { | 1004 | { |
1005 | struct vml_info *vinfo = container_of(info, struct vml_info, info); | 1005 | struct vml_info *vinfo = container_of(info, struct vml_info, info); |
1006 | unsigned long size = vma->vm_end - vma->vm_start; | ||
1007 | unsigned long offset = vma->vm_pgoff << PAGE_SHIFT; | 1006 | unsigned long offset = vma->vm_pgoff << PAGE_SHIFT; |
1008 | int ret; | 1007 | int ret; |
1009 | 1008 | ||
1010 | if (vma->vm_pgoff > (~0UL >> PAGE_SHIFT)) | ||
1011 | return -EINVAL; | ||
1012 | if (offset + size > vinfo->vram_contig_size) | ||
1013 | return -EINVAL; | ||
1014 | ret = vmlfb_vram_offset(vinfo, offset); | 1009 | ret = vmlfb_vram_offset(vinfo, offset); |
1015 | if (ret) | 1010 | if (ret) |
1016 | return -EINVAL; | 1011 | return -EINVAL; |
1017 | offset += vinfo->vram_start; | 1012 | |
1018 | pgprot_val(vma->vm_page_prot) |= _PAGE_PCD; | 1013 | pgprot_val(vma->vm_page_prot) |= _PAGE_PCD; |
1019 | pgprot_val(vma->vm_page_prot) &= ~_PAGE_PWT; | 1014 | pgprot_val(vma->vm_page_prot) &= ~_PAGE_PWT; |
1020 | if (remap_pfn_range(vma, vma->vm_start, offset >> PAGE_SHIFT, | 1015 | |
1021 | size, vma->vm_page_prot)) | 1016 | return vm_iomap_memory(vma, vinfo->vram_start, |
1022 | return -EAGAIN; | 1017 | vinfo->vram_contig_size); |
1023 | return 0; | ||
1024 | } | 1018 | } |
1025 | 1019 | ||
1026 | static int vmlfb_sync(struct fb_info *info) | 1020 | static int vmlfb_sync(struct fb_info *info) |
diff --git a/drivers/video/vfb.c b/drivers/video/vfb.c index 8bc1f9398945..ee5985efa15c 100644 --- a/drivers/video/vfb.c +++ b/drivers/video/vfb.c | |||
@@ -420,9 +420,12 @@ static int vfb_mmap(struct fb_info *info, | |||
420 | unsigned long offset = vma->vm_pgoff << PAGE_SHIFT; | 420 | unsigned long offset = vma->vm_pgoff << PAGE_SHIFT; |
421 | unsigned long page, pos; | 421 | unsigned long page, pos; |
422 | 422 | ||
423 | if (offset + size > info->fix.smem_len) { | 423 | if (vma->vm_pgoff > (~0UL >> PAGE_SHIFT)) |
424 | return -EINVAL; | ||
425 | if (size > info->fix.smem_len) | ||
426 | return -EINVAL; | ||
427 | if (offset > info->fix.smem_len - size) | ||
424 | return -EINVAL; | 428 | return -EINVAL; |
425 | } | ||
426 | 429 | ||
427 | pos = (unsigned long)info->fix.smem_start + offset; | 430 | pos = (unsigned long)info->fix.smem_start + offset; |
428 | 431 | ||
diff --git a/drivers/video/videomode.c b/drivers/video/videomode.c index 21c47a202afa..df375c96c5d3 100644 --- a/drivers/video/videomode.c +++ b/drivers/video/videomode.c | |||
@@ -11,7 +11,25 @@ | |||
11 | #include <video/display_timing.h> | 11 | #include <video/display_timing.h> |
12 | #include <video/videomode.h> | 12 | #include <video/videomode.h> |
13 | 13 | ||
14 | int videomode_from_timing(const struct display_timings *disp, | 14 | void videomode_from_timing(const struct display_timing *dt, |
15 | struct videomode *vm) | ||
16 | { | ||
17 | vm->pixelclock = dt->pixelclock.typ; | ||
18 | vm->hactive = dt->hactive.typ; | ||
19 | vm->hfront_porch = dt->hfront_porch.typ; | ||
20 | vm->hback_porch = dt->hback_porch.typ; | ||
21 | vm->hsync_len = dt->hsync_len.typ; | ||
22 | |||
23 | vm->vactive = dt->vactive.typ; | ||
24 | vm->vfront_porch = dt->vfront_porch.typ; | ||
25 | vm->vback_porch = dt->vback_porch.typ; | ||
26 | vm->vsync_len = dt->vsync_len.typ; | ||
27 | |||
28 | vm->flags = dt->flags; | ||
29 | } | ||
30 | EXPORT_SYMBOL_GPL(videomode_from_timing); | ||
31 | |||
32 | int videomode_from_timings(const struct display_timings *disp, | ||
15 | struct videomode *vm, unsigned int index) | 33 | struct videomode *vm, unsigned int index) |
16 | { | 34 | { |
17 | struct display_timing *dt; | 35 | struct display_timing *dt; |
@@ -20,20 +38,8 @@ int videomode_from_timing(const struct display_timings *disp, | |||
20 | if (!dt) | 38 | if (!dt) |
21 | return -EINVAL; | 39 | return -EINVAL; |
22 | 40 | ||
23 | vm->pixelclock = display_timing_get_value(&dt->pixelclock, TE_TYP); | 41 | videomode_from_timing(dt, vm); |
24 | vm->hactive = display_timing_get_value(&dt->hactive, TE_TYP); | ||
25 | vm->hfront_porch = display_timing_get_value(&dt->hfront_porch, TE_TYP); | ||
26 | vm->hback_porch = display_timing_get_value(&dt->hback_porch, TE_TYP); | ||
27 | vm->hsync_len = display_timing_get_value(&dt->hsync_len, TE_TYP); | ||
28 | |||
29 | vm->vactive = display_timing_get_value(&dt->vactive, TE_TYP); | ||
30 | vm->vfront_porch = display_timing_get_value(&dt->vfront_porch, TE_TYP); | ||
31 | vm->vback_porch = display_timing_get_value(&dt->vback_porch, TE_TYP); | ||
32 | vm->vsync_len = display_timing_get_value(&dt->vsync_len, TE_TYP); | ||
33 | |||
34 | vm->dmt_flags = dt->dmt_flags; | ||
35 | vm->data_flags = dt->data_flags; | ||
36 | 42 | ||
37 | return 0; | 43 | return 0; |
38 | } | 44 | } |
39 | EXPORT_SYMBOL_GPL(videomode_from_timing); | 45 | EXPORT_SYMBOL_GPL(videomode_from_timings); |
diff --git a/drivers/video/vt8500lcdfb.c b/drivers/video/vt8500lcdfb.c index aa2579c2364a..9547e1831e03 100644 --- a/drivers/video/vt8500lcdfb.c +++ b/drivers/video/vt8500lcdfb.c | |||
@@ -15,22 +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 | 32 | #include <video/of_display_timing.h> | |
33 | #include <linux/platform_data/video-vt8500lcdfb.h> | ||
34 | 33 | ||
35 | #include "vt8500lcdfb.h" | 34 | #include "vt8500lcdfb.h" |
36 | #include "wmt_ge_rops.h" | 35 | #include "wmt_ge_rops.h" |
@@ -277,11 +276,11 @@ static int vt8500lcd_probe(struct platform_device *pdev) | |||
277 | { | 276 | { |
278 | struct vt8500lcd_info *fbi; | 277 | struct vt8500lcd_info *fbi; |
279 | struct resource *res; | 278 | struct resource *res; |
279 | struct display_timings *disp_timing; | ||
280 | void *addr; | 280 | void *addr; |
281 | int irq, ret; | 281 | int irq, ret; |
282 | 282 | ||
283 | struct fb_videomode of_mode; | 283 | struct fb_videomode of_mode; |
284 | struct device_node *np; | ||
285 | u32 bpp; | 284 | u32 bpp; |
286 | dma_addr_t fb_mem_phys; | 285 | dma_addr_t fb_mem_phys; |
287 | unsigned long fb_mem_len; | 286 | unsigned long fb_mem_len; |
@@ -346,32 +345,18 @@ static int vt8500lcd_probe(struct platform_device *pdev) | |||
346 | goto failed_free_res; | 345 | goto failed_free_res; |
347 | } | 346 | } |
348 | 347 | ||
349 | np = of_parse_phandle(pdev->dev.of_node, "default-mode", 0); | 348 | disp_timing = of_get_display_timings(pdev->dev.of_node); |
350 | if (!np) { | 349 | if (!disp_timing) |
351 | pr_err("%s: No display description in Device Tree\n", __func__); | 350 | return -EINVAL; |
352 | ret = -EINVAL; | ||
353 | goto failed_free_res; | ||
354 | } | ||
355 | 351 | ||
356 | /* | 352 | ret = of_get_fb_videomode(pdev->dev.of_node, &of_mode, |
357 | * This code is copied from Sascha Hauer's of_videomode helper | 353 | OF_USE_NATIVE_MODE); |
358 | * and can be replaced with a call to the helper once mainlined | 354 | if (ret) |
359 | */ | 355 | return ret; |
360 | ret = 0; | 356 | |
361 | ret |= of_property_read_u32(np, "hactive", &of_mode.xres); | 357 | ret = of_property_read_u32(pdev->dev.of_node, "bits-per-pixel", &bpp); |
362 | ret |= of_property_read_u32(np, "vactive", &of_mode.yres); | 358 | if (ret) |
363 | ret |= of_property_read_u32(np, "hback-porch", &of_mode.left_margin); | 359 | return ret; |
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 | 360 | ||
376 | /* try allocating the framebuffer */ | 361 | /* try allocating the framebuffer */ |
377 | 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 4dd0580f96fd..01f9ace068e2 100644 --- a/drivers/video/wm8505fb.c +++ b/drivers/video/wm8505fb.c | |||
@@ -14,25 +14,25 @@ | |||
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> | ||
21 | #include <linux/err.h> | ||
25 | #include <linux/init.h> | 22 | #include <linux/init.h> |
26 | #include <linux/interrupt.h> | 23 | #include <linux/interrupt.h> |
27 | #include <linux/io.h> | 24 | #include <linux/io.h> |
28 | #include <linux/dma-mapping.h> | 25 | #include <linux/kernel.h> |
29 | #include <linux/platform_device.h> | 26 | #include <linux/memblock.h> |
30 | #include <linux/wait.h> | 27 | #include <linux/mm.h> |
28 | #include <linux/module.h> | ||
31 | #include <linux/of.h> | 29 | #include <linux/of.h> |
32 | #include <linux/of_fdt.h> | 30 | #include <linux/of_fdt.h> |
33 | #include <linux/memblock.h> | 31 | #include <linux/platform_device.h> |
34 | 32 | #include <linux/slab.h> | |
35 | #include <linux/platform_data/video-vt8500lcdfb.h> | 33 | #include <linux/string.h> |
34 | #include <linux/wait.h> | ||
35 | #include <video/of_display_timing.h> | ||
36 | 36 | ||
37 | #include "wm8505fb_regs.h" | 37 | #include "wm8505fb_regs.h" |
38 | #include "wmt_ge_rops.h" | 38 | #include "wmt_ge_rops.h" |
@@ -263,26 +263,22 @@ static struct fb_ops wm8505fb_ops = { | |||
263 | static int wm8505fb_probe(struct platform_device *pdev) | 263 | static int wm8505fb_probe(struct platform_device *pdev) |
264 | { | 264 | { |
265 | struct wm8505fb_info *fbi; | 265 | struct wm8505fb_info *fbi; |
266 | struct resource *res; | 266 | struct resource *res; |
267 | struct display_timings *disp_timing; | ||
267 | void *addr; | 268 | void *addr; |
268 | int ret; | 269 | int ret; |
269 | 270 | ||
270 | struct fb_videomode of_mode; | 271 | struct fb_videomode mode; |
271 | struct device_node *np; | ||
272 | u32 bpp; | 272 | u32 bpp; |
273 | dma_addr_t fb_mem_phys; | 273 | dma_addr_t fb_mem_phys; |
274 | unsigned long fb_mem_len; | 274 | unsigned long fb_mem_len; |
275 | void *fb_mem_virt; | 275 | void *fb_mem_virt; |
276 | 276 | ||
277 | ret = -ENOMEM; | ||
278 | fbi = NULL; | ||
279 | |||
280 | fbi = devm_kzalloc(&pdev->dev, sizeof(struct wm8505fb_info) + | 277 | fbi = devm_kzalloc(&pdev->dev, sizeof(struct wm8505fb_info) + |
281 | sizeof(u32) * 16, GFP_KERNEL); | 278 | sizeof(u32) * 16, GFP_KERNEL); |
282 | if (!fbi) { | 279 | if (!fbi) { |
283 | dev_err(&pdev->dev, "Failed to initialize framebuffer device\n"); | 280 | dev_err(&pdev->dev, "Failed to initialize framebuffer device\n"); |
284 | ret = -ENOMEM; | 281 | return -ENOMEM; |
285 | goto failed; | ||
286 | } | 282 | } |
287 | 283 | ||
288 | strcpy(fbi->fb.fix.id, DRIVER_NAME); | 284 | strcpy(fbi->fb.fix.id, DRIVER_NAME); |
@@ -308,54 +304,23 @@ static int wm8505fb_probe(struct platform_device *pdev) | |||
308 | fbi->fb.pseudo_palette = addr; | 304 | fbi->fb.pseudo_palette = addr; |
309 | 305 | ||
310 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 306 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
311 | if (res == NULL) { | 307 | fbi->regbase = devm_ioremap_resource(&pdev->dev, res); |
312 | dev_err(&pdev->dev, "no I/O memory resource defined\n"); | 308 | if (IS_ERR(fbi->regbase)) |
313 | ret = -ENODEV; | 309 | return PTR_ERR(fbi->regbase); |
314 | goto failed_fbi; | ||
315 | } | ||
316 | 310 | ||
317 | res = request_mem_region(res->start, resource_size(res), DRIVER_NAME); | 311 | disp_timing = of_get_display_timings(pdev->dev.of_node); |
318 | if (res == NULL) { | 312 | if (!disp_timing) |
319 | dev_err(&pdev->dev, "failed to request I/O memory\n"); | 313 | return -EINVAL; |
320 | ret = -EBUSY; | ||
321 | goto failed_fbi; | ||
322 | } | ||
323 | |||
324 | fbi->regbase = ioremap(res->start, resource_size(res)); | ||
325 | if (fbi->regbase == NULL) { | ||
326 | dev_err(&pdev->dev, "failed to map I/O memory\n"); | ||
327 | ret = -EBUSY; | ||
328 | goto failed_free_res; | ||
329 | } | ||
330 | 314 | ||
331 | np = of_parse_phandle(pdev->dev.of_node, "default-mode", 0); | 315 | ret = of_get_fb_videomode(pdev->dev.of_node, &mode, OF_USE_NATIVE_MODE); |
332 | if (!np) { | 316 | if (ret) |
333 | pr_err("%s: No display description in Device Tree\n", __func__); | 317 | return ret; |
334 | ret = -EINVAL; | ||
335 | goto failed_free_res; | ||
336 | } | ||
337 | 318 | ||
338 | /* | 319 | ret = of_property_read_u32(pdev->dev.of_node, "bits-per-pixel", &bpp); |
339 | * This code is copied from Sascha Hauer's of_videomode helper | 320 | if (ret) |
340 | * and can be replaced with a call to the helper once mainlined | 321 | return ret; |
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 | 322 | ||
357 | of_mode.vmode = FB_VMODE_NONINTERLACED; | 323 | fb_videomode_to_var(&fbi->fb.var, &mode); |
358 | fb_videomode_to_var(&fbi->fb.var, &of_mode); | ||
359 | 324 | ||
360 | fbi->fb.var.nonstd = 0; | 325 | fbi->fb.var.nonstd = 0; |
361 | fbi->fb.var.activate = FB_ACTIVATE_NOW; | 326 | fbi->fb.var.activate = FB_ACTIVATE_NOW; |
@@ -364,16 +329,16 @@ static int wm8505fb_probe(struct platform_device *pdev) | |||
364 | fbi->fb.var.width = -1; | 329 | fbi->fb.var.width = -1; |
365 | 330 | ||
366 | /* try allocating the framebuffer */ | 331 | /* try allocating the framebuffer */ |
367 | fb_mem_len = of_mode.xres * of_mode.yres * 2 * (bpp / 8); | 332 | fb_mem_len = mode.xres * mode.yres * 2 * (bpp / 8); |
368 | fb_mem_virt = dma_alloc_coherent(&pdev->dev, fb_mem_len, &fb_mem_phys, | 333 | fb_mem_virt = dmam_alloc_coherent(&pdev->dev, fb_mem_len, &fb_mem_phys, |
369 | GFP_KERNEL); | 334 | GFP_KERNEL); |
370 | if (!fb_mem_virt) { | 335 | if (!fb_mem_virt) { |
371 | pr_err("%s: Failed to allocate framebuffer\n", __func__); | 336 | pr_err("%s: Failed to allocate framebuffer\n", __func__); |
372 | return -ENOMEM; | 337 | return -ENOMEM; |
373 | }; | 338 | } |
374 | 339 | ||
375 | fbi->fb.var.xres_virtual = of_mode.xres; | 340 | fbi->fb.var.xres_virtual = mode.xres; |
376 | fbi->fb.var.yres_virtual = of_mode.yres * 2; | 341 | fbi->fb.var.yres_virtual = mode.yres * 2; |
377 | fbi->fb.var.bits_per_pixel = bpp; | 342 | fbi->fb.var.bits_per_pixel = bpp; |
378 | 343 | ||
379 | fbi->fb.fix.smem_start = fb_mem_phys; | 344 | fbi->fb.fix.smem_start = fb_mem_phys; |
@@ -381,28 +346,29 @@ static int wm8505fb_probe(struct platform_device *pdev) | |||
381 | fbi->fb.screen_base = fb_mem_virt; | 346 | fbi->fb.screen_base = fb_mem_virt; |
382 | fbi->fb.screen_size = fb_mem_len; | 347 | fbi->fb.screen_size = fb_mem_len; |
383 | 348 | ||
349 | fbi->contrast = 0x10; | ||
350 | ret = wm8505fb_set_par(&fbi->fb); | ||
351 | if (ret) { | ||
352 | dev_err(&pdev->dev, "Failed to set parameters\n"); | ||
353 | return ret; | ||
354 | } | ||
355 | |||
384 | if (fb_alloc_cmap(&fbi->fb.cmap, 256, 0) < 0) { | 356 | if (fb_alloc_cmap(&fbi->fb.cmap, 256, 0) < 0) { |
385 | dev_err(&pdev->dev, "Failed to allocate color map\n"); | 357 | dev_err(&pdev->dev, "Failed to allocate color map\n"); |
386 | ret = -ENOMEM; | 358 | return -ENOMEM; |
387 | goto failed_free_io; | ||
388 | } | 359 | } |
389 | 360 | ||
390 | wm8505fb_init_hw(&fbi->fb); | 361 | wm8505fb_init_hw(&fbi->fb); |
391 | 362 | ||
392 | fbi->contrast = 0x80; | ||
393 | ret = wm8505fb_set_par(&fbi->fb); | ||
394 | if (ret) { | ||
395 | dev_err(&pdev->dev, "Failed to set parameters\n"); | ||
396 | goto failed_free_cmap; | ||
397 | } | ||
398 | |||
399 | platform_set_drvdata(pdev, fbi); | 363 | platform_set_drvdata(pdev, fbi); |
400 | 364 | ||
401 | ret = register_framebuffer(&fbi->fb); | 365 | ret = register_framebuffer(&fbi->fb); |
402 | if (ret < 0) { | 366 | if (ret < 0) { |
403 | dev_err(&pdev->dev, | 367 | dev_err(&pdev->dev, |
404 | "Failed to register framebuffer device: %d\n", ret); | 368 | "Failed to register framebuffer device: %d\n", ret); |
405 | goto failed_free_cmap; | 369 | if (fbi->fb.cmap.len) |
370 | fb_dealloc_cmap(&fbi->fb.cmap); | ||
371 | return ret; | ||
406 | } | 372 | } |
407 | 373 | ||
408 | ret = device_create_file(&pdev->dev, &dev_attr_contrast); | 374 | ret = device_create_file(&pdev->dev, &dev_attr_contrast); |
@@ -416,25 +382,11 @@ static int wm8505fb_probe(struct platform_device *pdev) | |||
416 | fbi->fb.fix.smem_start + fbi->fb.fix.smem_len - 1); | 382 | fbi->fb.fix.smem_start + fbi->fb.fix.smem_len - 1); |
417 | 383 | ||
418 | return 0; | 384 | return 0; |
419 | |||
420 | failed_free_cmap: | ||
421 | if (fbi->fb.cmap.len) | ||
422 | fb_dealloc_cmap(&fbi->fb.cmap); | ||
423 | failed_free_io: | ||
424 | iounmap(fbi->regbase); | ||
425 | failed_free_res: | ||
426 | release_mem_region(res->start, resource_size(res)); | ||
427 | failed_fbi: | ||
428 | platform_set_drvdata(pdev, NULL); | ||
429 | kfree(fbi); | ||
430 | failed: | ||
431 | return ret; | ||
432 | } | 385 | } |
433 | 386 | ||
434 | static int wm8505fb_remove(struct platform_device *pdev) | 387 | static int wm8505fb_remove(struct platform_device *pdev) |
435 | { | 388 | { |
436 | struct wm8505fb_info *fbi = platform_get_drvdata(pdev); | 389 | struct wm8505fb_info *fbi = platform_get_drvdata(pdev); |
437 | struct resource *res; | ||
438 | 390 | ||
439 | device_remove_file(&pdev->dev, &dev_attr_contrast); | 391 | device_remove_file(&pdev->dev, &dev_attr_contrast); |
440 | 392 | ||
@@ -445,13 +397,6 @@ static int wm8505fb_remove(struct platform_device *pdev) | |||
445 | if (fbi->fb.cmap.len) | 397 | if (fbi->fb.cmap.len) |
446 | fb_dealloc_cmap(&fbi->fb.cmap); | 398 | fb_dealloc_cmap(&fbi->fb.cmap); |
447 | 399 | ||
448 | iounmap(fbi->regbase); | ||
449 | |||
450 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
451 | release_mem_region(res->start, resource_size(res)); | ||
452 | |||
453 | kfree(fbi); | ||
454 | |||
455 | return 0; | 400 | return 0; |
456 | } | 401 | } |
457 | 402 | ||
diff --git a/drivers/video/wmt_ge_rops.h b/drivers/video/wmt_ge_rops.h index 87380751a443..f73ec6377a46 100644 --- a/drivers/video/wmt_ge_rops.h +++ b/drivers/video/wmt_ge_rops.h | |||
@@ -1,5 +1,28 @@ | |||
1 | #ifdef CONFIG_FB_WMT_GE_ROPS | ||
2 | |||
1 | extern void wmt_ge_fillrect(struct fb_info *info, | 3 | extern void wmt_ge_fillrect(struct fb_info *info, |
2 | const struct fb_fillrect *rect); | 4 | const struct fb_fillrect *rect); |
3 | extern void wmt_ge_copyarea(struct fb_info *info, | 5 | extern void wmt_ge_copyarea(struct fb_info *info, |
4 | const struct fb_copyarea *area); | 6 | const struct fb_copyarea *area); |
5 | extern int wmt_ge_sync(struct fb_info *info); | 7 | extern int wmt_ge_sync(struct fb_info *info); |
8 | |||
9 | #else | ||
10 | |||
11 | static inline int wmt_ge_sync(struct fb_info *p) | ||
12 | { | ||
13 | return 0; | ||
14 | } | ||
15 | |||
16 | static inline void wmt_ge_fillrect(struct fb_info *p, | ||
17 | const struct fb_fillrect *rect) | ||
18 | { | ||
19 | sys_fillrect(p, rect); | ||
20 | } | ||
21 | |||
22 | static inline void wmt_ge_copyarea(struct fb_info *p, | ||
23 | const struct fb_copyarea *area) | ||
24 | { | ||
25 | sys_copyarea(p, area); | ||
26 | } | ||
27 | |||
28 | #endif | ||
diff --git a/include/linux/platform_data/video-vt8500lcdfb.h b/include/linux/platform_data/video-vt8500lcdfb.h deleted file mode 100644 index 7f399c370fe0..000000000000 --- a/include/linux/platform_data/video-vt8500lcdfb.h +++ /dev/null | |||
@@ -1,31 +0,0 @@ | |||
1 | /* | ||
2 | * VT8500/WM8505 Frame Buffer platform data definitions | ||
3 | * | ||
4 | * Copyright (C) 2010 Ed Spiridonov <edo.rus@gmail.com> | ||
5 | * | ||
6 | * This software is licensed under the terms of the GNU General Public | ||
7 | * License version 2, as published by the Free Software Foundation, and | ||
8 | * may be copied, distributed, and modified under those terms. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | */ | ||
15 | |||
16 | #ifndef _VT8500FB_H | ||
17 | #define _VT8500FB_H | ||
18 | |||
19 | #include <linux/fb.h> | ||
20 | |||
21 | struct vt8500fb_platform_data { | ||
22 | struct fb_videomode mode; | ||
23 | u32 xres_virtual; | ||
24 | u32 yres_virtual; | ||
25 | u32 bpp; | ||
26 | unsigned long video_mem_phys; | ||
27 | void *video_mem_virt; | ||
28 | unsigned long video_mem_len; | ||
29 | }; | ||
30 | |||
31 | #endif /* _VT8500FB_H */ | ||
diff --git a/include/linux/platform_data/video_s3c.h b/include/linux/platform_data/video_s3c.h new file mode 100644 index 000000000000..48883995f47f --- /dev/null +++ b/include/linux/platform_data/video_s3c.h | |||
@@ -0,0 +1,54 @@ | |||
1 | #ifndef __PLATFORM_DATA_VIDEO_S3C | ||
2 | #define __PLATFORM_DATA_VIDEO_S3C | ||
3 | |||
4 | /* S3C_FB_MAX_WIN | ||
5 | * Set to the maximum number of windows that any of the supported hardware | ||
6 | * can use. Since the platform data uses this for an array size, having it | ||
7 | * set to the maximum of any version of the hardware can do is safe. | ||
8 | */ | ||
9 | #define S3C_FB_MAX_WIN (5) | ||
10 | |||
11 | /** | ||
12 | * struct s3c_fb_pd_win - per window setup data | ||
13 | * @xres : The window X size. | ||
14 | * @yres : The window Y size. | ||
15 | * @virtual_x: The virtual X size. | ||
16 | * @virtual_y: The virtual Y size. | ||
17 | */ | ||
18 | struct s3c_fb_pd_win { | ||
19 | unsigned short default_bpp; | ||
20 | unsigned short max_bpp; | ||
21 | unsigned short xres; | ||
22 | unsigned short yres; | ||
23 | unsigned short virtual_x; | ||
24 | unsigned short virtual_y; | ||
25 | }; | ||
26 | |||
27 | /** | ||
28 | * struct s3c_fb_platdata - S3C driver platform specific information | ||
29 | * @setup_gpio: Setup the external GPIO pins to the right state to transfer | ||
30 | * the data from the display system to the connected display | ||
31 | * device. | ||
32 | * @vidcon0: The base vidcon0 values to control the panel data format. | ||
33 | * @vidcon1: The base vidcon1 values to control the panel data output. | ||
34 | * @vtiming: Video timing when connected to a RGB type panel. | ||
35 | * @win: The setup data for each hardware window, or NULL for unused. | ||
36 | * @display_mode: The LCD output display mode. | ||
37 | * | ||
38 | * The platform data supplies the video driver with all the information | ||
39 | * it requires to work with the display(s) attached to the machine. It | ||
40 | * controls the initial mode, the number of display windows (0 is always | ||
41 | * the base framebuffer) that are initialised etc. | ||
42 | * | ||
43 | */ | ||
44 | struct s3c_fb_platdata { | ||
45 | void (*setup_gpio)(void); | ||
46 | |||
47 | struct s3c_fb_pd_win *win[S3C_FB_MAX_WIN]; | ||
48 | struct fb_videomode *vtiming; | ||
49 | |||
50 | u32 vidcon0; | ||
51 | u32 vidcon1; | ||
52 | }; | ||
53 | |||
54 | #endif | ||
diff --git a/include/video/auo_k190xfb.h b/include/video/auo_k190xfb.h index 609efe8c686e..ac329ee1d753 100644 --- a/include/video/auo_k190xfb.h +++ b/include/video/auo_k190xfb.h | |||
@@ -22,6 +22,8 @@ | |||
22 | */ | 22 | */ |
23 | #define AUOK190X_RESOLUTION_800_600 0 | 23 | #define AUOK190X_RESOLUTION_800_600 0 |
24 | #define AUOK190X_RESOLUTION_1024_768 1 | 24 | #define AUOK190X_RESOLUTION_1024_768 1 |
25 | #define AUOK190X_RESOLUTION_600_800 4 | ||
26 | #define AUOK190X_RESOLUTION_768_1024 5 | ||
25 | 27 | ||
26 | /* | 28 | /* |
27 | * struct used by auok190x. board specific stuff comes from *board | 29 | * struct used by auok190x. board specific stuff comes from *board |
@@ -98,7 +100,6 @@ struct auok190x_board { | |||
98 | int gpio_nbusy; | 100 | int gpio_nbusy; |
99 | 101 | ||
100 | int resolution; | 102 | int resolution; |
101 | int rotation; | ||
102 | int quirks; | 103 | int quirks; |
103 | int fps; | 104 | int fps; |
104 | }; | 105 | }; |
diff --git a/include/video/display_timing.h b/include/video/display_timing.h index 71e9a383a981..5d0259b08e01 100644 --- a/include/video/display_timing.h +++ b/include/video/display_timing.h | |||
@@ -12,19 +12,22 @@ | |||
12 | #include <linux/bitops.h> | 12 | #include <linux/bitops.h> |
13 | #include <linux/types.h> | 13 | #include <linux/types.h> |
14 | 14 | ||
15 | /* VESA display monitor timing parameters */ | 15 | enum display_flags { |
16 | #define VESA_DMT_HSYNC_LOW BIT(0) | 16 | DISPLAY_FLAGS_HSYNC_LOW = BIT(0), |
17 | #define VESA_DMT_HSYNC_HIGH BIT(1) | 17 | DISPLAY_FLAGS_HSYNC_HIGH = BIT(1), |
18 | #define VESA_DMT_VSYNC_LOW BIT(2) | 18 | DISPLAY_FLAGS_VSYNC_LOW = BIT(2), |
19 | #define VESA_DMT_VSYNC_HIGH BIT(3) | 19 | DISPLAY_FLAGS_VSYNC_HIGH = BIT(3), |
20 | 20 | ||
21 | /* display specific flags */ | 21 | /* data enable flag */ |
22 | #define DISPLAY_FLAGS_DE_LOW BIT(0) /* data enable flag */ | 22 | DISPLAY_FLAGS_DE_LOW = BIT(4), |
23 | #define DISPLAY_FLAGS_DE_HIGH BIT(1) | 23 | DISPLAY_FLAGS_DE_HIGH = BIT(5), |
24 | #define DISPLAY_FLAGS_PIXDATA_POSEDGE BIT(2) /* drive data on pos. edge */ | 24 | /* drive data on pos. edge */ |
25 | #define DISPLAY_FLAGS_PIXDATA_NEGEDGE BIT(3) /* drive data on neg. edge */ | 25 | DISPLAY_FLAGS_PIXDATA_POSEDGE = BIT(6), |
26 | #define DISPLAY_FLAGS_INTERLACED BIT(4) | 26 | /* drive data on neg. edge */ |
27 | #define DISPLAY_FLAGS_DOUBLESCAN BIT(5) | 27 | DISPLAY_FLAGS_PIXDATA_NEGEDGE = BIT(7), |
28 | DISPLAY_FLAGS_INTERLACED = BIT(8), | ||
29 | DISPLAY_FLAGS_DOUBLESCAN = BIT(9), | ||
30 | }; | ||
28 | 31 | ||
29 | /* | 32 | /* |
30 | * A single signal can be specified via a range of minimal and maximal values | 33 | * A single signal can be specified via a range of minimal and maximal values |
@@ -36,12 +39,6 @@ struct timing_entry { | |||
36 | u32 max; | 39 | u32 max; |
37 | }; | 40 | }; |
38 | 41 | ||
39 | enum timing_entry_index { | ||
40 | TE_MIN = 0, | ||
41 | TE_TYP = 1, | ||
42 | TE_MAX = 2, | ||
43 | }; | ||
44 | |||
45 | /* | 42 | /* |
46 | * Single "mode" entry. This describes one set of signal timings a display can | 43 | * Single "mode" entry. This describes one set of signal timings a display can |
47 | * have in one setting. This struct can later be converted to struct videomode | 44 | * have in one setting. This struct can later be converted to struct videomode |
@@ -72,8 +69,7 @@ struct display_timing { | |||
72 | struct timing_entry vback_porch; /* ver. back porch */ | 69 | struct timing_entry vback_porch; /* ver. back porch */ |
73 | struct timing_entry vsync_len; /* ver. sync len */ | 70 | struct timing_entry vsync_len; /* ver. sync len */ |
74 | 71 | ||
75 | unsigned int dmt_flags; /* VESA DMT flags */ | 72 | enum display_flags flags; /* display flags */ |
76 | unsigned int data_flags; /* video data flags */ | ||
77 | }; | 73 | }; |
78 | 74 | ||
79 | /* | 75 | /* |
@@ -89,25 +85,6 @@ struct display_timings { | |||
89 | struct display_timing **timings; | 85 | struct display_timing **timings; |
90 | }; | 86 | }; |
91 | 87 | ||
92 | /* get value specified by index from struct timing_entry */ | ||
93 | static inline u32 display_timing_get_value(const struct timing_entry *te, | ||
94 | enum timing_entry_index index) | ||
95 | { | ||
96 | switch (index) { | ||
97 | case TE_MIN: | ||
98 | return te->min; | ||
99 | break; | ||
100 | case TE_TYP: | ||
101 | return te->typ; | ||
102 | break; | ||
103 | case TE_MAX: | ||
104 | return te->max; | ||
105 | break; | ||
106 | default: | ||
107 | return te->typ; | ||
108 | } | ||
109 | } | ||
110 | |||
111 | /* get one entry from struct display_timings */ | 88 | /* get one entry from struct display_timings */ |
112 | static inline struct display_timing *display_timings_get(const struct | 89 | static inline struct display_timing *display_timings_get(const struct |
113 | display_timings *disp, | 90 | display_timings *disp, |
diff --git a/include/video/videomode.h b/include/video/videomode.h index a42156234dd4..3f1049d870d5 100644 --- a/include/video/videomode.h +++ b/include/video/videomode.h | |||
@@ -29,20 +29,30 @@ struct videomode { | |||
29 | u32 vback_porch; | 29 | u32 vback_porch; |
30 | u32 vsync_len; | 30 | u32 vsync_len; |
31 | 31 | ||
32 | unsigned int dmt_flags; /* VESA DMT flags */ | 32 | enum display_flags flags; /* display flags */ |
33 | unsigned int data_flags; /* video data flags */ | ||
34 | }; | 33 | }; |
35 | 34 | ||
36 | /** | 35 | /** |
37 | * videomode_from_timing - convert display timing to videomode | 36 | * videomode_from_timing - convert display timing to videomode |
37 | * @dt: display_timing structure | ||
38 | * @vm: return value | ||
39 | * | ||
40 | * DESCRIPTION: | ||
41 | * This function converts a struct display_timing to a struct videomode. | ||
42 | */ | ||
43 | void videomode_from_timing(const struct display_timing *dt, | ||
44 | struct videomode *vm); | ||
45 | |||
46 | /** | ||
47 | * videomode_from_timings - convert one display timings entry to videomode | ||
38 | * @disp: structure with all possible timing entries | 48 | * @disp: structure with all possible timing entries |
39 | * @vm: return value | 49 | * @vm: return value |
40 | * @index: index into the list of display timings in devicetree | 50 | * @index: index into the list of display timings in devicetree |
41 | * | 51 | * |
42 | * DESCRIPTION: | 52 | * DESCRIPTION: |
43 | * This function converts a struct display_timing to a struct videomode. | 53 | * This function converts one struct display_timing entry to a struct videomode. |
44 | */ | 54 | */ |
45 | int videomode_from_timing(const struct display_timings *disp, | 55 | int videomode_from_timings(const struct display_timings *disp, |
46 | struct videomode *vm, unsigned int index); | 56 | struct videomode *vm, unsigned int index); |
47 | 57 | ||
48 | #endif | 58 | #endif |