Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6fce983f authored by Jose Abreu's avatar Jose Abreu Committed by Mark Brown
Browse files

ASoC: dwc: Fix PIO mode initialization



We can no longer rely on the return value of
devm_snd_dmaengine_pcm_register(...) to check if the DMA
handle is declared in the DT.

Previously this check activated PIO mode but currently
dma_request_chan returns either a valid channel or -EPROBE_DEFER.

In order to activate PIO mode check instead if the interrupt
line is declared. This reflects better what is documented in
the DT bindings (see Documentation/devicetree/bindings/sound/
designware-i2s.txt).

Also, initialize use_pio variable which was never being set
causing PIO mode to never work.

Signed-off-by: default avatarJose Abreu <joabreu@synopsys.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent a5de5b74
Loading
Loading
Loading
Loading
+11 −14
Original line number Original line Diff line number Diff line
@@ -681,24 +681,21 @@ static int dw_i2s_probe(struct platform_device *pdev)
	}
	}


	if (!pdata) {
	if (!pdata) {
		ret = devm_snd_dmaengine_pcm_register(&pdev->dev, NULL, 0);
		if (irq >= 0) {
		if (ret == -EPROBE_DEFER) {
			dev_err(&pdev->dev,
				"failed to register PCM, deferring probe\n");
			return ret;
		} else if (ret) {
			dev_err(&pdev->dev,
				"Could not register DMA PCM: %d\n"
				"falling back to PIO mode\n", ret);
			ret = dw_pcm_register(pdev);
			ret = dw_pcm_register(pdev);
			dev->use_pio = true;
		} else {
			ret = devm_snd_dmaengine_pcm_register(&pdev->dev, NULL,
					0);
			dev->use_pio = false;
		}

		if (ret) {
		if (ret) {
				dev_err(&pdev->dev,
			dev_err(&pdev->dev, "could not register pcm: %d\n",
					"Could not register PIO PCM: %d\n",
					ret);
					ret);
			goto err_clk_disable;
			goto err_clk_disable;
		}
		}
	}
	}
	}


	pm_runtime_enable(&pdev->dev);
	pm_runtime_enable(&pdev->dev);
	return 0;
	return 0;