[lm-sensors] [patch 2.6.25-rc9 3/5] lm75: support 12-bit resolution
Jean Delvare
khali at linux-fr.org
Tue Apr 22 17:41:42 CEST 2008
On Sun, 20 Apr 2008 18:03:28 +0200, Jean Delvare wrote:
> This conversion function should return the following depending on the
> resolution:
>
> 9-bit: ((temp +/- 250) / 500) << 7
> 10-bit: ((temp +/- 125) / 250) << 6
> 11-bit: ((temp +/- 62) / 125) << 5
> 12-bit: ((temp +/- 31) / 62) << 4
Oops, this last one is of course not correct. This should read, for
example:
12-bit: ((temp * 2 +/- 62) / 125) << 4
So we might as well write the above:
9-bit: (( temp +/- 250) / 500) << 7
10-bit: (((temp << 1) +/- 250) / 500) << 6
11-bit: (((temp << 2) +/- 250) / 500) << 5
12-bit: (((temp << 3) +/- 250) / 500) << 4
which is easier to generalize.
--
Jean Delvare
More information about the lm-sensors
mailing list