Browse Source

ENGR00331799-8: ASoC: fsl_spdif: add pm runtime for spdif

Add pm runtime for spdif.

Signed-off-by: Shengjiu Wang <b02247@freescale.com>
isee-imx_3.14.28.y
Shengjiu Wang 7 years ago
committed by Nitin Garg
parent
commit
ce80c93237
1 changed files with 29 additions and 0 deletions
  1. +29
    -0
      sound/soc/fsl/fsl_spdif.c

+ 29
- 0
sound/soc/fsl/fsl_spdif.c View File

@ -21,6 +21,8 @@
#include <linux/of_device.h>
#include <linux/of_irq.h>
#include <linux/regmap.h>
#include <linux/pm_runtime.h>
#include <linux/busfreq-imx6.h>
#include <sound/asoundef.h>
#include <sound/dmaengine_pcm.h>
@ -450,6 +452,8 @@ static int fsl_spdif_startup(struct snd_pcm_substream *substream,
u32 scr, mask, i;
int ret;
pm_runtime_get_sync(cpu_dai->dev);
/* Reset module and interrupts only for first initialization */
if (!cpu_dai->active) {
ret = clk_prepare_enable(spdif_priv->coreclk);
@ -533,6 +537,8 @@ static void fsl_spdif_shutdown(struct snd_pcm_substream *substream,
clk_disable_unprepare(spdif_priv->dmaclk);
clk_disable_unprepare(spdif_priv->coreclk);
}
pm_runtime_put_sync(cpu_dai->dev);
}
static int fsl_spdif_hw_params(struct snd_pcm_substream *substream,
@ -1255,6 +1261,8 @@ static int fsl_spdif_probe(struct platform_device *pdev)
spdif_priv->dma_params_tx.addr = res->start + REG_SPDIF_STL;
spdif_priv->dma_params_rx.addr = res->start + REG_SPDIF_SRL;
pm_runtime_enable(&pdev->dev);
/* Register with ASoC */
dev_set_drvdata(&pdev->dev, spdif_priv);
@ -1272,6 +1280,26 @@ static int fsl_spdif_probe(struct platform_device *pdev)
return ret;
}
#ifdef CONFIG_PM_RUNTIME
static int fsl_spdif_runtime_resume(struct device *dev)
{
request_bus_freq(BUS_FREQ_HIGH);
return 0;
}
static int fsl_spdif_runtime_suspend(struct device *dev)
{
release_bus_freq(BUS_FREQ_HIGH);
return 0;
}
#endif
static const struct dev_pm_ops fsl_spdif_pm = {
SET_RUNTIME_PM_OPS(fsl_spdif_runtime_suspend,
fsl_spdif_runtime_resume,
NULL)
};
static const struct of_device_id fsl_spdif_dt_ids[] = {
{ .compatible = "fsl,imx35-spdif", },
{ .compatible = "fsl,vf610-spdif", },
@ -1284,6 +1312,7 @@ static struct platform_driver fsl_spdif_driver = {
.name = "fsl-spdif-dai",
.owner = THIS_MODULE,
.of_match_table = fsl_spdif_dt_ids,
.pm = &fsl_spdif_pm,
},
.probe = fsl_spdif_probe,
};


Loading…
Cancel
Save