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, };