From bd7b26036e8793d7fb915da6206706e3e6620ffa Mon Sep 17 00:00:00 2001 From: Shengjiu Wang Date: Fri, 20 Sep 2019 19:00:06 +0800 Subject: =?UTF-8?q?ASoC:=20fsl=5Fspdif=EF=BC=9ASupport=20multi=20power=20d?= =?UTF-8?q?omains?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Support multi power domains Signed-off-by: Shengjiu Wang --- sound/soc/fsl/fsl_spdif.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'sound/soc/fsl/fsl_spdif.c') diff --git a/sound/soc/fsl/fsl_spdif.c b/sound/soc/fsl/fsl_spdif.c index 5d35805176ec..3ae6dd089ce4 100644 --- a/sound/soc/fsl/fsl_spdif.c +++ b/sound/soc/fsl/fsl_spdif.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include @@ -1360,6 +1361,7 @@ static int fsl_spdif_probe(struct platform_device *pdev) void __iomem *regs; int irq, ret, i; char tmp[16]; + int num_domains = 0; if (!np) return -ENODEV; @@ -1423,6 +1425,24 @@ static int fsl_spdif_probe(struct platform_device *pdev) } } + num_domains = of_count_phandle_with_args(np, "power-domains", + "#power-domain-cells"); + for (i = 0; i < num_domains; i++) { + struct device *pd_dev; + struct device_link *link; + + pd_dev = dev_pm_domain_attach_by_id(&pdev->dev, i); + if (IS_ERR(pd_dev)) + return PTR_ERR(pd_dev); + + link = device_link_add(&pdev->dev, pd_dev, + DL_FLAG_STATELESS | + DL_FLAG_PM_RUNTIME | + DL_FLAG_RPM_ACTIVE); + if (IS_ERR(link)) + return PTR_ERR(link); + } + for (i = 0; i < STC_TXCLK_SRC_MAX; i++) { sprintf(tmp, "rxtx%d", i); spdif_priv->txclk[i] = devm_clk_get(&pdev->dev, tmp); -- cgit v1.2.3