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

Merge tag 'pm+acpi-3.20-rc1-3' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm

Pull one more batch of power management and ACPI updates from Rafael Wysocki:
"These are mostly fixes on top of the previously merged recent PM and
ACPI material.

First, one commit that broke the ACPI LPSS (Low-Power Subsystem)
driver on a Dell box is reverted and there are two stable-candidate
fixes for that driver. Another fix cleans up two recently added ACPI
EC messages that look odd and the printk level of a noisy debug
message in the core ACPI resources handling code is reduced.

In addition to that we have two stable-candidate fixes for the s3c
cpufreq driver, two cpuidle powernv driver updates related to Device
Trees and a PNP subsystem cleanup that will allow us to get rid of
some old ugliness going forward. Also there is a new blacklist entry
for the ACPI backlight code.

Specifics:

- Revert a recent ACPI LPSS driver commit that prevented the touchpad
driver from loading on Dell XPS13 (Jarkko Nikula).

- Make the ACPI LPSS driver disable the I2C controllers and deassert
SPI host controllers resets at startup on Intel BayTrail and
Braswell SoCs in case they have been left in wrong states by the
platform firmware which then may casuse fatal controller driver
failures during resume from hibernation (Mika Westerberg).

- Make two recently added ACPI EC messages look better (Scot Doyle).

- Reduce the printk level of a recently added debug message related
to ACPI resources that may become noisy in some cases (Rafael J
Wysocki).

- Add a new ACPI backlight blacklist entry for Samsung Series 9
(900X3C/900X3D/900X3E/900X4C/900X4D) laptops where the native
backlight interface doesn't work while the ACPI based one does
(Jens Reyer).

- Make the PNP sybsystem's core code use __request_region() followed
by __release_region() instead of __check_region() which then will
allow us to get rid of the latter as it has no more users (Jakub
Sitnicki).

- Fix a build breakage and an issue with two __init functions that
may be called after initialization in the s3c cpufreq driver (Arnd
Bergmann).

- Make the powernv cpuidle driver read target_residency values for
idle states from a Device Tree (as we have the suitable DT bindings
for that now) and improve the parsing of the powermgmt DT node in
that driver (Preeti U Murthy)"

* tag 'pm+acpi-3.20-rc1-3' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
cpuidle: powernv: Avoid endianness conversions while parsing DT
cpufreq: s3c: remove last use of resume_clocks callback
cpufreq: s3c: remove incorrect __init annotations
ACPI / LPSS: Deassert resets for SPI host controllers on Braswell
ACPI / LPSS: Always disable I2C host controllers
ACPI / resources: Change pr_info() to pr_debug() for debug information
ACPI / video: Disable native backlight on Samsung Series 9 laptops
cpuidle: powernv: Read target_residency value of idle states from DT if available
Revert "ACPI / LPSS: Remove non-existing clock control from Intel Lynxpoint I2C"
ACPI / EC: Remove non-standard log emphasis
PNP: Switch from __check_region() to __request_region()

+86 -54
+18 -3
drivers/acpi/acpi_lpss.c
··· 105 105 } 106 106 } 107 107 108 - static void byt_i2c_setup(struct lpss_private_data *pdata) 108 + static void lpss_deassert_reset(struct lpss_private_data *pdata) 109 109 { 110 110 unsigned int offset; 111 111 u32 val; ··· 114 114 val = readl(pdata->mmio_base + offset); 115 115 val |= LPSS_RESETS_RESET_APB | LPSS_RESETS_RESET_FUNC; 116 116 writel(val, pdata->mmio_base + offset); 117 + } 118 + 119 + #define LPSS_I2C_ENABLE 0x6c 120 + 121 + static void byt_i2c_setup(struct lpss_private_data *pdata) 122 + { 123 + lpss_deassert_reset(pdata); 117 124 118 125 if (readl(pdata->mmio_base + pdata->dev_desc->prv_offset)) 119 126 pdata->fixed_clk_rate = 133000000; 127 + 128 + writel(0, pdata->mmio_base + LPSS_I2C_ENABLE); 120 129 } 121 130 122 131 static struct lpss_device_desc lpt_dev_desc = { ··· 134 125 }; 135 126 136 127 static struct lpss_device_desc lpt_i2c_dev_desc = { 137 - .flags = LPSS_CLK | LPSS_LTR, 128 + .flags = LPSS_CLK | LPSS_CLK_GATE | LPSS_LTR, 138 129 .prv_offset = 0x800, 139 130 }; 140 131 ··· 175 166 .setup = byt_i2c_setup, 176 167 }; 177 168 169 + static struct lpss_device_desc bsw_spi_dev_desc = { 170 + .flags = LPSS_CLK | LPSS_CLK_GATE | LPSS_CLK_DIVIDER | LPSS_SAVE_CTX, 171 + .prv_offset = 0x400, 172 + .setup = lpss_deassert_reset, 173 + }; 174 + 178 175 #else 179 176 180 177 #define LPSS_ADDR(desc) (0UL) ··· 213 198 /* Braswell LPSS devices */ 214 199 { "80862288", LPSS_ADDR(byt_pwm_dev_desc) }, 215 200 { "8086228A", LPSS_ADDR(byt_uart_dev_desc) }, 216 - { "8086228E", LPSS_ADDR(byt_spi_dev_desc) }, 201 + { "8086228E", LPSS_ADDR(bsw_spi_dev_desc) }, 217 202 { "808622C1", LPSS_ADDR(byt_i2c_dev_desc) }, 218 203 219 204 { "INT3430", LPSS_ADDR(lpt_dev_desc) },
+2 -2
drivers/acpi/ec.c
··· 680 680 /* Enable GPE for event processing (SCI_EVT=1) */ 681 681 if (!resuming) 682 682 acpi_ec_submit_request(ec); 683 - pr_info("+++++ EC started +++++\n"); 683 + pr_debug("EC started\n"); 684 684 } 685 685 spin_unlock_irqrestore(&ec->lock, flags); 686 686 } ··· 712 712 acpi_ec_complete_request(ec); 713 713 clear_bit(EC_FLAGS_STARTED, &ec->flags); 714 714 clear_bit(EC_FLAGS_STOPPED, &ec->flags); 715 - pr_info("+++++ EC stopped +++++\n"); 715 + pr_debug("EC stopped\n"); 716 716 } 717 717 spin_unlock_irqrestore(&ec->lock, flags); 718 718 }
+1 -1
drivers/acpi/resource.c
··· 46 46 if (len && reslen && reslen == len && start <= end) 47 47 return true; 48 48 49 - pr_info("ACPI: invalid or unassigned resource %s [%016llx - %016llx] length [%016llx]\n", 49 + pr_debug("ACPI: invalid or unassigned resource %s [%016llx - %016llx] length [%016llx]\n", 50 50 io ? "io" : "mem", start, end, len); 51 51 52 52 return false;
+9
drivers/acpi/video.c
··· 540 540 DMI_MATCH(DMI_PRODUCT_NAME, "730U3E/740U3E"), 541 541 }, 542 542 }, 543 + { 544 + /* https://bugs.freedesktop.org/show_bug.cgi?id=87286 */ 545 + .callback = video_disable_native_backlight, 546 + .ident = "SAMSUNG 900X3C/900X3D/900X3E/900X4C/900X4D", 547 + .matches = { 548 + DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."), 549 + DMI_MATCH(DMI_PRODUCT_NAME, "900X3C/900X3D/900X3E/900X4C/900X4D"), 550 + }, 551 + }, 543 552 544 553 { 545 554 /* https://bugzilla.redhat.com/show_bug.cgi?id=1163574 */
+2 -2
drivers/cpufreq/s3c2416-cpufreq.c
··· 263 263 } 264 264 265 265 #ifdef CONFIG_ARM_S3C2416_CPUFREQ_VCORESCALE 266 - static void __init s3c2416_cpufreq_cfg_regulator(struct s3c2416_data *s3c_freq) 266 + static void s3c2416_cpufreq_cfg_regulator(struct s3c2416_data *s3c_freq) 267 267 { 268 268 int count, v, i, found; 269 269 struct cpufreq_frequency_table *pos; ··· 333 333 .notifier_call = s3c2416_cpufreq_reboot_notifier_evt, 334 334 }; 335 335 336 - static int __init s3c2416_cpufreq_driver_init(struct cpufreq_policy *policy) 336 + static int s3c2416_cpufreq_driver_init(struct cpufreq_policy *policy) 337 337 { 338 338 struct s3c2416_data *s3c_freq = &s3c2416_cpufreq; 339 339 struct cpufreq_frequency_table *pos;
+1 -9
drivers/cpufreq/s3c24xx-cpufreq.c
··· 144 144 (cfg->info->set_fvco)(cfg); 145 145 } 146 146 147 - static inline void s3c_cpufreq_resume_clocks(void) 148 - { 149 - cpu_cur.info->resume_clocks(); 150 - } 151 - 152 147 static inline void s3c_cpufreq_updateclk(struct clk *clk, 153 148 unsigned int freq) 154 149 { ··· 412 417 413 418 last_target = ~0; /* invalidate last_target setting */ 414 419 415 - /* first, find out what speed we resumed at. */ 416 - s3c_cpufreq_resume_clocks(); 417 - 418 420 /* whilst we will be called later on, we try and re-set the 419 421 * cpu frequencies as soon as possible so that we do not end 420 422 * up resuming devices and then immediately having to re-set ··· 446 454 }; 447 455 448 456 449 - int __init s3c_cpufreq_register(struct s3c_cpufreq_info *info) 457 + int s3c_cpufreq_register(struct s3c_cpufreq_info *info) 450 458 { 451 459 if (!info || !info->name) { 452 460 printk(KERN_ERR "%s: failed to pass valid information\n",
+49 -35
drivers/cpuidle/cpuidle-powernv.c
··· 13 13 #include <linux/notifier.h> 14 14 #include <linux/clockchips.h> 15 15 #include <linux/of.h> 16 + #include <linux/slab.h> 16 17 17 18 #include <asm/machdep.h> 18 19 #include <asm/firmware.h> ··· 159 158 struct device_node *power_mgt; 160 159 int nr_idle_states = 1; /* Snooze */ 161 160 int dt_idle_states; 162 - const __be32 *idle_state_flags; 163 - const __be32 *idle_state_latency; 164 - u32 len_flags, flags, latency_ns; 165 - int i; 161 + u32 *latency_ns, *residency_ns, *flags; 162 + int i, rc; 166 163 167 164 /* Currently we have snooze statically defined */ 168 165 169 166 power_mgt = of_find_node_by_path("/ibm,opal/power-mgt"); 170 167 if (!power_mgt) { 171 168 pr_warn("opal: PowerMgmt Node not found\n"); 172 - return nr_idle_states; 169 + goto out; 173 170 } 174 171 175 - idle_state_flags = of_get_property(power_mgt, "ibm,cpu-idle-state-flags", &len_flags); 176 - if (!idle_state_flags) { 177 - pr_warn("DT-PowerMgmt: missing ibm,cpu-idle-state-flags\n"); 178 - return nr_idle_states; 172 + /* Read values of any property to determine the num of idle states */ 173 + dt_idle_states = of_property_count_u32_elems(power_mgt, "ibm,cpu-idle-state-flags"); 174 + if (dt_idle_states < 0) { 175 + pr_warn("cpuidle-powernv: no idle states found in the DT\n"); 176 + goto out; 179 177 } 180 178 181 - idle_state_latency = of_get_property(power_mgt, 182 - "ibm,cpu-idle-state-latencies-ns", NULL); 183 - if (!idle_state_latency) { 184 - pr_warn("DT-PowerMgmt: missing ibm,cpu-idle-state-latencies-ns\n"); 185 - return nr_idle_states; 179 + flags = kzalloc(sizeof(*flags) * dt_idle_states, GFP_KERNEL); 180 + if (of_property_read_u32_array(power_mgt, 181 + "ibm,cpu-idle-state-flags", flags, dt_idle_states)) { 182 + pr_warn("cpuidle-powernv : missing ibm,cpu-idle-state-flags in DT\n"); 183 + goto out_free_flags; 186 184 } 187 185 188 - dt_idle_states = len_flags / sizeof(u32); 186 + latency_ns = kzalloc(sizeof(*latency_ns) * dt_idle_states, GFP_KERNEL); 187 + rc = of_property_read_u32_array(power_mgt, 188 + "ibm,cpu-idle-state-latencies-ns", latency_ns, dt_idle_states); 189 + if (rc) { 190 + pr_warn("cpuidle-powernv: missing ibm,cpu-idle-state-latencies-ns in DT\n"); 191 + goto out_free_latency; 192 + } 193 + 194 + residency_ns = kzalloc(sizeof(*residency_ns) * dt_idle_states, GFP_KERNEL); 195 + rc = of_property_read_u32_array(power_mgt, 196 + "ibm,cpu-idle-state-residency-ns", residency_ns, dt_idle_states); 189 197 190 198 for (i = 0; i < dt_idle_states; i++) { 191 199 192 - flags = be32_to_cpu(idle_state_flags[i]); 193 - 194 - /* Cpuidle accepts exit_latency in us and we estimate 195 - * target residency to be 10x exit_latency 200 + /* 201 + * Cpuidle accepts exit_latency and target_residency in us. 202 + * Use default target_residency values if f/w does not expose it. 196 203 */ 197 - latency_ns = be32_to_cpu(idle_state_latency[i]); 198 - if (flags & OPAL_PM_NAP_ENABLED) { 204 + if (flags[i] & OPAL_PM_NAP_ENABLED) { 199 205 /* Add NAP state */ 200 206 strcpy(powernv_states[nr_idle_states].name, "Nap"); 201 207 strcpy(powernv_states[nr_idle_states].desc, "Nap"); 202 208 powernv_states[nr_idle_states].flags = 0; 203 - powernv_states[nr_idle_states].exit_latency = 204 - ((unsigned int)latency_ns) / 1000; 205 - powernv_states[nr_idle_states].target_residency = 206 - ((unsigned int)latency_ns / 100); 209 + powernv_states[nr_idle_states].target_residency = 100; 207 210 powernv_states[nr_idle_states].enter = &nap_loop; 208 - nr_idle_states++; 209 - } 210 - 211 - if (flags & OPAL_PM_SLEEP_ENABLED || 212 - flags & OPAL_PM_SLEEP_ENABLED_ER1) { 211 + } else if (flags[i] & OPAL_PM_SLEEP_ENABLED || 212 + flags[i] & OPAL_PM_SLEEP_ENABLED_ER1) { 213 213 /* Add FASTSLEEP state */ 214 214 strcpy(powernv_states[nr_idle_states].name, "FastSleep"); 215 215 strcpy(powernv_states[nr_idle_states].desc, "FastSleep"); 216 216 powernv_states[nr_idle_states].flags = CPUIDLE_FLAG_TIMER_STOP; 217 - powernv_states[nr_idle_states].exit_latency = 218 - ((unsigned int)latency_ns) / 1000; 219 - powernv_states[nr_idle_states].target_residency = 220 - ((unsigned int)latency_ns / 100); 217 + powernv_states[nr_idle_states].target_residency = 300000; 221 218 powernv_states[nr_idle_states].enter = &fastsleep_loop; 222 - nr_idle_states++; 223 219 } 220 + 221 + powernv_states[nr_idle_states].exit_latency = 222 + ((unsigned int)latency_ns[i]) / 1000; 223 + 224 + if (!rc) { 225 + powernv_states[nr_idle_states].target_residency = 226 + ((unsigned int)residency_ns[i]) / 1000; 227 + } 228 + 229 + nr_idle_states++; 224 230 } 225 231 232 + kfree(residency_ns); 233 + out_free_latency: 234 + kfree(latency_ns); 235 + out_free_flags: 236 + kfree(flags); 237 + out: 226 238 return nr_idle_states; 227 239 } 228 240
+4 -2
drivers/pnp/resource.c
··· 179 179 /* check if the resource is already in use, skip if the 180 180 * device is active because it itself may be in use */ 181 181 if (!dev->active) { 182 - if (__check_region(&ioport_resource, *port, length(port, end))) 182 + if (!request_region(*port, length(port, end), "pnp")) 183 183 return 0; 184 + release_region(*port, length(port, end)); 184 185 } 185 186 186 187 /* check if the resource is reserved */ ··· 242 241 /* check if the resource is already in use, skip if the 243 242 * device is active because it itself may be in use */ 244 243 if (!dev->active) { 245 - if (check_mem_region(*addr, length(addr, end))) 244 + if (!request_mem_region(*addr, length(addr, end), "pnp")) 246 245 return 0; 246 + release_mem_region(*addr, length(addr, end)); 247 247 } 248 248 249 249 /* check if the resource is reserved */