提交 23b0f015 编写于 作者: L Luming Yu 提交者: Len Brown

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: NLuming Yu <Luming.yu@intel.com>
Signed-off-by: NLen Brown <len.brown@intel.com>
上级 de372ecd
...@@ -124,7 +124,7 @@ config ACPI_BUTTON ...@@ -124,7 +124,7 @@ config ACPI_BUTTON
config ACPI_VIDEO config ACPI_VIDEO
tristate "Video" tristate "Video"
depends on X86 && BACKLIGHT_CLASS_DEVICE depends on X86 && BACKLIGHT_CLASS_DEVICE && VIDEO_OUTPUT_CONTROL
help help
This driver implement the ACPI Extensions For Display Adapters This driver implement the ACPI Extensions For Display Adapters
for integrated graphics devices on motherboard, as specified in for integrated graphics devices on motherboard, as specified in
......
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
#include <linux/seq_file.h> #include <linux/seq_file.h>
#include <linux/backlight.h> #include <linux/backlight.h>
#include <linux/video_output.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include <acpi/acpi_bus.h> #include <acpi/acpi_bus.h>
...@@ -169,6 +170,7 @@ struct acpi_video_device { ...@@ -169,6 +170,7 @@ struct acpi_video_device {
struct acpi_device *dev; struct acpi_device *dev;
struct acpi_video_device_brightness *brightness; struct acpi_video_device_brightness *brightness;
struct backlight_device *backlight; struct backlight_device *backlight;
struct output_device *output_dev;
}; };
/* bus */ /* bus */
...@@ -272,6 +274,10 @@ static int acpi_video_get_next_level(struct acpi_video_device *device, ...@@ -272,6 +274,10 @@ static int acpi_video_get_next_level(struct acpi_video_device *device,
u32 level_current, u32 event); u32 level_current, u32 event);
static void acpi_video_switch_brightness(struct acpi_video_device *device, static void acpi_video_switch_brightness(struct acpi_video_device *device,
int event); int event);
static int acpi_video_device_get_state(struct acpi_video_device *device,
unsigned long *state);
static int acpi_video_output_get(struct output_device *od);
static int acpi_video_device_set_state(struct acpi_video_device *device, int state);
/*backlight device sysfs support*/ /*backlight device sysfs support*/
static int acpi_video_get_brightness(struct backlight_device *bd) static int acpi_video_get_brightness(struct backlight_device *bd)
...@@ -297,6 +303,28 @@ static struct backlight_ops acpi_backlight_ops = { ...@@ -297,6 +303,28 @@ static struct backlight_ops acpi_backlight_ops = {
.update_status = acpi_video_set_brightness, .update_status = acpi_video_set_brightness,
}; };
/*video output device sysfs support*/
static int acpi_video_output_get(struct output_device *od)
{
unsigned long state;
struct acpi_video_device *vd =
(struct acpi_video_device *)class_get_devdata(&od->class_dev);
acpi_video_device_get_state(vd, &state);
return (int)state;
}
static int acpi_video_output_set(struct output_device *od)
{
unsigned long state = od->request_state;
struct acpi_video_device *vd=
(struct acpi_video_device *)class_get_devdata(&od->class_dev);
return acpi_video_device_set_state(vd, state);
}
static struct output_properties acpi_output_properties = {
.set_state = acpi_video_output_set,
.get_status = acpi_video_output_get,
};
/* -------------------------------------------------------------------------- /* --------------------------------------------------------------------------
Video Management Video Management
-------------------------------------------------------------------------- */ -------------------------------------------------------------------------- */
...@@ -626,6 +654,17 @@ static void acpi_video_device_find_cap(struct acpi_video_device *device) ...@@ -626,6 +654,17 @@ static void acpi_video_device_find_cap(struct acpi_video_device *device)
kfree(name); kfree(name);
} }
if (device->cap._DCS && device->cap._DSS){
static int count = 0;
char *name;
name = kzalloc(MAX_NAME_LEN, GFP_KERNEL);
if (!name)
return;
sprintf(name, "acpi_video%d", count++);
device->output_dev = video_output_register(name,
NULL, device, &acpi_output_properties);
kfree(name);
}
return; return;
} }
...@@ -1669,6 +1708,7 @@ static int acpi_video_bus_put_one_device(struct acpi_video_device *device) ...@@ -1669,6 +1708,7 @@ static int acpi_video_bus_put_one_device(struct acpi_video_device *device)
ACPI_DEVICE_NOTIFY, ACPI_DEVICE_NOTIFY,
acpi_video_device_notify); acpi_video_device_notify);
backlight_device_unregister(device->backlight); backlight_device_unregister(device->backlight);
video_output_unregister(device->output_dev);
return 0; return 0;
} }
......
...@@ -11,6 +11,13 @@ config VGASTATE ...@@ -11,6 +11,13 @@ config VGASTATE
tristate tristate
default n default n
config VIDEO_OUTPUT_CONTROL
tristate "Lowlevel video output switch controls"
default m
help
This framework adds support for low-level control of the video
output switch.
config FB config FB
tristate "Support for frame buffer devices" tristate "Support for frame buffer devices"
---help--- ---help---
......
...@@ -119,3 +119,6 @@ obj-$(CONFIG_FB_OF) += offb.o ...@@ -119,3 +119,6 @@ obj-$(CONFIG_FB_OF) += offb.o
# the test framebuffer is last # the test framebuffer is last
obj-$(CONFIG_FB_VIRTUAL) += vfb.o obj-$(CONFIG_FB_VIRTUAL) += vfb.o
#video output switch sysfs driver
obj-$(CONFIG_VIDEO_OUTPUT_CONTROL) += output.o
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册