Browse Source

ENGR00331799-7: ASoC: fsl_ssi: pm_runtime for ssi

ADD pm runtime for ssi.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
isee-imx_3.14.28.y
Shengjiu Wang 6 years ago
committed by Nitin Garg
parent
commit
b778b9df66
1 changed files with 30 additions and 1 deletions
  1. +30
    -1
      sound/soc/fsl/fsl_ssi.c

+ 30
- 1
sound/soc/fsl/fsl_ssi.c View File

@ -43,6 +43,8 @@
#include <linux/of_address.h>
#include <linux/of_irq.h>
#include <linux/of_platform.h>
#include <linux/pm_runtime.h>
#include <linux/busfreq-imx6.h>
#include <sound/core.h>
#include <sound/pcm.h>
@ -532,6 +534,8 @@ static int fsl_ssi_startup(struct snd_pcm_substream *substream,
if (ret)
return ret;
pm_runtime_get_sync(dai->dev);
/* When using dual fifo mode, it is safer to ensure an even period
* size. If appearing to an odd number while DMA always starts its
* task from fifo0, fifo1 would be neglected at the end of each
@ -555,6 +559,8 @@ static void fsl_ssi_shutdown(struct snd_pcm_substream *substream,
struct fsl_ssi_private *ssi_private =
snd_soc_dai_get_drvdata(rtd->cpu_dai);
pm_runtime_put_sync(dai->dev);
clk_disable_unprepare(ssi_private->clk);
}
@ -1041,7 +1047,7 @@ static int fsl_ssi_dai_probe(struct snd_soc_dai *dai)
static const struct snd_soc_dai_ops fsl_ssi_dai_ops = {
.startup = fsl_ssi_startup,
.shutdown = fsl_ssi_shutdown,
.shutdown = fsl_ssi_shutdown,
.hw_params = fsl_ssi_hw_params,
.hw_free = fsl_ssi_hw_free,
.set_fmt = fsl_ssi_set_dai_fmt,
@ -1363,6 +1369,8 @@ static int fsl_ssi_probe(struct platform_device *pdev)
/* Older 8610 DTs didn't have the fifo-depth property */
ssi_private->fifo_depth = 8;
pm_runtime_enable(&pdev->dev);
dev_set_drvdata(&pdev->dev, ssi_private);
if (ssi_private->soc->imx) {
@ -1464,11 +1472,32 @@ static int fsl_ssi_remove(struct platform_device *pdev)
return 0;
}
#ifdef CONFIG_PM_RUNTIME
static int fsl_ssi_runtime_resume(struct device *dev)
{
request_bus_freq(BUS_FREQ_AUDIO);
return 0;
}
static int fsl_ssi_runtime_suspend(struct device *dev)
{
release_bus_freq(BUS_FREQ_AUDIO);
return 0;
}
#endif
static const struct dev_pm_ops fsl_ssi_pm = {
SET_RUNTIME_PM_OPS(fsl_ssi_runtime_suspend,
fsl_ssi_runtime_resume,
NULL)
};
static struct platform_driver fsl_ssi_driver = {
.driver = {
.name = "fsl-ssi-dai",
.owner = THIS_MODULE,
.of_match_table = fsl_ssi_ids,
.pm = &fsl_ssi_pm,
},
.probe = fsl_ssi_probe,
.remove = fsl_ssi_remove,


Loading…
Cancel
Save