rk29: cpufreq: add board_update_cpufreq_table API, support board specific freq table
author黄涛 <huangtao@rock-chips.com>
Tue, 14 Jun 2011 01:45:56 +0000 (09:45 +0800)
committer黄涛 <huangtao@rock-chips.com>
Tue, 14 Jun 2011 01:46:20 +0000 (09:46 +0800)
arch/arm/mach-rk29/cpufreq.c
arch/arm/mach-rk29/include/mach/cpufreq.h [new file with mode: 0644]

index c13a4b3b5ab1db6df835f0c5e679dda1e07f42d5..ae4db7fa4fd184fbf888e24b50bcd316c2268604 100755 (executable)
 #include <linux/init.h>
 #include <linux/regulator/consumer.h>
 #include <linux/suspend.h>
+#include <mach/cpufreq.h>
 
 #define SLEEP_FREQ     (800 * 1000) /* Use 800MHz when entering sleep */
 
-/* additional symantics for "relation" in cpufreq with pm */
-#define DISABLE_FURTHER_CPUFREQ         0x10
-#define ENABLE_FURTHER_CPUFREQ          0x20
-#define MASK_FURTHER_CPUFREQ            0x30
-/* With 0x00(NOCHANGE), it depends on the previous "further" status */
 static int no_cpufreq_access;
 
-static struct cpufreq_frequency_table freq_table[] = {
-//     { .index =  950000, .frequency =  204000 },
-//     { .index = 1050000, .frequency =  300000 },
+static struct cpufreq_frequency_table default_freq_table[] = {
+//     { .index = 1100000, .frequency =   24000 },
+//     { .index = 1200000, .frequency =  204000 },
+//     { .index = 1200000, .frequency =  300000 },
        { .index = 1200000, .frequency =  408000 },
-//     { .index = 1125000, .frequency =  600000 },
-       { .index = 1200000, .frequency =  816000 },
+//     { .index = 1200000, .frequency =  600000 },
+       { .index = 1200000, .frequency =  816000 }, /* must enable, see SLEEP_FREQ above */
 //     { .index = 1250000, .frequency = 1008000 },
-//     { .index = 1300000, .frequency = 1200000 },
+//     { .index = 1300000, .frequency = 1104000 },
+//     { .index = 1400000, .frequency = 1176000 },
+//     { .index = 1400000, .frequency = 1200000 },
        { .frequency = CPUFREQ_TABLE_END },
 };
+static struct cpufreq_frequency_table *freq_table = default_freq_table;
 static struct clk *arm_clk;
 static struct regulator *vcore;
 static int vcore_uV;
 
+int board_update_cpufreq_table(struct cpufreq_frequency_table *table)
+{
+       freq_table = table;
+       return 0;
+}
+
 static int rk29_cpufreq_verify(struct cpufreq_policy *policy)
 {
        return cpufreq_frequency_table_verify(policy, freq_table);
@@ -128,8 +134,6 @@ err_vol:
        return err;
 }
 
-extern void clk_init_cpufreq_table(struct cpufreq_frequency_table **table);
-
 static int __init rk29_cpufreq_init(struct cpufreq_policy *policy)
 {
        arm_clk = clk_get(NULL, "arm_pll");
diff --git a/arch/arm/mach-rk29/include/mach/cpufreq.h b/arch/arm/mach-rk29/include/mach/cpufreq.h
new file mode 100644 (file)
index 0000000..540a67c
--- /dev/null
@@ -0,0 +1,32 @@
+/* arch/arm/mach-rk29/include/mach/cpufreq.h
+ *
+ * Copyright (C) 2011 ROCKCHIP, Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#ifndef __ASM_ARCH_RK29_CPUFREQ_H
+
+#include <linux/cpufreq.h>
+
+/* additional symantics for "relation" in cpufreq with pm */
+#define DISABLE_FURTHER_CPUFREQ         0x10
+#define ENABLE_FURTHER_CPUFREQ          0x20
+#define MASK_FURTHER_CPUFREQ            0x30
+/* With 0x00(NOCHANGE), it depends on the previous "further" status */
+
+#ifdef CONFIG_CPU_FREQ
+int board_update_cpufreq_table(struct cpufreq_frequency_table *table);
+#else
+static inline int board_update_cpufreq_table(struct cpufreq_frequency_table *table) { return 0; }
+#endif
+
+#endif