diff options
author | Shengjiu Wang <shengjiu.wang@nxp.com> | 2019-01-29 14:50:54 +0800 |
---|---|---|
committer | Dong Aisheng <aisheng.dong@nxp.com> | 2019-11-25 15:48:40 +0800 |
commit | 442ad6fd0c22a2e39aa916b248dc652b9da9a30f (patch) | |
tree | 652d04aaefc2164effb12280928e611f85e02ff7 /sound/soc/fsl/fsl_asrc.c | |
parent | c0815928c529f5b8f5abcdbbdb483b39e50572d5 (diff) |
ASoC: fsl_asrc: support multi power domain
support multi power domain
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Diffstat (limited to 'sound/soc/fsl/fsl_asrc.c')
-rw-r--r-- | sound/soc/fsl/fsl_asrc.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/sound/soc/fsl/fsl_asrc.c b/sound/soc/fsl/fsl_asrc.c index a451905928c6..778754d0110a 100644 --- a/sound/soc/fsl/fsl_asrc.c +++ b/sound/soc/fsl/fsl_asrc.c @@ -16,6 +16,7 @@ #include <linux/pm_runtime.h> #include <linux/miscdevice.h> #include <linux/sched/signal.h> +#include <linux/pm_domain.h> #include <sound/dmaengine_pcm.h> #include <sound/pcm_params.h> @@ -1026,6 +1027,7 @@ static int fsl_asrc_probe(struct platform_device *pdev) void __iomem *regs; int irq, ret, i; char tmp[16]; + int num_domains = 0; asrc_priv = devm_kzalloc(&pdev->dev, sizeof(*asrc_priv), GFP_KERNEL); if (!asrc_priv) @@ -1084,6 +1086,24 @@ static int fsl_asrc_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); + } + if (of_device_is_compatible(np, "fsl,imx35-asrc")) { asrc_priv->channel_bits = 3; strncpy(asrc_priv->name, "mxc_asrc", |