Re: [PATCH] thermal: generic-adc: Fix linear temperature approximation

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

 




Yes please send patch to replace the 1000 with the temp1 - temp2 as what you did in your original patch.
This will fix the non-sequenced (un-equally spaced) temperature table.

replacing 1000 with (temp1 - temp2) is not enough as for example for val = 9 and table

<7000 8
 9000 10>

	adc_hi = gti->lookup_table[2 * i - 1];
	adc_lo = gti->lookup_table[2 * i + 1];
	temp = gti->lookup_table[2 * i];
	temp -= (val - adc_lo) * (temp1 - temp2) / (adc_hi - adc_lo);


adc_hi = 8
adc_lo = 10
temp = 9000 - (9 - 10) * (7000 - 9000) / (8 - 10)
temp = 9000 - (-1) * (-2000) / (-2)
temp = 9000 - (-1000) = 10000

and for val = 9 temp should be 8000.


--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux