Lines Matching full:dfsdm
3 * This file is the ADC part of the STM32 DFSDM driver
11 #include <linux/iio/adc/stm32-dfsdm-adc.h>
29 #include "stm32-dfsdm.h"
73 struct stm32_dfsdm *dfsdm; member
105 /* DFSDM channel serial interface type */
114 /* DFSDM channel clock source */
140 * struct stm32_dfsdm_trig_info - DFSDM trigger info
319 struct stm32_dfsdm_filter *fl = &adc->dfsdm->fl_list[adc->fl_id]; in stm32_dfsdm_compute_all_osrs()
340 struct regmap *regmap = adc->dfsdm->regmap; in stm32_dfsdm_start_channel()
360 struct regmap *regmap = adc->dfsdm->regmap; in stm32_dfsdm_stop_channel()
372 static int stm32_dfsdm_chan_configure(struct stm32_dfsdm *dfsdm, in stm32_dfsdm_chan_configure() argument
376 struct regmap *regmap = dfsdm->regmap; in stm32_dfsdm_chan_configure()
398 struct stm32_dfsdm *dfsdm = adc->dfsdm; in stm32_dfsdm_start_filter() local
402 ret = regmap_update_bits(dfsdm->regmap, DFSDM_CR1(fl_id), in stm32_dfsdm_start_filter()
412 return regmap_update_bits(dfsdm->regmap, DFSDM_CR1(fl_id), in stm32_dfsdm_start_filter()
417 static void stm32_dfsdm_stop_filter(struct stm32_dfsdm *dfsdm, in stm32_dfsdm_stop_filter() argument
421 regmap_update_bits(dfsdm->regmap, DFSDM_CR1(fl_id), in stm32_dfsdm_stop_filter()
430 struct regmap *regmap = adc->dfsdm->regmap; in stm32_dfsdm_filter_set_trig()
459 struct regmap *regmap = adc->dfsdm->regmap; in stm32_dfsdm_channels_configure()
460 struct stm32_dfsdm_filter *fl = &adc->dfsdm->fl_list[fl_id]; in stm32_dfsdm_channels_configure()
505 struct regmap *regmap = adc->dfsdm->regmap; in stm32_dfsdm_filter_configure()
506 struct stm32_dfsdm_filter *fl = &adc->dfsdm->fl_list[fl_id]; in stm32_dfsdm_filter_configure()
541 * DFSDM modes configuration W.R.T audio/iio type modes in stm32_dfsdm_filter_configure()
600 static int stm32_dfsdm_channel_parse_of(struct stm32_dfsdm *dfsdm, in stm32_dfsdm_channel_parse_of() argument
618 if (ch->channel >= dfsdm->num_chs) { in stm32_dfsdm_channel_parse_of()
621 ch->channel, dfsdm->num_chs); in stm32_dfsdm_channel_parse_of()
635 df_ch = &dfsdm->ch_list[ch->channel]; in stm32_dfsdm_channel_parse_of()
671 static int stm32_dfsdm_generic_channel_parse_of(struct stm32_dfsdm *dfsdm, in stm32_dfsdm_generic_channel_parse_of() argument
688 if (ch->channel >= dfsdm->num_chs) { in stm32_dfsdm_generic_channel_parse_of()
690 ch->channel, dfsdm->num_chs); in stm32_dfsdm_generic_channel_parse_of()
701 df_ch = &dfsdm->ch_list[ch->channel]; in stm32_dfsdm_generic_channel_parse_of()
779 struct stm32_dfsdm_channel *ch = &adc->dfsdm->ch_list[chan->channel]; in dfsdm_adc_audio_set_spiclk()
785 /* If DFSDM is master on SPI, SPI freq can not be updated */ in dfsdm_adc_audio_set_spiclk()
810 struct regmap *regmap = adc->dfsdm->regmap; in stm32_dfsdm_start_conv()
842 struct regmap *regmap = adc->dfsdm->regmap; in stm32_dfsdm_stop_conv()
844 stm32_dfsdm_stop_filter(adc->dfsdm, adc->fl_id); in stm32_dfsdm_stop_conv()
898 struct stm32_dfsdm_filter *fl = &adc->dfsdm->fl_list[adc->fl_id]; in stm32_dfsdm_process_data()
974 * The DFSDM supports half-word transfers. However, for 16 bits record, in stm32_dfsdm_adc_dma_start()
979 .src_addr = (dma_addr_t)adc->dfsdm->phys_base, in stm32_dfsdm_adc_dma_start()
1022 ret = regmap_set_bits(adc->dfsdm->regmap, in stm32_dfsdm_adc_dma_start()
1027 ret = regmap_set_bits(adc->dfsdm->regmap, in stm32_dfsdm_adc_dma_start()
1050 regmap_clear_bits(adc->dfsdm->regmap, DFSDM_CR1(adc->fl_id), in stm32_dfsdm_adc_dma_stop()
1092 ret = stm32_dfsdm_start_dfsdm(adc->dfsdm); in stm32_dfsdm_postenable()
1113 stm32_dfsdm_stop_dfsdm(adc->dfsdm); in stm32_dfsdm_postenable()
1130 stm32_dfsdm_stop_dfsdm(adc->dfsdm); in stm32_dfsdm_predisable()
1210 ret = stm32_dfsdm_start_dfsdm(adc->dfsdm); in stm32_dfsdm_single_conv()
1214 ret = regmap_update_bits(adc->dfsdm->regmap, DFSDM_CR2(adc->fl_id), in stm32_dfsdm_single_conv()
1223 regmap_update_bits(adc->dfsdm->regmap, DFSDM_CR2(adc->fl_id), in stm32_dfsdm_single_conv()
1232 regmap_update_bits(adc->dfsdm->regmap, DFSDM_CR2(adc->fl_id), in stm32_dfsdm_single_conv()
1247 stm32_dfsdm_stop_dfsdm(adc->dfsdm); in stm32_dfsdm_single_conv()
1257 struct stm32_dfsdm_channel *ch = &adc->dfsdm->ch_list[chan->channel]; in stm32_dfsdm_write_raw()
1263 spi_freq = adc->dfsdm->spi_master_freq; in stm32_dfsdm_write_raw()
1267 spi_freq = adc->dfsdm->spi_master_freq / 2; in stm32_dfsdm_write_raw()
1312 struct stm32_dfsdm_filter *fl = &adc->dfsdm->fl_list[adc->fl_id]; in stm32_dfsdm_read_raw()
1385 * DFSDM output data are in the range [-2^n, 2^n], in stm32_dfsdm_read_raw()
1435 struct regmap *regmap = adc->dfsdm->regmap; in stm32_dfsdm_irq()
1518 ret = stm32_dfsdm_generic_channel_parse_of(adc->dfsdm, indio_dev, ch, child); in stm32_dfsdm_adc_chan_init_one()
1520 ret = stm32_dfsdm_channel_parse_of(adc->dfsdm, indio_dev, ch); in stm32_dfsdm_adc_chan_init_one()
1553 return stm32_dfsdm_chan_configure(adc->dfsdm, in stm32_dfsdm_adc_chan_init_one()
1554 &adc->dfsdm->ch_list[ch->channel]); in stm32_dfsdm_adc_chan_init_one()
1578 /* Skip DAI node in DFSDM audio nodes */ in stm32_dfsdm_generic_chan_init()
1624 d_ch = &adc->dfsdm->ch_list[ch->channel]; in stm32_dfsdm_audio_init()
1626 adc->spi_freq = adc->dfsdm->spi_master_freq; in stm32_dfsdm_audio_init()
1655 if (num_ch > adc->dfsdm->num_chs) { in stm32_dfsdm_adc_init()
1657 num_ch, adc->dfsdm->num_chs); in stm32_dfsdm_adc_init()
1730 .compatible = "st,stm32-dfsdm-adc",
1734 .compatible = "st,stm32-dfsdm-dmic",
1759 adc->dfsdm = dev_get_drvdata(dev->parent); in stm32_dfsdm_adc_probe()
1767 if (ret != 0 || adc->fl_id >= adc->dfsdm->num_fls) { in stm32_dfsdm_adc_probe()
1772 name = devm_kzalloc(dev, sizeof("dfsdm-adc0"), GFP_KERNEL); in stm32_dfsdm_adc_probe()
1777 snprintf(name, sizeof("dfsdm-pdm0"), "dfsdm-pdm%d", adc->fl_id); in stm32_dfsdm_adc_probe()
1780 snprintf(name, sizeof("dfsdm-adc0"), "dfsdm-adc%d", adc->fl_id); in stm32_dfsdm_adc_probe()
1805 adc->dfsdm->fl_list[adc->fl_id].ford = val; in stm32_dfsdm_adc_probe()
1809 adc->dfsdm->fl_list[adc->fl_id].sync_mode = val; in stm32_dfsdm_adc_probe()
1870 ch = &adc->dfsdm->ch_list[chan->channel]; in stm32_dfsdm_adc_resume()
1871 ret = stm32_dfsdm_chan_configure(adc->dfsdm, ch); in stm32_dfsdm_adc_resume()
1888 .name = "stm32-dfsdm-adc",