mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 11:41:38 -04:00
The common clock framework changes for 3.8 are comprised of lots of
fixes for existing platforms as well as new ports for some ARM platforms. In addition there are new clk drivers for audio devices and MFDs. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) iQIcBAABAgAGBQJQxtdeAAoJEDqPOy9afJhJwzUP/2/oaBAGXakQf+TTOsRo2IMh ejwgOxFsBcspR0OrJ73TAPDqbgY3xZ+BeVdvbIiYikcZLqT9dZsoN7oa9udcu6aL 1OxBT6F/CFnxUR4EVkpUdQ+vVIR8svxsAAv71zvaVGCeie0D7MDL2JgK8TvgRxHF DKxFYJ935CJC64JHJBYhW/1b4T/Tt94z/nYMijcQxkjmpEimTm/qLHpbK6OCQFUU fmvs3VmSA4p7hBmgXu3zp6NkOF3JJa7NWb+3kJh1UmqM7xh/CijxZP2YHhLkIdU1 g2qhYVKIIxmAFa7xJjXY05VrjMKvAkXGNJGVwCFQHnP17By4Pni3BDsQ+61u30Nj B/bIRrzAC17EOh6c6pAZIbNLTHHaQGe0XQMDuHGsjgmVpn2CTRmIduEVJPiq9wAk lNkwqh6Dftq72Xepy1RieqFuDOO8kHSsOPqS2e9A9yDuh5bzLsKlhKWKUahhxrML TnRBd7NfwctoEsKy42HtrXA2+iQsQDmHXNlec3ARNgWS3Hhre7qb1d0Q00y28OTA RWyPoxOn1O+wQsV2cu3I1LKVo9CmNU55evHG5zSDPIA3GsrMcPZmP/4KM9Vbs3Ye 5BIMtptUrOeZQ2PRxcTHnCbWvch5bQyvDkDiK/xR7XsiQIheE/0Ak8wGgVZ7TW4d 0zLm7UmmkmFu4xTwf2Nk =GoXf -----END PGP SIGNATURE----- Merge tag 'clk-for-linus' of git://git.linaro.org/people/mturquette/linux Pull clock framework changes from Mike Turquette: "The common clock framework changes for 3.8 are comprised of lots of fixes for existing platforms as well as new ports for some ARM platforms. In addition there are new clk drivers for audio devices and MFDs." Fix up trivial conflict in <linux/clk-provider.h> (removal of 'inline' clashing with return type fixes) * tag 'clk-for-linus' of git://git.linaro.org/people/mturquette/linux: (51 commits) MAINTAINERS: bad email address for Mike Turquette clk: introduce optional disable_unused callback clk: ux500: fix bit error clk: clock multiplexers may register out of order clk: ux500: Initial support for abx500 clock driver CLK: SPEAr: Remove unused dummy apb_pclk CLK: SPEAr: Correct index scanning done for clock synths CLK: SPEAr: Update clock rate table CLK: SPEAr: Add missing clocks CLK: SPEAr: Set CLK_SET_RATE_PARENT for few clocks CLK: SPEAr13xx: fix parent names of multiple clocks CLK: SPEAr13xx: Fix mux clock names CLK: SPEAr: Fix dev_id & con_id for multiple clocks clk: move IM-PD1 clocks to drivers/clk clk: make ICST driver handle the VCO registers clk: add GPLv2 headers to the Versatile clock files clk: mxs: Use a better name for the USB PHY clock clk: spear: Add stub functions for spear3[0|1|2]0_clk_init() CLK: clk-twl6040: fix return value check in twl6040_clk_probe() clk: ux500: Register nomadik keypad clock lookups for u8500 ...
This commit is contained in:
commit
93874681aa
43 changed files with 1491 additions and 573 deletions
|
|
@ -8,43 +8,17 @@
|
|||
* Author: Jonas Aaberg <jonas.aberg@stericsson.com>
|
||||
*
|
||||
*/
|
||||
#include <linux/module.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/cpufreq.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/mfd/dbx500-prcmu.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/clk.h>
|
||||
#include <mach/id.h>
|
||||
|
||||
static struct cpufreq_frequency_table freq_table[] = {
|
||||
[0] = {
|
||||
.index = 0,
|
||||
.frequency = 200000,
|
||||
},
|
||||
[1] = {
|
||||
.index = 1,
|
||||
.frequency = 400000,
|
||||
},
|
||||
[2] = {
|
||||
.index = 2,
|
||||
.frequency = 800000,
|
||||
},
|
||||
[3] = {
|
||||
/* Used for MAX_OPP, if available */
|
||||
.index = 3,
|
||||
.frequency = CPUFREQ_TABLE_END,
|
||||
},
|
||||
[4] = {
|
||||
.index = 4,
|
||||
.frequency = CPUFREQ_TABLE_END,
|
||||
},
|
||||
};
|
||||
|
||||
static enum arm_opp idx2opp[] = {
|
||||
ARM_EXTCLK,
|
||||
ARM_50_OPP,
|
||||
ARM_100_OPP,
|
||||
ARM_MAX_OPP
|
||||
};
|
||||
static struct cpufreq_frequency_table *freq_table;
|
||||
static struct clk *armss_clk;
|
||||
|
||||
static struct freq_attr *db8500_cpufreq_attr[] = {
|
||||
&cpufreq_freq_attr_scaling_available_freqs,
|
||||
|
|
@ -85,9 +59,9 @@ static int db8500_cpufreq_target(struct cpufreq_policy *policy,
|
|||
for_each_cpu(freqs.cpu, policy->cpus)
|
||||
cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE);
|
||||
|
||||
/* request the PRCM unit for opp change */
|
||||
if (prcmu_set_arm_opp(idx2opp[idx])) {
|
||||
pr_err("db8500-cpufreq: Failed to set OPP level\n");
|
||||
/* update armss clk frequency */
|
||||
if (clk_set_rate(armss_clk, freq_table[idx].frequency * 1000)) {
|
||||
pr_err("db8500-cpufreq: Failed to update armss clk\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
|
@ -100,25 +74,36 @@ static int db8500_cpufreq_target(struct cpufreq_policy *policy,
|
|||
|
||||
static unsigned int db8500_cpufreq_getspeed(unsigned int cpu)
|
||||
{
|
||||
int i;
|
||||
/* request the prcm to get the current ARM opp */
|
||||
for (i = 0; prcmu_get_arm_opp() != idx2opp[i]; i++)
|
||||
;
|
||||
return freq_table[i].frequency;
|
||||
int i = 0;
|
||||
unsigned long freq = clk_get_rate(armss_clk) / 1000;
|
||||
|
||||
while (freq_table[i].frequency != CPUFREQ_TABLE_END) {
|
||||
if (freq <= freq_table[i].frequency)
|
||||
return freq_table[i].frequency;
|
||||
i++;
|
||||
}
|
||||
|
||||
/* We could not find a corresponding frequency. */
|
||||
pr_err("db8500-cpufreq: Failed to find cpufreq speed\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int __cpuinit db8500_cpufreq_init(struct cpufreq_policy *policy)
|
||||
{
|
||||
int i, res;
|
||||
int i = 0;
|
||||
int res;
|
||||
|
||||
BUILD_BUG_ON(ARRAY_SIZE(idx2opp) + 1 != ARRAY_SIZE(freq_table));
|
||||
|
||||
if (prcmu_has_arm_maxopp())
|
||||
freq_table[3].frequency = 1000000;
|
||||
armss_clk = clk_get(NULL, "armss");
|
||||
if (IS_ERR(armss_clk)) {
|
||||
pr_err("db8500-cpufreq : Failed to get armss clk\n");
|
||||
return PTR_ERR(armss_clk);
|
||||
}
|
||||
|
||||
pr_info("db8500-cpufreq : Available frequencies:\n");
|
||||
for (i = 0; freq_table[i].frequency != CPUFREQ_TABLE_END; i++)
|
||||
while (freq_table[i].frequency != CPUFREQ_TABLE_END) {
|
||||
pr_info(" %d Mhz\n", freq_table[i].frequency/1000);
|
||||
i++;
|
||||
}
|
||||
|
||||
/* get policy fields based on the table */
|
||||
res = cpufreq_frequency_table_cpuinfo(policy, freq_table);
|
||||
|
|
@ -126,6 +111,7 @@ static int __cpuinit db8500_cpufreq_init(struct cpufreq_policy *policy)
|
|||
cpufreq_frequency_table_get_attr(freq_table, policy->cpu);
|
||||
else {
|
||||
pr_err("db8500-cpufreq : Failed to read policy table\n");
|
||||
clk_put(armss_clk);
|
||||
return res;
|
||||
}
|
||||
|
||||
|
|
@ -159,12 +145,35 @@ static struct cpufreq_driver db8500_cpufreq_driver = {
|
|||
.attr = db8500_cpufreq_attr,
|
||||
};
|
||||
|
||||
static int db8500_cpufreq_probe(struct platform_device *pdev)
|
||||
{
|
||||
freq_table = dev_get_platdata(&pdev->dev);
|
||||
|
||||
if (!freq_table) {
|
||||
pr_err("db8500-cpufreq: Failed to fetch cpufreq table\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
return cpufreq_register_driver(&db8500_cpufreq_driver);
|
||||
}
|
||||
|
||||
static struct platform_driver db8500_cpufreq_plat_driver = {
|
||||
.driver = {
|
||||
.name = "cpufreq-u8500",
|
||||
.owner = THIS_MODULE,
|
||||
},
|
||||
.probe = db8500_cpufreq_probe,
|
||||
};
|
||||
|
||||
static int __init db8500_cpufreq_register(void)
|
||||
{
|
||||
if (!cpu_is_u8500_family())
|
||||
return -ENODEV;
|
||||
|
||||
pr_info("cpufreq for DB8500 started\n");
|
||||
return cpufreq_register_driver(&db8500_cpufreq_driver);
|
||||
return platform_driver_register(&db8500_cpufreq_plat_driver);
|
||||
}
|
||||
device_initcall(db8500_cpufreq_register);
|
||||
|
||||
MODULE_LICENSE("GPL v2");
|
||||
MODULE_DESCRIPTION("cpufreq driver for DB8500");
|
||||
|
|
|
|||
Loading…
Reference in a new issue