From: malattia@linux.it
To: lenb@kernel.org
Cc: linux-acpi@vger.kernel.org, Andrew Morton <akpm@osdl.org>
Subject: [PATCH 2/11] Avoid dimness on resume.
Date: Sun, 7 Jan 2007 18:54:34 +0100 [thread overview]
Message-ID: <1168192483207-git-send-email-malattia@linux.it> (raw)
In-Reply-To: <11681924832840-git-send-email-malattia@linux.it>
From: Andrew Morton <akpm@osdl.org>
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>
---
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 e23522a..beb56b9 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;
--
1.4.4.2
next prev parent reply other threads:[~2007-01-07 17:55 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-01-07 17:54 [PATCH 0/11] sony_acpi: getting in shape for prime time malattia
2007-01-07 17:54 ` [PATCH 1/11] SNC device support for Sony Vaios malattia
2007-01-07 17:54 ` malattia [this message]
2007-01-07 17:54 ` [PATCH 3/11] Fix sony_acpi_resume call malattia
2007-01-07 17:54 ` [PATCH 4/11] Add backlight support to the sony_acpi malattia
2007-01-07 17:54 ` [PATCH 5/11] Add backlight support to the sony_acpi v2 malattia
2007-01-07 17:54 ` [PATCH 6/11] Video sysfs support take 2 malattia
2007-01-07 17:54 ` [PATCH 7/11] Add acpi_bus_generate event malattia
2007-01-07 17:54 ` [PATCH 8/11] Allow easier debugging for the unknown SNC methods malattia
2007-01-07 17:54 ` [PATCH 9/11] Add lanpower and audiopower controls malattia
2007-01-07 17:54 ` [PATCH 10/11] Allow multiple sony_acpi_values for the same .name malattia
2007-01-07 17:54 ` [PATCH 11/11] initialize the brighness value at device registration malattia
2007-01-12 17:04 ` Mattia Dongili
-- strict thread matches above, loose matches on Subject: below --
2007-01-13 22:04 [PATCH 0/11] sony_acpi: prepare for prime time (resend) malattia
2007-01-13 22:04 ` [PATCH 1/11] SNC device support for Sony Vaios malattia
2007-01-13 22:04 ` [PATCH 2/11] Avoid dimness on resume malattia
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1168192483207-git-send-email-malattia@linux.it \
--to=malattia@linux.it \
--cc=akpm@osdl.org \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).