Lines Matching +full:quad +full:- +full:channel
1 // SPDX-License-Identifier: GPL-2.0-only
117 static const char * const quad_se_mode_names[] = { "se-pos", "se-neg", "diff" };
142 st->data[0] = ADMV1014_READ | FIELD_PREP(ADMV1014_REG_ADDR_READ_MSK, reg); in __admv1014_spi_read()
143 st->data[1] = 0; in __admv1014_spi_read()
144 st->data[2] = 0; in __admv1014_spi_read()
146 t.rx_buf = &st->data[0]; in __admv1014_spi_read()
147 t.tx_buf = &st->data[0]; in __admv1014_spi_read()
148 t.len = sizeof(st->data); in __admv1014_spi_read()
150 ret = spi_sync_transfer(st->spi, &t, 1); in __admv1014_spi_read()
154 *val = FIELD_GET(ADMV1014_REG_DATA_MSK, get_unaligned_be24(&st->data[0])); in __admv1014_spi_read()
164 mutex_lock(&st->lock); in admv1014_spi_read()
166 mutex_unlock(&st->lock); in admv1014_spi_read()
176 FIELD_PREP(ADMV1014_REG_ADDR_WRITE_MSK, reg), &st->data[0]); in __admv1014_spi_write()
178 return spi_write(st->spi, &st->data[0], 3); in __admv1014_spi_write()
186 mutex_lock(&st->lock); in admv1014_spi_write()
188 mutex_unlock(&st->lock); in admv1014_spi_write()
213 mutex_lock(&st->lock); in admv1014_spi_update_bits()
215 mutex_unlock(&st->lock); in admv1014_spi_update_bits()
223 u64 rate = clk_get_rate(st->clkin); in admv1014_update_quad_filters()
244 vcm_mv = regulator_get_voltage(st->regulators[0].consumer) / 1000; in admv1014_update_vcm_settings()
267 return -EINVAL; in admv1014_update_vcm_settings()
284 if (chan->channel2 == IIO_MOD_I) in admv1014_read_raw()
295 if (chan->channel2 == IIO_MOD_I) in admv1014_read_raw()
316 return -EINVAL; in admv1014_read_raw()
330 if (chan->channel2 == IIO_MOD_I) { in admv1014_write_raw()
340 if (chan->channel2 == IIO_MOD_I) { in admv1014_write_raw()
358 return -EINVAL; in admv1014_write_raw()
373 if (chan->channel2 == IIO_MOD_I) { in admv1014_read()
392 if (chan->channel2 == IIO_MOD_I) in admv1014_read()
398 return -EINVAL; in admv1014_read()
419 if (chan->channel2 == IIO_MOD_I) { in admv1014_write()
432 if (chan->channel2 == IIO_MOD_I) { in admv1014_write()
441 return -EINVAL; in admv1014_write()
462 return -EINVAL; in admv1014_read_avail()
487 "vcm", "vcc-if-bb", "vcc-vga", "vcc-vva", "vcc-lna-3p3",
488 "vcc-lna-1p5", "vcc-bg", "vcc-quad", "vcc-mixer"
497 mutex_lock(&st->lock); in admv1014_freq_change()
499 mutex_unlock(&st->lock); in admv1014_freq_change()
526 .channel = _channel, \
538 .channel = _channel, \
547 .channel = _channel, \
558 .channel = _channel, \
612 struct spi_device *spi = st->spi; in admv1014_init()
615 ret = regulator_bulk_enable(ADMV1014_NUM_REGULATORS, st->regulators); in admv1014_init()
617 dev_err(&spi->dev, "Failed to enable regulators"); in admv1014_init()
621 ret = devm_add_action_or_reset(&spi->dev, admv1014_reg_disable, st->regulators); in admv1014_init()
625 ret = clk_prepare_enable(st->clkin); in admv1014_init()
629 ret = devm_add_action_or_reset(&spi->dev, admv1014_clk_disable, st->clkin); in admv1014_init()
633 st->nb.notifier_call = admv1014_freq_change; in admv1014_init()
634 ret = devm_clk_notifier_register(&spi->dev, st->clkin, &st->nb); in admv1014_init()
638 ret = devm_add_action_or_reset(&spi->dev, admv1014_powerdown, st); in admv1014_init()
647 dev_err(&spi->dev, "ADMV1014 SPI software reset failed.\n"); in admv1014_init()
655 dev_err(&spi->dev, "ADMV1014 SPI software reset disable failed.\n"); in admv1014_init()
661 dev_err(&spi->dev, "Writing default Temperature Compensation value failed.\n"); in admv1014_init()
671 dev_err(&spi->dev, "Invalid Chip ID.\n"); in admv1014_init()
672 return -EINVAL; in admv1014_init()
678 st->quad_se_mode)); in admv1014_init()
680 dev_err(&spi->dev, "Writing Quad SE Mode failed.\n"); in admv1014_init()
686 dev_err(&spi->dev, "Update Quad Filters failed.\n"); in admv1014_init()
692 dev_err(&spi->dev, "Update VCM Settings failed.\n"); in admv1014_init()
701 enable_reg = FIELD_PREP(ADMV1014_P1DB_COMPENSATION_MSK, st->p1db_comp ? 3 : 0) | in admv1014_init()
703 (st->input_mode == ADMV1014_IF_MODE) ? 0 : 1) | in admv1014_init()
705 (st->input_mode == ADMV1014_IF_MODE) ? 1 : 0) | in admv1014_init()
706 FIELD_PREP(ADMV1014_DET_EN_MSK, st->det_en); in admv1014_init()
714 struct spi_device *spi = st->spi; in admv1014_properties_parse()
717 st->det_en = device_property_read_bool(&spi->dev, "adi,detector-enable"); in admv1014_properties_parse()
719 st->p1db_comp = device_property_read_bool(&spi->dev, "adi,p1db-compensation-enable"); in admv1014_properties_parse()
721 ret = device_property_match_property_string(&spi->dev, "adi,input-mode", in admv1014_properties_parse()
725 st->input_mode = ret; in admv1014_properties_parse()
727 st->input_mode = ADMV1014_IQ_MODE; in admv1014_properties_parse()
729 ret = device_property_match_property_string(&spi->dev, "adi,quad-se-mode", in admv1014_properties_parse()
733 st->quad_se_mode = ADMV1014_SE_MODE_POS + (ret * 3); in admv1014_properties_parse()
735 st->quad_se_mode = ADMV1014_SE_MODE_POS; in admv1014_properties_parse()
738 st->regulators[i].supply = admv1014_reg_name[i]; in admv1014_properties_parse()
740 ret = devm_regulator_bulk_get(&st->spi->dev, ADMV1014_NUM_REGULATORS, in admv1014_properties_parse()
741 st->regulators); in admv1014_properties_parse()
743 dev_err(&spi->dev, "Failed to request regulators"); in admv1014_properties_parse()
747 st->clkin = devm_clk_get(&spi->dev, "lo_in"); in admv1014_properties_parse()
748 if (IS_ERR(st->clkin)) in admv1014_properties_parse()
749 return dev_err_probe(&spi->dev, PTR_ERR(st->clkin), in admv1014_properties_parse()
761 indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*st)); in admv1014_probe()
763 return -ENOMEM; in admv1014_probe()
771 indio_dev->info = &admv1014_info; in admv1014_probe()
772 indio_dev->name = "admv1014"; in admv1014_probe()
774 if (st->input_mode == ADMV1014_IQ_MODE) { in admv1014_probe()
775 indio_dev->channels = admv1014_channels_iq; in admv1014_probe()
776 indio_dev->num_channels = ARRAY_SIZE(admv1014_channels_iq); in admv1014_probe()
778 indio_dev->channels = admv1014_channels_if; in admv1014_probe()
779 indio_dev->num_channels = ARRAY_SIZE(admv1014_channels_if); in admv1014_probe()
782 st->spi = spi; in admv1014_probe()
784 mutex_init(&st->lock); in admv1014_probe()
790 return devm_iio_device_register(&spi->dev, indio_dev); in admv1014_probe()