From: Mirela Rabulea Date: Thu, 18 Jul 2019 16:06:30 +0000 (+0300) Subject: MLK-22288: mxc-jpeg: Jpeg decoding/encoding on slot other than 0 X-Git-Tag: rel_imx_4.19.35_1.1.0~136 X-Git-Url: https://git.somdevices.com/?a=commitdiff_plain;h=d2c2cdb11b29fb30fedb0c17620a95955c876fb8;p=linux.git MLK-22288: mxc-jpeg: Jpeg decoding/encoding on slot other than 0 Set-up the interrupts for all 4 slots to be handled in the same routine, mxc_jpeg_dec_irq, which now is no longer hard-coded for slot 0. Return initial code instead of EINVAL. Signed-off-by: Mirela Rabulea Reviewed-by: Robert Chiras --- diff --git a/drivers/media/platform/imx8/mxc-jpeg.c b/drivers/media/platform/imx8/mxc-jpeg.c index 8b478c4120ea..6573c52b4afe 100644 --- a/drivers/media/platform/imx8/mxc-jpeg.c +++ b/drivers/media/platform/imx8/mxc-jpeg.c @@ -1926,6 +1926,7 @@ static int mxc_jpeg_probe(struct platform_device *pdev) int ret; int mode; const struct of_device_id *of_id; + unsigned int slot; of_id = of_match_node(mxc_jpeg_match, dev->of_node); mode = (int)(u64) of_id->data; @@ -1937,30 +1938,33 @@ static int mxc_jpeg_probe(struct platform_device *pdev) mutex_init(&jpeg->lock); spin_lock_init(&jpeg->hw_lock); - if (dma_set_mask_and_coherent(dev, DMA_BIT_MASK(32))) { + ret = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(32)); + if (ret) { dev_err(&pdev->dev, "No suitable DMA available.\n"); - return -EINVAL; + goto err_irq; } res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - dec_irq = platform_get_irq(pdev, 0); - if (!res || dec_irq < 0) { - dev_err(&pdev->dev, "Failed to get dec_irq %d.\n", dec_irq); - ret = -EINVAL; - goto err_irq; - } - ret = devm_request_irq(&pdev->dev, dec_irq, mxc_jpeg_dec_irq, 0, - pdev->name, jpeg); - if (ret) { - dev_err(&pdev->dev, "Failed to request dec_irq %d (%d)\n", - dec_irq, ret); - ret = -EINVAL; - goto err_irq; - } jpeg->base_reg = devm_ioremap_resource(&pdev->dev, res); if (IS_ERR(jpeg->base_reg)) return PTR_ERR(jpeg->base_reg); + for (slot = 0; slot < MXC_MAX_SLOTS; slot++) { + dec_irq = platform_get_irq(pdev, slot); + if (dec_irq < 0) { + dev_err(&pdev->dev, "Failed to get irq %d.\n", dec_irq); + ret = dec_irq; + goto err_irq; + } + ret = devm_request_irq(&pdev->dev, dec_irq, mxc_jpeg_dec_irq, 0, + pdev->name, jpeg); + if (ret) { + dev_err(&pdev->dev, "Failed to request irq %d (%d)\n", + dec_irq, ret); + goto err_irq; + } + } + jpeg->pdev = pdev; jpeg->dev = dev; jpeg->mode = mode;