aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/kernel-parameters.txt55
-rw-r--r--Documentation/laptops/acer-wmi.txt28
-rw-r--r--arch/x86/kernel/cpu/cpufreq/powernow-k8.c42
-rw-r--r--drivers/acpi/bus.c53
-rw-r--r--drivers/acpi/pci_link.c4
-rw-r--r--drivers/acpi/power.c68
-rw-r--r--drivers/acpi/processor_perflib.c18
-rw-r--r--drivers/acpi/scan.c62
-rw-r--r--drivers/acpi/wmi.c49
-rw-r--r--drivers/misc/Kconfig1
-rw-r--r--drivers/misc/acer-wmi.c225
-rw-r--r--drivers/pnp/pnpacpi/core.c6
-rw-r--r--include/acpi/acpi_drivers.h1
-rw-r--r--include/linux/kernel.h24
14 files changed, 423 insertions, 213 deletions
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
index 1150444a21ab..99cf83fd6947 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -217,20 +217,47 @@ and is between 256 and 4096 characters. It is defined in the file
217 acpi.debug_level= [HW,ACPI] 217 acpi.debug_level= [HW,ACPI]
218 Format: <int> 218 Format: <int>
219 Each bit of the <int> indicates an ACPI debug level, 219 Each bit of the <int> indicates an ACPI debug level,
220 1: enable, 0: disable. It is useful for boot time 220 which corresponds to the level in an ACPI_DEBUG_PRINT
221 debugging. After system has booted up, it can be set 221 statement. After system has booted up, this mask
222 via /sys/module/acpi/parameters/debug_level. 222 can be set via /sys/module/acpi/parameters/debug_level.
223 CONFIG_ACPI_DEBUG must be enabled for this to produce any output. 223
224 Available bits (add the numbers together) to enable different 224 CONFIG_ACPI_DEBUG must be enabled for this to produce
225 debug output levels of the ACPI subsystem: 225 any output. The number can be in decimal or prefixed
226 0x01 error 0x02 warn 0x04 init 0x08 debug object 226 with 0x in hex. Some of these options produce so much
227 0x10 info 0x20 init names 0x40 parse 0x80 load 227 output that the system is unusable.
228 0x100 dispatch 0x200 execute 0x400 names 0x800 operation region 228
229 0x1000 bfield 0x2000 tables 0x4000 values 0x8000 objects 229 The following global components are defined by the
230 0x10000 resources 0x20000 user requests 0x40000 package. 230 ACPI CA:
231 The number can be in decimal or prefixed with 0x in hex. 231 0x01 error
232 Warning: Many of these options can produce a lot of 232 0x02 warn
233 output and make your system unusable. Be very careful. 233 0x04 init
234 0x08 debug object
235 0x10 info
236 0x20 init names
237 0x40 parse
238 0x80 load
239 0x100 dispatch
240 0x200 execute
241 0x400 names
242 0x800 operation region
243 0x1000 bfield
244 0x2000 tables
245 0x4000 values
246 0x8000 objects
247 0x10000 resources
248 0x20000 user requests
249 0x40000 package
250 The number can be in decimal or prefixed with 0x in hex.
251 Warning: Many of these options can produce a lot of
252 output and make your system unusable. Be very careful.
253
254 acpi.power_nocheck= [HW,ACPI]
255 Format: 1/0 enable/disable the check of power state.
256 On some bogus BIOS the _PSC object/_STA object of
257 power resource can't return the correct device power
258 state. In such case it is unneccessary to check its
259 power state again in power transition.
260 1 : disable the power state check
234 261
235 acpi_pm_good [X86-32,X86-64] 262 acpi_pm_good [X86-32,X86-64]
236 Override the pmtimer bug detection: force the kernel 263 Override the pmtimer bug detection: force the kernel
diff --git a/Documentation/laptops/acer-wmi.txt b/Documentation/laptops/acer-wmi.txt
index 69b5dd4e5a59..2b3a6b5260bf 100644
--- a/Documentation/laptops/acer-wmi.txt
+++ b/Documentation/laptops/acer-wmi.txt
@@ -1,7 +1,7 @@
1Acer Laptop WMI Extras Driver 1Acer Laptop WMI Extras Driver
2http://code.google.com/p/aceracpi 2http://code.google.com/p/aceracpi
3Version 0.1 3Version 0.2
49th February 2008 418th August 2008
5 5
6Copyright 2007-2008 Carlos Corbacho <carlos@strangeworlds.co.uk> 6Copyright 2007-2008 Carlos Corbacho <carlos@strangeworlds.co.uk>
7 7
@@ -87,17 +87,7 @@ acer-wmi come with built-in wireless. However, should you feel so inclined to
87ever wish to remove the card, or swap it out at some point, please get in touch 87ever wish to remove the card, or swap it out at some point, please get in touch
88with me, as we may well be able to gain some data on wireless card detection. 88with me, as we may well be able to gain some data on wireless card detection.
89 89
90To read the status of the wireless radio (0=off, 1=on): 90The wireless radio is exposed through rfkill.
91cat /sys/devices/platform/acer-wmi/wireless
92
93To enable the wireless radio:
94echo 1 > /sys/devices/platform/acer-wmi/wireless
95
96To disable the wireless radio:
97echo 0 > /sys/devices/platform/acer-wmi/wireless
98
99To set the state of the wireless radio when loading acer-wmi, pass:
100wireless=X (where X is 0 or 1)
101 91
102Bluetooth 92Bluetooth
103********* 93*********
@@ -117,17 +107,7 @@ For the adventurously minded - if you want to buy an internal bluetooth
117module off the internet that is compatible with your laptop and fit it, then 107module off the internet that is compatible with your laptop and fit it, then
118it will work just fine with acer-wmi. 108it will work just fine with acer-wmi.
119 109
120To read the status of the bluetooth module (0=off, 1=on): 110Bluetooth is exposed through rfkill.
121cat /sys/devices/platform/acer-wmi/wireless
122
123To enable the bluetooth module:
124echo 1 > /sys/devices/platform/acer-wmi/bluetooth
125
126To disable the bluetooth module:
127echo 0 > /sys/devices/platform/acer-wmi/bluetooth
128
129To set the state of the bluetooth module when loading acer-wmi, pass:
130bluetooth=X (where X is 0 or 1)
131 111
1323G 1123G
133** 113**
diff --git a/arch/x86/kernel/cpu/cpufreq/powernow-k8.c b/arch/x86/kernel/cpu/cpufreq/powernow-k8.c
index 84bb395038d8..4e0c6abd7ca4 100644
--- a/arch/x86/kernel/cpu/cpufreq/powernow-k8.c
+++ b/arch/x86/kernel/cpu/cpufreq/powernow-k8.c
@@ -45,7 +45,6 @@
45#endif 45#endif
46 46
47#define PFX "powernow-k8: " 47#define PFX "powernow-k8: "
48#define BFX PFX "BIOS error: "
49#define VERSION "version 2.20.00" 48#define VERSION "version 2.20.00"
50#include "powernow-k8.h" 49#include "powernow-k8.h"
51 50
@@ -536,35 +535,40 @@ static int check_pst_table(struct powernow_k8_data *data, struct pst_s *pst, u8
536 535
537 for (j = 0; j < data->numps; j++) { 536 for (j = 0; j < data->numps; j++) {
538 if (pst[j].vid > LEAST_VID) { 537 if (pst[j].vid > LEAST_VID) {
539 printk(KERN_ERR PFX "vid %d invalid : 0x%x\n", j, pst[j].vid); 538 printk(KERN_ERR FW_BUG PFX "vid %d invalid : 0x%x\n",
539 j, pst[j].vid);
540 return -EINVAL; 540 return -EINVAL;
541 } 541 }
542 if (pst[j].vid < data->rvo) { /* vid + rvo >= 0 */ 542 if (pst[j].vid < data->rvo) { /* vid + rvo >= 0 */
543 printk(KERN_ERR BFX "0 vid exceeded with pstate %d\n", j); 543 printk(KERN_ERR FW_BUG PFX "0 vid exceeded with pstate"
544 " %d\n", j);
544 return -ENODEV; 545 return -ENODEV;
545 } 546 }
546 if (pst[j].vid < maxvid + data->rvo) { /* vid + rvo >= maxvid */ 547 if (pst[j].vid < maxvid + data->rvo) { /* vid + rvo >= maxvid */
547 printk(KERN_ERR BFX "maxvid exceeded with pstate %d\n", j); 548 printk(KERN_ERR FW_BUG PFX "maxvid exceeded with pstate"
549 " %d\n", j);
548 return -ENODEV; 550 return -ENODEV;
549 } 551 }
550 if (pst[j].fid > MAX_FID) { 552 if (pst[j].fid > MAX_FID) {
551 printk(KERN_ERR BFX "maxfid exceeded with pstate %d\n", j); 553 printk(KERN_ERR FW_BUG PFX "maxfid exceeded with pstate"
554 " %d\n", j);
552 return -ENODEV; 555 return -ENODEV;
553 } 556 }
554 if (j && (pst[j].fid < HI_FID_TABLE_BOTTOM)) { 557 if (j && (pst[j].fid < HI_FID_TABLE_BOTTOM)) {
555 /* Only first fid is allowed to be in "low" range */ 558 /* Only first fid is allowed to be in "low" range */
556 printk(KERN_ERR BFX "two low fids - %d : 0x%x\n", j, pst[j].fid); 559 printk(KERN_ERR FW_BUG PFX "two low fids - %d : "
560 "0x%x\n", j, pst[j].fid);
557 return -EINVAL; 561 return -EINVAL;
558 } 562 }
559 if (pst[j].fid < lastfid) 563 if (pst[j].fid < lastfid)
560 lastfid = pst[j].fid; 564 lastfid = pst[j].fid;
561 } 565 }
562 if (lastfid & 1) { 566 if (lastfid & 1) {
563 printk(KERN_ERR BFX "lastfid invalid\n"); 567 printk(KERN_ERR FW_BUG PFX "lastfid invalid\n");
564 return -EINVAL; 568 return -EINVAL;
565 } 569 }
566 if (lastfid > LO_FID_TABLE_TOP) 570 if (lastfid > LO_FID_TABLE_TOP)
567 printk(KERN_INFO BFX "first fid not from lo freq table\n"); 571 printk(KERN_INFO FW_BUG PFX "first fid not from lo freq table\n");
568 572
569 return 0; 573 return 0;
570} 574}
@@ -672,13 +676,13 @@ static int find_psb_table(struct powernow_k8_data *data)
672 676
673 dprintk("table vers: 0x%x\n", psb->tableversion); 677 dprintk("table vers: 0x%x\n", psb->tableversion);
674 if (psb->tableversion != PSB_VERSION_1_4) { 678 if (psb->tableversion != PSB_VERSION_1_4) {
675 printk(KERN_ERR BFX "PSB table is not v1.4\n"); 679 printk(KERN_ERR FW_BUG PFX "PSB table is not v1.4\n");
676 return -ENODEV; 680 return -ENODEV;
677 } 681 }
678 682
679 dprintk("flags: 0x%x\n", psb->flags1); 683 dprintk("flags: 0x%x\n", psb->flags1);
680 if (psb->flags1) { 684 if (psb->flags1) {
681 printk(KERN_ERR BFX "unknown flags\n"); 685 printk(KERN_ERR FW_BUG PFX "unknown flags\n");
682 return -ENODEV; 686 return -ENODEV;
683 } 687 }
684 688
@@ -705,7 +709,7 @@ static int find_psb_table(struct powernow_k8_data *data)
705 } 709 }
706 } 710 }
707 if (cpst != 1) { 711 if (cpst != 1) {
708 printk(KERN_ERR BFX "numpst must be 1\n"); 712 printk(KERN_ERR FW_BUG PFX "numpst must be 1\n");
709 return -ENODEV; 713 return -ENODEV;
710 } 714 }
711 715
@@ -1130,17 +1134,19 @@ static int __cpuinit powernowk8_cpu_init(struct cpufreq_policy *pol)
1130 "ACPI Processor module before starting this " 1134 "ACPI Processor module before starting this "
1131 "driver.\n"); 1135 "driver.\n");
1132#else 1136#else
1133 printk(KERN_ERR PFX "Your BIOS does not provide ACPI " 1137 printk(KERN_ERR FW_BUG PFX "Your BIOS does not provide"
1134 "_PSS objects in a way that Linux understands. " 1138 " ACPI _PSS objects in a way that Linux "
1135 "Please report this to the Linux ACPI maintainers" 1139 "understands. Please report this to the Linux "
1136 " and complain to your BIOS vendor.\n"); 1140 "ACPI maintainers and complain to your BIOS "
1141 "vendor.\n");
1137#endif 1142#endif
1138 kfree(data); 1143 kfree(data);
1139 return -ENODEV; 1144 return -ENODEV;
1140 } 1145 }
1141 if (pol->cpu != 0) { 1146 if (pol->cpu != 0) {
1142 printk(KERN_ERR PFX "No ACPI _PSS objects for CPU other than " 1147 printk(KERN_ERR FW_BUG PFX "No ACPI _PSS objects for "
1143 "CPU0. Complain to your BIOS vendor.\n"); 1148 "CPU other than CPU0. Complain to your BIOS "
1149 "vendor.\n");
1144 kfree(data); 1150 kfree(data);
1145 return -ENODEV; 1151 return -ENODEV;
1146 } 1152 }
@@ -1193,7 +1199,7 @@ static int __cpuinit powernowk8_cpu_init(struct cpufreq_policy *pol)
1193 1199
1194 /* min/max the cpu is capable of */ 1200 /* min/max the cpu is capable of */
1195 if (cpufreq_frequency_table_cpuinfo(pol, data->powernow_table)) { 1201 if (cpufreq_frequency_table_cpuinfo(pol, data->powernow_table)) {
1196 printk(KERN_ERR PFX "invalid powernow_table\n"); 1202 printk(KERN_ERR FW_BUG PFX "invalid powernow_table\n");
1197 powernow_k8_cpu_exit_acpi(data); 1203 powernow_k8_cpu_exit_acpi(data);
1198 kfree(data->powernow_table); 1204 kfree(data->powernow_table);
1199 kfree(data); 1205 kfree(data);
diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c
index ccae305ee55d..e9b116d2b56d 100644
--- a/drivers/acpi/bus.c
+++ b/drivers/acpi/bus.c
@@ -48,6 +48,23 @@ EXPORT_SYMBOL(acpi_root_dir);
48 48
49#define STRUCT_TO_INT(s) (*((int*)&s)) 49#define STRUCT_TO_INT(s) (*((int*)&s))
50 50
51static int set_power_nocheck(const struct dmi_system_id *id)
52{
53 printk(KERN_NOTICE PREFIX "%s detected - "
54 "disable power check in power transistion\n", id->ident);
55 acpi_power_nocheck = 1;
56 return 0;
57}
58static struct dmi_system_id __cpuinitdata power_nocheck_dmi_table[] = {
59 {
60 set_power_nocheck, "HP Pavilion 05", {
61 DMI_MATCH(DMI_BIOS_VENDOR, "Phoenix Technologies LTD"),
62 DMI_MATCH(DMI_SYS_VENDOR, "HP Pavilion 05"),
63 DMI_MATCH(DMI_PRODUCT_VERSION, "2001211RE101GLEND") }, NULL},
64 {},
65};
66
67
51/* -------------------------------------------------------------------------- 68/* --------------------------------------------------------------------------
52 Device Management 69 Device Management
53 -------------------------------------------------------------------------- */ 70 -------------------------------------------------------------------------- */
@@ -95,21 +112,21 @@ int acpi_bus_get_status(struct acpi_device *device)
95 } 112 }
96 113
97 /* 114 /*
98 * Otherwise we assume the status of our parent (unless we don't 115 * According to ACPI spec some device can be present and functional
99 * have one, in which case status is implied). 116 * even if the parent is not present but functional.
117 * In such conditions the child device should not inherit the status
118 * from the parent.
100 */ 119 */
101 else if (device->parent)
102 device->status = device->parent->status;
103 else 120 else
104 STRUCT_TO_INT(device->status) = 121 STRUCT_TO_INT(device->status) =
105 ACPI_STA_DEVICE_PRESENT | ACPI_STA_DEVICE_ENABLED | 122 ACPI_STA_DEVICE_PRESENT | ACPI_STA_DEVICE_ENABLED |
106 ACPI_STA_DEVICE_UI | ACPI_STA_DEVICE_FUNCTIONING; 123 ACPI_STA_DEVICE_UI | ACPI_STA_DEVICE_FUNCTIONING;
107 124
108 if (device->status.functional && !device->status.present) { 125 if (device->status.functional && !device->status.present) {
109 printk(KERN_WARNING PREFIX "Device [%s] status [%08x]: " 126 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device [%s] status [%08x]: "
110 "functional but not present; setting present\n", 127 "functional but not present;\n",
111 device->pnp.bus_id, (u32) STRUCT_TO_INT(device->status)); 128 device->pnp.bus_id,
112 device->status.present = 1; 129 (u32) STRUCT_TO_INT(device->status)));
113 } 130 }
114 131
115 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device [%s] status [%08x]\n", 132 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device [%s] status [%08x]\n",
@@ -223,7 +240,19 @@ int acpi_bus_set_power(acpi_handle handle, int state)
223 /* 240 /*
224 * Get device's current power state 241 * Get device's current power state
225 */ 242 */
226 acpi_bus_get_power(device->handle, &device->power.state); 243 if (!acpi_power_nocheck) {
244 /*
245 * Maybe the incorrect power state is returned on the bogus
246 * bios, which is different with the real power state.
247 * For example: the bios returns D0 state and the real power
248 * state is D3. OS expects to set the device to D0 state. In
249 * such case if OS uses the power state returned by the BIOS,
250 * the device can't be transisted to the correct power state.
251 * So if the acpi_power_nocheck is set, it is unnecessary to
252 * get the power state by calling acpi_bus_get_power.
253 */
254 acpi_bus_get_power(device->handle, &device->power.state);
255 }
227 if ((state == device->power.state) && !device->flags.force_power_state) { 256 if ((state == device->power.state) && !device->flags.force_power_state) {
228 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device is already at D%d\n", 257 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device is already at D%d\n",
229 state)); 258 state));
@@ -818,7 +847,11 @@ static int __init acpi_init(void)
818 } 847 }
819 } else 848 } else
820 disable_acpi(); 849 disable_acpi();
821 850 /*
851 * If the laptop falls into the DMI check table, the power state check
852 * will be disabled in the course of device power transistion.
853 */
854 dmi_check_system(power_nocheck_dmi_table);
822 return result; 855 return result;
823} 856}
824 857
diff --git a/drivers/acpi/pci_link.c b/drivers/acpi/pci_link.c
index cf47805a7448..65bf4fa59633 100644
--- a/drivers/acpi/pci_link.c
+++ b/drivers/acpi/pci_link.c
@@ -709,7 +709,7 @@ int acpi_pci_link_free_irq(acpi_handle handle)
709 acpi_device_bid(link->device))); 709 acpi_device_bid(link->device)));
710 710
711 if (link->refcnt == 0) { 711 if (link->refcnt == 0) {
712 acpi_ut_evaluate_object(link->device->handle, "_DIS", 0, NULL); 712 acpi_evaluate_object(link->device->handle, "_DIS", NULL, NULL);
713 } 713 }
714 mutex_unlock(&acpi_link_lock); 714 mutex_unlock(&acpi_link_lock);
715 return (link->irq.active); 715 return (link->irq.active);
@@ -773,7 +773,7 @@ static int acpi_pci_link_add(struct acpi_device *device)
773 773
774 end: 774 end:
775 /* disable all links -- to be activated on use */ 775 /* disable all links -- to be activated on use */
776 acpi_ut_evaluate_object(device->handle, "_DIS", 0, NULL); 776 acpi_evaluate_object(device->handle, "_DIS", NULL, NULL);
777 mutex_unlock(&acpi_link_lock); 777 mutex_unlock(&acpi_link_lock);
778 778
779 if (result) 779 if (result)
diff --git a/drivers/acpi/power.c b/drivers/acpi/power.c
index 4ab21cb1c8c7..7ff7349c0c52 100644
--- a/drivers/acpi/power.c
+++ b/drivers/acpi/power.c
@@ -54,6 +54,14 @@ ACPI_MODULE_NAME("power");
54#define ACPI_POWER_RESOURCE_STATE_OFF 0x00 54#define ACPI_POWER_RESOURCE_STATE_OFF 0x00
55#define ACPI_POWER_RESOURCE_STATE_ON 0x01 55#define ACPI_POWER_RESOURCE_STATE_ON 0x01
56#define ACPI_POWER_RESOURCE_STATE_UNKNOWN 0xFF 56#define ACPI_POWER_RESOURCE_STATE_UNKNOWN 0xFF
57
58#ifdef MODULE_PARAM_PREFIX
59#undef MODULE_PARAM_PREFIX
60#endif
61#define MODULE_PARAM_PREFIX "acpi."
62int acpi_power_nocheck;
63module_param_named(power_nocheck, acpi_power_nocheck, bool, 000);
64
57static int acpi_power_add(struct acpi_device *device); 65static int acpi_power_add(struct acpi_device *device);
58static int acpi_power_remove(struct acpi_device *device, int type); 66static int acpi_power_remove(struct acpi_device *device, int type);
59static int acpi_power_resume(struct acpi_device *device); 67static int acpi_power_resume(struct acpi_device *device);
@@ -128,16 +136,16 @@ acpi_power_get_context(acpi_handle handle,
128 return 0; 136 return 0;
129} 137}
130 138
131static int acpi_power_get_state(struct acpi_power_resource *resource, int *state) 139static int acpi_power_get_state(acpi_handle handle, int *state)
132{ 140{
133 acpi_status status = AE_OK; 141 acpi_status status = AE_OK;
134 unsigned long sta = 0; 142 unsigned long sta = 0;
135 143
136 144
137 if (!resource || !state) 145 if (!handle || !state)
138 return -EINVAL; 146 return -EINVAL;
139 147
140 status = acpi_evaluate_integer(resource->device->handle, "_STA", NULL, &sta); 148 status = acpi_evaluate_integer(handle, "_STA", NULL, &sta);
141 if (ACPI_FAILURE(status)) 149 if (ACPI_FAILURE(status))
142 return -ENODEV; 150 return -ENODEV;
143 151
@@ -145,7 +153,7 @@ static int acpi_power_get_state(struct acpi_power_resource *resource, int *state
145 ACPI_POWER_RESOURCE_STATE_OFF; 153 ACPI_POWER_RESOURCE_STATE_OFF;
146 154
147 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Resource [%s] is %s\n", 155 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Resource [%s] is %s\n",
148 resource->name, state ? "on" : "off")); 156 acpi_ut_get_node_name(handle), state ? "on" : "off"));
149 157
150 return 0; 158 return 0;
151} 159}
@@ -153,7 +161,6 @@ static int acpi_power_get_state(struct acpi_power_resource *resource, int *state
153static int acpi_power_get_list_state(struct acpi_handle_list *list, int *state) 161static int acpi_power_get_list_state(struct acpi_handle_list *list, int *state)
154{ 162{
155 int result = 0, state1; 163 int result = 0, state1;
156 struct acpi_power_resource *resource = NULL;
157 u32 i = 0; 164 u32 i = 0;
158 165
159 166
@@ -161,12 +168,15 @@ static int acpi_power_get_list_state(struct acpi_handle_list *list, int *state)
161 return -EINVAL; 168 return -EINVAL;
162 169
163 /* The state of the list is 'on' IFF all resources are 'on'. */ 170 /* The state of the list is 'on' IFF all resources are 'on'. */
171 /* */
164 172
165 for (i = 0; i < list->count; i++) { 173 for (i = 0; i < list->count; i++) {
166 result = acpi_power_get_context(list->handles[i], &resource); 174 /*
167 if (result) 175 * The state of the power resource can be obtained by
168 return result; 176 * using the ACPI handle. In such case it is unnecessary to
169 result = acpi_power_get_state(resource, &state1); 177 * get the Power resource first and then get its state again.
178 */
179 result = acpi_power_get_state(list->handles[i], &state1);
170 if (result) 180 if (result)
171 return result; 181 return result;
172 182
@@ -226,12 +236,18 @@ static int acpi_power_on(acpi_handle handle, struct acpi_device *dev)
226 if (ACPI_FAILURE(status)) 236 if (ACPI_FAILURE(status))
227 return -ENODEV; 237 return -ENODEV;
228 238
229 result = acpi_power_get_state(resource, &state); 239 if (!acpi_power_nocheck) {
230 if (result) 240 /*
231 return result; 241 * If acpi_power_nocheck is set, it is unnecessary to check
232 if (state != ACPI_POWER_RESOURCE_STATE_ON) 242 * the power state after power transition.
233 return -ENOEXEC; 243 */
234 244 result = acpi_power_get_state(resource->device->handle,
245 &state);
246 if (result)
247 return result;
248 if (state != ACPI_POWER_RESOURCE_STATE_ON)
249 return -ENOEXEC;
250 }
235 /* Update the power resource's _device_ power state */ 251 /* Update the power resource's _device_ power state */
236 resource->device->power.state = ACPI_STATE_D0; 252 resource->device->power.state = ACPI_STATE_D0;
237 253
@@ -277,11 +293,17 @@ static int acpi_power_off_device(acpi_handle handle, struct acpi_device *dev)
277 if (ACPI_FAILURE(status)) 293 if (ACPI_FAILURE(status))
278 return -ENODEV; 294 return -ENODEV;
279 295
280 result = acpi_power_get_state(resource, &state); 296 if (!acpi_power_nocheck) {
281 if (result) 297 /*
282 return result; 298 * If acpi_power_nocheck is set, it is unnecessary to check
283 if (state != ACPI_POWER_RESOURCE_STATE_OFF) 299 * the power state after power transition.
284 return -ENOEXEC; 300 */
301 result = acpi_power_get_state(handle, &state);
302 if (result)
303 return result;
304 if (state != ACPI_POWER_RESOURCE_STATE_OFF)
305 return -ENOEXEC;
306 }
285 307
286 /* Update the power resource's _device_ power state */ 308 /* Update the power resource's _device_ power state */
287 resource->device->power.state = ACPI_STATE_D3; 309 resource->device->power.state = ACPI_STATE_D3;
@@ -555,7 +577,7 @@ static int acpi_power_seq_show(struct seq_file *seq, void *offset)
555 if (!resource) 577 if (!resource)
556 goto end; 578 goto end;
557 579
558 result = acpi_power_get_state(resource, &state); 580 result = acpi_power_get_state(resource->device->handle, &state);
559 if (result) 581 if (result)
560 goto end; 582 goto end;
561 583
@@ -668,7 +690,7 @@ static int acpi_power_add(struct acpi_device *device)
668 resource->system_level = acpi_object.power_resource.system_level; 690 resource->system_level = acpi_object.power_resource.system_level;
669 resource->order = acpi_object.power_resource.resource_order; 691 resource->order = acpi_object.power_resource.resource_order;
670 692
671 result = acpi_power_get_state(resource, &state); 693 result = acpi_power_get_state(device->handle, &state);
672 if (result) 694 if (result)
673 goto end; 695 goto end;
674 696
@@ -735,7 +757,7 @@ static int acpi_power_resume(struct acpi_device *device)
735 757
736 resource = (struct acpi_power_resource *)acpi_driver_data(device); 758 resource = (struct acpi_power_resource *)acpi_driver_data(device);
737 759
738 result = acpi_power_get_state(resource, &state); 760 result = acpi_power_get_state(device->handle, &state);
739 if (result) 761 if (result)
740 return result; 762 return result;
741 763
diff --git a/drivers/acpi/processor_perflib.c b/drivers/acpi/processor_perflib.c
index e5c457b45f2b..b0614f379470 100644
--- a/drivers/acpi/processor_perflib.c
+++ b/drivers/acpi/processor_perflib.c
@@ -38,6 +38,7 @@
38 38
39#include <asm/uaccess.h> 39#include <asm/uaccess.h>
40#endif 40#endif
41#include <asm/cpufeature.h>
41 42
42#include <acpi/acpi_bus.h> 43#include <acpi/acpi_bus.h>
43#include <acpi/processor.h> 44#include <acpi/processor.h>
@@ -334,7 +335,6 @@ static int acpi_processor_get_performance_info(struct acpi_processor *pr)
334 acpi_status status = AE_OK; 335 acpi_status status = AE_OK;
335 acpi_handle handle = NULL; 336 acpi_handle handle = NULL;
336 337
337
338 if (!pr || !pr->performance || !pr->handle) 338 if (!pr || !pr->performance || !pr->handle)
339 return -EINVAL; 339 return -EINVAL;
340 340
@@ -347,13 +347,25 @@ static int acpi_processor_get_performance_info(struct acpi_processor *pr)
347 347
348 result = acpi_processor_get_performance_control(pr); 348 result = acpi_processor_get_performance_control(pr);
349 if (result) 349 if (result)
350 return result; 350 goto update_bios;
351 351
352 result = acpi_processor_get_performance_states(pr); 352 result = acpi_processor_get_performance_states(pr);
353 if (result) 353 if (result)
354 return result; 354 goto update_bios;
355 355
356 return 0; 356 return 0;
357
358 /*
359 * Having _PPC but missing frequencies (_PSS, _PCT) is a very good hint that
360 * the BIOS is older than the CPU and does not know its frequencies
361 */
362 update_bios:
363 if (ACPI_SUCCESS(acpi_get_handle(pr->handle, "_PPC", &handle))){
364 if(boot_cpu_has(X86_FEATURE_EST))
365 printk(KERN_WARNING FW_BUG "BIOS needs update for CPU "
366 "frequency support\n");
367 }
368 return result;
357} 369}
358 370
359int acpi_processor_notify_smm(struct module *calling_module) 371int acpi_processor_notify_smm(struct module *calling_module)
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
index 81d6095468f9..1f98103b53c3 100644
--- a/drivers/acpi/scan.c
+++ b/drivers/acpi/scan.c
@@ -276,6 +276,13 @@ int acpi_match_device_ids(struct acpi_device *device,
276{ 276{
277 const struct acpi_device_id *id; 277 const struct acpi_device_id *id;
278 278
279 /*
280 * If the device is not present, it is unnecessary to load device
281 * driver for it.
282 */
283 if (!device->status.present)
284 return -ENODEV;
285
279 if (device->flags.hardware_id) { 286 if (device->flags.hardware_id) {
280 for (id = ids; id->id[0]; id++) { 287 for (id = ids; id->id[0]; id++) {
281 if (!strcmp((char*)id->id, device->pnp.hardware_id)) 288 if (!strcmp((char*)id->id, device->pnp.hardware_id))
@@ -807,6 +814,7 @@ static int acpi_bus_get_power_flags(struct acpi_device *device)
807 /* TBD: System wake support and resource requirements. */ 814 /* TBD: System wake support and resource requirements. */
808 815
809 device->power.state = ACPI_STATE_UNKNOWN; 816 device->power.state = ACPI_STATE_UNKNOWN;
817 acpi_bus_get_power(device->handle, &(device->power.state));
810 818
811 return 0; 819 return 0;
812} 820}
@@ -1153,20 +1161,6 @@ static int acpi_bus_remove(struct acpi_device *dev, int rmdevice)
1153} 1161}
1154 1162
1155static int 1163static int
1156acpi_is_child_device(struct acpi_device *device,
1157 int (*matcher)(struct acpi_device *))
1158{
1159 int result = -ENODEV;
1160
1161 do {
1162 if (ACPI_SUCCESS(matcher(device)))
1163 return AE_OK;
1164 } while ((device = device->parent));
1165
1166 return result;
1167}
1168
1169static int
1170acpi_add_single_object(struct acpi_device **child, 1164acpi_add_single_object(struct acpi_device **child,
1171 struct acpi_device *parent, acpi_handle handle, int type, 1165 struct acpi_device *parent, acpi_handle handle, int type,
1172 struct acpi_bus_ops *ops) 1166 struct acpi_bus_ops *ops)
@@ -1221,15 +1215,18 @@ acpi_add_single_object(struct acpi_device **child,
1221 result = -ENODEV; 1215 result = -ENODEV;
1222 goto end; 1216 goto end;
1223 } 1217 }
1224 if (!device->status.present) { 1218 /*
1225 /* Bay and dock should be handled even if absent */ 1219 * When the device is neither present nor functional, the
1226 if (!ACPI_SUCCESS( 1220 * device should not be added to Linux ACPI device tree.
1227 acpi_is_child_device(device, acpi_bay_match)) && 1221 * When the status of the device is not present but functinal,
1228 !ACPI_SUCCESS( 1222 * it should be added to Linux ACPI tree. For example : bay
1229 acpi_is_child_device(device, acpi_dock_match))) { 1223 * device , dock device.
1230 result = -ENODEV; 1224 * In such conditions it is unncessary to check whether it is
1231 goto end; 1225 * bay device or dock device.
1232 } 1226 */
1227 if (!device->status.present && !device->status.functional) {
1228 result = -ENODEV;
1229 goto end;
1233 } 1230 }
1234 break; 1231 break;
1235 default: 1232 default:
@@ -1252,6 +1249,16 @@ acpi_add_single_object(struct acpi_device **child,
1252 acpi_device_set_id(device, parent, handle, type); 1249 acpi_device_set_id(device, parent, handle, type);
1253 1250
1254 /* 1251 /*
1252 * The ACPI device is attached to acpi handle before getting
1253 * the power/wakeup/peformance flags. Otherwise OS can't get
1254 * the corresponding ACPI device by the acpi handle in the course
1255 * of getting the power/wakeup/performance flags.
1256 */
1257 result = acpi_device_set_context(device, type);
1258 if (result)
1259 goto end;
1260
1261 /*
1255 * Power Management 1262 * Power Management
1256 * ---------------- 1263 * ----------------
1257 */ 1264 */
@@ -1281,8 +1288,6 @@ acpi_add_single_object(struct acpi_device **child,
1281 goto end; 1288 goto end;
1282 } 1289 }
1283 1290
1284 if ((result = acpi_device_set_context(device, type)))
1285 goto end;
1286 1291
1287 result = acpi_device_register(device, parent); 1292 result = acpi_device_register(device, parent);
1288 1293
@@ -1402,7 +1407,12 @@ static int acpi_bus_scan(struct acpi_device *start, struct acpi_bus_ops *ops)
1402 * TBD: Need notifications and other detection mechanisms 1407 * TBD: Need notifications and other detection mechanisms
1403 * in place before we can fully implement this. 1408 * in place before we can fully implement this.
1404 */ 1409 */
1405 if (child->status.present) { 1410 /*
1411 * When the device is not present but functional, it is also
1412 * necessary to scan the children of this device.
1413 */
1414 if (child->status.present || (!child->status.present &&
1415 child->status.functional)) {
1406 status = acpi_get_next_object(ACPI_TYPE_ANY, chandle, 1416 status = acpi_get_next_object(ACPI_TYPE_ANY, chandle,
1407 NULL, NULL); 1417 NULL, NULL);
1408 if (ACPI_SUCCESS(status)) { 1418 if (ACPI_SUCCESS(status)) {
diff --git a/drivers/acpi/wmi.c b/drivers/acpi/wmi.c
index cfe2c833474d..47cd7baf9b1b 100644
--- a/drivers/acpi/wmi.c
+++ b/drivers/acpi/wmi.c
@@ -217,6 +217,35 @@ static bool find_guid(const char *guid_string, struct wmi_block **out)
217 return 0; 217 return 0;
218} 218}
219 219
220static acpi_status wmi_method_enable(struct wmi_block *wblock, int enable)
221{
222 struct guid_block *block = NULL;
223 char method[5];
224 struct acpi_object_list input;
225 union acpi_object params[1];
226 acpi_status status;
227 acpi_handle handle;
228
229 block = &wblock->gblock;
230 handle = wblock->handle;
231
232 if (!block)
233 return AE_NOT_EXIST;
234
235 input.count = 1;
236 input.pointer = params;
237 params[0].type = ACPI_TYPE_INTEGER;
238 params[0].integer.value = enable;
239
240 snprintf(method, 5, "WE%02X", block->notify_id);
241 status = acpi_evaluate_object(handle, method, &input, NULL);
242
243 if (status != AE_OK && status != AE_NOT_FOUND)
244 return status;
245 else
246 return AE_OK;
247}
248
220/* 249/*
221 * Exported WMI functions 250 * Exported WMI functions
222 */ 251 */
@@ -242,7 +271,7 @@ u32 method_id, const struct acpi_buffer *in, struct acpi_buffer *out)
242 char method[4] = "WM"; 271 char method[4] = "WM";
243 272
244 if (!find_guid(guid_string, &wblock)) 273 if (!find_guid(guid_string, &wblock))
245 return AE_BAD_ADDRESS; 274 return AE_ERROR;
246 275
247 block = &wblock->gblock; 276 block = &wblock->gblock;
248 handle = wblock->handle; 277 handle = wblock->handle;
@@ -304,7 +333,7 @@ struct acpi_buffer *out)
304 return AE_BAD_PARAMETER; 333 return AE_BAD_PARAMETER;
305 334
306 if (!find_guid(guid_string, &wblock)) 335 if (!find_guid(guid_string, &wblock))
307 return AE_BAD_ADDRESS; 336 return AE_ERROR;
308 337
309 block = &wblock->gblock; 338 block = &wblock->gblock;
310 handle = wblock->handle; 339 handle = wblock->handle;
@@ -314,7 +343,7 @@ struct acpi_buffer *out)
314 343
315 /* Check GUID is a data block */ 344 /* Check GUID is a data block */
316 if (block->flags & (ACPI_WMI_EVENT | ACPI_WMI_METHOD)) 345 if (block->flags & (ACPI_WMI_EVENT | ACPI_WMI_METHOD))
317 return AE_BAD_ADDRESS; 346 return AE_ERROR;
318 347
319 input.count = 1; 348 input.count = 1;
320 input.pointer = wq_params; 349 input.pointer = wq_params;
@@ -385,7 +414,7 @@ const struct acpi_buffer *in)
385 return AE_BAD_DATA; 414 return AE_BAD_DATA;
386 415
387 if (!find_guid(guid_string, &wblock)) 416 if (!find_guid(guid_string, &wblock))
388 return AE_BAD_ADDRESS; 417 return AE_ERROR;
389 418
390 block = &wblock->gblock; 419 block = &wblock->gblock;
391 handle = wblock->handle; 420 handle = wblock->handle;
@@ -395,7 +424,7 @@ const struct acpi_buffer *in)
395 424
396 /* Check GUID is a data block */ 425 /* Check GUID is a data block */
397 if (block->flags & (ACPI_WMI_EVENT | ACPI_WMI_METHOD)) 426 if (block->flags & (ACPI_WMI_EVENT | ACPI_WMI_METHOD))
398 return AE_BAD_ADDRESS; 427 return AE_ERROR;
399 428
400 input.count = 2; 429 input.count = 2;
401 input.pointer = params; 430 input.pointer = params;
@@ -427,6 +456,7 @@ acpi_status wmi_install_notify_handler(const char *guid,
427wmi_notify_handler handler, void *data) 456wmi_notify_handler handler, void *data)
428{ 457{
429 struct wmi_block *block; 458 struct wmi_block *block;
459 acpi_status status;
430 460
431 if (!guid || !handler) 461 if (!guid || !handler)
432 return AE_BAD_PARAMETER; 462 return AE_BAD_PARAMETER;
@@ -441,7 +471,9 @@ wmi_notify_handler handler, void *data)
441 block->handler = handler; 471 block->handler = handler;
442 block->handler_data = data; 472 block->handler_data = data;
443 473
444 return AE_OK; 474 status = wmi_method_enable(block, 1);
475
476 return status;
445} 477}
446EXPORT_SYMBOL_GPL(wmi_install_notify_handler); 478EXPORT_SYMBOL_GPL(wmi_install_notify_handler);
447 479
@@ -453,6 +485,7 @@ EXPORT_SYMBOL_GPL(wmi_install_notify_handler);
453acpi_status wmi_remove_notify_handler(const char *guid) 485acpi_status wmi_remove_notify_handler(const char *guid)
454{ 486{
455 struct wmi_block *block; 487 struct wmi_block *block;
488 acpi_status status;
456 489
457 if (!guid) 490 if (!guid)
458 return AE_BAD_PARAMETER; 491 return AE_BAD_PARAMETER;
@@ -464,10 +497,12 @@ acpi_status wmi_remove_notify_handler(const char *guid)
464 if (!block->handler) 497 if (!block->handler)
465 return AE_NULL_ENTRY; 498 return AE_NULL_ENTRY;
466 499
500 status = wmi_method_enable(block, 0);
501
467 block->handler = NULL; 502 block->handler = NULL;
468 block->handler_data = NULL; 503 block->handler_data = NULL;
469 504
470 return AE_OK; 505 return status;
471} 506}
472EXPORT_SYMBOL_GPL(wmi_remove_notify_handler); 507EXPORT_SYMBOL_GPL(wmi_remove_notify_handler);
473 508
diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig
index a726f3b01a6b..6abb95919c38 100644
--- a/drivers/misc/Kconfig
+++ b/drivers/misc/Kconfig
@@ -145,6 +145,7 @@ config ACER_WMI
145 depends on NEW_LEDS 145 depends on NEW_LEDS
146 depends on BACKLIGHT_CLASS_DEVICE 146 depends on BACKLIGHT_CLASS_DEVICE
147 depends on SERIO_I8042 147 depends on SERIO_I8042
148 depends on RFKILL
148 select ACPI_WMI 149 select ACPI_WMI
149 ---help--- 150 ---help---
150 This is a driver for newer Acer (and Wistron) laptops. It adds 151 This is a driver for newer Acer (and Wistron) laptops. It adds
diff --git a/drivers/misc/acer-wmi.c b/drivers/misc/acer-wmi.c
index d8b0d326e452..0532a2de2ce4 100644
--- a/drivers/misc/acer-wmi.c
+++ b/drivers/misc/acer-wmi.c
@@ -33,6 +33,8 @@
33#include <linux/platform_device.h> 33#include <linux/platform_device.h>
34#include <linux/acpi.h> 34#include <linux/acpi.h>
35#include <linux/i8042.h> 35#include <linux/i8042.h>
36#include <linux/rfkill.h>
37#include <linux/workqueue.h>
36#include <linux/debugfs.h> 38#include <linux/debugfs.h>
37 39
38#include <acpi/acpi_drivers.h> 40#include <acpi/acpi_drivers.h>
@@ -123,21 +125,15 @@ enum interface_flags {
123 125
124static int max_brightness = 0xF; 126static int max_brightness = 0xF;
125 127
126static int wireless = -1;
127static int bluetooth = -1;
128static int mailled = -1; 128static int mailled = -1;
129static int brightness = -1; 129static int brightness = -1;
130static int threeg = -1; 130static int threeg = -1;
131static int force_series; 131static int force_series;
132 132
133module_param(mailled, int, 0444); 133module_param(mailled, int, 0444);
134module_param(wireless, int, 0444);
135module_param(bluetooth, int, 0444);
136module_param(brightness, int, 0444); 134module_param(brightness, int, 0444);
137module_param(threeg, int, 0444); 135module_param(threeg, int, 0444);
138module_param(force_series, int, 0444); 136module_param(force_series, int, 0444);
139MODULE_PARM_DESC(wireless, "Set initial state of Wireless hardware");
140MODULE_PARM_DESC(bluetooth, "Set initial state of Bluetooth hardware");
141MODULE_PARM_DESC(mailled, "Set initial state of Mail LED"); 137MODULE_PARM_DESC(mailled, "Set initial state of Mail LED");
142MODULE_PARM_DESC(brightness, "Set initial LCD backlight brightness"); 138MODULE_PARM_DESC(brightness, "Set initial LCD backlight brightness");
143MODULE_PARM_DESC(threeg, "Set initial state of 3G hardware"); 139MODULE_PARM_DESC(threeg, "Set initial state of 3G hardware");
@@ -145,8 +141,6 @@ MODULE_PARM_DESC(force_series, "Force a different laptop series");
145 141
146struct acer_data { 142struct acer_data {
147 int mailled; 143 int mailled;
148 int wireless;
149 int bluetooth;
150 int threeg; 144 int threeg;
151 int brightness; 145 int brightness;
152}; 146};
@@ -157,6 +151,9 @@ struct acer_debug {
157 u32 wmid_devices; 151 u32 wmid_devices;
158}; 152};
159 153
154static struct rfkill *wireless_rfkill;
155static struct rfkill *bluetooth_rfkill;
156
160/* Each low-level interface must define at least some of the following */ 157/* Each low-level interface must define at least some of the following */
161struct wmi_interface { 158struct wmi_interface {
162 /* The WMI device type */ 159 /* The WMI device type */
@@ -476,7 +473,7 @@ struct wmi_interface *iface)
476 } 473 }
477 break; 474 break;
478 default: 475 default:
479 return AE_BAD_ADDRESS; 476 return AE_ERROR;
480 } 477 }
481 return AE_OK; 478 return AE_OK;
482} 479}
@@ -514,7 +511,7 @@ static acpi_status AMW0_set_u32(u32 value, u32 cap, struct wmi_interface *iface)
514 break; 511 break;
515 } 512 }
516 default: 513 default:
517 return AE_BAD_ADDRESS; 514 return AE_ERROR;
518 } 515 }
519 516
520 /* Actually do the set */ 517 /* Actually do the set */
@@ -689,7 +686,7 @@ struct wmi_interface *iface)
689 return 0; 686 return 0;
690 } 687 }
691 default: 688 default:
692 return AE_BAD_ADDRESS; 689 return AE_ERROR;
693 } 690 }
694 status = WMI_execute_u32(method_id, 0, &result); 691 status = WMI_execute_u32(method_id, 0, &result);
695 692
@@ -735,7 +732,7 @@ static acpi_status WMID_set_u32(u32 value, u32 cap, struct wmi_interface *iface)
735 } 732 }
736 break; 733 break;
737 default: 734 default:
738 return AE_BAD_ADDRESS; 735 return AE_ERROR;
739 } 736 }
740 return WMI_execute_u32(method_id, (u32)value, NULL); 737 return WMI_execute_u32(method_id, (u32)value, NULL);
741} 738}
@@ -785,7 +782,7 @@ static struct wmi_interface wmid_interface = {
785 782
786static acpi_status get_u32(u32 *value, u32 cap) 783static acpi_status get_u32(u32 *value, u32 cap)
787{ 784{
788 acpi_status status = AE_BAD_ADDRESS; 785 acpi_status status = AE_ERROR;
789 786
790 switch (interface->type) { 787 switch (interface->type) {
791 case ACER_AMW0: 788 case ACER_AMW0:
@@ -846,8 +843,6 @@ static void __init acer_commandline_init(void)
846 * capability isn't available on the given interface 843 * capability isn't available on the given interface
847 */ 844 */
848 set_u32(mailled, ACER_CAP_MAILLED); 845 set_u32(mailled, ACER_CAP_MAILLED);
849 set_u32(wireless, ACER_CAP_WIRELESS);
850 set_u32(bluetooth, ACER_CAP_BLUETOOTH);
851 set_u32(threeg, ACER_CAP_THREEG); 846 set_u32(threeg, ACER_CAP_THREEG);
852 set_u32(brightness, ACER_CAP_BRIGHTNESS); 847 set_u32(brightness, ACER_CAP_BRIGHTNESS);
853} 848}
@@ -933,40 +928,135 @@ static void acer_backlight_exit(void)
933} 928}
934 929
935/* 930/*
936 * Read/ write bool sysfs macro 931 * Rfkill devices
937 */ 932 */
938#define show_set_bool(value, cap) \ 933static void acer_rfkill_update(struct work_struct *ignored);
939static ssize_t \ 934static DECLARE_DELAYED_WORK(acer_rfkill_work, acer_rfkill_update);
940show_bool_##value(struct device *dev, struct device_attribute *attr, \ 935static void acer_rfkill_update(struct work_struct *ignored)
941 char *buf) \ 936{
942{ \ 937 u32 state;
943 u32 result; \ 938 acpi_status status;
944 acpi_status status = get_u32(&result, cap); \ 939
945 if (ACPI_SUCCESS(status)) \ 940 status = get_u32(&state, ACER_CAP_WIRELESS);
946 return sprintf(buf, "%u\n", result); \ 941 if (ACPI_SUCCESS(status))
947 return sprintf(buf, "Read error\n"); \ 942 rfkill_force_state(wireless_rfkill, state ?
948} \ 943 RFKILL_STATE_UNBLOCKED : RFKILL_STATE_SOFT_BLOCKED);
949\ 944
950static ssize_t \ 945 if (has_cap(ACER_CAP_BLUETOOTH)) {
951set_bool_##value(struct device *dev, struct device_attribute *attr, \ 946 status = get_u32(&state, ACER_CAP_BLUETOOTH);
952 const char *buf, size_t count) \ 947 if (ACPI_SUCCESS(status))
953{ \ 948 rfkill_force_state(bluetooth_rfkill, state ?
954 u32 tmp = simple_strtoul(buf, NULL, 10); \ 949 RFKILL_STATE_UNBLOCKED :
955 acpi_status status = set_u32(tmp, cap); \ 950 RFKILL_STATE_SOFT_BLOCKED);
956 if (ACPI_FAILURE(status)) \ 951 }
957 return -EINVAL; \ 952
958 return count; \ 953 schedule_delayed_work(&acer_rfkill_work, round_jiffies_relative(HZ));
959} \ 954}
960static DEVICE_ATTR(value, S_IWUGO | S_IRUGO | S_IWUSR, \ 955
961 show_bool_##value, set_bool_##value); 956static int acer_rfkill_set(void *data, enum rfkill_state state)
962 957{
963show_set_bool(wireless, ACER_CAP_WIRELESS); 958 acpi_status status;
964show_set_bool(bluetooth, ACER_CAP_BLUETOOTH); 959 u32 *cap = data;
965show_set_bool(threeg, ACER_CAP_THREEG); 960 status = set_u32((u32) (state == RFKILL_STATE_UNBLOCKED), *cap);
961 if (ACPI_FAILURE(status))
962 return -ENODEV;
963 return 0;
964}
965
966static struct rfkill * acer_rfkill_register(struct device *dev,
967enum rfkill_type type, char *name, u32 cap)
968{
969 int err;
970 u32 state;
971 u32 *data;
972 struct rfkill *rfkill_dev;
973
974 rfkill_dev = rfkill_allocate(dev, type);
975 if (!rfkill_dev)
976 return ERR_PTR(-ENOMEM);
977 rfkill_dev->name = name;
978 get_u32(&state, cap);
979 rfkill_dev->state = state ? RFKILL_STATE_UNBLOCKED :
980 RFKILL_STATE_SOFT_BLOCKED;
981 data = kzalloc(sizeof(u32), GFP_KERNEL);
982 if (!data) {
983 rfkill_free(rfkill_dev);
984 return ERR_PTR(-ENOMEM);
985 }
986 *data = cap;
987 rfkill_dev->data = data;
988 rfkill_dev->toggle_radio = acer_rfkill_set;
989 rfkill_dev->user_claim_unsupported = 1;
990
991 err = rfkill_register(rfkill_dev);
992 if (err) {
993 kfree(rfkill_dev->data);
994 rfkill_free(rfkill_dev);
995 return ERR_PTR(err);
996 }
997 return rfkill_dev;
998}
999
1000static int acer_rfkill_init(struct device *dev)
1001{
1002 wireless_rfkill = acer_rfkill_register(dev, RFKILL_TYPE_WLAN,
1003 "acer-wireless", ACER_CAP_WIRELESS);
1004 if (IS_ERR(wireless_rfkill))
1005 return PTR_ERR(wireless_rfkill);
1006
1007 if (has_cap(ACER_CAP_BLUETOOTH)) {
1008 bluetooth_rfkill = acer_rfkill_register(dev,
1009 RFKILL_TYPE_BLUETOOTH, "acer-bluetooth",
1010 ACER_CAP_BLUETOOTH);
1011 if (IS_ERR(bluetooth_rfkill)) {
1012 kfree(wireless_rfkill->data);
1013 rfkill_unregister(wireless_rfkill);
1014 return PTR_ERR(bluetooth_rfkill);
1015 }
1016 }
1017
1018 schedule_delayed_work(&acer_rfkill_work, round_jiffies_relative(HZ));
1019
1020 return 0;
1021}
1022
1023static void acer_rfkill_exit(void)
1024{
1025 cancel_delayed_work_sync(&acer_rfkill_work);
1026 kfree(wireless_rfkill->data);
1027 rfkill_unregister(wireless_rfkill);
1028 if (has_cap(ACER_CAP_BLUETOOTH)) {
1029 kfree(wireless_rfkill->data);
1030 rfkill_unregister(bluetooth_rfkill);
1031 }
1032 return;
1033}
966 1034
967/* 1035/*
968 * Read interface sysfs macro 1036 * sysfs interface
969 */ 1037 */
1038static ssize_t show_bool_threeg(struct device *dev,
1039 struct device_attribute *attr, char *buf)
1040{
1041 u32 result; \
1042 acpi_status status = get_u32(&result, ACER_CAP_THREEG);
1043 if (ACPI_SUCCESS(status))
1044 return sprintf(buf, "%u\n", result);
1045 return sprintf(buf, "Read error\n");
1046}
1047
1048static ssize_t set_bool_threeg(struct device *dev,
1049 struct device_attribute *attr, const char *buf, size_t count)
1050{
1051 u32 tmp = simple_strtoul(buf, NULL, 10);
1052 acpi_status status = set_u32(tmp, ACER_CAP_THREEG);
1053 if (ACPI_FAILURE(status))
1054 return -EINVAL;
1055 return count;
1056}
1057static DEVICE_ATTR(threeg, S_IWUGO | S_IRUGO | S_IWUSR, show_bool_threeg,
1058 set_bool_threeg);
1059
970static ssize_t show_interface(struct device *dev, struct device_attribute *attr, 1060static ssize_t show_interface(struct device *dev, struct device_attribute *attr,
971 char *buf) 1061 char *buf)
972{ 1062{
@@ -1026,7 +1116,9 @@ static int __devinit acer_platform_probe(struct platform_device *device)
1026 goto error_brightness; 1116 goto error_brightness;
1027 } 1117 }
1028 1118
1029 return 0; 1119 err = acer_rfkill_init(&device->dev);
1120
1121 return err;
1030 1122
1031error_brightness: 1123error_brightness:
1032 acer_led_exit(); 1124 acer_led_exit();
@@ -1040,6 +1132,8 @@ static int acer_platform_remove(struct platform_device *device)
1040 acer_led_exit(); 1132 acer_led_exit();
1041 if (has_cap(ACER_CAP_BRIGHTNESS)) 1133 if (has_cap(ACER_CAP_BRIGHTNESS))
1042 acer_backlight_exit(); 1134 acer_backlight_exit();
1135
1136 acer_rfkill_exit();
1043 return 0; 1137 return 0;
1044} 1138}
1045 1139
@@ -1052,16 +1146,6 @@ pm_message_t state)
1052 if (!data) 1146 if (!data)
1053 return -ENOMEM; 1147 return -ENOMEM;
1054 1148
1055 if (has_cap(ACER_CAP_WIRELESS)) {
1056 get_u32(&value, ACER_CAP_WIRELESS);
1057 data->wireless = value;
1058 }
1059
1060 if (has_cap(ACER_CAP_BLUETOOTH)) {
1061 get_u32(&value, ACER_CAP_BLUETOOTH);
1062 data->bluetooth = value;
1063 }
1064
1065 if (has_cap(ACER_CAP_MAILLED)) { 1149 if (has_cap(ACER_CAP_MAILLED)) {
1066 get_u32(&value, ACER_CAP_MAILLED); 1150 get_u32(&value, ACER_CAP_MAILLED);
1067 data->mailled = value; 1151 data->mailled = value;
@@ -1082,15 +1166,6 @@ static int acer_platform_resume(struct platform_device *device)
1082 if (!data) 1166 if (!data)
1083 return -ENOMEM; 1167 return -ENOMEM;
1084 1168
1085 if (has_cap(ACER_CAP_WIRELESS))
1086 set_u32(data->wireless, ACER_CAP_WIRELESS);
1087
1088 if (has_cap(ACER_CAP_BLUETOOTH))
1089 set_u32(data->bluetooth, ACER_CAP_BLUETOOTH);
1090
1091 if (has_cap(ACER_CAP_THREEG))
1092 set_u32(data->threeg, ACER_CAP_THREEG);
1093
1094 if (has_cap(ACER_CAP_MAILLED)) 1169 if (has_cap(ACER_CAP_MAILLED))
1095 set_u32(data->mailled, ACER_CAP_MAILLED); 1170 set_u32(data->mailled, ACER_CAP_MAILLED);
1096 1171
@@ -1115,12 +1190,6 @@ static struct platform_device *acer_platform_device;
1115 1190
1116static int remove_sysfs(struct platform_device *device) 1191static int remove_sysfs(struct platform_device *device)
1117{ 1192{
1118 if (has_cap(ACER_CAP_WIRELESS))
1119 device_remove_file(&device->dev, &dev_attr_wireless);
1120
1121 if (has_cap(ACER_CAP_BLUETOOTH))
1122 device_remove_file(&device->dev, &dev_attr_bluetooth);
1123
1124 if (has_cap(ACER_CAP_THREEG)) 1193 if (has_cap(ACER_CAP_THREEG))
1125 device_remove_file(&device->dev, &dev_attr_threeg); 1194 device_remove_file(&device->dev, &dev_attr_threeg);
1126 1195
@@ -1133,20 +1202,6 @@ static int create_sysfs(void)
1133{ 1202{
1134 int retval = -ENOMEM; 1203 int retval = -ENOMEM;
1135 1204
1136 if (has_cap(ACER_CAP_WIRELESS)) {
1137 retval = device_create_file(&acer_platform_device->dev,
1138 &dev_attr_wireless);
1139 if (retval)
1140 goto error_sysfs;
1141 }
1142
1143 if (has_cap(ACER_CAP_BLUETOOTH)) {
1144 retval = device_create_file(&acer_platform_device->dev,
1145 &dev_attr_bluetooth);
1146 if (retval)
1147 goto error_sysfs;
1148 }
1149
1150 if (has_cap(ACER_CAP_THREEG)) { 1205 if (has_cap(ACER_CAP_THREEG)) {
1151 retval = device_create_file(&acer_platform_device->dev, 1206 retval = device_create_file(&acer_platform_device->dev,
1152 &dev_attr_threeg); 1207 &dev_attr_threeg);
diff --git a/drivers/pnp/pnpacpi/core.c b/drivers/pnp/pnpacpi/core.c
index c1b9ea34977b..98b9df7776e9 100644
--- a/drivers/pnp/pnpacpi/core.c
+++ b/drivers/pnp/pnpacpi/core.c
@@ -148,9 +148,13 @@ static int __init pnpacpi_add_device(struct acpi_device *device)
148 acpi_status status; 148 acpi_status status;
149 struct pnp_dev *dev; 149 struct pnp_dev *dev;
150 150
151 /*
152 * If a PnPacpi device is not present , the device
153 * driver should not be loaded.
154 */
151 status = acpi_get_handle(device->handle, "_CRS", &temp); 155 status = acpi_get_handle(device->handle, "_CRS", &temp);
152 if (ACPI_FAILURE(status) || !ispnpidacpi(acpi_device_hid(device)) || 156 if (ACPI_FAILURE(status) || !ispnpidacpi(acpi_device_hid(device)) ||
153 is_exclusive_device(device)) 157 is_exclusive_device(device) || (!device->status.present))
154 return 0; 158 return 0;
155 159
156 dev = pnp_alloc_dev(&pnpacpi_protocol, num, acpi_device_hid(device)); 160 dev = pnp_alloc_dev(&pnpacpi_protocol, num, acpi_device_hid(device));
diff --git a/include/acpi/acpi_drivers.h b/include/acpi/acpi_drivers.h
index e5f38e5ce86f..efbaa271ee11 100644
--- a/include/acpi/acpi_drivers.h
+++ b/include/acpi/acpi_drivers.h
@@ -93,6 +93,7 @@ int acpi_enable_wakeup_device_power(struct acpi_device *dev, int sleep_state);
93int acpi_disable_wakeup_device_power(struct acpi_device *dev); 93int acpi_disable_wakeup_device_power(struct acpi_device *dev);
94int acpi_power_get_inferred_state(struct acpi_device *device); 94int acpi_power_get_inferred_state(struct acpi_device *device);
95int acpi_power_transition(struct acpi_device *device, int state); 95int acpi_power_transition(struct acpi_device *device, int state);
96extern int acpi_power_nocheck;
96#endif 97#endif
97 98
98/* -------------------------------------------------------------------------- 99/* --------------------------------------------------------------------------
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 2651f805ba6d..0b19848e380e 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -190,6 +190,30 @@ extern int kernel_text_address(unsigned long addr);
190struct pid; 190struct pid;
191extern struct pid *session_of_pgrp(struct pid *pgrp); 191extern struct pid *session_of_pgrp(struct pid *pgrp);
192 192
193/*
194 * FW_BUG
195 * Add this to a message where you are sure the firmware is buggy or behaves
196 * really stupid or out of spec. Be aware that the responsible BIOS developer
197 * should be able to fix this issue or at least get a concrete idea of the
198 * problem by reading your message without the need of looking at the kernel
199 * code.
200 *
201 * Use it for definite and high priority BIOS bugs.
202 *
203 * FW_WARN
204 * Use it for not that clear (e.g. could the kernel messed up things already?)
205 * and medium priority BIOS bugs.
206 *
207 * FW_INFO
208 * Use this one if you want to tell the user or vendor about something
209 * suspicious, but generally harmless related to the firmware.
210 *
211 * Use it for information or very low priority BIOS bugs.
212 */
213#define FW_BUG "[Firmware Bug]: "
214#define FW_WARN "[Firmware Warn]: "
215#define FW_INFO "[Firmware Info]: "
216
193#ifdef CONFIG_PRINTK 217#ifdef CONFIG_PRINTK
194asmlinkage int vprintk(const char *fmt, va_list args) 218asmlinkage int vprintk(const char *fmt, va_list args)
195 __attribute__ ((format (printf, 1, 0))); 219 __attribute__ ((format (printf, 1, 0)));