aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/sony_acpi.c
diff options
context:
space:
mode:
authorAndrew Morton <akpm@osdl.org>2007-01-13 17:04:32 -0500
committerLen Brown <len.brown@intel.com>2007-02-13 03:05:17 -0500
commit3f4f461fa816815b9338047a29cf2521f23f1783 (patch)
tree33a01f549a271e23c4601062792c7e9ece0141c6 /drivers/acpi/sony_acpi.c
parent7f09c432bed80cecfba634933ddc06735e64da00 (diff)
sony_acpi: Avoid dimness on resume.
Doesn't work. Cc: Stelian Pop <stelian@popies.net> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Mattia Dongili <malattia@linux.it> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/sony_acpi.c')
-rw-r--r--drivers/acpi/sony_acpi.c49
1 files changed, 34 insertions, 15 deletions
diff --git a/drivers/acpi/sony_acpi.c b/drivers/acpi/sony_acpi.c
index e23522a0296..beb56b9df5c 100644
--- a/drivers/acpi/sony_acpi.c
+++ b/drivers/acpi/sony_acpi.c
@@ -46,19 +46,6 @@ module_param(debug, int, 0);
46MODULE_PARM_DESC(debug, "set this to 1 (and RTFM) if you want to help " 46MODULE_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
49static int sony_acpi_add (struct acpi_device *device);
50static int sony_acpi_remove (struct acpi_device *device, int type);
51
52static 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
62static acpi_handle sony_acpi_handle; 49static acpi_handle sony_acpi_handle;
63static struct proc_dir_entry *sony_acpi_dir; 50static 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
236static 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
246static void sony_acpi_notify(acpi_handle handle, u32 event, void *data) 255static 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
348static int sony_acpi_remove(struct acpi_device *device, int type) 356static 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
378static 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
370static int __init sony_acpi_init(void) 389static int __init sony_acpi_init(void)
371{ 390{
372 int result; 391 int result;