diff options
author | Shengjiu Wang <shengjiu.wang@nxp.com> | 2019-01-29 14:51:24 +0800 |
---|---|---|
committer | Dong Aisheng <aisheng.dong@nxp.com> | 2019-11-25 15:54:10 +0800 |
commit | 53915e7ea973851a5d9b60681a2718bbdeb5439e (patch) | |
tree | 83b828190115ff81f5b50143b8e7730855d59fc1 /sound/soc/fsl/fsl_sai.c | |
parent | c43c341752c40e11544c79b6367046f85f6f65cc (diff) |
ASoC: fsl_sai: support multi power domain
support multi power domain
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Diffstat (limited to 'sound/soc/fsl/fsl_sai.c')
-rw-r--r-- | sound/soc/fsl/fsl_sai.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/sound/soc/fsl/fsl_sai.c b/sound/soc/fsl/fsl_sai.c index 361ea7126fb9..e82be743a034 100644 --- a/sound/soc/fsl/fsl_sai.c +++ b/sound/soc/fsl/fsl_sai.c @@ -16,6 +16,7 @@ #include <linux/slab.h> #include <linux/time.h> #include <linux/pm_qos.h> +#include <linux/pm_domain.h> #include <sound/core.h> #include <sound/dmaengine_pcm.h> #include <sound/pcm_params.h> @@ -1357,6 +1358,7 @@ static int fsl_sai_probe(struct platform_device *pdev) int index; struct regmap_config fsl_sai_regmap_config = fsl_sai_v2_regmap_config; unsigned long irqflags = 0; + int num_domains = 0; sai = devm_kzalloc(&pdev->dev, sizeof(*sai), GFP_KERNEL); if (!sai) @@ -1409,6 +1411,24 @@ static int fsl_sai_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); + } + sai->pll8k_clk = devm_clk_get(&pdev->dev, "pll8k"); if (IS_ERR(sai->pll8k_clk)) sai->pll8k_clk = NULL; |