]> Pileus Git - ~andy/linux/commitdiff
Merge tag 'for_3.7-fixes-cpufreq' of git://git.kernel.org/pub/scm/linux/kernel/git...
authorTony Lindgren <tony@atomide.com>
Mon, 8 Oct 2012 22:54:14 +0000 (15:54 -0700)
committerTony Lindgren <tony@atomide.com>
Mon, 8 Oct 2012 22:54:14 +0000 (15:54 -0700)
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 16642a2e7be23bbda013fc32d8f6c68982eab603.

arch/arm/mach-omap2/opp.c
arch/arm/mach-omap2/pm.c
arch/arm/mach-omap2/twl-common.c
drivers/cpufreq/omap-cpufreq.c

index 45ad7f74f35624fd564d7cf1325dc3edb983d8a1..58e16aef40bbd92f73ea631ce2e777028ddfaf53 100644 (file)
@@ -18,6 +18,7 @@
  */
 #include <linux/module.h>
 #include <linux/opp.h>
+#include <linux/cpu.h>
 
 #include <plat/omap_device.h>
 
@@ -62,13 +63,23 @@ int __init omap_init_opp_table(struct omap_opp_def *opp_def,
                                __func__, i);
                        return -EINVAL;
                }
-               oh = omap_hwmod_lookup(opp_def->hwmod_name);
-               if (!oh || !oh->od) {
-                       pr_debug("%s: no hwmod or odev for %s, [%d] cannot add OPPs.\n",
-                                __func__, opp_def->hwmod_name, i);
-                       continue;
+
+               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);
+                       if (!oh || !oh->od) {
+                               pr_debug("%s: no hwmod or odev for %s, [%d] cannot add OPPs.\n",
+                                        __func__, opp_def->hwmod_name, i);
+                               continue;
+                       }
+                       dev = &oh->od->pdev->dev;
                }
-               dev = &oh->od->pdev->dev;
 
                r = opp_add(dev, opp_def->freq, opp_def->u_volt);
                if (r) {
index abefbc4d8e0b9bd452c54af22d3a09e7cd172af9..fbe31313d7eb5ae8140db95d099cbe2a17bc1c0b 100644 (file)
@@ -16,6 +16,7 @@
 #include <linux/opp.h>
 #include <linux/export.h>
 #include <linux/suspend.h>
+#include <linux/cpu.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;
        }
 
-       dev = omap_device_get_by_hwmod_name(oh_name);
+       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);
+
        if (IS_ERR(dev)) {
                pr_err("%s: Unable to get dev pointer for hwmod %s\n",
                        __func__, oh_name);
index 45f77413c21d10b70074ade36b984031eb8c05c5..3f5eaccf6d8f464be777c9c7b75a99a2d95e90bc 100644 (file)
@@ -158,7 +158,7 @@ static struct regulator_init_data omap3_vpll2_idata = {
 };
 
 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[] = {
index 65f8e9a54975e8274c9de6403718f5ff39ee2e85..1f3417a8322dfe8b0ca773873e058f7eb3a6c283 100644 (file)
 #include <asm/smp_plat.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 */
 #define        OPP_TOLERANCE   4
 
 static struct cpufreq_frequency_table *freq_table;
 static atomic_t freq_table_users = ATOMIC_INIT(0);
 static struct clk *mpu_clk;
-static char *mpu_clk_name;
 static struct device *mpu_dev;
 static struct regulator *mpu_reg;
 
@@ -108,6 +100,14 @@ static int omap_target(struct cpufreq_policy *policy,
        }
 
        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) {
                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;
 
-       mpu_clk = clk_get(NULL, mpu_clk_name);
+       mpu_clk = clk_get(NULL, "cpufreq_ck");
        if (IS_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)
 {
-       if (cpu_is_omap24xx())
-               mpu_clk_name = "virt_prcm_set";
-       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)) {
+       mpu_dev = get_cpu_device(0);
+       if (!mpu_dev) {
                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");