Lines Matching full:fifo

20 /* FIFO header: 1 byte */
52 /* FIFO empty */ in inv_icm42600_fifo_decode_packet()
105 if (st->fifo.en & INV_ICM42600_SENSOR_GYRO) in inv_icm42600_buffer_update_fifo_period()
110 if (st->fifo.en & INV_ICM42600_SENSOR_ACCEL) in inv_icm42600_buffer_update_fifo_period()
120 st->fifo.period = period; in inv_icm42600_buffer_update_fifo_period()
129 /* update only FIFO EN bits */ in inv_icm42600_buffer_set_fifo_en()
147 st->fifo.en = fifo_en; in inv_icm42600_buffer_set_fifo_en()
182 * inv_icm42600_buffer_update_watermark - update watermark FIFO threshold
187 * FIFO watermark threshold is computed based on the required watermark values
200 * to the FIFO frequency. Beware that this is only true because we are not
213 packet_size = inv_icm42600_get_packet_size(st->fifo.en); in inv_icm42600_buffer_update_watermark()
216 wm_gyro = inv_icm42600_wm_truncate(st->fifo.watermark.gyro, packet_size); in inv_icm42600_buffer_update_watermark()
217 wm_accel = inv_icm42600_wm_truncate(st->fifo.watermark.accel, packet_size); in inv_icm42600_buffer_update_watermark()
230 st->fifo.watermark.eff_accel = wm_accel; in inv_icm42600_buffer_update_watermark()
233 st->fifo.watermark.eff_gyro = wm_gyro; in inv_icm42600_buffer_update_watermark()
250 st->fifo.watermark.eff_gyro = latency / period_gyro; in inv_icm42600_buffer_update_watermark()
251 if (st->fifo.watermark.eff_gyro < 1) in inv_icm42600_buffer_update_watermark()
252 st->fifo.watermark.eff_gyro = 1; in inv_icm42600_buffer_update_watermark()
253 st->fifo.watermark.eff_accel = latency / period_accel; in inv_icm42600_buffer_update_watermark()
254 if (st->fifo.watermark.eff_accel < 1) in inv_icm42600_buffer_update_watermark()
255 st->fifo.watermark.eff_accel = 1; in inv_icm42600_buffer_update_watermark()
261 /* changing FIFO watermark requires to turn off watermark interrupt */ in inv_icm42600_buffer_update_watermark()
303 * update_scan_mode callback is turning sensors on and setting data FIFO enable
313 /* exit if FIFO is already on */ in inv_icm42600_buffer_postenable()
314 if (st->fifo.on) { in inv_icm42600_buffer_postenable()
319 /* set FIFO threshold interrupt */ in inv_icm42600_buffer_postenable()
325 /* flush FIFO data */ in inv_icm42600_buffer_postenable()
331 /* set FIFO in streaming mode */ in inv_icm42600_buffer_postenable()
337 /* workaround: first read of FIFO count after reset is always 0 */ in inv_icm42600_buffer_postenable()
343 /* increase FIFO on counter */ in inv_icm42600_buffer_postenable()
344 st->fifo.on++; in inv_icm42600_buffer_postenable()
357 /* exit if there are several sensors using the FIFO */ in inv_icm42600_buffer_predisable()
358 if (st->fifo.on > 1) { in inv_icm42600_buffer_predisable()
363 /* set FIFO in bypass mode */ in inv_icm42600_buffer_predisable()
369 /* flush FIFO data */ in inv_icm42600_buffer_predisable()
375 /* disable FIFO threshold interrupt */ in inv_icm42600_buffer_predisable()
382 /* decrease FIFO on counter */ in inv_icm42600_buffer_predisable()
383 st->fifo.on--; in inv_icm42600_buffer_predisable()
403 watermark = &st->fifo.watermark.gyro; in inv_icm42600_buffer_postdisable()
406 watermark = &st->fifo.watermark.accel; in inv_icm42600_buffer_postdisable()
413 ret = inv_icm42600_buffer_set_fifo_en(st, st->fifo.en & ~sensor); in inv_icm42600_buffer_postdisable()
430 /* if FIFO is off, turn temperature off */ in inv_icm42600_buffer_postdisable()
431 if (!st->fifo.on) in inv_icm42600_buffer_postdisable()
467 st->fifo.count = 0; in inv_icm42600_buffer_fifo_read()
468 st->fifo.nb.gyro = 0; in inv_icm42600_buffer_fifo_read()
469 st->fifo.nb.accel = 0; in inv_icm42600_buffer_fifo_read()
470 st->fifo.nb.total = 0; in inv_icm42600_buffer_fifo_read()
472 /* compute maximum FIFO read size */ in inv_icm42600_buffer_fifo_read()
474 max_count = sizeof(st->fifo.data); in inv_icm42600_buffer_fifo_read()
476 max_count = max * inv_icm42600_get_packet_size(st->fifo.en); in inv_icm42600_buffer_fifo_read()
478 /* read FIFO count value */ in inv_icm42600_buffer_fifo_read()
484 st->fifo.count = be16_to_cpup(raw_fifo_count); in inv_icm42600_buffer_fifo_read()
486 /* check and clamp FIFO count value */ in inv_icm42600_buffer_fifo_read()
487 if (st->fifo.count == 0) in inv_icm42600_buffer_fifo_read()
489 if (st->fifo.count > max_count) in inv_icm42600_buffer_fifo_read()
490 st->fifo.count = max_count; in inv_icm42600_buffer_fifo_read()
492 /* read all FIFO data in internal buffer */ in inv_icm42600_buffer_fifo_read()
494 st->fifo.data, st->fifo.count); in inv_icm42600_buffer_fifo_read()
499 for (i = 0; i < st->fifo.count; i += size) { in inv_icm42600_buffer_fifo_read()
500 size = inv_icm42600_fifo_decode_packet(&st->fifo.data[i], in inv_icm42600_buffer_fifo_read()
505 st->fifo.nb.gyro++; in inv_icm42600_buffer_fifo_read()
507 st->fifo.nb.accel++; in inv_icm42600_buffer_fifo_read()
508 st->fifo.nb.total++; in inv_icm42600_buffer_fifo_read()
521 if (st->fifo.nb.total == 0) in inv_icm42600_buffer_fifo_parse()
524 /* handle gyroscope timestamp and FIFO data parsing */ in inv_icm42600_buffer_fifo_parse()
525 if (st->fifo.nb.gyro > 0) { in inv_icm42600_buffer_fifo_parse()
527 inv_sensors_timestamp_interrupt(ts, st->fifo.watermark.eff_gyro, in inv_icm42600_buffer_fifo_parse()
534 /* handle accelerometer timestamp and FIFO data parsing */ in inv_icm42600_buffer_fifo_parse()
535 if (st->fifo.nb.accel > 0) { in inv_icm42600_buffer_fifo_parse()
537 inv_sensors_timestamp_interrupt(ts, st->fifo.watermark.eff_accel, in inv_icm42600_buffer_fifo_parse()
563 if (st->fifo.nb.total == 0) in inv_icm42600_buffer_hwfifo_flush()
566 if (st->fifo.nb.gyro > 0) { in inv_icm42600_buffer_hwfifo_flush()
568 inv_sensors_timestamp_interrupt(ts, st->fifo.nb.gyro, gyro_ts); in inv_icm42600_buffer_hwfifo_flush()
574 if (st->fifo.nb.accel > 0) { in inv_icm42600_buffer_hwfifo_flush()
576 inv_sensors_timestamp_interrupt(ts, st->fifo.nb.accel, accel_ts); in inv_icm42600_buffer_hwfifo_flush()
590 st->fifo.watermark.eff_gyro = 1; in inv_icm42600_buffer_init()
591 st->fifo.watermark.eff_accel = 1; in inv_icm42600_buffer_init()
594 * Default FIFO configuration (bits 7 to 5) in inv_icm42600_buffer_init()
596 * - FIFO count in bytes in inv_icm42600_buffer_init()
597 * - FIFO count in big endian in inv_icm42600_buffer_init()
606 * Enable FIFO partial read and continuous watermark interrupt. in inv_icm42600_buffer_init()
607 * Disable all FIFO EN bits. in inv_icm42600_buffer_init()