mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Marcelo Schmitt <marcelo.schmitt1@gmail.com>
To: David Lechner <dlechner@baylibre.com>
Cc: Marcelo Schmitt <marcelo.schmitt@analog.com>,
	linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, jic23@kernel.org,
	nuno.sa@analog.com, Michael.Hennerich@analog.com,
	andy@kernel.org, robh@kernel.org, krzk+dt@kernel.org,
	conor+dt@kernel.org, pop.ioan-daniel@analog.com
Subject: Re: [PATCH v3 5/5] iio: adc: ltc2378: Enable triggered buffer data capture
Date: Fri, 19 Jun 2026 11:27:16 -0300	[thread overview]
Message-ID: <ajVRxCPejqxlo_Z4@debian-BULLSEYE-live-builder-AMD64> (raw)
In-Reply-To: <4f7f50ad-c305-4947-b4e9-3666a4f31031@baylibre.com>

On 06/17, David Lechner wrote:
> On 6/16/26 9:04 PM, Marcelo Schmitt wrote:
> > Enable users to run triggered data captures with LTC2378 and similar ADCs.
> > 
> > Signed-off-by: Marcelo Schmitt <marcelo.schmitt@analog.com>
> > ---
...
> > @@ -27,6 +27,21 @@ int ltc2378_lib_buffer_setup(struct iio_dev *indio_dev, struct ltc2378_state *st
> >  		return dev_err_probe(dev, ret, "error on SPI offload setup\n");
> >  
> >  	return 0;
> > +
> > +trigger_buf_setup:
> > +	ret = __ltc2378_set_triggered_buf_ops(st);
> > +	if (ret == -EOPNOTSUPP)
> > +		return 0; /* Let device setup complete without buffer support */
> > +
> > +	if (!ret)
> > +		ret = st->ops->buffer_setup(indio_dev, st);
> > +
> > +	if (ret)
> > +		return dev_err_probe(dev, ret, "error on buffer setup\n");
> 
> This is repeating the code above. Seems like it would be better without
> the goto.
Ack

> 
> > +
> > +	st->chans[st->num_iio_chans++] = IIO_CHAN_SOFT_TIMESTAMP(1);
> 
> Adding a channel here seems messy. I still think static const channel
> data would be better. But at least would be better if this was moved
> to the same function as the other channel setup.
> 
Agree, will think of a better place to init the timestamp channel while
switching to static const channel.

> > +
> > +	return 0;
> >  }
...
> > +static irqreturn_t ltc2378_trigger_handler(int irq, void *p)
> > +{
> > +	struct iio_poll_func *pf = p;
> > +	struct iio_dev *indio_dev = pf->indio_dev;
> > +	struct ltc2378_state *st = iio_priv(indio_dev);
> > +	int ret;
> > +
> > +	ret = ltc2378_convert_and_acquire(st);
> > +	if (ret < 0)
> > +		goto err_out;
> 
> As mentioned elsewhere, SPI xfer size may be 2 or 4 bytes, but
> we are always pushing 4 bytes, so this only works on little-endian
> architecture.
> 
> I think best would be to have storagesize = 16 when appropriate to
> avoid having to manually handle this.
> 
Okay, it will probably be easier to do that with static const channels.
Am checking out other sashiko comments as well.

> > +
> > +	iio_push_to_buffers_with_ts(indio_dev, &st->scan, sizeof(st->scan),
> > +				    pf->timestamp);
> > +
> > +err_out:
> > +	iio_trigger_notify_done(indio_dev->trig);
> > +	return IRQ_HANDLED;
> > +}
> > +
> 
Thanks,
Marcelo

  reply	other threads:[~2026-06-19 14:26 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-17  2:02 [PATCH v3 0/5] iio: adc: Add support for LTC2378 and similar ADCs Marcelo Schmitt
2026-06-17  2:03 ` [PATCH v3 1/5] dt-bindings: iio: adc: Add ltc2378 Marcelo Schmitt
2026-06-17 16:05   ` Conor Dooley
2026-06-17 17:14     ` Marcelo Schmitt
2026-06-17 21:16       ` Conor Dooley
2026-06-19 13:07         ` Marcelo Schmitt
2026-06-19 14:07           ` Conor Dooley
2026-06-17 22:04   ` David Lechner
2026-06-19 13:17     ` Marcelo Schmitt
2026-06-17  2:03 ` [PATCH v3 2/5] iio: adc: ltc2378: Add support for LTC2378-20 and similar ADCs Marcelo Schmitt
2026-06-17 22:18   ` David Lechner
2026-06-17  2:03 ` [RFC PATCH v3 3/5] iio: buffer: Extend DMAengine buffer interfaces to take extra sysfs attributes Marcelo Schmitt
2026-06-17 21:43   ` David Lechner
2026-06-18 10:38     ` Nuno Sá
2026-06-19 13:57       ` Marcelo Schmitt
2026-06-19 14:17         ` David Lechner
2026-06-17  2:04 ` [PATCH v3 4/5] iio: adc: ltc2378: Enable high-speed data capture Marcelo Schmitt
2026-06-17 16:26   ` Julian Braha
2026-06-17 22:33   ` David Lechner
2026-06-17  2:04 ` [PATCH v3 5/5] iio: adc: ltc2378: Enable triggered buffer " Marcelo Schmitt
2026-06-17 22:39   ` David Lechner
2026-06-19 14:27     ` Marcelo Schmitt [this message]
2026-06-17 22:46 ` [PATCH v3 0/5] iio: adc: Add support for LTC2378 and similar ADCs David Lechner

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=ajVRxCPejqxlo_Z4@debian-BULLSEYE-live-builder-AMD64 \
    --to=marcelo.schmitt1@gmail.com \
    --cc=Michael.Hennerich@analog.com \
    --cc=andy@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=jic23@kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcelo.schmitt@analog.com \
    --cc=nuno.sa@analog.com \
    --cc=pop.ioan-daniel@analog.com \
    --cc=robh@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

all inboxes | Powered by JetHome®