ath79/mikrotik: use routerbootpart partitions
[oweals/openwrt.git] / target / linux / layerscape / patches-5.4 / 801-audio-0061-ASoC-fsl_sai-support-multi-power-domain.patch
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
5
6 support multi power domain
7
8 Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
9 ---
10  sound/soc/fsl/fsl_sai.c | 20 ++++++++++++++++++++
11  1 file changed, 20 insertions(+)
12
13 --- a/sound/soc/fsl/fsl_sai.c
14 +++ b/sound/soc/fsl/fsl_sai.c
15 @@ -16,6 +16,7 @@
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
24         int index;
25         struct regmap_config fsl_sai_regmap_config = fsl_sai_v2_regmap_config;
26         unsigned long irqflags = 0;
27 +       int num_domains = 0;
28  
29         sai = devm_kzalloc(&pdev->dev, sizeof(*sai), GFP_KERNEL);
30         if (!sai)
31 @@ -1409,6 +1411,24 @@ static int fsl_sai_probe(struct platform
32                 }
33         }
34  
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;
40 +
41 +               pd_dev = dev_pm_domain_attach_by_id(&pdev->dev, i);
42 +               if (IS_ERR(pd_dev))
43 +                       return PTR_ERR(pd_dev);
44 +
45 +               link = device_link_add(&pdev->dev, pd_dev,
46 +                       DL_FLAG_STATELESS |
47 +                       DL_FLAG_PM_RUNTIME |
48 +                       DL_FLAG_RPM_ACTIVE);
49 +               if (IS_ERR(link))
50 +                       return PTR_ERR(link);
51 +       }
52 +
53         sai->pll8k_clk = devm_clk_get(&pdev->dev, "pll8k");
54         if (IS_ERR(sai->pll8k_clk))
55                 sai->pll8k_clk = NULL;