diff options
Diffstat (limited to 'drivers/acpi')
-rw-r--r-- | drivers/acpi/Kconfig | 2 | ||||
-rw-r--r-- | drivers/acpi/video.c | 40 |
2 files changed, 41 insertions, 1 deletions
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig index 139f41f033d8..eb4855f2c606 100644 --- a/drivers/acpi/Kconfig +++ b/drivers/acpi/Kconfig | |||
@@ -124,7 +124,7 @@ config ACPI_BUTTON | |||
124 | 124 | ||
125 | config ACPI_VIDEO | 125 | config ACPI_VIDEO |
126 | tristate "Video" | 126 | tristate "Video" |
127 | depends on X86 && BACKLIGHT_CLASS_DEVICE | 127 | depends on X86 && BACKLIGHT_CLASS_DEVICE && VIDEO_OUTPUT_CONTROL |
128 | help | 128 | help |
129 | This driver implement the ACPI Extensions For Display Adapters | 129 | This driver implement the ACPI Extensions For Display Adapters |
130 | for integrated graphics devices on motherboard, as specified in | 130 | for integrated graphics devices on motherboard, as specified in |
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c index 00d25b347255..39273dae7004 100644 --- a/drivers/acpi/video.c +++ b/drivers/acpi/video.c | |||
@@ -33,6 +33,7 @@ | |||
33 | #include <linux/seq_file.h> | 33 | #include <linux/seq_file.h> |
34 | 34 | ||
35 | #include <linux/backlight.h> | 35 | #include <linux/backlight.h> |
36 | #include <linux/video_output.h> | ||
36 | #include <asm/uaccess.h> | 37 | #include <asm/uaccess.h> |
37 | 38 | ||
38 | #include <acpi/acpi_bus.h> | 39 | #include <acpi/acpi_bus.h> |
@@ -169,6 +170,7 @@ struct acpi_video_device { | |||
169 | struct acpi_device *dev; | 170 | struct acpi_device *dev; |
170 | struct acpi_video_device_brightness *brightness; | 171 | struct acpi_video_device_brightness *brightness; |
171 | struct backlight_device *backlight; | 172 | struct backlight_device *backlight; |
173 | struct output_device *output_dev; | ||
172 | }; | 174 | }; |
173 | 175 | ||
174 | /* bus */ | 176 | /* bus */ |
@@ -272,6 +274,10 @@ static int acpi_video_get_next_level(struct acpi_video_device *device, | |||
272 | u32 level_current, u32 event); | 274 | u32 level_current, u32 event); |
273 | static void acpi_video_switch_brightness(struct acpi_video_device *device, | 275 | static void acpi_video_switch_brightness(struct acpi_video_device *device, |
274 | int event); | 276 | int event); |
277 | static int acpi_video_device_get_state(struct acpi_video_device *device, | ||
278 | unsigned long *state); | ||
279 | static int acpi_video_output_get(struct output_device *od); | ||
280 | static int acpi_video_device_set_state(struct acpi_video_device *device, int state); | ||
275 | 281 | ||
276 | /*backlight device sysfs support*/ | 282 | /*backlight device sysfs support*/ |
277 | static int acpi_video_get_brightness(struct backlight_device *bd) | 283 | static int acpi_video_get_brightness(struct backlight_device *bd) |
@@ -297,6 +303,28 @@ static struct backlight_ops acpi_backlight_ops = { | |||
297 | .update_status = acpi_video_set_brightness, | 303 | .update_status = acpi_video_set_brightness, |
298 | }; | 304 | }; |
299 | 305 | ||
306 | /*video output device sysfs support*/ | ||
307 | static int acpi_video_output_get(struct output_device *od) | ||
308 | { | ||
309 | unsigned long state; | ||
310 | struct acpi_video_device *vd = | ||
311 | (struct acpi_video_device *)class_get_devdata(&od->class_dev); | ||
312 | acpi_video_device_get_state(vd, &state); | ||
313 | return (int)state; | ||
314 | } | ||
315 | |||
316 | static int acpi_video_output_set(struct output_device *od) | ||
317 | { | ||
318 | unsigned long state = od->request_state; | ||
319 | struct acpi_video_device *vd= | ||
320 | (struct acpi_video_device *)class_get_devdata(&od->class_dev); | ||
321 | return acpi_video_device_set_state(vd, state); | ||
322 | } | ||
323 | |||
324 | static struct output_properties acpi_output_properties = { | ||
325 | .set_state = acpi_video_output_set, | ||
326 | .get_status = acpi_video_output_get, | ||
327 | }; | ||
300 | /* -------------------------------------------------------------------------- | 328 | /* -------------------------------------------------------------------------- |
301 | Video Management | 329 | Video Management |
302 | -------------------------------------------------------------------------- */ | 330 | -------------------------------------------------------------------------- */ |
@@ -626,6 +654,17 @@ static void acpi_video_device_find_cap(struct acpi_video_device *device) | |||
626 | 654 | ||
627 | kfree(name); | 655 | kfree(name); |
628 | } | 656 | } |
657 | if (device->cap._DCS && device->cap._DSS){ | ||
658 | static int count = 0; | ||
659 | char *name; | ||
660 | name = kzalloc(MAX_NAME_LEN, GFP_KERNEL); | ||
661 | if (!name) | ||
662 | return; | ||
663 | sprintf(name, "acpi_video%d", count++); | ||
664 | device->output_dev = video_output_register(name, | ||
665 | NULL, device, &acpi_output_properties); | ||
666 | kfree(name); | ||
667 | } | ||
629 | return; | 668 | return; |
630 | } | 669 | } |
631 | 670 | ||
@@ -1669,6 +1708,7 @@ static int acpi_video_bus_put_one_device(struct acpi_video_device *device) | |||
1669 | ACPI_DEVICE_NOTIFY, | 1708 | ACPI_DEVICE_NOTIFY, |
1670 | acpi_video_device_notify); | 1709 | acpi_video_device_notify); |
1671 | backlight_device_unregister(device->backlight); | 1710 | backlight_device_unregister(device->backlight); |
1711 | video_output_unregister(device->output_dev); | ||
1672 | return 0; | 1712 | return 0; |
1673 | } | 1713 | } |
1674 | 1714 | ||