Skip to content

Commit cd50b70

Browse files
committed
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()
2 parents 2bfedd1 + 3466b54 commit cd50b70

File tree

8 files changed

+86
-54
lines changed

8 files changed

+86
-54
lines changed

drivers/acpi/acpi_lpss.c

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ static void lpss_uart_setup(struct lpss_private_data *pdata)
105105
}
106106
}
107107

108-
static void byt_i2c_setup(struct lpss_private_data *pdata)
108+
static void lpss_deassert_reset(struct lpss_private_data *pdata)
109109
{
110110
unsigned int offset;
111111
u32 val;
@@ -114,9 +114,18 @@ static void byt_i2c_setup(struct lpss_private_data *pdata)
114114
val = readl(pdata->mmio_base + offset);
115115
val |= LPSS_RESETS_RESET_APB | LPSS_RESETS_RESET_FUNC;
116116
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);
117124

118125
if (readl(pdata->mmio_base + pdata->dev_desc->prv_offset))
119126
pdata->fixed_clk_rate = 133000000;
127+
128+
writel(0, pdata->mmio_base + LPSS_I2C_ENABLE);
120129
}
121130

122131
static struct lpss_device_desc lpt_dev_desc = {
@@ -125,7 +134,7 @@ static struct lpss_device_desc lpt_dev_desc = {
125134
};
126135

127136
static struct lpss_device_desc lpt_i2c_dev_desc = {
128-
.flags = LPSS_CLK | LPSS_LTR,
137+
.flags = LPSS_CLK | LPSS_CLK_GATE | LPSS_LTR,
129138
.prv_offset = 0x800,
130139
};
131140

@@ -166,6 +175,12 @@ static struct lpss_device_desc byt_i2c_dev_desc = {
166175
.setup = byt_i2c_setup,
167176
};
168177

178+
static struct lpss_device_desc bsw_spi_dev_desc = {
179+
.flags = LPSS_CLK | LPSS_CLK_GATE | LPSS_CLK_DIVIDER | LPSS_SAVE_CTX,
180+
.prv_offset = 0x400,
181+
.setup = lpss_deassert_reset,
182+
};
183+
169184
#else
170185

171186
#define LPSS_ADDR(desc) (0UL)
@@ -198,7 +213,7 @@ static const struct acpi_device_id acpi_lpss_device_ids[] = {
198213
/* Braswell LPSS devices */
199214
{ "80862288", LPSS_ADDR(byt_pwm_dev_desc) },
200215
{ "8086228A", LPSS_ADDR(byt_uart_dev_desc) },
201-
{ "8086228E", LPSS_ADDR(byt_spi_dev_desc) },
216+
{ "8086228E", LPSS_ADDR(bsw_spi_dev_desc) },
202217
{ "808622C1", LPSS_ADDR(byt_i2c_dev_desc) },
203218

204219
{ "INT3430", LPSS_ADDR(lpt_dev_desc) },

drivers/acpi/ec.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -680,7 +680,7 @@ static void acpi_ec_start(struct acpi_ec *ec, bool resuming)
680680
/* Enable GPE for event processing (SCI_EVT=1) */
681681
if (!resuming)
682682
acpi_ec_submit_request(ec);
683-
pr_info("+++++ EC started +++++\n");
683+
pr_debug("EC started\n");
684684
}
685685
spin_unlock_irqrestore(&ec->lock, flags);
686686
}
@@ -712,7 +712,7 @@ static void acpi_ec_stop(struct acpi_ec *ec, bool suspending)
712712
acpi_ec_complete_request(ec);
713713
clear_bit(EC_FLAGS_STARTED, &ec->flags);
714714
clear_bit(EC_FLAGS_STOPPED, &ec->flags);
715-
pr_info("+++++ EC stopped +++++\n");
715+
pr_debug("EC stopped\n");
716716
}
717717
spin_unlock_irqrestore(&ec->lock, flags);
718718
}

drivers/acpi/resource.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ static bool acpi_dev_resource_len_valid(u64 start, u64 end, u64 len, bool io)
4646
if (len && reslen && reslen == len && start <= end)
4747
return true;
4848

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",
5050
io ? "io" : "mem", start, end, len);
5151

5252
return false;

drivers/acpi/video.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -540,6 +540,15 @@ static struct dmi_system_id video_dmi_table[] __initdata = {
540540
DMI_MATCH(DMI_PRODUCT_NAME, "730U3E/740U3E"),
541541
},
542542
},
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+
},
543552

544553
{
545554
/* https://bugzilla.redhat.com/show_bug.cgi?id=1163574 */

drivers/cpufreq/s3c2416-cpufreq.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ static int s3c2416_cpufreq_set_target(struct cpufreq_policy *policy,
263263
}
264264

265265
#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)
267267
{
268268
int count, v, i, found;
269269
struct cpufreq_frequency_table *pos;
@@ -333,7 +333,7 @@ static struct notifier_block s3c2416_cpufreq_reboot_notifier = {
333333
.notifier_call = s3c2416_cpufreq_reboot_notifier_evt,
334334
};
335335

336-
static int __init s3c2416_cpufreq_driver_init(struct cpufreq_policy *policy)
336+
static int s3c2416_cpufreq_driver_init(struct cpufreq_policy *policy)
337337
{
338338
struct s3c2416_data *s3c_freq = &s3c2416_cpufreq;
339339
struct cpufreq_frequency_table *pos;

drivers/cpufreq/s3c24xx-cpufreq.c

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -144,11 +144,6 @@ static void s3c_cpufreq_setfvco(struct s3c_cpufreq_config *cfg)
144144
(cfg->info->set_fvco)(cfg);
145145
}
146146

147-
static inline void s3c_cpufreq_resume_clocks(void)
148-
{
149-
cpu_cur.info->resume_clocks();
150-
}
151-
152147
static inline void s3c_cpufreq_updateclk(struct clk *clk,
153148
unsigned int freq)
154149
{
@@ -417,9 +412,6 @@ static int s3c_cpufreq_resume(struct cpufreq_policy *policy)
417412

418413
last_target = ~0; /* invalidate last_target setting */
419414

420-
/* first, find out what speed we resumed at. */
421-
s3c_cpufreq_resume_clocks();
422-
423415
/* whilst we will be called later on, we try and re-set the
424416
* cpu frequencies as soon as possible so that we do not end
425417
* up resuming devices and then immediately having to re-set
@@ -454,7 +446,7 @@ static struct cpufreq_driver s3c24xx_driver = {
454446
};
455447

456448

457-
int __init s3c_cpufreq_register(struct s3c_cpufreq_info *info)
449+
int s3c_cpufreq_register(struct s3c_cpufreq_info *info)
458450
{
459451
if (!info || !info->name) {
460452
printk(KERN_ERR "%s: failed to pass valid information\n",

drivers/cpuidle/cpuidle-powernv.c

Lines changed: 49 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include <linux/notifier.h>
1414
#include <linux/clockchips.h>
1515
#include <linux/of.h>
16+
#include <linux/slab.h>
1617

1718
#include <asm/machdep.h>
1819
#include <asm/firmware.h>
@@ -158,70 +159,83 @@ static int powernv_add_idle_states(void)
158159
struct device_node *power_mgt;
159160
int nr_idle_states = 1; /* Snooze */
160161
int dt_idle_states;
161-
const __be32 *idle_state_flags;
162-
const __be32 *idle_state_latency;
163-
u32 len_flags, flags, latency_ns;
164-
int i;
162+
u32 *latency_ns, *residency_ns, *flags;
163+
int i, rc;
165164

166165
/* Currently we have snooze statically defined */
167166

168167
power_mgt = of_find_node_by_path("/ibm,opal/power-mgt");
169168
if (!power_mgt) {
170169
pr_warn("opal: PowerMgmt Node not found\n");
171-
return nr_idle_states;
170+
goto out;
172171
}
173172

174-
idle_state_flags = of_get_property(power_mgt, "ibm,cpu-idle-state-flags", &len_flags);
175-
if (!idle_state_flags) {
176-
pr_warn("DT-PowerMgmt: missing ibm,cpu-idle-state-flags\n");
177-
return nr_idle_states;
173+
/* Read values of any property to determine the num of idle states */
174+
dt_idle_states = of_property_count_u32_elems(power_mgt, "ibm,cpu-idle-state-flags");
175+
if (dt_idle_states < 0) {
176+
pr_warn("cpuidle-powernv: no idle states found in the DT\n");
177+
goto out;
178178
}
179179

180-
idle_state_latency = of_get_property(power_mgt,
181-
"ibm,cpu-idle-state-latencies-ns", NULL);
182-
if (!idle_state_latency) {
183-
pr_warn("DT-PowerMgmt: missing ibm,cpu-idle-state-latencies-ns\n");
184-
return nr_idle_states;
180+
flags = kzalloc(sizeof(*flags) * dt_idle_states, GFP_KERNEL);
181+
if (of_property_read_u32_array(power_mgt,
182+
"ibm,cpu-idle-state-flags", flags, dt_idle_states)) {
183+
pr_warn("cpuidle-powernv : missing ibm,cpu-idle-state-flags in DT\n");
184+
goto out_free_flags;
185185
}
186186

187-
dt_idle_states = len_flags / sizeof(u32);
187+
latency_ns = kzalloc(sizeof(*latency_ns) * dt_idle_states, GFP_KERNEL);
188+
rc = of_property_read_u32_array(power_mgt,
189+
"ibm,cpu-idle-state-latencies-ns", latency_ns, dt_idle_states);
190+
if (rc) {
191+
pr_warn("cpuidle-powernv: missing ibm,cpu-idle-state-latencies-ns in DT\n");
192+
goto out_free_latency;
193+
}
188194

189-
for (i = 0; i < dt_idle_states; i++) {
195+
residency_ns = kzalloc(sizeof(*residency_ns) * dt_idle_states, GFP_KERNEL);
196+
rc = of_property_read_u32_array(power_mgt,
197+
"ibm,cpu-idle-state-residency-ns", residency_ns, dt_idle_states);
190198

191-
flags = be32_to_cpu(idle_state_flags[i]);
199+
for (i = 0; i < dt_idle_states; i++) {
192200

193-
/* Cpuidle accepts exit_latency in us and we estimate
194-
* target residency to be 10x exit_latency
201+
/*
202+
* Cpuidle accepts exit_latency and target_residency in us.
203+
* Use default target_residency values if f/w does not expose it.
195204
*/
196-
latency_ns = be32_to_cpu(idle_state_latency[i]);
197-
if (flags & OPAL_PM_NAP_ENABLED) {
205+
if (flags[i] & OPAL_PM_NAP_ENABLED) {
198206
/* Add NAP state */
199207
strcpy(powernv_states[nr_idle_states].name, "Nap");
200208
strcpy(powernv_states[nr_idle_states].desc, "Nap");
201209
powernv_states[nr_idle_states].flags = 0;
202-
powernv_states[nr_idle_states].exit_latency =
203-
((unsigned int)latency_ns) / 1000;
204-
powernv_states[nr_idle_states].target_residency =
205-
((unsigned int)latency_ns / 100);
210+
powernv_states[nr_idle_states].target_residency = 100;
206211
powernv_states[nr_idle_states].enter = &nap_loop;
207-
nr_idle_states++;
208-
}
209-
210-
if (flags & OPAL_PM_SLEEP_ENABLED ||
211-
flags & OPAL_PM_SLEEP_ENABLED_ER1) {
212+
} else if (flags[i] & OPAL_PM_SLEEP_ENABLED ||
213+
flags[i] & OPAL_PM_SLEEP_ENABLED_ER1) {
212214
/* Add FASTSLEEP state */
213215
strcpy(powernv_states[nr_idle_states].name, "FastSleep");
214216
strcpy(powernv_states[nr_idle_states].desc, "FastSleep");
215217
powernv_states[nr_idle_states].flags = CPUIDLE_FLAG_TIMER_STOP;
216-
powernv_states[nr_idle_states].exit_latency =
217-
((unsigned int)latency_ns) / 1000;
218-
powernv_states[nr_idle_states].target_residency =
219-
((unsigned int)latency_ns / 100);
218+
powernv_states[nr_idle_states].target_residency = 300000;
220219
powernv_states[nr_idle_states].enter = &fastsleep_loop;
221-
nr_idle_states++;
222220
}
221+
222+
powernv_states[nr_idle_states].exit_latency =
223+
((unsigned int)latency_ns[i]) / 1000;
224+
225+
if (!rc) {
226+
powernv_states[nr_idle_states].target_residency =
227+
((unsigned int)residency_ns[i]) / 1000;
228+
}
229+
230+
nr_idle_states++;
223231
}
224232

233+
kfree(residency_ns);
234+
out_free_latency:
235+
kfree(latency_ns);
236+
out_free_flags:
237+
kfree(flags);
238+
out:
225239
return nr_idle_states;
226240
}
227241

drivers/pnp/resource.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,8 +179,9 @@ int pnp_check_port(struct pnp_dev *dev, struct resource *res)
179179
/* check if the resource is already in use, skip if the
180180
* device is active because it itself may be in use */
181181
if (!dev->active) {
182-
if (__check_region(&ioport_resource, *port, length(port, end)))
182+
if (!request_region(*port, length(port, end), "pnp"))
183183
return 0;
184+
release_region(*port, length(port, end));
184185
}
185186

186187
/* check if the resource is reserved */
@@ -241,8 +242,9 @@ int pnp_check_mem(struct pnp_dev *dev, struct resource *res)
241242
/* check if the resource is already in use, skip if the
242243
* device is active because it itself may be in use */
243244
if (!dev->active) {
244-
if (check_mem_region(*addr, length(addr, end)))
245+
if (!request_mem_region(*addr, length(addr, end), "pnp"))
245246
return 0;
247+
release_mem_region(*addr, length(addr, end));
246248
}
247249

248250
/* check if the resource is reserved */

0 commit comments

Comments
 (0)