From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Eason Yang <j2anfernee@gmail.com>
Cc: jic23@kernel.org, lars@metafoo.de, robh@kernel.org,
krzk+dt@kernel.org, conor+dt@kernel.org, dlechner@baylibre.com,
nuno.sa@analog.com, javier.carrasco.cruz@gmail.com,
tgamblin@baylibre.com, olivier.moysan@foss.st.com,
alisadariana@gmail.com, gstols@baylibre.com,
antoniu.miclaus@analog.com, eblanc@baylibre.com,
matteomartelli3@gmail.com, marcelo.schmitt@analog.com,
chanh@os.amperecomputing.com, KWLIU@nuvoton.com,
yhyang2@nuvoton.com, linux-iio@vger.kernel.org,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v8 2/2] iio: adc: add support for Nuvoton NCT7201
Date: Fri, 2 May 2025 12:23:06 +0300 [thread overview]
Message-ID: <aBSO-o4OFrXKJ82C@smile.fi.intel.com> (raw)
In-Reply-To: <20250429025505.3278016-3-j2anfernee@gmail.com>
On Tue, Apr 29, 2025 at 10:55:05AM +0800, Eason Yang wrote:
> Add Nuvoton NCT7201/NCT7202 system voltage monitor 12-bit ADC driver
>
> NCT7201/NCT7202 supports up to 12 analog voltage monitor inputs and up
> to 4 SMBus addresses by ADDR pin. Meanwhile, ALERT# hardware event pins
> for independent alarm signals, and all the threshold values could be set
> for system protection without any timing delay. It also supports reset
> input RSTIN# to recover system from a fault condition.
>
> Currently, only single-edge mode conversion and threshold events are
> supported.
...
> +static int nct7201_write_event_value(struct iio_dev *indio_dev,
> + const struct iio_chan_spec *chan,
> + enum iio_event_type type,
> + enum iio_event_direction dir,
> + enum iio_event_info info,
> + int val, int val2)
> +{
> + struct nct7201_chip_info *chip = iio_priv(indio_dev);
> + int err;
One space too many.
> + if (chan->type != IIO_VOLTAGE)
> + return -EOPNOTSUPP;
> +
> + if (info != IIO_EV_INFO_VALUE)
> + return -EOPNOTSUPP;
> +
> + if (dir == IIO_EV_DIR_FALLING)
> + err = regmap_write(chip->regmap16, NCT7201_REG_VIN_LOW_LIMIT(chan->address),
> + FIELD_PREP(NCT7201_REG_VIN_MASK, val));
> + else
> + err = regmap_write(chip->regmap16, NCT7201_REG_VIN_HIGH_LIMIT(chan->address),
> + FIELD_PREP(NCT7201_REG_VIN_MASK, val));
> +
> + return err;
> +}
...
> + /* Enable Channel */
Channels
> + if (chip->num_vin_channels <= 8)
> + err = regmap_write(chip->regmap, NCT7201_REG_CHANNEL_ENABLE,
> + GENMASK(chip->num_vin_channels - 1, 0));
Why can't you use the value kept in data variable?
> + else
> + err = regmap_bulk_write(chip->regmap, NCT7201_REG_CHANNEL_ENABLE,
> + &data, sizeof(data));
> + if (err)
> + return dev_err_probe(dev, err, "Failed to enable channel\n");
--
With Best Regards,
Andy Shevchenko
prev parent reply other threads:[~2025-05-02 9:23 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-29 2:55 [PATCH v8 0/2] iio: adc: add Nuvoton NCT7201 ADC driver Eason Yang
2025-04-29 2:55 ` [PATCH v8 1/2] dt-bindings: iio: adc: add NCT7201 ADCs Eason Yang
2025-04-29 7:36 ` Krzysztof Kozlowski
2025-04-29 16:09 ` David Lechner
2025-04-29 17:43 ` Krzysztof Kozlowski
2025-04-29 17:50 ` David Lechner
2025-04-29 2:55 ` [PATCH v8 2/2] iio: adc: add support for Nuvoton NCT7201 Eason Yang
2025-04-29 16:32 ` David Lechner
2025-05-02 9:23 ` Andy Shevchenko [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=aBSO-o4OFrXKJ82C@smile.fi.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=KWLIU@nuvoton.com \
--cc=alisadariana@gmail.com \
--cc=antoniu.miclaus@analog.com \
--cc=chanh@os.amperecomputing.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dlechner@baylibre.com \
--cc=eblanc@baylibre.com \
--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=nuno.sa@analog.com \
--cc=olivier.moysan@foss.st.com \
--cc=robh@kernel.org \
--cc=tgamblin@baylibre.com \
--cc=yhyang2@nuvoton.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