public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Marcus Folkesson <marcus.folkesson@gmail.com>
To: "Leonard Göhrs" <l.goehrs@pengutronix.de>
Cc: Jonathan Cameron <jic23@kernel.org>,
	Lars-Peter Clausen <lars@metafoo.de>,
	kernel@pengutronix.de, linux-kernel@vger.kernel.org,
	linux-iio@vger.kernel.org
Subject: Re: [PATCH v1 2/2] iio: adc: add ADC driver for the TI LMP92064 controller
Date: Tue, 4 Oct 2022 16:57:08 +0200	[thread overview]
Message-ID: <YzxJxCSHP9tGHge6@gmail.com> (raw)
In-Reply-To: <20221004134238.3144326-2-l.goehrs@pengutronix.de>

[-- Attachment #1: Type: text/plain, Size: 2079 bytes --]

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@pengutronix.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,

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2022-10-04 14:57 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-04 13:42 [PATCH v1 1/2] dt-bindings:iio:adc: add documentation for TI LMP92064 controller Leonard Göhrs
2022-10-04 13:42 ` [PATCH v1 2/2] iio: adc: add ADC driver for the " Leonard Göhrs
2022-10-04 14:57   ` Marcus Folkesson [this message]
2022-10-09 16:11   ` Jonathan Cameron
2022-10-04 14:56 ` [PATCH v1 1/2] dt-bindings:iio:adc: add documentation for " Krzysztof Kozlowski

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=YzxJxCSHP9tGHge6@gmail.com \
    --to=marcus.folkesson@gmail.com \
    --cc=jic23@kernel.org \
    --cc=kernel@pengutronix.de \
    --cc=l.goehrs@pengutronix.de \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /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