Re: [PATCH v2 3/3] power: wm831x_power: Support USB charger current limit management

From: Mark Brown
Date: Tue Aug 18 2015 - 12:13:16 EST


On Tue, Aug 18, 2015 at 01:20:12PM +0800, Peter Chen wrote:

> ok, I just had suspected below function's correctness, after looking
> it again, it always set 1800 as charging limit, does it be expected?

> + /* Find the highest supported limit */
> + best = 0;
> + for (i = 0; i < ARRAY_SIZE(wm831x_usb_limits); i++) {
> + if (limit < wm831x_usb_limits[i] &&

The above check is intended to ensure that we don't go over the limit
that was passed in in the callback. The goal is to select the highest
option that is less than the limit passed in.

Attachment: signature.asc
Description: Digital signature