@@ -676,7 +676,7 @@ static void adc_stm32_oversampling_ratioshift(ADC_TypeDef *adc, uint32_t ratio,
676
676
}
677
677
678
678
/*
679
- * Function to configure the oversampling ratio and shit using stm32 LL
679
+ * Function to configure the oversampling ratio and shift using stm32 LL
680
680
* ratio is directly the sequence->oversampling (a 2^n value)
681
681
* shift is the corresponding LL_ADC_OVS_SHIFT_RIGHT_x constant
682
682
*/
@@ -760,6 +760,10 @@ static void dma_callback(const struct device *dev, void *user_data,
760
760
adc_context_on_sampling_done (& data -> ctx , dev );
761
761
pm_policy_state_lock_put (PM_STATE_SUSPEND_TO_IDLE ,
762
762
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
+ }
763
767
} else if (status < 0 ) {
764
768
LOG_ERR ("DMA sampling complete, but DMA reported error %d" , status );
765
769
data -> dma_error = status ;
@@ -1062,6 +1066,10 @@ static void adc_stm32_isr(const struct device *dev)
1062
1066
adc_context_on_sampling_done (& data -> ctx , dev );
1063
1067
pm_policy_state_lock_put (PM_STATE_SUSPEND_TO_IDLE ,
1064
1068
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
+ }
1065
1073
}
1066
1074
}
1067
1075
@@ -1098,6 +1106,9 @@ static int adc_stm32_read(const struct device *dev,
1098
1106
1099
1107
adc_context_lock (& data -> ctx , false, NULL );
1100
1108
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
+ }
1101
1112
error = start_read (dev , sequence );
1102
1113
adc_context_release (& data -> ctx , error );
1103
1114
@@ -1114,6 +1125,9 @@ static int adc_stm32_read_async(const struct device *dev,
1114
1125
1115
1126
adc_context_lock (& data -> ctx , true, async );
1116
1127
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
+ }
1117
1131
error = start_read (dev , sequence );
1118
1132
adc_context_release (& data -> ctx , error );
1119
1133
0 commit comments