Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 351029
b: refs/heads/master
c: 5553f9e
h: refs/heads/master
i:
  351027: 812d61a
v: v3
  • Loading branch information
Shawn Guo authored and Rafael J. Wysocki committed Feb 1, 2013
1 parent 66297e0 commit 12a0cbb
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 14 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: 58ddcead4f163a01cef96aa5ba88f374011d8aea
refs/heads/master: 5553f9e26f6f49a93ba732fd222eac6973a4cf35
2 changes: 1 addition & 1 deletion trunk/drivers/cpufreq/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ config CPU_FREQ_GOV_CONSERVATIVE
If in doubt, say N.

config GENERIC_CPUFREQ_CPU0
bool "Generic CPU0 cpufreq driver"
tristate "Generic CPU0 cpufreq driver"
depends on HAVE_CLK && REGULATOR && PM_OPP && OF
select CPU_FREQ_TABLE
help
Expand Down
35 changes: 23 additions & 12 deletions trunk/drivers/cpufreq/cpufreq-cpu0.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt

#include <linux/clk.h>
#include <linux/cpu.h>
#include <linux/cpufreq.h>
#include <linux/err.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/opp.h>
#include <linux/platform_device.h>
#include <linux/regulator/consumer.h>
#include <linux/slab.h>

Expand Down Expand Up @@ -177,7 +177,7 @@ static struct cpufreq_driver cpu0_cpufreq_driver = {
.attr = cpu0_cpufreq_attr,
};

static int cpu0_cpufreq_driver_init(void)
static int cpu0_cpufreq_probe(struct platform_device *pdev)
{
struct device_node *np;
int ret;
Expand All @@ -192,23 +192,17 @@ static int cpu0_cpufreq_driver_init(void)
return -ENOENT;
}

cpu_dev = get_cpu_device(0);
if (!cpu_dev) {
pr_err("failed to get cpu0 device\n");
ret = -ENODEV;
goto out_put_node;
}

cpu_dev = &pdev->dev;
cpu_dev->of_node = np;

cpu_clk = clk_get(cpu_dev, NULL);
cpu_clk = devm_clk_get(cpu_dev, NULL);
if (IS_ERR(cpu_clk)) {
ret = PTR_ERR(cpu_clk);
pr_err("failed to get cpu0 clock: %d\n", ret);
goto out_put_node;
}

cpu_reg = regulator_get(cpu_dev, "cpu0");
cpu_reg = devm_regulator_get(cpu_dev, "cpu0");
if (IS_ERR(cpu_reg)) {
pr_warn("failed to get cpu0 regulator\n");
cpu_reg = NULL;
Expand Down Expand Up @@ -271,7 +265,24 @@ static int cpu0_cpufreq_driver_init(void)
of_node_put(np);
return ret;
}
late_initcall(cpu0_cpufreq_driver_init);

static int cpu0_cpufreq_remove(struct platform_device *pdev)
{
cpufreq_unregister_driver(&cpu0_cpufreq_driver);
opp_free_cpufreq_table(cpu_dev, &freq_table);

return 0;
}

static struct platform_driver cpu0_cpufreq_platdrv = {
.driver = {
.name = "cpufreq-cpu0",
.owner = THIS_MODULE,
},
.probe = cpu0_cpufreq_probe,
.remove = cpu0_cpufreq_remove,
};
module_platform_driver(cpu0_cpufreq_platdrv);

MODULE_AUTHOR("Shawn Guo <shawn.guo@linaro.org>");
MODULE_DESCRIPTION("Generic CPU0 cpufreq driver");
Expand Down
5 changes: 5 additions & 0 deletions trunk/drivers/cpufreq/highbank-cpufreq.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include <linux/err.h>
#include <linux/of.h>
#include <linux/mailbox.h>
#include <linux/platform_device.h>

#define HB_CPUFREQ_CHANGE_NOTE 0x80000001
#define HB_CPUFREQ_IPC_LEN 7
Expand Down Expand Up @@ -65,6 +66,7 @@ static struct notifier_block hb_cpufreq_clk_nb = {

static int hb_cpufreq_driver_init(void)
{
struct platform_device_info devinfo = { .name = "cpufreq-cpu0", };
struct device *cpu_dev;
struct clk *cpu_clk;
struct device_node *np;
Expand Down Expand Up @@ -104,6 +106,9 @@ static int hb_cpufreq_driver_init(void)
goto out_put_node;
}

/* Instantiate cpufreq-cpu0 */
platform_device_register_full(&devinfo);

out_put_node:
of_node_put(np);
return ret;
Expand Down

0 comments on commit 12a0cbb

Please sign in to comment.