aboutsummaryrefslogtreecommitdiffstats
path: root/packages/linux/linux/acern30/s3c2410_lcd-pm.c
blob: 304baf385cdb8b2396856cd2b508e477e1c4dad8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
Index: linux-2.6.14/drivers/video/backlight/s3c2410_lcd.c
===================================================================
--- linux-2.6.14.orig/drivers/video/backlight/s3c2410_lcd.c
+++ linux-2.6.14/drivers/video/backlight/s3c2410_lcd.c
@@ -248,10 +248,75 @@ static int s3c2410bl_remove(struct devic
 
 }
 
+#ifdef CONFIG_PM
+
+static int s3c2410bl_suspend(struct device *dev, pm_message_t state)
+{
+	struct s3c2410_bl_mach_info *info =
+		(struct s3c2410_bl_mach_info *)dev->platform_data;
+
+	if (info) {
+		if (info->backlight_power)
+			info->backlight_power(0);
+		if (info->lcd_power)
+			info->lcd_power(0);
+	}
+
+	return 0;
+}
+
+static int s3c2410bl_resume(struct device *dev)
+{
+	struct s3c2410_bl_mach_info *info =
+		(struct s3c2410_bl_mach_info *)dev->platform_data;
+
+	if (info) {
+		if (info->lcd_power) {
+			switch(info->lcd_power_value) {
+			case FB_BLANK_NORMAL:
+			case FB_BLANK_POWERDOWN:
+				info->lcd_power(0);
+				break;
+			default:
+			case FB_BLANK_VSYNC_SUSPEND:
+			case FB_BLANK_HSYNC_SUSPEND:
+			case FB_BLANK_UNBLANK:
+				info->lcd_power(1);
+				break;
+			}
+		}
+		if (info->backlight_power) {
+			switch(info->backlight_power_value) {
+			case FB_BLANK_NORMAL:
+			case FB_BLANK_VSYNC_SUSPEND:
+			case FB_BLANK_HSYNC_SUSPEND:
+			case FB_BLANK_POWERDOWN:
+				info->backlight_power(0);
+				break;
+			default:
+			case FB_BLANK_UNBLANK:
+				info->backlight_power(1);
+				break;
+			}
+		}
+		if (info->set_brightness)
+			info->set_brightness(info->brightness_value);
+	}
+
+	return 0;
+}
+
+#else
+#define s3c2410bl_suspend NULL
+#define s3c2410bl_resume  NULL
+#endif
+
 static struct device_driver s3c2410bl_driver = {
 	.name		= "s3c2410-bl",
 	.bus		= &platform_bus_type,
 	.probe		= s3c2410bl_probe,
+	.suspend        = s3c2410bl_suspend,
+	.resume         = s3c2410bl_resume,
 	.remove		= s3c2410bl_remove,
 };