Lines Matching refs:vreg

133 				struct cnss_vreg_info *vreg)  in cnss_get_vreg_single()  argument
146 reg = devm_regulator_get_optional(dev, vreg->cfg.name); in cnss_get_vreg_single()
153 vreg->cfg.name); in cnss_get_vreg_single()
156 vreg->cfg.name, ret); in cnss_get_vreg_single()
160 vreg->reg = reg; in cnss_get_vreg_single()
163 vreg->cfg.name); in cnss_get_vreg_single()
170 vreg->cfg.min_uv = be32_to_cpup(&prop[0]); in cnss_get_vreg_single()
171 vreg->cfg.max_uv = be32_to_cpup(&prop[1]); in cnss_get_vreg_single()
172 vreg->cfg.load_ua = be32_to_cpup(&prop[2]); in cnss_get_vreg_single()
173 vreg->cfg.delay_us = be32_to_cpup(&prop[3]); in cnss_get_vreg_single()
174 vreg->cfg.need_unvote = be32_to_cpup(&prop[4]); in cnss_get_vreg_single()
178 vreg->cfg.name, vreg->cfg.min_uv, in cnss_get_vreg_single()
179 vreg->cfg.max_uv, vreg->cfg.load_ua, in cnss_get_vreg_single()
180 vreg->cfg.delay_us, vreg->cfg.need_unvote); in cnss_get_vreg_single()
186 struct cnss_vreg_info *vreg) in cnss_put_vreg_single() argument
190 cnss_pr_dbg("Put regulator: %s\n", vreg->cfg.name); in cnss_put_vreg_single()
191 devm_regulator_put(vreg->reg); in cnss_put_vreg_single()
192 devm_kfree(dev, vreg); in cnss_put_vreg_single()
195 static int cnss_vreg_on_single(struct cnss_vreg_info *vreg) in cnss_vreg_on_single() argument
199 if (vreg->enabled) { in cnss_vreg_on_single()
201 vreg->cfg.name); in cnss_vreg_on_single()
205 cnss_pr_dbg("Regulator %s is being enabled\n", vreg->cfg.name); in cnss_vreg_on_single()
207 if (vreg->cfg.min_uv != 0 && vreg->cfg.max_uv != 0) { in cnss_vreg_on_single()
208 ret = regulator_set_voltage(vreg->reg, in cnss_vreg_on_single()
209 vreg->cfg.min_uv, in cnss_vreg_on_single()
210 vreg->cfg.max_uv); in cnss_vreg_on_single()
214 vreg->cfg.name, vreg->cfg.min_uv, in cnss_vreg_on_single()
215 vreg->cfg.max_uv, ret); in cnss_vreg_on_single()
220 if (vreg->cfg.load_ua) { in cnss_vreg_on_single()
221 ret = regulator_set_load(vreg->reg, in cnss_vreg_on_single()
222 vreg->cfg.load_ua); in cnss_vreg_on_single()
226 vreg->cfg.name, vreg->cfg.load_ua, in cnss_vreg_on_single()
232 if (vreg->cfg.delay_us) in cnss_vreg_on_single()
233 udelay(vreg->cfg.delay_us); in cnss_vreg_on_single()
235 ret = regulator_enable(vreg->reg); in cnss_vreg_on_single()
238 vreg->cfg.name, ret); in cnss_vreg_on_single()
241 vreg->enabled = true; in cnss_vreg_on_single()
247 static int cnss_vreg_unvote_single(struct cnss_vreg_info *vreg) in cnss_vreg_unvote_single() argument
251 if (!vreg->enabled) { in cnss_vreg_unvote_single()
253 vreg->cfg.name); in cnss_vreg_unvote_single()
257 cnss_pr_dbg("Removing vote for Regulator %s\n", vreg->cfg.name); in cnss_vreg_unvote_single()
259 if (vreg->cfg.load_ua) { in cnss_vreg_unvote_single()
260 ret = regulator_set_load(vreg->reg, 0); in cnss_vreg_unvote_single()
263 vreg->cfg.name, ret); in cnss_vreg_unvote_single()
266 if (vreg->cfg.min_uv != 0 && vreg->cfg.max_uv != 0) { in cnss_vreg_unvote_single()
267 ret = regulator_set_voltage(vreg->reg, 0, in cnss_vreg_unvote_single()
268 vreg->cfg.max_uv); in cnss_vreg_unvote_single()
271 vreg->cfg.name, ret); in cnss_vreg_unvote_single()
277 static int cnss_vreg_off_single(struct cnss_vreg_info *vreg) in cnss_vreg_off_single() argument
281 if (!vreg->enabled) { in cnss_vreg_off_single()
283 vreg->cfg.name); in cnss_vreg_off_single()
288 vreg->cfg.name); in cnss_vreg_off_single()
290 ret = regulator_disable(vreg->reg); in cnss_vreg_off_single()
293 vreg->cfg.name, ret); in cnss_vreg_off_single()
295 if (vreg->cfg.load_ua) { in cnss_vreg_off_single()
296 ret = regulator_set_load(vreg->reg, 0); in cnss_vreg_off_single()
299 vreg->cfg.name, ret); in cnss_vreg_off_single()
302 if (vreg->cfg.min_uv != 0 && vreg->cfg.max_uv != 0) { in cnss_vreg_off_single()
303 ret = regulator_set_voltage(vreg->reg, 0, in cnss_vreg_off_single()
304 vreg->cfg.max_uv); in cnss_vreg_off_single()
307 vreg->cfg.name, ret); in cnss_vreg_off_single()
309 vreg->enabled = false; in cnss_vreg_off_single()
347 struct cnss_vreg_info *vreg; in cnss_get_vreg() local
385 vreg = devm_kzalloc(dev, sizeof(*vreg), GFP_KERNEL); in cnss_get_vreg()
386 if (!vreg) in cnss_get_vreg()
392 &vreg->cfg.name); in cnss_get_vreg()
398 memcpy(&vreg->cfg, &vreg_cfg[i], sizeof(vreg->cfg)); in cnss_get_vreg()
401 ret = cnss_get_vreg_single(plat_priv, vreg); in cnss_get_vreg()
404 devm_kfree(dev, vreg); in cnss_get_vreg()
407 devm_kfree(dev, vreg); in cnss_get_vreg()
411 list_add_tail(&vreg->list, vreg_list); in cnss_get_vreg()
420 struct cnss_vreg_info *vreg; in cnss_put_vreg() local
423 vreg = list_first_entry(vreg_list, in cnss_put_vreg()
425 list_del(&vreg->list); in cnss_put_vreg()
426 if (IS_ERR_OR_NULL(vreg->reg)) in cnss_put_vreg()
428 cnss_put_vreg_single(plat_priv, vreg); in cnss_put_vreg()
435 struct cnss_vreg_info *vreg; in cnss_vreg_on() local
438 list_for_each_entry(vreg, vreg_list, list) { in cnss_vreg_on()
439 if (IS_ERR_OR_NULL(vreg->reg)) in cnss_vreg_on()
441 ret = cnss_vreg_on_single(vreg); in cnss_vreg_on()
449 list_for_each_entry_continue_reverse(vreg, vreg_list, list) { in cnss_vreg_on()
450 if (IS_ERR_OR_NULL(vreg->reg) || !vreg->enabled) in cnss_vreg_on()
453 cnss_vreg_off_single(vreg); in cnss_vreg_on()
462 struct cnss_vreg_info *vreg; in cnss_vreg_off() local
464 list_for_each_entry_reverse(vreg, vreg_list, list) { in cnss_vreg_off()
465 if (IS_ERR_OR_NULL(vreg->reg)) in cnss_vreg_off()
468 cnss_vreg_off_single(vreg); in cnss_vreg_off()
477 struct cnss_vreg_info *vreg; in cnss_vreg_unvote() local
479 list_for_each_entry_reverse(vreg, vreg_list, list) { in cnss_vreg_unvote()
480 if (IS_ERR_OR_NULL(vreg->reg)) in cnss_vreg_unvote()
483 if (vreg->cfg.need_unvote) in cnss_vreg_unvote()
484 cnss_vreg_unvote_single(vreg); in cnss_vreg_unvote()
1662 const char *pmu_pin, *vreg; in cnss_aop_ol_cpr_cfg_setup() local
1667 char vreg[MAX_PROP_SIZE]; in cnss_aop_ol_cpr_cfg_setup() member
1701 vreg = NULL; in cnss_aop_ol_cpr_cfg_setup()
1706 vreg = plat_priv->pmu_vreg_map[j + 1]; in cnss_aop_ol_cpr_cfg_setup()
1710 if (!vreg) { in cnss_aop_ol_cpr_cfg_setup()
1716 fw_pmu_param[i].pin_name, vreg); in cnss_aop_ol_cpr_cfg_setup()
1721 if (plat_vreg_param[j].vreg[0] == '\0') in cnss_aop_ol_cpr_cfg_setup()
1722 strlcpy(plat_vreg_param[j].vreg, vreg, in cnss_aop_ol_cpr_cfg_setup()
1723 sizeof(plat_vreg_param[j].vreg)); in cnss_aop_ol_cpr_cfg_setup()
1724 else if (!strnstr(plat_vreg_param[j].vreg, vreg, in cnss_aop_ol_cpr_cfg_setup()
1725 strlen(plat_vreg_param[j].vreg))) in cnss_aop_ol_cpr_cfg_setup()
1749 plat_vreg_param[j].vreg, in cnss_aop_ol_cpr_cfg_setup()
1760 plat_vreg_param[i].vreg, in cnss_aop_ol_cpr_cfg_setup()
1768 plat_vreg_param[i].vreg, in cnss_aop_ol_cpr_cfg_setup()