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()
114 inv_sensors_timestamp_apply_odr(&st->timestamp, 0, 0, 0); in inv_mpu6050_prepare_fifo()
116 d = st->chip_config.user_ctrl | INV_MPU6050_BIT_FIFO_RST; in inv_mpu6050_prepare_fifo()
117 ret = regmap_write(st->map, st->reg->user_ctrl, d); in inv_mpu6050_prepare_fifo()
122 if (st->chip_config.gyro_fifo_enable) in inv_mpu6050_prepare_fifo()
124 if (st->chip_config.accl_fifo_enable) in inv_mpu6050_prepare_fifo()
126 if (st->chip_config.temp_fifo_enable) in inv_mpu6050_prepare_fifo()
128 if (st->chip_config.magn_fifo_enable) in inv_mpu6050_prepare_fifo()
130 ret = regmap_write(st->map, st->reg->fifo_en, d); in inv_mpu6050_prepare_fifo()
134 d = st->chip_config.user_ctrl | INV_MPU6050_BIT_FIFO_EN; in inv_mpu6050_prepare_fifo()
135 ret = regmap_write(st->map, st->reg->user_ctrl, d); in inv_mpu6050_prepare_fifo()
139 ret = regmap_write(st->map, st->reg->int_enable, in inv_mpu6050_prepare_fifo()
142 ret = regmap_write(st->map, st->reg->int_enable, 0); in inv_mpu6050_prepare_fifo()
145 ret = regmap_write(st->map, st->reg->fifo_en, 0); in inv_mpu6050_prepare_fifo()
149 ret = regmap_write(st->map, st->reg->user_ctrl, in inv_mpu6050_prepare_fifo()
150 st->chip_config.user_ctrl); in inv_mpu6050_prepare_fifo()
163 struct inv_mpu6050_state *st = iio_priv(indio_dev); in inv_mpu6050_set_enable() local
164 struct device *pdev = regmap_get_device(st->map); in inv_mpu6050_set_enable()
177 result = inv_mpu6050_switch_engine(st, false, ~scan); in inv_mpu6050_set_enable()
180 result = inv_mpu6050_switch_engine(st, true, scan); in inv_mpu6050_set_enable()
183 st->skip_samples = inv_compute_skip_samples(st); in inv_mpu6050_set_enable()
184 result = inv_mpu6050_prepare_fifo(st, true); in inv_mpu6050_set_enable()
188 st->chip_config.gyro_fifo_enable = 0; in inv_mpu6050_set_enable()
189 st->chip_config.accl_fifo_enable = 0; in inv_mpu6050_set_enable()
190 st->chip_config.temp_fifo_enable = 0; in inv_mpu6050_set_enable()
191 st->chip_config.magn_fifo_enable = 0; in inv_mpu6050_set_enable()
192 result = inv_mpu6050_prepare_fifo(st, false); in inv_mpu6050_set_enable()
215 struct inv_mpu6050_state *st = iio_priv(indio_dev); in inv_mpu_data_rdy_trigger_set_state() local
218 mutex_lock(&st->lock); in inv_mpu_data_rdy_trigger_set_state()
220 mutex_unlock(&st->lock); in inv_mpu_data_rdy_trigger_set_state()
232 struct inv_mpu6050_state *st = iio_priv(indio_dev); in inv_mpu6050_probe_trigger() local
234 st->trig = devm_iio_trigger_alloc(&indio_dev->dev, in inv_mpu6050_probe_trigger()
238 if (!st->trig) in inv_mpu6050_probe_trigger()
241 ret = devm_request_irq(&indio_dev->dev, st->irq, in inv_mpu6050_probe_trigger()
245 st->trig); in inv_mpu6050_probe_trigger()
249 st->trig->dev.parent = regmap_get_device(st->map); in inv_mpu6050_probe_trigger()
250 st->trig->ops = &inv_mpu_trigger_ops; in inv_mpu6050_probe_trigger()
251 iio_trigger_set_drvdata(st->trig, indio_dev); in inv_mpu6050_probe_trigger()
253 ret = devm_iio_trigger_register(&indio_dev->dev, st->trig); in inv_mpu6050_probe_trigger()
257 indio_dev->trig = iio_trigger_get(st->trig); in inv_mpu6050_probe_trigger()