summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Morton <akpm@osdl.org>2007-01-13 23:04:32 +0100
committerLen Brown <len.brown@intel.com>2007-02-13 03:05:17 -0500
commit3f4f461fa816815b9338047a29cf2521f23f1783 (patch)
tree33a01f549a271e23c4601062792c7e9ece0141c6
parent7f09c432bed80cecfba634933ddc06735e64da00 (diff)
downloadlinux-next-3f4f461fa816815b9338047a29cf2521f23f1783.tar.gz
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>
-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 e23522a02965..beb56b9df5c8 100644
--- a/drivers/acpi/sony_acpi.c
+++ b/drivers/acpi/sony_acpi.c
@@ -46,19 +46,6 @@ module_param(debug, int, 0);
MODULE_PARM_DESC(debug, "set this to 1 (and RTFM) if you want to help "
"the development of this driver");
-static int sony_acpi_add (struct acpi_device *device);
-static int sony_acpi_remove (struct acpi_device *device, int type);
-
-static struct acpi_driver sony_acpi_driver = {
- .name = ACPI_SNC_DRIVER_NAME,
- .class = ACPI_SNC_CLASS,
- .ids = ACPI_SNC_HID,
- .ops = {
- .add = sony_acpi_add,
- .remove = sony_acpi_remove,
- },
-};
-
static acpi_handle sony_acpi_handle;
static struct proc_dir_entry *sony_acpi_dir;
@@ -69,6 +56,8 @@ static struct sony_acpi_value {
char *acpiset;/* name of the ACPI get function */
int min; /* minimum allowed value or -1 */
int max; /* maximum allowed value or -1 */
+ int value; /* current setting */
+ int valid; /* Has ever been set */
int debug; /* active only in debug mode ? */
} sony_acpi_values[] = {
{
@@ -239,10 +228,30 @@ static int sony_acpi_write(struct file *file, const char __user *buffer,
if (acpi_callsetfunc(sony_acpi_handle, item->acpiset, value, NULL) < 0)
return -EIO;
-
+ item->value = value;
+ item->valid = 1;
return count;
}
+static int sony_acpi_resume(struct acpi_device *device, int state)
+{
+ struct sony_acpi_value *item;
+
+ for (item = sony_acpi_values; item->name; item++) {
+ int ret;
+
+ if (!item->valid)
+ continue;
+ ret = acpi_callsetfunc(sony_acpi_handle, item->acpiset,
+ item->value, NULL);
+ if (ret < 0) {
+ printk("%s: %d\n", __FUNCTION__, ret);
+ break;
+ }
+ }
+ return 0;
+}
+
static void sony_acpi_notify(acpi_handle handle, u32 event, void *data)
{
printk(LOG_PFX "sony_acpi_notify\n");
@@ -344,7 +353,6 @@ outwalk:
return result;
}
-
static int sony_acpi_remove(struct acpi_device *device, int type)
{
acpi_status status;
@@ -367,6 +375,17 @@ static int sony_acpi_remove(struct acpi_device *device, int type)
return 0;
}
+static struct acpi_driver sony_acpi_driver = {
+ .name = ACPI_SNC_DRIVER_NAME,
+ .class = ACPI_SNC_CLASS,
+ .ids = ACPI_SNC_HID,
+ .ops = {
+ .add = sony_acpi_add,
+ .remove = sony_acpi_remove,
+ .resume = sony_acpi_resume,
+ },
+};
+
static int __init sony_acpi_init(void)
{
int result;