From: Matti Vaittinen Date: Thu, 16 May 2024 08:55:37 +0000 (+0300) Subject: regulator: rohm-regulator: warn if unsupported voltage is set X-Git-Tag: v6.10-rc1~31^2~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cb3a0f84ae0caa5eabf40457485473edc1e2d3f0;p=thirdparty%2Flinux.git regulator: rohm-regulator: warn if unsupported voltage is set A few of the ROHM PMICs allow setting low-power state specific voltages for regulators. These voltages are then taken in use (by the hardware) when the PMIC state is changed. The voltages for these states can be given via device-tree. If unsupported voltage has been given, the users have only seen print: "driver callback failed to parse DT for regulator ". This does help to pinpoint the problem to some extent, but there may be several properties in device-tree so it should help if we can be a bit more specific. Print the voltage value and the run-state property if voltage can not be supported. Signed-off-by: Matti Vaittinen Link: https://msgid.link/r/0937411855967cbefd9ff2d6045a52ca26712c4a.1715848512.git.mazziesaccount@gmail.com Signed-off-by: Mark Brown --- diff --git a/drivers/regulator/rohm-regulator.c b/drivers/regulator/rohm-regulator.c index 0e2418ed957c1..4b95ca01959c1 100644 --- a/drivers/regulator/rohm-regulator.c +++ b/drivers/regulator/rohm-regulator.c @@ -46,6 +46,7 @@ static int set_dvs_level(const struct regulator_desc *desc, continue; if (ret == uv) { i <<= ffs(desc->vsel_mask) - 1; + ret = regmap_update_bits(regmap, reg, mask, i); if (omask && !ret) ret = regmap_update_bits(regmap, oreg, omask, @@ -53,6 +54,9 @@ static int set_dvs_level(const struct regulator_desc *desc, break; } } + if (i == desc->n_voltages) + pr_warn("Unsupported %s voltage %u\n", prop, uv); + return ret; }