Thread (9 messages) 9 messages, 2 authors, 2018-07-05

Charge counter on droid 4

From: tony@atomide.com (Tony Lindgren)
Date: 2018-07-05 08:27:00
Also in: linux-omap, lkml

* Pavel Machek [off-list ref] [180704 19:59]:
On Mon 2018-06-18 04:48:32, Tony Lindgren wrote:
quoted
* Pavel Machek [off-list ref] [180618 09:37]:
quoted
On Mon 2018-06-18 01:28:58, Tony Lindgren wrote:
quoted
* Pavel Machek [off-list ref] [180618 07:43]:
quoted
So... there are mA, mAh values. Those come from hardware, and I
believe we should keep them.

But there are also mW, mWh values, which are synthetic. Userland can
compute them from mV, mA values... and it is confusing that kernel
provides them. (My tendency was to start computing these synthetic
values in userland, to compare them with "real hardware" values from
kernel. But then I looked at kernel implementation, and realized they
are synthetic, tooo...)
Hmm mWh value is based on the hardware sampled shunt
values and number of samples gathered between the
two readings. I'd rather call the calculated values
based on userland reading mV and mA values "synthetic" :)
As far as I know, shunt resistors provide you with current (mA) not
power (mW) measurement... and cpcap-battery computes power_now as
voltage * current. I'd rather have kernel tell me "hardware can't
measure power" and do "voltage*current" computation in userspace.
Yup you are correct the hardware samples mA and we still need
to calculate mW based on the voltage.

But considering it works and seems to match the power supply
provided average power consumption numbers pretty well and at
least I'm using it.. What is your reasoning for removing such
a usable interface?
Well, it is confusing for the userland, because it has no way of
knowing data is synthetic.
Also the average current is as synthetic. And we don't
want to rely on user space polling the voltage as that
will mess up measurements for low-power idle states.

If there is a problem let's fix it by adding a timer
to refresh average current and power once a minute or
something like that.

I'd rather not have to rely on user space apps for
any knowledge about how to use it.

Regards,

Tony
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help