Re: BBB IIO ADC access not working

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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;
 



--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux