From: David Lechner <dlechner@baylibre.com>
To: Eason Yang <j2anfernee@gmail.com>,
avifishman70@gmail.com, tmaimon77@gmail.com,
tali.perry1@gmail.com, venture@google.com, yuenn@google.com,
benjaminfair@google.com, jic23@kernel.org, lars@metafoo.de,
robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org,
nuno.sa@analog.com, javier.carrasco.cruz@gmail.com,
andriy.shevchenko@linux.intel.com, marcelo.schmitt@analog.com,
olivier.moysan@foss.st.com, mitrutzceclan@gmail.com,
tgamblin@baylibre.com, matteomartelli3@gmail.com,
alisadariana@gmail.com, gstols@baylibre.com,
thomas.bonnefille@bootlin.com, ramona.nechita@analog.com,
mike.looijmans@topic.nl, chanh@os.amperecomputing.com,
KWLIU@nuvoton.com, yhyang2@nuvoton.com
Cc: openbmc@lists.ozlabs.org, linux-iio@vger.kernel.org,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 2/2] iio: adc: add Nuvoton NCT720x ADC driver
Date: Thu, 5 Dec 2024 13:01:51 -0600 [thread overview]
Message-ID: <a4cd4d74-93bc-4c63-a9ee-aa25957b96d9@baylibre.com> (raw)
In-Reply-To: <8f5ca298-54ba-4274-a35d-83be868fcfc8@baylibre.com>
On 12/5/24 12:22 PM, David Lechner wrote:
> On 12/3/24 3:15 AM, Eason Yang wrote:
>> +static int nct720x_read_raw(struct iio_dev *indio_dev,
>> + struct iio_chan_spec const *chan,
>> + int *val, int *val2, long mask)
>> +{
>> + int index = nct720x_chan_to_index[chan->address];
>> + u16 volt;
>> + unsigned int value;
>> + int err;
>> + struct nct720x_chip_info *chip = iio_priv(indio_dev);
>> +
>> + if (chan->type != IIO_VOLTAGE)
>> + return -EOPNOTSUPP;
>> +
>> + guard(mutex)(&chip->access_lock);
>> + switch (mask) {
>> + case IIO_CHAN_INFO_RAW:
>> + err = regmap_read(chip->regmap16, REG_VIN[index], &value);
>> + if (err < 0)
>> + return err;
>> + volt = (u16)value;
>> + *val = volt >> 3;
>
> It seems strange that this is 13 bits when the chips are 8 and 12 bit.
>
>> + return IIO_VAL_INT;
>> + case IIO_CHAN_INFO_SCALE:
>> + /* From the datasheet, we have to multiply by 0.0004995 */
>
> The scale is the same for both 8 bit and 12 bit chips?
>
>> + *val = 0;
>> + *val2 = 499500;
>> + return IIO_VAL_INT_PLUS_NANO;
>> + default:
>> + return -EINVAL;
>> + }
>> +}
>> +
Sorry, I got confused. The difference between the two chips is the
number of channels, not the number of bits. Please ignore these two
comments.
next prev parent reply other threads:[~2024-12-05 19:01 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-03 9:15 [PATCH v2 0/2] iio: adc: add Nuvoton NCT720x ADC driver Eason Yang
2024-12-03 9:15 ` [PATCH v2 1/2] dt-bindings: iio: adc: Add binding for Nuvoton NCT720x ADCs Eason Yang
2024-12-03 9:25 ` Krzysztof Kozlowski
2024-12-04 3:10 ` Yu-Hsian Yang
2024-12-04 7:12 ` Krzysztof Kozlowski
2024-12-04 8:47 ` Yu-Hsian Yang
2024-12-03 9:15 ` [PATCH v2 2/2] iio: adc: add Nuvoton NCT720x ADC driver Eason Yang
2024-12-03 13:50 ` Andy Shevchenko
2024-12-04 3:20 ` Yu-Hsian Yang
2024-12-04 4:27 ` Andy Shevchenko
2024-12-04 9:05 ` Yu-Hsian Yang
2024-12-08 17:16 ` Jonathan Cameron
2024-12-05 18:22 ` David Lechner
2024-12-05 19:01 ` David Lechner [this message]
2024-12-10 5:27 ` Yu-Hsian Yang
2024-12-10 5:20 ` Yu-Hsian Yang
2024-12-08 17:22 ` Jonathan Cameron
2024-12-10 5:38 ` Yu-Hsian Yang
2024-12-10 5:47 ` Yu-Hsian Yang
2024-12-11 18:28 ` Jonathan Cameron
2024-12-11 18:26 ` Jonathan Cameron
2024-12-08 17:47 ` Christophe JAILLET
2024-12-10 5:59 ` Yu-Hsian Yang
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=a4cd4d74-93bc-4c63-a9ee-aa25957b96d9@baylibre.com \
--to=dlechner@baylibre.com \
--cc=KWLIU@nuvoton.com \
--cc=alisadariana@gmail.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=avifishman70@gmail.com \
--cc=benjaminfair@google.com \
--cc=chanh@os.amperecomputing.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=gstols@baylibre.com \
--cc=j2anfernee@gmail.com \
--cc=javier.carrasco.cruz@gmail.com \
--cc=jic23@kernel.org \
--cc=krzk+dt@kernel.org \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=marcelo.schmitt@analog.com \
--cc=matteomartelli3@gmail.com \
--cc=mike.looijmans@topic.nl \
--cc=mitrutzceclan@gmail.com \
--cc=nuno.sa@analog.com \
--cc=olivier.moysan@foss.st.com \
--cc=openbmc@lists.ozlabs.org \
--cc=ramona.nechita@analog.com \
--cc=robh@kernel.org \
--cc=tali.perry1@gmail.com \
--cc=tgamblin@baylibre.com \
--cc=thomas.bonnefille@bootlin.com \
--cc=tmaimon77@gmail.com \
--cc=venture@google.com \
--cc=yhyang2@nuvoton.com \
--cc=yuenn@google.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox