Author: richard
Date: Mon Apr 27 06:27:20 2009
New Revision: 5489
URL: http://svn.slimdevices.com/jive?rev=5489&view=rev
Log:
Bug: 11824
Description:
Add support for configuration of FF_WU_CFG1 in the lis302 driver.
Modified:
7.3/trunk/squeezeos/src/s3c2412/linux-2.6.22/drivers/i2c/chips/lis302dl.c
Modified:
7.3/trunk/squeezeos/src/s3c2412/linux-2.6.22/drivers/i2c/chips/lis302dl.c
URL:
http://svn.slimdevices.com/jive/7.3/trunk/squeezeos/src/s3c2412/linux-2.6.22/drivers/i2c/chips/lis302dl.c?rev=5489&r1=5488&r2=5489&view=diff
==============================================================================
--- 7.3/trunk/squeezeos/src/s3c2412/linux-2.6.22/drivers/i2c/chips/lis302dl.c
(original)
+++ 7.3/trunk/squeezeos/src/s3c2412/linux-2.6.22/drivers/i2c/chips/lis302dl.c
Mon Apr 27 06:27:20 2009
@@ -64,6 +64,7 @@
unsigned int threshold;
unsigned int duration;
+ unsigned int config;
unsigned int resume_en : 1;
struct mutex lock;
@@ -193,15 +194,13 @@
/* I1CFG=FF_WU_1 */
lis302dl_write_value(client, LIS302DL_REG_CTRL_REG3, 0x01);
- /* threshold, duration */
+ /* threshold, duration, cfg_1 */
lis302dl_write_value(client, LIS302DL_REG_FF_WU_THS_1, data->threshold);
lis302dl_write_value(client, LIS302DL_REG_FF_WU_DURATION_1,
data->duration);
+ lis302dl_write_value(client, LIS302DL_REG_FF_WU_CFG_1, data->config);
/* reset HPF */
lis302dl_read_value(client, LIS302DL_REG_HP_FILTER_RESET);
-
- /* LIR, ZHIE, YHIE, XHIE */
- lis302dl_write_value(client, LIS302DL_REG_FF_WU_CFG_1, 0x6A);
INIT_WORK(&data->irq_work, lis302dl_irq_work);
}
@@ -279,6 +278,44 @@
}
static DEVICE_ATTR(duration, 0644, lis302dl_duration_show,
lis302dl_duration_store);
+
+
+static ssize_t lis302dl_config_show(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
+ struct i2c_client *client = to_i2c_client(dev);
+ struct lis302dl_data *data = i2c_get_clientdata(client);
+
+ return snprintf(buf, PAGE_SIZE, "%d\n", data->config);
+}
+
+static ssize_t lis302dl_config_store(struct device *dev,
+ struct device_attribute *attr,
+ const char *buf, size_t count)
+{
+ struct i2c_client *client = to_i2c_client(dev);
+ struct lis302dl_data *data = i2c_get_clientdata(client);
+ char *ptr;
+ unsigned long val;
+
+ val = simple_strtoul(buf, &ptr, 10);
+ if (ptr == buf)
+ return -EINVAL;
+
+ if (val != data->config) {
+ data->config = val;
+
+ mutex_lock(&data->lock);
+
+ lis302dl_write_value(client, LIS302DL_REG_FF_WU_CFG_1,
data->config);
+
+ mutex_unlock(&data->lock);
+ }
+
+ return count;
+}
+
+static DEVICE_ATTR(config, 0644, lis302dl_config_show, lis302dl_config_store);
#ifdef CONFIG_PM
@@ -354,6 +391,7 @@
memset(data, 0, sizeof(struct lis302dl_data));
data->threshold = 0x14; // 350mg default
+ data->config = 0x6A; // LIR, ZHIE, YHIE, XHIE
mutex_init(&data->lock);
@@ -413,7 +451,8 @@
}
if ((err = device_create_file(&client->dev, &dev_attr_threshold)) ||
- (err = device_create_file(&client->dev, &dev_attr_duration))) {
+ (err = device_create_file(&client->dev, &dev_attr_duration)) ||
+ (err = device_create_file(&client->dev, &dev_attr_config))) {
dev_err(&client->dev, "cannot attach resume attribute\n");
}
_______________________________________________
Jive-checkins mailing list
[email protected]
http://lists.slimdevices.com/mailman/listinfo/jive-checkins