Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1 | /* |
| 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 | |
| 21 | int __init avs_init(int (*set_vdd)(int), u32 freq_cnt, u32 freq_idx); |
| 22 | void __exit avs_exit(void); |
| 23 | |
| 24 | int avs_adjust_freq(u32 freq_index, int begin); |
| 25 | |
| 26 | /* Routines exported from avs_hw.S */ |
| 27 | #ifdef CONFIG_MSM_CPU_AVS |
| 28 | u32 avs_test_delays(void); |
| 29 | #else |
| 30 | static inline u32 avs_test_delays(void) |
| 31 | { return 0; } |
| 32 | #endif |
| 33 | |
| 34 | #ifdef CONFIG_MSM_AVS_HW |
| 35 | u32 avs_reset_delays(u32 avsdscr); |
| 36 | u32 avs_get_avscsr(void); |
| 37 | u32 avs_get_avsdscr(void); |
| 38 | u32 avs_get_tscsr(void); |
| 39 | void avs_set_tscsr(u32 to_tscsr); |
| 40 | void avs_disable(void); |
| 41 | #else |
| 42 | static inline u32 avs_reset_delays(u32 avsdscr) |
| 43 | { return 0; } |
| 44 | static inline u32 avs_get_avscsr(void) |
| 45 | { return 0; } |
| 46 | static inline u32 avs_get_avsdscr(void) |
| 47 | { return 0; } |
| 48 | static inline u32 avs_get_tscsr(void) |
| 49 | { return 0; } |
| 50 | static inline void avs_set_tscsr(u32 to_tscsr) {} |
| 51 | static 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 */ |