diff --git a/src/drivers/dw/dma.c b/src/drivers/dw/dma.c index a1c41a083131..ba43e8c4c4f1 100644 --- a/src/drivers/dw/dma.c +++ b/src/drivers/dw/dma.c @@ -92,14 +92,19 @@ struct dma_pdata { static const uint32_t burst_elems[] = {1, 2, 4, 8}; #if !CONFIG_HW_LLI -static inline void dw_dma_chan_reload_lli(struct dma *dma, int channel); -static inline void dw_dma_chan_reload_next(struct dma *dma, int channel, +static inline void dw_dma_chan_reload_lli(struct dma *dma, + unsigned int channel); +static inline void dw_dma_chan_reload_next(struct dma *dma, + unsigned int channel, struct dma_sg_elem *next, int direction); #endif -static inline int dw_dma_interrupt_register(struct dma *dma, int channel); -static inline void dw_dma_interrupt_unregister(struct dma *dma, int channel); -static int dw_dma_copy(struct dma *dma, int channel, int bytes, uint32_t flags); +static inline int dw_dma_interrupt_register(struct dma *dma, + unsigned int channel); +static inline void dw_dma_interrupt_unregister(struct dma *dma, + unsigned int channel); +static int dw_dma_copy(struct dma *dma, unsigned int channel, int bytes, + uint32_t flags); static inline void dw_write(struct dma *dma, uint32_t reg, uint32_t value) { @@ -111,7 +116,7 @@ static inline uint32_t dw_read(struct dma *dma, uint32_t reg) return io_reg_read(dma_base(dma) + reg); } -static void dw_dma_interrupt_mask(struct dma *dma, int channel) +static void dw_dma_interrupt_mask(struct dma *dma, unsigned int channel) { const struct dma_pdata *p = dma_get_drvdata(dma); @@ -128,7 +133,7 @@ static void dw_dma_interrupt_mask(struct dma *dma, int channel) dw_write(dma, DW_MASK_ERR, DW_CHAN_MASK(channel)); } -static void dw_dma_interrupt_unmask(struct dma *dma, int channel) +static void dw_dma_interrupt_unmask(struct dma *dma, unsigned int channel) { const struct dma_pdata *p = dma_get_drvdata(dma); @@ -148,7 +153,7 @@ static void dw_dma_interrupt_unmask(struct dma *dma, int channel) dw_write(dma, DW_MASK_ERR, DW_CHAN_UNMASK(channel)); } -static void dw_dma_interrupt_clear(struct dma *dma, int channel) +static void dw_dma_interrupt_clear(struct dma *dma, unsigned int channel) { const struct dma_pdata *p = dma_get_drvdata(dma); @@ -172,7 +177,7 @@ static void dw_dma_interrupt_clear(struct dma *dma, int channel) } /* allocate next free DMA channel */ -static int dw_dma_channel_get(struct dma *dma, int req_chan) +static int dw_dma_channel_get(struct dma *dma, unsigned int req_chan) { struct dma_pdata *p = dma_get_drvdata(dma); uint32_t flags; @@ -208,7 +213,7 @@ static int dw_dma_channel_get(struct dma *dma, int req_chan) } /* channel must not be running when this is called */ -static void dw_dma_channel_put_unlocked(struct dma *dma, int channel) +static void dw_dma_channel_put_unlocked(struct dma *dma, unsigned int channel) { struct dma_pdata *p = dma_get_drvdata(dma); struct dw_dma_chan_data *chan = p->chan + channel; @@ -241,7 +246,7 @@ static void dw_dma_channel_put_unlocked(struct dma *dma, int channel) } /* channel must not be running when this is called */ -static void dw_dma_channel_put(struct dma *dma, int channel) +static void dw_dma_channel_put(struct dma *dma, unsigned int channel) { uint32_t flags; @@ -253,7 +258,7 @@ static void dw_dma_channel_put(struct dma *dma, int channel) spin_unlock_irq(&dma->lock, flags); } -static int dw_dma_start(struct dma *dma, int channel) +static int dw_dma_start(struct dma *dma, unsigned int channel) { struct dma_pdata *p = dma_get_drvdata(dma); struct dw_dma_chan_data *chan = p->chan + channel; @@ -343,7 +348,7 @@ static int dw_dma_start(struct dma *dma, int channel) return ret; } -static int dw_dma_release(struct dma *dma, int channel) +static int dw_dma_release(struct dma *dma, unsigned int channel) { struct dma_pdata *p = dma_get_drvdata(dma); struct dw_dma_chan_data *chan = p->chan + channel; @@ -383,7 +388,7 @@ static int dw_dma_release(struct dma *dma, int channel) return 0; } -static int dw_dma_pause(struct dma *dma, int channel) +static int dw_dma_pause(struct dma *dma, unsigned int channel) { struct dma_pdata *p = dma_get_drvdata(dma); struct dw_dma_chan_data *chan = p->chan + channel; @@ -413,7 +418,7 @@ static int dw_dma_pause(struct dma *dma, int channel) return 0; } -static int dw_dma_stop(struct dma *dma, int channel) +static int dw_dma_stop(struct dma *dma, unsigned int channel) { struct dma_pdata *p = dma_get_drvdata(dma); struct dw_dma_chan_data *chan = p->chan + channel; @@ -481,7 +486,7 @@ static int dw_dma_stop(struct dma *dma, int channel) } /* fill in "status" with current DMA channel state and position */ -static int dw_dma_status(struct dma *dma, int channel, +static int dw_dma_status(struct dma *dma, unsigned int channel, struct dma_chan_status *status, uint8_t direction) { @@ -532,7 +537,7 @@ static void dw_dma_mask_address(struct dma_sg_elem *sg_elem, uint32_t *sar, } /* set the DMA channel configuration, source/target address, buffer sizes */ -static int dw_dma_set_config(struct dma *dma, int channel, +static int dw_dma_set_config(struct dma *dma, unsigned int channel, struct dma_sg_config *config) { struct dw_drv_plat_data *dp = dma->plat_data.drv_plat_data; @@ -843,7 +848,7 @@ static int dw_dma_pm_context_store(struct dma *dma) return 0; } -static int dw_dma_set_cb(struct dma *dma, int channel, int type, +static int dw_dma_set_cb(struct dma *dma, unsigned int channel, int type, void (*cb)(void *data, uint32_t type, struct dma_sg_elem *next), void *data) @@ -852,6 +857,13 @@ static int dw_dma_set_cb(struct dma *dma, int channel, int type, struct dw_dma_chan_data *chan = p->chan + channel; uint32_t flags; + if (channel >= dma->plat_data.channels || + channel == DMA_CHAN_INVALID) { + trace_dwdma_error("dw_dma_set_config() error: dma %d invalid " + "channel %d", dma->plat_data.id, channel); + return -EINVAL; + } + spin_lock_irq(&dma->lock, flags); chan->cb = cb; chan->cb_data = data; @@ -863,7 +875,7 @@ static int dw_dma_set_cb(struct dma *dma, int channel, int type, #if !CONFIG_HW_LLI /* reload using LLI data */ -static inline void dw_dma_chan_reload_lli(struct dma *dma, int channel) +static inline void dw_dma_chan_reload_lli(struct dma *dma, unsigned int channel) { struct dma_pdata *p = dma_get_drvdata(dma); struct dw_dma_chan_data *chan = p->chan + channel; @@ -896,7 +908,8 @@ static inline void dw_dma_chan_reload_lli(struct dma *dma, int channel) } /* reload using callback data */ -static inline void dw_dma_chan_reload_next(struct dma *dma, int channel, +static inline void dw_dma_chan_reload_next(struct dma *dma, + unsigned int channel, struct dma_sg_elem *next, int direction) { @@ -935,7 +948,7 @@ static inline void dw_dma_chan_reload_next(struct dma *dma, int channel, } #endif -static void dw_dma_verify_transfer(struct dma *dma, int channel, +static void dw_dma_verify_transfer(struct dma *dma, unsigned int channel, struct dma_sg_elem *next) { struct dma_pdata *p = dma_get_drvdata(dma); @@ -979,7 +992,7 @@ static void dw_dma_verify_transfer(struct dma *dma, int channel, #endif } -static void dw_dma_irq_callback(struct dma *dma, int channel, +static void dw_dma_irq_callback(struct dma *dma, unsigned int channel, struct dma_sg_elem *next, uint32_t type) { struct dma_pdata *p = dma_get_drvdata(dma); @@ -999,7 +1012,8 @@ static void dw_dma_irq_callback(struct dma *dma, int channel, dw_dma_verify_transfer(dma, channel, next); } -static int dw_dma_copy(struct dma *dma, int channel, int bytes, uint32_t flags) +static int dw_dma_copy(struct dma *dma, unsigned int channel, int bytes, + uint32_t flags) { struct dma_pdata *p = dma_get_drvdata(dma); struct dw_dma_chan_data *chan = p->chan + channel; @@ -1009,6 +1023,13 @@ static int dw_dma_copy(struct dma *dma, int channel, int bytes, uint32_t flags) .size = bytes }; + if (channel >= dma->plat_data.channels || + channel == DMA_CHAN_INVALID) { + trace_dwdma_error("dw_dma_irq_callback() error: dma %d invalid" + " channel %d", dma->plat_data.id, channel); + return -EINVAL; + } + tracev_dwdma("dw_dma_copy(): dma %d channel %d copy", dma->plat_data.id, channel); @@ -1086,7 +1107,8 @@ static void dw_dma_irq_handler(void *data) } } -static inline int dw_dma_interrupt_register(struct dma *dma, int channel) +static inline int dw_dma_interrupt_register(struct dma *dma, + unsigned int channel) { struct dma_pdata *p = dma_get_drvdata(dma); uint32_t irq = dma_chan_irq(dma, cpu_get_id(), channel); @@ -1125,7 +1147,8 @@ static inline int dw_dma_interrupt_register(struct dma *dma, int channel) return 0; } -static inline void dw_dma_interrupt_unregister(struct dma *dma, int channel) +static inline void dw_dma_interrupt_unregister(struct dma *dma, + unsigned int channel) { struct dma_pdata *p = dma_get_drvdata(dma); uint32_t irq = dma_chan_irq(dma, cpu_get_id(), channel); @@ -1248,7 +1271,7 @@ static int dw_dma_remove(struct dma *dma) return 0; } -static int dw_dma_avail_data_size(struct dma *dma, int channel) +static int dw_dma_avail_data_size(struct dma *dma, unsigned int channel) { struct dma_pdata *p = dma_get_drvdata(dma); struct dw_dma_chan_data *chan = p->chan + channel; @@ -1263,7 +1286,7 @@ static int dw_dma_avail_data_size(struct dma *dma, int channel) return size; } -static int dw_dma_free_data_size(struct dma *dma, int channel) +static int dw_dma_free_data_size(struct dma *dma, unsigned int channel) { struct dma_pdata *p = dma_get_drvdata(dma); struct dw_dma_chan_data *chan = p->chan + channel; @@ -1278,13 +1301,20 @@ static int dw_dma_free_data_size(struct dma *dma, int channel) return size; } -static int dw_dma_get_data_size(struct dma *dma, int channel, uint32_t *avail, - uint32_t *free) +static int dw_dma_get_data_size(struct dma *dma, unsigned int channel, + uint32_t *avail, uint32_t *free) { struct dma_pdata *p = dma_get_drvdata(dma); struct dw_dma_chan_data *chan = p->chan + channel; uint32_t flags; + if (channel >= dma->plat_data.channels || + channel == DMA_CHAN_INVALID) { + trace_dwdma_error("dw_dma_set_config() error: dma %d invalid " + "channel %d", dma->plat_data.id, channel); + return -EINVAL; + } + tracev_dwdma("dw_dma_get_data_size(): dma %d channel %d get data size", dma->plat_data.id, channel); diff --git a/src/drivers/imx/dummy-dma.c b/src/drivers/imx/dummy-dma.c index 7f6af1ed2de6..73e884ea2ad6 100644 --- a/src/drivers/imx/dummy-dma.c +++ b/src/drivers/imx/dummy-dma.c @@ -11,39 +11,39 @@ #include /* allocate next free DMA channel */ -static int dummy_dma_channel_get(struct dma *dma, int req_chan) +static int dummy_dma_channel_get(struct dma *dma, unsigned int req_chan) { return 0; } /* channel must not be running when this is called */ -static void dummy_dma_channel_put(struct dma *dma, int channel) +static void dummy_dma_channel_put(struct dma *dma, unsigned int channel) { } -static int dummy_dma_start(struct dma *dma, int channel) +static int dummy_dma_start(struct dma *dma, unsigned int channel) { return 0; } -static int dummy_dma_release(struct dma *dma, int channel) +static int dummy_dma_release(struct dma *dma, unsigned int channel) { return 0; } -static int dummy_dma_pause(struct dma *dma, int channel) +static int dummy_dma_pause(struct dma *dma, unsigned int channel) { return 0; } -static int dummy_dma_stop(struct dma *dma, int channel) +static int dummy_dma_stop(struct dma *dma, unsigned int channel) { return 0; } /* fill in "status" with current DMA channel state and position */ -static int dummy_dma_status(struct dma *dma, int channel, +static int dummy_dma_status(struct dma *dma, unsigned int channel, struct dma_chan_status *status, uint8_t direction) { @@ -51,7 +51,7 @@ static int dummy_dma_status(struct dma *dma, int channel, } /* set the DMA channel configuration, source/target address, buffer sizes */ -static int dummy_dma_set_config(struct dma *dma, int channel, +static int dummy_dma_set_config(struct dma *dma, unsigned int channel, struct dma_sg_config *config) { return 0; @@ -69,14 +69,14 @@ static int dummy_dma_pm_context_store(struct dma *dma) return 0; } -static int dummy_dma_set_cb(struct dma *dma, int channel, int type, +static int dummy_dma_set_cb(struct dma *dma, unsigned int channel, int type, void (*cb)(void *data, uint32_t type, struct dma_sg_elem *next), void *data) { return 0; } -static int dummy_dma_copy(struct dma *dma, int channel, int bytes, +static int dummy_dma_copy(struct dma *dma, unsigned int channel, int bytes, uint32_t flags) { return 0; @@ -92,7 +92,7 @@ static int dummy_dma_remove(struct dma *dma) return 0; } -static int dummy_dma_get_data_size(struct dma *dma, int channel, +static int dummy_dma_get_data_size(struct dma *dma, unsigned int channel, uint32_t *avail, uint32_t *free) { return 0; diff --git a/src/drivers/imx/edma.c b/src/drivers/imx/edma.c index e12ad5269781..aac932926022 100644 --- a/src/drivers/imx/edma.c +++ b/src/drivers/imx/edma.c @@ -39,44 +39,44 @@ static inline void edma_update_bits(struct dma *dma, uint32_t reg, } /* acquire the specific DMA channel */ -static int edma_channel_get(struct dma *dma, int req_chan) +static int edma_channel_get(struct dma *dma, unsigned int req_chan) { return 0; } /* channel must not be running when this is called */ -static void edma_channel_put(struct dma *dma, int channel) +static void edma_channel_put(struct dma *dma, unsigned int channel) { } -static int edma_start(struct dma *dma, int channel) +static int edma_start(struct dma *dma, unsigned int channel) { return 0; } -static int edma_release(struct dma *dma, int channel) +static int edma_release(struct dma *dma, unsigned int channel) { return 0; } -static int edma_pause(struct dma *dma, int channel) +static int edma_pause(struct dma *dma, unsigned int channel) { return 0; } -static int edma_stop(struct dma *dma, int channel) +static int edma_stop(struct dma *dma, unsigned int channel) { return 0; } -static int edma_status(struct dma *dma, int channel, +static int edma_status(struct dma *dma, unsigned int channel, struct dma_chan_status *status, uint8_t direction) { return 0; } /* set the DMA channel configuration, source/target address, buffer sizes */ -static int edma_set_config(struct dma *dma, int channel, +static int edma_set_config(struct dma *dma, unsigned int channel, struct dma_sg_config *config) { return 0; @@ -95,7 +95,7 @@ static int edma_pm_context_store(struct dma *dma) return 0; } -static int edma_set_cb(struct dma *dma, int channel, int type, +static int edma_set_cb(struct dma *dma, unsigned int channel, int type, void (*cb)(void *data, uint32_t type, struct dma_sg_elem *next), void *data) { diff --git a/src/drivers/intel/cavs/hda-dma.c b/src/drivers/intel/cavs/hda-dma.c index bbe00954e0c2..2db13161c5cb 100644 --- a/src/drivers/intel/cavs/hda-dma.c +++ b/src/drivers/intel/cavs/hda-dma.c @@ -150,7 +150,7 @@ struct dma_pdata { struct hda_chan_data chan[HDA_DMA_MAX_CHANS]; }; -static int hda_dma_stop(struct dma *dma, int channel); +static int hda_dma_stop(struct dma *dma, unsigned int channel); static inline uint32_t host_dma_reg_read(struct dma *dma, uint32_t chan, uint32_t reg) @@ -353,16 +353,10 @@ static int hda_dma_link_copy_ch(struct dma *dma, struct hda_chan_data *chan, } /* lock should be held by caller */ -static void hda_dma_enable_unlock(struct dma *dma, int channel) +static void hda_dma_enable_unlock(struct dma *dma, unsigned int channel) { struct dma_pdata *p = dma_get_drvdata(dma); - if (channel >= HDA_DMA_MAX_CHANS) { - trace_hddma_error("hda-dmac: %d invalid channel %d", - dma->plat_data.id, channel); - return; - } - trace_hddma("hda-dmac: %d channel %d -> enable", dma->plat_data.id, channel); @@ -393,17 +387,23 @@ static void hda_dma_enable_unlock(struct dma *dma, int channel) } /* notify DMA to copy bytes */ -static int hda_dma_link_copy(struct dma *dma, int channel, int bytes, +static int hda_dma_link_copy(struct dma *dma, unsigned int channel, int bytes, uint32_t flags) { struct dma_pdata *p = dma_get_drvdata(dma); struct hda_chan_data *chan = p->chan + channel; + if (channel >= HDA_DMA_MAX_CHANS) { + trace_hddma_error("hda-dmac: %d invalid channel %d", + dma->plat_data.id, channel); + return -EINVAL; + } + return hda_dma_link_copy_ch(dma, chan, bytes); } /* notify DMA to copy bytes */ -static int hda_dma_host_copy(struct dma *dma, int channel, int bytes, +static int hda_dma_host_copy(struct dma *dma, unsigned int channel, int bytes, uint32_t flags) { struct dma_pdata *p = dma_get_drvdata(dma); @@ -445,7 +445,7 @@ static int hda_dma_host_copy(struct dma *dma, int channel, int bytes, } /* acquire the specific DMA channel */ -static int hda_dma_channel_get(struct dma *dma, int channel) +static int hda_dma_channel_get(struct dma *dma, unsigned int channel) { struct dma_pdata *p = dma_get_drvdata(dma); uint32_t flags; @@ -480,16 +480,10 @@ static int hda_dma_channel_get(struct dma *dma, int channel) } /* channel must not be running when this is called */ -static void hda_dma_channel_put_unlocked(struct dma *dma, int channel) +static void hda_dma_channel_put_unlocked(struct dma *dma, unsigned int channel) { struct dma_pdata *p = dma_get_drvdata(dma); - if (channel >= HDA_DMA_MAX_CHANS) { - trace_hddma_error("hda-dmac: %d invalid channel %d", - dma->plat_data.id, channel); - return; - } - /* set new state */ p->chan[channel].status = COMP_STATE_INIT; p->chan[channel].state = 0; @@ -501,10 +495,16 @@ static void hda_dma_channel_put_unlocked(struct dma *dma, int channel) } /* channel must not be running when this is called */ -static void hda_dma_channel_put(struct dma *dma, int channel) +static void hda_dma_channel_put(struct dma *dma, unsigned int channel) { uint32_t flags; + if (channel >= HDA_DMA_MAX_CHANS) { + trace_hddma_error("hda-dmac: %d invalid channel %d", + dma->plat_data.id, channel); + return; + } + spin_lock_irq(&dma->lock, flags); hda_dma_channel_put_unlocked(dma, channel); spin_unlock_irq(&dma->lock, flags); @@ -512,7 +512,7 @@ static void hda_dma_channel_put(struct dma *dma, int channel) atomic_sub(&dma->num_channels_busy, 1); } -static int hda_dma_start(struct dma *dma, int channel) +static int hda_dma_start(struct dma *dma, unsigned int channel) { struct dma_pdata *p = dma_get_drvdata(dma); uint32_t flags; @@ -551,7 +551,7 @@ static int hda_dma_start(struct dma *dma, int channel) return ret; } -static int hda_dma_release(struct dma *dma, int channel) +static int hda_dma_release(struct dma *dma, unsigned int channel) { struct dma_pdata *p = dma_get_drvdata(dma); @@ -578,7 +578,7 @@ static int hda_dma_release(struct dma *dma, int channel) return 0; } -static int hda_dma_pause(struct dma *dma, int channel) +static int hda_dma_pause(struct dma *dma, unsigned int channel) { struct dma_pdata *p = dma_get_drvdata(dma); uint32_t flags; @@ -605,12 +605,12 @@ static int hda_dma_pause(struct dma *dma, int channel) return 0; } -static int hda_dma_stop(struct dma *dma, int channel) +static int hda_dma_stop(struct dma *dma, unsigned int channel) { struct dma_pdata *p = dma_get_drvdata(dma); uint32_t flags; - if (channel >= HDA_DMA_MAX_CHANS || channel < 0) { + if (channel >= HDA_DMA_MAX_CHANS) { trace_hddma_error("hda-dmac: %d invalid channel %d", dma->plat_data.id, channel); return -EINVAL; @@ -638,7 +638,7 @@ static int hda_dma_stop(struct dma *dma, int channel) } /* fill in "status" with current DMA channel state and position */ -static int hda_dma_status(struct dma *dma, int channel, +static int hda_dma_status(struct dma *dma, unsigned int channel, struct dma_chan_status *status, uint8_t direction) { struct dma_pdata *p = dma_get_drvdata(dma); @@ -658,7 +658,7 @@ static int hda_dma_status(struct dma *dma, int channel, } /* set the DMA channel configuration, source/target address, buffer sizes */ -static int hda_dma_set_config(struct dma *dma, int channel, +static int hda_dma_set_config(struct dma *dma, unsigned int channel, struct dma_sg_config *config) { struct dma_pdata *p = dma_get_drvdata(dma); @@ -798,13 +798,19 @@ static int hda_dma_pm_context_store(struct dma *dma) return 0; } -static int hda_dma_set_cb(struct dma *dma, int channel, int type, +static int hda_dma_set_cb(struct dma *dma, unsigned int channel, int type, void (*cb)(void *data, uint32_t type, struct dma_sg_elem *next), void *data) { struct dma_pdata *p = dma_get_drvdata(dma); uint32_t flags; + if (channel >= HDA_DMA_MAX_CHANS) { + trace_hddma_error("hda-dmac: %d invalid channel %d", + dma->plat_data.id, channel); + return -EINVAL; + } + spin_lock_irq(&dma->lock, flags); p->chan[channel].cb = cb; p->chan[channel].cb_data = data; @@ -909,8 +915,8 @@ static int hda_dma_free_data_size(struct hda_chan_data *chan) return size; } -static int hda_dma_data_size(struct dma *dma, int channel, uint32_t *avail, - uint32_t *free) +static int hda_dma_data_size(struct dma *dma, unsigned int channel, + uint32_t *avail, uint32_t *free) { struct dma_pdata *p = dma_get_drvdata(dma); struct hda_chan_data *chan = &p->chan[channel]; @@ -939,37 +945,37 @@ static int hda_dma_data_size(struct dma *dma, int channel, uint32_t *avail, } const struct dma_ops hda_host_dma_ops = { - .channel_get = hda_dma_channel_get, - .channel_put = hda_dma_channel_put, - .start = hda_dma_start, - .stop = hda_dma_stop, - .copy = hda_dma_host_copy, - .pause = hda_dma_pause, - .release = hda_dma_release, - .status = hda_dma_status, - .set_config = hda_dma_set_config, - .set_cb = hda_dma_set_cb, - .pm_context_restore = hda_dma_pm_context_restore, - .pm_context_store = hda_dma_pm_context_store, - .probe = hda_dma_probe, - .remove = hda_dma_remove, - .get_data_size = hda_dma_data_size, + .channel_get = hda_dma_channel_get, + .channel_put = hda_dma_channel_put, + .start = hda_dma_start, + .stop = hda_dma_stop, + .copy = hda_dma_host_copy, + .pause = hda_dma_pause, + .release = hda_dma_release, + .status = hda_dma_status, + .set_config = hda_dma_set_config, + .set_cb = hda_dma_set_cb, + .pm_context_restore = hda_dma_pm_context_restore, + .pm_context_store = hda_dma_pm_context_store, + .probe = hda_dma_probe, + .remove = hda_dma_remove, + .get_data_size = hda_dma_data_size, }; const struct dma_ops hda_link_dma_ops = { - .channel_get = hda_dma_channel_get, - .channel_put = hda_dma_channel_put, - .start = hda_dma_start, - .stop = hda_dma_stop, - .copy = hda_dma_link_copy, - .pause = hda_dma_pause, - .release = hda_dma_release, - .status = hda_dma_status, - .set_config = hda_dma_set_config, - .set_cb = hda_dma_set_cb, - .pm_context_restore = hda_dma_pm_context_restore, - .pm_context_store = hda_dma_pm_context_store, - .probe = hda_dma_probe, - .remove = hda_dma_remove, - .get_data_size = hda_dma_data_size, + .channel_get = hda_dma_channel_get, + .channel_put = hda_dma_channel_put, + .start = hda_dma_start, + .stop = hda_dma_stop, + .copy = hda_dma_link_copy, + .pause = hda_dma_pause, + .release = hda_dma_release, + .status = hda_dma_status, + .set_config = hda_dma_set_config, + .set_cb = hda_dma_set_cb, + .pm_context_restore = hda_dma_pm_context_restore, + .pm_context_store = hda_dma_pm_context_store, + .probe = hda_dma_probe, + .remove = hda_dma_remove, + .get_data_size = hda_dma_data_size, }; diff --git a/src/include/sof/dma.h b/src/include/sof/dma.h index 405014dac320..25e748375952 100644 --- a/src/include/sof/dma.h +++ b/src/include/sof/dma.h @@ -119,21 +119,22 @@ struct dma_chan_status { /* DMA operations */ struct dma_ops { - int (*channel_get)(struct dma *dma, int req_channel); - void (*channel_put)(struct dma *dma, int channel); - - int (*start)(struct dma *dma, int channel); - int (*stop)(struct dma *dma, int channel); - int (*copy)(struct dma *dma, int channel, int bytes, uint32_t flags); - int (*pause)(struct dma *dma, int channel); - int (*release)(struct dma *dma, int channel); - int (*status)(struct dma *dma, int channel, + int (*channel_get)(struct dma *dma, unsigned int req_channel); + void (*channel_put)(struct dma *dma, unsigned int channel); + + int (*start)(struct dma *dma, unsigned int channel); + int (*stop)(struct dma *dma, unsigned int channel); + int (*copy)(struct dma *dma, unsigned int channel, int bytes, + uint32_t flags); + int (*pause)(struct dma *dma, unsigned int channel); + int (*release)(struct dma *dma, unsigned int channel); + int (*status)(struct dma *dma, unsigned int channel, struct dma_chan_status *status, uint8_t direction); - int (*set_config)(struct dma *dma, int channel, + int (*set_config)(struct dma *dma, unsigned int channel, struct dma_sg_config *config); - int (*set_cb)(struct dma *dma, int channel, int type, + int (*set_cb)(struct dma *dma, unsigned int channel, int type, void (*cb)(void *data, uint32_t type, struct dma_sg_elem *next), void *data); @@ -143,8 +144,8 @@ struct dma_ops { int (*probe)(struct dma *dma); int (*remove)(struct dma *dma); - int (*get_data_size)(struct dma *dma, int channel, uint32_t *avail, - uint32_t *free); + int (*get_data_size)(struct dma *dma, unsigned int channel, + uint32_t *avail, uint32_t *free); }; /* DMA platform data */