| /* |
| * MSM architecture CPU clock driver header |
| * |
| * Copyright (C) 2007 Google, Inc. |
| * Copyright (c) 2007-2012, Code Aurora Forum. 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_soc_data - SoC data for acpuclk_init() |
| */ |
| struct acpuclk_soc_data { |
| unsigned long max_speed_delta_khz; |
| unsigned int max_axi_khz; |
| int (*init)(struct acpuclk_soc_data *); |
| }; |
| |
| /** |
| * 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); |
| |
| /** |
| * acpuclk_init() - acpuclock driver initialization function |
| * |
| * Return 0 for success. |
| */ |
| int acpuclk_init(struct acpuclk_soc_data *); |
| |
| /* SoC-specific acpuclock initialization functions. */ |
| extern struct acpuclk_soc_data acpuclk_7x27_soc_data; |
| extern struct acpuclk_soc_data acpuclk_7x27a_soc_data; |
| extern struct acpuclk_soc_data acpuclk_7x27aa_soc_data; |
| extern struct acpuclk_soc_data acpuclk_7x30_soc_data; |
| extern struct acpuclk_soc_data acpuclk_8x50_soc_data; |
| extern struct acpuclk_soc_data acpuclk_8x60_soc_data; |
| extern struct acpuclk_soc_data acpuclk_8960_soc_data; |
| extern struct acpuclk_soc_data acpuclk_9xxx_soc_data; |
| extern struct acpuclk_soc_data acpuclk_9615_soc_data; |
| extern struct acpuclk_soc_data acpuclk_8930_soc_data; |
| extern struct acpuclk_soc_data acpuclk_8064_soc_data; |
| |
| #endif |