We do "selector += info->volt.v_offset" in da9055_regulator_set_voltage_bits() to take care of voltage range that does not start with 0 offset. Thus in da9055_regulator_get_voltage_sel() we should do corresponding "sel -= volt.v_offset" before returning selector. Otherwise, we pass wrong selector for list_voltage callback.
Signed-off-by: Axel Lin <axel....@ingics.com> --- drivers/regulator/da9055-regulator.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/regulator/da9055-regulator.c b/drivers/regulator/da9055-regulator.c index 79c5665..dbcb43d 100644 --- a/drivers/regulator/da9055-regulator.c +++ b/drivers/regulator/da9055-regulator.c @@ -232,10 +232,9 @@ static int da9055_regulator_get_voltage_sel(struct regulator_dev *rdev) return ret; sel = (ret & volt.v_mask); - if (sel <= volt.v_offset) - return 0; - else - return sel; + sel -= volt.v_offset; + + return sel; } static int da9055_regulator_set_voltage_bits(struct regulator_dev *rdev, -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/