Lines Matching refs:adc

405 static void configure_tempsensor_calib_point(ADC_TypeDef *adc, uint32_t calib_point)  in configure_tempsensor_calib_point()  argument
416 LL_ADC_ConfigureCalibPoint(adc, calib_point, gain, 0x0); in configure_tempsensor_calib_point()
488 static void adc_enter_idle_mode(ADC_TypeDef *adc, const struct stm32_pclken *ana_clk) in adc_enter_idle_mode() argument
494 LL_ADC_Disable(adc); in adc_enter_idle_mode()
498 LL_ADC_SMPSSyncDisable(adc); in adc_enter_idle_mode()
513 LL_ADC_DisableInternalRegulator(adc); in adc_enter_idle_mode()
526 static int adc_exit_idle_mode(ADC_TypeDef *adc, const struct stm32_pclken *ana_clk) in adc_exit_idle_mode() argument
552 LL_ADC_EnableInternalRegulator(adc); in adc_exit_idle_mode()
571 LL_ADC_SMPSSyncEnable(adc); in adc_exit_idle_mode()
575 LL_ADC_Enable(adc); in adc_exit_idle_mode()
584 static void schedule_and_start_adc_sequence(ADC_TypeDef *adc, struct adc_stm32wb0_data *data) in schedule_and_start_adc_sequence() argument
678 ll_adc_set_conversion_channel(adc, sequence_length, channel); in schedule_and_start_adc_sequence()
682 ll_adc_set_calib_point_for_any(adc, ch_type, ch_vin_range, calib_pt); in schedule_and_start_adc_sequence()
689 LL_ADC_SetChannelVoltageRange(adc, channel, ch_vin_range); in schedule_and_start_adc_sequence()
711 configure_tempsensor_calib_point(adc, i); in schedule_and_start_adc_sequence()
713 configure_calib_point_from_flash(adc, i, type, range); in schedule_and_start_adc_sequence()
720 LL_ADC_SetSequenceLength(adc, sequence_length); in schedule_and_start_adc_sequence()
733 data->dma_block_config.source_address = (uint32_t)&adc->DS_DATAOUT; in schedule_and_start_adc_sequence()
753 LL_ADC_StartConversion(adc); in schedule_and_start_adc_sequence()
756 static inline void handle_end_of_sequence(ADC_TypeDef *adc, struct adc_stm32wb0_data *data) in handle_end_of_sequence() argument
763 schedule_and_start_adc_sequence(adc, data); in handle_end_of_sequence()
775 ADC_TypeDef *adc = (ADC_TypeDef *)config->reg; in initiate_read_operation() local
784 err = adc_exit_idle_mode(adc, &config->ana_clk); in initiate_read_operation()
793 LL_ADC_SetDSDataOutputWidth(adc, ds_width_from_adc_res(sequence->resolution)); in initiate_read_operation()
796 LL_ADC_SetDSDataOutputRatio(adc, sequence->oversampling); in initiate_read_operation()
809 ADC_TypeDef *adc = config->reg; in adc_stm32wb0_isr() local
812 if (LL_ADC_IsActiveFlag_EODS(adc)) { in adc_stm32wb0_isr()
814 LL_ADC_ClearFlag_EODS(adc); in adc_stm32wb0_isr()
817 *data->next_sample_ptr++ = LL_ADC_DSGetOutputData(adc); in adc_stm32wb0_isr()
821 if (LL_ADC_IsActiveFlag_OVRDS(adc)) { in adc_stm32wb0_isr()
822 LL_ADC_ClearFlag_OVRDS(adc); in adc_stm32wb0_isr()
830 if (!LL_ADC_IsActiveFlag_EOS(adc)) { in adc_stm32wb0_isr()
836 LL_ADC_ClearFlag_EOS(adc); in adc_stm32wb0_isr()
839 handle_end_of_sequence(adc, data); in adc_stm32wb0_isr()
848 ADC_TypeDef *adc = config->reg; in adc_stm32wb0_dma_callback() local
855 if (LL_ADC_IsActiveFlag_OVRDS(adc) || (dma_status >= 0)) { in adc_stm32wb0_dma_callback()
863 LL_ADC_ClearFlag_OVRDS(adc); in adc_stm32wb0_dma_callback()
866 handle_end_of_sequence(adc, data); in adc_stm32wb0_dma_callback()
869 LL_ADC_StopConversion(adc); in adc_stm32wb0_dma_callback()
1059 static DEVICE_API(adc, api_stm32wb0_driver_api) = {
1073 ADC_TypeDef *adc = config->reg; in adc_stm32wb0_init() local
1099 LL_ADC_SetADCMode(adc, LL_ADC_OP_MODE_ADC); in adc_stm32wb0_init()
1108 LL_ADC_SetSampleRate(adc, LL_ADC_SAMPLE_RATE_16); in adc_stm32wb0_init()
1111 LL_ADC_SetOverrunDS(adc, LL_ADC_NEW_DATA_IS_KEPT); in adc_stm32wb0_init()
1124 LL_ADC_EnableIT_EODS(adc); in adc_stm32wb0_init()
1142 LL_ADC_DMAModeDSEnable(adc); in adc_stm32wb0_init()
1163 ADC_TypeDef *adc = config->reg; in adc_stm32wb0_pm_action() local
1170 adc_enter_idle_mode(adc, &config->ana_clk); in adc_stm32wb0_pm_action()