diff options
author | Richard Purdie <rpurdie@linux.intel.com> | 2009-01-06 16:00:19 -0500 |
---|---|---|
committer | Richard Purdie <rpurdie@linux.intel.com> | 2009-01-08 10:37:43 -0500 |
commit | c835ee7f4154992e6cf0674d7ee136f5d36247a4 (patch) | |
tree | e886aecbf4ce1389ca649a20891315499ff9054d /drivers/video/backlight/backlight.c | |
parent | 9be1df98bca44dbe3769cd22f4ab8122b76c5313 (diff) |
backlight: Add suspend/resume support to the backlight core
Add suspend/resume support to the backlight core and enable use of it
by appropriate drivers.
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
Diffstat (limited to 'drivers/video/backlight/backlight.c')
-rw-r--r-- | drivers/video/backlight/backlight.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/drivers/video/backlight/backlight.c b/drivers/video/backlight/backlight.c index a9c013bb9f20..157057c79ca3 100644 --- a/drivers/video/backlight/backlight.c +++ b/drivers/video/backlight/backlight.c | |||
@@ -40,6 +40,10 @@ static int fb_notifier_callback(struct notifier_block *self, | |||
40 | if (!bd->ops->check_fb || | 40 | if (!bd->ops->check_fb || |
41 | bd->ops->check_fb(evdata->info)) { | 41 | bd->ops->check_fb(evdata->info)) { |
42 | bd->props.fb_blank = *(int *)evdata->data; | 42 | bd->props.fb_blank = *(int *)evdata->data; |
43 | if (bd->props.fb_blank == FB_BLANK_UNBLANK) | ||
44 | bd->props.state &= ~BL_CORE_FBBLANK; | ||
45 | else | ||
46 | bd->props.state |= BL_CORE_FBBLANK; | ||
43 | backlight_update_status(bd); | 47 | backlight_update_status(bd); |
44 | } | 48 | } |
45 | mutex_unlock(&bd->ops_lock); | 49 | mutex_unlock(&bd->ops_lock); |
@@ -165,6 +169,34 @@ static ssize_t backlight_show_actual_brightness(struct device *dev, | |||
165 | 169 | ||
166 | static struct class *backlight_class; | 170 | static struct class *backlight_class; |
167 | 171 | ||
172 | static int backlight_suspend(struct device *dev, pm_message_t state) | ||
173 | { | ||
174 | struct backlight_device *bd = to_backlight_device(dev); | ||
175 | |||
176 | if (bd->ops->options & BL_CORE_SUSPENDRESUME) { | ||
177 | mutex_lock(&bd->ops_lock); | ||
178 | bd->props.state |= BL_CORE_SUSPENDED; | ||
179 | backlight_update_status(bd); | ||
180 | mutex_unlock(&bd->ops_lock); | ||
181 | } | ||
182 | |||
183 | return 0; | ||
184 | } | ||
185 | |||
186 | static int backlight_resume(struct device *dev) | ||
187 | { | ||
188 | struct backlight_device *bd = to_backlight_device(dev); | ||
189 | |||
190 | if (bd->ops->options & BL_CORE_SUSPENDRESUME) { | ||
191 | mutex_lock(&bd->ops_lock); | ||
192 | bd->props.state &= ~BL_CORE_SUSPENDED; | ||
193 | backlight_update_status(bd); | ||
194 | mutex_unlock(&bd->ops_lock); | ||
195 | } | ||
196 | |||
197 | return 0; | ||
198 | } | ||
199 | |||
168 | static void bl_device_release(struct device *dev) | 200 | static void bl_device_release(struct device *dev) |
169 | { | 201 | { |
170 | struct backlight_device *bd = to_backlight_device(dev); | 202 | struct backlight_device *bd = to_backlight_device(dev); |
@@ -281,6 +313,8 @@ static int __init backlight_class_init(void) | |||
281 | } | 313 | } |
282 | 314 | ||
283 | backlight_class->dev_attrs = bl_device_attributes; | 315 | backlight_class->dev_attrs = bl_device_attributes; |
316 | backlight_class->suspend = backlight_suspend; | ||
317 | backlight_class->resume = backlight_resume; | ||
284 | return 0; | 318 | return 0; |
285 | } | 319 | } |
286 | 320 | ||