Lines Matching +full:analog +full:- +full:pass
1 // SPDX-License-Identifier: GPL-2.0-or-later
6 * Copyright (C) 2020 Analog Devices, Inc.
83 * Available cut-off frequencies of the low pass filter in Hz.
98 * Available cut-off frequencies of the high pass filter in Hz.
121 mutex_lock(&st->lock); in adxrs290_get_rate_data()
122 temp = spi_w8r16(st->spi, cmd); in adxrs290_get_rate_data()
131 mutex_unlock(&st->lock); in adxrs290_get_rate_data()
142 mutex_lock(&st->lock); in adxrs290_get_temp_data()
143 temp = spi_w8r16(st->spi, cmd); in adxrs290_get_temp_data()
153 mutex_unlock(&st->lock); in adxrs290_get_temp_data()
164 mutex_lock(&st->lock); in adxrs290_get_3db_freq()
165 temp = spi_w8r8(st->spi, cmd); in adxrs290_get_3db_freq()
175 mutex_unlock(&st->lock); in adxrs290_get_3db_freq()
200 return -EINVAL; in adxrs290_find_match()
212 return adxrs290_spi_write_reg(st->spi, ADXRS290_REG_FILTER, val); in adxrs290_set_filter_freq()
220 if (st->mode == mode) in adxrs290_set_mode()
223 mutex_lock(&st->lock); in adxrs290_set_mode()
225 ret = spi_w8r8(st->spi, ADXRS290_READ_REG(ADXRS290_REG_POWER_CTL)); in adxrs290_set_mode()
239 ret = -EINVAL; in adxrs290_set_mode()
243 ret = adxrs290_spi_write_reg(st->spi, ADXRS290_REG_POWER_CTL, val); in adxrs290_set_mode()
245 dev_err(&st->spi->dev, "unable to set mode: %d\n", ret); in adxrs290_set_mode()
250 st->mode = mode; in adxrs290_set_mode()
253 mutex_unlock(&st->lock); in adxrs290_set_mode()
267 struct spi_device *spi = st->spi; in adxrs290_initial_setup()
275 st->mode = ADXRS290_MODE_MEASUREMENT; in adxrs290_initial_setup()
277 return devm_add_action_or_reset(&spi->dev, adxrs290_chip_off_action, in adxrs290_initial_setup()
297 switch (chan->type) { in adxrs290_read_raw()
300 ADXRS290_READ_REG(chan->address), in adxrs290_read_raw()
315 ret = -EINVAL; in adxrs290_read_raw()
322 switch (chan->type) { in adxrs290_read_raw()
333 return -EINVAL; in adxrs290_read_raw()
336 switch (chan->type) { in adxrs290_read_raw()
338 t = st->lpf_3db_freq_idx; in adxrs290_read_raw()
343 return -EINVAL; in adxrs290_read_raw()
346 switch (chan->type) { in adxrs290_read_raw()
348 t = st->hpf_3db_freq_idx; in adxrs290_read_raw()
353 return -EINVAL; in adxrs290_read_raw()
357 return -EINVAL; in adxrs290_read_raw()
379 ret = -EINVAL; in adxrs290_write_raw()
383 /* caching the updated state of the low-pass filter */ in adxrs290_write_raw()
384 st->lpf_3db_freq_idx = lpf_idx; in adxrs290_write_raw()
385 /* retrieving the current state of the high-pass filter */ in adxrs290_write_raw()
386 hpf_idx = st->hpf_3db_freq_idx; in adxrs290_write_raw()
395 ret = -EINVAL; in adxrs290_write_raw()
399 /* caching the updated state of the high-pass filter */ in adxrs290_write_raw()
400 st->hpf_3db_freq_idx = hpf_idx; in adxrs290_write_raw()
401 /* retrieving the current state of the low-pass filter */ in adxrs290_write_raw()
402 lpf_idx = st->lpf_3db_freq_idx; in adxrs290_write_raw()
407 ret = -EINVAL; in adxrs290_write_raw()
436 return -EINVAL; in adxrs290_read_avail()
460 return adxrs290_reg_access_rw(st->spi, reg, readval); in adxrs290_reg_access()
462 return adxrs290_spi_write_reg(st->spi, reg, writeval); in adxrs290_reg_access()
475 ret = adxrs290_spi_write_reg(st->spi, ADXRS290_REG_DATA_RDY, val); in adxrs290_data_rdy_trigger_set_state()
477 dev_err(&st->spi->dev, "failed to start data rdy interrupt\n"); in adxrs290_data_rdy_trigger_set_state()
506 struct iio_dev *indio_dev = pf->indio_dev; in adxrs290_trigger_handler()
511 mutex_lock(&st->lock); in adxrs290_trigger_handler()
514 ret = spi_write_then_read(st->spi, &tx, sizeof(tx), st->buffer.channels, in adxrs290_trigger_handler()
515 sizeof(st->buffer.channels)); in adxrs290_trigger_handler()
519 iio_push_to_buffers_with_timestamp(indio_dev, &st->buffer, in adxrs290_trigger_handler()
520 pf->timestamp); in adxrs290_trigger_handler()
523 mutex_unlock(&st->lock); in adxrs290_trigger_handler()
524 iio_trigger_notify_done(indio_dev->trig); in adxrs290_trigger_handler()
586 if (!st->spi->irq) { in adxrs290_probe_trigger()
587 dev_info(&st->spi->dev, "no irq, using polling\n"); in adxrs290_probe_trigger()
591 st->dready_trig = devm_iio_trigger_alloc(&st->spi->dev, "%s-dev%d", in adxrs290_probe_trigger()
592 indio_dev->name, in adxrs290_probe_trigger()
594 if (!st->dready_trig) in adxrs290_probe_trigger()
595 return -ENOMEM; in adxrs290_probe_trigger()
597 st->dready_trig->ops = &adxrs290_trigger_ops; in adxrs290_probe_trigger()
598 iio_trigger_set_drvdata(st->dready_trig, indio_dev); in adxrs290_probe_trigger()
600 ret = devm_request_irq(&st->spi->dev, st->spi->irq, in adxrs290_probe_trigger()
602 IRQF_ONESHOT, "adxrs290_irq", st->dready_trig); in adxrs290_probe_trigger()
604 return dev_err_probe(&st->spi->dev, ret, in adxrs290_probe_trigger()
605 "request irq %d failed\n", st->spi->irq); in adxrs290_probe_trigger()
607 ret = devm_iio_trigger_register(&st->spi->dev, st->dready_trig); in adxrs290_probe_trigger()
609 dev_err(&st->spi->dev, "iio trigger register failed\n"); in adxrs290_probe_trigger()
613 indio_dev->trig = iio_trigger_get(st->dready_trig); in adxrs290_probe_trigger()
625 indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*st)); in adxrs290_probe()
627 return -ENOMEM; in adxrs290_probe()
630 st->spi = spi; in adxrs290_probe()
632 indio_dev->name = "adxrs290"; in adxrs290_probe()
633 indio_dev->modes = INDIO_DIRECT_MODE; in adxrs290_probe()
634 indio_dev->channels = adxrs290_channels; in adxrs290_probe()
635 indio_dev->num_channels = ARRAY_SIZE(adxrs290_channels); in adxrs290_probe()
636 indio_dev->info = &adxrs290_info; in adxrs290_probe()
637 indio_dev->available_scan_masks = adxrs290_avail_scan_masks; in adxrs290_probe()
639 mutex_init(&st->lock); in adxrs290_probe()
643 dev_err(&spi->dev, "Wrong ADI ID 0x%02x\n", val); in adxrs290_probe()
644 return -ENODEV; in adxrs290_probe()
649 dev_err(&spi->dev, "Wrong MEMS ID 0x%02x\n", val); in adxrs290_probe()
650 return -ENODEV; in adxrs290_probe()
655 dev_err(&spi->dev, "Wrong DEV ID 0x%02x\n", val); in adxrs290_probe()
656 return -ENODEV; in adxrs290_probe()
660 st->mode = ADXRS290_MODE_STANDBY; in adxrs290_probe()
674 st->lpf_3db_freq_idx = val; in adxrs290_probe()
675 st->hpf_3db_freq_idx = val2; in adxrs290_probe()
677 ret = devm_iio_triggered_buffer_setup(&spi->dev, indio_dev, in adxrs290_probe()
681 return dev_err_probe(&spi->dev, ret, in adxrs290_probe()
688 return devm_iio_device_register(&spi->dev, indio_dev); in adxrs290_probe()
707 MODULE_DESCRIPTION("Analog Devices ADXRS290 Gyroscope SPI driver");