Lines Matching +full:lo +full:- +full:buff +full:- +full:en

1 // SPDX-License-Identifier: GPL-2.0-only
12 #include <linux/clk-provider.h>
98 st->data[0] = 0x80 | (reg << 1); in __adrf6780_spi_read()
99 st->data[1] = 0x0; in __adrf6780_spi_read()
100 st->data[2] = 0x0; in __adrf6780_spi_read()
102 t.rx_buf = &st->data[0]; in __adrf6780_spi_read()
103 t.tx_buf = &st->data[0]; in __adrf6780_spi_read()
106 ret = spi_sync_transfer(st->spi, &t, 1); in __adrf6780_spi_read()
110 *val = (get_unaligned_be24(&st->data[0]) >> 1) & GENMASK(15, 0); in __adrf6780_spi_read()
120 mutex_lock(&st->lock); in adrf6780_spi_read()
122 mutex_unlock(&st->lock); in adrf6780_spi_read()
131 put_unaligned_be24((val << 1) | (reg << 17), &st->data[0]); in __adrf6780_spi_write()
133 return spi_write(st->spi, &st->data[0], 3); in __adrf6780_spi_write()
141 mutex_lock(&st->lock); in adrf6780_spi_write()
143 mutex_unlock(&st->lock); in adrf6780_spi_write()
169 mutex_lock(&st->lock); in adrf6780_spi_update_bits()
171 mutex_unlock(&st->lock); in adrf6780_spi_update_bits()
180 mutex_lock(&st->lock); in adrf6780_read_adc_raw()
200 ret = -EINVAL; in adrf6780_read_adc_raw()
213 mutex_unlock(&st->lock); in adrf6780_read_adc_raw()
248 switch (chan->channel2) { in adrf6780_read_raw()
259 return -EINVAL; in adrf6780_read_raw()
262 return -EINVAL; in adrf6780_read_raw()
276 switch (chan->channel2) { in adrf6780_write_raw()
288 return -EINVAL; in adrf6780_write_raw()
291 return -EINVAL; in adrf6780_write_raw()
350 struct spi_device *spi = st->spi; in adrf6780_reset()
356 dev_err(&spi->dev, "ADRF6780 SPI software reset failed.\n"); in adrf6780_reset()
364 dev_err(&spi->dev, "ADRF6780 SPI software reset disable failed.\n"); in adrf6780_reset()
375 struct spi_device *spi = st->spi; in adrf6780_init()
388 dev_err(&spi->dev, "ADRF6780 Invalid Chip ID.\n"); in adrf6780_init()
389 return -EINVAL; in adrf6780_init()
402 enable_reg = FIELD_PREP(ADRF6780_VGA_BUFFER_EN_MSK, st->vga_buff_en) | in adrf6780_init()
404 FIELD_PREP(ADRF6780_LO_BUFFER_EN_MSK, st->lo_buff_en) | in adrf6780_init()
405 FIELD_PREP(ADRF6780_IF_MODE_EN_MSK, st->if_mode_en) | in adrf6780_init()
406 FIELD_PREP(ADRF6780_IQ_MODE_EN_MSK, st->iq_mode_en) | in adrf6780_init()
407 FIELD_PREP(ADRF6780_LO_X2_EN_MSK, st->lo_x2_en) | in adrf6780_init()
408 FIELD_PREP(ADRF6780_LO_PPF_EN_MSK, st->lo_ppf_en) | in adrf6780_init()
409 FIELD_PREP(ADRF6780_LO_EN_MSK, st->lo_en) | in adrf6780_init()
410 FIELD_PREP(ADRF6780_UC_BIAS_EN_MSK, st->uc_bias_en); in adrf6780_init()
419 FIELD_PREP(ADRF6780_LO_SIDEBAND_MSK, st->lo_sideband)); in adrf6780_init()
425 FIELD_PREP(ADRF6780_VDET_OUTPUT_SELECT_MSK, st->vdet_out_en)); in adrf6780_init()
430 struct spi_device *spi = st->spi; in adrf6780_properties_parse()
432 st->vga_buff_en = device_property_read_bool(&spi->dev, "adi,vga-buff-en"); in adrf6780_properties_parse()
433 st->lo_buff_en = device_property_read_bool(&spi->dev, "adi,lo-buff-en"); in adrf6780_properties_parse()
434 st->if_mode_en = device_property_read_bool(&spi->dev, "adi,if-mode-en"); in adrf6780_properties_parse()
435 st->iq_mode_en = device_property_read_bool(&spi->dev, "adi,iq-mode-en"); in adrf6780_properties_parse()
436 st->lo_x2_en = device_property_read_bool(&spi->dev, "adi,lo-x2-en"); in adrf6780_properties_parse()
437 st->lo_ppf_en = device_property_read_bool(&spi->dev, "adi,lo-ppf-en"); in adrf6780_properties_parse()
438 st->lo_en = device_property_read_bool(&spi->dev, "adi,lo-en"); in adrf6780_properties_parse()
439 st->uc_bias_en = device_property_read_bool(&spi->dev, "adi,uc-bias-en"); in adrf6780_properties_parse()
440 st->lo_sideband = device_property_read_bool(&spi->dev, "adi,lo-sideband"); in adrf6780_properties_parse()
441 st->vdet_out_en = device_property_read_bool(&spi->dev, "adi,vdet-out-en"); in adrf6780_properties_parse()
456 indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*st)); in adrf6780_probe()
458 return -ENOMEM; in adrf6780_probe()
462 indio_dev->info = &adrf6780_info; in adrf6780_probe()
463 indio_dev->name = "adrf6780"; in adrf6780_probe()
464 indio_dev->channels = adrf6780_channels; in adrf6780_probe()
465 indio_dev->num_channels = ARRAY_SIZE(adrf6780_channels); in adrf6780_probe()
467 st->spi = spi; in adrf6780_probe()
471 st->clkin = devm_clk_get_enabled(&spi->dev, "lo_in"); in adrf6780_probe()
472 if (IS_ERR(st->clkin)) in adrf6780_probe()
473 return dev_err_probe(&spi->dev, PTR_ERR(st->clkin), in adrf6780_probe()
474 "failed to get the LO input clock\n"); in adrf6780_probe()
476 mutex_init(&st->lock); in adrf6780_probe()
482 ret = devm_add_action_or_reset(&spi->dev, adrf6780_powerdown, st); in adrf6780_probe()
486 return devm_iio_device_register(&spi->dev, indio_dev); in adrf6780_probe()