From 7330c695afad64eef62c525cb8e54913265a3b39 Mon Sep 17 00:00:00 2001
From: Gregoire Gentil <gregoire@gentil.com>
Date: Fri, 12 Mar 2010 13:50:52 +0100
Subject: [PATCH 07/17] ads7846: add settling delay to pdata

---
 drivers/input/touchscreen/ads7846.c |   22 ++++++++++++++++++++++
 1 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c
index 56b0ffd..1d9f97c 100644
--- a/drivers/input/touchscreen/ads7846.c
+++ b/drivers/input/touchscreen/ads7846.c
@@ -515,6 +515,26 @@ static ssize_t show_x_plate_ohms(struct device *dev, struct device_attribute *at
 	return sprintf(buf, "%u\n", ts->x_plate_ohms);
 }
 
+static ssize_t show_settle_delay_usecs(struct device *dev, struct device_attribute *attr, char *buf) {
+	struct ads7846 *ts = dev_get_drvdata(dev);
+	struct ads7846_platform_data *pdata = ts->spi->dev.platform_data;
+
+	return sprintf(buf, "%u\n", pdata->settle_delay_usecs);
+}
+
+static ssize_t write_settle_delay_usecs(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) {
+	struct ads7846 *ts = dev_get_drvdata(dev);
+	struct ads7846_platform_data *pdata = ts->spi->dev.platform_data;
+
+	unsigned long i;
+
+        if (strict_strtoul(buf, 10, &i))
+		return -EINVAL;
+
+	pdata->settle_delay_usecs = i;
+	return count;
+}
+
 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;
@@ -563,6 +583,7 @@ static DEVICE_ATTR(debounce_max, S_IRUGO | S_IWUGO, show_debounce_max, write_deb
 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 DEVICE_ATTR(settle_delay_usecs, S_IRUGO | S_IWUGO, show_settle_delay_usecs, write_settle_delay_usecs);
 
 static struct attribute *ads784x_attributes[] = {
 	&dev_attr_pen_down.attr,
@@ -571,6 +592,7 @@ static struct attribute *ads784x_attributes[] = {
 	&dev_attr_debounce_tol.attr,
 	&dev_attr_debounce_rep.attr,
 	&dev_attr_x_plate_ohms.attr,
+	&dev_attr_settle_delay_usecs.attr,
 	NULL,
 };
 
-- 
1.6.6.1

