Skip to content

Commit c89d916

Browse files
akloniexjajanusz
authored andcommitted
dma: Implement DMA IRQ callback using notifier interface.
Signed-off-by: ArturX Kloniecki <arturx.kloniecki@linux.intel.com>
1 parent 07bf590 commit c89d916

File tree

4 files changed

+12
-11
lines changed

4 files changed

+12
-11
lines changed

src/drivers/dw/dma.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -761,9 +761,11 @@ static int dw_dma_pm_context_store(struct dma *dma)
761761
}
762762

763763
#if !CONFIG_HW_LLI
764-
/* reload using LLI data */
765-
static inline void dw_dma_chan_reload_lli(struct dma_chan_data *channel)
764+
/* reload using LLI data from DMA IRQ cb */
765+
static inline void dw_dma_chan_reload_lli_cb(void *arg, enum notify_id type,
766+
void *data)
766767
{
768+
struct dma_chan_data *channel = data;
767769
struct dma *dma = channel->dma;
768770
struct dw_dma_chan_data *dw_chan = dma_chan_get_data(channel);
769771
struct dw_lli *lli = dw_chan->lli_current;
@@ -967,7 +969,8 @@ static int dw_dma_probe(struct dma *dma)
967969
chan->index = i;
968970
chan->core = DMA_CORE_INVALID;
969971
#if !CONFIG_HW_LLI
970-
chan->irq_callback = dw_dma_chan_reload_lli;
972+
notifier_register(chan, chan, NOTIFIER_ID_DMA_IRQ,
973+
dw_dma_chan_reload_lli_cb);
971974
#endif
972975

973976
dw_chan = rzalloc(RZONE_SYS_RUNTIME | RZONE_FLAG_UNCACHED,

src/include/sof/lib/dma.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -211,11 +211,6 @@ struct dma_chan_data {
211211
/* true if this DMA channel is the scheduling source */
212212
bool is_scheduling_source;
213213

214-
/* called by the DMA domain right after receiving an interrupt,
215-
* so should execute very time-sensitive operations
216-
*/
217-
void (*irq_callback)(struct dma_chan_data *channel);
218-
219214
void *private;
220215
};
221216

src/include/sof/lib/notifier.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ enum notify_id {
2828
NOTIFIER_ID_BUFFER_CONSUME, /* struct buffer_cb_transact* */
2929
NOTIFIER_ID_BUFFER_FREE, /* struct buffer_cb_free* */
3030
NOTIFIER_ID_DMA_COPY, /* struct dma_cb_data* */
31+
NOTIFIER_ID_DMA_IRQ, /* struct dma_chan_data * */
3132
NOTIFIER_ID_COUNT
3233
};
3334

src/schedule/dma_multi_chan_domain.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include <sof/lib/alloc.h>
1212
#include <sof/lib/cpu.h>
1313
#include <sof/lib/dma.h>
14+
#include <sof/lib/notifier.h>
1415
#include <sof/platform.h>
1516
#include <sof/schedule/ll_schedule.h>
1617
#include <sof/schedule/ll_schedule_domain.h>
@@ -272,9 +273,10 @@ static bool dma_multi_chan_domain_is_pending(struct ll_schedule_domain *domain,
272273
platform_timer_get(platform_timer))
273274
continue;
274275

275-
/* execute callback if exists */
276-
if (dmas[i].chan[j].irq_callback)
277-
dmas[i].chan[j].irq_callback(&dmas[i].chan[j]);
276+
notifier_event(&dmas[i].chan[j], NOTIFIER_ID_DMA_IRQ,
277+
NOTIFIER_TARGET_CORE_LOCAL,
278+
&dmas[i].chan[j],
279+
sizeof(struct dma_chan_data));
278280

279281
/* clear interrupt */
280282
if (pipe_task->registrable) {

0 commit comments

Comments
 (0)