Skip to content

Commit

Permalink
ACPI: video: reset brightness on resume
Browse files Browse the repository at this point in the history
Some machines seem to need the backlight brightness to be reset on resume.
Add support for doing so to the video module.

[akpm@linux-foundation.org: coding-style fixes]
Signed-off-by: Matthew Garrett <mjg59@srcf.ucam.org>
Cc: Zhang Rui <rui.zhang@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Len Brown <len.brown@intel.com>
  • Loading branch information
Matthew Garrett authored and Len Brown committed Feb 7, 2008
1 parent 7761f63 commit 863c149
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions drivers/acpi/video.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ module_param(brightness_switch_enabled, bool, 0644);

static int acpi_video_bus_add(struct acpi_device *device);
static int acpi_video_bus_remove(struct acpi_device *device, int type);
static int acpi_video_resume(struct acpi_device *device);

static const struct acpi_device_id video_device_ids[] = {
{ACPI_VIDEO_HID, 0},
Expand All @@ -91,6 +92,7 @@ static struct acpi_driver acpi_video_bus = {
.ops = {
.add = acpi_video_bus_add,
.remove = acpi_video_bus_remove,
.resume = acpi_video_resume,
},
};

Expand Down Expand Up @@ -1837,6 +1839,25 @@ static void acpi_video_device_notify(acpi_handle handle, u32 event, void *data)
}

static int instance;
static int acpi_video_resume(struct acpi_device *device)
{
struct acpi_video_bus *video;
struct acpi_video_device *video_device;
int i;

if (!device || !acpi_driver_data(device))
return -EINVAL;

video = acpi_driver_data(device);

for (i = 0; i < video->attached_count; i++) {
video_device = video->attached_array[i].bind_info;
if (video_device && video_device->backlight)
acpi_video_set_brightness(video_device->backlight);
}
return AE_OK;
}

static int acpi_video_bus_add(struct acpi_device *device)
{
acpi_status status;
Expand Down

0 comments on commit 863c149

Please sign in to comment.