2 #include <linux/kobject.h>
3 #include <linux/string.h>
4 #include <linux/resume-trace.h>
5 #include <linux/workqueue.h>
6 #include <linux/mutex.h>
7 #include <linux/module.h>
8 #include <linux/syscalls.h>
9 #include <linux/init.h>
10 #include <linux/interrupt.h>
11 #include <linux/delay.h>
12 #include <linux/cpu.h>
13 #include <linux/slab.h>
14 #include <linux/dma-mapping.h>
15 #include <linux/regulator/machine.h>
16 #include <linux/mfd/wm831x/core.h>
17 #include <linux/sysfs.h>
18 #include <linux/err.h>
19 #include <linux/watchdog.h>
22 #include <asm/unistd.h>
23 #include <asm/uaccess.h>
24 #include "rk_pm_tests.h"
25 #include "rk_pm_tests.h"
26 #include "dvfs_table_scan.h"
27 /***************************************************************************/
28 void rk29_wdt_start(void);
29 void rk29_wdt_stop(void);
30 void rk29_wdt_keepalive(void);
31 int rk29_wdt_set_heartbeat(int timeout);
33 #define ALIVE_INTERVAL 2 //s
34 #define WATCHDOG_TIMEOUT (10*ALIVE_INTERVAL)
35 #define RESERVE_TIME_FOR_TIMEOUT 600000 //ms
37 ssize_t dvfs_table_scan_show(struct kobject *kobj, struct kobj_attribute *attr,
41 str += sprintf(str, "start: \tstart scan dvfs table, send alive every 2s\n"
42 "stop: \tstop send alive signal\n");
49 ssize_t dvfs_table_scan_store(struct kobject *kobj, struct kobj_attribute *attr,
50 const char *buf, size_t n)
53 int cur_test_need_time=0; //ms
54 static int cur_test_timeout_cnt = 0;
56 sscanf(buf, "%s %d", cmd, &cur_test_need_time);
58 PM_DBG("%s: cmd(%s), cur_test_need_time(%d)\n", __func__, cmd, cur_test_need_time);
60 if (!strncmp(cmd, "start", strlen("start"))) {
61 if (cur_test_need_time == 0)
63 cur_test_timeout_cnt = (cur_test_need_time + RESERVE_TIME_FOR_TIMEOUT)/1000/ALIVE_INTERVAL;
65 rk29_wdt_set_heartbeat(WATCHDOG_TIMEOUT);
66 } else if (!strncmp(cmd, "alive", strlen("alive"))) {
67 printk("cur_test_timeout_cnt:%d\n", cur_test_timeout_cnt);
68 if (cur_test_timeout_cnt-- > 0)
71 } else if (!strncmp(cmd, "stop", strlen("stop"))) {
72 cur_test_timeout_cnt = -1;