diff options
author | Ranjani Vaidyanathan <ra5478@freescale.com> | 2013-08-20 15:31:40 -0400 |
---|---|---|
committer | Nitin Garg <nitin.garg@freescale.com> | 2014-04-16 09:01:25 -0400 |
commit | 715a18bea8c1e38ea7200034d7ca0cf32974ecf8 (patch) | |
tree | d2374d83b2f0923eadf29ef6613d596f2a63f694 /sound/soc/fsl/fsl_ssi.c | |
parent | 38937ae1c8de16798a28b7327e1d2c3cb6574384 (diff) |
ENGR00275974-3 [iMX6x] Add busfreq support to the drivers
Add request_bus_freq() and release_bus_freq() calls to the
various drivers to ensure that the DDR and AHB are the requested
frequency before the driver starts its task.
Signed-off-by: Ranjani Vaidyanathan <ra5478@freescale.com>
Diffstat (limited to 'sound/soc/fsl/fsl_ssi.c')
-rw-r--r-- | sound/soc/fsl/fsl_ssi.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c index 70df5a0caca7..49ab2bdc035c 100644 --- a/sound/soc/fsl/fsl_ssi.c +++ b/sound/soc/fsl/fsl_ssi.c | |||
@@ -10,6 +10,7 @@ | |||
10 | * kind, whether express or implied. | 10 | * kind, whether express or implied. |
11 | */ | 11 | */ |
12 | 12 | ||
13 | #include <linux/busfreq-imx6.h> | ||
13 | #include <linux/init.h> | 14 | #include <linux/init.h> |
14 | #include <linux/io.h> | 15 | #include <linux/io.h> |
15 | #include <linux/module.h> | 16 | #include <linux/module.h> |
@@ -21,6 +22,7 @@ | |||
21 | #include <linux/of_address.h> | 22 | #include <linux/of_address.h> |
22 | #include <linux/of_irq.h> | 23 | #include <linux/of_irq.h> |
23 | #include <linux/of_platform.h> | 24 | #include <linux/of_platform.h> |
25 | #include <linux/pm_runtime.h> | ||
24 | 26 | ||
25 | #include <sound/core.h> | 27 | #include <sound/core.h> |
26 | #include <sound/pcm.h> | 28 | #include <sound/pcm.h> |
@@ -330,6 +332,8 @@ static int fsl_ssi_startup(struct snd_pcm_substream *substream, | |||
330 | snd_soc_dai_get_drvdata(rtd->cpu_dai); | 332 | snd_soc_dai_get_drvdata(rtd->cpu_dai); |
331 | int synchronous = ssi_private->cpu_dai_drv.symmetric_rates; | 333 | int synchronous = ssi_private->cpu_dai_drv.symmetric_rates; |
332 | 334 | ||
335 | pm_runtime_get_sync(dai->dev); | ||
336 | |||
333 | clk_enable(ssi_private->clk); | 337 | clk_enable(ssi_private->clk); |
334 | 338 | ||
335 | /* | 339 | /* |
@@ -577,6 +581,8 @@ static void fsl_ssi_shutdown(struct snd_pcm_substream *substream, | |||
577 | 581 | ||
578 | clk_disable(ssi_private->clk); | 582 | clk_disable(ssi_private->clk); |
579 | 583 | ||
584 | pm_runtime_put_sync(dai->dev); | ||
585 | |||
580 | /* If this is the last active substream, disable the interrupts. */ | 586 | /* If this is the last active substream, disable the interrupts. */ |
581 | if (!ssi_private->first_stream) { | 587 | if (!ssi_private->first_stream) { |
582 | struct ccsr_ssi __iomem *ssi = ssi_private->ssi; | 588 | struct ccsr_ssi __iomem *ssi = ssi_private->ssi; |
@@ -813,6 +819,8 @@ static int fsl_ssi_probe(struct platform_device *pdev) | |||
813 | goto error_irq; | 819 | goto error_irq; |
814 | } | 820 | } |
815 | 821 | ||
822 | pm_runtime_enable(&pdev->dev); | ||
823 | |||
816 | /* Register with ASoC */ | 824 | /* Register with ASoC */ |
817 | dev_set_drvdata(&pdev->dev, ssi_private); | 825 | dev_set_drvdata(&pdev->dev, ssi_private); |
818 | 826 | ||
@@ -918,6 +926,26 @@ static int fsl_ssi_remove(struct platform_device *pdev) | |||
918 | return 0; | 926 | return 0; |
919 | } | 927 | } |
920 | 928 | ||
929 | #ifdef CONFIG_PM_RUNTIME | ||
930 | static int fsl_ssi_runtime_resume(struct device *dev) | ||
931 | { | ||
932 | request_bus_freq(BUS_FREQ_AUDIO); | ||
933 | return 0; | ||
934 | } | ||
935 | |||
936 | static int fsl_ssi_runtime_suspend(struct device *dev) | ||
937 | { | ||
938 | release_bus_freq(BUS_FREQ_AUDIO); | ||
939 | return 0; | ||
940 | } | ||
941 | |||
942 | static const struct dev_pm_ops fsl_ssi_pm = { | ||
943 | SET_RUNTIME_PM_OPS(fsl_ssi_runtime_suspend, | ||
944 | fsl_ssi_runtime_resume, | ||
945 | NULL) | ||
946 | }; | ||
947 | #endif | ||
948 | |||
921 | static const struct of_device_id fsl_ssi_ids[] = { | 949 | static const struct of_device_id fsl_ssi_ids[] = { |
922 | { .compatible = "fsl,mpc8610-ssi", }, | 950 | { .compatible = "fsl,mpc8610-ssi", }, |
923 | { .compatible = "fsl,imx21-ssi", }, | 951 | { .compatible = "fsl,imx21-ssi", }, |