Beispiel #1
0
/*
***************************************************************
 @Function   :mali_set_freq

 @Description:Set the frequency of gpu related clocks with mali dvfs function

 @Input	     :Frequency value

 @Return     :Zero or error code
***************************************************************
*/
static int mali_set_freq(int freq /* MHz */)
{
	int err;
	mali_dev_pause();
	err = set_freq(freq);
	mali_dev_resume();
	return err;
}
static ssize_t power_power_events_write(struct file *filp, const char __user *ubuf, size_t cnt, loff_t *ppos)
{
	if (!strncmp(ubuf, mali_power_events[_MALI_DEVICE_SUSPEND], strlen(mali_power_events[_MALI_DEVICE_SUSPEND]) - 1)) {
		mali_pm_os_suspend(MALI_TRUE);
	} else if (!strncmp(ubuf, mali_power_events[_MALI_DEVICE_RESUME], strlen(mali_power_events[_MALI_DEVICE_RESUME]) - 1)) {
		mali_pm_os_resume();
	} else if (!strncmp(ubuf, mali_power_events[_MALI_DEVICE_DVFS_PAUSE], strlen(mali_power_events[_MALI_DEVICE_DVFS_PAUSE]) - 1)) {
		mali_dev_pause();
	} else if (!strncmp(ubuf, mali_power_events[_MALI_DEVICE_DVFS_RESUME], strlen(mali_power_events[_MALI_DEVICE_DVFS_RESUME]) - 1)) {
		mali_dev_resume();
	}
	*ppos += cnt;
	return cnt;
}
static ssize_t power_events_write(struct file *filp, const char __user *ubuf, size_t cnt, loff_t *ppos)
{
	
	memset(pwr_buf,0,POWER_BUFFER_SIZE);
	virtual_power_status_register = 0;
	if (!strncmp(ubuf,mali_power_events[_MALI_DEVICE_SUSPEND],strlen(mali_power_events[_MALI_DEVICE_SUSPEND])))
	{
		mali_pm_os_suspend();
		/* @@@@ assuming currently suspend is successful later on to tune as per previous*/
		virtual_power_status_register =1;

	}
	else if (!strncmp(ubuf,mali_power_events[_MALI_DEVICE_RESUME],strlen(mali_power_events[_MALI_DEVICE_RESUME])))
	{
		mali_pm_os_resume();

		/* @@@@ assuming currently resume is successful later on to tune as per previous */
		virtual_power_status_register = 1;
	}
	else if (!strncmp(ubuf,mali_power_events[_MALI_DEVICE_DVFS_PAUSE],strlen(mali_power_events[_MALI_DEVICE_DVFS_PAUSE])))
	{
		mali_bool power_on;
		mali_dev_pause(&power_on);
		if (!power_on)
		{
			virtual_power_status_register = 2;
			mali_dev_resume();		
		}
		else
		{
			/*  @@@@ assuming currently resume is successful later on to tune as per previous */
			virtual_power_status_register =1;
		}
	}
	else if (!strncmp(ubuf,mali_power_events[_MALI_DEVICE_DVFS_RESUME],strlen(mali_power_events[_MALI_DEVICE_DVFS_RESUME])))
	{
		mali_dev_resume();
		/*  @@@@ assuming currently resume is successful later on to tune as per previous */
		virtual_power_status_register = 1;
                
	}
	*ppos += cnt;
	sprintf(pwr_buf, "%d",virtual_power_status_register);
	return cnt;
}
Beispiel #4
0
static void do_scaling(struct work_struct *work)
{
	mali_dvfs_threshold_table * pdvfs = pmali_plat->dvfs_table;
	int err = mali_perf_set_num_pp_cores(num_cores_enabled);
	MALI_DEBUG_ASSERT(0 == err);
	MALI_IGNORE(err);
	if (pdvfs[currentStep].freq_index != pdvfs[lastStep].freq_index) {
		mali_dev_pause();
		mali_clock_set(pdvfs[currentStep].freq_index);
		mali_dev_resume();
		lastStep = currentStep;
	}
#ifdef CONFIG_MALI400_PROFILING
	_mali_osk_profiling_add_event(MALI_PROFILING_EVENT_TYPE_SINGLE |
					MALI_PROFILING_EVENT_CHANNEL_GPU |
					MALI_PROFILING_EVENT_REASON_SINGLE_GPU_FREQ_VOLT_CHANGE,
					get_current_frequency(),
					0,	0,	0,	0);
#endif
}
Beispiel #5
0
/** This function is called when user wants to suspend the mali GPU device in order
 * to simulate the power up and power down events.
 */
static ssize_t store_file(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
{
	int err = 0;

#if MALI_POWER_MGMT_TEST_SUITE
	int test_flag_dvfs = 0;
        pwr_mgmt_status_reg = 0;
        mali_is_pmu_present();

#endif
	if (!strncmp(buf,mali_states[_MALI_DEVICE_SUSPEND],strlen(mali_states[_MALI_DEVICE_SUSPEND])))
	{
		MALI_DEBUG_PRINT(4, ("PMMDEBUG: MALI suspend Power operation is scheduled\n" ));
		err = mali_pm_suspend(NULL);
	}

#if MALI_POWER_MGMT_TEST_SUITE
	else if (!strncmp(buf,mali_pmm_recording_events[_MALI_DEVICE_PMM_REGISTERED_CORES],strlen(mali_pmm_recording_events[_MALI_DEVICE_PMM_REGISTERED_CORES])))
	{
		MALI_DEBUG_PRINT(4, ("PMMDEBUG: MALI Device get number of registerd cores\n" ));
		pwr_mgmt_status_reg = _mali_pmm_cores_list();
		return count;
	}
	else if (!strncmp(buf,mali_pmm_recording_events[_MALI_DEVICE_PMM_TIMEOUT_EVENT],strlen(mali_pmm_recording_events[_MALI_DEVICE_PMM_TIMEOUT_EVENT])))
	{
		MALI_DEBUG_PRINT(4, ("PMMDEBUG: MALI timeout event recording is enabled\n" ));
		mali_timeout_event_recording_on = 1;
	}
	else if (!strncmp(buf,mali_pmm_recording_events[_MALI_DEVICE_PMM_JOB_SCHEDULING_EVENTS],strlen(mali_pmm_recording_events[_MALI_DEVICE_PMM_JOB_SCHEDULING_EVENTS])))
	{
		MALI_DEBUG_PRINT(4, ("PMMDEBUG: MALI Job scheduling  events recording is enabled\n" ));
		mali_job_scheduling_events_recording_on = 1;
	}
#endif /* MALI_POWER_MGMT_TEST_SUITE */

	else if (!strncmp(buf,mali_states[_MALI_DEVICE_RESUME],strlen(mali_states[_MALI_DEVICE_RESUME]))) 
	{
		MALI_DEBUG_PRINT(4, ("PMMDEBUG: MALI Resume Power operation is scheduled\n" ));
		err = mali_pm_resume(NULL);
	}
	else if (!strncmp(buf,mali_states[_MALI_DVFS_PAUSE_EVENT],strlen(mali_states[_MALI_DVFS_PAUSE_EVENT])))
	{
		MALI_DEBUG_PRINT(4, ("PMMDEBUG: MALI DVFS Pause Power operation is scheduled\n" ));
		err = mali_dev_pause();
#if MALI_POWER_MGMT_TEST_SUITE
		test_flag_dvfs = 1;
#endif /* MALI_POWER_MGMT_TEST_SUITE */
	}
	else if (!strncmp(buf,mali_states[_MALI_DVFS_RESUME_EVENT],strlen(mali_states[_MALI_DVFS_RESUME_EVENT])))
	{
		MALI_DEBUG_PRINT(4, ("PMMDEBUG: MALI DVFS Resume Power operation is scheduled\n" ));
		err = mali_dev_resume();
#if MALI_POWER_MGMT_TEST_SUITE
		test_flag_dvfs = 1;
#endif /* MALI_POWER_MGMT_TEST_SUITE */
	}
	else 
	{
		MALI_DEBUG_PRINT(4, ("PMMDEBUG: Invalid Power Mode Operation selected\n" ));
	}
#if MALI_POWER_MGMT_TEST_SUITE
	if (test_flag_dvfs == 1)
	{
		if (err)
		{
			pwr_mgmt_status_reg = 2;
		}
		else
		{
			pwr_mgmt_status_reg = 1;
		}
	}
	else
	{
		if (1 == is_mali_pmu_present)
		{
			pwr_mgmt_status_reg = pmu_get_power_up_down_info();
		}
	}
#endif /* MALI_POWER_MGMT_TEST_SUITE */
	return count;
}