Lines Matching full:vreg

156  * @vreg:		Pointer to the RPMh regulator
163 static int rpmh_regulator_send_request(struct rpmh_vreg *vreg, in rpmh_regulator_send_request() argument
168 if (wait_for_ack || vreg->always_wait_for_ack) in rpmh_regulator_send_request()
169 ret = rpmh_write(vreg->dev, RPMH_ACTIVE_ONLY_STATE, cmd, 1); in rpmh_regulator_send_request()
171 ret = rpmh_write_async(vreg->dev, RPMH_ACTIVE_ONLY_STATE, cmd, in rpmh_regulator_send_request()
180 struct rpmh_vreg *vreg = rdev_get_drvdata(rdev); in _rpmh_regulator_vrm_set_voltage_sel() local
182 .addr = vreg->addr + RPMH_REGULATOR_REG_VRM_VOLTAGE, in _rpmh_regulator_vrm_set_voltage_sel()
190 ret = rpmh_regulator_send_request(vreg, &cmd, wait_for_ack); in _rpmh_regulator_vrm_set_voltage_sel()
192 vreg->voltage_selector = selector; in _rpmh_regulator_vrm_set_voltage_sel()
200 struct rpmh_vreg *vreg = rdev_get_drvdata(rdev); in rpmh_regulator_vrm_set_voltage_sel() local
202 if (vreg->enabled == -EINVAL) { in rpmh_regulator_vrm_set_voltage_sel()
207 vreg->voltage_selector = selector; in rpmh_regulator_vrm_set_voltage_sel()
212 selector > vreg->voltage_selector); in rpmh_regulator_vrm_set_voltage_sel()
217 struct rpmh_vreg *vreg = rdev_get_drvdata(rdev); in rpmh_regulator_vrm_get_voltage_sel() local
219 return vreg->voltage_selector; in rpmh_regulator_vrm_get_voltage_sel()
224 struct rpmh_vreg *vreg = rdev_get_drvdata(rdev); in rpmh_regulator_is_enabled() local
226 return vreg->enabled; in rpmh_regulator_is_enabled()
232 struct rpmh_vreg *vreg = rdev_get_drvdata(rdev); in rpmh_regulator_set_enable_state() local
234 .addr = vreg->addr + RPMH_REGULATOR_REG_ENABLE, in rpmh_regulator_set_enable_state()
239 if (vreg->enabled == -EINVAL && in rpmh_regulator_set_enable_state()
240 vreg->voltage_selector != -ENOTRECOVERABLE) { in rpmh_regulator_set_enable_state()
242 vreg->voltage_selector, true); in rpmh_regulator_set_enable_state()
247 ret = rpmh_regulator_send_request(vreg, &cmd, enable); in rpmh_regulator_set_enable_state()
249 vreg->enabled = enable; in rpmh_regulator_set_enable_state()
264 static int rpmh_regulator_vrm_set_mode_bypass(struct rpmh_vreg *vreg, in rpmh_regulator_vrm_set_mode_bypass() argument
268 .addr = vreg->addr + RPMH_REGULATOR_REG_VRM_MODE, in rpmh_regulator_vrm_set_mode_bypass()
275 pmic_mode = vreg->hw_data->pmic_mode_map[mode]; in rpmh_regulator_vrm_set_mode_bypass()
284 return rpmh_regulator_send_request(vreg, &cmd, true); in rpmh_regulator_vrm_set_mode_bypass()
290 struct rpmh_vreg *vreg = rdev_get_drvdata(rdev); in rpmh_regulator_vrm_set_mode() local
293 if (mode == vreg->mode) in rpmh_regulator_vrm_set_mode()
296 ret = rpmh_regulator_vrm_set_mode_bypass(vreg, mode, vreg->bypassed); in rpmh_regulator_vrm_set_mode()
298 vreg->mode = mode; in rpmh_regulator_vrm_set_mode()
305 struct rpmh_vreg *vreg = rdev_get_drvdata(rdev); in rpmh_regulator_vrm_get_mode() local
307 return vreg->mode; in rpmh_regulator_vrm_get_mode()
325 struct rpmh_vreg *vreg = rdev_get_drvdata(rdev); in rpmh_regulator_vrm_get_optimum_mode() local
327 if (load_uA >= vreg->hw_data->hpm_min_load_uA) in rpmh_regulator_vrm_get_optimum_mode()
336 struct rpmh_vreg *vreg = rdev_get_drvdata(rdev); in rpmh_regulator_vrm_set_bypass() local
339 if (vreg->bypassed == enable) in rpmh_regulator_vrm_set_bypass()
342 ret = rpmh_regulator_vrm_set_mode_bypass(vreg, vreg->mode, enable); in rpmh_regulator_vrm_set_bypass()
344 vreg->bypassed = enable; in rpmh_regulator_vrm_set_bypass()
352 struct rpmh_vreg *vreg = rdev_get_drvdata(rdev); in rpmh_regulator_vrm_get_bypass() local
354 *enable = vreg->bypassed; in rpmh_regulator_vrm_get_bypass()
403 * @vreg: Pointer to the individual rpmh-regulator resource
414 static int rpmh_regulator_init_vreg(struct rpmh_vreg *vreg, struct device *dev, in rpmh_regulator_init_vreg() argument
425 vreg->dev = dev; in rpmh_regulator_init_vreg()
439 vreg->addr = cmd_db_read_addr(rpmh_resource_name); in rpmh_regulator_init_vreg()
440 if (!vreg->addr) { in rpmh_regulator_init_vreg()
446 vreg->rdesc.name = rpmh_data->name; in rpmh_regulator_init_vreg()
447 vreg->rdesc.supply_name = rpmh_data->supply_name; in rpmh_regulator_init_vreg()
448 vreg->hw_data = rpmh_data->hw_data; in rpmh_regulator_init_vreg()
450 vreg->enabled = -EINVAL; in rpmh_regulator_init_vreg()
451 vreg->voltage_selector = -ENOTRECOVERABLE; in rpmh_regulator_init_vreg()
452 vreg->mode = REGULATOR_MODE_INVALID; in rpmh_regulator_init_vreg()
455 vreg->rdesc.linear_ranges = rpmh_data->hw_data->voltage_ranges; in rpmh_regulator_init_vreg()
456 vreg->rdesc.n_linear_ranges = rpmh_data->hw_data->n_linear_ranges; in rpmh_regulator_init_vreg()
457 vreg->rdesc.n_voltages = rpmh_data->hw_data->n_voltages; in rpmh_regulator_init_vreg()
460 vreg->always_wait_for_ack = of_property_read_bool(node, in rpmh_regulator_init_vreg()
463 vreg->rdesc.owner = THIS_MODULE; in rpmh_regulator_init_vreg()
464 vreg->rdesc.type = REGULATOR_VOLTAGE; in rpmh_regulator_init_vreg()
465 vreg->rdesc.ops = vreg->hw_data->ops; in rpmh_regulator_init_vreg()
466 vreg->rdesc.of_map_mode = vreg->hw_data->of_map_mode; in rpmh_regulator_init_vreg()
468 init_data = of_get_regulator_init_data(dev, node, &vreg->rdesc); in rpmh_regulator_init_vreg()
475 vreg->rdesc.fixed_uV = init_data->constraints.min_uV; in rpmh_regulator_init_vreg()
476 vreg->rdesc.n_voltages = 1; in rpmh_regulator_init_vreg()
482 reg_config.driver_data = vreg; in rpmh_regulator_init_vreg()
484 rdev = devm_regulator_register(dev, &vreg->rdesc, &reg_config); in rpmh_regulator_init_vreg()
493 node, rpmh_resource_name, vreg->addr); in rpmh_regulator_init_vreg()
1540 struct rpmh_vreg *vreg; in rpmh_regulator_probe() local
1555 vreg = devm_kzalloc(dev, sizeof(*vreg), GFP_KERNEL); in rpmh_regulator_probe()
1556 if (!vreg) in rpmh_regulator_probe()
1559 ret = rpmh_regulator_init_vreg(vreg, dev, node, pmic_id, in rpmh_regulator_probe()