[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YzxJxCSHP9tGHge6@gmail.com>
Date: Tue, 4 Oct 2022 16:57:08 +0200
From: Marcus Folkesson <marcus.folkesson@...il.com>
To: Leonard Göhrs <l.goehrs@...gutronix.de>
Cc: Jonathan Cameron <jic23@...nel.org>,
Lars-Peter Clausen <lars@...afoo.de>, kernel@...gutronix.de,
linux-kernel@...r.kernel.org, linux-iio@...r.kernel.org
Subject: Re: [PATCH v1 2/2] iio: adc: add ADC driver for the TI LMP92064
controller
Hi,
Overall, a lot of comments does not have the right formatting.
Please run scripts/checkpatch.pl.
On Tue, Oct 04, 2022 at 03:42:38PM +0200, Leonard Göhrs wrote:
> The TI LMP92064 is a dual 12 Bit ADC connected via SPI.
> The two channels are intended for simultaneous measurements of the voltage
> across- and current through a load to allow accurate instantaneous power
> measurements.
> The driver does not yet take advantage of this feature, as buffering is not yet
> implemented.
>
> Signed-off-by: Leonard Göhrs <l.goehrs@...gutronix.de>
> ---
> +static const struct iio_chan_spec lmp92064_adc_channels[] = {
> + {
> + .type = IIO_CURRENT,
> + .address = TI_LMP92064_CHAN_INC,
> + .info_mask_separate =
> + BIT(IIO_CHAN_INFO_RAW) | BIT(IIO_CHAN_INFO_SCALE),
> + .datasheet_name = "INC",
> + },
> + {
> + .type = IIO_VOLTAGE,
> + .address = TI_LMP92064_CHAN_INV,
> + .info_mask_separate =
> + BIT(IIO_CHAN_INFO_RAW) | BIT(IIO_CHAN_INFO_SCALE),
> + .datasheet_name = "INV",
> + },
> +};
> +
[...]
> +static int lmp92064_write_reg(struct lmp92064_adc_priv *priv, u16 reg, u8 val)
> +static int lmp92064_read_reg(struct lmp92064_adc_priv *priv, u16 reg, u8 *val)
Does not regmap work for this?
[...]
> +static int lmp92064_adc_probe(struct spi_device *spi)
> +{
> + struct device *dev = &spi->dev;
> + struct lmp92064_adc_priv *priv;
> + struct iio_dev *indio_dev;
> + struct gpio_desc *gpio_reset;
> + int ret;
> + u32 shunt_resistor;
> +
> + spi->bits_per_word = 8;
> + spi->mode &= ~SPI_MODE_X_MASK;
> + spi->mode |= SPI_MODE_0;
> + ret = spi_setup(spi);
> + if (ret < 0)
> + return dev_err_probe(dev, ret, "Error in SPI setup\n");
> +
> + indio_dev = devm_iio_device_alloc(dev, sizeof(*priv));
> + if (!indio_dev)
> + return -ENOMEM;
> +
> + priv = iio_priv(indio_dev);
> +
> + priv->spi = spi;
> +
> + ret = of_property_read_u32(dev->of_node, "shunt-resistor",
> + &shunt_resistor);
device_property_read_u32() ?
> + if (ret < 0)
> + return dev_err_probe(dev, ret,
Download attachment "signature.asc" of type "application/pgp-signature" (834 bytes)
Powered by blists - more mailing lists