diff options
author | Shengjiu Wang <shengjiu.wang@nxp.com> | 2019-09-20 19:00:06 +0800 |
---|---|---|
committer | Dong Aisheng <aisheng.dong@nxp.com> | 2019-11-25 15:54:24 +0800 |
commit | bd7b26036e8793d7fb915da6206706e3e6620ffa (patch) | |
tree | 96c8d3cb40bbeccb778158393c689b4303c71fc1 /sound/soc/fsl/fsl_spdif.c | |
parent | 2d2076c4d0f8eb0f75cd07cbe3809ce150d5b085 (diff) |
ASoC: fsl_spdif:Support multi power domains
Support multi power domains
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Diffstat (limited to 'sound/soc/fsl/fsl_spdif.c')
-rw-r--r-- | sound/soc/fsl/fsl_spdif.c | 20 |
1 files changed, 20 insertions, 0 deletions
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 <linux/of_irq.h> #include <linux/regmap.h> #include <linux/pm_runtime.h> +#include <linux/pm_domain.h> #include <sound/asoundef.h> #include <sound/dmaengine_pcm.h> @@ -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); |