mali_error kbase_cpuprops_uk_get_props(struct kbase_context *kctx, struct kbase_uk_cpuprops * const kbase_props)
{
	unsigned int max_cpu_freq;

	kbase_props->props.cpu_l1_dcache_line_size_log2 = L1_DCACHE_LINE_SIZE_LOG2;
	kbase_props->props.cpu_l1_dcache_size = L1_DCACHE_SIZE;
	kbase_props->props.cpu_flags = BASE_CPU_PROPERTY_FLAG_LITTLE_ENDIAN;

	kbase_props->props.nr_cores = NR_CPUS;
	kbase_props->props.cpu_page_size_log2 = PAGE_SHIFT;
	kbase_props->props.available_memory_size = totalram_pages << PAGE_SHIFT;

	kbasep_cpuprops_uk_get_cpu_id_info(kbase_props);

	/* check if kernel supports dynamic frequency scaling */
	max_cpu_freq = cpufreq_quick_get_max(KBASE_DEFAULT_CPU_NUM);
	if (max_cpu_freq != 0) {
		/* convert from kHz to mHz */
		kbase_props->props.max_cpu_clock_speed_mhz = max_cpu_freq / 1000;
	} else {
		/* fallback if CONFIG_CPU_FREQ turned off */
		int result;
		kbase_cpuprops_clock_speed_function kbase_cpuprops_uk_get_clock_speed;

		kbase_cpuprops_uk_get_clock_speed = (kbase_cpuprops_clock_speed_function) kbasep_get_config_value(kctx->kbdev, kctx->kbdev->config_attributes, KBASE_CONFIG_ATTR_CPU_SPEED_FUNC);
		result = kbase_cpuprops_uk_get_clock_speed(&kbase_props->props.max_cpu_clock_speed_mhz);
		if (result != 0)
			return MALI_ERROR_FUNCTION_FAILED;
	}

	return MALI_ERROR_NONE;
}
Exemplo n.º 2
0
/**
 * cpufreq_get_cur_state - callback function to get the current cooling state.
 * @cdev: thermal cooling device pointer.
 * @state: fill this variable with the current cooling state.
 *
 * Callback for the thermal cooling device to return the cpufreq
 * current cooling state.
 *
 * Return: 0 on success, an error code otherwise.
 */
static int cpufreq_get_cur_state(struct thermal_cooling_device *cdev,
				 unsigned long *state)
{
	*state=cpufreq_cooling_get_level(0,cpufreq_quick_get_max(0));
	pr_debug( "*state=%ld\n",*state);
	return 0;
}
Exemplo n.º 3
0
/* 
 * Manages driver behavior on screenoff mode
 * It sets max online CPUs to max_cores_screenoff and freq to max_freq_screenoff
 * Restores previous values on resume work
 *
 */
static __ref void max_screenoff(bool screenoff)
{
	uint32_t cpu, freq;
	
	if (screenoff) {
		max_freq_plug = cpufreq_quick_get_max(0);
		freq = min(max_freq_screenoff, max_freq_plug);

		cancel_delayed_work_sync(&dyn_work);
		
		for_each_possible_cpu(cpu) {
			msm_cpufreq_set_freq_limits(cpu, MSM_CPUFREQ_NO_LIMIT, freq);
			
			if (cpu && num_online_cpus() > max_cores_screenoff)
				cpu_down(cpu);
		}
		cpufreq_update_policy(cpu);
	}
	else {
Exemplo n.º 4
0
static int __init secos_booster_init(void)
{
	int ret;

	ret = mc_timer_init();
	if (ret) {
		pr_err("%s: mc timer init error :%d\n", __func__, ret);
		return ret;
	}

	hrtimer_init(&timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
	timer.function = secos_booster_hrtimer_fn;

	max_cpu_freq = cpufreq_quick_get_max(DEFAULT_BIG_CORE);

	pm_qos_add_request(&secos_booster_qos, PM_QOS_CPU_FREQ_MIN, 0);

	return ret;
}