blob: 38c1f324ce15d98d513e7dfd613c9a7e835f5979 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * linux/drivers/video/amba-clcd.c
3 *
4 * Copyright (C) 2001 ARM Limited, by David A Rusling
5 * Updated to 2.5, Deep Blue Solutions Ltd.
6 *
7 * This file is subject to the terms and conditions of the GNU General Public
8 * License. See the file COPYING in the main directory of this archive
9 * for more details.
10 *
11 * ARM PrimeCell PL110 Color LCD Controller
12 */
Vladimir Zapolskiy69550ad2017-01-30 17:39:48 +010013#include <linux/amba/bus.h>
14#include <linux/amba/clcd.h>
15#include <linux/backlight.h>
16#include <linux/clk.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070017#include <linux/delay.h>
Vladimir Zapolskiy69550ad2017-01-30 17:39:48 +010018#include <linux/dma-mapping.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070019#include <linux/fb.h>
20#include <linux/init.h>
21#include <linux/ioport.h>
22#include <linux/list.h>
Vladimir Zapolskiy69550ad2017-01-30 17:39:48 +010023#include <linux/mm.h>
24#include <linux/module.h>
Pawel Molld10715be2014-06-24 12:55:11 +010025#include <linux/of_address.h>
26#include <linux/of_graph.h>
Vladimir Zapolskiy69550ad2017-01-30 17:39:48 +010027#include <linux/slab.h>
28#include <linux/string.h>
Pawel Molld10715be2014-06-24 12:55:11 +010029#include <video/display_timing.h>
30#include <video/of_display_timing.h>
31#include <video/videomode.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070032
Linus Walleij1d3f0cb2016-06-16 11:36:17 +020033#include "amba-clcd-nomadik.h"
Linus Walleij25348162016-06-16 11:36:18 +020034#include "amba-clcd-versatile.h"
Linus Walleij1d3f0cb2016-06-16 11:36:17 +020035
Linus Torvalds1da177e2005-04-16 15:20:36 -070036#define to_clcd(info) container_of(info, struct clcd_fb, fb)
37
38/* This is limited to 16 characters when displayed by X startup */
39static const char *clcd_name = "CLCD FB";
40
41/*
42 * Unfortunately, the enable/disable functions may be called either from
43 * process or IRQ context, and we _need_ to delay. This is _not_ good.
44 */
45static inline void clcdfb_sleep(unsigned int ms)
46{
47 if (in_atomic()) {
48 mdelay(ms);
49 } else {
50 msleep(ms);
51 }
52}
53
54static inline void clcdfb_set_start(struct clcd_fb *fb)
55{
56 unsigned long ustart = fb->fb.fix.smem_start;
57 unsigned long lstart;
58
59 ustart += fb->fb.var.yoffset * fb->fb.fix.line_length;
60 lstart = ustart + fb->fb.var.yres * fb->fb.fix.line_length / 2;
61
62 writel(ustart, fb->regs + CLCD_UBAS);
63 writel(lstart, fb->regs + CLCD_LBAS);
64}
65
66static void clcdfb_disable(struct clcd_fb *fb)
67{
68 u32 val;
69
70 if (fb->board->disable)
71 fb->board->disable(fb);
72
Linus Walleijc38162b2016-06-16 11:36:13 +020073 if (fb->panel->backlight) {
74 fb->panel->backlight->props.power = FB_BLANK_POWERDOWN;
75 backlight_update_status(fb->panel->backlight);
76 }
77
Russell King3f175222010-02-12 14:32:01 +000078 val = readl(fb->regs + fb->off_cntl);
Linus Torvalds1da177e2005-04-16 15:20:36 -070079 if (val & CNTL_LCDPWR) {
80 val &= ~CNTL_LCDPWR;
Russell King3f175222010-02-12 14:32:01 +000081 writel(val, fb->regs + fb->off_cntl);
Linus Torvalds1da177e2005-04-16 15:20:36 -070082
83 clcdfb_sleep(20);
84 }
85 if (val & CNTL_LCDEN) {
86 val &= ~CNTL_LCDEN;
Russell King3f175222010-02-12 14:32:01 +000087 writel(val, fb->regs + fb->off_cntl);
Linus Torvalds1da177e2005-04-16 15:20:36 -070088 }
89
90 /*
91 * Disable CLCD clock source.
92 */
Russell King99c796d2010-08-17 22:13:22 +010093 if (fb->clk_enabled) {
94 fb->clk_enabled = false;
95 clk_disable(fb->clk);
96 }
Linus Torvalds1da177e2005-04-16 15:20:36 -070097}
98
99static void clcdfb_enable(struct clcd_fb *fb, u32 cntl)
100{
101 /*
102 * Enable the CLCD clock source.
103 */
Russell King99c796d2010-08-17 22:13:22 +0100104 if (!fb->clk_enabled) {
105 fb->clk_enabled = true;
106 clk_enable(fb->clk);
107 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700108
109 /*
110 * Bring up by first enabling..
111 */
112 cntl |= CNTL_LCDEN;
Russell King3f175222010-02-12 14:32:01 +0000113 writel(cntl, fb->regs + fb->off_cntl);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700114
115 clcdfb_sleep(20);
116
117 /*
118 * and now apply power.
119 */
120 cntl |= CNTL_LCDPWR;
Russell King3f175222010-02-12 14:32:01 +0000121 writel(cntl, fb->regs + fb->off_cntl);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700122
123 /*
Linus Walleijc38162b2016-06-16 11:36:13 +0200124 * Turn on backlight
125 */
126 if (fb->panel->backlight) {
127 fb->panel->backlight->props.power = FB_BLANK_UNBLANK;
128 backlight_update_status(fb->panel->backlight);
129 }
130
131 /*
Linus Torvalds1da177e2005-04-16 15:20:36 -0700132 * finally, enable the interface.
133 */
134 if (fb->board->enable)
135 fb->board->enable(fb);
136}
137
138static int
139clcdfb_set_bitfields(struct clcd_fb *fb, struct fb_var_screeninfo *var)
140{
Russell King7b4e9ce2011-01-21 14:03:28 +0000141 u32 caps;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700142 int ret = 0;
143
Russell King7b4e9ce2011-01-21 14:03:28 +0000144 if (fb->panel->caps && fb->board->caps)
145 caps = fb->panel->caps & fb->board->caps;
146 else {
147 /* Old way of specifying what can be used */
148 caps = fb->panel->cntl & CNTL_BGR ?
149 CLCD_CAP_BGR : CLCD_CAP_RGB;
150 /* But mask out 444 modes as they weren't supported */
151 caps &= ~CLCD_CAP_444;
152 }
153
154 /* Only TFT panels can do RGB888/BGR888 */
155 if (!(fb->panel->cntl & CNTL_LCDTFT))
156 caps &= ~CLCD_CAP_888;
157
Linus Torvalds1da177e2005-04-16 15:20:36 -0700158 memset(&var->transp, 0, sizeof(var->transp));
Russell Kingc43e6f02006-01-26 14:12:06 +0000159
160 var->red.msb_right = 0;
161 var->green.msb_right = 0;
162 var->blue.msb_right = 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700163
164 switch (var->bits_per_pixel) {
165 case 1:
166 case 2:
167 case 4:
168 case 8:
Russell King7b4e9ce2011-01-21 14:03:28 +0000169 /* If we can't do 5551, reject */
170 caps &= CLCD_CAP_5551;
171 if (!caps) {
172 ret = -EINVAL;
173 break;
174 }
175
Russell Kingc4d12b92005-04-28 10:38:19 +0100176 var->red.length = var->bits_per_pixel;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700177 var->red.offset = 0;
Russell Kingc4d12b92005-04-28 10:38:19 +0100178 var->green.length = var->bits_per_pixel;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700179 var->green.offset = 0;
Russell Kingc4d12b92005-04-28 10:38:19 +0100180 var->blue.length = var->bits_per_pixel;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700181 var->blue.offset = 0;
182 break;
Russell King7b4e9ce2011-01-21 14:03:28 +0000183
Linus Torvalds1da177e2005-04-16 15:20:36 -0700184 case 16:
Russell King7b4e9ce2011-01-21 14:03:28 +0000185 /* If we can't do 444, 5551 or 565, reject */
186 if (!(caps & (CLCD_CAP_444 | CLCD_CAP_5551 | CLCD_CAP_565))) {
187 ret = -EINVAL;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700188 break;
189 }
Russell King7b4e9ce2011-01-21 14:03:28 +0000190
191 /*
192 * Green length can be 4, 5 or 6 depending whether
193 * we're operating in 444, 5551 or 565 mode.
194 */
195 if (var->green.length == 4 && caps & CLCD_CAP_444)
196 caps &= CLCD_CAP_444;
197 if (var->green.length == 5 && caps & CLCD_CAP_5551)
198 caps &= CLCD_CAP_5551;
199 else if (var->green.length == 6 && caps & CLCD_CAP_565)
200 caps &= CLCD_CAP_565;
201 else {
202 /*
203 * PL110 officially only supports RGB555,
204 * but may be wired up to allow RGB565.
205 */
206 if (caps & CLCD_CAP_565) {
207 var->green.length = 6;
208 caps &= CLCD_CAP_565;
209 } else if (caps & CLCD_CAP_5551) {
210 var->green.length = 5;
211 caps &= CLCD_CAP_5551;
212 } else {
213 var->green.length = 4;
214 caps &= CLCD_CAP_444;
215 }
216 }
217
218 if (var->green.length >= 5) {
219 var->red.length = 5;
220 var->blue.length = 5;
221 } else {
222 var->red.length = 4;
223 var->blue.length = 4;
224 }
225 break;
Linus Walleij046ad6c2016-06-16 11:36:16 +0200226 case 24:
227 if (fb->vendor->packed_24_bit_pixels) {
228 var->red.length = 8;
229 var->green.length = 8;
230 var->blue.length = 8;
231 } else {
232 ret = -EINVAL;
233 }
234 break;
Russell King7b4e9ce2011-01-21 14:03:28 +0000235 case 32:
236 /* If we can't do 888, reject */
237 caps &= CLCD_CAP_888;
238 if (!caps) {
239 ret = -EINVAL;
240 break;
241 }
242
243 var->red.length = 8;
244 var->green.length = 8;
245 var->blue.length = 8;
246 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700247 default:
248 ret = -EINVAL;
249 break;
250 }
251
Russell Kingc43e6f02006-01-26 14:12:06 +0000252 /*
253 * >= 16bpp displays have separate colour component bitfields
254 * encoded in the pixel data. Calculate their position from
255 * the bitfield length defined above.
256 */
257 if (ret == 0 && var->bits_per_pixel >= 16) {
Russell King7b4e9ce2011-01-21 14:03:28 +0000258 bool bgr, rgb;
259
260 bgr = caps & CLCD_CAP_BGR && var->blue.offset == 0;
261 rgb = caps & CLCD_CAP_RGB && var->red.offset == 0;
262
263 if (!bgr && !rgb)
264 /*
265 * The requested format was not possible, try just
266 * our capabilities. One of BGR or RGB must be
267 * supported.
268 */
269 bgr = caps & CLCD_CAP_BGR;
270
271 if (bgr) {
Russell Kingc43e6f02006-01-26 14:12:06 +0000272 var->blue.offset = 0;
273 var->green.offset = var->blue.offset + var->blue.length;
274 var->red.offset = var->green.offset + var->green.length;
275 } else {
276 var->red.offset = 0;
277 var->green.offset = var->red.offset + var->red.length;
278 var->blue.offset = var->green.offset + var->green.length;
279 }
280 }
281
Linus Torvalds1da177e2005-04-16 15:20:36 -0700282 return ret;
283}
284
285static int clcdfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
286{
287 struct clcd_fb *fb = to_clcd(info);
288 int ret = -EINVAL;
289
290 if (fb->board->check)
291 ret = fb->board->check(fb, var);
Russell King82235e92005-04-28 10:43:52 +0100292
293 if (ret == 0 &&
294 var->xres_virtual * var->bits_per_pixel / 8 *
295 var->yres_virtual > fb->fb.fix.smem_len)
296 ret = -EINVAL;
297
Linus Torvalds1da177e2005-04-16 15:20:36 -0700298 if (ret == 0)
299 ret = clcdfb_set_bitfields(fb, var);
300
301 return ret;
302}
303
304static int clcdfb_set_par(struct fb_info *info)
305{
306 struct clcd_fb *fb = to_clcd(info);
307 struct clcd_regs regs;
308
309 fb->fb.fix.line_length = fb->fb.var.xres_virtual *
310 fb->fb.var.bits_per_pixel / 8;
311
312 if (fb->fb.var.bits_per_pixel <= 8)
313 fb->fb.fix.visual = FB_VISUAL_PSEUDOCOLOR;
314 else
315 fb->fb.fix.visual = FB_VISUAL_TRUECOLOR;
316
317 fb->board->decode(fb, &regs);
318
319 clcdfb_disable(fb);
320
Linus Walleij046ad6c2016-06-16 11:36:16 +0200321 /* Some variants must be clocked here */
322 if (fb->vendor->clock_timregs && !fb->clk_enabled) {
323 fb->clk_enabled = true;
324 clk_enable(fb->clk);
325 }
326
Linus Torvalds1da177e2005-04-16 15:20:36 -0700327 writel(regs.tim0, fb->regs + CLCD_TIM0);
328 writel(regs.tim1, fb->regs + CLCD_TIM1);
329 writel(regs.tim2, fb->regs + CLCD_TIM2);
330 writel(regs.tim3, fb->regs + CLCD_TIM3);
331
332 clcdfb_set_start(fb);
333
334 clk_set_rate(fb->clk, (1000000000 / regs.pixclock) * 1000);
335
336 fb->clcd_cntl = regs.cntl;
337
338 clcdfb_enable(fb, regs.cntl);
339
340#ifdef DEBUG
Joe Perchesad361c92009-07-06 13:05:40 -0700341 printk(KERN_INFO
342 "CLCD: Registers set to\n"
343 " %08x %08x %08x %08x\n"
344 " %08x %08x %08x %08x\n",
Linus Torvalds1da177e2005-04-16 15:20:36 -0700345 readl(fb->regs + CLCD_TIM0), readl(fb->regs + CLCD_TIM1),
346 readl(fb->regs + CLCD_TIM2), readl(fb->regs + CLCD_TIM3),
347 readl(fb->regs + CLCD_UBAS), readl(fb->regs + CLCD_LBAS),
Russell King3f175222010-02-12 14:32:01 +0000348 readl(fb->regs + fb->off_ienb), readl(fb->regs + fb->off_cntl));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700349#endif
350
351 return 0;
352}
353
354static inline u32 convert_bitfield(int val, struct fb_bitfield *bf)
355{
356 unsigned int mask = (1 << bf->length) - 1;
357
358 return (val >> (16 - bf->length) & mask) << bf->offset;
359}
360
361/*
362 * Set a single color register. The values supplied have a 16 bit
363 * magnitude. Return != 0 for invalid regno.
364 */
365static int
366clcdfb_setcolreg(unsigned int regno, unsigned int red, unsigned int green,
367 unsigned int blue, unsigned int transp, struct fb_info *info)
368{
369 struct clcd_fb *fb = to_clcd(info);
370
371 if (regno < 16)
372 fb->cmap[regno] = convert_bitfield(transp, &fb->fb.var.transp) |
373 convert_bitfield(blue, &fb->fb.var.blue) |
374 convert_bitfield(green, &fb->fb.var.green) |
375 convert_bitfield(red, &fb->fb.var.red);
376
Russell King1ddb8a12005-04-30 22:39:51 +0100377 if (fb->fb.fix.visual == FB_VISUAL_PSEUDOCOLOR && regno < 256) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700378 int hw_reg = CLCD_PALETTE + ((regno * 2) & ~3);
379 u32 val, mask, newval;
380
381 newval = (red >> 11) & 0x001f;
382 newval |= (green >> 6) & 0x03e0;
383 newval |= (blue >> 1) & 0x7c00;
384
385 /*
386 * 3.2.11: if we're configured for big endian
387 * byte order, the palette entries are swapped.
388 */
389 if (fb->clcd_cntl & CNTL_BEBO)
390 regno ^= 1;
391
392 if (regno & 1) {
393 newval <<= 16;
394 mask = 0x0000ffff;
395 } else {
396 mask = 0xffff0000;
397 }
398
399 val = readl(fb->regs + hw_reg) & mask;
400 writel(val | newval, fb->regs + hw_reg);
401 }
402
403 return regno > 255;
404}
405
406/*
407 * Blank the screen if blank_mode != 0, else unblank. If blank == NULL
408 * then the caller blanks by setting the CLUT (Color Look Up Table) to all
409 * black. Return 0 if blanking succeeded, != 0 if un-/blanking failed due
410 * to e.g. a video mode which doesn't support it. Implements VESA suspend
411 * and powerdown modes on hardware that supports disabling hsync/vsync:
412 * blank_mode == 2: suspend vsync
413 * blank_mode == 3: suspend hsync
414 * blank_mode == 4: powerdown
415 */
416static int clcdfb_blank(int blank_mode, struct fb_info *info)
417{
418 struct clcd_fb *fb = to_clcd(info);
419
420 if (blank_mode != 0) {
421 clcdfb_disable(fb);
422 } else {
423 clcdfb_enable(fb, fb->clcd_cntl);
424 }
425 return 0;
426}
427
Christoph Hellwig216d5262006-01-14 13:21:25 -0800428static int clcdfb_mmap(struct fb_info *info,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700429 struct vm_area_struct *vma)
430{
431 struct clcd_fb *fb = to_clcd(info);
432 unsigned long len, off = vma->vm_pgoff << PAGE_SHIFT;
433 int ret = -EINVAL;
434
435 len = info->fix.smem_len;
436
437 if (off <= len && vma->vm_end - vma->vm_start <= len - off &&
438 fb->board->mmap)
439 ret = fb->board->mmap(fb, vma);
440
441 return ret;
442}
443
444static struct fb_ops clcdfb_ops = {
445 .owner = THIS_MODULE,
446 .fb_check_var = clcdfb_check_var,
447 .fb_set_par = clcdfb_set_par,
448 .fb_setcolreg = clcdfb_setcolreg,
449 .fb_blank = clcdfb_blank,
450 .fb_fillrect = cfb_fillrect,
451 .fb_copyarea = cfb_copyarea,
452 .fb_imageblit = cfb_imageblit,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700453 .fb_mmap = clcdfb_mmap,
454};
455
456static int clcdfb_register(struct clcd_fb *fb)
457{
458 int ret;
459
Russell King3f175222010-02-12 14:32:01 +0000460 /*
461 * ARM PL111 always has IENB at 0x1c; it's only PL110
462 * which is reversed on some platforms.
463 */
464 if (amba_manf(fb->dev) == 0x41 && amba_part(fb->dev) == 0x111) {
465 fb->off_ienb = CLCD_PL111_IENB;
466 fb->off_cntl = CLCD_PL111_CNTL;
467 } else {
Linus Walleijf36fdac2016-02-23 11:01:38 +0100468 if (of_machine_is_compatible("arm,versatile-ab") ||
469 of_machine_is_compatible("arm,versatile-pb")) {
470 fb->off_ienb = CLCD_PL111_IENB;
471 fb->off_cntl = CLCD_PL111_CNTL;
472 } else {
473 fb->off_ienb = CLCD_PL110_IENB;
474 fb->off_cntl = CLCD_PL110_CNTL;
475 }
Russell King3f175222010-02-12 14:32:01 +0000476 }
477
Russell Kingee569c42008-11-30 17:38:14 +0000478 fb->clk = clk_get(&fb->dev->dev, NULL);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700479 if (IS_ERR(fb->clk)) {
480 ret = PTR_ERR(fb->clk);
481 goto out;
482 }
483
Russell King99df4ee2011-09-22 12:34:31 +0100484 ret = clk_prepare(fb->clk);
485 if (ret)
486 goto free_clk;
487
Loïc Minier17e8c4e2011-06-20 20:44:17 +0000488 fb->fb.device = &fb->dev->dev;
489
Linus Torvalds1da177e2005-04-16 15:20:36 -0700490 fb->fb.fix.mmio_start = fb->dev->res.start;
Linus Walleijdc890c22009-06-07 23:27:31 +0100491 fb->fb.fix.mmio_len = resource_size(&fb->dev->res);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700492
493 fb->regs = ioremap(fb->fb.fix.mmio_start, fb->fb.fix.mmio_len);
494 if (!fb->regs) {
495 printk(KERN_ERR "CLCD: unable to remap registers\n");
496 ret = -ENOMEM;
Russell King99df4ee2011-09-22 12:34:31 +0100497 goto clk_unprep;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700498 }
499
500 fb->fb.fbops = &clcdfb_ops;
501 fb->fb.flags = FBINFO_FLAG_DEFAULT;
502 fb->fb.pseudo_palette = fb->cmap;
503
504 strncpy(fb->fb.fix.id, clcd_name, sizeof(fb->fb.fix.id));
505 fb->fb.fix.type = FB_TYPE_PACKED_PIXELS;
506 fb->fb.fix.type_aux = 0;
507 fb->fb.fix.xpanstep = 0;
508 fb->fb.fix.ypanstep = 0;
509 fb->fb.fix.ywrapstep = 0;
510 fb->fb.fix.accel = FB_ACCEL_NONE;
511
512 fb->fb.var.xres = fb->panel->mode.xres;
513 fb->fb.var.yres = fb->panel->mode.yres;
514 fb->fb.var.xres_virtual = fb->panel->mode.xres;
515 fb->fb.var.yres_virtual = fb->panel->mode.yres;
516 fb->fb.var.bits_per_pixel = fb->panel->bpp;
517 fb->fb.var.grayscale = fb->panel->grayscale;
518 fb->fb.var.pixclock = fb->panel->mode.pixclock;
519 fb->fb.var.left_margin = fb->panel->mode.left_margin;
520 fb->fb.var.right_margin = fb->panel->mode.right_margin;
521 fb->fb.var.upper_margin = fb->panel->mode.upper_margin;
522 fb->fb.var.lower_margin = fb->panel->mode.lower_margin;
523 fb->fb.var.hsync_len = fb->panel->mode.hsync_len;
524 fb->fb.var.vsync_len = fb->panel->mode.vsync_len;
525 fb->fb.var.sync = fb->panel->mode.sync;
526 fb->fb.var.vmode = fb->panel->mode.vmode;
527 fb->fb.var.activate = FB_ACTIVATE_NOW;
528 fb->fb.var.nonstd = 0;
529 fb->fb.var.height = fb->panel->height;
530 fb->fb.var.width = fb->panel->width;
531 fb->fb.var.accel_flags = 0;
532
533 fb->fb.monspecs.hfmin = 0;
534 fb->fb.monspecs.hfmax = 100000;
535 fb->fb.monspecs.vfmin = 0;
536 fb->fb.monspecs.vfmax = 400;
537 fb->fb.monspecs.dclkmin = 1000000;
538 fb->fb.monspecs.dclkmax = 100000000;
539
540 /*
541 * Make sure that the bitfields are set appropriately.
542 */
543 clcdfb_set_bitfields(fb, &fb->fb.var);
544
545 /*
546 * Allocate colourmap.
547 */
Andres Salomon909baf02009-03-31 15:25:29 -0700548 ret = fb_alloc_cmap(&fb->fb.cmap, 256, 0);
549 if (ret)
550 goto unmap;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700551
552 /*
553 * Ensure interrupts are disabled.
554 */
Russell King3f175222010-02-12 14:32:01 +0000555 writel(0, fb->regs + fb->off_ienb);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700556
557 fb_set_var(&fb->fb, &fb->fb.var);
558
Russell Kingff643322011-01-19 21:10:24 +0000559 dev_info(&fb->dev->dev, "%s hardware, %s display\n",
560 fb->board->name, fb->panel->mode.name);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700561
562 ret = register_framebuffer(&fb->fb);
563 if (ret == 0)
564 goto out;
565
566 printk(KERN_ERR "CLCD: cannot register framebuffer (%d)\n", ret);
567
Andres Salomon909baf02009-03-31 15:25:29 -0700568 fb_dealloc_cmap(&fb->fb.cmap);
569 unmap:
Linus Torvalds1da177e2005-04-16 15:20:36 -0700570 iounmap(fb->regs);
Russell King99df4ee2011-09-22 12:34:31 +0100571 clk_unprep:
572 clk_unprepare(fb->clk);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700573 free_clk:
574 clk_put(fb->clk);
575 out:
576 return ret;
577}
578
Pawel Molld10715be2014-06-24 12:55:11 +0100579#ifdef CONFIG_OF
580static int clcdfb_of_get_dpi_panel_mode(struct device_node *node,
Linus Walleijaf298972016-06-16 11:36:14 +0200581 struct clcd_panel *clcd_panel)
Pawel Molld10715be2014-06-24 12:55:11 +0100582{
583 int err;
584 struct display_timing timing;
585 struct videomode video;
586
587 err = of_get_display_timing(node, "panel-timing", &timing);
588 if (err)
589 return err;
590
591 videomode_from_timing(&timing, &video);
592
Linus Walleijaf298972016-06-16 11:36:14 +0200593 err = fb_videomode_from_videomode(&video, &clcd_panel->mode);
Pawel Molld10715be2014-06-24 12:55:11 +0100594 if (err)
595 return err;
596
Linus Walleijaf298972016-06-16 11:36:14 +0200597 /* Set up some inversion flags */
598 if (timing.flags & DISPLAY_FLAGS_PIXDATA_NEGEDGE)
599 clcd_panel->tim2 |= TIM2_IPC;
600 else if (!(timing.flags & DISPLAY_FLAGS_PIXDATA_POSEDGE))
601 /*
602 * To preserve backwards compatibility, the IPC (inverted
603 * pixel clock) flag needs to be set on any display that
604 * doesn't explicitly specify that the pixel clock is
605 * active on the negative or positive edge.
606 */
607 clcd_panel->tim2 |= TIM2_IPC;
608
609 if (timing.flags & DISPLAY_FLAGS_HSYNC_LOW)
610 clcd_panel->tim2 |= TIM2_IHS;
611
612 if (timing.flags & DISPLAY_FLAGS_VSYNC_LOW)
613 clcd_panel->tim2 |= TIM2_IVS;
614
615 if (timing.flags & DISPLAY_FLAGS_DE_LOW)
616 clcd_panel->tim2 |= TIM2_IOE;
617
Pawel Molld10715be2014-06-24 12:55:11 +0100618 return 0;
619}
620
621static int clcdfb_snprintf_mode(char *buf, int size, struct fb_videomode *mode)
622{
623 return snprintf(buf, size, "%ux%u@%u", mode->xres, mode->yres,
624 mode->refresh);
625}
626
Vladimir Zapolskiy6306b3a2017-01-30 17:39:48 +0100627static int clcdfb_of_get_backlight(struct device_node *panel,
Linus Walleijc38162b2016-06-16 11:36:13 +0200628 struct clcd_panel *clcd_panel)
629{
Linus Walleijc38162b2016-06-16 11:36:13 +0200630 struct device_node *backlight;
631
Linus Walleijc38162b2016-06-16 11:36:13 +0200632 /* Look up the optional backlight phandle */
633 backlight = of_parse_phandle(panel, "backlight", 0);
634 if (backlight) {
635 clcd_panel->backlight = of_find_backlight_by_node(backlight);
636 of_node_put(backlight);
637
638 if (!clcd_panel->backlight)
639 return -EPROBE_DEFER;
640 }
641 return 0;
642}
643
Vladimir Zapolskiy6306b3a2017-01-30 17:39:48 +0100644static int clcdfb_of_get_mode(struct device *dev, struct device_node *panel,
645 struct clcd_panel *clcd_panel)
Pawel Molld10715be2014-06-24 12:55:11 +0100646{
647 int err;
Linus Walleijaf298972016-06-16 11:36:14 +0200648 struct fb_videomode *mode;
Pawel Molld10715be2014-06-24 12:55:11 +0100649 char *name;
650 int len;
651
Pawel Molld10715be2014-06-24 12:55:11 +0100652 /* Only directly connected DPI panels supported for now */
653 if (of_device_is_compatible(panel, "panel-dpi"))
Linus Walleijaf298972016-06-16 11:36:14 +0200654 err = clcdfb_of_get_dpi_panel_mode(panel, clcd_panel);
Pawel Molld10715be2014-06-24 12:55:11 +0100655 else
656 err = -ENOENT;
657 if (err)
658 return err;
Linus Walleijaf298972016-06-16 11:36:14 +0200659 mode = &clcd_panel->mode;
Pawel Molld10715be2014-06-24 12:55:11 +0100660
661 len = clcdfb_snprintf_mode(NULL, 0, mode);
662 name = devm_kzalloc(dev, len + 1, GFP_KERNEL);
Kiran Padwal11f09e52015-02-11 15:06:45 +0530663 if (!name)
664 return -ENOMEM;
665
Pawel Molld10715be2014-06-24 12:55:11 +0100666 clcdfb_snprintf_mode(name, len + 1, mode);
667 mode->name = name;
668
669 return 0;
670}
671
672static int clcdfb_of_init_tft_panel(struct clcd_fb *fb, u32 r0, u32 g0, u32 b0)
673{
674 static struct {
675 unsigned int part;
676 u32 r0, g0, b0;
677 u32 caps;
678 } panels[] = {
679 { 0x110, 1, 7, 13, CLCD_CAP_5551 },
680 { 0x110, 0, 8, 16, CLCD_CAP_888 },
Linus Walleij03d14c32016-06-16 11:36:15 +0200681 { 0x110, 16, 8, 0, CLCD_CAP_888 },
Pawel Molld10715be2014-06-24 12:55:11 +0100682 { 0x111, 4, 14, 20, CLCD_CAP_444 },
683 { 0x111, 3, 11, 19, CLCD_CAP_444 | CLCD_CAP_5551 },
684 { 0x111, 3, 10, 19, CLCD_CAP_444 | CLCD_CAP_5551 |
685 CLCD_CAP_565 },
686 { 0x111, 0, 8, 16, CLCD_CAP_444 | CLCD_CAP_5551 |
687 CLCD_CAP_565 | CLCD_CAP_888 },
688 };
689 int i;
690
Linus Walleijaf298972016-06-16 11:36:14 +0200691 /* Bypass pixel clock divider */
692 fb->panel->tim2 |= TIM2_BCD;
Pawel Molld10715be2014-06-24 12:55:11 +0100693
694 /* TFT display, vert. comp. interrupt at the start of the back porch */
695 fb->panel->cntl |= CNTL_LCDTFT | CNTL_LCDVCOMP(1);
696
697 fb->panel->caps = 0;
698
699 /* Match the setup with known variants */
700 for (i = 0; i < ARRAY_SIZE(panels) && !fb->panel->caps; i++) {
701 if (amba_part(fb->dev) != panels[i].part)
702 continue;
703 if (g0 != panels[i].g0)
704 continue;
705 if (r0 == panels[i].r0 && b0 == panels[i].b0)
Pawel Molle4cf39e2014-09-10 15:15:53 +0100706 fb->panel->caps = panels[i].caps;
Pawel Molld10715be2014-06-24 12:55:11 +0100707 }
708
Linus Walleij03d14c32016-06-16 11:36:15 +0200709 /*
710 * If we actually physically connected the R lines to B and
711 * vice versa
712 */
713 if (r0 != 0 && b0 == 0)
714 fb->panel->bgr_connection = true;
715
Linus Walleij046ad6c2016-06-16 11:36:16 +0200716 if (fb->panel->caps && fb->vendor->st_bitmux_control) {
717 /*
718 * Set up the special bits for the Nomadik control register
719 * (other platforms tend to do this through an external
720 * register).
721 */
722
723 /* Offset of the highest used color */
724 int maxoff = max3(r0, g0, b0);
725 /* Most significant bit out, highest used bit */
726 int msb = 0;
727
728 if (fb->panel->caps & CLCD_CAP_888) {
729 msb = maxoff + 8 - 1;
730 } else if (fb->panel->caps & CLCD_CAP_565) {
731 msb = maxoff + 5 - 1;
732 fb->panel->cntl |= CNTL_ST_1XBPP_565;
733 } else if (fb->panel->caps & CLCD_CAP_5551) {
734 msb = maxoff + 5 - 1;
735 fb->panel->cntl |= CNTL_ST_1XBPP_5551;
736 } else if (fb->panel->caps & CLCD_CAP_444) {
737 msb = maxoff + 4 - 1;
738 fb->panel->cntl |= CNTL_ST_1XBPP_444;
739 }
740
741 /* Send out as many bits as we need */
742 if (msb > 17)
743 fb->panel->cntl |= CNTL_ST_CDWID_24;
744 else if (msb > 15)
745 fb->panel->cntl |= CNTL_ST_CDWID_18;
746 else if (msb > 11)
747 fb->panel->cntl |= CNTL_ST_CDWID_16;
748 else
749 fb->panel->cntl |= CNTL_ST_CDWID_12;
750 }
751
Pawel Molld10715be2014-06-24 12:55:11 +0100752 return fb->panel->caps ? 0 : -EINVAL;
753}
754
755static int clcdfb_of_init_display(struct clcd_fb *fb)
756{
Vladimir Zapolskiybe736792017-01-30 17:39:48 +0100757 struct device_node *endpoint, *panel;
Pawel Molld10715be2014-06-24 12:55:11 +0100758 int err;
Jon Medhurst (Tixy)2b6c53b2014-08-20 13:41:04 +0100759 unsigned int bpp;
Pawel Molld10715be2014-06-24 12:55:11 +0100760 u32 max_bandwidth;
761 u32 tft_r0b0g0[3];
762
763 fb->panel = devm_kzalloc(&fb->dev->dev, sizeof(*fb->panel), GFP_KERNEL);
764 if (!fb->panel)
765 return -ENOMEM;
766
Linus Walleij046ad6c2016-06-16 11:36:16 +0200767 /*
768 * Fetch the panel endpoint.
769 */
Arnd Bergmann1121a412016-08-26 17:25:43 +0200770 endpoint = of_graph_get_next_endpoint(fb->dev->dev.of_node, NULL);
771 if (!endpoint)
772 return -ENODEV;
Linus Walleij046ad6c2016-06-16 11:36:16 +0200773
Vladimir Zapolskiybe736792017-01-30 17:39:48 +0100774 panel = of_graph_get_remote_port_parent(endpoint);
775 if (!panel)
776 return -ENODEV;
777
Linus Walleij046ad6c2016-06-16 11:36:16 +0200778 if (fb->vendor->init_panel) {
Vladimir Zapolskiybe736792017-01-30 17:39:48 +0100779 err = fb->vendor->init_panel(fb, panel);
Linus Walleij046ad6c2016-06-16 11:36:16 +0200780 if (err)
781 return err;
782 }
Pawel Molld10715be2014-06-24 12:55:11 +0100783
Vladimir Zapolskiy6306b3a2017-01-30 17:39:48 +0100784 err = clcdfb_of_get_backlight(panel, fb->panel);
Linus Walleijc38162b2016-06-16 11:36:13 +0200785 if (err)
786 return err;
787
Vladimir Zapolskiy6306b3a2017-01-30 17:39:48 +0100788 err = clcdfb_of_get_mode(&fb->dev->dev, panel, fb->panel);
Pawel Molld10715be2014-06-24 12:55:11 +0100789 if (err)
790 return err;
791
792 err = of_property_read_u32(fb->dev->dev.of_node, "max-memory-bandwidth",
793 &max_bandwidth);
Jon Medhurst (Tixy)2b6c53b2014-08-20 13:41:04 +0100794 if (!err) {
795 /*
796 * max_bandwidth is in bytes per second and pixclock in
797 * pico-seconds, so the maximum allowed bits per pixel is
798 * 8 * max_bandwidth / (PICOS2KHZ(pixclock) * 1000)
799 * Rearrange this calculation to avoid overflow and then ensure
800 * result is a valid format.
801 */
802 bpp = max_bandwidth / (1000 / 8)
803 / PICOS2KHZ(fb->panel->mode.pixclock);
804 bpp = rounddown_pow_of_two(bpp);
805 if (bpp > 32)
806 bpp = 32;
807 } else
808 bpp = 32;
809 fb->panel->bpp = bpp;
Pawel Molld10715be2014-06-24 12:55:11 +0100810
811#ifdef CONFIG_CPU_BIG_ENDIAN
812 fb->panel->cntl |= CNTL_BEBO;
813#endif
814 fb->panel->width = -1;
815 fb->panel->height = -1;
816
817 if (of_property_read_u32_array(endpoint,
818 "arm,pl11x,tft-r0g0b0-pads",
Linus Walleij046ad6c2016-06-16 11:36:16 +0200819 tft_r0b0g0, ARRAY_SIZE(tft_r0b0g0)) != 0)
820 return -ENOENT;
Pawel Molld10715be2014-06-24 12:55:11 +0100821
Linus Walleij046ad6c2016-06-16 11:36:16 +0200822 return clcdfb_of_init_tft_panel(fb, tft_r0b0g0[0],
823 tft_r0b0g0[1], tft_r0b0g0[2]);
Pawel Molld10715be2014-06-24 12:55:11 +0100824}
825
826static int clcdfb_of_vram_setup(struct clcd_fb *fb)
827{
828 int err;
829 struct device_node *memory;
830 u64 size;
831
832 err = clcdfb_of_init_display(fb);
833 if (err)
834 return err;
835
836 memory = of_parse_phandle(fb->dev->dev.of_node, "memory-region", 0);
837 if (!memory)
838 return -ENODEV;
839
840 fb->fb.screen_base = of_iomap(memory, 0);
841 if (!fb->fb.screen_base)
842 return -ENOMEM;
843
844 fb->fb.fix.smem_start = of_translate_address(memory,
845 of_get_address(memory, 0, &size, NULL));
846 fb->fb.fix.smem_len = size;
847
848 return 0;
849}
850
851static int clcdfb_of_vram_mmap(struct clcd_fb *fb, struct vm_area_struct *vma)
852{
853 unsigned long off, user_size, kernel_size;
854
855
856 off = vma->vm_pgoff << PAGE_SHIFT;
857 user_size = vma->vm_end - vma->vm_start;
858 kernel_size = fb->fb.fix.smem_len;
859
860 if (off >= kernel_size || user_size > (kernel_size - off))
861 return -ENXIO;
862
863 return remap_pfn_range(vma, vma->vm_start,
864 __phys_to_pfn(fb->fb.fix.smem_start) + vma->vm_pgoff,
865 user_size,
866 pgprot_writecombine(vma->vm_page_prot));
867}
868
869static void clcdfb_of_vram_remove(struct clcd_fb *fb)
870{
871 iounmap(fb->fb.screen_base);
872}
873
874static int clcdfb_of_dma_setup(struct clcd_fb *fb)
875{
876 unsigned long framesize;
877 dma_addr_t dma;
878 int err;
879
880 err = clcdfb_of_init_display(fb);
881 if (err)
882 return err;
883
Liam Beguin9a1c7792017-04-07 17:03:24 +0200884 framesize = PAGE_ALIGN(fb->panel->mode.xres * fb->panel->mode.yres *
885 fb->panel->bpp / 8);
Pawel Molld10715be2014-06-24 12:55:11 +0100886 fb->fb.screen_base = dma_alloc_coherent(&fb->dev->dev, framesize,
887 &dma, GFP_KERNEL);
888 if (!fb->fb.screen_base)
889 return -ENOMEM;
890
891 fb->fb.fix.smem_start = dma;
892 fb->fb.fix.smem_len = framesize;
893
894 return 0;
895}
896
897static int clcdfb_of_dma_mmap(struct clcd_fb *fb, struct vm_area_struct *vma)
898{
Luis R. Rodriguezf6e45662016-01-22 18:34:22 -0800899 return dma_mmap_wc(&fb->dev->dev, vma, fb->fb.screen_base,
900 fb->fb.fix.smem_start, fb->fb.fix.smem_len);
Pawel Molld10715be2014-06-24 12:55:11 +0100901}
902
903static void clcdfb_of_dma_remove(struct clcd_fb *fb)
904{
905 dma_free_coherent(&fb->dev->dev, fb->fb.fix.smem_len,
906 fb->fb.screen_base, fb->fb.fix.smem_start);
907}
908
909static struct clcd_board *clcdfb_of_get_board(struct amba_device *dev)
910{
911 struct clcd_board *board = devm_kzalloc(&dev->dev, sizeof(*board),
912 GFP_KERNEL);
913 struct device_node *node = dev->dev.of_node;
914
915 if (!board)
916 return NULL;
917
918 board->name = of_node_full_name(node);
919 board->caps = CLCD_CAP_ALL;
920 board->check = clcdfb_check;
921 board->decode = clcdfb_decode;
922 if (of_find_property(node, "memory-region", NULL)) {
923 board->setup = clcdfb_of_vram_setup;
924 board->mmap = clcdfb_of_vram_mmap;
925 board->remove = clcdfb_of_vram_remove;
926 } else {
927 board->setup = clcdfb_of_dma_setup;
928 board->mmap = clcdfb_of_dma_mmap;
929 board->remove = clcdfb_of_dma_remove;
930 }
931
932 return board;
933}
934#else
Pawel Moll1d5167b2014-08-01 15:43:34 +0100935static struct clcd_board *clcdfb_of_get_board(struct amba_device *dev)
Pawel Molld10715be2014-06-24 12:55:11 +0100936{
937 return NULL;
938}
939#endif
940
Russell Kingaa25afa2011-02-19 15:55:00 +0000941static int clcdfb_probe(struct amba_device *dev, const struct amba_id *id)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700942{
Jingoo Han46d2db82013-09-17 14:03:53 +0900943 struct clcd_board *board = dev_get_platdata(&dev->dev);
Linus Walleij046ad6c2016-06-16 11:36:16 +0200944 struct clcd_vendor_data *vendor = id->data;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700945 struct clcd_fb *fb;
946 int ret;
947
948 if (!board)
Pawel Molld10715be2014-06-24 12:55:11 +0100949 board = clcdfb_of_get_board(dev);
950
951 if (!board)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700952 return -EINVAL;
953
Linus Walleij046ad6c2016-06-16 11:36:16 +0200954 if (vendor->init_board) {
955 ret = vendor->init_board(dev, board);
956 if (ret)
957 return ret;
958 }
959
Russell Kinge0a8ba22013-06-27 10:29:32 +0100960 ret = dma_set_mask_and_coherent(&dev->dev, DMA_BIT_MASK(32));
961 if (ret)
962 goto out;
963
Linus Torvalds1da177e2005-04-16 15:20:36 -0700964 ret = amba_request_regions(dev, NULL);
965 if (ret) {
966 printk(KERN_ERR "CLCD: unable to reserve regs region\n");
967 goto out;
968 }
969
Markus Elfringd6f58612018-03-28 16:34:29 +0200970 fb = kzalloc(sizeof(*fb), GFP_KERNEL);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700971 if (!fb) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700972 ret = -ENOMEM;
973 goto free_region;
974 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700975
976 fb->dev = dev;
Linus Walleij046ad6c2016-06-16 11:36:16 +0200977 fb->vendor = vendor;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700978 fb->board = board;
979
Linus Walleij046ad6c2016-06-16 11:36:16 +0200980 dev_info(&fb->dev->dev, "PL%03x designer %02x rev%u at 0x%08llx\n",
981 amba_part(dev), amba_manf(dev), amba_rev(dev),
Russell Kingff643322011-01-19 21:10:24 +0000982 (unsigned long long)dev->res.start);
983
Linus Torvalds1da177e2005-04-16 15:20:36 -0700984 ret = fb->board->setup(fb);
985 if (ret)
986 goto free_fb;
987
Linus Walleij1d3f0cb2016-06-16 11:36:17 +0200988 ret = clcdfb_register(fb);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700989 if (ret == 0) {
990 amba_set_drvdata(dev, fb);
991 goto out;
992 }
993
994 fb->board->remove(fb);
995 free_fb:
996 kfree(fb);
997 free_region:
998 amba_release_regions(dev);
999 out:
1000 return ret;
1001}
1002
1003static int clcdfb_remove(struct amba_device *dev)
1004{
1005 struct clcd_fb *fb = amba_get_drvdata(dev);
1006
Linus Torvalds1da177e2005-04-16 15:20:36 -07001007 clcdfb_disable(fb);
1008 unregister_framebuffer(&fb->fb);
Andres Salomon909baf02009-03-31 15:25:29 -07001009 if (fb->fb.cmap.len)
1010 fb_dealloc_cmap(&fb->fb.cmap);
Linus Torvalds1da177e2005-04-16 15:20:36 -07001011 iounmap(fb->regs);
Russell King99df4ee2011-09-22 12:34:31 +01001012 clk_unprepare(fb->clk);
Linus Torvalds1da177e2005-04-16 15:20:36 -07001013 clk_put(fb->clk);
1014
1015 fb->board->remove(fb);
1016
1017 kfree(fb);
1018
1019 amba_release_regions(dev);
1020
1021 return 0;
1022}
1023
Linus Walleij046ad6c2016-06-16 11:36:16 +02001024static struct clcd_vendor_data vendor_arm = {
Linus Walleij25348162016-06-16 11:36:18 +02001025 /* Sets up the versatile board displays */
1026 .init_panel = versatile_clcd_init_panel,
Linus Walleij046ad6c2016-06-16 11:36:16 +02001027};
1028
1029static struct clcd_vendor_data vendor_nomadik = {
1030 .clock_timregs = true,
1031 .packed_24_bit_pixels = true,
1032 .st_bitmux_control = true,
Linus Walleij1d3f0cb2016-06-16 11:36:17 +02001033 .init_board = nomadik_clcd_init_board,
1034 .init_panel = nomadik_clcd_init_panel,
Linus Walleij046ad6c2016-06-16 11:36:16 +02001035};
1036
Arvind Yadavbf4392b2017-09-04 16:00:49 +02001037static const struct amba_id clcdfb_id_table[] = {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001038 {
1039 .id = 0x00041110,
Russell Kinge8315562005-11-02 14:40:35 +00001040 .mask = 0x000ffffe,
Linus Walleij046ad6c2016-06-16 11:36:16 +02001041 .data = &vendor_arm,
1042 },
1043 /* ST Electronics Nomadik variant */
1044 {
1045 .id = 0x00180110,
1046 .mask = 0x00fffffe,
1047 .data = &vendor_nomadik,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001048 },
1049 { 0, 0 },
1050};
1051
Dave Martin6054f9b2011-10-05 15:15:23 +01001052MODULE_DEVICE_TABLE(amba, clcdfb_id_table);
1053
Linus Torvalds1da177e2005-04-16 15:20:36 -07001054static struct amba_driver clcd_driver = {
1055 .drv = {
Russell Kinge8315562005-11-02 14:40:35 +00001056 .name = "clcd-pl11x",
Linus Torvalds1da177e2005-04-16 15:20:36 -07001057 },
1058 .probe = clcdfb_probe,
1059 .remove = clcdfb_remove,
1060 .id_table = clcdfb_id_table,
1061};
1062
Russell King2c250132005-11-08 14:44:15 +00001063static int __init amba_clcdfb_init(void)
Linus Torvalds1da177e2005-04-16 15:20:36 -07001064{
1065 if (fb_get_options("ambafb", NULL))
1066 return -ENODEV;
1067
1068 return amba_driver_register(&clcd_driver);
1069}
1070
1071module_init(amba_clcdfb_init);
1072
1073static void __exit amba_clcdfb_exit(void)
1074{
1075 amba_driver_unregister(&clcd_driver);
1076}
1077
1078module_exit(amba_clcdfb_exit);
1079
1080MODULE_DESCRIPTION("ARM PrimeCell PL110 CLCD core driver");
1081MODULE_LICENSE("GPL");