First, let me apologize if some of you may have received an earlier version as HTML. I forgot that I was in my web email client. On 12/23/20 3:08 PM, Linus Walleij wrote:
Then commit 0315253b19bbc63eedad2f6125c21e280c76e29b "hwmon: (ntc_thermistor) fix iio raw to microvolts conversion" calls iio_convert_raw_to_processed() to get around the 12 bit assumption, instead adding a 1000x scale assumption on the value passed in from the raw read. This just looks wrong, why would it be 1000 and not 1 like the IIO core does when we call iio_read_channel_processed()? It looks like it is actually compensating for a bug in the ADC returning the wrong scale: the author may have used a buggy ADC driver return a scaling to volts instead of millivolts and then this was a trial-and-error solution to that bug in the ADC driver. In that case it would be nice to know which ADC driver, so we can fix it! I suspect maybe an out-of-tree ADC?
I'm the author ofcommit 0315253b19bbc63eedad2f6125c21e280c76e29b "hwmon: (ntc_thermistor) fix iio raw to microvolts conversion". The 1000X scaling was not to get around a bad ADC driver that returns volts instead of millivolts; it was to convert millivolts to microvolts. The function ntc_adc_iio_read needs to return microvolts.