From: Jonathan Cameron <jic23@kernel.org>
To: Ge Gao <ggao@invensense.com>
Cc: linux-iio@vger.kernel.org
Subject: Re: A IIO trigger problem/bug.
Date: Fri, 01 Jun 2012 08:59:08 +0100 [thread overview]
Message-ID: <4FC8764C.9050700@kernel.org> (raw)
In-Reply-To: <CAE9_fz=THxH8DRwbJMGONJC3szwiJ9DM=NF0HM-e19nqXmtcHQ@mail.gmail.com>
On 5/31/2012 4:56 PM, Ge Gao wrote:
>
> I met a strange problem concerning IIO driver. I wrote a driver
> that has trigger, ring buffer,just the standard way of doing things.
> It sometimes runs OK. However, I found sometimes, the trigger is NOT
> triggered at all. I am using a hardware interrupt to trigger a
> threaded ISR and post-ISR. I can see the interrupt coming correctly.
> By using "cat /proc/interrupts", I can see that the number of triggers
> stays the same while the number of interrupt increases steadily.
It's been a while since I looked at this corner, but IIRC the basic
principal is to prevent the driver
read out code from being reentrant. Thus if your trigger is occuring
faster than the driver is
capable of reading from the device then triggers will be dropped.
It's possible that we have a bug in there that means it is not
succesfully recovering from the trigger being dropped.
One thought would be that you weren't clearing the interrupt unless a
read occurs, but that doesn't seem
to be the case here given you are seeing /proc/interrupts continue to
increase...
The driver controls masking (typically through IRQF_ONESHOT) of an
interrupt that is in turn fed by a second
interrupt handler - the one in your driver handling the actual hardware
interrupt.
I can't immediately spot why trig->usecount would be wrong. Just as a
test could you drop the test for it
entirely and see if that makes things work as expected? That will break
having multiple users of the trigger,
but might give us some clues as to what is happening. Otherwise, please
add some printk's to the relevant
places and lets see what is happening. With your usecase
trig->use_count should only ever be 0 or 1
and if it is still 1 in iio_trigger_poll, we'll have some clue what is
happening...
prev parent reply other threads:[~2012-06-01 7:59 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-31 15:56 A IIO trigger problem/bug Ge Gao
2012-06-01 7:59 ` 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=4FC8764C.9050700@kernel.org \
--to=jic23@kernel.org \
--cc=ggao@invensense.com \
--cc=linux-iio@vger.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;
as well as URLs for NNTP newsgroup(s).