/* * If the MPU6050 is just used as a trigger, then the scan mask * is not allocated so we simply enable the temperature channel * as a dummy and bail out.
*/ if (!indio_dev->active_scan_mask) {
st->chip_config.temp_fifo_enable = true; return INV_MPU6050_SENSOR_TEMP;
}
/* mag first sample is always not ready, skip it */ if (st->chip_config.magn_fifo_enable)
skip_samples = 1;
return skip_samples;
}
int inv_mpu6050_prepare_fifo(struct inv_mpu6050_state *st, bool enable)
{
uint8_t d; int ret;
if (enable) { /* reset timestamping */
inv_sensors_timestamp_reset(&st->timestamp); /* reset FIFO */
d = st->chip_config.user_ctrl | INV_MPU6050_BIT_FIFO_RST;
ret = regmap_write(st->map, st->reg->user_ctrl, d); if (ret) return ret; /* enable sensor output to FIFO */
d = 0; if (st->chip_config.gyro_fifo_enable)
d |= INV_MPU6050_BITS_GYRO_OUT; if (st->chip_config.accl_fifo_enable)
d |= INV_MPU6050_BIT_ACCEL_OUT; if (st->chip_config.temp_fifo_enable)
d |= INV_MPU6050_BIT_TEMP_OUT; if (st->chip_config.magn_fifo_enable)
d |= INV_MPU6050_BIT_SLAVE_0;
ret = regmap_write(st->map, st->reg->fifo_en, d); if (ret) return ret; /* enable FIFO reading */
d = st->chip_config.user_ctrl | INV_MPU6050_BIT_FIFO_EN;
ret = regmap_write(st->map, st->reg->user_ctrl, d); if (ret) return ret; /* enable data interrupt */
ret = regmap_update_bits(st->map, st->reg->int_enable,
INV_MPU6050_BIT_DATA_RDY_EN, INV_MPU6050_BIT_DATA_RDY_EN);
} else { /* disable data interrupt */
ret = regmap_update_bits(st->map, st->reg->int_enable,
INV_MPU6050_BIT_DATA_RDY_EN, 0); if (ret) return ret;
ret = regmap_write(st->map, st->reg->fifo_en, 0); if (ret) return ret; /* restore user_ctrl for disabling FIFO reading */
ret = regmap_write(st->map, st->reg->user_ctrl,
st->chip_config.user_ctrl);
}
switch (st->chip_type) { case INV_MPU6000: case INV_MPU6050: case INV_MPU9150: /* * WoM is not supported and interrupt status read seems to be broken for * some chips. Since data ready is the only interrupt, bypass interrupt * status read and always assert data ready bit.
*/
wom_bits = 0;
int_status = INV_MPU6050_BIT_RAW_DATA_RDY_INT; goto data_ready_interrupt; case INV_MPU6500: case INV_MPU6515: case INV_MPU6880: case INV_MPU9250: case INV_MPU9255:
wom_bits = INV_MPU6500_BIT_WOM_INT; break; default:
wom_bits = INV_ICM20608_BIT_WOM_INT; break;
}
scoped_guard(mutex, &st->lock) { /* ack interrupt and check status */
result = regmap_read(st->map, st->reg->int_status, &int_status); if (result) {
dev_err(regmap_get_device(st->map), "failed to ack interrupt\n"); return IRQ_HANDLED;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.