diff options
Diffstat (limited to 'drivers/video/s3c2410fb.c')
-rw-r--r-- | drivers/video/s3c2410fb.c | 130 |
1 files changed, 42 insertions, 88 deletions
diff --git a/drivers/video/s3c2410fb.c b/drivers/video/s3c2410fb.c index 13b38cbbe4c..f0598961c6b 100644 --- a/drivers/video/s3c2410fb.c +++ b/drivers/video/s3c2410fb.c | |||
@@ -1,75 +1,15 @@ | |||
1 | /* | 1 | /* linux/drivers/video/s3c2410fb.c |
2 | * linux/drivers/video/s3c2410fb.c | 2 | * Copyright (c) 2004,2005 Arnaud Patard |
3 | * Copyright (c) Arnaud Patard, Ben Dooks | 3 | * Copyright (c) 2004-2008 Ben Dooks |
4 | * | ||
5 | * S3C2410 LCD Framebuffer Driver | ||
4 | * | 6 | * |
5 | * This file is subject to the terms and conditions of the GNU General Public | 7 | * This file is subject to the terms and conditions of the GNU General Public |
6 | * License. See the file COPYING in the main directory of this archive for | 8 | * License. See the file COPYING in the main directory of this archive for |
7 | * more details. | 9 | * more details. |
8 | * | 10 | * |
9 | * S3C2410 LCD Controller Frame Buffer Driver | 11 | * Driver based on skeletonfb.c, sa1100fb.c and others. |
10 | * based on skeletonfb.c, sa1100fb.c and others | 12 | */ |
11 | * | ||
12 | * ChangeLog | ||
13 | * 2005-04-07: Arnaud Patard <arnaud.patard@rtp-net.org> | ||
14 | * - u32 state -> pm_message_t state | ||
15 | * - S3C2410_{VA,SZ}_LCD -> S3C24XX | ||
16 | * | ||
17 | * 2005-03-15: Arnaud Patard <arnaud.patard@rtp-net.org> | ||
18 | * - Removed the ioctl | ||
19 | * - use readl/writel instead of __raw_writel/__raw_readl | ||
20 | * | ||
21 | * 2004-12-04: Arnaud Patard <arnaud.patard@rtp-net.org> | ||
22 | * - Added the possibility to set on or off the | ||
23 | * debugging messages | ||
24 | * - Replaced 0 and 1 by on or off when reading the | ||
25 | * /sys files | ||
26 | * | ||
27 | * 2005-03-23: Ben Dooks <ben-linux@fluff.org> | ||
28 | * - added non 16bpp modes | ||
29 | * - updated platform information for range of x/y/bpp | ||
30 | * - add code to ensure palette is written correctly | ||
31 | * - add pixel clock divisor control | ||
32 | * | ||
33 | * 2004-11-11: Arnaud Patard <arnaud.patard@rtp-net.org> | ||
34 | * - Removed the use of currcon as it no more exists | ||
35 | * - Added LCD power sysfs interface | ||
36 | * | ||
37 | * 2004-11-03: Ben Dooks <ben-linux@fluff.org> | ||
38 | * - minor cleanups | ||
39 | * - add suspend/resume support | ||
40 | * - s3c2410fb_setcolreg() not valid in >8bpp modes | ||
41 | * - removed last CONFIG_FB_S3C2410_FIXED | ||
42 | * - ensure lcd controller stopped before cleanup | ||
43 | * - added sysfs interface for backlight power | ||
44 | * - added mask for gpio configuration | ||
45 | * - ensured IRQs disabled during GPIO configuration | ||
46 | * - disable TPAL before enabling video | ||
47 | * | ||
48 | * 2004-09-20: Arnaud Patard <arnaud.patard@rtp-net.org> | ||
49 | * - Suppress command line options | ||
50 | * | ||
51 | * 2004-09-15: Arnaud Patard <arnaud.patard@rtp-net.org> | ||
52 | * - code cleanup | ||
53 | * | ||
54 | * 2004-09-07: Arnaud Patard <arnaud.patard@rtp-net.org> | ||
55 | * - Renamed from h1940fb.c to s3c2410fb.c | ||
56 | * - Add support for different devices | ||
57 | * - Backlight support | ||
58 | * | ||
59 | * 2004-09-05: Herbert Pötzl <herbert@13thfloor.at> | ||
60 | * - added clock (de-)allocation code | ||
61 | * - added fixem fbmem option | ||
62 | * | ||
63 | * 2004-07-27: Arnaud Patard <arnaud.patard@rtp-net.org> | ||
64 | * - code cleanup | ||
65 | * - added a forgotten return in h1940fb_init | ||
66 | * | ||
67 | * 2004-07-19: Herbert Pötzl <herbert@13thfloor.at> | ||
68 | * - code cleanup and extended debugging | ||
69 | * | ||
70 | * 2004-07-15: Arnaud Patard <arnaud.patard@rtp-net.org> | ||
71 | * - First version | ||
72 | */ | ||
73 | 13 | ||
74 | #include <linux/module.h> | 14 | #include <linux/module.h> |
75 | #include <linux/kernel.h> | 15 | #include <linux/kernel.h> |
@@ -580,6 +520,27 @@ static int s3c2410fb_setcolreg(unsigned regno, | |||
580 | return 0; | 520 | return 0; |
581 | } | 521 | } |
582 | 522 | ||
523 | /* s3c2410fb_lcd_enable | ||
524 | * | ||
525 | * shutdown the lcd controller | ||
526 | */ | ||
527 | static void s3c2410fb_lcd_enable(struct s3c2410fb_info *fbi, int enable) | ||
528 | { | ||
529 | unsigned long flags; | ||
530 | |||
531 | local_irq_save(flags); | ||
532 | |||
533 | if (enable) | ||
534 | fbi->regs.lcdcon1 |= S3C2410_LCDCON1_ENVID; | ||
535 | else | ||
536 | fbi->regs.lcdcon1 &= ~S3C2410_LCDCON1_ENVID; | ||
537 | |||
538 | writel(fbi->regs.lcdcon1, fbi->io + S3C2410_LCDCON1); | ||
539 | |||
540 | local_irq_restore(flags); | ||
541 | } | ||
542 | |||
543 | |||
583 | /* | 544 | /* |
584 | * s3c2410fb_blank | 545 | * s3c2410fb_blank |
585 | * @blank_mode: the blank mode we want. | 546 | * @blank_mode: the blank mode we want. |
@@ -589,9 +550,6 @@ static int s3c2410fb_setcolreg(unsigned regno, | |||
589 | * blanking succeeded, != 0 if un-/blanking failed due to e.g. a | 550 | * blanking succeeded, != 0 if un-/blanking failed due to e.g. a |
590 | * video mode which doesn't support it. Implements VESA suspend | 551 | * video mode which doesn't support it. Implements VESA suspend |
591 | * and powerdown modes on hardware that supports disabling hsync/vsync: | 552 | * and powerdown modes on hardware that supports disabling hsync/vsync: |
592 | * blank_mode == 2: suspend vsync | ||
593 | * blank_mode == 3: suspend hsync | ||
594 | * blank_mode == 4: powerdown | ||
595 | * | 553 | * |
596 | * Returns negative errno on error, or zero on success. | 554 | * Returns negative errno on error, or zero on success. |
597 | * | 555 | * |
@@ -605,6 +563,12 @@ static int s3c2410fb_blank(int blank_mode, struct fb_info *info) | |||
605 | 563 | ||
606 | tpal_reg += is_s3c2412(fbi) ? S3C2412_TPAL : S3C2410_TPAL; | 564 | tpal_reg += is_s3c2412(fbi) ? S3C2412_TPAL : S3C2410_TPAL; |
607 | 565 | ||
566 | if (blank_mode == FB_BLANK_POWERDOWN) { | ||
567 | s3c2410fb_lcd_enable(fbi, 0); | ||
568 | } else { | ||
569 | s3c2410fb_lcd_enable(fbi, 1); | ||
570 | } | ||
571 | |||
608 | if (blank_mode == FB_BLANK_UNBLANK) | 572 | if (blank_mode == FB_BLANK_UNBLANK) |
609 | writel(0x0, tpal_reg); | 573 | writel(0x0, tpal_reg); |
610 | else { | 574 | else { |
@@ -948,7 +912,10 @@ static int __init s3c24xxfb_probe(struct platform_device *pdev, | |||
948 | } | 912 | } |
949 | 913 | ||
950 | /* create device files */ | 914 | /* create device files */ |
951 | device_create_file(&pdev->dev, &dev_attr_debug); | 915 | ret = device_create_file(&pdev->dev, &dev_attr_debug); |
916 | if (ret) { | ||
917 | printk(KERN_ERR "failed to add debug attribute\n"); | ||
918 | } | ||
952 | 919 | ||
953 | printk(KERN_INFO "fb%d: %s frame buffer device\n", | 920 | printk(KERN_INFO "fb%d: %s frame buffer device\n", |
954 | fbinfo->node, fbinfo->fix.id); | 921 | fbinfo->node, fbinfo->fix.id); |
@@ -983,21 +950,6 @@ static int __init s3c2412fb_probe(struct platform_device *pdev) | |||
983 | return s3c24xxfb_probe(pdev, DRV_S3C2412); | 950 | return s3c24xxfb_probe(pdev, DRV_S3C2412); |
984 | } | 951 | } |
985 | 952 | ||
986 | /* s3c2410fb_stop_lcd | ||
987 | * | ||
988 | * shutdown the lcd controller | ||
989 | */ | ||
990 | static void s3c2410fb_stop_lcd(struct s3c2410fb_info *fbi) | ||
991 | { | ||
992 | unsigned long flags; | ||
993 | |||
994 | local_irq_save(flags); | ||
995 | |||
996 | fbi->regs.lcdcon1 &= ~S3C2410_LCDCON1_ENVID; | ||
997 | writel(fbi->regs.lcdcon1, fbi->io + S3C2410_LCDCON1); | ||
998 | |||
999 | local_irq_restore(flags); | ||
1000 | } | ||
1001 | 953 | ||
1002 | /* | 954 | /* |
1003 | * Cleanup | 955 | * Cleanup |
@@ -1010,7 +962,7 @@ static int s3c2410fb_remove(struct platform_device *pdev) | |||
1010 | 962 | ||
1011 | unregister_framebuffer(fbinfo); | 963 | unregister_framebuffer(fbinfo); |
1012 | 964 | ||
1013 | s3c2410fb_stop_lcd(info); | 965 | s3c2410fb_lcd_enable(info, 0); |
1014 | msleep(1); | 966 | msleep(1); |
1015 | 967 | ||
1016 | s3c2410fb_unmap_video_memory(fbinfo); | 968 | s3c2410fb_unmap_video_memory(fbinfo); |
@@ -1043,7 +995,7 @@ static int s3c2410fb_suspend(struct platform_device *dev, pm_message_t state) | |||
1043 | struct fb_info *fbinfo = platform_get_drvdata(dev); | 995 | struct fb_info *fbinfo = platform_get_drvdata(dev); |
1044 | struct s3c2410fb_info *info = fbinfo->par; | 996 | struct s3c2410fb_info *info = fbinfo->par; |
1045 | 997 | ||
1046 | s3c2410fb_stop_lcd(info); | 998 | s3c2410fb_lcd_enable(info, 0); |
1047 | 999 | ||
1048 | /* sleep before disabling the clock, we need to ensure | 1000 | /* sleep before disabling the clock, we need to ensure |
1049 | * the LCD DMA engine is not going to get back on the bus | 1001 | * the LCD DMA engine is not going to get back on the bus |
@@ -1118,3 +1070,5 @@ MODULE_AUTHOR("Arnaud Patard <arnaud.patard@rtp-net.org>, " | |||
1118 | "Ben Dooks <ben-linux@fluff.org>"); | 1070 | "Ben Dooks <ben-linux@fluff.org>"); |
1119 | MODULE_DESCRIPTION("Framebuffer driver for the s3c2410"); | 1071 | MODULE_DESCRIPTION("Framebuffer driver for the s3c2410"); |
1120 | MODULE_LICENSE("GPL"); | 1072 | MODULE_LICENSE("GPL"); |
1073 | MODULE_ALIAS("platform:s3c2410-lcd"); | ||
1074 | MODULE_ALIAS("platform:s3c2412-lcd"); | ||