Lines Matching +full:quad +full:- +full:se +full:- +full:mode

1 // SPDX-License-Identifier: GPL-2.0-only
112 st->data[0] = ADMV1013_READ | FIELD_PREP(ADMV1013_REG_ADDR_READ_MSK, reg); in __admv1013_spi_read()
113 st->data[1] = 0x0; in __admv1013_spi_read()
114 st->data[2] = 0x0; in __admv1013_spi_read()
116 t.rx_buf = &st->data[0]; in __admv1013_spi_read()
117 t.tx_buf = &st->data[0]; in __admv1013_spi_read()
120 ret = spi_sync_transfer(st->spi, &t, 1); in __admv1013_spi_read()
124 *val = FIELD_GET(ADMV1013_REG_DATA_MSK, get_unaligned_be24(&st->data[0])); in __admv1013_spi_read()
134 mutex_lock(&st->lock); in admv1013_spi_read()
136 mutex_unlock(&st->lock); in admv1013_spi_read()
146 FIELD_PREP(ADMV1013_REG_ADDR_WRITE_MSK, reg), &st->data[0]); in __admv1013_spi_write()
148 return spi_write(st->spi, &st->data[0], 3); in __admv1013_spi_write()
156 mutex_lock(&st->lock); in admv1013_spi_write()
158 mutex_unlock(&st->lock); in admv1013_spi_write()
183 mutex_lock(&st->lock); in admv1013_spi_update_bits()
185 mutex_unlock(&st->lock); in admv1013_spi_update_bits()
200 switch (chan->channel) { in admv1013_read_raw()
208 return -EINVAL; in admv1013_read_raw()
215 if (!chan->channel) in admv1013_read_raw()
222 return -EINVAL; in admv1013_read_raw()
235 switch (chan->channel2) { in admv1013_write_raw()
243 return -EINVAL; in admv1013_write_raw()
246 if (!chan->channel) { in admv1013_write_raw()
256 return -EINVAL; in admv1013_write_raw()
277 return -EINVAL; in admv1013_read()
320 return -EINVAL; in admv1013_write()
329 u64 rate = clk_get_rate(st->clkin); in admv1013_update_quad_filters()
349 vcm = regulator_get_voltage(st->reg); in admv1013_update_mixer_vgate()
356 return -EINVAL; in admv1013_update_mixer_vgate()
388 mutex_lock(&st->lock); in admv1013_freq_change()
390 mutex_unlock(&st->lock); in admv1013_freq_change()
442 struct spi_device *spi = st->spi; in admv1013_init()
463 dev_err(&spi->dev, "Invalid Chip ID.\n"); in admv1013_init()
464 return -EINVAL; in admv1013_init()
471 data = FIELD_PREP(ADMV1013_QUAD_SE_MODE_MSK, st->quad_se_mode); in admv1013_init()
489 st->det_en | in admv1013_init()
490 st->input_mode); in admv1013_init()
529 struct spi_device *spi = st->spi; in admv1013_properties_parse()
531 st->det_en = device_property_read_bool(&spi->dev, "adi,detector-enable"); in admv1013_properties_parse()
533 ret = device_property_read_string(&spi->dev, "adi,input-mode", &str); in admv1013_properties_parse()
535 st->input_mode = ADMV1013_IQ_MODE; in admv1013_properties_parse()
538 st->input_mode = ADMV1013_IQ_MODE; in admv1013_properties_parse()
540 st->input_mode = ADMV1013_IF_MODE; in admv1013_properties_parse()
542 return -EINVAL; in admv1013_properties_parse()
544 ret = device_property_read_string(&spi->dev, "adi,quad-se-mode", &str); in admv1013_properties_parse()
546 st->quad_se_mode = ADMV1013_SE_MODE_DIFF; in admv1013_properties_parse()
549 st->quad_se_mode = ADMV1013_SE_MODE_DIFF; in admv1013_properties_parse()
550 else if (!strcmp(str, "se-pos")) in admv1013_properties_parse()
551 st->quad_se_mode = ADMV1013_SE_MODE_POS; in admv1013_properties_parse()
552 else if (!strcmp(str, "se-neg")) in admv1013_properties_parse()
553 st->quad_se_mode = ADMV1013_SE_MODE_NEG; in admv1013_properties_parse()
555 return -EINVAL; in admv1013_properties_parse()
557 st->reg = devm_regulator_get(&spi->dev, "vcm"); in admv1013_properties_parse()
558 if (IS_ERR(st->reg)) in admv1013_properties_parse()
559 return dev_err_probe(&spi->dev, PTR_ERR(st->reg), in admv1013_properties_parse()
560 "failed to get the common-mode voltage\n"); in admv1013_properties_parse()
562 st->clkin = devm_clk_get(&spi->dev, "lo_in"); in admv1013_properties_parse()
563 if (IS_ERR(st->clkin)) in admv1013_properties_parse()
564 return dev_err_probe(&spi->dev, PTR_ERR(st->clkin), in admv1013_properties_parse()
576 indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*st)); in admv1013_probe()
578 return -ENOMEM; in admv1013_probe()
582 indio_dev->info = &admv1013_info; in admv1013_probe()
583 indio_dev->name = "admv1013"; in admv1013_probe()
584 indio_dev->channels = admv1013_channels; in admv1013_probe()
585 indio_dev->num_channels = ARRAY_SIZE(admv1013_channels); in admv1013_probe()
587 st->spi = spi; in admv1013_probe()
593 ret = regulator_enable(st->reg); in admv1013_probe()
595 dev_err(&spi->dev, "Failed to enable specified Common-Mode Voltage!\n"); in admv1013_probe()
599 ret = devm_add_action_or_reset(&spi->dev, admv1013_reg_disable, in admv1013_probe()
600 st->reg); in admv1013_probe()
604 ret = clk_prepare_enable(st->clkin); in admv1013_probe()
608 ret = devm_add_action_or_reset(&spi->dev, admv1013_clk_disable, st->clkin); in admv1013_probe()
612 st->nb.notifier_call = admv1013_freq_change; in admv1013_probe()
613 ret = devm_clk_notifier_register(&spi->dev, st->clkin, &st->nb); in admv1013_probe()
617 mutex_init(&st->lock); in admv1013_probe()
621 dev_err(&spi->dev, "admv1013 init failed\n"); in admv1013_probe()
625 ret = devm_add_action_or_reset(&spi->dev, admv1013_powerdown, st); in admv1013_probe()
629 return devm_iio_device_register(&spi->dev, indio_dev); in admv1013_probe()