diff options
Diffstat (limited to 'drivers/platform')
-rw-r--r-- | drivers/platform/x86/toshiba_acpi.c | 38 |
1 files changed, 23 insertions, 15 deletions
diff --git a/drivers/platform/x86/toshiba_acpi.c b/drivers/platform/x86/toshiba_acpi.c index d6e97aadde0b..734c98f9d493 100644 --- a/drivers/platform/x86/toshiba_acpi.c +++ b/drivers/platform/x86/toshiba_acpi.c | |||
@@ -57,7 +57,7 @@ | |||
57 | #include <linux/i8042.h> | 57 | #include <linux/i8042.h> |
58 | #include <linux/acpi.h> | 58 | #include <linux/acpi.h> |
59 | #include <linux/dmi.h> | 59 | #include <linux/dmi.h> |
60 | #include <asm/uaccess.h> | 60 | #include <linux/uaccess.h> |
61 | 61 | ||
62 | MODULE_AUTHOR("John Belmonte"); | 62 | MODULE_AUTHOR("John Belmonte"); |
63 | MODULE_DESCRIPTION("Toshiba Laptop ACPI Extras Driver"); | 63 | MODULE_DESCRIPTION("Toshiba Laptop ACPI Extras Driver"); |
@@ -289,7 +289,7 @@ static const struct key_entry toshiba_acpi_alt_keymap[] = { | |||
289 | /* utility | 289 | /* utility |
290 | */ | 290 | */ |
291 | 291 | ||
292 | static __inline__ void _set_bit(u32 * word, u32 mask, int value) | 292 | static inline void _set_bit(u32 *word, u32 mask, int value) |
293 | { | 293 | { |
294 | *word = (*word & ~mask) | (mask * value); | 294 | *word = (*word & ~mask) | (mask * value); |
295 | } | 295 | } |
@@ -332,9 +332,8 @@ static acpi_status tci_raw(struct toshiba_acpi_dev *dev, | |||
332 | (char *)dev->method_hci, ¶ms, | 332 | (char *)dev->method_hci, ¶ms, |
333 | &results); | 333 | &results); |
334 | if ((status == AE_OK) && (out_objs->package.count <= TCI_WORDS)) { | 334 | if ((status == AE_OK) && (out_objs->package.count <= TCI_WORDS)) { |
335 | for (i = 0; i < out_objs->package.count; ++i) { | 335 | for (i = 0; i < out_objs->package.count; ++i) |
336 | out[i] = out_objs->package.elements[i].integer.value; | 336 | out[i] = out_objs->package.elements[i].integer.value; |
337 | } | ||
338 | } | 337 | } |
339 | 338 | ||
340 | return status; | 339 | return status; |
@@ -360,6 +359,7 @@ static u32 hci_read1(struct toshiba_acpi_dev *dev, u32 reg, u32 *out1) | |||
360 | u32 in[TCI_WORDS] = { HCI_GET, reg, 0, 0, 0, 0 }; | 359 | u32 in[TCI_WORDS] = { HCI_GET, reg, 0, 0, 0, 0 }; |
361 | u32 out[TCI_WORDS]; | 360 | u32 out[TCI_WORDS]; |
362 | acpi_status status = tci_raw(dev, in, out); | 361 | acpi_status status = tci_raw(dev, in, out); |
362 | |||
363 | if (ACPI_FAILURE(status)) | 363 | if (ACPI_FAILURE(status)) |
364 | return TOS_FAILURE; | 364 | return TOS_FAILURE; |
365 | 365 | ||
@@ -377,11 +377,13 @@ static u32 hci_write2(struct toshiba_acpi_dev *dev, u32 reg, u32 in1, u32 in2) | |||
377 | return ACPI_SUCCESS(status) ? out[0] : TOS_FAILURE; | 377 | return ACPI_SUCCESS(status) ? out[0] : TOS_FAILURE; |
378 | } | 378 | } |
379 | 379 | ||
380 | static u32 hci_read2(struct toshiba_acpi_dev *dev, u32 reg, u32 *out1, u32 *out2) | 380 | static u32 hci_read2(struct toshiba_acpi_dev *dev, |
381 | u32 reg, u32 *out1, u32 *out2) | ||
381 | { | 382 | { |
382 | u32 in[TCI_WORDS] = { HCI_GET, reg, *out1, *out2, 0, 0 }; | 383 | u32 in[TCI_WORDS] = { HCI_GET, reg, *out1, *out2, 0, 0 }; |
383 | u32 out[TCI_WORDS]; | 384 | u32 out[TCI_WORDS]; |
384 | acpi_status status = tci_raw(dev, in, out); | 385 | acpi_status status = tci_raw(dev, in, out); |
386 | |||
385 | if (ACPI_FAILURE(status)) | 387 | if (ACPI_FAILURE(status)) |
386 | return TOS_FAILURE; | 388 | return TOS_FAILURE; |
387 | 389 | ||
@@ -456,6 +458,7 @@ static u32 sci_read(struct toshiba_acpi_dev *dev, u32 reg, u32 *out1) | |||
456 | u32 in[TCI_WORDS] = { SCI_GET, reg, 0, 0, 0, 0 }; | 458 | u32 in[TCI_WORDS] = { SCI_GET, reg, 0, 0, 0, 0 }; |
457 | u32 out[TCI_WORDS]; | 459 | u32 out[TCI_WORDS]; |
458 | acpi_status status = tci_raw(dev, in, out); | 460 | acpi_status status = tci_raw(dev, in, out); |
461 | |||
459 | if (ACPI_FAILURE(status)) | 462 | if (ACPI_FAILURE(status)) |
460 | return TOS_FAILURE; | 463 | return TOS_FAILURE; |
461 | 464 | ||
@@ -730,7 +733,8 @@ static int toshiba_eco_mode_available(struct toshiba_acpi_dev *dev) | |||
730 | return 0; | 733 | return 0; |
731 | } | 734 | } |
732 | 735 | ||
733 | static enum led_brightness toshiba_eco_mode_get_status(struct led_classdev *cdev) | 736 | static enum led_brightness |
737 | toshiba_eco_mode_get_status(struct led_classdev *cdev) | ||
734 | { | 738 | { |
735 | struct toshiba_acpi_dev *dev = container_of(cdev, | 739 | struct toshiba_acpi_dev *dev = container_of(cdev, |
736 | struct toshiba_acpi_dev, eco_led); | 740 | struct toshiba_acpi_dev, eco_led); |
@@ -1252,7 +1256,7 @@ static int set_tr_backlight_status(struct toshiba_acpi_dev *dev, bool enable) | |||
1252 | return hci_result == TOS_SUCCESS ? 0 : -EIO; | 1256 | return hci_result == TOS_SUCCESS ? 0 : -EIO; |
1253 | } | 1257 | } |
1254 | 1258 | ||
1255 | static struct proc_dir_entry *toshiba_proc_dir /*= 0*/ ; | 1259 | static struct proc_dir_entry *toshiba_proc_dir /*= 0*/; |
1256 | 1260 | ||
1257 | static int __get_lcd_brightness(struct toshiba_acpi_dev *dev) | 1261 | static int __get_lcd_brightness(struct toshiba_acpi_dev *dev) |
1258 | { | 1262 | { |
@@ -1263,6 +1267,7 @@ static int __get_lcd_brightness(struct toshiba_acpi_dev *dev) | |||
1263 | if (dev->tr_backlight_supported) { | 1267 | if (dev->tr_backlight_supported) { |
1264 | bool enabled; | 1268 | bool enabled; |
1265 | int ret = get_tr_backlight_status(dev, &enabled); | 1269 | int ret = get_tr_backlight_status(dev, &enabled); |
1270 | |||
1266 | if (ret) | 1271 | if (ret) |
1267 | return ret; | 1272 | return ret; |
1268 | if (enabled) | 1273 | if (enabled) |
@@ -1280,6 +1285,7 @@ static int __get_lcd_brightness(struct toshiba_acpi_dev *dev) | |||
1280 | static int get_lcd_brightness(struct backlight_device *bd) | 1285 | static int get_lcd_brightness(struct backlight_device *bd) |
1281 | { | 1286 | { |
1282 | struct toshiba_acpi_dev *dev = bl_get_data(bd); | 1287 | struct toshiba_acpi_dev *dev = bl_get_data(bd); |
1288 | |||
1283 | return __get_lcd_brightness(dev); | 1289 | return __get_lcd_brightness(dev); |
1284 | } | 1290 | } |
1285 | 1291 | ||
@@ -1316,6 +1322,7 @@ static int set_lcd_brightness(struct toshiba_acpi_dev *dev, int value) | |||
1316 | if (dev->tr_backlight_supported) { | 1322 | if (dev->tr_backlight_supported) { |
1317 | bool enable = !value; | 1323 | bool enable = !value; |
1318 | int ret = set_tr_backlight_status(dev, enable); | 1324 | int ret = set_tr_backlight_status(dev, enable); |
1325 | |||
1319 | if (ret) | 1326 | if (ret) |
1320 | return ret; | 1327 | return ret; |
1321 | if (value) | 1328 | if (value) |
@@ -1330,6 +1337,7 @@ static int set_lcd_brightness(struct toshiba_acpi_dev *dev, int value) | |||
1330 | static int set_lcd_status(struct backlight_device *bd) | 1337 | static int set_lcd_status(struct backlight_device *bd) |
1331 | { | 1338 | { |
1332 | struct toshiba_acpi_dev *dev = bl_get_data(bd); | 1339 | struct toshiba_acpi_dev *dev = bl_get_data(bd); |
1340 | |||
1333 | return set_lcd_brightness(dev, bd->props.brightness); | 1341 | return set_lcd_brightness(dev, bd->props.brightness); |
1334 | } | 1342 | } |
1335 | 1343 | ||
@@ -1387,6 +1395,7 @@ static int video_proc_show(struct seq_file *m, void *v) | |||
1387 | int is_lcd = (value & HCI_VIDEO_OUT_LCD) ? 1 : 0; | 1395 | int is_lcd = (value & HCI_VIDEO_OUT_LCD) ? 1 : 0; |
1388 | int is_crt = (value & HCI_VIDEO_OUT_CRT) ? 1 : 0; | 1396 | int is_crt = (value & HCI_VIDEO_OUT_CRT) ? 1 : 0; |
1389 | int is_tv = (value & HCI_VIDEO_OUT_TV) ? 1 : 0; | 1397 | int is_tv = (value & HCI_VIDEO_OUT_TV) ? 1 : 0; |
1398 | |||
1390 | seq_printf(m, "lcd_out: %d\n", is_lcd); | 1399 | seq_printf(m, "lcd_out: %d\n", is_lcd); |
1391 | seq_printf(m, "crt_out: %d\n", is_crt); | 1400 | seq_printf(m, "crt_out: %d\n", is_crt); |
1392 | seq_printf(m, "tv_out: %d\n", is_tv); | 1401 | seq_printf(m, "tv_out: %d\n", is_tv); |
@@ -1439,8 +1448,7 @@ static ssize_t video_proc_write(struct file *file, const char __user *buf, | |||
1439 | do { | 1448 | do { |
1440 | ++buffer; | 1449 | ++buffer; |
1441 | --remain; | 1450 | --remain; |
1442 | } | 1451 | } while (remain && *(buffer - 1) != ';'); |
1443 | while (remain && *(buffer - 1) != ';'); | ||
1444 | } | 1452 | } |
1445 | 1453 | ||
1446 | kfree(cmd); | 1454 | kfree(cmd); |
@@ -1448,6 +1456,7 @@ static ssize_t video_proc_write(struct file *file, const char __user *buf, | |||
1448 | ret = get_video_status(dev, &video_out); | 1456 | ret = get_video_status(dev, &video_out); |
1449 | if (!ret) { | 1457 | if (!ret) { |
1450 | unsigned int new_video_out = video_out; | 1458 | unsigned int new_video_out = video_out; |
1459 | |||
1451 | if (lcd_out != -1) | 1460 | if (lcd_out != -1) |
1452 | _set_bit(&new_video_out, HCI_VIDEO_OUT_LCD, lcd_out); | 1461 | _set_bit(&new_video_out, HCI_VIDEO_OUT_LCD, lcd_out); |
1453 | if (crt_out != -1) | 1462 | if (crt_out != -1) |
@@ -1517,10 +1526,10 @@ static ssize_t fan_proc_write(struct file *file, const char __user *buf, | |||
1517 | if (sscanf(cmd, " force_on : %i", &value) == 1 && | 1526 | if (sscanf(cmd, " force_on : %i", &value) == 1 && |
1518 | value >= 0 && value <= 1) { | 1527 | value >= 0 && value <= 1) { |
1519 | hci_result = hci_write1(dev, HCI_FAN, value); | 1528 | hci_result = hci_write1(dev, HCI_FAN, value); |
1520 | if (hci_result != TOS_SUCCESS) | 1529 | if (hci_result == TOS_SUCCESS) |
1521 | return -EIO; | ||
1522 | else | ||
1523 | dev->force_fan = value; | 1530 | dev->force_fan = value; |
1531 | else | ||
1532 | return -EIO; | ||
1524 | } else { | 1533 | } else { |
1525 | return -EINVAL; | 1534 | return -EINVAL; |
1526 | } | 1535 | } |
@@ -1585,11 +1594,10 @@ static ssize_t keys_proc_write(struct file *file, const char __user *buf, | |||
1585 | return -EFAULT; | 1594 | return -EFAULT; |
1586 | cmd[len] = '\0'; | 1595 | cmd[len] = '\0'; |
1587 | 1596 | ||
1588 | if (sscanf(cmd, " hotkey_ready : %i", &value) == 1 && value == 0) { | 1597 | if (sscanf(cmd, " hotkey_ready : %i", &value) == 1 && value == 0) |
1589 | dev->key_event_valid = 0; | 1598 | dev->key_event_valid = 0; |
1590 | } else { | 1599 | else |
1591 | return -EINVAL; | 1600 | return -EINVAL; |
1592 | } | ||
1593 | 1601 | ||
1594 | return count; | 1602 | return count; |
1595 | } | 1603 | } |