diff options
| -rw-r--r-- | drivers/char/sonypi.c | 45 |
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 { | |||
| 510 | #define SONYPI_ACPI_ACTIVE 0 | 510 | #define SONYPI_ACPI_ACTIVE 0 |
| 511 | #endif /* CONFIG_ACPI */ | 511 | #endif /* CONFIG_ACPI */ |
| 512 | 512 | ||
| 513 | #ifdef CONFIG_ACPI | ||
| 514 | static struct acpi_device *sonypi_acpi_device; | ||
| 515 | static int acpi_enabled; | ||
| 516 | #endif | ||
| 517 | |||
| 513 | static int sonypi_ec_write(u8 addr, u8 value) | 518 | static int sonypi_ec_write(u8 addr, u8 value) |
| 514 | { | 519 | { |
| 515 | #ifdef CONFIG_ACPI_EC | 520 | #ifdef CONFIG_ACPI_EC |
| @@ -863,6 +868,11 @@ found: | |||
| 863 | if (useinput) | 868 | if (useinput) |
| 864 | sonypi_report_input_event(event); | 869 | sonypi_report_input_event(event); |
| 865 | 870 | ||
| 871 | #ifdef CONFIG_ACPI | ||
| 872 | if (acpi_enabled) | ||
| 873 | acpi_bus_generate_event(sonypi_acpi_device, 1, event); | ||
| 874 | #endif | ||
| 875 | |||
| 866 | kfifo_put(sonypi_device.fifo, (unsigned char *)&event, sizeof(event)); | 876 | kfifo_put(sonypi_device.fifo, (unsigned char *)&event, sizeof(event)); |
| 867 | kill_fasync(&sonypi_device.fifo_async, SIGIO, POLL_IN); | 877 | kill_fasync(&sonypi_device.fifo_async, SIGIO, POLL_IN); |
| 868 | wake_up_interruptible(&sonypi_device.fifo_proc_list); | 878 | wake_up_interruptible(&sonypi_device.fifo_proc_list); |
| @@ -1164,6 +1174,32 @@ static int sonypi_disable(void) | |||
| 1164 | return 0; | 1174 | return 0; |
| 1165 | } | 1175 | } |
| 1166 | 1176 | ||
| 1177 | #ifdef CONFIG_ACPI | ||
| 1178 | static int sonypi_acpi_add(struct acpi_device *device) | ||
| 1179 | { | ||
| 1180 | sonypi_acpi_device = device; | ||
| 1181 | strcpy(acpi_device_name(device), "Sony laptop hotkeys"); | ||
| 1182 | strcpy(acpi_device_class(device), "sony/hotkey"); | ||
| 1183 | return 0; | ||
| 1184 | } | ||
| 1185 | |||
| 1186 | static int sonypi_acpi_remove(struct acpi_device *device, int type) | ||
| 1187 | { | ||
| 1188 | sonypi_acpi_device = NULL; | ||
| 1189 | return 0; | ||
| 1190 | } | ||
| 1191 | |||
| 1192 | static struct acpi_driver sonypi_acpi_driver = { | ||
| 1193 | .name = "sonypi", | ||
| 1194 | .class = "hkey", | ||
| 1195 | .ids = "SNY6001", | ||
| 1196 | .ops = { | ||
| 1197 | .add = sonypi_acpi_add, | ||
| 1198 | .remove = sonypi_acpi_remove, | ||
| 1199 | }, | ||
| 1200 | }; | ||
| 1201 | #endif | ||
| 1202 | |||
| 1167 | static int __devinit sonypi_create_input_devices(void) | 1203 | static int __devinit sonypi_create_input_devices(void) |
| 1168 | { | 1204 | { |
| 1169 | struct input_dev *jog_dev; | 1205 | struct input_dev *jog_dev; |
| @@ -1511,6 +1547,11 @@ static int __init sonypi_init(void) | |||
| 1511 | if (error) | 1547 | if (error) |
| 1512 | goto err_free_device; | 1548 | goto err_free_device; |
| 1513 | 1549 | ||
| 1550 | #ifdef CONFIG_ACPI | ||
| 1551 | if (acpi_bus_register_driver(&sonypi_acpi_driver) > 0) | ||
| 1552 | acpi_enabled = 1; | ||
| 1553 | #endif | ||
| 1554 | |||
| 1514 | return 0; | 1555 | return 0; |
| 1515 | 1556 | ||
| 1516 | err_free_device: | 1557 | err_free_device: |
| @@ -1522,6 +1563,10 @@ static int __init sonypi_init(void) | |||
| 1522 | 1563 | ||
| 1523 | static void __exit sonypi_exit(void) | 1564 | static void __exit sonypi_exit(void) |
| 1524 | { | 1565 | { |
| 1566 | #ifdef CONFIG_ACPI | ||
| 1567 | if (acpi_enabled) | ||
| 1568 | acpi_bus_unregister_driver(&sonypi_acpi_driver); | ||
| 1569 | #endif | ||
| 1525 | platform_device_unregister(sonypi_platform_device); | 1570 | platform_device_unregister(sonypi_platform_device); |
| 1526 | platform_driver_unregister(&sonypi_driver); | 1571 | platform_driver_unregister(&sonypi_driver); |
| 1527 | printk(KERN_INFO "sonypi: removed.\n"); | 1572 | printk(KERN_INFO "sonypi: removed.\n"); |
