From 0c28da26ba4b47d81c0f69968fda0d7802e7ee38 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Thu, 12 Jan 2023 15:33:06 +0100 Subject: [PATCH] drivers: regulator: npm6001: handle LDO0 set voltage correctly Even if the regulator is fixed, allow valid voltage input (1.8V). Signed-off-by: Gerard Marull-Paretas --- drivers/regulator/regulator_npm6001.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/regulator/regulator_npm6001.c b/drivers/regulator/regulator_npm6001.c index 21086b3ad60..32e8c3192e3 100644 --- a/drivers/regulator/regulator_npm6001.c +++ b/drivers/regulator/regulator_npm6001.c @@ -383,7 +383,10 @@ static int regulator_npm6001_set_voltage(const struct device *dev, case NPM6001_SOURCE_LDO0: return regulator_npm6001_ldo0_set_voltage(dev, min_uv, max_uv); case NPM6001_SOURCE_LDO1: - return -ENOTSUP; + if ((min_uv != 1800000) && (max_uv != 1800000)) { + return -EINVAL; + } + break; default: __ASSERT(NULL, "Unexpected source"); }