video/backlight: remove obsolete cleanup for clientdata
[pandora-kernel.git] / drivers / video / epson1355fb.c
1 /*
2  * linux/drivers/video/epson1355fb.c -- Epson S1D13505 frame buffer for 2.5.
3  *
4  * Epson Research S1D13505 Embedded RAMDAC LCD/CRT Controller
5  *   (previously known as SED1355)
6  *
7  * Cf. http://vdc.epson.com/
8  *
9  *
10  * Copyright (C) Hewlett-Packard Company.  All rights reserved.
11  *
12  * Written by Christopher Hoover <ch@hpl.hp.com>
13  *
14  * Adapted from:
15  *
16  *  linux/drivers/video/skeletonfb.c
17  *  Modified to new api Jan 2001 by James Simmons (jsimmons@infradead.org)
18  *  Created 28 Dec 1997 by Geert Uytterhoeven
19  *
20  *  linux/drivers/video/epson1355fb.c (2.4 driver)
21  *  Copyright (C) 2000 Philipp Rumpf <prumpf@tux.org>
22  *
23  * This file is subject to the terms and conditions of the GNU General Public
24  * License. See the file COPYING in the main directory of this archive for
25  * more details.
26  *
27  *
28  * Noteworthy Issues
29  * -----------------
30  *
31  * This driver is complicated by the fact that this is a 16-bit chip
32  * and, on at least one platform (ceiva), we can only do 16-bit reads
33  * and writes to the framebuffer.  We hide this from user space
34  * except in the case of mmap().
35  *
36  *
37  * To Do
38  * -----
39  *
40  * - Test 8-bit pseudocolor mode
41  * - Allow setting bpp, virtual resolution
42  * - Implement horizontal panning
43  * - (maybe) Implement hardware cursor
44  */
45
46 #include <linux/module.h>
47 #include <linux/kernel.h>
48 #include <linux/errno.h>
49 #include <linux/string.h>
50 #include <linux/mm.h>
51 #include <linux/delay.h>
52 #include <linux/fb.h>
53 #include <linux/init.h>
54 #include <linux/ioport.h>
55 #include <linux/platform_device.h>
56
57 #include <asm/types.h>
58 #include <asm/io.h>
59 #include <linux/uaccess.h>
60
61 #include <video/epson1355.h>
62
63 struct epson1355_par {
64         unsigned long reg_addr;
65         u32 pseudo_palette[16];
66 };
67
68 /* ------------------------------------------------------------------------- */
69
70 #if defined(CONFIG_ARM)
71
72 # ifdef CONFIG_ARCH_CEIVA
73 #  include <mach/hardware.h>
74 #  define EPSON1355FB_BASE_PHYS (CEIVA_PHYS_SED1355)
75 # endif
76
77 static inline u8 epson1355_read_reg(struct epson1355_par *par, int index)
78 {
79         return __raw_readb(par->reg_addr + index);
80 }
81
82 static inline void epson1355_write_reg(struct epson1355_par *par, u8 data, int index)
83 {
84         __raw_writeb(data, par->reg_addr + index);
85 }
86
87 #else
88 # error "no architecture-specific epson1355_{read,write}_reg"
89 #endif
90
91 #ifndef EPSON1355FB_BASE_PHYS
92 # error  "EPSON1355FB_BASE_PHYS is not defined"
93 #endif
94
95 #define EPSON1355FB_REGS_OFS    (0)
96 #define EPSON1355FB_REGS_PHYS   (EPSON1355FB_BASE_PHYS + EPSON1355FB_REGS_OFS)
97 #define EPSON1355FB_REGS_LEN    (64)
98
99 #define EPSON1355FB_FB_OFS      (0x00200000)
100 #define EPSON1355FB_FB_PHYS     (EPSON1355FB_BASE_PHYS + EPSON1355FB_FB_OFS)
101 #define EPSON1355FB_FB_LEN      (2 * 1024 * 1024)
102
103 /* ------------------------------------------------------------------------- */
104
105 static inline u16 epson1355_read_reg16(struct epson1355_par *par, int index)
106 {
107         u8 lo = epson1355_read_reg(par, index);
108         u8 hi = epson1355_read_reg(par, index + 1);
109
110         return (hi << 8) | lo;
111 }
112
113 static inline void epson1355_write_reg16(struct epson1355_par *par, u16 data, int index)
114 {
115         u8 lo = data & 0xff;
116         u8 hi = (data >> 8) & 0xff;
117
118         epson1355_write_reg(par, lo, index);
119         epson1355_write_reg(par, hi, index + 1);
120 }
121
122 static inline u32 epson1355_read_reg20(struct epson1355_par *par, int index)
123 {
124         u8 b0 = epson1355_read_reg(par, index);
125         u8 b1 = epson1355_read_reg(par, index + 1);
126         u8 b2 = epson1355_read_reg(par, index + 2);
127
128         return (b2 & 0x0f) << 16 | (b1 << 8) | b0;
129 }
130
131 static inline void epson1355_write_reg20(struct epson1355_par *par, u32 data, int index)
132 {
133         u8 b0 = data & 0xff;
134         u8 b1 = (data >> 8) & 0xff;
135         u8 b2 = (data >> 16) & 0x0f;
136
137         epson1355_write_reg(par, b0, index);
138         epson1355_write_reg(par, b1, index + 1);
139         epson1355_write_reg(par, b2, index + 2);
140 }
141
142 /* ------------------------------------------------------------------------- */
143
144 static void set_lut(struct epson1355_par *par, u8 index, u8 r, u8 g, u8 b)
145 {
146         epson1355_write_reg(par, index, REG_LUT_ADDR);
147         epson1355_write_reg(par, r, REG_LUT_DATA);
148         epson1355_write_reg(par, g, REG_LUT_DATA);
149         epson1355_write_reg(par, b, REG_LUT_DATA);
150 }
151
152
153 /**
154  *      epson1355fb_setcolreg - sets a color register.
155  *      @regno: Which register in the CLUT we are programming
156  *      @red: The red value which can be up to 16 bits wide
157  *      @green: The green value which can be up to 16 bits wide
158  *      @blue:  The blue value which can be up to 16 bits wide.
159  *      @transp: If supported the alpha value which can be up to 16 bits wide.
160  *      @info: frame buffer info structure
161  *
162  *      Returns negative errno on error, or zero on success.
163  */
164 static int epson1355fb_setcolreg(unsigned regno, unsigned r, unsigned g,
165                                  unsigned b, unsigned transp,
166                                  struct fb_info *info)
167 {
168         struct epson1355_par *par = info->par;
169
170         if (info->var.grayscale)
171                 r = g = b = (19595 * r + 38470 * g + 7471 * b) >> 16;
172
173         switch (info->fix.visual) {
174         case FB_VISUAL_TRUECOLOR:
175                 if (regno >= 16)
176                         return -EINVAL;
177
178                 ((u32 *) info->pseudo_palette)[regno] =
179                     (r & 0xf800) | (g & 0xfc00) >> 5 | (b & 0xf800) >> 11;
180
181                 break;
182         case FB_VISUAL_PSEUDOCOLOR:
183                 if (regno >= 256)
184                         return -EINVAL;
185
186                 set_lut(par, regno, r >> 8, g >> 8, b >> 8);
187
188                 break;
189         default:
190                 return -ENOSYS;
191         }
192         return 0;
193 }
194
195 /* ------------------------------------------------------------------------- */
196
197 /**
198  *      epson1355fb_pan_display - Pans the display.
199  *      @var: frame buffer variable screen structure
200  *      @info: frame buffer structure that represents a single frame buffer
201  *
202  *      Pan (or wrap, depending on the `vmode' field) the display using the
203  *      `xoffset' and `yoffset' fields of the `var' structure.
204  *      If the values don't fit, return -EINVAL.
205  *
206  *      Returns negative errno on error, or zero on success.
207  */
208 static int epson1355fb_pan_display(struct fb_var_screeninfo *var,
209                                    struct fb_info *info)
210 {
211         struct epson1355_par *par = info->par;
212         u32 start;
213
214         if (var->xoffset != 0)  /* not yet ... */
215                 return -EINVAL;
216
217         if (var->yoffset + info->var.yres > info->var.yres_virtual)
218                 return -EINVAL;
219
220         start = (info->fix.line_length >> 1) * var->yoffset;
221
222         epson1355_write_reg20(par, start, REG_SCRN1_DISP_START_ADDR0);
223
224         return 0;
225 }
226
227 /* ------------------------------------------------------------------------- */
228
229 static void lcd_enable(struct epson1355_par *par, int enable)
230 {
231         u8 mode = epson1355_read_reg(par, REG_DISPLAY_MODE);
232
233         if (enable)
234                 mode |= 1;
235         else
236                 mode &= ~1;
237
238         epson1355_write_reg(par, mode, REG_DISPLAY_MODE);
239 }
240
241 #if defined(CONFIG_ARCH_CEIVA)
242 static void backlight_enable(int enable)
243 {
244         /* ### this should be protected by a spinlock ... */
245         u8 pddr = clps_readb(PDDR);
246         if (enable)
247                 pddr |= (1 << 5);
248         else
249                 pddr &= ~(1 << 5);
250         clps_writeb(pddr, PDDR);
251 }
252 #else
253 static void backlight_enable(int enable)
254 {
255 }
256 #endif
257
258
259 /**
260  *      epson1355fb_blank - blanks the display.
261  *      @blank_mode: the blank mode we want.
262  *      @info: frame buffer structure that represents a single frame buffer
263  *
264  *      Blank the screen if blank_mode != 0, else unblank. Return 0 if
265  *      blanking succeeded, != 0 if un-/blanking failed due to e.g. a
266  *      video mode which doesn't support it. Implements VESA suspend
267  *      and powerdown modes on hardware that supports disabling hsync/vsync:
268  *      blank_mode == 2: suspend vsync
269  *      blank_mode == 3: suspend hsync
270  *      blank_mode == 4: powerdown
271  *
272  *      Returns negative errno on error, or zero on success.
273  *
274  */
275 static int epson1355fb_blank(int blank_mode, struct fb_info *info)
276 {
277         struct epson1355_par *par = info->par;
278
279         switch (blank_mode) {
280         case FB_BLANK_UNBLANK:
281         case FB_BLANK_NORMAL:
282                 lcd_enable(par, 1);
283                 backlight_enable(1);
284                 break;
285         case FB_BLANK_VSYNC_SUSPEND:
286         case FB_BLANK_HSYNC_SUSPEND:
287                 backlight_enable(0);
288                 break;
289         case FB_BLANK_POWERDOWN:
290                 backlight_enable(0);
291                 lcd_enable(par, 0);
292                 break;
293         default:
294                 return -EINVAL;
295         }
296
297         /* let fbcon do a soft blank for us */
298         return (blank_mode == FB_BLANK_NORMAL) ? 1 : 0;
299 }
300
301 /* ------------------------------------------------------------------------- */
302
303 /*
304  * We can't use the cfb generic routines, as we have to limit
305  * ourselves to 16-bit or 8-bit loads and stores to this 16-bit
306  * chip.
307  */
308
309 static inline void epson1355fb_fb_writel(unsigned long v, unsigned long *a)
310 {
311         u16 *p = (u16 *) a;
312         u16 l = v & 0xffff;
313         u16 h = v >> 16;
314
315         fb_writew(l, p);
316         fb_writew(h, p + 1);
317 }
318
319 static inline unsigned long epson1355fb_fb_readl(const unsigned long *a)
320 {
321         const u16 *p = (u16 *) a;
322         u16 l = fb_readw(p);
323         u16 h = fb_readw(p + 1);
324
325         return (h << 16) | l;
326 }
327
328 #define FB_READL epson1355fb_fb_readl
329 #define FB_WRITEL epson1355fb_fb_writel
330
331 /* ------------------------------------------------------------------------- */
332
333 static inline unsigned long copy_from_user16(void *to, const void *from,
334                                              unsigned long n)
335 {
336         u16 *dst = (u16 *) to;
337         u16 *src = (u16 *) from;
338
339         if (!access_ok(VERIFY_READ, from, n))
340                 return n;
341
342         while (n > 1) {
343                 u16 v;
344                 if (__get_user(v, src))
345                         return n;
346
347                 fb_writew(v, dst);
348
349                 src++, dst++;
350                 n -= 2;
351         }
352
353         if (n) {
354                 u8 v;
355
356                 if (__get_user(v, ((u8 *) src)))
357                         return n;
358
359                 fb_writeb(v, dst);
360         }
361         return 0;
362 }
363
364 static inline unsigned long copy_to_user16(void *to, const void *from,
365                                            unsigned long n)
366 {
367         u16 *dst = (u16 *) to;
368         u16 *src = (u16 *) from;
369
370         if (!access_ok(VERIFY_WRITE, to, n))
371                 return n;
372
373         while (n > 1) {
374                 u16 v = fb_readw(src);
375
376                 if (__put_user(v, dst))
377                         return n;
378
379                 src++, dst++;
380                 n -= 2;
381         }
382
383         if (n) {
384                 u8 v = fb_readb(src);
385
386                 if (__put_user(v, ((u8 *) dst)))
387                         return n;
388         }
389         return 0;
390 }
391
392
393 static ssize_t
394 epson1355fb_read(struct fb_info *info, char *buf, size_t count, loff_t * ppos)
395 {
396         unsigned long p = *ppos;
397
398         if (p >= info->fix.smem_len)
399                 return 0;
400         if (count >= info->fix.smem_len)
401                 count = info->fix.smem_len;
402         if (count + p > info->fix.smem_len)
403                 count = info->fix.smem_len - p;
404
405         if (count) {
406                 char *base_addr;
407
408                 base_addr = info->screen_base;
409                 count -= copy_to_user16(buf, base_addr + p, count);
410                 if (!count)
411                         return -EFAULT;
412                 *ppos += count;
413         }
414         return count;
415 }
416
417 static ssize_t
418 epson1355fb_write(struct fb_info *info, const char *buf,
419                   size_t count, loff_t * ppos)
420 {
421         unsigned long p = *ppos;
422         int err;
423
424         /* from fbmem.c except for our own copy_*_user */
425         if (p > info->fix.smem_len)
426                 return -ENOSPC;
427         if (count >= info->fix.smem_len)
428                 count = info->fix.smem_len;
429         err = 0;
430         if (count + p > info->fix.smem_len) {
431                 count = info->fix.smem_len - p;
432                 err = -ENOSPC;
433         }
434
435         if (count) {
436                 char *base_addr;
437
438                 base_addr = info->screen_base;
439                 count -= copy_from_user16(base_addr + p, buf, count);
440                 *ppos += count;
441                 err = -EFAULT;
442         }
443         if (count)
444                 return count;
445         return err;
446 }
447
448 /* ------------------------------------------------------------------------- */
449
450 static struct fb_ops epson1355fb_fbops = {
451         .owner          = THIS_MODULE,
452         .fb_setcolreg   = epson1355fb_setcolreg,
453         .fb_pan_display = epson1355fb_pan_display,
454         .fb_blank       = epson1355fb_blank,
455         .fb_fillrect    = cfb_fillrect,
456         .fb_copyarea    = cfb_copyarea,
457         .fb_imageblit   = cfb_imageblit,
458         .fb_read        = epson1355fb_read,
459         .fb_write       = epson1355fb_write,
460 };
461
462 /* ------------------------------------------------------------------------- */
463
464 static __init unsigned int get_fb_size(struct fb_info *info)
465 {
466         unsigned int size = 2 * 1024 * 1024;
467         char *p = info->screen_base;
468
469         /* the 512k framebuffer is aliased at start + 0x80000 * n */
470         fb_writeb(1, p);
471         fb_writeb(0, p + 0x80000);
472         if (!fb_readb(p))
473                 size = 512 * 1024;
474
475         fb_writeb(0, p);
476
477         return size;
478 }
479
480 static int epson1355_width_tab[2][4] __initdata =
481     { {4, 8, 16, -1}, {9, 12, 16, -1} };
482 static int epson1355_bpp_tab[8] __initdata = { 1, 2, 4, 8, 15, 16 };
483
484 static void __init fetch_hw_state(struct fb_info *info, struct epson1355_par *par)
485 {
486         struct fb_var_screeninfo *var = &info->var;
487         struct fb_fix_screeninfo *fix = &info->fix;
488         u8 panel, display;
489         u16 offset;
490         u32 xres, yres;
491         u32 xres_virtual, yres_virtual;
492         int bpp, lcd_bpp;
493         int is_color, is_dual, is_tft;
494         int lcd_enabled, crt_enabled;
495
496         fix->type = FB_TYPE_PACKED_PIXELS;
497
498         display = epson1355_read_reg(par, REG_DISPLAY_MODE);
499         bpp = epson1355_bpp_tab[(display >> 2) & 7];
500
501         switch (bpp) {
502         case 8:
503                 fix->visual = FB_VISUAL_PSEUDOCOLOR;
504                 var->bits_per_pixel = 8;
505                 var->red.offset = var->green.offset = var->blue.offset = 0;
506                 var->red.length = var->green.length = var->blue.length = 8;
507                 break;
508         case 16:
509                 /* 5-6-5 RGB */
510                 fix->visual = FB_VISUAL_TRUECOLOR;
511                 var->bits_per_pixel = 16;
512                 var->red.offset = 11;
513                 var->red.length = 5;
514                 var->green.offset = 5;
515                 var->green.length = 6;
516                 var->blue.offset = 0;
517                 var->blue.length = 5;
518                 break;
519         default:
520                 BUG();
521         }
522         fb_alloc_cmap(&(info->cmap), 256, 0);
523
524         panel = epson1355_read_reg(par, REG_PANEL_TYPE);
525         is_color = (panel & 0x04) != 0;
526         is_dual = (panel & 0x02) != 0;
527         is_tft = (panel & 0x01) != 0;
528         crt_enabled = (display & 0x02) != 0;
529         lcd_enabled = (display & 0x01) != 0;
530         lcd_bpp = epson1355_width_tab[is_tft][(panel >> 4) & 3];
531
532         xres = (epson1355_read_reg(par, REG_HORZ_DISP_WIDTH) + 1) * 8;
533         yres = (epson1355_read_reg16(par, REG_VERT_DISP_HEIGHT0) + 1) *
534             ((is_dual && !crt_enabled) ? 2 : 1);
535         offset = epson1355_read_reg16(par, REG_MEM_ADDR_OFFSET0) & 0x7ff;
536         xres_virtual = offset * 16 / bpp;
537         yres_virtual = fix->smem_len / (offset * 2);
538
539         var->xres = xres;
540         var->yres = yres;
541         var->xres_virtual = xres_virtual;
542         var->yres_virtual = yres_virtual;
543         var->xoffset = var->yoffset = 0;
544
545         fix->line_length = offset * 2;
546
547         fix->xpanstep = 0;      /* no pan yet */
548         fix->ypanstep = 1;
549         fix->ywrapstep = 0;
550         fix->accel = FB_ACCEL_NONE;
551
552         var->grayscale = !is_color;
553
554 #ifdef DEBUG
555         printk(KERN_INFO
556                "epson1355fb: xres=%d, yres=%d, "
557                "is_color=%d, is_dual=%d, is_tft=%d\n",
558                xres, yres, is_color, is_dual, is_tft);
559         printk(KERN_INFO
560                "epson1355fb: bpp=%d, lcd_bpp=%d, "
561                "crt_enabled=%d, lcd_enabled=%d\n",
562                bpp, lcd_bpp, crt_enabled, lcd_enabled);
563 #endif
564 }
565
566
567 static void clearfb16(struct fb_info *info)
568 {
569         u16 *dst = (u16 *) info->screen_base;
570         unsigned long n = info->fix.smem_len;
571
572         while (n > 1) {
573                 fb_writew(0, dst);
574                 dst++, n -= 2;
575         }
576
577         if (n)
578                 fb_writeb(0, dst);
579 }
580
581 static int epson1355fb_remove(struct platform_device *dev)
582 {
583         struct fb_info *info = platform_get_drvdata(dev);
584         struct epson1355_par *par = info->par;
585
586         backlight_enable(0);
587         if (par) {
588                 lcd_enable(par, 0);
589                 if (par && par->reg_addr)
590                         iounmap((void *) par->reg_addr);
591         }
592
593         if (info) {
594                 fb_dealloc_cmap(&info->cmap);
595                 if (info->screen_base)
596                         iounmap(info->screen_base);
597                 framebuffer_release(info);
598         }
599         release_mem_region(EPSON1355FB_FB_PHYS, EPSON1355FB_FB_LEN);
600         release_mem_region(EPSON1355FB_REGS_PHYS, EPSON1355FB_REGS_LEN);
601         return 0;
602 }
603
604 int __devinit epson1355fb_probe(struct platform_device *dev)
605 {
606         struct epson1355_par *default_par;
607         struct fb_info *info;
608         u8 revision;
609         int rc = 0;
610
611         if (!request_mem_region(EPSON1355FB_REGS_PHYS, EPSON1355FB_REGS_LEN, "S1D13505 registers")) {
612                 printk(KERN_ERR "epson1355fb: unable to reserve "
613                        "registers at 0x%0x\n", EPSON1355FB_REGS_PHYS);
614                 rc = -EBUSY;
615                 goto bail;
616         }
617
618         if (!request_mem_region(EPSON1355FB_FB_PHYS, EPSON1355FB_FB_LEN,
619                                 "S1D13505 framebuffer")) {
620                 printk(KERN_ERR "epson1355fb: unable to reserve "
621                        "framebuffer at 0x%0x\n", EPSON1355FB_FB_PHYS);
622                 rc = -EBUSY;
623                 goto bail;
624         }
625
626         info = framebuffer_alloc(sizeof(struct epson1355_par), &dev->dev);
627         if (!info) {
628                 rc = -ENOMEM;
629                 goto bail;
630         }
631
632         default_par = info->par;
633         default_par->reg_addr = (unsigned long) ioremap(EPSON1355FB_REGS_PHYS, EPSON1355FB_REGS_LEN);
634         if (!default_par->reg_addr) {
635                 printk(KERN_ERR "epson1355fb: unable to map registers\n");
636                 rc = -ENOMEM;
637                 goto bail;
638         }
639         info->pseudo_palette = default_par->pseudo_palette;
640
641         info->screen_base = ioremap(EPSON1355FB_FB_PHYS, EPSON1355FB_FB_LEN);
642         if (!info->screen_base) {
643                 printk(KERN_ERR "epson1355fb: unable to map framebuffer\n");
644                 rc = -ENOMEM;
645                 goto bail;
646         }
647
648         revision = epson1355_read_reg(default_par, REG_REVISION_CODE);
649         if ((revision >> 2) != 3) {
650                 printk(KERN_INFO "epson1355fb: epson1355 not found\n");
651                 rc = -ENODEV;
652                 goto bail;
653         }
654
655         info->fix.mmio_start = EPSON1355FB_REGS_PHYS;
656         info->fix.mmio_len = EPSON1355FB_REGS_LEN;
657         info->fix.smem_start = EPSON1355FB_FB_PHYS;
658         info->fix.smem_len = get_fb_size(info);
659
660         printk(KERN_INFO "epson1355fb: regs mapped at 0x%lx, fb %d KiB mapped at 0x%p\n",
661                default_par->reg_addr, info->fix.smem_len / 1024, info->screen_base);
662
663         strcpy(info->fix.id, "S1D13505");
664         info->par = default_par;
665         info->fbops = &epson1355fb_fbops;
666         info->flags = FBINFO_DEFAULT | FBINFO_HWACCEL_YPAN;
667
668         /* we expect the boot loader to have initialized the chip
669            with appropriate parameters from which we can determinte
670            the flavor of lcd panel attached */
671         fetch_hw_state(info, default_par);
672
673         /* turn this puppy on ... */
674         clearfb16(info);
675         backlight_enable(1);
676         lcd_enable(default_par, 1);
677
678         if (register_framebuffer(info) < 0) {
679                 rc = -EINVAL;
680                 goto bail;
681         }
682         /*
683          * Our driver data.
684          */
685         platform_set_drvdata(dev, info);
686
687         printk(KERN_INFO "fb%d: %s frame buffer device\n",
688                info->node, info->fix.id);
689
690         return 0;
691
692       bail:
693         epson1355fb_remove(dev);
694         return rc;
695 }
696
697 static struct platform_driver epson1355fb_driver = {
698         .probe  = epson1355fb_probe,
699         .remove = epson1355fb_remove,
700         .driver = {
701                 .name   = "epson1355fb",
702         },
703 };
704
705 static struct platform_device *epson1355fb_device;
706
707 int __init epson1355fb_init(void)
708 {
709         int ret = 0;
710
711         if (fb_get_options("epson1355fb", NULL))
712                 return -ENODEV;
713
714         ret = platform_driver_register(&epson1355fb_driver);
715
716         if (!ret) {
717                 epson1355fb_device = platform_device_alloc("epson1355fb", 0);
718
719                 if (epson1355fb_device)
720                         ret = platform_device_add(epson1355fb_device);
721                 else
722                         ret = -ENOMEM;
723
724                 if (ret) {
725                         platform_device_put(epson1355fb_device);
726                         platform_driver_unregister(&epson1355fb_driver);
727                 }
728         }
729
730         return ret;
731 }
732
733 module_init(epson1355fb_init);
734         
735 #ifdef MODULE
736 static void __exit epson1355fb_exit(void)
737 {
738         platform_device_unregister(epson1355fb_device);
739         platform_driver_unregister(&epson1355fb_driver);
740 }
741
742 /* ------------------------------------------------------------------------- */
743
744 module_exit(epson1355fb_exit);
745 #endif
746
747 MODULE_AUTHOR("Christopher Hoover <ch@hpl.hp.com>");
748 MODULE_DESCRIPTION("Framebuffer driver for Epson S1D13505");
749 MODULE_LICENSE("GPL");