ARM: rockchip: clean folder
authorJacob Chen <jacob2.chen@rock-chips.com>
Tue, 10 Jan 2017 08:20:53 +0000 (16:20 +0800)
committerHuang, Tao <huangtao@rock-chips.com>
Thu, 12 Jan 2017 03:52:50 +0000 (11:52 +0800)
Change-Id: I5ab0d917dc79976a944b380ca3a77d823b6cae98
Signed-off-by: Jacob Chen <jacob2.chen@rock-chips.com>
12 files changed:
arch/arm/mach-rockchip/rk_pm_tests/Makefile [deleted file]
arch/arm/mach-rockchip/rk_pm_tests/clk_rate.c [deleted file]
arch/arm/mach-rockchip/rk_pm_tests/clk_rate.h [deleted file]
arch/arm/mach-rockchip/rk_pm_tests/clk_volt.c [deleted file]
arch/arm/mach-rockchip/rk_pm_tests/clk_volt.h [deleted file]
arch/arm/mach-rockchip/rk_pm_tests/cpu_usage.c [deleted file]
arch/arm/mach-rockchip/rk_pm_tests/cpu_usage.h [deleted file]
arch/arm/mach-rockchip/rk_pm_tests/dvfs_table_scan.c [deleted file]
arch/arm/mach-rockchip/rk_pm_tests/dvfs_table_scan.h [deleted file]
arch/arm/mach-rockchip/rk_pm_tests/pvtm_test.c [deleted file]
arch/arm/mach-rockchip/rk_pm_tests/rk_pm_tests.c [deleted file]
arch/arm/mach-rockchip/rk_pm_tests/rk_pm_tests.h [deleted file]

diff --git a/arch/arm/mach-rockchip/rk_pm_tests/Makefile b/arch/arm/mach-rockchip/rk_pm_tests/Makefile
deleted file mode 100644 (file)
index 837c386..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-obj-y += rk_pm_tests.o
-obj-y += clk_rate.o
-obj-y += clk_volt.o
-obj-y += cpu_usage.o
-obj-y += dvfs_table_scan.o
-obj-y += pvtm_test.o
diff --git a/arch/arm/mach-rockchip/rk_pm_tests/clk_rate.c b/arch/arm/mach-rockchip/rk_pm_tests/clk_rate.c
deleted file mode 100644 (file)
index 8d5cfcd..0000000
+++ /dev/null
@@ -1,152 +0,0 @@
-#include <linux/clk.h>
-#include <linux/kobject.h>
-#include <linux/string.h>
-#include <linux/resume-trace.h>
-#include <linux/workqueue.h>
-#include <linux/mutex.h>
-#include <linux/module.h>
-#include <linux/syscalls.h>
-#include <linux/init.h>
-#include <linux/interrupt.h>
-#include <linux/delay.h>
-#include <linux/cpu.h>
-#include <linux/slab.h>
-#include <linux/dma-mapping.h>
-#include <linux/regulator/machine.h>
-#include <linux/mfd/wm831x/core.h>
-#include <linux/sysfs.h>
-#include <linux/err.h>
-
-#include <linux/fs.h>
-#include <asm/unistd.h>
-#include <asm/uaccess.h>
-#include <linux/rockchip/dvfs.h>
-
-#include "rk_pm_tests.h"
-#include "clk_rate.h"
-/***************************************************************************/
-#define FILE_GOV_MODE "/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor"
-
-#if 0
-static int file_read(char *file_path, char *buf)
-{
-       struct file *file = NULL;
-       mm_segment_t old_fs;
-       loff_t offset = 0;
-
-       PM_DBG("%s: read %s\n", __func__, file_path);
-       file = filp_open(file_path, O_RDONLY, 0);
-
-       if (IS_ERR(file)) {
-               PM_ERR("%s: error open file  %s\n", __func__, file_path);
-               return -1;
-       }
-
-       old_fs = get_fs();
-       set_fs(KERNEL_DS);
-
-       file->f_op->read(file, (char *)buf, 32, &offset);
-       sscanf(buf, "%s", buf);
-
-       set_fs(old_fs);
-       filp_close(file, NULL);  
-
-       file = NULL;
-
-       return 0;
-
-}
-#endif
-
-static int file_write(char *file_path, char *buf)
-{
-       struct file *file = NULL;
-       mm_segment_t old_fs;
-       loff_t offset = 0;
-
-       PM_DBG("%s: write %s %s size = %d\n", __func__,
-              file_path, buf, (int)strlen(buf));
-       file = filp_open(file_path, O_RDWR, 0);
-
-       if (IS_ERR(file)) {
-               PM_ERR("%s: error open file  %s\n", __func__, file_path);
-               return -1;
-       }
-
-       old_fs = get_fs();
-       set_fs(KERNEL_DS);
-
-       file->f_op->write(file, (char *)buf, strlen(buf), &offset);
-
-       set_fs(old_fs);
-       filp_close(file, NULL);  
-
-       file = NULL;
-
-       return 0;
-
-}
-
-ssize_t clk_rate_show(struct kobject *kobj, struct kobj_attribute *attr,
-               char *buf)
-{
-       char *str = buf;
-       str += sprintf(str, "set [clk_name] [rate(Hz)]\n"
-                       "rawset [clk_name] [rate(Hz)]\n");
-       if (str != buf)
-               *(str - 1) = '\n';
-       return (str - buf);
-
-}
-
-ssize_t clk_rate_store(struct kobject *kobj, struct kobj_attribute *attr,
-               const char *buf, size_t n)
-{
-       struct dvfs_node *clk_dvfs_node = NULL;
-       struct clk *clk;
-       char cmd[20], clk_name[20];
-       unsigned long rate=0;
-       int ret=0;
-               
-       sscanf(buf, "%s %s %lu", cmd, clk_name, &rate);
-       
-       PM_DBG("%s: cmd(%s), clk_name(%s), rate(%lu)\n", __func__, cmd, clk_name, rate);
-
-       if (!strncmp(cmd, "set", strlen("set"))) {
-               clk_dvfs_node = clk_get_dvfs_node(clk_name);
-               if (!clk_dvfs_node) {
-                       PM_ERR("%s: clk(%s) get dvfs node error\n", __func__, clk_name);
-                       return n;
-               }
-               
-               if (!strncmp(clk_name, "clk_core", strlen("clk_core"))) {
-                       if (file_write(FILE_GOV_MODE, "userspace") != 0) {
-                               PM_ERR("%s: set current governor error\n", __func__);
-                               return n;
-                       }
-               }
-
-               ret = dvfs_clk_enable_limit(clk_dvfs_node, rate, rate);
-       } else {
-               clk = clk_get(NULL, clk_name);
-               if (IS_ERR_OR_NULL(clk)) {
-                       PM_ERR("%s: get clk(%s) err(%ld)\n", 
-                               __func__, clk_name, PTR_ERR(clk));
-                       return n;
-               }
-               
-               if (!strncmp(cmd, "rawset", strlen("rawset"))) {
-                       ret = clk_set_rate(clk, rate);
-               } else if (!strncmp(cmd, "open", strlen("open"))) {
-                       ret = clk_prepare_enable(clk);
-               } else if (!strncmp(cmd, "close", strlen("close"))) {   
-                       clk_disable_unprepare(clk);
-               }
-       }
-
-       if (ret) {
-               PM_ERR("%s: set rate err(%d)", __func__, ret);
-       }
-       return n;
-}
-
diff --git a/arch/arm/mach-rockchip/rk_pm_tests/clk_rate.h b/arch/arm/mach-rockchip/rk_pm_tests/clk_rate.h
deleted file mode 100644 (file)
index bfb649d..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-#ifndef _CLK_RATE_H_
-#define _CLK_RATE_H_
-ssize_t clk_rate_show(struct kobject *kobj, struct kobj_attribute *attr,
-               char *buf);
-ssize_t clk_rate_store(struct kobject *kobj, struct kobj_attribute *attr,
-               const char *buf, size_t n);
-
-#endif
diff --git a/arch/arm/mach-rockchip/rk_pm_tests/clk_volt.c b/arch/arm/mach-rockchip/rk_pm_tests/clk_volt.c
deleted file mode 100644 (file)
index aaf10ce..0000000
+++ /dev/null
@@ -1,91 +0,0 @@
-#include <linux/clk.h>
-#include <linux/kobject.h>
-#include <linux/string.h>
-#include <linux/resume-trace.h>
-#include <linux/workqueue.h>
-#include <linux/mutex.h>
-#include <linux/module.h>
-#include <linux/syscalls.h>
-#include <linux/init.h>
-#include <linux/interrupt.h>
-#include <linux/delay.h>
-#include <linux/cpu.h>
-#include <linux/slab.h>
-#include <linux/dma-mapping.h>
-#include <linux/regulator/machine.h>
-#include <linux/mfd/wm831x/core.h>
-#include <linux/sysfs.h>
-#include <linux/err.h>
-#include <linux/rockchip/dvfs.h>
-
-#include "rk_pm_tests.h"
-#include "clk_volt.h"
-/***************************************************************************/
-ssize_t clk_volt_show(struct kobject *kobj, struct kobj_attribute *attr,
-               char *buf)
-{
-       char *str = buf;
-       str += sprintf(str, "usage:\n");
-       str += sprintf(str, "get voltage:get [regulaotr_name]\n");
-       str += sprintf(str, "set voltage:set [regulaotr_name] [voltage(uV)]\n");
-       str += sprintf(str, "set suspend voltage:set [regulaotr_name] [voltage(uV)+1]\n");
-       if (str != buf)
-               *(str - 1) = '\n';
-       return (str - buf);
-
-}
-
-#define SET_SUSPEND_VOLT_FLAG  (1<<0)
-
-ssize_t clk_volt_store(struct kobject *kobj, struct kobj_attribute *attr,
-               const char *buf, size_t n)
-{
-       
-       struct regulator *regulator;
-       char cmd[20], regulator_name[20];
-       unsigned int volt;
-       int need_put_regulator=0, ret=0;
-
-       sscanf(buf, "%s %s %u", cmd, regulator_name, &volt);
-
-       PM_DBG("%s: cmd(%s), regulator_name(%s), volt(%u)\n", 
-               __func__, cmd, regulator_name, volt);
-
-       regulator = dvfs_get_regulator(regulator_name);
-       if (IS_ERR_OR_NULL(regulator)) {
-               regulator = regulator_get(NULL, regulator_name);
-               if (IS_ERR(regulator)){
-                       PM_ERR("%s: get dvfs_regulator %s error\n", __func__, regulator_name);
-                       return n;
-               }
-               need_put_regulator = 1;
-       }       
-
-       if (!strncmp(cmd, "set", strlen("set"))){
-               if (volt & SET_SUSPEND_VOLT_FLAG){
-                       volt &= ~SET_SUSPEND_VOLT_FLAG;
-                       //ret = regulator_set_suspend_voltage(regulator, volt); 
-                       if (!ret)
-                               PM_DBG("%s: set %s suspend volt to %u uV ok\n", __func__, regulator_name, volt);
-                       else
-                               PM_DBG("%s: regulator_set_suspend_voltage err(%d)\n", __func__, ret);
-               }else{
-                       ret = regulator_set_voltage(regulator, volt, volt); 
-                       if (!ret)
-                               PM_DBG("%s: set %s volt to %u uV ok\n", __func__, regulator_name, regulator_get_voltage(regulator));
-                       else
-                               PM_DBG("%s: regulator_set_voltage err(%d)\n", __func__, ret);
-               }
-               
-       }
-       if (!strncmp(cmd, "get", strlen("get"))){
-               printk("%s: %s current is %d uV\n", 
-                       __func__, regulator_name, regulator_get_voltage(regulator));
-       }
-
-       if (need_put_regulator)
-               regulator_put(regulator);
-
-       return n;
-}
-
diff --git a/arch/arm/mach-rockchip/rk_pm_tests/clk_volt.h b/arch/arm/mach-rockchip/rk_pm_tests/clk_volt.h
deleted file mode 100644 (file)
index 346bd20..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-#ifndef _CLK_VOLT_H_
-#define _CLK_VOLT_H_
-ssize_t clk_volt_show(struct kobject *kobj, struct kobj_attribute *attr,
-               char *buf);
-ssize_t clk_volt_store(struct kobject *kobj, struct kobj_attribute *attr,
-               const char *buf, size_t n);
-
-#endif
diff --git a/arch/arm/mach-rockchip/rk_pm_tests/cpu_usage.c b/arch/arm/mach-rockchip/rk_pm_tests/cpu_usage.c
deleted file mode 100644 (file)
index 78a643d..0000000
+++ /dev/null
@@ -1,135 +0,0 @@
-#include <linux/clk.h>
-#include <linux/kobject.h>
-#include <linux/string.h>
-#include <linux/resume-trace.h>
-#include <linux/workqueue.h>
-#include <linux/mutex.h>
-#include <linux/module.h>
-#include <linux/syscalls.h>
-#include <linux/init.h>
-#include <linux/interrupt.h>
-#include <linux/delay.h>
-#include <linux/cpu.h>
-#include <linux/slab.h>
-#include <linux/dma-mapping.h>
-#include <linux/regulator/machine.h>
-#include <linux/mfd/wm831x/core.h>
-#include <linux/sysfs.h>
-#include <linux/err.h>
-#include <linux/random.h>
-
-#include <linux/fs.h>
-#include <asm/unistd.h>
-#include <asm/uaccess.h>
-#include "rk_pm_tests.h"
-#include "cpu_usage.h"
-/***************************************************************************/
-static DEFINE_PER_CPU(struct work_struct, work_cpu_usage);
-static DEFINE_PER_CPU(struct workqueue_struct *, workqueue_cpu_usage);
-
-int cpu_usage_run = 0;
-int cpu_usage_percent = 0;
-
-struct timer_list arm_mode_timer;
-#define ARM_MODE_TIMER_MSEC    100
-static void arm_mode_timer_handler(unsigned long data)
-{
-       int i;
-       PM_DBG("enter %s\n", __func__);
-       if (cpu_usage_run == 0) {
-               PM_DBG("STOP\n");
-               return ;
-       }
-
-       arm_mode_timer.expires  = jiffies + msecs_to_jiffies(ARM_MODE_TIMER_MSEC);
-       add_timer(&arm_mode_timer);
-       for(i = 0; i < cpu_usage_percent; i++) {
-               mdelay(1);
-       }
-}
-
-static void handler_cpu_usage(struct work_struct *work)
-{      
-#if 1
-       while(cpu_usage_run) {
-               barrier();
-       }
-#else
-       del_timer(&arm_mode_timer);
-       arm_mode_timer.expires  = jiffies + msecs_to_jiffies(ARM_MODE_TIMER_MSEC);
-       add_timer(&arm_mode_timer);
-#endif
-}
-ssize_t cpu_usage_show(struct kobject *kobj, struct kobj_attribute *attr,
-               char *buf)
-{
-       char *str = buf;
-       str += sprintf(str, "HELLO\n");
-       if (str != buf)
-               *(str - 1) = '\n';
-       return (str - buf);
-
-}
-ssize_t cpu_usage_store(struct kobject *kobj, struct kobj_attribute *attr,
-               const char *buf, size_t n)
-{
-       struct workqueue_struct *workqueue;
-       struct work_struct *work;
-       char cmd[20];
-       int usage = 0;
-       int cpu;
-
-       sscanf(buf, "%s %d", cmd, &usage);
-
-       if((!strncmp(cmd, "start", strlen("start")))) {
-               PM_DBG("get cmd start\n");
-               cpu_usage_run = 1;
-               
-               cpu_usage_percent = (ARM_MODE_TIMER_MSEC * usage) / 100;
-
-
-               for_each_online_cpu(cpu){
-                       work = &per_cpu(work_cpu_usage, cpu);
-                       workqueue = per_cpu(workqueue_cpu_usage, cpu);
-                       if (!work || !workqueue){
-                               PM_ERR("work or workqueue NULL\n");
-                               return n;
-                       }       
-                       queue_work_on(cpu, workqueue, work);
-               }
-#if 0
-               del_timer(&arm_mode_timer);
-               arm_mode_timer.expires  = jiffies + msecs_to_jiffies(ARM_MODE_TIMER_MSEC);
-               add_timer(&arm_mode_timer);
-#endif
-       
-       } else if (!strncmp(cmd, "stop", strlen("stop"))) {
-               PM_DBG("get cmd stop\n");
-               cpu_usage_run = 0;
-       }
-
-       return n;
-}
-
-static int __init cpu_usage_init(void)
-{
-       struct workqueue_struct **workqueue;
-       struct work_struct      *work;
-       int cpu;
-       
-       for_each_online_cpu(cpu){       
-               work = &per_cpu(work_cpu_usage, cpu);
-               workqueue = &per_cpu(workqueue_cpu_usage, cpu);
-               if (!work || !workqueue){
-                       PM_ERR("work or workqueue NULL\n");
-                       return -1;
-               }
-                       
-               *workqueue = create_singlethread_workqueue("workqueue_cpu_usage");
-               INIT_WORK(work, handler_cpu_usage);
-       }
-
-       setup_timer(&arm_mode_timer, arm_mode_timer_handler, 0);
-       return 0;
-}
-late_initcall(cpu_usage_init);
diff --git a/arch/arm/mach-rockchip/rk_pm_tests/cpu_usage.h b/arch/arm/mach-rockchip/rk_pm_tests/cpu_usage.h
deleted file mode 100644 (file)
index 0c45ad4..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-#ifndef _CPU_USAGE_H_
-#define _CPU_USAGE_H_
-ssize_t cpu_usage_show(struct kobject *kobj, struct kobj_attribute *attr,
-               char *buf);
-ssize_t cpu_usage_store(struct kobject *kobj, struct kobj_attribute *attr,
-               const char *buf, size_t n);
-
-#endif
diff --git a/arch/arm/mach-rockchip/rk_pm_tests/dvfs_table_scan.c b/arch/arm/mach-rockchip/rk_pm_tests/dvfs_table_scan.c
deleted file mode 100644 (file)
index b29243e..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-#include <linux/clk.h>
-#include <linux/kobject.h>
-#include <linux/string.h>
-#include <linux/resume-trace.h>
-#include <linux/workqueue.h>
-#include <linux/mutex.h>
-#include <linux/module.h>
-#include <linux/syscalls.h>
-#include <linux/init.h>
-#include <linux/interrupt.h>
-#include <linux/delay.h>
-#include <linux/cpu.h>
-#include <linux/slab.h>
-#include <linux/dma-mapping.h>
-#include <linux/regulator/machine.h>
-#include <linux/mfd/wm831x/core.h>
-#include <linux/sysfs.h>
-#include <linux/err.h>
-#include <linux/watchdog.h>
-
-#include <linux/fs.h>
-#include <asm/unistd.h>
-#include <asm/uaccess.h>
-#include "rk_pm_tests.h"
-#include "rk_pm_tests.h"
-#include "dvfs_table_scan.h"
-/***************************************************************************/
-void rk29_wdt_start(void);
-void rk29_wdt_stop(void);
-void rk29_wdt_keepalive(void);
-int rk29_wdt_set_heartbeat(int timeout);
-
-#define ALIVE_INTERVAL                 2       //s
-#define WATCHDOG_TIMEOUT               (10*ALIVE_INTERVAL)
-#define RESERVE_TIME_FOR_TIMEOUT       600000  //ms
-
-ssize_t dvfs_table_scan_show(struct kobject *kobj, struct kobj_attribute *attr,
-               char *buf)
-{
-       char *str = buf;
-       str += sprintf(str, "start: \tstart scan dvfs table, send alive every 2s\n"
-                       "stop: \tstop send alive signal\n");
-       if (str != buf)
-               *(str - 1) = '\n';
-       return (str - buf);
-
-}
-
-ssize_t dvfs_table_scan_store(struct kobject *kobj, struct kobj_attribute *attr,
-               const char *buf, size_t n)
-{
-       char cmd[20];
-       int cur_test_need_time=0; //ms
-       static int cur_test_timeout_cnt = 0;
-
-       sscanf(buf, "%s %d", cmd, &cur_test_need_time);
-       
-       PM_DBG("%s: cmd(%s), cur_test_need_time(%d)\n", __func__, cmd, cur_test_need_time);
-               
-       if (!strncmp(cmd, "start", strlen("start"))) {
-               if (cur_test_need_time == 0)
-                       return n;
-               cur_test_timeout_cnt = (cur_test_need_time + RESERVE_TIME_FOR_TIMEOUT)/1000/ALIVE_INTERVAL;
-               rk29_wdt_start();
-               rk29_wdt_set_heartbeat(WATCHDOG_TIMEOUT);
-       } else if (!strncmp(cmd, "alive", strlen("alive"))) {
-               printk("cur_test_timeout_cnt:%d\n", cur_test_timeout_cnt);
-               if (cur_test_timeout_cnt-- > 0)         
-                       rk29_wdt_keepalive();
-
-       } else if (!strncmp(cmd, "stop", strlen("stop"))) {
-               cur_test_timeout_cnt = -1;
-               rk29_wdt_stop();
-       }
-
-       return n;
-}
diff --git a/arch/arm/mach-rockchip/rk_pm_tests/dvfs_table_scan.h b/arch/arm/mach-rockchip/rk_pm_tests/dvfs_table_scan.h
deleted file mode 100644 (file)
index bef9f7b..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-#ifndef _DVFS_TABLE_SCAN_H_
-#define _DVFS_TABLE_SCAN_H_
-ssize_t dvfs_table_scan_show(struct kobject *kobj, struct kobj_attribute *attr,
-               char *buf);
-ssize_t dvfs_table_scan_store(struct kobject *kobj, struct kobj_attribute *attr,
-               const char *buf, size_t n);
-
-#endif
diff --git a/arch/arm/mach-rockchip/rk_pm_tests/pvtm_test.c b/arch/arm/mach-rockchip/rk_pm_tests/pvtm_test.c
deleted file mode 100644 (file)
index 926c1e0..0000000
+++ /dev/null
@@ -1,524 +0,0 @@
-/* arch/arm/mach-rockchip/rk_pm_tests/pvtm_test.c
- *
- * Copyright (C) 2014 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.
- *
- */
-#include <linux/clk.h>
-#include <linux/delay.h>
-#include <linux/module.h>
-#include <linux/vmalloc.h>
-#include <linux/regulator/consumer.h>
-#include <asm/cacheflush.h>
-
-#define PVTM_TEST 0
-
-extern int rockchip_tsadc_get_temp(int chn);
-extern void rk29_wdt_keepalive(void);
-extern u32 pvtm_get_value(u32 ch, u32 time_us);
-
-#if PVTM_TEST
-char *pvtm_buf;
-static const char pi_result[] = "3141592653589793238462643383279528841971693993751058209749445923078164062862089986280348253421170679821480865132823664709384469555822317253594081284811174502841270193852115559644622948954930381964428810975665933446128475648233786783165271201991456485669234634861045432664821339360726024914127372458706606315588174881520920962829254917153643678925903611330530548820466521384146951941511609433057273657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566438602139494639522473719070217986943702770539217176293176752384674818467669451320005681271452635608277857713427577896091736371787214684409012249534301465495853710579227968925892354201995611212902196864344181598136297747713099605187072113499999983729780499510597317328160963185";
-int calc_pi(void)
-{
-       int bit = 0, i = 0;
-       long a = 10000, b = 0, c = 2800, d = 0, e = 0, g = 0;
-       int *result;
-       long *f;
-       int len = 0;
-       char *pi_calc, *pi_tmp;
-       char *pi_just = (char *)&pi_result[0];
-       size_t pi_just_size = sizeof(pi_result);
-
-        result = vmalloc(10000*sizeof(int));
-        if (result == NULL)
-               return -ENOMEM;
-
-        f = vmalloc(2801*sizeof(long));
-         if (f == NULL)
-               return -ENOMEM;
-
-        pi_calc = vmalloc(1000*sizeof(char));
-         if (pi_calc == NULL)
-               return -ENOMEM;
-
-       for (; b-c; )
-               f[b++] = a/5;
-       for (; d = 0, g = c*2; c -= 14, result[bit++] = e+d/a, e = d%a)
-               for (b = c; d += f[b]*a, f[b] = d%--g, d /= g--, --b; d *= b)
-                       ;
-
-       pi_tmp = pi_calc;
-       for (i = 0; i < bit; i++)
-               len += sprintf(pi_tmp+len, "%d", result[i]);
-
-       if (strncmp(pi_just, pi_calc, pi_just_size) == 0) {
-               vfree(result);
-               vfree(f);
-               vfree(pi_calc);
-               return 0;
-       } else {
-               vfree(result);
-               vfree(f);
-               vfree(pi_calc);
-
-               while (1)
-                       pr_info("calc_pi error\n");
-       }
-}
-
-void pvtm_repeat_test(void)
-{
-       struct regulator *regulator_arm;
-       struct clk *clk_core;
-       u32 pvtm, delta, old_pvtm;
-       u32 min_pvtm = -1, max_pvtm = 0;
-       u32 average = 0, sum = 0;
-       int i, n;
-
-       regulator_arm = regulator_get(NULL, "vdd_arm");
-       if (IS_ERR_OR_NULL(regulator_arm)) {
-               pr_err("get regulator err\n");
-               return;
-       }
-
-       clk_core = clk_get(NULL, "clk_core");
-       if (IS_ERR_OR_NULL(clk_core)) {
-               pr_err("get clk err\n");
-               return;
-       }
-
-       n = 1000;
-       for (i = 0; i < n; i++) {
-               rk29_wdt_keepalive();
-               pvtm = pvtm_get_value(0, 1000);
-
-               sum += pvtm;
-               if (!old_pvtm)
-                       old_pvtm = pvtm;
-
-               if (pvtm > max_pvtm)
-                       max_pvtm = pvtm;
-
-               if (pvtm < min_pvtm)
-                       min_pvtm = pvtm;
-       }
-
-       average = sum/n;
-       delta = max_pvtm - min_pvtm;
-       pr_info("rate %lu volt %d max %u min %u average %u delta %u\n",
-               clk_get_rate(clk_core), regulator_get_voltage(regulator_arm),
-               max_pvtm, min_pvtm, average, delta);
-}
-
-void pvtm_samp_interval_test(void)
-{
-       struct regulator *regulator_arm;
-       struct clk *clk_core;
-       u32 pvtm, old_pvtm = 0, samp_interval, times;
-       int i, n;
-
-       regulator_arm = regulator_get(NULL, "vdd_arm");
-       if (IS_ERR_OR_NULL(regulator_arm)) {
-               pr_err("get regulator err\n");
-               return;
-       }
-
-       clk_core = clk_get(NULL, "clk_core");
-       if (IS_ERR_OR_NULL(clk_core)) {
-               pr_err("get clk err\n");
-               return;
-       }
-
-
-       n = 10;
-       for (i = 0; i < n; i++) {
-               rk29_wdt_keepalive();
-               samp_interval = 10 * (1 << i);
-               pvtm = pvtm_get_value(0, samp_interval);
-
-               if (!old_pvtm)
-                       old_pvtm = pvtm;
-
-               times = (1000*pvtm)/old_pvtm;
-
-               old_pvtm = pvtm;
-
-               pr_info("rate %lu volt %d samp_interval %d pvtm %d times %d\n",
-                       clk_get_rate(clk_core),
-                       regulator_get_voltage(regulator_arm),
-                       samp_interval, pvtm, times);
-       }
-}
-
-void pvtm_temp_test(void)
-{
-       struct regulator *regulator_arm;
-       struct clk *clk_core;
-       int temp, old_temp = 0;
-       int volt;
-       u32 rate;
-
-       regulator_arm = regulator_get(NULL, "vdd_arm");
-       if (IS_ERR_OR_NULL(regulator_arm)) {
-               pr_err("get regulator err\n");
-               return;
-       }
-
-       clk_core = clk_get(NULL, "clk_core");
-       if (IS_ERR_OR_NULL(clk_core)) {
-               pr_err("get clk err\n");
-               return;
-       }
-
-       volt = 1100000;
-       rate = 312000000;
-       regulator_set_voltage(regulator_arm, volt, volt);
-       clk_set_rate(clk_core, rate);
-
-       do {
-               rk29_wdt_keepalive();
-               temp = rockchip_tsadc_get_temp(1);
-               if (!old_temp)
-                       old_temp = temp;
-
-               if (temp-old_temp >= 2)
-                       pr_info("rate %lu volt %d temp %d pvtm %u\n",
-                               clk_get_rate(clk_core),
-                               regulator_get_voltage(regulator_arm),
-                               temp, pvtm_get_value(0, 1000));
-
-               old_temp = temp;
-       } while (1);
-}
-
-
-#define ALL_DONE_FLAG  'a'
-#define ONE_DONE_FLAG  'o'
-#define ALL_BUF_SIZE   (PAGE_SIZE << 8)
-#define ONE_BUF_SIZE   PAGE_SIZE
-#define VOLT_STEP      (12500)         /*mv*/
-#define VOLT_START     (1300000)       /*mv*/
-#define VOLT_END       (1000000)       /*mv*/
-#define RATE_STEP      (48000000)      /*hz*/
-#define RATE_START     (816000000)     /*hz*/
-#define RATE_END       (1200000000)    /*hz*/
-
-void scale_min_pvtm_fix_volt(void)
-{
-       struct regulator *regulator_arm;
-       struct clk *clk_core;
-       unsigned long rate;
-       u32 pvtm, old_pvtm = 0;
-       int volt, i, ret = 0;
-
-       regulator_arm = regulator_get(NULL, "vdd_arm");
-       if (IS_ERR_OR_NULL(regulator_arm)) {
-               pr_info("get regulator err\n");
-               return;
-       }
-
-       clk_core = clk_get(NULL, "clk_core");
-       if (IS_ERR_OR_NULL(clk_core)) {
-               pr_info("get clk err\n");
-               return;
-       }
-
-       volt = VOLT_START;
-       rate = RATE_START;
-       do {
-               for (i = 0; i < ALL_BUF_SIZE; i += ONE_BUF_SIZE) {
-                       if (pvtm_buf[i] == ALL_DONE_FLAG) {
-                               pr_info("=============test done!========\n");
-                               do {
-                                       if (i) {
-                                               i -= ONE_BUF_SIZE;
-                                               pr_info("%s", pvtm_buf+i+1);
-                                       } else {
-                                               pr_info("no item!!!!\n");
-                                       }
-                               } while (i);
-
-                               do {
-                                       rk29_wdt_keepalive();
-                                       msleep(1000);
-                               } while (1);
-                       }
-                       if (pvtm_buf[i] != ONE_DONE_FLAG)
-                               break;
-                       volt -= VOLT_STEP;
-               }
-
-               if (volt < VOLT_END) {
-                       pvtm_buf[i] = ALL_DONE_FLAG;
-                       continue;
-               }
-
-               pvtm_buf[i] = ONE_DONE_FLAG;
-
-               ret = regulator_set_voltage(regulator_arm, volt, volt);
-               if (ret) {
-                       pr_err("set volt(%d) err:%d\n", volt, ret);
-
-                       do {
-                               rk29_wdt_keepalive();
-                               msleep(1000);
-                       } while (1);
-               }
-
-               do {
-                       rk29_wdt_keepalive();
-
-                       flush_cache_all();
-                       outer_flush_all();
-
-                       clk_set_rate(clk_core, rate);
-
-                       calc_pi();
-                       /*fft_test();*/
-                       mdelay(500);
-                       rk29_wdt_keepalive();
-
-                       pvtm = pvtm_get_value(0, 1000);
-                       if (!old_pvtm)
-                               old_pvtm = pvtm;
-                       sprintf(pvtm_buf+i+1, "%d %lu %d %d %d\n",
-                               volt, clk_get_rate(clk_core), pvtm,
-                               rockchip_tsadc_get_temp(1), old_pvtm-pvtm);
-
-                       pr_info("%s", pvtm_buf+i+1);
-
-                       old_pvtm = pvtm;
-                       rate += RATE_STEP;
-               } while (1);
-       } while (1);
-}
-
-void scale_min_pvtm_fix_rate(void)
-{
-       struct regulator *regulator_arm;
-       struct clk *clk_core;
-       unsigned long rate;
-       u32 pvtm, old_pvtm = 0;
-       int volt, i, ret = 0;
-
-       regulator_arm = regulator_get(NULL, "vdd_arm");
-       if (IS_ERR_OR_NULL(regulator_arm)) {
-               pr_info("get regulator err\n");
-               return;
-       }
-
-       clk_core = clk_get(NULL, "clk_core");
-       if (IS_ERR_OR_NULL(clk_core)) {
-               pr_info("get clk err\n");
-               return;
-       }
-
-       volt = VOLT_START;
-       rate = RATE_START;
-       do {
-               for (i = 0; i < ALL_BUF_SIZE; i += ONE_BUF_SIZE) {
-                       if (pvtm_buf[i] == ALL_DONE_FLAG) {
-                               pr_info("=============test done!========\n");
-                               do {
-                                       if (i) {
-                                               i -= ONE_BUF_SIZE;
-                                               pr_info("%s", pvtm_buf+i+1);
-                                       } else {
-                                               pr_info("no item!!!!\n");
-                                       }
-                               } while (i);
-
-                               do {
-                                       rk29_wdt_keepalive();
-                                       msleep(1000);
-                               } while (1);
-                       }
-                       if (pvtm_buf[i] != ONE_DONE_FLAG)
-                               break;
-
-                       rate += RATE_STEP;
-               }
-
-               if (rate > RATE_END) {
-                       pvtm_buf[i] = ALL_DONE_FLAG;
-                       continue;
-               }
-
-               pvtm_buf[i] = ONE_DONE_FLAG;
-
-               ret = regulator_set_voltage(regulator_arm, volt, volt);
-               if (ret) {
-                       pr_err("set volt(%d) err:%d\n", volt, ret);
-
-                       do {
-                               rk29_wdt_keepalive();
-                               msleep(1000);
-                       } while (1);
-               }
-
-               ret = clk_set_rate(clk_core, rate);
-               do {
-                       rk29_wdt_keepalive();
-
-                       flush_cache_all();
-                       outer_flush_all();
-                       regulator_set_voltage(regulator_arm, volt, volt);
-
-                       calc_pi();
-                       mdelay(500);
-                       rk29_wdt_keepalive();
-
-                       pvtm = pvtm_get_value(0, 1000);
-                       if (!old_pvtm)
-                               old_pvtm = pvtm;
-
-                       sprintf(pvtm_buf+i+1, "%d %lu %d %d %d\n",
-                               volt, clk_get_rate(clk_core), pvtm,
-                               rockchip_tsadc_get_temp(1), old_pvtm-pvtm);
-
-                       pr_info("%s", pvtm_buf+i+1);
-                       old_pvtm = pvtm;
-                       volt -= VOLT_STEP;
-               } while (1);
-       } while (1);
-}
-
-#endif
-
-void scale_pvtm_fix_freq(void)
-{
-       struct regulator *regulator_arm;
-       struct clk *clk_core_b, *clk_core_l;
-       unsigned long rate;
-       u32 pvtm, old_pvtm = 0;
-       int volt, ret = 0;
-
-       regulator_arm = regulator_get(NULL, "vdd_arm");
-       if (IS_ERR_OR_NULL(regulator_arm)) {
-               pr_info("get regulator err\n");
-               return;
-       }
-
-       clk_core_b = clk_get(NULL, "clk_core_b");
-       if (IS_ERR_OR_NULL(clk_core_b)) {
-               pr_info("get clk err\n");
-               return;
-       }
-       clk_core_l = clk_get(NULL, "clk_core_l");
-       if (IS_ERR_OR_NULL(clk_core_l)) {
-               pr_info("get clk err\n");
-               return;
-       }
-
-       volt = 1300000;
-       rate = 216000000;
-       ret = regulator_set_voltage(regulator_arm, volt, volt);
-       if (ret)
-               pr_err("set volt(%d) err:%d\n", volt, ret);
-
-       do {
-               clk_set_rate(clk_core_b, rate);
-               clk_set_rate(clk_core_l, rate);
-               mdelay(500);
-               pvtm = pvtm_get_value(0, 1000);
-               if (!old_pvtm)
-                       old_pvtm = pvtm;
-               pr_info("%d %lu %d %d\n",
-                       volt, clk_get_rate(clk_core_b), pvtm, old_pvtm-pvtm);
-
-               old_pvtm = pvtm;
-               rate += 48000000;
-               if (rate > 1200000000)
-                       break;
-       } while (1);
-}
-
-void scale_pvtm_fix_volt(void)
-{
-       struct regulator *regulator_arm;
-       struct clk *clk_core_b, *clk_core_l;
-       unsigned long rate;
-       u32 pvtm, old_pvtm = 0;
-       int volt, ret = 0;
-
-       regulator_arm = regulator_get(NULL, "vdd_arm");
-       if (IS_ERR_OR_NULL(regulator_arm)) {
-               pr_info("get regulator err\n");
-               return;
-       }
-
-       clk_core_b = clk_get(NULL, "clk_core_b");
-       if (IS_ERR_OR_NULL(clk_core_b)) {
-               pr_info("get clk err\n");
-               return;
-       }
-
-       clk_core_l = clk_get(NULL, "clk_core_b");
-       if (IS_ERR_OR_NULL(clk_core_l)) {
-               pr_info("get clk err\n");
-               return;
-       }
-
-       volt = 1300000;
-       rate = 816000000;
-
-       ret = regulator_set_voltage(regulator_arm, volt, volt);
-       if (ret)
-               pr_err("set volt(%d) err:%d\n", volt, ret);
-
-       ret = clk_set_rate(clk_core_b, rate);
-       ret = clk_set_rate(clk_core_l, rate);
-       do {
-               regulator_set_voltage(regulator_arm, volt, volt);
-               mdelay(500);
-               pvtm = pvtm_get_value(0, 1000);
-               if (!old_pvtm)
-                       old_pvtm = pvtm;
-
-               pr_info("%d %lu %d %d\n",
-                       volt, clk_get_rate(clk_core_b), pvtm, old_pvtm-pvtm);
-               old_pvtm = pvtm;
-               volt -= 12500;
-               if (volt < 950000) {
-                       regulator_set_voltage(regulator_arm, 1300000, 1300000);
-                       break;
-               }
-       } while (1);
-}
-
-ssize_t pvtm_show(struct kobject *kobj, struct kobj_attribute *attr,
-                 char *buf)
-{
-       char *str = buf;
-
-       str += sprintf(str, "core:%d\ngpu:%d\n",
-               pvtm_get_value(0, 1000),
-               pvtm_get_value(1, 1000));
-       return (str - buf);
-}
-
-ssize_t pvtm_store(struct kobject *kobj, struct kobj_attribute *attr,
-                  const char *buf, size_t n)
-{
-       return n;
-}
-
-int pvtm_buf_init(void)
-{
-#if PVTM_TEST
-       pvtm_buf = (char *)__get_free_pages(GFP_KERNEL, 8);
-
-#endif
-       return 0;
-}
-fs_initcall(pvtm_buf_init);
diff --git a/arch/arm/mach-rockchip/rk_pm_tests/rk_pm_tests.c b/arch/arm/mach-rockchip/rk_pm_tests/rk_pm_tests.c
deleted file mode 100644 (file)
index 1ab12bf..0000000
+++ /dev/null
@@ -1,138 +0,0 @@
-/* arch/arm/mach-rk30/rk_pm_tests.c
- *
- * Copyright (C) 2010 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.
- *
- */
-
-
-/*************************************************************************/
-/*       COPYRIGHT (C)  ROCK-CHIPS FUZHOU . ALL RIGHTS RESERVED.*/
-/*************************************************************************
-FILE           :         rk_pm_tests.c
-DESC           :         Power management in dynning state
-AUTHOR         :         chenxing
-DATE           :         2012-7-2
-NOTES          :
-$LOG: GPIO.C,V $
-REVISION 0.01
-#include <linux/clk.h>
-#include <linux/kobject.h>
- ***************************************************************************/
-#include <linux/string.h>
-#include <linux/resume-trace.h>
-#include <linux/workqueue.h>
-#include <linux/mutex.h>
-#include <linux/module.h>
-#include <linux/syscalls.h>
-#include <linux/init.h>
-#include <linux/interrupt.h>
-#include <linux/delay.h>
-#include <linux/cpu.h>
-#include <linux/slab.h>
-#include <linux/dma-mapping.h>
-#include <linux/regulator/machine.h>
-#include <linux/mfd/wm831x/core.h>
-#include <linux/sysfs.h>
-#include <linux/err.h>
-
-#include "rk_pm_tests.h"
-#include "clk_rate.h"
-#include "clk_volt.h"
-#include "cpu_usage.h"
-#include "dvfs_table_scan.h"
-
-struct kobject *rk_pm_tests_kobj=NULL;
-struct pm_attribute {
-       struct attribute        attr;
-       ssize_t (*show)(struct kobject *kobj, struct kobj_attribute *attr,
-                       char *buf);
-       ssize_t (*store)(struct kobject *kobj, struct kobj_attribute *attr,
-                       const char *buf, size_t n);
-};
-
-extern ssize_t pvtm_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf);
-extern ssize_t pvtm_store(struct kobject *kobj, struct kobj_attribute *attr, const char *buf, size_t n);
-
-static struct pm_attribute pm_attrs[] = {
-       /* node_name    permision       show_func       store_func*/
-       __ATTR(clk_rate, S_IRUGO | S_IWUSR | S_IWUGO, clk_rate_show, clk_rate_store),
-       __ATTR(clk_volt, S_IRUGO | S_IWUSR | S_IWUGO, clk_volt_show, clk_volt_store),
-       __ATTR(dvfs_table_scan, S_IRUGO | S_IWUSR | S_IWUGO, dvfs_table_scan_show, dvfs_table_scan_store),
-       __ATTR(cpu_usage, S_IRUGO | S_IWUSR, cpu_usage_show, cpu_usage_store),
-       __ATTR(pvtm, S_IRUGO | S_IWUSR, pvtm_show, pvtm_store),
-/*
-       __ATTR(maxfreq_volt, S_IRUGO | S_IWUSR, maxfreq_show, maxfreq_store),
-       __ATTR(freq_limit, S_IRUGO | S_IWUSR, freq_limit_show, freq_limit_store),
-       __ATTR(cpu_usage, S_IRUGO | S_IWUSR, cpu_usage_show, cpu_usage_store),
-       __ATTR(auto_wakeup, S_IRUGO | S_IWUSR, auto_wakeup_show, auto_wakeup_store),
-       __ATTR(suspend_test,   S_IRUGO | S_IWUSR,   suspend_test_show, suspend_test_store),
-       __ATTR(clk_auto_volt, S_IRUGO | S_IWUSR, clk_auto_volt_show, clk_auto_volt_store),
-*/
-};
-
-static void __exit rk_pm_tests_exit(void)
-{
-       kobject_put(rk_pm_tests_kobj);
-}
-
-struct kobject *get_rk_pm_tests_kobj(void)
-{
-
-    if(rk_pm_tests_kobj==NULL)
-    {
-        rk_pm_tests_kobj = kobject_create_and_add("pm_tests", NULL);
-
-       if (!rk_pm_tests_kobj)
-               return NULL;
-    }
-    return rk_pm_tests_kobj;
-}
-
-int rk_pm_tests_kobj_atrradd(const struct attribute *attr)
-{
-    int ret;
-    struct kobject * pm_kobj;
-    pm_kobj =get_rk_pm_tests_kobj();
-
-    if (!pm_kobj)
-    return -ENOMEM;
-
-    ret = sysfs_create_file(pm_kobj,attr);
-    if (ret != 0) {
-        PM_ERR("pm tests create %s node error\n",attr->name);
-        return ret;
-    }
-    return ret;
-}
-
-static int __init rk_pm_tests_init(void)
-{
-       int i, ret = 0;
-         struct kobject * pm_kobj;
-       pm_kobj =get_rk_pm_tests_kobj();
-
-       if (!pm_kobj)
-               return -ENOMEM;
-
-       for (i = 0; i < ARRAY_SIZE(pm_attrs); i++) {
-               ret = sysfs_create_file(pm_kobj, &pm_attrs[i].attr);
-               if (ret != 0) {
-                       PM_ERR("create index %d error\n", i);
-                       return ret;
-               }
-       }
-       
-       return ret;
-}
-
-late_initcall(rk_pm_tests_init);
-module_exit(rk_pm_tests_exit);
diff --git a/arch/arm/mach-rockchip/rk_pm_tests/rk_pm_tests.h b/arch/arm/mach-rockchip/rk_pm_tests/rk_pm_tests.h
deleted file mode 100644 (file)
index d0d7a8d..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-#ifndef _RK_PM_TESTS_H_
-#define _RK_PM_TESTS_H_
-#define PM_DBG(fmt, args...) printk(KERN_DEBUG "PM_TESTS_DBG:\t"fmt, ##args)
-#define PM_ERR(fmt, args...) printk(KERN_ERR "PM_TESTS_ERR:\t"fmt, ##args)
-#endif