blob: 510a62ebfc5f922baff30ddee59f87cf3cd8320d [file] [log] [blame]
/*
* MSM architecture CPU clock driver header
*
* Copyright (C) 2007 Google, Inc.
* Copyright (c) 2007-2012, The Linux Foundation. All rights reserved.
* Author: San Mehat <san@android.com>
*
* This software is licensed under the terms of the GNU General Public
* License version 2, as published by the Free Software Foundation, and
* may be copied, distributed, and modified under those terms.
*
* 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_ACPUCLOCK_H
#define __ARCH_ARM_MACH_MSM_ACPUCLOCK_H
/**
* enum setrate_reason - Reasons for use with acpuclk_set_rate()
*/
enum setrate_reason {
SETRATE_CPUFREQ = 0,
SETRATE_SWFI,
SETRATE_PC,
SETRATE_HOTPLUG,
SETRATE_INIT,
};
/**
* struct acpuclk_pdata - Platform data for acpuclk
*/
struct acpuclk_pdata {
unsigned long max_speed_delta_khz;
unsigned int max_axi_khz;
};
/**
* struct acpuclk_data - Function pointers and data for function implementations
*/
struct acpuclk_data {
unsigned long (*get_rate)(int cpu);
int (*set_rate)(int cpu, unsigned long rate, enum setrate_reason);
uint32_t switch_time_us;
unsigned long power_collapse_khz;
unsigned long wait_for_irq_khz;
};
/**
* acpulock_get_rate() - Get a CPU's clock rate in KHz
* @cpu: CPU to query the rate of
*/
unsigned long acpuclk_get_rate(int cpu);
/**
* acpuclk_set_rate() - Set a CPU's clock rate
* @cpu: CPU to set rate of
* @rate: Desired rate in KHz
* @setrate_reason: Reason for the rate switch
*
* Returns 0 for success.
*/
int acpuclk_set_rate(int cpu, unsigned long rate, enum setrate_reason);
/**
* acpuclk_get_switch_time() - Query estimated time in us for a CPU rate switch
*/
uint32_t acpuclk_get_switch_time(void);
/**
* acpuclk_power_collapse() - Prepare current CPU clocks for power-collapse
*
* Returns the previous rate of the CPU in KHz.
*/
unsigned long acpuclk_power_collapse(void);
/**
* acpuclk_wait_for_irq() - Prepare current CPU clocks for SWFI
*
* Returns the previous rate of the CPU in KHz.
*/
unsigned long acpuclk_wait_for_irq(void);
/**
* acpuclk_register() - Register acpuclk_data function implementations
* @data: acpuclock API implementations and data
*/
void acpuclk_register(struct acpuclk_data *data);
#endif /*__ARCH_ARM_MACH_MSM_ACPUCLOCK_H*/