lkml.org 
[lkml]   [2011]   [May]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 2/5] regulator: tps65911: Add new chip version
On 05/03/2011 09:18 AM, Jorge Eduardo Candelaria wrote:
> @@ -419,17 +541,21 @@ static int tps65910_get_voltage_dcdc(struct regulator_dev *dev)
> mult=1;
>
> if (sr) {
> - /* Valid range is 3-75 so normalise */
> - if (srvsel < 3) srvsel = 3;
> - if (srvsel > 75) srvsel = 75;
> + /* normalise to valid range */
> + if (srvsel < 3)
> + srvsel = 3;
> + if (srvsel > vselmax)
> + srvsel = vselmax;
> srvsel -= 3;
>
> voltage = (srvsel * VDD1_2_OFFSET + VDD1_2_MIN_VOLT) * 100;
> } else {
>
> - /* Valid range is 3-75 so normalise */
> - if (opvsel < 3) opvsel = 3;
> - if (opvsel > 75) opvsel = 75;
> + /* normalise to valid range*/
> + if (opvsel < 3)
> + opvsel = 3;
> + if (opvsel > vselmax)
> + opvsel = vselmax;

Can we use clamp() instead?

--
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.



\
 
 \ /
  Last update: 2011-05-03 18:33    [W:0.031 / U:0.848 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site