summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Yu <davyu@nvidia.com>2013-10-18 18:03:55 +0900
committerGabby Lee <galee@nvidia.com>2013-10-18 05:21:25 -0700
commitfa435e4bba4711c2e0d083d52b9f490e59630039 (patch)
tree9e1bc05dae3bbccadaa96d1a23adecaa73b6dc81
parent1aa792d601dcc436e05d8d10033b714ee129a474 (diff)
input: misc: mpu: add load cal sysfs
Bug 1376017 Change-Id: I1e332dbb7f2a127a482837f3dff28b54077c923b Reviewed-on: http://git-master/r/301137 (cherry picked from commit 6d170a3841164753799cca57b9d9b2f7610846b1) Signed-off-by: Gabby Lee <galee@nvidia.com> Reviewed-on: http://git-master/r/301233
-rw-r--r--drivers/input/misc/mpu/inv_gyro.c29
-rw-r--r--drivers/input/misc/mpu/inv_gyro.h1
2 files changed, 30 insertions, 0 deletions
diff --git a/drivers/input/misc/mpu/inv_gyro.c b/drivers/input/misc/mpu/inv_gyro.c
index 34ec3a52c6cd..039431aec401 100644
--- a/drivers/input/misc/mpu/inv_gyro.c
+++ b/drivers/input/misc/mpu/inv_gyro.c
@@ -3134,6 +3134,32 @@ static ssize_t inv_key_show(struct device *dev, struct device_attribute *attr,
key[13], key[14], key[15]);
}
+static ssize_t inv_loadcal_store(struct device *dev,
+ struct device_attribute *attr,
+ const char *buf, size_t count)
+{
+ struct inv_gyro_state_s *inf;
+ unsigned int load_cal;
+ int err;
+
+ inf = dev_get_drvdata(dev);
+ err = kstrtouint(buf, 10, &load_cal);
+ if (err)
+ return -EINVAL;
+
+ inf->chip_config.load_cal = load_cal;
+
+ return count;
+}
+
+static ssize_t inv_loadcal_show(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
+ struct inv_gyro_state_s *inf = dev_get_drvdata(dev);
+
+ return sprintf(buf, "%u\n", inf->chip_config.load_cal);
+}
+
/**
* OBSOLETE
*/
@@ -3931,6 +3957,8 @@ static DEVICE_ATTR(power_state, S_IRUGO | S_IWUSR | S_IWGRP,
inv_power_state_show, inv_power_state_store);
static DEVICE_ATTR(key, S_IRUGO | S_IWUSR | S_IWGRP,
inv_key_show, inv_key_store);
+static DEVICE_ATTR(loadcal, S_IRUGO | S_IWUSR | S_IWGRP,
+ inv_loadcal_show, inv_loadcal_store);
static struct device_attribute *inv_attributes[] = {
&dev_attr_accl_enable,
@@ -3953,6 +3981,7 @@ static struct device_attribute *inv_attributes[] = {
&dev_attr_enable,
&dev_attr_power_state,
&dev_attr_key,
+ &dev_attr_loadcal,
#if DEBUG_SYSFS_INTERFACE
&dev_attr_dbg_reg,
&dev_attr_dbg_dat,
diff --git a/drivers/input/misc/mpu/inv_gyro.h b/drivers/input/misc/mpu/inv_gyro.h
index abe468bdd14f..af4093ff51de 100644
--- a/drivers/input/misc/mpu/inv_gyro.h
+++ b/drivers/input/misc/mpu/inv_gyro.h
@@ -238,6 +238,7 @@ struct inv_chip_config_s {
long long gyro_start_delay_ns;
unsigned int bypass_timeout_ms;
unsigned char is_asleep;
+ unsigned int load_cal;
};
/**