diff options
author | Minsu, Kim <minsu78.kim@samsung.com> | 2011-01-19 17:13:23 +0900 |
---|---|---|
committer | Arve Hjønnevåg <arve@android.com> | 2011-11-17 17:52:54 -0800 |
commit | e5615b56fb489c004ddaa097484d169a16a54d1a (patch) | |
tree | d45fee6e06a2dc97bc7f9139a7dc42e4a42f35f3 /arch/arm | |
parent | 663cb5be2808d19636da500773a5d230e25918a2 (diff) | |
download | kernel_samsung_crespo-e5615b56fb489c004ddaa097484d169a16a54d1a.zip kernel_samsung_crespo-e5615b56fb489c004ddaa097484d169a16a54d1a.tar.gz kernel_samsung_crespo-e5615b56fb489c004ddaa097484d169a16a54d1a.tar.bz2 |
S5PC11X : CPUFREQ : add platform data interface to dvfs
In case of board voltage drop, voltage table should be changed.
voltage table can be updated by platform data
Change-Id: I4147d1599fd4f91e398dad713a145ad44db77620
Signed-off-by: Minsu Kim <minsu78.kim@samsung.com>
Also removes unused code from arch/arm/mach-s5pv210/include/mach/cpu-freq-v210.h
Diffstat (limited to 'arch/arm')
-rw-r--r-- | arch/arm/mach-s5pv210/Makefile | 1 | ||||
-rwxr-xr-x | arch/arm/mach-s5pv210/cpufreq.c | 40 | ||||
-rw-r--r-- | arch/arm/mach-s5pv210/dev-cpufreq.c | 28 | ||||
-rw-r--r-- | arch/arm/mach-s5pv210/include/mach/cpu-freq-v210.h | 114 | ||||
-rw-r--r-- | arch/arm/plat-samsung/include/plat/devs.h | 2 |
5 files changed, 86 insertions, 99 deletions
diff --git a/arch/arm/mach-s5pv210/Makefile b/arch/arm/mach-s5pv210/Makefile index a3ae5d5..af96a70 100644 --- a/arch/arm/mach-s5pv210/Makefile +++ b/arch/arm/mach-s5pv210/Makefile @@ -57,3 +57,4 @@ obj-$(CONFIG_S5PV210_SETUP_FIMC1) += setup-fimc1.o obj-$(CONFIG_S5PV210_SETUP_FIMC2) += setup-fimc2.o obj-$(CONFIG_CPU_IDLE) += cpuidle.o +obj-$(CONFIG_CPU_FREQ) += dev-cpufreq.o diff --git a/arch/arm/mach-s5pv210/cpufreq.c b/arch/arm/mach-s5pv210/cpufreq.c index 03fddd1..ce31e8a 100755 --- a/arch/arm/mach-s5pv210/cpufreq.c +++ b/arch/arm/mach-s5pv210/cpufreq.c @@ -19,9 +19,11 @@ #include <linux/suspend.h> #include <linux/regulator/consumer.h> #include <linux/cpufreq.h> +#include <linux/platform_device.h> #include <mach/map.h> #include <mach/regs-clock.h> +#include <mach/cpu-freq-v210.h> static struct clk *cpu_clk; static struct clk *dmc0_clk; @@ -597,8 +599,25 @@ static struct notifier_block s5pv210_cpufreq_notifier = { .notifier_call = s5pv210_cpufreq_notifier_event, }; -static int __init s5pv210_cpufreq_init(void) +static int __init s5pv210_cpufreq_probe(struct platform_device *pdev) { + struct s5pv210_cpufreq_data *pdata = dev_get_platdata(&pdev->dev); + int i, j; + + if (pdata && pdata->size) { + for (i = 0; i < pdata->size; i++) { + j = 0; + while (s5pv210_freq_table[j].frequency != CPUFREQ_TABLE_END) { + if (s5pv210_freq_table[j].frequency == pdata->volt[i].freq) { + dvs_conf[j].arm_volt = pdata->volt[i].varm; + dvs_conf[j].int_volt = pdata->volt[i].vint; + break; + } + j++; + } + } + } + arm_regulator = regulator_get(NULL, "vddarm"); if (IS_ERR(arm_regulator)) { pr_err("failed to get regulater resource vddarm\n"); @@ -619,4 +638,23 @@ finish: return cpufreq_register_driver(&s5pv210_driver); } +static struct platform_driver s5pv210_cpufreq_drv = { + .probe = s5pv210_cpufreq_probe, + .driver = { + .owner = THIS_MODULE, + .name = "s5pv210-cpufreq", + }, +}; + +static int __init s5pv210_cpufreq_init(void) +{ + int ret; + + ret = platform_driver_register(&s5pv210_cpufreq_drv); + if (!ret) + pr_info("%s: S5PV210 cpu-freq driver\n", __func__); + + return ret; +} + late_initcall(s5pv210_cpufreq_init); diff --git a/arch/arm/mach-s5pv210/dev-cpufreq.c b/arch/arm/mach-s5pv210/dev-cpufreq.c new file mode 100644 index 0000000..ff0e0f1 --- /dev/null +++ b/arch/arm/mach-s5pv210/dev-cpufreq.c @@ -0,0 +1,28 @@ +/* + * linux/arch/arm/mach-s5pv210/dev-cpufreq.c + * + * Copyright (c) 2008-2010 Samsung Electronics + * Taekki Kim <taekki.kim@samsung.com> + * + * S5PV210 series device definition for cpufreq devices + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#include <linux/kernel.h> +#include <linux/platform_device.h> + +#include <mach/cpu-freq-v210.h> + +struct platform_device s5pv210_device_cpufreq = { + .name = "s5pv210-cpufreq", + .id = -1, +}; + +void s5pv210_cpufreq_set_platdata(struct s5pv210_cpufreq_data *pdata) +{ + s5pv210_device_cpufreq.dev.platform_data = pdata; +} + diff --git a/arch/arm/mach-s5pv210/include/mach/cpu-freq-v210.h b/arch/arm/mach-s5pv210/include/mach/cpu-freq-v210.h index fb44000..8274a01 100644 --- a/arch/arm/mach-s5pv210/include/mach/cpu-freq-v210.h +++ b/arch/arm/mach-s5pv210/include/mach/cpu-freq-v210.h @@ -2,112 +2,30 @@ * * Copyright (c) 2010 Samsung Electronics Co., Ltd. * + * S5PV210/S5PC110 CPU frequency scaling support + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. - */ - -#include <linux/cpufreq.h> - -//extern void s5pc110_lock_power_domain(unsigned int nToken); - -#define MAXIMUM_FREQ 1000000 -#define USE_FREQ_TABLE -//#undef USE_DVS -#define USE_DVS -#define VERY_HI_RATE 800*1000*1000 -#define APLL_GEN_CLK 800*1000 -#define KHZ_T 1000 - -#define MPU_CLK "armclk" - -#define INDX_ERROR 65535 - -enum perf_level { - L0, - L1, - L2, - L3, - L4, - L5, - L6, - L7, -}; - -enum freq_level_states { - LEV_1200MHZ, - LEV_1000MHZ, - LEV_800MHZ, - LEV_400MHZ, - LEV_200MHZ, - LEV_100MHZ, -}; +*/ -extern unsigned int s5pc11x_cpufreq_index; -extern unsigned int S5PC11X_FREQ_TAB; -extern unsigned int S5PC11X_MAXFREQLEVEL; +#ifndef __ASM_ARCH_CPU_FREQ_H +#define __ASM_ARCH_CPU_FREQ_H -extern unsigned int s5pc11x_target_frq(unsigned int pred_freq, int flag); -extern int s5pc110_pm_target(unsigned int target_freq); -extern int is_conservative_gov(void); -extern int is_userspace_gov(void); -extern void set_dvfs_target_level(enum freq_level_states freq_level); -extern int set_voltage(enum perf_level p_lv); -extern int set_voltage_dvs(enum perf_level p_lv); - -extern int s5pc110_dvfs_lock_high_hclk(unsigned int dToken); -extern int s5pc110_dvfs_unlock_high_hclk(unsigned int dToken); - -#define NUMBER_OF_LOCKTOKEN 9 - -#define DVFS_LOCK_TOKEN_1 0 -#define DVFS_LOCK_TOKEN_2 1 -#define DVFS_LOCK_TOKEN_3 2 -#define DVFS_LOCK_TOKEN_4 3 -#define DVFS_LOCK_TOKEN_5 4 -#define DVFS_LOCK_TOKEN_6 5 -#define DVFS_LOCK_TOKEN_7 6 -#define DVFS_LOCK_TOKEN_8 7 -#define DVFS_LOCK_TOKEN_9 8 - -void s5pc110_lock_dvfs_high_level(unsigned int nToken, enum freq_level_states freq_level); -void s5pc110_unlock_dvfs_high_level(unsigned int nToken); - -#define CLK_OUT_PROBING //TP80 on SMDKC100 board - - -#define CLK_DIV0_MASK ((0x7<<0)|(0x7<<8)|(0x7<<12)) // APLL,HCLK_MSYS,PCLK_MSYS mask value - - -/* - * APLL M,P,S value for target frequency - **/ -#define APLL_VAL_1664 (1<<31)|(417<<16)|(3<<8)|(0) -#define APLL_VAL_1332 (1<<31)|(444<<16)|(4<<8)|(0) -#define APLL_VAL_1000 (1<<31)|(125<<16)|(3<<8)|(1) -#define APLL_VAL_800 (1<<31)|(100<<16)|(3<<8)|(1) +#include <linux/cpufreq.h> -struct s5pv210_domain_freq { - unsigned long apll_out; - unsigned long armclk; - unsigned long hclk_msys; - unsigned long pclk_msys; - unsigned long hclk_dsys; - unsigned long pclk_dsys; - unsigned long hclk_psys; - unsigned long pclk_psys; +/* For cpu-freq driver */ +struct s5pv210_cpufreq_voltage { + unsigned int freq; /* kHz */ + unsigned long varm; /* uV */ + unsigned long vint; /* uV */ }; -struct s5pv210_cpufreq_freqs { - struct cpufreq_freqs freqs; - struct s5pv210_domain_freq old; - struct s5pv210_domain_freq new; +struct s5pv210_cpufreq_data { + struct s5pv210_cpufreq_voltage *volt; + unsigned int size; }; -struct s5pv210_dvs_conf { - const unsigned long lvl; /* DVFS level : L0,L1,L2,L3.*/ - unsigned long arm_volt; /* uV */ - unsigned long int_volt; /* uV */ -}; +extern void s5pv210_cpufreq_set_platdata(struct s5pv210_cpufreq_data *pdata); -extern void s5pv210_set_cpufreq_level(unsigned int flag); +#endif /* __ASM_ARCH_CPU_FREQ_H */ diff --git a/arch/arm/plat-samsung/include/plat/devs.h b/arch/arm/plat-samsung/include/plat/devs.h index 0c7cd24..1170fb9 100644 --- a/arch/arm/plat-samsung/include/plat/devs.h +++ b/arch/arm/plat-samsung/include/plat/devs.h @@ -177,6 +177,8 @@ extern struct platform_device s5pv210_device_pdma0; extern struct platform_device s5pv210_device_pdma1; extern struct platform_device s5pv210_device_mdma; +extern struct platform_device s5pv210_device_cpufreq; + #ifdef CONFIG_CPU_S3C2440 extern struct platform_device s3c_device_camif; |