Subject: [PATCH] [acpi video] Add bus event interface - Trap same events as legacy interface, but in smaller, cleaner way - Don't do much with NOTIFY_PROBE event, since the legacy didn't seem to do it right.. Signed-off-by: Patrick Mochel --- drivers/acpi/drivers/video/bus-event.c | 55 +++++++++++++++++++++++++++++++- 1 files changed, 54 insertions(+), 1 deletions(-) applies-to: e5b1b934708a4d94482885cc9f34a857a51bc1be 7ba679939461858258eee71f5d8c66439bb6bb31 diff --git a/drivers/acpi/drivers/video/bus-event.c b/drivers/acpi/drivers/video/bus-event.c index 84702b6..15bd181 100644 --- a/drivers/acpi/drivers/video/bus-event.c +++ b/drivers/acpi/drivers/video/bus-event.c @@ -12,4 +12,57 @@ #include "video.h" -acpi_device_event_none(video_bus); +#define ACPI_VIDEO_NOTIFY_SWITCH 0x80 +#define ACPI_VIDEO_NOTIFY_PROBE 0x81 +#define ACPI_VIDEO_NOTIFY_CYCLE 0x82 +#define ACPI_VIDEO_NOTIFY_NEXT_OUTPUT 0x83 +#define ACPI_VIDEO_NOTIFY_PREV_OUTPUT 0x84 + +static int video_bus_notify(struct acpi_dev * ad, u32 event, int * data) +{ + struct acpi_video_bus * vb = dev_get_drvdata(&ad->dev); + int ret = 0; + + if (event == ACPI_VIDEO_NOTIFY_PROBE) { + /* + * User plugged in or removed a video connector + * + * FIXME: What do we do here? + * + * An output device has been plugged in, but so what? + * A request to change has not occurred. + * The old code did a switch, though incorrectly, so + * an actual switch never really happened. + */ + + } else if (event == ACPI_VIDEO_NOTIFY_CYCLE) { + /* + * "Cycle Display Output" hotkey pressed + */ + ret = video_switch_next(vb); + + } else if (event == ACPI_VIDEO_NOTIFY_NEXT_OUTPUT) { + /* + * "Next Display Output" hotkey pressed + */ + ret = video_switch_next(vb); + + } else if (event == ACPI_VIDEO_NOTIFY_PREV_OUTPUT) { + /* + * "Previous Display Output" hotkey pressed + */ + ret = video_switch_prev(vb); + + } + *data = 0; + return 0; +} + +declare_acpi_events(video_bus, + acpi_event_raise(ACPI_VIDEO_NOTIFY_SWITCH), + acpi_event_raise(ACPI_VIDEO_NOTIFY_PROBE), + acpi_event_raise(ACPI_VIDEO_NOTIFY_CYCLE), + acpi_event_raise(ACPI_VIDEO_NOTIFY_NEXT_OUTPUT), + acpi_event_raise(ACPI_VIDEO_NOTIFY_PREV_OUTPUT)); + +acpi_device_event(video_bus); --- 0.99.9.GIT