From: Axel Lin Date: Thu, 16 Aug 2012 04:26:02 +0000 (+0800) Subject: regulator: max8907: Fix n_voltages for MAX8907B SD1 X-Git-Tag: firefly_0821_release~3680^2~2008^2^5~19 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=7305608bc888271786e38aa27e63f846367ae842;p=firefly-linux-kernel-4.4.55.git regulator: max8907: Fix n_voltages for MAX8907B SD1 For linear voltage mapping, the n_voltages is (max - min) / step + 1 Signed-off-by: Axel Lin Acked-by: Stephen Warren Signed-off-by: Mark Brown --- diff --git a/drivers/regulator/max8907-regulator.c b/drivers/regulator/max8907-regulator.c index bd3b28b55231..bdf21a199612 100644 --- a/drivers/regulator/max8907-regulator.c +++ b/drivers/regulator/max8907-regulator.c @@ -286,7 +286,8 @@ static __devinit int max8907_regulator_probe(struct platform_device *pdev) MAX8907_II2RR_VERSION_REV_B) { pmic->desc[MAX8907_SD1].min_uV = 637500; pmic->desc[MAX8907_SD1].uV_step = 12500; - pmic->desc[MAX8907_SD1].n_voltages = (1425000 - 637500) / 12500; + pmic->desc[MAX8907_SD1].n_voltages = + (1425000 - 637500) / 12500 + 1; } for (i = 0; i < MAX8907_NUM_REGULATORS; i++) {