drivers: dma: dma_nxp_edma: disable IRQs when not needed

IRQs are currently only enabled during channel setup
and never disabled. As such, even though they're not
needed (i.e: after a channel has been suspended or stopped)
they remain enabled. Fix this by enabling IRQs during the
channel start() operation and disabling them during the
channel stop() operation.

This change is required by irq chips (i.e: irqsteer) which
perform PM operations during irq_enable()/irq_disable(). If
interrupts are left enabled all the time that means the irq
chip's PM resources might also remain enabled when not needed.

Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
This commit is contained in:
Laurentiu Mihalcea 2024-09-30 13:26:46 +03:00 committed by Carles Cufí
parent c7be48aae4
commit 48b98a9284

View file

@ -332,9 +332,6 @@ static int edma_config(const struct device *dev, uint32_t chan_id,
EDMA_TCD_CSR_INTHALF_MASK, 0);
}
/* enable channel interrupt */
irq_enable(chan->irq);
/* dump register status - for debugging purposes */
edma_dump_channel_registers(data, chan_id);
@ -462,8 +459,11 @@ static int edma_stop(const struct device *dev, uint32_t chan_id)
/* disable HW requests */
EDMA_ChannelRegUpdate(data->hal_cfg, chan_id, EDMA_TCD_CH_CSR, 0,
EDMA_TCD_CH_CSR_ERQ_MASK);
out_release_channel:
irq_disable(chan->irq);
/* clear the channel MUX so that it can used by a different peripheral.
*
* note: because the channel is released during dma_stop() that means
@ -511,6 +511,8 @@ static int edma_start(const struct device *dev, uint32_t chan_id)
LOG_DBG("starting channel %u", chan_id);
irq_enable(chan->irq);
/* enable HW requests */
EDMA_ChannelRegUpdate(data->hal_cfg, chan_id,
EDMA_TCD_CH_CSR, EDMA_TCD_CH_CSR_ERQ_MASK, 0);