linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
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: Tue, 18 Aug 2015 11:28:53 -0500	[thread overview]
Message-ID: <20150818162851.GA27380@deathstar> (raw)
In-Reply-To: <782E3A02C2EB2347BEA6DEA69DC7AB86021D3CBD42B1@sfamail.SAKURAUS.LOCAL>

On Tue, Aug 18, 2015 at 09:06:20AM -0700, Greg Wilson-Lindberg wrote:
>  
> 
> > On Fri, Aug 14, 2015 at 03:40:18PM -0500, Michael Welling wrote:
> > > On Fri, Aug 14, 2015 at 11:43:52AM -0700, Greg 
> > Wilson-Lindberg wrote:
> > > > Thank you very much,
> > > > Regards, Greg
> > > >
> > > 
> > > To replicate the issue I did the following:
> > > 
> > > - Started a touchscreen enabled application ts_test
> > > 
> > > - In another terminal started a dump of /dev/iio:device0 hexdump -C 
> > > /dev/iio\:device0
> > > 
> > > - In yet another terminal enable the buffer cd 
> > > /sys/bus/iio/devices/iio\:device0 echo 1 > 
> > > scan_elements/in_voltage4_en echo 1 > buffer/enable
> > > 
> > > Once the buffer is enabled the hexdump window starts spewing out 
> > > readings as expected. The touchscreen is unresponsive as expected.
> > > 
> > > Then I started occassionally enabling and disabling the buffer and 
> > > noticed something very off. When enabling the buffer sometimes the 
> > > readings from the hexdump would start and abruptly stop. In 
> > this state 
> > > the entire system is nonresponsive. None of the terminals are 
> > > excepting input and the system is in complete deadlock. 
> > Then I touched 
> > > the screen and the deadlock is lifted and readings started again.
> > > 
> > > As if the behavior was not weird enough, occassionally after the 
> > > buffer is disabled, the touchscreen readings are mangled.
> > > 
> > > Next step, figure out what is going wrong.
> > >
> > 
> > It seems the drivers are being flooded with IRQENB_EOS 
> > interrupts causing the lockup.
> > 
> > By adding the following to the tiadc_irq_h function the lockup stops.
> > 
> > .
> > .
> >         if (status & IRQENB_EOS) {
> >                 tiadc_writel(adc_dev, REG_IRQCLR, IRQENB_EOS);
> >                 return IRQ_HANDLED;
> >         }
> > .
> > .
> > 
> > Now the IRQENB_EOS is also handled in the touchscreen driver 
> > so this is may not be an appropriate fix but at least it 
> > fixes the lockup.
> > 
> > Try adding the snippet above to ti_am335x_adc.c and see if it 
> > makes your program stop locking up.
> > 
> > Then we need to find a solution that makes the maintainers happy.
> > 
> > 
> 
> I've applied this to the ti_am335x_adc.c driver in both the 3.14.49-ti-r62 & 3.14.49-ti-r73 kernels from RCN and they both suffered touch screen lockups over night.

This is disturbing. Do you have any idea how long it takes before the lockup occurs?

Previously it was in a few seconds so there is obviously some improvement.

Is the mouse locked as well after the overnight test?

> 
> Here is what I did:
> static irqreturn_t tiadc_irq_h(int irq, void *private)
> {
> 	struct iio_dev *indio_dev = private;
> 	struct tiadc_device *adc_dev = iio_priv(indio_dev);
> 	unsigned int status, config;
> 	status = tiadc_readl(adc_dev, REG_IRQSTATUS);
> 
> 	/*
> 	 * ADC and touchscreen share the IRQ line.
> 	 * FIFO0 interrupts are used by TSC. Handle FIFO1 IRQs here only
> 	 */
> 	if (status & IRQENB_FIFO1OVRRUN) {
> 		/* FIFO Overrun. Clear flag. Disable/Enable ADC to recover */
> 		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));
> 		return IRQ_HANDLED;
> 	} else if (status & IRQENB_FIFO1THRES) {
> 		/* Disable irq and wake worker thread */
> 		tiadc_writel(adc_dev, REG_IRQCLR, IRQENB_FIFO1THRES);
> 		return IRQ_WAKE_THREAD;
> 	}
> 
>     if (status & IRQENB_EOS) {
>         tiadc_writel(adc_dev, REG_IRQCLR, IRQENB_EOS);
>         return IRQ_HANDLED;
>     }
> 
>     return IRQ_NONE;
> }
> 
> Regards,
> Greg

  reply	other threads:[~2015-08-18 16:29 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 [this message]
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
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=20150818162851.GA27380@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).