From: Guenter Roeck <linux@roeck-us.net>
To: lm-sensors@vger.kernel.org
Subject: Re: [lm-sensors] [PATCH v3] hwmon: ntc: fix iio raw to microvolts conversion
Date: Mon, 01 Jun 2015 23:48:33 +0000 [thread overview]
Message-ID: <556CEF51.50100@roeck-us.net> (raw)
In-Reply-To: <1433176057-26446-1-git-send-email-chris.lesiak@licor.com>
On 06/01/2015 03:06 PM, Chris Lesiak wrote:
[ ... ]
.
>>>
>>> I think things could be improved in one of two ways:
>>> 1. Accept the precision that you get by doing the calculation millivolts.
>>> Simplify things by using millivolts throughout, although pullup_uv
>>> needs to remain becaus it is part of the interface.
>>> 2. Create an additional patch doing the calculations with microvolts
>>> instead of millivolts.
>>>
>>> What are your thoughts?
>>>
>>
>> You explain above that doing the calculations in mV looses precision.
>> Given that, what would be the point of the first proposal, especially
>> since the uV are already available (and may still be needed in
>> ntc_adc_iio_read if conversion through iio is not available) ?
>>
>> Thanks,
>> Guenter
>>
>
> I do think that option 2 is the better choice. If you'd like, I'll create a patch.
>
Your call.
> But if 1 were implemented, ntc_adc_iio_read would give a value in millivolts
> even when iio_convert_raw_to_processed failed. Something like:
>
> ret = iio_convert_raw_to_processed(channel, raw, &mv, 1);
> if (ret < 0) {
> /* Assume 12 bit ADC with vref at pullup_uv*/
> mv = (pdata->pullup_uv * (s64)raw / 1000) >> 12;
> }
>
But what would be the point ? I don't see how that would improve anything.
Since iio internally supports uV, at least optionally, you would then
always loose accuracy. So we might as well leave everything as-is.
Thanks,
Guenter
_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
prev parent reply other threads:[~2015-06-01 23:48 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-01 16:27 [lm-sensors] [PATCH v3] hwmon: ntc: fix iio raw to microvolts conversion Chris Lesiak
2015-06-01 19:54 ` Guenter Roeck
2015-06-01 21:21 ` Chris Lesiak
2015-06-01 21:44 ` Guenter Roeck
2015-06-01 22:06 ` Chris Lesiak
2015-06-01 23:48 ` Guenter Roeck [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=556CEF51.50100@roeck-us.net \
--to=linux@roeck-us.net \
--cc=lm-sensors@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.