gpu: update gcdENABLE_AUTO_FREQ to show gpu's load

This commit is contained in:
杜坤明
2011-06-22 17:54:48 +08:00
parent c472bb82fa
commit ac5f1288b8
2 changed files with 11 additions and 11 deletions

View File

@@ -40,7 +40,7 @@ struct clk *clk_gpu = NULL;
void get_run_idle(u32 *run, u32 *idle)
{
if(gcvPOWER_IDLE==lastState)
if(gcvPOWER_ON!=lastState)
{
do_gettimeofday(&tv_on);
usec_idle += (1000000*(tv_on.tv_sec-tv_idle.tv_sec)+(tv_on.tv_usec-tv_idle.tv_usec));
@@ -67,12 +67,12 @@ inline void cal_run_idle(gceCHIPPOWERSTATE State)
{
int freq = 0;
if(gcvPOWER_IDLE==lastState && gcvPOWER_ON==State) //gcvPOWER_IDLE->gcvPOWER_ON
if(gcvPOWER_ON!=lastState && gcvPOWER_ON==State) //NotON -> ON
{
do_gettimeofday(&tv_on);
usec_idle += (1000000*(tv_on.tv_sec-tv_idle.tv_sec)+(tv_on.tv_usec-tv_idle.tv_usec));
}
if(gcvPOWER_ON==lastState && gcvPOWER_IDLE==State) //gcvPOWER_ON->gcvPOWER_IDLE
}
else if(gcvPOWER_ON==lastState && gcvPOWER_ON!=State) //ON -> NotON
{
do_gettimeofday(&tv_idle);
usec_run += (1000000*(tv_idle.tv_sec-tv_on.tv_sec)+(tv_idle.tv_usec-tv_on.tv_usec));
@@ -80,12 +80,11 @@ inline void cal_run_idle(gceCHIPPOWERSTATE State)
freq = nextfreq;
nextfreq = 0;
if(freq) {
if(freq<24) freq = 24;
if(freq>600) freq = 600;
clk_gpu = clk_get(NULL, "gpu");
clk_set_parent(clk_gpu, clk_get(NULL, "general_pll"));
clk_set_rate(clk_get(NULL, "codec_pll"), freq*1000000);
clk_set_rate(clk_gpu, freq*1000000);
clk_set_parent(clk_gpu, clk_get(NULL, "codec_pll"));
//printk(" == > gpu change freq to %d \n", freq);
printk(" == > gpu change freq to %d \n", freq);
}
}

View File

@@ -207,7 +207,7 @@ void gputimer_callback(unsigned long arg)
u32 run, idle;
int precent, freq, diff;
mod_timer(&gpu_timer, jiffies + HZ/10);
mod_timer(&gpu_timer, jiffies + HZ/4);
get_run_idle(&run, &idle);
precent = (int)((run*100)/(run+idle));
@@ -237,8 +237,9 @@ void gputimer_callback(unsigned long arg)
last_freq = freq;
//set_nextfreq(freq);
}
printk("%8d /%8d = %3d %%, needfreq = %dM (%d)\n", (int)run, (int)(run+idle), precent, freq, power_cnt);
printk("gpu load : %3d %%\n", precent);
//printk("%8d /%8d = %3d %%, needfreq = %dM (%d)\n", (int)run, (int)(run+idle), precent, freq, power_cnt);
}
#elif(2==gcdENABLE_AUTO_FREQ)
#include <linux/timer.h>