Lines Matching full:lis2dh

18 LOG_MODULE_DECLARE(lis2dh, CONFIG_SENSOR_LOG_LEVEL);
19 #include "lis2dh.h"
46 struct lis2dh_data *lis2dh = dev->data; in lis2dh_trigger_drdy_set() local
57 atomic_clear_bit(&lis2dh->trig_flags, TRIGGED_INT1); in lis2dh_trigger_drdy_set()
59 status = lis2dh->hw_tf->update_reg(dev, LIS2DH_REG_CTRL3, in lis2dh_trigger_drdy_set()
62 lis2dh->handler_drdy = handler; in lis2dh_trigger_drdy_set()
63 lis2dh->trig_drdy = trig; in lis2dh_trigger_drdy_set()
68 lis2dh->chan_drdy = chan; in lis2dh_trigger_drdy_set()
73 atomic_set_bit(&lis2dh->trig_flags, START_TRIG_INT1); in lis2dh_trigger_drdy_set()
75 k_sem_give(&lis2dh->gpio_sem); in lis2dh_trigger_drdy_set()
77 k_work_submit(&lis2dh->work); in lis2dh_trigger_drdy_set()
88 struct lis2dh_data *lis2dh = dev->data; in lis2dh_start_trigger_int1() local
91 status = lis2dh->hw_tf->read_reg(dev, LIS2DH_REG_CTRL1, &ctrl1); in lis2dh_start_trigger_int1()
95 status = lis2dh->hw_tf->write_reg(dev, LIS2DH_REG_CTRL1, in lis2dh_start_trigger_int1()
105 status = lis2dh->hw_tf->read_data(dev, LIS2DH_REG_STATUS, in lis2dh_start_trigger_int1()
114 status = lis2dh->hw_tf->write_reg(dev, LIS2DH_REG_CTRL1, ctrl1); in lis2dh_start_trigger_int1()
119 return lis2dh->hw_tf->update_reg(dev, LIS2DH_REG_CTRL3, in lis2dh_start_trigger_int1()
144 struct lis2dh_data *lis2dh = dev->data; in lis2dh_trigger_anym_tap_set() local
156 atomic_clear_bit(&lis2dh->trig_flags, TRIGGED_INT2); in lis2dh_trigger_anym_tap_set()
159 status = lis2dh->hw_tf->update_reg(dev, LIS2DH_REG_CTRL3, in lis2dh_trigger_anym_tap_set()
164 status = lis2dh->hw_tf->write_reg(dev, in lis2dh_trigger_anym_tap_set()
170 status = lis2dh->hw_tf->write_reg(dev, in lis2dh_trigger_anym_tap_set()
175 status = lis2dh->hw_tf->read_reg(dev, in lis2dh_trigger_anym_tap_set()
180 status = lis2dh->hw_tf->read_reg(dev, in lis2dh_trigger_anym_tap_set()
185 lis2dh->handler_anymotion = handler; in lis2dh_trigger_anym_tap_set()
186 lis2dh->trig_anymotion = trig; in lis2dh_trigger_anym_tap_set()
188 lis2dh->handler_tap = handler; in lis2dh_trigger_anym_tap_set()
189 lis2dh->trig_tap = trig; in lis2dh_trigger_anym_tap_set()
199 atomic_set_bit(&lis2dh->trig_flags, START_TRIG_INT2); in lis2dh_trigger_anym_tap_set()
201 k_sem_give(&lis2dh->gpio_sem); in lis2dh_trigger_anym_tap_set()
203 k_work_submit(&lis2dh->work); in lis2dh_trigger_anym_tap_set()
224 struct lis2dh_data *lis2dh = dev->data; in lis2dh_start_trigger_int2() local
231 bool has_anyt = (lis2dh->handler_tap != NULL); in lis2dh_start_trigger_int2()
232 bool has_anym = (lis2dh->handler_anymotion != NULL); in lis2dh_start_trigger_int2()
237 status = lis2dh->hw_tf->write_reg(dev, reg, val); in lis2dh_start_trigger_int2()
247 status = lis2dh->hw_tf->update_reg(dev, reg, mask, val); in lis2dh_start_trigger_int2()
257 status = lis2dh->hw_tf->update_reg(dev, reg, mask, val); in lis2dh_start_trigger_int2()
267 status = lis2dh->hw_tf->update_reg(dev, reg, mask, val); in lis2dh_start_trigger_int2()
295 struct lis2dh_data *lis2dh = dev->data; in lis2dh_acc_slope_config() local
303 status = lis2dh->hw_tf->read_reg(dev, LIS2DH_REG_CTRL4, in lis2dh_acc_slope_config()
327 status = lis2dh->hw_tf->write_reg(dev, in lis2dh_acc_slope_config()
334 status = lis2dh->hw_tf->write_reg(dev, in lis2dh_acc_slope_config()
349 status = lis2dh->hw_tf->write_reg(dev, in lis2dh_acc_slope_config()
356 status = lis2dh->hw_tf->write_reg(dev, in lis2dh_acc_slope_config()
367 struct lis2dh_data *lis2dh = dev->data; in lis2dh_acc_hp_filter_set() local
370 status = lis2dh->hw_tf->update_reg(dev, LIS2DH_REG_CTRL2, in lis2dh_acc_hp_filter_set()
383 struct lis2dh_data *lis2dh = in lis2dh_gpio_int1_callback() local
388 atomic_set_bit(&lis2dh->trig_flags, TRIGGED_INT1); in lis2dh_gpio_int1_callback()
391 setup_int1(lis2dh->dev, false); in lis2dh_gpio_int1_callback()
394 k_sem_give(&lis2dh->gpio_sem); in lis2dh_gpio_int1_callback()
396 k_work_submit(&lis2dh->work); in lis2dh_gpio_int1_callback()
403 struct lis2dh_data *lis2dh = in lis2dh_gpio_int2_callback() local
408 atomic_set_bit(&lis2dh->trig_flags, TRIGGED_INT2); in lis2dh_gpio_int2_callback()
411 setup_int2(lis2dh->dev, false); in lis2dh_gpio_int2_callback()
414 k_sem_give(&lis2dh->gpio_sem); in lis2dh_gpio_int2_callback()
416 k_work_submit(&lis2dh->work); in lis2dh_gpio_int2_callback()
422 struct lis2dh_data *lis2dh = dev->data; in lis2dh_thread_cb() local
427 unlikely(atomic_test_and_clear_bit(&lis2dh->trig_flags, in lis2dh_thread_cb()
438 unlikely(atomic_test_and_clear_bit(&lis2dh->trig_flags, in lis2dh_thread_cb()
449 atomic_test_and_clear_bit(&lis2dh->trig_flags, in lis2dh_thread_cb()
451 if (likely(lis2dh->handler_drdy != NULL)) { in lis2dh_thread_cb()
452 lis2dh->handler_drdy(dev, lis2dh->trig_drdy); in lis2dh_thread_cb()
458 if (likely(lis2dh->handler_drdy != NULL)) { in lis2dh_thread_cb()
466 atomic_test_and_clear_bit(&lis2dh->trig_flags, in lis2dh_thread_cb()
471 status = lis2dh->hw_tf->read_reg(dev, in lis2dh_thread_cb()
481 if (likely(lis2dh->handler_anymotion != NULL) && in lis2dh_thread_cb()
483 lis2dh->handler_anymotion(dev, lis2dh->trig_anymotion); in lis2dh_thread_cb()
489 status = lis2dh->hw_tf->read_reg(dev, LIS2DH_REG_CLICK_SRC, in lis2dh_thread_cb()
496 if (likely(lis2dh->handler_tap != NULL) && in lis2dh_thread_cb()
498 lis2dh->handler_tap(dev, lis2dh->trig_tap); in lis2dh_thread_cb()
506 if (lis2dh->handler_anymotion || lis2dh->handler_tap) { in lis2dh_thread_cb()
520 struct lis2dh_data *lis2dh = p1; in lis2dh_thread() local
523 k_sem_take(&lis2dh->gpio_sem, K_FOREVER); in lis2dh_thread()
524 lis2dh_thread_cb(lis2dh->dev); in lis2dh_thread()
532 struct lis2dh_data *lis2dh = in lis2dh_work_cb() local
535 lis2dh_thread_cb(lis2dh->dev); in lis2dh_work_cb()
541 struct lis2dh_data *lis2dh = dev->data; in lis2dh_init_interrupt() local
546 lis2dh->dev = dev; in lis2dh_init_interrupt()
549 k_sem_init(&lis2dh->gpio_sem, 0, K_SEM_MAX_LIMIT); in lis2dh_init_interrupt()
551 k_thread_create(&lis2dh->thread, lis2dh->thread_stack, CONFIG_LIS2DH_THREAD_STACK_SIZE, in lis2dh_init_interrupt()
552 lis2dh_thread, lis2dh, NULL, NULL, in lis2dh_init_interrupt()
555 lis2dh->work.handler = lis2dh_work_cb; in lis2dh_init_interrupt()
583 gpio_init_callback(&lis2dh->gpio_int1_cb, in lis2dh_init_interrupt()
587 status = gpio_add_callback(cfg->gpio_drdy.port, &lis2dh->gpio_int1_cb); in lis2dh_init_interrupt()
623 gpio_init_callback(&lis2dh->gpio_int2_cb, in lis2dh_init_interrupt()
628 status = gpio_add_callback(cfg->gpio_int.port, &lis2dh->gpio_int2_cb); in lis2dh_init_interrupt()
639 status = lis2dh->hw_tf->write_reg(dev, in lis2dh_init_interrupt()
648 status = lis2dh->hw_tf->write_reg(dev, in lis2dh_init_interrupt()
657 status = lis2dh->hw_tf->write_data(dev, in lis2dh_init_interrupt()
669 status = lis2dh->hw_tf->write_reg(dev, in lis2dh_init_interrupt()