summaryrefslogtreecommitdiffstats
path: root/extras/recipes-kernel/linux/linux-omap/base/0015-drivers-input-touchscreen-ads7846-return-ENODEV-if-d.patch
diff options
context:
space:
mode:
Diffstat (limited to 'extras/recipes-kernel/linux/linux-omap/base/0015-drivers-input-touchscreen-ads7846-return-ENODEV-if-d.patch')
-rw-r--r--extras/recipes-kernel/linux/linux-omap/base/0015-drivers-input-touchscreen-ads7846-return-ENODEV-if-d.patch47
1 files changed, 47 insertions, 0 deletions
diff --git a/extras/recipes-kernel/linux/linux-omap/base/0015-drivers-input-touchscreen-ads7846-return-ENODEV-if-d.patch b/extras/recipes-kernel/linux/linux-omap/base/0015-drivers-input-touchscreen-ads7846-return-ENODEV-if-d.patch
new file mode 100644
index 00000000..74691ab8
--- /dev/null
+++ b/extras/recipes-kernel/linux/linux-omap/base/0015-drivers-input-touchscreen-ads7846-return-ENODEV-if-d.patch
@@ -0,0 +1,47 @@
1From 713eb96dd137e1436198aa07094049ae0e0f9f1f Mon Sep 17 00:00:00 2001
2From: Steve Sakoman <sakoman@gmail.com>
3Date: Tue, 15 Dec 2009 15:24:10 -0800
4Subject: [PATCH 15/28] drivers: input: touchscreen: ads7846: return ENODEV if device is not found
5
6Signed-off-by: Steve Sakoman <sakoman@gmail.com>
7---
8 drivers/input/touchscreen/ads7846.c | 13 ++++++++++---
9 1 files changed, 10 insertions(+), 3 deletions(-)
10
11diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c
12index 14ea54b..c775e38 100644
13--- a/drivers/input/touchscreen/ads7846.c
14+++ b/drivers/input/touchscreen/ads7846.c
15@@ -1325,11 +1325,18 @@ static int __devinit ads7846_probe(struct spi_device *spi)
16 * the touchscreen, in case it's not connected.
17 */
18 if (ts->model == 7845)
19- ads7845_read12_ser(&spi->dev, PWRDOWN);
20+ err = ads7845_read12_ser(&spi->dev, PWRDOWN);
21 else
22- (void) ads7846_read12_ser(&spi->dev,
23+ err = ads7846_read12_ser(&spi->dev,
24 READ_12BIT_SER(vaux) | ADS_PD10_ALL_ON);
25
26+ /* if sample is all 0's or all 1's then there is no device on spi */
27+ if ( (err == 0x000) || (err == 0xfff)) {
28+ dev_info(&spi->dev, "no device detected, test read result was 0x%08X\n", err);
29+ err = -ENODEV;
30+ goto err_free_irq;
31+ }
32+
33 err = sysfs_create_group(&spi->dev.kobj, &ads784x_attr_group);
34 if (err)
35 goto err_remove_hwmon;
36@@ -1353,7 +1360,7 @@ static int __devinit ads7846_probe(struct spi_device *spi)
37 err_put_regulator:
38 regulator_put(ts->reg);
39 err_free_gpio:
40- if (ts->gpio_pendown != -1)
41+ if (!ts->get_pendown_state && ts->gpio_pendown != -1)
42 gpio_free(ts->gpio_pendown);
43 err_cleanup_filter:
44 if (ts->filter_cleanup)
45--
461.6.6.1
47