diff options
author | David Yu <davyu@nvidia.com> | 2013-10-18 18:03:55 +0900 |
---|---|---|
committer | Gabby Lee <galee@nvidia.com> | 2013-10-18 04:54:24 -0700 |
commit | 6d170a3841164753799cca57b9d9b2f7610846b1 (patch) | |
tree | 78ce2b215ae176e95661a3f161ffeb5c00912489 /drivers | |
parent | 1d911020e42ab1a59233a71e167d6ca4082a91b2 (diff) |
input: misc: mpu: add load cal sysfs
Bug 1376017
Change-Id: I1e332dbb7f2a127a482837f3dff28b54077c923b
Signed-off-by: David Yu <davyu@nvidia.com>
Reviewed-on: http://git-master/r/301137
Reviewed-by: Automatic_Commit_Validation_User
Tested-by: BK Kim <bkk@nvidia.com>
Reviewed-by: Gabby Lee <galee@nvidia.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/input/misc/mpu/inv_gyro.c | 29 | ||||
-rw-r--r-- | drivers/input/misc/mpu/inv_gyro.h | 1 |
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; }; /** |