#include <linux/delay.h>
#include <linux/regulator/consumer.h>
#include <linux/fs.h>
+#include <linux/miscdevice.h>
#include <linux/string.h>
#include <linux/earlysuspend.h>
#include <asm/unistd.h>
extern int rk30_tsadc_get_temp(unsigned int chn);
+static char sys_state;
+static ssize_t sys_state_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos)
+{
+ char state;
+
+ if (count < 1)
+ return count;
+ if (copy_from_user(&state, buffer, 1)) {
+ return -EFAULT;
+ }
+
+ sys_state = state;
+ return count;
+}
+
+static const struct file_operations sys_state_fops = {
+ .owner = THIS_MODULE,
+ .write = sys_state_write,
+};
+
+static struct miscdevice sys_state_dev = {
+ .fops = &sys_state_fops,
+ .name = "sys_state",
+ .minor = MISC_DYNAMIC_MINOR,
+};
+
static void rk30_cpufreq_temp_limit_work_func(struct work_struct *work)
{
struct cpufreq_policy *policy;
FREQ_PRINTK_LOG("cpu_thermal(%d)\n", temp);
gpu_irqs[1] = kstat_irqs(IRQ_GPU_GP);
- if (clk_get_rate(gpu_clk) > GPU_MAX_RATE) {
+ if (sys_state == '1' || clk_get_rate(gpu_clk) > GPU_MAX_RATE) {
delay = HZ / 20;
if ((gpu_irqs[1] - gpu_irqs[0]) < 3) {
limits_table = temp_limits_high;
freq_wq = create_singlethread_workqueue("rk30_cpufreqd");
#ifdef CONFIG_RK30_CPU_FREQ_LIMIT_BY_TEMP
+ misc_register(&sys_state_dev);
if (rk30_cpufreq_is_ondemand_policy(policy)) {
queue_delayed_work(freq_wq, &rk30_cpufreq_temp_limit_work, 0*HZ);
}
cpufreq_unregister_notifier(¬ifier_policy_block, CPUFREQ_POLICY_NOTIFIER);
if (freq_wq)
cancel_delayed_work(&rk30_cpufreq_temp_limit_work);
+ misc_deregister(&sys_state_dev);
#endif
if (freq_wq) {
flush_workqueue(freq_wq);