feat(st-regulator): support regulator_set_voltage for fixed regulator

Always support the regulator_set_voltage operation for the same voltage.
This patch prepares the DDR power configuration when the power supplies
are fixed.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Signed-off-by: Maxime Méré <maxime.mere@foss.st.com>
Change-Id: Idf032b03c6f0c95f997dec3ed8a0d38c54a3de15
This commit is contained in:
Patrick Delaunay 2024-01-19 17:45:25 +01:00 committed by Maxime Méré
parent 6897ae8d0f
commit 156ed9724f

View file

@ -215,14 +215,18 @@ int regulator_set_voltage(struct rdev *rdev, uint16_t mvolt)
VERBOSE("%s: set mvolt\n", rdev->desc->node_name);
if (rdev->desc->ops->set_voltage == NULL) {
return -ENODEV;
}
if ((mvolt < rdev->min_mv) || (mvolt > rdev->max_mv)) {
return -EPERM;
}
if (regulator_get_voltage(rdev) == mvolt) {
return 0U;
}
if (rdev->desc->ops->set_voltage == NULL) {
return -ENODEV;
}
lock_driver(rdev);
ret = rdev->desc->ops->set_voltage(rdev->desc, mvolt);