From fa256c1543ec16f869544d1d3496ab62b6d96065 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=E9=BB=84=E6=B6=9B?= Date: Fri, 11 Apr 2014 10:49:24 +0800 Subject: [PATCH] ARM: rockchip: dvfs: get temp on workqueue --- arch/arm/mach-rockchip/dvfs.c | 10 ++++++---- include/linux/rockchip/dvfs.h | 1 + 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/arch/arm/mach-rockchip/dvfs.c b/arch/arm/mach-rockchip/dvfs.c index 25f52fbee2cc..bcdc16ae28db 100644 --- a/arch/arm/mach-rockchip/dvfs.c +++ b/arch/arm/mach-rockchip/dvfs.c @@ -456,20 +456,22 @@ static void dvfs_temp_limit_work_func(struct work_struct *work) struct pd_node *pd; struct dvfs_node *clk_dvfs_node; + queue_delayed_work_on(0, dvfs_wq, to_delayed_work(work), delay); + mutex_lock(&rk_dvfs_mutex); list_for_each_entry(vd, &rk_dvfs_tree, node) { mutex_lock(&vd->mutex); list_for_each_entry(pd, &vd->pd_list, node) { list_for_each_entry(clk_dvfs_node, &pd->clk_list, node) { - if (clk_dvfs_node->temp_limit_table) + if (clk_dvfs_node->temp_limit_table) { + clk_dvfs_node->temp = rockchip_tsadc_get_temp(clk_dvfs_node->temp_channel); clk_dvfs_node->vd->vd_dvfs_target(clk_dvfs_node, clk_dvfs_node->last_set_rate); + } } } mutex_unlock(&vd->mutex); } mutex_unlock(&rk_dvfs_mutex); - - queue_delayed_work_on(0, dvfs_wq, to_delayed_work(work), delay); } static DECLARE_DELAYED_WORK(dvfs_temp_limit_work, dvfs_temp_limit_work_func); @@ -736,7 +738,7 @@ static unsigned long dvfs_get_limit_rate(struct dvfs_node *clk_dvfs_node, unsign //temp limt if (clk_dvfs_node->temp_limit_table) { - temp = rockchip_tsadc_get_temp(clk_dvfs_node->temp_channel); + temp = clk_dvfs_node->temp; for (i=0; clk_dvfs_node->temp_limit_table[i].frequency != CPUFREQ_TABLE_END; i++) { if (temp > clk_dvfs_node->temp_limit_table[i].index) { temp_limit_rate = clk_dvfs_node->temp_limit_table[i].frequency; diff --git a/include/linux/rockchip/dvfs.h b/include/linux/rockchip/dvfs.h index 31454b8a18fa..297978cb5cb1 100644 --- a/include/linux/rockchip/dvfs.h +++ b/include/linux/rockchip/dvfs.h @@ -98,6 +98,7 @@ struct dvfs_node { unsigned int max_rate; //limit max frequency unsigned int last_set_rate; unsigned int temp_channel; + int temp; struct clk *clk; struct pd_node *pd; struct vd_node *vd; -- 2.34.1