summaryrefslogtreecommitdiff
path: root/recipes/linux/linux-omap-2.6.29/omap3-touchbook/touchscreen-ads7846-export-settings.patch
blob: f8353afee5cba574cc14c3fa839b607eb4469aa5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c
index 7c3897f..0c62ace 100644
--- a/drivers/input/touchscreen/ads7846.c
+++ b/drivers/input/touchscreen/ads7846.c
@@ -491,9 +491,82 @@ static ssize_t ads7846_disable_store(struct device *dev,
 
 static DEVICE_ATTR(disable, 0664, ads7846_disable_show, ads7846_disable_store);
 
+static ssize_t show_debounce_max(struct device *dev, struct device_attribute *attr, char *buf) {
+	struct ads7846 *ts = dev_get_drvdata(dev);
+	return sprintf(buf, "%u\n", ts->debounce_max);
+}
+
+static ssize_t show_debounce_tol(struct device *dev, struct device_attribute *attr, char *buf) {
+	struct ads7846 *ts = dev_get_drvdata(dev);
+	return sprintf(buf, "%u\n", ts->debounce_tol);
+}
+
+static ssize_t show_debounce_rep(struct device *dev, struct device_attribute *attr, char *buf) {
+	struct ads7846 *ts = dev_get_drvdata(dev);
+	return sprintf(buf, "%u\n", ts->debounce_rep);
+}
+
+static ssize_t show_x_plate_ohms(struct device *dev, struct device_attribute *attr, char *buf) {
+	struct ads7846 *ts = dev_get_drvdata(dev);
+	return sprintf(buf, "%u\n", ts->x_plate_ohms);
+}
+
+static ssize_t write_debounce_max(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) {
+	struct ads7846 *ts = dev_get_drvdata(dev);
+	unsigned long i;
+
+        if (strict_strtoul(buf, 10, &i))
+		return -EINVAL;
+
+	ts->debounce_max = i;
+	return count;
+}
+
+static ssize_t write_debounce_tol(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) {
+	struct ads7846 *ts = dev_get_drvdata(dev);
+	unsigned long i;
+
+        if (strict_strtoul(buf, 10, &i))
+		return -EINVAL;
+
+	ts->debounce_tol = i;
+	return count;
+}
+
+static ssize_t write_debounce_rep(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) {
+	struct ads7846 *ts = dev_get_drvdata(dev);
+	unsigned long i;
+
+        if (strict_strtoul(buf, 10, &i))
+		return -EINVAL;
+
+	ts->debounce_rep = i;
+	return count;
+}
+
+static ssize_t write_x_plate_ohms(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) {
+	struct ads7846 *ts = dev_get_drvdata(dev);
+	unsigned long i;
+
+        if (strict_strtoul(buf, 10, &i))
+		return -EINVAL;
+
+	ts->x_plate_ohms = i;
+	return count;
+}
+
+static DEVICE_ATTR(debounce_max, S_IRUGO | S_IWUGO, show_debounce_max, write_debounce_max);
+static DEVICE_ATTR(debounce_tol, S_IRUGO | S_IWUGO, show_debounce_tol, write_debounce_tol);
+static DEVICE_ATTR(debounce_rep, S_IRUGO | S_IWUGO, show_debounce_rep, write_debounce_rep);
+static DEVICE_ATTR(x_plate_ohms, S_IRUGO | S_IWUGO, show_x_plate_ohms, write_x_plate_ohms);
+
 static struct attribute *ads784x_attributes[] = {
 	&dev_attr_pen_down.attr,
 	&dev_attr_disable.attr,
+	&dev_attr_debounce_max.attr,
+	&dev_attr_debounce_tol.attr,
+	&dev_attr_debounce_rep.attr,
+	&dev_attr_x_plate_ohms.attr,
 	NULL,
 };