[patch 2.6.25-rc9 3/5] lm75: support 12-bit resolution

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

 



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




[Index of Archives]     [Linux Kernel]     [Linux Hardware Monitoring]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux