aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi')
-rw-r--r--drivers/acpi/ibm_acpi.c70
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)
567 return 0; 567 return 0;
568} 568}
569 569
570static int wan_supported;
571
572static int wan_init(void)
573{
574 wan_supported = hkey_handle &&
575 acpi_evalf(hkey_handle, NULL, "GWAN", "qv");
576
577 return 0;
578}
579
580static int wan_status(void)
581{
582 int status;
583
584 if (!wan_supported ||
585 !acpi_evalf(hkey_handle, &status, "GWAN", "d"))
586 status = 0;
587
588 return status;
589}
590
591static int wan_read(char *p)
592{
593 int len = 0;
594 int status = wan_status();
595
596 if (!wan_supported)
597 len += sprintf(p + len, "status:\t\tnot supported\n");
598 else if (!(status & 1))
599 len += sprintf(p + len, "status:\t\tnot installed\n");
600 else {
601 len += sprintf(p + len, "status:\t\t%s\n", enabled(status, 1));
602 len += sprintf(p + len, "commands:\tenable, disable\n");
603 }
604
605 return len;
606}
607
608static int wan_write(char *buf)
609{
610 int status = wan_status();
611 char *cmd;
612 int do_cmd = 0;
613
614 if (!wan_supported)
615 return -ENODEV;
616
617 while ((cmd = next_cmd(&buf))) {
618 if (strlencmp(cmd, "enable") == 0) {
619 status |= 2;
620 } else if (strlencmp(cmd, "disable") == 0) {
621 status &= ~2;
622 } else
623 return -EINVAL;
624 do_cmd = 1;
625 }
626
627 if (do_cmd && !acpi_evalf(hkey_handle, NULL, "SWAN", "vd", status))
628 return -EIO;
629
630 return 0;
631}
632
570static int video_supported; 633static int video_supported;
571static int video_orig_autosw; 634static int video_orig_autosw;
572 635
@@ -1563,6 +1626,13 @@ static struct ibm_struct ibms[] = {
1563 .write = bluetooth_write, 1626 .write = bluetooth_write,
1564 }, 1627 },
1565 { 1628 {
1629 .name = "wan",
1630 .init = wan_init,
1631 .read = wan_read,
1632 .write = wan_write,
1633 .experimental = 1,
1634 },
1635 {
1566 .name = "video", 1636 .name = "video",
1567 .init = video_init, 1637 .init = video_init,
1568 .read = video_read, 1638 .read = video_read,