aboutsummaryrefslogtreecommitdiff
path: root/drivers/input/misc/lis302dl.c
diff options
context:
space:
mode:
authorSimon Kagstrom <simon.kagstrom@gmail.com>2008-11-19 17:11:26 +0000
committerAndy Green <agreen@pads.home.warmcat.com>2008-11-19 17:11:26 +0000
commitc98144b6f6126f591425073dbb1c45c4098ee0be (patch)
tree67a933a229f5b0c7d859f7221d5f1d6f39752a0a /drivers/input/misc/lis302dl.c
parent45f195b05adc0f0798f4920ee649f58b6ea99494 (diff)
lis302dl-ack-ff_wu-interrupts.patch
Setup interrupt latching for thresholded operation From: Simon Kagstrom <simon.kagstrom@gmail.com> This patch, for stable-tracking, sets up interrupt latching for thresholded operation, and also acks the interrupt in the handler. This reduces the interrupt load, and thresholds < 36 are once again allowed (though not of much use). The patch also fixes some warnings in the code (including a potential bug). Thanks to Werner for pointing this out! Signed-off-by: Simon Kagstrom <simon.kagstrom@gmail.com>
Diffstat (limited to 'drivers/input/misc/lis302dl.c')
-rw-r--r--drivers/input/misc/lis302dl.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/drivers/input/misc/lis302dl.c b/drivers/input/misc/lis302dl.c
index 5a8f362f2af..237ff48fac1 100644
--- a/drivers/input/misc/lis302dl.c
+++ b/drivers/input/misc/lis302dl.c
@@ -137,7 +137,8 @@ static void __enable_wakeup(struct lis302dl_info *lis)
/* First zero to get to a known state */
__reg_write(lis, LIS302DL_REG_FF_WU_CFG_1, LIS302DL_FFWUCFG_XHIE |
- LIS302DL_FFWUCFG_YHIE | LIS302DL_FFWUCFG_ZHIE);
+ LIS302DL_FFWUCFG_YHIE | LIS302DL_FFWUCFG_ZHIE |
+ LIS302DL_FFWUCFG_LIR);
__reg_write(lis, LIS302DL_REG_FF_WU_THS_1,
__mg_to_threshold(lis, lis->wakeup.threshold));
__reg_write(lis, LIS302DL_REG_FF_WU_DURATION_1,
@@ -183,7 +184,7 @@ static void __enable_data_collection(struct lis302dl_info *lis)
__reg_read(lis, LIS302DL_REG_HP_FILTER_RESET);
__reg_write(lis, LIS302DL_REG_FF_WU_CFG_1,
LIS302DL_FFWUCFG_XHIE | LIS302DL_FFWUCFG_YHIE |
- LIS302DL_FFWUCFG_ZHIE);
+ LIS302DL_FFWUCFG_ZHIE | LIS302DL_FFWUCFG_LIR);
__lis302dl_int_mode(lis->dev, 1, LIS302DL_INTMODE_FF_WU_12);
__lis302dl_int_mode(lis->dev, 2, LIS302DL_INTMODE_FF_WU_12);
}
@@ -216,7 +217,6 @@ static void lis302dl_bitbang_read_sample(struct lis302dl_info *lis)
u8 read[5];
unsigned long flags;
int mg_per_sample;
- int n;
local_irq_save(flags);
mg_per_sample = __threshold_to_mg(lis, 1);
@@ -233,6 +233,7 @@ static void lis302dl_bitbang_read_sample(struct lis302dl_info *lis)
/* Reset the HP filter */
__reg_read(lis, LIS302DL_REG_HP_FILTER_RESET);
+ __reg_read(lis, LIS302DL_REG_FF_WU_SRC_1);
}
static irqreturn_t lis302dl_interrupt(int irq, void *_lis)
@@ -346,9 +347,6 @@ static ssize_t set_threshold(struct device *dev, struct device_attribute *attr,
/* 8g is the maximum if FS is 1 */
if (val > 8000)
return -ERANGE;
- /* Lower than 36 overloads the system with interrupts */
- if (val < 36)
- val = 36;
/* Set the threshold and write it out if the device is used */
lis->threshold = val;
@@ -435,8 +433,6 @@ static ssize_t set_wakeup_threshold(struct device *dev,
if (threshold > 8000)
return -ERANGE;
- if (threshold < 36)
- threshold = 36;
/* Zero turns the feature off */
if (threshold == 0) {
@@ -629,6 +625,7 @@ static int __devinit lis302dl_probe(struct platform_device *pdev)
dev_err(lis->dev, "unknown who_am_i signature 0x%02x\n", wai);
dev_set_drvdata(lis->dev, NULL);
rc = -ENODEV;
+ local_irq_restore(flags);
goto bail_sysfs;
}
@@ -707,7 +704,6 @@ bail_sysfs:
sysfs_remove_group(&lis->dev->kobj, &lis302dl_attr_group);
bail_free_lis:
kfree(lis);
- local_irq_restore(flags);
return rc;
}