diff options
-rw-r--r-- | drivers/acpi/sony_acpi.c | 49 |
1 files changed, 34 insertions, 15 deletions
diff --git a/drivers/acpi/sony_acpi.c b/drivers/acpi/sony_acpi.c index e23522a02965..beb56b9df5c8 100644 --- a/drivers/acpi/sony_acpi.c +++ b/drivers/acpi/sony_acpi.c | |||
@@ -46,19 +46,6 @@ module_param(debug, int, 0); | |||
46 | MODULE_PARM_DESC(debug, "set this to 1 (and RTFM) if you want to help " | 46 | MODULE_PARM_DESC(debug, "set this to 1 (and RTFM) if you want to help " |
47 | "the development of this driver"); | 47 | "the development of this driver"); |
48 | 48 | ||
49 | static int sony_acpi_add (struct acpi_device *device); | ||
50 | static int sony_acpi_remove (struct acpi_device *device, int type); | ||
51 | |||
52 | static struct acpi_driver sony_acpi_driver = { | ||
53 | .name = ACPI_SNC_DRIVER_NAME, | ||
54 | .class = ACPI_SNC_CLASS, | ||
55 | .ids = ACPI_SNC_HID, | ||
56 | .ops = { | ||
57 | .add = sony_acpi_add, | ||
58 | .remove = sony_acpi_remove, | ||
59 | }, | ||
60 | }; | ||
61 | |||
62 | static acpi_handle sony_acpi_handle; | 49 | static acpi_handle sony_acpi_handle; |
63 | static struct proc_dir_entry *sony_acpi_dir; | 50 | static struct proc_dir_entry *sony_acpi_dir; |
64 | 51 | ||
@@ -69,6 +56,8 @@ static struct sony_acpi_value { | |||
69 | char *acpiset;/* name of the ACPI get function */ | 56 | char *acpiset;/* name of the ACPI get function */ |
70 | int min; /* minimum allowed value or -1 */ | 57 | int min; /* minimum allowed value or -1 */ |
71 | int max; /* maximum allowed value or -1 */ | 58 | int max; /* maximum allowed value or -1 */ |
59 | int value; /* current setting */ | ||
60 | int valid; /* Has ever been set */ | ||
72 | int debug; /* active only in debug mode ? */ | 61 | int debug; /* active only in debug mode ? */ |
73 | } sony_acpi_values[] = { | 62 | } sony_acpi_values[] = { |
74 | { | 63 | { |
@@ -239,10 +228,30 @@ static int sony_acpi_write(struct file *file, const char __user *buffer, | |||
239 | 228 | ||
240 | if (acpi_callsetfunc(sony_acpi_handle, item->acpiset, value, NULL) < 0) | 229 | if (acpi_callsetfunc(sony_acpi_handle, item->acpiset, value, NULL) < 0) |
241 | return -EIO; | 230 | return -EIO; |
242 | 231 | item->value = value; | |
232 | item->valid = 1; | ||
243 | return count; | 233 | return count; |
244 | } | 234 | } |
245 | 235 | ||
236 | static int sony_acpi_resume(struct acpi_device *device, int state) | ||
237 | { | ||
238 | struct sony_acpi_value *item; | ||
239 | |||
240 | for (item = sony_acpi_values; item->name; item++) { | ||
241 | int ret; | ||
242 | |||
243 | if (!item->valid) | ||
244 | continue; | ||
245 | ret = acpi_callsetfunc(sony_acpi_handle, item->acpiset, | ||
246 | item->value, NULL); | ||
247 | if (ret < 0) { | ||
248 | printk("%s: %d\n", __FUNCTION__, ret); | ||
249 | break; | ||
250 | } | ||
251 | } | ||
252 | return 0; | ||
253 | } | ||
254 | |||
246 | static void sony_acpi_notify(acpi_handle handle, u32 event, void *data) | 255 | static void sony_acpi_notify(acpi_handle handle, u32 event, void *data) |
247 | { | 256 | { |
248 | printk(LOG_PFX "sony_acpi_notify\n"); | 257 | printk(LOG_PFX "sony_acpi_notify\n"); |
@@ -344,7 +353,6 @@ outwalk: | |||
344 | return result; | 353 | return result; |
345 | } | 354 | } |
346 | 355 | ||
347 | |||
348 | static int sony_acpi_remove(struct acpi_device *device, int type) | 356 | static int sony_acpi_remove(struct acpi_device *device, int type) |
349 | { | 357 | { |
350 | acpi_status status; | 358 | acpi_status status; |
@@ -367,6 +375,17 @@ static int sony_acpi_remove(struct acpi_device *device, int type) | |||
367 | return 0; | 375 | return 0; |
368 | } | 376 | } |
369 | 377 | ||
378 | static struct acpi_driver sony_acpi_driver = { | ||
379 | .name = ACPI_SNC_DRIVER_NAME, | ||
380 | .class = ACPI_SNC_CLASS, | ||
381 | .ids = ACPI_SNC_HID, | ||
382 | .ops = { | ||
383 | .add = sony_acpi_add, | ||
384 | .remove = sony_acpi_remove, | ||
385 | .resume = sony_acpi_resume, | ||
386 | }, | ||
387 | }; | ||
388 | |||
370 | static int __init sony_acpi_init(void) | 389 | static int __init sony_acpi_init(void) |
371 | { | 390 | { |
372 | int result; | 391 | int result; |