Re: [PATCH 6/7] [RFC] ds2760 battery driver

2007-04-17 Thread Pavel Machek
Hi! > >> + /* Calculate the empty level at the present temperature. */ > >> + scale[4] = di->raw[DS2760_ACTIVE_EMPTY + 4]; > >> + for (i = 3; i >= 0; i--) > >> + scale[i] = scale[i + 1] + di->raw[DS2760_ACTIVE_EMPTY + i]; > >> + > >> + di->empty_mAh =

Re: [PATCH 6/7] [RFC] ds2760 battery driver

2007-04-17 Thread Pavel Machek
Hi! + /* Calculate the empty level at the present temperature. */ + scale[4] = di-raw[DS2760_ACTIVE_EMPTY + 4]; + for (i = 3; i = 0; i--) + scale[i] = scale[i + 1] + di-raw[DS2760_ACTIVE_EMPTY + i]; + + di-empty_mAh = battery_interpolate(scale, di-temp_C /

Re: [PATCH 6/7] [RFC] ds2760 battery driver

2007-04-16 Thread Matt Reimer
On 4/16/07, Anton Vorontsov <[EMAIL PROTECTED]> wrote: On Mon, Apr 16, 2007 at 12:14:27PM -0700, Matt Reimer wrote: > The shifts (<< 3 and >> 5) are just to get the bits reassembled in the > right positions. The multiplication by 5 and subtracting 1/8 is > because (AFAIK) we can't do floating

Re: [PATCH 6/7] [RFC] ds2760 battery driver

2007-04-16 Thread Anton Vorontsov
On Mon, Apr 16, 2007 at 12:14:27PM -0700, Matt Reimer wrote: > On 4/15/07, Pavel Machek <[EMAIL PROTECTED]> wrote: > > > + di->update_time = jiffies; > > > + > > > + /* DS2760 reports voltage in units of 4.88mV, but the battery class > > > + * reports in units of mV, so convert by

Re: [PATCH 6/7] [RFC] ds2760 battery driver

2007-04-16 Thread Matt Reimer
On 4/15/07, Pavel Machek <[EMAIL PROTECTED]> wrote: > + di->update_time = jiffies; > + > + /* DS2760 reports voltage in units of 4.88mV, but the battery class > + * reports in units of mV, so convert by multiplying by 4.875. > + * We approximate because integer math is cheap,

Re: [PATCH 6/7] [RFC] ds2760 battery driver

2007-04-16 Thread Matt Reimer
On 4/15/07, Pavel Machek [EMAIL PROTECTED] wrote: + di-update_time = jiffies; + + /* DS2760 reports voltage in units of 4.88mV, but the battery class + * reports in units of mV, so convert by multiplying by 4.875. + * We approximate because integer math is cheap, and close

Re: [PATCH 6/7] [RFC] ds2760 battery driver

2007-04-16 Thread Anton Vorontsov
On Mon, Apr 16, 2007 at 12:14:27PM -0700, Matt Reimer wrote: On 4/15/07, Pavel Machek [EMAIL PROTECTED] wrote: + di-update_time = jiffies; + + /* DS2760 reports voltage in units of 4.88mV, but the battery class + * reports in units of mV, so convert by multiplying by

Re: [PATCH 6/7] [RFC] ds2760 battery driver

2007-04-16 Thread Matt Reimer
On 4/16/07, Anton Vorontsov [EMAIL PROTECTED] wrote: On Mon, Apr 16, 2007 at 12:14:27PM -0700, Matt Reimer wrote: The shifts ( 3 and 5) are just to get the bits reassembled in the right positions. The multiplication by 5 and subtracting 1/8 is because (AFAIK) we can't do floating point

Re: [PATCH 6/7] [RFC] ds2760 battery driver

2007-04-15 Thread Pavel Machek
Hi! > This is driver for batteries with ds2760 chip inside. Such batteries > used in almost every HP iPaq and HTC PDAs/phones. Looks nice to me. It even knows about dependency between temperature and remaining power :-). > + di->update_time = jiffies; > + > + /* DS2760 reports voltage

Re: [PATCH 6/7] [RFC] ds2760 battery driver

2007-04-15 Thread Pavel Machek
Hi! This is driver for batteries with ds2760 chip inside. Such batteries used in almost every HP iPaq and HTC PDAs/phones. Looks nice to me. It even knows about dependency between temperature and remaining power :-). + di-update_time = jiffies; + + /* DS2760 reports voltage in

Re: [PATCH 6/7] [RFC] ds2760 battery driver

2007-04-13 Thread Anton Vorontsov
On Thu, Apr 12, 2007 at 03:25:45AM +0400, Anton Vorontsov wrote: > This is driver for batteries with ds2760 chip inside. Such batteries > used in almost every HP iPaq and HTC PDAs/phones. Changes: - follow battery class changes (get rid of vast amount of macro-created functions). - cleanups

Re: [PATCH 6/7] [RFC] ds2760 battery driver

2007-04-13 Thread Anton Vorontsov
On Thu, Apr 12, 2007 at 03:25:45AM +0400, Anton Vorontsov wrote: This is driver for batteries with ds2760 chip inside. Such batteries used in almost every HP iPaq and HTC PDAs/phones. Changes: - follow battery class changes (get rid of vast amount of macro-created functions). - cleanups

[PATCH 6/7] [RFC] ds2760 battery driver

2007-04-11 Thread Anton Vorontsov
This is driver for batteries with ds2760 chip inside. Such batteries used in almost every HP iPaq and HTC PDAs/phones. --- drivers/battery/Kconfig |7 + drivers/battery/Makefile |1 + drivers/battery/ds2760_battery.c | 466 ++

[PATCH 6/7] [RFC] ds2760 battery driver

2007-04-11 Thread Anton Vorontsov
This is driver for batteries with ds2760 chip inside. Such batteries used in almost every HP iPaq and HTC PDAs/phones. --- drivers/battery/Kconfig |7 + drivers/battery/Makefile |1 + drivers/battery/ds2760_battery.c | 466 ++