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 tag 'pm+acpi-3.16-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm

Pull ACPI and power management fixes from Rafael Wysocki:
"These are a few regression fixes for ACPI device enumeration and
resources management, intel_pstate and cpufreq, a revert of an ACPI
commit removing user space interfaces in /proc that we incorrectly
thought were not used any more, fixes for some long-standing
concurrency issues in the ACPI EC driver, two ACPI battery driver
fixes, stable-candidate fixes for intel_pstate, an ACPI-related fix
for i915 and two new ACPI video blacklist entries for Win8-oriented
BIOSes.

Specifics:

- Missing device ID for ACPI enumeration of PNP devices that we
overlooked during the recent rework of that code from Zhang Rui.

- Fix for a problem introduced during the 3.14 cycle in the ACPI
device resources management code and causing it to reject all
resources of length 0 although some of them are actually valid
which affects serial ports detection on a number of systems. From
Andy Whitcroft.

- intel_pstate fix for a boot problem on some BayTrail-based systems
introduced by a previous fix related to that platform during the
3.13 cycle from Dirk Brandewie.

- Revert of a 3.13 commit that removed the ACPI AC /proc interface
which turns out to be still needed by some old utilities
(kpowersave from kde 3.5.10 in particular) from Lan Tianyu.

- cpufreq build fix for the davinci ARM platform from Prabhakar Lad
(the breakage was introduced during the 3.10 cycle).

- ACPI-related i915 fix preventing firmware on some Thinkpad laptops
from setting backlight levels incorrectly during AC plug/unplug.
From Aaron Lu.

- Fixes for two nasty race conditions in the ACPI embedded controller
driver that may be responsible for a number of past bug reports
related to the EC from Lv Zhang and a fix for two memory leaks in
error code paths in that driver from Colin Ian King.

- Fixes for a couple of corner-case issues in the intel_pstate driver
(all candidates for -stable) from Dirk Brandewie and Vincent Minet.

- Fixes for two corner-case issues in the ACPI battery driver from
Josef Gajdusek and Lan Tianyu.

- Two new ACPI video blacklist entries for Acer TravelMate B113 and
Dell Inspiron 5737 from Edward Lin and Martin Kepplinger"

* tag 'pm+acpi-3.16-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
ACPI / PNP: add soc_button_array device ID to PNP IDs list
cpufreq: Makefile: fix compilation for davinci platform
ACPI / video: Add Acer TravelMate B113 to native backlight blacklist
ACPI / video: Add Dell Inspiron 5737 to the blacklist
ACPI / i915: ignore firmware requests for backlight change
ACPI / battery: fix wrong value of capacity_now reported when fully charged
ACPI / resources: only reject zero length resources based at address zero
ACPI / battery: Retry to get battery information if failed during probing
ACPI / EC: Free saved_ec on error exit path
ACPI / EC: Add detailed fields debugging support of EC_SC(R).
ACPI / EC: Update revision due to recent changes
ACPI / EC: Fix race condition in ec_transaction_completed()
ACPI / EC: Remove duplicated ec_wait_ibf0() waiter
ACPI / EC: Add asynchronous command byte write support
ACPI / EC: Avoid race condition related to advance_transaction()
intel_pstate: Set CPU number before accessing MSRs
intel_pstate: Update documentation of {max,min}_perf_pct sysfs files
intel_pstate: don't touch turbo bit if turbo disabled or unavailable.
intel_pstate: Fix setting VID
Revert "ACPI / AC: Remove AC's proc directory."

+318 -105
+5 -2
Documentation/cpu-freq/intel-pstate.txt
··· 15 15 /sys/devices/system/cpu/intel_pstate/ 16 16 17 17 max_perf_pct: limits the maximum P state that will be requested by 18 - the driver stated as a percentage of the available performance. 18 + the driver stated as a percentage of the available performance. The 19 + available (P states) performance may be reduced by the no_turbo 20 + setting described below. 19 21 20 22 min_perf_pct: limits the minimum P state that will be requested by 21 - the driver stated as a percentage of the available performance. 23 + the driver stated as a percentage of the max (non-turbo) 24 + performance level. 22 25 23 26 no_turbo: limits the driver to selecting P states below the turbo 24 27 frequency range.
+129 -3
drivers/acpi/ac.c
··· 30 30 #include <linux/types.h> 31 31 #include <linux/dmi.h> 32 32 #include <linux/delay.h> 33 + #ifdef CONFIG_ACPI_PROCFS_POWER 34 + #include <linux/proc_fs.h> 35 + #include <linux/seq_file.h> 36 + #endif 33 37 #include <linux/platform_device.h> 34 38 #include <linux/power_supply.h> 35 39 #include <linux/acpi.h> ··· 56 52 MODULE_DESCRIPTION("ACPI AC Adapter Driver"); 57 53 MODULE_LICENSE("GPL"); 58 54 55 + 59 56 static int acpi_ac_add(struct acpi_device *device); 60 57 static int acpi_ac_remove(struct acpi_device *device); 61 58 static void acpi_ac_notify(struct acpi_device *device, u32 event); ··· 71 66 static int acpi_ac_resume(struct device *dev); 72 67 #endif 73 68 static SIMPLE_DEV_PM_OPS(acpi_ac_pm, NULL, acpi_ac_resume); 69 + 70 + #ifdef CONFIG_ACPI_PROCFS_POWER 71 + extern struct proc_dir_entry *acpi_lock_ac_dir(void); 72 + extern void *acpi_unlock_ac_dir(struct proc_dir_entry *acpi_ac_dir); 73 + static int acpi_ac_open_fs(struct inode *inode, struct file *file); 74 + #endif 75 + 74 76 75 77 static int ac_sleep_before_get_state_ms; 76 78 ··· 102 90 }; 103 91 104 92 #define to_acpi_ac(x) container_of(x, struct acpi_ac, charger) 93 + 94 + #ifdef CONFIG_ACPI_PROCFS_POWER 95 + static const struct file_operations acpi_ac_fops = { 96 + .owner = THIS_MODULE, 97 + .open = acpi_ac_open_fs, 98 + .read = seq_read, 99 + .llseek = seq_lseek, 100 + .release = single_release, 101 + }; 102 + #endif 105 103 106 104 /* -------------------------------------------------------------------------- 107 105 AC Adapter Management ··· 164 142 static enum power_supply_property ac_props[] = { 165 143 POWER_SUPPLY_PROP_ONLINE, 166 144 }; 145 + 146 + #ifdef CONFIG_ACPI_PROCFS_POWER 147 + /* -------------------------------------------------------------------------- 148 + FS Interface (/proc) 149 + -------------------------------------------------------------------------- */ 150 + 151 + static struct proc_dir_entry *acpi_ac_dir; 152 + 153 + static int acpi_ac_seq_show(struct seq_file *seq, void *offset) 154 + { 155 + struct acpi_ac *ac = seq->private; 156 + 157 + 158 + if (!ac) 159 + return 0; 160 + 161 + if (acpi_ac_get_state(ac)) { 162 + seq_puts(seq, "ERROR: Unable to read AC Adapter state\n"); 163 + return 0; 164 + } 165 + 166 + seq_puts(seq, "state: "); 167 + switch (ac->state) { 168 + case ACPI_AC_STATUS_OFFLINE: 169 + seq_puts(seq, "off-line\n"); 170 + break; 171 + case ACPI_AC_STATUS_ONLINE: 172 + seq_puts(seq, "on-line\n"); 173 + break; 174 + default: 175 + seq_puts(seq, "unknown\n"); 176 + break; 177 + } 178 + 179 + return 0; 180 + } 181 + 182 + static int acpi_ac_open_fs(struct inode *inode, struct file *file) 183 + { 184 + return single_open(file, acpi_ac_seq_show, PDE_DATA(inode)); 185 + } 186 + 187 + static int acpi_ac_add_fs(struct acpi_ac *ac) 188 + { 189 + struct proc_dir_entry *entry = NULL; 190 + 191 + printk(KERN_WARNING PREFIX "Deprecated procfs I/F for AC is loaded," 192 + " please retry with CONFIG_ACPI_PROCFS_POWER cleared\n"); 193 + if (!acpi_device_dir(ac->device)) { 194 + acpi_device_dir(ac->device) = 195 + proc_mkdir(acpi_device_bid(ac->device), acpi_ac_dir); 196 + if (!acpi_device_dir(ac->device)) 197 + return -ENODEV; 198 + } 199 + 200 + /* 'state' [R] */ 201 + entry = proc_create_data(ACPI_AC_FILE_STATE, 202 + S_IRUGO, acpi_device_dir(ac->device), 203 + &acpi_ac_fops, ac); 204 + if (!entry) 205 + return -ENODEV; 206 + return 0; 207 + } 208 + 209 + static int acpi_ac_remove_fs(struct acpi_ac *ac) 210 + { 211 + 212 + if (acpi_device_dir(ac->device)) { 213 + remove_proc_entry(ACPI_AC_FILE_STATE, 214 + acpi_device_dir(ac->device)); 215 + remove_proc_entry(acpi_device_bid(ac->device), acpi_ac_dir); 216 + acpi_device_dir(ac->device) = NULL; 217 + } 218 + 219 + return 0; 220 + } 221 + #endif 167 222 168 223 /* -------------------------------------------------------------------------- 169 224 Driver Model ··· 342 243 goto end; 343 244 344 245 ac->charger.name = acpi_device_bid(device); 246 + #ifdef CONFIG_ACPI_PROCFS_POWER 247 + result = acpi_ac_add_fs(ac); 248 + if (result) 249 + goto end; 250 + #endif 345 251 ac->charger.type = POWER_SUPPLY_TYPE_MAINS; 346 252 ac->charger.properties = ac_props; 347 253 ac->charger.num_properties = ARRAY_SIZE(ac_props); ··· 362 258 ac->battery_nb.notifier_call = acpi_ac_battery_notify; 363 259 register_acpi_notifier(&ac->battery_nb); 364 260 end: 365 - if (result) 261 + if (result) { 262 + #ifdef CONFIG_ACPI_PROCFS_POWER 263 + acpi_ac_remove_fs(ac); 264 + #endif 366 265 kfree(ac); 266 + } 367 267 368 268 dmi_check_system(ac_dmi_table); 369 269 return result; ··· 411 303 power_supply_unregister(&ac->charger); 412 304 unregister_acpi_notifier(&ac->battery_nb); 413 305 306 + #ifdef CONFIG_ACPI_PROCFS_POWER 307 + acpi_ac_remove_fs(ac); 308 + #endif 309 + 414 310 kfree(ac); 415 311 416 312 return 0; ··· 427 315 if (acpi_disabled) 428 316 return -ENODEV; 429 317 430 - result = acpi_bus_register_driver(&acpi_ac_driver); 431 - if (result < 0) 318 + #ifdef CONFIG_ACPI_PROCFS_POWER 319 + acpi_ac_dir = acpi_lock_ac_dir(); 320 + if (!acpi_ac_dir) 432 321 return -ENODEV; 322 + #endif 323 + 324 + 325 + result = acpi_bus_register_driver(&acpi_ac_driver); 326 + if (result < 0) { 327 + #ifdef CONFIG_ACPI_PROCFS_POWER 328 + acpi_unlock_ac_dir(acpi_ac_dir); 329 + #endif 330 + return -ENODEV; 331 + } 433 332 434 333 return 0; 435 334 } ··· 448 325 static void __exit acpi_ac_exit(void) 449 326 { 450 327 acpi_bus_unregister_driver(&acpi_ac_driver); 328 + #ifdef CONFIG_ACPI_PROCFS_POWER 329 + acpi_unlock_ac_dir(acpi_ac_dir); 330 + #endif 451 331 } 452 332 module_init(acpi_ac_init); 453 333 module_exit(acpi_ac_exit);
+2
drivers/acpi/acpi_pnp.c
··· 14 14 #include <linux/module.h> 15 15 16 16 static const struct acpi_device_id acpi_pnp_device_ids[] = { 17 + /* soc_button_array */ 18 + {"PNP0C40"}, 17 19 /* pata_isapnp */ 18 20 {"PNP0600"}, /* Generic ESDI/IDE/ATA compatible hard disk controller */ 19 21 /* floppy */
+40 -1
drivers/acpi/battery.c
··· 35 35 #include <linux/delay.h> 36 36 #include <linux/slab.h> 37 37 #include <linux/suspend.h> 38 + #include <linux/delay.h> 38 39 #include <asm/unaligned.h> 39 40 40 41 #ifdef CONFIG_ACPI_PROCFS_POWER ··· 533 532 battery->rate_now = abs((s16)battery->rate_now); 534 533 printk_once(KERN_WARNING FW_BUG "battery: (dis)charge rate" 535 534 " invalid.\n"); 535 + } 536 + 537 + /* 538 + * When fully charged, some batteries wrongly report 539 + * capacity_now = design_capacity instead of = full_charge_capacity 540 + */ 541 + if (battery->capacity_now > battery->full_charge_capacity 542 + && battery->full_charge_capacity != ACPI_BATTERY_VALUE_UNKNOWN) { 543 + battery->capacity_now = battery->full_charge_capacity; 544 + if (battery->capacity_now != battery->design_capacity) 545 + printk_once(KERN_WARNING FW_BUG 546 + "battery: reported current charge level (%d) " 547 + "is higher than reported maximum charge level (%d).\n", 548 + battery->capacity_now, battery->full_charge_capacity); 536 549 } 537 550 538 551 if (test_bit(ACPI_BATTERY_QUIRK_PERCENTAGE_CAPACITY, &battery->flags) ··· 1166 1151 {}, 1167 1152 }; 1168 1153 1154 + /* 1155 + * Some machines'(E,G Lenovo Z480) ECs are not stable 1156 + * during boot up and this causes battery driver fails to be 1157 + * probed due to failure of getting battery information 1158 + * from EC sometimes. After several retries, the operation 1159 + * may work. So add retry code here and 20ms sleep between 1160 + * every retries. 1161 + */ 1162 + static int acpi_battery_update_retry(struct acpi_battery *battery) 1163 + { 1164 + int retry, ret; 1165 + 1166 + for (retry = 5; retry; retry--) { 1167 + ret = acpi_battery_update(battery, false); 1168 + if (!ret) 1169 + break; 1170 + 1171 + msleep(20); 1172 + } 1173 + return ret; 1174 + } 1175 + 1169 1176 static int acpi_battery_add(struct acpi_device *device) 1170 1177 { 1171 1178 int result = 0; ··· 1206 1169 mutex_init(&battery->sysfs_lock); 1207 1170 if (acpi_has_method(battery->device->handle, "_BIX")) 1208 1171 set_bit(ACPI_BATTERY_XINFO_PRESENT, &battery->flags); 1209 - result = acpi_battery_update(battery, false); 1172 + 1173 + result = acpi_battery_update_retry(battery); 1210 1174 if (result) 1211 1175 goto fail; 1176 + 1212 1177 #ifdef CONFIG_ACPI_PROCFS_POWER 1213 1178 result = acpi_battery_add_fs(device); 1214 1179 #endif
+85 -79
drivers/acpi/ec.c
··· 1 1 /* 2 - * ec.c - ACPI Embedded Controller Driver (v2.1) 2 + * ec.c - ACPI Embedded Controller Driver (v2.2) 3 3 * 4 - * Copyright (C) 2006-2008 Alexey Starikovskiy <astarikovskiy@suse.de> 5 - * Copyright (C) 2006 Denis Sadykov <denis.m.sadykov@intel.com> 6 - * Copyright (C) 2004 Luming Yu <luming.yu@intel.com> 7 - * Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com> 8 - * Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com> 4 + * Copyright (C) 2001-2014 Intel Corporation 5 + * Author: 2014 Lv Zheng <lv.zheng@intel.com> 6 + * 2006, 2007 Alexey Starikovskiy <alexey.y.starikovskiy@intel.com> 7 + * 2006 Denis Sadykov <denis.m.sadykov@intel.com> 8 + * 2004 Luming Yu <luming.yu@intel.com> 9 + * 2001, 2002 Andy Grover <andrew.grover@intel.com> 10 + * 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com> 11 + * Copyright (C) 2008 Alexey Starikovskiy <astarikovskiy@suse.de> 9 12 * 10 13 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 11 14 * ··· 55 52 /* EC status register */ 56 53 #define ACPI_EC_FLAG_OBF 0x01 /* Output buffer full */ 57 54 #define ACPI_EC_FLAG_IBF 0x02 /* Input buffer full */ 55 + #define ACPI_EC_FLAG_CMD 0x08 /* Input buffer contains a command */ 58 56 #define ACPI_EC_FLAG_BURST 0x10 /* burst mode */ 59 57 #define ACPI_EC_FLAG_SCI 0x20 /* EC-SCI occurred */ 60 58 ··· 81 77 * OpReg are installed */ 82 78 EC_FLAGS_BLOCKED, /* Transactions are blocked */ 83 79 }; 80 + 81 + #define ACPI_EC_COMMAND_POLL 0x01 /* Available for command byte */ 82 + #define ACPI_EC_COMMAND_COMPLETE 0x02 /* Completed last byte */ 84 83 85 84 /* ec.c is compiled in acpi namespace so this shows up as acpi.ec_delay param */ 86 85 static unsigned int ec_delay __read_mostly = ACPI_EC_DELAY; ··· 116 109 u8 ri; 117 110 u8 wlen; 118 111 u8 rlen; 119 - bool done; 112 + u8 flags; 120 113 }; 121 114 122 115 struct acpi_ec *boot_ec, *first_ec; ··· 134 127 static inline u8 acpi_ec_read_status(struct acpi_ec *ec) 135 128 { 136 129 u8 x = inb(ec->command_addr); 137 - pr_debug("---> status = 0x%2.2x\n", x); 130 + pr_debug("EC_SC(R) = 0x%2.2x " 131 + "SCI_EVT=%d BURST=%d CMD=%d IBF=%d OBF=%d\n", 132 + x, 133 + !!(x & ACPI_EC_FLAG_SCI), 134 + !!(x & ACPI_EC_FLAG_BURST), 135 + !!(x & ACPI_EC_FLAG_CMD), 136 + !!(x & ACPI_EC_FLAG_IBF), 137 + !!(x & ACPI_EC_FLAG_OBF)); 138 138 return x; 139 139 } 140 140 141 141 static inline u8 acpi_ec_read_data(struct acpi_ec *ec) 142 142 { 143 143 u8 x = inb(ec->data_addr); 144 - pr_debug("---> data = 0x%2.2x\n", x); 144 + pr_debug("EC_DATA(R) = 0x%2.2x\n", x); 145 145 return x; 146 146 } 147 147 148 148 static inline void acpi_ec_write_cmd(struct acpi_ec *ec, u8 command) 149 149 { 150 - pr_debug("<--- command = 0x%2.2x\n", command); 150 + pr_debug("EC_SC(W) = 0x%2.2x\n", command); 151 151 outb(command, ec->command_addr); 152 152 } 153 153 154 154 static inline void acpi_ec_write_data(struct acpi_ec *ec, u8 data) 155 155 { 156 - pr_debug("<--- data = 0x%2.2x\n", data); 156 + pr_debug("EC_DATA(W) = 0x%2.2x\n", data); 157 157 outb(data, ec->data_addr); 158 158 } 159 159 160 - static int ec_transaction_done(struct acpi_ec *ec) 160 + static int ec_transaction_completed(struct acpi_ec *ec) 161 161 { 162 162 unsigned long flags; 163 163 int ret = 0; 164 164 spin_lock_irqsave(&ec->lock, flags); 165 - if (!ec->curr || ec->curr->done) 165 + if (ec->curr && (ec->curr->flags & ACPI_EC_COMMAND_COMPLETE)) 166 166 ret = 1; 167 167 spin_unlock_irqrestore(&ec->lock, flags); 168 168 return ret; 169 169 } 170 170 171 - static void start_transaction(struct acpi_ec *ec) 171 + static bool advance_transaction(struct acpi_ec *ec) 172 172 { 173 - ec->curr->irq_count = ec->curr->wi = ec->curr->ri = 0; 174 - ec->curr->done = false; 175 - acpi_ec_write_cmd(ec, ec->curr->command); 176 - } 177 - 178 - static void advance_transaction(struct acpi_ec *ec, u8 status) 179 - { 180 - unsigned long flags; 181 173 struct transaction *t; 174 + u8 status; 175 + bool wakeup = false; 182 176 183 - spin_lock_irqsave(&ec->lock, flags); 177 + pr_debug("===== %s =====\n", in_interrupt() ? "IRQ" : "TASK"); 178 + status = acpi_ec_read_status(ec); 184 179 t = ec->curr; 185 180 if (!t) 186 - goto unlock; 187 - if (t->wlen > t->wi) { 188 - if ((status & ACPI_EC_FLAG_IBF) == 0) 189 - acpi_ec_write_data(ec, 190 - t->wdata[t->wi++]); 191 - else 192 - goto err; 193 - } else if (t->rlen > t->ri) { 194 - if ((status & ACPI_EC_FLAG_OBF) == 1) { 195 - t->rdata[t->ri++] = acpi_ec_read_data(ec); 196 - if (t->rlen == t->ri) 197 - t->done = true; 181 + goto err; 182 + if (t->flags & ACPI_EC_COMMAND_POLL) { 183 + if (t->wlen > t->wi) { 184 + if ((status & ACPI_EC_FLAG_IBF) == 0) 185 + acpi_ec_write_data(ec, t->wdata[t->wi++]); 186 + else 187 + goto err; 188 + } else if (t->rlen > t->ri) { 189 + if ((status & ACPI_EC_FLAG_OBF) == 1) { 190 + t->rdata[t->ri++] = acpi_ec_read_data(ec); 191 + if (t->rlen == t->ri) { 192 + t->flags |= ACPI_EC_COMMAND_COMPLETE; 193 + wakeup = true; 194 + } 195 + } else 196 + goto err; 197 + } else if (t->wlen == t->wi && 198 + (status & ACPI_EC_FLAG_IBF) == 0) { 199 + t->flags |= ACPI_EC_COMMAND_COMPLETE; 200 + wakeup = true; 201 + } 202 + return wakeup; 203 + } else { 204 + if ((status & ACPI_EC_FLAG_IBF) == 0) { 205 + acpi_ec_write_cmd(ec, t->command); 206 + t->flags |= ACPI_EC_COMMAND_POLL; 198 207 } else 199 208 goto err; 200 - } else if (t->wlen == t->wi && 201 - (status & ACPI_EC_FLAG_IBF) == 0) 202 - t->done = true; 203 - goto unlock; 209 + return wakeup; 210 + } 204 211 err: 205 212 /* 206 213 * If SCI bit is set, then don't think it's a false IRQ 207 214 * otherwise will take a not handled IRQ as a false one. 208 215 */ 209 - if (in_interrupt() && !(status & ACPI_EC_FLAG_SCI)) 210 - ++t->irq_count; 216 + if (!(status & ACPI_EC_FLAG_SCI)) { 217 + if (in_interrupt() && t) 218 + ++t->irq_count; 219 + } 220 + return wakeup; 221 + } 211 222 212 - unlock: 213 - spin_unlock_irqrestore(&ec->lock, flags); 223 + static void start_transaction(struct acpi_ec *ec) 224 + { 225 + ec->curr->irq_count = ec->curr->wi = ec->curr->ri = 0; 226 + ec->curr->flags = 0; 227 + (void)advance_transaction(ec); 214 228 } 215 229 216 230 static int acpi_ec_sync_query(struct acpi_ec *ec, u8 *data); ··· 256 228 /* don't sleep with disabled interrupts */ 257 229 if (EC_FLAGS_MSI || irqs_disabled()) { 258 230 udelay(ACPI_EC_MSI_UDELAY); 259 - if (ec_transaction_done(ec)) 231 + if (ec_transaction_completed(ec)) 260 232 return 0; 261 233 } else { 262 234 if (wait_event_timeout(ec->wait, 263 - ec_transaction_done(ec), 235 + ec_transaction_completed(ec), 264 236 msecs_to_jiffies(1))) 265 237 return 0; 266 238 } 267 - advance_transaction(ec, acpi_ec_read_status(ec)); 239 + spin_lock_irqsave(&ec->lock, flags); 240 + (void)advance_transaction(ec); 241 + spin_unlock_irqrestore(&ec->lock, flags); 268 242 } while (time_before(jiffies, delay)); 269 243 pr_debug("controller reset, restart transaction\n"); 270 244 spin_lock_irqsave(&ec->lock, flags); ··· 298 268 return ret; 299 269 } 300 270 301 - static int ec_check_ibf0(struct acpi_ec *ec) 302 - { 303 - u8 status = acpi_ec_read_status(ec); 304 - return (status & ACPI_EC_FLAG_IBF) == 0; 305 - } 306 - 307 - static int ec_wait_ibf0(struct acpi_ec *ec) 308 - { 309 - unsigned long delay = jiffies + msecs_to_jiffies(ec_delay); 310 - /* interrupt wait manually if GPE mode is not active */ 311 - while (time_before(jiffies, delay)) 312 - if (wait_event_timeout(ec->wait, ec_check_ibf0(ec), 313 - msecs_to_jiffies(1))) 314 - return 0; 315 - return -ETIME; 316 - } 317 - 318 271 static int acpi_ec_transaction(struct acpi_ec *ec, struct transaction *t) 319 272 { 320 273 int status; ··· 317 304 status = -ENODEV; 318 305 goto unlock; 319 306 } 320 - } 321 - if (ec_wait_ibf0(ec)) { 322 - pr_err("input buffer is not empty, " 323 - "aborting transaction\n"); 324 - status = -ETIME; 325 - goto end; 326 307 } 327 308 pr_debug("transaction start (cmd=0x%02x, addr=0x%02x)\n", 328 309 t->command, t->wdata ? t->wdata[0] : 0); ··· 341 334 set_bit(EC_FLAGS_GPE_STORM, &ec->flags); 342 335 } 343 336 pr_debug("transaction end\n"); 344 - end: 345 337 if (ec->global_lock) 346 338 acpi_release_global_lock(glk); 347 339 unlock: ··· 640 634 static u32 acpi_ec_gpe_handler(acpi_handle gpe_device, 641 635 u32 gpe_number, void *data) 642 636 { 637 + unsigned long flags; 643 638 struct acpi_ec *ec = data; 644 - u8 status = acpi_ec_read_status(ec); 645 639 646 - pr_debug("~~~> interrupt, status:0x%02x\n", status); 647 - 648 - advance_transaction(ec, status); 649 - if (ec_transaction_done(ec) && 650 - (acpi_ec_read_status(ec) & ACPI_EC_FLAG_IBF) == 0) { 640 + spin_lock_irqsave(&ec->lock, flags); 641 + if (advance_transaction(ec)) 651 642 wake_up(&ec->wait); 652 - ec_check_sci(ec, acpi_ec_read_status(ec)); 653 - } 643 + spin_unlock_irqrestore(&ec->lock, flags); 644 + ec_check_sci(ec, acpi_ec_read_status(ec)); 654 645 return ACPI_INTERRUPT_HANDLED | ACPI_REENABLE_GPE; 655 646 } 656 647 ··· 1069 1066 /* fall through */ 1070 1067 } 1071 1068 1072 - if (EC_FLAGS_SKIP_DSDT_SCAN) 1069 + if (EC_FLAGS_SKIP_DSDT_SCAN) { 1070 + kfree(saved_ec); 1073 1071 return -ENODEV; 1072 + } 1074 1073 1075 1074 /* This workaround is needed only on some broken machines, 1076 1075 * which require early EC, but fail to provide ECDT */ ··· 1110 1105 } 1111 1106 error: 1112 1107 kfree(boot_ec); 1108 + kfree(saved_ec); 1113 1109 boot_ec = NULL; 1114 1110 return -ENODEV; 1115 1111 }
+5 -5
drivers/acpi/resource.c
··· 77 77 switch (ares->type) { 78 78 case ACPI_RESOURCE_TYPE_MEMORY24: 79 79 memory24 = &ares->data.memory24; 80 - if (!memory24->address_length) 80 + if (!memory24->minimum && !memory24->address_length) 81 81 return false; 82 82 acpi_dev_get_memresource(res, memory24->minimum, 83 83 memory24->address_length, ··· 85 85 break; 86 86 case ACPI_RESOURCE_TYPE_MEMORY32: 87 87 memory32 = &ares->data.memory32; 88 - if (!memory32->address_length) 88 + if (!memory32->minimum && !memory32->address_length) 89 89 return false; 90 90 acpi_dev_get_memresource(res, memory32->minimum, 91 91 memory32->address_length, ··· 93 93 break; 94 94 case ACPI_RESOURCE_TYPE_FIXED_MEMORY32: 95 95 fixed_memory32 = &ares->data.fixed_memory32; 96 - if (!fixed_memory32->address_length) 96 + if (!fixed_memory32->address && !fixed_memory32->address_length) 97 97 return false; 98 98 acpi_dev_get_memresource(res, fixed_memory32->address, 99 99 fixed_memory32->address_length, ··· 150 150 switch (ares->type) { 151 151 case ACPI_RESOURCE_TYPE_IO: 152 152 io = &ares->data.io; 153 - if (!io->address_length) 153 + if (!io->minimum && !io->address_length) 154 154 return false; 155 155 acpi_dev_get_ioresource(res, io->minimum, 156 156 io->address_length, ··· 158 158 break; 159 159 case ACPI_RESOURCE_TYPE_FIXED_IO: 160 160 fixed_io = &ares->data.fixed_io; 161 - if (!fixed_io->address_length) 161 + if (!fixed_io->address && !fixed_io->address_length) 162 162 return false; 163 163 acpi_dev_get_ioresource(res, fixed_io->address, 164 164 fixed_io->address_length,
+10 -1
drivers/acpi/video.c
··· 241 241 return use_native_backlight_dmi; 242 242 } 243 243 244 - static bool acpi_video_verify_backlight_support(void) 244 + bool acpi_video_verify_backlight_support(void) 245 245 { 246 246 if (acpi_osi_is_win8() && acpi_video_use_native_backlight() && 247 247 backlight_device_registered(BACKLIGHT_RAW)) 248 248 return false; 249 249 return acpi_video_backlight_support(); 250 250 } 251 + EXPORT_SYMBOL_GPL(acpi_video_verify_backlight_support); 251 252 252 253 /* backlight device sysfs support */ 253 254 static int acpi_video_get_brightness(struct backlight_device *bd) ··· 561 560 .matches = { 562 561 DMI_MATCH(DMI_BOARD_VENDOR, "Acer"), 563 562 DMI_MATCH(DMI_PRODUCT_NAME, "Aspire V5-471G"), 563 + }, 564 + }, 565 + { 566 + .callback = video_set_use_native_backlight, 567 + .ident = "Acer TravelMate B113", 568 + .matches = { 569 + DMI_MATCH(DMI_SYS_VENDOR, "Acer"), 570 + DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate B113"), 564 571 }, 565 572 }, 566 573 {
+8
drivers/acpi/video_detect.c
··· 166 166 DMI_MATCH(DMI_PRODUCT_NAME, "UL30A"), 167 167 }, 168 168 }, 169 + { 170 + .callback = video_detect_force_vendor, 171 + .ident = "Dell Inspiron 5737", 172 + .matches = { 173 + DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), 174 + DMI_MATCH(DMI_PRODUCT_NAME, "Inspiron 5737"), 175 + }, 176 + }, 169 177 { }, 170 178 }; 171 179
+1 -1
drivers/cpufreq/Makefile
··· 49 49 # LITTLE drivers, so that it is probed last. 50 50 obj-$(CONFIG_ARM_DT_BL_CPUFREQ) += arm_big_little_dt.o 51 51 52 - obj-$(CONFIG_ARCH_DAVINCI_DA850) += davinci-cpufreq.o 52 + obj-$(CONFIG_ARCH_DAVINCI) += davinci-cpufreq.o 53 53 obj-$(CONFIG_UX500_SOC_DB8500) += dbx500-cpufreq.o 54 54 obj-$(CONFIG_ARM_EXYNOS_CPUFREQ) += exynos-cpufreq.o 55 55 obj-$(CONFIG_ARM_EXYNOS4210_CPUFREQ) += exynos4210-cpufreq.o
+22 -13
drivers/cpufreq/intel_pstate.c
··· 128 128 129 129 struct perf_limits { 130 130 int no_turbo; 131 + int turbo_disabled; 131 132 int max_perf_pct; 132 133 int min_perf_pct; 133 134 int32_t max_perf; ··· 288 287 if (ret != 1) 289 288 return -EINVAL; 290 289 limits.no_turbo = clamp_t(int, input, 0 , 1); 291 - 290 + if (limits.turbo_disabled) { 291 + pr_warn("Turbo disabled by BIOS or unavailable on processor\n"); 292 + limits.no_turbo = limits.turbo_disabled; 293 + } 292 294 return count; 293 295 } 294 296 ··· 361 357 { 362 358 u64 value; 363 359 rdmsrl(BYT_RATIOS, value); 364 - return (value >> 8) & 0x3F; 360 + return (value >> 8) & 0x7F; 365 361 } 366 362 367 363 static int byt_get_max_pstate(void) 368 364 { 369 365 u64 value; 370 366 rdmsrl(BYT_RATIOS, value); 371 - return (value >> 16) & 0x3F; 367 + return (value >> 16) & 0x7F; 372 368 } 373 369 374 370 static int byt_get_turbo_pstate(void) 375 371 { 376 372 u64 value; 377 373 rdmsrl(BYT_TURBO_RATIOS, value); 378 - return value & 0x3F; 374 + return value & 0x7F; 379 375 } 380 376 381 377 static void byt_set_pstate(struct cpudata *cpudata, int pstate) ··· 385 381 u32 vid; 386 382 387 383 val = pstate << 8; 388 - if (limits.no_turbo) 384 + if (limits.no_turbo && !limits.turbo_disabled) 389 385 val |= (u64)1 << 32; 390 386 391 387 vid_fp = cpudata->vid.min + mul_fp( ··· 409 405 410 406 411 407 rdmsrl(BYT_VIDS, value); 412 - cpudata->vid.min = int_tofp((value >> 8) & 0x3f); 413 - cpudata->vid.max = int_tofp((value >> 16) & 0x3f); 408 + cpudata->vid.min = int_tofp((value >> 8) & 0x7f); 409 + cpudata->vid.max = int_tofp((value >> 16) & 0x7f); 414 410 cpudata->vid.ratio = div_fp( 415 411 cpudata->vid.max - cpudata->vid.min, 416 412 int_tofp(cpudata->pstate.max_pstate - ··· 452 448 u64 val; 453 449 454 450 val = pstate << 8; 455 - if (limits.no_turbo) 451 + if (limits.no_turbo && !limits.turbo_disabled) 456 452 val |= (u64)1 << 32; 457 453 458 454 wrmsrl_on_cpu(cpudata->cpu, MSR_IA32_PERF_CTL, val); ··· 700 696 701 697 cpu = all_cpu_data[cpunum]; 702 698 703 - intel_pstate_get_cpu_pstates(cpu); 704 - 705 699 cpu->cpu = cpunum; 700 + intel_pstate_get_cpu_pstates(cpu); 706 701 707 702 init_timer_deferrable(&cpu->timer); 708 703 cpu->timer.function = intel_pstate_timer_func; ··· 744 741 limits.min_perf = int_tofp(1); 745 742 limits.max_perf_pct = 100; 746 743 limits.max_perf = int_tofp(1); 747 - limits.no_turbo = 0; 744 + limits.no_turbo = limits.turbo_disabled; 748 745 return 0; 749 746 } 750 747 limits.min_perf_pct = (policy->min * 100) / policy->cpuinfo.max_freq; ··· 787 784 { 788 785 struct cpudata *cpu; 789 786 int rc; 787 + u64 misc_en; 790 788 791 789 rc = intel_pstate_init_cpu(policy->cpu); 792 790 if (rc) ··· 795 791 796 792 cpu = all_cpu_data[policy->cpu]; 797 793 798 - if (!limits.no_turbo && 799 - limits.min_perf_pct == 100 && limits.max_perf_pct == 100) 794 + rdmsrl(MSR_IA32_MISC_ENABLE, misc_en); 795 + if (misc_en & MSR_IA32_MISC_ENABLE_TURBO_DISABLE || 796 + cpu->pstate.max_pstate == cpu->pstate.turbo_pstate) { 797 + limits.turbo_disabled = 1; 798 + limits.no_turbo = 1; 799 + } 800 + if (limits.min_perf_pct == 100 && limits.max_perf_pct == 100) 800 801 policy->policy = CPUFREQ_POLICY_PERFORMANCE; 801 802 else 802 803 policy->policy = CPUFREQ_POLICY_POWERSAVE;
+9
drivers/gpu/drm/i915/intel_opregion.c
··· 403 403 404 404 DRM_DEBUG_DRIVER("bclp = 0x%08x\n", bclp); 405 405 406 + /* 407 + * If the acpi_video interface is not supposed to be used, don't 408 + * bother processing backlight level change requests from firmware. 409 + */ 410 + if (!acpi_video_verify_backlight_support()) { 411 + DRM_DEBUG_KMS("opregion backlight request ignored\n"); 412 + return 0; 413 + } 414 + 406 415 if (!(bclp & ASLE_BCLP_VALID)) 407 416 return ASLC_BACKLIGHT_FAILED; 408 417
+2
include/acpi/video.h
··· 22 22 extern void acpi_video_unregister_backlight(void); 23 23 extern int acpi_video_get_edid(struct acpi_device *device, int type, 24 24 int device_id, void **edid); 25 + extern bool acpi_video_verify_backlight_support(void); 25 26 #else 26 27 static inline int acpi_video_register(void) { return 0; } 27 28 static inline void acpi_video_unregister(void) { return; } ··· 32 31 { 33 32 return -ENODEV; 34 33 } 34 + static inline bool acpi_video_verify_backlight_support(void) { return false; } 35 35 #endif 36 36 37 37 #endif