diff options
author | Daniel Hillenbrand <codeworkx@cyanogenmod.org> | 2013-04-13 13:27:42 +0000 |
---|---|---|
committer | Daniel Hillenbrand <codeworkx@cyanogenmod.org> | 2013-04-13 13:38:09 +0000 |
commit | c806b3f082045b7557f469d554da4233c254149a (patch) | |
tree | c3ebd09ecf65838b6f7bce7a28e9a2a180b7e649 | |
parent | 75d32dc8e3136e0c171503126b2737f46f69e5cb (diff) | |
download | kernel_samsung_espresso10-c806b3f082045b7557f469d554da4233c254149a.tar.gz kernel_samsung_espresso10-c806b3f082045b7557f469d554da4233c254149a.tar.bz2 kernel_samsung_espresso10-c806b3f082045b7557f469d554da4233c254149a.zip |
mms136: add sysfs for controlling pivot mode
Change-Id: I913860e8eb1643610efd3a27974543e70b022f27
-rw-r--r-- | drivers/input/touchscreen/mms136.c | 37 |
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, }; |