Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 173332
b: refs/heads/master
c: 35f9acd
h: refs/heads/master
v: v3
  • Loading branch information
Sekhar Nori authored and Kevin Hilman committed Nov 25, 2009
1 parent a8021a8 commit 9923b52
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 683b1e1f0e6f7b2690c0ce76751ba8f26f0235c6
refs/heads/master: 35f9acd8bd13ba3d90998b5f31cae3e271309127
43 changes: 43 additions & 0 deletions trunk/arch/arm/mach-davinci/da850.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include <linux/clk.h>
#include <linux/platform_device.h>
#include <linux/cpufreq.h>
#include <linux/regulator/consumer.h>

#include <asm/mach/map.h>

Expand Down Expand Up @@ -844,27 +845,35 @@ struct da850_opp {
unsigned int prediv;
unsigned int mult;
unsigned int postdiv;
unsigned int cvdd_min; /* in uV */
unsigned int cvdd_max; /* in uV */
};

static const struct da850_opp da850_opp_300 = {
.freq = 300000,
.prediv = 1,
.mult = 25,
.postdiv = 2,
.cvdd_min = 1140000,
.cvdd_max = 1320000,
};

static const struct da850_opp da850_opp_200 = {
.freq = 200000,
.prediv = 1,
.mult = 25,
.postdiv = 3,
.cvdd_min = 1050000,
.cvdd_max = 1160000,
};

static const struct da850_opp da850_opp_96 = {
.freq = 96000,
.prediv = 1,
.mult = 20,
.postdiv = 5,
.cvdd_min = 950000,
.cvdd_max = 1050000,
};

#define OPP(freq) \
Expand Down Expand Up @@ -973,6 +982,40 @@ static int da850_round_armrate(struct clk *clk, unsigned long rate)
}
#endif

#ifdef CONFIG_REGULATOR
static struct regulator *cvdd;

static int da850_set_voltage(unsigned int index)
{
struct da850_opp *opp;

if (!cvdd)
return -ENODEV;

opp = (struct da850_opp *) da850_freq_table[index].index;

return regulator_set_voltage(cvdd, opp->cvdd_min, opp->cvdd_max);
}

static int __init da850_regulator_init(void)
{
int ret = 0;

cvdd = regulator_get(NULL, "cvdd");
if (WARN(IS_ERR(cvdd), "Unable to obtain voltage regulator for CVDD;"
" voltage scaling unsupported\n")) {
ret = PTR_ERR(cvdd);
goto out;
}

cpufreq_info.set_voltage = da850_set_voltage;

out:
return ret;
}
device_initcall(da850_regulator_init);
#endif

static struct davinci_soc_info davinci_soc_info_da850 = {
.io_desc = da850_io_desc,
.io_desc_num = ARRAY_SIZE(da850_io_desc),
Expand Down

0 comments on commit 9923b52

Please sign in to comment.