mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Krzysztof Kozlowski <krzk@kernel.org>
To: marcelo.schmitt@analog.com, beniamin.bia@analog.com,
	paul.cercueil@analog.com, Michael.Hennerich@analog.com,
	lars@metafoo.de, jic23@kernel.org, marcelo.schmitt1@gmail.com
Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 6/7] iio: adc: Add support for AD7091R-8
Date: Wed, 22 Nov 2023 11:01:45 +0100	[thread overview]
Message-ID: <b730a42a-600b-4207-8898-7e4a3b19203b@kernel.org> (raw)
In-Reply-To: <514295a9b760b44a710425803a41decddd3e8df8.1700595310.git.marcelo.schmitt1@gmail.com>

On 21/11/2023 22:36, marcelo.schmitt@analog.com wrote:
> From: Marcelo Schmitt <marcelo.schmitt@analog.com>
> 
> Add support for Analog Devices AD7091R-2, AD7091R-4, and AD7091R-8
> low power 12-Bit SAR ADCs.
> Extend ad7091r-base driver so it can be used by AD7091R-8 drivers.
> 
> Signed-off-by: Marcelo Schmitt <marcelo.schmitt@analog.com>
> ---
> 
> Device read/write might look odd due to the transfer protocol for these devices.
> I'm glad to hear any suggestions on how to make it better.
> 


...

> +
> +static int ad7091r8_gpio_setup(struct ad7091r_state *st)
> +{
> +	st->convst_gpio = devm_gpiod_get(st->dev, "adi,conversion-start",
> +					 GPIOD_OUT_LOW);
> +	if (IS_ERR(st->convst_gpio))
> +		return dev_err_probe(st->dev, PTR_ERR(st->convst_gpio),
> +				     "Error getting convst GPIO: %ld\n",
> +				     PTR_ERR(st->convst_gpio));

Don't print error code twice.

> +
> +	st->reset_gpio =  devm_gpiod_get_optional(st->dev, "reset",
> +						  GPIOD_OUT_HIGH);
> +	if (IS_ERR(st->reset_gpio))
> +		return PTR_ERR(st->reset_gpio);
> +
> +	if (st->reset_gpio) {
> +		fsleep(20);
> +		gpiod_set_value_cansleep(st->reset_gpio, 0);
> +	}
> +
> +	return 0;
> +}
> +
> +static int ad7091r8_spi_probe(struct spi_device *spi)
> +{
> +	const struct ad7091r_chip_info *chip_info;
> +	struct ad7091r_state *st;
> +	struct iio_dev *iio_dev;
> +	struct regmap *map;
> +	int ret;
> +
> +	chip_info = spi_get_device_match_data(spi);
> +	if (!chip_info)
> +		return -EINVAL;
> +
> +	iio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*st));
> +	if (!iio_dev)
> +		return -ENOMEM;
> +
> +	st = iio_priv(iio_dev);
> +	st->dev = &spi->dev;
> +
> +	map = devm_regmap_init(&spi->dev, &ad7091r8_regmap_bus, st,
> +			       &ad7091r_spi_regmap_config[chip_info->type]);
> +
> +	if (IS_ERR(map))
> +		return dev_err_probe(&spi->dev, PTR_ERR(map),
> +				     "Error initializing spi regmap: %ld\n",
> +				     PTR_ERR(map));

Don't print error code twice.

Best regards,
Krzysztof


  reply	other threads:[~2023-11-22 10:01 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-21 21:33 [PATCH 0/7] Add support for AD7091R-2/-4/-8 marcelo.schmitt
2023-11-21 21:34 ` [PATCH 1/7] iio: adc: ad7091r-base: Set alert config and drvdata marcelo.schmitt
2023-11-21 21:35 ` [PATCH 2/7] MAINTAINERS: Add MAINTAINERS entry for AD7091R marcelo.schmitt
2023-11-21 21:35 ` [PATCH 3/7] iio: adc: ad7091r: Move defines to header file marcelo.schmitt
2023-11-22 12:40   ` kernel test robot
2023-11-21 21:35 ` [PATCH 4/7] iio: adc: ad7091r: Alloc IIO device before generic probe marcelo.schmitt
2023-11-21 21:36 ` [PATCH 5/7] dt-bindings: iio: Add binding documentation for AD7091R-8 marcelo.schmitt
2023-11-22  9:57   ` Krzysztof Kozlowski
2023-11-22 12:40   ` kernel test robot
2023-11-21 21:36 ` [PATCH 6/7] iio: adc: Add support " marcelo.schmitt
2023-11-22 10:01   ` Krzysztof Kozlowski [this message]
2023-11-23  6:30   ` Dan Carpenter
2023-11-21 21:36 ` [PATCH 7/7] iio: adc: ad7091r-base: Add debugfs reg access marcelo.schmitt

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=b730a42a-600b-4207-8898-7e4a3b19203b@kernel.org \
    --to=krzk@kernel.org \
    --cc=Michael.Hennerich@analog.com \
    --cc=beniamin.bia@analog.com \
    --cc=jic23@kernel.org \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcelo.schmitt1@gmail.com \
    --cc=marcelo.schmitt@analog.com \
    --cc=paul.cercueil@analog.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

all inboxes | Powered by JetHome®