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

Commit 37fedb4c authored by Tony Lindgren's avatar Tony Lindgren
Browse files

Merge tag 'for_3.7-fixes-cpufreq' of...

Merge tag 'for_3.7-fixes-cpufreq' of git://git.kernel.org/pub/scm/linux/kernel/git/khilman/linux-omap-pm into omap-for-v3.7-rc1/fixes-cpufreq

This series a couple bug fixes and a couple fixes that make this
driver support recently added OMAP-based SoCs.

The 'get_cpu_device' patch is needed due to a change in the OMAP
OMAP PM core code which enforces use of get_cpu_device() instead of
a deprecated OMAP-specific API.

The usage of plat/*.h headers breaks single zImage, so platforms are
cleaning up and/or removing plat/*.h so the driver needs to be fixed
accordingly.

This series is based on the merge of Rafael's pm-for-3.7-rc1 tag into
Linus' master branch: commit 16642a2e.
parents 5e090ed7 24d7b40a
Loading
Loading
Loading
Loading
+17 −6
Original line number Original line Diff line number Diff line
@@ -18,6 +18,7 @@
 */
 */
#include <linux/module.h>
#include <linux/module.h>
#include <linux/opp.h>
#include <linux/opp.h>
#include <linux/cpu.h>


#include <plat/omap_device.h>
#include <plat/omap_device.h>


@@ -62,6 +63,15 @@ int __init omap_init_opp_table(struct omap_opp_def *opp_def,
				__func__, i);
				__func__, i);
			return -EINVAL;
			return -EINVAL;
		}
		}

		if (!strncmp(opp_def->hwmod_name, "mpu", 3)) {
			/* 
			 * All current OMAPs share voltage rail and
			 * clock source, so CPU0 is used to represent
			 * the MPU-SS.
			 */
			dev = get_cpu_device(0);
		} else {
			oh = omap_hwmod_lookup(opp_def->hwmod_name);
			oh = omap_hwmod_lookup(opp_def->hwmod_name);
			if (!oh || !oh->od) {
			if (!oh || !oh->od) {
				pr_debug("%s: no hwmod or odev for %s, [%d] cannot add OPPs.\n",
				pr_debug("%s: no hwmod or odev for %s, [%d] cannot add OPPs.\n",
@@ -69,6 +79,7 @@ int __init omap_init_opp_table(struct omap_opp_def *opp_def,
				continue;
				continue;
			}
			}
			dev = &oh->od->pdev->dev;
			dev = &oh->od->pdev->dev;
		}


		r = opp_add(dev, opp_def->freq, opp_def->u_volt);
		r = opp_add(dev, opp_def->freq, opp_def->u_volt);
		if (r) {
		if (r) {
+10 −1
Original line number Original line Diff line number Diff line
@@ -16,6 +16,7 @@
#include <linux/opp.h>
#include <linux/opp.h>
#include <linux/export.h>
#include <linux/export.h>
#include <linux/suspend.h>
#include <linux/suspend.h>
#include <linux/cpu.h>


#include <asm/system_misc.h>
#include <asm/system_misc.h>


@@ -169,7 +170,15 @@ static int __init omap2_set_init_voltage(char *vdd_name, char *clk_name,
		goto exit;
		goto exit;
	}
	}


	if (!strncmp(oh_name, "mpu", 3))
		/* 
		 * All current OMAPs share voltage rail and clock
		 * source, so CPU0 is used to represent the MPU-SS.
		 */
		dev = get_cpu_device(0);
	else
		dev = omap_device_get_by_hwmod_name(oh_name);
		dev = omap_device_get_by_hwmod_name(oh_name);

	if (IS_ERR(dev)) {
	if (IS_ERR(dev)) {
		pr_err("%s: Unable to get dev pointer for hwmod %s\n",
		pr_err("%s: Unable to get dev pointer for hwmod %s\n",
			__func__, oh_name);
			__func__, oh_name);
+1 −1
Original line number Original line Diff line number Diff line
@@ -158,7 +158,7 @@ static struct regulator_init_data omap3_vpll2_idata = {
};
};


static struct regulator_consumer_supply omap3_vdd1_supply[] = {
static struct regulator_consumer_supply omap3_vdd1_supply[] = {
	REGULATOR_SUPPLY("vcc", "mpu.0"),
	REGULATOR_SUPPLY("vcc", "cpu0"),
};
};


static struct regulator_consumer_supply omap3_vdd2_supply[] = {
static struct regulator_consumer_supply omap3_vdd2_supply[] = {
+12 −24
Original line number Original line Diff line number Diff line
@@ -30,20 +30,12 @@
#include <asm/smp_plat.h>
#include <asm/smp_plat.h>
#include <asm/cpu.h>
#include <asm/cpu.h>


#include <plat/clock.h>
#include <plat/omap-pm.h>
#include <plat/common.h>
#include <plat/omap_device.h>

#include <mach/hardware.h>

/* OPP tolerance in percentage */
/* OPP tolerance in percentage */
#define	OPP_TOLERANCE	4
#define	OPP_TOLERANCE	4


static struct cpufreq_frequency_table *freq_table;
static struct cpufreq_frequency_table *freq_table;
static atomic_t freq_table_users = ATOMIC_INIT(0);
static atomic_t freq_table_users = ATOMIC_INIT(0);
static struct clk *mpu_clk;
static struct clk *mpu_clk;
static char *mpu_clk_name;
static struct device *mpu_dev;
static struct device *mpu_dev;
static struct regulator *mpu_reg;
static struct regulator *mpu_reg;


@@ -108,6 +100,14 @@ static int omap_target(struct cpufreq_policy *policy,
	}
	}


	freq = freqs.new * 1000;
	freq = freqs.new * 1000;
	ret = clk_round_rate(mpu_clk, freq);
	if (IS_ERR_VALUE(ret)) {
		dev_warn(mpu_dev,
			 "CPUfreq: Cannot find matching frequency for %lu\n",
			 freq);
		return ret;
	}
	freq = ret;


	if (mpu_reg) {
	if (mpu_reg) {
		opp = opp_find_freq_ceil(mpu_dev, &freq);
		opp = opp_find_freq_ceil(mpu_dev, &freq);
@@ -172,7 +172,7 @@ static int __cpuinit omap_cpu_init(struct cpufreq_policy *policy)
{
{
	int result = 0;
	int result = 0;


	mpu_clk = clk_get(NULL, mpu_clk_name);
	mpu_clk = clk_get(NULL, "cpufreq_ck");
	if (IS_ERR(mpu_clk))
	if (IS_ERR(mpu_clk))
		return PTR_ERR(mpu_clk);
		return PTR_ERR(mpu_clk);


@@ -253,22 +253,10 @@ static struct cpufreq_driver omap_driver = {


static int __init omap_cpufreq_init(void)
static int __init omap_cpufreq_init(void)
{
{
	if (cpu_is_omap24xx())
	mpu_dev = get_cpu_device(0);
		mpu_clk_name = "virt_prcm_set";
	if (!mpu_dev) {
	else if (cpu_is_omap34xx())
		mpu_clk_name = "dpll1_ck";
	else if (cpu_is_omap44xx())
		mpu_clk_name = "dpll_mpu_ck";

	if (!mpu_clk_name) {
		pr_err("%s: unsupported Silicon?\n", __func__);
		return -EINVAL;
	}

	mpu_dev = omap_device_get_by_hwmod_name("mpu");
	if (IS_ERR(mpu_dev)) {
		pr_warning("%s: unable to get the mpu device\n", __func__);
		pr_warning("%s: unable to get the mpu device\n", __func__);
		return PTR_ERR(mpu_dev);
		return -EINVAL;
	}
	}


	mpu_reg = regulator_get(mpu_dev, "vcc");
	mpu_reg = regulator_get(mpu_dev, "vcc");