aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
Diffstat (limited to 'sound')
-rw-r--r--sound/core/pcm_native.c13
-rw-r--r--sound/i2c/other/ak4113.c2
-rw-r--r--sound/i2c/other/ak4114.c2
-rw-r--r--sound/i2c/other/tea575x-tuner.c205
-rw-r--r--sound/oss/.gitignore1
-rw-r--r--sound/pci/Kconfig4
-rw-r--r--sound/pci/oxygen/oxygen_lib.c8
-rw-r--r--sound/soc/codecs/ab8500-codec.c81
-rw-r--r--sound/soc/codecs/wm5100.c2
-rw-r--r--sound/soc/codecs/wm8350.c2
-rw-r--r--sound/soc/codecs/wm8753.c2
-rw-r--r--sound/soc/ep93xx/ep93xx-ac97.c2
-rw-r--r--sound/soc/ep93xx/ep93xx-i2s.c2
-rw-r--r--sound/soc/ep93xx/ep93xx-pcm.c2
-rw-r--r--sound/soc/fsl/imx-pcm-dma.c2
-rw-r--r--sound/soc/fsl/imx-pcm-fiq.c2
-rw-r--r--sound/soc/fsl/imx-ssi.c2
-rw-r--r--sound/soc/fsl/imx-ssi.h2
-rw-r--r--sound/soc/kirkwood/kirkwood-i2s.c2
-rw-r--r--sound/soc/kirkwood/kirkwood-openrd.c2
-rw-r--r--sound/soc/kirkwood/kirkwood-t5325.c2
-rw-r--r--sound/soc/omap/am3517evm.c2
-rw-r--r--sound/soc/omap/ams-delta.c4
-rw-r--r--sound/soc/omap/igep0020.c2
-rw-r--r--sound/soc/omap/mcbsp.c4
-rw-r--r--sound/soc/omap/n810.c2
-rw-r--r--sound/soc/omap/omap-abe-twl6040.c4
-rw-r--r--sound/soc/omap/omap-mcbsp.c3
-rw-r--r--sound/soc/omap/omap-mcpdm.c2
-rw-r--r--sound/soc/omap/omap-pcm.c1
-rw-r--r--sound/soc/omap/omap3beagle.c2
-rw-r--r--sound/soc/omap/omap3evm.c2
-rw-r--r--sound/soc/omap/omap3pandora.c2
-rw-r--r--sound/soc/omap/osk5912.c2
-rw-r--r--sound/soc/omap/overo.c2
-rw-r--r--sound/soc/omap/rx51.c2
-rw-r--r--sound/soc/omap/sdp3430.c3
-rw-r--r--sound/soc/omap/zoom2.c2
-rw-r--r--sound/soc/pxa/palm27x.c2
-rw-r--r--sound/soc/samsung/ac97.c2
-rw-r--r--sound/soc/samsung/i2s.c2
-rw-r--r--sound/soc/samsung/pcm.c2
-rw-r--r--sound/soc/samsung/s3c24xx_simtec.c2
-rw-r--r--sound/soc/samsung/spdif.c2
-rw-r--r--sound/soc/soc-core.c6
-rw-r--r--sound/soc/tegra/Kconfig2
-rw-r--r--sound/soc/tegra/tegra_pcm.c232
-rw-r--r--sound/soc/tegra/tegra_pcm.h14
-rw-r--r--sound/soc/ux500/mop500.c47
-rw-r--r--sound/soc/ux500/ux500_msp_dai.c6
-rw-r--r--sound/soc/ux500/ux500_msp_i2s.c89
-rw-r--r--sound/soc/ux500/ux500_msp_i2s.h8
52 files changed, 432 insertions, 367 deletions
diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c
index 53b5ada8f7c3..20554eff5a21 100644
--- a/sound/core/pcm_native.c
+++ b/sound/core/pcm_native.c
@@ -1563,25 +1563,25 @@ static int snd_pcm_drop(struct snd_pcm_substream *substream)
1563 1563
1564 1564
1565/* WARNING: Don't forget to fput back the file */ 1565/* WARNING: Don't forget to fput back the file */
1566static struct file *snd_pcm_file_fd(int fd) 1566static struct file *snd_pcm_file_fd(int fd, int *fput_needed)
1567{ 1567{
1568 struct file *file; 1568 struct file *file;
1569 struct inode *inode; 1569 struct inode *inode;
1570 unsigned int minor; 1570 unsigned int minor;
1571 1571
1572 file = fget(fd); 1572 file = fget_light(fd, fput_needed);
1573 if (!file) 1573 if (!file)
1574 return NULL; 1574 return NULL;
1575 inode = file->f_path.dentry->d_inode; 1575 inode = file->f_path.dentry->d_inode;
1576 if (!S_ISCHR(inode->i_mode) || 1576 if (!S_ISCHR(inode->i_mode) ||
1577 imajor(inode) != snd_major) { 1577 imajor(inode) != snd_major) {
1578 fput(file); 1578 fput_light(file, *fput_needed);
1579 return NULL; 1579 return NULL;
1580 } 1580 }
1581 minor = iminor(inode); 1581 minor = iminor(inode);
1582 if (!snd_lookup_minor_data(minor, SNDRV_DEVICE_TYPE_PCM_PLAYBACK) && 1582 if (!snd_lookup_minor_data(minor, SNDRV_DEVICE_TYPE_PCM_PLAYBACK) &&
1583 !snd_lookup_minor_data(minor, SNDRV_DEVICE_TYPE_PCM_CAPTURE)) { 1583 !snd_lookup_minor_data(minor, SNDRV_DEVICE_TYPE_PCM_CAPTURE)) {
1584 fput(file); 1584 fput_light(file, *fput_needed);
1585 return NULL; 1585 return NULL;
1586 } 1586 }
1587 return file; 1587 return file;
@@ -1597,8 +1597,9 @@ static int snd_pcm_link(struct snd_pcm_substream *substream, int fd)
1597 struct snd_pcm_file *pcm_file; 1597 struct snd_pcm_file *pcm_file;
1598 struct snd_pcm_substream *substream1; 1598 struct snd_pcm_substream *substream1;
1599 struct snd_pcm_group *group; 1599 struct snd_pcm_group *group;
1600 int fput_needed;
1600 1601
1601 file = snd_pcm_file_fd(fd); 1602 file = snd_pcm_file_fd(fd, &fput_needed);
1602 if (!file) 1603 if (!file)
1603 return -EBADFD; 1604 return -EBADFD;
1604 pcm_file = file->private_data; 1605 pcm_file = file->private_data;
@@ -1633,7 +1634,7 @@ static int snd_pcm_link(struct snd_pcm_substream *substream, int fd)
1633 write_unlock_irq(&snd_pcm_link_rwlock); 1634 write_unlock_irq(&snd_pcm_link_rwlock);
1634 up_write(&snd_pcm_link_rwsem); 1635 up_write(&snd_pcm_link_rwsem);
1635 _nolock: 1636 _nolock:
1636 fput(file); 1637 fput_light(file, fput_needed);
1637 if (res < 0) 1638 if (res < 0)
1638 kfree(group); 1639 kfree(group);
1639 return res; 1640 return res;
diff --git a/sound/i2c/other/ak4113.c b/sound/i2c/other/ak4113.c
index dde5c9c92132..ef68d710d08c 100644
--- a/sound/i2c/other/ak4113.c
+++ b/sound/i2c/other/ak4113.c
@@ -141,7 +141,7 @@ void snd_ak4113_reinit(struct ak4113 *chip)
141{ 141{
142 chip->init = 1; 142 chip->init = 1;
143 mb(); 143 mb();
144 flush_delayed_work_sync(&chip->work); 144 flush_delayed_work(&chip->work);
145 ak4113_init_regs(chip); 145 ak4113_init_regs(chip);
146 /* bring up statistics / event queing */ 146 /* bring up statistics / event queing */
147 chip->init = 0; 147 chip->init = 0;
diff --git a/sound/i2c/other/ak4114.c b/sound/i2c/other/ak4114.c
index fdf3c1b65e38..816e7d225fb0 100644
--- a/sound/i2c/other/ak4114.c
+++ b/sound/i2c/other/ak4114.c
@@ -154,7 +154,7 @@ void snd_ak4114_reinit(struct ak4114 *chip)
154{ 154{
155 chip->init = 1; 155 chip->init = 1;
156 mb(); 156 mb();
157 flush_delayed_work_sync(&chip->work); 157 flush_delayed_work(&chip->work);
158 ak4114_init_regs(chip); 158 ak4114_init_regs(chip);
159 /* bring up statistics / event queing */ 159 /* bring up statistics / event queing */
160 chip->init = 0; 160 chip->init = 0;
diff --git a/sound/i2c/other/tea575x-tuner.c b/sound/i2c/other/tea575x-tuner.c
index d14edb7d6484..3c6c1e3226f3 100644
--- a/sound/i2c/other/tea575x-tuner.c
+++ b/sound/i2c/other/tea575x-tuner.c
@@ -37,9 +37,6 @@ MODULE_AUTHOR("Jaroslav Kysela <perex@perex.cz>");
37MODULE_DESCRIPTION("Routines for control of TEA5757/5759 Philips AM/FM radio tuner chips"); 37MODULE_DESCRIPTION("Routines for control of TEA5757/5759 Philips AM/FM radio tuner chips");
38MODULE_LICENSE("GPL"); 38MODULE_LICENSE("GPL");
39 39
40#define FREQ_LO ((tea->tea5759 ? 760 : 875) * 1600U)
41#define FREQ_HI ((tea->tea5759 ? 910 : 1080) * 1600U)
42
43/* 40/*
44 * definitions 41 * definitions
45 */ 42 */
@@ -50,8 +47,8 @@ MODULE_LICENSE("GPL");
50#define TEA575X_BIT_BAND_MASK (3<<20) 47#define TEA575X_BIT_BAND_MASK (3<<20)
51#define TEA575X_BIT_BAND_FM (0<<20) 48#define TEA575X_BIT_BAND_FM (0<<20)
52#define TEA575X_BIT_BAND_MW (1<<20) 49#define TEA575X_BIT_BAND_MW (1<<20)
53#define TEA575X_BIT_BAND_LW (1<<21) 50#define TEA575X_BIT_BAND_LW (2<<20)
54#define TEA575X_BIT_BAND_SW (1<<22) 51#define TEA575X_BIT_BAND_SW (3<<20)
55#define TEA575X_BIT_PORT_0 (1<<19) /* user bit */ 52#define TEA575X_BIT_PORT_0 (1<<19) /* user bit */
56#define TEA575X_BIT_PORT_1 (1<<18) /* user bit */ 53#define TEA575X_BIT_PORT_1 (1<<18) /* user bit */
57#define TEA575X_BIT_SEARCH_MASK (3<<16) /* search level */ 54#define TEA575X_BIT_SEARCH_MASK (3<<16) /* search level */
@@ -62,6 +59,37 @@ MODULE_LICENSE("GPL");
62#define TEA575X_BIT_DUMMY (1<<15) /* buffer */ 59#define TEA575X_BIT_DUMMY (1<<15) /* buffer */
63#define TEA575X_BIT_FREQ_MASK 0x7fff 60#define TEA575X_BIT_FREQ_MASK 0x7fff
64 61
62enum { BAND_FM, BAND_FM_JAPAN, BAND_AM };
63
64static const struct v4l2_frequency_band bands[] = {
65 {
66 .type = V4L2_TUNER_RADIO,
67 .index = 0,
68 .capability = V4L2_TUNER_CAP_LOW | V4L2_TUNER_CAP_STEREO |
69 V4L2_TUNER_CAP_FREQ_BANDS,
70 .rangelow = 87500 * 16,
71 .rangehigh = 108000 * 16,
72 .modulation = V4L2_BAND_MODULATION_FM,
73 },
74 {
75 .type = V4L2_TUNER_RADIO,
76 .index = 0,
77 .capability = V4L2_TUNER_CAP_LOW | V4L2_TUNER_CAP_STEREO |
78 V4L2_TUNER_CAP_FREQ_BANDS,
79 .rangelow = 76000 * 16,
80 .rangehigh = 91000 * 16,
81 .modulation = V4L2_BAND_MODULATION_FM,
82 },
83 {
84 .type = V4L2_TUNER_RADIO,
85 .index = 1,
86 .capability = V4L2_TUNER_CAP_LOW | V4L2_TUNER_CAP_FREQ_BANDS,
87 .rangelow = 530 * 16,
88 .rangehigh = 1710 * 16,
89 .modulation = V4L2_BAND_MODULATION_AM,
90 },
91};
92
65/* 93/*
66 * lowlevel part 94 * lowlevel part
67 */ 95 */
@@ -133,16 +161,29 @@ static u32 snd_tea575x_val_to_freq(struct snd_tea575x *tea, u32 val)
133 if (freq == 0) 161 if (freq == 0)
134 return freq; 162 return freq;
135 163
136 /* freq *= 12.5 */ 164 switch (tea->band) {
137 freq *= 125; 165 case BAND_FM:
138 freq /= 10; 166 /* freq *= 12.5 */
139 /* crystal fixup */ 167 freq *= 125;
140 if (tea->tea5759) 168 freq /= 10;
141 freq += TEA575X_FMIF; 169 /* crystal fixup */
142 else
143 freq -= TEA575X_FMIF; 170 freq -= TEA575X_FMIF;
171 break;
172 case BAND_FM_JAPAN:
173 /* freq *= 12.5 */
174 freq *= 125;
175 freq /= 10;
176 /* crystal fixup */
177 freq += TEA575X_FMIF;
178 break;
179 case BAND_AM:
180 /* crystal fixup */
181 freq -= TEA575X_AMIF;
182 break;
183 }
144 184
145 return clamp(freq * 16, FREQ_LO, FREQ_HI); /* from kHz */ 185 return clamp(freq * 16, bands[tea->band].rangelow,
186 bands[tea->band].rangehigh); /* from kHz */
146} 187}
147 188
148static u32 snd_tea575x_get_freq(struct snd_tea575x *tea) 189static u32 snd_tea575x_get_freq(struct snd_tea575x *tea)
@@ -150,21 +191,37 @@ static u32 snd_tea575x_get_freq(struct snd_tea575x *tea)
150 return snd_tea575x_val_to_freq(tea, snd_tea575x_read(tea)); 191 return snd_tea575x_val_to_freq(tea, snd_tea575x_read(tea));
151} 192}
152 193
153static void snd_tea575x_set_freq(struct snd_tea575x *tea) 194void snd_tea575x_set_freq(struct snd_tea575x *tea)
154{ 195{
155 u32 freq = tea->freq; 196 u32 freq = tea->freq / 16; /* to kHz */
197 u32 band = 0;
156 198
157 freq /= 16; /* to kHz */ 199 switch (tea->band) {
158 /* crystal fixup */ 200 case BAND_FM:
159 if (tea->tea5759) 201 band = TEA575X_BIT_BAND_FM;
160 freq -= TEA575X_FMIF; 202 /* crystal fixup */
161 else
162 freq += TEA575X_FMIF; 203 freq += TEA575X_FMIF;
163 /* freq /= 12.5 */ 204 /* freq /= 12.5 */
164 freq *= 10; 205 freq *= 10;
165 freq /= 125; 206 freq /= 125;
207 break;
208 case BAND_FM_JAPAN:
209 band = TEA575X_BIT_BAND_FM;
210 /* crystal fixup */
211 freq -= TEA575X_FMIF;
212 /* freq /= 12.5 */
213 freq *= 10;
214 freq /= 125;
215 break;
216 case BAND_AM:
217 band = TEA575X_BIT_BAND_MW;
218 /* crystal fixup */
219 freq += TEA575X_AMIF;
220 break;
221 }
166 222
167 tea->val &= ~TEA575X_BIT_FREQ_MASK; 223 tea->val &= ~(TEA575X_BIT_FREQ_MASK | TEA575X_BIT_BAND_MASK);
224 tea->val |= band;
168 tea->val |= freq & TEA575X_BIT_FREQ_MASK; 225 tea->val |= freq & TEA575X_BIT_FREQ_MASK;
169 snd_tea575x_write(tea, tea->val); 226 snd_tea575x_write(tea, tea->val);
170 tea->freq = snd_tea575x_val_to_freq(tea, tea->val); 227 tea->freq = snd_tea575x_val_to_freq(tea, tea->val);
@@ -190,23 +247,57 @@ static int vidioc_querycap(struct file *file, void *priv,
190 return 0; 247 return 0;
191} 248}
192 249
250static int vidioc_enum_freq_bands(struct file *file, void *priv,
251 struct v4l2_frequency_band *band)
252{
253 struct snd_tea575x *tea = video_drvdata(file);
254 int index;
255
256 if (band->tuner != 0)
257 return -EINVAL;
258
259 switch (band->index) {
260 case 0:
261 if (tea->tea5759)
262 index = BAND_FM_JAPAN;
263 else
264 index = BAND_FM;
265 break;
266 case 1:
267 if (tea->has_am) {
268 index = BAND_AM;
269 break;
270 }
271 /* Fall through */
272 default:
273 return -EINVAL;
274 }
275
276 *band = bands[index];
277 if (!tea->cannot_read_data)
278 band->capability |= V4L2_TUNER_CAP_HWSEEK_BOUNDED;
279
280 return 0;
281}
282
193static int vidioc_g_tuner(struct file *file, void *priv, 283static int vidioc_g_tuner(struct file *file, void *priv,
194 struct v4l2_tuner *v) 284 struct v4l2_tuner *v)
195{ 285{
196 struct snd_tea575x *tea = video_drvdata(file); 286 struct snd_tea575x *tea = video_drvdata(file);
287 struct v4l2_frequency_band band_fm = { 0, };
197 288
198 if (v->index > 0) 289 if (v->index > 0)
199 return -EINVAL; 290 return -EINVAL;
200 291
201 snd_tea575x_read(tea); 292 snd_tea575x_read(tea);
293 vidioc_enum_freq_bands(file, priv, &band_fm);
202 294
203 strcpy(v->name, "FM"); 295 memset(v, 0, sizeof(*v));
296 strlcpy(v->name, tea->has_am ? "FM/AM" : "FM", sizeof(v->name));
204 v->type = V4L2_TUNER_RADIO; 297 v->type = V4L2_TUNER_RADIO;
205 v->capability = V4L2_TUNER_CAP_LOW | V4L2_TUNER_CAP_STEREO; 298 v->capability = band_fm.capability;
206 if (!tea->cannot_read_data) 299 v->rangelow = tea->has_am ? bands[BAND_AM].rangelow : band_fm.rangelow;
207 v->capability |= V4L2_TUNER_CAP_HWSEEK_BOUNDED; 300 v->rangehigh = band_fm.rangehigh;
208 v->rangelow = FREQ_LO;
209 v->rangehigh = FREQ_HI;
210 v->rxsubchans = tea->stereo ? V4L2_TUNER_SUB_STEREO : V4L2_TUNER_SUB_MONO; 301 v->rxsubchans = tea->stereo ? V4L2_TUNER_SUB_STEREO : V4L2_TUNER_SUB_MONO;
211 v->audmode = (tea->val & TEA575X_BIT_MONO) ? 302 v->audmode = (tea->val & TEA575X_BIT_MONO) ?
212 V4L2_TUNER_MODE_MONO : V4L2_TUNER_MODE_STEREO; 303 V4L2_TUNER_MODE_MONO : V4L2_TUNER_MODE_STEREO;
@@ -218,13 +309,17 @@ static int vidioc_s_tuner(struct file *file, void *priv,
218 struct v4l2_tuner *v) 309 struct v4l2_tuner *v)
219{ 310{
220 struct snd_tea575x *tea = video_drvdata(file); 311 struct snd_tea575x *tea = video_drvdata(file);
312 u32 orig_val = tea->val;
221 313
222 if (v->index) 314 if (v->index)
223 return -EINVAL; 315 return -EINVAL;
224 tea->val &= ~TEA575X_BIT_MONO; 316 tea->val &= ~TEA575X_BIT_MONO;
225 if (v->audmode == V4L2_TUNER_MODE_MONO) 317 if (v->audmode == V4L2_TUNER_MODE_MONO)
226 tea->val |= TEA575X_BIT_MONO; 318 tea->val |= TEA575X_BIT_MONO;
227 snd_tea575x_write(tea, tea->val); 319 /* Only apply changes if currently tuning FM */
320 if (tea->band != BAND_AM && tea->val != orig_val)
321 snd_tea575x_set_freq(tea);
322
228 return 0; 323 return 0;
229} 324}
230 325
@@ -248,24 +343,56 @@ static int vidioc_s_frequency(struct file *file, void *priv,
248 if (f->tuner != 0 || f->type != V4L2_TUNER_RADIO) 343 if (f->tuner != 0 || f->type != V4L2_TUNER_RADIO)
249 return -EINVAL; 344 return -EINVAL;
250 345
251 tea->val &= ~TEA575X_BIT_SEARCH; 346 if (tea->has_am && f->frequency < (20000 * 16))
252 tea->freq = clamp(f->frequency, FREQ_LO, FREQ_HI); 347 tea->band = BAND_AM;
348 else if (tea->tea5759)
349 tea->band = BAND_FM_JAPAN;
350 else
351 tea->band = BAND_FM;
352
353 tea->freq = clamp(f->frequency, bands[tea->band].rangelow,
354 bands[tea->band].rangehigh);
253 snd_tea575x_set_freq(tea); 355 snd_tea575x_set_freq(tea);
254 return 0; 356 return 0;
255} 357}
256 358
257static int vidioc_s_hw_freq_seek(struct file *file, void *fh, 359static int vidioc_s_hw_freq_seek(struct file *file, void *fh,
258 struct v4l2_hw_freq_seek *a) 360 const struct v4l2_hw_freq_seek *a)
259{ 361{
260 struct snd_tea575x *tea = video_drvdata(file); 362 struct snd_tea575x *tea = video_drvdata(file);
261 unsigned long timeout; 363 unsigned long timeout;
262 int i; 364 int i, spacing;
263 365
264 if (tea->cannot_read_data) 366 if (tea->cannot_read_data)
265 return -ENOTTY; 367 return -ENOTTY;
266 if (a->tuner || a->wrap_around) 368 if (a->tuner || a->wrap_around)
267 return -EINVAL; 369 return -EINVAL;
268 370
371 if (file->f_flags & O_NONBLOCK)
372 return -EWOULDBLOCK;
373
374 if (a->rangelow || a->rangehigh) {
375 for (i = 0; i < ARRAY_SIZE(bands); i++) {
376 if ((i == BAND_FM && tea->tea5759) ||
377 (i == BAND_FM_JAPAN && !tea->tea5759) ||
378 (i == BAND_AM && !tea->has_am))
379 continue;
380 if (bands[i].rangelow == a->rangelow &&
381 bands[i].rangehigh == a->rangehigh)
382 break;
383 }
384 if (i == ARRAY_SIZE(bands))
385 return -EINVAL; /* No matching band found */
386 if (i != tea->band) {
387 tea->band = i;
388 tea->freq = clamp(tea->freq, bands[i].rangelow,
389 bands[i].rangehigh);
390 snd_tea575x_set_freq(tea);
391 }
392 }
393
394 spacing = (tea->band == BAND_AM) ? 5 : 50; /* kHz */
395
269 /* clear the frequency, HW will fill it in */ 396 /* clear the frequency, HW will fill it in */
270 tea->val &= ~TEA575X_BIT_FREQ_MASK; 397 tea->val &= ~TEA575X_BIT_FREQ_MASK;
271 tea->val |= TEA575X_BIT_SEARCH; 398 tea->val |= TEA575X_BIT_SEARCH;
@@ -297,10 +424,10 @@ static int vidioc_s_hw_freq_seek(struct file *file, void *fh,
297 if (freq == 0) /* shouldn't happen */ 424 if (freq == 0) /* shouldn't happen */
298 break; 425 break;
299 /* 426 /*
300 * if we moved by less than 50 kHz, or in the wrong 427 * if we moved by less than the spacing, or in the
301 * direction, continue seeking 428 * wrong direction, continue seeking
302 */ 429 */
303 if (abs(tea->freq - freq) < 16 * 50 || 430 if (abs(tea->freq - freq) < 16 * spacing ||
304 (a->seek_upward && freq < tea->freq) || 431 (a->seek_upward && freq < tea->freq) ||
305 (!a->seek_upward && freq > tea->freq)) { 432 (!a->seek_upward && freq > tea->freq)) {
306 snd_tea575x_write(tea, tea->val); 433 snd_tea575x_write(tea, tea->val);
@@ -344,6 +471,7 @@ static const struct v4l2_ioctl_ops tea575x_ioctl_ops = {
344 .vidioc_g_frequency = vidioc_g_frequency, 471 .vidioc_g_frequency = vidioc_g_frequency,
345 .vidioc_s_frequency = vidioc_s_frequency, 472 .vidioc_s_frequency = vidioc_s_frequency,
346 .vidioc_s_hw_freq_seek = vidioc_s_hw_freq_seek, 473 .vidioc_s_hw_freq_seek = vidioc_s_hw_freq_seek,
474 .vidioc_enum_freq_bands = vidioc_enum_freq_bands,
347 .vidioc_log_status = v4l2_ctrl_log_status, 475 .vidioc_log_status = v4l2_ctrl_log_status,
348 .vidioc_subscribe_event = v4l2_ctrl_subscribe_event, 476 .vidioc_subscribe_event = v4l2_ctrl_subscribe_event,
349 .vidioc_unsubscribe_event = v4l2_event_unsubscribe, 477 .vidioc_unsubscribe_event = v4l2_event_unsubscribe,
@@ -446,3 +574,4 @@ module_exit(alsa_tea575x_module_exit)
446 574
447EXPORT_SYMBOL(snd_tea575x_init); 575EXPORT_SYMBOL(snd_tea575x_init);
448EXPORT_SYMBOL(snd_tea575x_exit); 576EXPORT_SYMBOL(snd_tea575x_exit);
577EXPORT_SYMBOL(snd_tea575x_set_freq);
diff --git a/sound/oss/.gitignore b/sound/oss/.gitignore
index 7efb12b45502..12a3920d6fb6 100644
--- a/sound/oss/.gitignore
+++ b/sound/oss/.gitignore
@@ -1,4 +1,3 @@
1#Ignore generated files 1#Ignore generated files
2maui_boot.h
3pss_boot.h 2pss_boot.h
4trix_boot.h 3trix_boot.h
diff --git a/sound/pci/Kconfig b/sound/pci/Kconfig
index ff3af6e77d61..f99fa2512286 100644
--- a/sound/pci/Kconfig
+++ b/sound/pci/Kconfig
@@ -2,8 +2,8 @@
2 2
3config SND_TEA575X 3config SND_TEA575X
4 tristate 4 tristate
5 depends on SND_FM801_TEA575X_BOOL || SND_ES1968_RADIO || RADIO_SF16FMR2 || RADIO_MAXIRADIO 5 depends on SND_FM801_TEA575X_BOOL || SND_ES1968_RADIO || RADIO_SF16FMR2 || RADIO_MAXIRADIO || RADIO_SHARK
6 default SND_FM801 || SND_ES1968 || RADIO_SF16FMR2 || RADIO_MAXIRADIO 6 default SND_FM801 || SND_ES1968 || RADIO_SF16FMR2 || RADIO_MAXIRADIO || RADIO_SHARK
7 7
8menuconfig SND_PCI 8menuconfig SND_PCI
9 bool "PCI sound devices" 9 bool "PCI sound devices"
diff --git a/sound/pci/oxygen/oxygen_lib.c b/sound/pci/oxygen/oxygen_lib.c
index ab8738e21ad1..e9fa2d07951d 100644
--- a/sound/pci/oxygen/oxygen_lib.c
+++ b/sound/pci/oxygen/oxygen_lib.c
@@ -573,8 +573,8 @@ static void oxygen_card_free(struct snd_card *card)
573 oxygen_shutdown(chip); 573 oxygen_shutdown(chip);
574 if (chip->irq >= 0) 574 if (chip->irq >= 0)
575 free_irq(chip->irq, chip); 575 free_irq(chip->irq, chip);
576 flush_work_sync(&chip->spdif_input_bits_work); 576 flush_work(&chip->spdif_input_bits_work);
577 flush_work_sync(&chip->gpio_work); 577 flush_work(&chip->gpio_work);
578 chip->model.cleanup(chip); 578 chip->model.cleanup(chip);
579 kfree(chip->model_data); 579 kfree(chip->model_data);
580 mutex_destroy(&chip->mutex); 580 mutex_destroy(&chip->mutex);
@@ -751,8 +751,8 @@ static int oxygen_pci_suspend(struct device *dev)
751 spin_unlock_irq(&chip->reg_lock); 751 spin_unlock_irq(&chip->reg_lock);
752 752
753 synchronize_irq(chip->irq); 753 synchronize_irq(chip->irq);
754 flush_work_sync(&chip->spdif_input_bits_work); 754 flush_work(&chip->spdif_input_bits_work);
755 flush_work_sync(&chip->gpio_work); 755 flush_work(&chip->gpio_work);
756 chip->interrupt_mask = saved_interrupt_mask; 756 chip->interrupt_mask = saved_interrupt_mask;
757 757
758 pci_disable_device(pci); 758 pci_disable_device(pci);
diff --git a/sound/soc/codecs/ab8500-codec.c b/sound/soc/codecs/ab8500-codec.c
index 23b40186f9b8..07abd09e0b1d 100644
--- a/sound/soc/codecs/ab8500-codec.c
+++ b/sound/soc/codecs/ab8500-codec.c
@@ -34,6 +34,7 @@
34#include <linux/mfd/abx500/ab8500-sysctrl.h> 34#include <linux/mfd/abx500/ab8500-sysctrl.h>
35#include <linux/mfd/abx500/ab8500-codec.h> 35#include <linux/mfd/abx500/ab8500-codec.h>
36#include <linux/regulator/consumer.h> 36#include <linux/regulator/consumer.h>
37#include <linux/of.h>
37 38
38#include <sound/core.h> 39#include <sound/core.h>
39#include <sound/pcm.h> 40#include <sound/pcm.h>
@@ -2394,9 +2395,65 @@ struct snd_soc_dai_driver ab8500_codec_dai[] = {
2394 } 2395 }
2395}; 2396};
2396 2397
2398static void ab8500_codec_of_probe(struct device *dev, struct device_node *np,
2399 struct ab8500_codec_platform_data *codec)
2400{
2401 u32 value;
2402
2403 if (of_get_property(np, "stericsson,amic1-type-single-ended", NULL))
2404 codec->amics.mic1_type = AMIC_TYPE_SINGLE_ENDED;
2405 else
2406 codec->amics.mic1_type = AMIC_TYPE_DIFFERENTIAL;
2407
2408 if (of_get_property(np, "stericsson,amic2-type-single-ended", NULL))
2409 codec->amics.mic2_type = AMIC_TYPE_SINGLE_ENDED;
2410 else
2411 codec->amics.mic2_type = AMIC_TYPE_DIFFERENTIAL;
2412
2413 /* Has a non-standard Vamic been requested? */
2414 if (of_get_property(np, "stericsson,amic1a-bias-vamic2", NULL))
2415 codec->amics.mic1a_micbias = AMIC_MICBIAS_VAMIC2;
2416 else
2417 codec->amics.mic1a_micbias = AMIC_MICBIAS_VAMIC1;
2418
2419 if (of_get_property(np, "stericsson,amic1b-bias-vamic2", NULL))
2420 codec->amics.mic1b_micbias = AMIC_MICBIAS_VAMIC2;
2421 else
2422 codec->amics.mic1b_micbias = AMIC_MICBIAS_VAMIC1;
2423
2424 if (of_get_property(np, "stericsson,amic2-bias-vamic1", NULL))
2425 codec->amics.mic2_micbias = AMIC_MICBIAS_VAMIC1;
2426 else
2427 codec->amics.mic2_micbias = AMIC_MICBIAS_VAMIC2;
2428
2429 if (!of_property_read_u32(np, "stericsson,earpeice-cmv", &value)) {
2430 switch (value) {
2431 case 950 :
2432 codec->ear_cmv = EAR_CMV_0_95V;
2433 break;
2434 case 1100 :
2435 codec->ear_cmv = EAR_CMV_1_10V;
2436 break;
2437 case 1270 :
2438 codec->ear_cmv = EAR_CMV_1_27V;
2439 break;
2440 case 1580 :
2441 codec->ear_cmv = EAR_CMV_1_58V;
2442 break;
2443 default :
2444 codec->ear_cmv = EAR_CMV_UNKNOWN;
2445 dev_err(dev, "Unsuitable earpiece voltage found in DT\n");
2446 }
2447 } else {
2448 dev_warn(dev, "No earpiece voltage found in DT - using default\n");
2449 codec->ear_cmv = EAR_CMV_0_95V;
2450 }
2451}
2452
2397static int ab8500_codec_probe(struct snd_soc_codec *codec) 2453static int ab8500_codec_probe(struct snd_soc_codec *codec)
2398{ 2454{
2399 struct device *dev = codec->dev; 2455 struct device *dev = codec->dev;
2456 struct device_node *np = dev->of_node;
2400 struct ab8500_codec_drvdata *drvdata = dev_get_drvdata(dev); 2457 struct ab8500_codec_drvdata *drvdata = dev_get_drvdata(dev);
2401 struct ab8500_platform_data *pdata; 2458 struct ab8500_platform_data *pdata;
2402 struct filter_control *fc; 2459 struct filter_control *fc;
@@ -2410,6 +2467,30 @@ static int ab8500_codec_probe(struct snd_soc_codec *codec)
2410 /* Inform SoC Core that we have our own I/O arrangements. */ 2467 /* Inform SoC Core that we have our own I/O arrangements. */
2411 codec->control_data = (void *)true; 2468 codec->control_data = (void *)true;
2412 2469
2470 if (np) {
2471 if (!pdata)
2472 pdata = devm_kzalloc(dev,
2473 sizeof(struct ab8500_platform_data),
2474 GFP_KERNEL);
2475
2476 if (pdata && !pdata->codec)
2477 pdata->codec
2478 = devm_kzalloc(dev,
2479 sizeof(struct ab8500_codec_platform_data),
2480 GFP_KERNEL);
2481
2482 if (!(pdata && pdata->codec))
2483 return -ENOMEM;
2484
2485 ab8500_codec_of_probe(dev, np, pdata->codec);
2486
2487 } else {
2488 if (!(pdata && pdata->codec)) {
2489 dev_err(dev, "No codec platform data or DT found\n");
2490 return -EINVAL;
2491 }
2492 }
2493
2413 status = ab8500_audio_setup_mics(codec, &pdata->codec->amics); 2494 status = ab8500_audio_setup_mics(codec, &pdata->codec->amics);
2414 if (status < 0) { 2495 if (status < 0) {
2415 pr_err("%s: Failed to setup mics (%d)!\n", __func__, status); 2496 pr_err("%s: Failed to setup mics (%d)!\n", __func__, status);
diff --git a/sound/soc/codecs/wm5100.c b/sound/soc/codecs/wm5100.c
index f4817292ef45..aa62c0e44cb6 100644
--- a/sound/soc/codecs/wm5100.c
+++ b/sound/soc/codecs/wm5100.c
@@ -1233,7 +1233,7 @@ static const struct snd_soc_dapm_route wm5100_dapm_routes[] = {
1233 { "PWM2", NULL, "PWM2 Driver" }, 1233 { "PWM2", NULL, "PWM2 Driver" },
1234}; 1234};
1235 1235
1236static const __devinitdata struct reg_default wm5100_reva_patches[] = { 1236static const __devinitconst struct reg_default wm5100_reva_patches[] = {
1237 { WM5100_AUDIO_IF_1_10, 0 }, 1237 { WM5100_AUDIO_IF_1_10, 0 },
1238 { WM5100_AUDIO_IF_1_11, 1 }, 1238 { WM5100_AUDIO_IF_1_11, 1 },
1239 { WM5100_AUDIO_IF_1_12, 2 }, 1239 { WM5100_AUDIO_IF_1_12, 2 },
diff --git a/sound/soc/codecs/wm8350.c b/sound/soc/codecs/wm8350.c
index d26c8ae4e6d9..a4cae060bf26 100644
--- a/sound/soc/codecs/wm8350.c
+++ b/sound/soc/codecs/wm8350.c
@@ -1601,7 +1601,7 @@ static int wm8350_codec_remove(struct snd_soc_codec *codec)
1601 1601
1602 /* if there was any work waiting then we run it now and 1602 /* if there was any work waiting then we run it now and
1603 * wait for its completion */ 1603 * wait for its completion */
1604 flush_delayed_work_sync(&codec->dapm.delayed_work); 1604 flush_delayed_work(&codec->dapm.delayed_work);
1605 1605
1606 wm8350_set_bias_level(codec, SND_SOC_BIAS_OFF); 1606 wm8350_set_bias_level(codec, SND_SOC_BIAS_OFF);
1607 1607
diff --git a/sound/soc/codecs/wm8753.c b/sound/soc/codecs/wm8753.c
index 13bff87ddcf5..2e4a775ae560 100644
--- a/sound/soc/codecs/wm8753.c
+++ b/sound/soc/codecs/wm8753.c
@@ -1509,7 +1509,7 @@ static int wm8753_probe(struct snd_soc_codec *codec)
1509/* power down chip */ 1509/* power down chip */
1510static int wm8753_remove(struct snd_soc_codec *codec) 1510static int wm8753_remove(struct snd_soc_codec *codec)
1511{ 1511{
1512 flush_delayed_work_sync(&codec->dapm.delayed_work); 1512 flush_delayed_work(&codec->dapm.delayed_work);
1513 wm8753_set_bias_level(codec, SND_SOC_BIAS_OFF); 1513 wm8753_set_bias_level(codec, SND_SOC_BIAS_OFF);
1514 1514
1515 return 0; 1515 return 0;
diff --git a/sound/soc/ep93xx/ep93xx-ac97.c b/sound/soc/ep93xx/ep93xx-ac97.c
index bdffab33e160..c3521653cfd3 100644
--- a/sound/soc/ep93xx/ep93xx-ac97.c
+++ b/sound/soc/ep93xx/ep93xx-ac97.c
@@ -21,7 +21,7 @@
21#include <sound/ac97_codec.h> 21#include <sound/ac97_codec.h>
22#include <sound/soc.h> 22#include <sound/soc.h>
23 23
24#include <mach/dma.h> 24#include <linux/platform_data/dma-ep93xx.h>
25#include "ep93xx-pcm.h" 25#include "ep93xx-pcm.h"
26 26
27/* 27/*
diff --git a/sound/soc/ep93xx/ep93xx-i2s.c b/sound/soc/ep93xx/ep93xx-i2s.c
index 8df8f6dc474f..ac4a7515e7be 100644
--- a/sound/soc/ep93xx/ep93xx-i2s.c
+++ b/sound/soc/ep93xx/ep93xx-i2s.c
@@ -28,7 +28,7 @@
28 28
29#include <mach/hardware.h> 29#include <mach/hardware.h>
30#include <mach/ep93xx-regs.h> 30#include <mach/ep93xx-regs.h>
31#include <mach/dma.h> 31#include <linux/platform_data/dma-ep93xx.h>
32 32
33#include "ep93xx-pcm.h" 33#include "ep93xx-pcm.h"
34 34
diff --git a/sound/soc/ep93xx/ep93xx-pcm.c b/sound/soc/ep93xx/ep93xx-pcm.c
index 4eea98b42bc8..665d9c94cc17 100644
--- a/sound/soc/ep93xx/ep93xx-pcm.c
+++ b/sound/soc/ep93xx/ep93xx-pcm.c
@@ -25,7 +25,7 @@
25#include <sound/soc.h> 25#include <sound/soc.h>
26#include <sound/dmaengine_pcm.h> 26#include <sound/dmaengine_pcm.h>
27 27
28#include <mach/dma.h> 28#include <linux/platform_data/dma-ep93xx.h>
29#include <mach/hardware.h> 29#include <mach/hardware.h>
30#include <mach/ep93xx-regs.h> 30#include <mach/ep93xx-regs.h>
31 31
diff --git a/sound/soc/fsl/imx-pcm-dma.c b/sound/soc/fsl/imx-pcm-dma.c
index 48f9d886f020..89a7755b6f56 100644
--- a/sound/soc/fsl/imx-pcm-dma.c
+++ b/sound/soc/fsl/imx-pcm-dma.c
@@ -30,7 +30,7 @@
30#include <sound/soc.h> 30#include <sound/soc.h>
31#include <sound/dmaengine_pcm.h> 31#include <sound/dmaengine_pcm.h>
32 32
33#include <mach/dma.h> 33#include <linux/platform_data/dma-imx.h>
34 34
35#include "imx-pcm.h" 35#include "imx-pcm.h"
36 36
diff --git a/sound/soc/fsl/imx-pcm-fiq.c b/sound/soc/fsl/imx-pcm-fiq.c
index ee27ba3933bd..22c6130957ba 100644
--- a/sound/soc/fsl/imx-pcm-fiq.c
+++ b/sound/soc/fsl/imx-pcm-fiq.c
@@ -30,7 +30,7 @@
30#include <asm/fiq.h> 30#include <asm/fiq.h>
31 31
32#include <mach/irqs.h> 32#include <mach/irqs.h>
33#include <mach/ssi.h> 33#include <linux/platform_data/asoc-imx-ssi.h>
34 34
35#include "imx-ssi.h" 35#include "imx-ssi.h"
36 36
diff --git a/sound/soc/fsl/imx-ssi.c b/sound/soc/fsl/imx-ssi.c
index 81d7728cf67f..e6a17baca1ee 100644
--- a/sound/soc/fsl/imx-ssi.c
+++ b/sound/soc/fsl/imx-ssi.c
@@ -47,7 +47,7 @@
47#include <sound/pcm_params.h> 47#include <sound/pcm_params.h>
48#include <sound/soc.h> 48#include <sound/soc.h>
49 49
50#include <mach/ssi.h> 50#include <linux/platform_data/asoc-imx-ssi.h>
51#include <mach/hardware.h> 51#include <mach/hardware.h>
52 52
53#include "imx-ssi.h" 53#include "imx-ssi.h"
diff --git a/sound/soc/fsl/imx-ssi.h b/sound/soc/fsl/imx-ssi.h
index 5744e86ca878..dc114bdedce5 100644
--- a/sound/soc/fsl/imx-ssi.h
+++ b/sound/soc/fsl/imx-ssi.h
@@ -186,7 +186,7 @@
186#define DRV_NAME "imx-ssi" 186#define DRV_NAME "imx-ssi"
187 187
188#include <linux/dmaengine.h> 188#include <linux/dmaengine.h>
189#include <mach/dma.h> 189#include <linux/platform_data/dma-imx.h>
190#include "imx-pcm.h" 190#include "imx-pcm.h"
191 191
192struct imx_ssi { 192struct imx_ssi {
diff --git a/sound/soc/kirkwood/kirkwood-i2s.c b/sound/soc/kirkwood/kirkwood-i2s.c
index 7646dd7f30cb..542538d10ab7 100644
--- a/sound/soc/kirkwood/kirkwood-i2s.c
+++ b/sound/soc/kirkwood/kirkwood-i2s.c
@@ -21,7 +21,7 @@
21#include <sound/pcm.h> 21#include <sound/pcm.h>
22#include <sound/pcm_params.h> 22#include <sound/pcm_params.h>
23#include <sound/soc.h> 23#include <sound/soc.h>
24#include <plat/audio.h> 24#include <linux/platform_data/asoc-kirkwood.h>
25#include "kirkwood.h" 25#include "kirkwood.h"
26 26
27#define DRV_NAME "kirkwood-i2s" 27#define DRV_NAME "kirkwood-i2s"
diff --git a/sound/soc/kirkwood/kirkwood-openrd.c b/sound/soc/kirkwood/kirkwood-openrd.c
index 80bd59c33be4..c28540aeea25 100644
--- a/sound/soc/kirkwood/kirkwood-openrd.c
+++ b/sound/soc/kirkwood/kirkwood-openrd.c
@@ -17,7 +17,7 @@
17#include <linux/slab.h> 17#include <linux/slab.h>
18#include <sound/soc.h> 18#include <sound/soc.h>
19#include <mach/kirkwood.h> 19#include <mach/kirkwood.h>
20#include <plat/audio.h> 20#include <linux/platform_data/asoc-kirkwood.h>
21#include <asm/mach-types.h> 21#include <asm/mach-types.h>
22#include "../codecs/cs42l51.h" 22#include "../codecs/cs42l51.h"
23 23
diff --git a/sound/soc/kirkwood/kirkwood-t5325.c b/sound/soc/kirkwood/kirkwood-t5325.c
index f8983635f7ef..c67bbc574987 100644
--- a/sound/soc/kirkwood/kirkwood-t5325.c
+++ b/sound/soc/kirkwood/kirkwood-t5325.c
@@ -16,7 +16,7 @@
16#include <linux/slab.h> 16#include <linux/slab.h>
17#include <sound/soc.h> 17#include <sound/soc.h>
18#include <mach/kirkwood.h> 18#include <mach/kirkwood.h>
19#include <plat/audio.h> 19#include <linux/platform_data/asoc-kirkwood.h>
20#include <asm/mach-types.h> 20#include <asm/mach-types.h>
21#include "../codecs/alc5623.h" 21#include "../codecs/alc5623.h"
22 22
diff --git a/sound/soc/omap/am3517evm.c b/sound/soc/omap/am3517evm.c
index df65f98211ec..a52e87d28b6e 100644
--- a/sound/soc/omap/am3517evm.c
+++ b/sound/soc/omap/am3517evm.c
@@ -27,7 +27,7 @@
27#include <asm/mach-types.h> 27#include <asm/mach-types.h>
28#include <mach/hardware.h> 28#include <mach/hardware.h>
29#include <mach/gpio.h> 29#include <mach/gpio.h>
30#include <plat/mcbsp.h> 30#include <linux/platform_data/asoc-ti-mcbsp.h>
31 31
32#include "omap-mcbsp.h" 32#include "omap-mcbsp.h"
33#include "omap-pcm.h" 33#include "omap-pcm.h"
diff --git a/sound/soc/omap/ams-delta.c b/sound/soc/omap/ams-delta.c
index 7d4fa8ed6699..dc0ee7626626 100644
--- a/sound/soc/omap/ams-delta.c
+++ b/sound/soc/omap/ams-delta.c
@@ -32,8 +32,8 @@
32 32
33#include <asm/mach-types.h> 33#include <asm/mach-types.h>
34 34
35#include <plat/board-ams-delta.h> 35#include <mach/board-ams-delta.h>
36#include <plat/mcbsp.h> 36#include <linux/platform_data/asoc-ti-mcbsp.h>
37 37
38#include "omap-mcbsp.h" 38#include "omap-mcbsp.h"
39#include "omap-pcm.h" 39#include "omap-pcm.h"
diff --git a/sound/soc/omap/igep0020.c b/sound/soc/omap/igep0020.c
index e8357819175b..5ed871676ed0 100644
--- a/sound/soc/omap/igep0020.c
+++ b/sound/soc/omap/igep0020.c
@@ -29,7 +29,7 @@
29#include <asm/mach-types.h> 29#include <asm/mach-types.h>
30#include <mach/hardware.h> 30#include <mach/hardware.h>
31#include <mach/gpio.h> 31#include <mach/gpio.h>
32#include <plat/mcbsp.h> 32#include <linux/platform_data/asoc-ti-mcbsp.h>
33 33
34#include "omap-mcbsp.h" 34#include "omap-mcbsp.h"
35#include "omap-pcm.h" 35#include "omap-pcm.h"
diff --git a/sound/soc/omap/mcbsp.c b/sound/soc/omap/mcbsp.c
index d33c48baaf71..a681a9a8b846 100644
--- a/sound/soc/omap/mcbsp.c
+++ b/sound/soc/omap/mcbsp.c
@@ -25,7 +25,9 @@
25#include <linux/io.h> 25#include <linux/io.h>
26#include <linux/slab.h> 26#include <linux/slab.h>
27 27
28#include <plat/mcbsp.h> 28#include <linux/platform_data/asoc-ti-mcbsp.h>
29
30#include <plat/cpu.h>
29 31
30#include "mcbsp.h" 32#include "mcbsp.h"
31 33
diff --git a/sound/soc/omap/n810.c b/sound/soc/omap/n810.c
index abac4b690750..521bfc3d2b2b 100644
--- a/sound/soc/omap/n810.c
+++ b/sound/soc/omap/n810.c
@@ -32,7 +32,7 @@
32#include <mach/hardware.h> 32#include <mach/hardware.h>
33#include <linux/gpio.h> 33#include <linux/gpio.h>
34#include <linux/module.h> 34#include <linux/module.h>
35#include <plat/mcbsp.h> 35#include <linux/platform_data/asoc-ti-mcbsp.h>
36 36
37#include "omap-mcbsp.h" 37#include "omap-mcbsp.h"
38#include "omap-pcm.h" 38#include "omap-pcm.h"
diff --git a/sound/soc/omap/omap-abe-twl6040.c b/sound/soc/omap/omap-abe-twl6040.c
index 9d93793d3077..45909ca889fa 100644
--- a/sound/soc/omap/omap-abe-twl6040.c
+++ b/sound/soc/omap/omap-abe-twl6040.c
@@ -31,10 +31,6 @@
31#include <sound/soc.h> 31#include <sound/soc.h>
32#include <sound/jack.h> 32#include <sound/jack.h>
33 33
34#include <asm/mach-types.h>
35#include <plat/hardware.h>
36#include <plat/mux.h>
37
38#include "omap-dmic.h" 34#include "omap-dmic.h"
39#include "omap-mcpdm.h" 35#include "omap-mcpdm.h"
40#include "omap-pcm.h" 36#include "omap-pcm.h"
diff --git a/sound/soc/omap/omap-mcbsp.c b/sound/soc/omap/omap-mcbsp.c
index acdd3ef14e08..1b18627763ce 100644
--- a/sound/soc/omap/omap-mcbsp.c
+++ b/sound/soc/omap/omap-mcbsp.c
@@ -32,8 +32,9 @@
32#include <sound/initval.h> 32#include <sound/initval.h>
33#include <sound/soc.h> 33#include <sound/soc.h>
34 34
35#include <plat/cpu.h>
35#include <plat/dma.h> 36#include <plat/dma.h>
36#include <plat/mcbsp.h> 37#include <linux/platform_data/asoc-ti-mcbsp.h>
37#include "mcbsp.h" 38#include "mcbsp.h"
38#include "omap-mcbsp.h" 39#include "omap-mcbsp.h"
39#include "omap-pcm.h" 40#include "omap-pcm.h"
diff --git a/sound/soc/omap/omap-mcpdm.c b/sound/soc/omap/omap-mcpdm.c
index 2c66e2498a45..ea053c3d2ab1 100644
--- a/sound/soc/omap/omap-mcpdm.c
+++ b/sound/soc/omap/omap-mcpdm.c
@@ -45,6 +45,8 @@
45#include "omap-mcpdm.h" 45#include "omap-mcpdm.h"
46#include "omap-pcm.h" 46#include "omap-pcm.h"
47 47
48#define OMAP44XX_MCPDM_L3_BASE 0x49032000
49
48struct omap_mcpdm { 50struct omap_mcpdm {
49 struct device *dev; 51 struct device *dev;
50 unsigned long phys_base; 52 unsigned long phys_base;
diff --git a/sound/soc/omap/omap-pcm.c b/sound/soc/omap/omap-pcm.c
index f0feb06615f8..b30994179885 100644
--- a/sound/soc/omap/omap-pcm.c
+++ b/sound/soc/omap/omap-pcm.c
@@ -30,6 +30,7 @@
30#include <sound/pcm_params.h> 30#include <sound/pcm_params.h>
31#include <sound/soc.h> 31#include <sound/soc.h>
32 32
33#include <plat/cpu.h>
33#include <plat/dma.h> 34#include <plat/dma.h>
34#include "omap-pcm.h" 35#include "omap-pcm.h"
35 36
diff --git a/sound/soc/omap/omap3beagle.c b/sound/soc/omap/omap3beagle.c
index 2830dfd05661..e263188841b6 100644
--- a/sound/soc/omap/omap3beagle.c
+++ b/sound/soc/omap/omap3beagle.c
@@ -29,7 +29,7 @@
29#include <asm/mach-types.h> 29#include <asm/mach-types.h>
30#include <mach/hardware.h> 30#include <mach/hardware.h>
31#include <mach/gpio.h> 31#include <mach/gpio.h>
32#include <plat/mcbsp.h> 32#include <linux/platform_data/asoc-ti-mcbsp.h>
33 33
34#include "omap-mcbsp.h" 34#include "omap-mcbsp.h"
35#include "omap-pcm.h" 35#include "omap-pcm.h"
diff --git a/sound/soc/omap/omap3evm.c b/sound/soc/omap/omap3evm.c
index 3d468c9179d7..d632bfbb6983 100644
--- a/sound/soc/omap/omap3evm.c
+++ b/sound/soc/omap/omap3evm.c
@@ -27,7 +27,7 @@
27#include <asm/mach-types.h> 27#include <asm/mach-types.h>
28#include <mach/hardware.h> 28#include <mach/hardware.h>
29#include <mach/gpio.h> 29#include <mach/gpio.h>
30#include <plat/mcbsp.h> 30#include <linux/platform_data/asoc-ti-mcbsp.h>
31 31
32#include "omap-mcbsp.h" 32#include "omap-mcbsp.h"
33#include "omap-pcm.h" 33#include "omap-pcm.h"
diff --git a/sound/soc/omap/omap3pandora.c b/sound/soc/omap/omap3pandora.c
index 4c3a0978578a..43d950a79ff9 100644
--- a/sound/soc/omap/omap3pandora.c
+++ b/sound/soc/omap/omap3pandora.c
@@ -31,7 +31,7 @@
31#include <sound/soc.h> 31#include <sound/soc.h>
32 32
33#include <asm/mach-types.h> 33#include <asm/mach-types.h>
34#include <plat/mcbsp.h> 34#include <linux/platform_data/asoc-ti-mcbsp.h>
35 35
36#include "omap-mcbsp.h" 36#include "omap-mcbsp.h"
37#include "omap-pcm.h" 37#include "omap-pcm.h"
diff --git a/sound/soc/omap/osk5912.c b/sound/soc/omap/osk5912.c
index b1a9d64cbc56..3960e8df9c76 100644
--- a/sound/soc/omap/osk5912.c
+++ b/sound/soc/omap/osk5912.c
@@ -31,7 +31,7 @@
31#include <mach/hardware.h> 31#include <mach/hardware.h>
32#include <linux/gpio.h> 32#include <linux/gpio.h>
33#include <linux/module.h> 33#include <linux/module.h>
34#include <plat/mcbsp.h> 34#include <linux/platform_data/asoc-ti-mcbsp.h>
35 35
36#include "omap-mcbsp.h" 36#include "omap-mcbsp.h"
37#include "omap-pcm.h" 37#include "omap-pcm.h"
diff --git a/sound/soc/omap/overo.c b/sound/soc/omap/overo.c
index 6ac3e0c3c282..502bce299885 100644
--- a/sound/soc/omap/overo.c
+++ b/sound/soc/omap/overo.c
@@ -29,7 +29,7 @@
29#include <asm/mach-types.h> 29#include <asm/mach-types.h>
30#include <mach/hardware.h> 30#include <mach/hardware.h>
31#include <mach/gpio.h> 31#include <mach/gpio.h>
32#include <plat/mcbsp.h> 32#include <linux/platform_data/asoc-ti-mcbsp.h>
33 33
34#include "omap-mcbsp.h" 34#include "omap-mcbsp.h"
35#include "omap-pcm.h" 35#include "omap-pcm.h"
diff --git a/sound/soc/omap/rx51.c b/sound/soc/omap/rx51.c
index 2712dd232b6d..d921ddbe3ecb 100644
--- a/sound/soc/omap/rx51.c
+++ b/sound/soc/omap/rx51.c
@@ -31,7 +31,7 @@
31#include <sound/jack.h> 31#include <sound/jack.h>
32#include <sound/pcm.h> 32#include <sound/pcm.h>
33#include <sound/soc.h> 33#include <sound/soc.h>
34#include <plat/mcbsp.h> 34#include <linux/platform_data/asoc-ti-mcbsp.h>
35#include "../codecs/tpa6130a2.h" 35#include "../codecs/tpa6130a2.h"
36 36
37#include <asm/mach-types.h> 37#include <asm/mach-types.h>
diff --git a/sound/soc/omap/sdp3430.c b/sound/soc/omap/sdp3430.c
index 0e283226e2bf..597cae769cea 100644
--- a/sound/soc/omap/sdp3430.c
+++ b/sound/soc/omap/sdp3430.c
@@ -33,7 +33,8 @@
33#include <asm/mach-types.h> 33#include <asm/mach-types.h>
34#include <mach/hardware.h> 34#include <mach/hardware.h>
35#include <mach/gpio.h> 35#include <mach/gpio.h>
36#include <plat/mcbsp.h> 36#include <linux/platform_data/gpio-omap.h>
37#include <linux/platform_data/asoc-ti-mcbsp.h>
37 38
38/* Register descriptions for twl4030 codec part */ 39/* Register descriptions for twl4030 codec part */
39#include <linux/mfd/twl4030-audio.h> 40#include <linux/mfd/twl4030-audio.h>
diff --git a/sound/soc/omap/zoom2.c b/sound/soc/omap/zoom2.c
index 920e0d9e03db..23de2b21d696 100644
--- a/sound/soc/omap/zoom2.c
+++ b/sound/soc/omap/zoom2.c
@@ -29,7 +29,7 @@
29#include <mach/hardware.h> 29#include <mach/hardware.h>
30#include <mach/gpio.h> 30#include <mach/gpio.h>
31#include <mach/board-zoom.h> 31#include <mach/board-zoom.h>
32#include <plat/mcbsp.h> 32#include <linux/platform_data/asoc-ti-mcbsp.h>
33 33
34/* Register descriptions for twl4030 codec part */ 34/* Register descriptions for twl4030 codec part */
35#include <linux/mfd/twl4030-audio.h> 35#include <linux/mfd/twl4030-audio.h>
diff --git a/sound/soc/pxa/palm27x.c b/sound/soc/pxa/palm27x.c
index db24bc685bd3..aa3da91907c6 100644
--- a/sound/soc/pxa/palm27x.c
+++ b/sound/soc/pxa/palm27x.c
@@ -25,7 +25,7 @@
25 25
26#include <asm/mach-types.h> 26#include <asm/mach-types.h>
27#include <mach/audio.h> 27#include <mach/audio.h>
28#include <mach/palmasoc.h> 28#include <linux/platform_data/asoc-palm27x.h>
29 29
30#include "../codecs/wm9712.h" 30#include "../codecs/wm9712.h"
31#include "pxa2xx-ac97.h" 31#include "pxa2xx-ac97.h"
diff --git a/sound/soc/samsung/ac97.c b/sound/soc/samsung/ac97.c
index 3d04c1fa6781..14fbcd30cae5 100644
--- a/sound/soc/samsung/ac97.c
+++ b/sound/soc/samsung/ac97.c
@@ -21,7 +21,7 @@
21 21
22#include <mach/dma.h> 22#include <mach/dma.h>
23#include <plat/regs-ac97.h> 23#include <plat/regs-ac97.h>
24#include <plat/audio.h> 24#include <linux/platform_data/asoc-s3c.h>
25 25
26#include "dma.h" 26#include "dma.h"
27 27
diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c
index 6ac7b8281a02..40b00a13dcd1 100644
--- a/sound/soc/samsung/i2s.c
+++ b/sound/soc/samsung/i2s.c
@@ -20,7 +20,7 @@
20#include <sound/soc.h> 20#include <sound/soc.h>
21#include <sound/pcm_params.h> 21#include <sound/pcm_params.h>
22 22
23#include <plat/audio.h> 23#include <linux/platform_data/asoc-s3c.h>
24 24
25#include "dma.h" 25#include "dma.h"
26#include "idma.h" 26#include "idma.h"
diff --git a/sound/soc/samsung/pcm.c b/sound/soc/samsung/pcm.c
index 89b064650f14..c86081992dfd 100644
--- a/sound/soc/samsung/pcm.c
+++ b/sound/soc/samsung/pcm.c
@@ -19,7 +19,7 @@
19#include <sound/soc.h> 19#include <sound/soc.h>
20#include <sound/pcm_params.h> 20#include <sound/pcm_params.h>
21 21
22#include <plat/audio.h> 22#include <linux/platform_data/asoc-s3c.h>
23#include <mach/dma.h> 23#include <mach/dma.h>
24 24
25#include "dma.h" 25#include "dma.h"
diff --git a/sound/soc/samsung/s3c24xx_simtec.c b/sound/soc/samsung/s3c24xx_simtec.c
index 656d5afe4ca9..335a7d8a4a8d 100644
--- a/sound/soc/samsung/s3c24xx_simtec.c
+++ b/sound/soc/samsung/s3c24xx_simtec.c
@@ -13,7 +13,7 @@
13 13
14#include <sound/soc.h> 14#include <sound/soc.h>
15 15
16#include <plat/audio-simtec.h> 16#include <linux/platform_data/asoc-s3c24xx_simtec.h>
17 17
18#include "s3c24xx-i2s.h" 18#include "s3c24xx-i2s.h"
19#include "s3c24xx_simtec.h" 19#include "s3c24xx_simtec.h"
diff --git a/sound/soc/samsung/spdif.c b/sound/soc/samsung/spdif.c
index a5a56a120345..bc24c7af02b2 100644
--- a/sound/soc/samsung/spdif.c
+++ b/sound/soc/samsung/spdif.c
@@ -17,7 +17,7 @@
17#include <sound/soc.h> 17#include <sound/soc.h>
18#include <sound/pcm_params.h> 18#include <sound/pcm_params.h>
19 19
20#include <plat/audio.h> 20#include <linux/platform_data/asoc-s3c.h>
21#include <mach/dma.h> 21#include <mach/dma.h>
22 22
23#include "dma.h" 23#include "dma.h"
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index c501af6d8dbe..cf3d0b0c71b9 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -591,7 +591,7 @@ int snd_soc_suspend(struct device *dev)
591 591
592 /* close any waiting streams and save state */ 592 /* close any waiting streams and save state */
593 for (i = 0; i < card->num_rtd; i++) { 593 for (i = 0; i < card->num_rtd; i++) {
594 flush_delayed_work_sync(&card->rtd[i].delayed_work); 594 flush_delayed_work(&card->rtd[i].delayed_work);
595 card->rtd[i].codec->dapm.suspend_bias_level = card->rtd[i].codec->dapm.bias_level; 595 card->rtd[i].codec->dapm.suspend_bias_level = card->rtd[i].codec->dapm.bias_level;
596 } 596 }
597 597
@@ -1848,7 +1848,7 @@ static int soc_cleanup_card_resources(struct snd_soc_card *card)
1848 /* make sure any delayed work runs */ 1848 /* make sure any delayed work runs */
1849 for (i = 0; i < card->num_rtd; i++) { 1849 for (i = 0; i < card->num_rtd; i++) {
1850 struct snd_soc_pcm_runtime *rtd = &card->rtd[i]; 1850 struct snd_soc_pcm_runtime *rtd = &card->rtd[i];
1851 flush_delayed_work_sync(&rtd->delayed_work); 1851 flush_delayed_work(&rtd->delayed_work);
1852 } 1852 }
1853 1853
1854 /* remove auxiliary devices */ 1854 /* remove auxiliary devices */
@@ -1892,7 +1892,7 @@ int snd_soc_poweroff(struct device *dev)
1892 * now, we're shutting down so no imminent restart. */ 1892 * now, we're shutting down so no imminent restart. */
1893 for (i = 0; i < card->num_rtd; i++) { 1893 for (i = 0; i < card->num_rtd; i++) {
1894 struct snd_soc_pcm_runtime *rtd = &card->rtd[i]; 1894 struct snd_soc_pcm_runtime *rtd = &card->rtd[i];
1895 flush_delayed_work_sync(&rtd->delayed_work); 1895 flush_delayed_work(&rtd->delayed_work);
1896 } 1896 }
1897 1897
1898 snd_soc_dapm_shutdown(card); 1898 snd_soc_dapm_shutdown(card);
diff --git a/sound/soc/tegra/Kconfig b/sound/soc/tegra/Kconfig
index 02bcd308c189..19e5fe7cc403 100644
--- a/sound/soc/tegra/Kconfig
+++ b/sound/soc/tegra/Kconfig
@@ -1,6 +1,6 @@
1config SND_SOC_TEGRA 1config SND_SOC_TEGRA
2 tristate "SoC Audio for the Tegra System-on-Chip" 2 tristate "SoC Audio for the Tegra System-on-Chip"
3 depends on ARCH_TEGRA && (TEGRA_SYSTEM_DMA || TEGRA20_APB_DMA) 3 depends on ARCH_TEGRA && TEGRA20_APB_DMA
4 select REGMAP_MMIO 4 select REGMAP_MMIO
5 select SND_SOC_DMAENGINE_PCM if TEGRA20_APB_DMA 5 select SND_SOC_DMAENGINE_PCM if TEGRA20_APB_DMA
6 help 6 help
diff --git a/sound/soc/tegra/tegra_pcm.c b/sound/soc/tegra/tegra_pcm.c
index 8d6900c1ee47..e18733963cb4 100644
--- a/sound/soc/tegra/tegra_pcm.c
+++ b/sound/soc/tegra/tegra_pcm.c
@@ -57,237 +57,6 @@ static const struct snd_pcm_hardware tegra_pcm_hardware = {
57 .fifo_size = 4, 57 .fifo_size = 4,
58}; 58};
59 59
60#if defined(CONFIG_TEGRA_SYSTEM_DMA)
61static void tegra_pcm_queue_dma(struct tegra_runtime_data *prtd)
62{
63 struct snd_pcm_substream *substream = prtd->substream;
64 struct snd_dma_buffer *buf = &substream->dma_buffer;
65 struct tegra_dma_req *dma_req;
66 unsigned long addr;
67
68 dma_req = &prtd->dma_req[prtd->dma_req_idx];
69 prtd->dma_req_idx = 1 - prtd->dma_req_idx;
70
71 addr = buf->addr + prtd->dma_pos;
72 prtd->dma_pos += dma_req->size;
73 if (prtd->dma_pos >= prtd->dma_pos_end)
74 prtd->dma_pos = 0;
75
76 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
77 dma_req->source_addr = addr;
78 else
79 dma_req->dest_addr = addr;
80
81 tegra_dma_enqueue_req(prtd->dma_chan, dma_req);
82}
83
84static void dma_complete_callback(struct tegra_dma_req *req)
85{
86 struct tegra_runtime_data *prtd = (struct tegra_runtime_data *)req->dev;
87 struct snd_pcm_substream *substream = prtd->substream;
88 struct snd_pcm_runtime *runtime = substream->runtime;
89
90 spin_lock(&prtd->lock);
91
92 if (!prtd->running) {
93 spin_unlock(&prtd->lock);
94 return;
95 }
96
97 if (++prtd->period_index >= runtime->periods)
98 prtd->period_index = 0;
99
100 tegra_pcm_queue_dma(prtd);
101
102 spin_unlock(&prtd->lock);
103
104 snd_pcm_period_elapsed(substream);
105}
106
107static void setup_dma_tx_request(struct tegra_dma_req *req,
108 struct tegra_pcm_dma_params * dmap)
109{
110 req->complete = dma_complete_callback;
111 req->to_memory = false;
112 req->dest_addr = dmap->addr;
113 req->dest_wrap = dmap->wrap;
114 req->source_bus_width = 32;
115 req->source_wrap = 0;
116 req->dest_bus_width = dmap->width;
117 req->req_sel = dmap->req_sel;
118}
119
120static void setup_dma_rx_request(struct tegra_dma_req *req,
121 struct tegra_pcm_dma_params * dmap)
122{
123 req->complete = dma_complete_callback;
124 req->to_memory = true;
125 req->source_addr = dmap->addr;
126 req->dest_wrap = 0;
127 req->source_bus_width = dmap->width;
128 req->source_wrap = dmap->wrap;
129 req->dest_bus_width = 32;
130 req->req_sel = dmap->req_sel;
131}
132
133static int tegra_pcm_open(struct snd_pcm_substream *substream)
134{
135 struct snd_pcm_runtime *runtime = substream->runtime;
136 struct tegra_runtime_data *prtd;
137 struct snd_soc_pcm_runtime *rtd = substream->private_data;
138 struct tegra_pcm_dma_params * dmap;
139 int ret = 0;
140
141 prtd = kzalloc(sizeof(struct tegra_runtime_data), GFP_KERNEL);
142 if (prtd == NULL)
143 return -ENOMEM;
144
145 runtime->private_data = prtd;
146 prtd->substream = substream;
147
148 spin_lock_init(&prtd->lock);
149
150 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
151 dmap = snd_soc_dai_get_dma_data(rtd->cpu_dai, substream);
152 setup_dma_tx_request(&prtd->dma_req[0], dmap);
153 setup_dma_tx_request(&prtd->dma_req[1], dmap);
154 } else {
155 dmap = snd_soc_dai_get_dma_data(rtd->cpu_dai, substream);
156 setup_dma_rx_request(&prtd->dma_req[0], dmap);
157 setup_dma_rx_request(&prtd->dma_req[1], dmap);
158 }
159
160 prtd->dma_req[0].dev = prtd;
161 prtd->dma_req[1].dev = prtd;
162
163 prtd->dma_chan = tegra_dma_allocate_channel(TEGRA_DMA_MODE_ONESHOT);
164 if (prtd->dma_chan == NULL) {
165 ret = -ENOMEM;
166 goto err;
167 }
168
169 /* Set HW params now that initialization is complete */
170 snd_soc_set_runtime_hwparams(substream, &tegra_pcm_hardware);
171
172 /* Ensure that buffer size is a multiple of period size */
173 ret = snd_pcm_hw_constraint_integer(runtime,
174 SNDRV_PCM_HW_PARAM_PERIODS);
175 if (ret < 0)
176 goto err;
177
178 return 0;
179
180err:
181 if (prtd->dma_chan) {
182 tegra_dma_free_channel(prtd->dma_chan);
183 }
184
185 kfree(prtd);
186
187 return ret;
188}
189
190static int tegra_pcm_close(struct snd_pcm_substream *substream)
191{
192 struct snd_pcm_runtime *runtime = substream->runtime;
193 struct tegra_runtime_data *prtd = runtime->private_data;
194
195 tegra_dma_free_channel(prtd->dma_chan);
196
197 kfree(prtd);
198
199 return 0;
200}
201
202static int tegra_pcm_hw_params(struct snd_pcm_substream *substream,
203 struct snd_pcm_hw_params *params)
204{
205 struct snd_pcm_runtime *runtime = substream->runtime;
206 struct tegra_runtime_data *prtd = runtime->private_data;
207
208 snd_pcm_set_runtime_buffer(substream, &substream->dma_buffer);
209
210 prtd->dma_req[0].size = params_period_bytes(params);
211 prtd->dma_req[1].size = prtd->dma_req[0].size;
212
213 return 0;
214}
215
216static int tegra_pcm_hw_free(struct snd_pcm_substream *substream)
217{
218 snd_pcm_set_runtime_buffer(substream, NULL);
219
220 return 0;
221}
222
223static int tegra_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
224{
225 struct snd_pcm_runtime *runtime = substream->runtime;
226 struct tegra_runtime_data *prtd = runtime->private_data;
227 unsigned long flags;
228
229 switch (cmd) {
230 case SNDRV_PCM_TRIGGER_START:
231 prtd->dma_pos = 0;
232 prtd->dma_pos_end = frames_to_bytes(runtime, runtime->periods * runtime->period_size);
233 prtd->period_index = 0;
234 prtd->dma_req_idx = 0;
235 /* Fall-through */
236 case SNDRV_PCM_TRIGGER_RESUME:
237 case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
238 spin_lock_irqsave(&prtd->lock, flags);
239 prtd->running = 1;
240 spin_unlock_irqrestore(&prtd->lock, flags);
241 tegra_pcm_queue_dma(prtd);
242 tegra_pcm_queue_dma(prtd);
243 break;
244 case SNDRV_PCM_TRIGGER_STOP:
245 case SNDRV_PCM_TRIGGER_SUSPEND:
246 case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
247 spin_lock_irqsave(&prtd->lock, flags);
248 prtd->running = 0;
249 spin_unlock_irqrestore(&prtd->lock, flags);
250 tegra_dma_dequeue_req(prtd->dma_chan, &prtd->dma_req[0]);
251 tegra_dma_dequeue_req(prtd->dma_chan, &prtd->dma_req[1]);
252 break;
253 default:
254 return -EINVAL;
255 }
256
257 return 0;
258}
259
260static snd_pcm_uframes_t tegra_pcm_pointer(struct snd_pcm_substream *substream)
261{
262 struct snd_pcm_runtime *runtime = substream->runtime;
263 struct tegra_runtime_data *prtd = runtime->private_data;
264
265 return prtd->period_index * runtime->period_size;
266}
267
268
269static int tegra_pcm_mmap(struct snd_pcm_substream *substream,
270 struct vm_area_struct *vma)
271{
272 struct snd_pcm_runtime *runtime = substream->runtime;
273
274 return dma_mmap_writecombine(substream->pcm->card->dev, vma,
275 runtime->dma_area,
276 runtime->dma_addr,
277 runtime->dma_bytes);
278}
279
280static struct snd_pcm_ops tegra_pcm_ops = {
281 .open = tegra_pcm_open,
282 .close = tegra_pcm_close,
283 .ioctl = snd_pcm_lib_ioctl,
284 .hw_params = tegra_pcm_hw_params,
285 .hw_free = tegra_pcm_hw_free,
286 .trigger = tegra_pcm_trigger,
287 .pointer = tegra_pcm_pointer,
288 .mmap = tegra_pcm_mmap,
289};
290#else
291static int tegra_pcm_open(struct snd_pcm_substream *substream) 60static int tegra_pcm_open(struct snd_pcm_substream *substream)
292{ 61{
293 struct snd_soc_pcm_runtime *rtd = substream->private_data; 62 struct snd_soc_pcm_runtime *rtd = substream->private_data;
@@ -399,7 +168,6 @@ static struct snd_pcm_ops tegra_pcm_ops = {
399 .pointer = snd_dmaengine_pcm_pointer, 168 .pointer = snd_dmaengine_pcm_pointer,
400 .mmap = tegra_pcm_mmap, 169 .mmap = tegra_pcm_mmap,
401}; 170};
402#endif
403 171
404static int tegra_pcm_preallocate_dma_buffer(struct snd_pcm *pcm, int stream) 172static int tegra_pcm_preallocate_dma_buffer(struct snd_pcm *pcm, int stream)
405{ 173{
diff --git a/sound/soc/tegra/tegra_pcm.h b/sound/soc/tegra/tegra_pcm.h
index a3a450352dcf..b40279b9f413 100644
--- a/sound/soc/tegra/tegra_pcm.h
+++ b/sound/soc/tegra/tegra_pcm.h
@@ -40,20 +40,6 @@ struct tegra_pcm_dma_params {
40 unsigned long req_sel; 40 unsigned long req_sel;
41}; 41};
42 42
43#if defined(CONFIG_TEGRA_SYSTEM_DMA)
44struct tegra_runtime_data {
45 struct snd_pcm_substream *substream;
46 spinlock_t lock;
47 int running;
48 int dma_pos;
49 int dma_pos_end;
50 int period_index;
51 int dma_req_idx;
52 struct tegra_dma_req dma_req[2];
53 struct tegra_dma_channel *dma_chan;
54};
55#endif
56
57int tegra_pcm_platform_register(struct device *dev); 43int tegra_pcm_platform_register(struct device *dev);
58void tegra_pcm_platform_unregister(struct device *dev); 44void tegra_pcm_platform_unregister(struct device *dev);
59 45
diff --git a/sound/soc/ux500/mop500.c b/sound/soc/ux500/mop500.c
index 31c4d26d0359..356611d9654d 100644
--- a/sound/soc/ux500/mop500.c
+++ b/sound/soc/ux500/mop500.c
@@ -16,6 +16,7 @@
16#include <linux/module.h> 16#include <linux/module.h>
17#include <linux/io.h> 17#include <linux/io.h>
18#include <linux/spi/spi.h> 18#include <linux/spi/spi.h>
19#include <linux/of.h>
19 20
20#include <sound/soc.h> 21#include <sound/soc.h>
21#include <sound/initval.h> 22#include <sound/initval.h>
@@ -56,16 +57,47 @@ static struct snd_soc_card mop500_card = {
56 .num_links = ARRAY_SIZE(mop500_dai_links), 57 .num_links = ARRAY_SIZE(mop500_dai_links),
57}; 58};
58 59
60static int __devinit mop500_of_probe(struct platform_device *pdev,
61 struct device_node *np)
62{
63 struct device_node *codec_np, *msp_np[2];
64 int i;
65
66 msp_np[0] = of_parse_phandle(np, "stericsson,cpu-dai", 0);
67 msp_np[1] = of_parse_phandle(np, "stericsson,cpu-dai", 1);
68 codec_np = of_parse_phandle(np, "stericsson,audio-codec", 0);
69
70 if (!(msp_np[0] && msp_np[1] && codec_np)) {
71 dev_err(&pdev->dev, "Phandle missing or invalid\n");
72 return -EINVAL;
73 }
74
75 for (i = 0; i < 2; i++) {
76 mop500_dai_links[i].cpu_of_node = msp_np[i];
77 mop500_dai_links[i].cpu_dai_name = NULL;
78 mop500_dai_links[i].codec_of_node = codec_np;
79 mop500_dai_links[i].codec_name = NULL;
80 }
81
82 snd_soc_of_parse_card_name(&mop500_card, "stericsson,card-name");
83
84 return 0;
85}
59static int __devinit mop500_probe(struct platform_device *pdev) 86static int __devinit mop500_probe(struct platform_device *pdev)
60{ 87{
88 struct device_node *np = pdev->dev.of_node;
61 int ret; 89 int ret;
62 90
63 pr_debug("%s: Enter.\n", __func__);
64
65 dev_dbg(&pdev->dev, "%s: Enter.\n", __func__); 91 dev_dbg(&pdev->dev, "%s: Enter.\n", __func__);
66 92
67 mop500_card.dev = &pdev->dev; 93 mop500_card.dev = &pdev->dev;
68 94
95 if (np) {
96 ret = mop500_of_probe(pdev, np);
97 if (ret)
98 return ret;
99 }
100
69 dev_dbg(&pdev->dev, "%s: Card %s: Set platform drvdata.\n", 101 dev_dbg(&pdev->dev, "%s: Card %s: Set platform drvdata.\n",
70 __func__, mop500_card.name); 102 __func__, mop500_card.name);
71 platform_set_drvdata(pdev, &mop500_card); 103 platform_set_drvdata(pdev, &mop500_card);
@@ -83,8 +115,7 @@ static int __devinit mop500_probe(struct platform_device *pdev)
83 ret = snd_soc_register_card(&mop500_card); 115 ret = snd_soc_register_card(&mop500_card);
84 if (ret) 116 if (ret)
85 dev_err(&pdev->dev, 117 dev_err(&pdev->dev,
86 "Error: snd_soc_register_card failed (%d)!\n", 118 "Error: snd_soc_register_card failed (%d)!\n", ret);
87 ret);
88 119
89 return ret; 120 return ret;
90} 121}
@@ -97,14 +128,20 @@ static int __devexit mop500_remove(struct platform_device *pdev)
97 128
98 snd_soc_unregister_card(mop500_card); 129 snd_soc_unregister_card(mop500_card);
99 mop500_ab8500_remove(mop500_card); 130 mop500_ab8500_remove(mop500_card);
100 131
101 return 0; 132 return 0;
102} 133}
103 134
135static const struct of_device_id snd_soc_mop500_match[] = {
136 { .compatible = "stericsson,snd-soc-mop500", },
137 {},
138};
139
104static struct platform_driver snd_soc_mop500_driver = { 140static struct platform_driver snd_soc_mop500_driver = {
105 .driver = { 141 .driver = {
106 .owner = THIS_MODULE, 142 .owner = THIS_MODULE,
107 .name = "snd-soc-mop500", 143 .name = "snd-soc-mop500",
144 .of_match_table = snd_soc_mop500_match,
108 }, 145 },
109 .probe = mop500_probe, 146 .probe = mop500_probe,
110 .remove = __devexit_p(mop500_remove), 147 .remove = __devexit_p(mop500_remove),
diff --git a/sound/soc/ux500/ux500_msp_dai.c b/sound/soc/ux500/ux500_msp_dai.c
index 057e28ef770e..45e43b4057b0 100644
--- a/sound/soc/ux500/ux500_msp_dai.c
+++ b/sound/soc/ux500/ux500_msp_dai.c
@@ -830,10 +830,16 @@ static int __devexit ux500_msp_drv_remove(struct platform_device *pdev)
830 return 0; 830 return 0;
831} 831}
832 832
833static const struct of_device_id ux500_msp_i2s_match[] = {
834 { .compatible = "stericsson,ux500-msp-i2s", },
835 {},
836};
837
833static struct platform_driver msp_i2s_driver = { 838static struct platform_driver msp_i2s_driver = {
834 .driver = { 839 .driver = {
835 .name = "ux500-msp-i2s", 840 .name = "ux500-msp-i2s",
836 .owner = THIS_MODULE, 841 .owner = THIS_MODULE,
842 .of_match_table = ux500_msp_i2s_match,
837 }, 843 },
838 .probe = ux500_msp_drv_probe, 844 .probe = ux500_msp_drv_probe,
839 .remove = ux500_msp_drv_remove, 845 .remove = ux500_msp_drv_remove,
diff --git a/sound/soc/ux500/ux500_msp_i2s.c b/sound/soc/ux500/ux500_msp_i2s.c
index eb85113d472a..e5c79ca42518 100644
--- a/sound/soc/ux500/ux500_msp_i2s.c
+++ b/sound/soc/ux500/ux500_msp_i2s.c
@@ -15,8 +15,10 @@
15 15
16#include <linux/module.h> 16#include <linux/module.h>
17#include <linux/platform_device.h> 17#include <linux/platform_device.h>
18#include <linux/pinctrl/consumer.h>
18#include <linux/delay.h> 19#include <linux/delay.h>
19#include <linux/slab.h> 20#include <linux/slab.h>
21#include <linux/of.h>
20 22
21#include <mach/hardware.h> 23#include <mach/hardware.h>
22#include <mach/msp.h> 24#include <mach/msp.h>
@@ -25,6 +27,9 @@
25 27
26#include "ux500_msp_i2s.h" 28#include "ux500_msp_i2s.h"
27 29
30/* MSP1/3 Tx/Rx usage protection */
31static DEFINE_SPINLOCK(msp_rxtx_lock);
32
28 /* Protocol desciptors */ 33 /* Protocol desciptors */
29static const struct msp_protdesc prot_descs[] = { 34static const struct msp_protdesc prot_descs[] = {
30 { /* I2S */ 35 { /* I2S */
@@ -352,17 +357,23 @@ static int configure_multichannel(struct ux500_msp *msp,
352 357
353static int enable_msp(struct ux500_msp *msp, struct ux500_msp_config *config) 358static int enable_msp(struct ux500_msp *msp, struct ux500_msp_config *config)
354{ 359{
355 int status = 0; 360 int status = 0, retval = 0;
356 u32 reg_val_DMACR, reg_val_GCR; 361 u32 reg_val_DMACR, reg_val_GCR;
362 unsigned long flags;
357 363
358 /* Check msp state whether in RUN or CONFIGURED Mode */ 364 /* Check msp state whether in RUN or CONFIGURED Mode */
359 if ((msp->msp_state == MSP_STATE_IDLE) && (msp->plat_init)) { 365 if (msp->msp_state == MSP_STATE_IDLE) {
360 status = msp->plat_init(); 366 spin_lock_irqsave(&msp_rxtx_lock, flags);
361 if (status) { 367 if (msp->pinctrl_rxtx_ref == 0 &&
362 dev_err(msp->dev, "%s: ERROR: Failed to init MSP (%d)!\n", 368 !(IS_ERR(msp->pinctrl_p) || IS_ERR(msp->pinctrl_def))) {
363 __func__, status); 369 retval = pinctrl_select_state(msp->pinctrl_p,
364 return status; 370 msp->pinctrl_def);
371 if (retval)
372 pr_err("could not set MSP defstate\n");
365 } 373 }
374 if (!retval)
375 msp->pinctrl_rxtx_ref++;
376 spin_unlock_irqrestore(&msp_rxtx_lock, flags);
366 } 377 }
367 378
368 /* Configure msp with protocol dependent settings */ 379 /* Configure msp with protocol dependent settings */
@@ -620,7 +631,8 @@ int ux500_msp_i2s_trigger(struct ux500_msp *msp, int cmd, int direction)
620 631
621int ux500_msp_i2s_close(struct ux500_msp *msp, unsigned int dir) 632int ux500_msp_i2s_close(struct ux500_msp *msp, unsigned int dir)
622{ 633{
623 int status = 0; 634 int status = 0, retval = 0;
635 unsigned long flags;
624 636
625 dev_dbg(msp->dev, "%s: Enter (dir = 0x%01x).\n", __func__, dir); 637 dev_dbg(msp->dev, "%s: Enter (dir = 0x%01x).\n", __func__, dir);
626 638
@@ -631,12 +643,19 @@ int ux500_msp_i2s_close(struct ux500_msp *msp, unsigned int dir)
631 writel((readl(msp->registers + MSP_GCR) & 643 writel((readl(msp->registers + MSP_GCR) &
632 (~(FRAME_GEN_ENABLE | SRG_ENABLE))), 644 (~(FRAME_GEN_ENABLE | SRG_ENABLE))),
633 msp->registers + MSP_GCR); 645 msp->registers + MSP_GCR);
634 if (msp->plat_exit) 646
635 status = msp->plat_exit(); 647 spin_lock_irqsave(&msp_rxtx_lock, flags);
636 if (status) 648 WARN_ON(!msp->pinctrl_rxtx_ref);
637 dev_warn(msp->dev, 649 msp->pinctrl_rxtx_ref--;
638 "%s: WARN: ux500_msp_i2s_exit failed (%d)!\n", 650 if (msp->pinctrl_rxtx_ref == 0 &&
639 __func__, status); 651 !(IS_ERR(msp->pinctrl_p) || IS_ERR(msp->pinctrl_sleep))) {
652 retval = pinctrl_select_state(msp->pinctrl_p,
653 msp->pinctrl_sleep);
654 if (retval)
655 pr_err("could not set MSP sleepstate\n");
656 }
657 spin_unlock_irqrestore(&msp_rxtx_lock, flags);
658
640 writel(0, msp->registers + MSP_GCR); 659 writel(0, msp->registers + MSP_GCR);
641 writel(0, msp->registers + MSP_TCF); 660 writel(0, msp->registers + MSP_TCF);
642 writel(0, msp->registers + MSP_RCF); 661 writel(0, msp->registers + MSP_RCF);
@@ -665,18 +684,31 @@ int ux500_msp_i2s_init_msp(struct platform_device *pdev,
665{ 684{
666 struct resource *res = NULL; 685 struct resource *res = NULL;
667 struct i2s_controller *i2s_cont; 686 struct i2s_controller *i2s_cont;
687 struct device_node *np = pdev->dev.of_node;
668 struct ux500_msp *msp; 688 struct ux500_msp *msp;
669 689
670 dev_dbg(&pdev->dev, "%s: Enter (name: %s, id: %d).\n", __func__,
671 pdev->name, platform_data->id);
672
673 *msp_p = devm_kzalloc(&pdev->dev, sizeof(struct ux500_msp), GFP_KERNEL); 690 *msp_p = devm_kzalloc(&pdev->dev, sizeof(struct ux500_msp), GFP_KERNEL);
674 msp = *msp_p; 691 msp = *msp_p;
675 692
693 if (np) {
694 if (!platform_data) {
695 platform_data = devm_kzalloc(&pdev->dev,
696 sizeof(struct msp_i2s_platform_data), GFP_KERNEL);
697 if (!platform_data)
698 ret = -ENOMEM;
699 }
700 } else
701 if (!platform_data)
702 ret = -EINVAL;
703
704 if (ret)
705 goto err_res;
706
707 dev_dbg(&pdev->dev, "%s: Enter (name: %s, id: %d).\n", __func__,
708 pdev->name, platform_data->id);
709
676 msp->id = platform_data->id; 710 msp->id = platform_data->id;
677 msp->dev = &pdev->dev; 711 msp->dev = &pdev->dev;
678 msp->plat_init = platform_data->msp_i2s_init;
679 msp->plat_exit = platform_data->msp_i2s_exit;
680 msp->dma_cfg_rx = platform_data->msp_i2s_dma_rx; 712 msp->dma_cfg_rx = platform_data->msp_i2s_dma_rx;
681 msp->dma_cfg_tx = platform_data->msp_i2s_dma_tx; 713 msp->dma_cfg_tx = platform_data->msp_i2s_dma_tx;
682 714
@@ -713,6 +745,25 @@ int ux500_msp_i2s_init_msp(struct platform_device *pdev,
713 dev_dbg(&pdev->dev, "I2S device-name: '%s'\n", i2s_cont->name); 745 dev_dbg(&pdev->dev, "I2S device-name: '%s'\n", i2s_cont->name);
714 msp->i2s_cont = i2s_cont; 746 msp->i2s_cont = i2s_cont;
715 747
748 msp->pinctrl_p = pinctrl_get(msp->dev);
749 if (IS_ERR(msp->pinctrl_p))
750 dev_err(&pdev->dev, "could not get MSP pinctrl\n");
751 else {
752 msp->pinctrl_def = pinctrl_lookup_state(msp->pinctrl_p,
753 PINCTRL_STATE_DEFAULT);
754 if (IS_ERR(msp->pinctrl_def)) {
755 dev_err(&pdev->dev,
756 "could not get MSP defstate (%li)\n",
757 PTR_ERR(msp->pinctrl_def));
758 }
759 msp->pinctrl_sleep = pinctrl_lookup_state(msp->pinctrl_p,
760 PINCTRL_STATE_SLEEP);
761 if (IS_ERR(msp->pinctrl_sleep))
762 dev_err(&pdev->dev,
763 "could not get MSP idlestate (%li)\n",
764 PTR_ERR(msp->pinctrl_def));
765 }
766
716 return 0; 767 return 0;
717} 768}
718 769
diff --git a/sound/soc/ux500/ux500_msp_i2s.h b/sound/soc/ux500/ux500_msp_i2s.h
index 2d9136da9865..1311c0df7628 100644
--- a/sound/soc/ux500/ux500_msp_i2s.h
+++ b/sound/soc/ux500/ux500_msp_i2s.h
@@ -524,14 +524,18 @@ struct ux500_msp {
524 struct dma_chan *rx_pipeid; 524 struct dma_chan *rx_pipeid;
525 enum msp_state msp_state; 525 enum msp_state msp_state;
526 int (*transfer) (struct ux500_msp *msp, struct i2s_message *message); 526 int (*transfer) (struct ux500_msp *msp, struct i2s_message *message);
527 int (*plat_init) (void);
528 int (*plat_exit) (void);
529 struct timer_list notify_timer; 527 struct timer_list notify_timer;
530 int def_elem_len; 528 int def_elem_len;
531 unsigned int dir_busy; 529 unsigned int dir_busy;
532 int loopback_enable; 530 int loopback_enable;
533 u32 backup_regs[MAX_MSP_BACKUP_REGS]; 531 u32 backup_regs[MAX_MSP_BACKUP_REGS];
534 unsigned int f_bitclk; 532 unsigned int f_bitclk;
533 /* Pin modes */
534 struct pinctrl *pinctrl_p;
535 struct pinctrl_state *pinctrl_def;
536 struct pinctrl_state *pinctrl_sleep;
537 /* Reference Count */
538 int pinctrl_rxtx_ref;
535}; 539};
536 540
537struct ux500_msp_dma_params { 541struct ux500_msp_dma_params {