All of
 help / color / mirror / Atom feed
From: Chris Lesiak <>
To: Linus Walleij <>
Cc: Jean Delvare <>,
	Guenter Roeck <>,
	"" <>,
	Peter Rosin <>, Jonathan Cameron <>,
	"" <>
Subject: Re: [PATCH v2] hwmon: (ntc_thermistor): try reading processed
Date: Sat, 26 Dec 2020 01:45:33 +0000	[thread overview]
Message-ID: <> (raw)
In-Reply-To: <>

Linus Walleij <>wrote:
> I have to do this change because my ADC driver only provides processed
> channels (drivers/iio/adc/ab8500-gpadc.c). It provides raw values and
> it provides processed values but no scale. That means your code will
> not work, sadly. It will result in the raw value being used without scaling.

> The reason that the ADC cannot provide scaling is that the scale is not
> linear and based on calibration. IIO scaling is only linear.

I haven't been able to find detailed documentation on the ab8500-gpadc,
so I have a couple of questions / comments:

1. The driver appears to support temperature output directly.  Why do
you need ntc_thermistor?

2. I don't understand how the ab8500_gpadc_read_raw output of processed
data could possibly be correct.

        if (mask == IIO_CHAN_INFO_PROCESSED) {
                processed = ab8500_gpadc_ad_to_voltage(gpadc, ch->id, raw_val);
                if (processed < 0)
                        return processed;

                /* Return millivolt or milliamps or millicentigrades */
                *val = processed * 1000;
                return IIO_VAL_INT;

Note that both processed and *val are both of type int.

If *val really does end up with milliVolt units, then processed must
have had Volt units.  And you only have single Volt resolution.

Either you are working with a lot higher voltages than I usually see,
or something must be wrong.

  reply	other threads:[~2020-12-26  1:46 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-24  1:16 Linus Walleij
2020-12-24  1:39 ` Chris Lesiak
2020-12-24  3:15   ` Chris Lesiak
2020-12-25 23:01     ` Linus Walleij
2020-12-25 22:55   ` Linus Walleij
2020-12-26  1:45     ` Chris Lesiak [this message]
2020-12-27 13:46       ` Linus Walleij
2020-12-27 18:54         ` Chris Lesiak
2020-12-27 21:47           ` Linus Walleij
2020-12-27 22:08             ` Chris Lesiak
2020-12-29 14:25               ` Jonathan Cameron
2020-12-29 16:33                 ` Guenter Roeck
2020-12-29 16:53                   ` Jonathan Cameron

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:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \ \ \ \ \ \
    --subject='Re: [PATCH v2] hwmon: (ntc_thermistor): try reading processed' \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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.