Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 87283
b: refs/heads/master
c: b8488fb
h: refs/heads/master
i:
  87281: a8b981b
  87279: 746416e
v: v3
  • Loading branch information
Hiroshi DOYU authored and Tony Lindgren committed Mar 5, 2008
1 parent f6dbd36 commit 4ce606d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 23 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 538528de0cb256f65716ab2e9613d9e920f97fe2
refs/heads/master: b8488fbe6d2f32ff4ad2f8f348a50e42389fc727
32 changes: 10 additions & 22 deletions trunk/arch/arm/plat-omap/cpu-omap.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,74 +33,56 @@
#define MPU_CLK "virt_prcm_set"
#endif

static struct clk *mpu_clk;

/* TODO: Add support for SDRAM timing changes */

int omap_verify_speed(struct cpufreq_policy *policy)
{
struct clk * mpu_clk;

if (policy->cpu)
return -EINVAL;

cpufreq_verify_within_limits(policy, policy->cpuinfo.min_freq,
policy->cpuinfo.max_freq);
mpu_clk = clk_get(NULL, MPU_CLK);
if (IS_ERR(mpu_clk))
return PTR_ERR(mpu_clk);

policy->min = clk_round_rate(mpu_clk, policy->min * 1000) / 1000;
policy->max = clk_round_rate(mpu_clk, policy->max * 1000) / 1000;
cpufreq_verify_within_limits(policy, policy->cpuinfo.min_freq,
policy->cpuinfo.max_freq);
clk_put(mpu_clk);

return 0;
}

unsigned int omap_getspeed(unsigned int cpu)
{
struct clk * mpu_clk;
unsigned long rate;

if (cpu)
return 0;

mpu_clk = clk_get(NULL, MPU_CLK);
if (IS_ERR(mpu_clk))
return 0;
rate = clk_get_rate(mpu_clk) / 1000;
clk_put(mpu_clk);

return rate;
}

static int omap_target(struct cpufreq_policy *policy,
unsigned int target_freq,
unsigned int relation)
{
struct clk * mpu_clk;
struct cpufreq_freqs freqs;
int ret = 0;

mpu_clk = clk_get(NULL, MPU_CLK);
if (IS_ERR(mpu_clk))
return PTR_ERR(mpu_clk);

freqs.old = omap_getspeed(0);
freqs.new = clk_round_rate(mpu_clk, target_freq * 1000) / 1000;
freqs.cpu = 0;

cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE);
ret = clk_set_rate(mpu_clk, target_freq * 1000);
cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE);
clk_put(mpu_clk);

return ret;
}

static int __init omap_cpu_init(struct cpufreq_policy *policy)
{
struct clk * mpu_clk;

mpu_clk = clk_get(NULL, MPU_CLK);
if (IS_ERR(mpu_clk))
return PTR_ERR(mpu_clk);
Expand All @@ -111,17 +93,23 @@ static int __init omap_cpu_init(struct cpufreq_policy *policy)
policy->cpuinfo.min_freq = clk_round_rate(mpu_clk, 0) / 1000;
policy->cpuinfo.max_freq = clk_round_rate(mpu_clk, VERY_HI_RATE) / 1000;
policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL;
clk_put(mpu_clk);

return 0;
}

static int omap_cpu_exit(struct cpufreq_policy *policy)
{
clk_put(mpu_clk);
return 0;
}

static struct cpufreq_driver omap_driver = {
.flags = CPUFREQ_STICKY,
.verify = omap_verify_speed,
.target = omap_target,
.get = omap_getspeed,
.init = omap_cpu_init,
.exit = omap_cpu_exit,
.name = "omap",
};

Expand Down

0 comments on commit 4ce606d

Please sign in to comment.