ASoC: rockchip: i2s-tdm: 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: I578b7c54b96cfa89fd2f8cf346832e2b68a1d355
This commit is contained in:
Sugar Zhang
2023-11-28 08:51:15 +08:00
committed by Tao Huang
parent 22847afeca
commit 008b472c5a

View File

@@ -2813,6 +2813,29 @@ static int rockchip_i2s_tdm_keep_clk_always_on(struct rk_i2s_tdm_dev *i2s_tdm)
return 0;
}
static int rockchip_i2s_tdm_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;
}
if (device_property_read_bool(dev, "rockchip,digital-loopback")) {
ret = devm_snd_dmaengine_dlp_register(dev, &dconfig);
if (ret)
dev_err(dev, "Could not register DLP\n");
return ret;
}
ret = devm_snd_dmaengine_pcm_register(dev, NULL, 0);
if (ret)
dev_err(dev, "Could not register PCM\n");
return ret;
}
static int rockchip_i2s_tdm_probe(struct platform_device *pdev)
{
struct device_node *node = pdev->dev.of_node;
@@ -3046,6 +3069,10 @@ static int rockchip_i2s_tdm_probe(struct platform_device *pdev)
*/
pm_runtime_enable(&pdev->dev);
ret = rockchip_i2s_tdm_register_platform(&pdev->dev);
if (ret)
goto err_suspend;
ret = devm_snd_soc_register_component(&pdev->dev,
&rockchip_i2s_tdm_component,
i2s_tdm->dai, 1);
@@ -3055,21 +3082,6 @@ static int rockchip_i2s_tdm_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;
}
if (of_property_read_bool(node, "rockchip,digital-loopback"))
ret = devm_snd_dmaengine_dlp_register(&pdev->dev, &dconfig);
else
ret = devm_snd_dmaengine_pcm_register(&pdev->dev, NULL, 0);
if (ret) {
dev_err(&pdev->dev, "Could not register PCM\n");
return ret;
}
return 0;
err_suspend: