diff options
-rw-r--r-- | drivers/platform/x86/toshiba_acpi.c | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/drivers/platform/x86/toshiba_acpi.c b/drivers/platform/x86/toshiba_acpi.c index 48c79b257178..a480fd089f81 100644 --- a/drivers/platform/x86/toshiba_acpi.c +++ b/drivers/platform/x86/toshiba_acpi.c | |||
@@ -108,6 +108,7 @@ MODULE_LICENSE("GPL"); | |||
108 | #define TOS_FIFO_EMPTY 0x8c00 | 108 | #define TOS_FIFO_EMPTY 0x8c00 |
109 | #define TOS_DATA_NOT_AVAILABLE 0x8d20 | 109 | #define TOS_DATA_NOT_AVAILABLE 0x8d20 |
110 | #define TOS_NOT_INITIALIZED 0x8d50 | 110 | #define TOS_NOT_INITIALIZED 0x8d50 |
111 | #define TOS_NOT_INSTALLED 0x8e00 | ||
111 | 112 | ||
112 | /* registers */ | 113 | /* registers */ |
113 | #define HCI_FAN 0x0004 | 114 | #define HCI_FAN 0x0004 |
@@ -695,16 +696,32 @@ static int toshiba_touchpad_get(struct toshiba_acpi_dev *dev, u32 *state) | |||
695 | static int toshiba_eco_mode_available(struct toshiba_acpi_dev *dev) | 696 | static int toshiba_eco_mode_available(struct toshiba_acpi_dev *dev) |
696 | { | 697 | { |
697 | acpi_status status; | 698 | acpi_status status; |
698 | u32 in[TCI_WORDS] = { HCI_GET, HCI_ECO_MODE, 0, 1, 0, 0 }; | 699 | u32 in[TCI_WORDS] = { HCI_GET, HCI_ECO_MODE, 0, 0, 0, 0 }; |
699 | u32 out[TCI_WORDS]; | 700 | u32 out[TCI_WORDS]; |
700 | 701 | ||
701 | status = tci_raw(dev, in, out); | 702 | status = tci_raw(dev, in, out); |
702 | if (ACPI_FAILURE(status) || out[0] == TOS_INPUT_DATA_ERROR) { | 703 | if (ACPI_FAILURE(status) || out[0] == TOS_FAILURE) { |
703 | pr_info("ACPI call to get ECO led failed\n"); | 704 | pr_err("ACPI call to get ECO led failed\n"); |
704 | return 0; | 705 | } else if (out[0] == TOS_NOT_INSTALLED) { |
706 | pr_info("ECO led not installed"); | ||
707 | } else if (out[0] == TOS_INPUT_DATA_ERROR) { | ||
708 | /* If we receive 0x8300 (Input Data Error), it means that the | ||
709 | * LED device is present, but that we just screwed the input | ||
710 | * parameters. | ||
711 | * | ||
712 | * Let's query the status of the LED to see if we really have a | ||
713 | * success response, indicating the actual presense of the LED, | ||
714 | * bail out otherwise. | ||
715 | */ | ||
716 | in[3] = 1; | ||
717 | status = tci_raw(dev, in, out); | ||
718 | if (ACPI_FAILURE(status) || out[0] == TOS_FAILURE) | ||
719 | pr_err("ACPI call to get ECO led failed\n"); | ||
720 | else if (out[0] == TOS_SUCCESS) | ||
721 | return 1; | ||
705 | } | 722 | } |
706 | 723 | ||
707 | return 1; | 724 | return 0; |
708 | } | 725 | } |
709 | 726 | ||
710 | static enum led_brightness toshiba_eco_mode_get_status(struct led_classdev *cdev) | 727 | static enum led_brightness toshiba_eco_mode_get_status(struct led_classdev *cdev) |