diff options
author | Len Brown <len.brown@intel.com> | 2006-06-15 21:33:36 -0400 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2006-06-15 21:33:36 -0400 |
commit | e4151eaa7f231296d027b8fb34e2b855a3480836 (patch) | |
tree | 9821c60756cff4b4a0d8cca3b4a9889ea66dee49 /drivers/acpi | |
parent | c080a3e69dfb58ae9b8c7e70a1e33f4f4e493ea7 (diff) | |
parent | 42adb53cb36d19862a02d3087e2e3d9dab39e5fa (diff) | |
download | blackbird-op-linux-e4151eaa7f231296d027b8fb34e2b855a3480836.tar.gz blackbird-op-linux-e4151eaa7f231296d027b8fb34e2b855a3480836.zip |
Pull ibm_acpi into release branch
Diffstat (limited to 'drivers/acpi')
-rw-r--r-- | drivers/acpi/ibm_acpi.c | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/drivers/acpi/ibm_acpi.c b/drivers/acpi/ibm_acpi.c index 262b1f41335a..15fc12482ba0 100644 --- a/drivers/acpi/ibm_acpi.c +++ b/drivers/acpi/ibm_acpi.c @@ -567,6 +567,69 @@ static int bluetooth_write(char *buf) return 0; } +static int wan_supported; + +static int wan_init(void) +{ + wan_supported = hkey_handle && + acpi_evalf(hkey_handle, NULL, "GWAN", "qv"); + + return 0; +} + +static int wan_status(void) +{ + int status; + + if (!wan_supported || + !acpi_evalf(hkey_handle, &status, "GWAN", "d")) + status = 0; + + return status; +} + +static int wan_read(char *p) +{ + int len = 0; + int status = wan_status(); + + if (!wan_supported) + len += sprintf(p + len, "status:\t\tnot supported\n"); + else if (!(status & 1)) + len += sprintf(p + len, "status:\t\tnot installed\n"); + else { + len += sprintf(p + len, "status:\t\t%s\n", enabled(status, 1)); + len += sprintf(p + len, "commands:\tenable, disable\n"); + } + + return len; +} + +static int wan_write(char *buf) +{ + int status = wan_status(); + char *cmd; + int do_cmd = 0; + + if (!wan_supported) + return -ENODEV; + + while ((cmd = next_cmd(&buf))) { + if (strlencmp(cmd, "enable") == 0) { + status |= 2; + } else if (strlencmp(cmd, "disable") == 0) { + status &= ~2; + } else + return -EINVAL; + do_cmd = 1; + } + + if (do_cmd && !acpi_evalf(hkey_handle, NULL, "SWAN", "vd", status)) + return -EIO; + + return 0; +} + static int video_supported; static int video_orig_autosw; @@ -1563,6 +1626,13 @@ static struct ibm_struct ibms[] = { .write = bluetooth_write, }, { + .name = "wan", + .init = wan_init, + .read = wan_read, + .write = wan_write, + .experimental = 1, + }, + { .name = "video", .init = video_init, .read = video_read, |