summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorBen Collins <bcollins@ubuntu.com>2006-01-08 10:04:24 +0100
committerLinus Torvalds <torvalds@g5.osdl.org>2006-01-09 05:14:03 +0100
commitb368fae6abaa1736b8f26128c32947d47237b8e5 (patch)
treed9e14fb1c894c51bdd92b100f0ac30bcc8714174 /drivers
parent[PATCH] Sonypi: convert to the new platform device interface (diff)
downloadlinux-b368fae6abaa1736b8f26128c32947d47237b8e5.tar.xz
linux-b368fae6abaa1736b8f26128c32947d47237b8e5.zip
[PATCH] sonypi: Enable ACPI events for Sony laptop hotkeys
Signed-off-by: Ben Collins <bcollins@ubuntu.com> Cc: "Brown, Len" <len.brown@intel.com> Cc: linux-acpi@vger.kernel.org Cc: Stelian Pop <stelian@popies.net> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/char/sonypi.c45
1 files changed, 45 insertions, 0 deletions
diff --git a/drivers/char/sonypi.c b/drivers/char/sonypi.c
index 6a9e23dc4897..f8dd8527c6aa 100644
--- a/drivers/char/sonypi.c
+++ b/drivers/char/sonypi.c
@@ -510,6 +510,11 @@ static struct sonypi_device {
#define SONYPI_ACPI_ACTIVE 0
#endif /* CONFIG_ACPI */
+#ifdef CONFIG_ACPI
+static struct acpi_device *sonypi_acpi_device;
+static int acpi_enabled;
+#endif
+
static int sonypi_ec_write(u8 addr, u8 value)
{
#ifdef CONFIG_ACPI_EC
@@ -863,6 +868,11 @@ found:
if (useinput)
sonypi_report_input_event(event);
+#ifdef CONFIG_ACPI
+ if (acpi_enabled)
+ acpi_bus_generate_event(sonypi_acpi_device, 1, event);
+#endif
+
kfifo_put(sonypi_device.fifo, (unsigned char *)&event, sizeof(event));
kill_fasync(&sonypi_device.fifo_async, SIGIO, POLL_IN);
wake_up_interruptible(&sonypi_device.fifo_proc_list);
@@ -1164,6 +1174,32 @@ static int sonypi_disable(void)
return 0;
}
+#ifdef CONFIG_ACPI
+static int sonypi_acpi_add(struct acpi_device *device)
+{
+ sonypi_acpi_device = device;
+ strcpy(acpi_device_name(device), "Sony laptop hotkeys");
+ strcpy(acpi_device_class(device), "sony/hotkey");
+ return 0;
+}
+
+static int sonypi_acpi_remove(struct acpi_device *device, int type)
+{
+ sonypi_acpi_device = NULL;
+ return 0;
+}
+
+static struct acpi_driver sonypi_acpi_driver = {
+ .name = "sonypi",
+ .class = "hkey",
+ .ids = "SNY6001",
+ .ops = {
+ .add = sonypi_acpi_add,
+ .remove = sonypi_acpi_remove,
+ },
+};
+#endif
+
static int __devinit sonypi_create_input_devices(void)
{
struct input_dev *jog_dev;
@@ -1511,6 +1547,11 @@ static int __init sonypi_init(void)
if (error)
goto err_free_device;
+#ifdef CONFIG_ACPI
+ if (acpi_bus_register_driver(&sonypi_acpi_driver) > 0)
+ acpi_enabled = 1;
+#endif
+
return 0;
err_free_device:
@@ -1522,6 +1563,10 @@ static int __init sonypi_init(void)
static void __exit sonypi_exit(void)
{
+#ifdef CONFIG_ACPI
+ if (acpi_enabled)
+ acpi_bus_unregister_driver(&sonypi_acpi_driver);
+#endif
platform_device_unregister(sonypi_platform_device);
platform_driver_unregister(&sonypi_driver);
printk(KERN_INFO "sonypi: removed.\n");