All of lore.kernel.org
 help / color / mirror / Atom feed
* BBB touch screen and ADC interactions
@ 2015-05-12 23:23 Greg Wilson-Lindberg
  2015-05-13  1:11 ` Michael Welling
  0 siblings, 1 reply; 14+ messages in thread
From: Greg Wilson-Lindberg @ 2015-05-12 23:23 UTC (permalink / raw)
  To: linux-iio

Hello all,
I've got a problem with the BeagleBone Black ti_am335x_tsc, ti_am335x_adc & ti_am335x_tsadc drivers, and Jonathan Cameron suggested that I reach out to this list to see if any one here has any insight to my problem.
 
I'm using a BBB running a Debian Jessie build with the 3.14.40 ti kernel by Robert C. Nelson. I've got it hooked up to a touch screen and I would like to also be able to use some of the remaining adc channels.
 
As soon as I try to read any of the remaining channels the touch screen locks up. I've tried catting them from /sys/bus/iio/devices/iio:device0/in_voltageX_raw, using the generic_buffer program provided by the kernel, and using the Analog Devices libiio library. In all cases, I get the same results, adc values that look reasonable, but the touch screen stops responding.
 
I've asked on the TI support forum if they could help with this problem, but their response was that they only supported the TI SDK.
 
Can any of you tell me if the current iio subsystem will work correctly with the ti touch screen and adc drivers? 

Greg Wilson-Lindberg
Sakura Finetek
310-783-5075

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: BBB touch screen and ADC interactions
  2015-05-12 23:23 BBB touch screen and ADC interactions Greg Wilson-Lindberg
@ 2015-05-13  1:11 ` Michael Welling
  2015-05-14 17:00   ` Greg Wilson-Lindberg
  0 siblings, 1 reply; 14+ messages in thread
From: Michael Welling @ 2015-05-13  1:11 UTC (permalink / raw)
  To: Greg Wilson-Lindberg; +Cc: linux-iio

On Tue, May 12, 2015 at 04:23:43PM -0700, Greg Wilson-Lindberg wrote:
> Hello all,
> I've got a problem with the BeagleBone Black ti_am335x_tsc, ti_am335x_adc & ti_am335x_tsadc drivers, and Jonathan Cameron suggested that I reach out to this list to see if any one here has any insight to my problem.
>  
> I'm using a BBB running a Debian Jessie build with the 3.14.40 ti kernel by Robert C. Nelson. I've got it hooked up to a touch screen and I would like to also be able to use some of the remaining adc channels.
>  
> As soon as I try to read any of the remaining channels the touch screen locks up. I've tried catting them from /sys/bus/iio/devices/iio:device0/in_voltageX_raw, using the generic_buffer program provided by the kernel, and using the Analog Devices libiio library. In all cases, I get the same results, adc values that look reasonable, but the touch screen stops responding.
>

Does the touchscreen freeze indefinitely or does it come back after ADC sampling
is stopped?
  
> I've asked on the TI support forum if they could help with this problem, but their response was that they only supported the TI SDK.
>  
> Can any of you tell me if the current iio subsystem will work correctly with the ti touch screen and adc drivers? 
>

I have been working on porting Linux to a device that uses the AM335x and have
noticed that the drivers has undergone many changes recently. I am now using 
a 4.0 kernel and am able to sample the ADC and use the touchscreen
simultaneously.

When sampling the ADC you will notice that the touchscreen is less responsive
but it does not freeze. The responsiveness comes back when ADC sampling stops.

One thing that I have noticed recently is that when using ts_calibrate or
ts_test the screen will register touch releases repeatedly without touching
the screen.

I have a workaround patch but have not attempted to push it upstream yet.

So it won't freeze the touchscreen completely after sampling ADCs but you
still may notice some quirks.

The best way to find out is building the new kernel and trying it out.

> 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

^ permalink raw reply	[flat|nested] 14+ messages in thread

* RE: BBB touch screen and ADC interactions
  2015-05-13  1:11 ` Michael Welling
@ 2015-05-14 17:00   ` Greg Wilson-Lindberg
  2015-05-19 23:30     ` Michael Welling
  0 siblings, 1 reply; 14+ messages in thread
From: Greg Wilson-Lindberg @ 2015-05-14 17:00 UTC (permalink / raw)
  To: Michael Welling; +Cc: linux-iio

Hi Michael,

Sorry for the slow response to this email, I'm fighting with our IT on an email filtering system that is not delivering linux-iio emails to me. 

> -----Original Message-----
> From: Michael Welling [mailto:mwelling79@gmail.com] On Behalf 
> Of Michael Welling
> Sent: Tuesday, May 12, 2015 6:12 PM
> To: Greg Wilson-Lindberg
> Cc: linux-iio@vger.kernel.org
> Subject: Re: BBB touch screen and ADC interactions
> 
> On Tue, May 12, 2015 at 04:23:43PM -0700, Greg Wilson-Lindberg wrote:
> > Hello all,
> > I've got a problem with the BeagleBone Black ti_am335x_tsc, 
> ti_am335x_adc & ti_am335x_tsadc drivers, and Jonathan Cameron 
> suggested that I reach out to this list to see if any one 
> here has any insight to my problem.
> >  
> > I'm using a BBB running a Debian Jessie build with the 
> 3.14.40 ti kernel by Robert C. Nelson. I've got it hooked up 
> to a touch screen and I would like to also be able to use 
> some of the remaining adc channels.
> >  
> > As soon as I try to read any of the remaining channels the 
> touch screen locks up. I've tried catting them from 
> /sys/bus/iio/devices/iio:device0/in_voltageX_raw, using the 
> generic_buffer program provided by the kernel, and using the 
> Analog Devices libiio library. In all cases, I get the same 
> results, adc values that look reasonable, but the touch 
> screen stops responding.
> >
> 
> Does the touchscreen freeze indefinitely or does it come back 
> after ADC sampling is stopped?

It is freezing indefinitely.
>   
> > I've asked on the TI support forum if they could help with 
> this problem, but their response was that they only supported 
> the TI SDK.
> >  
> > Can any of you tell me if the current iio subsystem will 
> work correctly with the ti touch screen and adc drivers? 
> >
> 
> I have been working on porting Linux to a device that uses 
> the AM335x and have noticed that the drivers has undergone 
> many changes recently. I am now using a 4.0 kernel and am 
> able to sample the ADC and use the touchscreen simultaneously.
> 
> When sampling the ADC you will notice that the touchscreen is 
> less responsive but it does not freeze. The responsiveness 
> comes back when ADC sampling stops.
> 
> One thing that I have noticed recently is that when using 
> ts_calibrate or ts_test the screen will register touch 
> releases repeatedly without touching the screen.
> 
> I have a workaround patch but have not attempted to push it 
> upstream yet.
> 
> So it won't freeze the touchscreen completely after sampling 
> ADCs but you still may notice some quirks.
> 
> The best way to find out is building the new kernel and trying it out.

I'll try out a new (4.0 - 4.1) kernel, but we are using QT to generate a GUI and I don't know if the graphics that we need have been ported to the mainline yet.  I guess I'll find out the hard way.

Thanks for the information,

Greg
> 
> > 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
> 
> 

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: BBB touch screen and ADC interactions
  2015-05-14 17:00   ` Greg Wilson-Lindberg
@ 2015-05-19 23:30     ` Michael Welling
  2015-05-19 23:56       ` Greg Wilson-Lindberg
  0 siblings, 1 reply; 14+ messages in thread
From: Michael Welling @ 2015-05-19 23:30 UTC (permalink / raw)
  To: Greg Wilson-Lindberg; +Cc: linux-iio

On Thu, May 14, 2015 at 10:00:14AM -0700, Greg Wilson-Lindberg wrote:
> 
> I'll try out a new (4.0 - 4.1) kernel, but we are using QT to generate a GUI and I don't know if the graphics that we need have been ported to the mainline yet.  I guess I'll find out the hard way.
>

Have you had any luck getting the new kernel to work?

I would like to know if you are experiencing the unexpected release events that
I experienced with the touchscreen.

-Michael
 
> Thanks for the information,
> 
> Greg

^ permalink raw reply	[flat|nested] 14+ messages in thread

* RE: BBB touch screen and ADC interactions
  2015-05-19 23:30     ` Michael Welling
@ 2015-05-19 23:56       ` Greg Wilson-Lindberg
  2015-05-20  0:13         ` mwelling
  0 siblings, 1 reply; 14+ messages in thread
From: Greg Wilson-Lindberg @ 2015-05-19 23:56 UTC (permalink / raw)
  To: Michael Welling; +Cc: linux-iio

Hi Michael,

> -----Original Message-----
> From: Michael Welling [mailto:mwelling79@gmail.com] On Behalf 
> Of Michael Welling
> Sent: Tuesday, May 19, 2015 4:30 PM
> To: Greg Wilson-Lindberg
> Cc: linux-iio@vger.kernel.org
> Subject: Re: BBB touch screen and ADC interactions
> 
> On Thu, May 14, 2015 at 10:00:14AM -0700, Greg Wilson-Lindberg wrote:
> > 
> > I'll try out a new (4.0 - 4.1) kernel, but we are using QT 
> to generate a GUI and I don't know if the graphics that we 
> need have been ported to the mainline yet.  I guess I'll find 
> out the hard way.
> >
> 
> Have you had any luck getting the new kernel to work?
> 
> I would like to know if you are experiencing the unexpected 
> release events that I experienced with the touchscreen.
> 

I just got  the 4.1 kernel working today. Our application is running just fine, so all of the QT stuff is working.

I found that when running my IIO ADC read program on the 4.1 kernel, not only do I lose the touch screen, but mouse clicks stop working, and the cursor periodically jumps.

I also figured out that I wasn't disabling the channels when my ADC program exited. When I got it to properly exit and disable the IIO ADC channels, the mouse started working again.

I then booted back to a 3.14 kernel and while the touch screen stops working while I am reading the ADC channels, the mouse still works normally, and the touch screen starts working again when the IIO program exits.

It appears, for me at least, that the 4.1 kernel is not an improvement.

I don't need fast reads on the ADC, I may be able to get away with enabling the ADC channels, reading some values, and disabling them again every once in a while.  I guess I'll have to try that.

- Greg

> -Michael
>  
> > Thanks for the information,
> > 
> > Greg
> 

^ permalink raw reply	[flat|nested] 14+ messages in thread

* RE: BBB touch screen and ADC interactions
  2015-05-19 23:56       ` Greg Wilson-Lindberg
@ 2015-05-20  0:13         ` mwelling
  2015-05-20  0:16           ` Greg Wilson-Lindberg
  0 siblings, 1 reply; 14+ messages in thread
From: mwelling @ 2015-05-20  0:13 UTC (permalink / raw)
  To: Greg Wilson-Lindberg; +Cc: linux-iio



On May 19, 2015 6:56:37 PM CDT, Greg Wilson-Lindberg <GWilson@sakuraus.com> wrote:
>Hi Michael,
>
>> -----Original Message-----
>> From: Michael Welling [mailto:mwelling79@gmail.com] On Behalf 
>> Of Michael Welling
>> Sent: Tuesday, May 19, 2015 4:30 PM
>> To: Greg Wilson-Lindberg
>> Cc: linux-iio@vger.kernel.org
>> Subject: Re: BBB touch screen and ADC interactions
>> 
>> On Thu, May 14, 2015 at 10:00:14AM -0700, Greg Wilson-Lindberg wrote:
>> > 
>> > I'll try out a new (4.0 - 4.1) kernel, but we are using QT 
>> to generate a GUI and I don't know if the graphics that we 
>> need have been ported to the mainline yet.  I guess I'll find 
>> out the hard way.
>> >
>> 
>> Have you had any luck getting the new kernel to work?
>> 
>> I would like to know if you are experiencing the unexpected 
>> release events that I experienced with the touchscreen.
>> 
>
>I just got  the 4.1 kernel working today. Our application is running
>just fine, so all of the QT stuff is working.
>
>I found that when running my IIO ADC read program on the 4.1 kernel,
>not only do I lose the touch screen, but mouse clicks stop working, and
>the cursor periodically jumps.

This seems to be the same issue that I was experiencing.

I can forward the workaround patch when I get back to my PC.

>
>I also figured out that I wasn't disabling the channels when my ADC
>program exited. When I got it to properly exit and disable the IIO ADC
>channels, the mouse started working again.
>
>I then booted back to a 3.14 kernel and while the touch screen stops
>working while I am reading the ADC channels, the mouse still works
>normally, and the touch screen starts working again when the IIO
>program exits.
>
>It appears, for me at least, that the 4.1 kernel is not an improvement.
>
>I don't need fast reads on the ADC, I may be able to get away with
>enabling the ADC channels, reading some values, and disabling them
>again every once in a while.  I guess I'll have to try that.

I have been working on a qt demo that reads the adc and displays a graph while the touchscreen is enabled. The workaround patch must be necessary. 

Would you like to the workaround patch?

We can make a formal patch if it works for you.

>
>- Greg
>
>> -Michael
>>  
>> > Thanks for the information,
>> > 
>> > Greg
>> 

-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* RE: BBB touch screen and ADC interactions
  2015-05-20  0:13         ` mwelling
@ 2015-05-20  0:16           ` Greg Wilson-Lindberg
  2015-05-20  0:34             ` Michael Welling
  0 siblings, 1 reply; 14+ messages in thread
From: Greg Wilson-Lindberg @ 2015-05-20  0:16 UTC (permalink / raw)
  To: mwelling; +Cc: linux-iio

Hi Michael,

> -----Original Message-----
> From: Michael Welling [mailto:mwelling79@gmail.com] On Behalf 
> Of mwelling@ieee.org
> Sent: Tuesday, May 19, 2015 5:14 PM
> To: Greg Wilson-Lindberg
> Cc: linux-iio@vger.kernel.org
> Subject: RE: BBB touch screen and ADC interactions
> 
> 
> 
> On May 19, 2015 6:56:37 PM CDT, Greg Wilson-Lindberg 
> <GWilson@sakuraus.com> wrote:
> >Hi Michael,
> >
> >> -----Original Message-----
> >> From: Michael Welling [mailto:mwelling79@gmail.com] On Behalf Of 
> >> Michael Welling
> >> Sent: Tuesday, May 19, 2015 4:30 PM
> >> To: Greg Wilson-Lindberg
> >> Cc: linux-iio@vger.kernel.org
> >> Subject: Re: BBB touch screen and ADC interactions
> >> 
> >> On Thu, May 14, 2015 at 10:00:14AM -0700, Greg 
> Wilson-Lindberg wrote:
> >> > 
> >> > I'll try out a new (4.0 - 4.1) kernel, but we are using QT
> >> to generate a GUI and I don't know if the graphics that we 
> need have 
> >> been ported to the mainline yet.  I guess I'll find out 
> the hard way.
> >> >
> >> 
> >> Have you had any luck getting the new kernel to work?
> >> 
> >> I would like to know if you are experiencing the unexpected 
> >> release events that I experienced with the touchscreen.
> >> 
> >
> >I just got  the 4.1 kernel working today. Our application is running
> >just fine, so all of the QT stuff is working.
> >
> >I found that when running my IIO ADC read program on the 4.1 kernel,
> >not only do I lose the touch screen, but mouse clicks stop 
> working, and
> >the cursor periodically jumps.
> 
> This seems to be the same issue that I was experiencing.
> 
> I can forward the workaround patch when I get back to my PC.
> 
> >
> >I also figured out that I wasn't disabling the channels when my ADC
> >program exited. When I got it to properly exit and disable 
> the IIO ADC
> >channels, the mouse started working again.
> >
> >I then booted back to a 3.14 kernel and while the touch screen stops
> >working while I am reading the ADC channels, the mouse still works
> >normally, and the touch screen starts working again when the IIO
> >program exits.
> >
> >It appears, for me at least, that the 4.1 kernel is not an 
> improvement.
> >
> >I don't need fast reads on the ADC, I may be able to get away with
> >enabling the ADC channels, reading some values, and disabling them
> >again every once in a while.  I guess I'll have to try that.
> 
> I have been working on a qt demo that reads the adc and 
> displays a graph while the touchscreen is enabled. The 
> workaround patch must be necessary. 
> 
> Would you like to the workaround patch?

I would be happy to test the patch, better than what I was going to try.

-Greg
> 
> We can make a formal patch if it works for you.
> 
> >
> >- Greg
> >
> >> -Michael
> >>  
> >> > Thanks for the information,
> >> > 
> >> > Greg
> >> 
> 
> -- 
> Sent from my Android device with K-9 Mail. Please excuse my brevity.
> 

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: BBB touch screen and ADC interactions
  2015-05-20  0:16           ` Greg Wilson-Lindberg
@ 2015-05-20  0:34             ` Michael Welling
  2015-05-20 21:54               ` Greg Wilson-Lindberg
  0 siblings, 1 reply; 14+ messages in thread
From: Michael Welling @ 2015-05-20  0:34 UTC (permalink / raw)
  To: Greg Wilson-Lindberg; +Cc: linux-iio

On Tue, May 19, 2015 at 05:16:46PM -0700, Greg Wilson-Lindberg wrote:
> 
> I would be happy to test the patch, better than what I was going to try.
> 
> -Greg

Below is the simple workaround patch that I used to eliminate the repeated
release events that were occurring without touching the screen.

See if it helps.

diff --git a/drivers/input/touchscreen/ti_am335x_tsc.c b/drivers/input/touchscreen/ti_am335x_tsc.c
index 191a1b8..f876097 100644
--- a/drivers/input/touchscreen/ti_am335x_tsc.c
+++ b/drivers/input/touchscreen/ti_am335x_tsc.c
@@ -281,13 +281,11 @@ static irqreturn_t titsc_irq(int irq, void *dev)
 	if (status & IRQENB_PENUP) {
 		fsm = titsc_readl(ts_dev, REG_ADCFSM);
 		if (fsm == ADCFSM_STEPID) {
-			ts_dev->pen_down = false;
 			input_report_key(input_dev, BTN_TOUCH, 0);
 			input_report_abs(input_dev, ABS_PRESSURE, 0);
 			input_sync(input_dev);
-		} else {
-			ts_dev->pen_down = true;
 		}
+		ts_dev->pen_down = false;
 		irqclr |= IRQENB_PENUP;
 	}
 

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* RE: BBB touch screen and ADC interactions
  2015-05-20  0:34             ` Michael Welling
@ 2015-05-20 21:54               ` Greg Wilson-Lindberg
  2015-05-20 22:14                 ` Michael Welling
  0 siblings, 1 reply; 14+ messages in thread
From: Greg Wilson-Lindberg @ 2015-05-20 21:54 UTC (permalink / raw)
  To: Michael Welling; +Cc: linux-iio

Hi Michael,
I've applied your patch and the mouse clicks now work mostly, and I even saw one touch screen click that worked.

I only need to read the ADC infrequently so I guess I'll set it up to enable when I need to read the ADC and then disable again.

Do you know if I can set up the context, device and channels and then just enable the channels, do the scan, and then disable the channels until I need them again, without tearing down the channels, device and context?

Regards,
Greg


> -----Original Message-----
> From: Michael Welling [mailto:mwelling79@gmail.com] On Behalf 
> Of Michael Welling
> Sent: Tuesday, May 19, 2015 5:35 PM
> To: Greg Wilson-Lindberg
> Cc: linux-iio@vger.kernel.org
> Subject: Re: BBB touch screen and ADC interactions
> 
> On Tue, May 19, 2015 at 05:16:46PM -0700, Greg Wilson-Lindberg wrote:
> > 
> > I would be happy to test the patch, better than what I was 
> going to try.
> > 
> > -Greg
> 
> Below is the simple workaround patch that I used to eliminate 
> the repeated release events that were occurring without 
> touching the screen.
> 
> See if it helps.
> 
> diff --git a/drivers/input/touchscreen/ti_am335x_tsc.c 
> b/drivers/input/touchscreen/ti_am335x_tsc.c
> index 191a1b8..f876097 100644
> --- a/drivers/input/touchscreen/ti_am335x_tsc.c
> +++ b/drivers/input/touchscreen/ti_am335x_tsc.c
> @@ -281,13 +281,11 @@ static irqreturn_t titsc_irq(int irq, void *dev)
>  	if (status & IRQENB_PENUP) {
>  		fsm = titsc_readl(ts_dev, REG_ADCFSM);
>  		if (fsm == ADCFSM_STEPID) {
> -			ts_dev->pen_down = false;
>  			input_report_key(input_dev, BTN_TOUCH, 0);
>  			input_report_abs(input_dev, ABS_PRESSURE, 0);
>  			input_sync(input_dev);
> -		} else {
> -			ts_dev->pen_down = true;
>  		}
> +		ts_dev->pen_down = false;
>  		irqclr |= IRQENB_PENUP;
>  	}
>  
> 

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: BBB touch screen and ADC interactions
  2015-05-20 21:54               ` Greg Wilson-Lindberg
@ 2015-05-20 22:14                 ` Michael Welling
  2015-05-20 22:41                   ` Greg Wilson-Lindberg
  0 siblings, 1 reply; 14+ messages in thread
From: Michael Welling @ 2015-05-20 22:14 UTC (permalink / raw)
  To: Greg Wilson-Lindberg; +Cc: linux-iio

On Wed, May 20, 2015 at 02:54:35PM -0700, Greg Wilson-Lindberg wrote:
> Hi Michael,
> I've applied your patch and the mouse clicks now work mostly, and I even saw one touch screen click that worked.
> 

This is not promising. Perhaps you are accessing the ADC to quickly for it to be available for the touchscreen.

> I only need to read the ADC infrequently so I guess I'll set it up to enable when I need to read the ADC and then disable again.
> 
> Do you know if I can set up the context, device and channels and then just enable the channels, do the scan, and then disable the channels until I need them again, without tearing down the channels, device and context?
>

I think you can just enable and disable the buffer.

To disable:
echo 0 > /sys/bus/iio/devices/iio:device0/buffer/disable
or
http://lxr.free-electrons.com/source/drivers/staging/iio/Documentation/generic_buffer.c#L337

To enable:
echo 1 > /sys/bus/iio/devices/iio:device0/buffer/enable
or
http://lxr.free-electrons.com/source/drivers/staging/iio/Documentation/generic_buffer.c#L280

> Regards,
> Greg
> 
> 
> > -----Original Message-----
> > From: Michael Welling [mailto:mwelling79@gmail.com] On Behalf 
> > Of Michael Welling
> > Sent: Tuesday, May 19, 2015 5:35 PM
> > To: Greg Wilson-Lindberg
> > Cc: linux-iio@vger.kernel.org
> > Subject: Re: BBB touch screen and ADC interactions
> > 
> > On Tue, May 19, 2015 at 05:16:46PM -0700, Greg Wilson-Lindberg wrote:
> > > 
> > > I would be happy to test the patch, better than what I was 
> > going to try.
> > > 
> > > -Greg
> > 
> > Below is the simple workaround patch that I used to eliminate 
> > the repeated release events that were occurring without 
> > touching the screen.
> > 
> > See if it helps.
> > 
> > diff --git a/drivers/input/touchscreen/ti_am335x_tsc.c 
> > b/drivers/input/touchscreen/ti_am335x_tsc.c
> > index 191a1b8..f876097 100644
> > --- a/drivers/input/touchscreen/ti_am335x_tsc.c
> > +++ b/drivers/input/touchscreen/ti_am335x_tsc.c
> > @@ -281,13 +281,11 @@ static irqreturn_t titsc_irq(int irq, void *dev)
> >  	if (status & IRQENB_PENUP) {
> >  		fsm = titsc_readl(ts_dev, REG_ADCFSM);
> >  		if (fsm == ADCFSM_STEPID) {
> > -			ts_dev->pen_down = false;
> >  			input_report_key(input_dev, BTN_TOUCH, 0);
> >  			input_report_abs(input_dev, ABS_PRESSURE, 0);
> >  			input_sync(input_dev);
> > -		} else {
> > -			ts_dev->pen_down = true;
> >  		}
> > +		ts_dev->pen_down = false;
> >  		irqclr |= IRQENB_PENUP;
> >  	}
> >  
> > 

^ permalink raw reply	[flat|nested] 14+ messages in thread

* RE: BBB touch screen and ADC interactions
  2015-05-20 22:14                 ` Michael Welling
@ 2015-05-20 22:41                   ` Greg Wilson-Lindberg
  2015-05-20 23:04                     ` Michael Welling
  0 siblings, 1 reply; 14+ messages in thread
From: Greg Wilson-Lindberg @ 2015-05-20 22:41 UTC (permalink / raw)
  To: Michael Welling; +Cc: linux-iio

Hi Michael, 

> -----Original Message-----
> From: Michael Welling [mailto:mwelling79@gmail.com] On Behalf 
> Of Michael Welling
> Sent: Wednesday, May 20, 2015 3:14 PM
> To: Greg Wilson-Lindberg
> Cc: linux-iio@vger.kernel.org
> Subject: Re: BBB touch screen and ADC interactions
> 
> On Wed, May 20, 2015 at 02:54:35PM -0700, Greg Wilson-Lindberg wrote:
> > Hi Michael,
> > I've applied your patch and the mouse clicks now work 
> mostly, and I even saw one touch screen click that worked.
> > 
> 
> This is not promising. Perhaps you are accessing the ADC to 
> quickly for it to be available for the touchscreen.

I'm setting up a buffer of 1024 elements, and I'm currently reading it every second in my test code. There isn't any way that I see of changing the update frequency, would using a smaller buffer decrease the update rate?

> 
> > I only need to read the ADC infrequently so I guess I'll 
> set it up to enable when I need to read the ADC and then 
> disable again.
> > 
> > Do you know if I can set up the context, device and 
> channels and then just enable the channels, do the scan, and 
> then disable the channels until I need them again, without 
> tearing down the channels, device and context?
> >
> 
> I think you can just enable and disable the buffer.
> 
> To disable:
> echo 0 > /sys/bus/iio/devices/iio:device0/buffer/disable
> or
> http://lxr.free-electrons.com/source/drivers/staging/iio/Docum
entation/generic_buffer.c#L337
> 
> To enable:
> echo 1 > /sys/bus/iio/devices/iio:device0/buffer/enable
> or
> http://lxr.free-electrons.com/source/drivers/staging/iio/Docum
entation/generic_buffer.c#L280

I'll try this and see if it works.

-Greg
> 
> > Regards,
> > Greg
> > 
> > 
> > > -----Original Message-----
> > > From: Michael Welling [mailto:mwelling79@gmail.com] On Behalf Of 
> > > Michael Welling
> > > Sent: Tuesday, May 19, 2015 5:35 PM
> > > To: Greg Wilson-Lindberg
> > > Cc: linux-iio@vger.kernel.org
> > > Subject: Re: BBB touch screen and ADC interactions
> > > 
> > > On Tue, May 19, 2015 at 05:16:46PM -0700, Greg 
> Wilson-Lindberg wrote:
> > > > 
> > > > I would be happy to test the patch, better than what I was
> > > going to try.
> > > > 
> > > > -Greg
> > > 
> > > Below is the simple workaround patch that I used to eliminate the 
> > > repeated release events that were occurring without touching the 
> > > screen.
> > > 
> > > See if it helps.
> > > 
> > > diff --git a/drivers/input/touchscreen/ti_am335x_tsc.c
> > > b/drivers/input/touchscreen/ti_am335x_tsc.c
> > > index 191a1b8..f876097 100644
> > > --- a/drivers/input/touchscreen/ti_am335x_tsc.c
> > > +++ b/drivers/input/touchscreen/ti_am335x_tsc.c
> > > @@ -281,13 +281,11 @@ static irqreturn_t titsc_irq(int 
> irq, void *dev)
> > >  	if (status & IRQENB_PENUP) {
> > >  		fsm = titsc_readl(ts_dev, REG_ADCFSM);
> > >  		if (fsm == ADCFSM_STEPID) {
> > > -			ts_dev->pen_down = false;
> > >  			input_report_key(input_dev, BTN_TOUCH, 0);
> > >  			input_report_abs(input_dev, ABS_PRESSURE, 0);
> > >  			input_sync(input_dev);
> > > -		} else {
> > > -			ts_dev->pen_down = true;
> > >  		}
> > > +		ts_dev->pen_down = false;
> > >  		irqclr |= IRQENB_PENUP;
> > >  	}
> > >  
> > > 
> 

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: BBB touch screen and ADC interactions
  2015-05-20 22:41                   ` Greg Wilson-Lindberg
@ 2015-05-20 23:04                     ` Michael Welling
  2015-05-26 17:42                       ` Michael Welling
  0 siblings, 1 reply; 14+ messages in thread
From: Michael Welling @ 2015-05-20 23:04 UTC (permalink / raw)
  To: Greg Wilson-Lindberg; +Cc: linux-iio

On Wed, May 20, 2015 at 03:41:03PM -0700, Greg Wilson-Lindberg wrote:
> Hi Michael, 
> 
> > -----Original Message-----
> > From: Michael Welling [mailto:mwelling79@gmail.com] On Behalf 
> > Of Michael Welling
> > Sent: Wednesday, May 20, 2015 3:14 PM
> > To: Greg Wilson-Lindberg
> > Cc: linux-iio@vger.kernel.org
> > Subject: Re: BBB touch screen and ADC interactions
> > 
> > On Wed, May 20, 2015 at 02:54:35PM -0700, Greg Wilson-Lindberg wrote:
> > > Hi Michael,
> > > I've applied your patch and the mouse clicks now work 
> > mostly, and I even saw one touch screen click that worked.
> > > 
> > 
> > This is not promising. Perhaps you are accessing the ADC to 
> > quickly for it to be available for the touchscreen.
> 
> I'm setting up a buffer of 1024 elements, and I'm currently reading it every second in my test code. There isn't any way that I see of changing the update frequency, would using a smaller buffer decrease the update rate?
>

The buffer size does not effect the frequency the trigger does.
 
> > 
> > > I only need to read the ADC infrequently so I guess I'll 
> > set it up to enable when I need to read the ADC and then 
> > disable again.
> > > 
> > > Do you know if I can set up the context, device and 
> > channels and then just enable the channels, do the scan, and 
> > then disable the channels until I need them again, without 
> > tearing down the channels, device and context?
> > >
> > 
> > I think you can just enable and disable the buffer.
> > 
> > To disable:
> > echo 0 > /sys/bus/iio/devices/iio:device0/buffer/disable

It should be /sys/bus/iio/devices/iio:device0/buffer/enable above.

Sorry about that.

> > or
> > http://lxr.free-electrons.com/source/drivers/staging/iio/Docum
> entation/generic_buffer.c#L337
> > 
> > To enable:
> > echo 1 > /sys/bus/iio/devices/iio:device0/buffer/enable
> > or
> > http://lxr.free-electrons.com/source/drivers/staging/iio/Docum
> entation/generic_buffer.c#L280
> 
> I'll try this and see if it works.

It should.

> 
> -Greg
> > 
> > > Regards,
> > > Greg
> > > 
> > > 
> > > > -----Original Message-----
> > > > From: Michael Welling [mailto:mwelling79@gmail.com] On Behalf Of 
> > > > Michael Welling
> > > > Sent: Tuesday, May 19, 2015 5:35 PM
> > > > To: Greg Wilson-Lindberg
> > > > Cc: linux-iio@vger.kernel.org
> > > > Subject: Re: BBB touch screen and ADC interactions
> > > > 
> > > > On Tue, May 19, 2015 at 05:16:46PM -0700, Greg 
> > Wilson-Lindberg wrote:
> > > > > 
> > > > > I would be happy to test the patch, better than what I was
> > > > going to try.
> > > > > 
> > > > > -Greg
> > > > 
> > > > Below is the simple workaround patch that I used to eliminate the 
> > > > repeated release events that were occurring without touching the 
> > > > screen.
> > > > 
> > > > See if it helps.
> > > > 
> > > > diff --git a/drivers/input/touchscreen/ti_am335x_tsc.c
> > > > b/drivers/input/touchscreen/ti_am335x_tsc.c
> > > > index 191a1b8..f876097 100644
> > > > --- a/drivers/input/touchscreen/ti_am335x_tsc.c
> > > > +++ b/drivers/input/touchscreen/ti_am335x_tsc.c
> > > > @@ -281,13 +281,11 @@ static irqreturn_t titsc_irq(int 
> > irq, void *dev)
> > > >  	if (status & IRQENB_PENUP) {
> > > >  		fsm = titsc_readl(ts_dev, REG_ADCFSM);
> > > >  		if (fsm == ADCFSM_STEPID) {
> > > > -			ts_dev->pen_down = false;
> > > >  			input_report_key(input_dev, BTN_TOUCH, 0);
> > > >  			input_report_abs(input_dev, ABS_PRESSURE, 0);
> > > >  			input_sync(input_dev);
> > > > -		} else {
> > > > -			ts_dev->pen_down = true;
> > > >  		}
> > > > +		ts_dev->pen_down = false;
> > > >  		irqclr |= IRQENB_PENUP;
> > > >  	}
> > > >  
> > > > 
> > 

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: BBB touch screen and ADC interactions
  2015-05-20 23:04                     ` Michael Welling
@ 2015-05-26 17:42                       ` Michael Welling
  2015-05-26 18:04                         ` Greg Wilson-Lindberg
  0 siblings, 1 reply; 14+ messages in thread
From: Michael Welling @ 2015-05-26 17:42 UTC (permalink / raw)
  To: Greg Wilson-Lindberg; +Cc: linux-iio

On Wed, May 20, 2015 at 06:04:09PM -0500, Michael Welling wrote:

> It should.

Greg,

Have you had any success using the buffer enable/disable mechanism?

Regards,

Michael

^ permalink raw reply	[flat|nested] 14+ messages in thread

* RE: BBB touch screen and ADC interactions
  2015-05-26 17:42                       ` Michael Welling
@ 2015-05-26 18:04                         ` Greg Wilson-Lindberg
  0 siblings, 0 replies; 14+ messages in thread
From: Greg Wilson-Lindberg @ 2015-05-26 18:04 UTC (permalink / raw)
  To: Michael Welling; +Cc: linux-iio

> > It should.
> 
> Greg,
> 
> Have you had any success using the buffer enable/disable mechanism?
> 
Hi Michael,
Yes, it seems to be working, even with the 3.14 kernel. I've been fighting some hardware problems on our prototype so I haven't been able to test it as well as I would like.

Regards,
Greg 

> Regards,
> 
> Michael
> 

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2015-05-26 18:05 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-12 23:23 BBB touch screen and ADC interactions Greg Wilson-Lindberg
2015-05-13  1:11 ` Michael Welling
2015-05-14 17:00   ` Greg Wilson-Lindberg
2015-05-19 23:30     ` Michael Welling
2015-05-19 23:56       ` Greg Wilson-Lindberg
2015-05-20  0:13         ` mwelling
2015-05-20  0:16           ` Greg Wilson-Lindberg
2015-05-20  0:34             ` Michael Welling
2015-05-20 21:54               ` Greg Wilson-Lindberg
2015-05-20 22:14                 ` Michael Welling
2015-05-20 22:41                   ` Greg Wilson-Lindberg
2015-05-20 23:04                     ` Michael Welling
2015-05-26 17:42                       ` Michael Welling
2015-05-26 18:04                         ` Greg Wilson-Lindberg

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.