drivers: regulator: add get_mode API

Add a new API to query the configured regulator mode. Updated fake
driver and API tests.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
This commit is contained in:
Gerard Marull-Paretas 2022-12-21 10:46:13 +01:00 committed by Carles Cufí
commit 1ca1f25918
4 changed files with 89 additions and 0 deletions

View file

@ -37,6 +37,8 @@ DEFINE_FAKE_VALUE_FUNC(int, regulator_fake_get_current_limit,
const struct device *, int32_t *);
DEFINE_FAKE_VALUE_FUNC(int, regulator_fake_set_mode, const struct device *,
regulator_mode_t);
DEFINE_FAKE_VALUE_FUNC(int, regulator_fake_get_mode, const struct device *,
regulator_mode_t *);
DEFINE_FAKE_VALUE_FUNC(int, regulator_fake_get_error_flags,
const struct device *, regulator_error_flags_t *);
@ -50,6 +52,7 @@ static struct regulator_driver_api api = {
.set_current_limit = regulator_fake_set_current_limit,
.get_current_limit = regulator_fake_get_current_limit,
.set_mode = regulator_fake_set_mode,
.get_mode = regulator_fake_get_mode,
.get_error_flags = regulator_fake_get_error_flags,
};