public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Convert touchscreen to input_allocate_device
@ 2005-12-04 15:52 Dirk Behme
  0 siblings, 0 replies; 12+ messages in thread
From: Dirk Behme @ 2005-12-04 15:52 UTC (permalink / raw)
  To: linux-omap-open-source

[-- Attachment #1: Type: text/plain, Size: 427 bytes --]

ARM: OMAP: Convert touchscreen to input_allocate_device() to remove:

input: device omap_ts is statically allocated, will not register
Please convert to input_allocate_device() or contact dtor_core@ameritech.net

ARM: OMAP: Check in omap_ts_handler() if timer is still running. Delete
it if necessary. Else we will get Oops "kernel BUG at
include/linux/timer.h:83!"

Signed-off-by: Dirk Behme <dirk.behme_at_de.bosch.com>






[-- Attachment #2: touchscreen_input_allocate_device.patch --]
[-- Type: text/plain, Size: 3799 bytes --]

--- ./drivers/input/touchscreen/omap/omap_ts.c_orig	2005-12-02 17:41:07.000000000 +0100
+++ ./drivers/input/touchscreen/omap/omap_ts.c	2005-12-02 18:11:32.000000000 +0100
@@ -65,10 +65,10 @@ static int omap_ts_read(void)
 
 	ts_omap.dev->read(data);
 
-	input_report_abs(&(ts_omap.inputdevice), ABS_X, data[0]);
-	input_report_abs(&(ts_omap.inputdevice), ABS_Y, data[1]);
-	input_report_abs(&(ts_omap.inputdevice), ABS_PRESSURE, data[2]);
-	input_sync(&(ts_omap.inputdevice));
+	input_report_abs(ts_omap.inputdevice, ABS_X, data[0]);
+	input_report_abs(ts_omap.inputdevice, ABS_Y, data[1]);
+	input_report_abs(ts_omap.inputdevice, ABS_PRESSURE, data[2]);
+	input_sync(ts_omap.inputdevice);
 
 	DEBUG_TS("omap_ts_read: read x=%d,y=%d,p=%d\n", data[0], data[1],
 		 data[2]);
@@ -85,7 +85,7 @@ static void omap_ts_timer(unsigned long 
 	if (!ts_omap.dev->penup()) {
 		if (!ts_omap.touched) {
 			DEBUG_TS("omap_ts_timer: pen down\n");
-			input_report_key(&(ts_omap.inputdevice), BTN_TOUCH, 1);
+			input_report_key(ts_omap.inputdevice, BTN_TOUCH, 1);
 		}
 		ts_omap.touched = 1;
 		omap_ts_read();
@@ -95,12 +95,12 @@ static void omap_ts_timer(unsigned long 
 		if (ts_omap.touched) {
 			DEBUG_TS("omap_ts_timer: pen up\n");
 			ts_omap.touched = 0;
-			input_report_abs(&(ts_omap.inputdevice), ABS_X, 0);
-			input_report_abs(&(ts_omap.inputdevice), ABS_Y, 0);
-			input_report_abs(&(ts_omap.inputdevice), ABS_PRESSURE,
+			input_report_abs(ts_omap.inputdevice, ABS_X, 0);
+			input_report_abs(ts_omap.inputdevice, ABS_Y, 0);
+			input_report_abs(ts_omap.inputdevice, ABS_PRESSURE,
 					 0);
-			input_sync(&(ts_omap.inputdevice));
-			input_report_key(&(ts_omap.inputdevice), BTN_TOUCH, 0);
+			input_sync(ts_omap.inputdevice);
+			input_report_key(ts_omap.inputdevice, BTN_TOUCH, 0);
 		}
 		if (!ts_omap.irq_enabled) {
 			ts_omap.irq_enabled = 1;
@@ -119,7 +119,10 @@ static irqreturn_t omap_ts_handler(int i
 		ts_omap.irq_enabled = 0;
 		disable_irq(irq);
 	}
-	// restart acquire
+	// check for still pending timer, delete it if neccessary
+        if(timer_pending(&(ts_omap.ts_timer)))
+		del_timer(&(ts_omap.ts_timer));
+        // restart acquire
 	ts_omap.ts_timer.expires = jiffies + HZ / 100;
 	add_timer(&(ts_omap.ts_timer));
 
@@ -168,14 +171,14 @@ static int __init omap_ts_probe(struct p
 		return -EINVAL;
 	}
 
-	init_input_dev(&(ts_omap.inputdevice));
-	ts_omap.inputdevice.name = OMAP_TS_NAME;
-	ts_omap.inputdevice.dev = &pdev->dev;
-	ts_omap.inputdevice.evbit[0] = BIT(EV_KEY) | BIT(EV_ABS);
-	ts_omap.inputdevice.keybit[LONG(BTN_TOUCH)] |= BIT(BTN_TOUCH);
-	ts_omap.inputdevice.absbit[0] =
+	ts_omap.inputdevice = input_allocate_device();
+	ts_omap.inputdevice->name = OMAP_TS_NAME;
+	ts_omap.inputdevice->dev = &pdev->dev;
+	ts_omap.inputdevice->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS);
+	ts_omap.inputdevice->keybit[LONG(BTN_TOUCH)] |= BIT(BTN_TOUCH);
+	ts_omap.inputdevice->absbit[0] =
 	    BIT(ABS_X) | BIT(ABS_Y) | BIT(ABS_PRESSURE);
-	input_register_device(&(ts_omap.inputdevice));
+	input_register_device(ts_omap.inputdevice);
 
 	ts_omap.dev->enable();
 
@@ -187,7 +190,7 @@ static int __init omap_ts_probe(struct p
 static int omap_ts_remove(struct platform_device *pdev)
 {
 	ts_omap.dev->disable();
-	input_unregister_device(&ts_omap.inputdevice);
+	input_unregister_device(ts_omap.inputdevice);
 	if (ts_omap.irq != -1)
 		free_irq(ts_omap.irq, &ts_omap);
 
--- ./drivers/input/touchscreen/omap/omap_ts.h_orig	2005-12-02 17:42:30.000000000 +0100
+++ ./drivers/input/touchscreen/omap/omap_ts.h	2005-12-02 17:43:05.000000000 +0100
@@ -42,7 +42,7 @@ struct ts_device {
 };
 
 struct omap_ts_t{
-	struct input_dev inputdevice;
+	struct input_dev * inputdevice;
 	struct timer_list ts_timer;      // Timer for triggering acquisitions
 	int touched;
 	int irq;






[-- Attachment #3: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[flat|nested] 12+ messages in thread
* Pending patches
@ 2005-12-27  9:51 Dirk Behme
  2005-12-30 22:28 ` Tony Lindgren
  0 siblings, 1 reply; 12+ messages in thread
From: Dirk Behme @ 2005-12-27  9:51 UTC (permalink / raw)
  To: linux-omap-open-source

Hello,

find below a list of pending patches from last weeks.

Feel free to update, correct, extend etc.

Hth,

Dirk


List of pending patches for OMAP Linux.

Last modified: 2005/12/27

Pending patches (ready for inclusion):
======================================

1) Fix OMAP audio miscompile
http://linux.omap.com/pipermail/linux-omap-open-source/2005-December/005830.html

2) Fix miscompile if CONFIG_FB_OMAP_LCDC_INTERNAL=n
http://linux.omap.com/pipermail/linux-omap-open-source/2005-December/005831.html

3) Fix omap keypad
http://linux.omap.com/pipermail/linux-omap-open-source/2005-December/005833.html

4) Convert touchscreen to input_allocate_device
http://linux.omap.com/pipermail/linux-omap-open-source/2005-December/005837.html
(input_allocate_device & timer fix)

_or_ (timer fix only!)

OMAP touchscreen timer BUG
http://linux.omap.com/pipermail/linux-omap-open-source/2005-December/005899.html

5) Fix warning in pm.c
http://linux.omap.com/pipermail/linux-omap-open-source/2005-December/005838.html

6) USB clock changes from Juha
http://linux.omap.com/pipermail/linux-omap-open-source/2005-August/004818.html
(http://linux.omap.com/pipermail/linux-omap-open-source/2005-December/005846.html)
(http://linux.omap.com/pipermail/linux-omap-open-source/2005-December/006027.html)

7) OSS Audio L/R Channel Interchanges fix
http://linux.omap.com/pipermail/linux-omap-open-source/2005-December/005890.html

8) omap1510 MPU interupt BUG
http://linux.omap.com/pipermail/linux-omap-open-source/2005-December/005894.html

9) LDM wakeup flags for OMAP keypad
http://linux.omap.com/pipermail/linux-omap-open-source/2005-December/005897.html

10) Add MMC password protection (lock/unlock) support
http://linux.omap.com/pipermail/linux-omap-open-source/2005-December/005911.html
http://linux.omap.com/pipermail/linux-omap-open-source/2005-December/005912.html
http://linux.omap.com/pipermail/linux-omap-open-source/2005-December/005913.html
http://linux.omap.com/pipermail/linux-omap-open-source/2005-December/005914.html
http://linux.omap.com/pipermail/linux-omap-open-source/2005-December/005915.html
http://linux.omap.com/pipermail/linux-omap-open-source/2005-December/005916.html

Note: Still in discussion with RMK?

11) MMC - CONFIG_HOTPLUG support
http://linux.omap.com/pipermail/linux-omap-open-source/2005-December/005963.html

Note: Still in discussion with RMK?

12) ALSA Audio L/R Channel Interchanges fix
http://linux.omap.com/pipermail/linux-omap-open-source/2005-December/005971.html

13) Disable DEBUG_LL in omap_h3_1710_defconfig
http://linux.omap.com/pipermail/linux-omap-open-source/2005-December/005997.html

14) I2C: Use struct platform_driver
http://linux.omap.com/pipermail/linux-omap-open-source/2005-December/006025.html


Experimental & test (do not apply yet):
=======================================

1) omap24xx vout and dispc library
http://linux.omap.com/pipermail/linux-omap-open-source/2005-December/005932.html

2) omap24xx spi + touchscreen
http://linux.omap.com/pipermail/linux-omap-open-source/2005-December/005980.html

3) keypad: platform_data and 24xx support -exp
http://linux.omap.com/pipermail/linux-omap-open-source/2005-December/005889.html

4) omap24xx IrDA update
http://linux.omap.com/pipermail/linux-omap-open-source/2005-December/005992.html


Already applied (by Juha, nothing to do):
=========================================

1) Omapfb: panel enable/disable reordering
http://linux.omap.com/pipermail/linux-omap-open-source/2005-December/005844.html

2) H3 LCD clocking changes suggested by the driver
http://linux.omap.com/pipermail/linux-omap-open-source/2005-December/005898.html

3) fix watchdog
http://linux.omap.com/pipermail/linux-omap-open-source/2005-December/005969.html

^ permalink raw reply	[flat|nested] 12+ messages in thread
* RE: [PATCH] Convert touchscreen to input_allocate_device
@ 2006-01-16 11:59 Mikko.Soikkala
  2006-01-16 18:15 ` Dirk Behme
  0 siblings, 1 reply; 12+ messages in thread
From: Mikko.Soikkala @ 2006-01-16 11:59 UTC (permalink / raw)
  To: tony, dirk.behme; +Cc: linux-omap-open-source

Hi

Shouldn't there be a check after input_allocate_device() if the
allocation fails? At least other touchscreen drivers seem to return
-ENOMEM in this case.

Mikko

-----Original Message-----
From: linux-omap-open-source-bounces@linux.omap.com
[mailto:linux-omap-open-source-bounces@linux.omap.com] On Behalf Of Tony
Lindgren
Sent: 14. tammikuuta 2006 02:18
To: Dirk Behme
Cc: linux-omap-open-source@linux.omap.com
Subject: Re: [PATCH] Convert touchscreen to input_allocate_device

* Dirk Behme <dirk.behme@de.bosch.com> [060106 11:36]:
> Tony Lindgren wrote:
> >Dirk, I've only pushed Todd's timer fix below like you suggested. Can
you 
> >please
> >update your patch?
> 
> ARM: OMAP: Convert touchscreen to input_allocate_device() to remove:
> 
> input: device omap_ts is statically allocated, will not register
> Please convert to input_allocate_device() or contact
dtor_core@ameritech.net

Pushing this one today, thanks.

Tony
_______________________________________________
Linux-omap-open-source mailing list
Linux-omap-open-source@linux.omap.com
http://linux.omap.com/mailman/listinfo/linux-omap-open-source

^ permalink raw reply	[flat|nested] 12+ messages in thread
* RE: [PATCH] Convert touchscreen to input_allocate_device
@ 2006-01-17 13:24 Mikko.Soikkala
  2006-01-17 15:12 ` Komal Shah
  0 siblings, 1 reply; 12+ messages in thread
From: Mikko.Soikkala @ 2006-01-17 13:24 UTC (permalink / raw)
  To: dirk.behme; +Cc: linux-omap-open-source

> -----Original Message-----
> From: Dirk Behme [mailto:dirk.behme@de.bosch.com]
> 
> Mikko.Soikkala@Tietoenator.com wrote:
> > Hi
> >
> > Shouldn't there be a check after input_allocate_device() if the
> > allocation fails? At least other touchscreen drivers seem to return
> > -ENOMEM in this case.
> 
> Sounds good to me. Can you send a patch?

I'm still learning how to create and submit patches, but hopefully this
does the trick.

Mikko

--

diff -Naur linux-2.6.15-omap2/drivers/input/touchscreen/omap/omap_ts.c
linux-2.6.15-omap2-tsfix/drivers/input/touchscreen/omap/omap_ts.c
--- linux-2.6.15-omap2/drivers/input/touchscreen/omap/omap_ts.c
2006-01-17 14:39:49.000000000 +0200
+++ linux-2.6.15-omap2-tsfix/drivers/input/touchscreen/omap/omap_ts.c
2006-01-17 14:47:48.000000000 +0200
@@ -168,6 +168,9 @@
 	}
 
 	ts_omap.inputdevice = input_allocate_device();
+	if (!ts_omap.inputdevice)
+		return -ENOMEM;
+
 	ts_omap.inputdevice->name = OMAP_TS_NAME;
 	ts_omap.inputdevice->dev = &pdev->dev;
 	ts_omap.inputdevice->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS);

^ permalink raw reply	[flat|nested] 12+ messages in thread
* RE: [PATCH] Convert touchscreen to input_allocate_device
@ 2006-01-18  9:34 Mikko.Soikkala
  2006-01-18 10:10 ` Komal Shah
  0 siblings, 1 reply; 12+ messages in thread
From: Mikko.Soikkala @ 2006-01-18  9:34 UTC (permalink / raw)
  To: komal_shah802003, dirk.behme; +Cc: linux-omap-open-source

> -----Original Message-----
> From: Komal Shah [mailto:komal_shah802003@yahoo.com]
> 
> Not good enough.
> 
> 1. Need to free the irq, you just got before this code.
> 2. Need to call ts_omap.dev->remove() to match _probe() for the
> corresponding platform before you return -ENOMEM.> 

How about if we move the allocation and check to the beginning of the
probe function? Then the return shouldn't cause problems?

Mikko

--

diff -Naur linux-2.6.15-omap2/drivers/input/touchscreen/omap/omap_ts.c
linux-2.6.15-omap2-tsfix/drivers/input/touchscreen/omap/omap_ts.c
--- linux-2.6.15-omap2/drivers/input/touchscreen/omap/omap_ts.c
2006-01-17 14:39:49.000000000 +0200
+++ linux-2.6.15-omap2-tsfix/drivers/input/touchscreen/omap/omap_ts.c
2006-01-18 11:08:42.447581656 +0200
@@ -133,6 +133,10 @@
 	int status = -ENODEV;
 
 	memset(&ts_omap, 0, sizeof(ts_omap));
+	ts_omap.inputdevice = input_allocate_device();
+	if (!ts_omap.inputdevice)
+		return -ENOMEM;
+
 	spin_lock_init(&ts_omap.lock);
 
 	for (i = 0; i < ARRAY_SIZE(ts_devs); i++) {
@@ -167,7 +171,6 @@
 		return -EINVAL;
 	}
 
-	ts_omap.inputdevice = input_allocate_device();
 	ts_omap.inputdevice->name = OMAP_TS_NAME;
 	ts_omap.inputdevice->dev = &pdev->dev;
 	ts_omap.inputdevice->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); 

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

end of thread, other threads:[~2006-01-20 23:07 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-12-04 15:52 [PATCH] Convert touchscreen to input_allocate_device Dirk Behme
  -- strict thread matches above, loose matches on Subject: below --
2005-12-27  9:51 Pending patches Dirk Behme
2005-12-30 22:28 ` Tony Lindgren
2006-01-03 19:13   ` Pending patches mostly pushed, please check Tony Lindgren
2006-01-06 19:37     ` [PATCH] Convert touchscreen to input_allocate_device Dirk Behme
2006-01-14  0:18       ` Tony Lindgren
2006-01-16 11:59 Mikko.Soikkala
2006-01-16 18:15 ` Dirk Behme
2006-01-17 13:24 Mikko.Soikkala
2006-01-17 15:12 ` Komal Shah
2006-01-18  9:34 Mikko.Soikkala
2006-01-18 10:10 ` Komal Shah
2006-01-18 11:21   ` Juha Yrjölä
2006-01-18 16:39     ` Komal Shah
2006-01-20 23:07       ` Tony Lindgren

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox