From 798baf132eac5022ce6c2da7e2d54eb0e65b0193 Mon Sep 17 00:00:00 2001 From: Gregoire Gentil Date: Fri, 12 Mar 2010 13:50:38 +0100 Subject: [PATCH 05/16] adf7846: add more debugging --- drivers/input/touchscreen/ads7846.c | 73 +++++++++++++++++++++++++++++++++++ 1 files changed, 73 insertions(+), 0 deletions(-) diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c index 45287ab..ebdeeeb 100644 --- a/drivers/input/touchscreen/ads7846.c +++ b/drivers/input/touchscreen/ads7846.c @@ -495,9 +495,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, }; -- 1.6.6.1