blob: a549e9de7f26075ff1f8839833ced192655c0fc8 [file] [log] [blame]
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001/*
2 * Copyright (c) 2009, Code Aurora Forum. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 and
6 * only version 2 as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 */
13
14#ifndef AVS_H
15#define AVS_H
16
17#define VOLTAGE_MIN 1000 /* mV */
18#define VOLTAGE_MAX 1250
19#define VOLTAGE_STEP 25
20
21int __init avs_init(int (*set_vdd)(int), u32 freq_cnt, u32 freq_idx);
22void __exit avs_exit(void);
23
24int avs_adjust_freq(u32 freq_index, int begin);
25
26/* Routines exported from avs_hw.S */
27#ifdef CONFIG_MSM_CPU_AVS
28u32 avs_test_delays(void);
29#else
30static inline u32 avs_test_delays(void)
31{ return 0; }
32#endif
33
34#ifdef CONFIG_MSM_AVS_HW
35u32 avs_reset_delays(u32 avsdscr);
36u32 avs_get_avscsr(void);
37u32 avs_get_avsdscr(void);
38u32 avs_get_tscsr(void);
39void avs_set_tscsr(u32 to_tscsr);
40void avs_disable(void);
41#else
42static inline u32 avs_reset_delays(u32 avsdscr)
43{ return 0; }
44static inline u32 avs_get_avscsr(void)
45{ return 0; }
46static inline u32 avs_get_avsdscr(void)
47{ return 0; }
48static inline u32 avs_get_tscsr(void)
49{ return 0; }
50static inline void avs_set_tscsr(u32 to_tscsr) {}
51static inline void avs_disable(void) {}
52#endif
53
54/*#define AVSDEBUG(x...) pr_info("AVS: " x);*/
55#define AVSDEBUG(...)
56
57#define AVS_DISABLE(cpu) do { \
58 if (get_cpu() == (cpu)) \
59 avs_disable(); \
60 put_cpu(); \
61 } while (0);
62
63#define AVS_ENABLE(cpu, x) do { \
64 if (get_cpu() == (cpu)) \
65 avs_reset_delays((x)); \
66 put_cpu(); \
67 } while (0);
68
69#endif /* AVS_H */