On Thursday 28 November 2013 01:25:50 Sebastian Reichel wrote: > On Wed, Nov 27, 2013 at 10:16:47PM +0100, Pali Rohár wrote: > > On Monday 25 November 2013 22:50:01 Sebastian Reichel wrote: > > > > 2 seems more generic to me, but as rx51-battery is > > > > missing the functionality to send events on temperature > > > > change, I guess 1 will be easier to implement. > > > > > > The temperature must be polled anyway, if the ADC does not > > > support interrupts. > > > > Yes, ADC does not support interrupts, temperature must be > > polled. Also bq27200 chip does not support interrupts, but > > bq27x00_battery driver using delayed work which every 60s > > poll all values (timeout can be configured via modprobe > > param). So similar code can be added to rx51_battery.ko > > too. > > I think the safest implementation would be: > > bq2415x polls the temperature from rx51-battery in the bq2415x > watchdog handler. That way discontinuation of the charge > process is guaranteed. > > To avoid useless ADC conversion the rx51-battery driver caches > the converted temperature value for a reasonable time (e.g. > 10 seconds). This helps if multiple users want to read the > battery temperature (e.g. userspace). > > This also means, that the kernel stuff can handle charging > autonomously and the userland daemon checks the battery > temperature only for emergency shutdown (I guess the > temperatures for stopping the charging and emergency shutdown > are different). > > IMHO it makes sense to move the emergency shutdown also into > the kernel (but different driver!) in the future, but that's > another topic :) > > -- Sebastian Just to note, here is original nokia table of temperature limits: https://gitorious.org/rx51-bme-replacement/dsme-thermalobject-surface/source/master:modules/thermalobject_surface.c#L40 -- Pali Rohár pali.rohar@gmail.com