Merge branch 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6

* 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6: (30 commits)
ACPI: Kconfig text - Fix the ACPI_CONTAINER module name according to the real module name.
eeepc-laptop: fix oops when changing backlight brightness during eeepc-laptop init
ACPICA: Fix table entry truncation calculation
ACPI: Enable bit 11 in _PDC to advertise hw coord
ACPI: struct device - replace bus_id with dev_name(), dev_set_name()
ACPI: add missing KERN_* constants to printks
ACPI: dock: Don't eval _STA on every show_docked sysfs read
ACPI: disable ACPI cleanly when bad RSDP found
ACPI: delete CPU_IDLE=n code
ACPI: cpufreq: Remove deprecated /proc/acpi/processor/../performance proc entries
ACPI: make some IO ports off-limits to AML
ACPICA: add debug dump of BIOS _OSI strings
ACPI: proc_dir_entry 'video/VGA' already registered
ACPI: Skip the first two elements in the _BCL package
ACPI: remove BM_RLD access from idle entry path
ACPI: remove locking from PM1x_STS register reads
eeepc-laptop: use netlink interface
eeepc-laptop: Implement rfkill hotplugging in eeepc-laptop
eeepc-laptop: Check return values from rfkill_register
eeepc-laptop: Add support for extended hotkeys
...

+480 -900
-16
Documentation/cpu-freq/user-guide.txt
··· 195 you can change the speed of the CPU, 196 but only within the limits of 197 scaling_min_freq and scaling_max_freq. 198 - 199 - 200 - 3.2 Deprecated Interfaces 201 - ------------------------- 202 - 203 - Depending on your kernel configuration, you might find the following 204 - cpufreq-related files: 205 - /proc/cpufreq 206 - /proc/sys/cpu/*/speed 207 - /proc/sys/cpu/*/speed-min 208 - /proc/sys/cpu/*/speed-max 209 - 210 - These are files for deprecated interfaces to cpufreq, which offer far 211 - less functionality. Because of this, these interfaces aren't described 212 - here. 213 -
··· 195 you can change the speed of the CPU, 196 but only within the limits of 197 scaling_min_freq and scaling_max_freq.
+2 -2
arch/x86/kernel/acpi/sleep.c
··· 156 #ifdef CONFIG_HIBERNATION 157 if (strncmp(str, "s4_nohwsig", 10) == 0) 158 acpi_no_s4_hw_signature(); 159 #endif 160 if (strncmp(str, "old_ordering", 12) == 0) 161 acpi_old_suspend_ordering(); 162 - if (strncmp(str, "s4_nonvs", 8) == 0) 163 - acpi_s4_no_nvs(); 164 str = strchr(str, ','); 165 if (str != NULL) 166 str += strspn(str, ", \t");
··· 156 #ifdef CONFIG_HIBERNATION 157 if (strncmp(str, "s4_nohwsig", 10) == 0) 158 acpi_no_s4_hw_signature(); 159 + if (strncmp(str, "s4_nonvs", 8) == 0) 160 + acpi_s4_no_nvs(); 161 #endif 162 if (strncmp(str, "old_ordering", 12) == 0) 163 acpi_old_suspend_ordering(); 164 str = strchr(str, ','); 165 if (str != NULL) 166 str += strspn(str, ", \t");
-11
arch/x86/kernel/cpu/cpufreq/Kconfig
··· 245 246 comment "shared options" 247 248 - config X86_ACPI_CPUFREQ_PROC_INTF 249 - bool "/proc/acpi/processor/../performance interface (deprecated)" 250 - depends on PROC_FS 251 - depends on X86_ACPI_CPUFREQ || X86_POWERNOW_K7_ACPI || X86_POWERNOW_K8_ACPI 252 - help 253 - This enables the deprecated /proc/acpi/processor/../performance 254 - interface. While it is helpful for debugging, the generic, 255 - cross-architecture cpufreq interfaces should be used. 256 - 257 - If in doubt, say N. 258 - 259 config X86_SPEEDSTEP_LIB 260 tristate 261 default (X86_SPEEDSTEP_ICH || X86_SPEEDSTEP_SMI || X86_P4_CLOCKMOD)
··· 245 246 comment "shared options" 247 248 config X86_SPEEDSTEP_LIB 249 tristate 250 default (X86_SPEEDSTEP_ICH || X86_SPEEDSTEP_SMI || X86_P4_CLOCKMOD)
+2 -1
drivers/acpi/Kconfig
··· 9 depends on PCI 10 depends on PM 11 select PNP 12 default y 13 ---help--- 14 Advanced Configuration and Power Interface (ACPI) support for ··· 288 support physical cpu/memory hot-plug. 289 290 If one selects "m", this driver can be loaded with 291 - "modprobe acpi_container". 292 293 config ACPI_HOTPLUG_MEMORY 294 tristate "Memory Hotplug"
··· 9 depends on PCI 10 depends on PM 11 select PNP 12 + select CPU_IDLE 13 default y 14 ---help--- 15 Advanced Configuration and Power Interface (ACPI) support for ··· 287 support physical cpu/memory hot-plug. 288 289 If one selects "m", this driver can be loaded with 290 + "modprobe container". 291 292 config ACPI_HOTPLUG_MEMORY 293 tristate "Memory Hotplug"
+3 -4
drivers/acpi/acpica/tbutils.c
··· 538 if (ACPI_FAILURE(status)) { 539 ACPI_WARNING((AE_INFO, 540 "Truncating %u table entries!", 541 - (unsigned) 542 - (acpi_gbl_root_table_list.size - 543 - acpi_gbl_root_table_list. 544 - count))); 545 break; 546 } 547 }
··· 538 if (ACPI_FAILURE(status)) { 539 ACPI_WARNING((AE_INFO, 540 "Truncating %u table entries!", 541 + (unsigned) (table_count - 542 + (acpi_gbl_root_table_list. 543 + count - 2)))); 544 break; 545 } 546 }
+9 -12
drivers/acpi/acpica/uteval.c
··· 116 return_ACPI_STATUS(AE_NO_MEMORY); 117 } 118 119 - /* Default return value is SUPPORTED */ 120 121 - return_desc->integer.value = ACPI_UINT32_MAX; 122 walk_state->return_desc = return_desc; 123 124 /* Compare input string to static table of supported interfaces */ ··· 127 if (!ACPI_STRCMP 128 (string_desc->string.pointer, 129 acpi_interfaces_supported[i])) { 130 - 131 - /* The interface is supported */ 132 - 133 - return_ACPI_STATUS(AE_OK); 134 } 135 } 136 ··· 139 */ 140 status = acpi_os_validate_interface(string_desc->string.pointer); 141 if (ACPI_SUCCESS(status)) { 142 - 143 - /* The interface is supported */ 144 - 145 - return_ACPI_STATUS(AE_OK); 146 } 147 148 - /* The interface is not supported */ 149 150 - return_desc->integer.value = 0; 151 return_ACPI_STATUS(AE_OK); 152 } 153
··· 116 return_ACPI_STATUS(AE_NO_MEMORY); 117 } 118 119 + /* Default return value is 0, NOT-SUPPORTED */ 120 121 + return_desc->integer.value = 0; 122 walk_state->return_desc = return_desc; 123 124 /* Compare input string to static table of supported interfaces */ ··· 127 if (!ACPI_STRCMP 128 (string_desc->string.pointer, 129 acpi_interfaces_supported[i])) { 130 + return_desc->integer.value = ACPI_UINT32_MAX; 131 + goto done; 132 } 133 } 134 ··· 141 */ 142 status = acpi_os_validate_interface(string_desc->string.pointer); 143 if (ACPI_SUCCESS(status)) { 144 + return_desc->integer.value = ACPI_UINT32_MAX; 145 } 146 147 + done: 148 + ACPI_DEBUG_PRINT_RAW((ACPI_DB_INFO, "ACPI: BIOS _OSI(%s) %ssupported\n", 149 + string_desc->string.pointer, 150 + return_desc->integer.value == 0 ? "not-" : "")); 151 152 return_ACPI_STATUS(AE_OK); 153 } 154
+3 -2
drivers/acpi/container.c
··· 163 case ACPI_NOTIFY_BUS_CHECK: 164 /* Fall through */ 165 case ACPI_NOTIFY_DEVICE_CHECK: 166 - printk("Container driver received %s event\n", 167 (type == ACPI_NOTIFY_BUS_CHECK) ? 168 "ACPI_NOTIFY_BUS_CHECK" : "ACPI_NOTIFY_DEVICE_CHECK"); 169 status = acpi_bus_get_device(handle, &device); ··· 174 kobject_uevent(&device->dev.kobj, 175 KOBJ_ONLINE); 176 else 177 - printk("Failed to add container\n"); 178 } 179 } else { 180 if (ACPI_SUCCESS(status)) {
··· 163 case ACPI_NOTIFY_BUS_CHECK: 164 /* Fall through */ 165 case ACPI_NOTIFY_DEVICE_CHECK: 166 + printk(KERN_WARNING "Container driver received %s event\n", 167 (type == ACPI_NOTIFY_BUS_CHECK) ? 168 "ACPI_NOTIFY_BUS_CHECK" : "ACPI_NOTIFY_DEVICE_CHECK"); 169 status = acpi_bus_get_device(handle, &device); ··· 174 kobject_uevent(&device->dev.kobj, 175 KOBJ_ONLINE); 176 else 177 + printk(KERN_WARNING 178 + "Failed to add container\n"); 179 } 180 } else { 181 if (ACPI_SUCCESS(status)) {
+9 -5
drivers/acpi/dock.c
··· 855 static ssize_t show_docked(struct device *dev, 856 struct device_attribute *attr, char *buf) 857 { 858 struct dock_station *dock_station = *((struct dock_station **) 859 dev->platform_data); 860 - return snprintf(buf, PAGE_SIZE, "%d\n", dock_present(dock_station)); 861 862 } 863 static DEVICE_ATTR(docked, S_IRUGO, show_docked, NULL); 864 ··· 988 989 ret = device_create_file(&dock_device->dev, &dev_attr_docked); 990 if (ret) { 991 - printk("Error %d adding sysfs file\n", ret); 992 platform_device_unregister(dock_device); 993 kfree(dock_station); 994 dock_station = NULL; ··· 996 } 997 ret = device_create_file(&dock_device->dev, &dev_attr_undock); 998 if (ret) { 999 - printk("Error %d adding sysfs file\n", ret); 1000 device_remove_file(&dock_device->dev, &dev_attr_docked); 1001 platform_device_unregister(dock_device); 1002 kfree(dock_station); ··· 1005 } 1006 ret = device_create_file(&dock_device->dev, &dev_attr_uid); 1007 if (ret) { 1008 - printk("Error %d adding sysfs file\n", ret); 1009 device_remove_file(&dock_device->dev, &dev_attr_docked); 1010 device_remove_file(&dock_device->dev, &dev_attr_undock); 1011 platform_device_unregister(dock_device); ··· 1015 } 1016 ret = device_create_file(&dock_device->dev, &dev_attr_flags); 1017 if (ret) { 1018 - printk("Error %d adding sysfs file\n", ret); 1019 device_remove_file(&dock_device->dev, &dev_attr_docked); 1020 device_remove_file(&dock_device->dev, &dev_attr_undock); 1021 device_remove_file(&dock_device->dev, &dev_attr_uid);
··· 855 static ssize_t show_docked(struct device *dev, 856 struct device_attribute *attr, char *buf) 857 { 858 + struct acpi_device *tmp; 859 + 860 struct dock_station *dock_station = *((struct dock_station **) 861 dev->platform_data); 862 863 + if (ACPI_SUCCESS(acpi_bus_get_device(dock_station->handle, &tmp))) 864 + return snprintf(buf, PAGE_SIZE, "1\n"); 865 + return snprintf(buf, PAGE_SIZE, "0\n"); 866 } 867 static DEVICE_ATTR(docked, S_IRUGO, show_docked, NULL); 868 ··· 984 985 ret = device_create_file(&dock_device->dev, &dev_attr_docked); 986 if (ret) { 987 + printk(KERN_ERR "Error %d adding sysfs file\n", ret); 988 platform_device_unregister(dock_device); 989 kfree(dock_station); 990 dock_station = NULL; ··· 992 } 993 ret = device_create_file(&dock_device->dev, &dev_attr_undock); 994 if (ret) { 995 + printk(KERN_ERR "Error %d adding sysfs file\n", ret); 996 device_remove_file(&dock_device->dev, &dev_attr_docked); 997 platform_device_unregister(dock_device); 998 kfree(dock_station); ··· 1001 } 1002 ret = device_create_file(&dock_device->dev, &dev_attr_uid); 1003 if (ret) { 1004 + printk(KERN_ERR "Error %d adding sysfs file\n", ret); 1005 device_remove_file(&dock_device->dev, &dev_attr_docked); 1006 device_remove_file(&dock_device->dev, &dev_attr_undock); 1007 platform_device_unregister(dock_device); ··· 1011 } 1012 ret = device_create_file(&dock_device->dev, &dev_attr_flags); 1013 if (ret) { 1014 + printk(KERN_ERR "Error %d adding sysfs file\n", ret); 1015 device_remove_file(&dock_device->dev, &dev_attr_docked); 1016 device_remove_file(&dock_device->dev, &dev_attr_undock); 1017 device_remove_file(&dock_device->dev, &dev_attr_uid);
+1 -1
drivers/acpi/ec.c
··· 982 saved_ec = kmalloc(sizeof(struct acpi_ec), GFP_KERNEL); 983 if (!saved_ec) 984 return -ENOMEM; 985 - memcpy(&saved_ec, boot_ec, sizeof(saved_ec)); 986 /* fall through */ 987 } 988 /* This workaround is needed only on some broken machines,
··· 982 saved_ec = kmalloc(sizeof(struct acpi_ec), GFP_KERNEL); 983 if (!saved_ec) 984 return -ENOMEM; 985 + memcpy(saved_ec, boot_ec, sizeof(*saved_ec)); 986 /* fall through */ 987 } 988 /* This workaround is needed only on some broken machines,
+4 -4
drivers/acpi/glue.c
··· 255 } 256 type = acpi_get_bus_type(dev->bus); 257 if (!type) { 258 - DBG("No ACPI bus support for %s\n", dev->bus_id); 259 ret = -EINVAL; 260 goto end; 261 } 262 if ((ret = type->find_device(dev, &handle)) != 0) 263 - DBG("Can't get handler for %s\n", dev->bus_id); 264 end: 265 if (!ret) 266 acpi_bind_one(dev, handle); ··· 271 272 acpi_get_name(dev->archdata.acpi_handle, 273 ACPI_FULL_PATHNAME, &buffer); 274 - DBG("Device %s -> %s\n", dev->bus_id, (char *)buffer.pointer); 275 kfree(buffer.pointer); 276 } else 277 - DBG("Device %s -> No ACPI support\n", dev->bus_id); 278 #endif 279 280 return ret;
··· 255 } 256 type = acpi_get_bus_type(dev->bus); 257 if (!type) { 258 + DBG("No ACPI bus support for %s\n", dev_name(dev)); 259 ret = -EINVAL; 260 goto end; 261 } 262 if ((ret = type->find_device(dev, &handle)) != 0) 263 + DBG("Can't get handler for %s\n", dev_name(dev)); 264 end: 265 if (!ret) 266 acpi_bind_one(dev, handle); ··· 271 272 acpi_get_name(dev->archdata.acpi_handle, 273 ACPI_FULL_PATHNAME, &buffer); 274 + DBG("Device %s -> %s\n", dev_name(dev), (char *)buffer.pointer); 275 kfree(buffer.pointer); 276 } else 277 + DBG("Device %s -> No ACPI support\n", dev_name(dev)); 278 #endif 279 280 return ret;
+52 -2
drivers/acpi/osl.c
··· 228 if (acpi_in_debugger) { 229 kdb_printf("%s", buffer); 230 } else { 231 - printk("%s", buffer); 232 } 233 #else 234 - printk("%s", buffer); 235 #endif 236 } 237 ··· 1317 return AE_SUPPORT; 1318 } 1319 1320 /****************************************************************************** 1321 * 1322 * FUNCTION: acpi_os_validate_address ··· 1394 1395 switch (space_id) { 1396 case ACPI_ADR_SPACE_SYSTEM_IO: 1397 case ACPI_ADR_SPACE_SYSTEM_MEMORY: 1398 /* Only interference checks against SystemIO and SytemMemory 1399 are needed */
··· 228 if (acpi_in_debugger) { 229 kdb_printf("%s", buffer); 230 } else { 231 + printk(KERN_CONT "%s", buffer); 232 } 233 #else 234 + printk(KERN_CONT "%s", buffer); 235 #endif 236 } 237 ··· 1317 return AE_SUPPORT; 1318 } 1319 1320 + #ifdef CONFIG_X86 1321 + 1322 + struct aml_port_desc { 1323 + uint start; 1324 + uint end; 1325 + char* name; 1326 + char warned; 1327 + }; 1328 + 1329 + static struct aml_port_desc aml_invalid_port_list[] = { 1330 + {0x20, 0x21, "PIC0", 0}, 1331 + {0xA0, 0xA1, "PIC1", 0}, 1332 + {0x4D0, 0x4D1, "ELCR", 0} 1333 + }; 1334 + 1335 + /* 1336 + * valid_aml_io_address() 1337 + * 1338 + * if valid, return true 1339 + * else invalid, warn once, return false 1340 + */ 1341 + static bool valid_aml_io_address(uint address, uint length) 1342 + { 1343 + int i; 1344 + int entries = sizeof(aml_invalid_port_list) / sizeof(struct aml_port_desc); 1345 + 1346 + for (i = 0; i < entries; ++i) { 1347 + if ((address >= aml_invalid_port_list[i].start && 1348 + address <= aml_invalid_port_list[i].end) || 1349 + (address + length >= aml_invalid_port_list[i].start && 1350 + address + length <= aml_invalid_port_list[i].end)) 1351 + { 1352 + if (!aml_invalid_port_list[i].warned) 1353 + { 1354 + printk(KERN_ERR "ACPI: Denied BIOS AML access" 1355 + " to invalid port 0x%x+0x%x (%s)\n", 1356 + address, length, 1357 + aml_invalid_port_list[i].name); 1358 + aml_invalid_port_list[i].warned = 1; 1359 + } 1360 + return false; /* invalid */ 1361 + } 1362 + } 1363 + return true; /* valid */ 1364 + } 1365 + #else 1366 + static inline bool valid_aml_io_address(uint address, uint length) { return true; } 1367 + #endif 1368 /****************************************************************************** 1369 * 1370 * FUNCTION: acpi_os_validate_address ··· 1346 1347 switch (space_id) { 1348 case ACPI_ADR_SPACE_SYSTEM_IO: 1349 + if (!valid_aml_io_address(address, length)) 1350 + return AE_AML_ILLEGAL_ADDRESS; 1351 case ACPI_ADR_SPACE_SYSTEM_MEMORY: 1352 /* Only interference checks against SystemIO and SytemMemory 1353 are needed */
+1 -1
drivers/acpi/pci_link.c
··· 593 return -ENODEV; 594 } else { 595 acpi_irq_penalty[link->irq.active] += PIRQ_PENALTY_PCI_USING; 596 - printk(PREFIX "%s [%s] enabled at IRQ %d\n", 597 acpi_device_name(link->device), 598 acpi_device_bid(link->device), link->irq.active); 599 }
··· 593 return -ENODEV; 594 } else { 595 acpi_irq_penalty[link->irq.active] += PIRQ_PENALTY_PCI_USING; 596 + printk(KERN_WARNING PREFIX "%s [%s] enabled at IRQ %d\n", 597 acpi_device_name(link->device), 598 acpi_device_bid(link->device), link->irq.active); 599 }
+10 -657
drivers/acpi/processor_idle.c
··· 66 #define ACPI_PROCESSOR_FILE_POWER "power" 67 #define US_TO_PM_TIMER_TICKS(t) ((t * (PM_TIMER_FREQUENCY/1000)) / 1000) 68 #define PM_TIMER_TICK_NS (1000000000ULL/PM_TIMER_FREQUENCY) 69 - #ifndef CONFIG_CPU_IDLE 70 - #define C2_OVERHEAD 4 /* 1us (3.579 ticks per us) */ 71 - #define C3_OVERHEAD 4 /* 1us (3.579 ticks per us) */ 72 - static void (*pm_idle_save) (void) __read_mostly; 73 - #else 74 #define C2_OVERHEAD 1 /* 1us */ 75 #define C3_OVERHEAD 1 /* 1us */ 76 - #endif 77 #define PM_TIMER_TICKS_TO_US(p) (((p) * 1000)/(PM_TIMER_FREQUENCY/1000)) 78 79 static unsigned int max_cstate __read_mostly = ACPI_PROCESSOR_MAX_POWER; 80 - #ifdef CONFIG_CPU_IDLE 81 module_param(max_cstate, uint, 0000); 82 - #else 83 - module_param(max_cstate, uint, 0644); 84 - #endif 85 static unsigned int nocst __read_mostly; 86 module_param(nocst, uint, 0000); 87 88 - #ifndef CONFIG_CPU_IDLE 89 - /* 90 - * bm_history -- bit-mask with a bit per jiffy of bus-master activity 91 - * 1000 HZ: 0xFFFFFFFF: 32 jiffies = 32ms 92 - * 800 HZ: 0xFFFFFFFF: 32 jiffies = 40ms 93 - * 100 HZ: 0x0000000F: 4 jiffies = 40ms 94 - * reduce history for more aggressive entry into C3 95 - */ 96 - static unsigned int bm_history __read_mostly = 97 - (HZ >= 800 ? 0xFFFFFFFF : ((1U << (HZ / 25)) - 1)); 98 - module_param(bm_history, uint, 0644); 99 - 100 - static int acpi_processor_set_power_policy(struct acpi_processor *pr); 101 - 102 - #else /* CONFIG_CPU_IDLE */ 103 static unsigned int latency_factor __read_mostly = 2; 104 module_param(latency_factor, uint, 0644); 105 - #endif 106 107 /* 108 * IBM ThinkPad R40e crashes mysteriously when going into C2 or C3. ··· 198 current_thread_info()->status |= TS_POLLING; 199 } 200 201 - #ifndef CONFIG_CPU_IDLE 202 - 203 - static void 204 - acpi_processor_power_activate(struct acpi_processor *pr, 205 - struct acpi_processor_cx *new) 206 - { 207 - struct acpi_processor_cx *old; 208 - 209 - if (!pr || !new) 210 - return; 211 - 212 - old = pr->power.state; 213 - 214 - if (old) 215 - old->promotion.count = 0; 216 - new->demotion.count = 0; 217 - 218 - /* Cleanup from old state. */ 219 - if (old) { 220 - switch (old->type) { 221 - case ACPI_STATE_C3: 222 - /* Disable bus master reload */ 223 - if (new->type != ACPI_STATE_C3 && pr->flags.bm_check) 224 - acpi_set_register(ACPI_BITREG_BUS_MASTER_RLD, 0); 225 - break; 226 - } 227 - } 228 - 229 - /* Prepare to use new state. */ 230 - switch (new->type) { 231 - case ACPI_STATE_C3: 232 - /* Enable bus master reload */ 233 - if (old->type != ACPI_STATE_C3 && pr->flags.bm_check) 234 - acpi_set_register(ACPI_BITREG_BUS_MASTER_RLD, 1); 235 - break; 236 - } 237 - 238 - pr->power.state = new; 239 - 240 - return; 241 - } 242 - 243 - static atomic_t c3_cpu_count; 244 - 245 - /* Common C-state entry for C2, C3, .. */ 246 - static void acpi_cstate_enter(struct acpi_processor_cx *cstate) 247 - { 248 - /* Don't trace irqs off for idle */ 249 - stop_critical_timings(); 250 - if (cstate->entry_method == ACPI_CSTATE_FFH) { 251 - /* Call into architectural FFH based C-state */ 252 - acpi_processor_ffh_cstate_enter(cstate); 253 - } else { 254 - int unused; 255 - /* IO port based C-state */ 256 - inb(cstate->address); 257 - /* Dummy wait op - must do something useless after P_LVL2 read 258 - because chipsets cannot guarantee that STPCLK# signal 259 - gets asserted in time to freeze execution properly. */ 260 - unused = inl(acpi_gbl_FADT.xpm_timer_block.address); 261 - } 262 - start_critical_timings(); 263 - } 264 - #endif /* !CONFIG_CPU_IDLE */ 265 - 266 #ifdef ARCH_APICTIMER_STOPS_ON_C3 267 268 /* ··· 298 } 299 } 300 #endif 301 - 302 - #ifndef CONFIG_CPU_IDLE 303 - static void acpi_processor_idle(void) 304 - { 305 - struct acpi_processor *pr = NULL; 306 - struct acpi_processor_cx *cx = NULL; 307 - struct acpi_processor_cx *next_state = NULL; 308 - int sleep_ticks = 0; 309 - u32 t1, t2 = 0; 310 - 311 - /* 312 - * Interrupts must be disabled during bus mastering calculations and 313 - * for C2/C3 transitions. 314 - */ 315 - local_irq_disable(); 316 - 317 - pr = __get_cpu_var(processors); 318 - if (!pr) { 319 - local_irq_enable(); 320 - return; 321 - } 322 - 323 - /* 324 - * Check whether we truly need to go idle, or should 325 - * reschedule: 326 - */ 327 - if (unlikely(need_resched())) { 328 - local_irq_enable(); 329 - return; 330 - } 331 - 332 - cx = pr->power.state; 333 - if (!cx || acpi_idle_suspend) { 334 - if (pm_idle_save) { 335 - pm_idle_save(); /* enables IRQs */ 336 - } else { 337 - acpi_safe_halt(); 338 - local_irq_enable(); 339 - } 340 - 341 - return; 342 - } 343 - 344 - /* 345 - * Check BM Activity 346 - * ----------------- 347 - * Check for bus mastering activity (if required), record, and check 348 - * for demotion. 349 - */ 350 - if (pr->flags.bm_check) { 351 - u32 bm_status = 0; 352 - unsigned long diff = jiffies - pr->power.bm_check_timestamp; 353 - 354 - if (diff > 31) 355 - diff = 31; 356 - 357 - pr->power.bm_activity <<= diff; 358 - 359 - acpi_get_register(ACPI_BITREG_BUS_MASTER_STATUS, &bm_status); 360 - if (bm_status) { 361 - pr->power.bm_activity |= 0x1; 362 - acpi_set_register(ACPI_BITREG_BUS_MASTER_STATUS, 1); 363 - } 364 - /* 365 - * PIIX4 Erratum #18: Note that BM_STS doesn't always reflect 366 - * the true state of bus mastering activity; forcing us to 367 - * manually check the BMIDEA bit of each IDE channel. 368 - */ 369 - else if (errata.piix4.bmisx) { 370 - if ((inb_p(errata.piix4.bmisx + 0x02) & 0x01) 371 - || (inb_p(errata.piix4.bmisx + 0x0A) & 0x01)) 372 - pr->power.bm_activity |= 0x1; 373 - } 374 - 375 - pr->power.bm_check_timestamp = jiffies; 376 - 377 - /* 378 - * If bus mastering is or was active this jiffy, demote 379 - * to avoid a faulty transition. Note that the processor 380 - * won't enter a low-power state during this call (to this 381 - * function) but should upon the next. 382 - * 383 - * TBD: A better policy might be to fallback to the demotion 384 - * state (use it for this quantum only) istead of 385 - * demoting -- and rely on duration as our sole demotion 386 - * qualification. This may, however, introduce DMA 387 - * issues (e.g. floppy DMA transfer overrun/underrun). 388 - */ 389 - if ((pr->power.bm_activity & 0x1) && 390 - cx->demotion.threshold.bm) { 391 - local_irq_enable(); 392 - next_state = cx->demotion.state; 393 - goto end; 394 - } 395 - } 396 - 397 - #ifdef CONFIG_HOTPLUG_CPU 398 - /* 399 - * Check for P_LVL2_UP flag before entering C2 and above on 400 - * an SMP system. We do it here instead of doing it at _CST/P_LVL 401 - * detection phase, to work cleanly with logical CPU hotplug. 402 - */ 403 - if ((cx->type != ACPI_STATE_C1) && (num_online_cpus() > 1) && 404 - !pr->flags.has_cst && !(acpi_gbl_FADT.flags & ACPI_FADT_C2_MP_SUPPORTED)) 405 - cx = &pr->power.states[ACPI_STATE_C1]; 406 - #endif 407 - 408 - /* 409 - * Sleep: 410 - * ------ 411 - * Invoke the current Cx state to put the processor to sleep. 412 - */ 413 - if (cx->type == ACPI_STATE_C2 || cx->type == ACPI_STATE_C3) { 414 - current_thread_info()->status &= ~TS_POLLING; 415 - /* 416 - * TS_POLLING-cleared state must be visible before we 417 - * test NEED_RESCHED: 418 - */ 419 - smp_mb(); 420 - if (need_resched()) { 421 - current_thread_info()->status |= TS_POLLING; 422 - local_irq_enable(); 423 - return; 424 - } 425 - } 426 - 427 - switch (cx->type) { 428 - 429 - case ACPI_STATE_C1: 430 - /* 431 - * Invoke C1. 432 - * Use the appropriate idle routine, the one that would 433 - * be used without acpi C-states. 434 - */ 435 - if (pm_idle_save) { 436 - pm_idle_save(); /* enables IRQs */ 437 - } else { 438 - acpi_safe_halt(); 439 - local_irq_enable(); 440 - } 441 - 442 - /* 443 - * TBD: Can't get time duration while in C1, as resumes 444 - * go to an ISR rather than here. Need to instrument 445 - * base interrupt handler. 446 - * 447 - * Note: the TSC better not stop in C1, sched_clock() will 448 - * skew otherwise. 449 - */ 450 - sleep_ticks = 0xFFFFFFFF; 451 - 452 - break; 453 - 454 - case ACPI_STATE_C2: 455 - /* Get start time (ticks) */ 456 - t1 = inl(acpi_gbl_FADT.xpm_timer_block.address); 457 - /* Tell the scheduler that we are going deep-idle: */ 458 - sched_clock_idle_sleep_event(); 459 - /* Invoke C2 */ 460 - acpi_state_timer_broadcast(pr, cx, 1); 461 - acpi_cstate_enter(cx); 462 - /* Get end time (ticks) */ 463 - t2 = inl(acpi_gbl_FADT.xpm_timer_block.address); 464 - 465 - #if defined (CONFIG_GENERIC_TIME) && defined (CONFIG_X86) 466 - /* TSC halts in C2, so notify users */ 467 - if (tsc_halts_in_c(ACPI_STATE_C2)) 468 - mark_tsc_unstable("possible TSC halt in C2"); 469 - #endif 470 - /* Compute time (ticks) that we were actually asleep */ 471 - sleep_ticks = ticks_elapsed(t1, t2); 472 - 473 - /* Tell the scheduler how much we idled: */ 474 - sched_clock_idle_wakeup_event(sleep_ticks*PM_TIMER_TICK_NS); 475 - 476 - /* Re-enable interrupts */ 477 - local_irq_enable(); 478 - /* Do not account our idle-switching overhead: */ 479 - sleep_ticks -= cx->latency_ticks + C2_OVERHEAD; 480 - 481 - current_thread_info()->status |= TS_POLLING; 482 - acpi_state_timer_broadcast(pr, cx, 0); 483 - break; 484 - 485 - case ACPI_STATE_C3: 486 - acpi_unlazy_tlb(smp_processor_id()); 487 - /* 488 - * Must be done before busmaster disable as we might 489 - * need to access HPET ! 490 - */ 491 - acpi_state_timer_broadcast(pr, cx, 1); 492 - /* 493 - * disable bus master 494 - * bm_check implies we need ARB_DIS 495 - * !bm_check implies we need cache flush 496 - * bm_control implies whether we can do ARB_DIS 497 - * 498 - * That leaves a case where bm_check is set and bm_control is 499 - * not set. In that case we cannot do much, we enter C3 500 - * without doing anything. 501 - */ 502 - if (pr->flags.bm_check && pr->flags.bm_control) { 503 - if (atomic_inc_return(&c3_cpu_count) == 504 - num_online_cpus()) { 505 - /* 506 - * All CPUs are trying to go to C3 507 - * Disable bus master arbitration 508 - */ 509 - acpi_set_register(ACPI_BITREG_ARB_DISABLE, 1); 510 - } 511 - } else if (!pr->flags.bm_check) { 512 - /* SMP with no shared cache... Invalidate cache */ 513 - ACPI_FLUSH_CPU_CACHE(); 514 - } 515 - 516 - /* Get start time (ticks) */ 517 - t1 = inl(acpi_gbl_FADT.xpm_timer_block.address); 518 - /* Invoke C3 */ 519 - /* Tell the scheduler that we are going deep-idle: */ 520 - sched_clock_idle_sleep_event(); 521 - acpi_cstate_enter(cx); 522 - /* Get end time (ticks) */ 523 - t2 = inl(acpi_gbl_FADT.xpm_timer_block.address); 524 - if (pr->flags.bm_check && pr->flags.bm_control) { 525 - /* Enable bus master arbitration */ 526 - atomic_dec(&c3_cpu_count); 527 - acpi_set_register(ACPI_BITREG_ARB_DISABLE, 0); 528 - } 529 - 530 - #if defined (CONFIG_GENERIC_TIME) && defined (CONFIG_X86) 531 - /* TSC halts in C3, so notify users */ 532 - if (tsc_halts_in_c(ACPI_STATE_C3)) 533 - mark_tsc_unstable("TSC halts in C3"); 534 - #endif 535 - /* Compute time (ticks) that we were actually asleep */ 536 - sleep_ticks = ticks_elapsed(t1, t2); 537 - /* Tell the scheduler how much we idled: */ 538 - sched_clock_idle_wakeup_event(sleep_ticks*PM_TIMER_TICK_NS); 539 - 540 - /* Re-enable interrupts */ 541 - local_irq_enable(); 542 - /* Do not account our idle-switching overhead: */ 543 - sleep_ticks -= cx->latency_ticks + C3_OVERHEAD; 544 - 545 - current_thread_info()->status |= TS_POLLING; 546 - acpi_state_timer_broadcast(pr, cx, 0); 547 - break; 548 - 549 - default: 550 - local_irq_enable(); 551 - return; 552 - } 553 - cx->usage++; 554 - if ((cx->type != ACPI_STATE_C1) && (sleep_ticks > 0)) 555 - cx->time += sleep_ticks; 556 - 557 - next_state = pr->power.state; 558 - 559 - #ifdef CONFIG_HOTPLUG_CPU 560 - /* Don't do promotion/demotion */ 561 - if ((cx->type == ACPI_STATE_C1) && (num_online_cpus() > 1) && 562 - !pr->flags.has_cst && !(acpi_gbl_FADT.flags & ACPI_FADT_C2_MP_SUPPORTED)) { 563 - next_state = cx; 564 - goto end; 565 - } 566 - #endif 567 - 568 - /* 569 - * Promotion? 570 - * ---------- 571 - * Track the number of longs (time asleep is greater than threshold) 572 - * and promote when the count threshold is reached. Note that bus 573 - * mastering activity may prevent promotions. 574 - * Do not promote above max_cstate. 575 - */ 576 - if (cx->promotion.state && 577 - ((cx->promotion.state - pr->power.states) <= max_cstate)) { 578 - if (sleep_ticks > cx->promotion.threshold.ticks && 579 - cx->promotion.state->latency <= 580 - pm_qos_requirement(PM_QOS_CPU_DMA_LATENCY)) { 581 - cx->promotion.count++; 582 - cx->demotion.count = 0; 583 - if (cx->promotion.count >= 584 - cx->promotion.threshold.count) { 585 - if (pr->flags.bm_check) { 586 - if (! 587 - (pr->power.bm_activity & cx-> 588 - promotion.threshold.bm)) { 589 - next_state = 590 - cx->promotion.state; 591 - goto end; 592 - } 593 - } else { 594 - next_state = cx->promotion.state; 595 - goto end; 596 - } 597 - } 598 - } 599 - } 600 - 601 - /* 602 - * Demotion? 603 - * --------- 604 - * Track the number of shorts (time asleep is less than time threshold) 605 - * and demote when the usage threshold is reached. 606 - */ 607 - if (cx->demotion.state) { 608 - if (sleep_ticks < cx->demotion.threshold.ticks) { 609 - cx->demotion.count++; 610 - cx->promotion.count = 0; 611 - if (cx->demotion.count >= cx->demotion.threshold.count) { 612 - next_state = cx->demotion.state; 613 - goto end; 614 - } 615 - } 616 - } 617 - 618 - end: 619 - /* 620 - * Demote if current state exceeds max_cstate 621 - * or if the latency of the current state is unacceptable 622 - */ 623 - if ((pr->power.state - pr->power.states) > max_cstate || 624 - pr->power.state->latency > 625 - pm_qos_requirement(PM_QOS_CPU_DMA_LATENCY)) { 626 - if (cx->demotion.state) 627 - next_state = cx->demotion.state; 628 - } 629 - 630 - /* 631 - * New Cx State? 632 - * ------------- 633 - * If we're going to start using a new Cx state we must clean up 634 - * from the previous and prepare to use the new. 635 - */ 636 - if (next_state != pr->power.state) 637 - acpi_processor_power_activate(pr, next_state); 638 - } 639 - 640 - static int acpi_processor_set_power_policy(struct acpi_processor *pr) 641 - { 642 - unsigned int i; 643 - unsigned int state_is_set = 0; 644 - struct acpi_processor_cx *lower = NULL; 645 - struct acpi_processor_cx *higher = NULL; 646 - struct acpi_processor_cx *cx; 647 - 648 - 649 - if (!pr) 650 - return -EINVAL; 651 - 652 - /* 653 - * This function sets the default Cx state policy (OS idle handler). 654 - * Our scheme is to promote quickly to C2 but more conservatively 655 - * to C3. We're favoring C2 for its characteristics of low latency 656 - * (quick response), good power savings, and ability to allow bus 657 - * mastering activity. Note that the Cx state policy is completely 658 - * customizable and can be altered dynamically. 659 - */ 660 - 661 - /* startup state */ 662 - for (i = 1; i < ACPI_PROCESSOR_MAX_POWER; i++) { 663 - cx = &pr->power.states[i]; 664 - if (!cx->valid) 665 - continue; 666 - 667 - if (!state_is_set) 668 - pr->power.state = cx; 669 - state_is_set++; 670 - break; 671 - } 672 - 673 - if (!state_is_set) 674 - return -ENODEV; 675 - 676 - /* demotion */ 677 - for (i = 1; i < ACPI_PROCESSOR_MAX_POWER; i++) { 678 - cx = &pr->power.states[i]; 679 - if (!cx->valid) 680 - continue; 681 - 682 - if (lower) { 683 - cx->demotion.state = lower; 684 - cx->demotion.threshold.ticks = cx->latency_ticks; 685 - cx->demotion.threshold.count = 1; 686 - if (cx->type == ACPI_STATE_C3) 687 - cx->demotion.threshold.bm = bm_history; 688 - } 689 - 690 - lower = cx; 691 - } 692 - 693 - /* promotion */ 694 - for (i = (ACPI_PROCESSOR_MAX_POWER - 1); i > 0; i--) { 695 - cx = &pr->power.states[i]; 696 - if (!cx->valid) 697 - continue; 698 - 699 - if (higher) { 700 - cx->promotion.state = higher; 701 - cx->promotion.threshold.ticks = cx->latency_ticks; 702 - if (cx->type >= ACPI_STATE_C2) 703 - cx->promotion.threshold.count = 4; 704 - else 705 - cx->promotion.threshold.count = 10; 706 - if (higher->type == ACPI_STATE_C3) 707 - cx->promotion.threshold.bm = bm_history; 708 - } 709 - 710 - higher = cx; 711 - } 712 - 713 - return 0; 714 - } 715 - #endif /* !CONFIG_CPU_IDLE */ 716 717 static int acpi_processor_get_power_info_fadt(struct acpi_processor *pr) 718 { ··· 541 */ 542 cx->valid = 1; 543 544 - #ifndef CONFIG_CPU_IDLE 545 - cx->latency_ticks = US_TO_PM_TIMER_TICKS(cx->latency); 546 - #else 547 cx->latency_ticks = cx->latency; 548 - #endif 549 550 return; 551 } ··· 611 " for C3 to be enabled on SMP systems\n")); 612 return; 613 } 614 - acpi_set_register(ACPI_BITREG_BUS_MASTER_RLD, 0); 615 } 616 617 /* ··· 621 */ 622 cx->valid = 1; 623 624 - #ifndef CONFIG_CPU_IDLE 625 - cx->latency_ticks = US_TO_PM_TIMER_TICKS(cx->latency); 626 - #else 627 cx->latency_ticks = cx->latency; 628 - #endif 629 630 return; 631 } ··· 694 acpi_processor_get_power_info_default(pr); 695 696 pr->power.count = acpi_processor_power_verify(pr); 697 - 698 - #ifndef CONFIG_CPU_IDLE 699 - /* 700 - * Set Default Policy 701 - * ------------------ 702 - * Now that we know which states are supported, set the default 703 - * policy. Note that this policy can be changed dynamically 704 - * (e.g. encourage deeper sleeps to conserve battery life when 705 - * not on AC). 706 - */ 707 - result = acpi_processor_set_power_policy(pr); 708 - if (result) 709 - return result; 710 - #endif 711 712 /* 713 * if one state of type C2 or C3 is available, mark this ··· 792 .release = single_release, 793 }; 794 795 - #ifndef CONFIG_CPU_IDLE 796 - 797 - int acpi_processor_cst_has_changed(struct acpi_processor *pr) 798 - { 799 - int result = 0; 800 - 801 - if (boot_option_idle_override) 802 - return 0; 803 - 804 - if (!pr) 805 - return -EINVAL; 806 - 807 - if (nocst) { 808 - return -ENODEV; 809 - } 810 - 811 - if (!pr->flags.power_setup_done) 812 - return -ENODEV; 813 - 814 - /* 815 - * Fall back to the default idle loop, when pm_idle_save had 816 - * been initialized. 817 - */ 818 - if (pm_idle_save) { 819 - pm_idle = pm_idle_save; 820 - /* Relies on interrupts forcing exit from idle. */ 821 - synchronize_sched(); 822 - } 823 - 824 - pr->flags.power = 0; 825 - result = acpi_processor_get_power_info(pr); 826 - if ((pr->flags.power == 1) && (pr->flags.power_setup_done)) 827 - pm_idle = acpi_processor_idle; 828 - 829 - return result; 830 - } 831 - 832 - #ifdef CONFIG_SMP 833 - static void smp_callback(void *v) 834 - { 835 - /* we already woke the CPU up, nothing more to do */ 836 - } 837 - 838 - /* 839 - * This function gets called when a part of the kernel has a new latency 840 - * requirement. This means we need to get all processors out of their C-state, 841 - * and then recalculate a new suitable C-state. Just do a cross-cpu IPI; that 842 - * wakes them all right up. 843 - */ 844 - static int acpi_processor_latency_notify(struct notifier_block *b, 845 - unsigned long l, void *v) 846 - { 847 - smp_call_function(smp_callback, NULL, 1); 848 - return NOTIFY_OK; 849 - } 850 - 851 - static struct notifier_block acpi_processor_latency_notifier = { 852 - .notifier_call = acpi_processor_latency_notify, 853 - }; 854 - 855 - #endif 856 - 857 - #else /* CONFIG_CPU_IDLE */ 858 859 /** 860 * acpi_idle_bm_check - checks if bus master activity was detected ··· 800 { 801 u32 bm_status = 0; 802 803 - acpi_get_register(ACPI_BITREG_BUS_MASTER_STATUS, &bm_status); 804 if (bm_status) 805 acpi_set_register(ACPI_BITREG_BUS_MASTER_STATUS, 1); 806 /* ··· 814 bm_status = 1; 815 } 816 return bm_status; 817 - } 818 - 819 - /** 820 - * acpi_idle_update_bm_rld - updates the BM_RLD bit depending on target state 821 - * @pr: the processor 822 - * @target: the new target state 823 - */ 824 - static inline void acpi_idle_update_bm_rld(struct acpi_processor *pr, 825 - struct acpi_processor_cx *target) 826 - { 827 - if (pr->flags.bm_rld_set && target->type != ACPI_STATE_C3) { 828 - acpi_set_register(ACPI_BITREG_BUS_MASTER_RLD, 0); 829 - pr->flags.bm_rld_set = 0; 830 - } 831 - 832 - if (!pr->flags.bm_rld_set && target->type == ACPI_STATE_C3) { 833 - acpi_set_register(ACPI_BITREG_BUS_MASTER_RLD, 1); 834 - pr->flags.bm_rld_set = 1; 835 - } 836 } 837 838 /** ··· 871 return 0; 872 } 873 874 - if (pr->flags.bm_check) 875 - acpi_idle_update_bm_rld(pr, cx); 876 - 877 t1 = inl(acpi_gbl_FADT.xpm_timer_block.address); 878 acpi_idle_do_entry(cx); 879 t2 = inl(acpi_gbl_FADT.xpm_timer_block.address); ··· 921 * access HPET ! 922 */ 923 acpi_state_timer_broadcast(pr, cx, 1); 924 - 925 - if (pr->flags.bm_check) 926 - acpi_idle_update_bm_rld(pr, cx); 927 928 if (cx->type == ACPI_STATE_C3) 929 ACPI_FLUSH_CPU_CACHE(); ··· 1012 * access HPET ! 1013 */ 1014 acpi_state_timer_broadcast(pr, cx, 1); 1015 - 1016 - acpi_idle_update_bm_rld(pr, cx); 1017 1018 /* 1019 * disable bus master ··· 1185 return ret; 1186 } 1187 1188 - #endif /* CONFIG_CPU_IDLE */ 1189 - 1190 int __cpuinit acpi_processor_power_init(struct acpi_processor *pr, 1191 struct acpi_device *device) 1192 { ··· 1213 "ACPI: processor limited to max C-state %d\n", 1214 max_cstate); 1215 first_run++; 1216 - #if !defined(CONFIG_CPU_IDLE) && defined(CONFIG_SMP) 1217 - pm_qos_add_notifier(PM_QOS_CPU_DMA_LATENCY, 1218 - &acpi_processor_latency_notifier); 1219 - #endif 1220 } 1221 1222 if (!pr) ··· 1236 * platforms that only support C1. 1237 */ 1238 if (pr->flags.power) { 1239 - #ifdef CONFIG_CPU_IDLE 1240 acpi_processor_setup_cpuidle(pr); 1241 if (cpuidle_register_device(&pr->power.dev)) 1242 return -EIO; 1243 - #endif 1244 1245 printk(KERN_INFO PREFIX "CPU%d (power states:", pr->id); 1246 for (i = 1; i <= pr->power.count; i++) ··· 1246 printk(" C%d[C%d]", i, 1247 pr->power.states[i].type); 1248 printk(")\n"); 1249 - 1250 - #ifndef CONFIG_CPU_IDLE 1251 - if (pr->id == 0) { 1252 - pm_idle_save = pm_idle; 1253 - pm_idle = acpi_processor_idle; 1254 - } 1255 - #endif 1256 } 1257 1258 /* 'power' [R] */ ··· 1264 if (boot_option_idle_override) 1265 return 0; 1266 1267 - #ifdef CONFIG_CPU_IDLE 1268 cpuidle_unregister_device(&pr->power.dev); 1269 - #endif 1270 pr->flags.power_setup_done = 0; 1271 1272 if (acpi_device_dir(device)) 1273 remove_proc_entry(ACPI_PROCESSOR_FILE_POWER, 1274 acpi_device_dir(device)); 1275 - 1276 - #ifndef CONFIG_CPU_IDLE 1277 - 1278 - /* Unregister the idle handler when processor #0 is removed. */ 1279 - if (pr->id == 0) { 1280 - if (pm_idle_save) 1281 - pm_idle = pm_idle_save; 1282 - 1283 - /* 1284 - * We are about to unload the current idle thread pm callback 1285 - * (pm_idle), Wait for all processors to update cached/local 1286 - * copies of pm_idle before proceeding. 1287 - */ 1288 - cpu_idle_wait(); 1289 - #ifdef CONFIG_SMP 1290 - pm_qos_remove_notifier(PM_QOS_CPU_DMA_LATENCY, 1291 - &acpi_processor_latency_notifier); 1292 - #endif 1293 - } 1294 - #endif 1295 1296 return 0; 1297 }
··· 66 #define ACPI_PROCESSOR_FILE_POWER "power" 67 #define US_TO_PM_TIMER_TICKS(t) ((t * (PM_TIMER_FREQUENCY/1000)) / 1000) 68 #define PM_TIMER_TICK_NS (1000000000ULL/PM_TIMER_FREQUENCY) 69 #define C2_OVERHEAD 1 /* 1us */ 70 #define C3_OVERHEAD 1 /* 1us */ 71 #define PM_TIMER_TICKS_TO_US(p) (((p) * 1000)/(PM_TIMER_FREQUENCY/1000)) 72 73 static unsigned int max_cstate __read_mostly = ACPI_PROCESSOR_MAX_POWER; 74 module_param(max_cstate, uint, 0000); 75 static unsigned int nocst __read_mostly; 76 module_param(nocst, uint, 0000); 77 78 static unsigned int latency_factor __read_mostly = 2; 79 module_param(latency_factor, uint, 0644); 80 81 /* 82 * IBM ThinkPad R40e crashes mysteriously when going into C2 or C3. ··· 224 current_thread_info()->status |= TS_POLLING; 225 } 226 227 #ifdef ARCH_APICTIMER_STOPS_ON_C3 228 229 /* ··· 389 } 390 } 391 #endif 392 393 static int acpi_processor_get_power_info_fadt(struct acpi_processor *pr) 394 { ··· 1047 */ 1048 cx->valid = 1; 1049 1050 cx->latency_ticks = cx->latency; 1051 1052 return; 1053 } ··· 1121 " for C3 to be enabled on SMP systems\n")); 1122 return; 1123 } 1124 } 1125 1126 /* ··· 1132 */ 1133 cx->valid = 1; 1134 1135 cx->latency_ticks = cx->latency; 1136 + /* 1137 + * On older chipsets, BM_RLD needs to be set 1138 + * in order for Bus Master activity to wake the 1139 + * system from C3. Newer chipsets handle DMA 1140 + * during C3 automatically and BM_RLD is a NOP. 1141 + * In either case, the proper way to 1142 + * handle BM_RLD is to set it and leave it set. 1143 + */ 1144 + acpi_set_register(ACPI_BITREG_BUS_MASTER_RLD, 1); 1145 1146 return; 1147 } ··· 1200 acpi_processor_get_power_info_default(pr); 1201 1202 pr->power.count = acpi_processor_power_verify(pr); 1203 1204 /* 1205 * if one state of type C2 or C3 is available, mark this ··· 1312 .release = single_release, 1313 }; 1314 1315 1316 /** 1317 * acpi_idle_bm_check - checks if bus master activity was detected ··· 1383 { 1384 u32 bm_status = 0; 1385 1386 + acpi_get_register_unlocked(ACPI_BITREG_BUS_MASTER_STATUS, &bm_status); 1387 if (bm_status) 1388 acpi_set_register(ACPI_BITREG_BUS_MASTER_STATUS, 1); 1389 /* ··· 1397 bm_status = 1; 1398 } 1399 return bm_status; 1400 } 1401 1402 /** ··· 1473 return 0; 1474 } 1475 1476 t1 = inl(acpi_gbl_FADT.xpm_timer_block.address); 1477 acpi_idle_do_entry(cx); 1478 t2 = inl(acpi_gbl_FADT.xpm_timer_block.address); ··· 1526 * access HPET ! 1527 */ 1528 acpi_state_timer_broadcast(pr, cx, 1); 1529 1530 if (cx->type == ACPI_STATE_C3) 1531 ACPI_FLUSH_CPU_CACHE(); ··· 1620 * access HPET ! 1621 */ 1622 acpi_state_timer_broadcast(pr, cx, 1); 1623 1624 /* 1625 * disable bus master ··· 1795 return ret; 1796 } 1797 1798 int __cpuinit acpi_processor_power_init(struct acpi_processor *pr, 1799 struct acpi_device *device) 1800 { ··· 1825 "ACPI: processor limited to max C-state %d\n", 1826 max_cstate); 1827 first_run++; 1828 } 1829 1830 if (!pr) ··· 1852 * platforms that only support C1. 1853 */ 1854 if (pr->flags.power) { 1855 acpi_processor_setup_cpuidle(pr); 1856 if (cpuidle_register_device(&pr->power.dev)) 1857 return -EIO; 1858 1859 printk(KERN_INFO PREFIX "CPU%d (power states:", pr->id); 1860 for (i = 1; i <= pr->power.count; i++) ··· 1864 printk(" C%d[C%d]", i, 1865 pr->power.states[i].type); 1866 printk(")\n"); 1867 } 1868 1869 /* 'power' [R] */ ··· 1889 if (boot_option_idle_override) 1890 return 0; 1891 1892 cpuidle_unregister_device(&pr->power.dev); 1893 pr->flags.power_setup_done = 0; 1894 1895 if (acpi_device_dir(device)) 1896 remove_proc_entry(ACPI_PROCESSOR_FILE_POWER, 1897 acpi_device_dir(device)); 1898 1899 return 0; 1900 }
-105
drivers/acpi/processor_perflib.c
··· 31 #include <linux/init.h> 32 #include <linux/cpufreq.h> 33 34 - #ifdef CONFIG_X86_ACPI_CPUFREQ_PROC_INTF 35 - #include <linux/proc_fs.h> 36 - #include <linux/seq_file.h> 37 - #include <linux/mutex.h> 38 - 39 - #include <asm/uaccess.h> 40 - #endif 41 - 42 #ifdef CONFIG_X86 43 #include <asm/cpufeature.h> 44 #endif ··· 426 427 EXPORT_SYMBOL(acpi_processor_notify_smm); 428 429 - #ifdef CONFIG_X86_ACPI_CPUFREQ_PROC_INTF 430 - /* /proc/acpi/processor/../performance interface (DEPRECATED) */ 431 - 432 - static int acpi_processor_perf_open_fs(struct inode *inode, struct file *file); 433 - static struct file_operations acpi_processor_perf_fops = { 434 - .owner = THIS_MODULE, 435 - .open = acpi_processor_perf_open_fs, 436 - .read = seq_read, 437 - .llseek = seq_lseek, 438 - .release = single_release, 439 - }; 440 - 441 - static int acpi_processor_perf_seq_show(struct seq_file *seq, void *offset) 442 - { 443 - struct acpi_processor *pr = seq->private; 444 - int i; 445 - 446 - 447 - if (!pr) 448 - goto end; 449 - 450 - if (!pr->performance) { 451 - seq_puts(seq, "<not supported>\n"); 452 - goto end; 453 - } 454 - 455 - seq_printf(seq, "state count: %d\n" 456 - "active state: P%d\n", 457 - pr->performance->state_count, pr->performance->state); 458 - 459 - seq_puts(seq, "states:\n"); 460 - for (i = 0; i < pr->performance->state_count; i++) 461 - seq_printf(seq, 462 - " %cP%d: %d MHz, %d mW, %d uS\n", 463 - (i == pr->performance->state ? '*' : ' '), i, 464 - (u32) pr->performance->states[i].core_frequency, 465 - (u32) pr->performance->states[i].power, 466 - (u32) pr->performance->states[i].transition_latency); 467 - 468 - end: 469 - return 0; 470 - } 471 - 472 - static int acpi_processor_perf_open_fs(struct inode *inode, struct file *file) 473 - { 474 - return single_open(file, acpi_processor_perf_seq_show, 475 - PDE(inode)->data); 476 - } 477 - 478 - static void acpi_cpufreq_add_file(struct acpi_processor *pr) 479 - { 480 - struct acpi_device *device = NULL; 481 - 482 - 483 - if (acpi_bus_get_device(pr->handle, &device)) 484 - return; 485 - 486 - /* add file 'performance' [R/W] */ 487 - proc_create_data(ACPI_PROCESSOR_FILE_PERFORMANCE, S_IFREG | S_IRUGO, 488 - acpi_device_dir(device), 489 - &acpi_processor_perf_fops, acpi_driver_data(device)); 490 - return; 491 - } 492 - 493 - static void acpi_cpufreq_remove_file(struct acpi_processor *pr) 494 - { 495 - struct acpi_device *device = NULL; 496 - 497 - 498 - if (acpi_bus_get_device(pr->handle, &device)) 499 - return; 500 - 501 - /* remove file 'performance' */ 502 - remove_proc_entry(ACPI_PROCESSOR_FILE_PERFORMANCE, 503 - acpi_device_dir(device)); 504 - 505 - return; 506 - } 507 - 508 - #else 509 - static void acpi_cpufreq_add_file(struct acpi_processor *pr) 510 - { 511 - return; 512 - } 513 - static void acpi_cpufreq_remove_file(struct acpi_processor *pr) 514 - { 515 - return; 516 - } 517 - #endif /* CONFIG_X86_ACPI_CPUFREQ_PROC_INTF */ 518 - 519 static int acpi_processor_get_psd(struct acpi_processor *pr) 520 { 521 int result = 0; ··· 649 } 650 EXPORT_SYMBOL(acpi_processor_preregister_performance); 651 652 - 653 int 654 acpi_processor_register_performance(struct acpi_processor_performance 655 *performance, unsigned int cpu) 656 { 657 struct acpi_processor *pr; 658 - 659 660 if (!(acpi_processor_ppc_status & PPC_REGISTERED)) 661 return -EINVAL; ··· 681 return -EIO; 682 } 683 684 - acpi_cpufreq_add_file(pr); 685 - 686 mutex_unlock(&performance_mutex); 687 return 0; 688 } ··· 693 { 694 struct acpi_processor *pr; 695 696 - 697 mutex_lock(&performance_mutex); 698 699 pr = per_cpu(processors, cpu); ··· 704 if (pr->performance) 705 kfree(pr->performance->states); 706 pr->performance = NULL; 707 - 708 - acpi_cpufreq_remove_file(pr); 709 710 mutex_unlock(&performance_mutex); 711
··· 31 #include <linux/init.h> 32 #include <linux/cpufreq.h> 33 34 #ifdef CONFIG_X86 35 #include <asm/cpufeature.h> 36 #endif ··· 434 435 EXPORT_SYMBOL(acpi_processor_notify_smm); 436 437 static int acpi_processor_get_psd(struct acpi_processor *pr) 438 { 439 int result = 0; ··· 747 } 748 EXPORT_SYMBOL(acpi_processor_preregister_performance); 749 750 int 751 acpi_processor_register_performance(struct acpi_processor_performance 752 *performance, unsigned int cpu) 753 { 754 struct acpi_processor *pr; 755 756 if (!(acpi_processor_ppc_status & PPC_REGISTERED)) 757 return -EINVAL; ··· 781 return -EIO; 782 } 783 784 mutex_unlock(&performance_mutex); 785 return 0; 786 } ··· 795 { 796 struct acpi_processor *pr; 797 798 mutex_lock(&performance_mutex); 799 800 pr = per_cpu(processors, cpu); ··· 807 if (pr->performance) 808 kfree(pr->performance->states); 809 pr->performance = NULL; 810 811 mutex_unlock(&performance_mutex); 812
+27 -26
drivers/acpi/sleep.c
··· 90 old_suspend_ordering = true; 91 } 92 93 - /* 94 - * According to the ACPI specification the BIOS should make sure that ACPI is 95 - * enabled and SCI_EN bit is set on wake-up from S1 - S3 sleep states. Still, 96 - * some BIOSes don't do that and therefore we use acpi_enable() to enable ACPI 97 - * on such systems during resume. Unfortunately that doesn't help in 98 - * particularly pathological cases in which SCI_EN has to be set directly on 99 - * resume, although the specification states very clearly that this flag is 100 - * owned by the hardware. The set_sci_en_on_resume variable will be set in such 101 - * cases. 102 - */ 103 - static bool set_sci_en_on_resume; 104 - /* 105 - * The ACPI specification wants us to save NVS memory regions during hibernation 106 - * and to restore them during the subsequent resume. However, it is not certain 107 - * if this mechanism is going to work on all machines, so we allow the user to 108 - * disable this mechanism using the 'acpi_sleep=s4_nonvs' kernel command line 109 - * option. 110 - */ 111 - static bool s4_no_nvs; 112 - 113 - void __init acpi_s4_no_nvs(void) 114 - { 115 - s4_no_nvs = true; 116 - } 117 - 118 /** 119 * acpi_pm_disable_gpes - Disable the GPEs. 120 */ ··· 168 #endif /* CONFIG_ACPI_SLEEP */ 169 170 #ifdef CONFIG_SUSPEND 171 extern void do_suspend_lowlevel(void); 172 173 static u32 acpi_suspend_states[] = { ··· 383 #endif /* CONFIG_SUSPEND */ 384 385 #ifdef CONFIG_HIBERNATION 386 static unsigned long s4_hardware_signature; 387 static struct acpi_table_facs *facs; 388 static bool nosigcheck; ··· 680 static void acpi_power_off(void) 681 { 682 /* acpi_sleep_prepare(ACPI_STATE_S5) should have already been called */ 683 - printk("%s called\n", __func__); 684 local_irq_disable(); 685 acpi_enable_wakeup_device(ACPI_STATE_S5); 686 acpi_enter_sleep_state(ACPI_STATE_S5);
··· 90 old_suspend_ordering = true; 91 } 92 93 /** 94 * acpi_pm_disable_gpes - Disable the GPEs. 95 */ ··· 193 #endif /* CONFIG_ACPI_SLEEP */ 194 195 #ifdef CONFIG_SUSPEND 196 + /* 197 + * According to the ACPI specification the BIOS should make sure that ACPI is 198 + * enabled and SCI_EN bit is set on wake-up from S1 - S3 sleep states. Still, 199 + * some BIOSes don't do that and therefore we use acpi_enable() to enable ACPI 200 + * on such systems during resume. Unfortunately that doesn't help in 201 + * particularly pathological cases in which SCI_EN has to be set directly on 202 + * resume, although the specification states very clearly that this flag is 203 + * owned by the hardware. The set_sci_en_on_resume variable will be set in such 204 + * cases. 205 + */ 206 + static bool set_sci_en_on_resume; 207 + 208 extern void do_suspend_lowlevel(void); 209 210 static u32 acpi_suspend_states[] = { ··· 396 #endif /* CONFIG_SUSPEND */ 397 398 #ifdef CONFIG_HIBERNATION 399 + /* 400 + * The ACPI specification wants us to save NVS memory regions during hibernation 401 + * and to restore them during the subsequent resume. However, it is not certain 402 + * if this mechanism is going to work on all machines, so we allow the user to 403 + * disable this mechanism using the 'acpi_sleep=s4_nonvs' kernel command line 404 + * option. 405 + */ 406 + static bool s4_no_nvs; 407 + 408 + void __init acpi_s4_no_nvs(void) 409 + { 410 + s4_no_nvs = true; 411 + } 412 + 413 static unsigned long s4_hardware_signature; 414 static struct acpi_table_facs *facs; 415 static bool nosigcheck; ··· 679 static void acpi_power_off(void) 680 { 681 /* acpi_sleep_prepare(ACPI_STATE_S5) should have already been called */ 682 + printk(KERN_DEBUG "%s called\n", __func__); 683 local_irq_disable(); 684 acpi_enable_wakeup_device(ACPI_STATE_S5); 685 acpi_enter_sleep_state(ACPI_STATE_S5);
+6 -1
drivers/acpi/tables.c
··· 293 294 int __init acpi_table_init(void) 295 { 296 - acpi_initialize_tables(initial_tables, ACPI_MAX_TABLES, 0); 297 check_multiple_madt(); 298 return 0; 299 }
··· 293 294 int __init acpi_table_init(void) 295 { 296 + acpi_status status; 297 + 298 + status = acpi_initialize_tables(initial_tables, ACPI_MAX_TABLES, 0); 299 + if (ACPI_FAILURE(status)) 300 + return 1; 301 + 302 check_multiple_madt(); 303 return 0; 304 }
+11 -5
drivers/acpi/video.c
··· 1020 } 1021 1022 seq_printf(seq, "levels: "); 1023 - for (i = 0; i < dev->brightness->count; i++) 1024 seq_printf(seq, " %d", dev->brightness->levels[i]); 1025 seq_printf(seq, "\ncurrent: %d\n", dev->brightness->curr); 1026 ··· 1059 return -EFAULT; 1060 1061 /* validate through the list of available levels */ 1062 - for (i = 0; i < dev->brightness->count; i++) 1063 if (level == dev->brightness->levels[i]) { 1064 if (ACPI_SUCCESS 1065 (acpi_video_device_lcd_set_level(dev, level))) ··· 1260 printk(KERN_WARNING PREFIX 1261 "This indicates a BIOS bug. Please contact the manufacturer.\n"); 1262 } 1263 - printk("%llx\n", options); 1264 seq_printf(seq, "can POST: <integrated video>"); 1265 if (options & 2) 1266 seq_printf(seq, " <PCI video>"); ··· 1712 max = max_below = 0; 1713 min = min_above = 255; 1714 /* Find closest level to level_current */ 1715 - for (i = 0; i < device->brightness->count; i++) { 1716 l = device->brightness->levels[i]; 1717 if (abs(l - level_current) < abs(delta)) { 1718 delta = l - level_current; ··· 1722 } 1723 /* Ajust level_current to closest available level */ 1724 level_current += delta; 1725 - for (i = 0; i < device->brightness->count; i++) { 1726 l = device->brightness->levels[i]; 1727 if (l < min) 1728 min = l; ··· 2005 if (instance) 2006 device->pnp.bus_id[3] = '0' + instance; 2007 instance ++; 2008 } 2009 2010 video->device = device;
··· 1020 } 1021 1022 seq_printf(seq, "levels: "); 1023 + for (i = 2; i < dev->brightness->count; i++) 1024 seq_printf(seq, " %d", dev->brightness->levels[i]); 1025 seq_printf(seq, "\ncurrent: %d\n", dev->brightness->curr); 1026 ··· 1059 return -EFAULT; 1060 1061 /* validate through the list of available levels */ 1062 + for (i = 2; i < dev->brightness->count; i++) 1063 if (level == dev->brightness->levels[i]) { 1064 if (ACPI_SUCCESS 1065 (acpi_video_device_lcd_set_level(dev, level))) ··· 1260 printk(KERN_WARNING PREFIX 1261 "This indicates a BIOS bug. Please contact the manufacturer.\n"); 1262 } 1263 + printk(KERN_WARNING "%llx\n", options); 1264 seq_printf(seq, "can POST: <integrated video>"); 1265 if (options & 2) 1266 seq_printf(seq, " <PCI video>"); ··· 1712 max = max_below = 0; 1713 min = min_above = 255; 1714 /* Find closest level to level_current */ 1715 + for (i = 2; i < device->brightness->count; i++) { 1716 l = device->brightness->levels[i]; 1717 if (abs(l - level_current) < abs(delta)) { 1718 delta = l - level_current; ··· 1722 } 1723 /* Ajust level_current to closest available level */ 1724 level_current += delta; 1725 + for (i = 2; i < device->brightness->count; i++) { 1726 l = device->brightness->levels[i]; 1727 if (l < min) 1728 min = l; ··· 2005 if (instance) 2006 device->pnp.bus_id[3] = '0' + instance; 2007 instance ++; 2008 + } 2009 + /* a hack to fix the duplicate name "VGA" problem on Pa 3553 */ 2010 + if (!strcmp(device->pnp.bus_id, "VGA")) { 2011 + if (instance) 2012 + device->pnp.bus_id[3] = '0' + instance; 2013 + instance++; 2014 } 2015 2016 video->device = device;
+1
drivers/platform/x86/Kconfig
··· 42 depends on LEDS_CLASS 43 depends on NEW_LEDS 44 depends on BACKLIGHT_CLASS_DEVICE 45 ---help--- 46 This is the new Linux driver for Asus laptops. It may also support some 47 MEDION, JVC or VICTOR laptops. It makes all the extra buttons generate
··· 42 depends on LEDS_CLASS 43 depends on NEW_LEDS 44 depends on BACKLIGHT_CLASS_DEVICE 45 + depends on INPUT 46 ---help--- 47 This is the new Linux driver for Asus laptops. It may also support some 48 MEDION, JVC or VICTOR laptops. It makes all the extra buttons generate
+164 -10
drivers/platform/x86/asus-laptop.c
··· 46 #include <acpi/acpi_drivers.h> 47 #include <acpi/acpi_bus.h> 48 #include <asm/uaccess.h> 49 50 #define ASUS_LAPTOP_VERSION "0.42" 51 ··· 182 u8 light_level; //light sensor level 183 u8 light_switch; //light sensor switch value 184 u16 event_count[128]; //count for each event TODO make this better 185 }; 186 187 /* ··· 252 ASUS_LED(rled, "record"); 253 ASUS_LED(pled, "phone"); 254 ASUS_LED(gled, "gaming"); 255 256 /* 257 * This function evaluates an ACPI method, given an int as parameter, the ··· 754 return store_status(buf, count, NULL, GPS_ON); 755 } 756 757 static void asus_hotk_notify(acpi_handle handle, u32 event, void *data) 758 { 759 /* TODO Find a better way to handle events count. */ 760 if (!hotk) 761 return; ··· 832 lcd_blank(FB_BLANK_POWERDOWN); 833 } 834 835 - acpi_bus_generate_proc_event(hotk->device, event, 836 - hotk->event_count[event % 128]++); 837 838 - return; 839 } 840 841 #define ASUS_CREATE_DEVICE_ATTR(_name) \ ··· 1067 return AE_OK; 1068 } 1069 1070 static int asus_hotk_check(void) 1071 { 1072 int result = 0; ··· 1184 /* GPS is on by default */ 1185 write_status(NULL, 1, GPS_ON); 1186 1187 - end: 1188 if (result) { 1189 kfree(hotk->name); 1190 kfree(hotk); ··· 1231 ASUS_LED_UNREGISTER(gled); 1232 } 1233 1234 static void __exit asus_laptop_exit(void) 1235 { 1236 asus_backlight_exit(); 1237 asus_led_exit(); 1238 1239 acpi_bus_unregister_driver(&asus_hotk_driver); 1240 sysfs_remove_group(&asuspf_device->dev.kobj, &asuspf_attribute_group); ··· 1363 printk(ASUS_INFO "Brightness ignored, must be controlled by " 1364 "ACPI video driver\n"); 1365 1366 result = asus_led_init(dev); 1367 if (result) 1368 goto fail_led; ··· 1393 1394 return 0; 1395 1396 - fail_sysfs: 1397 platform_device_del(asuspf_device); 1398 1399 - fail_platform_device2: 1400 platform_device_put(asuspf_device); 1401 1402 - fail_platform_device1: 1403 platform_driver_unregister(&asuspf_driver); 1404 1405 - fail_platform_driver: 1406 asus_led_exit(); 1407 1408 - fail_led: 1409 asus_backlight_exit(); 1410 1411 - fail_backlight: 1412 1413 return result; 1414 }
··· 46 #include <acpi/acpi_drivers.h> 47 #include <acpi/acpi_bus.h> 48 #include <asm/uaccess.h> 49 + #include <linux/input.h> 50 51 #define ASUS_LAPTOP_VERSION "0.42" 52 ··· 181 u8 light_level; //light sensor level 182 u8 light_switch; //light sensor switch value 183 u16 event_count[128]; //count for each event TODO make this better 184 + struct input_dev *inputdev; 185 + u16 *keycode_map; 186 }; 187 188 /* ··· 249 ASUS_LED(rled, "record"); 250 ASUS_LED(pled, "phone"); 251 ASUS_LED(gled, "gaming"); 252 + 253 + struct key_entry { 254 + char type; 255 + u8 code; 256 + u16 keycode; 257 + }; 258 + 259 + enum { KE_KEY, KE_END }; 260 + 261 + static struct key_entry asus_keymap[] = { 262 + {KE_KEY, 0x30, KEY_VOLUMEUP}, 263 + {KE_KEY, 0x31, KEY_VOLUMEDOWN}, 264 + {KE_KEY, 0x32, KEY_MUTE}, 265 + {KE_KEY, 0x33, KEY_SWITCHVIDEOMODE}, 266 + {KE_KEY, 0x34, KEY_SWITCHVIDEOMODE}, 267 + {KE_KEY, 0x40, KEY_PREVIOUSSONG}, 268 + {KE_KEY, 0x41, KEY_NEXTSONG}, 269 + {KE_KEY, 0x43, KEY_STOP}, 270 + {KE_KEY, 0x45, KEY_PLAYPAUSE}, 271 + {KE_KEY, 0x50, KEY_EMAIL}, 272 + {KE_KEY, 0x51, KEY_WWW}, 273 + {KE_KEY, 0x5C, BTN_EXTRA}, /* Performance */ 274 + {KE_KEY, 0x5D, KEY_WLAN}, 275 + {KE_KEY, 0x61, KEY_SWITCHVIDEOMODE}, 276 + {KE_KEY, 0x6B, BTN_TOUCH}, /* Lock Mouse */ 277 + {KE_KEY, 0x82, KEY_CAMERA}, 278 + {KE_KEY, 0x8A, KEY_TV}, 279 + {KE_KEY, 0x95, KEY_MEDIA}, 280 + {KE_KEY, 0x99, KEY_PHONE}, 281 + {KE_END, 0}, 282 + }; 283 284 /* 285 * This function evaluates an ACPI method, given an int as parameter, the ··· 720 return store_status(buf, count, NULL, GPS_ON); 721 } 722 723 + /* 724 + * Hotkey functions 725 + */ 726 + static struct key_entry *asus_get_entry_by_scancode(int code) 727 + { 728 + struct key_entry *key; 729 + 730 + for (key = asus_keymap; key->type != KE_END; key++) 731 + if (code == key->code) 732 + return key; 733 + 734 + return NULL; 735 + } 736 + 737 + static struct key_entry *asus_get_entry_by_keycode(int code) 738 + { 739 + struct key_entry *key; 740 + 741 + for (key = asus_keymap; key->type != KE_END; key++) 742 + if (code == key->keycode && key->type == KE_KEY) 743 + return key; 744 + 745 + return NULL; 746 + } 747 + 748 + static int asus_getkeycode(struct input_dev *dev, int scancode, int *keycode) 749 + { 750 + struct key_entry *key = asus_get_entry_by_scancode(scancode); 751 + 752 + if (key && key->type == KE_KEY) { 753 + *keycode = key->keycode; 754 + return 0; 755 + } 756 + 757 + return -EINVAL; 758 + } 759 + 760 + static int asus_setkeycode(struct input_dev *dev, int scancode, int keycode) 761 + { 762 + struct key_entry *key; 763 + int old_keycode; 764 + 765 + if (keycode < 0 || keycode > KEY_MAX) 766 + return -EINVAL; 767 + 768 + key = asus_get_entry_by_scancode(scancode); 769 + if (key && key->type == KE_KEY) { 770 + old_keycode = key->keycode; 771 + key->keycode = keycode; 772 + set_bit(keycode, dev->keybit); 773 + if (!asus_get_entry_by_keycode(old_keycode)) 774 + clear_bit(old_keycode, dev->keybit); 775 + return 0; 776 + } 777 + 778 + return -EINVAL; 779 + } 780 + 781 static void asus_hotk_notify(acpi_handle handle, u32 event, void *data) 782 { 783 + static struct key_entry *key; 784 + 785 /* TODO Find a better way to handle events count. */ 786 if (!hotk) 787 return; ··· 738 lcd_blank(FB_BLANK_POWERDOWN); 739 } 740 741 + acpi_bus_generate_netlink_event(hotk->device->pnp.device_class, 742 + dev_name(&hotk->device->dev), event, 743 + hotk->event_count[event % 128]++); 744 745 + if (hotk->inputdev) { 746 + key = asus_get_entry_by_scancode(event); 747 + if (!key) 748 + return ; 749 + 750 + switch (key->type) { 751 + case KE_KEY: 752 + input_report_key(hotk->inputdev, key->keycode, 1); 753 + input_sync(hotk->inputdev); 754 + input_report_key(hotk->inputdev, key->keycode, 0); 755 + input_sync(hotk->inputdev); 756 + break; 757 + } 758 + } 759 } 760 761 #define ASUS_CREATE_DEVICE_ATTR(_name) \ ··· 959 return AE_OK; 960 } 961 962 + static int asus_input_init(void) 963 + { 964 + const struct key_entry *key; 965 + int result; 966 + 967 + hotk->inputdev = input_allocate_device(); 968 + if (!hotk->inputdev) { 969 + printk(ASUS_INFO "Unable to allocate input device\n"); 970 + return 0; 971 + } 972 + hotk->inputdev->name = "Asus Laptop extra buttons"; 973 + hotk->inputdev->phys = ASUS_HOTK_FILE "/input0"; 974 + hotk->inputdev->id.bustype = BUS_HOST; 975 + hotk->inputdev->getkeycode = asus_getkeycode; 976 + hotk->inputdev->setkeycode = asus_setkeycode; 977 + 978 + for (key = asus_keymap; key->type != KE_END; key++) { 979 + switch (key->type) { 980 + case KE_KEY: 981 + set_bit(EV_KEY, hotk->inputdev->evbit); 982 + set_bit(key->keycode, hotk->inputdev->keybit); 983 + break; 984 + } 985 + } 986 + result = input_register_device(hotk->inputdev); 987 + if (result) { 988 + printk(ASUS_INFO "Unable to register input device\n"); 989 + input_free_device(hotk->inputdev); 990 + } 991 + return result; 992 + } 993 + 994 static int asus_hotk_check(void) 995 { 996 int result = 0; ··· 1044 /* GPS is on by default */ 1045 write_status(NULL, 1, GPS_ON); 1046 1047 + end: 1048 if (result) { 1049 kfree(hotk->name); 1050 kfree(hotk); ··· 1091 ASUS_LED_UNREGISTER(gled); 1092 } 1093 1094 + static void asus_input_exit(void) 1095 + { 1096 + if (hotk->inputdev) 1097 + input_unregister_device(hotk->inputdev); 1098 + } 1099 + 1100 static void __exit asus_laptop_exit(void) 1101 { 1102 asus_backlight_exit(); 1103 asus_led_exit(); 1104 + asus_input_exit(); 1105 1106 acpi_bus_unregister_driver(&asus_hotk_driver); 1107 sysfs_remove_group(&asuspf_device->dev.kobj, &asuspf_attribute_group); ··· 1216 printk(ASUS_INFO "Brightness ignored, must be controlled by " 1217 "ACPI video driver\n"); 1218 1219 + result = asus_input_init(); 1220 + if (result) 1221 + goto fail_input; 1222 + 1223 result = asus_led_init(dev); 1224 if (result) 1225 goto fail_led; ··· 1242 1243 return 0; 1244 1245 + fail_sysfs: 1246 platform_device_del(asuspf_device); 1247 1248 + fail_platform_device2: 1249 platform_device_put(asuspf_device); 1250 1251 + fail_platform_device1: 1252 platform_driver_unregister(&asuspf_driver); 1253 1254 + fail_platform_driver: 1255 asus_led_exit(); 1256 1257 + fail_led: 1258 + asus_input_exit(); 1259 + 1260 + fail_input: 1261 asus_backlight_exit(); 1262 1263 + fail_backlight: 1264 1265 return result; 1266 }
+15 -1
drivers/platform/x86/asus_acpi.c
··· 143 S1300N, S5200N*/ 144 A4S, /* Z81sp */ 145 F3Sa, /* (Centrino) */ 146 END_MODEL 147 } model; /* Models currently supported */ 148 u16 event_count[128]; /* Count for each event TODO make this better */ ··· 421 .display_get = "\\ADVG", 422 .display_set = "SDSP", 423 }, 424 - 425 }; 426 427 /* procdir we use */ ··· 1177 return W3V; 1178 else if (strncmp(model, "W5A", 3) == 0) 1179 return W5A; 1180 else if (strncmp(model, "A4S", 3) == 0) 1181 return A4S; 1182 else if (strncmp(model, "F3Sa", 4) == 0)
··· 143 S1300N, S5200N*/ 144 A4S, /* Z81sp */ 145 F3Sa, /* (Centrino) */ 146 + R1F, 147 END_MODEL 148 } model; /* Models currently supported */ 149 u16 event_count[128]; /* Count for each event TODO make this better */ ··· 420 .display_get = "\\ADVG", 421 .display_set = "SDSP", 422 }, 423 + { 424 + .name = "R1F", 425 + .mt_bt_switch = "BLED", 426 + .mt_mled = "MLED", 427 + .mt_wled = "WLED", 428 + .mt_lcd_switch = "\\Q10", 429 + .lcd_status = "\\GP06", 430 + .brightness_set = "SPLV", 431 + .brightness_get = "GPLV", 432 + .display_set = "SDSP", 433 + .display_get = "\\INFB" 434 + } 435 }; 436 437 /* procdir we use */ ··· 1165 return W3V; 1166 else if (strncmp(model, "W5A", 3) == 0) 1167 return W5A; 1168 + else if (strncmp(model, "R1F", 3) == 0) 1169 + return R1F; 1170 else if (strncmp(model, "A4S", 3) == 0) 1171 return A4S; 1172 else if (strncmp(model, "F3Sa", 4) == 0)
+144 -20
drivers/platform/x86/eeepc-laptop.c
··· 30 #include <linux/uaccess.h> 31 #include <linux/input.h> 32 #include <linux/rfkill.h> 33 34 #define EEEPC_LAPTOP_VERSION "0.1" 35 ··· 162 {KE_KEY, 0x13, KEY_MUTE }, 163 {KE_KEY, 0x14, KEY_VOLUMEDOWN }, 164 {KE_KEY, 0x15, KEY_VOLUMEUP }, 165 {KE_KEY, 0x30, KEY_SWITCHVIDEOMODE }, 166 {KE_KEY, 0x31, KEY_SWITCHVIDEOMODE }, 167 {KE_KEY, 0x32, KEY_SWITCHVIDEOMODE }, ··· 515 static void notify_brn(void) 516 { 517 struct backlight_device *bd = eeepc_backlight_device; 518 - bd->props.brightness = read_brightness(bd); 519 } 520 521 static void eeepc_hotk_notify(acpi_handle handle, u32 event, void *data) ··· 561 return; 562 if (event >= NOTIFY_BRN_MIN && event <= NOTIFY_BRN_MAX) 563 notify_brn(); 564 - acpi_bus_generate_proc_event(ehotk->device, event, 565 - ehotk->event_count[event % 128]++); 566 if (ehotk->inputdev) { 567 key = eepc_get_entry_by_scancode(event); 568 if (key) { ··· 578 break; 579 } 580 } 581 } 582 } 583 ··· 639 ehotk->device = device; 640 result = eeepc_hotk_check(); 641 if (result) 642 - goto end; 643 status = acpi_install_notify_handler(ehotk->handle, ACPI_SYSTEM_NOTIFY, 644 eeepc_hotk_notify, ehotk); 645 if (ACPI_FAILURE(status)) ··· 650 RFKILL_TYPE_WLAN); 651 652 if (!ehotk->eeepc_wlan_rfkill) 653 - goto end; 654 655 ehotk->eeepc_wlan_rfkill->name = "eeepc-wlan"; 656 ehotk->eeepc_wlan_rfkill->toggle_radio = eeepc_wlan_rfkill_set; 657 ehotk->eeepc_wlan_rfkill->get_state = eeepc_wlan_rfkill_state; 658 - if (get_acpi(CM_ASL_WLAN) == 1) 659 ehotk->eeepc_wlan_rfkill->state = 660 RFKILL_STATE_UNBLOCKED; 661 - else 662 ehotk->eeepc_wlan_rfkill->state = 663 RFKILL_STATE_SOFT_BLOCKED; 664 - rfkill_register(ehotk->eeepc_wlan_rfkill); 665 } 666 667 if (get_acpi(CM_ASL_BLUETOOTH) != -1) { ··· 676 rfkill_allocate(&device->dev, RFKILL_TYPE_BLUETOOTH); 677 678 if (!ehotk->eeepc_bluetooth_rfkill) 679 - goto end; 680 681 ehotk->eeepc_bluetooth_rfkill->name = "eeepc-bluetooth"; 682 ehotk->eeepc_bluetooth_rfkill->toggle_radio = 683 eeepc_bluetooth_rfkill_set; 684 ehotk->eeepc_bluetooth_rfkill->get_state = 685 eeepc_bluetooth_rfkill_state; 686 - if (get_acpi(CM_ASL_BLUETOOTH) == 1) 687 ehotk->eeepc_bluetooth_rfkill->state = 688 RFKILL_STATE_UNBLOCKED; 689 - else 690 ehotk->eeepc_bluetooth_rfkill->state = 691 RFKILL_STATE_SOFT_BLOCKED; 692 - rfkill_register(ehotk->eeepc_bluetooth_rfkill); 693 } 694 695 - end: 696 - if (result) { 697 - kfree(ehotk); 698 - ehotk = NULL; 699 - } 700 return result; 701 } 702 ··· 730 eeepc_hotk_notify); 731 if (ACPI_FAILURE(status)) 732 printk(EEEPC_ERR "Error removing notify handler\n"); 733 kfree(ehotk); 734 return 0; 735 } ··· 849 { 850 if (eeepc_backlight_device) 851 backlight_device_unregister(eeepc_backlight_device); 852 - if (ehotk->inputdev) 853 - input_unregister_device(ehotk->inputdev); 854 if (ehotk->eeepc_wlan_rfkill) 855 rfkill_unregister(ehotk->eeepc_wlan_rfkill); 856 if (ehotk->eeepc_bluetooth_rfkill) 857 rfkill_unregister(ehotk->eeepc_bluetooth_rfkill); 858 - eeepc_backlight_device = NULL; 859 } 860 861 static void eeepc_hwmon_exit(void) ··· 882 static void __exit eeepc_laptop_exit(void) 883 { 884 eeepc_backlight_exit(); 885 eeepc_hwmon_exit(); 886 acpi_bus_unregister_driver(&eeepc_hotk_driver); 887 sysfs_remove_group(&platform_device->dev.kobj, ··· 987 fail_hwmon: 988 eeepc_backlight_exit(); 989 fail_backlight: 990 return result; 991 } 992
··· 30 #include <linux/uaccess.h> 31 #include <linux/input.h> 32 #include <linux/rfkill.h> 33 + #include <linux/pci.h> 34 35 #define EEEPC_LAPTOP_VERSION "0.1" 36 ··· 161 {KE_KEY, 0x13, KEY_MUTE }, 162 {KE_KEY, 0x14, KEY_VOLUMEDOWN }, 163 {KE_KEY, 0x15, KEY_VOLUMEUP }, 164 + {KE_KEY, 0x1a, KEY_COFFEE }, 165 + {KE_KEY, 0x1b, KEY_ZOOM }, 166 + {KE_KEY, 0x1c, KEY_PROG2 }, 167 + {KE_KEY, 0x1d, KEY_PROG3 }, 168 {KE_KEY, 0x30, KEY_SWITCHVIDEOMODE }, 169 {KE_KEY, 0x31, KEY_SWITCHVIDEOMODE }, 170 {KE_KEY, 0x32, KEY_SWITCHVIDEOMODE }, ··· 510 static void notify_brn(void) 511 { 512 struct backlight_device *bd = eeepc_backlight_device; 513 + if (bd) 514 + bd->props.brightness = read_brightness(bd); 515 + } 516 + 517 + static void eeepc_rfkill_notify(acpi_handle handle, u32 event, void *data) 518 + { 519 + struct pci_dev *dev; 520 + struct pci_bus *bus = pci_find_bus(0, 1); 521 + 522 + if (event != ACPI_NOTIFY_BUS_CHECK) 523 + return; 524 + 525 + if (!bus) { 526 + printk(EEEPC_WARNING "Unable to find PCI bus 1?\n"); 527 + return; 528 + } 529 + 530 + if (get_acpi(CM_ASL_WLAN) == 1) { 531 + dev = pci_get_slot(bus, 0); 532 + if (dev) { 533 + /* Device already present */ 534 + pci_dev_put(dev); 535 + return; 536 + } 537 + dev = pci_scan_single_device(bus, 0); 538 + if (dev) { 539 + pci_bus_assign_resources(bus); 540 + if (pci_bus_add_device(dev)) 541 + printk(EEEPC_ERR "Unable to hotplug wifi\n"); 542 + } 543 + } else { 544 + dev = pci_get_slot(bus, 0); 545 + if (dev) { 546 + pci_remove_bus_device(dev); 547 + pci_dev_put(dev); 548 + } 549 + } 550 } 551 552 static void eeepc_hotk_notify(acpi_handle handle, u32 event, void *data) ··· 520 return; 521 if (event >= NOTIFY_BRN_MIN && event <= NOTIFY_BRN_MAX) 522 notify_brn(); 523 + acpi_bus_generate_netlink_event(ehotk->device->pnp.device_class, 524 + dev_name(&ehotk->device->dev), event, 525 + ehotk->event_count[event % 128]++); 526 if (ehotk->inputdev) { 527 key = eepc_get_entry_by_scancode(event); 528 if (key) { ··· 536 break; 537 } 538 } 539 + } 540 + } 541 + 542 + static int eeepc_register_rfkill_notifier(char *node) 543 + { 544 + acpi_status status = AE_OK; 545 + acpi_handle handle; 546 + 547 + status = acpi_get_handle(NULL, node, &handle); 548 + 549 + if (ACPI_SUCCESS(status)) { 550 + status = acpi_install_notify_handler(handle, 551 + ACPI_SYSTEM_NOTIFY, 552 + eeepc_rfkill_notify, 553 + NULL); 554 + if (ACPI_FAILURE(status)) 555 + printk(EEEPC_WARNING 556 + "Failed to register notify on %s\n", node); 557 + } else 558 + return -ENODEV; 559 + 560 + return 0; 561 + } 562 + 563 + static void eeepc_unregister_rfkill_notifier(char *node) 564 + { 565 + acpi_status status = AE_OK; 566 + acpi_handle handle; 567 + 568 + status = acpi_get_handle(NULL, node, &handle); 569 + 570 + if (ACPI_SUCCESS(status)) { 571 + status = acpi_remove_notify_handler(handle, 572 + ACPI_SYSTEM_NOTIFY, 573 + eeepc_rfkill_notify); 574 + if (ACPI_FAILURE(status)) 575 + printk(EEEPC_ERR 576 + "Error removing rfkill notify handler %s\n", 577 + node); 578 } 579 } 580 ··· 558 ehotk->device = device; 559 result = eeepc_hotk_check(); 560 if (result) 561 + goto ehotk_fail; 562 status = acpi_install_notify_handler(ehotk->handle, ACPI_SYSTEM_NOTIFY, 563 eeepc_hotk_notify, ehotk); 564 if (ACPI_FAILURE(status)) ··· 569 RFKILL_TYPE_WLAN); 570 571 if (!ehotk->eeepc_wlan_rfkill) 572 + goto wlan_fail; 573 574 ehotk->eeepc_wlan_rfkill->name = "eeepc-wlan"; 575 ehotk->eeepc_wlan_rfkill->toggle_radio = eeepc_wlan_rfkill_set; 576 ehotk->eeepc_wlan_rfkill->get_state = eeepc_wlan_rfkill_state; 577 + if (get_acpi(CM_ASL_WLAN) == 1) { 578 ehotk->eeepc_wlan_rfkill->state = 579 RFKILL_STATE_UNBLOCKED; 580 + rfkill_set_default(RFKILL_TYPE_WLAN, 581 + RFKILL_STATE_UNBLOCKED); 582 + } else { 583 ehotk->eeepc_wlan_rfkill->state = 584 RFKILL_STATE_SOFT_BLOCKED; 585 + rfkill_set_default(RFKILL_TYPE_WLAN, 586 + RFKILL_STATE_SOFT_BLOCKED); 587 + } 588 + result = rfkill_register(ehotk->eeepc_wlan_rfkill); 589 + if (result) 590 + goto wlan_fail; 591 } 592 593 if (get_acpi(CM_ASL_BLUETOOTH) != -1) { ··· 588 rfkill_allocate(&device->dev, RFKILL_TYPE_BLUETOOTH); 589 590 if (!ehotk->eeepc_bluetooth_rfkill) 591 + goto bluetooth_fail; 592 593 ehotk->eeepc_bluetooth_rfkill->name = "eeepc-bluetooth"; 594 ehotk->eeepc_bluetooth_rfkill->toggle_radio = 595 eeepc_bluetooth_rfkill_set; 596 ehotk->eeepc_bluetooth_rfkill->get_state = 597 eeepc_bluetooth_rfkill_state; 598 + if (get_acpi(CM_ASL_BLUETOOTH) == 1) { 599 ehotk->eeepc_bluetooth_rfkill->state = 600 RFKILL_STATE_UNBLOCKED; 601 + rfkill_set_default(RFKILL_TYPE_BLUETOOTH, 602 + RFKILL_STATE_UNBLOCKED); 603 + } else { 604 ehotk->eeepc_bluetooth_rfkill->state = 605 RFKILL_STATE_SOFT_BLOCKED; 606 + rfkill_set_default(RFKILL_TYPE_BLUETOOTH, 607 + RFKILL_STATE_SOFT_BLOCKED); 608 + } 609 + 610 + result = rfkill_register(ehotk->eeepc_bluetooth_rfkill); 611 + if (result) 612 + goto bluetooth_fail; 613 } 614 615 + eeepc_register_rfkill_notifier("\\_SB.PCI0.P0P6"); 616 + eeepc_register_rfkill_notifier("\\_SB.PCI0.P0P7"); 617 + 618 + return 0; 619 + 620 + bluetooth_fail: 621 + if (ehotk->eeepc_bluetooth_rfkill) 622 + rfkill_free(ehotk->eeepc_bluetooth_rfkill); 623 + rfkill_unregister(ehotk->eeepc_wlan_rfkill); 624 + ehotk->eeepc_wlan_rfkill = NULL; 625 + wlan_fail: 626 + if (ehotk->eeepc_wlan_rfkill) 627 + rfkill_free(ehotk->eeepc_wlan_rfkill); 628 + ehotk_fail: 629 + kfree(ehotk); 630 + ehotk = NULL; 631 + 632 return result; 633 } 634 ··· 622 eeepc_hotk_notify); 623 if (ACPI_FAILURE(status)) 624 printk(EEEPC_ERR "Error removing notify handler\n"); 625 + 626 + eeepc_unregister_rfkill_notifier("\\_SB.PCI0.P0P6"); 627 + eeepc_unregister_rfkill_notifier("\\_SB.PCI0.P0P7"); 628 + 629 kfree(ehotk); 630 return 0; 631 } ··· 737 { 738 if (eeepc_backlight_device) 739 backlight_device_unregister(eeepc_backlight_device); 740 + eeepc_backlight_device = NULL; 741 + } 742 + 743 + static void eeepc_rfkill_exit(void) 744 + { 745 if (ehotk->eeepc_wlan_rfkill) 746 rfkill_unregister(ehotk->eeepc_wlan_rfkill); 747 if (ehotk->eeepc_bluetooth_rfkill) 748 rfkill_unregister(ehotk->eeepc_bluetooth_rfkill); 749 + } 750 + 751 + static void eeepc_input_exit(void) 752 + { 753 + if (ehotk->inputdev) 754 + input_unregister_device(ehotk->inputdev); 755 } 756 757 static void eeepc_hwmon_exit(void) ··· 762 static void __exit eeepc_laptop_exit(void) 763 { 764 eeepc_backlight_exit(); 765 + eeepc_rfkill_exit(); 766 + eeepc_input_exit(); 767 eeepc_hwmon_exit(); 768 acpi_bus_unregister_driver(&eeepc_hotk_driver); 769 sysfs_remove_group(&platform_device->dev.kobj, ··· 865 fail_hwmon: 866 eeepc_backlight_exit(); 867 fail_backlight: 868 + eeepc_input_exit(); 869 + eeepc_rfkill_exit(); 870 return result; 871 } 872
+1 -1
drivers/platform/x86/panasonic-laptop.c
··· 507 508 hkey_num = result & 0xf; 509 510 - if (hkey_num < 0 || hkey_num > ARRAY_SIZE(pcc->keymap)) { 511 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 512 "hotkey number out of range: %d\n", 513 hkey_num));
··· 507 508 hkey_num = result & 0xf; 509 510 + if (hkey_num < 0 || hkey_num >= ARRAY_SIZE(pcc->keymap)) { 511 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 512 "hotkey number out of range: %d\n", 513 hkey_num));
+2
include/acpi/pdc_intel.h
··· 14 #define ACPI_PDC_SMP_T_SWCOORD (0x0080) 15 #define ACPI_PDC_C_C1_FFH (0x0100) 16 #define ACPI_PDC_C_C2C3_FFH (0x0200) 17 18 #define ACPI_PDC_EST_CAPABILITY_SMP (ACPI_PDC_SMP_C1PT | \ 19 ACPI_PDC_C_C1_HALT | \ ··· 23 #define ACPI_PDC_EST_CAPABILITY_SWSMP (ACPI_PDC_SMP_C1PT | \ 24 ACPI_PDC_C_C1_HALT | \ 25 ACPI_PDC_SMP_P_SWCOORD | \ 26 ACPI_PDC_P_FFH) 27 28 #define ACPI_PDC_C_CAPABILITY_SMP (ACPI_PDC_SMP_C2C3 | \
··· 14 #define ACPI_PDC_SMP_T_SWCOORD (0x0080) 15 #define ACPI_PDC_C_C1_FFH (0x0100) 16 #define ACPI_PDC_C_C2C3_FFH (0x0200) 17 + #define ACPI_PDC_SMP_P_HWCOORD (0x0800) 18 19 #define ACPI_PDC_EST_CAPABILITY_SMP (ACPI_PDC_SMP_C1PT | \ 20 ACPI_PDC_C_C1_HALT | \ ··· 22 #define ACPI_PDC_EST_CAPABILITY_SWSMP (ACPI_PDC_SMP_C1PT | \ 23 ACPI_PDC_C_C1_HALT | \ 24 ACPI_PDC_SMP_P_SWCOORD | \ 25 + ACPI_PDC_SMP_P_HWCOORD | \ 26 ACPI_PDC_P_FFH) 27 28 #define ACPI_PDC_C_CAPABILITY_SMP (ACPI_PDC_SMP_C2C3 | \
+13 -13
kernel/power/main.c
··· 57 #ifdef CONFIG_PM_DEBUG 58 int pm_test_level = TEST_NONE; 59 60 - static int suspend_test(int level) 61 - { 62 - if (pm_test_level == level) { 63 - printk(KERN_INFO "suspend debug: Waiting for 5 seconds.\n"); 64 - mdelay(5000); 65 - return 1; 66 - } 67 - return 0; 68 - } 69 - 70 static const char * const pm_tests[__TEST_AFTER_LAST] = { 71 [TEST_NONE] = "none", 72 [TEST_CORE] = "core", ··· 115 } 116 117 power_attr(pm_test); 118 - #else /* !CONFIG_PM_DEBUG */ 119 - static inline int suspend_test(int level) { return 0; } 120 - #endif /* !CONFIG_PM_DEBUG */ 121 122 #endif /* CONFIG_PM_SLEEP */ 123 124 #ifdef CONFIG_SUSPEND 125 126 #ifdef CONFIG_PM_TEST_SUSPEND 127
··· 57 #ifdef CONFIG_PM_DEBUG 58 int pm_test_level = TEST_NONE; 59 60 static const char * const pm_tests[__TEST_AFTER_LAST] = { 61 [TEST_NONE] = "none", 62 [TEST_CORE] = "core", ··· 125 } 126 127 power_attr(pm_test); 128 + #endif /* CONFIG_PM_DEBUG */ 129 130 #endif /* CONFIG_PM_SLEEP */ 131 132 #ifdef CONFIG_SUSPEND 133 + 134 + static int suspend_test(int level) 135 + { 136 + #ifdef CONFIG_PM_DEBUG 137 + if (pm_test_level == level) { 138 + printk(KERN_INFO "suspend debug: Waiting for 5 seconds.\n"); 139 + mdelay(5000); 140 + return 1; 141 + } 142 + #endif /* !CONFIG_PM_DEBUG */ 143 + return 0; 144 + } 145 146 #ifdef CONFIG_PM_TEST_SUSPEND 147