|
@@ -1499,32 +1499,10 @@ static const struct file_operations fan_proc_fops = {
|
|
|
static int keys_proc_show(struct seq_file *m, void *v)
|
|
|
{
|
|
|
struct toshiba_acpi_dev *dev = m->private;
|
|
|
- u32 hci_result;
|
|
|
- u32 value;
|
|
|
-
|
|
|
- if (!dev->key_event_valid && dev->system_event_supported) {
|
|
|
- hci_result = hci_read(dev, HCI_SYSTEM_EVENT, &value);
|
|
|
- if (hci_result == TOS_SUCCESS) {
|
|
|
- dev->key_event_valid = 1;
|
|
|
- dev->last_key_event = value;
|
|
|
- } else if (hci_result == TOS_FIFO_EMPTY) {
|
|
|
- /* Better luck next time */
|
|
|
- } else if (hci_result == TOS_NOT_SUPPORTED) {
|
|
|
- /*
|
|
|
- * This is a workaround for an unresolved issue on
|
|
|
- * some machines where system events sporadically
|
|
|
- * become disabled.
|
|
|
- */
|
|
|
- hci_result = hci_write(dev, HCI_SYSTEM_EVENT, 1);
|
|
|
- pr_notice("Re-enabled hotkeys\n");
|
|
|
- } else {
|
|
|
- pr_err("Error reading hotkey status\n");
|
|
|
- return -EIO;
|
|
|
- }
|
|
|
- }
|
|
|
|
|
|
seq_printf(m, "hotkey_ready: %d\n", dev->key_event_valid);
|
|
|
seq_printf(m, "hotkey: 0x%04x\n", dev->last_key_event);
|
|
|
+
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
@@ -2361,22 +2339,28 @@ static void toshiba_acpi_report_hotkey(struct toshiba_acpi_dev *dev,
|
|
|
|
|
|
static void toshiba_acpi_process_hotkeys(struct toshiba_acpi_dev *dev)
|
|
|
{
|
|
|
- u32 hci_result, value;
|
|
|
- int retries = 3;
|
|
|
- int scancode;
|
|
|
-
|
|
|
if (dev->info_supported) {
|
|
|
- scancode = toshiba_acpi_query_hotkey(dev);
|
|
|
- if (scancode < 0)
|
|
|
+ int scancode = toshiba_acpi_query_hotkey(dev);
|
|
|
+
|
|
|
+ if (scancode < 0) {
|
|
|
pr_err("Failed to query hotkey event\n");
|
|
|
- else if (scancode != 0)
|
|
|
+ } else if (scancode != 0) {
|
|
|
toshiba_acpi_report_hotkey(dev, scancode);
|
|
|
+ dev->key_event_valid = 1;
|
|
|
+ dev->last_key_event = scancode;
|
|
|
+ }
|
|
|
} else if (dev->system_event_supported) {
|
|
|
+ u32 result;
|
|
|
+ u32 value;
|
|
|
+ int retries = 3;
|
|
|
+
|
|
|
do {
|
|
|
- hci_result = hci_read(dev, HCI_SYSTEM_EVENT, &value);
|
|
|
- switch (hci_result) {
|
|
|
+ result = hci_read(dev, HCI_SYSTEM_EVENT, &value);
|
|
|
+ switch (result) {
|
|
|
case TOS_SUCCESS:
|
|
|
toshiba_acpi_report_hotkey(dev, (int)value);
|
|
|
+ dev->key_event_valid = 1;
|
|
|
+ dev->last_key_event = value;
|
|
|
break;
|
|
|
case TOS_NOT_SUPPORTED:
|
|
|
/*
|
|
@@ -2384,15 +2368,15 @@ static void toshiba_acpi_process_hotkeys(struct toshiba_acpi_dev *dev)
|
|
|
* issue on some machines where system events
|
|
|
* sporadically become disabled.
|
|
|
*/
|
|
|
- hci_result =
|
|
|
- hci_write(dev, HCI_SYSTEM_EVENT, 1);
|
|
|
- pr_notice("Re-enabled hotkeys\n");
|
|
|
+ result = hci_write(dev, HCI_SYSTEM_EVENT, 1);
|
|
|
+ if (result == TOS_SUCCESS)
|
|
|
+ pr_notice("Re-enabled hotkeys\n");
|
|
|
/* Fall through */
|
|
|
default:
|
|
|
retries--;
|
|
|
break;
|
|
|
}
|
|
|
- } while (retries && hci_result != TOS_FIFO_EMPTY);
|
|
|
+ } while (retries && result != TOS_FIFO_EMPTY);
|
|
|
}
|
|
|
}
|
|
|
|