diff options
-rw-r--r-- | drivers/hwmon/lis3lv02d.c | 45 |
1 files changed, 26 insertions, 19 deletions
diff --git a/drivers/hwmon/lis3lv02d.c b/drivers/hwmon/lis3lv02d.c index b2f2277cad3c..99fd45deda41 100644 --- a/drivers/hwmon/lis3lv02d.c +++ b/drivers/hwmon/lis3lv02d.c | |||
@@ -521,6 +521,30 @@ int lis3lv02d_remove_fs(struct lis3lv02d *lis3) | |||
521 | } | 521 | } |
522 | EXPORT_SYMBOL_GPL(lis3lv02d_remove_fs); | 522 | EXPORT_SYMBOL_GPL(lis3lv02d_remove_fs); |
523 | 523 | ||
524 | static void lis3lv02d_8b_configure(struct lis3lv02d *dev, | ||
525 | struct lis3lv02d_platform_data *p) | ||
526 | { | ||
527 | if (p->click_flags) { | ||
528 | dev->write(dev, CLICK_CFG, p->click_flags); | ||
529 | dev->write(dev, CLICK_TIMELIMIT, p->click_time_limit); | ||
530 | dev->write(dev, CLICK_LATENCY, p->click_latency); | ||
531 | dev->write(dev, CLICK_WINDOW, p->click_window); | ||
532 | dev->write(dev, CLICK_THSZ, p->click_thresh_z & 0xf); | ||
533 | dev->write(dev, CLICK_THSY_X, | ||
534 | (p->click_thresh_x & 0xf) | | ||
535 | (p->click_thresh_y << 4)); | ||
536 | } | ||
537 | |||
538 | if (p->wakeup_flags) { | ||
539 | dev->write(dev, FF_WU_CFG_1, p->wakeup_flags); | ||
540 | dev->write(dev, FF_WU_THS_1, p->wakeup_thresh & 0x7f); | ||
541 | /* default to 2.5ms for now */ | ||
542 | dev->write(dev, FF_WU_DURATION_1, 1); | ||
543 | /* enable high pass filter for both free-fall units */ | ||
544 | dev->write(dev, CTRL_REG2, HP_FF_WU1 | HP_FF_WU2); | ||
545 | } | ||
546 | } | ||
547 | |||
524 | /* | 548 | /* |
525 | * Initialise the accelerometer and the various subsystems. | 549 | * Initialise the accelerometer and the various subsystems. |
526 | * Should be rather independent of the bus system. | 550 | * Should be rather independent of the bus system. |
@@ -567,25 +591,8 @@ int lis3lv02d_init_device(struct lis3lv02d *dev) | |||
567 | if (dev->pdata) { | 591 | if (dev->pdata) { |
568 | struct lis3lv02d_platform_data *p = dev->pdata; | 592 | struct lis3lv02d_platform_data *p = dev->pdata; |
569 | 593 | ||
570 | if (p->click_flags && (dev->whoami == WAI_8B)) { | 594 | if (dev->whoami == WAI_8B) |
571 | dev->write(dev, CLICK_CFG, p->click_flags); | 595 | lis3lv02d_8b_configure(dev, p); |
572 | dev->write(dev, CLICK_TIMELIMIT, p->click_time_limit); | ||
573 | dev->write(dev, CLICK_LATENCY, p->click_latency); | ||
574 | dev->write(dev, CLICK_WINDOW, p->click_window); | ||
575 | dev->write(dev, CLICK_THSZ, p->click_thresh_z & 0xf); | ||
576 | dev->write(dev, CLICK_THSY_X, | ||
577 | (p->click_thresh_x & 0xf) | | ||
578 | (p->click_thresh_y << 4)); | ||
579 | } | ||
580 | |||
581 | if (p->wakeup_flags && (dev->whoami == WAI_8B)) { | ||
582 | dev->write(dev, FF_WU_CFG_1, p->wakeup_flags); | ||
583 | dev->write(dev, FF_WU_THS_1, p->wakeup_thresh & 0x7f); | ||
584 | /* default to 2.5ms for now */ | ||
585 | dev->write(dev, FF_WU_DURATION_1, 1); | ||
586 | /* enable high pass filter for both free-fall units */ | ||
587 | dev->write(dev, CTRL_REG2, HP_FF_WU1 | HP_FF_WU2); | ||
588 | } | ||
589 | 596 | ||
590 | if (p->irq_cfg) | 597 | if (p->irq_cfg) |
591 | dev->write(dev, CTRL_REG3, p->irq_cfg); | 598 | dev->write(dev, CTRL_REG3, p->irq_cfg); |