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]
Date:   Fri, 8 Sep 2017 15:15:32 +0200
From:   "H. Nikolaus Schaller" <hns@...delico.com>
To:     Sebastian Reichel <sebastian.reichel@...labora.co.uk>
Cc:     Marek Belisko <marek.belisko@...n-nandra.com>,
        Rob Herring <robh+dt@...nel.org>,
        Linux PM mailing list <linux-pm@...r.kernel.org>,
        linux-kernel <linux-kernel@...r.kernel.org>,
        Marek Belisko <marek.belisko@...il.com>,
        Pavel Machek <pavel@....cz>,
        Discussions about the Letux Kernel 
        <letux-kernel@...nphoenux.org>
Subject: Re: libbattery was Re: [RFC PATCH 5/5] power: generic-adc-battery: Add capacity handling

Hi,

> Am 08.09.2017 um 13:32 schrieb Pavel Machek <pavel@....cz>:
> 
> Hi!
> 
>>> +	case POWER_SUPPLY_PROP_CAPACITY:
>>> +		{
>>> +		int ret, curr, voltage;
>>> +
>>> +		ret = read_channel(adc_bat, POWER_SUPPLY_PROP_CURRENT_NOW, &curr);
>>> +		ret |= read_channel(adc_bat, POWER_SUPPLY_PROP_VOLTAGE_NOW, &voltage);
>>> +		if (ret < 0)
>>> +			goto err;
>>> +
>>> +		val->intval = fuel_level_LiIon(voltage, curr, 10);
>>> +		}
>>> +		break;
>>> 	default:
>>> 		return -EINVAL;
>>> 	}
>> 
>> Without patch description: See Last Question in
>> 
>> Documentation/power/power_supply_class.txt

The main argument to answer with "Most likely, no" seems to be:

"  as it would require floating point calculation to deal
   with things like differential equations and Kalman filters."

The code shown above uses none of such things, hence the answer
could as well be "Yes, if it is simple enough to be handled by
the kernel with some lines of code and integer arithmetic".

> 
> ...should be done in libbattery, yet to be written. :-).

For 10 years... Doesn't seem like anyone is waiting for it.

> 
> Do you have specific guidance what you'd like to see in libbattery?

As a poor user I'd expect it to be available and widely accepted by
major distributions and battery monitoring applications in max. 3 months.

If that is not possible, I'd recommend to toss overboard a 10 years old
"maybe" rule and just fix the single problem once and for all in the
generic-adc-battery driver instead of dreaming of user space magically
solving problems where we already have a proposal for a kernel solution.

We should not forget that all this work is just to replace the pdata
based drivers/power/supply/twl4030_madc_battery.c with a proper and
more general DT based solution.

Nothing new, no rocket science (differential equations and Kalman filters)
expected.

BR,
Nikolaus


Download attachment "signature.asc" of type "application/pgp-signature" (802 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ