]>
Commit | Line | Data |
---|---|---|
ec549a0f BD |
1 | /* linux/drivers/video/s3c-fb.c |
2 | * | |
3 | * Copyright 2008 Openmoko Inc. | |
50a5503a | 4 | * Copyright 2008-2010 Simtec Electronics |
ec549a0f BD |
5 | * Ben Dooks <ben@simtec.co.uk> |
6 | * http://armlinux.simtec.co.uk/ | |
7 | * | |
8 | * Samsung SoC Framebuffer driver | |
9 | * | |
10 | * This program is free software; you can redistribute it and/or modify | |
11 | * it under the terms of the GNU General Public License version 2 as | |
c4bb6ffa | 12 | * published by the Free Software FoundatIon. |
ec549a0f BD |
13 | */ |
14 | ||
15 | #include <linux/kernel.h> | |
16 | #include <linux/module.h> | |
17 | #include <linux/platform_device.h> | |
18 | #include <linux/dma-mapping.h> | |
5a0e3ad6 | 19 | #include <linux/slab.h> |
ec549a0f | 20 | #include <linux/init.h> |
ec549a0f BD |
21 | #include <linux/clk.h> |
22 | #include <linux/fb.h> | |
23 | #include <linux/io.h> | |
efdc846d PO |
24 | #include <linux/uaccess.h> |
25 | #include <linux/interrupt.h> | |
4959212c | 26 | #include <linux/pm_runtime.h> |
ec549a0f BD |
27 | |
28 | #include <mach/map.h> | |
c4bb6ffa | 29 | #include <plat/regs-fb-v4.h> |
ec549a0f BD |
30 | #include <plat/fb.h> |
31 | ||
32 | /* This driver will export a number of framebuffer interfaces depending | |
33 | * on the configuration passed in via the platform data. Each fb instance | |
34 | * maps to a hardware window. Currently there is no support for runtime | |
35 | * setting of the alpha-blending functions that each window has, so only | |
36 | * window 0 is actually useful. | |
37 | * | |
38 | * Window 0 is treated specially, it is used for the basis of the LCD | |
39 | * output timings and as the control for the output power-down state. | |
40 | */ | |
41 | ||
50a5503a BD |
42 | /* note, the previous use of <mach/regs-fb.h> to get platform specific data |
43 | * has been replaced by using the platform device name to pick the correct | |
44 | * configuration data for the system. | |
ec549a0f BD |
45 | */ |
46 | ||
47 | #ifdef CONFIG_FB_S3C_DEBUG_REGWRITE | |
48 | #undef writel | |
49 | #define writel(v, r) do { \ | |
50 | printk(KERN_DEBUG "%s: %08x => %p\n", __func__, (unsigned int)v, r); \ | |
05e52b4b JH |
51 | __raw_writel(v, r); \ |
52 | } while (0) | |
ec549a0f BD |
53 | #endif /* FB_S3C_DEBUG_REGWRITE */ |
54 | ||
efdc846d PO |
55 | /* irq_flags bits */ |
56 | #define S3C_FB_VSYNC_IRQ_EN 0 | |
57 | ||
58 | #define VSYNC_TIMEOUT_MSEC 50 | |
59 | ||
ec549a0f BD |
60 | struct s3c_fb; |
61 | ||
50a5503a BD |
62 | #define VALID_BPP(x) (1 << ((x) - 1)) |
63 | ||
c4bb6ffa BD |
64 | #define OSD_BASE(win, variant) ((variant).osd + ((win) * (variant).osd_stride)) |
65 | #define VIDOSD_A(win, variant) (OSD_BASE(win, variant) + 0x00) | |
66 | #define VIDOSD_B(win, variant) (OSD_BASE(win, variant) + 0x04) | |
67 | #define VIDOSD_C(win, variant) (OSD_BASE(win, variant) + 0x08) | |
68 | #define VIDOSD_D(win, variant) (OSD_BASE(win, variant) + 0x0C) | |
69 | ||
50a5503a BD |
70 | /** |
71 | * struct s3c_fb_variant - fb variant information | |
c4bb6ffa | 72 | * @is_2443: Set if S3C2443/S3C2416 style hardware. |
50a5503a | 73 | * @nr_windows: The number of windows. |
c4bb6ffa BD |
74 | * @vidtcon: The base for the VIDTCONx registers |
75 | * @wincon: The base for the WINxCON registers. | |
76 | * @winmap: The base for the WINxMAP registers. | |
77 | * @keycon: The abse for the WxKEYCON registers. | |
78 | * @buf_start: Offset of buffer start registers. | |
79 | * @buf_size: Offset of buffer size registers. | |
80 | * @buf_end: Offset of buffer end registers. | |
81 | * @osd: The base for the OSD registers. | |
50a5503a | 82 | * @palette: Address of palette memory, or 0 if none. |
067b226b | 83 | * @has_prtcon: Set if has PRTCON register. |
f5ec546f | 84 | * @has_shadowcon: Set if has SHADOWCON register. |
f7f31e50 | 85 | * @has_blendcon: Set if has BLENDCON register. |
b5480ed7 | 86 | * @has_clksel: Set if VIDCON0 register has CLKSEL bit. |
50a5503a BD |
87 | */ |
88 | struct s3c_fb_variant { | |
c4bb6ffa | 89 | unsigned int is_2443:1; |
50a5503a | 90 | unsigned short nr_windows; |
c4bb6ffa BD |
91 | unsigned short vidtcon; |
92 | unsigned short wincon; | |
93 | unsigned short winmap; | |
94 | unsigned short keycon; | |
95 | unsigned short buf_start; | |
96 | unsigned short buf_end; | |
97 | unsigned short buf_size; | |
98 | unsigned short osd; | |
99 | unsigned short osd_stride; | |
50a5503a | 100 | unsigned short palette[S3C_FB_MAX_WIN]; |
067b226b PO |
101 | |
102 | unsigned int has_prtcon:1; | |
f5ec546f | 103 | unsigned int has_shadowcon:1; |
f7f31e50 | 104 | unsigned int has_blendcon:1; |
b5480ed7 | 105 | unsigned int has_clksel:1; |
50a5503a BD |
106 | }; |
107 | ||
108 | /** | |
109 | * struct s3c_fb_win_variant | |
110 | * @has_osd_c: Set if has OSD C register. | |
111 | * @has_osd_d: Set if has OSD D register. | |
f676ec2a | 112 | * @has_osd_alpha: Set if can change alpha transparency for a window. |
50a5503a BD |
113 | * @palette_sz: Size of palette in entries. |
114 | * @palette_16bpp: Set if palette is 16bits wide. | |
f676ec2a PO |
115 | * @osd_size_off: If != 0, supports setting up OSD for a window; the appropriate |
116 | * register is located at the given offset from OSD_BASE. | |
50a5503a BD |
117 | * @valid_bpp: 1 bit per BPP setting to show valid bits-per-pixel. |
118 | * | |
119 | * valid_bpp bit x is set if (x+1)BPP is supported. | |
120 | */ | |
121 | struct s3c_fb_win_variant { | |
122 | unsigned int has_osd_c:1; | |
123 | unsigned int has_osd_d:1; | |
f676ec2a | 124 | unsigned int has_osd_alpha:1; |
50a5503a | 125 | unsigned int palette_16bpp:1; |
f676ec2a | 126 | unsigned short osd_size_off; |
50a5503a BD |
127 | unsigned short palette_sz; |
128 | u32 valid_bpp; | |
129 | }; | |
130 | ||
131 | /** | |
132 | * struct s3c_fb_driverdata - per-device type driver data for init time. | |
133 | * @variant: The variant information for this driver. | |
134 | * @win: The window information for each window. | |
135 | */ | |
136 | struct s3c_fb_driverdata { | |
137 | struct s3c_fb_variant variant; | |
138 | struct s3c_fb_win_variant *win[S3C_FB_MAX_WIN]; | |
139 | }; | |
140 | ||
bc2da1b6 BD |
141 | /** |
142 | * struct s3c_fb_palette - palette information | |
143 | * @r: Red bitfield. | |
144 | * @g: Green bitfield. | |
145 | * @b: Blue bitfield. | |
146 | * @a: Alpha bitfield. | |
147 | */ | |
148 | struct s3c_fb_palette { | |
149 | struct fb_bitfield r; | |
150 | struct fb_bitfield g; | |
151 | struct fb_bitfield b; | |
152 | struct fb_bitfield a; | |
153 | }; | |
154 | ||
ec549a0f BD |
155 | /** |
156 | * struct s3c_fb_win - per window private data for each framebuffer. | |
157 | * @windata: The platform data supplied for the window configuration. | |
158 | * @parent: The hardware that this window is part of. | |
159 | * @fbinfo: Pointer pack to the framebuffer info for this window. | |
50a5503a | 160 | * @varint: The variant information for this window. |
ec549a0f BD |
161 | * @palette_buffer: Buffer/cache to hold palette entries. |
162 | * @pseudo_palette: For use in TRUECOLOUR modes for entries 0..15/ | |
163 | * @index: The window number of this window. | |
164 | * @palette: The bitfields for changing r/g/b into a hardware palette entry. | |
165 | */ | |
166 | struct s3c_fb_win { | |
167 | struct s3c_fb_pd_win *windata; | |
168 | struct s3c_fb *parent; | |
169 | struct fb_info *fbinfo; | |
170 | struct s3c_fb_palette palette; | |
50a5503a | 171 | struct s3c_fb_win_variant variant; |
ec549a0f BD |
172 | |
173 | u32 *palette_buffer; | |
174 | u32 pseudo_palette[16]; | |
175 | unsigned int index; | |
176 | }; | |
177 | ||
efdc846d PO |
178 | /** |
179 | * struct s3c_fb_vsync - vsync information | |
180 | * @wait: a queue for processes waiting for vsync | |
181 | * @count: vsync interrupt count | |
182 | */ | |
183 | struct s3c_fb_vsync { | |
184 | wait_queue_head_t wait; | |
185 | unsigned int count; | |
186 | }; | |
187 | ||
ec549a0f BD |
188 | /** |
189 | * struct s3c_fb - overall hardware state of the hardware | |
b07f3bbe | 190 | * @slock: The spinlock protection for this data sturcture. |
ec549a0f | 191 | * @dev: The device that we bound to, for printing, etc. |
ec549a0f | 192 | * @bus_clk: The clk (hclk) feeding our interface and possibly pixclk. |
b5480ed7 | 193 | * @lcd_clk: The clk (sclk) feeding pixclk. |
ec549a0f | 194 | * @regs: The mapped hardware registers. |
50a5503a | 195 | * @variant: Variant information for this hardware. |
ec549a0f | 196 | * @enabled: A bitmask of enabled hardware windows. |
f4f51473 | 197 | * @output_on: Flag if the physical output is enabled. |
ec549a0f BD |
198 | * @pdata: The platform configuration data passed with the device. |
199 | * @windows: The hardware windows that have been claimed. | |
efdc846d PO |
200 | * @irq_no: IRQ line number |
201 | * @irq_flags: irq flags | |
202 | * @vsync_info: VSYNC-related information (count, queues...) | |
ec549a0f BD |
203 | */ |
204 | struct s3c_fb { | |
b07f3bbe | 205 | spinlock_t slock; |
ec549a0f | 206 | struct device *dev; |
ec549a0f | 207 | struct clk *bus_clk; |
b5480ed7 | 208 | struct clk *lcd_clk; |
ec549a0f | 209 | void __iomem *regs; |
50a5503a | 210 | struct s3c_fb_variant variant; |
ec549a0f BD |
211 | |
212 | unsigned char enabled; | |
f4f51473 | 213 | bool output_on; |
ec549a0f BD |
214 | |
215 | struct s3c_fb_platdata *pdata; | |
216 | struct s3c_fb_win *windows[S3C_FB_MAX_WIN]; | |
efdc846d PO |
217 | |
218 | int irq_no; | |
219 | unsigned long irq_flags; | |
220 | struct s3c_fb_vsync vsync_info; | |
ec549a0f BD |
221 | }; |
222 | ||
223 | /** | |
50a5503a BD |
224 | * s3c_fb_validate_win_bpp - validate the bits-per-pixel for this mode. |
225 | * @win: The device window. | |
226 | * @bpp: The bit depth. | |
ec549a0f | 227 | */ |
50a5503a | 228 | static bool s3c_fb_validate_win_bpp(struct s3c_fb_win *win, unsigned int bpp) |
ec549a0f | 229 | { |
50a5503a | 230 | return win->variant.valid_bpp & VALID_BPP(bpp); |
ec549a0f BD |
231 | } |
232 | ||
233 | /** | |
234 | * s3c_fb_check_var() - framebuffer layer request to verify a given mode. | |
235 | * @var: The screen information to verify. | |
236 | * @info: The framebuffer device. | |
237 | * | |
238 | * Framebuffer layer call to verify the given information and allow us to | |
239 | * update various information depending on the hardware capabilities. | |
240 | */ | |
241 | static int s3c_fb_check_var(struct fb_var_screeninfo *var, | |
242 | struct fb_info *info) | |
243 | { | |
244 | struct s3c_fb_win *win = info->par; | |
ec549a0f BD |
245 | struct s3c_fb *sfb = win->parent; |
246 | ||
247 | dev_dbg(sfb->dev, "checking parameters\n"); | |
248 | ||
13e6af88 JH |
249 | var->xres_virtual = max(var->xres_virtual, var->xres); |
250 | var->yres_virtual = max(var->yres_virtual, var->yres); | |
ec549a0f | 251 | |
50a5503a | 252 | if (!s3c_fb_validate_win_bpp(win, var->bits_per_pixel)) { |
ec549a0f BD |
253 | dev_dbg(sfb->dev, "win %d: unsupported bpp %d\n", |
254 | win->index, var->bits_per_pixel); | |
255 | return -EINVAL; | |
256 | } | |
257 | ||
258 | /* always ensure these are zero, for drop through cases below */ | |
259 | var->transp.offset = 0; | |
260 | var->transp.length = 0; | |
261 | ||
262 | switch (var->bits_per_pixel) { | |
263 | case 1: | |
264 | case 2: | |
265 | case 4: | |
266 | case 8: | |
50a5503a | 267 | if (sfb->variant.palette[win->index] != 0) { |
ec549a0f BD |
268 | /* non palletised, A:1,R:2,G:3,B:2 mode */ |
269 | var->red.offset = 4; | |
270 | var->green.offset = 2; | |
271 | var->blue.offset = 0; | |
272 | var->red.length = 5; | |
273 | var->green.length = 3; | |
274 | var->blue.length = 2; | |
275 | var->transp.offset = 7; | |
276 | var->transp.length = 1; | |
277 | } else { | |
278 | var->red.offset = 0; | |
279 | var->red.length = var->bits_per_pixel; | |
280 | var->green = var->red; | |
281 | var->blue = var->red; | |
282 | } | |
283 | break; | |
284 | ||
285 | case 19: | |
286 | /* 666 with one bit alpha/transparency */ | |
287 | var->transp.offset = 18; | |
288 | var->transp.length = 1; | |
289 | case 18: | |
290 | var->bits_per_pixel = 32; | |
291 | ||
292 | /* 666 format */ | |
293 | var->red.offset = 12; | |
294 | var->green.offset = 6; | |
295 | var->blue.offset = 0; | |
296 | var->red.length = 6; | |
297 | var->green.length = 6; | |
298 | var->blue.length = 6; | |
299 | break; | |
300 | ||
301 | case 16: | |
302 | /* 16 bpp, 565 format */ | |
303 | var->red.offset = 11; | |
304 | var->green.offset = 5; | |
305 | var->blue.offset = 0; | |
306 | var->red.length = 5; | |
307 | var->green.length = 6; | |
308 | var->blue.length = 5; | |
309 | break; | |
310 | ||
af1ce6b2 | 311 | case 32: |
ec549a0f BD |
312 | case 28: |
313 | case 25: | |
314 | var->transp.length = var->bits_per_pixel - 24; | |
315 | var->transp.offset = 24; | |
316 | /* drop through */ | |
317 | case 24: | |
318 | /* our 24bpp is unpacked, so 32bpp */ | |
319 | var->bits_per_pixel = 32; | |
ec549a0f BD |
320 | var->red.offset = 16; |
321 | var->red.length = 8; | |
322 | var->green.offset = 8; | |
323 | var->green.length = 8; | |
324 | var->blue.offset = 0; | |
325 | var->blue.length = 8; | |
326 | break; | |
327 | ||
328 | default: | |
329 | dev_err(sfb->dev, "invalid bpp\n"); | |
330 | } | |
331 | ||
332 | dev_dbg(sfb->dev, "%s: verified parameters\n", __func__); | |
333 | return 0; | |
334 | } | |
335 | ||
336 | /** | |
337 | * s3c_fb_calc_pixclk() - calculate the divider to create the pixel clock. | |
338 | * @sfb: The hardware state. | |
339 | * @pixclock: The pixel clock wanted, in picoseconds. | |
340 | * | |
341 | * Given the specified pixel clock, work out the necessary divider to get | |
342 | * close to the output frequency. | |
343 | */ | |
eb29a5cc | 344 | static int s3c_fb_calc_pixclk(struct s3c_fb *sfb, unsigned int pixclk) |
ec549a0f | 345 | { |
b5480ed7 | 346 | unsigned long clk; |
eb29a5cc | 347 | unsigned long long tmp; |
ec549a0f BD |
348 | unsigned int result; |
349 | ||
b5480ed7 JH |
350 | if (sfb->variant.has_clksel) |
351 | clk = clk_get_rate(sfb->bus_clk); | |
352 | else | |
353 | clk = clk_get_rate(sfb->lcd_clk); | |
354 | ||
eb29a5cc MB |
355 | tmp = (unsigned long long)clk; |
356 | tmp *= pixclk; | |
357 | ||
358 | do_div(tmp, 1000000000UL); | |
359 | result = (unsigned int)tmp / 1000; | |
ec549a0f BD |
360 | |
361 | dev_dbg(sfb->dev, "pixclk=%u, clk=%lu, div=%d (%lu)\n", | |
362 | pixclk, clk, result, clk / result); | |
363 | ||
364 | return result; | |
365 | } | |
366 | ||
367 | /** | |
368 | * s3c_fb_align_word() - align pixel count to word boundary | |
369 | * @bpp: The number of bits per pixel | |
370 | * @pix: The value to be aligned. | |
371 | * | |
372 | * Align the given pixel count so that it will start on an 32bit word | |
373 | * boundary. | |
374 | */ | |
375 | static int s3c_fb_align_word(unsigned int bpp, unsigned int pix) | |
376 | { | |
377 | int pix_per_word; | |
378 | ||
379 | if (bpp > 16) | |
380 | return pix; | |
381 | ||
382 | pix_per_word = (8 * 32) / bpp; | |
383 | return ALIGN(pix, pix_per_word); | |
384 | } | |
385 | ||
f676ec2a PO |
386 | /** |
387 | * vidosd_set_size() - set OSD size for a window | |
388 | * | |
389 | * @win: the window to set OSD size for | |
390 | * @size: OSD size register value | |
391 | */ | |
392 | static void vidosd_set_size(struct s3c_fb_win *win, u32 size) | |
393 | { | |
394 | struct s3c_fb *sfb = win->parent; | |
395 | ||
396 | /* OSD can be set up if osd_size_off != 0 for this window */ | |
397 | if (win->variant.osd_size_off) | |
398 | writel(size, sfb->regs + OSD_BASE(win->index, sfb->variant) | |
399 | + win->variant.osd_size_off); | |
400 | } | |
401 | ||
402 | /** | |
403 | * vidosd_set_alpha() - set alpha transparency for a window | |
404 | * | |
405 | * @win: the window to set OSD size for | |
406 | * @alpha: alpha register value | |
407 | */ | |
408 | static void vidosd_set_alpha(struct s3c_fb_win *win, u32 alpha) | |
409 | { | |
410 | struct s3c_fb *sfb = win->parent; | |
411 | ||
412 | if (win->variant.has_osd_alpha) | |
413 | writel(alpha, sfb->regs + VIDOSD_C(win->index, sfb->variant)); | |
414 | } | |
415 | ||
f5ec546f PO |
416 | /** |
417 | * shadow_protect_win() - disable updating values from shadow registers at vsync | |
418 | * | |
419 | * @win: window to protect registers for | |
420 | * @protect: 1 to protect (disable updates) | |
421 | */ | |
422 | static void shadow_protect_win(struct s3c_fb_win *win, bool protect) | |
423 | { | |
424 | struct s3c_fb *sfb = win->parent; | |
425 | u32 reg; | |
426 | ||
427 | if (protect) { | |
428 | if (sfb->variant.has_prtcon) { | |
429 | writel(PRTCON_PROTECT, sfb->regs + PRTCON); | |
430 | } else if (sfb->variant.has_shadowcon) { | |
431 | reg = readl(sfb->regs + SHADOWCON); | |
432 | writel(reg | SHADOWCON_WINx_PROTECT(win->index), | |
433 | sfb->regs + SHADOWCON); | |
434 | } | |
435 | } else { | |
436 | if (sfb->variant.has_prtcon) { | |
437 | writel(0, sfb->regs + PRTCON); | |
438 | } else if (sfb->variant.has_shadowcon) { | |
439 | reg = readl(sfb->regs + SHADOWCON); | |
440 | writel(reg & ~SHADOWCON_WINx_PROTECT(win->index), | |
441 | sfb->regs + SHADOWCON); | |
442 | } | |
443 | } | |
444 | } | |
445 | ||
a2b77dce MB |
446 | /** |
447 | * s3c_fb_enable() - Set the state of the main LCD output | |
448 | * @sfb: The main framebuffer state. | |
449 | * @enable: The state to set. | |
450 | */ | |
451 | static void s3c_fb_enable(struct s3c_fb *sfb, int enable) | |
452 | { | |
453 | u32 vidcon0 = readl(sfb->regs + VIDCON0); | |
454 | ||
f4f51473 MB |
455 | if (enable && !sfb->output_on) |
456 | pm_runtime_get_sync(sfb->dev); | |
457 | ||
458 | if (enable) { | |
a2b77dce | 459 | vidcon0 |= VIDCON0_ENVID | VIDCON0_ENVID_F; |
f4f51473 | 460 | } else { |
a2b77dce MB |
461 | /* see the note in the framebuffer datasheet about |
462 | * why you cannot take both of these bits down at the | |
463 | * same time. */ | |
464 | ||
f4f51473 MB |
465 | if (vidcon0 & VIDCON0_ENVID) { |
466 | vidcon0 |= VIDCON0_ENVID; | |
467 | vidcon0 &= ~VIDCON0_ENVID_F; | |
468 | } | |
a2b77dce MB |
469 | } |
470 | ||
471 | writel(vidcon0, sfb->regs + VIDCON0); | |
f4f51473 MB |
472 | |
473 | if (!enable && sfb->output_on) | |
474 | pm_runtime_put_sync(sfb->dev); | |
475 | ||
476 | sfb->output_on = enable; | |
a2b77dce MB |
477 | } |
478 | ||
ec549a0f BD |
479 | /** |
480 | * s3c_fb_set_par() - framebuffer request to set new framebuffer state. | |
481 | * @info: The framebuffer to change. | |
482 | * | |
483 | * Framebuffer layer request to set a new mode for the specified framebuffer | |
484 | */ | |
485 | static int s3c_fb_set_par(struct fb_info *info) | |
486 | { | |
487 | struct fb_var_screeninfo *var = &info->var; | |
488 | struct s3c_fb_win *win = info->par; | |
489 | struct s3c_fb *sfb = win->parent; | |
490 | void __iomem *regs = sfb->regs; | |
c4bb6ffa | 491 | void __iomem *buf = regs; |
ec549a0f | 492 | int win_no = win->index; |
f676ec2a | 493 | u32 alpha = 0; |
ec549a0f BD |
494 | u32 data; |
495 | u32 pagewidth; | |
496 | int clkdiv; | |
497 | ||
498 | dev_dbg(sfb->dev, "setting framebuffer parameters\n"); | |
499 | ||
5751b23e MB |
500 | pm_runtime_get_sync(sfb->dev); |
501 | ||
a8bdabca PO |
502 | shadow_protect_win(win, 1); |
503 | ||
ec549a0f BD |
504 | switch (var->bits_per_pixel) { |
505 | case 32: | |
506 | case 24: | |
507 | case 16: | |
508 | case 12: | |
509 | info->fix.visual = FB_VISUAL_TRUECOLOR; | |
510 | break; | |
511 | case 8: | |
50a5503a | 512 | if (win->variant.palette_sz >= 256) |
ec549a0f BD |
513 | info->fix.visual = FB_VISUAL_PSEUDOCOLOR; |
514 | else | |
515 | info->fix.visual = FB_VISUAL_TRUECOLOR; | |
516 | break; | |
517 | case 1: | |
518 | info->fix.visual = FB_VISUAL_MONO01; | |
519 | break; | |
520 | default: | |
521 | info->fix.visual = FB_VISUAL_PSEUDOCOLOR; | |
522 | break; | |
523 | } | |
524 | ||
525 | info->fix.line_length = (var->xres_virtual * var->bits_per_pixel) / 8; | |
526 | ||
067b226b PO |
527 | info->fix.xpanstep = info->var.xres_virtual > info->var.xres ? 1 : 0; |
528 | info->fix.ypanstep = info->var.yres_virtual > info->var.yres ? 1 : 0; | |
529 | ||
ec549a0f BD |
530 | /* disable the window whilst we update it */ |
531 | writel(0, regs + WINCON(win_no)); | |
532 | ||
ad04490a | 533 | /* use platform specified window as the basis for the lcd timings */ |
ec549a0f | 534 | |
ad04490a | 535 | if (win_no == sfb->pdata->default_win) { |
eb29a5cc | 536 | clkdiv = s3c_fb_calc_pixclk(sfb, var->pixclock); |
ec549a0f BD |
537 | |
538 | data = sfb->pdata->vidcon0; | |
539 | data &= ~(VIDCON0_CLKVAL_F_MASK | VIDCON0_CLKDIR); | |
540 | ||
541 | if (clkdiv > 1) | |
542 | data |= VIDCON0_CLKVAL_F(clkdiv-1) | VIDCON0_CLKDIR; | |
543 | else | |
544 | data &= ~VIDCON0_CLKDIR; /* 1:1 clock */ | |
545 | ||
546 | /* write the timing data to the panel */ | |
547 | ||
c4bb6ffa BD |
548 | if (sfb->variant.is_2443) |
549 | data |= (1 << 5); | |
550 | ||
ec549a0f BD |
551 | writel(data, regs + VIDCON0); |
552 | ||
a2b77dce MB |
553 | s3c_fb_enable(sfb, 1); |
554 | ||
ec549a0f BD |
555 | data = VIDTCON0_VBPD(var->upper_margin - 1) | |
556 | VIDTCON0_VFPD(var->lower_margin - 1) | | |
557 | VIDTCON0_VSPW(var->vsync_len - 1); | |
558 | ||
c4bb6ffa | 559 | writel(data, regs + sfb->variant.vidtcon); |
ec549a0f BD |
560 | |
561 | data = VIDTCON1_HBPD(var->left_margin - 1) | | |
562 | VIDTCON1_HFPD(var->right_margin - 1) | | |
563 | VIDTCON1_HSPW(var->hsync_len - 1); | |
564 | ||
c4bb6ffa BD |
565 | /* VIDTCON1 */ |
566 | writel(data, regs + sfb->variant.vidtcon + 4); | |
ec549a0f BD |
567 | |
568 | data = VIDTCON2_LINEVAL(var->yres - 1) | | |
569 | VIDTCON2_HOZVAL(var->xres - 1); | |
b73a21fc | 570 | writel(data, regs + sfb->variant.vidtcon + 8); |
ec549a0f BD |
571 | } |
572 | ||
573 | /* write the buffer address */ | |
574 | ||
c4bb6ffa BD |
575 | /* start and end registers stride is 8 */ |
576 | buf = regs + win_no * 8; | |
577 | ||
578 | writel(info->fix.smem_start, buf + sfb->variant.buf_start); | |
ec549a0f BD |
579 | |
580 | data = info->fix.smem_start + info->fix.line_length * var->yres; | |
c4bb6ffa | 581 | writel(data, buf + sfb->variant.buf_end); |
ec549a0f BD |
582 | |
583 | pagewidth = (var->xres * var->bits_per_pixel) >> 3; | |
584 | data = VIDW_BUF_SIZE_OFFSET(info->fix.line_length - pagewidth) | | |
585 | VIDW_BUF_SIZE_PAGEWIDTH(pagewidth); | |
c4bb6ffa | 586 | writel(data, regs + sfb->variant.buf_size + (win_no * 4)); |
ec549a0f BD |
587 | |
588 | /* write 'OSD' registers to control position of framebuffer */ | |
589 | ||
590 | data = VIDOSDxA_TOPLEFT_X(0) | VIDOSDxA_TOPLEFT_Y(0); | |
c4bb6ffa | 591 | writel(data, regs + VIDOSD_A(win_no, sfb->variant)); |
ec549a0f BD |
592 | |
593 | data = VIDOSDxB_BOTRIGHT_X(s3c_fb_align_word(var->bits_per_pixel, | |
594 | var->xres - 1)) | | |
595 | VIDOSDxB_BOTRIGHT_Y(var->yres - 1); | |
596 | ||
c4bb6ffa | 597 | writel(data, regs + VIDOSD_B(win_no, sfb->variant)); |
ec549a0f BD |
598 | |
599 | data = var->xres * var->yres; | |
39000d65 | 600 | |
f676ec2a | 601 | alpha = VIDISD14C_ALPHA1_R(0xf) | |
39000d65 ID |
602 | VIDISD14C_ALPHA1_G(0xf) | |
603 | VIDISD14C_ALPHA1_B(0xf); | |
604 | ||
f676ec2a PO |
605 | vidosd_set_alpha(win, alpha); |
606 | vidosd_set_size(win, data); | |
ec549a0f | 607 | |
fab7c5b7 JH |
608 | /* Enable DMA channel for this window */ |
609 | if (sfb->variant.has_shadowcon) { | |
610 | data = readl(sfb->regs + SHADOWCON); | |
611 | data |= SHADOWCON_CHx_ENABLE(win_no); | |
612 | writel(data, sfb->regs + SHADOWCON); | |
613 | } | |
614 | ||
ec549a0f | 615 | data = WINCONx_ENWIN; |
2d9ae7ac | 616 | sfb->enabled |= (1 << win->index); |
ec549a0f BD |
617 | |
618 | /* note, since we have to round up the bits-per-pixel, we end up | |
619 | * relying on the bitfield information for r/g/b/a to work out | |
620 | * exactly which mode of operation is intended. */ | |
621 | ||
622 | switch (var->bits_per_pixel) { | |
623 | case 1: | |
624 | data |= WINCON0_BPPMODE_1BPP; | |
625 | data |= WINCONx_BITSWP; | |
626 | data |= WINCONx_BURSTLEN_4WORD; | |
627 | break; | |
628 | case 2: | |
629 | data |= WINCON0_BPPMODE_2BPP; | |
630 | data |= WINCONx_BITSWP; | |
631 | data |= WINCONx_BURSTLEN_8WORD; | |
632 | break; | |
633 | case 4: | |
634 | data |= WINCON0_BPPMODE_4BPP; | |
635 | data |= WINCONx_BITSWP; | |
636 | data |= WINCONx_BURSTLEN_8WORD; | |
637 | break; | |
638 | case 8: | |
639 | if (var->transp.length != 0) | |
640 | data |= WINCON1_BPPMODE_8BPP_1232; | |
641 | else | |
642 | data |= WINCON0_BPPMODE_8BPP_PALETTE; | |
643 | data |= WINCONx_BURSTLEN_8WORD; | |
644 | data |= WINCONx_BYTSWP; | |
645 | break; | |
646 | case 16: | |
647 | if (var->transp.length != 0) | |
648 | data |= WINCON1_BPPMODE_16BPP_A1555; | |
649 | else | |
650 | data |= WINCON0_BPPMODE_16BPP_565; | |
651 | data |= WINCONx_HAWSWP; | |
652 | data |= WINCONx_BURSTLEN_16WORD; | |
653 | break; | |
654 | case 24: | |
655 | case 32: | |
656 | if (var->red.length == 6) { | |
657 | if (var->transp.length != 0) | |
658 | data |= WINCON1_BPPMODE_19BPP_A1666; | |
659 | else | |
660 | data |= WINCON1_BPPMODE_18BPP_666; | |
39000d65 ID |
661 | } else if (var->transp.length == 1) |
662 | data |= WINCON1_BPPMODE_25BPP_A1888 | |
663 | | WINCON1_BLD_PIX; | |
4420dd2b JH |
664 | else if ((var->transp.length == 4) || |
665 | (var->transp.length == 8)) | |
39000d65 ID |
666 | data |= WINCON1_BPPMODE_28BPP_A4888 |
667 | | WINCON1_BLD_PIX | WINCON1_ALPHA_SEL; | |
ec549a0f BD |
668 | else |
669 | data |= WINCON0_BPPMODE_24BPP_888; | |
670 | ||
dc8498c0 | 671 | data |= WINCONx_WSWP; |
ec549a0f BD |
672 | data |= WINCONx_BURSTLEN_16WORD; |
673 | break; | |
674 | } | |
675 | ||
c4bb6ffa | 676 | /* Enable the colour keying for the window below this one */ |
39000d65 ID |
677 | if (win_no > 0) { |
678 | u32 keycon0_data = 0, keycon1_data = 0; | |
c4bb6ffa | 679 | void __iomem *keycon = regs + sfb->variant.keycon; |
39000d65 ID |
680 | |
681 | keycon0_data = ~(WxKEYCON0_KEYBL_EN | | |
682 | WxKEYCON0_KEYEN_F | | |
683 | WxKEYCON0_DIRCON) | WxKEYCON0_COMPKEY(0); | |
684 | ||
685 | keycon1_data = WxKEYCON1_COLVAL(0xffffff); | |
686 | ||
c4bb6ffa BD |
687 | keycon += (win_no - 1) * 8; |
688 | ||
689 | writel(keycon0_data, keycon + WKEYCON0); | |
690 | writel(keycon1_data, keycon + WKEYCON1); | |
39000d65 ID |
691 | } |
692 | ||
c4bb6ffa BD |
693 | writel(data, regs + sfb->variant.wincon + (win_no * 4)); |
694 | writel(0x0, regs + sfb->variant.winmap + (win_no * 4)); | |
ec549a0f | 695 | |
f7f31e50 JH |
696 | /* Set alpha value width */ |
697 | if (sfb->variant.has_blendcon) { | |
698 | data = readl(sfb->regs + BLENDCON); | |
699 | data &= ~BLENDCON_NEW_MASK; | |
700 | if (var->transp.length > 4) | |
701 | data |= BLENDCON_NEW_8BIT_ALPHA_VALUE; | |
702 | else | |
703 | data |= BLENDCON_NEW_4BIT_ALPHA_VALUE; | |
704 | writel(data, sfb->regs + BLENDCON); | |
705 | } | |
706 | ||
a8bdabca PO |
707 | shadow_protect_win(win, 0); |
708 | ||
5751b23e MB |
709 | pm_runtime_put_sync(sfb->dev); |
710 | ||
ec549a0f BD |
711 | return 0; |
712 | } | |
713 | ||
714 | /** | |
715 | * s3c_fb_update_palette() - set or schedule a palette update. | |
716 | * @sfb: The hardware information. | |
717 | * @win: The window being updated. | |
718 | * @reg: The palette index being changed. | |
719 | * @value: The computed palette value. | |
720 | * | |
721 | * Change the value of a palette register, either by directly writing to | |
722 | * the palette (this requires the palette RAM to be disconnected from the | |
723 | * hardware whilst this is in progress) or schedule the update for later. | |
724 | * | |
725 | * At the moment, since we have no VSYNC interrupt support, we simply set | |
726 | * the palette entry directly. | |
727 | */ | |
728 | static void s3c_fb_update_palette(struct s3c_fb *sfb, | |
729 | struct s3c_fb_win *win, | |
730 | unsigned int reg, | |
731 | u32 value) | |
732 | { | |
733 | void __iomem *palreg; | |
734 | u32 palcon; | |
735 | ||
50a5503a | 736 | palreg = sfb->regs + sfb->variant.palette[win->index]; |
ec549a0f BD |
737 | |
738 | dev_dbg(sfb->dev, "%s: win %d, reg %d (%p): %08x\n", | |
739 | __func__, win->index, reg, palreg, value); | |
740 | ||
741 | win->palette_buffer[reg] = value; | |
742 | ||
743 | palcon = readl(sfb->regs + WPALCON); | |
744 | writel(palcon | WPALCON_PAL_UPDATE, sfb->regs + WPALCON); | |
745 | ||
50a5503a BD |
746 | if (win->variant.palette_16bpp) |
747 | writew(value, palreg + (reg * 2)); | |
ec549a0f | 748 | else |
50a5503a | 749 | writel(value, palreg + (reg * 4)); |
ec549a0f BD |
750 | |
751 | writel(palcon, sfb->regs + WPALCON); | |
752 | } | |
753 | ||
754 | static inline unsigned int chan_to_field(unsigned int chan, | |
755 | struct fb_bitfield *bf) | |
756 | { | |
757 | chan &= 0xffff; | |
758 | chan >>= 16 - bf->length; | |
759 | return chan << bf->offset; | |
760 | } | |
761 | ||
762 | /** | |
763 | * s3c_fb_setcolreg() - framebuffer layer request to change palette. | |
764 | * @regno: The palette index to change. | |
765 | * @red: The red field for the palette data. | |
766 | * @green: The green field for the palette data. | |
767 | * @blue: The blue field for the palette data. | |
768 | * @trans: The transparency (alpha) field for the palette data. | |
769 | * @info: The framebuffer being changed. | |
770 | */ | |
771 | static int s3c_fb_setcolreg(unsigned regno, | |
772 | unsigned red, unsigned green, unsigned blue, | |
773 | unsigned transp, struct fb_info *info) | |
774 | { | |
775 | struct s3c_fb_win *win = info->par; | |
776 | struct s3c_fb *sfb = win->parent; | |
777 | unsigned int val; | |
778 | ||
779 | dev_dbg(sfb->dev, "%s: win %d: %d => rgb=%d/%d/%d\n", | |
780 | __func__, win->index, regno, red, green, blue); | |
781 | ||
5751b23e MB |
782 | pm_runtime_get_sync(sfb->dev); |
783 | ||
ec549a0f BD |
784 | switch (info->fix.visual) { |
785 | case FB_VISUAL_TRUECOLOR: | |
786 | /* true-colour, use pseudo-palette */ | |
787 | ||
788 | if (regno < 16) { | |
789 | u32 *pal = info->pseudo_palette; | |
790 | ||
791 | val = chan_to_field(red, &info->var.red); | |
792 | val |= chan_to_field(green, &info->var.green); | |
793 | val |= chan_to_field(blue, &info->var.blue); | |
794 | ||
795 | pal[regno] = val; | |
796 | } | |
797 | break; | |
798 | ||
799 | case FB_VISUAL_PSEUDOCOLOR: | |
50a5503a | 800 | if (regno < win->variant.palette_sz) { |
ec549a0f BD |
801 | val = chan_to_field(red, &win->palette.r); |
802 | val |= chan_to_field(green, &win->palette.g); | |
803 | val |= chan_to_field(blue, &win->palette.b); | |
804 | ||
805 | s3c_fb_update_palette(sfb, win, regno, val); | |
806 | } | |
807 | ||
808 | break; | |
809 | ||
810 | default: | |
5751b23e | 811 | pm_runtime_put_sync(sfb->dev); |
ec549a0f BD |
812 | return 1; /* unknown type */ |
813 | } | |
814 | ||
5751b23e | 815 | pm_runtime_put_sync(sfb->dev); |
ec549a0f BD |
816 | return 0; |
817 | } | |
818 | ||
ec549a0f BD |
819 | /** |
820 | * s3c_fb_blank() - blank or unblank the given window | |
821 | * @blank_mode: The blank state from FB_BLANK_* | |
822 | * @info: The framebuffer to blank. | |
823 | * | |
824 | * Framebuffer layer request to change the power state. | |
825 | */ | |
826 | static int s3c_fb_blank(int blank_mode, struct fb_info *info) | |
827 | { | |
828 | struct s3c_fb_win *win = info->par; | |
829 | struct s3c_fb *sfb = win->parent; | |
830 | unsigned int index = win->index; | |
831 | u32 wincon; | |
832 | ||
833 | dev_dbg(sfb->dev, "blank mode %d\n", blank_mode); | |
834 | ||
5751b23e MB |
835 | pm_runtime_get_sync(sfb->dev); |
836 | ||
c4bb6ffa | 837 | wincon = readl(sfb->regs + sfb->variant.wincon + (index * 4)); |
ec549a0f BD |
838 | |
839 | switch (blank_mode) { | |
840 | case FB_BLANK_POWERDOWN: | |
841 | wincon &= ~WINCONx_ENWIN; | |
842 | sfb->enabled &= ~(1 << index); | |
843 | /* fall through to FB_BLANK_NORMAL */ | |
844 | ||
845 | case FB_BLANK_NORMAL: | |
846 | /* disable the DMA and display 0x0 (black) */ | |
ff8c9107 | 847 | shadow_protect_win(win, 1); |
ec549a0f | 848 | writel(WINxMAP_MAP | WINxMAP_MAP_COLOUR(0x0), |
c4bb6ffa | 849 | sfb->regs + sfb->variant.winmap + (index * 4)); |
ff8c9107 | 850 | shadow_protect_win(win, 0); |
ec549a0f BD |
851 | break; |
852 | ||
853 | case FB_BLANK_UNBLANK: | |
ff8c9107 | 854 | shadow_protect_win(win, 1); |
c4bb6ffa | 855 | writel(0x0, sfb->regs + sfb->variant.winmap + (index * 4)); |
ff8c9107 | 856 | shadow_protect_win(win, 0); |
ec549a0f BD |
857 | wincon |= WINCONx_ENWIN; |
858 | sfb->enabled |= (1 << index); | |
859 | break; | |
860 | ||
861 | case FB_BLANK_VSYNC_SUSPEND: | |
862 | case FB_BLANK_HSYNC_SUSPEND: | |
863 | default: | |
5751b23e | 864 | pm_runtime_put_sync(sfb->dev); |
ec549a0f BD |
865 | return 1; |
866 | } | |
867 | ||
ff8c9107 | 868 | shadow_protect_win(win, 1); |
c4bb6ffa | 869 | writel(wincon, sfb->regs + sfb->variant.wincon + (index * 4)); |
ff8c9107 | 870 | shadow_protect_win(win, 0); |
ec549a0f BD |
871 | |
872 | /* Check the enabled state to see if we need to be running the | |
873 | * main LCD interface, as if there are no active windows then | |
874 | * it is highly likely that we also do not need to output | |
875 | * anything. | |
876 | */ | |
877 | ||
878 | /* We could do something like the following code, but the current | |
879 | * system of using framebuffer events means that we cannot make | |
880 | * the distinction between just window 0 being inactive and all | |
881 | * the windows being down. | |
882 | * | |
883 | * s3c_fb_enable(sfb, sfb->enabled ? 1 : 0); | |
884 | */ | |
885 | ||
886 | /* we're stuck with this until we can do something about overriding | |
887 | * the power control using the blanking event for a single fb. | |
888 | */ | |
ff8c9107 JH |
889 | if (index == sfb->pdata->default_win) { |
890 | shadow_protect_win(win, 1); | |
ec549a0f | 891 | s3c_fb_enable(sfb, blank_mode != FB_BLANK_POWERDOWN ? 1 : 0); |
ff8c9107 JH |
892 | shadow_protect_win(win, 0); |
893 | } | |
ec549a0f | 894 | |
5751b23e MB |
895 | pm_runtime_put_sync(sfb->dev); |
896 | ||
ec549a0f BD |
897 | return 0; |
898 | } | |
899 | ||
067b226b PO |
900 | /** |
901 | * s3c_fb_pan_display() - Pan the display. | |
902 | * | |
903 | * Note that the offsets can be written to the device at any time, as their | |
904 | * values are latched at each vsync automatically. This also means that only | |
905 | * the last call to this function will have any effect on next vsync, but | |
906 | * there is no need to sleep waiting for it to prevent tearing. | |
907 | * | |
908 | * @var: The screen information to verify. | |
909 | * @info: The framebuffer device. | |
910 | */ | |
911 | static int s3c_fb_pan_display(struct fb_var_screeninfo *var, | |
912 | struct fb_info *info) | |
913 | { | |
914 | struct s3c_fb_win *win = info->par; | |
915 | struct s3c_fb *sfb = win->parent; | |
916 | void __iomem *buf = sfb->regs + win->index * 8; | |
917 | unsigned int start_boff, end_boff; | |
918 | ||
5751b23e MB |
919 | pm_runtime_get_sync(sfb->dev); |
920 | ||
067b226b PO |
921 | /* Offset in bytes to the start of the displayed area */ |
922 | start_boff = var->yoffset * info->fix.line_length; | |
923 | /* X offset depends on the current bpp */ | |
924 | if (info->var.bits_per_pixel >= 8) { | |
925 | start_boff += var->xoffset * (info->var.bits_per_pixel >> 3); | |
926 | } else { | |
927 | switch (info->var.bits_per_pixel) { | |
928 | case 4: | |
929 | start_boff += var->xoffset >> 1; | |
930 | break; | |
931 | case 2: | |
932 | start_boff += var->xoffset >> 2; | |
933 | break; | |
934 | case 1: | |
935 | start_boff += var->xoffset >> 3; | |
936 | break; | |
937 | default: | |
938 | dev_err(sfb->dev, "invalid bpp\n"); | |
5751b23e | 939 | pm_runtime_put_sync(sfb->dev); |
067b226b PO |
940 | return -EINVAL; |
941 | } | |
942 | } | |
943 | /* Offset in bytes to the end of the displayed area */ | |
d8e7a74b | 944 | end_boff = start_boff + info->var.yres * info->fix.line_length; |
067b226b PO |
945 | |
946 | /* Temporarily turn off per-vsync update from shadow registers until | |
947 | * both start and end addresses are updated to prevent corruption */ | |
f5ec546f | 948 | shadow_protect_win(win, 1); |
067b226b PO |
949 | |
950 | writel(info->fix.smem_start + start_boff, buf + sfb->variant.buf_start); | |
951 | writel(info->fix.smem_start + end_boff, buf + sfb->variant.buf_end); | |
952 | ||
f5ec546f | 953 | shadow_protect_win(win, 0); |
067b226b | 954 | |
5751b23e | 955 | pm_runtime_put_sync(sfb->dev); |
067b226b PO |
956 | return 0; |
957 | } | |
958 | ||
efdc846d PO |
959 | /** |
960 | * s3c_fb_enable_irq() - enable framebuffer interrupts | |
961 | * @sfb: main hardware state | |
962 | */ | |
963 | static void s3c_fb_enable_irq(struct s3c_fb *sfb) | |
964 | { | |
965 | void __iomem *regs = sfb->regs; | |
966 | u32 irq_ctrl_reg; | |
967 | ||
968 | if (!test_and_set_bit(S3C_FB_VSYNC_IRQ_EN, &sfb->irq_flags)) { | |
969 | /* IRQ disabled, enable it */ | |
970 | irq_ctrl_reg = readl(regs + VIDINTCON0); | |
971 | ||
972 | irq_ctrl_reg |= VIDINTCON0_INT_ENABLE; | |
973 | irq_ctrl_reg |= VIDINTCON0_INT_FRAME; | |
974 | ||
975 | irq_ctrl_reg &= ~VIDINTCON0_FRAMESEL0_MASK; | |
976 | irq_ctrl_reg |= VIDINTCON0_FRAMESEL0_VSYNC; | |
977 | irq_ctrl_reg &= ~VIDINTCON0_FRAMESEL1_MASK; | |
978 | irq_ctrl_reg |= VIDINTCON0_FRAMESEL1_NONE; | |
979 | ||
980 | writel(irq_ctrl_reg, regs + VIDINTCON0); | |
981 | } | |
982 | } | |
983 | ||
984 | /** | |
985 | * s3c_fb_disable_irq() - disable framebuffer interrupts | |
986 | * @sfb: main hardware state | |
987 | */ | |
988 | static void s3c_fb_disable_irq(struct s3c_fb *sfb) | |
989 | { | |
990 | void __iomem *regs = sfb->regs; | |
991 | u32 irq_ctrl_reg; | |
992 | ||
993 | if (test_and_clear_bit(S3C_FB_VSYNC_IRQ_EN, &sfb->irq_flags)) { | |
994 | /* IRQ enabled, disable it */ | |
995 | irq_ctrl_reg = readl(regs + VIDINTCON0); | |
996 | ||
997 | irq_ctrl_reg &= ~VIDINTCON0_INT_FRAME; | |
998 | irq_ctrl_reg &= ~VIDINTCON0_INT_ENABLE; | |
999 | ||
1000 | writel(irq_ctrl_reg, regs + VIDINTCON0); | |
1001 | } | |
1002 | } | |
1003 | ||
1004 | static irqreturn_t s3c_fb_irq(int irq, void *dev_id) | |
1005 | { | |
1006 | struct s3c_fb *sfb = dev_id; | |
1007 | void __iomem *regs = sfb->regs; | |
1008 | u32 irq_sts_reg; | |
1009 | ||
b07f3bbe JH |
1010 | spin_lock(&sfb->slock); |
1011 | ||
efdc846d PO |
1012 | irq_sts_reg = readl(regs + VIDINTCON1); |
1013 | ||
1014 | if (irq_sts_reg & VIDINTCON1_INT_FRAME) { | |
1015 | ||
1016 | /* VSYNC interrupt, accept it */ | |
1017 | writel(VIDINTCON1_INT_FRAME, regs + VIDINTCON1); | |
1018 | ||
1019 | sfb->vsync_info.count++; | |
1020 | wake_up_interruptible(&sfb->vsync_info.wait); | |
1021 | } | |
1022 | ||
1023 | /* We only support waiting for VSYNC for now, so it's safe | |
1024 | * to always disable irqs here. | |
1025 | */ | |
1026 | s3c_fb_disable_irq(sfb); | |
1027 | ||
b07f3bbe | 1028 | spin_unlock(&sfb->slock); |
efdc846d PO |
1029 | return IRQ_HANDLED; |
1030 | } | |
1031 | ||
1032 | /** | |
1033 | * s3c_fb_wait_for_vsync() - sleep until next VSYNC interrupt or timeout | |
1034 | * @sfb: main hardware state | |
1035 | * @crtc: head index. | |
1036 | */ | |
1037 | static int s3c_fb_wait_for_vsync(struct s3c_fb *sfb, u32 crtc) | |
1038 | { | |
1039 | unsigned long count; | |
1040 | int ret; | |
1041 | ||
1042 | if (crtc != 0) | |
1043 | return -ENODEV; | |
1044 | ||
5751b23e MB |
1045 | pm_runtime_get_sync(sfb->dev); |
1046 | ||
efdc846d PO |
1047 | count = sfb->vsync_info.count; |
1048 | s3c_fb_enable_irq(sfb); | |
1049 | ret = wait_event_interruptible_timeout(sfb->vsync_info.wait, | |
1050 | count != sfb->vsync_info.count, | |
1051 | msecs_to_jiffies(VSYNC_TIMEOUT_MSEC)); | |
5751b23e MB |
1052 | |
1053 | pm_runtime_put_sync(sfb->dev); | |
1054 | ||
efdc846d PO |
1055 | if (ret == 0) |
1056 | return -ETIMEDOUT; | |
1057 | ||
1058 | return 0; | |
1059 | } | |
1060 | ||
1061 | static int s3c_fb_ioctl(struct fb_info *info, unsigned int cmd, | |
1062 | unsigned long arg) | |
1063 | { | |
1064 | struct s3c_fb_win *win = info->par; | |
1065 | struct s3c_fb *sfb = win->parent; | |
1066 | int ret; | |
1067 | u32 crtc; | |
1068 | ||
1069 | switch (cmd) { | |
1070 | case FBIO_WAITFORVSYNC: | |
1071 | if (get_user(crtc, (u32 __user *)arg)) { | |
1072 | ret = -EFAULT; | |
1073 | break; | |
1074 | } | |
1075 | ||
1076 | ret = s3c_fb_wait_for_vsync(sfb, crtc); | |
1077 | break; | |
1078 | default: | |
1079 | ret = -ENOTTY; | |
1080 | } | |
1081 | ||
1082 | return ret; | |
1083 | } | |
1084 | ||
ec549a0f BD |
1085 | static struct fb_ops s3c_fb_ops = { |
1086 | .owner = THIS_MODULE, | |
1087 | .fb_check_var = s3c_fb_check_var, | |
1088 | .fb_set_par = s3c_fb_set_par, | |
1089 | .fb_blank = s3c_fb_blank, | |
1090 | .fb_setcolreg = s3c_fb_setcolreg, | |
1091 | .fb_fillrect = cfb_fillrect, | |
1092 | .fb_copyarea = cfb_copyarea, | |
1093 | .fb_imageblit = cfb_imageblit, | |
067b226b | 1094 | .fb_pan_display = s3c_fb_pan_display, |
efdc846d | 1095 | .fb_ioctl = s3c_fb_ioctl, |
ec549a0f BD |
1096 | }; |
1097 | ||
2bb567a3 MC |
1098 | /** |
1099 | * s3c_fb_missing_pixclock() - calculates pixel clock | |
1100 | * @mode: The video mode to change. | |
1101 | * | |
1102 | * Calculate the pixel clock when none has been given through platform data. | |
1103 | */ | |
1104 | static void __devinit s3c_fb_missing_pixclock(struct fb_videomode *mode) | |
1105 | { | |
1106 | u64 pixclk = 1000000000000ULL; | |
1107 | u32 div; | |
1108 | ||
1109 | div = mode->left_margin + mode->hsync_len + mode->right_margin + | |
1110 | mode->xres; | |
1111 | div *= mode->upper_margin + mode->vsync_len + mode->lower_margin + | |
1112 | mode->yres; | |
1113 | div *= mode->refresh ? : 60; | |
1114 | ||
1115 | do_div(pixclk, div); | |
1116 | ||
1117 | mode->pixclock = pixclk; | |
1118 | } | |
1119 | ||
ec549a0f BD |
1120 | /** |
1121 | * s3c_fb_alloc_memory() - allocate display memory for framebuffer window | |
1122 | * @sfb: The base resources for the hardware. | |
1123 | * @win: The window to initialise memory for. | |
1124 | * | |
1125 | * Allocate memory for the given framebuffer. | |
1126 | */ | |
1127 | static int __devinit s3c_fb_alloc_memory(struct s3c_fb *sfb, | |
1128 | struct s3c_fb_win *win) | |
1129 | { | |
1130 | struct s3c_fb_pd_win *windata = win->windata; | |
1131 | unsigned int real_size, virt_size, size; | |
1132 | struct fb_info *fbi = win->fbinfo; | |
1133 | dma_addr_t map_dma; | |
1134 | ||
1135 | dev_dbg(sfb->dev, "allocating memory for display\n"); | |
1136 | ||
1137 | real_size = windata->win_mode.xres * windata->win_mode.yres; | |
1138 | virt_size = windata->virtual_x * windata->virtual_y; | |
1139 | ||
1140 | dev_dbg(sfb->dev, "real_size=%u (%u.%u), virt_size=%u (%u.%u)\n", | |
1141 | real_size, windata->win_mode.xres, windata->win_mode.yres, | |
1142 | virt_size, windata->virtual_x, windata->virtual_y); | |
1143 | ||
1144 | size = (real_size > virt_size) ? real_size : virt_size; | |
1145 | size *= (windata->max_bpp > 16) ? 32 : windata->max_bpp; | |
1146 | size /= 8; | |
1147 | ||
1148 | fbi->fix.smem_len = size; | |
1149 | size = PAGE_ALIGN(size); | |
1150 | ||
1151 | dev_dbg(sfb->dev, "want %u bytes for window\n", size); | |
1152 | ||
1153 | fbi->screen_base = dma_alloc_writecombine(sfb->dev, size, | |
1154 | &map_dma, GFP_KERNEL); | |
1155 | if (!fbi->screen_base) | |
1156 | return -ENOMEM; | |
1157 | ||
1158 | dev_dbg(sfb->dev, "mapped %x to %p\n", | |
1159 | (unsigned int)map_dma, fbi->screen_base); | |
1160 | ||
1161 | memset(fbi->screen_base, 0x0, size); | |
1162 | fbi->fix.smem_start = map_dma; | |
1163 | ||
1164 | return 0; | |
1165 | } | |
1166 | ||
1167 | /** | |
1168 | * s3c_fb_free_memory() - free the display memory for the given window | |
1169 | * @sfb: The base resources for the hardware. | |
1170 | * @win: The window to free the display memory for. | |
1171 | * | |
1172 | * Free the display memory allocated by s3c_fb_alloc_memory(). | |
1173 | */ | |
1174 | static void s3c_fb_free_memory(struct s3c_fb *sfb, struct s3c_fb_win *win) | |
1175 | { | |
1176 | struct fb_info *fbi = win->fbinfo; | |
1177 | ||
cd7d7e02 PO |
1178 | if (fbi->screen_base) |
1179 | dma_free_writecombine(sfb->dev, PAGE_ALIGN(fbi->fix.smem_len), | |
ec549a0f BD |
1180 | fbi->screen_base, fbi->fix.smem_start); |
1181 | } | |
1182 | ||
1183 | /** | |
1184 | * s3c_fb_release_win() - release resources for a framebuffer window. | |
1185 | * @win: The window to cleanup the resources for. | |
1186 | * | |
1187 | * Release the resources that where claimed for the hardware window, | |
1188 | * such as the framebuffer instance and any memory claimed for it. | |
1189 | */ | |
1190 | static void s3c_fb_release_win(struct s3c_fb *sfb, struct s3c_fb_win *win) | |
1191 | { | |
04ab9ef9 PO |
1192 | u32 data; |
1193 | ||
ddc518d9 | 1194 | if (win->fbinfo) { |
04ab9ef9 PO |
1195 | if (sfb->variant.has_shadowcon) { |
1196 | data = readl(sfb->regs + SHADOWCON); | |
1197 | data &= ~SHADOWCON_CHx_ENABLE(win->index); | |
1198 | data &= ~SHADOWCON_CHx_LOCAL_ENABLE(win->index); | |
1199 | writel(data, sfb->regs + SHADOWCON); | |
1200 | } | |
ddc518d9 | 1201 | unregister_framebuffer(win->fbinfo); |
cd7d7e02 PO |
1202 | if (win->fbinfo->cmap.len) |
1203 | fb_dealloc_cmap(&win->fbinfo->cmap); | |
ddc518d9 KH |
1204 | s3c_fb_free_memory(sfb, win); |
1205 | framebuffer_release(win->fbinfo); | |
1206 | } | |
ec549a0f BD |
1207 | } |
1208 | ||
1209 | /** | |
1210 | * s3c_fb_probe_win() - register an hardware window | |
1211 | * @sfb: The base resources for the hardware | |
50a5503a | 1212 | * @variant: The variant information for this window. |
ec549a0f BD |
1213 | * @res: Pointer to where to place the resultant window. |
1214 | * | |
1215 | * Allocate and do the basic initialisation for one of the hardware's graphics | |
1216 | * windows. | |
1217 | */ | |
1218 | static int __devinit s3c_fb_probe_win(struct s3c_fb *sfb, unsigned int win_no, | |
50a5503a | 1219 | struct s3c_fb_win_variant *variant, |
ec549a0f BD |
1220 | struct s3c_fb_win **res) |
1221 | { | |
1222 | struct fb_var_screeninfo *var; | |
1223 | struct fb_videomode *initmode; | |
1224 | struct s3c_fb_pd_win *windata; | |
1225 | struct s3c_fb_win *win; | |
1226 | struct fb_info *fbinfo; | |
1227 | int palette_size; | |
1228 | int ret; | |
1229 | ||
c4bb6ffa | 1230 | dev_dbg(sfb->dev, "probing window %d, variant %p\n", win_no, variant); |
ec549a0f | 1231 | |
efdc846d PO |
1232 | init_waitqueue_head(&sfb->vsync_info.wait); |
1233 | ||
50a5503a | 1234 | palette_size = variant->palette_sz * 4; |
ec549a0f BD |
1235 | |
1236 | fbinfo = framebuffer_alloc(sizeof(struct s3c_fb_win) + | |
1237 | palette_size * sizeof(u32), sfb->dev); | |
1238 | if (!fbinfo) { | |
1239 | dev_err(sfb->dev, "failed to allocate framebuffer\n"); | |
1240 | return -ENOENT; | |
1241 | } | |
1242 | ||
1243 | windata = sfb->pdata->win[win_no]; | |
1244 | initmode = &windata->win_mode; | |
1245 | ||
1246 | WARN_ON(windata->max_bpp == 0); | |
1247 | WARN_ON(windata->win_mode.xres == 0); | |
1248 | WARN_ON(windata->win_mode.yres == 0); | |
1249 | ||
1250 | win = fbinfo->par; | |
cd7d7e02 | 1251 | *res = win; |
ec549a0f | 1252 | var = &fbinfo->var; |
50a5503a | 1253 | win->variant = *variant; |
ec549a0f BD |
1254 | win->fbinfo = fbinfo; |
1255 | win->parent = sfb; | |
1256 | win->windata = windata; | |
1257 | win->index = win_no; | |
1258 | win->palette_buffer = (u32 *)(win + 1); | |
1259 | ||
1260 | ret = s3c_fb_alloc_memory(sfb, win); | |
1261 | if (ret) { | |
1262 | dev_err(sfb->dev, "failed to allocate display memory\n"); | |
ddc518d9 | 1263 | return ret; |
ec549a0f BD |
1264 | } |
1265 | ||
1266 | /* setup the r/b/g positions for the window's palette */ | |
bc2da1b6 BD |
1267 | if (win->variant.palette_16bpp) { |
1268 | /* Set RGB 5:6:5 as default */ | |
1269 | win->palette.r.offset = 11; | |
1270 | win->palette.r.length = 5; | |
1271 | win->palette.g.offset = 5; | |
1272 | win->palette.g.length = 6; | |
1273 | win->palette.b.offset = 0; | |
1274 | win->palette.b.length = 5; | |
1275 | ||
1276 | } else { | |
1277 | /* Set 8bpp or 8bpp and 1bit alpha */ | |
1278 | win->palette.r.offset = 16; | |
1279 | win->palette.r.length = 8; | |
1280 | win->palette.g.offset = 8; | |
1281 | win->palette.g.length = 8; | |
1282 | win->palette.b.offset = 0; | |
1283 | win->palette.b.length = 8; | |
1284 | } | |
ec549a0f BD |
1285 | |
1286 | /* setup the initial video mode from the window */ | |
1287 | fb_videomode_to_var(&fbinfo->var, initmode); | |
1288 | ||
1289 | fbinfo->fix.type = FB_TYPE_PACKED_PIXELS; | |
1290 | fbinfo->fix.accel = FB_ACCEL_NONE; | |
1291 | fbinfo->var.activate = FB_ACTIVATE_NOW; | |
1292 | fbinfo->var.vmode = FB_VMODE_NONINTERLACED; | |
1293 | fbinfo->var.bits_per_pixel = windata->default_bpp; | |
1294 | fbinfo->fbops = &s3c_fb_ops; | |
1295 | fbinfo->flags = FBINFO_FLAG_DEFAULT; | |
1296 | fbinfo->pseudo_palette = &win->pseudo_palette; | |
1297 | ||
1298 | /* prepare to actually start the framebuffer */ | |
1299 | ||
1300 | ret = s3c_fb_check_var(&fbinfo->var, fbinfo); | |
1301 | if (ret < 0) { | |
1302 | dev_err(sfb->dev, "check_var failed on initial video params\n"); | |
ddc518d9 | 1303 | return ret; |
ec549a0f BD |
1304 | } |
1305 | ||
1306 | /* create initial colour map */ | |
1307 | ||
50a5503a | 1308 | ret = fb_alloc_cmap(&fbinfo->cmap, win->variant.palette_sz, 1); |
ec549a0f BD |
1309 | if (ret == 0) |
1310 | fb_set_cmap(&fbinfo->cmap, fbinfo); | |
1311 | else | |
1312 | dev_err(sfb->dev, "failed to allocate fb cmap\n"); | |
1313 | ||
1314 | s3c_fb_set_par(fbinfo); | |
1315 | ||
1316 | dev_dbg(sfb->dev, "about to register framebuffer\n"); | |
1317 | ||
1318 | /* run the check_var and set_par on our configuration. */ | |
1319 | ||
1320 | ret = register_framebuffer(fbinfo); | |
1321 | if (ret < 0) { | |
1322 | dev_err(sfb->dev, "failed to register framebuffer\n"); | |
ddc518d9 | 1323 | return ret; |
ec549a0f BD |
1324 | } |
1325 | ||
ec549a0f BD |
1326 | dev_info(sfb->dev, "window %d: fb %s\n", win_no, fbinfo->fix.id); |
1327 | ||
1328 | return 0; | |
ec549a0f BD |
1329 | } |
1330 | ||
1331 | /** | |
1332 | * s3c_fb_clear_win() - clear hardware window registers. | |
1333 | * @sfb: The base resources for the hardware. | |
1334 | * @win: The window to process. | |
1335 | * | |
1336 | * Reset the specific window registers to a known state. | |
1337 | */ | |
1338 | static void s3c_fb_clear_win(struct s3c_fb *sfb, int win) | |
1339 | { | |
1340 | void __iomem *regs = sfb->regs; | |
a8bdabca | 1341 | u32 reg; |
ec549a0f | 1342 | |
c4bb6ffa BD |
1343 | writel(0, regs + sfb->variant.wincon + (win * 4)); |
1344 | writel(0, regs + VIDOSD_A(win, sfb->variant)); | |
1345 | writel(0, regs + VIDOSD_B(win, sfb->variant)); | |
1346 | writel(0, regs + VIDOSD_C(win, sfb->variant)); | |
a8bdabca PO |
1347 | reg = readl(regs + SHADOWCON); |
1348 | writel(reg & ~SHADOWCON_WINx_PROTECT(win), regs + SHADOWCON); | |
ec549a0f BD |
1349 | } |
1350 | ||
1351 | static int __devinit s3c_fb_probe(struct platform_device *pdev) | |
1352 | { | |
b73a21fc | 1353 | const struct platform_device_id *platid; |
50a5503a | 1354 | struct s3c_fb_driverdata *fbdrv; |
ec549a0f BD |
1355 | struct device *dev = &pdev->dev; |
1356 | struct s3c_fb_platdata *pd; | |
1357 | struct s3c_fb *sfb; | |
1358 | struct resource *res; | |
1359 | int win; | |
1360 | int ret = 0; | |
1361 | ||
b73a21fc JH |
1362 | platid = platform_get_device_id(pdev); |
1363 | fbdrv = (struct s3c_fb_driverdata *)platid->driver_data; | |
50a5503a BD |
1364 | |
1365 | if (fbdrv->variant.nr_windows > S3C_FB_MAX_WIN) { | |
1366 | dev_err(dev, "too many windows, cannot attach\n"); | |
1367 | return -EINVAL; | |
1368 | } | |
1369 | ||
ec549a0f BD |
1370 | pd = pdev->dev.platform_data; |
1371 | if (!pd) { | |
1372 | dev_err(dev, "no platform data specified\n"); | |
1373 | return -EINVAL; | |
1374 | } | |
1375 | ||
857a8df9 | 1376 | sfb = devm_kzalloc(dev, sizeof(struct s3c_fb), GFP_KERNEL); |
ec549a0f BD |
1377 | if (!sfb) { |
1378 | dev_err(dev, "no memory for framebuffers\n"); | |
1379 | return -ENOMEM; | |
1380 | } | |
1381 | ||
c4bb6ffa BD |
1382 | dev_dbg(dev, "allocate new framebuffer %p\n", sfb); |
1383 | ||
ec549a0f BD |
1384 | sfb->dev = dev; |
1385 | sfb->pdata = pd; | |
50a5503a | 1386 | sfb->variant = fbdrv->variant; |
ec549a0f | 1387 | |
b07f3bbe JH |
1388 | spin_lock_init(&sfb->slock); |
1389 | ||
ec549a0f BD |
1390 | sfb->bus_clk = clk_get(dev, "lcd"); |
1391 | if (IS_ERR(sfb->bus_clk)) { | |
1392 | dev_err(dev, "failed to get bus clock\n"); | |
942b8d05 | 1393 | ret = PTR_ERR(sfb->bus_clk); |
ec549a0f BD |
1394 | goto err_sfb; |
1395 | } | |
1396 | ||
1397 | clk_enable(sfb->bus_clk); | |
1398 | ||
b5480ed7 JH |
1399 | if (!sfb->variant.has_clksel) { |
1400 | sfb->lcd_clk = clk_get(dev, "sclk_fimd"); | |
1401 | if (IS_ERR(sfb->lcd_clk)) { | |
1402 | dev_err(dev, "failed to get lcd clock\n"); | |
1403 | ret = PTR_ERR(sfb->lcd_clk); | |
1404 | goto err_bus_clk; | |
1405 | } | |
1406 | ||
1407 | clk_enable(sfb->lcd_clk); | |
1408 | } | |
1409 | ||
4959212c JH |
1410 | pm_runtime_enable(sfb->dev); |
1411 | ||
ec549a0f BD |
1412 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
1413 | if (!res) { | |
1414 | dev_err(dev, "failed to find registers\n"); | |
1415 | ret = -ENOENT; | |
b5480ed7 | 1416 | goto err_lcd_clk; |
ec549a0f BD |
1417 | } |
1418 | ||
857a8df9 | 1419 | sfb->regs = devm_request_and_ioremap(dev, res); |
ec549a0f BD |
1420 | if (!sfb->regs) { |
1421 | dev_err(dev, "failed to map registers\n"); | |
1422 | ret = -ENXIO; | |
857a8df9 | 1423 | goto err_lcd_clk; |
ec549a0f BD |
1424 | } |
1425 | ||
efdc846d PO |
1426 | res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); |
1427 | if (!res) { | |
1428 | dev_err(dev, "failed to acquire irq resource\n"); | |
1429 | ret = -ENOENT; | |
857a8df9 | 1430 | goto err_lcd_clk; |
efdc846d PO |
1431 | } |
1432 | sfb->irq_no = res->start; | |
1433 | ret = request_irq(sfb->irq_no, s3c_fb_irq, | |
1434 | 0, "s3c_fb", sfb); | |
1435 | if (ret) { | |
1436 | dev_err(dev, "irq request failed\n"); | |
857a8df9 | 1437 | goto err_lcd_clk; |
efdc846d PO |
1438 | } |
1439 | ||
ec549a0f BD |
1440 | dev_dbg(dev, "got resources (regs %p), probing windows\n", sfb->regs); |
1441 | ||
4959212c JH |
1442 | platform_set_drvdata(pdev, sfb); |
1443 | pm_runtime_get_sync(sfb->dev); | |
1444 | ||
ec549a0f BD |
1445 | /* setup gpio and output polarity controls */ |
1446 | ||
1447 | pd->setup_gpio(); | |
1448 | ||
1449 | writel(pd->vidcon1, sfb->regs + VIDCON1); | |
1450 | ||
1451 | /* zero all windows before we do anything */ | |
1452 | ||
50a5503a | 1453 | for (win = 0; win < fbdrv->variant.nr_windows; win++) |
ec549a0f BD |
1454 | s3c_fb_clear_win(sfb, win); |
1455 | ||
94947037 | 1456 | /* initialise colour key controls */ |
50a5503a | 1457 | for (win = 0; win < (fbdrv->variant.nr_windows - 1); win++) { |
c4bb6ffa BD |
1458 | void __iomem *regs = sfb->regs + sfb->variant.keycon; |
1459 | ||
1460 | regs += (win * 8); | |
1461 | writel(0xffffff, regs + WKEYCON0); | |
1462 | writel(0xffffff, regs + WKEYCON1); | |
94947037 BD |
1463 | } |
1464 | ||
ec549a0f BD |
1465 | /* we have the register setup, start allocating framebuffers */ |
1466 | ||
50a5503a | 1467 | for (win = 0; win < fbdrv->variant.nr_windows; win++) { |
ec549a0f BD |
1468 | if (!pd->win[win]) |
1469 | continue; | |
1470 | ||
2bb567a3 MC |
1471 | if (!pd->win[win]->win_mode.pixclock) |
1472 | s3c_fb_missing_pixclock(&pd->win[win]->win_mode); | |
1473 | ||
50a5503a BD |
1474 | ret = s3c_fb_probe_win(sfb, win, fbdrv->win[win], |
1475 | &sfb->windows[win]); | |
ec549a0f BD |
1476 | if (ret < 0) { |
1477 | dev_err(dev, "failed to create window %d\n", win); | |
1478 | for (; win >= 0; win--) | |
1479 | s3c_fb_release_win(sfb, sfb->windows[win]); | |
3500b0be | 1480 | goto err_pm_runtime; |
ec549a0f BD |
1481 | } |
1482 | } | |
1483 | ||
1484 | platform_set_drvdata(pdev, sfb); | |
fe05f8b1 | 1485 | pm_runtime_put_sync(sfb->dev); |
ec549a0f BD |
1486 | |
1487 | return 0; | |
1488 | ||
3500b0be MB |
1489 | err_pm_runtime: |
1490 | pm_runtime_put_sync(sfb->dev); | |
efdc846d PO |
1491 | free_irq(sfb->irq_no, sfb); |
1492 | ||
b5480ed7 | 1493 | err_lcd_clk: |
3500b0be MB |
1494 | pm_runtime_disable(sfb->dev); |
1495 | ||
b5480ed7 JH |
1496 | if (!sfb->variant.has_clksel) { |
1497 | clk_disable(sfb->lcd_clk); | |
1498 | clk_put(sfb->lcd_clk); | |
1499 | } | |
1500 | ||
1501 | err_bus_clk: | |
ec549a0f BD |
1502 | clk_disable(sfb->bus_clk); |
1503 | clk_put(sfb->bus_clk); | |
1504 | ||
1505 | err_sfb: | |
ec549a0f BD |
1506 | return ret; |
1507 | } | |
1508 | ||
1509 | /** | |
1510 | * s3c_fb_remove() - Cleanup on module finalisation | |
1511 | * @pdev: The platform device we are bound to. | |
1512 | * | |
1513 | * Shutdown and then release all the resources that the driver allocated | |
1514 | * on initialisation. | |
1515 | */ | |
1516 | static int __devexit s3c_fb_remove(struct platform_device *pdev) | |
1517 | { | |
1518 | struct s3c_fb *sfb = platform_get_drvdata(pdev); | |
1519 | int win; | |
1520 | ||
fe05f8b1 MB |
1521 | pm_runtime_get_sync(sfb->dev); |
1522 | ||
c42b110c | 1523 | for (win = 0; win < S3C_FB_MAX_WIN; win++) |
17663e59 MS |
1524 | if (sfb->windows[win]) |
1525 | s3c_fb_release_win(sfb, sfb->windows[win]); | |
ec549a0f | 1526 | |
efdc846d PO |
1527 | free_irq(sfb->irq_no, sfb); |
1528 | ||
b5480ed7 JH |
1529 | if (!sfb->variant.has_clksel) { |
1530 | clk_disable(sfb->lcd_clk); | |
1531 | clk_put(sfb->lcd_clk); | |
1532 | } | |
1533 | ||
ec549a0f BD |
1534 | clk_disable(sfb->bus_clk); |
1535 | clk_put(sfb->bus_clk); | |
1536 | ||
4959212c JH |
1537 | pm_runtime_put_sync(sfb->dev); |
1538 | pm_runtime_disable(sfb->dev); | |
1539 | ||
ec549a0f BD |
1540 | return 0; |
1541 | } | |
1542 | ||
f4f51473 | 1543 | #ifdef CONFIG_PM_SLEEP |
4959212c JH |
1544 | static int s3c_fb_suspend(struct device *dev) |
1545 | { | |
1546 | struct platform_device *pdev = to_platform_device(dev); | |
1547 | struct s3c_fb *sfb = platform_get_drvdata(pdev); | |
1548 | struct s3c_fb_win *win; | |
1549 | int win_no; | |
1550 | ||
1551 | for (win_no = S3C_FB_MAX_WIN - 1; win_no >= 0; win_no--) { | |
1552 | win = sfb->windows[win_no]; | |
1553 | if (!win) | |
1554 | continue; | |
1555 | ||
1556 | /* use the blank function to push into power-down */ | |
1557 | s3c_fb_blank(FB_BLANK_POWERDOWN, win->fbinfo); | |
1558 | } | |
1559 | ||
b5480ed7 JH |
1560 | if (!sfb->variant.has_clksel) |
1561 | clk_disable(sfb->lcd_clk); | |
1562 | ||
4959212c JH |
1563 | clk_disable(sfb->bus_clk); |
1564 | return 0; | |
1565 | } | |
1566 | ||
1567 | static int s3c_fb_resume(struct device *dev) | |
1568 | { | |
1569 | struct platform_device *pdev = to_platform_device(dev); | |
1570 | struct s3c_fb *sfb = platform_get_drvdata(pdev); | |
1571 | struct s3c_fb_platdata *pd = sfb->pdata; | |
1572 | struct s3c_fb_win *win; | |
1573 | int win_no; | |
1574 | ||
1575 | clk_enable(sfb->bus_clk); | |
1576 | ||
b5480ed7 JH |
1577 | if (!sfb->variant.has_clksel) |
1578 | clk_enable(sfb->lcd_clk); | |
1579 | ||
6aa96811 JH |
1580 | /* setup gpio and output polarity controls */ |
1581 | pd->setup_gpio(); | |
4959212c JH |
1582 | writel(pd->vidcon1, sfb->regs + VIDCON1); |
1583 | ||
1584 | /* zero all windows before we do anything */ | |
1585 | for (win_no = 0; win_no < sfb->variant.nr_windows; win_no++) | |
1586 | s3c_fb_clear_win(sfb, win_no); | |
1587 | ||
1588 | for (win_no = 0; win_no < sfb->variant.nr_windows - 1; win_no++) { | |
1589 | void __iomem *regs = sfb->regs + sfb->variant.keycon; | |
ff8c9107 JH |
1590 | win = sfb->windows[win_no]; |
1591 | if (!win) | |
1592 | continue; | |
4959212c | 1593 | |
ff8c9107 | 1594 | shadow_protect_win(win, 1); |
4959212c JH |
1595 | regs += (win_no * 8); |
1596 | writel(0xffffff, regs + WKEYCON0); | |
1597 | writel(0xffffff, regs + WKEYCON1); | |
ff8c9107 | 1598 | shadow_protect_win(win, 0); |
4959212c JH |
1599 | } |
1600 | ||
1601 | /* restore framebuffers */ | |
1602 | for (win_no = 0; win_no < S3C_FB_MAX_WIN; win_no++) { | |
1603 | win = sfb->windows[win_no]; | |
1604 | if (!win) | |
1605 | continue; | |
1606 | ||
1607 | dev_dbg(&pdev->dev, "resuming window %d\n", win_no); | |
1608 | s3c_fb_set_par(win->fbinfo); | |
1609 | } | |
1610 | ||
1611 | return 0; | |
1612 | } | |
ec549a0f BD |
1613 | #endif |
1614 | ||
f4f51473 MB |
1615 | #ifdef CONFIG_PM_RUNTIME |
1616 | static int s3c_fb_runtime_suspend(struct device *dev) | |
1617 | { | |
1618 | struct platform_device *pdev = to_platform_device(dev); | |
1619 | struct s3c_fb *sfb = platform_get_drvdata(pdev); | |
1620 | ||
1621 | if (!sfb->variant.has_clksel) | |
1622 | clk_disable(sfb->lcd_clk); | |
1623 | ||
1624 | clk_disable(sfb->bus_clk); | |
1625 | ||
1626 | return 0; | |
1627 | } | |
1628 | ||
1629 | static int s3c_fb_runtime_resume(struct device *dev) | |
1630 | { | |
1631 | struct platform_device *pdev = to_platform_device(dev); | |
1632 | struct s3c_fb *sfb = platform_get_drvdata(pdev); | |
1633 | struct s3c_fb_platdata *pd = sfb->pdata; | |
1634 | ||
1635 | clk_enable(sfb->bus_clk); | |
1636 | ||
1637 | if (!sfb->variant.has_clksel) | |
1638 | clk_enable(sfb->lcd_clk); | |
1639 | ||
1640 | /* setup gpio and output polarity controls */ | |
1641 | pd->setup_gpio(); | |
1642 | writel(pd->vidcon1, sfb->regs + VIDCON1); | |
1643 | ||
1644 | return 0; | |
1645 | } | |
1646 | #endif | |
50a5503a BD |
1647 | |
1648 | #define VALID_BPP124 (VALID_BPP(1) | VALID_BPP(2) | VALID_BPP(4)) | |
1649 | #define VALID_BPP1248 (VALID_BPP124 | VALID_BPP(8)) | |
1650 | ||
8cfdcb23 | 1651 | static struct s3c_fb_win_variant s3c_fb_data_64xx_wins[] = { |
50a5503a BD |
1652 | [0] = { |
1653 | .has_osd_c = 1, | |
f676ec2a | 1654 | .osd_size_off = 0x8, |
50a5503a | 1655 | .palette_sz = 256, |
cd74ebaf JH |
1656 | .valid_bpp = (VALID_BPP1248 | VALID_BPP(16) | |
1657 | VALID_BPP(18) | VALID_BPP(24)), | |
50a5503a BD |
1658 | }, |
1659 | [1] = { | |
1660 | .has_osd_c = 1, | |
1661 | .has_osd_d = 1, | |
c9d503e9 | 1662 | .osd_size_off = 0xc, |
f676ec2a | 1663 | .has_osd_alpha = 1, |
50a5503a BD |
1664 | .palette_sz = 256, |
1665 | .valid_bpp = (VALID_BPP1248 | VALID_BPP(16) | | |
1666 | VALID_BPP(18) | VALID_BPP(19) | | |
cd74ebaf JH |
1667 | VALID_BPP(24) | VALID_BPP(25) | |
1668 | VALID_BPP(28)), | |
50a5503a BD |
1669 | }, |
1670 | [2] = { | |
1671 | .has_osd_c = 1, | |
1672 | .has_osd_d = 1, | |
c9d503e9 | 1673 | .osd_size_off = 0xc, |
f676ec2a | 1674 | .has_osd_alpha = 1, |
50a5503a BD |
1675 | .palette_sz = 16, |
1676 | .palette_16bpp = 1, | |
1677 | .valid_bpp = (VALID_BPP1248 | VALID_BPP(16) | | |
1678 | VALID_BPP(18) | VALID_BPP(19) | | |
cd74ebaf JH |
1679 | VALID_BPP(24) | VALID_BPP(25) | |
1680 | VALID_BPP(28)), | |
50a5503a BD |
1681 | }, |
1682 | [3] = { | |
1683 | .has_osd_c = 1, | |
f676ec2a | 1684 | .has_osd_alpha = 1, |
50a5503a BD |
1685 | .palette_sz = 16, |
1686 | .palette_16bpp = 1, | |
1687 | .valid_bpp = (VALID_BPP124 | VALID_BPP(16) | | |
1688 | VALID_BPP(18) | VALID_BPP(19) | | |
cd74ebaf JH |
1689 | VALID_BPP(24) | VALID_BPP(25) | |
1690 | VALID_BPP(28)), | |
50a5503a BD |
1691 | }, |
1692 | [4] = { | |
1693 | .has_osd_c = 1, | |
f676ec2a | 1694 | .has_osd_alpha = 1, |
50a5503a BD |
1695 | .palette_sz = 4, |
1696 | .palette_16bpp = 1, | |
1697 | .valid_bpp = (VALID_BPP(1) | VALID_BPP(2) | | |
1698 | VALID_BPP(16) | VALID_BPP(18) | | |
cd74ebaf JH |
1699 | VALID_BPP(19) | VALID_BPP(24) | |
1700 | VALID_BPP(25) | VALID_BPP(28)), | |
50a5503a BD |
1701 | }, |
1702 | }; | |
1703 | ||
af4a835b JH |
1704 | static struct s3c_fb_win_variant s3c_fb_data_s5p_wins[] = { |
1705 | [0] = { | |
1706 | .has_osd_c = 1, | |
1707 | .osd_size_off = 0x8, | |
1708 | .palette_sz = 256, | |
1709 | .valid_bpp = (VALID_BPP1248 | VALID_BPP(13) | | |
1710 | VALID_BPP(15) | VALID_BPP(16) | | |
1711 | VALID_BPP(18) | VALID_BPP(19) | | |
1712 | VALID_BPP(24) | VALID_BPP(25) | | |
1713 | VALID_BPP(32)), | |
1714 | }, | |
1715 | [1] = { | |
1716 | .has_osd_c = 1, | |
1717 | .has_osd_d = 1, | |
1718 | .osd_size_off = 0xc, | |
1719 | .has_osd_alpha = 1, | |
1720 | .palette_sz = 256, | |
1721 | .valid_bpp = (VALID_BPP1248 | VALID_BPP(13) | | |
1722 | VALID_BPP(15) | VALID_BPP(16) | | |
1723 | VALID_BPP(18) | VALID_BPP(19) | | |
1724 | VALID_BPP(24) | VALID_BPP(25) | | |
1725 | VALID_BPP(32)), | |
1726 | }, | |
1727 | [2] = { | |
1728 | .has_osd_c = 1, | |
1729 | .has_osd_d = 1, | |
1730 | .osd_size_off = 0xc, | |
1731 | .has_osd_alpha = 1, | |
1732 | .palette_sz = 256, | |
1733 | .valid_bpp = (VALID_BPP1248 | VALID_BPP(13) | | |
1734 | VALID_BPP(15) | VALID_BPP(16) | | |
1735 | VALID_BPP(18) | VALID_BPP(19) | | |
1736 | VALID_BPP(24) | VALID_BPP(25) | | |
1737 | VALID_BPP(32)), | |
1738 | }, | |
1739 | [3] = { | |
1740 | .has_osd_c = 1, | |
1741 | .has_osd_alpha = 1, | |
1742 | .palette_sz = 256, | |
1743 | .valid_bpp = (VALID_BPP1248 | VALID_BPP(13) | | |
1744 | VALID_BPP(15) | VALID_BPP(16) | | |
1745 | VALID_BPP(18) | VALID_BPP(19) | | |
1746 | VALID_BPP(24) | VALID_BPP(25) | | |
1747 | VALID_BPP(32)), | |
1748 | }, | |
1749 | [4] = { | |
1750 | .has_osd_c = 1, | |
1751 | .has_osd_alpha = 1, | |
1752 | .palette_sz = 256, | |
1753 | .valid_bpp = (VALID_BPP1248 | VALID_BPP(13) | | |
1754 | VALID_BPP(15) | VALID_BPP(16) | | |
1755 | VALID_BPP(18) | VALID_BPP(19) | | |
1756 | VALID_BPP(24) | VALID_BPP(25) | | |
1757 | VALID_BPP(32)), | |
1758 | }, | |
1759 | }; | |
1760 | ||
8cfdcb23 | 1761 | static struct s3c_fb_driverdata s3c_fb_data_64xx = { |
50a5503a BD |
1762 | .variant = { |
1763 | .nr_windows = 5, | |
c4bb6ffa BD |
1764 | .vidtcon = VIDTCON0, |
1765 | .wincon = WINCON(0), | |
1766 | .winmap = WINxMAP(0), | |
1767 | .keycon = WKEYCON, | |
1768 | .osd = VIDOSD_BASE, | |
1769 | .osd_stride = 16, | |
1770 | .buf_start = VIDW_BUF_START(0), | |
1771 | .buf_size = VIDW_BUF_SIZE(0), | |
1772 | .buf_end = VIDW_BUF_END(0), | |
50a5503a BD |
1773 | |
1774 | .palette = { | |
1775 | [0] = 0x400, | |
1776 | [1] = 0x800, | |
1777 | [2] = 0x300, | |
1778 | [3] = 0x320, | |
1779 | [4] = 0x340, | |
1780 | }, | |
067b226b PO |
1781 | |
1782 | .has_prtcon = 1, | |
b5480ed7 | 1783 | .has_clksel = 1, |
50a5503a BD |
1784 | }, |
1785 | .win[0] = &s3c_fb_data_64xx_wins[0], | |
1786 | .win[1] = &s3c_fb_data_64xx_wins[1], | |
1787 | .win[2] = &s3c_fb_data_64xx_wins[2], | |
1788 | .win[3] = &s3c_fb_data_64xx_wins[3], | |
1789 | .win[4] = &s3c_fb_data_64xx_wins[4], | |
1790 | }; | |
1791 | ||
8cfdcb23 | 1792 | static struct s3c_fb_driverdata s3c_fb_data_s5pc100 = { |
4e591ac6 PO |
1793 | .variant = { |
1794 | .nr_windows = 5, | |
1795 | .vidtcon = VIDTCON0, | |
1796 | .wincon = WINCON(0), | |
1797 | .winmap = WINxMAP(0), | |
1798 | .keycon = WKEYCON, | |
1799 | .osd = VIDOSD_BASE, | |
1800 | .osd_stride = 16, | |
1801 | .buf_start = VIDW_BUF_START(0), | |
1802 | .buf_size = VIDW_BUF_SIZE(0), | |
1803 | .buf_end = VIDW_BUF_END(0), | |
1804 | ||
1805 | .palette = { | |
1806 | [0] = 0x2400, | |
1807 | [1] = 0x2800, | |
1808 | [2] = 0x2c00, | |
1809 | [3] = 0x3000, | |
1810 | [4] = 0x3400, | |
1811 | }, | |
067b226b PO |
1812 | |
1813 | .has_prtcon = 1, | |
f7f31e50 | 1814 | .has_blendcon = 1, |
b5480ed7 | 1815 | .has_clksel = 1, |
4e591ac6 | 1816 | }, |
af4a835b JH |
1817 | .win[0] = &s3c_fb_data_s5p_wins[0], |
1818 | .win[1] = &s3c_fb_data_s5p_wins[1], | |
1819 | .win[2] = &s3c_fb_data_s5p_wins[2], | |
1820 | .win[3] = &s3c_fb_data_s5p_wins[3], | |
1821 | .win[4] = &s3c_fb_data_s5p_wins[4], | |
4e591ac6 PO |
1822 | }; |
1823 | ||
8cfdcb23 | 1824 | static struct s3c_fb_driverdata s3c_fb_data_s5pv210 = { |
b5480ed7 JH |
1825 | .variant = { |
1826 | .nr_windows = 5, | |
1827 | .vidtcon = VIDTCON0, | |
1828 | .wincon = WINCON(0), | |
1829 | .winmap = WINxMAP(0), | |
1830 | .keycon = WKEYCON, | |
1831 | .osd = VIDOSD_BASE, | |
1832 | .osd_stride = 16, | |
1833 | .buf_start = VIDW_BUF_START(0), | |
1834 | .buf_size = VIDW_BUF_SIZE(0), | |
1835 | .buf_end = VIDW_BUF_END(0), | |
1836 | ||
1837 | .palette = { | |
1838 | [0] = 0x2400, | |
1839 | [1] = 0x2800, | |
1840 | [2] = 0x2c00, | |
1841 | [3] = 0x3000, | |
1842 | [4] = 0x3400, | |
1843 | }, | |
1844 | ||
1845 | .has_shadowcon = 1, | |
f7f31e50 | 1846 | .has_blendcon = 1, |
b5480ed7 JH |
1847 | .has_clksel = 1, |
1848 | }, | |
1849 | .win[0] = &s3c_fb_data_s5p_wins[0], | |
1850 | .win[1] = &s3c_fb_data_s5p_wins[1], | |
1851 | .win[2] = &s3c_fb_data_s5p_wins[2], | |
1852 | .win[3] = &s3c_fb_data_s5p_wins[3], | |
1853 | .win[4] = &s3c_fb_data_s5p_wins[4], | |
1854 | }; | |
1855 | ||
1856 | static struct s3c_fb_driverdata s3c_fb_data_exynos4 = { | |
50a5503a BD |
1857 | .variant = { |
1858 | .nr_windows = 5, | |
c4bb6ffa BD |
1859 | .vidtcon = VIDTCON0, |
1860 | .wincon = WINCON(0), | |
1861 | .winmap = WINxMAP(0), | |
1862 | .keycon = WKEYCON, | |
1863 | .osd = VIDOSD_BASE, | |
1864 | .osd_stride = 16, | |
1865 | .buf_start = VIDW_BUF_START(0), | |
1866 | .buf_size = VIDW_BUF_SIZE(0), | |
1867 | .buf_end = VIDW_BUF_END(0), | |
50a5503a BD |
1868 | |
1869 | .palette = { | |
1870 | [0] = 0x2400, | |
1871 | [1] = 0x2800, | |
1872 | [2] = 0x2c00, | |
1873 | [3] = 0x3000, | |
1874 | [4] = 0x3400, | |
1875 | }, | |
f5ec546f PO |
1876 | |
1877 | .has_shadowcon = 1, | |
f7f31e50 | 1878 | .has_blendcon = 1, |
50a5503a | 1879 | }, |
af4a835b JH |
1880 | .win[0] = &s3c_fb_data_s5p_wins[0], |
1881 | .win[1] = &s3c_fb_data_s5p_wins[1], | |
1882 | .win[2] = &s3c_fb_data_s5p_wins[2], | |
1883 | .win[3] = &s3c_fb_data_s5p_wins[3], | |
1884 | .win[4] = &s3c_fb_data_s5p_wins[4], | |
50a5503a BD |
1885 | }; |
1886 | ||
c4bb6ffa | 1887 | /* S3C2443/S3C2416 style hardware */ |
8cfdcb23 | 1888 | static struct s3c_fb_driverdata s3c_fb_data_s3c2443 = { |
c4bb6ffa BD |
1889 | .variant = { |
1890 | .nr_windows = 2, | |
1891 | .is_2443 = 1, | |
1892 | ||
1893 | .vidtcon = 0x08, | |
1894 | .wincon = 0x14, | |
1895 | .winmap = 0xd0, | |
1896 | .keycon = 0xb0, | |
1897 | .osd = 0x28, | |
1898 | .osd_stride = 12, | |
1899 | .buf_start = 0x64, | |
1900 | .buf_size = 0x94, | |
1901 | .buf_end = 0x7c, | |
1902 | ||
1903 | .palette = { | |
1904 | [0] = 0x400, | |
1905 | [1] = 0x800, | |
1906 | }, | |
b5480ed7 | 1907 | .has_clksel = 1, |
c4bb6ffa BD |
1908 | }, |
1909 | .win[0] = &(struct s3c_fb_win_variant) { | |
1910 | .palette_sz = 256, | |
1911 | .valid_bpp = VALID_BPP1248 | VALID_BPP(16) | VALID_BPP(24), | |
1912 | }, | |
1913 | .win[1] = &(struct s3c_fb_win_variant) { | |
1914 | .has_osd_c = 1, | |
f676ec2a | 1915 | .has_osd_alpha = 1, |
c4bb6ffa BD |
1916 | .palette_sz = 256, |
1917 | .valid_bpp = (VALID_BPP1248 | VALID_BPP(16) | | |
1918 | VALID_BPP(18) | VALID_BPP(19) | | |
1919 | VALID_BPP(24) | VALID_BPP(25) | | |
1920 | VALID_BPP(28)), | |
1921 | }, | |
1922 | }; | |
1923 | ||
21b5a3ad AK |
1924 | static struct s3c_fb_driverdata s3c_fb_data_s5p64x0 = { |
1925 | .variant = { | |
1926 | .nr_windows = 3, | |
1927 | .vidtcon = VIDTCON0, | |
1928 | .wincon = WINCON(0), | |
1929 | .winmap = WINxMAP(0), | |
1930 | .keycon = WKEYCON, | |
1931 | .osd = VIDOSD_BASE, | |
1932 | .osd_stride = 16, | |
1933 | .buf_start = VIDW_BUF_START(0), | |
1934 | .buf_size = VIDW_BUF_SIZE(0), | |
1935 | .buf_end = VIDW_BUF_END(0), | |
1936 | ||
1937 | .palette = { | |
1938 | [0] = 0x2400, | |
1939 | [1] = 0x2800, | |
1940 | [2] = 0x2c00, | |
1941 | }, | |
f7f31e50 JH |
1942 | |
1943 | .has_blendcon = 1, | |
21b5a3ad AK |
1944 | }, |
1945 | .win[0] = &s3c_fb_data_s5p_wins[0], | |
1946 | .win[1] = &s3c_fb_data_s5p_wins[1], | |
1947 | .win[2] = &s3c_fb_data_s5p_wins[2], | |
1948 | }; | |
1949 | ||
50a5503a BD |
1950 | static struct platform_device_id s3c_fb_driver_ids[] = { |
1951 | { | |
1952 | .name = "s3c-fb", | |
1953 | .driver_data = (unsigned long)&s3c_fb_data_64xx, | |
1954 | }, { | |
4e591ac6 PO |
1955 | .name = "s5pc100-fb", |
1956 | .driver_data = (unsigned long)&s3c_fb_data_s5pc100, | |
1957 | }, { | |
1958 | .name = "s5pv210-fb", | |
1959 | .driver_data = (unsigned long)&s3c_fb_data_s5pv210, | |
b5480ed7 JH |
1960 | }, { |
1961 | .name = "exynos4-fb", | |
1962 | .driver_data = (unsigned long)&s3c_fb_data_exynos4, | |
c4bb6ffa BD |
1963 | }, { |
1964 | .name = "s3c2443-fb", | |
1965 | .driver_data = (unsigned long)&s3c_fb_data_s3c2443, | |
21b5a3ad AK |
1966 | }, { |
1967 | .name = "s5p64x0-fb", | |
1968 | .driver_data = (unsigned long)&s3c_fb_data_s5p64x0, | |
50a5503a BD |
1969 | }, |
1970 | {}, | |
1971 | }; | |
1972 | MODULE_DEVICE_TABLE(platform, s3c_fb_driver_ids); | |
1973 | ||
f4f51473 MB |
1974 | static const struct dev_pm_ops s3cfb_pm_ops = { |
1975 | SET_SYSTEM_SLEEP_PM_OPS(s3c_fb_suspend, s3c_fb_resume) | |
1976 | SET_RUNTIME_PM_OPS(s3c_fb_runtime_suspend, s3c_fb_runtime_resume, | |
1977 | NULL) | |
1978 | }; | |
4959212c | 1979 | |
ec549a0f BD |
1980 | static struct platform_driver s3c_fb_driver = { |
1981 | .probe = s3c_fb_probe, | |
3163eaba | 1982 | .remove = __devexit_p(s3c_fb_remove), |
50a5503a | 1983 | .id_table = s3c_fb_driver_ids, |
ec549a0f BD |
1984 | .driver = { |
1985 | .name = "s3c-fb", | |
1986 | .owner = THIS_MODULE, | |
fe05f8b1 | 1987 | .pm = &s3cfb_pm_ops, |
ec549a0f BD |
1988 | }, |
1989 | }; | |
1990 | ||
4277f2c4 | 1991 | module_platform_driver(s3c_fb_driver); |
ec549a0f BD |
1992 | |
1993 | MODULE_AUTHOR("Ben Dooks <ben@simtec.co.uk>"); | |
1994 | MODULE_DESCRIPTION("Samsung S3C SoC Framebuffer driver"); | |
1995 | MODULE_LICENSE("GPL"); | |
1996 | MODULE_ALIAS("platform:s3c-fb"); |