aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/acpi/asus_acpi.c67
-rw-r--r--drivers/acpi/battery.c14
-rw-r--r--drivers/acpi/events/evrgnini.c13
-rw-r--r--drivers/acpi/ibm_acpi.c2
-rw-r--r--drivers/acpi/processor_idle.c101
-rw-r--r--drivers/acpi/sbs.c20
6 files changed, 133 insertions, 84 deletions
diff --git a/drivers/acpi/asus_acpi.c b/drivers/acpi/asus_acpi.c
index e9ee4c52a5f6..c7ac9297a204 100644
--- a/drivers/acpi/asus_acpi.c
+++ b/drivers/acpi/asus_acpi.c
@@ -138,6 +138,7 @@ struct asus_hotk {
138 S2x, //S200 (J1 reported), Victor MP-XP7210 138 S2x, //S200 (J1 reported), Victor MP-XP7210
139 W1N, //W1000N 139 W1N, //W1000N
140 W5A, //W5A 140 W5A, //W5A
141 W3V, //W3030V
141 xxN, //M2400N, M3700N, M5200N, M6800N, S1300N, S5200N 142 xxN, //M2400N, M3700N, M5200N, M6800N, S1300N, S5200N
142 //(Centrino) 143 //(Centrino)
143 END_MODEL 144 END_MODEL
@@ -376,6 +377,17 @@ static struct model_data model_conf[END_MODEL] = {
376 .display_get = "\\ADVG"}, 377 .display_get = "\\ADVG"},
377 378
378 { 379 {
380 .name = "W3V",
381 .mt_mled = "MLED",
382 .mt_wled = "WLED",
383 .mt_lcd_switch = xxN_PREFIX "_Q10",
384 .lcd_status = "\\BKLT",
385 .brightness_set = "SPLV",
386 .brightness_get = "GPLV",
387 .display_set = "SDSP",
388 .display_get = "\\INFB"},
389
390 {
379 .name = "xxN", 391 .name = "xxN",
380 .mt_mled = "MLED", 392 .mt_mled = "MLED",
381/* WLED present, but not controlled by ACPI */ 393/* WLED present, but not controlled by ACPI */
@@ -555,11 +567,11 @@ static int
555write_led(const char __user * buffer, unsigned long count, 567write_led(const char __user * buffer, unsigned long count,
556 char *ledname, int ledmask, int invert) 568 char *ledname, int ledmask, int invert)
557{ 569{
558 int value; 570 int rv, value;
559 int led_out = 0; 571 int led_out = 0;
560 572
561 count = parse_arg(buffer, count, &value); 573 rv = parse_arg(buffer, count, &value);
562 if (count > 0) 574 if (rv > 0)
563 led_out = value ? 1 : 0; 575 led_out = value ? 1 : 0;
564 576
565 hotk->status = 577 hotk->status =
@@ -572,7 +584,7 @@ write_led(const char __user * buffer, unsigned long count,
572 printk(KERN_WARNING "Asus ACPI: LED (%s) write failed\n", 584 printk(KERN_WARNING "Asus ACPI: LED (%s) write failed\n",
573 ledname); 585 ledname);
574 586
575 return count; 587 return rv;
576} 588}
577 589
578/* 590/*
@@ -607,20 +619,18 @@ static int
607proc_write_ledd(struct file *file, const char __user * buffer, 619proc_write_ledd(struct file *file, const char __user * buffer,
608 unsigned long count, void *data) 620 unsigned long count, void *data)
609{ 621{
610 int value; 622 int rv, value;
611 623
612 count = parse_arg(buffer, count, &value); 624 rv = parse_arg(buffer, count, &value);
613 if (count > 0) { 625 if (rv > 0) {
614 if (!write_acpi_int 626 if (!write_acpi_int
615 (hotk->handle, hotk->methods->mt_ledd, value, NULL)) 627 (hotk->handle, hotk->methods->mt_ledd, value, NULL))
616 printk(KERN_WARNING 628 printk(KERN_WARNING
617 "Asus ACPI: LED display write failed\n"); 629 "Asus ACPI: LED display write failed\n");
618 else 630 else
619 hotk->ledd_status = (u32) value; 631 hotk->ledd_status = (u32) value;
620 } else if (count < 0) 632 }
621 printk(KERN_WARNING "Asus ACPI: Error reading user input\n"); 633 return rv;
622
623 return count;
624} 634}
625 635
626/* 636/*
@@ -761,12 +771,12 @@ static int
761proc_write_lcd(struct file *file, const char __user * buffer, 771proc_write_lcd(struct file *file, const char __user * buffer,
762 unsigned long count, void *data) 772 unsigned long count, void *data)
763{ 773{
764 int value; 774 int rv, value;
765 775
766 count = parse_arg(buffer, count, &value); 776 rv = parse_arg(buffer, count, &value);
767 if (count > 0) 777 if (rv > 0)
768 set_lcd_state(value); 778 set_lcd_state(value);
769 return count; 779 return rv;
770} 780}
771 781
772static int read_brightness(void) 782static int read_brightness(void)
@@ -830,18 +840,15 @@ static int
830proc_write_brn(struct file *file, const char __user * buffer, 840proc_write_brn(struct file *file, const char __user * buffer,
831 unsigned long count, void *data) 841 unsigned long count, void *data)
832{ 842{
833 int value; 843 int rv, value;
834 844
835 count = parse_arg(buffer, count, &value); 845 rv = parse_arg(buffer, count, &value);
836 if (count > 0) { 846 if (rv > 0) {
837 value = (0 < value) ? ((15 < value) ? 15 : value) : 0; 847 value = (0 < value) ? ((15 < value) ? 15 : value) : 0;
838 /* 0 <= value <= 15 */ 848 /* 0 <= value <= 15 */
839 set_brightness(value); 849 set_brightness(value);
840 } else if (count < 0) {
841 printk(KERN_WARNING "Asus ACPI: Error reading user input\n");
842 } 850 }
843 851 return rv;
844 return count;
845} 852}
846 853
847static void set_display(int value) 854static void set_display(int value)
@@ -880,15 +887,12 @@ static int
880proc_write_disp(struct file *file, const char __user * buffer, 887proc_write_disp(struct file *file, const char __user * buffer,
881 unsigned long count, void *data) 888 unsigned long count, void *data)
882{ 889{
883 int value; 890 int rv, value;
884 891
885 count = parse_arg(buffer, count, &value); 892 rv = parse_arg(buffer, count, &value);
886 if (count > 0) 893 if (rv > 0)
887 set_display(value); 894 set_display(value);
888 else if (count < 0) 895 return rv;
889 printk(KERN_WARNING "Asus ACPI: Error reading user input\n");
890
891 return count;
892} 896}
893 897
894typedef int (proc_readfunc) (char *page, char **start, off_t off, int count, 898typedef int (proc_readfunc) (char *page, char **start, off_t off, int count,
@@ -1097,6 +1101,8 @@ static int asus_model_match(char *model)
1097 return A4G; 1101 return A4G;
1098 else if (strncmp(model, "W1N", 3) == 0) 1102 else if (strncmp(model, "W1N", 3) == 0)
1099 return W1N; 1103 return W1N;
1104 else if (strncmp(model, "W3V", 3) == 0)
1105 return W3V;
1100 else if (strncmp(model, "W5A", 3) == 0) 1106 else if (strncmp(model, "W5A", 3) == 0)
1101 return W5A; 1107 return W5A;
1102 else 1108 else
@@ -1200,9 +1206,10 @@ static int asus_hotk_get_info(void)
1200 hotk->methods->mt_wled = NULL; 1206 hotk->methods->mt_wled = NULL;
1201 /* L5D's WLED is not controlled by ACPI */ 1207 /* L5D's WLED is not controlled by ACPI */
1202 else if (strncmp(string, "M2N", 3) == 0 || 1208 else if (strncmp(string, "M2N", 3) == 0 ||
1209 strncmp(string, "W3V", 3) == 0 ||
1203 strncmp(string, "S1N", 3) == 0) 1210 strncmp(string, "S1N", 3) == 0)
1204 hotk->methods->mt_wled = "WLED"; 1211 hotk->methods->mt_wled = "WLED";
1205 /* M2N and S1N have a usable WLED */ 1212 /* M2N, S1N and W3V have a usable WLED */
1206 else if (asus_info) { 1213 else if (asus_info) {
1207 if (strncmp(asus_info->oem_table_id, "L1", 2) == 0) 1214 if (strncmp(asus_info->oem_table_id, "L1", 2) == 0)
1208 hotk->methods->mled_status = NULL; 1215 hotk->methods->mled_status = NULL;
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c
index 9810e2a55d0a..026e40755cdd 100644
--- a/drivers/acpi/battery.c
+++ b/drivers/acpi/battery.c
@@ -64,6 +64,7 @@ extern void *acpi_unlock_battery_dir(struct proc_dir_entry *acpi_battery_dir);
64 64
65static int acpi_battery_add(struct acpi_device *device); 65static int acpi_battery_add(struct acpi_device *device);
66static int acpi_battery_remove(struct acpi_device *device, int type); 66static int acpi_battery_remove(struct acpi_device *device, int type);
67static int acpi_battery_resume(struct acpi_device *device, int status);
67 68
68static struct acpi_driver acpi_battery_driver = { 69static struct acpi_driver acpi_battery_driver = {
69 .name = ACPI_BATTERY_DRIVER_NAME, 70 .name = ACPI_BATTERY_DRIVER_NAME,
@@ -71,6 +72,7 @@ static struct acpi_driver acpi_battery_driver = {
71 .ids = ACPI_BATTERY_HID, 72 .ids = ACPI_BATTERY_HID,
72 .ops = { 73 .ops = {
73 .add = acpi_battery_add, 74 .add = acpi_battery_add,
75 .resume = acpi_battery_resume,
74 .remove = acpi_battery_remove, 76 .remove = acpi_battery_remove,
75 }, 77 },
76}; 78};
@@ -753,6 +755,18 @@ static int acpi_battery_remove(struct acpi_device *device, int type)
753 return 0; 755 return 0;
754} 756}
755 757
758/* this is needed to learn about changes made in suspended state */
759static int acpi_battery_resume(struct acpi_device *device, int state)
760{
761 struct acpi_battery *battery;
762
763 if (!device)
764 return -EINVAL;
765
766 battery = device->driver_data;
767 return acpi_battery_check(battery);
768}
769
756static int __init acpi_battery_init(void) 770static int __init acpi_battery_init(void)
757{ 771{
758 int result; 772 int result;
diff --git a/drivers/acpi/events/evrgnini.c b/drivers/acpi/events/evrgnini.c
index 5b3c7a85eb9a..203d1359190a 100644
--- a/drivers/acpi/events/evrgnini.c
+++ b/drivers/acpi/events/evrgnini.c
@@ -225,13 +225,12 @@ acpi_ev_pci_config_region_setup(acpi_handle handle,
225 if (! 225 if (!
226 (ACPI_STRNCMP 226 (ACPI_STRNCMP
227 (object_hID.value, PCI_ROOT_HID_STRING, 227 (object_hID.value, PCI_ROOT_HID_STRING,
228 sizeof(PCI_ROOT_HID_STRING)) 228 sizeof(PCI_ROOT_HID_STRING)))
229 || 229 ||
230 !(ACPI_STRNCMP 230 !(ACPI_STRNCMP
231 (object_hID.value, 231 (object_hID.value,
232 PCI_EXPRESS_ROOT_HID_STRING, 232 PCI_EXPRESS_ROOT_HID_STRING,
233 sizeof(PCI_EXPRESS_ROOT_HID_STRING))))) 233 sizeof(PCI_EXPRESS_ROOT_HID_STRING)))) {
234 {
235 234
236 /* Install a handler for this PCI root bridge */ 235 /* Install a handler for this PCI root bridge */
237 236
diff --git a/drivers/acpi/ibm_acpi.c b/drivers/acpi/ibm_acpi.c
index 15fc12482ba0..003a9876c968 100644
--- a/drivers/acpi/ibm_acpi.c
+++ b/drivers/acpi/ibm_acpi.c
@@ -1702,13 +1702,11 @@ static struct ibm_struct ibms[] = {
1702 .name = "brightness", 1702 .name = "brightness",
1703 .read = brightness_read, 1703 .read = brightness_read,
1704 .write = brightness_write, 1704 .write = brightness_write,
1705 .experimental = 1,
1706 }, 1705 },
1707 { 1706 {
1708 .name = "volume", 1707 .name = "volume",
1709 .read = volume_read, 1708 .read = volume_read,
1710 .write = volume_write, 1709 .write = volume_write,
1711 .experimental = 1,
1712 }, 1710 },
1713 { 1711 {
1714 .name = "fan", 1712 .name = "fan",
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c
index 0a395fca843b..429a39dbd75d 100644
--- a/drivers/acpi/processor_idle.c
+++ b/drivers/acpi/processor_idle.c
@@ -219,6 +219,23 @@ static void acpi_safe_halt(void)
219 219
220static atomic_t c3_cpu_count; 220static atomic_t c3_cpu_count;
221 221
222/* Common C-state entry for C2, C3, .. */
223static void acpi_cstate_enter(struct acpi_processor_cx *cstate)
224{
225 if (cstate->space_id == ACPI_CSTATE_FFH) {
226 /* Call into architectural FFH based C-state */
227 acpi_processor_ffh_cstate_enter(cstate);
228 } else {
229 int unused;
230 /* IO port based C-state */
231 inb(cstate->address);
232 /* Dummy wait op - must do something useless after P_LVL2 read
233 because chipsets cannot guarantee that STPCLK# signal
234 gets asserted in time to freeze execution properly. */
235 unused = inl(acpi_fadt.xpm_tmr_blk.address);
236 }
237}
238
222static void acpi_processor_idle(void) 239static void acpi_processor_idle(void)
223{ 240{
224 struct acpi_processor *pr = NULL; 241 struct acpi_processor *pr = NULL;
@@ -361,11 +378,7 @@ static void acpi_processor_idle(void)
361 /* Get start time (ticks) */ 378 /* Get start time (ticks) */
362 t1 = inl(acpi_fadt.xpm_tmr_blk.address); 379 t1 = inl(acpi_fadt.xpm_tmr_blk.address);
363 /* Invoke C2 */ 380 /* Invoke C2 */
364 inb(cx->address); 381 acpi_cstate_enter(cx);
365 /* Dummy wait op - must do something useless after P_LVL2 read
366 because chipsets cannot guarantee that STPCLK# signal
367 gets asserted in time to freeze execution properly. */
368 t2 = inl(acpi_fadt.xpm_tmr_blk.address);
369 /* Get end time (ticks) */ 382 /* Get end time (ticks) */
370 t2 = inl(acpi_fadt.xpm_tmr_blk.address); 383 t2 = inl(acpi_fadt.xpm_tmr_blk.address);
371 384
@@ -401,9 +414,7 @@ static void acpi_processor_idle(void)
401 /* Get start time (ticks) */ 414 /* Get start time (ticks) */
402 t1 = inl(acpi_fadt.xpm_tmr_blk.address); 415 t1 = inl(acpi_fadt.xpm_tmr_blk.address);
403 /* Invoke C3 */ 416 /* Invoke C3 */
404 inb(cx->address); 417 acpi_cstate_enter(cx);
405 /* Dummy wait op (see above) */
406 t2 = inl(acpi_fadt.xpm_tmr_blk.address);
407 /* Get end time (ticks) */ 418 /* Get end time (ticks) */
408 t2 = inl(acpi_fadt.xpm_tmr_blk.address); 419 t2 = inl(acpi_fadt.xpm_tmr_blk.address);
409 if (pr->flags.bm_check) { 420 if (pr->flags.bm_check) {
@@ -628,20 +639,16 @@ static int acpi_processor_get_power_info_fadt(struct acpi_processor *pr)
628 return 0; 639 return 0;
629} 640}
630 641
631static int acpi_processor_get_power_info_default_c1(struct acpi_processor *pr) 642static int acpi_processor_get_power_info_default(struct acpi_processor *pr)
632{ 643{
633 644 if (!pr->power.states[ACPI_STATE_C1].valid) {
634 /* Zero initialize all the C-states info. */ 645 /* set the first C-State to C1 */
635 memset(pr->power.states, 0, sizeof(pr->power.states)); 646 /* all processors need to support C1 */
636 647 pr->power.states[ACPI_STATE_C1].type = ACPI_STATE_C1;
637 /* set the first C-State to C1 */ 648 pr->power.states[ACPI_STATE_C1].valid = 1;
638 pr->power.states[ACPI_STATE_C1].type = ACPI_STATE_C1; 649 }
639 650 /* the C0 state only exists as a filler in our array */
640 /* the C0 state only exists as a filler in our array,
641 * and all processors need to support C1 */
642 pr->power.states[ACPI_STATE_C0].valid = 1; 651 pr->power.states[ACPI_STATE_C0].valid = 1;
643 pr->power.states[ACPI_STATE_C1].valid = 1;
644
645 return 0; 652 return 0;
646} 653}
647 654
@@ -658,12 +665,7 @@ static int acpi_processor_get_power_info_cst(struct acpi_processor *pr)
658 if (nocst) 665 if (nocst)
659 return -ENODEV; 666 return -ENODEV;
660 667
661 current_count = 1; 668 current_count = 0;
662
663 /* Zero initialize C2 onwards and prepare for fresh CST lookup */
664 for (i = 2; i < ACPI_PROCESSOR_MAX_POWER; i++)
665 memset(&(pr->power.states[i]), 0,
666 sizeof(struct acpi_processor_cx));
667 669
668 status = acpi_evaluate_object(pr->handle, "_CST", NULL, &buffer); 670 status = acpi_evaluate_object(pr->handle, "_CST", NULL, &buffer);
669 if (ACPI_FAILURE(status)) { 671 if (ACPI_FAILURE(status)) {
@@ -718,22 +720,39 @@ static int acpi_processor_get_power_info_cst(struct acpi_processor *pr)
718 (reg->space_id != ACPI_ADR_SPACE_FIXED_HARDWARE)) 720 (reg->space_id != ACPI_ADR_SPACE_FIXED_HARDWARE))
719 continue; 721 continue;
720 722
721 cx.address = (reg->space_id == ACPI_ADR_SPACE_FIXED_HARDWARE) ?
722 0 : reg->address;
723
724 /* There should be an easy way to extract an integer... */ 723 /* There should be an easy way to extract an integer... */
725 obj = (union acpi_object *)&(element->package.elements[1]); 724 obj = (union acpi_object *)&(element->package.elements[1]);
726 if (obj->type != ACPI_TYPE_INTEGER) 725 if (obj->type != ACPI_TYPE_INTEGER)
727 continue; 726 continue;
728 727
729 cx.type = obj->integer.value; 728 cx.type = obj->integer.value;
730 729 /*
731 if ((cx.type != ACPI_STATE_C1) && 730 * Some buggy BIOSes won't list C1 in _CST -
732 (reg->space_id != ACPI_ADR_SPACE_SYSTEM_IO)) 731 * Let acpi_processor_get_power_info_default() handle them later
733 continue; 732 */
734 733 if (i == 1 && cx.type != ACPI_STATE_C1)
735 if ((cx.type < ACPI_STATE_C2) || (cx.type > ACPI_STATE_C3)) 734 current_count++;
736 continue; 735
736 cx.address = reg->address;
737 cx.index = current_count + 1;
738
739 cx.space_id = ACPI_CSTATE_SYSTEMIO;
740 if (reg->space_id == ACPI_ADR_SPACE_FIXED_HARDWARE) {
741 if (acpi_processor_ffh_cstate_probe
742 (pr->id, &cx, reg) == 0) {
743 cx.space_id = ACPI_CSTATE_FFH;
744 } else if (cx.type != ACPI_STATE_C1) {
745 /*
746 * C1 is a special case where FIXED_HARDWARE
747 * can be handled in non-MWAIT way as well.
748 * In that case, save this _CST entry info.
749 * That is, we retain space_id of SYSTEM_IO for
750 * halt based C1.
751 * Otherwise, ignore this info and continue.
752 */
753 continue;
754 }
755 }
737 756
738 obj = (union acpi_object *)&(element->package.elements[2]); 757 obj = (union acpi_object *)&(element->package.elements[2]);
739 if (obj->type != ACPI_TYPE_INTEGER) 758 if (obj->type != ACPI_TYPE_INTEGER)
@@ -938,12 +957,18 @@ static int acpi_processor_get_power_info(struct acpi_processor *pr)
938 /* NOTE: the idle thread may not be running while calling 957 /* NOTE: the idle thread may not be running while calling
939 * this function */ 958 * this function */
940 959
941 /* Adding C1 state */ 960 /* Zero initialize all the C-states info. */
942 acpi_processor_get_power_info_default_c1(pr); 961 memset(pr->power.states, 0, sizeof(pr->power.states));
962
943 result = acpi_processor_get_power_info_cst(pr); 963 result = acpi_processor_get_power_info_cst(pr);
944 if (result == -ENODEV) 964 if (result == -ENODEV)
945 acpi_processor_get_power_info_fadt(pr); 965 acpi_processor_get_power_info_fadt(pr);
946 966
967 if (result)
968 return result;
969
970 acpi_processor_get_power_info_default(pr);
971
947 pr->power.count = acpi_processor_power_verify(pr); 972 pr->power.count = acpi_processor_power_verify(pr);
948 973
949 /* 974 /*
diff --git a/drivers/acpi/sbs.c b/drivers/acpi/sbs.c
index 62bef0b3b614..8908a975e575 100644
--- a/drivers/acpi/sbs.c
+++ b/drivers/acpi/sbs.c
@@ -98,11 +98,11 @@ static int update_info_mode = UPDATE_INFO_MODE;
98static int update_time = UPDATE_TIME; 98static int update_time = UPDATE_TIME;
99static int update_time2 = UPDATE_TIME2; 99static int update_time2 = UPDATE_TIME2;
100 100
101module_param(capacity_mode, int, CAPACITY_UNIT); 101module_param(capacity_mode, int, 0);
102module_param(update_mode, int, UPDATE_MODE); 102module_param(update_mode, int, 0);
103module_param(update_info_mode, int, UPDATE_INFO_MODE); 103module_param(update_info_mode, int, 0);
104module_param(update_time, int, UPDATE_TIME); 104module_param(update_time, int, 0);
105module_param(update_time2, int, UPDATE_TIME2); 105module_param(update_time2, int, 0);
106 106
107static int acpi_sbs_add(struct acpi_device *device); 107static int acpi_sbs_add(struct acpi_device *device);
108static int acpi_sbs_remove(struct acpi_device *device, int type); 108static int acpi_sbs_remove(struct acpi_device *device, int type);
@@ -1685,10 +1685,16 @@ static int acpi_sbs_add(struct acpi_device *device)
1685 1685
1686int acpi_sbs_remove(struct acpi_device *device, int type) 1686int acpi_sbs_remove(struct acpi_device *device, int type)
1687{ 1687{
1688 struct acpi_sbs *sbs = (struct acpi_sbs *)acpi_driver_data(device); 1688 struct acpi_sbs *sbs = NULL;
1689 int id; 1689 int id;
1690 1690
1691 if (!device || !sbs) { 1691 if (!device) {
1692 return -EINVAL;
1693 }
1694
1695 sbs = (struct acpi_sbs *)acpi_driver_data(device);
1696
1697 if (!sbs) {
1692 return -EINVAL; 1698 return -EINVAL;
1693 } 1699 }
1694 1700