[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1331640263-18935-8-git-send-email-djkurtz@chromium.org>
Date: Tue, 13 Mar 2012 20:04:10 +0800
From: Daniel Kurtz <djkurtz@...omium.org>
To: Dmitry Torokhov <dmitry.torokhov@...il.com>,
Joonyoung Shim <jy0922.shim@...sung.com>,
Iiro Valkonen <iiro.valkonen@...el.com>,
Henrik Rydberg <rydberg@...omail.se>,
linux-input@...r.kernel.org, linux-kernel@...r.kernel.org
Cc: Benson Leung <bleung@...omium.org>,
Yufeng Shen <miletus@...omium.org>,
Daniel Kurtz <djkurtz@...omium.org>
Subject: [PATCH 07/20] Input: atmel_mxt_ts - add backupnv sysfs entry
Writing to the object sysfs entry permits individual object table entries
to be modified in the device RAM at run time. To permanently save
the settings, they must be written to Non-Volatile memory (NVM).
This patch adds a write-only sysfs entry to allow userspace to save
current settings to NVM, but restricts access to root.
Signed-off-by: Daniel Kurtz <djkurtz@...omium.org>
---
drivers/input/touchscreen/atmel_mxt_ts.c | 19 +++++++++++++++++++
1 files changed, 19 insertions(+), 0 deletions(-)
diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c
index ac3dbb7..e988dc0 100644
--- a/drivers/input/touchscreen/atmel_mxt_ts.c
+++ b/drivers/input/touchscreen/atmel_mxt_ts.c
@@ -994,6 +994,23 @@ static ssize_t mxt_object_store(struct device *dev,
return count;
}
+static ssize_t mxt_backupnv_store(struct device *dev,
+ struct device_attribute *attr,
+ const char *buf, size_t count)
+{
+ struct mxt_data *data = dev_get_drvdata(dev);
+ int ret;
+
+ /* Backup non-volatile memory */
+ ret = mxt_write_object(data, MXT_GEN_COMMAND_T6, MXT_COMMAND_BACKUPNV,
+ MXT_BACKUP_VALUE);
+ if (ret)
+ return ret;
+ msleep(MXT_BACKUP_TIME);
+
+ return count;
+}
+
static int mxt_load_fw(struct device *dev, const char *fn)
{
struct mxt_data *data = dev_get_drvdata(dev);
@@ -1099,11 +1116,13 @@ static ssize_t mxt_update_fw_store(struct device *dev,
return count;
}
+static DEVICE_ATTR(backupnv, S_IWUSR, NULL, mxt_backupnv_store);
static DEVICE_ATTR(object, S_IRUGO | S_IWUSR, mxt_object_show,
mxt_object_store);
static DEVICE_ATTR(update_fw, S_IWUSR, NULL, mxt_update_fw_store);
static struct attribute *mxt_attrs[] = {
+ &dev_attr_backupnv.attr,
&dev_attr_object.attr,
&dev_attr_update_fw.attr,
NULL
--
1.7.7.3
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists