Lines Matching +full:step +full:- +full:up

1 // SPDX-License-Identifier: GPL-2.0-only
5 * Copyright (C) 2012-2019 NVIDIA Corporation. All rights reserved.
20 mv = DIV_ROUND_CLOSEST(cvb->c2 * speedo, s_scale); in get_cvb_voltage()
21 mv = DIV_ROUND_CLOSEST((mv + cvb->c1) * speedo, s_scale) + cvb->c0; in get_cvb_voltage()
28 /* combined: apply voltage scale and round to cvb alignment step */ in round_cvb_voltage()
30 int step = (align->step_uv ? : 1000) * v_scale; in round_cvb_voltage() local
31 int offset = align->offset_uv * v_scale; in round_cvb_voltage()
33 uv = max(mv * 1000, offset) - offset; in round_cvb_voltage()
34 uv = DIV_ROUND_UP(uv, step) * align->step_uv + align->offset_uv; in round_cvb_voltage()
40 UP enumerator
43 static int round_voltage(int mv, const struct rail_alignment *align, int up) in round_voltage() argument
45 if (align->step_uv) { in round_voltage()
48 uv = max(mv * 1000, align->offset_uv) - align->offset_uv; in round_voltage()
49 uv = (uv + (up ? align->step_uv - 1 : 0)) / align->step_uv; in round_voltage()
50 return (uv * align->step_uv + align->offset_uv) / 1000; in round_voltage()
61 min_mv = round_voltage(table->min_millivolts, align, UP); in build_opp_table()
62 max_mv = round_voltage(table->max_millivolts, align, DOWN); in build_opp_table()
65 const struct cvb_table_freq_entry *entry = &table->entries[i]; in build_opp_table()
67 if (!entry->freq || (entry->freq > max_freq)) in build_opp_table()
70 dfll_mv = get_cvb_voltage(speedo_value, table->speedo_scale, in build_opp_table()
71 &entry->coefficients); in build_opp_table()
72 dfll_mv = round_cvb_voltage(dfll_mv, table->voltage_scale, in build_opp_table()
76 ret = dev_pm_opp_add(dev, entry->freq, dfll_mv * 1000); in build_opp_table()
85 * tegra_cvb_add_opp_table - build OPP table from Tegra CVB tables
89 * @align: parameters of the regulator step and offset
97 * function calculates the optimal voltage-frequency operating points
114 if (table->speedo_id != -1 && table->speedo_id != speedo_id) in tegra_cvb_add_opp_table()
117 if (table->process_id != -1 && table->process_id != process_id) in tegra_cvb_add_opp_table()
125 return ERR_PTR(-EINVAL); in tegra_cvb_add_opp_table()
135 const struct cvb_table_freq_entry *entry = &table->entries[i]; in tegra_cvb_remove_opp_table()
137 if (!entry->freq || (entry->freq > max_freq)) in tegra_cvb_remove_opp_table()
140 dev_pm_opp_remove(dev, entry->freq); in tegra_cvb_remove_opp_table()