drivers: dma: stm32u5 dma with resume API function

Add the resume API function for the dma driver of the stm32U5 serie.
That completes the suspend API function.
Controlling the SUSPF bit of the GPDMA CR register is enough
to suspend/resume the channel.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
This commit is contained in:
Francois Ramu 2022-12-01 11:25:46 +01:00 committed by Fabio Baltieri
parent e5306ed8e3
commit 9c49ee3e48

View File

@ -586,6 +586,24 @@ static int dma_stm32_suspend(const struct device *dev, uint32_t id)
return 0;
}
static int dma_stm32_resume(const struct device *dev, uint32_t id)
{
const struct dma_stm32_config *config = dev->config;
DMA_TypeDef *dma = (DMA_TypeDef *)(config->base);
/* Give channel from index 0 */
id = id - STM32_DMA_STREAM_OFFSET;
if (id >= config->max_streams) {
return -EINVAL;
}
/* Resume the channel : it's enough after suspend */
LL_DMA_ResumeChannel(dma, dma_stm32_id_to_stream(id));
return 0;
}
static int dma_stm32_stop(const struct device *dev, uint32_t id)
{
const struct dma_stm32_config *config = dev->config;
@ -662,6 +680,7 @@ static const struct dma_driver_api dma_funcs = {
.stop = dma_stm32_stop,
.get_status = dma_stm32_get_status,
.suspend = dma_stm32_suspend,
.resume = dma_stm32_resume,
};
#define DMA_STM32_OFFSET_INIT(index)