public inbox for linux-iio@vger.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Greg Wilson-Lindberg <GWilson@sakuraus.com>,
	"linux-iio@vger.kernel.org" <linux-iio@vger.kernel.org>,
	"Patil, Rachna" <rachna@ti.com>,
	Zubair Lutfullah <zubair.lutfullah@gmail.com>,
	Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Subject: Re: TI tsadc sample frequency question
Date: Sun, 14 Jun 2015 15:29:46 +0100	[thread overview]
Message-ID: <557D8FDA.2020005@kernel.org> (raw)
In-Reply-To: <782E3A02C2EB2347BEA6DEA69DC7AB86021D3C87D7AB@sfamail.SAKURAUS.LOCAL>

On 27/05/15 01:17, Greg Wilson-Lindberg wrote:
> This probably falls closer to a stupid user question, but I can't
> seem to find it addressed in any of the documentation that I have
> found so far.
I'm not that familiar with the driver, but as no one who is has replied.
I'll take a stab at answering you.
> 
> As a partial work around for the TS TSADC problems that are being
> discussed in another thread I'm enabling a buffer for a short time,
> pulling the samples, and disabling the buffer. I'm trying to
> understand the number of samples that will actually be collected
> during the time that I have the buffer enabled.
> 
> I'm currently enabling the buffer for 0.1 seconds, according to the
> mfd/ti_am335x_tsadc.h file a single sample takes 116us to process, so
> 6 samples (4 ts + 2 adc) should take 696us, or ~1436 sample sets per
> second, or ~143 samples per 0.1 seconds.
> 
> No matter what size I set the buffer to, I get that number of samples
> back. So even though I should only be able to collect ~143 samples,
> if I set the buffer size to 256, I get 256 samples back.
This device is fairly unusual in that it has a substantial hardware fifo.
There is no explicit 'trigger' between samples to tell you when data is
available, rather we just have the fifo threshold interrupts.  These then
push into a software fifo.  It's this software fifo you are reading from.

> 
> Is there some way (low overhead preferable) to reset the buffer so
> that I only get the samples that have been collected in the time that
> the buffer has been enabled?
The hardware fifo is flushed on enabling of the buffer.  For the software
fifo, your might have to just do a non blocking read of the whole fifo size.
Then it will be empty.
You will stop getting fifo interrupts the moment the buffer is disabled, so no
more samples should come in.  There is also an explicit flush of the buffer
at disable to try and clear out anything that turned up since the last interrupt.
> Or is there some way to figure out what
> the number of samples are the I would get back in some time period,
> so I can set the buffer size accordingly?
A the moment this driver doesn't seem to expose sampling frequency control
except via the device tree parameters. IIRC this is because it's not easy
to calculate as the actual frequency is dependent on a whole load of
elements related to the channel setup.

I've cc'd a few people involved with this driver, perhaps they can give
you some more detailed options.
> 
> Greg Wilson-Lindberg Sakura Finetek 310-783-5075 -- To unsubscribe
> from this list: send the line "unsubscribe linux-iio" in the body of
> a message to majordomo@vger.kernel.org More majordomo info at
> http://vger.kernel.org/majordomo-info.html


      reply	other threads:[~2015-06-14 14:29 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-27  0:17 TI tsadc sample frequency question Greg Wilson-Lindberg
2015-06-14 14:29 ` 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=557D8FDA.2020005@kernel.org \
    --to=jic23@kernel.org \
    --cc=GWilson@sakuraus.com \
    --cc=bigeasy@linutronix.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=rachna@ti.com \
    --cc=zubair.lutfullah@gmail.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