Skip to content

Commit e32634f

Browse files
baruchsiachvinodkoul
authored andcommitted
dma: dw-axi-dmac: support per channel interrupt
Hardware might not support a single combined interrupt that covers all channels. In that case we have to deal with interrupt per channel. Add support for that configuration. Signed-off-by: Baruch Siach <baruch@tkos.co.il> Link: https://lore.kernel.org/r/ebab52e886ef1adc3c40e636aeb1ba3adfe2e578.1711453387.git.baruchs-c@neureality.ai Signed-off-by: Vinod Koul <vkoul@kernel.org>
1 parent 333e11b commit e32634f

2 files changed

Lines changed: 23 additions & 8 deletions

File tree

drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1443,6 +1443,24 @@ static int parse_device_properties(struct axi_dma_chip *chip)
14431443
return 0;
14441444
}
14451445

1446+
static int axi_req_irqs(struct platform_device *pdev, struct axi_dma_chip *chip)
1447+
{
1448+
int irq_count = platform_irq_count(pdev);
1449+
int ret;
1450+
1451+
for (int i = 0; i < irq_count; i++) {
1452+
chip->irq[i] = platform_get_irq(pdev, i);
1453+
if (chip->irq[i] < 0)
1454+
return chip->irq[i];
1455+
ret = devm_request_irq(chip->dev, chip->irq[i], dw_axi_dma_interrupt,
1456+
IRQF_SHARED, KBUILD_MODNAME, chip);
1457+
if (ret < 0)
1458+
return ret;
1459+
}
1460+
1461+
return 0;
1462+
}
1463+
14461464
static int dw_probe(struct platform_device *pdev)
14471465
{
14481466
struct axi_dma_chip *chip;
@@ -1469,10 +1487,6 @@ static int dw_probe(struct platform_device *pdev)
14691487
chip->dev = &pdev->dev;
14701488
chip->dw->hdata = hdata;
14711489

1472-
chip->irq = platform_get_irq(pdev, 0);
1473-
if (chip->irq < 0)
1474-
return chip->irq;
1475-
14761490
chip->regs = devm_platform_ioremap_resource(pdev, 0);
14771491
if (IS_ERR(chip->regs))
14781492
return PTR_ERR(chip->regs);
@@ -1513,8 +1527,7 @@ static int dw_probe(struct platform_device *pdev)
15131527
if (!dw->chan)
15141528
return -ENOMEM;
15151529

1516-
ret = devm_request_irq(chip->dev, chip->irq, dw_axi_dma_interrupt,
1517-
IRQF_SHARED, KBUILD_MODNAME, chip);
1530+
ret = axi_req_irqs(pdev, chip);
15181531
if (ret)
15191532
return ret;
15201533

@@ -1627,7 +1640,9 @@ static void dw_remove(struct platform_device *pdev)
16271640
pm_runtime_disable(chip->dev);
16281641
axi_dma_suspend(chip);
16291642

1630-
devm_free_irq(chip->dev, chip->irq, chip);
1643+
for (i = 0; i < DMAC_MAX_CHANNELS; i++)
1644+
if (chip->irq[i] > 0)
1645+
devm_free_irq(chip->dev, chip->irq[i], chip);
16311646

16321647
of_dma_controller_free(chip->dev->of_node);
16331648

drivers/dma/dw-axi-dmac/dw-axi-dmac.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ struct dw_axi_dma {
6565

6666
struct axi_dma_chip {
6767
struct device *dev;
68-
int irq;
68+
int irq[DMAC_MAX_CHANNELS];
6969
void __iomem *regs;
7070
void __iomem *apb_regs;
7171
struct clk *core_clk;

0 commit comments

Comments
 (0)