summaryrefslogtreecommitdiff
path: root/drivers/ide/aec62xx.c
diff options
context:
space:
mode:
authorBjorn Andersson <bjorn.andersson@linaro.org>2018-12-23 23:26:44 -0800
committerEduardo Valentin <edubezval@gmail.com>2019-01-02 04:47:23 -0800
commit9d216211fded20fff301d0317af3238d8383634c (patch)
tree52ee024a436534a9144f29b6318252ee5970fe8d /drivers/ide/aec62xx.c
parente36e13003efd8b0160d49138385b0cec570900aa (diff)
thermal: generic-adc: Fix adc to temp interpolation
First correct the edge case to return the last element if we're outside the range, rather than at the last element, so that interpolation is not omitted for points between the two last entries in the table. Then correct the formula to perform linear interpolation based the two points surrounding the read ADC value. The indices for temp are kept as "hi" and "lo" to pair with the adc indices, but there's no requirement that the temperature is provided in descendent order. mult_frac() is used to prevent issues with overflowing the int. Cc: Laxman Dewangan <ldewangan@nvidia.com> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
Diffstat (limited to 'drivers/ide/aec62xx.c')
0 files changed, 0 insertions, 0 deletions