[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aBSO-o4OFrXKJ82C@smile.fi.intel.com>
Date: Fri, 2 May 2025 12:23:06 +0300
From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To: Eason Yang <j2anfernee@...il.com>
Cc: jic23@...nel.org, lars@...afoo.de, robh@...nel.org, krzk+dt@...nel.org,
conor+dt@...nel.org, dlechner@...libre.com, nuno.sa@...log.com,
javier.carrasco.cruz@...il.com, tgamblin@...libre.com,
olivier.moysan@...s.st.com, alisadariana@...il.com,
gstols@...libre.com, antoniu.miclaus@...log.com,
eblanc@...libre.com, matteomartelli3@...il.com,
marcelo.schmitt@...log.com, chanh@...amperecomputing.com,
KWLIU@...oton.com, yhyang2@...oton.com, linux-iio@...r.kernel.org,
devicetree@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v8 2/2] iio: adc: add support for Nuvoton NCT7201
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
Powered by blists - more mailing lists