diff options
Diffstat (limited to 'extras/recipes-kernel/linux/linux-omap-psp-2.6.32/0018-drivers-input-touchscreen-ads7846-return-ENODEV-if-d.patch')
-rw-r--r-- | extras/recipes-kernel/linux/linux-omap-psp-2.6.32/0018-drivers-input-touchscreen-ads7846-return-ENODEV-if-d.patch | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/extras/recipes-kernel/linux/linux-omap-psp-2.6.32/0018-drivers-input-touchscreen-ads7846-return-ENODEV-if-d.patch b/extras/recipes-kernel/linux/linux-omap-psp-2.6.32/0018-drivers-input-touchscreen-ads7846-return-ENODEV-if-d.patch new file mode 100644 index 00000000..1ee7f324 --- /dev/null +++ b/extras/recipes-kernel/linux/linux-omap-psp-2.6.32/0018-drivers-input-touchscreen-ads7846-return-ENODEV-if-d.patch | |||
@@ -0,0 +1,53 @@ | |||
1 | From 56f59d080226a7a6a033e7f20e8a41d1c327e5a1 Mon Sep 17 00:00:00 2001 | ||
2 | From: Steve Sakoman <sakoman@gmail.com> | ||
3 | Date: Tue, 15 Dec 2009 15:24:10 -0800 | ||
4 | Subject: [PATCH 18/45] drivers: input: touchscreen: ads7846: return ENODEV if device is not found | ||
5 | |||
6 | Signed-off-by: Steve Sakoman <sakoman@gmail.com> | ||
7 | --- | ||
8 | drivers/input/touchscreen/ads7846.c | 13 ++++++++++--- | ||
9 | 1 files changed, 10 insertions(+), 3 deletions(-) | ||
10 | |||
11 | diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c | ||
12 | index e53ac1f..45287ab 100644 | ||
13 | --- a/drivers/input/touchscreen/ads7846.c | ||
14 | +++ b/drivers/input/touchscreen/ads7846.c | ||
15 | @@ -1165,9 +1165,16 @@ static int __devinit ads7846_probe(struct spi_device *spi) | ||
16 | /* take a first sample, leaving nPENIRQ active and vREF off; avoid | ||
17 | * the touchscreen, in case it's not connected. | ||
18 | */ | ||
19 | - (void) ads7846_read12_ser(&spi->dev, | ||
20 | + err = ads7846_read12_ser(&spi->dev, | ||
21 | READ_12BIT_SER(vaux) | ADS_PD10_ALL_ON); | ||
22 | |||
23 | + /* if sample is all 0's or all 1's then there is no device on spi */ | ||
24 | + if ( (err == 0x000) || (err == 0xfff)) { | ||
25 | + dev_info(&spi->dev, "no device detected, test read result was 0x%08X\n", err); | ||
26 | + err = -ENODEV; | ||
27 | + goto err_free_irq; | ||
28 | + } | ||
29 | + | ||
30 | err = sysfs_create_group(&spi->dev.kobj, &ads784x_attr_group); | ||
31 | if (err) | ||
32 | goto err_remove_hwmon; | ||
33 | @@ -1188,7 +1195,7 @@ static int __devinit ads7846_probe(struct spi_device *spi) | ||
34 | err_free_irq: | ||
35 | free_irq(spi->irq, ts); | ||
36 | err_free_gpio: | ||
37 | - if (ts->gpio_pendown != -1) | ||
38 | + if (!ts->get_pendown_state && ts->gpio_pendown != -1) | ||
39 | gpio_free(ts->gpio_pendown); | ||
40 | err_cleanup_filter: | ||
41 | if (ts->filter_cleanup) | ||
42 | @@ -1216,7 +1223,7 @@ static int __devexit ads7846_remove(struct spi_device *spi) | ||
43 | /* suspend left the IRQ disabled */ | ||
44 | enable_irq(ts->spi->irq); | ||
45 | |||
46 | - if (ts->gpio_pendown != -1) | ||
47 | + if (!ts->get_pendown_state && ts->gpio_pendown != -1) | ||
48 | gpio_free(ts->gpio_pendown); | ||
49 | |||
50 | if (ts->filter_cleanup) | ||
51 | -- | ||
52 | 1.6.6.1 | ||
53 | |||