Lines Matching full:constraints
105 if (rdev->constraints && rdev->constraints->name) in rdev_get_name()
106 return rdev->constraints->name; in rdev_get_name()
121 if (!rdev->constraints) { in regulator_ops_is_valid()
122 rdev_err(rdev, "no constraints\n"); in regulator_ops_is_valid()
126 if (rdev->constraints->valid_ops_mask & ops) in regulator_ops_is_valid()
435 if (*max_uV > rdev->constraints->max_uV) in regulator_check_voltage()
436 *max_uV = rdev->constraints->max_uV; in regulator_check_voltage()
437 if (*min_uV < rdev->constraints->min_uV) in regulator_check_voltage()
438 *min_uV = rdev->constraints->min_uV; in regulator_check_voltage()
500 if (*max_uA > rdev->constraints->max_uA) in regulator_check_current_limit()
501 *max_uA = rdev->constraints->max_uA; in regulator_check_current_limit()
502 if (*min_uA < rdev->constraints->min_uA) in regulator_check_current_limit()
503 *min_uA = rdev->constraints->min_uA; in regulator_check_current_limit()
539 if (rdev->constraints->valid_modes_mask & *mode) in regulator_mode_constrain()
550 if (rdev->constraints == NULL) in regulator_get_suspend_state()
555 return &rdev->constraints->state_standby; in regulator_get_suspend_state()
557 return &rdev->constraints->state_mem; in regulator_get_suspend_state()
559 return &rdev->constraints->state_disk; in regulator_get_suspend_state()
728 if (!rdev->constraints) in min_microamps_show()
731 return sprintf(buf, "%d\n", rdev->constraints->min_uA); in min_microamps_show()
740 if (!rdev->constraints) in max_microamps_show()
743 return sprintf(buf, "%d\n", rdev->constraints->max_uA); in max_microamps_show()
752 if (!rdev->constraints) in min_microvolts_show()
755 return sprintf(buf, "%d\n", rdev->constraints->min_uV); in min_microvolts_show()
764 if (!rdev->constraints) in max_microvolts_show()
767 return sprintf(buf, "%d\n", rdev->constraints->max_uV); in max_microvolts_show()
816 return sprintf(buf, "%d\n", rdev->constraints->state_mem.uV); in suspend_mem_microvolts_show()
825 return sprintf(buf, "%d\n", rdev->constraints->state_disk.uV); in suspend_disk_microvolts_show()
834 return sprintf(buf, "%d\n", rdev->constraints->state_standby.uV); in suspend_standby_microvolts_show()
844 rdev->constraints->state_mem.mode); in suspend_mem_mode_show()
854 rdev->constraints->state_disk.mode); in suspend_disk_mode_show()
864 rdev->constraints->state_standby.mode); in suspend_standby_mode_show()
874 rdev->constraints->state_mem.enabled); in suspend_mem_state_show()
884 rdev->constraints->state_disk.enabled); in suspend_disk_state_show()
894 rdev->constraints->state_standby.enabled); in suspend_standby_state_show()
975 current_uA += rdev->constraints->system_load; in drms_uA_update()
985 * Unfortunately in some cases the constraints->valid_ops has in drms_uA_update()
991 if (!rdev->constraints->valid_modes_mask) { in drms_uA_update()
1011 input_uV = rdev->constraints->input_uV; in drms_uA_update()
1084 rdev->constraints->initial_state); in suspend_set_initial_state()
1094 struct regulation_constraints *constraints = rdev->constraints; in print_constraints_debug() local
1100 if (constraints->min_uV && constraints->max_uV) { in print_constraints_debug()
1101 if (constraints->min_uV == constraints->max_uV) in print_constraints_debug()
1103 constraints->min_uV / 1000); in print_constraints_debug()
1107 constraints->min_uV / 1000, in print_constraints_debug()
1108 constraints->max_uV / 1000); in print_constraints_debug()
1111 if (!constraints->min_uV || in print_constraints_debug()
1112 constraints->min_uV != constraints->max_uV) { in print_constraints_debug()
1119 if (constraints->uV_offset) in print_constraints_debug()
1121 constraints->uV_offset / 1000); in print_constraints_debug()
1123 if (constraints->min_uA && constraints->max_uA) { in print_constraints_debug()
1124 if (constraints->min_uA == constraints->max_uA) in print_constraints_debug()
1126 constraints->min_uA / 1000); in print_constraints_debug()
1130 constraints->min_uA / 1000, in print_constraints_debug()
1131 constraints->max_uA / 1000); in print_constraints_debug()
1134 if (!constraints->min_uA || in print_constraints_debug()
1135 constraints->min_uA != constraints->max_uA) { in print_constraints_debug()
1142 if (constraints->valid_modes_mask & REGULATOR_MODE_FAST) in print_constraints_debug()
1144 if (constraints->valid_modes_mask & REGULATOR_MODE_NORMAL) in print_constraints_debug()
1146 if (constraints->valid_modes_mask & REGULATOR_MODE_IDLE) in print_constraints_debug()
1148 if (constraints->valid_modes_mask & REGULATOR_MODE_STANDBY) in print_constraints_debug()
1167 struct regulation_constraints *constraints = rdev->constraints; in print_constraints() local
1171 if ((constraints->min_uV != constraints->max_uV) && in print_constraints()
1178 struct regulation_constraints *constraints) in machine_constraints_voltage() argument
1184 if (rdev->constraints->apply_uV && in machine_constraints_voltage()
1185 rdev->constraints->min_uV && rdev->constraints->max_uV) { in machine_constraints_voltage()
1192 rdev->constraints->min_uV, in machine_constraints_voltage()
1193 rdev->constraints->max_uV); in machine_constraints_voltage()
1195 rdev->constraints->min_uV, in machine_constraints_voltage()
1196 rdev->constraints->max_uV); in machine_constraints_voltage()
1216 if (current_uV < rdev->constraints->min_uV) { in machine_constraints_voltage()
1217 target_min = rdev->constraints->min_uV; in machine_constraints_voltage()
1218 target_max = rdev->constraints->min_uV; in machine_constraints_voltage()
1221 if (current_uV > rdev->constraints->max_uV) { in machine_constraints_voltage()
1222 target_min = rdev->constraints->max_uV; in machine_constraints_voltage()
1223 target_max = rdev->constraints->max_uV; in machine_constraints_voltage()
1248 int cmin = constraints->min_uV; in machine_constraints_voltage()
1249 int cmax = constraints->max_uV; in machine_constraints_voltage()
1252 * and the constraints are used by list_voltage. in machine_constraints_voltage()
1257 constraints->min_uV = cmin; in machine_constraints_voltage()
1258 constraints->max_uV = cmax; in machine_constraints_voltage()
1261 /* voltage constraints are optional */ in machine_constraints_voltage()
1265 /* else require explicit machine-level constraints */ in machine_constraints_voltage()
1267 rdev_err(rdev, "invalid voltage constraints\n"); in machine_constraints_voltage()
1290 /* final: [min_uV..max_uV] valid iff constraints valid */ in machine_constraints_voltage()
1293 "unsupportable voltage constraints %u-%uuV\n", in machine_constraints_voltage()
1298 /* use regulator's subset of machine constraints */ in machine_constraints_voltage()
1299 if (constraints->min_uV < min_uV) { in machine_constraints_voltage()
1301 constraints->min_uV, min_uV); in machine_constraints_voltage()
1302 constraints->min_uV = min_uV; in machine_constraints_voltage()
1304 if (constraints->max_uV > max_uV) { in machine_constraints_voltage()
1306 constraints->max_uV, max_uV); in machine_constraints_voltage()
1307 constraints->max_uV = max_uV; in machine_constraints_voltage()
1315 struct regulation_constraints *constraints) in machine_constraints_current() argument
1320 if (!constraints->min_uA && !constraints->max_uA) in machine_constraints_current()
1323 if (constraints->min_uA > constraints->max_uA) { in machine_constraints_current()
1324 rdev_err(rdev, "Invalid current constraints\n"); in machine_constraints_current()
1333 /* Set regulator current in constraints range */ in machine_constraints_current()
1334 ret = ops->set_current_limit(rdev, constraints->min_uA, in machine_constraints_current()
1335 constraints->max_uA); in machine_constraints_current()
1393 * set_machine_constraints - sets regulator constraints
1398 * Constraints *must* be set by platform code in order for some
1409 ret = machine_constraints_voltage(rdev, rdev->constraints); in set_machine_constraints()
1413 ret = machine_constraints_current(rdev, rdev->constraints); in set_machine_constraints()
1417 if (rdev->constraints->ilim_uA && ops->set_input_current_limit) { in set_machine_constraints()
1419 rdev->constraints->ilim_uA); in set_machine_constraints()
1427 if (rdev->constraints->initial_state) { in set_machine_constraints()
1435 if (rdev->constraints->initial_mode) { in set_machine_constraints()
1441 ret = ops->set_mode(rdev, rdev->constraints->initial_mode); in set_machine_constraints()
1446 } else if (rdev->constraints->system_load) { in set_machine_constraints()
1454 if ((rdev->constraints->ramp_delay || rdev->constraints->ramp_disable) in set_machine_constraints()
1456 ret = ops->set_ramp_delay(rdev, rdev->constraints->ramp_delay); in set_machine_constraints()
1463 if (rdev->constraints->pull_down && ops->set_pull_down) { in set_machine_constraints()
1471 if (rdev->constraints->soft_start && ops->set_soft_start) { in set_machine_constraints()
1493 if (rdev->constraints->over_current_protection in set_machine_constraints()
1495 int lim = rdev->constraints->over_curr_limits.prot; in set_machine_constraints()
1507 if (rdev->constraints->over_current_detection) in set_machine_constraints()
1510 &rdev->constraints->over_curr_limits); in set_machine_constraints()
1521 if (rdev->constraints->over_voltage_detection) in set_machine_constraints()
1524 &rdev->constraints->over_voltage_limits); in set_machine_constraints()
1535 if (rdev->constraints->under_voltage_detection) in set_machine_constraints()
1538 &rdev->constraints->under_voltage_limits); in set_machine_constraints()
1549 if (rdev->constraints->over_temp_detection) in set_machine_constraints()
1552 &rdev->constraints->temp_limits); in set_machine_constraints()
1563 if (rdev->constraints->active_discharge && ops->set_active_discharge) { in set_machine_constraints()
1564 bool ad_state = (rdev->constraints->active_discharge == in set_machine_constraints()
1586 rdev->constraints->always_on = in set_machine_constraints()
1587 rdev->supply->rdev->constraints->always_on; in set_machine_constraints()
1589 rdev->constraints->always_on = true; in set_machine_constraints()
1592 /* If the constraints say the regulator should be on at this point in set_machine_constraints()
1595 if (rdev->constraints->always_on || rdev->constraints->boot_on) { in set_machine_constraints()
1607 (rdev->constraints->always_on || in set_machine_constraints()
1623 if (rdev->constraints->always_on) in set_machine_constraints()
1760 const struct regulation_constraints *c = regulator->rdev->constraints; in constraint_flags_read_file()
1889 if (rdev->constraints && rdev->constraints->enable_time) in _regulator_get_enable_time()
1890 return rdev->constraints->enable_time; in _regulator_get_enable_time()
2158 "incomplete constraints, dummy supplies not allowed (id=%s)\n", id); in _regulator_get_common()
2998 (rdev->constraints && !rdev->constraints->always_on)) { in _regulator_disable()
3048 * machine constraints permit this operation.
3183 * machine constraints permit this operation.
3244 if (ret < rdev->constraints->min_uV) in _regulator_list_voltage()
3246 else if (ret > rdev->constraints->max_uV) in _regulator_list_voltage()
3469 return min_uV >= rdev->constraints->min_uV && in regulator_is_supported_voltage()
3470 max_uV <= rdev->constraints->max_uV; in regulator_is_supported_voltage()
3624 if (rdev->constraints->ramp_delay) in _regulator_set_voltage_time()
3625 ramp_delay = rdev->constraints->ramp_delay; in _regulator_set_voltage_time()
3628 else if (rdev->constraints->settling_time) in _regulator_set_voltage_time()
3629 return rdev->constraints->settling_time; in _regulator_set_voltage_time()
3630 else if (rdev->constraints->settling_time_up && in _regulator_set_voltage_time()
3632 return rdev->constraints->settling_time_up; in _regulator_set_voltage_time()
3633 else if (rdev->constraints->settling_time_down && in _regulator_set_voltage_time()
3635 return rdev->constraints->settling_time_down; in _regulator_set_voltage_time()
3656 min_uV += rdev->constraints->uV_offset; in _regulator_do_set_voltage()
3657 max_uV += rdev->constraints->uV_offset; in _regulator_do_set_voltage()
3811 /* constraints check */ in regulator_set_voltage_unlocked()
3907 struct regulation_constraints *constraints = rdev->constraints; in regulator_limit_voltage_step() local
3910 if (!constraints->max_uV_step || !_regulator_is_enabled(rdev)) in regulator_limit_voltage_step()
3920 if (abs(*current_uV - *min_uV) <= constraints->max_uV_step) in regulator_limit_voltage_step()
3925 *min_uV = min(*current_uV + constraints->max_uV_step, in regulator_limit_voltage_step()
3928 *min_uV = max(*current_uV - constraints->max_uV_step, in regulator_limit_voltage_step()
3942 struct regulation_constraints *constraints = rdev->constraints; in regulator_get_optimal_voltage() local
3960 desired_min_uV = constraints->min_uV; in regulator_get_optimal_voltage()
3961 desired_max_uV = constraints->max_uV; in regulator_get_optimal_voltage()
3999 max_spread = constraints->max_spread[0]; in regulator_get_optimal_voltage()
4199 * request voltage that meets the system constraints will be used.
4200 * Regulator system constraints must be set for this regulator before
4519 return ret - rdev->constraints->uV_offset; in regulator_get_voltage_rdev()
4558 * NOTE: Regulator system constraints must be set for this regulator before
4577 /* constraints check */ in regulator_set_current_limit()
4633 * NOTE: Regulator system constraints must be set for this regulator before
4661 /* constraints check */ in regulator_set_mode()
4763 * DRMS (if enabled by constraints) to set the most efficient regulator
4779 * to the most efficient operating mode if platform constraints allow.
4819 * constraints allow this. Bypass mode means that the regulator is
5161 if (!rdev->constraints->system_critical) in regulator_handle_critical()
5179 rdev->constraints->uv_less_critical_window_ms); in regulator_handle_critical()
5320 /* constraints need specific supporting methods */ in regulator_attr_is_visible()
5362 kfree(rdev->constraints); in regulator_dev_release()
5586 if (!rdev->constraints->always_on) { in generic_coupler_attach()
5737 /* set regulator constraints */ in regulator_register()
5739 rdev->constraints = kmemdup(&init_data->constraints, in regulator_register()
5740 sizeof(*rdev->constraints), in regulator_register()
5743 rdev->constraints = kzalloc(sizeof(*rdev->constraints), in regulator_register()
5745 if (!rdev->constraints) { in regulator_register()
5751 (rdev->constraints->always_on || in regulator_register()
5752 rdev->constraints->boot_on)) { in regulator_register()
5783 * to set the constraints in regulator_register()
5971 * regulator_has_full_constraints - the system has fully specified constraints
6118 c = rdev->constraints; in regulator_summary_show_subtree()
6329 struct regulation_constraints *c = rdev->constraints; in regulator_late_cleanup()
6357 * assume that full constraints are provided in regulator_late_cleanup()
6361 rdev_warn(rdev, "incomplete constraints, leaving on\n"); in regulator_late_cleanup()
6402 * for DT and ACPI as they have full constraints. in regulator_init_complete_work_function()
6415 * enabling full constraints and since it's much more natural in regulator_init_complete()
6417 * system has full constraints. in regulator_init_complete()