Linux IIO development
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: David Lechner <dlechner@baylibre.com>
Cc: "Nuno Sá" <nuno.sa@analog.com>,
	"Andy Shevchenko" <andy@kernel.org>, "Chris Hall" <c-hall@ti.com>,
	"Patrick Edwards" <pedwards@ti.com>,
	"Kurt Borja" <kuurtb@gmail.com>,
	linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] iio: adc: ti-ads112c14: add continuous mode support
Date: Mon, 27 Jul 2026 22:18:22 +0100	[thread overview]
Message-ID: <20260727221822.554f7b4e@jic23-huawei> (raw)
In-Reply-To: <cf727776-07df-400f-a153-97297ecdbc5c@baylibre.com>

On Mon, 27 Jul 2026 08:45:57 -0500
David Lechner <dlechner@baylibre.com> wrote:

> On 7/26/26 8:45 PM, Jonathan Cameron wrote:
> > On Fri, 24 Jul 2026 15:13:11 -0500
> > "David Lechner (TI)" <dlechner@baylibre.com> wrote:
> >   
> >> Add support for continuous mode in the TI ADS112C14 ADC driver. In this
> >> mode the ADC itself is starting each conversion, so we add a trigger
> >> based on the DRDY interrupt to read each sample. This mode is also
> >> limited in that only one channel can be enabled at a time since the
> >> chip does not have a sequencer or simultaneous sampling capability.
> >> Continuous mode will only be used when this new trigger is the current
> >> trigger.
> >>  
> 
> ...
> 
> >> +static int ads112c14_buffer_predisable(struct iio_dev *indio_dev)
> >> +{
> >> +	struct ads112c14_data *data = iio_priv(indio_dev);
> >> +	int ret, ret2;
> >> +
> >> +	if (!ads112c14_using_drdy_trigger(indio_dev))
> >> +		return 0;
> >> +
> >> +	guard(mutex)(&data->lock);
> >> +
> >> +	ret = regmap_write(data->regmap, ADS112C14_REG_CONVERSION_CTRL,
> >> +			   ADS112C14_CONVERSION_CTRL_STOP);
> >> +	ret2 = regmap_assign_bits(data->regmap, ADS112C14_REG_DEVICE_CFG,
> >> +				  ADS112C14_DEVICE_CFG_CONV_MODE,
> >> +				  ADS112C14_DEVICE_CFG_CONV_MODE_SINGLE_SHOT);  
> > 
> > This is odd looking code. Needs comments on why we should prefer returning
> > the error for the second call over that for the first.  
> 
> It is arbitrary, I just went with first error wins.

?  Looks like second error wins to me!

> 
> Other option would be to return early since the hardware is going to
> be in a broken state anyway.
I'd go for that.

> 
> >   
> >> +	if (ret2)
> >> +		return ret2;
> >> +
> >> +	return ret;
> >> +}  
> > 
> >   


      reply	other threads:[~2026-07-27 21:18 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-24 20:13 [PATCH 0/2] iio: adc: ti-ads112c14: continuous mode support David Lechner (TI)
2026-07-24 20:13 ` [PATCH 1/2] iio: adc: ti-ads112c14: add DRDY interrupt support David Lechner (TI)
2026-07-27  1:34   ` Jonathan Cameron
2026-07-24 20:13 ` [PATCH 2/2] iio: adc: ti-ads112c14: add continuous mode support David Lechner (TI)
2026-07-27  1:45   ` Jonathan Cameron
2026-07-27 13:45     ` David Lechner
2026-07-27 21:18       ` Jonathan Cameron [this message]

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=20260727221822.554f7b4e@jic23-huawei \
    --to=jic23@kernel.org \
    --cc=andy@kernel.org \
    --cc=c-hall@ti.com \
    --cc=dlechner@baylibre.com \
    --cc=kuurtb@gmail.com \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nuno.sa@analog.com \
    --cc=pedwards@ti.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