Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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: (72 commits)
asus-laptop: remove EXPERIMENTAL dependency
asus-laptop: use pr_fmt and pr_<level>
eeepc-laptop: cpufv updates
eeepc-laptop: sync eeepc-laptop with asus_acpi
asus_acpi: Deprecate in favor of asus-laptop
acpi4asus: update MAINTAINER and KConfig links
asus-laptop: platform dev as parent for led and backlight
eeepc-laptop: enable camera by default
ACPI: Rename ACPI processor device bus ID
acerhdf: Acer Aspire One fan control
ACPI: video: DMI workaround broken Acer 7720 BIOS enabling display brightness
ACPI: run ACPI device hot removal in kacpi_hotplug_wq
ACPI: Add the reference count to avoid unloading ACPI video bus twice
ACPI: DMI to disable Vista compatibility on some Sony laptops
ACPI: fix a deadlock in hotplug case
Show the physical device node of backlight class device.
ACPI: pdc init related memory leak with physical CPU hotplug
ACPI: pci_root: remove unused dev/fn information
ACPI: pci_root: simplify list traversals
ACPI: pci_root: use driver data rather than list lookup
...

+1934 -1065
-8
Documentation/kernel-parameters.txt
··· 229 229 to assume that this machine's pmtimer latches its value 230 230 and always returns good values. 231 231 232 - acpi.power_nocheck= [HW,ACPI] 233 - Format: 1/0 enable/disable the check of power state. 234 - On some bogus BIOS the _PSC object/_STA object of 235 - power resource can't return the correct device power 236 - state. In such case it is unneccessary to check its 237 - power state again in power transition. 238 - 1 : disable the power state check 239 - 240 232 acpi_sci= [HW,ACPI] ACPI System Control Interrupt trigger mode 241 233 Format: { level | edge | high | low } 242 234
+37 -10
Documentation/laptops/thinkpad-acpi.txt
··· 920 920 echo '<LED number> off' >/proc/acpi/ibm/led 921 921 echo '<LED number> blink' >/proc/acpi/ibm/led 922 922 923 - The <LED number> range is 0 to 7. The set of LEDs that can be 923 + The <LED number> range is 0 to 15. The set of LEDs that can be 924 924 controlled varies from model to model. Here is the common ThinkPad 925 925 mapping: 926 926 ··· 932 932 5 - UltraBase battery slot 933 933 6 - (unknown) 934 934 7 - standby 935 + 8 - dock status 1 936 + 9 - dock status 2 937 + 10, 11 - (unknown) 938 + 12 - thinkvantage 939 + 13, 14, 15 - (unknown) 935 940 936 941 All of the above can be turned on and off and can be made to blink. 937 942 ··· 945 940 The ThinkPad LED sysfs interface is described in detail by the LED class 946 941 documentation, in Documentation/leds-class.txt. 947 942 948 - The leds are named (in LED ID order, from 0 to 7): 943 + The LEDs are named (in LED ID order, from 0 to 12): 949 944 "tpacpi::power", "tpacpi:orange:batt", "tpacpi:green:batt", 950 945 "tpacpi::dock_active", "tpacpi::bay_active", "tpacpi::dock_batt", 951 - "tpacpi::unknown_led", "tpacpi::standby". 946 + "tpacpi::unknown_led", "tpacpi::standby", "tpacpi::dock_status1", 947 + "tpacpi::dock_status2", "tpacpi::unknown_led2", "tpacpi::unknown_led3", 948 + "tpacpi::thinkvantage". 952 949 953 950 Due to limitations in the sysfs LED class, if the status of the LED 954 951 indicators cannot be read due to an error, thinkpad-acpi will report it as ··· 964 957 ThinkPad indicator LED should blink in hardware accelerated mode, use the 965 958 "timer" trigger, and leave the delay_on and delay_off parameters set to 966 959 zero (to request hardware acceleration autodetection). 960 + 961 + LEDs that are known not to exist in a given ThinkPad model are not 962 + made available through the sysfs interface. If you have a dock and you 963 + notice there are LEDs listed for your ThinkPad that do not exist (and 964 + are not in the dock), or if you notice that there are missing LEDs, 965 + a report to ibm-acpi-devel@lists.sourceforge.net is appreciated. 967 966 968 967 969 968 ACPI sounds -- /proc/acpi/ibm/beep ··· 1169 1156 display backlight brightness control methods have 16 levels, ranging 1170 1157 from 0 to 15. 1171 1158 1172 - There are two interfaces to the firmware for direct brightness control, 1173 - EC and UCMS (or CMOS). To select which one should be used, use the 1174 - brightness_mode module parameter: brightness_mode=1 selects EC mode, 1175 - brightness_mode=2 selects UCMS mode, brightness_mode=3 selects EC 1176 - mode with NVRAM backing (so that brightness changes are remembered 1177 - across shutdown/reboot). 1159 + For IBM ThinkPads, there are two interfaces to the firmware for direct 1160 + brightness control, EC and UCMS (or CMOS). To select which one should be 1161 + used, use the brightness_mode module parameter: brightness_mode=1 selects 1162 + EC mode, brightness_mode=2 selects UCMS mode, brightness_mode=3 selects EC 1163 + mode with NVRAM backing (so that brightness changes are remembered across 1164 + shutdown/reboot). 1178 1165 1179 1166 The driver tries to select which interface to use from a table of 1180 1167 defaults for each ThinkPad model. If it makes a wrong choice, please 1181 1168 report this as a bug, so that we can fix it. 1169 + 1170 + Lenovo ThinkPads only support brightness_mode=2 (UCMS). 1182 1171 1183 1172 When display backlight brightness controls are available through the 1184 1173 standard ACPI interface, it is best to use it instead of this direct ··· 1269 1254 1270 1255 procfs: /proc/acpi/ibm/fan 1271 1256 sysfs device attributes: (hwmon "thinkpad") fan1_input, pwm1, 1272 - pwm1_enable 1257 + pwm1_enable, fan2_input 1273 1258 sysfs hwmon driver attributes: fan_watchdog 1274 1259 1275 1260 NOTE NOTE NOTE: fan control operations are disabled by default for ··· 1281 1266 from the hardware registers of the embedded controller. This is known 1282 1267 to work on later R, T, X and Z series ThinkPads but may show a bogus 1283 1268 value on other models. 1269 + 1270 + Some Lenovo ThinkPads support a secondary fan. This fan cannot be 1271 + controlled separately, it shares the main fan control. 1284 1272 1285 1273 Fan levels: 1286 1274 ··· 1414 1396 ThinkPads while the EC transitions the PWM to offline mode, 1415 1397 which can take up to two minutes. May return rubbish on older 1416 1398 ThinkPads. 1399 + 1400 + hwmon device attribute fan2_input: 1401 + Fan tachometer reading, in RPM, for the secondary fan. 1402 + Available only on some ThinkPads. If the secondary fan is 1403 + not installed, will always read 0. 1417 1404 1418 1405 hwmon driver attribute fan_watchdog: 1419 1406 Fan safety watchdog timer interval, in seconds. Minimum is ··· 1578 1555 0x020300: hotkey enable/disable support removed, attributes 1579 1556 hotkey_bios_enabled and hotkey_enable deprecated and 1580 1557 marked for removal. 1558 + 1559 + 0x020400: Marker for 16 LEDs support. Also, LEDs that are known 1560 + to not exist in a given model are not registered with 1561 + the LED sysfs class anymore.
+10 -5
MAINTAINERS
··· 230 230 S: Maintained 231 231 F: drivers/net/acenic* 232 232 233 + ACER ASPIRE ONE TEMPERATURE AND FAN DRIVER 234 + P: Peter Feuerer 235 + M: peter@piie.net 236 + W: http://piie.net/?section=acerhdf 237 + S: Maintained 238 + F: drivers/platform/x86/acerhdf.c 239 + 233 240 ACER WMI LAPTOP EXTRAS 234 241 P: Carlos Corbacho 235 242 M: carlos@strangeworlds.co.uk ··· 920 913 P: Karol Kozimor 921 914 M: sziwan@users.sourceforge.net 922 915 L: acpi4asus-user@lists.sourceforge.net 923 - W: http://sourceforge.net/projects/acpi4asus 924 - W: http://xf.iksaif.net/acpi4asus 916 + W: http://acpi4asus.sf.net 925 917 S: Maintained 926 918 F: arch/x86/kernel/acpi/boot.c 927 919 F: drivers/platform/x86/asus_acpi.c ··· 936 930 P: Corentin Chary 937 931 M: corentincj@iksaif.net 938 932 L: acpi4asus-user@lists.sourceforge.net 939 - W: http://sourceforge.net/projects/acpi4asus 940 - W: http://xf.iksaif.net/acpi4asus 933 + W: http://acpi4asus.sf.net 941 934 S: Maintained 942 935 F: drivers/platform/x86/asus-laptop.c 943 936 ··· 2115 2110 P: Corentin Chary 2116 2111 M: corentincj@iksaif.net 2117 2112 L: acpi4asus-user@lists.sourceforge.net 2118 - W: http://sourceforge.net/projects/acpi4asus 2113 + W: http://acpi4asus.sf.net 2119 2114 S: Maintained 2120 2115 F: drivers/platform/x86/eeepc-laptop.c 2121 2116
+12
arch/ia64/kernel/acpi-processor.c
··· 71 71 } 72 72 73 73 EXPORT_SYMBOL(arch_acpi_processor_init_pdc); 74 + 75 + void arch_acpi_processor_cleanup_pdc(struct acpi_processor *pr) 76 + { 77 + if (pr->pdc) { 78 + kfree(pr->pdc->pointer->buffer.pointer); 79 + kfree(pr->pdc->pointer); 80 + kfree(pr->pdc); 81 + pr->pdc = NULL; 82 + } 83 + } 84 + 85 + EXPORT_SYMBOL(arch_acpi_processor_cleanup_pdc);
+1
arch/x86/include/asm/acpi.h
··· 144 144 145 145 #else /* !CONFIG_ACPI */ 146 146 147 + #define acpi_disabled 1 147 148 #define acpi_lapic 0 148 149 #define acpi_ioapic 0 149 150 static inline void acpi_noirq_set(void) { }
+3
arch/x86/include/asm/pci_x86.h
··· 121 121 extern int __init pci_mmcfg_arch_init(void); 122 122 extern void __init pci_mmcfg_arch_free(void); 123 123 124 + extern struct acpi_mcfg_allocation *pci_mmcfg_config; 125 + extern int pci_mmcfg_config_num; 126 + 124 127 /* 125 128 * AMD Fam10h CPUs are buggy, and cannot access MMIO config space 126 129 * on their northbrige except through the * %eax register. As such, you MUST
+1 -79
arch/x86/kernel/acpi/boot.c
··· 44 44 45 45 static int __initdata acpi_force = 0; 46 46 u32 acpi_rsdt_forced; 47 - #ifdef CONFIG_ACPI 48 - int acpi_disabled = 0; 49 - #else 50 - int acpi_disabled = 1; 51 - #endif 47 + int acpi_disabled; 52 48 EXPORT_SYMBOL(acpi_disabled); 53 49 54 50 #ifdef CONFIG_X86_64 ··· 117 121 118 122 early_iounmap(map, size); 119 123 } 120 - 121 - #ifdef CONFIG_PCI_MMCONFIG 122 - 123 - static int acpi_mcfg_64bit_base_addr __initdata = FALSE; 124 - 125 - /* The physical address of the MMCONFIG aperture. Set from ACPI tables. */ 126 - struct acpi_mcfg_allocation *pci_mmcfg_config; 127 - int pci_mmcfg_config_num; 128 - 129 - static int __init acpi_mcfg_oem_check(struct acpi_table_mcfg *mcfg) 130 - { 131 - if (!strcmp(mcfg->header.oem_id, "SGI")) 132 - acpi_mcfg_64bit_base_addr = TRUE; 133 - 134 - return 0; 135 - } 136 - 137 - int __init acpi_parse_mcfg(struct acpi_table_header *header) 138 - { 139 - struct acpi_table_mcfg *mcfg; 140 - unsigned long i; 141 - int config_size; 142 - 143 - if (!header) 144 - return -EINVAL; 145 - 146 - mcfg = (struct acpi_table_mcfg *)header; 147 - 148 - /* how many config structures do we have */ 149 - pci_mmcfg_config_num = 0; 150 - i = header->length - sizeof(struct acpi_table_mcfg); 151 - while (i >= sizeof(struct acpi_mcfg_allocation)) { 152 - ++pci_mmcfg_config_num; 153 - i -= sizeof(struct acpi_mcfg_allocation); 154 - }; 155 - if (pci_mmcfg_config_num == 0) { 156 - printk(KERN_ERR PREFIX "MMCONFIG has no entries\n"); 157 - return -ENODEV; 158 - } 159 - 160 - config_size = pci_mmcfg_config_num * sizeof(*pci_mmcfg_config); 161 - pci_mmcfg_config = kmalloc(config_size, GFP_KERNEL); 162 - if (!pci_mmcfg_config) { 163 - printk(KERN_WARNING PREFIX 164 - "No memory for MCFG config tables\n"); 165 - return -ENOMEM; 166 - } 167 - 168 - memcpy(pci_mmcfg_config, &mcfg[1], config_size); 169 - 170 - acpi_mcfg_oem_check(mcfg); 171 - 172 - for (i = 0; i < pci_mmcfg_config_num; ++i) { 173 - if ((pci_mmcfg_config[i].address > 0xFFFFFFFF) && 174 - !acpi_mcfg_64bit_base_addr) { 175 - printk(KERN_ERR PREFIX 176 - "MMCONFIG not in low 4GB of memory\n"); 177 - kfree(pci_mmcfg_config); 178 - pci_mmcfg_config_num = 0; 179 - return -ENODEV; 180 - } 181 - } 182 - 183 - return 0; 184 - } 185 - #endif /* CONFIG_PCI_MMCONFIG */ 186 124 187 125 #ifdef CONFIG_X86_LOCAL_APIC 188 126 static int __init acpi_parse_madt(struct acpi_table_header *table) ··· 1445 1515 .matches = { 1446 1516 DMI_MATCH(DMI_SYS_VENDOR, "Compaq"), 1447 1517 DMI_MATCH(DMI_PRODUCT_NAME, "Workstation W8000"), 1448 - }, 1449 - }, 1450 - { 1451 - .callback = force_acpi_ht, 1452 - .ident = "ASUS P4B266", 1453 - .matches = { 1454 - DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer INC."), 1455 - DMI_MATCH(DMI_BOARD_NAME, "P4B266"), 1456 1518 }, 1457 1519 }, 1458 1520 {
+13 -3
arch/x86/kernel/acpi/cstate.c
··· 34 34 flags->bm_check = 1; 35 35 else if (c->x86_vendor == X86_VENDOR_INTEL) { 36 36 /* 37 - * Today all CPUs that support C3 share cache. 38 - * TBD: This needs to look at cache shared map, once 39 - * multi-core detection patch makes to the base. 37 + * Today all MP CPUs that support C3 share cache. 38 + * And caches should not be flushed by software while 39 + * entering C3 type state. 40 40 */ 41 41 flags->bm_check = 1; 42 42 } 43 + 44 + /* 45 + * On all recent Intel platforms, ARB_DISABLE is a nop. 46 + * So, set bm_control to zero to indicate that ARB_DISABLE 47 + * is not required while entering C3 type state on 48 + * P4, Core and beyond CPUs 49 + */ 50 + if (c->x86_vendor == X86_VENDOR_INTEL && 51 + (c->x86 > 0x6 || (c->x86 == 6 && c->x86_model >= 14))) 52 + flags->bm_control = 0; 43 53 } 44 54 EXPORT_SYMBOL(acpi_processor_power_init_bm_check); 45 55
+13
arch/x86/kernel/acpi/processor.c
··· 72 72 return; 73 73 } 74 74 75 + 75 76 /* Initialize _PDC data based on the CPU vendor */ 76 77 void arch_acpi_processor_init_pdc(struct acpi_processor *pr) 77 78 { ··· 86 85 } 87 86 88 87 EXPORT_SYMBOL(arch_acpi_processor_init_pdc); 88 + 89 + void arch_acpi_processor_cleanup_pdc(struct acpi_processor *pr) 90 + { 91 + if (pr->pdc) { 92 + kfree(pr->pdc->pointer->buffer.pointer); 93 + kfree(pr->pdc->pointer); 94 + kfree(pr->pdc); 95 + pr->pdc = NULL; 96 + } 97 + } 98 + 99 + EXPORT_SYMBOL(arch_acpi_processor_cleanup_pdc);
+64 -1
arch/x86/pci/mmconfig-shared.c
··· 523 523 524 524 static int __initdata known_bridge; 525 525 526 + static int acpi_mcfg_64bit_base_addr __initdata = FALSE; 527 + 528 + /* The physical address of the MMCONFIG aperture. Set from ACPI tables. */ 529 + struct acpi_mcfg_allocation *pci_mmcfg_config; 530 + int pci_mmcfg_config_num; 531 + 532 + static int __init acpi_mcfg_oem_check(struct acpi_table_mcfg *mcfg) 533 + { 534 + if (!strcmp(mcfg->header.oem_id, "SGI")) 535 + acpi_mcfg_64bit_base_addr = TRUE; 536 + 537 + return 0; 538 + } 539 + 540 + static int __init pci_parse_mcfg(struct acpi_table_header *header) 541 + { 542 + struct acpi_table_mcfg *mcfg; 543 + unsigned long i; 544 + int config_size; 545 + 546 + if (!header) 547 + return -EINVAL; 548 + 549 + mcfg = (struct acpi_table_mcfg *)header; 550 + 551 + /* how many config structures do we have */ 552 + pci_mmcfg_config_num = 0; 553 + i = header->length - sizeof(struct acpi_table_mcfg); 554 + while (i >= sizeof(struct acpi_mcfg_allocation)) { 555 + ++pci_mmcfg_config_num; 556 + i -= sizeof(struct acpi_mcfg_allocation); 557 + }; 558 + if (pci_mmcfg_config_num == 0) { 559 + printk(KERN_ERR PREFIX "MMCONFIG has no entries\n"); 560 + return -ENODEV; 561 + } 562 + 563 + config_size = pci_mmcfg_config_num * sizeof(*pci_mmcfg_config); 564 + pci_mmcfg_config = kmalloc(config_size, GFP_KERNEL); 565 + if (!pci_mmcfg_config) { 566 + printk(KERN_WARNING PREFIX 567 + "No memory for MCFG config tables\n"); 568 + return -ENOMEM; 569 + } 570 + 571 + memcpy(pci_mmcfg_config, &mcfg[1], config_size); 572 + 573 + acpi_mcfg_oem_check(mcfg); 574 + 575 + for (i = 0; i < pci_mmcfg_config_num; ++i) { 576 + if ((pci_mmcfg_config[i].address > 0xFFFFFFFF) && 577 + !acpi_mcfg_64bit_base_addr) { 578 + printk(KERN_ERR PREFIX 579 + "MMCONFIG not in low 4GB of memory\n"); 580 + kfree(pci_mmcfg_config); 581 + pci_mmcfg_config_num = 0; 582 + return -ENODEV; 583 + } 584 + } 585 + 586 + return 0; 587 + } 588 + 526 589 static void __init __pci_mmcfg_init(int early) 527 590 { 528 591 /* MMCONFIG disabled */ ··· 606 543 } 607 544 608 545 if (!known_bridge) 609 - acpi_table_parse(ACPI_SIG_MCFG, acpi_parse_mcfg); 546 + acpi_table_parse(ACPI_SIG_MCFG, pci_parse_mcfg); 610 547 611 548 pci_mmcfg_reject_broken(early); 612 549
+5 -15
drivers/acpi/ac.c
··· 61 61 static int acpi_ac_add(struct acpi_device *device); 62 62 static int acpi_ac_remove(struct acpi_device *device, int type); 63 63 static int acpi_ac_resume(struct acpi_device *device); 64 + static void acpi_ac_notify(struct acpi_device *device, u32 event); 64 65 65 66 static const struct acpi_device_id ac_device_ids[] = { 66 67 {"ACPI0003", 0}, ··· 73 72 .name = "ac", 74 73 .class = ACPI_AC_CLASS, 75 74 .ids = ac_device_ids, 75 + .flags = ACPI_DRIVER_ALL_NOTIFY_EVENTS, 76 76 .ops = { 77 77 .add = acpi_ac_add, 78 78 .remove = acpi_ac_remove, 79 79 .resume = acpi_ac_resume, 80 + .notify = acpi_ac_notify, 80 81 }, 81 82 }; 82 83 ··· 223 220 Driver Model 224 221 -------------------------------------------------------------------------- */ 225 222 226 - static void acpi_ac_notify(acpi_handle handle, u32 event, void *data) 223 + static void acpi_ac_notify(struct acpi_device *device, u32 event) 227 224 { 228 - struct acpi_ac *ac = data; 229 - struct acpi_device *device = NULL; 225 + struct acpi_ac *ac = acpi_driver_data(device); 230 226 231 227 232 228 if (!ac) 233 229 return; 234 230 235 - device = ac->device; 236 231 switch (event) { 237 232 default: 238 233 ACPI_DEBUG_PRINT((ACPI_DB_INFO, ··· 254 253 static int acpi_ac_add(struct acpi_device *device) 255 254 { 256 255 int result = 0; 257 - acpi_status status = AE_OK; 258 256 struct acpi_ac *ac = NULL; 259 257 260 258 ··· 286 286 ac->charger.get_property = get_ac_property; 287 287 power_supply_register(&ac->device->dev, &ac->charger); 288 288 #endif 289 - status = acpi_install_notify_handler(device->handle, 290 - ACPI_ALL_NOTIFY, acpi_ac_notify, 291 - ac); 292 - if (ACPI_FAILURE(status)) { 293 - result = -ENODEV; 294 - goto end; 295 - } 296 289 297 290 printk(KERN_INFO PREFIX "%s [%s] (%s)\n", 298 291 acpi_device_name(device), acpi_device_bid(device), ··· 321 328 322 329 static int acpi_ac_remove(struct acpi_device *device, int type) 323 330 { 324 - acpi_status status = AE_OK; 325 331 struct acpi_ac *ac = NULL; 326 332 327 333 ··· 329 337 330 338 ac = acpi_driver_data(device); 331 339 332 - status = acpi_remove_notify_handler(device->handle, 333 - ACPI_ALL_NOTIFY, acpi_ac_notify); 334 340 #ifdef CONFIG_ACPI_SYSFS_POWER 335 341 if (ac->charger.dev) 336 342 power_supply_unregister(&ac->charger);
+10 -24
drivers/acpi/battery.c
··· 796 796 Driver Interface 797 797 -------------------------------------------------------------------------- */ 798 798 799 - static void acpi_battery_notify(acpi_handle handle, u32 event, void *data) 799 + static void acpi_battery_notify(struct acpi_device *device, u32 event) 800 800 { 801 - struct acpi_battery *battery = data; 802 - struct acpi_device *device; 801 + struct acpi_battery *battery = acpi_driver_data(device); 802 + 803 803 if (!battery) 804 804 return; 805 - device = battery->device; 806 805 acpi_battery_update(battery); 807 806 acpi_bus_generate_proc_event(device, event, 808 807 acpi_battery_present(battery)); ··· 818 819 static int acpi_battery_add(struct acpi_device *device) 819 820 { 820 821 int result = 0; 821 - acpi_status status = 0; 822 822 struct acpi_battery *battery = NULL; 823 823 if (!device) 824 824 return -EINVAL; ··· 832 834 acpi_battery_update(battery); 833 835 #ifdef CONFIG_ACPI_PROCFS_POWER 834 836 result = acpi_battery_add_fs(device); 835 - if (result) 836 - goto end; 837 837 #endif 838 - status = acpi_install_notify_handler(device->handle, 839 - ACPI_ALL_NOTIFY, 840 - acpi_battery_notify, battery); 841 - if (ACPI_FAILURE(status)) { 842 - ACPI_EXCEPTION((AE_INFO, status, "Installing notify handler")); 843 - result = -ENODEV; 844 - goto end; 845 - } 846 - printk(KERN_INFO PREFIX "%s Slot [%s] (battery %s)\n", 847 - ACPI_BATTERY_DEVICE_NAME, acpi_device_bid(device), 848 - device->status.battery_present ? "present" : "absent"); 849 - end: 850 - if (result) { 838 + if (!result) { 839 + printk(KERN_INFO PREFIX "%s Slot [%s] (battery %s)\n", 840 + ACPI_BATTERY_DEVICE_NAME, acpi_device_bid(device), 841 + device->status.battery_present ? "present" : "absent"); 842 + } else { 851 843 #ifdef CONFIG_ACPI_PROCFS_POWER 852 844 acpi_battery_remove_fs(device); 853 845 #endif ··· 848 860 849 861 static int acpi_battery_remove(struct acpi_device *device, int type) 850 862 { 851 - acpi_status status = 0; 852 863 struct acpi_battery *battery = NULL; 853 864 854 865 if (!device || !acpi_driver_data(device)) 855 866 return -EINVAL; 856 867 battery = acpi_driver_data(device); 857 - status = acpi_remove_notify_handler(device->handle, 858 - ACPI_ALL_NOTIFY, 859 - acpi_battery_notify); 860 868 #ifdef CONFIG_ACPI_PROCFS_POWER 861 869 acpi_battery_remove_fs(device); 862 870 #endif ··· 880 896 .name = "battery", 881 897 .class = ACPI_BATTERY_CLASS, 882 898 .ids = battery_device_ids, 899 + .flags = ACPI_DRIVER_ALL_NOTIFY_EVENTS, 883 900 .ops = { 884 901 .add = acpi_battery_add, 885 902 .resume = acpi_battery_resume, 886 903 .remove = acpi_battery_remove, 904 + .notify = acpi_battery_notify, 887 905 }, 888 906 }; 889 907
+16
drivers/acpi/blacklist.c
··· 192 192 DMI_MATCH(DMI_PRODUCT_NAME, "ESPRIMO Mobile V5505"), 193 193 }, 194 194 }, 195 + { 196 + .callback = dmi_disable_osi_vista, 197 + .ident = "Sony VGN-NS10J_S", 198 + .matches = { 199 + DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"), 200 + DMI_MATCH(DMI_PRODUCT_NAME, "VGN-NS10J_S"), 201 + }, 202 + }, 203 + { 204 + .callback = dmi_disable_osi_vista, 205 + .ident = "Sony VGN-SR290J", 206 + .matches = { 207 + DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"), 208 + DMI_MATCH(DMI_PRODUCT_NAME, "Sony VGN-SR290J"), 209 + }, 210 + }, 195 211 196 212 /* 197 213 * BIOS invocation of _OSI(Linux) is almost always a BIOS bug.
+24 -67
drivers/acpi/bus.c
··· 450 450 Notification Handling 451 451 -------------------------------------------------------------------------- */ 452 452 453 - static int 454 - acpi_bus_check_device(struct acpi_device *device, int *status_changed) 453 + static void acpi_bus_check_device(acpi_handle handle) 455 454 { 456 - acpi_status status = 0; 455 + struct acpi_device *device; 456 + acpi_status status; 457 457 struct acpi_device_status old_status; 458 458 459 - 459 + if (acpi_bus_get_device(handle, &device)) 460 + return; 460 461 if (!device) 461 - return -EINVAL; 462 - 463 - if (status_changed) 464 - *status_changed = 0; 462 + return; 465 463 466 464 old_status = device->status; 467 465 ··· 469 471 */ 470 472 if (device->parent && !device->parent->status.present) { 471 473 device->status = device->parent->status; 472 - if (STRUCT_TO_INT(old_status) != STRUCT_TO_INT(device->status)) { 473 - if (status_changed) 474 - *status_changed = 1; 475 - } 476 - return 0; 474 + return; 477 475 } 478 476 479 477 status = acpi_bus_get_status(device); 480 478 if (ACPI_FAILURE(status)) 481 - return -ENODEV; 479 + return; 482 480 483 481 if (STRUCT_TO_INT(old_status) == STRUCT_TO_INT(device->status)) 484 - return 0; 485 - 486 - if (status_changed) 487 - *status_changed = 1; 482 + return; 488 483 489 484 /* 490 485 * Device Insertion/Removal ··· 489 498 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device removal detected\n")); 490 499 /* TBD: Handle device removal */ 491 500 } 492 - 493 - return 0; 494 501 } 495 502 496 - static int acpi_bus_check_scope(struct acpi_device *device) 503 + static void acpi_bus_check_scope(acpi_handle handle) 497 504 { 498 - int result = 0; 499 - int status_changed = 0; 500 - 501 - 502 - if (!device) 503 - return -EINVAL; 504 - 505 505 /* Status Change? */ 506 - result = acpi_bus_check_device(device, &status_changed); 507 - if (result) 508 - return result; 509 - 510 - if (!status_changed) 511 - return 0; 506 + acpi_bus_check_device(handle); 512 507 513 508 /* 514 509 * TBD: Enumerate child devices within this device's scope and 515 510 * run acpi_bus_check_device()'s on them. 516 511 */ 517 - 518 - return 0; 519 512 } 520 513 521 514 static BLOCKING_NOTIFIER_HEAD(acpi_bus_notify_list); ··· 522 547 */ 523 548 static void acpi_bus_notify(acpi_handle handle, u32 type, void *data) 524 549 { 525 - int result = 0; 526 550 struct acpi_device *device = NULL; 551 + struct acpi_driver *driver; 552 + 553 + ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Notification %#02x to handle %p\n", 554 + type, handle)); 527 555 528 556 blocking_notifier_call_chain(&acpi_bus_notify_list, 529 557 type, (void *)handle); 530 558 531 - if (acpi_bus_get_device(handle, &device)) 532 - return; 533 - 534 559 switch (type) { 535 560 536 561 case ACPI_NOTIFY_BUS_CHECK: 537 - ACPI_DEBUG_PRINT((ACPI_DB_INFO, 538 - "Received BUS CHECK notification for device [%s]\n", 539 - device->pnp.bus_id)); 540 - result = acpi_bus_check_scope(device); 562 + acpi_bus_check_scope(handle); 541 563 /* 542 564 * TBD: We'll need to outsource certain events to non-ACPI 543 565 * drivers via the device manager (device.c). ··· 542 570 break; 543 571 544 572 case ACPI_NOTIFY_DEVICE_CHECK: 545 - ACPI_DEBUG_PRINT((ACPI_DB_INFO, 546 - "Received DEVICE CHECK notification for device [%s]\n", 547 - device->pnp.bus_id)); 548 - result = acpi_bus_check_device(device, NULL); 573 + acpi_bus_check_device(handle); 549 574 /* 550 575 * TBD: We'll need to outsource certain events to non-ACPI 551 576 * drivers via the device manager (device.c). ··· 550 581 break; 551 582 552 583 case ACPI_NOTIFY_DEVICE_WAKE: 553 - ACPI_DEBUG_PRINT((ACPI_DB_INFO, 554 - "Received DEVICE WAKE notification for device [%s]\n", 555 - device->pnp.bus_id)); 556 584 /* TBD */ 557 585 break; 558 586 559 587 case ACPI_NOTIFY_EJECT_REQUEST: 560 - ACPI_DEBUG_PRINT((ACPI_DB_INFO, 561 - "Received EJECT REQUEST notification for device [%s]\n", 562 - device->pnp.bus_id)); 563 588 /* TBD */ 564 589 break; 565 590 566 591 case ACPI_NOTIFY_DEVICE_CHECK_LIGHT: 567 - ACPI_DEBUG_PRINT((ACPI_DB_INFO, 568 - "Received DEVICE CHECK LIGHT notification for device [%s]\n", 569 - device->pnp.bus_id)); 570 592 /* TBD: Exactly what does 'light' mean? */ 571 593 break; 572 594 573 595 case ACPI_NOTIFY_FREQUENCY_MISMATCH: 574 - ACPI_DEBUG_PRINT((ACPI_DB_INFO, 575 - "Received FREQUENCY MISMATCH notification for device [%s]\n", 576 - device->pnp.bus_id)); 577 596 /* TBD */ 578 597 break; 579 598 580 599 case ACPI_NOTIFY_BUS_MODE_MISMATCH: 581 - ACPI_DEBUG_PRINT((ACPI_DB_INFO, 582 - "Received BUS MODE MISMATCH notification for device [%s]\n", 583 - device->pnp.bus_id)); 584 600 /* TBD */ 585 601 break; 586 602 587 603 case ACPI_NOTIFY_POWER_FAULT: 588 - ACPI_DEBUG_PRINT((ACPI_DB_INFO, 589 - "Received POWER FAULT notification for device [%s]\n", 590 - device->pnp.bus_id)); 591 604 /* TBD */ 592 605 break; 593 606 ··· 580 629 break; 581 630 } 582 631 583 - return; 632 + acpi_bus_get_device(handle, &device); 633 + if (device) { 634 + driver = device->driver; 635 + if (driver && driver->ops.notify && 636 + (driver->flags & ACPI_DRIVER_ALL_NOTIFY_EVENTS)) 637 + driver->ops.notify(device, type); 638 + } 584 639 } 585 640 586 641 /* --------------------------------------------------------------------------
-40
drivers/acpi/glue.c
··· 140 140 141 141 EXPORT_SYMBOL(acpi_get_physical_device); 142 142 143 - /* ToDo: When a PCI bridge is found, return the PCI device behind the bridge 144 - * This should work in general, but did not on a Lenovo T61 for the 145 - * graphics card. But this must be fixed when the PCI device is 146 - * bound and the kernel device struct is attached to the acpi device 147 - * Note: A success call will increase reference count by one 148 - * Do call put_device(dev) on the returned device then 149 - */ 150 - struct device *acpi_get_physical_pci_device(acpi_handle handle) 151 - { 152 - struct device *dev; 153 - long long device_id; 154 - acpi_status status; 155 - 156 - status = 157 - acpi_evaluate_integer(handle, "_ADR", NULL, &device_id); 158 - 159 - if (ACPI_FAILURE(status)) 160 - return NULL; 161 - 162 - /* We need to attempt to determine whether the _ADR refers to a 163 - PCI device or not. There's no terribly good way to do this, 164 - so the best we can hope for is to assume that there'll never 165 - be a device in the host bridge */ 166 - if (device_id >= 0x10000) { 167 - /* It looks like a PCI device. Does it exist? */ 168 - dev = acpi_get_physical_device(handle); 169 - } else { 170 - /* It doesn't look like a PCI device. Does its parent 171 - exist? */ 172 - acpi_handle phandle; 173 - if (acpi_get_parent(handle, &phandle)) 174 - return NULL; 175 - dev = acpi_get_physical_device(phandle); 176 - } 177 - if (!dev) 178 - return NULL; 179 - return dev; 180 - } 181 - EXPORT_SYMBOL(acpi_get_physical_pci_device); 182 - 183 143 static int acpi_bind_one(struct device *dev, acpi_handle handle) 184 144 { 185 145 struct acpi_device *acpi_dev;
+16 -9
drivers/acpi/osl.c
··· 79 79 static void *acpi_irq_context; 80 80 static struct workqueue_struct *kacpid_wq; 81 81 static struct workqueue_struct *kacpi_notify_wq; 82 + static struct workqueue_struct *kacpi_hotplug_wq; 82 83 83 84 struct acpi_res_list { 84 85 resource_size_t start; ··· 193 192 { 194 193 kacpid_wq = create_singlethread_workqueue("kacpid"); 195 194 kacpi_notify_wq = create_singlethread_workqueue("kacpi_notify"); 195 + kacpi_hotplug_wq = create_singlethread_workqueue("kacpi_hotplug"); 196 196 BUG_ON(!kacpid_wq); 197 197 BUG_ON(!kacpi_notify_wq); 198 + BUG_ON(!kacpi_hotplug_wq); 198 199 return AE_OK; 199 200 } 200 201 ··· 209 206 210 207 destroy_workqueue(kacpid_wq); 211 208 destroy_workqueue(kacpi_notify_wq); 209 + destroy_workqueue(kacpi_hotplug_wq); 212 210 213 211 return AE_OK; 214 212 } ··· 720 716 acpi_status status = AE_OK; 721 717 struct acpi_os_dpc *dpc; 722 718 struct workqueue_struct *queue; 719 + work_func_t func; 723 720 int ret; 724 721 ACPI_DEBUG_PRINT((ACPI_DB_EXEC, 725 722 "Scheduling function [%p(%p)] for deferred execution.\n", ··· 745 740 dpc->function = function; 746 741 dpc->context = context; 747 742 748 - if (!hp) { 749 - INIT_WORK(&dpc->work, acpi_os_execute_deferred); 750 - queue = (type == OSL_NOTIFY_HANDLER) ? 751 - kacpi_notify_wq : kacpid_wq; 752 - ret = queue_work(queue, &dpc->work); 753 - } else { 754 - INIT_WORK(&dpc->work, acpi_os_execute_hp_deferred); 755 - ret = schedule_work(&dpc->work); 756 - } 743 + /* 744 + * We can't run hotplug code in keventd_wq/kacpid_wq/kacpid_notify_wq 745 + * because the hotplug code may call driver .remove() functions, 746 + * which invoke flush_scheduled_work/acpi_os_wait_events_complete 747 + * to flush these workqueues. 748 + */ 749 + queue = hp ? kacpi_hotplug_wq : 750 + (type == OSL_NOTIFY_HANDLER ? kacpi_notify_wq : kacpid_wq); 751 + func = hp ? acpi_os_execute_hp_deferred : acpi_os_execute_deferred; 752 + INIT_WORK(&dpc->work, func); 753 + ret = queue_work(queue, &dpc->work); 757 754 758 755 if (!ret) { 759 756 printk(KERN_ERR PREFIX
+45 -284
drivers/acpi/pci_bind.c
··· 24 24 */ 25 25 26 26 #include <linux/kernel.h> 27 - #include <linux/module.h> 28 - #include <linux/init.h> 29 27 #include <linux/types.h> 30 - #include <linux/proc_fs.h> 31 - #include <linux/spinlock.h> 32 - #include <linux/pm.h> 33 28 #include <linux/pci.h> 34 29 #include <linux/acpi.h> 35 30 #include <acpi/acpi_bus.h> ··· 33 38 #define _COMPONENT ACPI_PCI_COMPONENT 34 39 ACPI_MODULE_NAME("pci_bind"); 35 40 36 - struct acpi_pci_data { 37 - struct acpi_pci_id id; 41 + static int acpi_pci_unbind(struct acpi_device *device) 42 + { 43 + struct pci_dev *dev; 44 + 45 + dev = acpi_get_pci_dev(device->handle); 46 + if (!dev || !dev->subordinate) 47 + goto out; 48 + 49 + acpi_pci_irq_del_prt(dev->subordinate); 50 + 51 + device->ops.bind = NULL; 52 + device->ops.unbind = NULL; 53 + 54 + out: 55 + pci_dev_put(dev); 56 + return 0; 57 + } 58 + 59 + static int acpi_pci_bind(struct acpi_device *device) 60 + { 61 + acpi_status status; 62 + acpi_handle handle; 38 63 struct pci_bus *bus; 39 64 struct pci_dev *dev; 40 - }; 41 65 42 - static int acpi_pci_unbind(struct acpi_device *device); 43 - 44 - static void acpi_pci_data_handler(acpi_handle handle, u32 function, 45 - void *context) 46 - { 47 - 48 - /* TBD: Anything we need to do here? */ 49 - 50 - return; 51 - } 52 - 53 - /** 54 - * acpi_get_pci_id 55 - * ------------------ 56 - * This function is used by the ACPI Interpreter (a.k.a. Core Subsystem) 57 - * to resolve PCI information for ACPI-PCI devices defined in the namespace. 58 - * This typically occurs when resolving PCI operation region information. 59 - */ 60 - acpi_status acpi_get_pci_id(acpi_handle handle, struct acpi_pci_id *id) 61 - { 62 - int result = 0; 63 - acpi_status status = AE_OK; 64 - struct acpi_device *device = NULL; 65 - struct acpi_pci_data *data = NULL; 66 - 67 - 68 - if (!id) 69 - return AE_BAD_PARAMETER; 70 - 71 - result = acpi_bus_get_device(handle, &device); 72 - if (result) { 73 - printk(KERN_ERR PREFIX 74 - "Invalid ACPI Bus context for device %s\n", 75 - acpi_device_bid(device)); 76 - return AE_NOT_EXIST; 77 - } 78 - 79 - status = acpi_get_data(handle, acpi_pci_data_handler, (void **)&data); 80 - if (ACPI_FAILURE(status) || !data) { 81 - ACPI_EXCEPTION((AE_INFO, status, 82 - "Invalid ACPI-PCI context for device %s", 83 - acpi_device_bid(device))); 84 - return status; 85 - } 86 - 87 - *id = data->id; 66 + dev = acpi_get_pci_dev(device->handle); 67 + if (!dev) 68 + return 0; 88 69 89 70 /* 90 - id->segment = data->id.segment; 91 - id->bus = data->id.bus; 92 - id->device = data->id.device; 93 - id->function = data->id.function; 71 + * Install the 'bind' function to facilitate callbacks for 72 + * children of the P2P bridge. 94 73 */ 95 - 96 - ACPI_DEBUG_PRINT((ACPI_DB_INFO, 97 - "Device %s has PCI address %04x:%02x:%02x.%d\n", 98 - acpi_device_bid(device), id->segment, id->bus, 99 - id->device, id->function)); 100 - 101 - return AE_OK; 102 - } 103 - 104 - EXPORT_SYMBOL(acpi_get_pci_id); 105 - 106 - int acpi_pci_bind(struct acpi_device *device) 107 - { 108 - int result = 0; 109 - acpi_status status; 110 - struct acpi_pci_data *data; 111 - struct acpi_pci_data *pdata; 112 - struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; 113 - acpi_handle handle; 114 - 115 - if (!device || !device->parent) 116 - return -EINVAL; 117 - 118 - data = kzalloc(sizeof(struct acpi_pci_data), GFP_KERNEL); 119 - if (!data) 120 - return -ENOMEM; 121 - 122 - status = acpi_get_name(device->handle, ACPI_FULL_PATHNAME, &buffer); 123 - if (ACPI_FAILURE(status)) { 124 - kfree(data); 125 - return -ENODEV; 126 - } 127 - 128 - ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Binding PCI device [%s]...\n", 129 - (char *)buffer.pointer)); 130 - 131 - /* 132 - * Segment & Bus 133 - * ------------- 134 - * These are obtained via the parent device's ACPI-PCI context. 135 - */ 136 - status = acpi_get_data(device->parent->handle, acpi_pci_data_handler, 137 - (void **)&pdata); 138 - if (ACPI_FAILURE(status) || !pdata || !pdata->bus) { 139 - ACPI_EXCEPTION((AE_INFO, status, 140 - "Invalid ACPI-PCI context for parent device %s", 141 - acpi_device_bid(device->parent))); 142 - result = -ENODEV; 143 - goto end; 144 - } 145 - data->id.segment = pdata->id.segment; 146 - data->id.bus = pdata->bus->number; 147 - 148 - /* 149 - * Device & Function 150 - * ----------------- 151 - * These are simply obtained from the device's _ADR method. Note 152 - * that a value of zero is valid. 153 - */ 154 - data->id.device = device->pnp.bus_address >> 16; 155 - data->id.function = device->pnp.bus_address & 0xFFFF; 156 - 157 - ACPI_DEBUG_PRINT((ACPI_DB_INFO, "...to %04x:%02x:%02x.%d\n", 158 - data->id.segment, data->id.bus, data->id.device, 159 - data->id.function)); 160 - 161 - /* 162 - * TBD: Support slot devices (e.g. function=0xFFFF). 163 - */ 164 - 165 - /* 166 - * Locate PCI Device 167 - * ----------------- 168 - * Locate matching device in PCI namespace. If it doesn't exist 169 - * this typically means that the device isn't currently inserted 170 - * (e.g. docking station, port replicator, etc.). 171 - */ 172 - data->dev = pci_get_slot(pdata->bus, 173 - PCI_DEVFN(data->id.device, data->id.function)); 174 - if (!data->dev) { 175 - ACPI_DEBUG_PRINT((ACPI_DB_INFO, 176 - "Device %04x:%02x:%02x.%d not present in PCI namespace\n", 177 - data->id.segment, data->id.bus, 178 - data->id.device, data->id.function)); 179 - result = -ENODEV; 180 - goto end; 181 - } 182 - if (!data->dev->bus) { 183 - printk(KERN_ERR PREFIX 184 - "Device %04x:%02x:%02x.%d has invalid 'bus' field\n", 185 - data->id.segment, data->id.bus, 186 - data->id.device, data->id.function); 187 - result = -ENODEV; 188 - goto end; 189 - } 190 - 191 - /* 192 - * PCI Bridge? 193 - * ----------- 194 - * If so, set the 'bus' field and install the 'bind' function to 195 - * facilitate callbacks for all of its children. 196 - */ 197 - if (data->dev->subordinate) { 74 + if (dev->subordinate) { 198 75 ACPI_DEBUG_PRINT((ACPI_DB_INFO, 199 76 "Device %04x:%02x:%02x.%d is a PCI bridge\n", 200 - data->id.segment, data->id.bus, 201 - data->id.device, data->id.function)); 202 - data->bus = data->dev->subordinate; 77 + pci_domain_nr(dev->bus), dev->bus->number, 78 + PCI_SLOT(dev->devfn), PCI_FUNC(dev->devfn))); 203 79 device->ops.bind = acpi_pci_bind; 204 80 device->ops.unbind = acpi_pci_unbind; 205 81 } 206 82 207 83 /* 208 - * Attach ACPI-PCI Context 209 - * ----------------------- 210 - * Thus binding the ACPI and PCI devices. 211 - */ 212 - status = acpi_attach_data(device->handle, acpi_pci_data_handler, data); 213 - if (ACPI_FAILURE(status)) { 214 - ACPI_EXCEPTION((AE_INFO, status, 215 - "Unable to attach ACPI-PCI context to device %s", 216 - acpi_device_bid(device))); 217 - result = -ENODEV; 218 - goto end; 219 - } 220 - 221 - /* 222 - * PCI Routing Table 223 - * ----------------- 224 - * Evaluate and parse _PRT, if exists. This code is independent of 225 - * PCI bridges (above) to allow parsing of _PRT objects within the 226 - * scope of non-bridge devices. Note that _PRTs within the scope of 227 - * a PCI bridge assume the bridge's subordinate bus number. 84 + * Evaluate and parse _PRT, if exists. This code allows parsing of 85 + * _PRT objects within the scope of non-bridge devices. Note that 86 + * _PRTs within the scope of a PCI bridge assume the bridge's 87 + * subordinate bus number. 228 88 * 229 89 * TBD: Can _PRTs exist within the scope of non-bridge PCI devices? 230 90 */ 231 91 status = acpi_get_handle(device->handle, METHOD_NAME__PRT, &handle); 232 - if (ACPI_SUCCESS(status)) { 233 - if (data->bus) /* PCI-PCI bridge */ 234 - acpi_pci_irq_add_prt(device->handle, data->id.segment, 235 - data->bus->number); 236 - else /* non-bridge PCI device */ 237 - acpi_pci_irq_add_prt(device->handle, data->id.segment, 238 - data->id.bus); 239 - } 240 - 241 - end: 242 - kfree(buffer.pointer); 243 - if (result) { 244 - pci_dev_put(data->dev); 245 - kfree(data); 246 - } 247 - return result; 248 - } 249 - 250 - static int acpi_pci_unbind(struct acpi_device *device) 251 - { 252 - int result = 0; 253 - acpi_status status; 254 - struct acpi_pci_data *data; 255 - struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; 256 - 257 - 258 - if (!device || !device->parent) 259 - return -EINVAL; 260 - 261 - status = acpi_get_name(device->handle, ACPI_FULL_PATHNAME, &buffer); 262 92 if (ACPI_FAILURE(status)) 263 - return -ENODEV; 93 + goto out; 264 94 265 - ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Unbinding PCI device [%s]...\n", 266 - (char *) buffer.pointer)); 267 - kfree(buffer.pointer); 95 + if (dev->subordinate) 96 + bus = dev->subordinate; 97 + else 98 + bus = dev->bus; 268 99 269 - status = 270 - acpi_get_data(device->handle, acpi_pci_data_handler, 271 - (void **)&data); 272 - if (ACPI_FAILURE(status)) { 273 - result = -ENODEV; 274 - goto end; 275 - } 100 + acpi_pci_irq_add_prt(device->handle, bus); 276 101 277 - status = acpi_detach_data(device->handle, acpi_pci_data_handler); 278 - if (ACPI_FAILURE(status)) { 279 - ACPI_EXCEPTION((AE_INFO, status, 280 - "Unable to detach data from device %s", 281 - acpi_device_bid(device))); 282 - result = -ENODEV; 283 - goto end; 284 - } 285 - if (data->dev->subordinate) { 286 - acpi_pci_irq_del_prt(data->id.segment, data->bus->number); 287 - } 288 - pci_dev_put(data->dev); 289 - kfree(data); 290 - 291 - end: 292 - return result; 102 + out: 103 + pci_dev_put(dev); 104 + return 0; 293 105 } 294 106 295 - int 296 - acpi_pci_bind_root(struct acpi_device *device, 297 - struct acpi_pci_id *id, struct pci_bus *bus) 107 + int acpi_pci_bind_root(struct acpi_device *device) 298 108 { 299 - int result = 0; 300 - acpi_status status; 301 - struct acpi_pci_data *data = NULL; 302 - struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; 303 - 304 - if (!device || !id || !bus) { 305 - return -EINVAL; 306 - } 307 - 308 - data = kzalloc(sizeof(struct acpi_pci_data), GFP_KERNEL); 309 - if (!data) 310 - return -ENOMEM; 311 - 312 - data->id = *id; 313 - data->bus = bus; 314 109 device->ops.bind = acpi_pci_bind; 315 110 device->ops.unbind = acpi_pci_unbind; 316 111 317 - status = acpi_get_name(device->handle, ACPI_FULL_PATHNAME, &buffer); 318 - if (ACPI_FAILURE(status)) { 319 - kfree (data); 320 - return -ENODEV; 321 - } 322 - 323 - ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Binding PCI root bridge [%s] to " 324 - "%04x:%02x\n", (char *)buffer.pointer, 325 - id->segment, id->bus)); 326 - 327 - status = acpi_attach_data(device->handle, acpi_pci_data_handler, data); 328 - if (ACPI_FAILURE(status)) { 329 - ACPI_EXCEPTION((AE_INFO, status, 330 - "Unable to attach ACPI-PCI context to device %s", 331 - (char *)buffer.pointer)); 332 - result = -ENODEV; 333 - goto end; 334 - } 335 - 336 - end: 337 - kfree(buffer.pointer); 338 - if (result != 0) 339 - kfree(data); 340 - 341 - return result; 112 + return 0; 342 113 }
+9 -8
drivers/acpi/pci_irq.c
··· 182 182 } 183 183 } 184 184 185 - static int acpi_pci_irq_add_entry(acpi_handle handle, int segment, int bus, 185 + static int acpi_pci_irq_add_entry(acpi_handle handle, struct pci_bus *bus, 186 186 struct acpi_pci_routing_table *prt) 187 187 { 188 188 struct acpi_prt_entry *entry; ··· 196 196 * 1=INTA, 2=INTB. We use the PCI encoding throughout, so convert 197 197 * it here. 198 198 */ 199 - entry->id.segment = segment; 200 - entry->id.bus = bus; 199 + entry->id.segment = pci_domain_nr(bus); 200 + entry->id.bus = bus->number; 201 201 entry->id.device = (prt->address >> 16) & 0xFFFF; 202 202 entry->pin = prt->pin + 1; 203 203 ··· 242 242 return 0; 243 243 } 244 244 245 - int acpi_pci_irq_add_prt(acpi_handle handle, int segment, int bus) 245 + int acpi_pci_irq_add_prt(acpi_handle handle, struct pci_bus *bus) 246 246 { 247 247 acpi_status status; 248 248 struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; ··· 271 271 272 272 entry = buffer.pointer; 273 273 while (entry && (entry->length > 0)) { 274 - acpi_pci_irq_add_entry(handle, segment, bus, entry); 274 + acpi_pci_irq_add_entry(handle, bus, entry); 275 275 entry = (struct acpi_pci_routing_table *) 276 276 ((unsigned long)entry + entry->length); 277 277 } ··· 280 280 return 0; 281 281 } 282 282 283 - void acpi_pci_irq_del_prt(int segment, int bus) 283 + void acpi_pci_irq_del_prt(struct pci_bus *bus) 284 284 { 285 285 struct acpi_prt_entry *entry, *tmp; 286 286 287 287 printk(KERN_DEBUG 288 288 "ACPI: Delete PCI Interrupt Routing Table for %04x:%02x\n", 289 - segment, bus); 289 + pci_domain_nr(bus), bus->number); 290 290 spin_lock(&acpi_prt_lock); 291 291 list_for_each_entry_safe(entry, tmp, &acpi_prt_list, list) { 292 - if (segment == entry->id.segment && bus == entry->id.bus) { 292 + if (pci_domain_nr(bus) == entry->id.segment 293 + && bus->number == entry->id.bus) { 293 294 list_del(&entry->list); 294 295 kfree(entry); 295 296 }
+164 -133
drivers/acpi/pci_root.c
··· 63 63 64 64 struct acpi_pci_root { 65 65 struct list_head node; 66 - struct acpi_device * device; 67 - struct acpi_pci_id id; 66 + struct acpi_device *device; 68 67 struct pci_bus *bus; 68 + u16 segment; 69 + u8 bus_nr; 69 70 70 71 u32 osc_support_set; /* _OSC state of support bits */ 71 72 u32 osc_control_set; /* _OSC state of control bits */ ··· 83 82 int acpi_pci_register_driver(struct acpi_pci_driver *driver) 84 83 { 85 84 int n = 0; 86 - struct list_head *entry; 85 + struct acpi_pci_root *root; 87 86 88 87 struct acpi_pci_driver **pptr = &sub_driver; 89 88 while (*pptr) ··· 93 92 if (!driver->add) 94 93 return 0; 95 94 96 - list_for_each(entry, &acpi_pci_roots) { 97 - struct acpi_pci_root *root; 98 - root = list_entry(entry, struct acpi_pci_root, node); 95 + list_for_each_entry(root, &acpi_pci_roots, node) { 99 96 driver->add(root->device->handle); 100 97 n++; 101 98 } ··· 105 106 106 107 void acpi_pci_unregister_driver(struct acpi_pci_driver *driver) 107 108 { 108 - struct list_head *entry; 109 + struct acpi_pci_root *root; 109 110 110 111 struct acpi_pci_driver **pptr = &sub_driver; 111 112 while (*pptr) { ··· 119 120 if (!driver->remove) 120 121 return; 121 122 122 - list_for_each(entry, &acpi_pci_roots) { 123 - struct acpi_pci_root *root; 124 - root = list_entry(entry, struct acpi_pci_root, node); 123 + list_for_each_entry(root, &acpi_pci_roots, node) 125 124 driver->remove(root->device->handle); 126 - } 127 125 } 128 126 129 127 EXPORT_SYMBOL(acpi_pci_unregister_driver); 130 128 131 129 acpi_handle acpi_get_pci_rootbridge_handle(unsigned int seg, unsigned int bus) 132 130 { 133 - struct acpi_pci_root *tmp; 131 + struct acpi_pci_root *root; 134 132 135 - list_for_each_entry(tmp, &acpi_pci_roots, node) { 136 - if ((tmp->id.segment == (u16) seg) && (tmp->id.bus == (u16) bus)) 137 - return tmp->device->handle; 138 - } 133 + list_for_each_entry(root, &acpi_pci_roots, node) 134 + if ((root->segment == (u16) seg) && (root->bus_nr == (u16) bus)) 135 + return root->device->handle; 139 136 return NULL; 140 137 } 141 138 142 139 EXPORT_SYMBOL_GPL(acpi_get_pci_rootbridge_handle); 140 + 141 + /** 142 + * acpi_is_root_bridge - determine whether an ACPI CA node is a PCI root bridge 143 + * @handle - the ACPI CA node in question. 144 + * 145 + * Note: we could make this API take a struct acpi_device * instead, but 146 + * for now, it's more convenient to operate on an acpi_handle. 147 + */ 148 + int acpi_is_root_bridge(acpi_handle handle) 149 + { 150 + int ret; 151 + struct acpi_device *device; 152 + 153 + ret = acpi_bus_get_device(handle, &device); 154 + if (ret) 155 + return 0; 156 + 157 + ret = acpi_match_device_ids(device, root_device_ids); 158 + if (ret) 159 + return 0; 160 + else 161 + return 1; 162 + } 163 + EXPORT_SYMBOL_GPL(acpi_is_root_bridge); 143 164 144 165 static acpi_status 145 166 get_root_bridge_busnr_callback(struct acpi_resource *resource, void *data) ··· 180 161 return AE_OK; 181 162 } 182 163 183 - static acpi_status try_get_root_bridge_busnr(acpi_handle handle, int *busnum) 164 + static acpi_status try_get_root_bridge_busnr(acpi_handle handle, 165 + unsigned long long *bus) 184 166 { 185 167 acpi_status status; 168 + int busnum; 186 169 187 - *busnum = -1; 170 + busnum = -1; 188 171 status = 189 172 acpi_walk_resources(handle, METHOD_NAME__CRS, 190 - get_root_bridge_busnr_callback, busnum); 173 + get_root_bridge_busnr_callback, &busnum); 191 174 if (ACPI_FAILURE(status)) 192 175 return status; 193 176 /* Check if we really get a bus number from _CRS */ 194 - if (*busnum == -1) 177 + if (busnum == -1) 195 178 return AE_ERROR; 179 + *bus = busnum; 196 180 return AE_OK; 197 181 } 198 182 ··· 320 298 static struct acpi_pci_root *acpi_pci_find_root(acpi_handle handle) 321 299 { 322 300 struct acpi_pci_root *root; 301 + 323 302 list_for_each_entry(root, &acpi_pci_roots, node) { 324 303 if (root->device->handle == handle) 325 304 return root; 326 305 } 327 306 return NULL; 328 307 } 308 + 309 + struct acpi_handle_node { 310 + struct list_head node; 311 + acpi_handle handle; 312 + }; 313 + 314 + /** 315 + * acpi_get_pci_dev - convert ACPI CA handle to struct pci_dev 316 + * @handle: the handle in question 317 + * 318 + * Given an ACPI CA handle, the desired PCI device is located in the 319 + * list of PCI devices. 320 + * 321 + * If the device is found, its reference count is increased and this 322 + * function returns a pointer to its data structure. The caller must 323 + * decrement the reference count by calling pci_dev_put(). 324 + * If no device is found, %NULL is returned. 325 + */ 326 + struct pci_dev *acpi_get_pci_dev(acpi_handle handle) 327 + { 328 + int dev, fn; 329 + unsigned long long adr; 330 + acpi_status status; 331 + acpi_handle phandle; 332 + struct pci_bus *pbus; 333 + struct pci_dev *pdev = NULL; 334 + struct acpi_handle_node *node, *tmp; 335 + struct acpi_pci_root *root; 336 + LIST_HEAD(device_list); 337 + 338 + /* 339 + * Walk up the ACPI CA namespace until we reach a PCI root bridge. 340 + */ 341 + phandle = handle; 342 + while (!acpi_is_root_bridge(phandle)) { 343 + node = kzalloc(sizeof(struct acpi_handle_node), GFP_KERNEL); 344 + if (!node) 345 + goto out; 346 + 347 + INIT_LIST_HEAD(&node->node); 348 + node->handle = phandle; 349 + list_add(&node->node, &device_list); 350 + 351 + status = acpi_get_parent(phandle, &phandle); 352 + if (ACPI_FAILURE(status)) 353 + goto out; 354 + } 355 + 356 + root = acpi_pci_find_root(phandle); 357 + if (!root) 358 + goto out; 359 + 360 + pbus = root->bus; 361 + 362 + /* 363 + * Now, walk back down the PCI device tree until we return to our 364 + * original handle. Assumes that everything between the PCI root 365 + * bridge and the device we're looking for must be a P2P bridge. 366 + */ 367 + list_for_each_entry(node, &device_list, node) { 368 + acpi_handle hnd = node->handle; 369 + status = acpi_evaluate_integer(hnd, "_ADR", NULL, &adr); 370 + if (ACPI_FAILURE(status)) 371 + goto out; 372 + dev = (adr >> 16) & 0xffff; 373 + fn = adr & 0xffff; 374 + 375 + pdev = pci_get_slot(pbus, PCI_DEVFN(dev, fn)); 376 + if (hnd == handle) 377 + break; 378 + 379 + pbus = pdev->subordinate; 380 + pci_dev_put(pdev); 381 + } 382 + out: 383 + list_for_each_entry_safe(node, tmp, &device_list, node) 384 + kfree(node); 385 + 386 + return pdev; 387 + } 388 + EXPORT_SYMBOL_GPL(acpi_get_pci_dev); 329 389 330 390 /** 331 391 * acpi_pci_osc_control_set - commit requested control to Firmware ··· 467 363 468 364 static int __devinit acpi_pci_root_add(struct acpi_device *device) 469 365 { 470 - int result = 0; 471 - struct acpi_pci_root *root = NULL; 472 - struct acpi_pci_root *tmp; 473 - acpi_status status = AE_OK; 474 - unsigned long long value = 0; 475 - acpi_handle handle = NULL; 366 + unsigned long long segment, bus; 367 + acpi_status status; 368 + int result; 369 + struct acpi_pci_root *root; 370 + acpi_handle handle; 476 371 struct acpi_device *child; 477 372 u32 flags, base_flags; 478 373 374 + segment = 0; 375 + status = acpi_evaluate_integer(device->handle, METHOD_NAME__SEG, NULL, 376 + &segment); 377 + if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) { 378 + printk(KERN_ERR PREFIX "can't evaluate _SEG\n"); 379 + return -ENODEV; 380 + } 479 381 480 - if (!device) 481 - return -EINVAL; 382 + /* Check _CRS first, then _BBN. If no _BBN, default to zero. */ 383 + bus = 0; 384 + status = try_get_root_bridge_busnr(device->handle, &bus); 385 + if (ACPI_FAILURE(status)) { 386 + status = acpi_evaluate_integer(device->handle, METHOD_NAME__BBN, NULL, &bus); 387 + if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) { 388 + printk(KERN_ERR PREFIX 389 + "no bus number in _CRS and can't evaluate _BBN\n"); 390 + return -ENODEV; 391 + } 392 + } 482 393 483 394 root = kzalloc(sizeof(struct acpi_pci_root), GFP_KERNEL); 484 395 if (!root) 485 396 return -ENOMEM; 486 - INIT_LIST_HEAD(&root->node); 487 397 398 + INIT_LIST_HEAD(&root->node); 488 399 root->device = device; 400 + root->segment = segment & 0xFFFF; 401 + root->bus_nr = bus & 0xFF; 489 402 strcpy(acpi_device_name(device), ACPI_PCI_ROOT_DEVICE_NAME); 490 403 strcpy(acpi_device_class(device), ACPI_PCI_ROOT_CLASS); 491 404 device->driver_data = root; 492 - 493 - device->ops.bind = acpi_pci_bind; 494 405 495 406 /* 496 407 * All supported architectures that use ACPI have support for ··· 513 394 */ 514 395 flags = base_flags = OSC_PCI_SEGMENT_GROUPS_SUPPORT; 515 396 acpi_pci_osc_support(root, flags); 516 - 517 - /* 518 - * Segment 519 - * ------- 520 - * Obtained via _SEG, if exists, otherwise assumed to be zero (0). 521 - */ 522 - status = acpi_evaluate_integer(device->handle, METHOD_NAME__SEG, NULL, 523 - &value); 524 - switch (status) { 525 - case AE_OK: 526 - root->id.segment = (u16) value; 527 - break; 528 - case AE_NOT_FOUND: 529 - ACPI_DEBUG_PRINT((ACPI_DB_INFO, 530 - "Assuming segment 0 (no _SEG)\n")); 531 - root->id.segment = 0; 532 - break; 533 - default: 534 - ACPI_EXCEPTION((AE_INFO, status, "Evaluating _SEG")); 535 - result = -ENODEV; 536 - goto end; 537 - } 538 - 539 - /* 540 - * Bus 541 - * --- 542 - * Obtained via _BBN, if exists, otherwise assumed to be zero (0). 543 - */ 544 - status = acpi_evaluate_integer(device->handle, METHOD_NAME__BBN, NULL, 545 - &value); 546 - switch (status) { 547 - case AE_OK: 548 - root->id.bus = (u16) value; 549 - break; 550 - case AE_NOT_FOUND: 551 - ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Assuming bus 0 (no _BBN)\n")); 552 - root->id.bus = 0; 553 - break; 554 - default: 555 - ACPI_EXCEPTION((AE_INFO, status, "Evaluating _BBN")); 556 - result = -ENODEV; 557 - goto end; 558 - } 559 - 560 - /* Some systems have wrong _BBN */ 561 - list_for_each_entry(tmp, &acpi_pci_roots, node) { 562 - if ((tmp->id.segment == root->id.segment) 563 - && (tmp->id.bus == root->id.bus)) { 564 - int bus = 0; 565 - acpi_status status; 566 - 567 - printk(KERN_ERR PREFIX 568 - "Wrong _BBN value, reboot" 569 - " and use option 'pci=noacpi'\n"); 570 - 571 - status = try_get_root_bridge_busnr(device->handle, &bus); 572 - if (ACPI_FAILURE(status)) 573 - break; 574 - if (bus != root->id.bus) { 575 - printk(KERN_INFO PREFIX 576 - "PCI _CRS %d overrides _BBN 0\n", bus); 577 - root->id.bus = bus; 578 - } 579 - break; 580 - } 581 - } 582 - /* 583 - * Device & Function 584 - * ----------------- 585 - * Obtained from _ADR (which has already been evaluated for us). 586 - */ 587 - root->id.device = device->pnp.bus_address >> 16; 588 - root->id.function = device->pnp.bus_address & 0xFFFF; 589 397 590 398 /* 591 399 * TBD: Need PCI interface for enumeration/configuration of roots. ··· 523 477 524 478 printk(KERN_INFO PREFIX "%s [%s] (%04x:%02x)\n", 525 479 acpi_device_name(device), acpi_device_bid(device), 526 - root->id.segment, root->id.bus); 480 + root->segment, root->bus_nr); 527 481 528 482 /* 529 483 * Scan the Root Bridge ··· 532 486 * PCI namespace does not get created until this call is made (and 533 487 * thus the root bridge's pci_dev does not exist). 534 488 */ 535 - root->bus = pci_acpi_scan_root(device, root->id.segment, root->id.bus); 489 + root->bus = pci_acpi_scan_root(device, segment, bus); 536 490 if (!root->bus) { 537 491 printk(KERN_ERR PREFIX 538 492 "Bus %04x:%02x not present in PCI namespace\n", 539 - root->id.segment, root->id.bus); 493 + root->segment, root->bus_nr); 540 494 result = -ENODEV; 541 495 goto end; 542 496 } ··· 546 500 * ----------------------- 547 501 * Thus binding the ACPI and PCI devices. 548 502 */ 549 - result = acpi_pci_bind_root(device, &root->id, root->bus); 503 + result = acpi_pci_bind_root(device); 550 504 if (result) 551 505 goto end; 552 506 ··· 557 511 */ 558 512 status = acpi_get_handle(device->handle, METHOD_NAME__PRT, &handle); 559 513 if (ACPI_SUCCESS(status)) 560 - result = acpi_pci_irq_add_prt(device->handle, root->id.segment, 561 - root->id.bus); 514 + result = acpi_pci_irq_add_prt(device->handle, root->bus); 562 515 563 516 /* 564 517 * Scan and bind all _ADR-Based Devices ··· 576 531 if (flags != base_flags) 577 532 acpi_pci_osc_support(root, flags); 578 533 579 - end: 580 - if (result) { 581 - if (!list_empty(&root->node)) 582 - list_del(&root->node); 583 - kfree(root); 584 - } 534 + return 0; 585 535 536 + end: 537 + if (!list_empty(&root->node)) 538 + list_del(&root->node); 539 + kfree(root); 586 540 return result; 587 541 } 588 542 589 543 static int acpi_pci_root_start(struct acpi_device *device) 590 544 { 591 - struct acpi_pci_root *root; 545 + struct acpi_pci_root *root = acpi_driver_data(device); 592 546 593 - 594 - list_for_each_entry(root, &acpi_pci_roots, node) { 595 - if (root->device == device) { 596 - pci_bus_add_devices(root->bus); 597 - return 0; 598 - } 599 - } 600 - return -ENODEV; 547 + pci_bus_add_devices(root->bus); 548 + return 0; 601 549 } 602 550 603 551 static int acpi_pci_root_remove(struct acpi_device *device, int type) 604 552 { 605 - struct acpi_pci_root *root = NULL; 606 - 607 - 608 - if (!device || !acpi_driver_data(device)) 609 - return -EINVAL; 610 - 611 - root = acpi_driver_data(device); 553 + struct acpi_pci_root *root = acpi_driver_data(device); 612 554 613 555 kfree(root); 614 - 615 556 return 0; 616 557 } 617 558
+2 -26
drivers/acpi/power.c
··· 194 194 195 195 static int acpi_power_on(acpi_handle handle, struct acpi_device *dev) 196 196 { 197 - int result = 0, state; 197 + int result = 0; 198 198 int found = 0; 199 199 acpi_status status = AE_OK; 200 200 struct acpi_power_resource *resource = NULL; ··· 236 236 if (ACPI_FAILURE(status)) 237 237 return -ENODEV; 238 238 239 - if (!acpi_power_nocheck) { 240 - /* 241 - * If acpi_power_nocheck is set, it is unnecessary to check 242 - * the power state after power transition. 243 - */ 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 - } 251 239 /* Update the power resource's _device_ power state */ 252 240 resource->device->power.state = ACPI_STATE_D0; 253 241 ··· 246 258 247 259 static int acpi_power_off_device(acpi_handle handle, struct acpi_device *dev) 248 260 { 249 - int result = 0, state; 261 + int result = 0; 250 262 acpi_status status = AE_OK; 251 263 struct acpi_power_resource *resource = NULL; 252 264 struct list_head *node, *next; ··· 280 292 status = acpi_evaluate_object(resource->device->handle, "_OFF", NULL, NULL); 281 293 if (ACPI_FAILURE(status)) 282 294 return -ENODEV; 283 - 284 - if (!acpi_power_nocheck) { 285 - /* 286 - * If acpi_power_nocheck is set, it is unnecessary to check 287 - * the power state after power transition. 288 - */ 289 - result = acpi_power_get_state(handle, &state); 290 - if (result) 291 - return result; 292 - if (state != ACPI_POWER_RESOURCE_STATE_OFF) 293 - return -ENOEXEC; 294 - } 295 295 296 296 /* Update the power resource's _device_ power state */ 297 297 resource->device->power.state = ACPI_STATE_D3;
+28 -17
drivers/acpi/processor_core.c
··· 89 89 90 90 static const struct acpi_device_id processor_device_ids[] = { 91 91 {ACPI_PROCESSOR_OBJECT_HID, 0}, 92 - {ACPI_PROCESSOR_HID, 0}, 92 + {"ACPI0007", 0}, 93 93 {"", 0}, 94 94 }; 95 95 MODULE_DEVICE_TABLE(acpi, processor_device_ids); ··· 596 596 ACPI_DEBUG_PRINT((ACPI_DB_INFO, 597 597 "No bus mastering arbitration control\n")); 598 598 599 - if (!strcmp(acpi_device_hid(device), ACPI_PROCESSOR_HID)) { 599 + if (!strcmp(acpi_device_hid(device), ACPI_PROCESSOR_OBJECT_HID)) { 600 + /* Declared with "Processor" statement; match ProcessorID */ 601 + status = acpi_evaluate_object(pr->handle, NULL, NULL, &buffer); 602 + if (ACPI_FAILURE(status)) { 603 + printk(KERN_ERR PREFIX "Evaluating processor object\n"); 604 + return -ENODEV; 605 + } 606 + 607 + /* 608 + * TBD: Synch processor ID (via LAPIC/LSAPIC structures) on SMP. 609 + * >>> 'acpi_get_processor_id(acpi_id, &id)' in 610 + * arch/xxx/acpi.c 611 + */ 612 + pr->acpi_id = object.processor.proc_id; 613 + } else { 600 614 /* 601 615 * Declared with "Device" statement; match _UID. 602 616 * Note that we don't handle string _UIDs yet. ··· 625 611 } 626 612 device_declaration = 1; 627 613 pr->acpi_id = value; 628 - } else { 629 - /* Declared with "Processor" statement; match ProcessorID */ 630 - status = acpi_evaluate_object(pr->handle, NULL, NULL, &buffer); 631 - if (ACPI_FAILURE(status)) { 632 - printk(KERN_ERR PREFIX "Evaluating processor object\n"); 633 - return -ENODEV; 634 - } 635 - 636 - /* 637 - * TBD: Synch processor ID (via LAPIC/LSAPIC structures) on SMP. 638 - * >>> 'acpi_get_processor_id(acpi_id, &id)' in 639 - * arch/xxx/acpi.c 640 - */ 641 - pr->acpi_id = object.processor.proc_id; 642 614 } 643 615 cpu_index = get_cpu_id(pr->handle, device_declaration, pr->acpi_id); 644 616 ··· 649 649 return -ENODEV; 650 650 } 651 651 } 652 - 652 + /* 653 + * On some boxes several processors use the same processor bus id. 654 + * But they are located in different scope. For example: 655 + * \_SB.SCK0.CPU0 656 + * \_SB.SCK1.CPU0 657 + * Rename the processor device bus id. And the new bus id will be 658 + * generated as the following format: 659 + * CPU+CPU ID. 660 + */ 661 + sprintf(acpi_device_bid(device), "CPU%X", pr->id); 653 662 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Processor [%d:%d]\n", pr->id, 654 663 pr->acpi_id)); 655 664 ··· 740 731 /* _PDC call should be done before doing anything else (if reqd.). */ 741 732 arch_acpi_processor_init_pdc(pr); 742 733 acpi_processor_set_pdc(pr); 734 + arch_acpi_processor_cleanup_pdc(pr); 735 + 743 736 #ifdef CONFIG_CPU_FREQ 744 737 acpi_processor_ppc_has_changed(pr); 745 738 #endif
+23 -24
drivers/acpi/processor_idle.c
··· 139 139 * are affected too. We pick the most conservative approach: we assume 140 140 * that the local APIC stops in both C2 and C3. 141 141 */ 142 - static void acpi_timer_check_state(int state, struct acpi_processor *pr, 142 + static void lapic_timer_check_state(int state, struct acpi_processor *pr, 143 143 struct acpi_processor_cx *cx) 144 144 { 145 145 struct acpi_processor_power *pwr = &pr->power; ··· 162 162 pr->power.timer_broadcast_on_state = state; 163 163 } 164 164 165 - static void acpi_propagate_timer_broadcast(struct acpi_processor *pr) 165 + static void lapic_timer_propagate_broadcast(struct acpi_processor *pr) 166 166 { 167 167 unsigned long reason; 168 168 ··· 173 173 } 174 174 175 175 /* Power(C) State timer broadcast control */ 176 - static void acpi_state_timer_broadcast(struct acpi_processor *pr, 176 + static void lapic_timer_state_broadcast(struct acpi_processor *pr, 177 177 struct acpi_processor_cx *cx, 178 178 int broadcast) 179 179 { ··· 190 190 191 191 #else 192 192 193 - static void acpi_timer_check_state(int state, struct acpi_processor *pr, 193 + static void lapic_timer_check_state(int state, struct acpi_processor *pr, 194 194 struct acpi_processor_cx *cstate) { } 195 - static void acpi_propagate_timer_broadcast(struct acpi_processor *pr) { } 196 - static void acpi_state_timer_broadcast(struct acpi_processor *pr, 195 + static void lapic_timer_propagate_broadcast(struct acpi_processor *pr) { } 196 + static void lapic_timer_state_broadcast(struct acpi_processor *pr, 197 197 struct acpi_processor_cx *cx, 198 198 int broadcast) 199 199 { ··· 515 515 static void acpi_processor_power_verify_c3(struct acpi_processor *pr, 516 516 struct acpi_processor_cx *cx) 517 517 { 518 - static int bm_check_flag; 518 + static int bm_check_flag = -1; 519 + static int bm_control_flag = -1; 519 520 520 521 521 522 if (!cx->address) ··· 546 545 } 547 546 548 547 /* All the logic here assumes flags.bm_check is same across all CPUs */ 549 - if (!bm_check_flag) { 548 + if (bm_check_flag == -1) { 550 549 /* Determine whether bm_check is needed based on CPU */ 551 550 acpi_processor_power_init_bm_check(&(pr->flags), pr->id); 552 551 bm_check_flag = pr->flags.bm_check; 552 + bm_control_flag = pr->flags.bm_control; 553 553 } else { 554 554 pr->flags.bm_check = bm_check_flag; 555 + pr->flags.bm_control = bm_control_flag; 555 556 } 556 557 557 558 if (pr->flags.bm_check) { ··· 617 614 switch (cx->type) { 618 615 case ACPI_STATE_C1: 619 616 cx->valid = 1; 620 - acpi_timer_check_state(i, pr, cx); 621 617 break; 622 618 623 619 case ACPI_STATE_C2: 624 620 acpi_processor_power_verify_c2(cx); 625 - if (cx->valid) 626 - acpi_timer_check_state(i, pr, cx); 627 621 break; 628 622 629 623 case ACPI_STATE_C3: 630 624 acpi_processor_power_verify_c3(pr, cx); 631 - if (cx->valid) 632 - acpi_timer_check_state(i, pr, cx); 633 625 break; 634 626 } 635 - if (cx->valid) 636 - tsc_check_state(cx->type); 627 + if (!cx->valid) 628 + continue; 637 629 638 - if (cx->valid) 639 - working++; 630 + lapic_timer_check_state(i, pr, cx); 631 + tsc_check_state(cx->type); 632 + working++; 640 633 } 641 634 642 - acpi_propagate_timer_broadcast(pr); 635 + lapic_timer_propagate_broadcast(pr); 643 636 644 637 return (working); 645 638 } ··· 838 839 return 0; 839 840 } 840 841 841 - acpi_state_timer_broadcast(pr, cx, 1); 842 + lapic_timer_state_broadcast(pr, cx, 1); 842 843 kt1 = ktime_get_real(); 843 844 acpi_idle_do_entry(cx); 844 845 kt2 = ktime_get_real(); ··· 846 847 847 848 local_irq_enable(); 848 849 cx->usage++; 849 - acpi_state_timer_broadcast(pr, cx, 0); 850 + lapic_timer_state_broadcast(pr, cx, 0); 850 851 851 852 return idle_time; 852 853 } ··· 891 892 * Must be done before busmaster disable as we might need to 892 893 * access HPET ! 893 894 */ 894 - acpi_state_timer_broadcast(pr, cx, 1); 895 + lapic_timer_state_broadcast(pr, cx, 1); 895 896 896 897 if (cx->type == ACPI_STATE_C3) 897 898 ACPI_FLUSH_CPU_CACHE(); ··· 913 914 914 915 cx->usage++; 915 916 916 - acpi_state_timer_broadcast(pr, cx, 0); 917 + lapic_timer_state_broadcast(pr, cx, 0); 917 918 cx->time += sleep_ticks; 918 919 return idle_time; 919 920 } ··· 980 981 * Must be done before busmaster disable as we might need to 981 982 * access HPET ! 982 983 */ 983 - acpi_state_timer_broadcast(pr, cx, 1); 984 + lapic_timer_state_broadcast(pr, cx, 1); 984 985 985 986 kt1 = ktime_get_real(); 986 987 /* ··· 1025 1026 1026 1027 cx->usage++; 1027 1028 1028 - acpi_state_timer_broadcast(pr, cx, 0); 1029 + lapic_timer_state_broadcast(pr, cx, 0); 1029 1030 cx->time += sleep_ticks; 1030 1031 return idle_time; 1031 1032 }
+30 -39
drivers/acpi/scan.c
··· 95 95 } 96 96 static DEVICE_ATTR(modalias, 0444, acpi_device_modalias_show, NULL); 97 97 98 - static int acpi_bus_hot_remove_device(void *context) 98 + static void acpi_bus_hot_remove_device(void *context) 99 99 { 100 100 struct acpi_device *device; 101 101 acpi_handle handle = context; ··· 104 104 acpi_status status = AE_OK; 105 105 106 106 if (acpi_bus_get_device(handle, &device)) 107 - return 0; 107 + return; 108 108 109 109 if (!device) 110 - return 0; 110 + return; 111 111 112 112 ACPI_DEBUG_PRINT((ACPI_DB_INFO, 113 113 "Hot-removing device %s...\n", dev_name(&device->dev))); ··· 115 115 if (acpi_bus_trim(device, 1)) { 116 116 printk(KERN_ERR PREFIX 117 117 "Removing device failed\n"); 118 - return -1; 118 + return; 119 119 } 120 120 121 121 /* power off device */ ··· 142 142 */ 143 143 status = acpi_evaluate_object(handle, "_EJ0", &arg_list, NULL); 144 144 if (ACPI_FAILURE(status)) 145 - return -ENODEV; 145 + printk(KERN_WARNING PREFIX 146 + "Eject device failed\n"); 146 147 147 - return 0; 148 + return; 148 149 } 149 150 150 151 static ssize_t ··· 156 155 acpi_status status; 157 156 acpi_object_type type = 0; 158 157 struct acpi_device *acpi_device = to_acpi_device(d); 159 - struct task_struct *task; 160 158 161 159 if ((!count) || (buf[0] != '1')) { 162 160 return -EINVAL; ··· 172 172 goto err; 173 173 } 174 174 175 - /* remove the device in another thread to fix the deadlock issue */ 176 - task = kthread_run(acpi_bus_hot_remove_device, 177 - acpi_device->handle, "acpi_hot_remove_device"); 178 - if (IS_ERR(task)) 179 - ret = PTR_ERR(task); 175 + acpi_os_hotplug_execute(acpi_bus_hot_remove_device, acpi_device->handle); 180 176 err: 181 177 return ret; 182 178 } ··· 194 198 int result; 195 199 196 200 result = acpi_get_name(acpi_dev->handle, ACPI_FULL_PATHNAME, &path); 197 - if(result) 201 + if (result) 198 202 goto end; 199 203 200 204 result = sprintf(buf, "%s\n", (char*)path.pointer); 201 205 kfree(path.pointer); 202 - end: 206 + end: 203 207 return result; 204 208 } 205 209 static DEVICE_ATTR(path, 0444, acpi_device_path_show, NULL); ··· 213 217 /* 214 218 * Devices gotten from FADT don't have a "path" attribute 215 219 */ 216 - if(dev->handle) { 220 + if (dev->handle) { 217 221 result = device_create_file(&dev->dev, &dev_attr_path); 218 - if(result) 222 + if (result) 219 223 goto end; 220 224 } 221 225 222 - if(dev->flags.hardware_id) { 226 + if (dev->flags.hardware_id) { 223 227 result = device_create_file(&dev->dev, &dev_attr_hid); 224 - if(result) 228 + if (result) 225 229 goto end; 226 230 } 227 231 228 - if (dev->flags.hardware_id || dev->flags.compatible_ids){ 232 + if (dev->flags.hardware_id || dev->flags.compatible_ids) { 229 233 result = device_create_file(&dev->dev, &dev_attr_modalias); 230 - if(result) 234 + if (result) 231 235 goto end; 232 236 } 233 237 ··· 238 242 status = acpi_get_handle(dev->handle, "_EJ0", &temp); 239 243 if (ACPI_SUCCESS(status)) 240 244 result = device_create_file(&dev->dev, &dev_attr_eject); 241 - end: 245 + end: 242 246 return result; 243 247 } 244 248 ··· 258 262 if (dev->flags.hardware_id || dev->flags.compatible_ids) 259 263 device_remove_file(&dev->dev, &dev_attr_modalias); 260 264 261 - if(dev->flags.hardware_id) 265 + if (dev->flags.hardware_id) 262 266 device_remove_file(&dev->dev, &dev_attr_hid); 263 - if(dev->handle) 267 + if (dev->handle) 264 268 device_remove_file(&dev->dev, &dev_attr_path); 265 269 } 266 270 /* -------------------------------------------------------------------------- ··· 508 512 break; 509 513 } 510 514 } 511 - if(!found) { 515 + if (!found) { 512 516 acpi_device_bus_id = new_bus_id; 513 517 strcpy(acpi_device_bus_id->bus_id, device->flags.hardware_id ? device->pnp.hardware_id : "device"); 514 518 acpi_device_bus_id->instance_no = 0; ··· 526 530 if (device->parent) 527 531 device->dev.parent = &parent->dev; 528 532 device->dev.bus = &acpi_bus_type; 529 - device_initialize(&device->dev); 530 533 device->dev.release = &acpi_device_release; 531 - result = device_add(&device->dev); 532 - if(result) { 533 - dev_err(&device->dev, "Error adding device\n"); 534 + result = device_register(&device->dev); 535 + if (result) { 536 + dev_err(&device->dev, "Error registering device\n"); 534 537 goto end; 535 538 } 536 539 537 540 result = acpi_device_setup_files(device); 538 - if(result) 541 + if (result) 539 542 printk(KERN_ERR PREFIX "Error creating sysfs interface for device %s\n", 540 543 dev_name(&device->dev)); 541 544 542 545 device->removal_type = ACPI_BUS_REMOVAL_NORMAL; 543 546 return 0; 544 - end: 547 + end: 545 548 mutex_lock(&acpi_device_lock); 546 549 if (device->parent) 547 550 list_del(&device->node); ··· 572 577 * @device: the device to add and initialize 573 578 * @driver: driver for the device 574 579 * 575 - * Used to initialize a device via its device driver. Called whenever a 580 + * Used to initialize a device via its device driver. Called whenever a 576 581 * driver is bound to a device. Invokes the driver's add() ops. 577 582 */ 578 583 static int 579 584 acpi_bus_driver_init(struct acpi_device *device, struct acpi_driver *driver) 580 585 { 581 586 int result = 0; 582 - 583 587 584 588 if (!device || !driver) 585 589 return -EINVAL; ··· 796 802 if (!acpi_match_device_ids(device, button_device_ids)) 797 803 device->wakeup.flags.run_wake = 1; 798 804 799 - end: 805 + end: 800 806 if (ACPI_FAILURE(status)) 801 807 device->flags.wake_capable = 0; 802 808 return 0; ··· 1064 1070 break; 1065 1071 } 1066 1072 1067 - /* 1073 + /* 1068 1074 * \_SB 1069 1075 * ---- 1070 1076 * Fix for the system root bus device -- the only root-level device. ··· 1314 1320 device->parent->ops.bind(device); 1315 1321 } 1316 1322 1317 - end: 1323 + end: 1318 1324 if (!result) 1319 1325 *child = device; 1320 1326 else { ··· 1458 1464 1459 1465 return result; 1460 1466 } 1461 - 1462 1467 EXPORT_SYMBOL(acpi_bus_add); 1463 1468 1464 1469 int acpi_bus_start(struct acpi_device *device) ··· 1477 1484 } 1478 1485 return result; 1479 1486 } 1480 - 1481 1487 EXPORT_SYMBOL(acpi_bus_start); 1482 1488 1483 1489 int acpi_bus_trim(struct acpi_device *start, int rmdevice) ··· 1533 1541 return err; 1534 1542 } 1535 1543 EXPORT_SYMBOL_GPL(acpi_bus_trim); 1536 - 1537 1544 1538 1545 static int acpi_bus_scan_fixed(struct acpi_device *root) 1539 1546 { ··· 1601 1610 if (result) 1602 1611 acpi_device_unregister(acpi_root, ACPI_BUS_REMOVAL_NORMAL); 1603 1612 1604 - Done: 1613 + Done: 1605 1614 return result; 1606 1615 }
+52 -9
drivers/acpi/video.c
··· 76 76 static int brightness_switch_enabled = 1; 77 77 module_param(brightness_switch_enabled, bool, 0644); 78 78 79 + static int register_count = 0; 79 80 static int acpi_video_bus_add(struct acpi_device *device); 80 81 static int acpi_video_bus_remove(struct acpi_device *device, int type); 81 82 static int acpi_video_resume(struct acpi_device *device); ··· 587 586 DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5315"), 588 587 }, 589 588 }, 589 + { 590 + .callback = video_set_bqc_offset, 591 + .ident = "Acer Aspire 7720", 592 + .matches = { 593 + DMI_MATCH(DMI_BOARD_VENDOR, "Acer"), 594 + DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 7720"), 595 + }, 596 + }, 590 597 {} 591 598 }; 592 599 ··· 985 976 device->backlight->props.max_brightness = device->brightness->count-3; 986 977 kfree(name); 987 978 979 + result = sysfs_create_link(&device->backlight->dev.kobj, 980 + &device->dev->dev.kobj, "device"); 981 + if (result) 982 + printk(KERN_ERR PREFIX "Create sysfs link\n"); 983 + 988 984 device->cdev = thermal_cooling_device_register("LCD", 989 985 device->dev, &video_cooling_ops); 990 986 if (IS_ERR(device->cdev)) ··· 1068 1054 static int acpi_video_bus_check(struct acpi_video_bus *video) 1069 1055 { 1070 1056 acpi_status status = -ENOENT; 1071 - struct device *dev; 1057 + struct pci_dev *dev; 1072 1058 1073 1059 if (!video) 1074 1060 return -EINVAL; 1075 1061 1076 - dev = acpi_get_physical_pci_device(video->device->handle); 1062 + dev = acpi_get_pci_dev(video->device->handle); 1077 1063 if (!dev) 1078 1064 return -ENODEV; 1079 - put_device(dev); 1065 + pci_dev_put(dev); 1080 1066 1081 1067 /* Since there is no HID, CID and so on for VGA driver, we have 1082 1068 * to check well known required nodes. ··· 2004 1990 status = acpi_remove_notify_handler(device->dev->handle, 2005 1991 ACPI_DEVICE_NOTIFY, 2006 1992 acpi_video_device_notify); 1993 + sysfs_remove_link(&device->backlight->dev.kobj, "device"); 2007 1994 backlight_device_unregister(device->backlight); 2008 1995 if (device->cdev) { 2009 1996 sysfs_remove_link(&device->dev->dev.kobj, ··· 2333 2318 int acpi_video_register(void) 2334 2319 { 2335 2320 int result = 0; 2321 + if (register_count) { 2322 + /* 2323 + * if the function of acpi_video_register is already called, 2324 + * don't register the acpi_vide_bus again and return no error. 2325 + */ 2326 + return 0; 2327 + } 2336 2328 2337 2329 acpi_video_dir = proc_mkdir(ACPI_VIDEO_CLASS, acpi_root_dir); 2338 2330 if (!acpi_video_dir) ··· 2351 2329 return -ENODEV; 2352 2330 } 2353 2331 2332 + /* 2333 + * When the acpi_video_bus is loaded successfully, increase 2334 + * the counter reference. 2335 + */ 2336 + register_count = 1; 2337 + 2354 2338 return 0; 2355 2339 } 2356 2340 EXPORT_SYMBOL(acpi_video_register); 2341 + 2342 + void acpi_video_unregister(void) 2343 + { 2344 + if (!register_count) { 2345 + /* 2346 + * If the acpi video bus is already unloaded, don't 2347 + * unload it again and return directly. 2348 + */ 2349 + return; 2350 + } 2351 + acpi_bus_unregister_driver(&acpi_video_bus); 2352 + 2353 + remove_proc_entry(ACPI_VIDEO_CLASS, acpi_root_dir); 2354 + 2355 + register_count = 0; 2356 + 2357 + return; 2358 + } 2359 + EXPORT_SYMBOL(acpi_video_unregister); 2357 2360 2358 2361 /* 2359 2362 * This is kind of nasty. Hardware using Intel chipsets may require ··· 2397 2350 return acpi_video_register(); 2398 2351 } 2399 2352 2400 - void acpi_video_exit(void) 2353 + static void __exit acpi_video_exit(void) 2401 2354 { 2402 - 2403 - acpi_bus_unregister_driver(&acpi_video_bus); 2404 - 2405 - remove_proc_entry(ACPI_VIDEO_CLASS, acpi_root_dir); 2355 + acpi_video_unregister(); 2406 2356 2407 2357 return; 2408 2358 } 2409 - EXPORT_SYMBOL(acpi_video_exit); 2410 2359 2411 2360 module_init(acpi_video_init); 2412 2361 module_exit(acpi_video_exit);
+5 -4
drivers/acpi/video_detect.c
··· 10 10 * assinged 11 11 * 12 12 * After PCI devices are glued with ACPI devices 13 - * acpi_get_physical_pci_device() can be called to identify ACPI graphics 13 + * acpi_get_pci_dev() can be called to identify ACPI graphics 14 14 * devices for which a real graphics card is plugged in 15 15 * 16 16 * Now acpi_video_get_capabilities() can be called to check which ··· 36 36 37 37 #include <linux/acpi.h> 38 38 #include <linux/dmi.h> 39 + #include <linux/pci.h> 39 40 40 41 ACPI_MODULE_NAME("video"); 41 42 #define _COMPONENT ACPI_VIDEO_COMPONENT ··· 110 109 find_video(acpi_handle handle, u32 lvl, void *context, void **rv) 111 110 { 112 111 long *cap = context; 113 - struct device *dev; 112 + struct pci_dev *dev; 114 113 struct acpi_device *acpi_dev; 115 114 116 115 const struct acpi_device_id video_ids[] = { ··· 121 120 return AE_OK; 122 121 123 122 if (!acpi_match_device_ids(acpi_dev, video_ids)) { 124 - dev = acpi_get_physical_pci_device(handle); 123 + dev = acpi_get_pci_dev(handle); 125 124 if (!dev) 126 125 return AE_OK; 127 - put_device(dev); 126 + pci_dev_put(dev); 128 127 *cap |= acpi_is_video_device(acpi_dev); 129 128 } 130 129 return AE_OK;
+1 -1
drivers/gpu/drm/i915/i915_opregion.c
··· 419 419 return; 420 420 421 421 if (!suspend) 422 - acpi_video_exit(); 422 + acpi_video_unregister(); 423 423 424 424 opregion->acpi->drdy = 0; 425 425
+2 -38
drivers/pci/hotplug/acpi_pcihp.c
··· 354 354 status = acpi_run_hpp(handle, hpp); 355 355 if (ACPI_SUCCESS(status)) 356 356 break; 357 - if (acpi_root_bridge(handle)) 357 + if (acpi_is_root_bridge(handle)) 358 358 break; 359 359 status = acpi_get_parent(handle, &phandle); 360 360 if (ACPI_FAILURE(status)) ··· 428 428 status = acpi_run_oshp(handle); 429 429 if (ACPI_SUCCESS(status)) 430 430 goto got_one; 431 - if (acpi_root_bridge(handle)) 431 + if (acpi_is_root_bridge(handle)) 432 432 break; 433 433 chandle = handle; 434 434 status = acpi_get_parent(chandle, &handle); ··· 448 448 return 0; 449 449 } 450 450 EXPORT_SYMBOL(acpi_get_hp_hw_control_from_firmware); 451 - 452 - /* acpi_root_bridge - check to see if this acpi object is a root bridge 453 - * 454 - * @handle - the acpi object in question. 455 - */ 456 - int acpi_root_bridge(acpi_handle handle) 457 - { 458 - acpi_status status; 459 - struct acpi_device_info *info; 460 - struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL}; 461 - int i; 462 - 463 - status = acpi_get_object_info(handle, &buffer); 464 - if (ACPI_SUCCESS(status)) { 465 - info = buffer.pointer; 466 - if ((info->valid & ACPI_VALID_HID) && 467 - !strcmp(PCI_ROOT_HID_STRING, 468 - info->hardware_id.value)) { 469 - kfree(buffer.pointer); 470 - return 1; 471 - } 472 - if (info->valid & ACPI_VALID_CID) { 473 - for (i=0; i < info->compatibility_id.count; i++) { 474 - if (!strcmp(PCI_ROOT_HID_STRING, 475 - info->compatibility_id.id[i].value)) { 476 - kfree(buffer.pointer); 477 - return 1; 478 - } 479 - } 480 - } 481 - kfree(buffer.pointer); 482 - } 483 - return 0; 484 - } 485 - EXPORT_SYMBOL_GPL(acpi_root_bridge); 486 - 487 451 488 452 static int is_ejectable(acpi_handle handle) 489 453 {
+8 -19
drivers/pci/hotplug/acpiphp_glue.c
··· 678 678 679 679 static struct pci_dev * get_apic_pci_info(acpi_handle handle) 680 680 { 681 - struct acpi_pci_id id; 682 - struct pci_bus *bus; 683 681 struct pci_dev *dev; 684 682 685 - if (ACPI_FAILURE(acpi_get_pci_id(handle, &id))) 686 - return NULL; 687 - 688 - bus = pci_find_bus(id.segment, id.bus); 689 - if (!bus) 690 - return NULL; 691 - 692 - dev = pci_get_slot(bus, PCI_DEVFN(id.device, id.function)); 683 + dev = acpi_get_pci_dev(handle); 693 684 if (!dev) 694 685 return NULL; 695 686 ··· 1387 1396 /* Program resources in newly inserted bridge */ 1388 1397 static int acpiphp_configure_bridge (acpi_handle handle) 1389 1398 { 1390 - struct acpi_pci_id pci_id; 1399 + struct pci_dev *dev; 1391 1400 struct pci_bus *bus; 1392 1401 1393 - if (ACPI_FAILURE(acpi_get_pci_id(handle, &pci_id))) { 1402 + dev = acpi_get_pci_dev(handle); 1403 + if (!dev) { 1394 1404 err("cannot get PCI domain and bus number for bridge\n"); 1395 1405 return -EINVAL; 1396 1406 } 1397 - bus = pci_find_bus(pci_id.segment, pci_id.bus); 1398 - if (!bus) { 1399 - err("cannot find bus %d:%d\n", 1400 - pci_id.segment, pci_id.bus); 1401 - return -EINVAL; 1402 - } 1407 + 1408 + bus = dev->bus; 1403 1409 1404 1410 pci_bus_size_bridges(bus); 1405 1411 pci_bus_assign_resources(bus); ··· 1404 1416 acpiphp_set_hpp_values(handle, bus); 1405 1417 pci_enable_bridges(bus); 1406 1418 acpiphp_configure_ioapics(handle); 1419 + pci_dev_put(dev); 1407 1420 return 0; 1408 1421 } 1409 1422 ··· 1620 1631 { 1621 1632 int *count = (int *)context; 1622 1633 1623 - if (acpi_root_bridge(handle)) { 1634 + if (acpi_is_root_bridge(handle)) { 1624 1635 acpi_install_notify_handler(handle, ACPI_SYSTEM_NOTIFY, 1625 1636 handle_hotplug_event_bridge, NULL); 1626 1637 (*count)++;
+27 -7
drivers/platform/x86/Kconfig
··· 34 34 If you have an ACPI-WMI compatible Acer/ Wistron laptop, say Y or M 35 35 here. 36 36 37 + config ACERHDF 38 + tristate "Acer Aspire One temperature and fan driver" 39 + depends on THERMAL && THERMAL_HWMON && ACPI 40 + ---help--- 41 + This is a driver for Acer Aspire One netbooks. It allows to access 42 + the temperature sensor and to control the fan. 43 + 44 + After loading this driver the BIOS is still in control of the fan. 45 + To let the kernel handle the fan, do: 46 + echo -n enabled > /sys/class/thermal/thermal_zone0/mode 47 + 48 + For more information about this driver see 49 + <http://piie.net/files/acerhdf_README.txt> 50 + 51 + If you have an Acer Aspire One netbook, say Y or M 52 + here. 53 + 37 54 config ASUS_LAPTOP 38 - tristate "Asus Laptop Extras (EXPERIMENTAL)" 55 + tristate "Asus Laptop Extras" 39 56 depends on ACPI 40 - depends on EXPERIMENTAL && !ACPI_ASUS 57 + depends on !ACPI_ASUS 41 58 select LEDS_CLASS 42 59 select NEW_LEDS 43 60 select BACKLIGHT_CLASS_DEVICE ··· 62 45 ---help--- 63 46 This is the new Linux driver for Asus laptops. It may also support some 64 47 MEDION, JVC or VICTOR laptops. It makes all the extra buttons generate 65 - standard ACPI events that go through /proc/acpi/events. It also adds 48 + standard ACPI events and input events. It also adds 66 49 support for video output switching, LCD backlight control, Bluetooth and 67 50 Wlan control, and most importantly, allows you to blink those fancy LEDs. 68 51 69 52 For more information and a userspace daemon for handling the extra 70 - buttons see <http://acpi4asus.sf.net/>. 53 + buttons see <http://acpi4asus.sf.net>. 71 54 72 55 If you have an ACPI-compatible ASUS laptop, say Y or M here. 73 56 ··· 359 342 select HWMON 360 343 ---help--- 361 344 This driver supports the Fn-Fx keys on Eee PC laptops. 362 - It also adds the ability to switch camera/wlan on/off. 345 + 346 + It also gives access to some extra laptop functionalities like 347 + Bluetooth, backlight and allows powering on/off some other 348 + devices. 363 349 364 350 If you have an Eee PC laptop, say Y or M here. 365 351 ··· 389 369 any ACPI-WMI devices. 390 370 391 371 config ACPI_ASUS 392 - tristate "ASUS/Medion Laptop Extras" 372 + tristate "ASUS/Medion Laptop Extras (DEPRECATED)" 393 373 depends on ACPI 394 374 select BACKLIGHT_CLASS_DEVICE 395 375 ---help--- ··· 410 390 parameters. 411 391 412 392 More information and a userspace daemon for handling the extra buttons 413 - at <http://sourceforge.net/projects/acpi4asus/>. 393 + at <http://acpi4asus.sf.net>. 414 394 415 395 If you have an ACPI-compatible ASUS laptop, say Y or M here. This 416 396 driver is still under development, so if your laptop is unsupported or
+1
drivers/platform/x86/Makefile
··· 9 9 obj-$(CONFIG_DELL_LAPTOP) += dell-laptop.o 10 10 obj-$(CONFIG_DELL_WMI) += dell-wmi.o 11 11 obj-$(CONFIG_ACER_WMI) += acer-wmi.o 12 + obj-$(CONFIG_ACERHDF) += acerhdf.o 12 13 obj-$(CONFIG_HP_WMI) += hp-wmi.o 13 14 obj-$(CONFIG_TC1100_WMI) += tc1100-wmi.o 14 15 obj-$(CONFIG_SONY_LAPTOP) += sony-laptop.o
+602
drivers/platform/x86/acerhdf.c
··· 1 + /* 2 + * acerhdf - A driver which monitors the temperature 3 + * of the aspire one netbook, turns on/off the fan 4 + * as soon as the upper/lower threshold is reached. 5 + * 6 + * (C) 2009 - Peter Feuerer peter (a) piie.net 7 + * http://piie.net 8 + * 2009 Borislav Petkov <petkovbb@gmail.com> 9 + * 10 + * Inspired by and many thanks to: 11 + * o acerfand - Rachel Greenham 12 + * o acer_ec.pl - Michael Kurz michi.kurz (at) googlemail.com 13 + * - Petr Tomasek tomasek (#) etf,cuni,cz 14 + * - Carlos Corbacho cathectic (at) gmail.com 15 + * o lkml - Matthew Garrett 16 + * - Borislav Petkov 17 + * - Andreas Mohr 18 + * 19 + * This program is free software; you can redistribute it and/or modify 20 + * it under the terms of the GNU General Public License as published by 21 + * the Free Software Foundation; either version 2 of the License, or 22 + * (at your option) any later version. 23 + * 24 + * This program is distributed in the hope that it will be useful, 25 + * but WITHOUT ANY WARRANTY; without even the implied warranty of 26 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 27 + * GNU General Public License for more details. 28 + * 29 + * You should have received a copy of the GNU General Public License 30 + * along with this program; if not, write to the Free Software 31 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 32 + */ 33 + 34 + #define pr_fmt(fmt) "acerhdf: " fmt 35 + 36 + #include <linux/kernel.h> 37 + #include <linux/module.h> 38 + #include <linux/fs.h> 39 + #include <linux/dmi.h> 40 + #include <acpi/acpi_drivers.h> 41 + #include <linux/sched.h> 42 + #include <linux/thermal.h> 43 + #include <linux/platform_device.h> 44 + 45 + /* 46 + * The driver is started with "kernel mode off" by default. That means, the BIOS 47 + * is still in control of the fan. In this mode the driver allows to read the 48 + * temperature of the cpu and a userspace tool may take over control of the fan. 49 + * If the driver is switched to "kernel mode" (e.g. via module parameter) the 50 + * driver is in full control of the fan. If you want the module to be started in 51 + * kernel mode by default, define the following: 52 + */ 53 + #undef START_IN_KERNEL_MODE 54 + 55 + #define DRV_VER "0.5.13" 56 + 57 + /* 58 + * According to the Atom N270 datasheet, 59 + * (http://download.intel.com/design/processor/datashts/320032.pdf) the 60 + * CPU's optimal operating limits denoted in junction temperature as 61 + * measured by the on-die thermal monitor are within 0 <= Tj <= 90. So, 62 + * assume 89°C is critical temperature. 63 + */ 64 + #define ACERHDF_TEMP_CRIT 89 65 + #define ACERHDF_FAN_OFF 0 66 + #define ACERHDF_FAN_AUTO 1 67 + 68 + /* 69 + * No matter what value the user puts into the fanon variable, turn on the fan 70 + * at 80 degree Celsius to prevent hardware damage 71 + */ 72 + #define ACERHDF_MAX_FANON 80 73 + 74 + /* 75 + * Maximum interval between two temperature checks is 15 seconds, as the die 76 + * can get hot really fast under heavy load (plus we shouldn't forget about 77 + * possible impact of _external_ aggressive sources such as heaters, sun etc.) 78 + */ 79 + #define ACERHDF_MAX_INTERVAL 15 80 + 81 + #ifdef START_IN_KERNEL_MODE 82 + static int kernelmode = 1; 83 + #else 84 + static int kernelmode; 85 + #endif 86 + 87 + static unsigned int interval = 10; 88 + static unsigned int fanon = 63; 89 + static unsigned int fanoff = 58; 90 + static unsigned int verbose; 91 + static unsigned int fanstate = ACERHDF_FAN_AUTO; 92 + static char force_bios[16]; 93 + static unsigned int prev_interval; 94 + struct thermal_zone_device *thz_dev; 95 + struct thermal_cooling_device *cl_dev; 96 + struct platform_device *acerhdf_dev; 97 + 98 + module_param(kernelmode, uint, 0); 99 + MODULE_PARM_DESC(kernelmode, "Kernel mode fan control on / off"); 100 + module_param(interval, uint, 0600); 101 + MODULE_PARM_DESC(interval, "Polling interval of temperature check"); 102 + module_param(fanon, uint, 0600); 103 + MODULE_PARM_DESC(fanon, "Turn the fan on above this temperature"); 104 + module_param(fanoff, uint, 0600); 105 + MODULE_PARM_DESC(fanoff, "Turn the fan off below this temperature"); 106 + module_param(verbose, uint, 0600); 107 + MODULE_PARM_DESC(verbose, "Enable verbose dmesg output"); 108 + module_param_string(force_bios, force_bios, 16, 0); 109 + MODULE_PARM_DESC(force_bios, "Force BIOS version and omit BIOS check"); 110 + 111 + /* BIOS settings */ 112 + struct bios_settings_t { 113 + const char *vendor; 114 + const char *version; 115 + unsigned char fanreg; 116 + unsigned char tempreg; 117 + unsigned char fancmd[2]; /* fan off and auto commands */ 118 + }; 119 + 120 + /* Register addresses and values for different BIOS versions */ 121 + static const struct bios_settings_t bios_tbl[] = { 122 + {"Acer", "v0.3109", 0x55, 0x58, {0x1f, 0x00} }, 123 + {"Acer", "v0.3114", 0x55, 0x58, {0x1f, 0x00} }, 124 + {"Acer", "v0.3301", 0x55, 0x58, {0xaf, 0x00} }, 125 + {"Acer", "v0.3304", 0x55, 0x58, {0xaf, 0x00} }, 126 + {"Acer", "v0.3305", 0x55, 0x58, {0xaf, 0x00} }, 127 + {"Acer", "v0.3308", 0x55, 0x58, {0x21, 0x00} }, 128 + {"Acer", "v0.3309", 0x55, 0x58, {0x21, 0x00} }, 129 + {"Acer", "v0.3310", 0x55, 0x58, {0x21, 0x00} }, 130 + {"Gateway", "v0.3103", 0x55, 0x58, {0x21, 0x00} }, 131 + {"Packard Bell", "v0.3105", 0x55, 0x58, {0x21, 0x00} }, 132 + {"", "", 0, 0, {0, 0} } 133 + }; 134 + 135 + static const struct bios_settings_t *bios_cfg __read_mostly; 136 + 137 + 138 + static int acerhdf_get_temp(int *temp) 139 + { 140 + u8 read_temp; 141 + 142 + if (ec_read(bios_cfg->tempreg, &read_temp)) 143 + return -EINVAL; 144 + 145 + *temp = read_temp; 146 + 147 + return 0; 148 + } 149 + 150 + static int acerhdf_get_fanstate(int *state) 151 + { 152 + u8 fan; 153 + bool tmp; 154 + 155 + if (ec_read(bios_cfg->fanreg, &fan)) 156 + return -EINVAL; 157 + 158 + tmp = (fan == bios_cfg->fancmd[ACERHDF_FAN_OFF]); 159 + *state = tmp ? ACERHDF_FAN_OFF : ACERHDF_FAN_AUTO; 160 + 161 + return 0; 162 + } 163 + 164 + static void acerhdf_change_fanstate(int state) 165 + { 166 + unsigned char cmd; 167 + 168 + if (verbose) 169 + pr_notice("fan %s\n", (state == ACERHDF_FAN_OFF) ? 170 + "OFF" : "ON"); 171 + 172 + if ((state != ACERHDF_FAN_OFF) && (state != ACERHDF_FAN_AUTO)) { 173 + pr_err("invalid fan state %d requested, setting to auto!\n", 174 + state); 175 + state = ACERHDF_FAN_AUTO; 176 + } 177 + 178 + cmd = bios_cfg->fancmd[state]; 179 + fanstate = state; 180 + 181 + ec_write(bios_cfg->fanreg, cmd); 182 + } 183 + 184 + static void acerhdf_check_param(struct thermal_zone_device *thermal) 185 + { 186 + if (fanon > ACERHDF_MAX_FANON) { 187 + pr_err("fanon temperature too high, set to %d\n", 188 + ACERHDF_MAX_FANON); 189 + fanon = ACERHDF_MAX_FANON; 190 + } 191 + 192 + if (kernelmode && prev_interval != interval) { 193 + if (interval > ACERHDF_MAX_INTERVAL) { 194 + pr_err("interval too high, set to %d\n", 195 + ACERHDF_MAX_INTERVAL); 196 + interval = ACERHDF_MAX_INTERVAL; 197 + } 198 + if (verbose) 199 + pr_notice("interval changed to: %d\n", 200 + interval); 201 + thermal->polling_delay = interval*1000; 202 + prev_interval = interval; 203 + } 204 + } 205 + 206 + /* 207 + * This is the thermal zone callback which does the delayed polling of the fan 208 + * state. We do check /sysfs-originating settings here in acerhdf_check_param() 209 + * as late as the polling interval is since we can't do that in the respective 210 + * accessors of the module parameters. 211 + */ 212 + static int acerhdf_get_ec_temp(struct thermal_zone_device *thermal, 213 + unsigned long *t) 214 + { 215 + int temp, err = 0; 216 + 217 + acerhdf_check_param(thermal); 218 + 219 + err = acerhdf_get_temp(&temp); 220 + if (err) 221 + return err; 222 + 223 + if (verbose) 224 + pr_notice("temp %d\n", temp); 225 + 226 + *t = temp; 227 + return 0; 228 + } 229 + 230 + static int acerhdf_bind(struct thermal_zone_device *thermal, 231 + struct thermal_cooling_device *cdev) 232 + { 233 + /* if the cooling device is the one from acerhdf bind it */ 234 + if (cdev != cl_dev) 235 + return 0; 236 + 237 + if (thermal_zone_bind_cooling_device(thermal, 0, cdev)) { 238 + pr_err("error binding cooling dev\n"); 239 + return -EINVAL; 240 + } 241 + return 0; 242 + } 243 + 244 + static int acerhdf_unbind(struct thermal_zone_device *thermal, 245 + struct thermal_cooling_device *cdev) 246 + { 247 + if (cdev != cl_dev) 248 + return 0; 249 + 250 + if (thermal_zone_unbind_cooling_device(thermal, 0, cdev)) { 251 + pr_err("error unbinding cooling dev\n"); 252 + return -EINVAL; 253 + } 254 + return 0; 255 + } 256 + 257 + static inline void acerhdf_revert_to_bios_mode(void) 258 + { 259 + acerhdf_change_fanstate(ACERHDF_FAN_AUTO); 260 + kernelmode = 0; 261 + if (thz_dev) 262 + thz_dev->polling_delay = 0; 263 + pr_notice("kernel mode fan control OFF\n"); 264 + } 265 + static inline void acerhdf_enable_kernelmode(void) 266 + { 267 + kernelmode = 1; 268 + 269 + thz_dev->polling_delay = interval*1000; 270 + thermal_zone_device_update(thz_dev); 271 + pr_notice("kernel mode fan control ON\n"); 272 + } 273 + 274 + static int acerhdf_get_mode(struct thermal_zone_device *thermal, 275 + enum thermal_device_mode *mode) 276 + { 277 + if (verbose) 278 + pr_notice("kernel mode fan control %d\n", kernelmode); 279 + 280 + *mode = (kernelmode) ? THERMAL_DEVICE_ENABLED 281 + : THERMAL_DEVICE_DISABLED; 282 + 283 + return 0; 284 + } 285 + 286 + /* 287 + * set operation mode; 288 + * enabled: the thermal layer of the kernel takes care about 289 + * the temperature and the fan. 290 + * disabled: the BIOS takes control of the fan. 291 + */ 292 + static int acerhdf_set_mode(struct thermal_zone_device *thermal, 293 + enum thermal_device_mode mode) 294 + { 295 + if (mode == THERMAL_DEVICE_DISABLED && kernelmode) 296 + acerhdf_revert_to_bios_mode(); 297 + else if (mode == THERMAL_DEVICE_ENABLED && !kernelmode) 298 + acerhdf_enable_kernelmode(); 299 + 300 + return 0; 301 + } 302 + 303 + static int acerhdf_get_trip_type(struct thermal_zone_device *thermal, int trip, 304 + enum thermal_trip_type *type) 305 + { 306 + if (trip == 0) 307 + *type = THERMAL_TRIP_ACTIVE; 308 + 309 + return 0; 310 + } 311 + 312 + static int acerhdf_get_trip_temp(struct thermal_zone_device *thermal, int trip, 313 + unsigned long *temp) 314 + { 315 + if (trip == 0) 316 + *temp = fanon; 317 + 318 + return 0; 319 + } 320 + 321 + static int acerhdf_get_crit_temp(struct thermal_zone_device *thermal, 322 + unsigned long *temperature) 323 + { 324 + *temperature = ACERHDF_TEMP_CRIT; 325 + return 0; 326 + } 327 + 328 + /* bind callback functions to thermalzone */ 329 + struct thermal_zone_device_ops acerhdf_dev_ops = { 330 + .bind = acerhdf_bind, 331 + .unbind = acerhdf_unbind, 332 + .get_temp = acerhdf_get_ec_temp, 333 + .get_mode = acerhdf_get_mode, 334 + .set_mode = acerhdf_set_mode, 335 + .get_trip_type = acerhdf_get_trip_type, 336 + .get_trip_temp = acerhdf_get_trip_temp, 337 + .get_crit_temp = acerhdf_get_crit_temp, 338 + }; 339 + 340 + 341 + /* 342 + * cooling device callback functions 343 + * get maximal fan cooling state 344 + */ 345 + static int acerhdf_get_max_state(struct thermal_cooling_device *cdev, 346 + unsigned long *state) 347 + { 348 + *state = 1; 349 + 350 + return 0; 351 + } 352 + 353 + static int acerhdf_get_cur_state(struct thermal_cooling_device *cdev, 354 + unsigned long *state) 355 + { 356 + int err = 0, tmp; 357 + 358 + err = acerhdf_get_fanstate(&tmp); 359 + if (err) 360 + return err; 361 + 362 + *state = (tmp == ACERHDF_FAN_AUTO) ? 1 : 0; 363 + return 0; 364 + } 365 + 366 + /* change current fan state - is overwritten when running in kernel mode */ 367 + static int acerhdf_set_cur_state(struct thermal_cooling_device *cdev, 368 + unsigned long state) 369 + { 370 + int cur_temp, cur_state, err = 0; 371 + 372 + if (!kernelmode) 373 + return 0; 374 + 375 + err = acerhdf_get_temp(&cur_temp); 376 + if (err) { 377 + pr_err("error reading temperature, hand off control to BIOS\n"); 378 + goto err_out; 379 + } 380 + 381 + err = acerhdf_get_fanstate(&cur_state); 382 + if (err) { 383 + pr_err("error reading fan state, hand off control to BIOS\n"); 384 + goto err_out; 385 + } 386 + 387 + if (state == 0) { 388 + /* turn fan off only if below fanoff temperature */ 389 + if ((cur_state == ACERHDF_FAN_AUTO) && 390 + (cur_temp < fanoff)) 391 + acerhdf_change_fanstate(ACERHDF_FAN_OFF); 392 + } else { 393 + if (cur_state == ACERHDF_FAN_OFF) 394 + acerhdf_change_fanstate(ACERHDF_FAN_AUTO); 395 + } 396 + return 0; 397 + 398 + err_out: 399 + acerhdf_revert_to_bios_mode(); 400 + return -EINVAL; 401 + } 402 + 403 + /* bind fan callbacks to fan device */ 404 + struct thermal_cooling_device_ops acerhdf_cooling_ops = { 405 + .get_max_state = acerhdf_get_max_state, 406 + .get_cur_state = acerhdf_get_cur_state, 407 + .set_cur_state = acerhdf_set_cur_state, 408 + }; 409 + 410 + /* suspend / resume functionality */ 411 + static int acerhdf_suspend(struct platform_device *dev, pm_message_t state) 412 + { 413 + if (kernelmode) 414 + acerhdf_change_fanstate(ACERHDF_FAN_AUTO); 415 + 416 + if (verbose) 417 + pr_notice("going suspend\n"); 418 + 419 + return 0; 420 + } 421 + 422 + static int acerhdf_resume(struct platform_device *device) 423 + { 424 + if (verbose) 425 + pr_notice("resuming\n"); 426 + 427 + return 0; 428 + } 429 + 430 + static int __devinit acerhdf_probe(struct platform_device *device) 431 + { 432 + return 0; 433 + } 434 + 435 + static int acerhdf_remove(struct platform_device *device) 436 + { 437 + return 0; 438 + } 439 + 440 + struct platform_driver acerhdf_drv = { 441 + .driver = { 442 + .name = "acerhdf", 443 + .owner = THIS_MODULE, 444 + }, 445 + .probe = acerhdf_probe, 446 + .remove = acerhdf_remove, 447 + .suspend = acerhdf_suspend, 448 + .resume = acerhdf_resume, 449 + }; 450 + 451 + 452 + /* check hardware */ 453 + static int acerhdf_check_hardware(void) 454 + { 455 + char const *vendor, *version, *product; 456 + int i; 457 + 458 + /* get BIOS data */ 459 + vendor = dmi_get_system_info(DMI_SYS_VENDOR); 460 + version = dmi_get_system_info(DMI_BIOS_VERSION); 461 + product = dmi_get_system_info(DMI_PRODUCT_NAME); 462 + 463 + pr_info("Acer Aspire One Fan driver, v.%s\n", DRV_VER); 464 + 465 + if (!force_bios[0]) { 466 + if (strncmp(product, "AO", 2)) { 467 + pr_err("no Aspire One hardware found\n"); 468 + return -EINVAL; 469 + } 470 + } else { 471 + pr_info("forcing BIOS version: %s\n", version); 472 + version = force_bios; 473 + kernelmode = 0; 474 + } 475 + 476 + if (verbose) 477 + pr_info("BIOS info: %s %s, product: %s\n", 478 + vendor, version, product); 479 + 480 + /* search BIOS version and vendor in BIOS settings table */ 481 + for (i = 0; bios_tbl[i].version[0]; i++) { 482 + if (!strcmp(bios_tbl[i].vendor, vendor) && 483 + !strcmp(bios_tbl[i].version, version)) { 484 + bios_cfg = &bios_tbl[i]; 485 + break; 486 + } 487 + } 488 + 489 + if (!bios_cfg) { 490 + pr_err("unknown (unsupported) BIOS version %s/%s, " 491 + "please report, aborting!\n", vendor, version); 492 + return -EINVAL; 493 + } 494 + 495 + /* 496 + * if started with kernel mode off, prevent the kernel from switching 497 + * off the fan 498 + */ 499 + if (!kernelmode) { 500 + pr_notice("Fan control off, to enable do:\n"); 501 + pr_notice("echo -n \"enabled\" > " 502 + "/sys/class/thermal/thermal_zone0/mode\n"); 503 + } 504 + 505 + return 0; 506 + } 507 + 508 + static int acerhdf_register_platform(void) 509 + { 510 + int err = 0; 511 + 512 + err = platform_driver_register(&acerhdf_drv); 513 + if (err) 514 + return err; 515 + 516 + acerhdf_dev = platform_device_alloc("acerhdf", -1); 517 + platform_device_add(acerhdf_dev); 518 + 519 + return 0; 520 + } 521 + 522 + static void acerhdf_unregister_platform(void) 523 + { 524 + if (!acerhdf_dev) 525 + return; 526 + 527 + platform_device_del(acerhdf_dev); 528 + platform_driver_unregister(&acerhdf_drv); 529 + } 530 + 531 + static int acerhdf_register_thermal(void) 532 + { 533 + cl_dev = thermal_cooling_device_register("acerhdf-fan", NULL, 534 + &acerhdf_cooling_ops); 535 + 536 + if (IS_ERR(cl_dev)) 537 + return -EINVAL; 538 + 539 + thz_dev = thermal_zone_device_register("acerhdf", 1, NULL, 540 + &acerhdf_dev_ops, 0, 0, 0, 541 + (kernelmode) ? interval*1000 : 0); 542 + if (IS_ERR(thz_dev)) 543 + return -EINVAL; 544 + 545 + return 0; 546 + } 547 + 548 + static void acerhdf_unregister_thermal(void) 549 + { 550 + if (cl_dev) { 551 + thermal_cooling_device_unregister(cl_dev); 552 + cl_dev = NULL; 553 + } 554 + 555 + if (thz_dev) { 556 + thermal_zone_device_unregister(thz_dev); 557 + thz_dev = NULL; 558 + } 559 + } 560 + 561 + static int __init acerhdf_init(void) 562 + { 563 + int err = 0; 564 + 565 + err = acerhdf_check_hardware(); 566 + if (err) 567 + goto out_err; 568 + 569 + err = acerhdf_register_platform(); 570 + if (err) 571 + goto err_unreg; 572 + 573 + err = acerhdf_register_thermal(); 574 + if (err) 575 + goto err_unreg; 576 + 577 + return 0; 578 + 579 + err_unreg: 580 + acerhdf_unregister_thermal(); 581 + acerhdf_unregister_platform(); 582 + 583 + out_err: 584 + return -ENODEV; 585 + } 586 + 587 + static void __exit acerhdf_exit(void) 588 + { 589 + acerhdf_change_fanstate(ACERHDF_FAN_AUTO); 590 + acerhdf_unregister_thermal(); 591 + acerhdf_unregister_platform(); 592 + } 593 + 594 + MODULE_LICENSE("GPL"); 595 + MODULE_AUTHOR("Peter Feuerer"); 596 + MODULE_DESCRIPTION("Aspire One temperature and fan driver"); 597 + MODULE_ALIAS("dmi:*:*Acer*:*:"); 598 + MODULE_ALIAS("dmi:*:*Gateway*:*:"); 599 + MODULE_ALIAS("dmi:*:*Packard Bell*:*:"); 600 + 601 + module_init(acerhdf_init); 602 + module_exit(acerhdf_exit);
+49 -62
drivers/platform/x86/asus-laptop.c
··· 33 33 * Sam Lin - GPS support 34 34 */ 35 35 36 + #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt 37 + 36 38 #include <linux/kernel.h> 37 39 #include <linux/module.h> 38 40 #include <linux/init.h> ··· 55 53 #define ASUS_HOTK_NAME "Asus Laptop Support" 56 54 #define ASUS_HOTK_CLASS "hotkey" 57 55 #define ASUS_HOTK_DEVICE_NAME "Hotkey" 58 - #define ASUS_HOTK_FILE "asus-laptop" 56 + #define ASUS_HOTK_FILE KBUILD_MODNAME 59 57 #define ASUS_HOTK_PREFIX "\\_SB.ATKD." 58 + 60 59 61 60 /* 62 61 * Some events we use, same for all Asus ··· 210 207 211 208 static int asus_hotk_add(struct acpi_device *device); 212 209 static int asus_hotk_remove(struct acpi_device *device, int type); 210 + static void asus_hotk_notify(struct acpi_device *device, u32 event); 211 + 213 212 static struct acpi_driver asus_hotk_driver = { 214 213 .name = ASUS_HOTK_NAME, 215 214 .class = ASUS_HOTK_CLASS, 216 215 .ids = asus_device_ids, 216 + .flags = ACPI_DRIVER_ALL_NOTIFY_EVENTS, 217 217 .ops = { 218 218 .add = asus_hotk_add, 219 219 .remove = asus_hotk_remove, 220 + .notify = asus_hotk_notify, 220 221 }, 221 222 }; 222 223 ··· 330 323 331 324 rv = acpi_evaluate_integer(wireless_status_handle, NULL, NULL, &status); 332 325 if (ACPI_FAILURE(rv)) 333 - printk(ASUS_WARNING "Error reading Wireless status\n"); 326 + pr_warning("Error reading Wireless status\n"); 334 327 else 335 328 return (status & mask) ? 1 : 0; 336 329 ··· 344 337 345 338 rv = acpi_evaluate_integer(gps_status_handle, NULL, NULL, &status); 346 339 if (ACPI_FAILURE(rv)) 347 - printk(ASUS_WARNING "Error reading GPS status\n"); 340 + pr_warning("Error reading GPS status\n"); 348 341 else 349 342 return status ? 1 : 0; 350 343 ··· 384 377 } 385 378 386 379 if (write_acpi_int(handle, NULL, out, NULL)) 387 - printk(ASUS_WARNING " write failed %x\n", mask); 380 + pr_warning(" write failed %x\n", mask); 388 381 } 389 382 390 383 /* /sys/class/led handlers */ ··· 427 420 NULL, NULL, NULL); 428 421 429 422 if (ACPI_FAILURE(status)) 430 - printk(ASUS_WARNING "Error switching LCD\n"); 423 + pr_warning("Error switching LCD\n"); 431 424 } 432 425 433 426 write_status(NULL, lcd, LCD_ON); ··· 451 444 452 445 rv = acpi_evaluate_integer(brightness_get_handle, NULL, NULL, &value); 453 446 if (ACPI_FAILURE(rv)) 454 - printk(ASUS_WARNING "Error reading brightness\n"); 447 + pr_warning("Error reading brightness\n"); 455 448 456 449 return value; 457 450 } ··· 464 457 /* 0 <= value <= 15 */ 465 458 466 459 if (write_acpi_int(brightness_set_handle, NULL, value, NULL)) { 467 - printk(ASUS_WARNING "Error changing brightness\n"); 460 + pr_warning("Error changing brightness\n"); 468 461 ret = -EIO; 469 462 } 470 463 ··· 594 587 rv = parse_arg(buf, count, &value); 595 588 if (rv > 0) { 596 589 if (write_acpi_int(ledd_set_handle, NULL, value, NULL)) 597 - printk(ASUS_WARNING "LED display write failed\n"); 590 + pr_warning("LED display write failed\n"); 598 591 else 599 592 hotk->ledd_status = (u32) value; 600 593 } ··· 639 632 { 640 633 /* no sanity check needed for now */ 641 634 if (write_acpi_int(display_set_handle, NULL, value, NULL)) 642 - printk(ASUS_WARNING "Error setting display\n"); 635 + pr_warning("Error setting display\n"); 643 636 return; 644 637 } 645 638 ··· 654 647 rv = acpi_evaluate_integer(display_get_handle, NULL, 655 648 NULL, &value); 656 649 if (ACPI_FAILURE(rv)) 657 - printk(ASUS_WARNING "Error reading display status\n"); 650 + pr_warning("Error reading display status\n"); 658 651 } 659 652 660 653 value &= 0x0F; /* needed for some models, shouldn't hurt others */ ··· 696 689 static void set_light_sens_switch(int value) 697 690 { 698 691 if (write_acpi_int(ls_switch_handle, NULL, value, NULL)) 699 - printk(ASUS_WARNING "Error setting light sensor switch\n"); 692 + pr_warning("Error setting light sensor switch\n"); 700 693 hotk->light_switch = value; 701 694 } 702 695 ··· 721 714 static void set_light_sens_level(int value) 722 715 { 723 716 if (write_acpi_int(ls_level_handle, NULL, value, NULL)) 724 - printk(ASUS_WARNING "Error setting light sensor level\n"); 717 + pr_warning("Error setting light sensor level\n"); 725 718 hotk->light_level = value; 726 719 } 727 720 ··· 819 812 return -EINVAL; 820 813 } 821 814 822 - static void asus_hotk_notify(acpi_handle handle, u32 event, void *data) 815 + static void asus_hotk_notify(struct acpi_device *device, u32 event) 823 816 { 824 817 static struct key_entry *key; 825 818 u16 count; ··· 982 975 */ 983 976 status = acpi_get_table(ACPI_SIG_DSDT, 1, &asus_info); 984 977 if (ACPI_FAILURE(status)) 985 - printk(ASUS_WARNING "Couldn't get the DSDT table header\n"); 978 + pr_warning("Couldn't get the DSDT table header\n"); 986 979 987 980 /* We have to write 0 on init this far for all ASUS models */ 988 981 if (write_acpi_int(hotk->handle, "INIT", 0, &buffer)) { 989 - printk(ASUS_ERR "Hotkey initialization failed\n"); 982 + pr_err("Hotkey initialization failed\n"); 990 983 return -ENODEV; 991 984 } 992 985 ··· 994 987 status = 995 988 acpi_evaluate_integer(hotk->handle, "BSTS", NULL, &bsts_result); 996 989 if (ACPI_FAILURE(status)) 997 - printk(ASUS_WARNING "Error calling BSTS\n"); 990 + pr_warning("Error calling BSTS\n"); 998 991 else if (bsts_result) 999 - printk(ASUS_NOTICE "BSTS called, 0x%02x returned\n", 992 + pr_notice("BSTS called, 0x%02x returned\n", 1000 993 (uint) bsts_result); 1001 994 1002 995 /* This too ... */ ··· 1027 1020 return -ENOMEM; 1028 1021 1029 1022 if (*string) 1030 - printk(ASUS_NOTICE " %s model detected\n", string); 1023 + pr_notice(" %s model detected\n", string); 1031 1024 1032 1025 ASUS_HANDLE_INIT(mled_set); 1033 1026 ASUS_HANDLE_INIT(tled_set); ··· 1084 1077 1085 1078 hotk->inputdev = input_allocate_device(); 1086 1079 if (!hotk->inputdev) { 1087 - printk(ASUS_INFO "Unable to allocate input device\n"); 1080 + pr_info("Unable to allocate input device\n"); 1088 1081 return 0; 1089 1082 } 1090 1083 hotk->inputdev->name = "Asus Laptop extra buttons"; ··· 1103 1096 } 1104 1097 result = input_register_device(hotk->inputdev); 1105 1098 if (result) { 1106 - printk(ASUS_INFO "Unable to register input device\n"); 1099 + pr_info("Unable to register input device\n"); 1107 1100 input_free_device(hotk->inputdev); 1108 1101 } 1109 1102 return result; ··· 1120 1113 if (hotk->device->status.present) { 1121 1114 result = asus_hotk_get_info(); 1122 1115 } else { 1123 - printk(ASUS_ERR "Hotkey device not present, aborting\n"); 1116 + pr_err("Hotkey device not present, aborting\n"); 1124 1117 return -EINVAL; 1125 1118 } 1126 1119 ··· 1131 1124 1132 1125 static int asus_hotk_add(struct acpi_device *device) 1133 1126 { 1134 - acpi_status status = AE_OK; 1135 1127 int result; 1136 1128 1137 1129 if (!device) 1138 1130 return -EINVAL; 1139 1131 1140 - printk(ASUS_NOTICE "Asus Laptop Support version %s\n", 1132 + pr_notice("Asus Laptop Support version %s\n", 1141 1133 ASUS_LAPTOP_VERSION); 1142 1134 1143 1135 hotk = kzalloc(sizeof(struct asus_hotk), GFP_KERNEL); ··· 1154 1148 goto end; 1155 1149 1156 1150 asus_hotk_add_fs(); 1157 - 1158 - /* 1159 - * We install the handler, it will receive the hotk in parameter, so, we 1160 - * could add other data to the hotk struct 1161 - */ 1162 - status = acpi_install_notify_handler(hotk->handle, ACPI_ALL_NOTIFY, 1163 - asus_hotk_notify, hotk); 1164 - if (ACPI_FAILURE(status)) 1165 - printk(ASUS_ERR "Error installing notify handler\n"); 1166 1151 1167 1152 asus_hotk_found = 1; 1168 1153 ··· 1195 1198 1196 1199 static int asus_hotk_remove(struct acpi_device *device, int type) 1197 1200 { 1198 - acpi_status status = 0; 1199 - 1200 1201 if (!device || !acpi_driver_data(device)) 1201 1202 return -EINVAL; 1202 - 1203 - status = acpi_remove_notify_handler(hotk->handle, ACPI_ALL_NOTIFY, 1204 - asus_hotk_notify); 1205 - if (ACPI_FAILURE(status)) 1206 - printk(ASUS_ERR "Error removing notify handler\n"); 1207 1203 1208 1204 kfree(hotk->name); 1209 1205 kfree(hotk); ··· 1250 1260 bd = backlight_device_register(ASUS_HOTK_FILE, dev, 1251 1261 NULL, &asusbl_ops); 1252 1262 if (IS_ERR(bd)) { 1253 - printk(ASUS_ERR 1254 - "Could not register asus backlight device\n"); 1263 + pr_err("Could not register asus backlight device\n"); 1255 1264 asus_backlight_device = NULL; 1256 1265 return PTR_ERR(bd); 1257 1266 } ··· 1323 1334 1324 1335 static int __init asus_laptop_init(void) 1325 1336 { 1326 - struct device *dev; 1327 1337 int result; 1328 1338 1329 1339 if (acpi_disabled) ··· 1344 1356 return -ENODEV; 1345 1357 } 1346 1358 1347 - dev = acpi_get_physical_device(hotk->device->handle); 1348 - 1349 - if (!acpi_video_backlight_support()) { 1350 - result = asus_backlight_init(dev); 1351 - if (result) 1352 - goto fail_backlight; 1353 - } else 1354 - printk(ASUS_INFO "Brightness ignored, must be controlled by " 1355 - "ACPI video driver\n"); 1356 - 1357 1359 result = asus_input_init(); 1358 1360 if (result) 1359 1361 goto fail_input; 1360 - 1361 - result = asus_led_init(dev); 1362 - if (result) 1363 - goto fail_led; 1364 1362 1365 1363 /* Register platform stuff */ 1366 1364 result = platform_driver_register(&asuspf_driver); ··· 1368 1394 if (result) 1369 1395 goto fail_sysfs; 1370 1396 1397 + result = asus_led_init(&asuspf_device->dev); 1398 + if (result) 1399 + goto fail_led; 1400 + 1401 + if (!acpi_video_backlight_support()) { 1402 + result = asus_backlight_init(&asuspf_device->dev); 1403 + if (result) 1404 + goto fail_backlight; 1405 + } else 1406 + pr_info("Brightness ignored, must be controlled by " 1407 + "ACPI video driver\n"); 1408 + 1371 1409 return 0; 1410 + 1411 + fail_backlight: 1412 + asus_led_exit(); 1413 + 1414 + fail_led: 1415 + sysfs_remove_group(&asuspf_device->dev.kobj, 1416 + &asuspf_attribute_group); 1372 1417 1373 1418 fail_sysfs: 1374 1419 platform_device_del(asuspf_device); ··· 1399 1406 platform_driver_unregister(&asuspf_driver); 1400 1407 1401 1408 fail_platform_driver: 1402 - asus_led_exit(); 1403 - 1404 - fail_led: 1405 1409 asus_input_exit(); 1406 1410 1407 1411 fail_input: 1408 - asus_backlight_exit(); 1409 - 1410 - fail_backlight: 1411 1412 1412 1413 return result; 1413 1414 }
+13 -17
drivers/platform/x86/asus_acpi.c
··· 455 455 */ 456 456 static int asus_hotk_add(struct acpi_device *device); 457 457 static int asus_hotk_remove(struct acpi_device *device, int type); 458 + static void asus_hotk_notify(struct acpi_device *device, u32 event); 459 + 458 460 static const struct acpi_device_id asus_device_ids[] = { 459 461 {"ATK0100", 0}, 460 462 {"", 0}, ··· 467 465 .name = "asus_acpi", 468 466 .class = ACPI_HOTK_CLASS, 469 467 .ids = asus_device_ids, 468 + .flags = ACPI_DRIVER_ALL_NOTIFY_EVENTS, 470 469 .ops = { 471 470 .add = asus_hotk_add, 472 471 .remove = asus_hotk_remove, 472 + .notify = asus_hotk_notify, 473 473 }, 474 474 }; 475 475 ··· 1105 1101 return 0; 1106 1102 } 1107 1103 1108 - static void asus_hotk_notify(acpi_handle handle, u32 event, void *data) 1104 + static void asus_hotk_notify(struct acpi_device *device, u32 event) 1109 1105 { 1110 1106 /* TODO Find a better way to handle events count. */ 1111 1107 if (!hotk) 1108 + return; 1109 + 1110 + /* 1111 + * The BIOS *should* be sending us device events, but apparently 1112 + * Asus uses system events instead, so just ignore any device 1113 + * events we get. 1114 + */ 1115 + if (event > ACPI_MAX_SYS_NOTIFY) 1112 1116 return; 1113 1117 1114 1118 if ((event & ~((u32) BR_UP)) < 16) ··· 1358 1346 if (result) 1359 1347 goto end; 1360 1348 1361 - /* 1362 - * We install the handler, it will receive the hotk in parameter, so, we 1363 - * could add other data to the hotk struct 1364 - */ 1365 - status = acpi_install_notify_handler(hotk->handle, ACPI_SYSTEM_NOTIFY, 1366 - asus_hotk_notify, hotk); 1367 - if (ACPI_FAILURE(status)) 1368 - printk(KERN_ERR " Error installing notify handler\n"); 1369 - 1370 1349 /* For laptops without GPLV: init the hotk->brightness value */ 1371 1350 if ((!hotk->methods->brightness_get) 1372 1351 && (!hotk->methods->brightness_status) ··· 1392 1389 1393 1390 static int asus_hotk_remove(struct acpi_device *device, int type) 1394 1391 { 1395 - acpi_status status = 0; 1396 - 1397 1392 if (!device || !acpi_driver_data(device)) 1398 1393 return -EINVAL; 1399 - 1400 - status = acpi_remove_notify_handler(hotk->handle, ACPI_SYSTEM_NOTIFY, 1401 - asus_hotk_notify); 1402 - if (ACPI_FAILURE(status)) 1403 - printk(KERN_ERR "Asus ACPI: Error removing notify handler\n"); 1404 1394 1405 1395 asus_hotk_remove_fs(device); 1406 1396
+52 -4
drivers/platform/x86/dell-wmi.c
··· 46 46 u16 keycode; 47 47 }; 48 48 49 - enum { KE_KEY, KE_SW, KE_END }; 49 + enum { KE_KEY, KE_SW, KE_IGNORE, KE_END }; 50 + 51 + /* 52 + * Certain keys are flagged as KE_IGNORE. All of these are either 53 + * notifications (rather than requests for change) or are also sent 54 + * via the keyboard controller so should not be sent again. 55 + */ 50 56 51 57 static struct key_entry dell_wmi_keymap[] = { 52 58 {KE_KEY, 0xe045, KEY_PROG1}, 59 + {KE_KEY, 0xe009, KEY_EJECTCD}, 60 + 61 + /* These also contain the brightness level at offset 6 */ 62 + {KE_KEY, 0xe006, KEY_BRIGHTNESSUP}, 63 + {KE_KEY, 0xe005, KEY_BRIGHTNESSDOWN}, 64 + 65 + /* Battery health status button */ 66 + {KE_KEY, 0xe007, KEY_BATTERY}, 67 + 68 + /* This is actually for all radios. Although physically a 69 + * switch, the notification does not provide an indication of 70 + * state and so it should be reported as a key */ 71 + {KE_KEY, 0xe008, KEY_WLAN}, 72 + 73 + /* The next device is at offset 6, the active devices are at 74 + offset 8 and the attached devices at offset 10 */ 75 + {KE_KEY, 0xe00b, KEY_DISPLAYTOGGLE}, 76 + 77 + {KE_IGNORE, 0xe00c, KEY_KBDILLUMTOGGLE}, 78 + 79 + /* BIOS error detected */ 80 + {KE_IGNORE, 0xe00d, KEY_RESERVED}, 81 + 82 + /* Wifi Catcher */ 83 + {KE_KEY, 0xe011, KEY_PROG2}, 84 + 85 + /* Ambient light sensor toggle */ 86 + {KE_IGNORE, 0xe013, KEY_RESERVED}, 87 + 88 + {KE_IGNORE, 0xe020, KEY_MUTE}, 89 + {KE_IGNORE, 0xe02e, KEY_VOLUMEDOWN}, 90 + {KE_IGNORE, 0xe030, KEY_VOLUMEUP}, 91 + {KE_IGNORE, 0xe033, KEY_KBDILLUMUP}, 92 + {KE_IGNORE, 0xe034, KEY_KBDILLUMDOWN}, 93 + {KE_IGNORE, 0xe03a, KEY_CAPSLOCK}, 94 + {KE_IGNORE, 0xe045, KEY_NUMLOCK}, 95 + {KE_IGNORE, 0xe046, KEY_SCROLLLOCK}, 53 96 {KE_END, 0} 54 97 }; 55 98 ··· 165 122 166 123 if (obj && obj->type == ACPI_TYPE_BUFFER) { 167 124 int *buffer = (int *)obj->buffer.pointer; 168 - key = dell_wmi_get_entry_by_scancode(buffer[1]); 125 + /* 126 + * The upper bytes of the event may contain 127 + * additional information, so mask them off for the 128 + * scancode lookup 129 + */ 130 + key = dell_wmi_get_entry_by_scancode(buffer[1] & 0xFFFF); 169 131 if (key) { 170 132 input_report_key(dell_wmi_input_dev, key->keycode, 1); 171 133 input_sync(dell_wmi_input_dev); 172 134 input_report_key(dell_wmi_input_dev, key->keycode, 0); 173 135 input_sync(dell_wmi_input_dev); 174 - } else 136 + } else if (buffer[1] & 0xFFFF) 175 137 printk(KERN_INFO "dell-wmi: Unknown key %x pressed\n", 176 - buffer[1]); 138 + buffer[1] & 0xFFFF); 177 139 } 178 140 } 179 141
+109 -17
drivers/platform/x86/eeepc-laptop.c
··· 62 62 DISABLE_ASL_GPS = 0x0020, 63 63 DISABLE_ASL_DISPLAYSWITCH = 0x0040, 64 64 DISABLE_ASL_MODEM = 0x0080, 65 - DISABLE_ASL_CARDREADER = 0x0100 65 + DISABLE_ASL_CARDREADER = 0x0100, 66 + DISABLE_ASL_3G = 0x0200, 67 + DISABLE_ASL_WIMAX = 0x0400, 68 + DISABLE_ASL_HWCF = 0x0800 66 69 }; 67 70 68 71 enum { ··· 90 87 CM_ASL_USBPORT3, 91 88 CM_ASL_MODEM, 92 89 CM_ASL_CARDREADER, 93 - CM_ASL_LID 90 + CM_ASL_3G, 91 + CM_ASL_WIMAX, 92 + CM_ASL_HWCF, 93 + CM_ASL_LID, 94 + CM_ASL_TYPE, 95 + CM_ASL_PANELPOWER, /*P901*/ 96 + CM_ASL_TPD 94 97 }; 95 98 96 99 static const char *cm_getv[] = { ··· 105 96 NULL, "PBLG", NULL, NULL, 106 97 "CFVG", NULL, NULL, NULL, 107 98 "USBG", NULL, NULL, "MODG", 108 - "CRDG", "LIDG" 99 + "CRDG", "M3GG", "WIMG", "HWCF", 100 + "LIDG", "TYPE", "PBPG", "TPDG" 109 101 }; 110 102 111 103 static const char *cm_setv[] = { ··· 115 105 "SDSP", "PBLS", "HDPS", NULL, 116 106 "CFVS", NULL, NULL, NULL, 117 107 "USBG", NULL, NULL, "MODS", 118 - "CRDS", NULL 108 + "CRDS", "M3GS", "WIMS", NULL, 109 + NULL, NULL, "PBPS", "TPDS" 119 110 }; 120 111 121 112 #define EEEPC_EC "\\_SB.PCI0.SBRG.EC0." ··· 192 181 static int eeepc_hotk_add(struct acpi_device *device); 193 182 static int eeepc_hotk_remove(struct acpi_device *device, int type); 194 183 static int eeepc_hotk_resume(struct acpi_device *device); 184 + static void eeepc_hotk_notify(struct acpi_device *device, u32 event); 195 185 196 186 static const struct acpi_device_id eeepc_device_ids[] = { 197 187 {EEEPC_HOTK_HID, 0}, ··· 204 192 .name = EEEPC_HOTK_NAME, 205 193 .class = EEEPC_HOTK_CLASS, 206 194 .ids = eeepc_device_ids, 195 + .flags = ACPI_DRIVER_ALL_NOTIFY_EVENTS, 207 196 .ops = { 208 197 .add = eeepc_hotk_add, 209 198 .remove = eeepc_hotk_remove, 210 199 .resume = eeepc_hotk_resume, 200 + .notify = eeepc_hotk_notify, 211 201 }, 212 202 }; 213 203 ··· 332 318 .set_block = eeepc_rfkill_set, 333 319 }; 334 320 321 + static void __init eeepc_enable_camera(void) 322 + { 323 + /* 324 + * If the following call to set_acpi() fails, it's because there's no 325 + * camera so we can ignore the error. 326 + */ 327 + set_acpi(CM_ASL_CAMERA, 1); 328 + } 329 + 335 330 /* 336 331 * Sys helpers 337 332 */ ··· 392 369 EEEPC_CREATE_DEVICE_ATTR(camera, CM_ASL_CAMERA); 393 370 EEEPC_CREATE_DEVICE_ATTR(cardr, CM_ASL_CARDREADER); 394 371 EEEPC_CREATE_DEVICE_ATTR(disp, CM_ASL_DISPLAYSWITCH); 395 - EEEPC_CREATE_DEVICE_ATTR(cpufv, CM_ASL_CPUFV); 372 + 373 + struct eeepc_cpufv { 374 + int num; 375 + int cur; 376 + }; 377 + 378 + static int get_cpufv(struct eeepc_cpufv *c) 379 + { 380 + c->cur = get_acpi(CM_ASL_CPUFV); 381 + c->num = (c->cur >> 8) & 0xff; 382 + c->cur &= 0xff; 383 + if (c->cur < 0 || c->num <= 0 || c->num > 12) 384 + return -ENODEV; 385 + return 0; 386 + } 387 + 388 + static ssize_t show_available_cpufv(struct device *dev, 389 + struct device_attribute *attr, 390 + char *buf) 391 + { 392 + struct eeepc_cpufv c; 393 + int i; 394 + ssize_t len = 0; 395 + 396 + if (get_cpufv(&c)) 397 + return -ENODEV; 398 + for (i = 0; i < c.num; i++) 399 + len += sprintf(buf + len, "%d ", i); 400 + len += sprintf(buf + len, "\n"); 401 + return len; 402 + } 403 + 404 + static ssize_t show_cpufv(struct device *dev, 405 + struct device_attribute *attr, 406 + char *buf) 407 + { 408 + struct eeepc_cpufv c; 409 + 410 + if (get_cpufv(&c)) 411 + return -ENODEV; 412 + return sprintf(buf, "%#x\n", (c.num << 8) | c.cur); 413 + } 414 + 415 + static ssize_t store_cpufv(struct device *dev, 416 + struct device_attribute *attr, 417 + const char *buf, size_t count) 418 + { 419 + struct eeepc_cpufv c; 420 + int rv, value; 421 + 422 + if (get_cpufv(&c)) 423 + return -ENODEV; 424 + rv = parse_arg(buf, count, &value); 425 + if (rv < 0) 426 + return rv; 427 + if (!rv || value < 0 || value >= c.num) 428 + return -EINVAL; 429 + set_acpi(CM_ASL_CPUFV, value); 430 + return rv; 431 + } 432 + 433 + static struct device_attribute dev_attr_cpufv = { 434 + .attr = { 435 + .name = "cpufv", 436 + .mode = 0644 }, 437 + .show = show_cpufv, 438 + .store = store_cpufv 439 + }; 440 + 441 + static struct device_attribute dev_attr_available_cpufv = { 442 + .attr = { 443 + .name = "available_cpufv", 444 + .mode = 0444 }, 445 + .show = show_available_cpufv 446 + }; 396 447 397 448 static struct attribute *platform_attributes[] = { 398 449 &dev_attr_camera.attr, 399 450 &dev_attr_cardr.attr, 400 451 &dev_attr_disp.attr, 401 452 &dev_attr_cpufv.attr, 453 + &dev_attr_available_cpufv.attr, 402 454 NULL 403 455 }; 404 456 ··· 656 558 eeepc_rfkill_hotplug(); 657 559 } 658 560 659 - static void eeepc_hotk_notify(acpi_handle handle, u32 event, void *data) 561 + static void eeepc_hotk_notify(struct acpi_device *device, u32 event) 660 562 { 661 563 static struct key_entry *key; 662 564 u16 count; 663 565 int brn = -ENODEV; 664 566 665 567 if (!ehotk) 568 + return; 569 + if (event > ACPI_MAX_SYS_NOTIFY) 666 570 return; 667 571 if (event >= NOTIFY_BRN_MIN && event <= NOTIFY_BRN_MAX) 668 572 brn = notify_brn(); ··· 746 646 747 647 static int eeepc_hotk_add(struct acpi_device *device) 748 648 { 749 - acpi_status status = AE_OK; 750 649 int result; 751 650 752 651 if (!device) ··· 763 664 result = eeepc_hotk_check(); 764 665 if (result) 765 666 goto ehotk_fail; 766 - status = acpi_install_notify_handler(ehotk->handle, ACPI_SYSTEM_NOTIFY, 767 - eeepc_hotk_notify, ehotk); 768 - if (ACPI_FAILURE(status)) 769 - printk(EEEPC_ERR "Error installing notify handler\n"); 770 667 771 668 eeepc_register_rfkill_notifier("\\_SB.PCI0.P0P6"); 772 669 eeepc_register_rfkill_notifier("\\_SB.PCI0.P0P7"); ··· 820 725 821 726 static int eeepc_hotk_remove(struct acpi_device *device, int type) 822 727 { 823 - acpi_status status = 0; 824 - 825 728 if (!device || !acpi_driver_data(device)) 826 729 return -EINVAL; 827 - status = acpi_remove_notify_handler(ehotk->handle, ACPI_SYSTEM_NOTIFY, 828 - eeepc_hotk_notify); 829 - if (ACPI_FAILURE(status)) 830 - printk(EEEPC_ERR "Error removing notify handler\n"); 831 730 832 731 eeepc_unregister_rfkill_notifier("\\_SB.PCI0.P0P6"); 833 732 eeepc_unregister_rfkill_notifier("\\_SB.PCI0.P0P7"); ··· 1078 989 result = eeepc_hwmon_init(dev); 1079 990 if (result) 1080 991 goto fail_hwmon; 992 + 993 + eeepc_enable_camera(); 994 + 1081 995 /* Register platform stuff */ 1082 996 result = platform_driver_register(&platform_driver); 1083 997 if (result)
+55 -32
drivers/platform/x86/hp-wmi.c
··· 47 47 #define HPWMI_DISPLAY_QUERY 0x1 48 48 #define HPWMI_HDDTEMP_QUERY 0x2 49 49 #define HPWMI_ALS_QUERY 0x3 50 - #define HPWMI_DOCK_QUERY 0x4 50 + #define HPWMI_HARDWARE_QUERY 0x4 51 51 #define HPWMI_WIRELESS_QUERY 0x5 52 52 #define HPWMI_HOTKEY_QUERY 0xc 53 53 ··· 75 75 u16 keycode; 76 76 }; 77 77 78 - enum { KE_KEY, KE_SW, KE_END }; 78 + enum { KE_KEY, KE_END }; 79 79 80 80 static struct key_entry hp_wmi_keymap[] = { 81 - {KE_SW, 0x01, SW_DOCK}, 82 81 {KE_KEY, 0x02, KEY_BRIGHTNESSUP}, 83 82 {KE_KEY, 0x03, KEY_BRIGHTNESSDOWN}, 84 83 {KE_KEY, 0x20e6, KEY_PROG1}, ··· 150 151 151 152 static int hp_wmi_dock_state(void) 152 153 { 153 - return hp_wmi_perform_query(HPWMI_DOCK_QUERY, 0, 0); 154 + int ret = hp_wmi_perform_query(HPWMI_HARDWARE_QUERY, 0, 0); 155 + 156 + if (ret < 0) 157 + return ret; 158 + 159 + return ret & 0x1; 160 + } 161 + 162 + static int hp_wmi_tablet_state(void) 163 + { 164 + int ret = hp_wmi_perform_query(HPWMI_HARDWARE_QUERY, 0, 0); 165 + 166 + if (ret < 0) 167 + return ret; 168 + 169 + return (ret & 0x4) ? 1 : 0; 154 170 } 155 171 156 172 static int hp_wmi_set_block(void *data, bool blocked) ··· 246 232 return sprintf(buf, "%d\n", value); 247 233 } 248 234 235 + static ssize_t show_tablet(struct device *dev, struct device_attribute *attr, 236 + char *buf) 237 + { 238 + int value = hp_wmi_tablet_state(); 239 + if (value < 0) 240 + return -EINVAL; 241 + return sprintf(buf, "%d\n", value); 242 + } 243 + 249 244 static ssize_t set_als(struct device *dev, struct device_attribute *attr, 250 245 const char *buf, size_t count) 251 246 { ··· 267 244 static DEVICE_ATTR(hddtemp, S_IRUGO, show_hddtemp, NULL); 268 245 static DEVICE_ATTR(als, S_IRUGO | S_IWUSR, show_als, set_als); 269 246 static DEVICE_ATTR(dock, S_IRUGO, show_dock, NULL); 247 + static DEVICE_ATTR(tablet, S_IRUGO, show_tablet, NULL); 270 248 271 249 static struct key_entry *hp_wmi_get_entry_by_scancode(int code) 272 250 { ··· 350 326 key->keycode, 0); 351 327 input_sync(hp_wmi_input_dev); 352 328 break; 353 - case KE_SW: 354 - input_report_switch(hp_wmi_input_dev, 355 - key->keycode, 356 - hp_wmi_dock_state()); 357 - input_sync(hp_wmi_input_dev); 358 - break; 359 329 } 330 + } else if (eventcode == 0x1) { 331 + input_report_switch(hp_wmi_input_dev, SW_DOCK, 332 + hp_wmi_dock_state()); 333 + input_report_switch(hp_wmi_input_dev, SW_TABLET_MODE, 334 + hp_wmi_tablet_state()); 335 + input_sync(hp_wmi_input_dev); 360 336 } else if (eventcode == 0x5) { 361 337 if (wifi_rfkill) 362 338 rfkill_set_sw_state(wifi_rfkill, ··· 393 369 set_bit(EV_KEY, hp_wmi_input_dev->evbit); 394 370 set_bit(key->keycode, hp_wmi_input_dev->keybit); 395 371 break; 396 - case KE_SW: 397 - set_bit(EV_SW, hp_wmi_input_dev->evbit); 398 - set_bit(key->keycode, hp_wmi_input_dev->swbit); 399 - 400 - /* Set initial dock state */ 401 - input_report_switch(hp_wmi_input_dev, key->keycode, 402 - hp_wmi_dock_state()); 403 - input_sync(hp_wmi_input_dev); 404 - break; 405 372 } 406 373 } 374 + 375 + set_bit(EV_SW, hp_wmi_input_dev->evbit); 376 + set_bit(SW_DOCK, hp_wmi_input_dev->swbit); 377 + set_bit(SW_TABLET_MODE, hp_wmi_input_dev->swbit); 378 + 379 + /* Set initial hardware state */ 380 + input_report_switch(hp_wmi_input_dev, SW_DOCK, hp_wmi_dock_state()); 381 + input_report_switch(hp_wmi_input_dev, SW_TABLET_MODE, 382 + hp_wmi_tablet_state()); 383 + input_sync(hp_wmi_input_dev); 407 384 408 385 err = input_register_device(hp_wmi_input_dev); 409 386 ··· 422 397 device_remove_file(&device->dev, &dev_attr_hddtemp); 423 398 device_remove_file(&device->dev, &dev_attr_als); 424 399 device_remove_file(&device->dev, &dev_attr_dock); 400 + device_remove_file(&device->dev, &dev_attr_tablet); 425 401 } 426 402 427 403 static int __init hp_wmi_bios_setup(struct platform_device *device) ··· 440 414 if (err) 441 415 goto add_sysfs_error; 442 416 err = device_create_file(&device->dev, &dev_attr_dock); 417 + if (err) 418 + goto add_sysfs_error; 419 + err = device_create_file(&device->dev, &dev_attr_tablet); 443 420 if (err) 444 421 goto add_sysfs_error; 445 422 ··· 514 485 515 486 static int hp_wmi_resume_handler(struct platform_device *device) 516 487 { 517 - struct key_entry *key; 518 - 519 488 /* 520 - * Docking state may have changed while suspended, so trigger 521 - * an input event for the current state. As this is a switch, 489 + * Hardware state may have changed while suspended, so trigger 490 + * input events for the current state. As this is a switch, 522 491 * the input layer will only actually pass it on if the state 523 492 * changed. 524 493 */ 525 - for (key = hp_wmi_keymap; key->type != KE_END; key++) { 526 - switch (key->type) { 527 - case KE_SW: 528 - input_report_switch(hp_wmi_input_dev, key->keycode, 529 - hp_wmi_dock_state()); 530 - input_sync(hp_wmi_input_dev); 531 - break; 532 - } 533 - } 494 + 495 + input_report_switch(hp_wmi_input_dev, SW_DOCK, hp_wmi_dock_state()); 496 + input_report_switch(hp_wmi_input_dev, SW_TABLET_MODE, 497 + hp_wmi_tablet_state()); 498 + input_sync(hp_wmi_input_dev); 534 499 535 500 return 0; 536 501 }
+371 -40
drivers/platform/x86/thinkpad_acpi.c
··· 22 22 */ 23 23 24 24 #define TPACPI_VERSION "0.23" 25 - #define TPACPI_SYSFS_VERSION 0x020300 25 + #define TPACPI_SYSFS_VERSION 0x020400 26 26 27 27 /* 28 28 * Changelog: ··· 257 257 u32 wan:1; 258 258 u32 uwb:1; 259 259 u32 fan_ctrl_status_undef:1; 260 + u32 second_fan:1; 261 + u32 beep_needs_two_args:1; 260 262 u32 input_device_registered:1; 261 263 u32 platform_drv_registered:1; 262 264 u32 platform_drv_attrs_registered:1; ··· 279 277 char *bios_version_str; /* Something like 1ZET51WW (1.03z) */ 280 278 char *ec_version_str; /* Something like 1ZHT51WW-1.04a */ 281 279 282 - u16 bios_model; /* Big Endian, TP-1Y = 0x5931, 0 = unknown */ 280 + u16 bios_model; /* 1Y = 0x5931, 0 = unknown */ 283 281 u16 ec_model; 282 + u16 bios_release; /* 1ZETK1WW = 0x314b, 0 = unknown */ 283 + u16 ec_release; 284 284 285 285 char *model_str; /* ThinkPad T43 */ 286 286 char *nummodel_str; /* 9384A9C for a 9384-A9C model */ ··· 358 354 what, task_tgid_vnr(current), ## arg); \ 359 355 } \ 360 356 } while (0) 357 + 358 + /* 359 + * Quirk handling helpers 360 + * 361 + * ThinkPad IDs and versions seen in the field so far 362 + * are two-characters from the set [0-9A-Z], i.e. base 36. 363 + * 364 + * We use values well outside that range as specials. 365 + */ 366 + 367 + #define TPACPI_MATCH_ANY 0xffffU 368 + #define TPACPI_MATCH_UNKNOWN 0U 369 + 370 + /* TPID('1', 'Y') == 0x5931 */ 371 + #define TPID(__c1, __c2) (((__c2) << 8) | (__c1)) 372 + 373 + #define TPACPI_Q_IBM(__id1, __id2, __quirk) \ 374 + { .vendor = PCI_VENDOR_ID_IBM, \ 375 + .bios = TPID(__id1, __id2), \ 376 + .ec = TPACPI_MATCH_ANY, \ 377 + .quirks = (__quirk) } 378 + 379 + #define TPACPI_Q_LNV(__id1, __id2, __quirk) \ 380 + { .vendor = PCI_VENDOR_ID_LENOVO, \ 381 + .bios = TPID(__id1, __id2), \ 382 + .ec = TPACPI_MATCH_ANY, \ 383 + .quirks = (__quirk) } 384 + 385 + struct tpacpi_quirk { 386 + unsigned int vendor; 387 + u16 bios; 388 + u16 ec; 389 + unsigned long quirks; 390 + }; 391 + 392 + /** 393 + * tpacpi_check_quirks() - search BIOS/EC version on a list 394 + * @qlist: array of &struct tpacpi_quirk 395 + * @qlist_size: number of elements in @qlist 396 + * 397 + * Iterates over a quirks list until one is found that matches the 398 + * ThinkPad's vendor, BIOS and EC model. 399 + * 400 + * Returns 0 if nothing matches, otherwise returns the quirks field of 401 + * the matching &struct tpacpi_quirk entry. 402 + * 403 + * The match criteria is: vendor, ec and bios much match. 404 + */ 405 + static unsigned long __init tpacpi_check_quirks( 406 + const struct tpacpi_quirk *qlist, 407 + unsigned int qlist_size) 408 + { 409 + while (qlist_size) { 410 + if ((qlist->vendor == thinkpad_id.vendor || 411 + qlist->vendor == TPACPI_MATCH_ANY) && 412 + (qlist->bios == thinkpad_id.bios_model || 413 + qlist->bios == TPACPI_MATCH_ANY) && 414 + (qlist->ec == thinkpad_id.ec_model || 415 + qlist->ec == TPACPI_MATCH_ANY)) 416 + return qlist->quirks; 417 + 418 + qlist_size--; 419 + qlist++; 420 + } 421 + return 0; 422 + } 423 + 361 424 362 425 /**************************************************************************** 363 426 **************************************************************************** ··· 2951 2880 /* update bright_acpimode... */ 2952 2881 tpacpi_check_std_acpi_brightness_support(); 2953 2882 2954 - if (tp_features.bright_acpimode) { 2883 + if (tp_features.bright_acpimode && acpi_video_backlight_support()) { 2955 2884 printk(TPACPI_INFO 2956 2885 "This ThinkPad has standard ACPI backlight " 2957 2886 "brightness control, supported by the ACPI " ··· 4844 4773 "LED", /* all others */ 4845 4774 ); /* R30, R31 */ 4846 4775 4847 - #define TPACPI_LED_NUMLEDS 8 4776 + #define TPACPI_LED_NUMLEDS 16 4848 4777 static struct tpacpi_led_classdev *tpacpi_leds; 4849 4778 static enum led_status_t tpacpi_led_state_cache[TPACPI_LED_NUMLEDS]; 4850 4779 static const char * const tpacpi_led_names[TPACPI_LED_NUMLEDS] = { ··· 4857 4786 "tpacpi::dock_batt", 4858 4787 "tpacpi::unknown_led", 4859 4788 "tpacpi::standby", 4789 + "tpacpi::dock_status1", 4790 + "tpacpi::dock_status2", 4791 + "tpacpi::unknown_led2", 4792 + "tpacpi::unknown_led3", 4793 + "tpacpi::thinkvantage", 4860 4794 }; 4861 - #define TPACPI_SAFE_LEDS 0x0081U 4795 + #define TPACPI_SAFE_LEDS 0x1081U 4862 4796 4863 4797 static inline bool tpacpi_is_led_restricted(const unsigned int led) 4864 4798 { 4865 4799 #ifdef CONFIG_THINKPAD_ACPI_UNSAFE_LEDS 4866 4800 return false; 4867 4801 #else 4868 - return (TPACPI_SAFE_LEDS & (1 << led)) == 0; 4802 + return (1U & (TPACPI_SAFE_LEDS >> led)) == 0; 4869 4803 #endif 4870 4804 } 4871 4805 ··· 5032 4956 5033 4957 tpacpi_leds[led].led = led; 5034 4958 4959 + /* LEDs with no name don't get registered */ 4960 + if (!tpacpi_led_names[led]) 4961 + return 0; 4962 + 5035 4963 tpacpi_leds[led].led_classdev.brightness_set = &led_sysfs_set; 5036 4964 tpacpi_leds[led].led_classdev.blink_set = &led_sysfs_blink_set; 5037 4965 if (led_supported == TPACPI_LED_570) ··· 5054 4974 return rc; 5055 4975 } 5056 4976 4977 + static const struct tpacpi_quirk led_useful_qtable[] __initconst = { 4978 + TPACPI_Q_IBM('1', 'E', 0x009f), /* A30 */ 4979 + TPACPI_Q_IBM('1', 'N', 0x009f), /* A31 */ 4980 + TPACPI_Q_IBM('1', 'G', 0x009f), /* A31 */ 4981 + 4982 + TPACPI_Q_IBM('1', 'I', 0x0097), /* T30 */ 4983 + TPACPI_Q_IBM('1', 'R', 0x0097), /* T40, T41, T42, R50, R51 */ 4984 + TPACPI_Q_IBM('7', '0', 0x0097), /* T43, R52 */ 4985 + TPACPI_Q_IBM('1', 'Y', 0x0097), /* T43 */ 4986 + TPACPI_Q_IBM('1', 'W', 0x0097), /* R50e */ 4987 + TPACPI_Q_IBM('1', 'V', 0x0097), /* R51 */ 4988 + TPACPI_Q_IBM('7', '8', 0x0097), /* R51e */ 4989 + TPACPI_Q_IBM('7', '6', 0x0097), /* R52 */ 4990 + 4991 + TPACPI_Q_IBM('1', 'K', 0x00bf), /* X30 */ 4992 + TPACPI_Q_IBM('1', 'Q', 0x00bf), /* X31, X32 */ 4993 + TPACPI_Q_IBM('1', 'U', 0x00bf), /* X40 */ 4994 + TPACPI_Q_IBM('7', '4', 0x00bf), /* X41 */ 4995 + TPACPI_Q_IBM('7', '5', 0x00bf), /* X41t */ 4996 + 4997 + TPACPI_Q_IBM('7', '9', 0x1f97), /* T60 (1) */ 4998 + TPACPI_Q_IBM('7', '7', 0x1f97), /* Z60* (1) */ 4999 + TPACPI_Q_IBM('7', 'F', 0x1f97), /* Z61* (1) */ 5000 + TPACPI_Q_IBM('7', 'B', 0x1fb7), /* X60 (1) */ 5001 + 5002 + /* (1) - may have excess leds enabled on MSB */ 5003 + 5004 + /* Defaults (order matters, keep last, don't reorder!) */ 5005 + { /* Lenovo */ 5006 + .vendor = PCI_VENDOR_ID_LENOVO, 5007 + .bios = TPACPI_MATCH_ANY, .ec = TPACPI_MATCH_ANY, 5008 + .quirks = 0x1fffU, 5009 + }, 5010 + { /* IBM ThinkPads with no EC version string */ 5011 + .vendor = PCI_VENDOR_ID_IBM, 5012 + .bios = TPACPI_MATCH_ANY, .ec = TPACPI_MATCH_UNKNOWN, 5013 + .quirks = 0x00ffU, 5014 + }, 5015 + { /* IBM ThinkPads with EC version string */ 5016 + .vendor = PCI_VENDOR_ID_IBM, 5017 + .bios = TPACPI_MATCH_ANY, .ec = TPACPI_MATCH_ANY, 5018 + .quirks = 0x00bfU, 5019 + }, 5020 + }; 5021 + 5022 + #undef TPACPI_LEDQ_IBM 5023 + #undef TPACPI_LEDQ_LNV 5024 + 5057 5025 static int __init led_init(struct ibm_init_struct *iibm) 5058 5026 { 5059 5027 unsigned int i; 5060 5028 int rc; 5029 + unsigned long useful_leds; 5061 5030 5062 5031 vdbg_printk(TPACPI_DBG_INIT, "initializing LED subdriver\n"); 5063 5032 ··· 5128 4999 vdbg_printk(TPACPI_DBG_INIT, "LED commands are %s, mode %d\n", 5129 5000 str_supported(led_supported), led_supported); 5130 5001 5002 + if (led_supported == TPACPI_LED_NONE) 5003 + return 1; 5004 + 5131 5005 tpacpi_leds = kzalloc(sizeof(*tpacpi_leds) * TPACPI_LED_NUMLEDS, 5132 5006 GFP_KERNEL); 5133 5007 if (!tpacpi_leds) { ··· 5138 5006 return -ENOMEM; 5139 5007 } 5140 5008 5009 + useful_leds = tpacpi_check_quirks(led_useful_qtable, 5010 + ARRAY_SIZE(led_useful_qtable)); 5011 + 5141 5012 for (i = 0; i < TPACPI_LED_NUMLEDS; i++) { 5142 - if (!tpacpi_is_led_restricted(i)) { 5013 + if (!tpacpi_is_led_restricted(i) && 5014 + test_bit(i, &useful_leds)) { 5143 5015 rc = tpacpi_init_led(i); 5144 5016 if (rc < 0) { 5145 5017 led_exit(); ··· 5153 5017 } 5154 5018 5155 5019 #ifdef CONFIG_THINKPAD_ACPI_UNSAFE_LEDS 5156 - if (led_supported != TPACPI_LED_NONE) 5157 - printk(TPACPI_NOTICE 5158 - "warning: userspace override of important " 5159 - "firmware LEDs is enabled\n"); 5020 + printk(TPACPI_NOTICE 5021 + "warning: userspace override of important " 5022 + "firmware LEDs is enabled\n"); 5160 5023 #endif 5161 - return (led_supported != TPACPI_LED_NONE)? 0 : 1; 5024 + return 0; 5162 5025 } 5163 5026 5164 5027 #define str_led_status(s) \ ··· 5187 5052 } 5188 5053 5189 5054 len += sprintf(p + len, "commands:\t" 5190 - "<led> on, <led> off, <led> blink (<led> is 0-7)\n"); 5055 + "<led> on, <led> off, <led> blink (<led> is 0-15)\n"); 5191 5056 5192 5057 return len; 5193 5058 } ··· 5202 5067 return -ENODEV; 5203 5068 5204 5069 while ((cmd = next_cmd(&buf))) { 5205 - if (sscanf(cmd, "%d", &led) != 1 || led < 0 || led > 7) 5070 + if (sscanf(cmd, "%d", &led) != 1 || led < 0 || led > 15) 5206 5071 return -EINVAL; 5207 5072 5208 5073 if (strstr(cmd, "off")) { ··· 5236 5101 5237 5102 TPACPI_HANDLE(beep, ec, "BEEP"); /* all except R30, R31 */ 5238 5103 5104 + #define TPACPI_BEEP_Q1 0x0001 5105 + 5106 + static const struct tpacpi_quirk beep_quirk_table[] __initconst = { 5107 + TPACPI_Q_IBM('I', 'M', TPACPI_BEEP_Q1), /* 570 */ 5108 + TPACPI_Q_IBM('I', 'U', TPACPI_BEEP_Q1), /* 570E - unverified */ 5109 + }; 5110 + 5239 5111 static int __init beep_init(struct ibm_init_struct *iibm) 5240 5112 { 5113 + unsigned long quirks; 5114 + 5241 5115 vdbg_printk(TPACPI_DBG_INIT, "initializing beep subdriver\n"); 5242 5116 5243 5117 TPACPI_ACPIHANDLE_INIT(beep); 5244 5118 5245 5119 vdbg_printk(TPACPI_DBG_INIT, "beep is %s\n", 5246 5120 str_supported(beep_handle != NULL)); 5121 + 5122 + quirks = tpacpi_check_quirks(beep_quirk_table, 5123 + ARRAY_SIZE(beep_quirk_table)); 5124 + 5125 + tp_features.beep_needs_two_args = !!(quirks & TPACPI_BEEP_Q1); 5247 5126 5248 5127 return (beep_handle)? 0 : 1; 5249 5128 } ··· 5290 5141 /* beep_cmd set */ 5291 5142 } else 5292 5143 return -EINVAL; 5293 - if (!acpi_evalf(beep_handle, NULL, NULL, "vdd", beep_cmd, 0)) 5294 - return -EIO; 5144 + if (tp_features.beep_needs_two_args) { 5145 + if (!acpi_evalf(beep_handle, NULL, NULL, "vdd", 5146 + beep_cmd, 0)) 5147 + return -EIO; 5148 + } else { 5149 + if (!acpi_evalf(beep_handle, NULL, NULL, "vd", 5150 + beep_cmd)) 5151 + return -EIO; 5152 + } 5295 5153 } 5296 5154 5297 5155 return 0; ··· 5725 5569 * Bit 3-0: backlight brightness level 5726 5570 * 5727 5571 * brightness_get_raw returns status data in the HBRV layout 5572 + * 5573 + * WARNING: The X61 has been verified to use HBRV for something else, so 5574 + * this should be used _only_ on IBM ThinkPads, and maybe with some careful 5575 + * testing on the very early *60 Lenovo models... 5728 5576 */ 5729 5577 5730 5578 enum { ··· 6029 5869 brightness_mode); 6030 5870 } 6031 5871 5872 + /* Safety */ 5873 + if (thinkpad_id.vendor != PCI_VENDOR_ID_IBM && 5874 + (brightness_mode == TPACPI_BRGHT_MODE_ECNVRAM || 5875 + brightness_mode == TPACPI_BRGHT_MODE_EC)) 5876 + return -EINVAL; 5877 + 6032 5878 if (tpacpi_brightness_get_raw(&b) < 0) 6033 5879 return 1; 6034 5880 ··· 6327 6161 * For firmware bugs, refer to: 6328 6162 * http://thinkwiki.org/wiki/Embedded_Controller_Firmware#Firmware_Issues 6329 6163 * 6164 + * ---- 6165 + * 6166 + * ThinkPad EC register 0x31 bit 0 (only on select models) 6167 + * 6168 + * When bit 0 of EC register 0x31 is zero, the tachometer registers 6169 + * show the speed of the main fan. When bit 0 of EC register 0x31 6170 + * is one, the tachometer registers show the speed of the auxiliary 6171 + * fan. 6172 + * 6173 + * Fan control seems to affect both fans, regardless of the state 6174 + * of this bit. 6175 + * 6176 + * So far, only the firmware for the X60/X61 non-tablet versions 6177 + * seem to support this (firmware TP-7M). 6178 + * 6330 6179 * TPACPI_FAN_WR_ACPI_FANS: 6331 6180 * ThinkPad X31, X40, X41. Not available in the X60. 6332 6181 * ··· 6368 6187 fan_status_offset = 0x2f, /* EC register 0x2f */ 6369 6188 fan_rpm_offset = 0x84, /* EC register 0x84: LSB, 0x85 MSB (RPM) 6370 6189 * 0x84 must be read before 0x85 */ 6190 + fan_select_offset = 0x31, /* EC register 0x31 (Firmware 7M) 6191 + bit 0 selects which fan is active */ 6371 6192 6372 6193 TP_EC_FAN_FULLSPEED = 0x40, /* EC fan mode: full speed */ 6373 6194 TP_EC_FAN_AUTO = 0x80, /* EC fan mode: auto fan control */ ··· 6432 6249 * We assume 0x07 really means auto mode while this quirk is active, 6433 6250 * as this is far more likely than the ThinkPad being in level 7, 6434 6251 * which is only used by the firmware during thermal emergencies. 6252 + * 6253 + * Enable for TP-1Y (T43), TP-78 (R51e), TP-76 (R52), 6254 + * TP-70 (T43, R52), which are known to be buggy. 6435 6255 */ 6436 6256 6437 - static void fan_quirk1_detect(void) 6257 + static void fan_quirk1_setup(void) 6438 6258 { 6439 - /* In some ThinkPads, neither the EC nor the ACPI 6440 - * DSDT initialize the HFSP register, and it ends up 6441 - * being initially set to 0x07 when it *could* be 6442 - * either 0x07 or 0x80. 6443 - * 6444 - * Enable for TP-1Y (T43), TP-78 (R51e), 6445 - * TP-76 (R52), TP-70 (T43, R52), which are known 6446 - * to be buggy. */ 6447 6259 if (fan_control_initial_status == 0x07) { 6448 - switch (thinkpad_id.ec_model) { 6449 - case 0x5931: /* TP-1Y */ 6450 - case 0x3837: /* TP-78 */ 6451 - case 0x3637: /* TP-76 */ 6452 - case 0x3037: /* TP-70 */ 6453 - printk(TPACPI_NOTICE 6454 - "fan_init: initial fan status is unknown, " 6455 - "assuming it is in auto mode\n"); 6456 - tp_features.fan_ctrl_status_undef = 1; 6457 - ;; 6458 - } 6260 + printk(TPACPI_NOTICE 6261 + "fan_init: initial fan status is unknown, " 6262 + "assuming it is in auto mode\n"); 6263 + tp_features.fan_ctrl_status_undef = 1; 6459 6264 } 6460 6265 } 6461 6266 ··· 6461 6290 *fan_status = TP_EC_FAN_AUTO; 6462 6291 } 6463 6292 } 6293 + } 6294 + 6295 + /* Select main fan on X60/X61, NOOP on others */ 6296 + static bool fan_select_fan1(void) 6297 + { 6298 + if (tp_features.second_fan) { 6299 + u8 val; 6300 + 6301 + if (ec_read(fan_select_offset, &val) < 0) 6302 + return false; 6303 + val &= 0xFEU; 6304 + if (ec_write(fan_select_offset, val) < 0) 6305 + return false; 6306 + } 6307 + return true; 6308 + } 6309 + 6310 + /* Select secondary fan on X60/X61 */ 6311 + static bool fan_select_fan2(void) 6312 + { 6313 + u8 val; 6314 + 6315 + if (!tp_features.second_fan) 6316 + return false; 6317 + 6318 + if (ec_read(fan_select_offset, &val) < 0) 6319 + return false; 6320 + val |= 0x01U; 6321 + if (ec_write(fan_select_offset, val) < 0) 6322 + return false; 6323 + 6324 + return true; 6464 6325 } 6465 6326 6466 6327 /* ··· 6572 6369 switch (fan_status_access_mode) { 6573 6370 case TPACPI_FAN_RD_TPEC: 6574 6371 /* all except 570, 600e/x, 770e, 770x */ 6372 + if (unlikely(!fan_select_fan1())) 6373 + return -EIO; 6575 6374 if (unlikely(!acpi_ec_read(fan_rpm_offset, &lo) || 6576 6375 !acpi_ec_read(fan_rpm_offset + 1, &hi))) 6376 + return -EIO; 6377 + 6378 + if (likely(speed)) 6379 + *speed = (hi << 8) | lo; 6380 + 6381 + break; 6382 + 6383 + default: 6384 + return -ENXIO; 6385 + } 6386 + 6387 + return 0; 6388 + } 6389 + 6390 + static int fan2_get_speed(unsigned int *speed) 6391 + { 6392 + u8 hi, lo; 6393 + bool rc; 6394 + 6395 + switch (fan_status_access_mode) { 6396 + case TPACPI_FAN_RD_TPEC: 6397 + /* all except 570, 600e/x, 770e, 770x */ 6398 + if (unlikely(!fan_select_fan2())) 6399 + return -EIO; 6400 + rc = !acpi_ec_read(fan_rpm_offset, &lo) || 6401 + !acpi_ec_read(fan_rpm_offset + 1, &hi); 6402 + fan_select_fan1(); /* play it safe */ 6403 + if (rc) 6577 6404 return -EIO; 6578 6405 6579 6406 if (likely(speed)) ··· 7023 6790 __ATTR(fan1_input, S_IRUGO, 7024 6791 fan_fan1_input_show, NULL); 7025 6792 6793 + /* sysfs fan fan2_input ------------------------------------------------ */ 6794 + static ssize_t fan_fan2_input_show(struct device *dev, 6795 + struct device_attribute *attr, 6796 + char *buf) 6797 + { 6798 + int res; 6799 + unsigned int speed; 6800 + 6801 + res = fan2_get_speed(&speed); 6802 + if (res < 0) 6803 + return res; 6804 + 6805 + return snprintf(buf, PAGE_SIZE, "%u\n", speed); 6806 + } 6807 + 6808 + static struct device_attribute dev_attr_fan_fan2_input = 6809 + __ATTR(fan2_input, S_IRUGO, 6810 + fan_fan2_input_show, NULL); 6811 + 7026 6812 /* sysfs fan fan_watchdog (hwmon driver) ------------------------------- */ 7027 6813 static ssize_t fan_fan_watchdog_show(struct device_driver *drv, 7028 6814 char *buf) ··· 7075 6823 static struct attribute *fan_attributes[] = { 7076 6824 &dev_attr_fan_pwm1_enable.attr, &dev_attr_fan_pwm1.attr, 7077 6825 &dev_attr_fan_fan1_input.attr, 6826 + NULL, /* for fan2_input */ 7078 6827 NULL 7079 6828 }; 7080 6829 ··· 7083 6830 .attrs = fan_attributes, 7084 6831 }; 7085 6832 6833 + #define TPACPI_FAN_Q1 0x0001 /* Unitialized HFSP */ 6834 + #define TPACPI_FAN_2FAN 0x0002 /* EC 0x31 bit 0 selects fan2 */ 6835 + 6836 + #define TPACPI_FAN_QI(__id1, __id2, __quirks) \ 6837 + { .vendor = PCI_VENDOR_ID_IBM, \ 6838 + .bios = TPACPI_MATCH_ANY, \ 6839 + .ec = TPID(__id1, __id2), \ 6840 + .quirks = __quirks } 6841 + 6842 + #define TPACPI_FAN_QL(__id1, __id2, __quirks) \ 6843 + { .vendor = PCI_VENDOR_ID_LENOVO, \ 6844 + .bios = TPACPI_MATCH_ANY, \ 6845 + .ec = TPID(__id1, __id2), \ 6846 + .quirks = __quirks } 6847 + 6848 + static const struct tpacpi_quirk fan_quirk_table[] __initconst = { 6849 + TPACPI_FAN_QI('1', 'Y', TPACPI_FAN_Q1), 6850 + TPACPI_FAN_QI('7', '8', TPACPI_FAN_Q1), 6851 + TPACPI_FAN_QI('7', '6', TPACPI_FAN_Q1), 6852 + TPACPI_FAN_QI('7', '0', TPACPI_FAN_Q1), 6853 + TPACPI_FAN_QL('7', 'M', TPACPI_FAN_2FAN), 6854 + }; 6855 + 6856 + #undef TPACPI_FAN_QL 6857 + #undef TPACPI_FAN_QI 6858 + 7086 6859 static int __init fan_init(struct ibm_init_struct *iibm) 7087 6860 { 7088 6861 int rc; 6862 + unsigned long quirks; 7089 6863 7090 6864 vdbg_printk(TPACPI_DBG_INIT | TPACPI_DBG_FAN, 7091 6865 "initializing fan subdriver\n"); ··· 7123 6843 fan_control_commands = 0; 7124 6844 fan_watchdog_maxinterval = 0; 7125 6845 tp_features.fan_ctrl_status_undef = 0; 6846 + tp_features.second_fan = 0; 7126 6847 fan_control_desired_level = 7; 7127 6848 7128 6849 TPACPI_ACPIHANDLE_INIT(fans); 7129 6850 TPACPI_ACPIHANDLE_INIT(gfan); 7130 6851 TPACPI_ACPIHANDLE_INIT(sfan); 6852 + 6853 + quirks = tpacpi_check_quirks(fan_quirk_table, 6854 + ARRAY_SIZE(fan_quirk_table)); 7131 6855 7132 6856 if (gfan_handle) { 7133 6857 /* 570, 600e/x, 770e, 770x */ ··· 7142 6858 if (likely(acpi_ec_read(fan_status_offset, 7143 6859 &fan_control_initial_status))) { 7144 6860 fan_status_access_mode = TPACPI_FAN_RD_TPEC; 7145 - fan_quirk1_detect(); 6861 + if (quirks & TPACPI_FAN_Q1) 6862 + fan_quirk1_setup(); 6863 + if (quirks & TPACPI_FAN_2FAN) { 6864 + tp_features.second_fan = 1; 6865 + dbg_printk(TPACPI_DBG_INIT | TPACPI_DBG_FAN, 6866 + "secondary fan support enabled\n"); 6867 + } 7146 6868 } else { 7147 6869 printk(TPACPI_ERR 7148 6870 "ThinkPad ACPI EC access misbehaving, " ··· 7204 6914 7205 6915 if (fan_status_access_mode != TPACPI_FAN_NONE || 7206 6916 fan_control_access_mode != TPACPI_FAN_WR_NONE) { 6917 + if (tp_features.second_fan) { 6918 + /* attach second fan tachometer */ 6919 + fan_attributes[ARRAY_SIZE(fan_attributes)-2] = 6920 + &dev_attr_fan_fan2_input.attr; 6921 + } 7207 6922 rc = sysfs_create_group(&tpacpi_sensors_pdev->dev.kobj, 7208 6923 &fan_attr_group); 7209 6924 if (rc < 0) ··· 7680 7385 7681 7386 /* Probing */ 7682 7387 7388 + static bool __pure __init tpacpi_is_fw_digit(const char c) 7389 + { 7390 + return (c >= '0' && c <= '9') || (c >= 'A' && c <= 'Z'); 7391 + } 7392 + 7393 + /* Most models: xxyTkkWW (#.##c); Ancient 570/600 and -SL lacks (#.##c) */ 7394 + static bool __pure __init tpacpi_is_valid_fw_id(const char* const s, 7395 + const char t) 7396 + { 7397 + return s && strlen(s) >= 8 && 7398 + tpacpi_is_fw_digit(s[0]) && 7399 + tpacpi_is_fw_digit(s[1]) && 7400 + s[2] == t && s[3] == 'T' && 7401 + tpacpi_is_fw_digit(s[4]) && 7402 + tpacpi_is_fw_digit(s[5]) && 7403 + s[6] == 'W' && s[7] == 'W'; 7404 + } 7405 + 7683 7406 /* returns 0 - probe ok, or < 0 - probe error. 7684 7407 * Probe ok doesn't mean thinkpad found. 7685 7408 * On error, kfree() cleanup on tp->* is not performed, caller must do it */ ··· 7724 7411 tp->bios_version_str = kstrdup(s, GFP_KERNEL); 7725 7412 if (s && !tp->bios_version_str) 7726 7413 return -ENOMEM; 7727 - if (!tp->bios_version_str) 7414 + 7415 + /* Really ancient ThinkPad 240X will fail this, which is fine */ 7416 + if (!tpacpi_is_valid_fw_id(tp->bios_version_str, 'E')) 7728 7417 return 0; 7418 + 7729 7419 tp->bios_model = tp->bios_version_str[0] 7730 7420 | (tp->bios_version_str[1] << 8); 7421 + tp->bios_release = (tp->bios_version_str[4] << 8) 7422 + | tp->bios_version_str[5]; 7731 7423 7732 7424 /* 7733 7425 * ThinkPad T23 or newer, A31 or newer, R50e or newer, ··· 7751 7433 tp->ec_version_str = kstrdup(ec_fw_string, GFP_KERNEL); 7752 7434 if (!tp->ec_version_str) 7753 7435 return -ENOMEM; 7754 - tp->ec_model = ec_fw_string[0] 7755 - | (ec_fw_string[1] << 8); 7436 + 7437 + if (tpacpi_is_valid_fw_id(ec_fw_string, 'H')) { 7438 + tp->ec_model = ec_fw_string[0] 7439 + | (ec_fw_string[1] << 8); 7440 + tp->ec_release = (ec_fw_string[4] << 8) 7441 + | ec_fw_string[5]; 7442 + } else { 7443 + printk(TPACPI_NOTICE 7444 + "ThinkPad firmware release %s " 7445 + "doesn't match the known patterns\n", 7446 + ec_fw_string); 7447 + printk(TPACPI_NOTICE 7448 + "please report this to %s\n", 7449 + TPACPI_MAIL); 7450 + } 7756 7451 break; 7757 7452 } 7758 7453 }
+44 -2
drivers/pnp/pnpacpi/rsparser.c
··· 287 287 ACPI_DECODE_16); 288 288 } 289 289 290 + static void pnpacpi_parse_allocated_ext_address_space(struct pnp_dev *dev, 291 + struct acpi_resource *res) 292 + { 293 + struct acpi_resource_extended_address64 *p = &res->data.ext_address64; 294 + 295 + if (p->producer_consumer == ACPI_PRODUCER) 296 + return; 297 + 298 + if (p->resource_type == ACPI_MEMORY_RANGE) 299 + pnpacpi_parse_allocated_memresource(dev, 300 + p->minimum, p->address_length, 301 + p->info.mem.write_protect); 302 + else if (p->resource_type == ACPI_IO_RANGE) 303 + pnpacpi_parse_allocated_ioresource(dev, 304 + p->minimum, p->address_length, 305 + p->granularity == 0xfff ? ACPI_DECODE_10 : 306 + ACPI_DECODE_16); 307 + } 308 + 290 309 static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res, 291 310 void *data) 292 311 { ··· 419 400 break; 420 401 421 402 case ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64: 422 - if (res->data.ext_address64.producer_consumer == ACPI_PRODUCER) 423 - return AE_OK; 403 + pnpacpi_parse_allocated_ext_address_space(dev, res); 424 404 break; 425 405 426 406 case ACPI_RESOURCE_TYPE_EXTENDED_IRQ: ··· 648 630 IORESOURCE_IO_FIXED); 649 631 } 650 632 633 + static __init void pnpacpi_parse_ext_address_option(struct pnp_dev *dev, 634 + unsigned int option_flags, 635 + struct acpi_resource *r) 636 + { 637 + struct acpi_resource_extended_address64 *p = &r->data.ext_address64; 638 + unsigned char flags = 0; 639 + 640 + if (p->address_length == 0) 641 + return; 642 + 643 + if (p->resource_type == ACPI_MEMORY_RANGE) { 644 + if (p->info.mem.write_protect == ACPI_READ_WRITE_MEMORY) 645 + flags = IORESOURCE_MEM_WRITEABLE; 646 + pnp_register_mem_resource(dev, option_flags, p->minimum, 647 + p->minimum, 0, p->address_length, 648 + flags); 649 + } else if (p->resource_type == ACPI_IO_RANGE) 650 + pnp_register_port_resource(dev, option_flags, p->minimum, 651 + p->minimum, 0, p->address_length, 652 + IORESOURCE_IO_FIXED); 653 + } 654 + 651 655 struct acpipnp_parse_option_s { 652 656 struct pnp_dev *dev; 653 657 unsigned int option_flags; ··· 751 711 break; 752 712 753 713 case ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64: 714 + pnpacpi_parse_ext_address_option(dev, option_flags, res); 754 715 break; 755 716 756 717 case ACPI_RESOURCE_TYPE_EXTENDED_IRQ: ··· 806 765 case ACPI_RESOURCE_TYPE_ADDRESS16: 807 766 case ACPI_RESOURCE_TYPE_ADDRESS32: 808 767 case ACPI_RESOURCE_TYPE_ADDRESS64: 768 + case ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64: 809 769 case ACPI_RESOURCE_TYPE_EXTENDED_IRQ: 810 770 return 1; 811 771 }
+5 -2
include/acpi/acpi_bus.h
··· 114 114 acpi_op_notify notify; 115 115 }; 116 116 117 + #define ACPI_DRIVER_ALL_NOTIFY_EVENTS 0x1 /* system AND device events */ 118 + 117 119 struct acpi_driver { 118 120 char name[80]; 119 121 char class[80]; 120 122 const struct acpi_device_id *ids; /* Supported Hardware IDs */ 123 + unsigned int flags; 121 124 struct acpi_device_ops ops; 122 125 struct device_driver drv; 123 126 struct module *owner; ··· 171 168 172 169 /* Plug and Play */ 173 170 174 - typedef char acpi_bus_id[5]; 171 + typedef char acpi_bus_id[8]; 175 172 typedef unsigned long acpi_bus_address; 176 173 typedef char acpi_hardware_id[15]; 177 174 typedef char acpi_unique_id[9]; ··· 368 365 int register_acpi_bus_type(struct acpi_bus_type *); 369 366 int unregister_acpi_bus_type(struct acpi_bus_type *); 370 367 struct device *acpi_get_physical_device(acpi_handle); 371 - struct device *acpi_get_physical_pci_device(acpi_handle); 372 368 373 369 /* helper */ 374 370 acpi_handle acpi_get_child(acpi_handle, acpi_integer); 371 + int acpi_is_root_bridge(acpi_handle); 375 372 acpi_handle acpi_get_pci_rootbridge_handle(unsigned int, unsigned int); 376 373 #define DEVICE_ACPI_HANDLE(dev) ((acpi_handle)((dev)->archdata.acpi_handle)) 377 374
+5 -8
include/acpi/acpi_drivers.h
··· 57 57 */ 58 58 59 59 #define ACPI_POWER_HID "LNXPOWER" 60 - #define ACPI_PROCESSOR_OBJECT_HID "ACPI_CPU" 61 - #define ACPI_PROCESSOR_HID "ACPI0007" 60 + #define ACPI_PROCESSOR_OBJECT_HID "LNXCPU" 62 61 #define ACPI_SYSTEM_HID "LNXSYSTM" 63 62 #define ACPI_THERMAL_HID "LNXTHERM" 64 63 #define ACPI_BUTTON_HID_POWERF "LNXPWRBN" ··· 90 91 91 92 /* ACPI PCI Interrupt Routing (pci_irq.c) */ 92 93 93 - int acpi_pci_irq_add_prt(acpi_handle handle, int segment, int bus); 94 - void acpi_pci_irq_del_prt(int segment, int bus); 94 + int acpi_pci_irq_add_prt(acpi_handle handle, struct pci_bus *bus); 95 + void acpi_pci_irq_del_prt(struct pci_bus *bus); 95 96 96 97 /* ACPI PCI Device Binding (pci_bind.c) */ 97 98 98 99 struct pci_bus; 99 100 100 - acpi_status acpi_get_pci_id(acpi_handle handle, struct acpi_pci_id *id); 101 - int acpi_pci_bind(struct acpi_device *device); 102 - int acpi_pci_bind_root(struct acpi_device *device, struct acpi_pci_id *id, 103 - struct pci_bus *bus); 101 + struct pci_dev *acpi_get_pci_dev(acpi_handle); 102 + int acpi_pci_bind_root(struct acpi_device *device); 104 103 105 104 /* Arch-defined function to add a bus to the system */ 106 105
+1
include/acpi/processor.h
··· 258 258 extern struct acpi_processor_errata errata; 259 259 260 260 void arch_acpi_processor_init_pdc(struct acpi_processor *pr); 261 + void arch_acpi_processor_cleanup_pdc(struct acpi_processor *pr); 261 262 262 263 #ifdef ARCH_HAS_POWER_INIT 263 264 void acpi_processor_power_init_bm_check(struct acpi_processor_flags *flags,
+2 -2
include/acpi/video.h
··· 3 3 4 4 #if (defined CONFIG_ACPI_VIDEO || defined CONFIG_ACPI_VIDEO_MODULE) 5 5 extern int acpi_video_register(void); 6 - extern int acpi_video_exit(void); 6 + extern void acpi_video_unregister(void); 7 7 #else 8 8 static inline int acpi_video_register(void) { return 0; } 9 - static inline void acpi_video_exit(void) { return; } 9 + static inline void acpi_video_unregister(void) { return; } 10 10 #endif 11 11 12 12 #endif
+3 -3
include/linux/acpi.h
··· 113 113 extern u32 acpi_irq_handled; 114 114 extern u32 acpi_irq_not_handled; 115 115 116 - extern struct acpi_mcfg_allocation *pci_mmcfg_config; 117 - extern int pci_mmcfg_config_num; 118 - 119 116 extern int sbf_port; 120 117 extern unsigned long acpi_realmode_flags; 121 118 ··· 290 293 OSC_PCI_EXPRESS_CAP_STRUCTURE_CONTROL) 291 294 292 295 extern acpi_status acpi_pci_osc_control_set(acpi_handle handle, u32 flags); 296 + extern void acpi_early_init(void); 297 + 293 298 #else /* CONFIG_ACPI */ 299 + static inline void acpi_early_init(void) { } 294 300 295 301 static inline int early_acpi_boot_init(void) 296 302 {
-1
include/linux/pci_hotplug.h
··· 229 229 extern acpi_status acpi_get_hp_params_from_firmware(struct pci_bus *bus, 230 230 struct hotplug_params *hpp); 231 231 int acpi_get_hp_hw_control_from_firmware(struct pci_dev *dev, u32 flags); 232 - int acpi_root_bridge(acpi_handle handle); 233 232 int acpi_pci_check_ejectable(struct pci_bus *pbus, acpi_handle handle); 234 233 int acpi_pci_detect_ejectable(struct pci_bus *pbus); 235 234 #endif
+1 -5
init/main.c
··· 24 24 #include <linux/smp_lock.h> 25 25 #include <linux/initrd.h> 26 26 #include <linux/bootmem.h> 27 + #include <linux/acpi.h> 27 28 #include <linux/tty.h> 28 29 #include <linux/gfp.h> 29 30 #include <linux/percpu.h> ··· 89 88 extern void prio_tree_init(void); 90 89 extern void radix_tree_init(void); 91 90 extern void free_initmem(void); 92 - #ifdef CONFIG_ACPI 93 - extern void acpi_early_init(void); 94 - #else 95 - static inline void acpi_early_init(void) { } 96 - #endif 97 91 #ifndef CONFIG_DEBUG_RODATA 98 92 static inline void mark_rodata_ro(void) { } 99 93 #endif