Skip to contentSkip to conversation

input/touchscreen: add S3C24XX SoC touchscreen input driver

PATCH New Maurus Cuelenaere 8 participants 11 messages Oct 19, 2009 – Oct 23, 2009 1 message not in the archive HID

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): mailman.4020.1255949705.2256.linux-arm-kernel@lists.infradead.org

#1 lore raw

PATCH 1/1 input/touchscreen: add S3C24XX SoC touchscreen input driver

Op 19-10-09 12:55, linux-arm-kernel-request at lists.infradead.org schreef:

Quoted 7 lines

This touchscreen driver is for touchscreen controller on Samsung S3C2410/S3C2440 SoC chip. S3C2410/S3C2440 has the on chip touchscreen controller based on it's analog to digital converter(8-channel analog inputs, touchscreen uses 4 of them). This driver uses the exsiting S3C ADC driver to make the touchscreen controller of S3C2410/S3C2440 work well together with other ADC devices connected to the S3C24XX SoC chip.

Quoted 7 lines

The patch is created against kernel 2.6.32-rc4 and tested with S3C2440 SoC and Samsung LTE430WQ-F0C touchscreen.

Do you know that there's another patch (at Openmoko) created by Nelson Castillo that does the same, but also has support for kernel-space touchscreen filters? (I think [1] is his latest version)
I don't know how your patch performs, but according to [2] the filters should help a lot avoiding jitter etc.

I'm not sure whether Nelson has submitted his patches for mainline review yet and what the status is on the kernel filters, but IMHO doing some filtering in kernel space (see the "Why are we doing filtering in kernel space?" part of [2]) which results in a "cleaner" output is preferred over reporting possible "jittery" data.

Regards,
Maurus Cuelenaere

[1]
http://nelson-patches.googlecode.com/svn/trunk/openmoko/kernel/ts-with-s3c-adc/
[2] http://wiki.openmoko.org/wiki/Touchscreen_Filters

#2 lore raw

PATCH 1/1 input/touchscreen: add S3C24XX SoC touchscreen input driver

Quoted 11 lines · Maurus Cuelenaere

Do you know that there's another patch (at Openmoko) created by Nelson Castillo that does the same, but also has support for kernel-space touchscreen filters? (I think [1] is his latest version)
I don't know how your patch performs, but according to [2] the filters should help a lot avoiding jitter etc.

I'm not sure whether Nelson has submitted his patches for mainline review yet and what the status is on the kernel filters, but IMHO doing some filtering in kernel space (see the "Why are we doing filtering in kernel space?" part of [2]) which results in a "cleaner" output is preferred over reporting possible "jittery" data.

It doesn't really describe why doing the filtering in kernel space is apparantly soo much better than doing it in tslib - it's seems to just do some handwaving kind of argument:

Let's say we would like to deliver a TS event to user space each 10 milliseconds. In the GTA02 with the current configuration the Analog/Digital conversion time of a sample is 0.4697 milliseconds, thus can get 18 samples for each event that we send to user-space. Sending the event (with 18 samples) takes us about 8.45 milliseconds.

So far so good. But, according to my maths, 8.45ms is less than 10ms.

Sometimes we
even decide that the event should not be sent to user-space (because the hardware didn't provide reliable data), and our tests show that it's the right thing to do. In previous versions of the driver light taps would confuse the driver (that would report bad clicks) and this is no longer an issue.

Err, that doesn't seem to follow on from the previous point.

The reason that we decided raw events should be passed to userspace and the processing done there is that it allows all of the _policy_ of deciding how to process touchscreen events to be configured. There's lots of different parameters and ways to filter touchscreens, and some are specific to individual touchscreen setups.

This is why tslib is entirely modular, and allows any combination of modules to be loaded to process the touchscreen samples - it's there to provide a totally flexible infrastructure to filter and scale the output from the touchscreen in whatever way is required for the hardware.

I don't think there is any single filtering system which can properly filter the output of any one touchscreen, and I don't think that putting this filtering in the kernel is a sane approach. It _may_ be a sane approach for one particular touchscreen setup, but it certainly isn't for all.

#3 lore raw

PATCH 1/1 input/touchscreen: add S3C24XX SoC touchscreen input driver

Quoted 11 lines · Russell King - ARM Linux
Quoted 10 lines · Maurus Cuelenaere

Do you know that there's another patch (at Openmoko) created by Nelson Castillo that does the same, but also has support for kernel-space touchscreen filters? (I think [1] is his latest version)
I don't know how your patch performs, but according to [2] the filters should help a lot avoiding jitter etc.
I'm not sure whether Nelson has submitted his patches for mainline review yet and what the status is on the kernel filters, but IMHO doing some filtering in kernel space (see the "Why are we doing filtering in kernel space?" part of [2]) which results in a "cleaner" output is preferred over reporting possible "jittery" data.

I did submit the filter stuff once and I applied ALL the upstream feedback we got from Andrew M.

Quoted 3 lines

It doesn't really describe why doing the filtering in kernel space is apparantly soo much better than doing it in tslib - it's seems to just do some handwaving kind of argument:

Some drivers do some kind of filtering. Even the other one for this chip submitted to linux-arm-kernel a few days ago.

Quoted 7 lines

? Let's say we would like to deliver a TS event to user space each 10 ? milliseconds. In the GTA02 with the current configuration the ? Analog/Digital conversion time of a sample is 0.4697 milliseconds, thus ? can get 18 samples for each event that we send to user-space. Sending the ? event (with 18 samples) takes us about 8.45 milliseconds.

So far so good. ?But, according to my maths, 8.45ms is less than 10ms.

In practice the event is generated each 10ms because of the jiffies resolution and the use of a timer but this might not be true if someone uses the filters with a different driver/configuration.

Quoted 7 lines

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? Sometimes we ? even decide that the event should not be sent to user-space (because the ? hardware didn't provide reliable data), and our tests show that it's the ? right thing to do. In previous versions of the driver light taps would ? confuse the driver (that would report bad clicks) and this is no longer an ? issue.

Quoted 7 lines

Err, that doesn't seem to follow on from the previous point.

The reason that we decided raw events should be passed to userspace and the processing done there is that it allows all of the _policy_ of deciding how to process touchscreen events to be configured. ?There's lots of different parameters and ways to filter touchscreens, and some are specific to individual touchscreen setups.

Yes, ignoring the event might not be the best thing to do if this is a policy.

"Giving up" could be implemented as sending a point of bad quality instead of ignoring the event. It's better to implement "I give up trying to get a better point for you" instead of "I driver decide you should never know someone touched the screen because it was all noise".

Quoted 5 lines

This is why tslib is entirely modular, and allows any combination of modules to be loaded to process the touchscreen samples - it's there to provide a totally flexible infrastructure to filter and scale the output from the touchscreen in whatever way is required for the hardware.

There is one case where "whatever way" fails here. If you get a set of points and you notice they have noise you can schedule more conversions _right_away_ without latency to get new points from the ADC. That's what the "group filter" does and you can not do that from tslib and I say it after learning how to write tslib filters.

Most people who hear about the filters blindly say "this should be done in user-space" without considering this fact.

Quoted 5 lines

I don't think there is any single filtering system which can properly filter the output of any one touchscreen, and I don't think that putting this filtering in the kernel is a sane approach. ?It _may_ be a sane approach for one particular touchscreen setup, but it certainly isn't for all.

I've found the filters to be useful and I would like to see them upstream but not if people don't find them to be useful.

#4 lore raw

PATCH 1/1 input/touchscreen: add S3C24XX SoC touchscreen input driver

Quoted 5 lines · Nelson Castillo

There is one case where "whatever way" fails here. If you get a set of points and you notice they have noise you can schedule more conversions _right_away_ without latency to get new points from the ADC. That's what the "group filter" does and you can not do that from tslib and I say it after learning how to write tslib filters.

In which case people aren't implementing their kernel drivers correctly. The kernel is supposed to produce a stream of samples when the pen is touched, and those samples should be delivered to tslib. tslib's filters then has the responsibility to read groups of samples, and filter them using whatever method that the user wants.

I also don't buy your comparison on your web page since there's almost zero details of what you're comparing. You don't give details of what filters you're using with the userspace method - for all the reader knows, you're not using tslib at all.

Quoted 2 lines

Most people who hear about the filters blindly say "this should be done in user-space" without considering this fact.

I'm the original author of tslib. Don't think for a moment that I haven't any experience in this area.

#5 lore raw

PATCH 1/1 input/touchscreen: add S3C24XX SoC touchscreen input driver

Quoted 7 lines · Russell King - ARM Linux
Quoted 5 lines · Nelson Castillo

There is one case where "whatever way" fails here. If you get a set of points and you notice they have noise you can schedule more conversions _right_away_ without latency to get new points from the ADC. That's what the "group filter" does and you can not do that from tslib and I say it after learning how to write tslib filters.

Quoted 5 lines

In which case people aren't implementing their kernel drivers correctly. The kernel is supposed to produce a stream of samples when the pen is touched, and those samples should be delivered to tslib. ?tslib's filters then has the responsibility to read groups of samples, and filter them using whatever method that the user wants.

The group filter (that mixes information from X and Y) could be ported to user-space but we would need points at a much higher rate.

Can the s3c driver send the events at full speed? (Maximum possible ADC rate?).

Even if it's possible I think we would monopolize the adc driver needlessly because we don't need all that conversions when there is not much noise. Please read on.

Quoted 4 lines

I also don't buy your comparison on your web page since there's almost zero details of what you're comparing. ?You don't give details of what filters you're using with the userspace method - for all the reader knows, you're not using tslib at all.

Blame lack of time.

Most of the time tslib filtering worked well when we have good pressure.

We have problems when we don't have much pressure and in this case there is a lot of noise and the events that are reported by the driver are actually noise. This noise would be more common at pen-down before the adc readings settle and at pen-up.

This is the noise we filtered in most cases.

I remember I wrote a tslib filter to skip the N first and the M last points but it was not enough.

http://svn.arhuaco.org/svn/src/openmoko/touchscreen/tslib-skip_module.patch

I should report some data here so that you can see how bad the noise problem is. It might be a hardware problem. I've heard of other boards that also have a lot of noise.

I did read this message last month in tslib:

https://lists.berlios.de/pipermail/tslib-general/2009-September/000228.html

I've taken the tack that we when we use the resistive sensors we have to take sloppy positioning and mis-clicks into the user interface design.

Really? We managed to fix a similar problem. Perhaps it can also be fixed with tslib but we tried and we could not. This was the last message in the thread so I took it as a conclusion.

Quoted 5 lines
Quoted 2 lines

Most people who hear about the filters blindly say "this should be done in user-space" without considering this fact.

I'm the original author of tslib. ?Don't think for a moment that I haven't any experience in this area.

I already knew, and I know, I know :-)

Perhaps I need to replace talk with data but I don't really feel like doing it now. I could do it later.

If everyone solves the noise problem in resistive touchscreens with tslib then there is no need for in-kernel filtering. But then I see the reply I quoted from the tslib ML where it is stated that one has to learn to live with the "sloppy positioning and mis-clicks". I don't think this is acceptable if there is a solution.

As you wrote before it will not work in all cases, but I've seen it's working for a few s3c-based projects.

#6 lore raw

PATCH 1/1 input/touchscreen: add S3C24XX SoC touchscreen input driver

Quoted 5 lines · Nelson Castillo

Can the s3c driver send the events at full speed? (Maximum possible ADC rate?).

Even if it's possible I think we would monopolize the adc driver needlessly because we don't need all that conversions when there is not much noise. Please read on.

There's currently no facility to push sample rate requests down into the kernel from userspace. However, this is a good idea in general - there was some recent (brief) discussion of doing this on the linux-input list. Since different use cases have different sample rate requirements (such as the difference between handwriting recognition which can need 200 samples/second and a simple finger operated menu which may be happy with
10) there's value in being able to vary the sample rate at run time. I was intending to look at this shortly as part of some touchscreen driver development I need to do soon or perhaps someone else will pick up the idea, if it does get implemented then obviously tslib would also be able to use it here.

#7 lore raw

PATCH 1/1 input/touchscreen: add S3C24XX SoC touchscreen input driver

Quoted 3 lines · Mark Brown
Quoted 1 line · Nelson Castillo

Can the s3c driver send the events at full speed? (Maximum possible ADC rate?).

Yes, but in packets I think (The way I would know how to implement it). We could try sending 2000 events per second to user-space and see what happens :-) :-)

Quoted 7 lines
Quoted 3 lines

Even if it's possible I think we would monopolize the adc driver needlessly because we don't need all that conversions when there is not much noise. Please read on.

There's currently no facility to push sample rate requests down into the kernel from userspace. ?However, this is a good idea in general - there was some recent (brief) discussion of doing this on the linux-input list.

I see. It makes sense.

ATM one big difference with the kernel approach is that in the kernel you can request the adc conversions on demand.

Quoted 8 lines

Since different use cases have different sample rate requirements (such as the difference between handwriting recognition which can need 200 samples/second and a simple finger operated menu which may be happy with
10) there's value in being able to vary the sample rate at run time. ?I was intending to look at this shortly as part of some touchscreen driver development I need to do soon or perhaps someone else will pick up the idea, if it does get implemented then obviously tslib would also be able to use it here.

With a lot more points you can indeed do better filtering in users-pace.

#8 lore raw

PATCH 1/1 input/touchscreen: add S3C24XX SoC touchscreen input driver

In reply to Nelson Castillo
Quoted 4 lines · Somebody in the thread at some point

We have problems when we don't have much pressure and in this case there is a lot of noise and the events that are reported by the driver are actually noise. This noise would be more common at pen-down before the adc readings settle and at pen-up.

Hi Nelson -

Just a FYI, on the board I have been working on there is a capacitive sensor, AD7174. I wrote a driver for it which again uses the in-kernel median filter (the original Openmoko version I wrote chopped out at the moment) heavily and with really excellent results. The median filters are pretty much like magic for certain common kinds of noise.

However, I just drop the median filter code into my tree in drivers/input/misc at the moment. What would be really a good result I think is if the filters turned up in ./lib in an easily reusable way.

I think maybe it's a mistake to focus on the in-kernel filters being good for a particular touchscreen technology or even specifically touchscreens. I am sure other drivers doing something completely different with noisy instantaneously sampled data, that won't fit into tslib worldview at all, can also benefit from being able to clean up data in a standardized way before passing it down as an input event or back to the device or whatever. And once that's possible, touchscreen drivers of any sort have the standardized option to use it too if they have a reason.

Just a thought, good luck :-)

-Andy

#9 lore raw

PATCH 1/1 input/touchscreen: add S3C24XX SoC touchscreen input driver

In reply to Maurus Cuelenaere
Quoted 11 lines · Maurus Cuelenaere

Do you know that there's another patch (at Openmoko) created by Nelson Castillo that does the same, but also has support for kernel-space touchscreen filters? (I think [1] is his latest version)
I don't know how your patch performs, but according to [2] the filters should help a lot avoiding jitter etc.

I'm not sure whether Nelson has submitted his patches for mainline review yet and what the status is on the kernel filters, but IMHO doing some filtering in kernel space (see the "Why are we doing filtering in kernel space?" part of [2]) which results in a "cleaner" output is preferred over reporting possible "jittery" data.

Yes, I do, because part of my patch comes from source code of openmoko project. I've also noticed there's 4 touchscreen filters in the openmoko project used by s3c24xx touchscreen driver.

I think there should be a s3c24xx touchscreen driver in the mailine, but I haven't found anyone submitted a s3c24xx touchscreen driver for the mainline. So I wrote the driver myself and refered the openmoko implementation.

I didn't use the kernel-space touchscreen filters, because I found tslib is able to meet the common requirement.

I have read the mail of Russell King. I think we may add the s3c24xx ts driver first, and the kernel-space touchscreen filters can be added later if most of us think it is valuable or usefull. After all, I don't think there is anyone like the mailine without s3c24xx ts driver support.

Cheers,

Shine Liu

#10 lore raw

PATCH 1/1 input/touchscreen: add S3C24XX SoC touchscreen input driver

Shine Liu <[email protected]> writes:

Hi,

Quoted 14 lines · Maurus Cuelenaere
Quoted 7 lines

Do you know that there's another patch (at Openmoko) created by Nelson Castillo that does the same, but also has support for kernel-space touchscreen filters? (I think [1] is his latest version)
I don't know how your patch performs, but according to [2] the filters should help a lot avoiding jitter etc.

Quoted 5 lines

I'm not sure whether Nelson has submitted his patches for mainline review yet and what the status is on the kernel filters, but IMHO doing some filtering in kernel space (see the "Why are we doing filtering in kernel space?" part of [2]) which results in a "cleaner" output is preferred over reporting possible "jittery" data.

Quoted 8 lines

Yes, I do, because part of my patch comes from source code of openmoko project. I've also noticed there's 4 touchscreen filters in the openmoko project used by s3c24xx touchscreen driver.

I think there should be a s3c24xx touchscreen driver in the mailine, but I haven't found anyone submitted a s3c24xx touchscreen driver for the mainline. So I wrote the driver myself and refered the openmoko implementation.

Please have a look at the arm-kernel mailing list archive. There has been some discussion about that. The idea was to compare between the openmoko's version and Simtec's version and choose the best version. Both are coming from the h1940 tree (fwiw written by me and it would have been nice to tell in your header you've taken the code from openmoko's tree) and both have been updated to take into account the adc support given by arch/arm/plat-s3c24xx/adc.c.

As regards why there's no driver yet, there's a reason. The adc stuff didn't exist when the driver was written and it was not a good idea to merge it because enabling it was meaning no hwmon support. Same problem if the hwmon support was enabled, no touchscreen support. So, it was decided to wait for a proper adc support. Now that Ben wrote it, it's time to discuss about merging it.

So, please have a look at the driver which was posted by Ben some days ago and comments/reply to his mail if you have problem with his version. The driver has been in Simtec's patchset since quite a long time so I tend to believe that this one is working nicely.

Thanks,
Arnaud

#11 lore raw

PATCH 1/1 input/touchscreen: add S3C24XX SoC touchscreen input driver

In reply to Maurus Cuelenaere
Quoted 21 lines · Maurus Cuelenaere

Op 19-10-09 12:55, linux-arm-kernel-request at lists.infradead.org schreef:

Quoted 7 lines

This touchscreen driver is for touchscreen controller on Samsung S3C2410/S3C2440 SoC chip. S3C2410/S3C2440 has the on chip touchscreen controller based on it's analog to digital converter(8-channel analog inputs, touchscreen uses 4 of them). This driver uses the exsiting S3C ADC driver to make the touchscreen controller of S3C2410/S3C2440 work well together with other ADC devices connected to the S3C24XX SoC chip.

Quoted 6 lines

The patch is created against kernel 2.6.32-rc4 and tested with S3C2440 SoC and Samsung LTE430WQ-F0C touchscreen.

Do you know that there's another patch (at Openmoko) created by Nelson Castillo that does the same, but also has support for kernel-space touchscreen filters? (I think [1] is his latest version)
I don't know how your patch performs, but according to [2] the filters should help a lot avoiding jitter etc.

Quoted 5 lines

I'm not sure whether Nelson has submitted his patches for mainline review yet and what the status is on the kernel filters, but IMHO doing some filtering in kernel space (see the "Why are we doing filtering in kernel space?" part of [2]) which results in a "cleaner" output is preferred over reporting possible "jittery" data.

Filtering can be done perfectly in userland (like all the other ts do). IMHO I can't see any need to do it in kernel space.

jbe

Signature · 4 lines
Pengutronix e.K.                              | Juergen Beisert             |
Linux Solutions for Science and Industry      | Phone: +49-8766-939 228     |
Vertretung Sued/Muenchen, Germany             | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686              | http://www.pengutronix.de/  |