aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/touchscreen/mms136.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/input/touchscreen/mms136.c')
-rw-r--r--drivers/input/touchscreen/mms136.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/drivers/input/touchscreen/mms136.c b/drivers/input/touchscreen/mms136.c
index 351d6cefacd..3586c2cc099 100644
--- a/drivers/input/touchscreen/mms136.c
+++ b/drivers/input/touchscreen/mms136.c
@@ -1087,10 +1087,47 @@ static DEVICE_ATTR(cmd, S_IWUSR | S_IWGRP, NULL, cmd_store);
static DEVICE_ATTR(cmd_status, S_IRUGO, cmd_status_show, NULL);
static DEVICE_ATTR(cmd_result, S_IRUGO, cmd_result_show, NULL);
+static ssize_t mms136_pivot_show(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
+ struct ts_data *ts = dev_get_drvdata(dev);
+ int count;
+
+ count = sprintf(buf, "%d\n", ts->platform_data->pivot);
+ pr_info("tsp: pivot mode=%d\n", ts->platform_data->pivot);
+
+ return count;
+}
+
+ssize_t mms136_pivot_store(struct device *dev,
+ struct device_attribute *attr,
+ const char *buf, size_t size)
+{
+ struct ts_data *ts = dev_get_drvdata(dev);
+ int pivot;
+
+ if (kstrtoint(buf, 0, &pivot))
+ pr_err("tsp: failed storing pivot value\n");
+
+ if (pivot < 0) {
+ pivot = 0;
+ } else if (pivot > 1) {
+ pivot = 1;
+ }
+
+ ts->platform_data->pivot = pivot;
+ pr_info("tsp: pivot mode=%d\n", pivot);
+
+ return size;
+}
+
+static DEVICE_ATTR(pivot, S_IRUGO | S_IWUSR, mms136_pivot_show, mms136_pivot_store);
+
static struct attribute *touchscreen_attributes[] = {
&dev_attr_cmd.attr,
&dev_attr_cmd_status.attr,
&dev_attr_cmd_result.attr,
+ &dev_attr_pivot.attr,
NULL,
};