@@ -676,7 +676,7 @@ static void adc_stm32_oversampling_ratioshift(ADC_TypeDef *adc, uint32_t ratio,
676676}
677677
678678/*
679- * Function to configure the oversampling ratio and shit using stm32 LL
679+ * Function to configure the oversampling ratio and shift using stm32 LL
680680 * ratio is directly the sequence->oversampling (a 2^n value)
681681 * shift is the corresponding LL_ADC_OVS_SHIFT_RIGHT_x constant
682682 */
@@ -760,6 +760,10 @@ static void dma_callback(const struct device *dev, void *user_data,
760760 adc_context_on_sampling_done (& data -> ctx , dev );
761761 pm_policy_state_lock_put (PM_STATE_SUSPEND_TO_IDLE ,
762762 PM_ALL_SUBSTATES );
763+ if (IS_ENABLED (CONFIG_PM_S2RAM )) {
764+ pm_policy_state_lock_put (PM_STATE_SUSPEND_TO_RAM ,
765+ PM_ALL_SUBSTATES );
766+ }
763767 } else if (status < 0 ) {
764768 LOG_ERR ("DMA sampling complete, but DMA reported error %d" , status );
765769 data -> dma_error = status ;
@@ -1062,6 +1066,10 @@ static void adc_stm32_isr(const struct device *dev)
10621066 adc_context_on_sampling_done (& data -> ctx , dev );
10631067 pm_policy_state_lock_put (PM_STATE_SUSPEND_TO_IDLE ,
10641068 PM_ALL_SUBSTATES );
1069+ if (IS_ENABLED (CONFIG_PM_S2RAM )) {
1070+ pm_policy_state_lock_put (PM_STATE_SUSPEND_TO_RAM ,
1071+ PM_ALL_SUBSTATES );
1072+ }
10651073 }
10661074 }
10671075
@@ -1098,6 +1106,9 @@ static int adc_stm32_read(const struct device *dev,
10981106
10991107 adc_context_lock (& data -> ctx , false, NULL );
11001108 pm_policy_state_lock_get (PM_STATE_SUSPEND_TO_IDLE , PM_ALL_SUBSTATES );
1109+ if (IS_ENABLED (CONFIG_PM_S2RAM )) {
1110+ pm_policy_state_lock_get (PM_STATE_SUSPEND_TO_RAM , PM_ALL_SUBSTATES );
1111+ }
11011112 error = start_read (dev , sequence );
11021113 adc_context_release (& data -> ctx , error );
11031114
@@ -1114,6 +1125,9 @@ static int adc_stm32_read_async(const struct device *dev,
11141125
11151126 adc_context_lock (& data -> ctx , true, async );
11161127 pm_policy_state_lock_get (PM_STATE_SUSPEND_TO_IDLE , PM_ALL_SUBSTATES );
1128+ if (IS_ENABLED (CONFIG_PM_S2RAM )) {
1129+ pm_policy_state_lock_get (PM_STATE_SUSPEND_TO_RAM , PM_ALL_SUBSTATES );
1130+ }
11171131 error = start_read (dev , sequence );
11181132 adc_context_release (& data -> ctx , error );
11191133
0 commit comments