1 /* drivers/video/s1d13xxxfb.c
3 * (c) 2004 Simtec Electronics
4 * (c) 2005 Thibaut VARENE <varenet@parisc-linux.org>
6 * Driver for Epson S1D13xxx series framebuffer chips
9 * linux/drivers/video/skeletonfb.c
10 * linux/drivers/video/epson1355fb.c
11 * linux/drivers/video/epson/s1d13xxxfb.c (2.4 driver by Epson)
13 * Note, currently only tested on S1D13806 with 16bit CRT.
14 * As such, this driver might still contain some hardcoded bits relating to
16 * Making it work on other S1D13XXX chips should merely be a matter of adding
17 * a few switch()s, some missing glue here and there maybe, and split header
20 * TODO: - handle dual screen display (CRT and LCD at the same time).
21 * - check_var(), mode change, etc.
23 * - Accelerated interfaces.
24 * - Probably not SMP safe :)
26 * This file is subject to the terms and conditions of the GNU General Public
27 * License. See the file COPYING in the main directory of this archive for
31 #include <linux/module.h>
32 #include <linux/platform_device.h>
33 #include <linux/delay.h>
35 #include <linux/types.h>
36 #include <linux/errno.h>
38 #include <linux/mman.h>
43 #include <video/s1d13xxxfb.h>
45 #define PFX "s1d13xxxfb: "
48 #define dbg(fmt, args...) do { printk(KERN_INFO fmt, ## args); } while(0)
50 #define dbg(fmt, args...) do { } while (0)
54 * Here we define the default struct fb_fix_screeninfo
56 static struct fb_fix_screeninfo __devinitdata s1d13xxxfb_fix
= {
58 .type
= FB_TYPE_PACKED_PIXELS
,
59 .visual
= FB_VISUAL_PSEUDOCOLOR
,
63 .accel
= FB_ACCEL_NONE
,
67 s1d13xxxfb_readreg(struct s1d13xxxfb_par
*par
, u16 regno
)
69 #if defined(CONFIG_PLAT_M32700UT) || defined(CONFIG_PLAT_OPSPUT) || defined(CONFIG_PLAT_MAPPI3)
70 regno
=((regno
& 1) ? (regno
& ~1L) : (regno
+ 1));
72 return readb(par
->regs
+ regno
);
76 s1d13xxxfb_writereg(struct s1d13xxxfb_par
*par
, u16 regno
, u8 value
)
78 #if defined(CONFIG_PLAT_M32700UT) || defined(CONFIG_PLAT_OPSPUT) || defined(CONFIG_PLAT_MAPPI3)
79 regno
=((regno
& 1) ? (regno
& ~1L) : (regno
+ 1));
81 writeb(value
, par
->regs
+ regno
);
85 s1d13xxxfb_runinit(struct s1d13xxxfb_par
*par
,
86 const struct s1d13xxxfb_regval
*initregs
,
87 const unsigned int size
)
91 for (i
= 0; i
< size
; i
++) {
92 if ((initregs
[i
].addr
== S1DREG_DELAYOFF
) ||
93 (initregs
[i
].addr
== S1DREG_DELAYON
))
94 mdelay((int)initregs
[i
].value
);
96 s1d13xxxfb_writereg(par
, initregs
[i
].addr
, initregs
[i
].value
);
100 /* make sure the hardware can cope with us */
105 lcd_enable(struct s1d13xxxfb_par
*par
, int enable
)
107 u8 mode
= s1d13xxxfb_readreg(par
, S1DREG_COM_DISP_MODE
);
114 s1d13xxxfb_writereg(par
, S1DREG_COM_DISP_MODE
, mode
);
118 crt_enable(struct s1d13xxxfb_par
*par
, int enable
)
120 u8 mode
= s1d13xxxfb_readreg(par
, S1DREG_COM_DISP_MODE
);
127 s1d13xxxfb_writereg(par
, S1DREG_COM_DISP_MODE
, mode
);
130 /* framebuffer control routines */
133 s1d13xxxfb_setup_pseudocolour(struct fb_info
*info
)
135 info
->fix
.visual
= FB_VISUAL_PSEUDOCOLOR
;
137 info
->var
.red
.length
= 4;
138 info
->var
.green
.length
= 4;
139 info
->var
.blue
.length
= 4;
143 s1d13xxxfb_setup_truecolour(struct fb_info
*info
)
145 info
->fix
.visual
= FB_VISUAL_TRUECOLOR
;
146 info
->var
.bits_per_pixel
= 16;
148 info
->var
.red
.length
= 5;
149 info
->var
.red
.offset
= 11;
151 info
->var
.green
.length
= 6;
152 info
->var
.green
.offset
= 5;
154 info
->var
.blue
.length
= 5;
155 info
->var
.blue
.offset
= 0;
159 * s1d13xxxfb_set_par - Alters the hardware state.
160 * @info: frame buffer structure
162 * Using the fb_var_screeninfo in fb_info we set the depth of the
163 * framebuffer. This function alters the par AND the
164 * fb_fix_screeninfo stored in fb_info. It doesn't not alter var in
165 * fb_info since we are using that data. This means we depend on the
166 * data in var inside fb_info to be supported by the hardware.
167 * xxxfb_check_var is always called before xxxfb_set_par to ensure this.
169 * XXX TODO: write proper s1d13xxxfb_check_var(), without which that
170 * function is quite useless.
173 s1d13xxxfb_set_par(struct fb_info
*info
)
175 struct s1d13xxxfb_par
*s1dfb
= info
->par
;
178 dbg("s1d13xxxfb_set_par: bpp=%d\n", info
->var
.bits_per_pixel
);
180 if ((s1dfb
->display
& 0x01)) /* LCD */
181 val
= s1d13xxxfb_readreg(s1dfb
, S1DREG_LCD_DISP_MODE
); /* read colour control */
183 val
= s1d13xxxfb_readreg(s1dfb
, S1DREG_CRT_DISP_MODE
); /* read colour control */
187 switch (info
->var
.bits_per_pixel
) {
189 dbg("pseudo colour 4\n");
190 s1d13xxxfb_setup_pseudocolour(info
);
194 dbg("pseudo colour 8\n");
195 s1d13xxxfb_setup_pseudocolour(info
);
199 dbg("true colour\n");
200 s1d13xxxfb_setup_truecolour(info
);
205 dbg("bpp not supported!\n");
209 dbg("writing %02x to display mode register\n", val
);
211 if ((s1dfb
->display
& 0x01)) /* LCD */
212 s1d13xxxfb_writereg(s1dfb
, S1DREG_LCD_DISP_MODE
, val
);
214 s1d13xxxfb_writereg(s1dfb
, S1DREG_CRT_DISP_MODE
, val
);
216 info
->fix
.line_length
= info
->var
.xres
* info
->var
.bits_per_pixel
;
217 info
->fix
.line_length
/= 8;
219 dbg("setting line_length to %d\n", info
->fix
.line_length
);
227 * s1d13xxxfb_setcolreg - sets a color register.
228 * @regno: Which register in the CLUT we are programming
229 * @red: The red value which can be up to 16 bits wide
230 * @green: The green value which can be up to 16 bits wide
231 * @blue: The blue value which can be up to 16 bits wide.
232 * @transp: If supported the alpha value which can be up to 16 bits wide.
233 * @info: frame buffer info structure
235 * Returns negative errno on error, or zero on success.
238 s1d13xxxfb_setcolreg(u_int regno
, u_int red
, u_int green
, u_int blue
,
239 u_int transp
, struct fb_info
*info
)
241 struct s1d13xxxfb_par
*s1dfb
= info
->par
;
242 unsigned int pseudo_val
;
244 if (regno
>= S1D_PALETTE_SIZE
)
247 dbg("s1d13xxxfb_setcolreg: %d: rgb=%d,%d,%d, tr=%d\n",
248 regno
, red
, green
, blue
, transp
);
250 if (info
->var
.grayscale
)
251 red
= green
= blue
= (19595*red
+ 38470*green
+ 7471*blue
) >> 16;
253 switch (info
->fix
.visual
) {
254 case FB_VISUAL_TRUECOLOR
:
258 /* deal with creating pseudo-palette entries */
260 pseudo_val
= (red
>> 11) << info
->var
.red
.offset
;
261 pseudo_val
|= (green
>> 10) << info
->var
.green
.offset
;
262 pseudo_val
|= (blue
>> 11) << info
->var
.blue
.offset
;
264 dbg("s1d13xxxfb_setcolreg: pseudo %d, val %08x\n",
267 #if defined(CONFIG_PLAT_MAPPI)
268 ((u32
*)info
->pseudo_palette
)[regno
] = cpu_to_le16(pseudo_val
);
270 ((u32
*)info
->pseudo_palette
)[regno
] = pseudo_val
;
274 case FB_VISUAL_PSEUDOCOLOR
:
275 s1d13xxxfb_writereg(s1dfb
, S1DREG_LKUP_ADDR
, regno
);
276 s1d13xxxfb_writereg(s1dfb
, S1DREG_LKUP_DATA
, red
);
277 s1d13xxxfb_writereg(s1dfb
, S1DREG_LKUP_DATA
, green
);
278 s1d13xxxfb_writereg(s1dfb
, S1DREG_LKUP_DATA
, blue
);
285 dbg("s1d13xxxfb_setcolreg: done\n");
291 * s1d13xxxfb_blank - blanks the display.
292 * @blank_mode: the blank mode we want.
293 * @info: frame buffer structure that represents a single frame buffer
295 * Blank the screen if blank_mode != 0, else unblank. Return 0 if
296 * blanking succeeded, != 0 if un-/blanking failed due to e.g. a
297 * video mode which doesn't support it. Implements VESA suspend
298 * and powerdown modes on hardware that supports disabling hsync/vsync:
299 * blank_mode == 2: suspend vsync
300 * blank_mode == 3: suspend hsync
301 * blank_mode == 4: powerdown
303 * Returns negative errno on error, or zero on success.
306 s1d13xxxfb_blank(int blank_mode
, struct fb_info
*info
)
308 struct s1d13xxxfb_par
*par
= info
->par
;
310 dbg("s1d13xxxfb_blank: blank=%d, info=%p\n", blank_mode
, info
);
312 switch (blank_mode
) {
313 case FB_BLANK_UNBLANK
:
314 case FB_BLANK_NORMAL
:
315 if ((par
->display
& 0x01) != 0)
317 if ((par
->display
& 0x02) != 0)
320 case FB_BLANK_VSYNC_SUSPEND
:
321 case FB_BLANK_HSYNC_SUSPEND
:
323 case FB_BLANK_POWERDOWN
:
331 /* let fbcon do a soft blank for us */
332 return ((blank_mode
== FB_BLANK_NORMAL
) ? 1 : 0);
336 * s1d13xxxfb_pan_display - Pans the display.
337 * @var: frame buffer variable screen structure
338 * @info: frame buffer structure that represents a single frame buffer
340 * Pan (or wrap, depending on the `vmode' field) the display using the
341 * `yoffset' field of the `var' structure (`xoffset' not yet supported).
342 * If the values don't fit, return -EINVAL.
344 * Returns negative errno on error, or zero on success.
347 s1d13xxxfb_pan_display(struct fb_var_screeninfo
*var
, struct fb_info
*info
)
349 struct s1d13xxxfb_par
*par
= info
->par
;
352 if (var
->xoffset
!= 0) /* not yet ... */
355 if (var
->yoffset
+ info
->var
.yres
> info
->var
.yres_virtual
)
358 start
= (info
->fix
.line_length
>> 1) * var
->yoffset
;
360 if ((par
->display
& 0x01)) {
362 s1d13xxxfb_writereg(par
, S1DREG_LCD_DISP_START0
, (start
& 0xff));
363 s1d13xxxfb_writereg(par
, S1DREG_LCD_DISP_START1
, ((start
>> 8) & 0xff));
364 s1d13xxxfb_writereg(par
, S1DREG_LCD_DISP_START2
, ((start
>> 16) & 0x0f));
367 s1d13xxxfb_writereg(par
, S1DREG_CRT_DISP_START0
, (start
& 0xff));
368 s1d13xxxfb_writereg(par
, S1DREG_CRT_DISP_START1
, ((start
>> 8) & 0xff));
369 s1d13xxxfb_writereg(par
, S1DREG_CRT_DISP_START2
, ((start
>> 16) & 0x0f));
376 /* framebuffer information structures */
378 static struct fb_ops s1d13xxxfb_fbops
= {
379 .owner
= THIS_MODULE
,
380 .fb_set_par
= s1d13xxxfb_set_par
,
381 .fb_setcolreg
= s1d13xxxfb_setcolreg
,
382 .fb_blank
= s1d13xxxfb_blank
,
384 .fb_pan_display
= s1d13xxxfb_pan_display
,
386 /* to be replaced by any acceleration we can */
387 .fb_fillrect
= cfb_fillrect
,
388 .fb_copyarea
= cfb_copyarea
,
389 .fb_imageblit
= cfb_imageblit
,
392 static int s1d13xxxfb_width_tab
[2][4] __devinitdata
= {
398 * s1d13xxxfb_fetch_hw_state - Configure the framebuffer according to
400 * @info: frame buffer structure
402 * We setup the framebuffer structures according to the current
403 * hardware setup. On some machines, the BIOS will have filled
404 * the chip registers with such info, on others, these values will
405 * have been written in some init procedure. In any case, the
406 * software values needs to match the hardware ones. This is what
407 * this function ensures.
409 * Note: some of the hardcoded values here might need some love to
410 * work on various chips, and might need to no longer be hardcoded.
412 static void __devinit
413 s1d13xxxfb_fetch_hw_state(struct fb_info
*info
)
415 struct fb_var_screeninfo
*var
= &info
->var
;
416 struct fb_fix_screeninfo
*fix
= &info
->fix
;
417 struct s1d13xxxfb_par
*par
= info
->par
;
421 u32 xres_virtual
, yres_virtual
;
423 int is_color
, is_dual
, is_tft
;
424 int lcd_enabled
, crt_enabled
;
426 fix
->type
= FB_TYPE_PACKED_PIXELS
;
429 par
->display
= s1d13xxxfb_readreg(par
, S1DREG_COM_DISP_MODE
);
430 crt_enabled
= (par
->display
& 0x02) != 0;
431 lcd_enabled
= (par
->display
& 0x01) != 0;
433 if (lcd_enabled
&& crt_enabled
)
434 printk(KERN_WARNING PFX
"Warning: LCD and CRT detected, using LCD\n");
437 display
= s1d13xxxfb_readreg(par
, S1DREG_LCD_DISP_MODE
);
439 display
= s1d13xxxfb_readreg(par
, S1DREG_CRT_DISP_MODE
);
441 bpp
= display
& 0x07;
446 var
->bits_per_pixel
= 8;
447 var
->red
.offset
= var
->green
.offset
= var
->blue
.offset
= 0;
448 var
->red
.length
= var
->green
.length
= var
->blue
.length
= 8;
451 s1d13xxxfb_setup_truecolour(info
);
454 dbg("bpp: %i\n", bpp
);
456 fb_alloc_cmap(&info
->cmap
, 256, 0);
459 panel
= s1d13xxxfb_readreg(par
, S1DREG_PANEL_TYPE
);
460 is_color
= (panel
& 0x04) != 0;
461 is_dual
= (panel
& 0x02) != 0;
462 is_tft
= (panel
& 0x01) != 0;
463 lcd_bpp
= s1d13xxxfb_width_tab
[is_tft
][(panel
>> 4) & 3];
466 xres
= (s1d13xxxfb_readreg(par
, S1DREG_LCD_DISP_HWIDTH
) + 1) * 8;
467 yres
= (s1d13xxxfb_readreg(par
, S1DREG_LCD_DISP_VHEIGHT0
) +
468 ((s1d13xxxfb_readreg(par
, S1DREG_LCD_DISP_VHEIGHT1
) & 0x03) << 8) + 1);
470 offset
= (s1d13xxxfb_readreg(par
, S1DREG_LCD_MEM_OFF0
) +
471 ((s1d13xxxfb_readreg(par
, S1DREG_LCD_MEM_OFF1
) & 0x7) << 8));
473 xres
= (s1d13xxxfb_readreg(par
, S1DREG_CRT_DISP_HWIDTH
) + 1) * 8;
474 yres
= (s1d13xxxfb_readreg(par
, S1DREG_CRT_DISP_VHEIGHT0
) +
475 ((s1d13xxxfb_readreg(par
, S1DREG_CRT_DISP_VHEIGHT1
) & 0x03) << 8) + 1);
477 offset
= (s1d13xxxfb_readreg(par
, S1DREG_CRT_MEM_OFF0
) +
478 ((s1d13xxxfb_readreg(par
, S1DREG_CRT_MEM_OFF1
) & 0x7) << 8));
480 xres_virtual
= offset
* 16 / var
->bits_per_pixel
;
481 yres_virtual
= fix
->smem_len
/ (offset
* 2);
485 var
->xres_virtual
= xres_virtual
;
486 var
->yres_virtual
= yres_virtual
;
487 var
->xoffset
= var
->yoffset
= 0;
489 fix
->line_length
= offset
* 2;
491 var
->grayscale
= !is_color
;
493 var
->activate
= FB_ACTIVATE_NOW
;
495 dbg(PFX
"bpp=%d, lcd_bpp=%d, "
496 "crt_enabled=%d, lcd_enabled=%d\n",
497 var
->bits_per_pixel
, lcd_bpp
, crt_enabled
, lcd_enabled
);
498 dbg(PFX
"xres=%d, yres=%d, vxres=%d, vyres=%d "
499 "is_color=%d, is_dual=%d, is_tft=%d\n",
500 xres
, yres
, xres_virtual
, yres_virtual
, is_color
, is_dual
, is_tft
);
505 s1d13xxxfb_remove(struct platform_device
*pdev
)
507 struct fb_info
*info
= platform_get_drvdata(pdev
);
508 struct s1d13xxxfb_par
*par
= NULL
;
512 if (par
&& par
->regs
) {
513 /* disable output & enable powersave */
514 s1d13xxxfb_writereg(par
, S1DREG_COM_DISP_MODE
, 0x00);
515 s1d13xxxfb_writereg(par
, S1DREG_PS_CNF
, 0x11);
519 fb_dealloc_cmap(&info
->cmap
);
521 if (info
->screen_base
)
522 iounmap(info
->screen_base
);
524 framebuffer_release(info
);
527 release_mem_region(pdev
->resource
[0].start
,
528 pdev
->resource
[0].end
- pdev
->resource
[0].start
+1);
529 release_mem_region(pdev
->resource
[1].start
,
530 pdev
->resource
[1].end
- pdev
->resource
[1].start
+1);
535 s1d13xxxfb_probe(struct platform_device
*pdev
)
537 struct s1d13xxxfb_par
*default_par
;
538 struct fb_info
*info
;
539 struct s1d13xxxfb_pdata
*pdata
= NULL
;
543 dbg("probe called: device is %p\n", dev
);
545 printk(KERN_INFO
"Epson S1D13XXX FB Driver\n");
547 /* enable platform-dependent hardware glue, if any */
548 if (pdev
->dev
.platform_data
)
549 pdata
= pdev
->dev
.platform_data
;
551 if (pdata
&& pdata
->platform_init_video
)
552 pdata
->platform_init_video();
555 if (pdev
->num_resources
!= 2) {
556 dev_err(&pdev
->dev
, "invalid num_resources: %i\n",
557 pdev
->num_resources
);
562 /* resource[0] is VRAM, resource[1] is registers */
563 if (pdev
->resource
[0].flags
!= IORESOURCE_MEM
564 || pdev
->resource
[1].flags
!= IORESOURCE_MEM
) {
565 dev_err(&pdev
->dev
, "invalid resource type\n");
570 if (!request_mem_region(pdev
->resource
[0].start
,
571 pdev
->resource
[0].end
- pdev
->resource
[0].start
+1, "s1d13xxxfb mem")) {
572 dev_dbg(&pdev
->dev
, "request_mem_region failed\n");
577 if (!request_mem_region(pdev
->resource
[1].start
,
578 pdev
->resource
[1].end
- pdev
->resource
[1].start
+1, "s1d13xxxfb regs")) {
579 dev_dbg(&pdev
->dev
, "request_mem_region failed\n");
584 info
= framebuffer_alloc(sizeof(struct s1d13xxxfb_par
) + sizeof(u32
) * 256, &pdev
->dev
);
590 platform_set_drvdata(pdev
, info
);
591 default_par
= info
->par
;
592 default_par
->regs
= ioremap_nocache(pdev
->resource
[1].start
,
593 pdev
->resource
[1].end
- pdev
->resource
[1].start
+1);
594 if (!default_par
->regs
) {
595 printk(KERN_ERR PFX
"unable to map registers\n");
599 info
->pseudo_palette
= default_par
->pseudo_palette
;
601 info
->screen_base
= ioremap_nocache(pdev
->resource
[0].start
,
602 pdev
->resource
[0].end
- pdev
->resource
[0].start
+1);
604 if (!info
->screen_base
) {
605 printk(KERN_ERR PFX
"unable to map framebuffer\n");
610 revision
= s1d13xxxfb_readreg(default_par
, S1DREG_REV_CODE
);
611 if ((revision
>> 2) != S1D_CHIP_REV
) {
612 printk(KERN_INFO PFX
"chip not found: %i\n", (revision
>> 2));
617 info
->fix
= s1d13xxxfb_fix
;
618 info
->fix
.mmio_start
= pdev
->resource
[1].start
;
619 info
->fix
.mmio_len
= pdev
->resource
[1].end
- pdev
->resource
[1].start
+1;
620 info
->fix
.smem_start
= pdev
->resource
[0].start
;
621 info
->fix
.smem_len
= pdev
->resource
[0].end
- pdev
->resource
[0].start
+1;
623 printk(KERN_INFO PFX
"regs mapped at 0x%p, fb %d KiB mapped at 0x%p\n",
624 default_par
->regs
, info
->fix
.smem_len
/ 1024, info
->screen_base
);
626 info
->par
= default_par
;
627 info
->fbops
= &s1d13xxxfb_fbops
;
628 info
->flags
= FBINFO_DEFAULT
| FBINFO_HWACCEL_YPAN
;
630 /* perform "manual" chip initialization, if needed */
631 if (pdata
&& pdata
->initregs
)
632 s1d13xxxfb_runinit(info
->par
, pdata
->initregs
, pdata
->initregssize
);
634 s1d13xxxfb_fetch_hw_state(info
);
636 if (register_framebuffer(info
) < 0) {
641 printk(KERN_INFO
"fb%d: %s frame buffer device\n",
642 info
->node
, info
->fix
.id
);
647 s1d13xxxfb_remove(pdev
);
653 static int s1d13xxxfb_suspend(struct platform_device
*dev
, pm_message_t state
)
655 struct fb_info
*info
= platform_get_drvdata(dev
);
656 struct s1d13xxxfb_par
*s1dfb
= info
->par
;
657 struct s1d13xxxfb_pdata
*pdata
= NULL
;
659 /* disable display */
660 lcd_enable(s1dfb
, 0);
661 crt_enable(s1dfb
, 0);
663 if (dev
->dev
.platform_data
)
664 pdata
= dev
->dev
.platform_data
;
667 if (!s1dfb
->disp_save
)
668 s1dfb
->disp_save
= kmalloc(info
->fix
.smem_len
, GFP_KERNEL
);
670 if (!s1dfb
->disp_save
) {
671 printk(KERN_ERR PFX
"no memory to save screen");
675 memcpy_fromio(s1dfb
->disp_save
, info
->screen_base
, info
->fix
.smem_len
);
677 s1dfb
->disp_save
= NULL
;
680 if (!s1dfb
->regs_save
)
681 s1dfb
->regs_save
= kmalloc(info
->fix
.mmio_len
, GFP_KERNEL
);
683 if (!s1dfb
->regs_save
) {
684 printk(KERN_ERR PFX
"no memory to save registers");
688 /* backup all registers */
689 memcpy_fromio(s1dfb
->regs_save
, s1dfb
->regs
, info
->fix
.mmio_len
);
691 /* now activate power save mode */
692 s1d13xxxfb_writereg(s1dfb
, S1DREG_PS_CNF
, 0x11);
694 if (pdata
&& pdata
->platform_suspend_video
)
695 return pdata
->platform_suspend_video();
700 static int s1d13xxxfb_resume(struct platform_device
*dev
)
702 struct fb_info
*info
= platform_get_drvdata(dev
);
703 struct s1d13xxxfb_par
*s1dfb
= info
->par
;
704 struct s1d13xxxfb_pdata
*pdata
= NULL
;
706 /* awaken the chip */
707 s1d13xxxfb_writereg(s1dfb
, S1DREG_PS_CNF
, 0x10);
709 /* do not let go until SDRAM "wakes up" */
710 while ((s1d13xxxfb_readreg(s1dfb
, S1DREG_PS_STATUS
) & 0x01))
713 if (dev
->dev
.platform_data
)
714 pdata
= dev
->dev
.platform_data
;
716 if (s1dfb
->regs_save
) {
717 /* will write RO regs, *should* get away with it :) */
718 memcpy_toio(s1dfb
->regs
, s1dfb
->regs_save
, info
->fix
.mmio_len
);
719 kfree(s1dfb
->regs_save
);
722 if (s1dfb
->disp_save
) {
723 memcpy_toio(info
->screen_base
, s1dfb
->disp_save
,
725 kfree(s1dfb
->disp_save
); /* XXX kmalloc()'d when? */
728 if ((s1dfb
->display
& 0x01) != 0)
729 lcd_enable(s1dfb
, 1);
730 if ((s1dfb
->display
& 0x02) != 0)
731 crt_enable(s1dfb
, 1);
733 if (pdata
&& pdata
->platform_resume_video
)
734 return pdata
->platform_resume_video();
738 #endif /* CONFIG_PM */
740 static struct platform_driver s1d13xxxfb_driver
= {
741 .probe
= s1d13xxxfb_probe
,
742 .remove
= s1d13xxxfb_remove
,
744 .suspend
= s1d13xxxfb_suspend
,
745 .resume
= s1d13xxxfb_resume
,
748 .name
= S1D_DEVICENAME
,
754 s1d13xxxfb_init(void)
756 if (fb_get_options("s1d13xxxfb", NULL
))
759 return platform_driver_register(&s1d13xxxfb_driver
);
764 s1d13xxxfb_exit(void)
766 platform_driver_unregister(&s1d13xxxfb_driver
);
769 module_init(s1d13xxxfb_init
);
770 module_exit(s1d13xxxfb_exit
);
773 MODULE_LICENSE("GPL");
774 MODULE_DESCRIPTION("Framebuffer driver for S1D13xxx devices");
775 MODULE_AUTHOR("Ben Dooks <ben@simtec.co.uk>, Thibaut VARENE <varenet@parisc-linux.org>");