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

Commit b1de556b authored by Saravana Kannan's avatar Saravana Kannan
Browse files

msm: cpufreq: Remove unused msm_cpufreq_set_freq_limits() API



The msm_cpufreq_set_freq_limits() is a mach specific way to set CPU freq
limits. The thermal code no longer uses this API and instead uses the
standard INCOMPATIBLE notifiers provided by the common CPUfreq framework.
Since this API is no longer needed, delete it.

Change-Id: I5c07b17195d4e4b75cdd4d82f8e7cb6cb6f3e199
Signed-off-by: default avatarSaravana Kannan <skannan@codeaurora.org>
parent 07ca70b0
Loading
Loading
Loading
Loading
+0 −92
Original line number Diff line number Diff line
@@ -32,7 +32,6 @@
#include <linux/platform_device.h>
#include <trace/events/power.h>
#include <mach/socinfo.h>
#include <mach/cpufreq.h>
#include <mach/msm_bus.h>

#include "acpuclock.h"
@@ -78,16 +77,6 @@ struct cpufreq_suspend_t {

static DEFINE_PER_CPU(struct cpufreq_suspend_t, cpufreq_suspend);

struct cpu_freq {
	uint32_t max;
	uint32_t min;
	uint32_t allowed_max;
	uint32_t allowed_min;
	uint32_t limits_init;
};

static DEFINE_PER_CPU(struct cpu_freq, cpu_freq_info);

static void update_l2_bw(int *also_cpu)
{
	int rc = 0, cpu;
@@ -125,27 +114,7 @@ static int set_cpu_freq(struct cpufreq_policy *policy, unsigned int new_freq,
	int saved_sched_policy = -EINVAL;
	int saved_sched_rt_prio = -EINVAL;
	struct cpufreq_freqs freqs;
	struct cpu_freq *limit = &per_cpu(cpu_freq_info, policy->cpu);
	struct sched_param param = { .sched_priority = MAX_RT_PRIO-1 };
	struct cpufreq_frequency_table *table;

	if (limit->limits_init) {
		if (new_freq > limit->allowed_max) {
			new_freq = limit->allowed_max;
			pr_debug("max: limiting freq to %d\n", new_freq);
		}

		if (new_freq < limit->allowed_min) {
			new_freq = limit->allowed_min;
			pr_debug("min: limiting freq to %d\n", new_freq);
		}
	}

	/* limits applied above must be in cpufreq table */
	table = cpufreq_frequency_get_table(policy->cpu);
	if (cpufreq_frequency_table_target(policy, table, new_freq,
		CPUFREQ_RELATION_H, &index))
		return -EINVAL;

	freqs.old = policy->cur;
	freqs.new = new_freq;
@@ -264,67 +233,6 @@ static unsigned int msm_cpufreq_get_freq(unsigned int cpu)
	return acpuclk_get_rate(cpu);
}

static inline int msm_cpufreq_limits_init(void)
{
	int cpu = 0;
	int i = 0;
	struct cpufreq_frequency_table *table = NULL;
	uint32_t min = (uint32_t) -1;
	uint32_t max = 0;
	struct cpu_freq *limit = NULL;

	for_each_possible_cpu(cpu) {
		limit = &per_cpu(cpu_freq_info, cpu);
		table = cpufreq_frequency_get_table(cpu);
		if (table == NULL) {
			pr_err("%s: error reading cpufreq table for cpu %d\n",
					__func__, cpu);
			continue;
		}
		for (i = 0; (table[i].frequency != CPUFREQ_TABLE_END); i++) {
			if (table[i].frequency > max)
				max = table[i].frequency;
			if (table[i].frequency < min)
				min = table[i].frequency;
		}
		limit->allowed_min = min;
		limit->allowed_max = max;
		limit->min = min;
		limit->max = max;
		limit->limits_init = 1;
	}

	return 0;
}

int msm_cpufreq_set_freq_limits(uint32_t cpu, uint32_t min, uint32_t max)
{
	struct cpu_freq *limit = &per_cpu(cpu_freq_info, cpu);

	if (!limit->limits_init)
		msm_cpufreq_limits_init();

	if ((min != MSM_CPUFREQ_NO_LIMIT) &&
		min >= limit->min && min <= limit->max)
		limit->allowed_min = min;
	else
		limit->allowed_min = limit->min;


	if ((max != MSM_CPUFREQ_NO_LIMIT) &&
		max <= limit->max && max >= limit->min)
		limit->allowed_max = max;
	else
		limit->allowed_max = limit->max;

	pr_debug("%s: Limiting cpu %d min = %d, max = %d\n",
			__func__, cpu,
			limit->allowed_min, limit->allowed_max);

	return 0;
}
EXPORT_SYMBOL(msm_cpufreq_set_freq_limits);

static int __cpuinit msm_cpufreq_init(struct cpufreq_policy *policy)
{
	int cur_freq;
+0 −42
Original line number Diff line number Diff line
/* Copyright (c) 2012, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
 * only version 2 as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 */

#ifndef __ARCH_ARM_MACH_MSM_MACH_CPUFREQ_H
#define __ARCH_ARM_MACH_MSM_MACH_CPUFREQ_H

#define MSM_CPUFREQ_NO_LIMIT 0xFFFFFFFF

#ifdef CONFIG_CPU_FREQ_MSM

/**
 * msm_cpufreq_set_freq_limit() - Set max/min freq limits on cpu
 *
 * @cpu: The cpu core for which the limits apply
 * @max: The max frequency allowed
 * @min: The min frequency allowed
 *
 * If the @max or @min is set to MSM_CPUFREQ_NO_LIMIT, the limit
 * will default to the CPUFreq limit.
 *
 * returns 0 on success, errno on failure
 */
extern int msm_cpufreq_set_freq_limits(
		uint32_t cpu, uint32_t min, uint32_t max);
#else
static inline int msm_cpufreq_set_freq_limits(
		uint32_t cpu, uint32_t min, uint32_t max)
{
	return -ENOSYS;
}
#endif

#endif /* __ARCH_ARM_MACH_MSM_MACH_CPUFREQ_H */
+0 −1
Original line number Diff line number Diff line
@@ -32,7 +32,6 @@
#include <linux/types.h>
#include <linux/alarmtimer.h>
#include <linux/thermal.h>
#include <mach/cpufreq.h>
#include <mach/rpm-regulator.h>
#include <mach/rpm-regulator-smd.h>
#include <linux/regulator/consumer.h>