ASoC: rockchip: pdm: Register PCM before DAI component

API snd_soc_register_component will try to rebind card per
each component register. and the ASoC allow no-pcm card instance.

  devm_snd_soc_register_component
      snd_soc_try_rebind_card
          snd_soc_bind_card
              snd_soc_add_pcm_runtime
  devm_snd_dmaengine_pcm_register

So, we should register PCM before DAI component.

Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com>
Change-Id: I0f9f7efd932fc9572c7574aeefb3d61bc5838db2
This commit is contained in:
Sugar Zhang
2024-07-19 16:44:40 +08:00
committed by Tao Huang
parent eb0f1ee27c
commit c1ac114227

View File

@@ -994,6 +994,22 @@ static int rockchip_pdm_parse_quirks(struct rk_pdm_dev *pdm)
return ret;
}
static int rockchip_pdm_register_platform(struct device *dev)
{
int ret = 0;
if (device_property_read_bool(dev, "rockchip,no-dmaengine")) {
dev_info(dev, "Used for Multi-DAI\n");
return 0;
}
ret = devm_snd_dmaengine_pcm_register(dev, NULL, 0);
if (ret)
dev_err(dev, "Could not register PCM\n");
return ret;
}
static int rockchip_pdm_probe(struct platform_device *pdev)
{
struct device_node *node = pdev->dev.of_node;
@@ -1096,6 +1112,10 @@ static int rockchip_pdm_probe(struct platform_device *pdev)
goto err_pm_disable;
}
ret = rockchip_pdm_register_platform(&pdev->dev);
if (ret)
goto err_suspend;
ret = devm_snd_soc_register_component(&pdev->dev,
&rockchip_pdm_component,
&rockchip_pdm_dai, 1);
@@ -1105,17 +1125,6 @@ static int rockchip_pdm_probe(struct platform_device *pdev)
goto err_suspend;
}
if (of_property_read_bool(node, "rockchip,no-dmaengine")) {
dev_info(&pdev->dev, "Used for Multi-DAI\n");
return 0;
}
ret = devm_snd_dmaengine_pcm_register(&pdev->dev, NULL, 0);
if (ret) {
dev_err(&pdev->dev, "could not register pcm: %d\n", ret);
goto err_suspend;
}
clk_disable_unprepare(pdm->hclk);
return 0;