Merge branch 'staging-next' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh...
[pandora-kernel.git] / arch / arm / plat-omap / include / plat / voltage.h
1 /*
2  * OMAP Voltage Management Routines
3  *
4  * Author: Thara Gopinath       <thara@ti.com>
5  *
6  * Copyright (C) 2009 Texas Instruments, Inc.
7  * Thara Gopinath <thara@ti.com>
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License version 2 as
11  * published by the Free Software Foundation.
12  */
13
14 #ifndef __ARCH_ARM_MACH_OMAP2_VOLTAGE_H
15 #define __ARCH_ARM_MACH_OMAP2_VOLTAGE_H
16
17 #define VOLTSCALE_VPFORCEUPDATE         1
18 #define VOLTSCALE_VCBYPASS              2
19
20 /*
21  * OMAP3 GENERIC setup times. Revisit to see if these needs to be
22  * passed from board or PMIC file
23  */
24 #define OMAP3_CLKSETUP          0xff
25 #define OMAP3_VOLTOFFSET        0xff
26 #define OMAP3_VOLTSETUP2        0xff
27
28 /* Voltage value defines */
29 #define OMAP3430_VDD_MPU_OPP1_UV                975000
30 #define OMAP3430_VDD_MPU_OPP2_UV                1075000
31 #define OMAP3430_VDD_MPU_OPP3_UV                1200000
32 #define OMAP3430_VDD_MPU_OPP4_UV                1270000
33 #define OMAP3430_VDD_MPU_OPP5_UV                1350000
34
35 #define OMAP3430_VDD_CORE_OPP1_UV               975000
36 #define OMAP3430_VDD_CORE_OPP2_UV               1050000
37 #define OMAP3430_VDD_CORE_OPP3_UV               1150000
38
39 #define OMAP3630_VDD_MPU_OPP50_UV               1012500
40 #define OMAP3630_VDD_MPU_OPP100_UV              1200000
41 #define OMAP3630_VDD_MPU_OPP120_UV              1325000
42 #define OMAP3630_VDD_MPU_OPP1G_UV               1375000
43
44 #define OMAP3630_VDD_CORE_OPP50_UV              1000000
45 #define OMAP3630_VDD_CORE_OPP100_UV             1200000
46
47 #define OMAP4430_VDD_MPU_OPP50_UV               930000
48 #define OMAP4430_VDD_MPU_OPP100_UV              1100000
49 #define OMAP4430_VDD_MPU_OPPTURBO_UV            1260000
50 #define OMAP4430_VDD_MPU_OPPNITRO_UV            1350000
51
52 #define OMAP4430_VDD_IVA_OPP50_UV               930000
53 #define OMAP4430_VDD_IVA_OPP100_UV              1100000
54 #define OMAP4430_VDD_IVA_OPPTURBO_UV            1260000
55
56 #define OMAP4430_VDD_CORE_OPP50_UV              930000
57 #define OMAP4430_VDD_CORE_OPP100_UV             1100000
58
59 /**
60  * struct voltagedomain - omap voltage domain global structure.
61  * @name:       Name of the voltage domain which can be used as a unique
62  *              identifier.
63  */
64 struct voltagedomain {
65         char *name;
66 };
67
68 /* API to get the voltagedomain pointer */
69 struct voltagedomain *omap_voltage_domain_lookup(char *name);
70
71 /**
72  * struct omap_volt_data - Omap voltage specific data.
73  * @voltage_nominal:    The possible voltage value in uV
74  * @sr_efuse_offs:      The offset of the efuse register(from system
75  *                      control module base address) from where to read
76  *                      the n-target value for the smartreflex module.
77  * @sr_errminlimit:     Error min limit value for smartreflex. This value
78  *                      differs at differnet opp and thus is linked
79  *                      with voltage.
80  * @vp_errorgain:       Error gain value for the voltage processor. This
81  *                      field also differs according to the voltage/opp.
82  */
83 struct omap_volt_data {
84         u32     volt_nominal;
85         u32     sr_efuse_offs;
86         u8      sr_errminlimit;
87         u8      vp_errgain;
88 };
89
90 /**
91  * struct omap_volt_pmic_info - PMIC specific data required by voltage driver.
92  * @slew_rate:  PMIC slew rate (in uv/us)
93  * @step_size:  PMIC voltage step size (in uv)
94  * @vsel_to_uv: PMIC API to convert vsel value to actual voltage in uV.
95  * @uv_to_vsel: PMIC API to convert voltage in uV to vsel value.
96  */
97 struct omap_volt_pmic_info {
98         int slew_rate;
99         int step_size;
100         u32 on_volt;
101         u32 onlp_volt;
102         u32 ret_volt;
103         u32 off_volt;
104         u16 volt_setup_time;
105         u8 vp_erroroffset;
106         u8 vp_vstepmin;
107         u8 vp_vstepmax;
108         u8 vp_vddmin;
109         u8 vp_vddmax;
110         u8 vp_timeout_us;
111         u8 i2c_slave_addr;
112         u8 pmic_reg;
113         unsigned long (*vsel_to_uv) (const u8 vsel);
114         u8 (*uv_to_vsel) (unsigned long uV);
115 };
116
117 unsigned long omap_vp_get_curr_volt(struct voltagedomain *voltdm);
118 void omap_vp_enable(struct voltagedomain *voltdm);
119 void omap_vp_disable(struct voltagedomain *voltdm);
120 int omap_voltage_scale_vdd(struct voltagedomain *voltdm,
121                 unsigned long target_volt);
122 void omap_voltage_reset(struct voltagedomain *voltdm);
123 void omap_voltage_get_volttable(struct voltagedomain *voltdm,
124                 struct omap_volt_data **volt_data);
125 struct omap_volt_data *omap_voltage_get_voltdata(struct voltagedomain *voltdm,
126                 unsigned long volt);
127 unsigned long omap_voltage_get_nom_volt(struct voltagedomain *voltdm);
128 struct dentry *omap_voltage_get_dbgdir(struct voltagedomain *voltdm);
129 #ifdef CONFIG_PM
130 int omap_voltage_register_pmic(struct voltagedomain *voltdm,
131                 struct omap_volt_pmic_info *pmic_info);
132 void omap_change_voltscale_method(struct voltagedomain *voltdm,
133                 int voltscale_method);
134 int omap_voltage_late_init(void);
135 #else
136 static inline int omap_voltage_register_pmic(struct voltagedomain *voltdm,
137                 struct omap_volt_pmic_info *pmic_info) {}
138 static inline  void omap_change_voltscale_method(struct voltagedomain *voltdm,
139                 int voltscale_method) {}
140 static inline int omap_voltage_late_init(void)
141 {
142         return -EINVAL;
143 }
144 #endif
145
146 #endif