aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuming Yu <luming.yu@gmail.com>2007-05-09 09:07:05 -0400
committerLen Brown <len.brown@intel.com>2007-05-09 22:44:38 -0400
commit23b0f015bf2c050b8b5399430ca64e1b3398cf76 (patch)
tree9961a709908c3d8c7b4b4824f4c48327694e8764
parentde372ecd80a42c4fb485c7232475301a18d05184 (diff)
ACPI: video: output switch sysfs support
Requires CONFIG_VIDEO_OUTPUT_CONTROL and CONFIG_ACPI_VIDEO. After loading output.ko and video.ko, you would have /sys/class/video_output and several device acpi_videoNum there. For example, I got acpi_video0, acpi_video1,acpi_video2,and acpi_video3 under /sys/class/video_output on my T40. I can query the status of output device0 by running " cat /sys/class/video_output/acpi_video0 " The return value is defined in ACPI SPEC B.5.5 _DCS(Return the Status of Output Device). Also you can turn off video1 and turn on video0 by " echo 0 > acpi_video1; echo 0x80000000 > acpi_video0". Please reference ACPI SPEC B.5.7 _DSS for the parameter definition. Please note that it may or may NOT works purely depending on if your vendor providing correct ACPI video extension support in bios. the driver output.ko and video.ko just works like a interface to invoke BIOS. Signed-off-by: Luming Yu <Luming.yu@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
-rw-r--r--drivers/acpi/Kconfig2
-rw-r--r--drivers/acpi/video.c40
-rw-r--r--drivers/video/Kconfig7
-rw-r--r--drivers/video/Makefile3
4 files changed, 51 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
125config ACPI_VIDEO 125config 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);
273static void acpi_video_switch_brightness(struct acpi_video_device *device, 275static void acpi_video_switch_brightness(struct acpi_video_device *device,
274 int event); 276 int event);
277static int acpi_video_device_get_state(struct acpi_video_device *device,
278 unsigned long *state);
279static int acpi_video_output_get(struct output_device *od);
280static 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*/
277static int acpi_video_get_brightness(struct backlight_device *bd) 283static 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*/
307static 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
316static 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
324static 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
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
index 1132ba5ff391..6c8ffe6757e1 100644
--- a/drivers/video/Kconfig
+++ b/drivers/video/Kconfig
@@ -11,6 +11,13 @@ config VGASTATE
11 tristate 11 tristate
12 default n 12 default n
13 13
14config VIDEO_OUTPUT_CONTROL
15 tristate "Lowlevel video output switch controls"
16 default m
17 help
18 This framework adds support for low-level control of the video
19 output switch.
20
14config FB 21config FB
15 tristate "Support for frame buffer devices" 22 tristate "Support for frame buffer devices"
16 ---help--- 23 ---help---
diff --git a/drivers/video/Makefile b/drivers/video/Makefile
index a916c204274f..08b7c26a5734 100644
--- a/drivers/video/Makefile
+++ b/drivers/video/Makefile
@@ -119,3 +119,6 @@ obj-$(CONFIG_FB_OF) += offb.o
119 119
120# the test framebuffer is last 120# the test framebuffer is last
121obj-$(CONFIG_FB_VIRTUAL) += vfb.o 121obj-$(CONFIG_FB_VIRTUAL) += vfb.o
122
123#video output switch sysfs driver
124obj-$(CONFIG_VIDEO_OUTPUT_CONTROL) += output.o