aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/platform/x86/toshiba_acpi.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/platform/x86/toshiba_acpi.c')
-rw-r--r--drivers/platform/x86/toshiba_acpi.c27
1 files changed, 20 insertions, 7 deletions
diff --git a/drivers/platform/x86/toshiba_acpi.c b/drivers/platform/x86/toshiba_acpi.c
index b062d3d7b373..d0dce734b2ed 100644
--- a/drivers/platform/x86/toshiba_acpi.c
+++ b/drivers/platform/x86/toshiba_acpi.c
@@ -1255,10 +1255,15 @@ static ssize_t toshiba_kbd_bl_mode_store(struct device *dev,
1255 const char *buf, size_t count) 1255 const char *buf, size_t count)
1256{ 1256{
1257 struct toshiba_acpi_dev *toshiba = dev_get_drvdata(dev); 1257 struct toshiba_acpi_dev *toshiba = dev_get_drvdata(dev);
1258 int mode = -1; 1258 int mode;
1259 int time = -1; 1259 int time;
1260 int ret;
1260 1261
1261 if (sscanf(buf, "%i", &mode) != 1 && (mode != 2 || mode != 1)) 1262
1263 ret = kstrtoint(buf, 0, &mode);
1264 if (ret)
1265 return ret;
1266 if (mode != SCI_KBD_MODE_FNZ && mode != SCI_KBD_MODE_AUTO)
1262 return -EINVAL; 1267 return -EINVAL;
1263 1268
1264 /* Set the Keyboard Backlight Mode where: 1269 /* Set the Keyboard Backlight Mode where:
@@ -1266,11 +1271,12 @@ static ssize_t toshiba_kbd_bl_mode_store(struct device *dev,
1266 * Auto - KBD backlight turns off automatically in given time 1271 * Auto - KBD backlight turns off automatically in given time
1267 * FN-Z - KBD backlight "toggles" when hotkey pressed 1272 * FN-Z - KBD backlight "toggles" when hotkey pressed
1268 */ 1273 */
1269 if (mode != -1 && toshiba->kbd_mode != mode) { 1274 if (toshiba->kbd_mode != mode) {
1270 time = toshiba->kbd_time << HCI_MISC_SHIFT; 1275 time = toshiba->kbd_time << HCI_MISC_SHIFT;
1271 time = time + toshiba->kbd_mode; 1276 time = time + toshiba->kbd_mode;
1272 if (toshiba_kbd_illum_status_set(toshiba, time) < 0) 1277 ret = toshiba_kbd_illum_status_set(toshiba, time);
1273 return -EIO; 1278 if (ret)
1279 return ret;
1274 toshiba->kbd_mode = mode; 1280 toshiba->kbd_mode = mode;
1275 } 1281 }
1276 1282
@@ -1857,9 +1863,16 @@ static int toshiba_acpi_resume(struct device *device)
1857{ 1863{
1858 struct toshiba_acpi_dev *dev = acpi_driver_data(to_acpi_device(device)); 1864 struct toshiba_acpi_dev *dev = acpi_driver_data(to_acpi_device(device));
1859 u32 result; 1865 u32 result;
1866 acpi_status status;
1867
1868 if (dev->hotkey_dev) {
1869 status = acpi_evaluate_object(dev->acpi_dev->handle, "ENAB",
1870 NULL, NULL);
1871 if (ACPI_FAILURE(status))
1872 pr_info("Unable to re-enable hotkeys\n");
1860 1873
1861 if (dev->hotkey_dev)
1862 hci_write1(dev, HCI_HOTKEY_EVENT, HCI_HOTKEY_ENABLE, &result); 1874 hci_write1(dev, HCI_HOTKEY_EVENT, HCI_HOTKEY_ENABLE, &result);
1875 }
1863 1876
1864 return 0; 1877 return 0;
1865} 1878}