Re: [PATCH 1/3] RFC: power: supply: cpcap-battery: Add helper for rough capacity

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi!

> Get a rough battery charge estimate until we've seen a high or low
> battery level. After that we can use the coulomb counter to calculate
> the battery capacity.
> 
> Note that I should probably update this to support ocv-capacity-table
> before this makes sense to apply. With ocv-capacity-table we should be
> able to estimate battery state as described in the documentation for
> Documentation/devicetree/bindings/power/supply/battery.txt.

Maybe we should let userspace do that?

https://github.com/pavelmachek/libbattery

> +struct cpcap_battery_capacity {
> +	int capacity;
> +	int voltage;
> +	int percentage;
> +};
> +
> +#define CPCAP_CAP(l, v, p)			\
> +{						\
> +	.capacity = (l),			\
> +	.voltage = (v),				\
> +	.percentage = (p),			\
> +},
> +
> +/* Pessimistic battery capacity mapping before high or low value is seen */
> +static const struct cpcap_battery_capacity cpcap_battery_cap[] = {
> +	CPCAP_CAP(POWER_SUPPLY_CAPACITY_LEVEL_UNKNOWN,        0,   0)
> +	CPCAP_CAP(POWER_SUPPLY_CAPACITY_LEVEL_CRITICAL, 3100000,   0)
> +	CPCAP_CAP(POWER_SUPPLY_CAPACITY_LEVEL_LOW,      3300000,   2)
> +	CPCAP_CAP(POWER_SUPPLY_CAPACITY_LEVEL_NORMAL,   3700000,  50)
> +	CPCAP_CAP(POWER_SUPPLY_CAPACITY_LEVEL_HIGH,     4000000,  75)
> +	CPCAP_CAP(POWER_SUPPLY_CAPACITY_LEVEL_FULL,     4200000 - 18000, 100)
> +};

No, not like this; it is simultaneously too complex and not complex
enough.

Too complex: we don't really want a table, when there's well know
formula implementing it:
http://git.goldelico.com/?p=gta04-kernel.git;a=patch;h=22ab047ae296e998379c1aa29fe1210043cfa040 

Not complex enough: we know the current (and there are going to be big
differences between CPU idle and CPU loaded with GSM active), and
there's dependency on temperature, too...

Best regards,

									Pavel

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

Attachment: signature.asc
Description: Digital signature


[Index of Archives]     [Linux Arm (vger)]     [ARM Kernel]     [ARM MSM]     [Linux Tegra]     [Linux WPAN Networking]     [Linux Wireless Networking]     [Maemo Users]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux