Lines Matching full:sensor

106 st_lsm6dsx_get_decimator_val(struct st_lsm6dsx_sensor *sensor, u32 max_odr)  in st_lsm6dsx_get_decimator_val()  argument
109 u32 decimator = max_odr / sensor->hwfifo_odr_mHz; in st_lsm6dsx_get_decimator_val()
120 sensor->decimator = decimator; in st_lsm6dsx_get_decimator_val()
127 struct st_lsm6dsx_sensor *sensor; in st_lsm6dsx_get_max_min_odr() local
135 sensor = iio_priv(hw->iio_devs[i]); in st_lsm6dsx_get_max_min_odr()
137 if (!(hw->enable_mask & BIT(sensor->id))) in st_lsm6dsx_get_max_min_odr()
140 *max_odr = max(*max_odr, sensor->hwfifo_odr_mHz); in st_lsm6dsx_get_max_min_odr()
141 *min_odr = min(*min_odr, sensor->hwfifo_odr_mHz); in st_lsm6dsx_get_max_min_odr()
145 static u8 st_lsm6dsx_get_sip(struct st_lsm6dsx_sensor *sensor, u32 min_odr) in st_lsm6dsx_get_sip() argument
147 u8 sip = sensor->hwfifo_odr_mHz / min_odr; in st_lsm6dsx_get_sip()
155 struct st_lsm6dsx_sensor *sensor; in st_lsm6dsx_update_decimators() local
169 sensor = iio_priv(hw->iio_devs[i]); in st_lsm6dsx_update_decimators()
171 if (hw->enable_mask & BIT(sensor->id)) { in st_lsm6dsx_update_decimators()
172 sensor->sip = st_lsm6dsx_get_sip(sensor, min_odr); in st_lsm6dsx_update_decimators()
173 data = st_lsm6dsx_get_decimator_val(sensor, max_odr); in st_lsm6dsx_update_decimators()
175 sensor->sip = 0; in st_lsm6dsx_update_decimators()
178 ts_sip = max_t(u16, ts_sip, sensor->sip); in st_lsm6dsx_update_decimators()
180 dec_reg = &hw->settings->decimator[sensor->id]; in st_lsm6dsx_update_decimators()
190 sip += sensor->sip; in st_lsm6dsx_update_decimators()
221 static int st_lsm6dsx_set_fifo_odr(struct st_lsm6dsx_sensor *sensor, in st_lsm6dsx_set_fifo_odr() argument
224 struct st_lsm6dsx_hw *hw = sensor->hw; in st_lsm6dsx_set_fifo_odr()
228 batch_reg = &hw->settings->batch[sensor->id]; in st_lsm6dsx_set_fifo_odr()
235 err = st_lsm6dsx_check_odr(sensor, sensor->hwfifo_odr_mHz, in st_lsm6dsx_set_fifo_odr()
255 int st_lsm6dsx_update_watermark(struct st_lsm6dsx_sensor *sensor, u16 watermark) in st_lsm6dsx_update_watermark() argument
258 struct st_lsm6dsx_hw *hw = sensor->hw; in st_lsm6dsx_update_watermark()
275 cur_watermark = (cur_sensor == sensor) ? watermark in st_lsm6dsx_update_watermark()
306 struct st_lsm6dsx_sensor *sensor; in st_lsm6dsx_reset_hw_ts() local
319 sensor = iio_priv(hw->iio_devs[i]); in st_lsm6dsx_reset_hw_ts()
324 sensor->ts_ref = iio_get_time_ns(hw->iio_devs[i]); in st_lsm6dsx_reset_hw_ts()
425 * sensor. in st_lsm6dsx_read_fifo()
474 * reset (the sensor generates an interrupt in st_lsm6dsx_read_fifo()
541 struct st_lsm6dsx_sensor *sensor; in st_lsm6dsx_push_tagged_data() local
583 sensor = iio_priv(iio_dev); in st_lsm6dsx_push_tagged_data()
585 ts + sensor->ts_ref); in st_lsm6dsx_push_tagged_data()
661 * reset (the sensor generates an interrupt in st_lsm6dsx_read_tagged_fifo()
701 st_lsm6dsx_update_samples_to_discard(struct st_lsm6dsx_sensor *sensor) in st_lsm6dsx_update_samples_to_discard() argument
704 struct st_lsm6dsx_hw *hw = sensor->hw; in st_lsm6dsx_update_samples_to_discard()
707 if (sensor->id != ST_LSM6DSX_ID_GYRO && in st_lsm6dsx_update_samples_to_discard()
708 sensor->id != ST_LSM6DSX_ID_ACC) in st_lsm6dsx_update_samples_to_discard()
715 data = &hw->settings->samples_to_discard[sensor->id]; in st_lsm6dsx_update_samples_to_discard()
717 if (data->val[i].milli_hz == sensor->hwfifo_odr_mHz) { in st_lsm6dsx_update_samples_to_discard()
718 sensor->samples_to_discard = data->val[i].samples; in st_lsm6dsx_update_samples_to_discard()
724 int st_lsm6dsx_update_fifo(struct st_lsm6dsx_sensor *sensor, bool enable) in st_lsm6dsx_update_fifo() argument
726 struct st_lsm6dsx_hw *hw = sensor->hw; in st_lsm6dsx_update_fifo()
733 fifo_mask = hw->fifo_mask | BIT(sensor->id); in st_lsm6dsx_update_fifo()
735 fifo_mask = hw->fifo_mask & ~BIT(sensor->id); in st_lsm6dsx_update_fifo()
744 st_lsm6dsx_update_samples_to_discard(sensor); in st_lsm6dsx_update_fifo()
746 err = st_lsm6dsx_device_set_enable(sensor, enable); in st_lsm6dsx_update_fifo()
750 err = st_lsm6dsx_set_fifo_odr(sensor, enable); in st_lsm6dsx_update_fifo()
758 err = st_lsm6dsx_update_watermark(sensor, sensor->watermark); in st_lsm6dsx_update_fifo()
778 struct st_lsm6dsx_sensor *sensor = iio_priv(iio_dev); in st_lsm6dsx_buffer_preenable() local
779 struct st_lsm6dsx_hw *hw = sensor->hw; in st_lsm6dsx_buffer_preenable()
784 return hw->settings->fifo_ops.update_fifo(sensor, true); in st_lsm6dsx_buffer_preenable()
789 struct st_lsm6dsx_sensor *sensor = iio_priv(iio_dev); in st_lsm6dsx_buffer_postdisable() local
790 struct st_lsm6dsx_hw *hw = sensor->hw; in st_lsm6dsx_buffer_postdisable()
795 return hw->settings->fifo_ops.update_fifo(sensor, false); in st_lsm6dsx_buffer_postdisable()
806 struct st_lsm6dsx_sensor *sensor = iio_priv(dev_to_iio_dev(dev)); in st_lsm6dsx_hwfifo_odr_show() local
808 return sysfs_emit(buf, "%d.%03d\n", sensor->hwfifo_odr_mHz / 1000, in st_lsm6dsx_hwfifo_odr_show()
809 sensor->hwfifo_odr_mHz % 1000); in st_lsm6dsx_hwfifo_odr_show()
817 struct st_lsm6dsx_sensor *sensor = iio_priv(iio_dev); in st_lsm6dsx_hwfifo_odr_store() local
831 ret = st_lsm6dsx_check_odr(sensor, hwfifo_odr, &data); in st_lsm6dsx_hwfifo_odr_store()
837 /* the batch data rate must not exceed the sensor output data rate */ in st_lsm6dsx_hwfifo_odr_store()
838 if (hwfifo_odr <= sensor->odr) in st_lsm6dsx_hwfifo_odr_store()
839 sensor->hwfifo_odr_mHz = hwfifo_odr; in st_lsm6dsx_hwfifo_odr_store()