1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
|
/*
* 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*/
|