aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/pxa/pxa2xx-i2s.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/soc/pxa/pxa2xx-i2s.c')
-rw-r--r--sound/soc/pxa/pxa2xx-i2s.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/sound/soc/pxa/pxa2xx-i2s.c b/sound/soc/pxa/pxa2xx-i2s.c
index 425071030970..e130346732ba 100644
--- a/sound/soc/pxa/pxa2xx-i2s.c
+++ b/sound/soc/pxa/pxa2xx-i2s.c
@@ -18,6 +18,7 @@
18#include <linux/module.h> 18#include <linux/module.h>
19#include <linux/device.h> 19#include <linux/device.h>
20#include <linux/delay.h> 20#include <linux/delay.h>
21#include <linux/clk.h>
21#include <sound/core.h> 22#include <sound/core.h>
22#include <sound/pcm.h> 23#include <sound/pcm.h>
23#include <sound/initval.h> 24#include <sound/initval.h>
@@ -40,6 +41,7 @@ struct pxa_i2s_port {
40 u32 fmt; 41 u32 fmt;
41}; 42};
42static struct pxa_i2s_port pxa_i2s; 43static struct pxa_i2s_port pxa_i2s;
44static struct clk *clk_i2s;
43 45
44static struct pxa2xx_pcm_dma_params pxa2xx_i2s_pcm_stereo_out = { 46static struct pxa2xx_pcm_dma_params pxa2xx_i2s_pcm_stereo_out = {
45 .name = "I2S PCM Stereo out", 47 .name = "I2S PCM Stereo out",
@@ -82,6 +84,10 @@ static int pxa2xx_i2s_startup(struct snd_pcm_substream *substream)
82 struct snd_soc_pcm_runtime *rtd = substream->private_data; 84 struct snd_soc_pcm_runtime *rtd = substream->private_data;
83 struct snd_soc_cpu_dai *cpu_dai = rtd->dai->cpu_dai; 85 struct snd_soc_cpu_dai *cpu_dai = rtd->dai->cpu_dai;
84 86
87 clk_i2s = clk_get(NULL, "I2SCLK");
88 if (IS_ERR(clk_i2s))
89 return PTR_ERR(clk_i2s);
90
85 if (!cpu_dai->active) { 91 if (!cpu_dai->active) {
86 SACR0 |= SACR0_RST; 92 SACR0 |= SACR0_RST;
87 SACR0 = 0; 93 SACR0 = 0;
@@ -149,7 +155,7 @@ static int pxa2xx_i2s_hw_params(struct snd_pcm_substream *substream,
149 pxa_gpio_mode(gpio_bus[pxa_i2s.master].tx); 155 pxa_gpio_mode(gpio_bus[pxa_i2s.master].tx);
150 pxa_gpio_mode(gpio_bus[pxa_i2s.master].frm); 156 pxa_gpio_mode(gpio_bus[pxa_i2s.master].frm);
151 pxa_gpio_mode(gpio_bus[pxa_i2s.master].clk); 157 pxa_gpio_mode(gpio_bus[pxa_i2s.master].clk);
152 pxa_set_cken(CKEN_I2S, 1); 158 clk_enable(clk_i2s);
153 pxa_i2s_wait(); 159 pxa_i2s_wait();
154 160
155 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) 161 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
@@ -234,8 +240,10 @@ static void pxa2xx_i2s_shutdown(struct snd_pcm_substream *substream)
234 if (SACR1 & (SACR1_DREC | SACR1_DRPL)) { 240 if (SACR1 & (SACR1_DREC | SACR1_DRPL)) {
235 SACR0 &= ~SACR0_ENB; 241 SACR0 &= ~SACR0_ENB;
236 pxa_i2s_wait(); 242 pxa_i2s_wait();
237 pxa_set_cken(CKEN_I2S, 0); 243 clk_disable(clk_i2s);
238 } 244 }
245
246 clk_put(clk_i2s);
239} 247}
240 248
241#ifdef CONFIG_PM 249#ifdef CONFIG_PM