示例#1
0
/*
***************************************************************
 @Function   :mali_throttle_notifier_call

 @Description:The callback function of throttle notifier
		
 @Input	     :nfb, mode, cmd

 @Return     :retval
***************************************************************
*/
static int mali_throttle_notifier_call(struct notifier_block *nfb, unsigned long mode, void *cmd)
{
    int retval = NOTIFY_DONE;
	
	if(mode == BUDGET_GPU_THROTTLE && cur_mode == 1)
    {
		mali_set_freq(freq_table[2]);
        cur_mode = 0;
    }
    else
	{
        if(cmd && (*(int *)cmd) == 1 && cur_mode != 1)
		{
			mali_set_freq(freq_table[3]);
           	cur_mode = 1;
        }
		else if(cmd && (*(int *)cmd) == 0 && cur_mode != 0)
		{
			mali_set_freq(freq_table[2]);
            cur_mode = 0;
        }
		else if(cmd && (*(int *)cmd) == 2 && cur_mode != 2)
		{
			mali_set_freq(freq_table[1]);
			cur_mode = 2;
		}
    }	
	
	return retval;
}
示例#2
0
/*
***************************************************************
 @Function   :mali_throttle_notifier_call

 @Description:The callback function of throttle notifier
		
 @Input	     :nfb, mode, cmd

 @Return     :retval
***************************************************************
*/
static int mali_throttle_notifier_call(struct notifier_block *nfb, unsigned long mode, void *cmd)
{
    int retval = NOTIFY_DONE;

#if !defined(CONFIG_ARCH_SUN8IW7P1)
	if(mode == BUDGET_GPU_THROTTLE && cur_mode == 1)
	{
		mali_set_freq(freq_table[2]);
        cur_mode = 0;
    }
	else
	{
        if(cmd && (*(int *)cmd) == 1 && cur_mode != 1)
		{
			mali_set_freq(freq_table[3]);
           	cur_mode = 1;
        }
		else if(cmd && (*(int *)cmd) == 0 && cur_mode != 0)
		{
			mali_set_freq(freq_table[2]);
            cur_mode = 0;
        }
		else if(cmd && (*(int *)cmd) == 2 && cur_mode != 2)
		{
			mali_set_freq(freq_table[1]);
			cur_mode = 2;
		}
    }
#elif defined(CONFIG_ARCH_SUN8IW7P1)
	int temperature = 0;
	int i = 0;
	temperature = ths_read_data(4);
	for(i=0;i<sizeof(temperature_threshold)/sizeof(temperature_threshold[0]);i++)
	{
		if(temperature < temperature_threshold[i])
		{
			if(cur_mode != i)
			{
				mali_set_freq(thermal_ctrl_freq[i]);
				cur_mode = i;
			}
			goto out;
		}
	}
	
	mali_set_freq(thermal_ctrl_freq[i]);
	cur_mode = i;

out:		
#endif
	return retval;
}