Commit ce8ebe0dfb1f8713337cebf82499d3dced288328

Authored by Kevin Hilman
1 parent 24d3194a2c

OMAP3+: voltage domain: move PMIC struct from vdd_info into struct voltagedomain

Move structure containing PMIC configurable settings into struct
voltagedomain.  In the process, rename from omap_volt_pmic_info to
omap_voltdm_pmic (_info suffix is not helpful.)

No functional changes.

Signed-off-by: Kevin Hilman <khilman@ti.com>

Showing 6 changed files with 55 additions and 60 deletions Side-by-side Diff

arch/arm/mach-omap2/omap_twl.c
... ... @@ -143,7 +143,7 @@
143 143 return DIV_ROUND_UP(uv - 600000, 12500) + 1;
144 144 }
145 145  
146   -static struct omap_volt_pmic_info omap3_mpu_volt_info = {
  146 +static struct omap_voltdm_pmic omap3_mpu_pmic = {
147 147 .slew_rate = 4000,
148 148 .step_size = 12500,
149 149 .on_volt = 1200000,
... ... @@ -163,7 +163,7 @@
163 163 .uv_to_vsel = twl4030_uv_to_vsel,
164 164 };
165 165  
166   -static struct omap_volt_pmic_info omap3_core_volt_info = {
  166 +static struct omap_voltdm_pmic omap3_core_pmic = {
167 167 .slew_rate = 4000,
168 168 .step_size = 12500,
169 169 .on_volt = 1200000,
... ... @@ -183,7 +183,7 @@
183 183 .uv_to_vsel = twl4030_uv_to_vsel,
184 184 };
185 185  
186   -static struct omap_volt_pmic_info omap4_mpu_volt_info = {
  186 +static struct omap_voltdm_pmic omap4_mpu_pmic = {
187 187 .slew_rate = 4000,
188 188 .step_size = 12500,
189 189 .on_volt = 1350000,
... ... @@ -203,7 +203,7 @@
203 203 .uv_to_vsel = twl6030_uv_to_vsel,
204 204 };
205 205  
206   -static struct omap_volt_pmic_info omap4_iva_volt_info = {
  206 +static struct omap_voltdm_pmic omap4_iva_pmic = {
207 207 .slew_rate = 4000,
208 208 .step_size = 12500,
209 209 .on_volt = 1100000,
... ... @@ -223,7 +223,7 @@
223 223 .uv_to_vsel = twl6030_uv_to_vsel,
224 224 };
225 225  
226   -static struct omap_volt_pmic_info omap4_core_volt_info = {
  226 +static struct omap_voltdm_pmic omap4_core_pmic = {
227 227 .slew_rate = 4000,
228 228 .step_size = 12500,
229 229 .on_volt = 1100000,
230 230  
231 231  
... ... @@ -251,13 +251,13 @@
251 251 return -ENODEV;
252 252  
253 253 voltdm = voltdm_lookup("mpu");
254   - omap_voltage_register_pmic(voltdm, &omap4_mpu_volt_info);
  254 + omap_voltage_register_pmic(voltdm, &omap4_mpu_pmic);
255 255  
256 256 voltdm = voltdm_lookup("iva");
257   - omap_voltage_register_pmic(voltdm, &omap4_iva_volt_info);
  257 + omap_voltage_register_pmic(voltdm, &omap4_iva_pmic);
258 258  
259 259 voltdm = voltdm_lookup("core");
260   - omap_voltage_register_pmic(voltdm, &omap4_core_volt_info);
  260 + omap_voltage_register_pmic(voltdm, &omap4_core_pmic);
261 261  
262 262 return 0;
263 263 }
... ... @@ -270,10 +270,10 @@
270 270 return -ENODEV;
271 271  
272 272 if (cpu_is_omap3630()) {
273   - omap3_mpu_volt_info.vp_vddmin = OMAP3630_VP1_VLIMITTO_VDDMIN;
274   - omap3_mpu_volt_info.vp_vddmax = OMAP3630_VP1_VLIMITTO_VDDMAX;
275   - omap3_core_volt_info.vp_vddmin = OMAP3630_VP2_VLIMITTO_VDDMIN;
276   - omap3_core_volt_info.vp_vddmax = OMAP3630_VP2_VLIMITTO_VDDMAX;
  273 + omap3_mpu_pmic.vp_vddmin = OMAP3630_VP1_VLIMITTO_VDDMIN;
  274 + omap3_mpu_pmic.vp_vddmax = OMAP3630_VP1_VLIMITTO_VDDMAX;
  275 + omap3_core_pmic.vp_vddmin = OMAP3630_VP2_VLIMITTO_VDDMIN;
  276 + omap3_core_pmic.vp_vddmax = OMAP3630_VP2_VLIMITTO_VDDMAX;
277 277 }
278 278  
279 279 /*
280 280  
... ... @@ -289,10 +289,10 @@
289 289 omap3_twl_set_sr_bit(true);
290 290  
291 291 voltdm = voltdm_lookup("mpu_iva");
292   - omap_voltage_register_pmic(voltdm, &omap3_mpu_volt_info);
  292 + omap_voltage_register_pmic(voltdm, &omap3_mpu_pmic);
293 293  
294 294 voltdm = voltdm_lookup("core");
295   - omap_voltage_register_pmic(voltdm, &omap3_core_volt_info);
  295 + omap_voltage_register_pmic(voltdm, &omap3_core_pmic);
296 296  
297 297 return 0;
298 298 }
arch/arm/mach-omap2/vc.c
... ... @@ -79,13 +79,13 @@
79 79 vp_common = vdd->vp_data->vp_common;
80 80  
81 81 /* Check if sufficient pmic info is available for this vdd */
82   - if (!vdd->pmic_info) {
  82 + if (!voltdm->pmic) {
83 83 pr_err("%s: Insufficient pmic info to scale the vdd_%s\n",
84 84 __func__, voltdm->name);
85 85 return -EINVAL;
86 86 }
87 87  
88   - if (!vdd->pmic_info->uv_to_vsel) {
  88 + if (!voltdm->pmic->uv_to_vsel) {
89 89 pr_err("%s: PMIC function to convert voltage in uV to"
90 90 "vsel not registered. Hence unable to scale voltage"
91 91 "for vdd_%s\n", __func__, voltdm->name);
... ... @@ -103,7 +103,7 @@
103 103 if (IS_ERR(volt_data))
104 104 volt_data = NULL;
105 105  
106   - *target_vsel = vdd->pmic_info->uv_to_vsel(target_volt);
  106 + *target_vsel = voltdm->pmic->uv_to_vsel(target_volt);
107 107 *current_vsel = voltdm->read(vdd->vp_data->voltage);
108 108  
109 109 /* Setting the ON voltage to the new target voltage */
... ... @@ -134,8 +134,8 @@
134 134  
135 135 smps_steps = abs(target_vsel - current_vsel);
136 136 /* SMPS slew rate / step size. 2us added as buffer. */
137   - smps_delay = ((smps_steps * vdd->pmic_info->step_size) /
138   - vdd->pmic_info->slew_rate) + 2;
  137 + smps_delay = ((smps_steps * voltdm->pmic->step_size) /
  138 + voltdm->pmic->slew_rate) + 2;
139 139 udelay(smps_delay);
140 140  
141 141 vdd->curr_volt = target_volt;
142 142  
... ... @@ -240,11 +240,10 @@
240 240 void __init omap_vc_init_channel(struct voltagedomain *voltdm)
241 241 {
242 242 struct omap_vc_channel *vc = voltdm->vc;
243   - struct omap_vdd_info *vdd = voltdm->vdd;
244 243 u8 on_vsel, onlp_vsel, ret_vsel, off_vsel;
245 244 u32 val;
246 245  
247   - if (!vdd->pmic_info || !vdd->pmic_info->uv_to_vsel) {
  246 + if (!voltdm->pmic || !voltdm->pmic->uv_to_vsel) {
248 247 pr_err("%s: PMIC info requried to configure vc for"
249 248 "vdd_%s not populated.Hence cannot initialize vc\n",
250 249 __func__, voltdm->name);
... ... @@ -260,10 +259,10 @@
260 259 vc->cfg_channel = 0;
261 260  
262 261 /* get PMIC/board specific settings */
263   - vc->i2c_slave_addr = vdd->pmic_info->i2c_slave_addr;
264   - vc->volt_reg_addr = vdd->pmic_info->volt_reg_addr;
265   - vc->cmd_reg_addr = vdd->pmic_info->cmd_reg_addr;
266   - vc->setup_time = vdd->pmic_info->volt_setup_time;
  262 + vc->i2c_slave_addr = voltdm->pmic->i2c_slave_addr;
  263 + vc->volt_reg_addr = voltdm->pmic->volt_reg_addr;
  264 + vc->cmd_reg_addr = voltdm->pmic->cmd_reg_addr;
  265 + vc->setup_time = voltdm->pmic->volt_setup_time;
267 266  
268 267 /* Configure the i2c slave address for this VC */
269 268 voltdm->rmw(vc->smps_sa_mask,
... ... @@ -287,10 +286,10 @@
287 286 }
288 287  
289 288 /* Set up the on, inactive, retention and off voltage */
290   - on_vsel = vdd->pmic_info->uv_to_vsel(vdd->pmic_info->on_volt);
291   - onlp_vsel = vdd->pmic_info->uv_to_vsel(vdd->pmic_info->onlp_volt);
292   - ret_vsel = vdd->pmic_info->uv_to_vsel(vdd->pmic_info->ret_volt);
293   - off_vsel = vdd->pmic_info->uv_to_vsel(vdd->pmic_info->off_volt);
  289 + on_vsel = voltdm->pmic->uv_to_vsel(voltdm->pmic->on_volt);
  290 + onlp_vsel = voltdm->pmic->uv_to_vsel(voltdm->pmic->onlp_volt);
  291 + ret_vsel = voltdm->pmic->uv_to_vsel(voltdm->pmic->ret_volt);
  292 + off_vsel = voltdm->pmic->uv_to_vsel(voltdm->pmic->off_volt);
294 293 val = ((on_vsel << vc->common->cmd_on_shift) |
295 294 (onlp_vsel << vc->common->cmd_onlp_shift) |
296 295 (ret_vsel << vc->common->cmd_ret_shift) |
arch/arm/mach-omap2/vc.h
... ... @@ -36,6 +36,7 @@
36 36 * @cmd_onlp_shift: ONLP field shift in PRM_VC_CMD_VAL_* register
37 37 * @cmd_ret_shift: RET field shift in PRM_VC_CMD_VAL_* register
38 38 * @cmd_off_shift: OFF field shift in PRM_VC_CMD_VAL_* register
  39 + * @cfg_channel_reg: VC channel configuration register
39 40 *
40 41 * XXX One of cmd_on_mask and cmd_on_shift are not needed
41 42 * XXX VALID should probably be a shift, not a mask
42 43  
... ... @@ -66,11 +67,14 @@
66 67 * @volt_reg_addr: voltage configuration register address
67 68 * @cmd_reg_addr: command configuration register address
68 69 * @setup_time: setup time (in sys_clk cycles) of regulator for this channel
  70 + * @cfg_channel: current value of VC channel configuration register
  71 + *
69 72 * @common: pointer to VC common data for this platform
70 73 * @smps_sa_mask: i2c slave address bitmask in the PRM_VC_SMPS_SA register
71 74 * @smps_volra_mask: VOLRA* bitmask in the PRM_VC_VOL_RA register
72 75 * @smps_cmdra_mask: CMDRA* bitmask in the PRM_VC_CMD_RA register
73 76 * @cmdval_reg: register for on/ret/off voltage level values for this channel
  77 + * @cfg_channel_sa_shift: bit shift for slave address cfg_channel register
74 78 * @flags: VC channel-specific flags (optional)
75 79 */
76 80 struct omap_vc_channel {
arch/arm/mach-omap2/voltage.c
... ... @@ -84,20 +84,20 @@
84 84 vdd->vp_enabled = false;
85 85  
86 86 vdd->vp_rt_data.vpconfig_erroroffset =
87   - (vdd->pmic_info->vp_erroroffset <<
  87 + (voltdm->pmic->vp_erroroffset <<
88 88 vdd->vp_data->vp_common->vpconfig_erroroffset_shift);
89 89  
90   - timeout_val = (sys_clk_speed * vdd->pmic_info->vp_timeout_us) / 1000;
  90 + timeout_val = (sys_clk_speed * voltdm->pmic->vp_timeout_us) / 1000;
91 91 vdd->vp_rt_data.vlimitto_timeout = timeout_val;
92   - vdd->vp_rt_data.vlimitto_vddmin = vdd->pmic_info->vp_vddmin;
93   - vdd->vp_rt_data.vlimitto_vddmax = vdd->pmic_info->vp_vddmax;
  92 + vdd->vp_rt_data.vlimitto_vddmin = voltdm->pmic->vp_vddmin;
  93 + vdd->vp_rt_data.vlimitto_vddmax = voltdm->pmic->vp_vddmax;
94 94  
95   - waittime = ((vdd->pmic_info->step_size / vdd->pmic_info->slew_rate) *
  95 + waittime = ((voltdm->pmic->step_size / voltdm->pmic->slew_rate) *
96 96 sys_clk_speed) / 1000;
97 97 vdd->vp_rt_data.vstepmin_smpswaittimemin = waittime;
98 98 vdd->vp_rt_data.vstepmax_smpswaittimemax = waittime;
99   - vdd->vp_rt_data.vstepmin_stepmin = vdd->pmic_info->vp_vstepmin;
100   - vdd->vp_rt_data.vstepmax_stepmax = vdd->pmic_info->vp_vstepmax;
  99 + vdd->vp_rt_data.vstepmin_stepmin = voltdm->pmic->vp_vstepmin;
  100 + vdd->vp_rt_data.vstepmax_stepmax = voltdm->pmic->vp_vstepmax;
101 101  
102 102 return 0;
103 103 }
104 104  
... ... @@ -149,10 +149,9 @@
149 149  
150 150 static int __init omap_vdd_data_configure(struct voltagedomain *voltdm)
151 151 {
152   - struct omap_vdd_info *vdd = voltdm->vdd;
153 152 int ret = -EINVAL;
154 153  
155   - if (!vdd->pmic_info) {
  154 + if (!voltdm->pmic) {
156 155 pr_err("%s: PMIC info requried to configure vdd_%s not"
157 156 "populated.Hence cannot initialize vdd_%s\n",
158 157 __func__, voltdm->name, voltdm->name);
159 158  
160 159  
161 160  
162 161  
... ... @@ -324,24 +323,20 @@
324 323 * omap_voltage_register_pmic() - API to register PMIC specific data
325 324 * @voltdm: pointer to the VDD for which the PMIC specific data is
326 325 * to be registered
327   - * @pmic_info: the structure containing pmic info
  326 + * @pmic: the structure containing pmic info
328 327 *
329 328 * This API is to be called by the SOC/PMIC file to specify the
330   - * pmic specific info as present in omap_volt_pmic_info structure.
  329 + * pmic specific info as present in omap_voltdm_pmic structure.
331 330 */
332 331 int omap_voltage_register_pmic(struct voltagedomain *voltdm,
333   - struct omap_volt_pmic_info *pmic_info)
  332 + struct omap_voltdm_pmic *pmic)
334 333 {
335   - struct omap_vdd_info *vdd;
336   -
337 334 if (!voltdm || IS_ERR(voltdm)) {
338 335 pr_warning("%s: VDD specified does not exist!\n", __func__);
339 336 return -EINVAL;
340 337 }
341 338  
342   - vdd = voltdm->vdd;
343   -
344   - vdd->pmic_info = pmic_info;
  339 + voltdm->pmic = pmic;
345 340  
346 341 return 0;
347 342 }
arch/arm/mach-omap2/voltage.h
... ... @@ -67,6 +67,7 @@
67 67 struct list_head pwrdm_list;
68 68 struct omap_vc_channel *vc;
69 69 const struct omap_vfsm_instance *vfsm;
  70 + struct omap_voltdm_pmic *pmic;
70 71  
71 72 /* VC/VP register access functions: SoC specific */
72 73 u32 (*read) (u8 offset);
... ... @@ -96,7 +97,7 @@
96 97 };
97 98  
98 99 /**
99   - * struct omap_volt_pmic_info - PMIC specific data required by voltage driver.
  100 + * struct omap_voltdm_pmic - PMIC specific data required by voltage driver.
100 101 * @slew_rate: PMIC slew rate (in uv/us)
101 102 * @step_size: PMIC voltage step size (in uv)
102 103 * @i2c_slave_addr: I2C slave address of PMIC
... ... @@ -105,7 +106,7 @@
105 106 * @vsel_to_uv: PMIC API to convert vsel value to actual voltage in uV.
106 107 * @uv_to_vsel: PMIC API to convert voltage in uV to vsel value.
107 108 */
108   -struct omap_volt_pmic_info {
  109 +struct omap_voltdm_pmic {
109 110 int slew_rate;
110 111 int step_size;
111 112 u32 on_volt;
... ... @@ -131,8 +132,6 @@
131 132 *
132 133 * @volt_data : voltage table having the distinct voltages supported
133 134 * by the domain and other associated per voltage data.
134   - * @pmic_info : pmic specific parameters which should be populted by
135   - * the pmic drivers.
136 135 * @vp_data : the register values, shifts, masks for various
137 136 * vp registers
138 137 * @vp_rt_data : VP data derived at runtime, not predefined
... ... @@ -143,7 +142,6 @@
143 142 */
144 143 struct omap_vdd_info {
145 144 struct omap_volt_data *volt_data;
146   - struct omap_volt_pmic_info *pmic_info;
147 145 struct omap_vp_instance_data *vp_data;
148 146 struct omap_vp_runtime_data vp_rt_data;
149 147 struct dentry *debug_dir;
150 148  
... ... @@ -165,13 +163,13 @@
165 163 struct dentry *omap_voltage_get_dbgdir(struct voltagedomain *voltdm);
166 164 #ifdef CONFIG_PM
167 165 int omap_voltage_register_pmic(struct voltagedomain *voltdm,
168   - struct omap_volt_pmic_info *pmic_info);
  166 + struct omap_voltdm_pmic *pmic);
169 167 void omap_change_voltscale_method(struct voltagedomain *voltdm,
170 168 int voltscale_method);
171 169 int omap_voltage_late_init(void);
172 170 #else
173 171 static inline int omap_voltage_register_pmic(struct voltagedomain *voltdm,
174   - struct omap_volt_pmic_info *pmic_info)
  172 + struct omap_voltdm_pmic *pmic)
175 173 {
176 174 return -EINVAL;
177 175 }
arch/arm/mach-omap2/vp.c
... ... @@ -18,7 +18,6 @@
18 18 u32 vpconfig;
19 19 unsigned long uvdc;
20 20 char vsel;
21   - struct omap_vdd_info *vdd = voltdm->vdd;
22 21  
23 22 uvdc = omap_voltage_get_nom_volt(voltdm);
24 23 if (!uvdc) {
25 24  
... ... @@ -27,13 +26,13 @@
27 26 return;
28 27 }
29 28  
30   - if (!vdd->pmic_info || !vdd->pmic_info->uv_to_vsel) {
  29 + if (!voltdm->pmic || !voltdm->pmic->uv_to_vsel) {
31 30 pr_warning("%s: PMIC function to convert voltage in uV to"
32 31 " vsel not registered\n", __func__);
33 32 return;
34 33 }
35 34  
36   - vsel = vdd->pmic_info->uv_to_vsel(uvdc);
  35 + vsel = voltdm->pmic->uv_to_vsel(uvdc);
37 36  
38 37 vpconfig = voltdm->read(vp->vpconfig);
39 38 vpconfig &= ~(vp->vp_common->vpconfig_initvoltage_mask |
40 39  
... ... @@ -206,13 +205,13 @@
206 205  
207 206 curr_vsel = voltdm->read(vp->voltage);
208 207  
209   - if (!vdd->pmic_info || !vdd->pmic_info->vsel_to_uv) {
  208 + if (!voltdm->pmic || !voltdm->pmic->vsel_to_uv) {
210 209 pr_warning("%s: PMIC function to convert vsel to voltage"
211 210 "in uV not registerd\n", __func__);
212 211 return 0;
213 212 }
214 213  
215   - return vdd->pmic_info->vsel_to_uv(curr_vsel);
  214 + return voltdm->pmic->vsel_to_uv(curr_vsel);
216 215 }
217 216  
218 217 /**
219 218  
... ... @@ -323,13 +322,13 @@
323 322  
324 323 vsel = voltdm->read(vp->voltage);
325 324  
326   - if (!vdd->pmic_info->vsel_to_uv) {
  325 + if (!voltdm->pmic->vsel_to_uv) {
327 326 pr_warning("PMIC function to convert vsel to voltage"
328 327 "in uV not registerd\n");
329 328 return -EINVAL;
330 329 }
331 330  
332   - *val = vdd->pmic_info->vsel_to_uv(vsel);
  331 + *val = voltdm->pmic->vsel_to_uv(vsel);
333 332 return 0;
334 333 }
335 334