Lines Matching full:constraints
103 if (rdev->constraints && rdev->constraints->name) in rdev_get_name()
104 return rdev->constraints->name; in rdev_get_name()
119 if (!rdev->constraints) { in regulator_ops_is_valid()
120 rdev_err(rdev, "no constraints\n"); in regulator_ops_is_valid()
124 if (rdev->constraints->valid_ops_mask & ops) in regulator_ops_is_valid()
431 if (*max_uV > rdev->constraints->max_uV) in regulator_check_voltage()
432 *max_uV = rdev->constraints->max_uV; in regulator_check_voltage()
433 if (*min_uV < rdev->constraints->min_uV) in regulator_check_voltage()
434 *min_uV = rdev->constraints->min_uV; in regulator_check_voltage()
496 if (*max_uA > rdev->constraints->max_uA) in regulator_check_current_limit()
497 *max_uA = rdev->constraints->max_uA; in regulator_check_current_limit()
498 if (*min_uA < rdev->constraints->min_uA) in regulator_check_current_limit()
499 *min_uA = rdev->constraints->min_uA; in regulator_check_current_limit()
535 if (rdev->constraints->valid_modes_mask & *mode) in regulator_mode_constrain()
546 if (rdev->constraints == NULL) in regulator_get_suspend_state()
551 return &rdev->constraints->state_standby; in regulator_get_suspend_state()
553 return &rdev->constraints->state_mem; in regulator_get_suspend_state()
555 return &rdev->constraints->state_disk; in regulator_get_suspend_state()
724 if (!rdev->constraints) in min_microamps_show()
727 return sprintf(buf, "%d\n", rdev->constraints->min_uA); in min_microamps_show()
736 if (!rdev->constraints) in max_microamps_show()
739 return sprintf(buf, "%d\n", rdev->constraints->max_uA); in max_microamps_show()
748 if (!rdev->constraints) in min_microvolts_show()
751 return sprintf(buf, "%d\n", rdev->constraints->min_uV); in min_microvolts_show()
760 if (!rdev->constraints) in max_microvolts_show()
763 return sprintf(buf, "%d\n", rdev->constraints->max_uV); in max_microvolts_show()
812 return sprintf(buf, "%d\n", rdev->constraints->state_mem.uV); in suspend_mem_microvolts_show()
821 return sprintf(buf, "%d\n", rdev->constraints->state_disk.uV); in suspend_disk_microvolts_show()
830 return sprintf(buf, "%d\n", rdev->constraints->state_standby.uV); in suspend_standby_microvolts_show()
840 rdev->constraints->state_mem.mode); in suspend_mem_mode_show()
850 rdev->constraints->state_disk.mode); in suspend_disk_mode_show()
860 rdev->constraints->state_standby.mode); in suspend_standby_mode_show()
870 rdev->constraints->state_mem.enabled); in suspend_mem_state_show()
880 rdev->constraints->state_disk.enabled); in suspend_disk_state_show()
890 rdev->constraints->state_standby.enabled); in suspend_standby_state_show()
971 current_uA += rdev->constraints->system_load; in drms_uA_update()
981 * Unfortunately in some cases the constraints->valid_ops has in drms_uA_update()
987 if (!rdev->constraints->valid_modes_mask) { in drms_uA_update()
1007 input_uV = rdev->constraints->input_uV; in drms_uA_update()
1080 rdev->constraints->initial_state); in suspend_set_initial_state()
1090 struct regulation_constraints *constraints = rdev->constraints; in print_constraints_debug() local
1096 if (constraints->min_uV && constraints->max_uV) { in print_constraints_debug()
1097 if (constraints->min_uV == constraints->max_uV) in print_constraints_debug()
1099 constraints->min_uV / 1000); in print_constraints_debug()
1103 constraints->min_uV / 1000, in print_constraints_debug()
1104 constraints->max_uV / 1000); in print_constraints_debug()
1107 if (!constraints->min_uV || in print_constraints_debug()
1108 constraints->min_uV != constraints->max_uV) { in print_constraints_debug()
1115 if (constraints->uV_offset) in print_constraints_debug()
1117 constraints->uV_offset / 1000); in print_constraints_debug()
1119 if (constraints->min_uA && constraints->max_uA) { in print_constraints_debug()
1120 if (constraints->min_uA == constraints->max_uA) in print_constraints_debug()
1122 constraints->min_uA / 1000); in print_constraints_debug()
1126 constraints->min_uA / 1000, in print_constraints_debug()
1127 constraints->max_uA / 1000); in print_constraints_debug()
1130 if (!constraints->min_uA || in print_constraints_debug()
1131 constraints->min_uA != constraints->max_uA) { in print_constraints_debug()
1138 if (constraints->valid_modes_mask & REGULATOR_MODE_FAST) in print_constraints_debug()
1140 if (constraints->valid_modes_mask & REGULATOR_MODE_NORMAL) in print_constraints_debug()
1142 if (constraints->valid_modes_mask & REGULATOR_MODE_IDLE) in print_constraints_debug()
1144 if (constraints->valid_modes_mask & REGULATOR_MODE_STANDBY) in print_constraints_debug()
1163 struct regulation_constraints *constraints = rdev->constraints; in print_constraints() local
1167 if ((constraints->min_uV != constraints->max_uV) && in print_constraints()
1174 struct regulation_constraints *constraints) in machine_constraints_voltage() argument
1180 if (rdev->constraints->apply_uV && in machine_constraints_voltage()
1181 rdev->constraints->min_uV && rdev->constraints->max_uV) { in machine_constraints_voltage()
1188 rdev->constraints->min_uV, in machine_constraints_voltage()
1189 rdev->constraints->max_uV); in machine_constraints_voltage()
1191 rdev->constraints->min_uV, in machine_constraints_voltage()
1192 rdev->constraints->max_uV); in machine_constraints_voltage()
1212 if (current_uV < rdev->constraints->min_uV) { in machine_constraints_voltage()
1213 target_min = rdev->constraints->min_uV; in machine_constraints_voltage()
1214 target_max = rdev->constraints->min_uV; in machine_constraints_voltage()
1217 if (current_uV > rdev->constraints->max_uV) { in machine_constraints_voltage()
1218 target_min = rdev->constraints->max_uV; in machine_constraints_voltage()
1219 target_max = rdev->constraints->max_uV; in machine_constraints_voltage()
1244 int cmin = constraints->min_uV; in machine_constraints_voltage()
1245 int cmax = constraints->max_uV; in machine_constraints_voltage()
1248 * and the constraints are used by list_voltage. in machine_constraints_voltage()
1253 constraints->min_uV = cmin; in machine_constraints_voltage()
1254 constraints->max_uV = cmax; in machine_constraints_voltage()
1257 /* voltage constraints are optional */ in machine_constraints_voltage()
1261 /* else require explicit machine-level constraints */ in machine_constraints_voltage()
1263 rdev_err(rdev, "invalid voltage constraints\n"); in machine_constraints_voltage()
1286 /* final: [min_uV..max_uV] valid iff constraints valid */ in machine_constraints_voltage()
1289 "unsupportable voltage constraints %u-%uuV\n", in machine_constraints_voltage()
1294 /* use regulator's subset of machine constraints */ in machine_constraints_voltage()
1295 if (constraints->min_uV < min_uV) { in machine_constraints_voltage()
1297 constraints->min_uV, min_uV); in machine_constraints_voltage()
1298 constraints->min_uV = min_uV; in machine_constraints_voltage()
1300 if (constraints->max_uV > max_uV) { in machine_constraints_voltage()
1302 constraints->max_uV, max_uV); in machine_constraints_voltage()
1303 constraints->max_uV = max_uV; in machine_constraints_voltage()
1311 struct regulation_constraints *constraints) in machine_constraints_current() argument
1316 if (!constraints->min_uA && !constraints->max_uA) in machine_constraints_current()
1319 if (constraints->min_uA > constraints->max_uA) { in machine_constraints_current()
1320 rdev_err(rdev, "Invalid current constraints\n"); in machine_constraints_current()
1329 /* Set regulator current in constraints range */ in machine_constraints_current()
1330 ret = ops->set_current_limit(rdev, constraints->min_uA, in machine_constraints_current()
1331 constraints->max_uA); in machine_constraints_current()
1389 * set_machine_constraints - sets regulator constraints
1394 * Constraints *must* be set by platform code in order for some
1403 ret = machine_constraints_voltage(rdev, rdev->constraints); in set_machine_constraints()
1407 ret = machine_constraints_current(rdev, rdev->constraints); in set_machine_constraints()
1411 if (rdev->constraints->ilim_uA && ops->set_input_current_limit) { in set_machine_constraints()
1413 rdev->constraints->ilim_uA); in set_machine_constraints()
1421 if (rdev->constraints->initial_state) { in set_machine_constraints()
1429 if (rdev->constraints->initial_mode) { in set_machine_constraints()
1435 ret = ops->set_mode(rdev, rdev->constraints->initial_mode); in set_machine_constraints()
1440 } else if (rdev->constraints->system_load) { in set_machine_constraints()
1448 if ((rdev->constraints->ramp_delay || rdev->constraints->ramp_disable) in set_machine_constraints()
1450 ret = ops->set_ramp_delay(rdev, rdev->constraints->ramp_delay); in set_machine_constraints()
1457 if (rdev->constraints->pull_down && ops->set_pull_down) { in set_machine_constraints()
1465 if (rdev->constraints->soft_start && ops->set_soft_start) { in set_machine_constraints()
1487 if (rdev->constraints->over_current_protection in set_machine_constraints()
1489 int lim = rdev->constraints->over_curr_limits.prot; in set_machine_constraints()
1501 if (rdev->constraints->over_current_detection) in set_machine_constraints()
1504 &rdev->constraints->over_curr_limits); in set_machine_constraints()
1515 if (rdev->constraints->over_voltage_detection) in set_machine_constraints()
1518 &rdev->constraints->over_voltage_limits); in set_machine_constraints()
1529 if (rdev->constraints->under_voltage_detection) in set_machine_constraints()
1532 &rdev->constraints->under_voltage_limits); in set_machine_constraints()
1543 if (rdev->constraints->over_temp_detection) in set_machine_constraints()
1546 &rdev->constraints->temp_limits); in set_machine_constraints()
1557 if (rdev->constraints->active_discharge && ops->set_active_discharge) { in set_machine_constraints()
1558 bool ad_state = (rdev->constraints->active_discharge == in set_machine_constraints()
1580 rdev->constraints->always_on = in set_machine_constraints()
1581 rdev->supply->rdev->constraints->always_on; in set_machine_constraints()
1583 rdev->constraints->always_on = true; in set_machine_constraints()
1589 /* If the constraints say the regulator should be on at this point in set_machine_constraints()
1592 if (rdev->constraints->always_on || rdev->constraints->boot_on) { in set_machine_constraints()
1614 if (rdev->constraints->always_on) in set_machine_constraints()
1744 const struct regulation_constraints *c = regulator->rdev->constraints; in constraint_flags_read_file()
1870 if (rdev->constraints && rdev->constraints->enable_time) in _regulator_get_enable_time()
1871 return rdev->constraints->enable_time; in _regulator_get_enable_time()
2124 "incomplete constraints, dummy supplies not allowed\n"); in _regulator_get()
2928 (rdev->constraints && !rdev->constraints->always_on)) { in _regulator_disable()
2977 * machine constraints permit this operation.
3108 * machine constraints permit this operation.
3167 if (ret < rdev->constraints->min_uV) in _regulator_list_voltage()
3169 else if (ret > rdev->constraints->max_uV) in _regulator_list_voltage()
3355 return min_uV >= rdev->constraints->min_uV && in regulator_is_supported_voltage()
3356 max_uV <= rdev->constraints->max_uV; in regulator_is_supported_voltage()
3510 if (rdev->constraints->ramp_delay) in _regulator_set_voltage_time()
3511 ramp_delay = rdev->constraints->ramp_delay; in _regulator_set_voltage_time()
3514 else if (rdev->constraints->settling_time) in _regulator_set_voltage_time()
3515 return rdev->constraints->settling_time; in _regulator_set_voltage_time()
3516 else if (rdev->constraints->settling_time_up && in _regulator_set_voltage_time()
3518 return rdev->constraints->settling_time_up; in _regulator_set_voltage_time()
3519 else if (rdev->constraints->settling_time_down && in _regulator_set_voltage_time()
3521 return rdev->constraints->settling_time_down; in _regulator_set_voltage_time()
3542 min_uV += rdev->constraints->uV_offset; in _regulator_do_set_voltage()
3543 max_uV += rdev->constraints->uV_offset; in _regulator_do_set_voltage()
3697 /* constraints check */ in regulator_set_voltage_unlocked()
3793 struct regulation_constraints *constraints = rdev->constraints; in regulator_limit_voltage_step() local
3796 if (!constraints->max_uV_step || !_regulator_is_enabled(rdev)) in regulator_limit_voltage_step()
3806 if (abs(*current_uV - *min_uV) <= constraints->max_uV_step) in regulator_limit_voltage_step()
3811 *min_uV = min(*current_uV + constraints->max_uV_step, in regulator_limit_voltage_step()
3814 *min_uV = max(*current_uV - constraints->max_uV_step, in regulator_limit_voltage_step()
3828 struct regulation_constraints *constraints = rdev->constraints; in regulator_get_optimal_voltage() local
3846 desired_min_uV = constraints->min_uV; in regulator_get_optimal_voltage()
3847 desired_max_uV = constraints->max_uV; in regulator_get_optimal_voltage()
3886 max_spread = constraints->max_spread[0]; in regulator_get_optimal_voltage()
4086 * request voltage that meets the system constraints will be used.
4087 * Regulator system constraints must be set for this regulator before
4398 return ret - rdev->constraints->uV_offset; in regulator_get_voltage_rdev()
4437 * NOTE: Regulator system constraints must be set for this regulator before
4454 /* constraints check */ in regulator_set_current_limit()
4509 * NOTE: Regulator system constraints must be set for this regulator before
4535 /* constraints check */ in regulator_set_mode()
4632 * DRMS (if enabled by constraints) to set the most efficient regulator
4648 * to the most efficient operating mode if platform constraints allow.
4688 * constraints allow this. Bypass mode means that the regulator is
5116 /* constraints need specific supporting methods */ in regulator_attr_is_visible()
5158 kfree(rdev->constraints); in regulator_dev_release()
5384 if (!rdev->constraints->always_on) { in generic_coupler_attach()
5534 /* set regulator constraints */ in regulator_register()
5536 rdev->constraints = kmemdup(&init_data->constraints, in regulator_register()
5537 sizeof(*rdev->constraints), in regulator_register()
5540 rdev->constraints = kzalloc(sizeof(*rdev->constraints), in regulator_register()
5542 if (!rdev->constraints) { in regulator_register()
5548 (rdev->constraints->always_on || in regulator_register()
5549 rdev->constraints->boot_on)) { in regulator_register()
5580 * to set the constraints in regulator_register()
5769 * regulator_has_full_constraints - the system has fully specified constraints
5910 c = rdev->constraints; in regulator_summary_show_subtree()
6120 struct regulation_constraints *c = rdev->constraints; in regulator_late_cleanup()
6148 * assume that full constraints are provided in regulator_late_cleanup()
6152 rdev_warn(rdev, "incomplete constraints, leaving on\n"); in regulator_late_cleanup()
6176 * for DT and ACPI as they have full constraints. in regulator_init_complete_work_function()
6189 * enabling full constraints and since it's much more natural in regulator_init_complete()
6191 * system has full constraints. in regulator_init_complete()