From: Andy Shevchenko <andriy.shevchenko@intel.com>
To: "David Lechner (TI)" <dlechner@baylibre.com>
Cc: "Jonathan Cameron" <jic23@kernel.org>,
"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 v3 3/3] iio: adc: ti-ads112c14: add continuous mode support
Date: Mon, 10 Aug 2026 11:58:27 +0300 [thread overview]
Message-ID: <anmSs_AHIt_cKacj@ashevche-desk.local> (raw)
In-Reply-To: <20260807-iio-adc-ti-ads112c14-continuous-mode-v3-3-76e0d30e6c6b@baylibre.com>
On Fri, Aug 07, 2026 at 04:19:48PM -0500, David Lechner (TI) 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 irqreturn_t ads112c14_trigger_handler(int irq, void *private)
> struct iio_poll_func *pf = private;
> struct iio_dev *indio_dev = pf->indio_dev;
> struct ads112c14_data *data = iio_priv(indio_dev);
> + unsigned int scan_mask_len = iio_get_masklength(indio_dev);
This is from indio_dev, which is defined two lines up, so this, longer one, can
be bumped one line up.
> u32 offset = 0;
> u32 i;
> int ret;
>
> + if (iio_trigger_using_own(indio_dev)) {
> + i = find_first_bit(indio_dev->active_scan_mask, scan_mask_len);
> + if (i >= scan_mask_len)
'>' is redundant, '==' suffices.
> + goto out;
> +
> + ret = ads112c14_scan_read(data, (u8 *)&data->scan[0]);
> + if (ret) {
> + const struct iio_chan_spec *chan = &indio_dev->channels[i];
> +
> + dev_err_once(indio_dev->dev.parent,
> + "failed to read channel %d: %pe; additional errors will be suppressed\n",
> + chan->channel, ERR_PTR(ret));
> + goto out;
> + }
> +
> + iio_push_to_buffers_with_ts(indio_dev, data->scan,
> + sizeof(data->scan), pf->timestamp);
> + goto out;
> + }
...
> +static int ads112c14_buffer_postenable(struct iio_dev *indio_dev)
> +{
> + unsigned int scan_mask_len = iio_get_masklength(indio_dev);
> + struct ads112c14_data *data = iio_priv(indio_dev);
> + const struct iio_chan_spec *chan;
> + unsigned int i;
> + int ret;
> +
> + if (!ads112c14_using_drdy_trigger(indio_dev))
> + return 0;
> + i = find_first_bit(indio_dev->active_scan_mask, scan_mask_len);
> + if (i >= scan_mask_len)
> + return -EINVAL;
> +
> + chan = &indio_dev->channels[i];
These lines repeat what you have in ads112c14_trigger_handler(). Perhaps
a helper to return a channel or error pointer or NULL?
> + guard(mutex)(&data->lock);
> +
> + ret = ads112c14_prepare_channel(data, chan);
> + if (ret)
> + return ret;
> +
> + ret = regmap_assign_bits(data->regmap, ADS112C14_REG_DEVICE_CFG,
> + ADS112C14_DEVICE_CFG_CONV_MODE,
> + ADS112C14_DEVICE_CFG_CONV_MODE_CONTINUOUS);
> + if (ret)
> + return ret;
> +
> + ret = regmap_write(data->regmap, ADS112C14_REG_CONVERSION_CTRL,
> + ADS112C14_CONVERSION_CTRL_START);
> + if (ret) {
> + regmap_assign_bits(data->regmap, ADS112C14_REG_DEVICE_CFG,
> + ADS112C14_DEVICE_CFG_CONV_MODE,
> + ADS112C14_DEVICE_CFG_CONV_MODE_SINGLE_SHOT);
> + return ret;
> + }
> +
> + return 0;
> +}
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2026-08-10 8:58 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-07 21:19 [PATCH v3 0/3] iio: adc: ti-ads112c14: continuous mode support David Lechner (TI)
2026-08-07 21:19 ` [PATCH v3 1/3] iio: adc: ti-ads112c14: add DRDY interrupt support David Lechner (TI)
2026-08-10 8:50 ` Andy Shevchenko
2026-08-10 15:59 ` David Lechner
2026-08-10 17:01 ` Andy Shevchenko
2026-08-07 21:19 ` [PATCH v3 2/3] iio: adc: ti-ads112c14: create data read helper functions David Lechner (TI)
2026-08-07 21:19 ` [PATCH v3 3/3] iio: adc: ti-ads112c14: add continuous mode support David Lechner (TI)
2026-08-10 8:58 ` Andy Shevchenko [this message]
2026-08-16 20:26 ` 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=anmSs_AHIt_cKacj@ashevche-desk.local \
--to=andriy.shevchenko@intel.com \
--cc=andy@kernel.org \
--cc=c-hall@ti.com \
--cc=dlechner@baylibre.com \
--cc=jic23@kernel.org \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.