lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMz4kuLwmk+F8w=3QKTn29OArMfCpZc-429m_nFn8bqFVQekgA@mail.gmail.com>
Date:   Thu, 1 Nov 2018 14:42:13 +0800
From:   Baolin Wang <baolin.wang@...aro.org>
To:     Linus Walleij <linus.walleij@...aro.org>
Cc:     Sebastian Reichel <sre@...nel.org>,
        Rob Herring <robh+dt@...nel.org>,
        Mark Rutland <mark.rutland@....com>,
        Linux PM list <linux-pm@...r.kernel.org>,
        "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" 
        <devicetree@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        yuanjiang.yu@...soc.com, Mark Brown <broonie@...nel.org>,
        Craig Tatlor <ctatlor97@...il.com>
Subject: Re: [PATCH v6 6/6] power: supply: Add Spreadtrum SC27XX fuel gauge
 unit driver

On 31 October 2018 at 16:56, Linus Walleij <linus.walleij@...aro.org> wrote:
> On Mon, Oct 22, 2018 at 9:44 AM Baolin Wang <baolin.wang@...aro.org> wrote:
>
>> This patch adds the Spreadtrum SC27XX serial PMICs fuel gauge support,
>> which is used to calculate the battery capacity.
>>
>> Original-by: Yuanjiang Yu <yuanjiang.yu@...soc.com>
>> Signed-off-by: Baolin Wang <baolin.wang@...aro.org>
>> Acked-by: Linus Walleij <linus.walleij@...aro.org>
>> ---
>> Changes from v5:
>>  - Save the OCV values in micro volts for OCV capacity table.
>>  - Use devm_kmemdup() instead of devm_kzalloc() in sc27xx_fgu_hw_init()
>
> Hi Baolin, you can keep my ACK, just adding some nitpicking:

Thanks.

>
>> +struct sc27xx_fgu_data {
>> +       struct regmap *regmap;
>> +       struct device *dev;
>> +       struct power_supply *battery;
>> +       u32 base;
>> +       struct mutex lock;
>> +       struct gpio_desc *gpiod;
>> +       struct iio_channel *channel;
>> +       bool bat_present;
>> +       int internal_resist;
>> +       int total_cap;
>> +       int init_cap;
>> +       int init_clbcnt;
>> +       int max_volt;
>> +       int table_len;
>
> Can  the above really be negative or should these int:s really
> be unsigned int?

 I think the table_len can be changed to u32, but for others, I'd like
to keep consistency with the power supply battery information。

>
>> +static int sc27xx_fgu_adc_to_current(int adc)
>> +{
>> +       return (adc * 1000) / SC27XX_FGU_1000MA_ADC;
>> +}
>> +
>> +static int sc27xx_fgu_adc_to_voltage(int adc)
>> +{
>> +       return (adc * 1000) / SC27XX_FGU_1000MV_ADC;
>> +}
>
> Would you maybe use
> DIV_ROUND_CLOSEST(adc*1000, SC27XX_FGU_1000MV_ADC)
> on these?

Good point. Will change in next version. Thanks for your comments.

>
> Overall this is a very fine driver and really pretty compared to some
> other stuff we have in drivers/power.

Thanks.

-- 
Baolin Wang
Best Regards

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ