1 From f11933205182a3da44e7f99d899dd27adafcb6d5 Mon Sep 17 00:00:00 2001
2 From: Shengjiu Wang <shengjiu.wang@nxp.com>
3 Date: Tue, 29 Jan 2019 14:51:24 +0800
4 Subject: [PATCH] ASoC: fsl_sai: support multi power domain
6 support multi power domain
8 Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
10 sound/soc/fsl/fsl_sai.c | 20 ++++++++++++++++++++
11 1 file changed, 20 insertions(+)
13 --- a/sound/soc/fsl/fsl_sai.c
14 +++ b/sound/soc/fsl/fsl_sai.c
16 #include <linux/slab.h>
17 #include <linux/time.h>
18 #include <linux/pm_qos.h>
19 +#include <linux/pm_domain.h>
20 #include <sound/core.h>
21 #include <sound/dmaengine_pcm.h>
22 #include <sound/pcm_params.h>
23 @@ -1357,6 +1358,7 @@ static int fsl_sai_probe(struct platform
25 struct regmap_config fsl_sai_regmap_config = fsl_sai_v2_regmap_config;
26 unsigned long irqflags = 0;
27 + int num_domains = 0;
29 sai = devm_kzalloc(&pdev->dev, sizeof(*sai), GFP_KERNEL);
31 @@ -1409,6 +1411,24 @@ static int fsl_sai_probe(struct platform
35 + num_domains = of_count_phandle_with_args(np, "power-domains",
36 + "#power-domain-cells");
37 + for (i = 0; i < num_domains; i++) {
38 + struct device *pd_dev;
39 + struct device_link *link;
41 + pd_dev = dev_pm_domain_attach_by_id(&pdev->dev, i);
43 + return PTR_ERR(pd_dev);
45 + link = device_link_add(&pdev->dev, pd_dev,
47 + DL_FLAG_PM_RUNTIME |
48 + DL_FLAG_RPM_ACTIVE);
50 + return PTR_ERR(link);
53 sai->pll8k_clk = devm_clk_get(&pdev->dev, "pll8k");
54 if (IS_ERR(sai->pll8k_clk))
55 sai->pll8k_clk = NULL;