1 From 1b90e477d484f666ba2224b950b2810fcaf53df2 Mon Sep 17 00:00:00 2001
2 From: Gregoire Gentil <gregoire@gentil.com>
3 Date: Fri, 12 Mar 2010 13:50:38 +0100
4 Subject: [PATCH 07/14] adf7846: add more debugging
7 drivers/input/touchscreen/ads7846.c | 73 +++++++++++++++++++++++++++++++++++
8 1 files changed, 73 insertions(+), 0 deletions(-)
10 diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c
11 index 45287ab..ebdeeeb 100644
12 --- a/drivers/input/touchscreen/ads7846.c
13 +++ b/drivers/input/touchscreen/ads7846.c
14 @@ -495,9 +495,82 @@ static ssize_t ads7846_disable_store(struct device *dev,
16 static DEVICE_ATTR(disable, 0664, ads7846_disable_show, ads7846_disable_store);
18 +static ssize_t show_debounce_max(struct device *dev, struct device_attribute *attr, char *buf) {
19 + struct ads7846 *ts = dev_get_drvdata(dev);
20 + return sprintf(buf, "%u\n", ts->debounce_max);
23 +static ssize_t show_debounce_tol(struct device *dev, struct device_attribute *attr, char *buf) {
24 + struct ads7846 *ts = dev_get_drvdata(dev);
25 + return sprintf(buf, "%u\n", ts->debounce_tol);
28 +static ssize_t show_debounce_rep(struct device *dev, struct device_attribute *attr, char *buf) {
29 + struct ads7846 *ts = dev_get_drvdata(dev);
30 + return sprintf(buf, "%u\n", ts->debounce_rep);
33 +static ssize_t show_x_plate_ohms(struct device *dev, struct device_attribute *attr, char *buf) {
34 + struct ads7846 *ts = dev_get_drvdata(dev);
35 + return sprintf(buf, "%u\n", ts->x_plate_ohms);
38 +static ssize_t write_debounce_max(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) {
39 + struct ads7846 *ts = dev_get_drvdata(dev);
42 + if (strict_strtoul(buf, 10, &i))
45 + ts->debounce_max = i;
49 +static ssize_t write_debounce_tol(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) {
50 + struct ads7846 *ts = dev_get_drvdata(dev);
53 + if (strict_strtoul(buf, 10, &i))
56 + ts->debounce_tol = i;
60 +static ssize_t write_debounce_rep(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) {
61 + struct ads7846 *ts = dev_get_drvdata(dev);
64 + if (strict_strtoul(buf, 10, &i))
67 + ts->debounce_rep = i;
71 +static ssize_t write_x_plate_ohms(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) {
72 + struct ads7846 *ts = dev_get_drvdata(dev);
75 + if (strict_strtoul(buf, 10, &i))
78 + ts->x_plate_ohms = i;
82 +static DEVICE_ATTR(debounce_max, S_IRUGO | S_IWUGO, show_debounce_max, write_debounce_max);
83 +static DEVICE_ATTR(debounce_tol, S_IRUGO | S_IWUGO, show_debounce_tol, write_debounce_tol);
84 +static DEVICE_ATTR(debounce_rep, S_IRUGO | S_IWUGO, show_debounce_rep, write_debounce_rep);
85 +static DEVICE_ATTR(x_plate_ohms, S_IRUGO | S_IWUGO, show_x_plate_ohms, write_x_plate_ohms);
87 static struct attribute *ads784x_attributes[] = {
88 &dev_attr_pen_down.attr,
89 &dev_attr_disable.attr,
90 + &dev_attr_debounce_max.attr,
91 + &dev_attr_debounce_tol.attr,
92 + &dev_attr_debounce_rep.attr,
93 + &dev_attr_x_plate_ohms.attr,