hwmon: (ntc_thermistor) Improve precision of resistance calculation
authorChris Lesiak <chris.lesiak@licor.com>
Tue, 2 Jun 2015 20:57:58 +0000 (15:57 -0500)
committerGuenter Roeck <linux@roeck-us.net>
Wed, 3 Jun 2015 22:25:53 +0000 (15:25 -0700)
commitf6725ae2f1ae266589ab177461e308bb2f86f9ee
treeb3906631816ba3048e183e0a6117fe5c3fa093ce
parent0315253b19bbc63eedad2f6125c21e280c76e29b
hwmon: (ntc_thermistor) Improve precision of resistance calculation

The function get_ohm_of_thermistor has both the measured voltage and the
pullup voltage available in microvolts.  But it was promptly converting
both to millivolts before using them to calculate the thermistor
resistance.  That conversion unnecessarily hurt the precision of the
calculation.

For example, take the ncpXXwb473 connected to 5000 mV and pulled down
through a 47000 ohm resistor.  At 25 C, the resistance of the thermistor
is 47000 ohms.  The measured voltage will be 2500 mV.  If we measure
instead 2501 mV, then the calculated resistance will be 46962 ohms --
a difference of 38 ohms.  So the precision of the resistance estimate
could be increased by 38X by doing the calculations in microvolts.

Signed-off-by: Chris Lesiak <chris.lesiak@licor.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
drivers/hwmon/ntc_thermistor.c
This page took 0.024334 seconds and 5 git commands to generate.