Lines Matching refs:st
14 struct inv_mpu6050_state *st = iio_priv(indio_dev); in inv_scan_query_mpu6050() local
23 st->chip_config.temp_fifo_enable = true; in inv_scan_query_mpu6050()
27 st->chip_config.gyro_fifo_enable = in inv_scan_query_mpu6050()
35 st->chip_config.accl_fifo_enable = in inv_scan_query_mpu6050()
43 st->chip_config.temp_fifo_enable = in inv_scan_query_mpu6050()
47 if (st->chip_config.gyro_fifo_enable) in inv_scan_query_mpu6050()
49 if (st->chip_config.accl_fifo_enable) in inv_scan_query_mpu6050()
51 if (st->chip_config.temp_fifo_enable) in inv_scan_query_mpu6050()
59 struct inv_mpu6050_state *st = iio_priv(indio_dev); in inv_scan_query_mpu9x50() local
65 if (st->magn_disabled) in inv_scan_query_mpu9x50()
68 st->chip_config.magn_fifo_enable = in inv_scan_query_mpu9x50()
75 if (st->chip_config.magn_fifo_enable) in inv_scan_query_mpu9x50()
83 struct inv_mpu6050_state *st = iio_priv(indio_dev); in inv_scan_query() local
85 switch (st->chip_type) { in inv_scan_query()
95 static unsigned int inv_compute_skip_samples(const struct inv_mpu6050_state *st) in inv_compute_skip_samples() argument
100 if (st->chip_config.magn_fifo_enable) in inv_compute_skip_samples()
106 int inv_mpu6050_prepare_fifo(struct inv_mpu6050_state *st, bool enable) in inv_mpu6050_prepare_fifo() argument
113 inv_sensors_timestamp_reset(&st->timestamp); in inv_mpu6050_prepare_fifo()
115 d = st->chip_config.user_ctrl | INV_MPU6050_BIT_FIFO_RST; in inv_mpu6050_prepare_fifo()
116 ret = regmap_write(st->map, st->reg->user_ctrl, d); in inv_mpu6050_prepare_fifo()
121 if (st->chip_config.gyro_fifo_enable) in inv_mpu6050_prepare_fifo()
123 if (st->chip_config.accl_fifo_enable) in inv_mpu6050_prepare_fifo()
125 if (st->chip_config.temp_fifo_enable) in inv_mpu6050_prepare_fifo()
127 if (st->chip_config.magn_fifo_enable) in inv_mpu6050_prepare_fifo()
129 ret = regmap_write(st->map, st->reg->fifo_en, d); in inv_mpu6050_prepare_fifo()
133 d = st->chip_config.user_ctrl | INV_MPU6050_BIT_FIFO_EN; in inv_mpu6050_prepare_fifo()
134 ret = regmap_write(st->map, st->reg->user_ctrl, d); in inv_mpu6050_prepare_fifo()
138 ret = regmap_write(st->map, st->reg->int_enable, in inv_mpu6050_prepare_fifo()
141 ret = regmap_write(st->map, st->reg->int_enable, 0); in inv_mpu6050_prepare_fifo()
144 ret = regmap_write(st->map, st->reg->fifo_en, 0); in inv_mpu6050_prepare_fifo()
148 ret = regmap_write(st->map, st->reg->user_ctrl, in inv_mpu6050_prepare_fifo()
149 st->chip_config.user_ctrl); in inv_mpu6050_prepare_fifo()
162 struct inv_mpu6050_state *st = iio_priv(indio_dev); in inv_mpu6050_set_enable() local
163 struct device *pdev = regmap_get_device(st->map); in inv_mpu6050_set_enable()
176 result = inv_mpu6050_switch_engine(st, false, ~scan); in inv_mpu6050_set_enable()
179 result = inv_mpu6050_switch_engine(st, true, scan); in inv_mpu6050_set_enable()
182 st->skip_samples = inv_compute_skip_samples(st); in inv_mpu6050_set_enable()
183 result = inv_mpu6050_prepare_fifo(st, true); in inv_mpu6050_set_enable()
187 result = inv_mpu6050_prepare_fifo(st, false); in inv_mpu6050_set_enable()
210 struct inv_mpu6050_state *st = iio_priv(indio_dev); in inv_mpu_data_rdy_trigger_set_state() local
213 mutex_lock(&st->lock); in inv_mpu_data_rdy_trigger_set_state()
215 mutex_unlock(&st->lock); in inv_mpu_data_rdy_trigger_set_state()
227 struct inv_mpu6050_state *st = iio_priv(indio_dev); in inv_mpu6050_probe_trigger() local
229 st->trig = devm_iio_trigger_alloc(&indio_dev->dev, in inv_mpu6050_probe_trigger()
233 if (!st->trig) in inv_mpu6050_probe_trigger()
236 ret = devm_request_irq(&indio_dev->dev, st->irq, in inv_mpu6050_probe_trigger()
240 st->trig); in inv_mpu6050_probe_trigger()
244 st->trig->dev.parent = regmap_get_device(st->map); in inv_mpu6050_probe_trigger()
245 st->trig->ops = &inv_mpu_trigger_ops; in inv_mpu6050_probe_trigger()
246 iio_trigger_set_drvdata(st->trig, indio_dev); in inv_mpu6050_probe_trigger()
248 ret = devm_iio_trigger_register(&indio_dev->dev, st->trig); in inv_mpu6050_probe_trigger()
252 indio_dev->trig = iio_trigger_get(st->trig); in inv_mpu6050_probe_trigger()