Add output switch sysfs class support for ACPI video driver. signed-off-by: Luming Yu <Luming.yu@xxxxxxxxx> --- drivers/acpi/Kconfig | 2 +- drivers/acpi/video.c | 38 ++++++++++++++++++++++++++++++++++++++ drivers/video/Kconfig | 7 +++++++ drivers/video/Makefile | 3 +++ include/acpi/processor.h | 0 5 files changed, 49 insertions(+), 1 deletion(-) diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig index e2ce4a9..7d1627b 100644 --- a/drivers/acpi/Kconfig +++ b/drivers/acpi/Kconfig @@ -124,7 +124,7 @@ config ACPI_BUTTON config ACPI_VIDEO tristate "Video" - depends on X86 && BACKLIGHT_CLASS_DEVICE + depends on X86 && BACKLIGHT_CLASS_DEVICE && VIDEO_OUTPUT_CONTROL help This driver implement the ACPI Extensions For Display Adapters for integrated graphics devices on motherboard, as specified in diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c index 00d25b3..3456603 100644 --- a/drivers/acpi/video.c +++ b/drivers/acpi/video.c @@ -33,6 +33,7 @@ #include <linux/proc_fs.h> #include <linux/seq_file.h> #include <linux/backlight.h> +#include <linux/video_output.h> #include <asm/uaccess.h> #include <acpi/acpi_bus.h> @@ -169,6 +170,7 @@ struct acpi_video_device { struct acpi_device *dev; struct acpi_video_device_brightness *brightness; struct backlight_device *backlight; + struct output_device *output_dev; }; /* bus */ @@ -297,6 +299,28 @@ static struct backlight_ops acpi_backlig .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 -------------------------------------------------------------------------- */ @@ -626,6 +650,19 @@ static void acpi_video_device_find_cap(s kfree(name); } + if (device->cap._DCS && device->cap._DSS){ + unsigned long tmp; + 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, + &(data->dev->dev), + device, &acpi_output_properties); + kfree(name); + } return; } @@ -1669,6 +1706,7 @@ static int acpi_video_bus_put_one_device ACPI_DEVICE_NOTIFY, acpi_video_device_notify); backlight_device_unregister(device->backlight); + video_output_unregister(device->output_dev); return 0; } diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig index 7f5a598..bd76a6c 100644 --- a/drivers/video/Kconfig +++ b/drivers/video/Kconfig @@ -6,6 +6,13 @@ menu "Graphics support" source "drivers/video/backlight/Kconfig" +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 tristate "Support for frame buffer devices" ---help--- diff --git a/drivers/video/Makefile b/drivers/video/Makefile index 760305c..f5ab032 100644 --- a/drivers/video/Makefile +++ b/drivers/video/Makefile @@ -108,3 +108,6 @@ obj-$(CONFIG_FB_OF) += off # the test framebuffer is last obj-$(CONFIG_FB_VIRTUAL) += vfb.o + +#video output switch sysfs driver +obj-$(CONFIG_VIDEO_OUTPUT_CONTROL) += output.o
Attachment:
video_output.patch
Description: Binary data