[Sound-open-firmware] [PATCH_V2 2/2] cnl: dma: refine dma interrupt processing on cnl

On cnl, all the dma share the same interrupt pin, so all the dma controller need to be checked in interrupt function.
--- V2: rebase on master Tested with: SOF master kernel:pierre V4.14 branch
Signed-off-by: Rander Wang rander.wang@linux.intel.com --- src/drivers/dw-dma.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+)
diff --git a/src/drivers/dw-dma.c b/src/drivers/dw-dma.c index ccefc50..3d92b21 100644 --- a/src/drivers/dw-dma.c +++ b/src/drivers/dw-dma.c @@ -1138,6 +1138,26 @@ static void dw_dma_irq_handler(void *data) } }
+/*All the dma share the same interrupt on CNL, so check each dma*/ +/*controller when interrupt coming, then do the work */ +static void dw_dma_irq_cnl(void *data) +{ + struct dma *dma; + uint32_t status_intr; + + /*check interrupt status of DMA controller 0*/ + dma = dma_get(DMA_GP_LP_DMAC0); + status_intr = dw_read(dma, DW_INTR_STATUS); + if (status_intr) + dw_dma_irq_handler(dma); + + /*check interrupt status of DMA controller 1*/ + dma = dma_get(DMA_GP_LP_DMAC1); + status_intr = dw_read(dma, DW_INTR_STATUS); + if (status_intr) + dw_dma_irq_handler(dma); +} + static int dw_dma_probe(struct dma *dma) { struct dma_pdata *dw_pdata; @@ -1160,7 +1180,11 @@ static int dw_dma_probe(struct dma *dma) }
/* register our IRQ handler */ +#if defined CONFIG_CANNONLAKE + interrupt_register(dma_irq(dma), dw_dma_irq_cnl, dma); +#else interrupt_register(dma_irq(dma), dw_dma_irq_handler, dma); +#endif interrupt_enable(dma_irq(dma));
return 0;

On Wed, 2018-03-07 at 10:42 +0800, Rander Wang wrote:
On cnl, all the dma share the same interrupt pin, so all the dma controller need to be checked in interrupt function.
Ok, lets go with this for 1.1 and fix properly in 1.2
V2: rebase on master Tested with: SOF master kernel:pierre V4.14 branch
It does not build on all targets
make[2]: Entering directory '/home/lrg/source/reef/reef.git/src/drivers' xtensa-byt-elf-gcc -DHAVE_CONFIG_H -I. -I../../src/include -mtext-section-literals -I /home/lrg/source/reef/reef.git/src/include -I /home/lrg/source/reef/reef.git/../xtensa-root/xtensa-byt-elf/include -I /home/lrg/source/reef/reef.git/src/arch/xtensa/include -I /home/lrg/source/reef/reef.git/src/arch/xtensa/xtos -I /home/lrg/source/reef/reef.git/src/platform/baytrail/include -O2 -g -Wall -Werror -Wl,-EL -Wmissing-prototypes -fno-inline-functions -nostdlib -mlongcalls -MT libdrivers_a-dw-dma.o -MD -MP -MF .deps/libdrivers_a-dw-dma.Tpo -c -o libdrivers_a-dw-dma.o `test -f 'dw-dma.c' || echo './'`dw-dma.c dw-dma.c: In function 'dw_dma_irq_cnl': dw-dma.c:1149:16: error: 'DMA_GP_LP_DMAC0' undeclared (first use in this function) dma = dma_get(DMA_GP_LP_DMAC0); ^ dw-dma.c:1149:16: note: each undeclared identifier is reported only once for each function it appears in dw-dma.c:1155:16: error: 'DMA_GP_LP_DMAC1' undeclared (first use in this function) dma = dma_get(DMA_GP_LP_DMAC1); ^ dw-dma.c: At top level: dw-dma.c:1143:13: error: 'dw_dma_irq_cnl' defined but not used [-Werror=unused-function] static void dw_dma_irq_cnl(void *data) ^ cc1: all warnings being treated as errors
Please resend and make sure it builds for all targets.
Thanks
Liam
participants (2)
-
Liam Girdwood
-
Rander Wang