mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 03:15:31 +09:00
regulator: rk806: Solve the initialization of non integer multiple step voltage
Resolve system error caused by the set voltage not being an integer multiple of the uV_step. Signed-off-by: shengfei Xu <xsf@rock-chips.com> Change-Id: Icdae0985e0173289c66c1d6cc182da92508acd4c
This commit is contained in:
@@ -681,7 +681,9 @@ static int rk806_regulator_resume(struct regulator_dev *rdev)
|
||||
static int rk806_set_suspend_voltage_range(struct regulator_dev *rdev, int uv)
|
||||
{
|
||||
struct rk806_regulator_data *pdata = rdev_get_drvdata(rdev);
|
||||
int sel = regulator_map_voltage_linear_range(rdev, uv, uv);
|
||||
int sel = regulator_map_voltage_linear_range(rdev,
|
||||
uv,
|
||||
rdev->constraints->max_uV);
|
||||
struct rk806 *rk806 = pdata->rk806;
|
||||
int rid = rdev_get_id(rdev);
|
||||
int reg_offset;
|
||||
@@ -725,6 +727,8 @@ static int rk806_set_voltage(struct regulator_dev *rdev,
|
||||
int ret;
|
||||
int sel;
|
||||
|
||||
if (req_min_uV == req_max_uV)
|
||||
req_max_uV = rdev->constraints->max_uV;
|
||||
ret = regulator_map_voltage_linear_range(rdev, req_min_uV, req_max_uV);
|
||||
if (ret >= 0) {
|
||||
*selector = ret;
|
||||
|
||||
Reference in New Issue
Block a user