Re: [PATCH v2] hwmon: (ntc_thermistor): try reading processed

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

 



Linus Walleij <linus.walleij@xxxxxxxxxx> wrote:
> But do you agree with the general stance that we should
> give precedence to using iio_read_channel_processed()
> and multiply the result with 1000? It should work with
> any driver I think.

In order to preserve resolution of the microVolt value for existing code,
I'd prefer a solution similar to the existing implementation of
iio_read_channel_processed.   Sans error handling:

int uv;
if (iio_channel_has_info(chan->channel, IIO_CHAN_INFO_PROCESSED)) {
        int mv;
        iio_read_channel_processed(channel, &mv);
        uv = 1000 * mv;
} else {
        int raw;
        iio_read_channel_raw(channel, &raw);
        iio_convert_raw_to_processed(channel, raw, &uv, 1000);
}
return uv;



[Index of Archives]     [LM Sensors]     [Linux Sound]     [ALSA Users]     [ALSA Devel]     [Linux Audio Users]     [Linux Media]     [Kernel]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux