lkml.org 
[lkml]   [2012]   [Jul]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRE: [PATCH 2/2] regulator: tps65217: Fix voltage boundary checking in tps65217_pmic_map_voltage
From
Date

> In side tps65217_pmic_map_voltage() we have
>
> tps->info[rid]->uv_to_vsel(850000, &sel) nothing but
> tps65217_uv_to_vsel1(850000, &sel);
>
> sel = (((850000 - 900000) + (25000) - 1) / (25000));
> sel = ((-25001)/(25000));
> sel = -1; /* Which is not expected */
>
> Ideally this would be the change
>
> if (min_uV < tps->info[rid]->min_uV)
> min_uV = tps->info[rid]->min_uV;
>
ok. I got your point now.

So if min_uV < tps->info[rid]->min_uV, we need to set
min_uV = tps->info[rid]->min_uV.
This is because the equation we used in uv_to_vsel() does not allow
min_uV < tps->info[rid]->min_uV, otherwise it returns negative selector.


> if (max_uV > tps->info[rid]->max_uV)
> max_uV = tps->info[rid]->max_uV;

This looks not necessary. the equation in uv_to_vsel() does not use
max_uV.

>
> if (max_uV < tps->info[rid]->min_uV ||
> min_uV > tps->info[rid]->max_uV)
> return -EINVAL;
>
> If this is not the case then I am completely in a wrong direction.
You are right in this case. I'll send a v2 for review.

Thanks for the review,
Axel




\
 
 \ /
  Last update: 2012-07-03 10:01    [W:0.060 / U:0.256 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site