Merge ../linus
[linux-2.6] / drivers / video / imxfb.c
1 /*
2  *  linux/drivers/video/imxfb.c
3  *
4  *  Freescale i.MX Frame Buffer device driver
5  *
6  *  Copyright (C) 2004 Sascha Hauer, Pengutronix
7  *   Based on acornfb.c Copyright (C) Russell King.
8  *
9  * This file is subject to the terms and conditions of the GNU General Public
10  * License.  See the file COPYING in the main directory of this archive for
11  * more details.
12  *
13  * Please direct your questions and comments on this driver to the following
14  * email address:
15  *
16  *      linux-arm-kernel@lists.arm.linux.org.uk
17  */
18
19 //#define DEBUG 1
20
21 #include <linux/module.h>
22 #include <linux/kernel.h>
23 #include <linux/sched.h>
24 #include <linux/errno.h>
25 #include <linux/string.h>
26 #include <linux/interrupt.h>
27 #include <linux/slab.h>
28 #include <linux/fb.h>
29 #include <linux/delay.h>
30 #include <linux/init.h>
31 #include <linux/ioport.h>
32 #include <linux/cpufreq.h>
33 #include <linux/platform_device.h>
34 #include <linux/dma-mapping.h>
35
36 #include <asm/hardware.h>
37 #include <asm/io.h>
38 #include <asm/uaccess.h>
39 #include <asm/arch/imxfb.h>
40
41 /*
42  * Complain if VAR is out of range.
43  */
44 #define DEBUG_VAR 1
45
46 #include "imxfb.h"
47
48 static struct imxfb_rgb def_rgb_16 = {
49         .red    = { .offset = 8,  .length = 4, },
50         .green  = { .offset = 4,  .length = 4, },
51         .blue   = { .offset = 0,  .length = 4, },
52         .transp = { .offset = 0,  .length = 0, },
53 };
54
55 static struct imxfb_rgb def_rgb_8 = {
56         .red    = { .offset = 0,  .length = 8, },
57         .green  = { .offset = 0,  .length = 8, },
58         .blue   = { .offset = 0,  .length = 8, },
59         .transp = { .offset = 0,  .length = 0, },
60 };
61
62 static int imxfb_activate_var(struct fb_var_screeninfo *var, struct fb_info *info);
63
64 static inline u_int chan_to_field(u_int chan, struct fb_bitfield *bf)
65 {
66         chan &= 0xffff;
67         chan >>= 16 - bf->length;
68         return chan << bf->offset;
69 }
70
71 #define LCDC_PALETTE(x) __REG2(IMX_LCDC_BASE+0x800, (x)<<2)
72 static int
73 imxfb_setpalettereg(u_int regno, u_int red, u_int green, u_int blue,
74                        u_int trans, struct fb_info *info)
75 {
76         struct imxfb_info *fbi = info->par;
77         u_int val, ret = 1;
78
79 #define CNVT_TOHW(val,width) ((((val)<<(width))+0x7FFF-(val))>>16)
80         if (regno < fbi->palette_size) {
81                 val = (CNVT_TOHW(red, 4) << 8) |
82                       (CNVT_TOHW(green,4) << 4) |
83                       CNVT_TOHW(blue,  4);
84
85                 LCDC_PALETTE(regno) = val;
86                 ret = 0;
87         }
88         return ret;
89 }
90
91 static int
92 imxfb_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
93                    u_int trans, struct fb_info *info)
94 {
95         struct imxfb_info *fbi = info->par;
96         unsigned int val;
97         int ret = 1;
98
99         /*
100          * If inverse mode was selected, invert all the colours
101          * rather than the register number.  The register number
102          * is what you poke into the framebuffer to produce the
103          * colour you requested.
104          */
105         if (fbi->cmap_inverse) {
106                 red   = 0xffff - red;
107                 green = 0xffff - green;
108                 blue  = 0xffff - blue;
109         }
110
111         /*
112          * If greyscale is true, then we convert the RGB value
113          * to greyscale no mater what visual we are using.
114          */
115         if (info->var.grayscale)
116                 red = green = blue = (19595 * red + 38470 * green +
117                                         7471 * blue) >> 16;
118
119         switch (info->fix.visual) {
120         case FB_VISUAL_TRUECOLOR:
121                 /*
122                  * 12 or 16-bit True Colour.  We encode the RGB value
123                  * according to the RGB bitfield information.
124                  */
125                 if (regno < 16) {
126                         u32 *pal = info->pseudo_palette;
127
128                         val  = chan_to_field(red, &info->var.red);
129                         val |= chan_to_field(green, &info->var.green);
130                         val |= chan_to_field(blue, &info->var.blue);
131
132                         pal[regno] = val;
133                         ret = 0;
134                 }
135                 break;
136
137         case FB_VISUAL_STATIC_PSEUDOCOLOR:
138         case FB_VISUAL_PSEUDOCOLOR:
139                 ret = imxfb_setpalettereg(regno, red, green, blue, trans, info);
140                 break;
141         }
142
143         return ret;
144 }
145
146 /*
147  *  imxfb_check_var():
148  *    Round up in the following order: bits_per_pixel, xres,
149  *    yres, xres_virtual, yres_virtual, xoffset, yoffset, grayscale,
150  *    bitfields, horizontal timing, vertical timing.
151  */
152 static int
153 imxfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
154 {
155         struct imxfb_info *fbi = info->par;
156         int rgbidx;
157
158         if (var->xres < MIN_XRES)
159                 var->xres = MIN_XRES;
160         if (var->yres < MIN_YRES)
161                 var->yres = MIN_YRES;
162         if (var->xres > fbi->max_xres)
163                 var->xres = fbi->max_xres;
164         if (var->yres > fbi->max_yres)
165                 var->yres = fbi->max_yres;
166         var->xres_virtual = max(var->xres_virtual, var->xres);
167         var->yres_virtual = max(var->yres_virtual, var->yres);
168
169         pr_debug("var->bits_per_pixel=%d\n", var->bits_per_pixel);
170         switch (var->bits_per_pixel) {
171         case 16:
172                 rgbidx = RGB_16;
173                 break;
174         case 8:
175                 rgbidx = RGB_8;
176                 break;
177         default:
178                 rgbidx = RGB_16;
179         }
180
181         /*
182          * Copy the RGB parameters for this display
183          * from the machine specific parameters.
184          */
185         var->red    = fbi->rgb[rgbidx]->red;
186         var->green  = fbi->rgb[rgbidx]->green;
187         var->blue   = fbi->rgb[rgbidx]->blue;
188         var->transp = fbi->rgb[rgbidx]->transp;
189
190         pr_debug("RGBT length = %d:%d:%d:%d\n",
191                 var->red.length, var->green.length, var->blue.length,
192                 var->transp.length);
193
194         pr_debug("RGBT offset = %d:%d:%d:%d\n",
195                 var->red.offset, var->green.offset, var->blue.offset,
196                 var->transp.offset);
197
198         return 0;
199 }
200
201 /*
202  * imxfb_set_par():
203  *      Set the user defined part of the display for the specified console
204  */
205 static int imxfb_set_par(struct fb_info *info)
206 {
207         struct imxfb_info *fbi = info->par;
208         struct fb_var_screeninfo *var = &info->var;
209
210         pr_debug("set_par\n");
211
212         if (var->bits_per_pixel == 16)
213                 info->fix.visual = FB_VISUAL_TRUECOLOR;
214         else if (!fbi->cmap_static)
215                 info->fix.visual = FB_VISUAL_PSEUDOCOLOR;
216         else {
217                 /*
218                  * Some people have weird ideas about wanting static
219                  * pseudocolor maps.  I suspect their user space
220                  * applications are broken.
221                  */
222                 info->fix.visual = FB_VISUAL_STATIC_PSEUDOCOLOR;
223         }
224
225         info->fix.line_length = var->xres_virtual *
226                                   var->bits_per_pixel / 8;
227         fbi->palette_size = var->bits_per_pixel == 8 ? 256 : 16;
228
229         imxfb_activate_var(var, info);
230
231         return 0;
232 }
233
234 static void imxfb_enable_controller(struct imxfb_info *fbi)
235 {
236         pr_debug("Enabling LCD controller\n");
237
238         /* initialize LCDC */
239         LCDC_RMCR &= ~RMCR_LCDC_EN;             /* just to be safe... */
240
241         LCDC_SSA        = fbi->screen_dma;
242         /* physical screen start address            */
243         LCDC_VPW        = VPW_VPW(fbi->max_xres * fbi->max_bpp / 8 / 4);
244
245         LCDC_POS        = 0x00000000;   /* panning offset 0 (0 pixel offset)        */
246
247         /* disable hardware cursor */
248         LCDC_CPOS       &= ~(CPOS_CC0 | CPOS_CC1);
249
250         LCDC_RMCR = RMCR_LCDC_EN;
251
252         if(fbi->backlight_power)
253                 fbi->backlight_power(1);
254         if(fbi->lcd_power)
255                 fbi->lcd_power(1);
256 }
257
258 static void imxfb_disable_controller(struct imxfb_info *fbi)
259 {
260         pr_debug("Disabling LCD controller\n");
261
262         if(fbi->backlight_power)
263                 fbi->backlight_power(0);
264         if(fbi->lcd_power)
265                 fbi->lcd_power(0);
266
267         LCDC_RMCR = 0;
268 }
269
270 static int imxfb_blank(int blank, struct fb_info *info)
271 {
272         struct imxfb_info *fbi = info->par;
273
274         pr_debug("imxfb_blank: blank=%d\n", blank);
275
276         switch (blank) {
277         case FB_BLANK_POWERDOWN:
278         case FB_BLANK_VSYNC_SUSPEND:
279         case FB_BLANK_HSYNC_SUSPEND:
280         case FB_BLANK_NORMAL:
281                 imxfb_disable_controller(fbi);
282                 break;
283
284         case FB_BLANK_UNBLANK:
285                 imxfb_enable_controller(fbi);
286                 break;
287         }
288         return 0;
289 }
290
291 static struct fb_ops imxfb_ops = {
292         .owner          = THIS_MODULE,
293         .fb_check_var   = imxfb_check_var,
294         .fb_set_par     = imxfb_set_par,
295         .fb_setcolreg   = imxfb_setcolreg,
296         .fb_fillrect    = cfb_fillrect,
297         .fb_copyarea    = cfb_copyarea,
298         .fb_imageblit   = cfb_imageblit,
299         .fb_blank       = imxfb_blank,
300 };
301
302 /*
303  * imxfb_activate_var():
304  *      Configures LCD Controller based on entries in var parameter.  Settings are
305  *      only written to the controller if changes were made.
306  */
307 static int imxfb_activate_var(struct fb_var_screeninfo *var, struct fb_info *info)
308 {
309         struct imxfb_info *fbi = info->par;
310         pr_debug("var: xres=%d hslen=%d lm=%d rm=%d\n",
311                 var->xres, var->hsync_len,
312                 var->left_margin, var->right_margin);
313         pr_debug("var: yres=%d vslen=%d um=%d bm=%d\n",
314                 var->yres, var->vsync_len,
315                 var->upper_margin, var->lower_margin);
316
317 #if DEBUG_VAR
318         if (var->xres < 16        || var->xres > 1024)
319                 printk(KERN_ERR "%s: invalid xres %d\n",
320                         info->fix.id, var->xres);
321         if (var->hsync_len < 1    || var->hsync_len > 64)
322                 printk(KERN_ERR "%s: invalid hsync_len %d\n",
323                         info->fix.id, var->hsync_len);
324         if (var->left_margin > 255)
325                 printk(KERN_ERR "%s: invalid left_margin %d\n",
326                         info->fix.id, var->left_margin);
327         if (var->right_margin > 255)
328                 printk(KERN_ERR "%s: invalid right_margin %d\n",
329                         info->fix.id, var->right_margin);
330         if (var->yres < 1 || var->yres > 511)
331                 printk(KERN_ERR "%s: invalid yres %d\n",
332                         info->fix.id, var->yres);
333         if (var->vsync_len > 100)
334                 printk(KERN_ERR "%s: invalid vsync_len %d\n",
335                         info->fix.id, var->vsync_len);
336         if (var->upper_margin > 63)
337                 printk(KERN_ERR "%s: invalid upper_margin %d\n",
338                         info->fix.id, var->upper_margin);
339         if (var->lower_margin > 255)
340                 printk(KERN_ERR "%s: invalid lower_margin %d\n",
341                         info->fix.id, var->lower_margin);
342 #endif
343
344         LCDC_HCR        = HCR_H_WIDTH(var->hsync_len) |
345                           HCR_H_WAIT_1(var->left_margin) |
346                           HCR_H_WAIT_2(var->right_margin);
347
348         LCDC_VCR        = VCR_V_WIDTH(var->vsync_len) |
349                           VCR_V_WAIT_1(var->upper_margin) |
350                           VCR_V_WAIT_2(var->lower_margin);
351
352         LCDC_SIZE       = SIZE_XMAX(var->xres) | SIZE_YMAX(var->yres);
353         LCDC_PCR        = fbi->pcr;
354         LCDC_PWMR       = fbi->pwmr;
355         LCDC_LSCR1      = fbi->lscr1;
356         LCDC_DMACR      = fbi->dmacr;
357
358         return 0;
359 }
360
361 static void imxfb_setup_gpio(struct imxfb_info *fbi)
362 {
363         int width;
364
365         LCDC_RMCR       &= ~(RMCR_LCDC_EN | RMCR_SELF_REF);
366
367         if( fbi->pcr & PCR_TFT )
368                 width = 16;
369         else
370                 width = 1 << ((fbi->pcr >> 28) & 0x3);
371
372         switch(width) {
373         case 16:
374                 imx_gpio_mode(PD30_PF_LD15);
375                 imx_gpio_mode(PD29_PF_LD14);
376                 imx_gpio_mode(PD28_PF_LD13);
377                 imx_gpio_mode(PD27_PF_LD12);
378                 imx_gpio_mode(PD26_PF_LD11);
379                 imx_gpio_mode(PD25_PF_LD10);
380                 imx_gpio_mode(PD24_PF_LD9);
381                 imx_gpio_mode(PD23_PF_LD8);
382         case 8:
383                 imx_gpio_mode(PD22_PF_LD7);
384                 imx_gpio_mode(PD21_PF_LD6);
385                 imx_gpio_mode(PD20_PF_LD5);
386                 imx_gpio_mode(PD19_PF_LD4);
387         case 4:
388                 imx_gpio_mode(PD18_PF_LD3);
389                 imx_gpio_mode(PD17_PF_LD2);
390         case 2:
391                 imx_gpio_mode(PD16_PF_LD1);
392         case 1:
393                 imx_gpio_mode(PD15_PF_LD0);
394         }
395
396         /* initialize GPIOs */
397         imx_gpio_mode(PD6_PF_LSCLK);
398         imx_gpio_mode(PD10_PF_SPL_SPR);
399         imx_gpio_mode(PD11_PF_CONTRAST);
400         imx_gpio_mode(PD14_PF_FLM_VSYNC);
401         imx_gpio_mode(PD13_PF_LP_HSYNC);
402         imx_gpio_mode(PD7_PF_REV);
403         imx_gpio_mode(PD8_PF_CLS);
404
405 #ifndef CONFIG_MACH_PIMX1
406         /* on PiMX1 used as buffers enable signal
407          */
408         imx_gpio_mode(PD9_PF_PS);
409 #endif
410
411 #ifndef CONFIG_MACH_MX1FS2
412         /* on mx1fs2 this pin is used to (de)activate the display, so we need
413          * it as a normal gpio
414          */
415         imx_gpio_mode(PD12_PF_ACD_OE);
416 #endif
417
418 }
419
420 #ifdef CONFIG_PM
421 /*
422  * Power management hooks.  Note that we won't be called from IRQ context,
423  * unlike the blank functions above, so we may sleep.
424  */
425 static int imxfb_suspend(struct platform_device *dev, pm_message_t state)
426 {
427         struct imxfb_info *fbi = platform_get_drvdata(dev);
428         pr_debug("%s\n",__FUNCTION__);
429
430         imxfb_disable_controller(fbi);
431         return 0;
432 }
433
434 static int imxfb_resume(struct platform_device *dev)
435 {
436         struct imxfb_info *fbi = platform_get_drvdata(dev);
437         pr_debug("%s\n",__FUNCTION__);
438
439         imxfb_enable_controller(fbi);
440         return 0;
441 }
442 #else
443 #define imxfb_suspend   NULL
444 #define imxfb_resume    NULL
445 #endif
446
447 static int __init imxfb_init_fbinfo(struct device *dev)
448 {
449         struct imxfb_mach_info *inf = dev->platform_data;
450         struct fb_info *info = dev_get_drvdata(dev);
451         struct imxfb_info *fbi = info->par;
452
453         pr_debug("%s\n",__FUNCTION__);
454
455         info->pseudo_palette = kmalloc( sizeof(u32) * 16, GFP_KERNEL);
456         if (!info->pseudo_palette)
457                 return -ENOMEM;
458
459         memset(fbi, 0, sizeof(struct imxfb_info));
460         fbi->dev = dev;
461
462         strlcpy(info->fix.id, IMX_NAME, sizeof(info->fix.id));
463
464         info->fix.type  = FB_TYPE_PACKED_PIXELS;
465         info->fix.type_aux              = 0;
466         info->fix.xpanstep              = 0;
467         info->fix.ypanstep              = 0;
468         info->fix.ywrapstep             = 0;
469         info->fix.accel = FB_ACCEL_NONE;
470
471         info->var.nonstd                = 0;
472         info->var.activate              = FB_ACTIVATE_NOW;
473         info->var.height                = -1;
474         info->var.width = -1;
475         info->var.accel_flags           = 0;
476         info->var.vmode = FB_VMODE_NONINTERLACED;
477
478         info->fbops                     = &imxfb_ops;
479         info->flags                     = FBINFO_FLAG_DEFAULT;
480         info->pseudo_palette            = (fbi + 1);
481
482         fbi->rgb[RGB_16]                = &def_rgb_16;
483         fbi->rgb[RGB_8]                 = &def_rgb_8;
484
485         fbi->max_xres                   = inf->xres;
486         info->var.xres                  = inf->xres;
487         info->var.xres_virtual          = inf->xres;
488         fbi->max_yres                   = inf->yres;
489         info->var.yres                  = inf->yres;
490         info->var.yres_virtual          = inf->yres;
491         fbi->max_bpp                    = inf->bpp;
492         info->var.bits_per_pixel        = inf->bpp;
493         info->var.pixclock              = inf->pixclock;
494         info->var.hsync_len             = inf->hsync_len;
495         info->var.left_margin           = inf->left_margin;
496         info->var.right_margin          = inf->right_margin;
497         info->var.vsync_len             = inf->vsync_len;
498         info->var.upper_margin          = inf->upper_margin;
499         info->var.lower_margin          = inf->lower_margin;
500         info->var.sync                  = inf->sync;
501         info->var.grayscale             = inf->cmap_greyscale;
502         fbi->cmap_inverse               = inf->cmap_inverse;
503         fbi->pcr                        = inf->pcr;
504         fbi->lscr1                      = inf->lscr1;
505         fbi->dmacr                      = inf->dmacr;
506         fbi->pwmr                       = inf->pwmr;
507         fbi->lcd_power                  = inf->lcd_power;
508         fbi->backlight_power            = inf->backlight_power;
509         info->fix.smem_len              = fbi->max_xres * fbi->max_yres *
510                                           fbi->max_bpp / 8;
511
512         return 0;
513 }
514
515 /*
516  *      Allocates the DRAM memory for the frame buffer.  This buffer is
517  *      remapped into a non-cached, non-buffered, memory region to
518  *      allow pixel writes to occur without flushing the cache.
519  *      Once this area is remapped, all virtual memory access to the
520  *      video memory should occur at the new region.
521  */
522 static int __init imxfb_map_video_memory(struct fb_info *info)
523 {
524         struct imxfb_info *fbi = info->par;
525
526         fbi->map_size = PAGE_ALIGN(info->fix.smem_len);
527         fbi->map_cpu = dma_alloc_writecombine(fbi->dev, fbi->map_size,
528                                         &fbi->map_dma,GFP_KERNEL);
529
530         if (fbi->map_cpu) {
531                 info->screen_base = fbi->map_cpu;
532                 fbi->screen_cpu = fbi->map_cpu;
533                 fbi->screen_dma = fbi->map_dma;
534                 info->fix.smem_start = fbi->screen_dma;
535         }
536
537         return fbi->map_cpu ? 0 : -ENOMEM;
538 }
539
540 static int __init imxfb_probe(struct platform_device *pdev)
541 {
542         struct imxfb_info *fbi;
543         struct fb_info *info;
544         struct imxfb_mach_info *inf;
545         struct resource *res;
546         int ret;
547
548         printk("i.MX Framebuffer driver\n");
549
550         res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
551         if(!res)
552                 return -ENODEV;
553
554         inf = pdev->dev.platform_data;
555         if(!inf) {
556                 dev_err(&pdev->dev,"No platform_data available\n");
557                 return -ENOMEM;
558         }
559
560         info = framebuffer_alloc(sizeof(struct imxfb_info), &pdev->dev);
561         if(!info)
562                 return -ENOMEM;
563
564         fbi = info->par;
565
566         platform_set_drvdata(pdev, info);
567
568         ret = imxfb_init_fbinfo(&pdev->dev);
569         if( ret < 0 )
570                 goto failed_init;
571
572         res = request_mem_region(res->start, res->end - res->start + 1, "IMXFB");
573         if (!res) {
574                 ret = -EBUSY;
575                 goto failed_regs;
576         }
577
578         if (!inf->fixed_screen_cpu) {
579                 ret = imxfb_map_video_memory(info);
580                 if (ret) {
581                         dev_err(&pdev->dev, "Failed to allocate video RAM: %d\n", ret);
582                         ret = -ENOMEM;
583                         goto failed_map;
584                 }
585         } else {
586                 /* Fixed framebuffer mapping enables location of the screen in eSRAM */
587                 fbi->map_cpu = inf->fixed_screen_cpu;
588                 fbi->map_dma = inf->fixed_screen_dma;
589                 info->screen_base = fbi->map_cpu;
590                 fbi->screen_cpu = fbi->map_cpu;
591                 fbi->screen_dma = fbi->map_dma;
592                 info->fix.smem_start = fbi->screen_dma;
593         }
594
595         /*
596          * This makes sure that our colour bitfield
597          * descriptors are correctly initialised.
598          */
599         imxfb_check_var(&info->var, info);
600
601         ret = fb_alloc_cmap(&info->cmap, 1<<info->var.bits_per_pixel, 0);
602         if (ret < 0)
603                 goto failed_cmap;
604
605         imxfb_setup_gpio(fbi);
606
607         imxfb_set_par(info);
608         ret = register_framebuffer(info);
609         if (ret < 0) {
610                 dev_err(&pdev->dev, "failed to register framebuffer\n");
611                 goto failed_register;
612         }
613
614         imxfb_enable_controller(fbi);
615
616         return 0;
617
618 failed_register:
619         fb_dealloc_cmap(&info->cmap);
620 failed_cmap:
621         if (!inf->fixed_screen_cpu)
622                 dma_free_writecombine(&pdev->dev,fbi->map_size,fbi->map_cpu,
623                            fbi->map_dma);
624 failed_map:
625         kfree(info->pseudo_palette);
626 failed_regs:
627         release_mem_region(res->start, res->end - res->start);
628 failed_init:
629         platform_set_drvdata(pdev, NULL);
630         framebuffer_release(info);
631         return ret;
632 }
633
634 static int imxfb_remove(struct platform_device *pdev)
635 {
636         struct fb_info *info = platform_get_drvdata(pdev);
637         struct imxfb_info *fbi = info->par;
638         struct resource *res;
639
640         res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
641
642         imxfb_disable_controller(fbi);
643
644         unregister_framebuffer(info);
645
646         fb_dealloc_cmap(&info->cmap);
647         kfree(info->pseudo_palette);
648         framebuffer_release(info);
649
650         release_mem_region(res->start, res->end - res->start + 1);
651         platform_set_drvdata(pdev, NULL);
652
653         return 0;
654 }
655
656 void  imxfb_shutdown(struct platform_device * dev)
657 {
658         struct fb_info *info = platform_get_drvdata(dev);
659         struct imxfb_info *fbi = info->par;
660         imxfb_disable_controller(fbi);
661 }
662
663 static struct platform_driver imxfb_driver = {
664         .probe          = imxfb_probe,
665         .suspend        = imxfb_suspend,
666         .resume         = imxfb_resume,
667         .remove         = imxfb_remove,
668         .shutdown       = imxfb_shutdown,
669         .driver         = {
670                 .name   = "imx-fb",
671         },
672 };
673
674 int __init imxfb_init(void)
675 {
676         return platform_driver_register(&imxfb_driver);
677 }
678
679 static void __exit imxfb_cleanup(void)
680 {
681         platform_driver_unregister(&imxfb_driver);
682 }
683
684 module_init(imxfb_init);
685 module_exit(imxfb_cleanup);
686
687 MODULE_DESCRIPTION("Motorola i.MX framebuffer driver");
688 MODULE_AUTHOR("Sascha Hauer, Pengutronix");
689 MODULE_LICENSE("GPL");