Commit 4419fbd4 authored by Rafael J. Wysocki's avatar Rafael J. Wysocki
Browse files

Merge branch 'pm-cpufreq'

* pm-cpufreq: (55 commits)
  cpufreq / intel_pstate: Fix 32 bit build
  cpufreq: conservative: Fix typos in comments
  cpufreq: ondemand: Fix typos in comments
  cpufreq: exynos: simplify .init() for setting policy->cpus
  cpufreq: kirkwood: Add a cpufreq driver for Marvell Kirkwood SoCs
  cpufreq/x86: Add P-state driver for sandy bridge.
  cpufreq_stats: do not remove sysfs files if frequency table is not present
  cpufreq: Do not track governor name for scaling drivers with internal governors.
  cpufreq: Only call cpufreq_out_of_sync() for driver that implement cpufreq_driver.target()
  cpufreq: Retrieve current frequency from scaling drivers with internal governors
  cpufreq: Fix locking issues
  cpufreq: Create a macro for unlock_policy_rwsem{read,write}
  cpufreq: Remove unused HOTPLUG_CPU code
  cpufreq: governors: Fix WARN_ON() for multi-policy platforms
  cpufreq: ondemand: Replace down_differential tuner with adj_up_threshold
  cpufreq / stats: Get rid of CPUFREQ_STATDEVICE_ATTR
  cpufreq: Don't check cpu_online(policy->cpu)
  cpufreq: add imx6q-cpufreq driver
  cpufreq: Don't remove sysfs link for policy->cpu
  cpufreq: Remove unnecessary use of policy->shared_type
  ...
parents 95ecb407 191e5edf
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -111,6 +111,12 @@ policy->governor must contain the "default policy" for
For setting some of these values, the frequency table helpers might be
helpful. See the section 2 for more information on them.

SMP systems normally have same clock source for a group of cpus. For these the
.init() would be called only once for the first online cpu. Here the .init()
routine must initialize policy->cpus with mask of all possible cpus (Online +
Offline) that share the clock. Then the core would copy this mask onto
policy->related_cpus and will reset policy->cpus to carry only online cpus.


1.3 verify
------------
+4 −4
Original line number Diff line number Diff line
@@ -190,11 +190,11 @@ scaling_max_freq show the current "policy limits" (in
				first set scaling_max_freq, then
				scaling_min_freq.

affected_cpus :			List of CPUs that require software coordination
				of frequency.
affected_cpus :			List of Online CPUs that require software
				coordination of frequency.

related_cpus :			List of CPUs that need some sort of frequency
				coordination, whether software or hardware.
related_cpus :			List of Online + Offline CPUs that need software
				coordination of frequency.

scaling_driver :		Hardware driver for cpufreq.

+27 −0
Original line number Diff line number Diff line
Marvell Kirkwood Platforms Device Tree Bindings
-----------------------------------------------

Boards with a SoC of the Marvell Kirkwood
shall have the following property:

Required root node property:

compatible: must contain "marvell,kirkwood";

In order to support the kirkwood cpufreq driver, there must be a node
cpus/cpu@0 with three clocks, "cpu_clk", "ddrclk" and "powersave",
where the "powersave" clock is a gating clock used to switch the CPU
between the "cpu_clk" and the "ddrclk".

Example:

	cpus {
		#address-cells = <1>;
		#size-cells = <0>;

		cpu@0 {
		      device_type = "cpu";
		      compatible = "marvell,sheeva-88SV131";
		      clocks = <&core_clk 1>, <&core_clk 3>, <&gate_clk 11>;
		      clock-names = "cpu_clk", "ddrclk", "powersave";
		};
+10 −0
Original line number Diff line number Diff line
@@ -37,6 +37,16 @@
			next-level-cache = <&L2>;
			clocks = <&a9pll>;
			clock-names = "cpu";
			operating-points = <
				/* kHz    ignored */
				 1300000  1000000
				 1200000  1000000
				 1100000  1000000
				  800000  1000000
				  400000  1000000
				  200000  1000000
			>;
			clock-latency = <100000>;
		};

		cpu@901 {
+19 −34
Original line number Diff line number Diff line
@@ -31,7 +31,6 @@ static void __iomem *twd_base;

static struct clk *twd_clk;
static unsigned long twd_timer_rate;
static bool common_setup_called;
static DEFINE_PER_CPU(bool, percpu_setup_called);

static struct clock_event_device __percpu **twd_evt;
@@ -239,25 +238,28 @@ static irqreturn_t twd_handler(int irq, void *dev_id)
	return IRQ_NONE;
}

static struct clk *twd_get_clock(void)
static void twd_get_clock(struct device_node *np)
{
	struct clk *clk;
	int err;

	clk = clk_get_sys("smp_twd", NULL);
	if (IS_ERR(clk)) {
		pr_err("smp_twd: clock not found: %d\n", (int)PTR_ERR(clk));
		return clk;
	if (np)
		twd_clk = of_clk_get(np, 0);
	else
		twd_clk = clk_get_sys("smp_twd", NULL);

	if (IS_ERR(twd_clk)) {
		pr_err("smp_twd: clock not found %d\n", (int) PTR_ERR(twd_clk));
		return;
	}

	err = clk_prepare_enable(clk);
	err = clk_prepare_enable(twd_clk);
	if (err) {
		pr_err("smp_twd: clock failed to prepare+enable: %d\n", err);
		clk_put(clk);
		return ERR_PTR(err);
		clk_put(twd_clk);
		return;
	}

	return clk;
	twd_timer_rate = clk_get_rate(twd_clk);
}

/*
@@ -280,27 +282,8 @@ static int __cpuinit twd_timer_setup(struct clock_event_device *clk)
	}
	per_cpu(percpu_setup_called, cpu) = true;

	/*
	 * This stuff only need to be done once for the entire TWD cluster
	 * during the runtime of the system.
	 */
	if (!common_setup_called) {
		twd_clk = twd_get_clock();

		/*
		 * We use IS_ERR_OR_NULL() here, because if the clock stubs
		 * are active we will get a valid clk reference which is
		 * however NULL and will return the rate 0. In that case we
		 * need to calibrate the rate instead.
		 */
		if (!IS_ERR_OR_NULL(twd_clk))
			twd_timer_rate = clk_get_rate(twd_clk);
		else
	twd_calibrate_rate();

		common_setup_called = true;
	}

	/*
	 * The following is done once per CPU the first time .setup() is
	 * called.
@@ -330,7 +313,7 @@ static struct local_timer_ops twd_lt_ops __cpuinitdata = {
	.stop	= twd_timer_stop,
};

static int __init twd_local_timer_common_register(void)
static int __init twd_local_timer_common_register(struct device_node *np)
{
	int err;

@@ -350,6 +333,8 @@ static int __init twd_local_timer_common_register(void)
	if (err)
		goto out_irq;

	twd_get_clock(np);

	return 0;

out_irq:
@@ -373,7 +358,7 @@ int __init twd_local_timer_register(struct twd_local_timer *tlt)
	if (!twd_base)
		return -ENOMEM;

	return twd_local_timer_common_register();
	return twd_local_timer_common_register(NULL);
}

#ifdef CONFIG_OF
@@ -405,7 +390,7 @@ void __init twd_local_timer_of_register(void)
		goto out;
	}

	err = twd_local_timer_common_register();
	err = twd_local_timer_common_register(np);

out:
	WARN(err, "twd_local_timer_of_register failed (%d)\n", err);
Loading