static int get_fan_status(struct toshiba_acpi_dev *dev, u32 *status) { u32 hci_result; hci_read1(dev, HCI_FAN, status, &hci_result); return hci_result == HCI_SUCCESS ? 0 : -EIO; }
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_read1(dev, HCI_SYSTEM_EVENT, &value, &hci_result); if (hci_result == HCI_SUCCESS) { dev->key_event_valid = 1; dev->last_key_event = value; } else if (hci_result == HCI_EMPTY) { /* */ } else if (hci_result == HCI_NOT_SUPPORTED) { /* */ hci_write1(dev, HCI_SYSTEM_EVENT, 1, &hci_result); 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; }
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_read1(dev, HCI_SYSTEM_EVENT, &value, &hci_result); if (hci_result == HCI_SUCCESS) { dev->key_event_valid = 1; dev->last_key_event = value; } else if (hci_result == HCI_EMPTY) { /* better luck next time */ } else if (hci_result == HCI_NOT_SUPPORTED) { /* This is a workaround for an unresolved issue on * some machines where system events sporadically * become disabled. */ hci_write1(dev, HCI_SYSTEM_EVENT, 1, &hci_result); 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; }
static int get_video_status(struct toshiba_acpi_dev *dev, u32 *status) { u32 hci_result; hci_read1(dev, HCI_VIDEO_OUT, status, &hci_result); return hci_result == HCI_SUCCESS ? 0 : -EIO; }
static int get_tr_backlight_status(struct toshiba_acpi_dev *dev, bool *enabled) { u32 hci_result; u32 status; hci_read1(dev, HCI_TR_BACKLIGHT, &status, &hci_result); *enabled = !status; return hci_result == HCI_SUCCESS ? 0 : -EIO; }
static int get_lcd(struct backlight_device *bd) { u32 hci_result; u32 value; hci_read1(HCI_LCD_BRIGHTNESS, &value, &hci_result); if (hci_result == HCI_SUCCESS) { return (value >> HCI_LCD_BRIGHTNESS_SHIFT); } else return -EFAULT;
static int get_lcd(struct backlight_device *bd) { struct toshiba_acpi_dev *dev = bl_get_data(bd); u32 hci_result; u32 value; hci_read1(dev, HCI_LCD_BRIGHTNESS, &value, &hci_result); if (hci_result == HCI_SUCCESS) return (value >> HCI_LCD_BRIGHTNESS_SHIFT); return -EIO; }
static char *read_lcd(char *p) { u32 hci_result; u32 value; hci_read1(HCI_LCD_BRIGHTNESS, &value, &hci_result); if (hci_result == HCI_SUCCESS) { value = value >> HCI_LCD_BRIGHTNESS_SHIFT; p += sprintf(p, "brightness: %d\n", value); p += sprintf(p, "brightness_levels: %d\n", HCI_LCD_BRIGHTNESS_LEVELS); } else {
static void toshiba_acpi_notify(struct acpi_device *acpi_dev, u32 event) { struct toshiba_acpi_dev *dev = acpi_driver_data(acpi_dev); u32 hci_result, value; int retries = 3; int scancode; if (event != 0x80) return; if (dev->info_supported) { scancode = toshiba_acpi_query_hotkey(dev); if (scancode < 0) pr_err("Failed to query hotkey event\n"); else if (scancode != 0) toshiba_acpi_report_hotkey(dev, scancode); } else if (dev->system_event_supported) { do { hci_read1(dev, HCI_SYSTEM_EVENT, &value, &hci_result); switch (hci_result) { case HCI_SUCCESS: toshiba_acpi_report_hotkey(dev, (int)value); break; case HCI_NOT_SUPPORTED: /* */ hci_write1(dev, HCI_SYSTEM_EVENT, 1, &hci_result); pr_notice("Re-enabled hotkeys\n"); /* */ default: retries--; break; } } while (retries && hci_result != HCI_EMPTY); } }
static int __get_lcd_brightness(struct toshiba_acpi_dev *dev) { u32 hci_result; u32 value; int brightness = 0; if (dev->tr_backlight_supported) { bool enabled; int ret = get_tr_backlight_status(dev, &enabled); if (ret) return ret; if (enabled) return 0; brightness++; } hci_read1(dev, HCI_LCD_BRIGHTNESS, &value, &hci_result); if (hci_result == HCI_SUCCESS) return brightness + (value >> HCI_LCD_BRIGHTNESS_SHIFT); return -EIO; }