Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 198318
b: refs/heads/master
c: ecc437a
h: refs/heads/master
v: v3
  • Loading branch information
Samu Onkalo authored and Linus Torvalds committed May 25, 2010
1 parent 7eec128 commit 8eee279
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 20 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 58e814227de9e8b5a4a50fb8018a770de9e974a0
refs/heads/master: ecc437aeee65afeea2e1bed963ccf6c384c555ea
45 changes: 26 additions & 19 deletions trunk/drivers/hwmon/lis3lv02d.c
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,30 @@ int lis3lv02d_remove_fs(struct lis3lv02d *lis3)
}
EXPORT_SYMBOL_GPL(lis3lv02d_remove_fs);

static void lis3lv02d_8b_configure(struct lis3lv02d *dev,
struct lis3lv02d_platform_data *p)
{
if (p->click_flags) {
dev->write(dev, CLICK_CFG, p->click_flags);
dev->write(dev, CLICK_TIMELIMIT, p->click_time_limit);
dev->write(dev, CLICK_LATENCY, p->click_latency);
dev->write(dev, CLICK_WINDOW, p->click_window);
dev->write(dev, CLICK_THSZ, p->click_thresh_z & 0xf);
dev->write(dev, CLICK_THSY_X,
(p->click_thresh_x & 0xf) |
(p->click_thresh_y << 4));
}

if (p->wakeup_flags) {
dev->write(dev, FF_WU_CFG_1, p->wakeup_flags);
dev->write(dev, FF_WU_THS_1, p->wakeup_thresh & 0x7f);
/* default to 2.5ms for now */
dev->write(dev, FF_WU_DURATION_1, 1);
/* enable high pass filter for both free-fall units */
dev->write(dev, CTRL_REG2, HP_FF_WU1 | HP_FF_WU2);
}
}

/*
* Initialise the accelerometer and the various subsystems.
* Should be rather independent of the bus system.
Expand Down Expand Up @@ -567,25 +591,8 @@ int lis3lv02d_init_device(struct lis3lv02d *dev)
if (dev->pdata) {
struct lis3lv02d_platform_data *p = dev->pdata;

if (p->click_flags && (dev->whoami == WAI_8B)) {
dev->write(dev, CLICK_CFG, p->click_flags);
dev->write(dev, CLICK_TIMELIMIT, p->click_time_limit);
dev->write(dev, CLICK_LATENCY, p->click_latency);
dev->write(dev, CLICK_WINDOW, p->click_window);
dev->write(dev, CLICK_THSZ, p->click_thresh_z & 0xf);
dev->write(dev, CLICK_THSY_X,
(p->click_thresh_x & 0xf) |
(p->click_thresh_y << 4));
}

if (p->wakeup_flags && (dev->whoami == WAI_8B)) {
dev->write(dev, FF_WU_CFG_1, p->wakeup_flags);
dev->write(dev, FF_WU_THS_1, p->wakeup_thresh & 0x7f);
/* default to 2.5ms for now */
dev->write(dev, FF_WU_DURATION_1, 1);
/* enable high pass filter for both free-fall units */
dev->write(dev, CTRL_REG2, HP_FF_WU1 | HP_FF_WU2);
}
if (dev->whoami == WAI_8B)
lis3lv02d_8b_configure(dev, p);

if (p->irq_cfg)
dev->write(dev, CTRL_REG3, p->irq_cfg);
Expand Down

0 comments on commit 8eee279

Please sign in to comment.