From: Michael Welling <mwelling@ieee.org>
To: Greg Wilson-Lindberg <GWilson@sakuraus.com>
Cc: Daniel Baluta <daniel.baluta@gmail.com>,
"linux-iio@vger.kernel.org" <linux-iio@vger.kernel.org>
Subject: Re: BBB IIO ADC access not working
Date: Wed, 19 Aug 2015 15:48:49 -0500 [thread overview]
Message-ID: <20150819204847.GA28779@deathstar> (raw)
In-Reply-To: <782E3A02C2EB2347BEA6DEA69DC7AB86021D3CBD444B@sfamail.SAKURAUS.LOCAL>
On Wed, Aug 19, 2015 at 01:35:10PM -0700, Greg Wilson-Lindberg wrote:
>
>
> > -----Original Message-----
> > From: Michael Welling [mailto:mwelling79@gmail.com] On Behalf
> > Of Michael Welling
> > Sent: Wednesday, August 19, 2015 10:53 AM
> > To: Greg Wilson-Lindberg
> > Cc: Daniel Baluta; linux-iio@vger.kernel.org
> > Subject: Re: BBB IIO ADC access not working
> >
> > On Wed, Aug 19, 2015 at 09:27:02AM -0700, Greg Wilson-Lindberg wrote:
> > >
> > >
> > > > -----Original Message-----
> > > > From: Michael Welling [mailto:mwelling79@gmail.com] On Behalf Of
> > > > Michael Welling
> > > > Sent: Tuesday, August 18, 2015 3:31 PM
> > > > To: Greg Wilson-Lindberg
> > > > Cc: Daniel Baluta; linux-iio@vger.kernel.org
> > > > Subject: Re: BBB IIO ADC access not working
> > > >
> > > > On Tue, Aug 18, 2015 at 03:11:13PM -0700, Greg
> > Wilson-Lindberg wrote:
> > > > >
> > > > >
> > > > > > I found that handling the IRQENB_EOS interrupt in the ADC
> > > > is causing
> > > > > > an undesired effect. After enabling the ADC buffer mode and
> > > > > > disabling it the coordinate readings work but the touch
> > > > release is
> > > > > > no longer detected.
> > > > >
> > > > > Can we put your code in the touch screen handler? The tsc
> > > > code is writing to the IRQSTATUS register, not the IRQCLR
> > register.
> > > > >
> > > >
> > > > Actually using the IRQCLR disables the IRQ instead of clearing it
> > > > and that was not my intent. This is why the pen releases
> > where not
> > > > working, the tsc driver relies on the EOS interrupt to write the
> > > > step register because it is using a one shot hardware mode.
> > > >
> > > > Since the IRQENB_EOS is not used by the ADC driver it can be
> > > > disabled when in buffered mode which is triggering faster
> > than the
> > > > isr can handle it.
> > > >
> > > > See patch below.
> > > >
> > > > Though it allows for the repeated enabling and disabling of the
> > > > buffer the touchscreen gets a bunch of unexpected
> > releases and the
> > > > readings are very jittery.
> > > >
> > > > diff --git a/drivers/iio/adc/ti_am335x_adc.c
> > > > b/drivers/iio/adc/ti_am335x_adc.c index a0e7161..9945e4a 100644
> > > > --- a/drivers/iio/adc/ti_am335x_adc.c
> > > > +++ b/drivers/iio/adc/ti_am335x_adc.c
> > > > @@ -177,6 +177,7 @@ static int
> > tiadc_buffer_preenable(struct iio_dev
> > > > *indio_dev)
> > > > IRQENB_FIFO1OVRRUN |
> > > > IRQENB_FIFO1UNDRFLW));
> > > >
> > > > + tiadc_writel(adc_dev, REG_IRQCLR, IRQENB_EOS);
> > > > /* Flush FIFO. Needed in corner cases in simultaneous
> > tsc/adc use
> > > > */
> > > > fifo1count = tiadc_readl(adc_dev, REG_FIFO1CNT);
> > > > for (i = 0; i < fifo1count; i++)
> > > > @@ -213,6 +214,7 @@ static int tiadc_buffer_predisable(struct
> > > > iio_dev *indio_dev)
> > > >
> > > > tiadc_writel(adc_dev, REG_IRQCLR, (IRQENB_FIFO1THRES |
> > > > IRQENB_FIFO1OVRRUN |
> > > > IRQENB_FIFO1UNDRFLW));
> > > > + tiadc_writel(adc_dev, REG_IRQENABLE, IRQENB_EOS);
> > > > am335x_tsc_se_clr(adc_dev->mfd_tscadc,
> > > > adc_dev->buffer_en_ch_steps);
> > > > adc_dev->buffer_en_ch_steps = 0;
> > > >
> > > >
> > >
> > > I'm not sure that it's better, but it is different. The
> > touch screen still locks up, but mouse clicks work.
> >
> > This is very disappointing.
> >
> > Have you tried reading the ADCs using one shot mode recently?
> >
> > IE cat /sys/bus/iio/devices/iio:device0/in_voltageX_raw
>
> I tried that after the system had locked up and what I get back is the Device
> or resource is busy. I restarted the BBB and tried before starting my application
> and it worked just fine. I started up the app and the touch screen was
> locked up immediately, mouse clicks delayed about 1/2 second. And I get Device or resource busy from the cat.
>
Is the using while using /sys/bus/iio/devices/iio:device0/in_voltageX_raw in your program?
> >
> > >
> > > >
> > > >
> > > >
> >
next prev parent reply other threads:[~2015-08-19 20:48 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-31 21:15 BBB IIO ADC access not working Greg Wilson-Lindberg
2015-08-05 23:07 ` Greg Wilson-Lindberg
2015-08-06 7:35 ` Daniel Baluta
2015-08-06 15:42 ` Greg Wilson-Lindberg
2015-08-06 18:07 ` Michael Welling
2015-08-10 22:22 ` Greg Wilson-Lindberg
2015-08-10 22:33 ` Michael Welling
2015-08-11 16:00 ` Greg Wilson-Lindberg
2015-08-11 17:02 ` Michael Welling
2015-08-11 17:08 ` Greg Wilson-Lindberg
2015-08-11 17:43 ` Michael Welling
2015-08-13 23:00 ` Greg Wilson-Lindberg
2015-08-14 18:39 ` Michael Welling
2015-08-14 18:43 ` Greg Wilson-Lindberg
2015-08-14 20:40 ` Michael Welling
2015-08-14 23:46 ` Michael Welling
2015-08-18 16:06 ` Greg Wilson-Lindberg
2015-08-18 16:28 ` Michael Welling
2015-08-18 16:54 ` Greg Wilson-Lindberg
2015-08-18 17:37 ` Michael Welling
2015-08-18 17:40 ` Greg Wilson-Lindberg
2015-08-18 18:13 ` Michael Welling
2015-08-18 22:11 ` Greg Wilson-Lindberg
2015-08-18 22:31 ` Michael Welling
2015-08-19 16:27 ` Greg Wilson-Lindberg
2015-08-19 17:52 ` Michael Welling
2015-08-19 20:35 ` Greg Wilson-Lindberg
2015-08-19 20:48 ` Michael Welling [this message]
2015-08-19 21:13 ` Greg Wilson-Lindberg
2015-08-19 21:29 ` Michael Welling
2015-08-19 21:34 ` Greg Wilson-Lindberg
2015-08-19 21:42 ` Michael Welling
2015-08-20 15:50 ` Greg Wilson-Lindberg
2015-08-20 16:14 ` Michael Welling
2015-08-20 16:18 ` Greg Wilson-Lindberg
2015-08-20 17:27 ` Greg Wilson-Lindberg
2015-08-20 17:31 ` Michael Welling
2015-08-20 18:41 ` Greg Wilson-Lindberg
2015-08-20 19:23 ` Michael Welling
2015-08-20 20:21 ` Greg Wilson-Lindberg
2015-08-20 20:48 ` Michael Welling
2015-08-21 17:36 ` Greg Wilson-Lindberg
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=20150819204847.GA28779@deathstar \
--to=mwelling@ieee.org \
--cc=GWilson@sakuraus.com \
--cc=daniel.baluta@gmail.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).