Linux IIO development
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Ramona Bolboaca <ramona.bolboaca@analog.com>
Cc: <robh+dt@kernel.org>, <krzysztof.kozlowski+dt@linaro.org>,
	<linux-iio@vger.kernel.org>, <devicetree@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2 2/2] iio: adc: add max11205 adc driver
Date: Sun, 4 Sep 2022 16:51:45 +0100	[thread overview]
Message-ID: <20220904165145.39cb4f75@jic23-huawei> (raw)
In-Reply-To: <20220904165003.192d5030@jic23-huawei>

On Sun, 4 Sep 2022 16:50:03 +0100
Jonathan Cameron <jic23@kernel.org> wrote:

> On Wed, 31 Aug 2022 16:30:21 +0300
> Ramona Bolboaca <ramona.bolboaca@analog.com> wrote:
> 
> > Adding support for max11205 16-bit single-channel ultra-low power
> > delta-sigma adc.
> > The MAX11205 is compatible with the 2-wire interface and uses
> > SCLK and RDY/DOUT for serial communications. In this mode, all
> > controls are implemented by timing the high or low phase of the SCLK.
> > The 2-wire serial interface only allows for data to be read out through
> > the RDY/DOUT output.
> > 
> > Datasheet: https://datasheets.maximintegrated.com/en/ds/MAX11205.pdf
> > Signed-off-by: Ramona Bolboaca <ramona.bolboaca@analog.com>  
> 
> Given the requested changes below and those from Andy and Kryzstof are minor, I'll just
> tweak them whilst applying.

On that note, applied to the togreg branch of iio.git (with changes as noted)
and pushed out as testing for 0-day to see if it can find anything we missed.

Thanks,

Jonathan

> 
> Diff for this patch was below.  The long line for chip_info is a bit ugly but
> not too bad...
> 
> diff --git a/drivers/iio/adc/max11205.c b/drivers/iio/adc/max11205.c
> index 68e6082e70e5..fc90fed81eb6 100644
> --- a/drivers/iio/adc/max11205.c
> +++ b/drivers/iio/adc/max11205.c
> @@ -1,6 +1,6 @@
>  // SPDX-License-Identifier: GPL-2.0
>  /*
> - * max11205 16-Bit Delta-Sigma ADC
> + * Maxim MAX11205 16-Bit Delta-Sigma ADC
>   *
>   * Datasheet: https://datasheets.maximintegrated.com/en/ds/MAX1240-max11205.pdf
>   * Copyright (C) 2022 Analog Devices, Inc.
> @@ -19,20 +19,20 @@
>  #define MAX11205A_OUT_DATA_RATE        116
>  #define MAX11205B_OUT_DATA_RATE        13
>  
> -enum chip_type {
> +enum max11205_chip_type {
>         TYPE_MAX11205A,
>         TYPE_MAX11205B,
>  };
>  
> -struct chip_info {
> +struct max11205_chip_info {
>         unsigned int    out_data_rate;
>         const char      *name;
>  };
>  
>  struct max11205_state {
> -       const struct chip_info  *chip_info;
> -       struct regulator        *vref;
> -       struct ad_sigma_delta   sd;
> +       const struct max11205_chip_info *chip_info;
> +       struct regulator                *vref;
> +       struct ad_sigma_delta           sd;
>  };
>  
>  static const struct ad_sigma_delta_info max11205_sigma_delta_info = {
> @@ -81,12 +81,12 @@ static const struct iio_chan_spec max11205_channels[] = {
>                         .endianness = IIO_BE
>                 },
>                 .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) |
> -               BIT(IIO_CHAN_INFO_SAMP_FREQ) |
> -               BIT(IIO_CHAN_INFO_SCALE),
> +                                     BIT(IIO_CHAN_INFO_SAMP_FREQ) |
> +                                     BIT(IIO_CHAN_INFO_SCALE),
>         },
>  };
>  
> -static const struct chip_info max11205_chip_info[] = {
> +static const struct max11205_chip_info max11205_chip_info[] = {
>         [TYPE_MAX11205A] = {
>                 .out_data_rate = MAX11205A_OUT_DATA_RATE,
>                 .name = "max11205a",
> @@ -117,9 +117,9 @@ static int max11205_probe(struct spi_device *spi)
>         ad_sd_init(&st->sd, indio_dev, spi, &max11205_sigma_delta_info);
>  
>         st->chip_info = device_get_match_data(&spi->dev);
> -
>         if (!st->chip_info)
> -               st->chip_info = (const struct chip_info *)spi_get_device_id(spi)->driver_data;
> +               st->chip_info =
> +                       (const struct max11205_chip_info *)spi_get_device_id(spi)->driver_data;
>  
>         indio_dev->name = st->chip_info->name;
>         indio_dev->modes = INDIO_DIRECT_MODE;
> 
> > ---
> > changes in v2:
> >  - add chip_info null pointer check
> >  - add support for probing with ACPI table
> >  - remove function for module removal
> >  - remove irq flag from max11205_sigma_delta_info
> >  - add missing commas and missing spaces
> >  - remove redundant blank line
> >  - wrap text to 75-80 chars
> >  - removed typos in commit message
> >  drivers/iio/adc/Kconfig    |  14 +++
> >  drivers/iio/adc/Makefile   |   1 +
> >  drivers/iio/adc/max11205.c | 183 +++++++++++++++++++++++++++++++++++++
> >  3 files changed, 198 insertions(+)
> >  create mode 100644 drivers/iio/adc/max11205.c
> >   
> 
> > +enum chip_type {
> > +	TYPE_MAX11205A,
> > +	TYPE_MAX11205B,
> > +};
> > +
> > +struct chip_info {
> > +	unsigned int	out_data_rate;
> > +	const char	*name;
> > +};  
> Prefix these enums and structures with max11205.
> 
> They have very generic names, so it's definitely possible that
> something with the same name might be added to a header included
> by this driver
> > +
> > +struct max11205_state {
> > +	const struct chip_info	*chip_info;
> > +	struct regulator	*vref;
> > +	struct ad_sigma_delta	sd;
> > +};
> > +  
> 
> 
> > +static const struct iio_chan_spec max11205_channels[] = {
> > +	{
> > +		.type = IIO_VOLTAGE,
> > +		.indexed = 1,
> > +		.scan_type = {
> > +			.sign = 's',
> > +			.realbits = 16,
> > +			.storagebits = 16,
> > +			.endianness = IIO_BE
> > +		},
> > +		.info_mask_separate = BIT(IIO_CHAN_INFO_RAW) |
> > +		BIT(IIO_CHAN_INFO_SAMP_FREQ) |  
> 
> Code editors always get confused on these, but please add an
> indent to this line and the next one. Either align it with the BIT()
> above, or just push it in one tab.
> 
> > +		BIT(IIO_CHAN_INFO_SCALE),
> > +	},
> > +};  
> 
> 


  reply	other threads:[~2022-09-04 16:26 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-31 13:30 [PATCH v2 1/2] bindings: iio: adc: Add max11205 documentation file Ramona Bolboaca
2022-08-31 13:30 ` [PATCH v2 2/2] iio: adc: add max11205 adc driver Ramona Bolboaca
2022-08-31 20:20   ` Andy Shevchenko
2022-09-01  8:04     ` Bolboaca, Ramona
2022-09-04 15:37       ` Jonathan Cameron
2022-09-04 15:50   ` Jonathan Cameron
2022-09-04 15:51     ` Jonathan Cameron [this message]
2022-09-04 19:49       ` Andy Shevchenko
2022-08-31 13:36 ` [PATCH v2 1/2] bindings: iio: adc: Add max11205 documentation file Krzysztof Kozlowski
2022-09-04 15:44   ` Jonathan Cameron
2022-09-04 15:43 ` Jonathan Cameron

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=20220904165145.39cb4f75@jic23-huawei \
    --to=jic23@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ramona.bolboaca@analog.com \
    --cc=robh+dt@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