projects/linux·commit f2d28566

Merge tag 'pm-4.17-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm

f2d28566 · Linus Torvalds <[email protected]> · 2018-04-03 10:45:39 -07:00

Pull power management updates from Rafael Wysocki:
 "These update the cpuidle poll state definition to reduce excessive
  energy usage related to it, add new CPU ID to the RAPL power capping
  driver, update the ACPI system suspend code to handle some special
  cases better, extend the PM core's device links code slightly, add new
  sysfs attribute for better suspend-to-idle diagnostics and easier
  hibernation handling, update power management tools and clean up
  cpufreq quite a bit.

  Specifics:

   - Modify the cpuidle poll state implementation to prevent CPUs from
     staying in the loop in there for excessive times (Rafael Wysocki).

   - Add Intel Cannon Lake chips support to the RAPL power capping
     driver (Joe Konno).

   - Add reference counting to the device links handling code in the PM
     core (Lukas Wunner).

   - Avoid reconfiguring GPEs on suspend-to-idle in the ACPI system
     suspend code (Rafael Wysocki).

   - Allow devices to be put into deeper low-power states via ACPI if
     both _SxD and _SxW are missing (Daniel Drake).

   - Reorganize the core ACPI suspend-to-idle wakeup code to avoid a
     keyboard wakeup issue on Asus UX331UA (Chris Chiu).

   - Prevent the PCMCIA library code from aborting suspend-to-idle due
     to noirq suspend failures resulting from incorrect assumptions
     (Rafael Wysocki).

   - Add coupled cpuidle supprt to the Exynos3250 platform (Marek
     Szyprowski).

   - Add new sysfs file to make it easier to specify the image storage
     location during hibernation (Mario Limonciello).

   - Add sysfs files for collecting suspend-to-idle usage and time
     statistics for CPU idle states (Rafael Wysocki).

   - Update the pm-graph utilities (Todd Brandt).

   - Reduce the kernel log noise related to reporting Low-power Idle
     constraings by the ACPI system suspend code (Rafael Wysocki).

   - Make it easier to distinguish dedicated wakeup IRQs in the
     /proc/interrupts output (Tony Lindgren).

   - Add the frequency table validation in cpufreq to the core and drop
     it from a number of cpufreq drivers (Viresh Kumar).

   - Drop "cooling-{min|max}-level" for CPU nodes from a couple of DT
     bindings (Viresh Kumar).

   - Clean up the CPU online error code path in the cpufreq core (Viresh
     Kumar).

   - Fix assorted issues in the SCPI, CPPC, mediatek and tegra186
     cpufreq drivers (Arnd Bergmann, Chunyu Hu, George Cherian, Viresh
     Kumar).

   - Drop memory allocation error messages from a few places in cpufreq
     and cpuildle drivers (Markus Elfring)"

* tag 'pm-4.17-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (56 commits)
  ACPI / PM: Fix keyboard wakeup from suspend-to-idle on ASUS UX331UA
  cpufreq: CPPC: Use transition_delay_us depending transition_latency
  PM / hibernate: Change message when writing to /sys/power/resume
  PM / hibernate: Make passing hibernate offsets more friendly
  cpuidle: poll_state: Avoid invoking local_clock() too often
  PM: cpuidle/suspend: Add s2idle usage and time state attributes
  cpuidle: Enable coupled cpuidle support on Exynos3250 platform
  cpuidle: poll_state: Add time limit to poll_idle()
  cpufreq: tegra186: Don't validate the frequency table twice
  cpufreq: speedstep: Don't validate the frequency table twice
  cpufreq: sparc: Don't validate the frequency table twice
  cpufreq: sh: Don't validate the frequency table twice
  cpufreq: sfi: Don't validate the frequency table twice
  cpufreq: scpi: Don't validate the frequency table twice
  cpufreq: sc520: Don't validate the frequency table twice
  cpufreq: s3c24xx: Don't validate the frequency table twice
  cpufreq: qoirq: Don't validate the frequency table twice
  cpufreq: pxa: Don't validate the frequency table twice
  cpufreq: ppc_cbe: Don't validate the frequency table twice
  cpufreq: powernow: Don't validate the frequency table twice
  ...
Commit
f2d285669aae656dfeafa0bf25e86bbbc5d22329
Parents
be553754 · 103cf0e5

Merge commit. Changes below are compared with the first parent: be553754.

Changes

75 files changed · +2916 −915

FileStatusAddDelContent
Documentation/ABI/testing/sysfs-devices-system-cpumodified+25−0View file
Documentation/ABI/testing/sysfs-powermodified+14−0View file
Documentation/devicetree/bindings/cpufreq/cpufreq-dt.txtmodified+0−4View file
Documentation/devicetree/bindings/cpufreq/cpufreq-mediatek.txtmodified+0−4View file
Documentation/power/swsusp.txtmodified+9−1View file
arch/arm/boot/dts/mt7623.dtsimodified+0−2View file
drivers/acpi/device_pm.cmodified+10−1View file
drivers/acpi/sleep.cmodified+9−15View file
drivers/base/core.cmodified+17−8View file
drivers/base/power/power.hmodified+1−0View file
drivers/base/power/wakeirq.cmodified+11−2View file
drivers/cpufreq/Kconfig.armmodified+1−0View file
drivers/cpufreq/acpi-cpufreq.cmodified+11−9View file
drivers/cpufreq/arm_big_little.cmodified+1−8View file
drivers/cpufreq/brcmstb-avs-cpufreq.cmodified+1−5View file
drivers/cpufreq/cppc_cpufreq.cmodified+10−2View file
drivers/cpufreq/cpufreq-dt.cmodified+1−7View file
drivers/cpufreq/cpufreq.cmodified+13−15View file
drivers/cpufreq/e_powersaver.cmodified+1−7View file
drivers/cpufreq/elanfreq.cmodified+2−1View file
drivers/cpufreq/freq_table.cmodified+15−1View file
drivers/cpufreq/ia64-acpi-cpufreq.cmodified+1−6View file
drivers/cpufreq/imx6q-cpufreq.cmodified+4−3View file
drivers/cpufreq/longhaul.cmodified+2−1View file
drivers/cpufreq/mediatek-cpufreq.cmodified+2−11View file
drivers/cpufreq/p4-clockmod.cmodified+2−1View file
drivers/cpufreq/powernow-k6.cmodified+2−1View file
drivers/cpufreq/powernow-k7.cmodified+2−1View file
drivers/cpufreq/powernow-k8.cmodified+4−20View file
drivers/cpufreq/powernv-cpufreq.cmodified+3−8View file
drivers/cpufreq/ppc_cbe_cpufreq.cmodified+2−3View file
drivers/cpufreq/pxa2xx-cpufreq.cmodified+2−2View file
drivers/cpufreq/pxa3xx-cpufreq.cmodified+3−1View file
drivers/cpufreq/qoriq-cpufreq.cmodified+4−17View file
drivers/cpufreq/s3c24xx-cpufreq.cmodified+3−10View file
drivers/cpufreq/sc520_freq.cmodified+2−1View file
drivers/cpufreq/scpi-cpufreq.cmodified+1−9View file
drivers/cpufreq/sfi-cpufreq.cmodified+2−1View file
drivers/cpufreq/sh-cpufreq.cmodified+12−10View file
drivers/cpufreq/sparc-us2e-cpufreq.cmodified+2−1View file
drivers/cpufreq/sparc-us3-cpufreq.cmodified+2−1View file
drivers/cpufreq/speedstep-centrino.cmodified+2−2View file
drivers/cpufreq/speedstep-ich.cmodified+3−1View file
drivers/cpufreq/speedstep-smi.cmodified+3−1View file
drivers/cpufreq/tegra186-cpufreq.cmodified+2−1View file
drivers/cpuidle/cpuidle-arm.cmodified+0−1View file
drivers/cpuidle/cpuidle-exynos.cmodified+2−1View file
drivers/cpuidle/cpuidle.cmodified+9−0View file
drivers/cpuidle/poll_state.cmodified+16−1View file
drivers/cpuidle/sysfs.cmodified+54−0View file
drivers/pcmcia/cs.cmodified+7−3View file
drivers/pcmcia/cs_internal.hmodified+1−0View file
drivers/powercap/intel_rapl.cmodified+1−0View file
include/linux/cpufreq.hmodified+1−0View file
include/linux/cpuidle.hmodified+4−0View file
include/linux/device.hmodified+2−0View file
kernel/power/hibernate.cmodified+25−1View file
tools/power/pm-graph/Makefilemodified+22−7View file
tools/power/pm-graph/bootgraph.8modified+14−4View file
tools/power/pm-graph/analyze_boot.py → tools/power/pm-graph/bootgraph.pyrenamed+146−73View file
tools/power/pm-graph/config/cgskip.txtadded+65−0View file
tools/power/pm-graph/config/custom-timeline-functions.cfgadded+205−0View file
tools/power/pm-graph/config/example.cfgadded+133−0View file
tools/power/pm-graph/config/freeze-callgraph.cfgadded+94−0View file
tools/power/pm-graph/config/freeze-dev.cfgadded+93−0View file
tools/power/pm-graph/config/freeze.cfgadded+93−0View file
tools/power/pm-graph/config/standby-callgraph.cfgadded+94−0View file
tools/power/pm-graph/config/standby-dev.cfgadded+93−0View file
tools/power/pm-graph/config/standby.cfgadded+93−0View file
tools/power/pm-graph/config/suspend-callgraph.cfgadded+98−0View file
tools/power/pm-graph/config/suspend-dev.cfgadded+93−0View file
tools/power/pm-graph/config/suspend-x2-proc.cfgadded+93−0View file
tools/power/pm-graph/config/suspend.cfgadded+93−0View file
tools/power/pm-graph/sleepgraph.8modified+41−6View file
tools/power/pm-graph/analyze_suspend.py → tools/power/pm-graph/sleepgraph.pyrenamed+1012−613View file

Only the first 600 diff lines are shown. Download the complete patch.

Documentation/ABI/testing/sysfs-devices-system-cpu

View file
diff --git a/Documentation/ABI/testing/sysfs-devices-system-cpu b/Documentation/ABI/testing/sysfs-devices-system-cpu
index 4ed63b6..025b7cf 100644
--- a/Documentation/ABI/testing/sysfs-devices-system-cpu
+++ b/Documentation/ABI/testing/sysfs-devices-system-cpu
@@ -198,6 +198,31 @@ Description:
time (in microseconds) this cpu should spend in this idle state
to make the transition worth the effort.
+What: /sys/devices/system/cpu/cpuX/cpuidle/stateN/s2idle/
+Date: March 2018
+KernelVersion: v4.17
+Contact: Linux power management list <[email protected]>
+Description:
+ Idle state usage statistics related to suspend-to-idle.
+
+ This attribute group is only present for states that can be
+ used in suspend-to-idle with suspended timekeeping.
+
+What: /sys/devices/system/cpu/cpuX/cpuidle/stateN/s2idle/time
+Date: March 2018
+KernelVersion: v4.17
+Contact: Linux power management list <[email protected]>
+Description:
+ Total time spent by the CPU in suspend-to-idle (with scheduler
+ tick suspended) after requesting this state.
+
+What: /sys/devices/system/cpu/cpuX/cpuidle/stateN/s2idle/usage
+Date: March 2018
+KernelVersion: v4.17
+Contact: Linux power management list <[email protected]>
+Description:
+ Total number of times this state has been requested by the CPU
+ while entering suspend-to-idle.
What: /sys/devices/system/cpu/cpu#/cpufreq/*
Date: pre-git history

Documentation/ABI/testing/sysfs-power

View file
diff --git a/Documentation/ABI/testing/sysfs-power b/Documentation/ABI/testing/sysfs-power
index 1e0d1da..2f813d6 100644
--- a/Documentation/ABI/testing/sysfs-power
+++ b/Documentation/ABI/testing/sysfs-power
@@ -287,3 +287,17 @@ Description:
Writing a "1" to this file enables the debug messages and
writing a "0" (default) to it disables them. Reads from
this file return the current value.
+
+What: /sys/power/resume_offset
+Date: April 2018
+Contact: Mario Limonciello <[email protected]>
+Description:
+ This file is used for telling the kernel an offset into a disk
+ to use when hibernating the system such as with a swap file.
+
+ Reads from this file will display the current offset
+ the kernel will be using on the next hibernation
+ attempt.
+
+ Using this sysfs file will override any values that were
+ set using the kernel command line for disk offset.
\ No newline at end of file

Documentation/devicetree/bindings/cpufreq/cpufreq-dt.txt

View file
diff --git a/Documentation/devicetree/bindings/cpufreq/cpufreq-dt.txt b/Documentation/devicetree/bindings/cpufreq/cpufreq-dt.txt
index dd3929e..332aed8 100644
--- a/Documentation/devicetree/bindings/cpufreq/cpufreq-dt.txt
+++ b/Documentation/devicetree/bindings/cpufreq/cpufreq-dt.txt
@@ -18,8 +18,6 @@ Optional properties:
in unit of nanoseconds.
- voltage-tolerance: Specify the CPU voltage tolerance in percentage.
- #cooling-cells:
-- cooling-min-level:
-- cooling-max-level:
Please refer to Documentation/devicetree/bindings/thermal/thermal.txt.
Examples:
@@ -40,8 +38,6 @@ cpus {
>;
clock-latency = <61036>; /* two CLK32 periods */
#cooling-cells = <2>;
- cooling-min-level = <0>;
- cooling-max-level = <2>;
};
cpu@1 {

Documentation/devicetree/bindings/cpufreq/cpufreq-mediatek.txt

View file
diff --git a/Documentation/devicetree/bindings/cpufreq/cpufreq-mediatek.txt b/Documentation/devicetree/bindings/cpufreq/cpufreq-mediatek.txt
index f640308..d36f07e 100644
--- a/Documentation/devicetree/bindings/cpufreq/cpufreq-mediatek.txt
+++ b/Documentation/devicetree/bindings/cpufreq/cpufreq-mediatek.txt
@@ -21,8 +21,6 @@ Optional properties:
flow is handled by hardware, hence no software "voltage tracking" is
needed.
- #cooling-cells:
-- cooling-min-level:
-- cooling-max-level:
Please refer to Documentation/devicetree/bindings/thermal/thermal.txt
for detail.
@@ -67,8 +65,6 @@ Example 1 (MT7623 SoC):
clock-names = "cpu", "intermediate";
operating-points-v2 = <&cpu_opp_table>;
#cooling-cells = <2>;
- cooling-min-level = <0>;
- cooling-max-level = <7>;
};
cpu@1 {
device_type = "cpu";

Documentation/power/swsusp.txt

View file
diff --git a/Documentation/power/swsusp.txt b/Documentation/power/swsusp.txt
index 9f2f942..cc87adf 100644
--- a/Documentation/power/swsusp.txt
+++ b/Documentation/power/swsusp.txt
@@ -24,8 +24,16 @@ Some warnings, first.
* see the FAQ below for details. (This is not true for more traditional
* power states like "standby", which normally don't turn USB off.)
+Swap partition:
You need to append resume=/dev/your_swap_partition to kernel command
-line. Then you suspend by
+line or specify it using /sys/power/resume.
+
+Swap file:
+If using a swapfile you can also specify a resume offset using
+resume_offset=<number> on the kernel command line or specify it
+in /sys/power/resume_offset.
+
+After preparing then you suspend by
echo shutdown > /sys/power/disk; echo disk > /sys/power/state

arch/arm/boot/dts/mt7623.dtsi

View file
diff --git a/arch/arm/boot/dts/mt7623.dtsi b/arch/arm/boot/dts/mt7623.dtsi
index b750da5..8e7c654 100644
--- a/arch/arm/boot/dts/mt7623.dtsi
+++ b/arch/arm/boot/dts/mt7623.dtsi
@@ -87,8 +87,6 @@
clock-names = "cpu", "intermediate";
operating-points-v2 = <&cpu_opp_table>;
#cooling-cells = <2>;
- cooling-min-level = <0>;
- cooling-max-level = <7>;
clock-frequency = <1300000000>;
};

drivers/acpi/device_pm.c

View file
diff --git a/drivers/acpi/device_pm.c b/drivers/acpi/device_pm.c
index c4d0a1c..3d96e4d 100644
--- a/drivers/acpi/device_pm.c
+++ b/drivers/acpi/device_pm.c
@@ -543,6 +543,7 @@ static int acpi_dev_pm_get_state(struct device *dev, struct acpi_device *adev,
unsigned long long ret;
int d_min, d_max;
bool wakeup = false;
+ bool has_sxd = false;
acpi_status status;
/*
@@ -581,6 +582,10 @@ static int acpi_dev_pm_get_state(struct device *dev, struct acpi_device *adev,
else
return -ENODATA;
}
+
+ if (status == AE_OK)
+ has_sxd = true;
+
d_min = ret;
wakeup = device_may_wakeup(dev) && adev->wakeup.flags.valid
&& adev->wakeup.sleep_state >= target_state;
@@ -599,7 +604,11 @@ static int acpi_dev_pm_get_state(struct device *dev, struct acpi_device *adev,
method[3] = 'W';
status = acpi_evaluate_integer(handle, method, NULL, &ret);
if (status == AE_NOT_FOUND) {
- if (target_state > ACPI_STATE_S0)
+ /* No _SxW. In this case, the ACPI spec says that we
+ * must not go into any power state deeper than the
+ * value returned from _SxD.
+ */
+ if (has_sxd && target_state > ACPI_STATE_S0)
d_max = d_min;
} else if (ACPI_SUCCESS(status) && ret <= ACPI_STATE_D3_COLD) {
/* Fall back to D3cold if ret is not a valid state. */

drivers/acpi/sleep.c

View file
diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c
index b35923e..99a1a65 100644
--- a/drivers/acpi/sleep.c
+++ b/drivers/acpi/sleep.c
@@ -849,23 +849,25 @@ static void lpi_check_constraints(void)
int i;
for (i = 0; i < lpi_constraints_table_size; ++i) {
+ acpi_handle handle = lpi_constraints_table[i].handle;
struct acpi_device *adev;
- if (acpi_bus_get_device(lpi_constraints_table[i].handle, &adev))
+ if (!handle || acpi_bus_get_device(handle, &adev))
continue;
- acpi_handle_debug(adev->handle,
+ acpi_handle_debug(handle,
"LPI: required min power state:%s current power state:%s\n",
acpi_power_state_string(lpi_constraints_table[i].min_dstate),
acpi_power_state_string(adev->power.state));
if (!adev->flags.power_manageable) {
- acpi_handle_info(adev->handle, "LPI: Device not power manageble\n");
+ acpi_handle_info(handle, "LPI: Device not power manageable\n");
+ lpi_constraints_table[i].handle = NULL;
continue;
}
if (adev->power.state < lpi_constraints_table[i].min_dstate)
- acpi_handle_info(adev->handle,
+ acpi_handle_info(handle,
"LPI: Constraint not met; min power state:%s current power state:%s\n",
acpi_power_state_string(lpi_constraints_table[i].min_dstate),
acpi_power_state_string(adev->power.state));
@@ -951,15 +953,8 @@ static int acpi_s2idle_prepare(void)
if (lps0_device_handle) {
acpi_sleep_run_lps0_dsm(ACPI_LPS0_SCREEN_OFF);
acpi_sleep_run_lps0_dsm(ACPI_LPS0_ENTRY);
- } else {
- /*
- * The configuration of GPEs is changed here to avoid spurious
- * wakeups, but that should not be necessary if this is a
- * "low-power S0" platform and the low-power S0 _DSM is present.
- */
- acpi_enable_all_wakeup_gpes();
- acpi_os_wait_events_complete();
}
+
if (acpi_sci_irq_valid())
enable_irq_wake(acpi_sci_irq);
@@ -992,8 +987,9 @@ static void acpi_s2idle_sync(void)
* The EC driver uses the system workqueue and an additional special
* one, so those need to be flushed too.
*/
+ acpi_os_wait_events_complete(); /* synchronize SCI IRQ handling */
acpi_ec_flush_work();
- acpi_os_wait_events_complete();
+ acpi_os_wait_events_complete(); /* synchronize Notify handling */
s2idle_wakeup = false;
}
@@ -1005,8 +1001,6 @@ static void acpi_s2idle_restore(void)
if (lps0_device_handle) {
acpi_sleep_run_lps0_dsm(ACPI_LPS0_EXIT);
acpi_sleep_run_lps0_dsm(ACPI_LPS0_SCREEN_ON);
- } else {
- acpi_enable_all_runtime_gpes();
}
}

drivers/base/core.c

View file
diff --git a/drivers/base/core.c b/drivers/base/core.c
index 5847364..b610816 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -196,8 +196,10 @@ struct device_link *device_link_add(struct device *consumer,
}
list_for_each_entry(link, &supplier->links.consumers, s_node)
- if (link->consumer == consumer)
+ if (link->consumer == consumer) {
+ kref_get(&link->kref);
goto out;
+ }
link = kzalloc(sizeof(*link), GFP_KERNEL);
if (!link)
@@ -222,6 +224,7 @@ struct device_link *device_link_add(struct device *consumer,
link->consumer = consumer;
INIT_LIST_HEAD(&link->c_node);
link->flags = flags;
+ kref_init(&link->kref);
/* Determine the initial link state. */
if (flags & DL_FLAG_STATELESS) {
@@ -292,8 +295,10 @@ static void __device_link_free_srcu(struct rcu_head *rhead)
device_link_free(container_of(rhead, struct device_link, rcu_head));
}
-static void __device_link_del(struct device_link *link)
+static void __device_link_del(struct kref *kref)
{
+ struct device_link *link = container_of(kref, struct device_link, kref);
+
dev_info(link->consumer, "Dropping the link to %s\n",
dev_name(link->supplier));
@@ -305,8 +310,10 @@ static void __device_link_del(struct device_link *link)
call_srcu(&device_links_srcu, &link->rcu_head, __device_link_free_srcu);
}
#else /* !CONFIG_SRCU */
-static void __device_link_del(struct device_link *link)
+static void __device_link_del(struct kref *kref)
{
+ struct device_link *link = container_of(kref, struct device_link, kref);
+
dev_info(link->consumer, "Dropping the link to %s\n",
dev_name(link->supplier));
@@ -324,13 +331,15 @@ static void __device_link_del(struct device_link *link)
* @link: Device link to delete.
*
* The caller must ensure proper synchronization of this function with runtime
- * PM.
+ * PM. If the link was added multiple times, it needs to be deleted as often.
+ * Care is required for hotplugged devices: Their links are purged on removal
+ * and calling device_link_del() is then no longer allowed.
*/
void device_link_del(struct device_link *link)
{
device_links_write_lock();
device_pm_lock();
- __device_link_del(link);
+ kref_put(&link->kref, __device_link_del);
device_pm_unlock();
device_links_write_unlock();
}
@@ -444,7 +453,7 @@ static void __device_links_no_driver(struct device *dev)
continue;
if (link->flags & DL_FLAG_AUTOREMOVE)
- __device_link_del(link);
+ kref_put(&link->kref, __device_link_del);
else if (link->status != DL_STATE_SUPPLIER_UNBIND)
WRITE_ONCE(link->status, DL_STATE_AVAILABLE);
}
@@ -597,13 +606,13 @@ static void device_links_purge(struct device *dev)
list_for_each_entry_safe_reverse(link, ln, &dev->links.suppliers, c_node) {
WARN_ON(link->status == DL_STATE_ACTIVE);
- __device_link_del(link);
+ __device_link_del(&link->kref);
}
list_for_each_entry_safe_reverse(link, ln, &dev->links.consumers, s_node) {
WARN_ON(link->status != DL_STATE_DORMANT &&
link->status != DL_STATE_NONE);
- __device_link_del(link);
+ __device_link_del(&link->kref);
}
device_links_write_unlock();

drivers/base/power/power.h

View file
diff --git a/drivers/base/power/power.h b/drivers/base/power/power.h
index 21244c5..86e67e7 100644
--- a/drivers/base/power/power.h
+++ b/drivers/base/power/power.h
@@ -31,6 +31,7 @@ struct wake_irq {
struct device *dev;
unsigned int status;
int irq;
+ const char *name;
};
extern void dev_pm_arm_wake_irq(struct wake_irq *wirq);

drivers/base/power/wakeirq.c

View file
diff --git a/drivers/base/power/wakeirq.c b/drivers/base/power/wakeirq.c
index 6637fc3..b8fa5c0 100644
--- a/drivers/base/power/wakeirq.c
+++ b/drivers/base/power/wakeirq.c
@@ -112,6 +112,7 @@ void dev_pm_clear_wake_irq(struct device *dev)
free_irq(wirq->irq, wirq);
wirq->status &= ~WAKE_IRQ_DEDICATED_MASK;
}
+ kfree(wirq->name);
kfree(wirq);
}
EXPORT_SYMBOL_GPL(dev_pm_clear_wake_irq);
@@ -184,6 +185,12 @@ int dev_pm_set_dedicated_wake_irq(struct device *dev, int irq)
if (!wirq)
return -ENOMEM;
+ wirq->name = kasprintf(GFP_KERNEL, "%s:wakeup", dev_name(dev));
+ if (!wirq->name) {
+ err = -ENOMEM;
+ goto err_free;
+ }
+
wirq->dev = dev;
wirq->irq = irq;
irq_set_status_flags(irq, IRQ_NOAUTOEN);
@@ -196,9 +203,9 @@ int dev_pm_set_dedicated_wake_irq(struct device *dev, int irq)
* so we use a threaded irq.
*/
err = request_threaded_irq(irq, NULL, handle_threaded_wake_irq,
- IRQF_ONESHOT, dev_name(dev), wirq);
+ IRQF_ONESHOT, wirq->name, wirq);
if (err)
- goto err_free;
+ goto err_free_name;
err = dev_pm_attach_wake_irq(dev, irq, wirq);
if (err)
@@ -210,6 +217,8 @@ int dev_pm_set_dedicated_wake_irq(struct device *dev, int irq)
err_free_irq:
free_irq(irq, wirq);
+err_free_name:
+ kfree(wirq->name);
err_free:
kfree(wirq);

drivers/cpufreq/Kconfig.arm

View file
diff --git a/drivers/cpufreq/Kconfig.arm b/drivers/cpufreq/Kconfig.arm
index fb586e0..833b5f4 100644
--- a/drivers/cpufreq/Kconfig.arm
+++ b/drivers/cpufreq/Kconfig.arm
@@ -45,6 +45,7 @@ config ARM_DT_BL_CPUFREQ
config ARM_SCPI_CPUFREQ
tristate "SCPI based CPUfreq driver"
depends on ARM_SCPI_PROTOCOL && COMMON_CLK_SCPI
+ depends on !CPU_THERMAL || THERMAL
help
This adds the CPUfreq driver support for ARM platforms using SCPI
protocol for CPU power management.

drivers/cpufreq/acpi-cpufreq.c

View file
diff --git a/drivers/cpufreq/acpi-cpufreq.c b/drivers/cpufreq/acpi-cpufreq.c
index d0c34df..9449657 100644
--- a/drivers/cpufreq/acpi-cpufreq.c
+++ b/drivers/cpufreq/acpi-cpufreq.c
@@ -794,15 +794,9 @@ static int acpi_cpufreq_cpu_init(struct cpufreq_policy *policy)
valid_states++;
}
freq_table[valid_states].frequency = CPUFREQ_TABLE_END;
+ policy->freq_table = freq_table;
perf->state = 0;
- result = cpufreq_table_validate_and_show(policy, freq_table);
- if (result)
- goto err_freqfree;
-
- if (perf->states[0].core_frequency * 1000 != policy->cpuinfo.max_freq)
- pr_warn(FW_WARN "P-state 0 is not max freq\n");
-
switch (perf->control_register.space_id) {
case ACPI_ADR_SPACE_SYSTEM_IO:
/*
@@ -842,8 +836,6 @@ static int acpi_cpufreq_cpu_init(struct cpufreq_policy *policy)
return result;
-err_freqfree:
- kfree(freq_table);
err_unreg:
acpi_processor_unregister_performance(cpu);
err_free_mask:
@@ -871,6 +863,15 @@ static int acpi_cpufreq_cpu_exit(struct cpufreq_policy *policy)
return 0;
}
+static void acpi_cpufreq_cpu_ready(struct cpufreq_policy *policy)
+{
+ struct acpi_processor_performance *perf = per_cpu_ptr(acpi_perf_data,
+ policy->cpu);
+
+ if (perf->states[0].core_frequency * 1000 != policy->cpuinfo.max_freq)
+ pr_warn(FW_WARN "P-state 0 is not max freq\n");
+}
+
static int acpi_cpufreq_resume(struct cpufreq_policy *policy)
{
struct acpi_cpufreq_data *data = policy->driver_data;
@@ -898,6 +899,7 @@ static struct cpufreq_driver acpi_cpufreq_driver = {
.bios_limit = acpi_processor_get_bios_limit,
.init = acpi_cpufreq_cpu_init,
.exit = acpi_cpufreq_cpu_exit,
+ .ready = acpi_cpufreq_cpu_ready,
.resume = acpi_cpufreq_resume,
.name = "acpi-cpufreq",
.attr = acpi_cpufreq_attr,

drivers/cpufreq/arm_big_little.c

View file
diff --git a/drivers/cpufreq/arm_big_little.c b/drivers/cpufreq/arm_big_little.c
index c56b57d..1d7ef5f 100644
--- a/drivers/cpufreq/arm_big_little.c
+++ b/drivers/cpufreq/arm_big_little.c
@@ -483,14 +483,7 @@ static int bL_cpufreq_init(struct cpufreq_policy *policy)
if (ret)
return ret;
- ret = cpufreq_table_validate_and_show(policy, freq_table[cur_cluster]);
- if (ret) {
- dev_err(cpu_dev, "CPU %d, cluster: %d invalid freq table\n",
- policy->cpu, cur_cluster);
- put_cluster_clk_and_freq_table(cpu_dev, policy->cpus);
- return ret;
- }
-
+ policy->freq_table = freq_table[cur_cluster];
policy->cpuinfo.transition_latency =
arm_bL_ops->get_transition_latency(cpu_dev);

drivers/cpufreq/brcmstb-avs-cpufreq.c

View file
diff --git a/drivers/cpufreq/brcmstb-avs-cpufreq.c b/drivers/cpufreq/brcmstb-avs-cpufreq.c
index 7281a2c..6cdac1a 100644
--- a/drivers/cpufreq/brcmstb-avs-cpufreq.c
+++ b/drivers/cpufreq/brcmstb-avs-cpufreq.c
@@ -902,11 +902,7 @@ static int brcm_avs_cpufreq_init(struct cpufreq_policy *policy)
return ret;
}
- ret = cpufreq_table_validate_and_show(policy, freq_table);
- if (ret) {
- dev_err(dev, "invalid frequency table: %d\n", ret);
- return ret;
- }
+ policy->freq_table = freq_table;
/* All cores share the same clock and thus the same policy. */
cpumask_setall(policy->cpus);

drivers/cpufreq/cppc_cpufreq.c

View file
diff --git a/drivers/cpufreq/cppc_cpufreq.c b/drivers/cpufreq/cppc_cpufreq.c
index a1c3025..8300a9f 100644
--- a/drivers/cpufreq/cppc_cpufreq.c
+++ b/drivers/cpufreq/cppc_cpufreq.c
@@ -20,6 +20,7 @@
#include <linux/cpu.h>
#include <linux/cpufreq.h>
#include <linux/dmi.h>
+#include <linux/time.h>
#include <linux/vmalloc.h>
#include <asm/unaligned.h>
@@ -162,6 +163,8 @@ static int cppc_cpufreq_cpu_init(struct cpufreq_policy *policy)
policy->cpuinfo.max_freq = cppc_dmi_max_khz;
policy->cpuinfo.transition_latency = cppc_get_transition_latency(cpu_num);
+ policy->transition_delay_us = cppc_get_transition_latency(cpu_num) /
+ NSEC_PER_USEC;
policy->shared_type = cpu->shared_type;
if (policy->shared_type == CPUFREQ_SHARED_TYPE_ANY)
@@ -230,8 +233,13 @@ static int __init cppc_cpufreq_init(void)
return ret;
out:
- for_each_possible_cpu(i)
- kfree(all_cpu_data[i]);
+ for_each_possible_cpu(i) {
+ cpu = all_cpu_data[i];
+ if (!cpu)
+ break;
+ free_cpumask_var(cpu->shared_cpu_map);
+ kfree(cpu);
+ }
kfree(all_cpu_data);
return -ENODEV;

drivers/cpufreq/cpufreq-dt.c

View file
diff --git a/drivers/cpufreq/cpufreq-dt.c b/drivers/cpufreq/cpufreq-dt.c
index de3d104..190ea0d 100644
--- a/drivers/cpufreq/cpufreq-dt.c
+++ b/drivers/cpufreq/cpufreq-dt.c
@@ -258,16 +258,10 @@ static int cpufreq_init(struct cpufreq_policy *policy)
priv->cpu_dev = cpu_dev;
policy->driver_data = priv;
policy->clk = cpu_clk;
+ policy->freq_table = freq_table;
policy->suspend_freq = dev_pm_opp_get_suspend_opp_freq(cpu_dev) / 1000;
- ret = cpufreq_table_validate_and_show(policy, freq_table);
- if (ret) {
- dev_err(cpu_dev, "%s: invalid frequency table: %d\n", __func__,
- ret);
- goto out_free_cpufreq_table;
- }
-
/* Support turbo/boost mode */
if (policy_has_boost_freq(policy)) {
/* This gets disabled by core on driver unregister */

drivers/cpufreq/cpufreq.c

View file
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index de33ebf..075d18f 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -178,14 +178,7 @@ int cpufreq_generic_init(struct cpufreq_policy *policy,
struct cpufreq_frequency_table *table,
unsigned int transition_latency)
{
- int ret;
-
- ret = cpufreq_table_validate_and_show(policy, table);
- if (ret) {
- pr_err("%s: invalid frequency table: %d\n", __func__, ret);
- return ret;
- }
-
+ policy->freq_table = table;
policy->cpuinfo.transition_latency = transition_latency;
/*
@@ -1219,6 +1212,10 @@ static int cpufreq_online(unsigned int cpu)
goto out_free_policy;
}
+ ret = cpufreq_table_validate_and_sort(policy);
+ if (ret)
+ goto out_exit_policy;
+
down_write(&policy->rwsem);
if (new_policy) {
@@ -1249,7 +1246,7 @@ static int cpufreq_online(unsigned int cpu)
policy->cur = cpufreq_driver->get(policy->cpu);
if (!policy->cur) {
pr_err("%s: ->get() failed\n", __func__);
- goto out_exit_policy;
+ goto out_destroy_policy;
}
}
@@ -1296,7 +1293,7 @@ static int cpufreq_online(unsigned int cpu)
if (new_policy) {
ret = cpufreq_add_dev_interface(policy);
if (ret)

This diff is incomplete. Download the complete patch.

drivers/cpufreq/e_powersaver.c

View file

This diff is incomplete. Download the complete patch.

drivers/cpufreq/elanfreq.c

View file

This diff is incomplete. Download the complete patch.

drivers/cpufreq/freq_table.c

View file

This diff is incomplete. Download the complete patch.

drivers/cpufreq/ia64-acpi-cpufreq.c

View file

This diff is incomplete. Download the complete patch.

drivers/cpufreq/imx6q-cpufreq.c

View file

This diff is incomplete. Download the complete patch.

drivers/cpufreq/longhaul.c

View file

This diff is incomplete. Download the complete patch.

drivers/cpufreq/mediatek-cpufreq.c

View file

This diff is incomplete. Download the complete patch.

drivers/cpufreq/p4-clockmod.c

View file

This diff is incomplete. Download the complete patch.

drivers/cpufreq/powernow-k6.c

View file

This diff is incomplete. Download the complete patch.

drivers/cpufreq/powernow-k7.c

View file

This diff is incomplete. Download the complete patch.

drivers/cpufreq/powernow-k8.c

View file

This diff is incomplete. Download the complete patch.

drivers/cpufreq/powernv-cpufreq.c

View file

This diff is incomplete. Download the complete patch.

drivers/cpufreq/ppc_cbe_cpufreq.c

View file

This diff is incomplete. Download the complete patch.

drivers/cpufreq/pxa2xx-cpufreq.c

View file

This diff is incomplete. Download the complete patch.

drivers/cpufreq/pxa3xx-cpufreq.c

View file

This diff is incomplete. Download the complete patch.

drivers/cpufreq/qoriq-cpufreq.c

View file

This diff is incomplete. Download the complete patch.

drivers/cpufreq/s3c24xx-cpufreq.c

View file

This diff is incomplete. Download the complete patch.

drivers/cpufreq/sc520_freq.c

View file

This diff is incomplete. Download the complete patch.

drivers/cpufreq/scpi-cpufreq.c

View file

This diff is incomplete. Download the complete patch.

drivers/cpufreq/sfi-cpufreq.c

View file

This diff is incomplete. Download the complete patch.

drivers/cpufreq/sh-cpufreq.c

View file

This diff is incomplete. Download the complete patch.

drivers/cpufreq/sparc-us2e-cpufreq.c

View file

This diff is incomplete. Download the complete patch.

drivers/cpufreq/sparc-us3-cpufreq.c

View file

This diff is incomplete. Download the complete patch.

drivers/cpufreq/speedstep-centrino.c

View file

This diff is incomplete. Download the complete patch.

drivers/cpufreq/speedstep-ich.c

View file

This diff is incomplete. Download the complete patch.

drivers/cpufreq/speedstep-smi.c

View file

This diff is incomplete. Download the complete patch.

drivers/cpufreq/tegra186-cpufreq.c

View file

This diff is incomplete. Download the complete patch.

drivers/cpuidle/cpuidle-arm.c

View file

This diff is incomplete. Download the complete patch.

drivers/cpuidle/cpuidle-exynos.c

View file

This diff is incomplete. Download the complete patch.

drivers/cpuidle/cpuidle.c

View file

This diff is incomplete. Download the complete patch.

drivers/cpuidle/poll_state.c

View file

This diff is incomplete. Download the complete patch.

drivers/cpuidle/sysfs.c

View file

This diff is incomplete. Download the complete patch.

drivers/pcmcia/cs.c

View file

This diff is incomplete. Download the complete patch.

drivers/pcmcia/cs_internal.h

View file

This diff is incomplete. Download the complete patch.

drivers/powercap/intel_rapl.c

View file

This diff is incomplete. Download the complete patch.

include/linux/cpufreq.h

View file

This diff is incomplete. Download the complete patch.

include/linux/cpuidle.h

View file

This diff is incomplete. Download the complete patch.

include/linux/device.h

View file

This diff is incomplete. Download the complete patch.

kernel/power/hibernate.c

View file

This diff is incomplete. Download the complete patch.

tools/power/pm-graph/Makefile

View file

This diff is incomplete. Download the complete patch.

tools/power/pm-graph/bootgraph.8

View file

This diff is incomplete. Download the complete patch.

tools/power/pm-graph/bootgraph.py

View file

This diff is incomplete. Download the complete patch.

tools/power/pm-graph/config/cgskip.txt

View file

This diff is incomplete. Download the complete patch.

tools/power/pm-graph/config/custom-timeline-functions.cfg

View file

This diff is incomplete. Download the complete patch.

tools/power/pm-graph/config/example.cfg

View file

This diff is incomplete. Download the complete patch.

tools/power/pm-graph/config/freeze-callgraph.cfg

View file

This diff is incomplete. Download the complete patch.

tools/power/pm-graph/config/freeze-dev.cfg

View file

This diff is incomplete. Download the complete patch.

tools/power/pm-graph/config/freeze.cfg

View file

This diff is incomplete. Download the complete patch.

tools/power/pm-graph/config/standby-callgraph.cfg

View file

This diff is incomplete. Download the complete patch.

tools/power/pm-graph/config/standby-dev.cfg

View file

This diff is incomplete. Download the complete patch.

tools/power/pm-graph/config/standby.cfg

View file

This diff is incomplete. Download the complete patch.

tools/power/pm-graph/config/suspend-callgraph.cfg

View file

This diff is incomplete. Download the complete patch.

tools/power/pm-graph/config/suspend-dev.cfg

View file

This diff is incomplete. Download the complete patch.

tools/power/pm-graph/config/suspend-x2-proc.cfg

View file

This diff is incomplete. Download the complete patch.

tools/power/pm-graph/config/suspend.cfg

View file

This diff is incomplete. Download the complete patch.

tools/power/pm-graph/sleepgraph.8

View file

This diff is incomplete. Download the complete patch.

tools/power/pm-graph/sleepgraph.py

View file

This diff is incomplete. Download the complete patch.