Skip to contentSkip to conversation

Input/Touchscreen Driver: add support AD7877 touchscreen driver

PATCH In review Bryan Wu 4 participants 5 messages Feb 14, 2008 – May 12, 2008

Subsystems (3)
lore
Share & tools
lore

Bryan Wu

author
#0 lore raw

PATCH 1/1 Input/Touchscreen Driver: add support AD7877 touchscreen driver

From: Michael Hennerich <[email protected]>

[try #3] Changlog (Add feedback from Dmitry Torokhov):
- Change handling of spi_sync / spi_async return value handling
- Remove depreciated dev->power.power_state
- Fix error return path in ad7877_probe
- delete pending kernel timer
- Some minor cleanup (indention, use dev_err etc.)

[try #2] Changelog:
- move locking inside ad7877_enable and ad7877_disable
- use setup_timer
- use input_dev->dev.parent
- fix unregister device
- kill EV_KEY since it's not used
- fix indention style

Apply patch from Philip Douglass:
Make ad7877 ts driver not dependent on Blackfin specific cs_change_per_word_option

---
 drivers/input/touchscreen/Kconfig  |   13 +
 drivers/input/touchscreen/Makefile |    1 +
 drivers/input/touchscreen/ad7877.c |  899 ++++++++++++++++++++++++++++++++++++
 3 files changed, 913 insertions(+), 0 deletions(-)
 create mode 100644 drivers/input/touchscreen/ad7877.c
drivers/input/touchscreen/Kconfig +13 -0
index 90e8e92..94845df 100644
@@ -29,6 +29,19 @@ config TOUCHSCREEN_ADS7846
 	  To compile this driver as a module, choose M here: the
 	  module will be called ads7846.
 
+config TOUCHSCREEN_AD7877
+	tristate "AD7877 based touchscreens"
+	depends on SPI_MASTER
+	help
+	  Say Y here if you have a touchscreen interface using the
+	  AD7877 controller, and your board-specific initialization
+	  code includes that in its table of SPI devices.
+
+	  If unsure, say N (but it's safe to say "Y").
+
+	  To compile this driver as a module, choose M here: the
+	  module will be called ad7877.
+
 config TOUCHSCREEN_BITSY
 	tristate "Compaq iPAQ H3600 (Bitsy) touchscreen"
 	depends on SA1100_BITSY
drivers/input/touchscreen/Makefile +1 -0
index 35d4097..49561b2 100644
@@ -4,6 +4,7 @@
 
 # Each configuration option enables a list of files.
 
+obj-$(CONFIG_TOUCHSCREEN_AD7877)	+= ad7877.o
 obj-$(CONFIG_TOUCHSCREEN_ADS7846)	+= ads7846.o
 obj-$(CONFIG_TOUCHSCREEN_BITSY)		+= h3600_ts_input.o
 obj-$(CONFIG_TOUCHSCREEN_CORGI)		+= corgi_ts.o
drivers/input/touchscreen/ad7877.c new file +899 -0

899 lines not on this page · raw message

Signature · 1 line
1.5.3.4
maintainer
#1 lore raw

Hi Bryan, Michael,

Quoted 8 lines · Bryan Wu

From: Michael Hennerich <[email protected]>

[try #3] Changlog (Add feedback from Dmitry Torokhov):
- Change handling of spi_sync / spi_async return value handling
- Remove depreciated dev->power.power_state
- Fix error return path in ad7877_probe
- delete pending kernel timer
- Some minor cleanup (indention, use dev_err etc.)

Sorry for the long silence... I have a couple of comments at the moment but I am sure i will have more ;)

drivers/input/touchscreen/ad7877.c line 248

Quoted 8 lines
drivers/input/touchscreen/ad7877.c new file +8 -0
+
+	status = spi_sync(spi, &req->msg);
+
+	if (status == 0)
+		status = req->msg.status;
+
+	kfree(req);
+	return status ? status : req->sample;

Use after free here.

drivers/input/touchscreen/ad7877.c line 324

Quoted 3 lines
drivers/input/touchscreen/ad7877.c new file +3 -0
+
+	ts->irq_disabled = 1;
+	disable_irq(spi->irq);

I am a bit uneasy here... do we need to wait for an async spi completion here before proceeding? Overall I have some concerns about the irq/spi/removal/sysfs iteractions, I will need some more time to look through the driver.

Quoted 4 lines
drivers/input/touchscreen/ad7877.c new file +4 -0
+	status = spi_sync(spi, &req->msg);
+	ts->irq_disabled = 0;
+	enable_irq(spi->irq);
+
Signature · 1 line
Dmitry
#2 lore raw

RE: [PATCH 1/1] Input/Touchscreen Driver: add support AD7877touchscreen driver

Quoted 26 lines

-----Original Message-----
From: Dmitry Torokhov [mailto:[email protected]]
Sent: Montag, 7. April 2008 22:16
To: Bryan Wu
Cc: [email protected]; [email protected]; Michael Hennerich
Subject: Re: [PATCH 1/1] Input/Touchscreen Driver: add support AD7877touchscreen driver

Hi Bryan, Michael,

Quoted 8 lines · Bryan Wu

From: Michael Hennerich <[email protected]>

[try #3] Changlog (Add feedback from Dmitry Torokhov):
- Change handling of spi_sync / spi_async return value handling
- Remove depreciated dev->power.power_state
- Fix error return path in ad7877_probe
- delete pending kernel timer
- Some minor cleanup (indention, use dev_err etc.)

Sorry for the long silence... I have a couple of comments at the moment but I am sure i will have more ;)

Quoted 10 lines

drivers/input/touchscreen/ad7877.c line 248

Quoted 8 lines
drivers/input/touchscreen/ad7877.c new file +8 -0
+
+	status = spi_sync(spi, &req->msg);
+
+	if (status == 0)
+		status = req->msg.status;
+
+	kfree(req);
+	return status ? status : req->sample;

Use after free here.

Yeah this is definitely broken.

Quoted 6 lines

drivers/input/touchscreen/ad7877.c line 324

Quoted 4 lines
drivers/input/touchscreen/ad7877.c new file +3 -0
+
+	ts->irq_disabled = 1;
+	disable_irq(spi->irq);

I am a bit uneasy here... do we need to wait for an async spi

completion

Quoted 3 lines

here before proceeding? Overall I have some concerns about the irq/spi/removal/sysfs iteractions, I will need some more time to look through the driver.

I think you are right - let me come up with a patch.

Thanks and best regards,
Michael

Quoted 8 lines

drivers/input/touchscreen/ad7877.c line 328

Quoted 5 lines
drivers/input/touchscreen/ad7877.c new file +4 -0
+	status = spi_sync(spi, &req->msg);
+	ts->irq_disabled = 0;
+	enable_irq(spi->irq);
+

--
Dmitry

#3 lore raw

Re: [PATCH 1/1] Input/Touchscreen Driver: add support AD7877touchscreen driver

Quoted 51 lines · Michael
Quoted 26 lines

-----Original Message-----
From: Dmitry Torokhov [mailto:[email protected]]
Sent: Montag, 7. April 2008 22:16
To: Bryan Wu
Cc: [email protected]; [email protected]; Michael Hennerich
Subject: Re: [PATCH 1/1] Input/Touchscreen Driver: add support AD7877touchscreen driver

Hi Bryan, Michael,

Quoted 8 lines · Bryan Wu

From: Michael Hennerich <[email protected]>

[try #3] Changlog (Add feedback from Dmitry Torokhov):
- Change handling of spi_sync / spi_async return value handling
- Remove depreciated dev->power.power_state
- Fix error return path in ad7877_probe
- delete pending kernel timer
- Some minor cleanup (indention, use dev_err etc.)

Sorry for the long silence... I have a couple of comments at the moment but I am sure i will have more ;)

Quoted 10 lines

drivers/input/touchscreen/ad7877.c line 248

Quoted 8 lines
drivers/input/touchscreen/ad7877.c new file +8 -0
+
+    status = spi_sync(spi, &req->msg);
+
+    if (status == 0)
+            status = req->msg.status;
+
+    kfree(req);
+    return status ? status : req->sample;

Use after free here.

Yeah this is definitely broken.

Quoted 6 lines

drivers/input/touchscreen/ad7877.c line 324

Quoted 4 lines
drivers/input/touchscreen/ad7877.c new file +3 -0
+
+    ts->irq_disabled = 1;
+    disable_irq(spi->irq);

I am a bit uneasy here... do we need to wait for an async spi

completion

Quoted 3 lines

here before proceeding? Overall I have some concerns about the irq/spi/removal/sysfs iteractions, I will need some more time to look through the driver.

Quoted 6 lines

I think you are right - let me come up with a patch.

Thanks and best regards,
Michael

Quoted 1 line

Hi Dmitry,

Sorry for no updates, I forget to send out that patch, although Michael fixed the driver as your review.

So need I send out one updated patch including Michael's fixing or just send out his incremental patch?

Thanks
-Bryan

maintainer
#4 lore raw

Re: [PATCH 1/1] Input/Touchscreen Driver: add support AD7877touchscreen driver

Hi Bryan,

Quoted 9 lines · Bryan Wu

Hi Dmitry,

Sorry for no updates, I forget to send out that patch, although Michael fixed the driver as your review.

So need I send out one updated patch including Michael's fixing or just send out his incremental patch?$B!)

Please send me the whole thing. Thanks!

Signature · 1 line
Dmitry