Lines Matching +full:se +full:- +full:neg
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()
350 vcm = regulator_get_voltage(st->reg); in admv1013_update_mixer_vgate()
359 return -EINVAL; in admv1013_update_mixer_vgate()
386 "vcc-drv", "vcc2-drv", "vcc-vva", "vcc-amp1", "vcc-amp2",
387 "vcc-env", "vcc-bg", "vcc-bg2", "vcc-mixer", "vcc-quad"
396 mutex_lock(&st->lock); in admv1013_freq_change()
398 mutex_unlock(&st->lock); in admv1013_freq_change()
450 struct spi_device *spi = st->spi; in admv1013_init()
471 dev_err(&spi->dev, "Invalid Chip ID.\n"); in admv1013_init()
472 return -EINVAL; in admv1013_init()
479 data = FIELD_PREP(ADMV1013_QUAD_SE_MODE_MSK, st->quad_se_mode); in admv1013_init()
497 st->det_en | in admv1013_init()
498 st->input_mode); in admv1013_init()
532 struct spi_device *spi = st->spi; in admv1013_properties_parse()
534 st->det_en = device_property_read_bool(&spi->dev, "adi,detector-enable"); in admv1013_properties_parse()
536 ret = device_property_read_string(&spi->dev, "adi,input-mode", &str); in admv1013_properties_parse()
538 st->input_mode = ADMV1013_IQ_MODE; in admv1013_properties_parse()
541 st->input_mode = ADMV1013_IQ_MODE; in admv1013_properties_parse()
543 st->input_mode = ADMV1013_IF_MODE; in admv1013_properties_parse()
545 return -EINVAL; in admv1013_properties_parse()
547 ret = device_property_read_string(&spi->dev, "adi,quad-se-mode", &str); in admv1013_properties_parse()
549 st->quad_se_mode = ADMV1013_SE_MODE_DIFF; in admv1013_properties_parse()
552 st->quad_se_mode = ADMV1013_SE_MODE_DIFF; in admv1013_properties_parse()
553 else if (!strcmp(str, "se-pos")) in admv1013_properties_parse()
554 st->quad_se_mode = ADMV1013_SE_MODE_POS; in admv1013_properties_parse()
555 else if (!strcmp(str, "se-neg")) in admv1013_properties_parse()
556 st->quad_se_mode = ADMV1013_SE_MODE_NEG; in admv1013_properties_parse()
558 return -EINVAL; in admv1013_properties_parse()
560 st->reg = devm_regulator_get(&spi->dev, "vcm"); in admv1013_properties_parse()
561 if (IS_ERR(st->reg)) in admv1013_properties_parse()
562 return dev_err_probe(&spi->dev, PTR_ERR(st->reg), in admv1013_properties_parse()
563 "failed to get the common-mode voltage\n"); in admv1013_properties_parse()
565 ret = devm_regulator_bulk_get_enable(&st->spi->dev, in admv1013_properties_parse()
569 dev_err_probe(&spi->dev, ret, in admv1013_properties_parse()
583 indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*st)); in admv1013_probe()
585 return -ENOMEM; in admv1013_probe()
589 indio_dev->info = &admv1013_info; in admv1013_probe()
590 indio_dev->name = "admv1013"; in admv1013_probe()
591 indio_dev->channels = admv1013_channels; in admv1013_probe()
592 indio_dev->num_channels = ARRAY_SIZE(admv1013_channels); in admv1013_probe()
594 st->spi = spi; in admv1013_probe()
600 ret = regulator_enable(st->reg); in admv1013_probe()
602 dev_err(&spi->dev, "Failed to enable specified Common-Mode Voltage!\n"); in admv1013_probe()
606 ret = devm_add_action_or_reset(&spi->dev, admv1013_reg_disable, in admv1013_probe()
607 st->reg); in admv1013_probe()
611 st->clkin = devm_clk_get_enabled(&spi->dev, "lo_in"); in admv1013_probe()
612 if (IS_ERR(st->clkin)) in admv1013_probe()
613 return dev_err_probe(&spi->dev, PTR_ERR(st->clkin), in admv1013_probe()
616 st->nb.notifier_call = admv1013_freq_change; in admv1013_probe()
617 ret = devm_clk_notifier_register(&spi->dev, st->clkin, &st->nb); in admv1013_probe()
621 mutex_init(&st->lock); in admv1013_probe()
625 dev_err(&spi->dev, "admv1013 init failed\n"); in admv1013_probe()
629 ret = devm_add_action_or_reset(&spi->dev, admv1013_powerdown, st); in admv1013_probe()
633 return devm_iio_device_register(&spi->dev, indio_dev); in admv1013_probe()