Lines Matching refs:vreg

99 				 struct icnss_vreg_info *vreg)  in icnss_get_vreg_single()  argument
111 reg = devm_regulator_get_optional(dev, vreg->cfg.name); in icnss_get_vreg_single()
118 vreg->cfg.name); in icnss_get_vreg_single()
121 if (vreg->cfg.required) { in icnss_get_vreg_single()
123 vreg->cfg.name, ret); in icnss_get_vreg_single()
127 vreg->cfg.name, ret); in icnss_get_vreg_single()
132 vreg->cfg.name, ret); in icnss_get_vreg_single()
137 vreg->reg = reg; in icnss_get_vreg_single()
140 vreg->cfg.name); in icnss_get_vreg_single()
156 vreg->cfg.min_uv = be32_to_cpup(&prop[0]); in icnss_get_vreg_single()
159 vreg->cfg.max_uv = be32_to_cpup(&prop[1]); in icnss_get_vreg_single()
162 vreg->cfg.load_ua = be32_to_cpup(&prop[2]); in icnss_get_vreg_single()
165 vreg->cfg.delay_us = be32_to_cpup(&prop[3]); in icnss_get_vreg_single()
169 vreg->cfg.need_unvote = be32_to_cpup(&prop[4]); in icnss_get_vreg_single()
171 vreg->cfg.need_unvote = 0; in icnss_get_vreg_single()
182 vreg->cfg.name, vreg->cfg.min_uv, in icnss_get_vreg_single()
183 vreg->cfg.max_uv, vreg->cfg.load_ua, in icnss_get_vreg_single()
184 vreg->cfg.delay_us, vreg->cfg.need_unvote); in icnss_get_vreg_single()
192 static int icnss_vreg_on_single(struct icnss_vreg_info *vreg) in icnss_vreg_on_single() argument
196 if (vreg->enabled) { in icnss_vreg_on_single()
198 vreg->cfg.name); in icnss_vreg_on_single()
202 icnss_pr_dbg("Regulator %s is being enabled\n", vreg->cfg.name); in icnss_vreg_on_single()
204 if (vreg->cfg.min_uv != 0 && vreg->cfg.max_uv != 0) { in icnss_vreg_on_single()
205 ret = regulator_set_voltage(vreg->reg, in icnss_vreg_on_single()
206 vreg->cfg.min_uv, in icnss_vreg_on_single()
207 vreg->cfg.max_uv); in icnss_vreg_on_single()
211 vreg->cfg.name, vreg->cfg.min_uv, in icnss_vreg_on_single()
212 vreg->cfg.max_uv, ret); in icnss_vreg_on_single()
217 if (vreg->cfg.load_ua) { in icnss_vreg_on_single()
218 ret = regulator_set_load(vreg->reg, in icnss_vreg_on_single()
219 vreg->cfg.load_ua); in icnss_vreg_on_single()
223 vreg->cfg.name, vreg->cfg.load_ua, in icnss_vreg_on_single()
229 if (vreg->cfg.delay_us) in icnss_vreg_on_single()
230 udelay(vreg->cfg.delay_us); in icnss_vreg_on_single()
232 ret = regulator_enable(vreg->reg); in icnss_vreg_on_single()
235 vreg->cfg.name, ret); in icnss_vreg_on_single()
239 vreg->enabled = true; in icnss_vreg_on_single()
245 static int icnss_vreg_unvote_single(struct icnss_vreg_info *vreg) in icnss_vreg_unvote_single() argument
249 if (!vreg->enabled) { in icnss_vreg_unvote_single()
251 vreg->cfg.name); in icnss_vreg_unvote_single()
255 icnss_pr_dbg("Removing vote for Regulator %s\n", vreg->cfg.name); in icnss_vreg_unvote_single()
257 if (vreg->cfg.load_ua) { in icnss_vreg_unvote_single()
258 ret = regulator_set_load(vreg->reg, 0); in icnss_vreg_unvote_single()
261 vreg->cfg.name, ret); in icnss_vreg_unvote_single()
264 if (vreg->cfg.min_uv != 0 && vreg->cfg.max_uv != 0) { in icnss_vreg_unvote_single()
265 ret = regulator_set_voltage(vreg->reg, 0, in icnss_vreg_unvote_single()
266 vreg->cfg.max_uv); in icnss_vreg_unvote_single()
269 vreg->cfg.name, ret); in icnss_vreg_unvote_single()
275 static int icnss_vreg_off_single(struct icnss_vreg_info *vreg) in icnss_vreg_off_single() argument
279 if (!vreg->enabled) { in icnss_vreg_off_single()
281 vreg->cfg.name); in icnss_vreg_off_single()
286 vreg->cfg.name); in icnss_vreg_off_single()
288 ret = regulator_disable(vreg->reg); in icnss_vreg_off_single()
291 vreg->cfg.name, ret); in icnss_vreg_off_single()
293 if (vreg->cfg.load_ua) { in icnss_vreg_off_single()
294 ret = regulator_set_load(vreg->reg, 0); in icnss_vreg_off_single()
297 vreg->cfg.name, ret); in icnss_vreg_off_single()
300 if (vreg->cfg.min_uv != 0 && vreg->cfg.max_uv != 0) { in icnss_vreg_off_single()
301 ret = regulator_set_voltage(vreg->reg, 0, in icnss_vreg_off_single()
302 vreg->cfg.max_uv); in icnss_vreg_off_single()
305 vreg->cfg.name, ret); in icnss_vreg_off_single()
307 vreg->enabled = false; in icnss_vreg_off_single()
339 struct icnss_vreg_info *vreg; in icnss_get_vreg() local
350 vreg = devm_kzalloc(dev, sizeof(*vreg), GFP_KERNEL); in icnss_get_vreg()
351 if (!vreg) in icnss_get_vreg()
354 memcpy(&vreg->cfg, &vreg_cfg[i], sizeof(vreg->cfg)); in icnss_get_vreg()
355 ret = icnss_get_vreg_single(priv, vreg); in icnss_get_vreg()
362 list_add_tail(&vreg->list, vreg_list); in icnss_get_vreg()
371 struct icnss_vreg_info *vreg = NULL; in icnss_put_vreg() local
374 vreg = list_first_entry(vreg_list, in icnss_put_vreg()
376 list_del(&vreg->list); in icnss_put_vreg()
383 struct icnss_vreg_info *vreg = NULL; in icnss_vreg_on() local
386 list_for_each_entry(vreg, vreg_list, list) { in icnss_vreg_on()
387 if (IS_ERR_OR_NULL(vreg->reg) || !vreg->cfg.is_supported) in icnss_vreg_on()
390 ret = icnss_vreg_on_single(vreg); in icnss_vreg_on()
398 list_for_each_entry_continue_reverse(vreg, vreg_list, list) { in icnss_vreg_on()
399 if (IS_ERR_OR_NULL(vreg->reg) || !vreg->enabled) in icnss_vreg_on()
402 icnss_vreg_off_single(vreg); in icnss_vreg_on()
411 struct icnss_vreg_info *vreg = NULL; in icnss_vreg_off() local
413 list_for_each_entry_reverse(vreg, vreg_list, list) { in icnss_vreg_off()
414 if (IS_ERR_OR_NULL(vreg->reg)) in icnss_vreg_off()
417 icnss_vreg_off_single(vreg); in icnss_vreg_off()
426 struct icnss_vreg_info *vreg = NULL; in icnss_vreg_unvote() local
428 list_for_each_entry_reverse(vreg, vreg_list, list) { in icnss_vreg_unvote()
429 if (IS_ERR_OR_NULL(vreg->reg)) in icnss_vreg_unvote()
432 if (vreg->cfg.need_unvote) in icnss_vreg_unvote()
433 icnss_vreg_unvote_single(vreg); in icnss_vreg_unvote()
729 struct icnss_vreg_info *vreg = NULL; in icnss_power_on_chain1_reg() local
732 list_for_each_entry(vreg, vreg_list, list) { in icnss_power_on_chain1_reg()
733 if (!strcmp(ICNSS_CHAIN1_REGULATOR, vreg->cfg.name) && priv->is_chain1_supported) { in icnss_power_on_chain1_reg()
734 vreg->cfg.is_supported = true; in icnss_power_on_chain1_reg()
735 ret = icnss_vreg_on_single(vreg); in icnss_power_on_chain1_reg()