Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 49514829 authored by Deepak Katragadda's avatar Deepak Katragadda
Browse files

clk: qcom: clk-cpu-osm: Add the fast_switch cpufreq callback



Implement and add the osm_cpufreq_fast_switch callback function
to allow CPU frequency switching from a scheduler context.

Change-Id: I6d3e365da97a93f69e5239b7d5a829568527c76f
Signed-off-by: default avatarDeepak Katragadda <dkatraga@codeaurora.org>
parent 8887fcbe
Loading
Loading
Loading
Loading
+17 −0
Original line number Diff line number Diff line
@@ -499,6 +499,21 @@ osm_cpufreq_target_index(struct cpufreq_policy *policy, unsigned int index)
	return 0;
}

static unsigned int
osm_cpufreq_fast_switch(struct cpufreq_policy *policy, unsigned int target_freq)
{
	int index;

	index = cpufreq_frequency_table_target(policy, target_freq,
							CPUFREQ_RELATION_L);
	if (index < 0)
		return 0;

	osm_cpufreq_target_index(policy, index);

	return policy->freq_table[index].frequency;
}

static unsigned int osm_cpufreq_get(unsigned int cpu)
{
	struct cpufreq_policy *policy = cpufreq_cpu_get_raw(cpu);
@@ -581,6 +596,7 @@ static int osm_cpufreq_cpu_init(struct cpufreq_policy *policy)
	}

	policy->dvfs_possible_from_any_cpu = true;
	policy->fast_switch_possible = true;
	policy->driver_data = c;
	return 0;

@@ -610,6 +626,7 @@ static struct cpufreq_driver qcom_osm_cpufreq_driver = {
	.get		= osm_cpufreq_get,
	.init		= osm_cpufreq_cpu_init,
	.exit		= osm_cpufreq_cpu_exit,
	.fast_switch	= osm_cpufreq_fast_switch,
	.name		= "osm-cpufreq",
	.attr		= osm_cpufreq_attr,
	.boost_enabled	= true,