UPSTREAM: regulator: scmi: Fix off-by-one for linear regulators .n_voltages setting
For linear regulators, the .n_voltages is (max_uv - min_uv) / uv_step + 1. Fixes: 0fbeae70ee7c ("regulator: add SCMI driver") Signed-off-by: Axel Lin <axel.lin@ingics.com> Reviewed-by: Cristian Marussi <cristian.marussi@arm.com> Link: https://lore.kernel.org/r/20210521073020.1944981-1-axel.lin@ingics.com Signed-off-by: Mark Brown <broonie@kernel.org> (cherry picked from commit 36cb555fae0875d5416e8514a84a427bec6e4cda) Bug: 187129171 Signed-off-by: Connor O'Brien <connoro@google.com> Change-Id: I443aedf5fb2f0062e9e4926596ba649997f0afc9
This commit is contained in:
@@ -173,7 +173,7 @@ scmi_config_linear_regulator_mappings(struct scmi_regulator *sreg,
|
||||
sreg->desc.uV_step =
|
||||
vinfo->levels_uv[SCMI_VOLTAGE_SEGMENT_STEP];
|
||||
sreg->desc.linear_min_sel = 0;
|
||||
sreg->desc.n_voltages = delta_uV / sreg->desc.uV_step;
|
||||
sreg->desc.n_voltages = (delta_uV / sreg->desc.uV_step) + 1;
|
||||
sreg->desc.ops = &scmi_reg_linear_ops;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user