[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <DB904C5425BA6F4E8424B3B51A1414D1714080606C@NWD2CMBX1.ad.analog.com>
Date: Tue, 3 Jul 2012 22:56:18 -0400
From: "Zhang, Sonic" <Sonic.Zhang@...log.com>
To: Axel Lin <axel.lin@...il.com>
CC: Lars-Peter Clausen <lars@...afoo.de>,
Mark Brown <broonie@...nsource.wolfsonmicro.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Liam Girdwood <lrg@...com>
Subject: RE: [PATCH v2] regulator: ad5398: Fix min/max current limit
boundary checking
>-----Original Message-----
>From: Axel Lin [mailto:axel.lin@...il.com]
>Sent: Tuesday, July 03, 2012 7:36 PM
>To: Zhang, Sonic
>Cc: Lars-Peter Clausen; Mark Brown; linux-kernel@...r.kernel.org; Liam
>Girdwood
>Subject: RE: [PATCH v2] regulator: ad5398: Fix min/max current limit boundary
>checking
>
>
>> >The equation to calculate the selector does not depend on max_uA.
>> >So I think we don't need to set the requested max_uA.
>> >
>>
>> But, ad5398_set_current_limit() behaves different for min_uA and max_uA with
>you patch. Is this expected?
>>
>
>What we want is to set the smallest current supported by this hardware
>within the range you requested.
>
>Current code uses below equation to choose selector:
>selector = DIV_ROUND_UP((min_uA - chip->min_uA) * chip->current_level,
> range_uA);
>
>With this equation, we need to ensure min_uA >= chip->min_uA,
>otherwise it returns a negative selector.
>
>That is why we need to add:
>if (min_uA < chip->min_uA)
> min_uA = chip->min_uA;
>
Yes, but if you apply this logic to min_uA, you should apply the same logic to max_uA, even though it is not used in your application.
Sonic
>
>Axel
>
Powered by blists - more mailing lists