RE: [PATCH v2] regulator: tps65217: Fix voltage boundary checkingin tps65217_pmic_map_voltage

From: AnilKumar, Chimata
Date: Tue Jul 03 2012 - 03:45:56 EST


Hi Axel,

Thanks for the patch

Acked-by: AnilKumar Ch <anilkumar@xxxxxx>

On Tue, Jul 03, 2012 at 12:49:33, Axel Lin wrote:
> It is ok to request voltage with min_uV < tps->info[rid]->min_uV and
> max_uV > tps->info[rid]->max_uV.
>
> The equation we used in uv_to_vsel() does not allow
> min_uV < tps->info[rid]->min_uV, otherwise it returns negative selector.
> So we need to set min_uV = tps->info[rid]->min_uV if
> min_uV < tps->info[rid]->min_uV.
>
> Signed-off-by: Axel Lin <axel.lin@xxxxxxxxx>
> ---
> drivers/regulator/tps65217-regulator.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/regulator/tps65217-regulator.c b/drivers/regulator/tps65217-regulator.c
> index 0a3df5b..f7d0495 100644
> --- a/drivers/regulator/tps65217-regulator.c
> +++ b/drivers/regulator/tps65217-regulator.c
> @@ -206,10 +206,10 @@ static int tps65217_pmic_map_voltage(struct regulator_dev *dev,
> if (rid < TPS65217_DCDC_1 || rid > TPS65217_LDO_4)
> return -EINVAL;
>
> - if (min_uV < tps->info[rid]->min_uV || min_uV > tps->info[rid]->max_uV)
> - return -EINVAL;
> + if (min_uV < tps->info[rid]->min_uV)
> + min_uV = tps->info[rid]->min_uV;
>
> - if (max_uV < tps->info[rid]->min_uV || max_uV > tps->info[rid]->max_uV)
> + if (max_uV < tps->info[rid]->min_uV || min_uV > tps->info[rid]->max_uV)
> return -EINVAL;
>
> ret = tps->info[rid]->uv_to_vsel(min_uV, &sel);
> --
> 1.7.9.5
>
>
>
>

N‹§²æìr¸›yúèšØb²X¬¶ÇvØ^–)Þ{.nÇ+‰·¥Š{±‘êçzX§¶›¡Ü}©ž²ÆzÚ&j:+v‰¨¾«‘êçzZ+€Ê+zf£¢·hšˆ§~†­†Ûiÿûàz¹®w¥¢¸?™¨è­Ú&¢)ßf”ù^jÇy§m…á@A«a¶Úÿ 0¶ìh®å’i