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
81
82
83
84
85
86
87
88
89
90
91
92
|
From ec4ff55857d5f48d2bf08e46f12eb4670ec6aa1a Mon Sep 17 00:00:00 2001
From: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Date: Thu, 14 Nov 2013 17:18:26 +0400
Subject: [PATCH] backlight: locomolcd: fix suspend/resume
Replace cooked suspend/resume with support from core backlight layer.
This allows us to remove suspend/resume callbacks from locomolcd
completely. They were not working anyway, as locomo does not support
pm_ops handling.
Signed-off-by: Dmitry Eremin-Solenikov <dmitry_eremin@mentor.com>
---
drivers/video/backlight/locomolcd.c | 26 +++-----------------------
1 file changed, 3 insertions(+), 23 deletions(-)
diff --git a/drivers/video/backlight/locomolcd.c b/drivers/video/backlight/locomolcd.c
index 6c3ec42..54d2da9 100644
--- a/drivers/video/backlight/locomolcd.c
+++ b/drivers/video/backlight/locomolcd.c
@@ -28,8 +28,6 @@
static struct backlight_device *locomolcd_bl_device;
static struct locomo_dev *locomolcd_dev;
-static unsigned long locomolcd_flags;
-#define LOCOMOLCD_SUSPENDED 0x01
static void locomolcd_on(int comadj)
{
@@ -117,7 +115,7 @@ static int locomolcd_set_intensity(struct backlight_device *bd)
intensity = 0;
if (bd->props.fb_blank != FB_BLANK_UNBLANK)
intensity = 0;
- if (locomolcd_flags & LOCOMOLCD_SUSPENDED)
+ if (bd->props.state & BL_CORE_SUSPENDED)
intensity = 0;
switch (intensity) {
@@ -155,26 +153,9 @@ static int locomolcd_get_intensity(struct backlight_device *bd)
static const struct backlight_ops locomobl_data = {
.get_brightness = locomolcd_get_intensity,
.update_status = locomolcd_set_intensity,
+ .options = BL_CORE_SUSPENDRESUME,
};
-#ifdef CONFIG_PM_SLEEP
-static int locomolcd_suspend(struct device *dev)
-{
- locomolcd_flags |= LOCOMOLCD_SUSPENDED;
- locomolcd_set_intensity(locomolcd_bl_device);
- return 0;
-}
-
-static int locomolcd_resume(struct device *dev)
-{
- locomolcd_flags &= ~LOCOMOLCD_SUSPENDED;
- locomolcd_set_intensity(locomolcd_bl_device);
- return 0;
-}
-#endif
-
-static SIMPLE_DEV_PM_OPS(locomolcd_pm_ops, locomolcd_suspend, locomolcd_resume);
-
static int locomolcd_probe(struct locomo_dev *ldev)
{
struct backlight_properties props;
@@ -198,6 +179,7 @@ static int locomolcd_probe(struct locomo_dev *ldev)
memset(&props, 0, sizeof(struct backlight_properties));
props.type = BACKLIGHT_RAW;
props.max_brightness = 4;
+ props.brightness = 2;
locomolcd_bl_device = backlight_device_register("locomo-bl",
&ldev->dev, NULL,
&locomobl_data, &props);
@@ -206,7 +188,6 @@ static int locomolcd_probe(struct locomo_dev *ldev)
return PTR_ERR(locomolcd_bl_device);
/* Set up frontlight so that screen is readable */
- locomolcd_bl_device->props.brightness = 2;
locomolcd_set_intensity(locomolcd_bl_device);
return 0;
@@ -230,7 +211,6 @@ static int locomolcd_remove(struct locomo_dev *dev)
static struct locomo_driver poodle_lcd_driver = {
.drv = {
.name = "locomo-backlight",
- .pm = &locomolcd_pm_ops,
},
.devid = LOCOMO_DEVID_BACKLIGHT,
.probe = locomolcd_probe,
--
1.8.4.2
|