Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a051c14b authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull more power management updates from Rafael Wysocki:
 "These are mostly fixes and cleanups and removal of the no longer
  needed at32ap-cpufreq driver.

  Specifics:

   - Drop the at32ap-cpufreq driver which is useless after the removal
     of the corresponding arch (Corentin LABBE).

   - Fix a regression from the 4.14 cycle in the APM idle driver by
     making it initialize the polling state properly (Rafael Wysocki).

   - Fix a crash on failing system suspend due to a missing check in the
     cpufreq core (Bo Yan).

   - Make the intel_pstate driver initialize the hardware-managed
     P-state control (HWP) feature on CPU0 upon resume from system
     suspend if HWP had been enabled before the system was suspended
     (Chen Yu).

   - Fix up the SCPI cpufreq driver after recent changes (Sudeep Holla,
     Wei Yongjun).

   - Avoid pointer subtractions during frequency table walks in cpufreq
     (Dominik Brodowski).

   - Avoid the check for ProcFeedback in ST/CZ in the cpufreq driver for
     AMD processors and add a MODULE_ALIAS for cpufreq on ARM IMX (Akshu
     Agrawal, Nicolas Chauvet).

   - Fix the prototype of swsusp_arch_resume() on x86 (Arnd Bergmann).

   - Fix up the parsing of power domains DT data (Ulf Hansson)"

* tag 'pm-part2-4.16-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
  arm: imx: Add MODULE_ALIAS for cpufreq
  cpufreq: Add and use cpufreq_for_each_{valid_,}entry_idx()
  cpufreq: intel_pstate: Enable HWP during system resume on CPU0
  cpufreq: scpi: fix error return code in scpi_cpufreq_init()
  x86: hibernate: fix swsusp_arch_resume() prototype
  PM / domains: Fix up domain-idle-states OF parsing
  cpufreq: scpi: fix static checker warning cdev isn't an ERR_PTR
  cpufreq: remove at32ap-cpufreq
  cpufreq: AMD: Ignore the check for ProcFeedback in ST/CZ
  x86: PM: Make APM idle driver initialize polling state
  cpufreq: Skip cpufreq resume if it's not suspended
parents f1517df8 616f1609
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -291,3 +291,7 @@ For example:
		/* Do something with pos */
		pos->frequency = ...
	}

If you need to work with the position of pos within driver_freq_table,
do not subtract the pointers, as it is quite costly. Instead, use the
macros cpufreq_for_each_entry_idx() and cpufreq_for_each_valid_entry_idx().
+1 −0
Original line number Diff line number Diff line
@@ -2389,6 +2389,7 @@ static int __init apm_init(void)
	if (HZ != 100)
		idle_period = (idle_period * HZ) / 100;
	if (idle_threshold < 100) {
		cpuidle_poll_state_init(&apm_idle_driver);
		if (!cpuidle_register_driver(&apm_idle_driver))
			if (cpuidle_register_device(&apm_cpuidle_device))
				cpuidle_unregister_driver(&apm_idle_driver);
+45 −31
Original line number Diff line number Diff line
@@ -2290,6 +2290,38 @@ static int genpd_parse_state(struct genpd_power_state *genpd_state,
	return 0;
}

static int genpd_iterate_idle_states(struct device_node *dn,
				     struct genpd_power_state *states)
{
	int ret;
	struct of_phandle_iterator it;
	struct device_node *np;
	int i = 0;

	ret = of_count_phandle_with_args(dn, "domain-idle-states", NULL);
	if (ret <= 0)
		return ret;

	/* Loop over the phandles until all the requested entry is found */
	of_for_each_phandle(&it, ret, dn, "domain-idle-states", NULL, 0) {
		np = it.node;
		if (!of_match_node(idle_state_match, np))
			continue;
		if (states) {
			ret = genpd_parse_state(&states[i], np);
			if (ret) {
				pr_err("Parsing idle state node %pOF failed with err %d\n",
				       np, ret);
				of_node_put(np);
				return ret;
			}
		}
		i++;
	}

	return i;
}

/**
 * of_genpd_parse_idle_states: Return array of idle states for the genpd.
 *
@@ -2299,49 +2331,31 @@ static int genpd_parse_state(struct genpd_power_state *genpd_state,
 *
 * Returns the device states parsed from the OF node. The memory for the states
 * is allocated by this function and is the responsibility of the caller to
 * free the memory after use.
 * free the memory after use. If no domain idle states is found it returns
 * -EINVAL and in case of errors, a negative error code.
 */
int of_genpd_parse_idle_states(struct device_node *dn,
			struct genpd_power_state **states, int *n)
{
	struct genpd_power_state *st;
	struct device_node *np;
	int i = 0;
	int err, ret;
	int count;
	struct of_phandle_iterator it;
	const struct of_device_id *match_id;
	int ret;

	count = of_count_phandle_with_args(dn, "domain-idle-states", NULL);
	if (count <= 0)
		return -EINVAL;
	ret = genpd_iterate_idle_states(dn, NULL);
	if (ret <= 0)
		return ret < 0 ? ret : -EINVAL;

	st = kcalloc(count, sizeof(*st), GFP_KERNEL);
	st = kcalloc(ret, sizeof(*st), GFP_KERNEL);
	if (!st)
		return -ENOMEM;

	/* Loop over the phandles until all the requested entry is found */
	of_for_each_phandle(&it, err, dn, "domain-idle-states", NULL, 0) {
		np = it.node;
		match_id = of_match_node(idle_state_match, np);
		if (!match_id)
			continue;
		ret = genpd_parse_state(&st[i++], np);
		if (ret) {
			pr_err
			("Parsing idle state node %pOF failed with err %d\n",
							np, ret);
			of_node_put(np);
	ret = genpd_iterate_idle_states(dn, st);
	if (ret <= 0) {
		kfree(st);
			return ret;
		}
		return ret < 0 ? ret : -EINVAL;
	}

	*n = i;
	if (!i)
		kfree(st);
	else
	*states = st;
	*n = ret;

	return 0;
}
+0 −10
Original line number Diff line number Diff line
@@ -239,16 +239,6 @@ if PPC32 || PPC64
source "drivers/cpufreq/Kconfig.powerpc"
endif

if AVR32
config AVR32_AT32AP_CPUFREQ
	bool "CPU frequency driver for AT32AP"
	depends on PLATFORM_AT32AP
	default n
	help
	  This enables the CPU frequency driver for AT32AP processors.
	  If in doubt, say N.
endif

if IA64
config IA64_ACPI_CPUFREQ
	tristate "ACPI Processor P-States driver"
+0 −1
Original line number Diff line number Diff line
@@ -100,7 +100,6 @@ obj-$(CONFIG_POWERNV_CPUFREQ) += powernv-cpufreq.o

##################################################################################
# Other platform drivers
obj-$(CONFIG_AVR32_AT32AP_CPUFREQ)	+= at32ap-cpufreq.o
obj-$(CONFIG_BFIN_CPU_FREQ)		+= blackfin-cpufreq.o
obj-$(CONFIG_BMIPS_CPUFREQ)		+= bmips-cpufreq.o
obj-$(CONFIG_CRIS_MACH_ARTPEC3)		+= cris-artpec3-cpufreq.o
Loading