From: "Zubair Lutfullah :" <zubair.lutfullah-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Jonathan Cameron <jic23-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Cc: Zubair Lutfullah
<zubair.lutfullah-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
jic23-KWPb1pKIrIJaa/9Udqfwiw@public.gmane.org,
dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
linux-iio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-input-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
bigeasy-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org,
gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org,
Russ.Dill-l0cyMroinI0@public.gmane.org
Subject: Re: [PATCH 4/4] iio: ti_am335x_adc: Add continuous sampling and trigger support
Date: Sat, 17 Aug 2013 09:58:25 +0100 [thread overview]
Message-ID: <20130817085824.GA5090@gmail.com> (raw)
In-Reply-To: <520CBEC6.8010400-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
On Thu, Aug 15, 2013 at 12:43:02PM +0100, Jonathan Cameron wrote:
> Note I'd also like a much more detailed description in the patch header.
>
> I would also expect an option for the trigger to be supplied from the
> chip itself based on fifo watershead interrupts. Thus the adc could be
> operated at full rate without losing data. As you described in a previous
> email this is much more similar to a one shot osciloscope trigger where it
> grabs the next set of readings. Now this is an interesting option, but
> it isn't the standard one for IIO. I'd be interested to see a proposal
> for adding this functionality to the core in a more general fashion.
When I read trigger, this functionality is what comes to my mind.
Not the single scan current implementation in IIO. My background I guess.
Adding this feature to the core feels a bit above my level at the moment.
I'd like to get this driver sorted first.
>
> For now I'd be much happier if this driver conformed to more or less the
> standard form with the one exception being that the 'trigger' is based on
> the fifo threshold and so it might appear to grab multiple scans of the
> enabled channels for each trigger (which is fine). Even if we provide the
> functionality sketched out above, it would still be as core functionality, not
> in the driver as you have done here.
>
> Jonathan
Will that affect the way generic_buffer.c will read from the driver?
Rest comments below.
> > diff --git a/drivers/iio/adc/ti_am335x_adc.c b/drivers/iio/adc/ti_am335x_adc.c
> > + /* FIFO Overrun. Clear flag. Disable/Enable ADC to recover */
> > + if (status & IRQENB_FIFO1OVRRUN) {
> > + config = tiadc_readl(adc_dev, REG_CTRL);
> > + config &= ~(CNTRLREG_TSCSSENB);
> > + tiadc_writel(adc_dev, REG_CTRL, config);
> > + tiadc_writel(adc_dev, REG_IRQSTATUS, IRQENB_FIFO1OVRRUN |
> > + IRQENB_FIFO1UNDRFLW | IRQENB_FIFO1THRES);
> > + tiadc_writel(adc_dev, REG_CTRL, (config | CNTRLREG_TSCSSENB));
> > + } else if (status & IRQENB_FIFO1THRES) {
>
> I'd normally expect this interrupt to drive a trigger that in turn results in
> the data being dumped into the software buffers.
>
The work handler is sort of providing similar functionality..
But, I guess using the trigger ABI is more efficient.
> > +
> > + tiadc_writel(adc_dev, REG_IRQSTATUS, IRQENB_FIFO1THRES |
> > + IRQENB_FIFO1OVRRUN | IRQENB_FIFO1UNDRFLW);
> > + tiadc_writel(adc_dev, REG_IRQENABLE, IRQENB_FIFO1THRES
> > + | IRQENB_FIFO1OVRRUN);
> > +
> > + iio_trigger_notify_done(indio_dev->trig);
> Are you actually done? What happens if another trigger turns up in the
> meantime? I'd expect this to occur only after the results of the trigger
> have been handled.
Indeed Done is passed immediately while ADC is still sampling.
Because of the way the trigger was used and structure of the driver.
> > +static int tiadc_buffer_preenable(struct iio_dev *indio_dev)
> > +{
> Don't have pointless wrappers like this.
Noted
> > + return iio_sw_buffer_preenable(indio_dev);
> > +}
> > +
> > +static void tiadc_adc_work(struct work_struct *work_s)
> > +{
> > + struct tiadc_device *adc_dev =
> > + container_of(work_s, struct tiadc_device, poll_work);
> > + struct iio_dev *indio_dev = iio_priv_to_dev(adc_dev);
> > + struct iio_buffer *buffer = indio_dev->buffer;
> > + int i, j, k, fifo1count, read;
> > + unsigned int config;
> So normally we'd just fill with one sample hence for this case
> I'd expect to push out whatever samples are in the fifo right now
> then return. The next trigger would grab the next lot etc.
>
Again. If I understand correctly,
I restructure the driver so that
enabling the buffer via userspace starts sampling the ADC channels.
Preenable/postenable do all that hard work.
I need to use iio_trigger_register to create an IIO trigger inside the
driver.
The IRQ handler for FIFO Threshold causes a trigger event.
The trigger handler pushes the entire fifo to userspace.
I'd like a small ACK before I get to work.
Just to make sure I got things correctly.
Thanks for the input
Zubair
next prev parent reply other threads:[~2013-08-17 8:58 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-13 20:04 [PATCH 0/4] iio: input: ti_am335x_adc: Add continuous sampling support round 5 Zubair Lutfullah
2013-08-13 20:05 ` [PATCH 1/4] input: ti_am335x_tsc: correct step mask update after IRQ Zubair Lutfullah
2013-08-13 20:05 ` [PATCH 2/4] input: ti_am335x_tsc: Increase sequencer delay time Zubair Lutfullah
[not found] ` <1376424303-22740-1-git-send-email-zubair.lutfullah-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2013-08-13 20:05 ` [PATCH 3/4] input: ti_am335x_tsc: Enable shared IRQ for TSC, add overrun and underflow checks Zubair Lutfullah
2013-08-13 20:05 ` [PATCH 4/4] iio: ti_am335x_adc: Add continuous sampling and trigger support Zubair Lutfullah
[not found] ` <1376424303-22740-5-git-send-email-zubair.lutfullah-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2013-08-15 11:43 ` Jonathan Cameron
[not found] ` <520CBEC6.8010400-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2013-08-16 10:07 ` Sebastian Andrzej Siewior
[not found] ` <20130816100702.GD26895-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>
2013-08-16 10:17 ` Sebastian Andrzej Siewior
2013-08-16 11:33 ` Jonathan Cameron
2013-08-16 10:46 ` Sebastian Andrzej Siewior
2013-08-16 21:21 ` Zubair Lutfullah :
2013-08-17 8:58 ` Zubair Lutfullah : [this message]
2013-08-16 12:53 ` Sebastian Andrzej Siewior
2013-08-16 21:18 ` Zubair Lutfullah :
2013-08-16 13:25 ` Sebastian Andrzej Siewior
2013-08-16 21:13 ` Zubair Lutfullah :
2013-08-16 14:59 ` Sebastian Andrzej Siewior
2013-08-16 21:10 ` Zubair Lutfullah :
2013-08-19 17:12 ` Sebastian Andrzej Siewior
[not found] ` <20130819171238.GA31610-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>
2013-08-20 16:26 ` Zubair Lutfullah :
2013-08-14 18:57 ` [PATCH 0/4] iio: input: ti_am335x_adc: Add continuous sampling support round 5 Jonathan Cameron
2013-08-14 18:05 ` Sebastian Andrzej Siewior
2013-08-16 21:23 ` Zubair Lutfullah :
-- strict thread matches above, loose matches on Subject: below --
2013-08-13 16:48 [PATCH 0/4] iio: input: ti_am335x_adc: Add continuous sampling support round 4 Zubair Lutfullah
2013-08-13 16:48 ` [PATCH 4/4] iio: ti_am335x_adc: Add continuous sampling and trigger support Zubair Lutfullah
2013-08-13 17:05 ` Lee Jones
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=20130817085824.GA5090@gmail.com \
--to=zubair.lutfullah-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
--cc=Russ.Dill-l0cyMroinI0@public.gmane.org \
--cc=bigeasy-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org \
--cc=dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org \
--cc=jic23-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
--cc=jic23-KWPb1pKIrIJaa/9Udqfwiw@public.gmane.org \
--cc=linux-iio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-input-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.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;
as well as URLs for NNTP newsgroup(s).