All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Lesiak <chris.lesiak@licor.com>
To: Linus Walleij <linus.walleij@linaro.org>
Cc: Jean Delvare <jdelvare@suse.com>,
	Guenter Roeck <linux@roeck-us.net>,
	"linux-hwmon@vger.kernel.org" <linux-hwmon@vger.kernel.org>,
	Peter Rosin <peda@axentia.se>, Jonathan Cameron <jic23@cam.ac.uk>,
	"linux-iio@vger.kernel.org" <linux-iio@vger.kernel.org>
Subject: Re: [PATCH v2] hwmon: (ntc_thermistor): try reading processed
Date: Sat, 26 Dec 2020 01:45:33 +0000	[thread overview]
Message-ID: <SN6PR08MB556511839F0A54D34E898EB79ADB0@SN6PR08MB5565.namprd08.prod.outlook.com> (raw)
In-Reply-To: <CACRpkdZJT386M5y5cyCLYaWDhS+AnpXgB__VEshvYKbxN_=wPg@mail.gmail.com>

Linus Walleij <linus.walleij@linaro.org>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:
  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=SN6PR08MB556511839F0A54D34E898EB79ADB0@SN6PR08MB5565.namprd08.prod.outlook.com \
    --to=chris.lesiak@licor.com \
    --cc=jdelvare@suse.com \
    --cc=jic23@cam.ac.uk \
    --cc=linus.walleij@linaro.org \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=peda@axentia.se \
    --subject='Re: [PATCH v2] hwmon: (ntc_thermistor): try reading processed' \
    /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

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.