public inbox for devicetree@vger.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Kurt Borja <kuurtb@gmail.com>
Cc: "Rob Herring" <robh@kernel.org>,
	"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
	"Conor Dooley" <conor+dt@kernel.org>,
	"Tobias Sperling" <tobias.sperling@softing.com>,
	"David Lechner" <dlechner@baylibre.com>,
	"Nuno Sá" <nuno.sa@analog.com>,
	"Andy Shevchenko" <andy@kernel.org>,
	linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	"Jonathan Cameron" <Jonathan.Cameron@huawei.com>
Subject: Re: [PATCH v8 2/2] iio: adc: Add ti-ads1018 driver
Date: Sun, 14 Dec 2025 14:48:39 +0000	[thread overview]
Message-ID: <20251214144839.2eec58f9@jic23-huawei> (raw)
In-Reply-To: <20251211-ads1x18-v8-2-5cd12ac556da@gmail.com>

On Thu, 11 Dec 2025 23:25:44 -0500
Kurt Borja <kuurtb@gmail.com> wrote:

> Add ti-ads1018 driver for Texas Instruments ADS1018 and ADS1118 SPI
> analog-to-digital converters.
> 
> This chips' MOSI pin is shared with a data-ready interrupt. Defining
> this interrupt in devicetree is optional, therefore we only create an
> IIO trigger if one is found.
> 
> Handling this interrupt requires some considerations. When enabling the
> trigger the CS line is tied low (active), thus we need to hold
> spi_bus_lock() too, to avoid state corruption. This is done inside the
> set_trigger_state() callback, to let users use other triggers without
> wasting a bus lock.
> 
> Reviewed-by: Andy Shevchenko <andy@kernel.org>
> Signed-off-by: Kurt Borja <kuurtb@gmail.com>

Hi Kurt, 

A couple of minor formatting things. All trivial so I tweaked whilst
applying. Applied to the testing branch of iio.git. I'll rebase that
on rc1 once available then push out as togreg for linux-next to pick
it up.

Thanks,

Jonathan



> diff --git a/drivers/iio/adc/ti-ads1018.c b/drivers/iio/adc/ti-ads1018.c
> new file mode 100644
> index 000000000000..e3087bb47699
> --- /dev/null
> +++ b/drivers/iio/adc/ti-ads1018.c

> +
> +static int
> +ads1018_write_raw_get_fmt(struct iio_dev *indio_dev,
> +			  struct iio_chan_spec const *chan, long mask)
I'm not immediately seeing why this particular line wrap mapes sense.
static int ads1018_write_raw_get_fmt(struct iio_dev *indio_dev,
			  	     struct iio_chan_spec const *chan,
				     long mask)

Is more common way to do this particular combination.

There are a few other places where the wrap choice wasn't quite what
I'd have gone with, so I tweaked those as well.


> +{
> +	switch (mask) {
> +	case IIO_CHAN_INFO_SCALE:
> +		return IIO_VAL_INT_PLUS_NANO;
> +	default:
> +		return IIO_VAL_INT_PLUS_MICRO;
> +	}
> +}
> +
> +static const struct iio_info ads1018_iio_info = {
> +	.read_raw = ads1018_read_raw,
> +	.read_avail = ads1018_read_avail,
> +	.write_raw = ads1018_write_raw,
> +	.write_raw_get_fmt = ads1018_write_raw_get_fmt,
> +};


> +static int ads1018_spi_probe(struct spi_device *spi)
> +{
> +	const struct ads1018_chip_info *info = spi_get_device_match_data(spi);
> +	struct device *dev = &spi->dev;
> +	struct iio_dev *indio_dev;
> +	struct ads1018 *ads1018;
> +	int ret;

...

> +	ret = devm_iio_triggered_buffer_setup(dev, indio_dev,
> +					      iio_pollfunc_store_time,
> +					      ads1018_trigger_handler,
> +					      &ads1018_buffer_ops);
> +	if (ret)
> +		return ret;
> +
> +	return devm_iio_device_register(&spi->dev, indio_dev);

You have dev, so makes sense to use it here too.

> +}


  reply	other threads:[~2025-12-14 14:48 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-12  4:25 [PATCH v8 0/2] iio: Add support for TI ADS1X18 ADCs Kurt Borja
2025-12-12  4:25 ` [PATCH v8 1/2] dt-bindings: iio: adc: Add TI ADS1018/ADS1118 Kurt Borja
2025-12-12  4:25 ` [PATCH v8 2/2] iio: adc: Add ti-ads1018 driver Kurt Borja
2025-12-14 14:48   ` Jonathan Cameron [this message]
2025-12-14 23:53     ` Kurt Borja
2025-12-15 15:55   ` David Lechner
2025-12-15 16:54     ` Kurt Borja
2025-12-15 18:09       ` David Lechner
2025-12-16 18:21         ` Jonathan Cameron
2025-12-16 20:49           ` Kurt Borja
2025-12-12  8:40 ` [PATCH v8 0/2] iio: Add support for TI ADS1X18 ADCs Tomas Melin
2025-12-12 13:10   ` Kurt Borja
2025-12-12 13:50     ` Tomas Melin
2025-12-15 15:56 ` David Lechner
2025-12-15 16:57   ` Kurt Borja

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=20251214144839.2eec58f9@jic23-huawei \
    --to=jic23@kernel.org \
    --cc=Jonathan.Cameron@huawei.com \
    --cc=andy@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=krzk+dt@kernel.org \
    --cc=kuurtb@gmail.com \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nuno.sa@analog.com \
    --cc=robh@kernel.org \
    --cc=tobias.sperling@softing.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