aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/sound/soc-dai.h2
-rw-r--r--include/sound/soc.h17
-rw-r--r--sound/soc/atmel/atmel-pcm-pdc.c63
-rw-r--r--sound/soc/soc-compress.c6
-rw-r--r--sound/soc/soc-core.c21
-rw-r--r--sound/soc/soc-pcm.c1
6 files changed, 29 insertions, 81 deletions
diff --git a/include/sound/soc-dai.h b/include/sound/soc-dai.h
index fad76769f153..688f2ba8009f 100644
--- a/include/sound/soc-dai.h
+++ b/include/sound/soc-dai.h
@@ -252,7 +252,6 @@ struct snd_soc_dai {
252 unsigned int symmetric_rates:1; 252 unsigned int symmetric_rates:1;
253 unsigned int symmetric_channels:1; 253 unsigned int symmetric_channels:1;
254 unsigned int symmetric_samplebits:1; 254 unsigned int symmetric_samplebits:1;
255 struct snd_pcm_runtime *runtime;
256 unsigned int active; 255 unsigned int active;
257 unsigned char probed:1; 256 unsigned char probed:1;
258 257
@@ -277,7 +276,6 @@ struct snd_soc_dai {
277 struct snd_soc_card *card; 276 struct snd_soc_card *card;
278 277
279 struct list_head list; 278 struct list_head list;
280 struct list_head card_list;
281}; 279};
282 280
283static inline void *snd_soc_dai_get_dma_data(const struct snd_soc_dai *dai, 281static inline void *snd_soc_dai_get_dma_data(const struct snd_soc_dai *dai,
diff --git a/include/sound/soc.h b/include/sound/soc.h
index c0b65fc90783..b9ee22018352 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -266,6 +266,13 @@
266 {.base = xbase, .num_regs = xregs, \ 266 {.base = xbase, .num_regs = xregs, \
267 .mask = xmask }) } 267 .mask = xmask }) }
268 268
269#define SND_SOC_BYTES_EXT(xname, xcount, xhandler_get, xhandler_put) \
270{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
271 .info = snd_soc_bytes_info_ext, \
272 .get = xhandler_get, .put = xhandler_put, \
273 .private_value = (unsigned long)&(struct soc_bytes_ext) \
274 {.max = xcount} }
275
269#define SOC_SINGLE_XR_SX(xname, xregbase, xregcount, xnbits, \ 276#define SOC_SINGLE_XR_SX(xname, xregbase, xregcount, xnbits, \
270 xmin, xmax, xinvert) \ 277 xmin, xmax, xinvert) \
271{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \ 278{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \
@@ -532,6 +539,8 @@ int snd_soc_bytes_get(struct snd_kcontrol *kcontrol,
532 struct snd_ctl_elem_value *ucontrol); 539 struct snd_ctl_elem_value *ucontrol);
533int snd_soc_bytes_put(struct snd_kcontrol *kcontrol, 540int snd_soc_bytes_put(struct snd_kcontrol *kcontrol,
534 struct snd_ctl_elem_value *ucontrol); 541 struct snd_ctl_elem_value *ucontrol);
542int snd_soc_bytes_info_ext(struct snd_kcontrol *kcontrol,
543 struct snd_ctl_elem_info *ucontrol);
535int snd_soc_info_xr_sx(struct snd_kcontrol *kcontrol, 544int snd_soc_info_xr_sx(struct snd_kcontrol *kcontrol,
536 struct snd_ctl_elem_info *uinfo); 545 struct snd_ctl_elem_info *uinfo);
537int snd_soc_get_xr_sx(struct snd_kcontrol *kcontrol, 546int snd_soc_get_xr_sx(struct snd_kcontrol *kcontrol,
@@ -692,7 +701,6 @@ struct snd_soc_codec {
692 struct snd_soc_card *card; 701 struct snd_soc_card *card;
693 struct list_head list; 702 struct list_head list;
694 struct list_head card_list; 703 struct list_head card_list;
695 int num_dai;
696 704
697 /* runtime */ 705 /* runtime */
698 struct snd_ac97 *ac97; /* for ad-hoc ac97 devices */ 706 struct snd_ac97 *ac97; /* for ad-hoc ac97 devices */
@@ -949,7 +957,6 @@ struct snd_soc_card {
949 struct snd_card *snd_card; 957 struct snd_card *snd_card;
950 struct module *owner; 958 struct module *owner;
951 959
952 struct list_head list;
953 struct mutex mutex; 960 struct mutex mutex;
954 struct mutex dapm_mutex; 961 struct mutex dapm_mutex;
955 962
@@ -1012,7 +1019,6 @@ struct snd_soc_card {
1012 /* lists of probed devices belonging to this card */ 1019 /* lists of probed devices belonging to this card */
1013 struct list_head codec_dev_list; 1020 struct list_head codec_dev_list;
1014 struct list_head platform_dev_list; 1021 struct list_head platform_dev_list;
1015 struct list_head dai_dev_list;
1016 1022
1017 struct list_head widgets; 1023 struct list_head widgets;
1018 struct list_head paths; 1024 struct list_head paths;
@@ -1082,6 +1088,10 @@ struct soc_bytes {
1082 u32 mask; 1088 u32 mask;
1083}; 1089};
1084 1090
1091struct soc_bytes_ext {
1092 int max;
1093};
1094
1085/* multi register control */ 1095/* multi register control */
1086struct soc_mreg_control { 1096struct soc_mreg_control {
1087 long min, max; 1097 long min, max;
@@ -1194,7 +1204,6 @@ static inline void *snd_soc_pcm_get_drvdata(struct snd_soc_pcm_runtime *rtd)
1194 1204
1195static inline void snd_soc_initialize_card_lists(struct snd_soc_card *card) 1205static inline void snd_soc_initialize_card_lists(struct snd_soc_card *card)
1196{ 1206{
1197 INIT_LIST_HEAD(&card->dai_dev_list);
1198 INIT_LIST_HEAD(&card->codec_dev_list); 1207 INIT_LIST_HEAD(&card->codec_dev_list);
1199 INIT_LIST_HEAD(&card->platform_dev_list); 1208 INIT_LIST_HEAD(&card->platform_dev_list);
1200 INIT_LIST_HEAD(&card->widgets); 1209 INIT_LIST_HEAD(&card->widgets);
diff --git a/sound/soc/atmel/atmel-pcm-pdc.c b/sound/soc/atmel/atmel-pcm-pdc.c
index 33ec592ecd75..a366b3503c28 100644
--- a/sound/soc/atmel/atmel-pcm-pdc.c
+++ b/sound/soc/atmel/atmel-pcm-pdc.c
@@ -76,12 +76,6 @@ struct atmel_runtime_data {
76 size_t period_size; 76 size_t period_size;
77 77
78 dma_addr_t period_ptr; /* physical address of next period */ 78 dma_addr_t period_ptr; /* physical address of next period */
79
80 /* PDC register save */
81 u32 pdc_xpr_save;
82 u32 pdc_xcr_save;
83 u32 pdc_xnpr_save;
84 u32 pdc_xncr_save;
85}; 79};
86 80
87/*--------------------------------------------------------------------------*\ 81/*--------------------------------------------------------------------------*\
@@ -320,67 +314,10 @@ static struct snd_pcm_ops atmel_pcm_ops = {
320 .mmap = atmel_pcm_mmap, 314 .mmap = atmel_pcm_mmap,
321}; 315};
322 316
323
324/*--------------------------------------------------------------------------*\
325 * ASoC platform driver
326\*--------------------------------------------------------------------------*/
327#ifdef CONFIG_PM
328static int atmel_pcm_suspend(struct snd_soc_dai *dai)
329{
330 struct snd_pcm_runtime *runtime = dai->runtime;
331 struct atmel_runtime_data *prtd;
332 struct atmel_pcm_dma_params *params;
333
334 if (!runtime)
335 return 0;
336
337 prtd = runtime->private_data;
338 params = prtd->params;
339
340 /* disable the PDC and save the PDC registers */
341
342 ssc_writel(params->ssc->regs, PDC_PTCR, params->mask->pdc_disable);
343
344 prtd->pdc_xpr_save = ssc_readx(params->ssc->regs, params->pdc->xpr);
345 prtd->pdc_xcr_save = ssc_readx(params->ssc->regs, params->pdc->xcr);
346 prtd->pdc_xnpr_save = ssc_readx(params->ssc->regs, params->pdc->xnpr);
347 prtd->pdc_xncr_save = ssc_readx(params->ssc->regs, params->pdc->xncr);
348
349 return 0;
350}
351
352static int atmel_pcm_resume(struct snd_soc_dai *dai)
353{
354 struct snd_pcm_runtime *runtime = dai->runtime;
355 struct atmel_runtime_data *prtd;
356 struct atmel_pcm_dma_params *params;
357
358 if (!runtime)
359 return 0;
360
361 prtd = runtime->private_data;
362 params = prtd->params;
363
364 /* restore the PDC registers and enable the PDC */
365 ssc_writex(params->ssc->regs, params->pdc->xpr, prtd->pdc_xpr_save);
366 ssc_writex(params->ssc->regs, params->pdc->xcr, prtd->pdc_xcr_save);
367 ssc_writex(params->ssc->regs, params->pdc->xnpr, prtd->pdc_xnpr_save);
368 ssc_writex(params->ssc->regs, params->pdc->xncr, prtd->pdc_xncr_save);
369
370 ssc_writel(params->ssc->regs, PDC_PTCR, params->mask->pdc_enable);
371 return 0;
372}
373#else
374#define atmel_pcm_suspend NULL
375#define atmel_pcm_resume NULL
376#endif
377
378static struct snd_soc_platform_driver atmel_soc_platform = { 317static struct snd_soc_platform_driver atmel_soc_platform = {
379 .ops = &atmel_pcm_ops, 318 .ops = &atmel_pcm_ops,
380 .pcm_new = atmel_pcm_new, 319 .pcm_new = atmel_pcm_new,
381 .pcm_free = atmel_pcm_free, 320 .pcm_free = atmel_pcm_free,
382 .suspend = atmel_pcm_suspend,
383 .resume = atmel_pcm_resume,
384}; 321};
385 322
386int atmel_pcm_pdc_platform_register(struct device *dev) 323int atmel_pcm_pdc_platform_register(struct device *dev)
diff --git a/sound/soc/soc-compress.c b/sound/soc/soc-compress.c
index 91083e6a6b38..10f7f1da2aca 100644
--- a/sound/soc/soc-compress.c
+++ b/sound/soc/soc-compress.c
@@ -203,7 +203,6 @@ static int soc_compr_free(struct snd_compr_stream *cstream)
203 203
204 if (platform->driver->compr_ops && platform->driver->compr_ops->free) 204 if (platform->driver->compr_ops && platform->driver->compr_ops->free)
205 platform->driver->compr_ops->free(cstream); 205 platform->driver->compr_ops->free(cstream);
206 cpu_dai->runtime = NULL;
207 206
208 if (cstream->direction == SND_COMPRESS_PLAYBACK) { 207 if (cstream->direction == SND_COMPRESS_PLAYBACK) {
209 if (snd_soc_runtime_ignore_pmdown_time(rtd)) { 208 if (snd_soc_runtime_ignore_pmdown_time(rtd)) {
@@ -317,8 +316,9 @@ static int soc_compr_trigger_fe(struct snd_compr_stream *cstream, int cmd)
317 cmd == SND_COMPR_TRIGGER_DRAIN) { 316 cmd == SND_COMPR_TRIGGER_DRAIN) {
318 317
319 if (platform->driver->compr_ops && 318 if (platform->driver->compr_ops &&
320 platform->driver->compr_ops->trigger) 319 platform->driver->compr_ops->trigger)
321 return platform->driver->compr_ops->trigger(cstream, cmd); 320 return platform->driver->compr_ops->trigger(cstream,
321 cmd);
322 } 322 }
323 323
324 if (cstream->direction == SND_COMPRESS_PLAYBACK) 324 if (cstream->direction == SND_COMPRESS_PLAYBACK)
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 4a381b307b08..a675eec64756 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -1017,7 +1017,6 @@ static void soc_remove_codec_dai(struct snd_soc_dai *codec_dai, int order)
1017 codec_dai->name, err); 1017 codec_dai->name, err);
1018 } 1018 }
1019 codec_dai->probed = 0; 1019 codec_dai->probed = 0;
1020 list_del(&codec_dai->card_list);
1021 } 1020 }
1022} 1021}
1023 1022
@@ -1049,7 +1048,6 @@ static void soc_remove_link_dais(struct snd_soc_card *card, int num, int order)
1049 cpu_dai->name, err); 1048 cpu_dai->name, err);
1050 } 1049 }
1051 cpu_dai->probed = 0; 1050 cpu_dai->probed = 0;
1052 list_del(&cpu_dai->card_list);
1053 1051
1054 if (!cpu_dai->codec) { 1052 if (!cpu_dai->codec) {
1055 snd_soc_dapm_free(&cpu_dai->dapm); 1053 snd_soc_dapm_free(&cpu_dai->dapm);
@@ -1405,7 +1403,6 @@ static int soc_probe_codec_dai(struct snd_soc_card *card,
1405 1403
1406 /* mark codec_dai as probed and add to card dai list */ 1404 /* mark codec_dai as probed and add to card dai list */
1407 codec_dai->probed = 1; 1405 codec_dai->probed = 1;
1408 list_add(&codec_dai->card_list, &card->dai_dev_list);
1409 } 1406 }
1410 1407
1411 return 0; 1408 return 0;
@@ -1490,8 +1487,6 @@ static int soc_probe_link_dais(struct snd_soc_card *card, int num, int order)
1490 } 1487 }
1491 } 1488 }
1492 cpu_dai->probed = 1; 1489 cpu_dai->probed = 1;
1493 /* mark cpu_dai as probed and add to card dai list */
1494 list_add(&cpu_dai->card_list, &card->dai_dev_list);
1495 } 1490 }
1496 1491
1497 /* probe the CODEC DAI */ 1492 /* probe the CODEC DAI */
@@ -3205,6 +3200,18 @@ out:
3205} 3200}
3206EXPORT_SYMBOL_GPL(snd_soc_bytes_put); 3201EXPORT_SYMBOL_GPL(snd_soc_bytes_put);
3207 3202
3203int snd_soc_bytes_info_ext(struct snd_kcontrol *kcontrol,
3204 struct snd_ctl_elem_info *ucontrol)
3205{
3206 struct soc_bytes_ext *params = (void *)kcontrol->private_value;
3207
3208 ucontrol->type = SNDRV_CTL_ELEM_TYPE_BYTES;
3209 ucontrol->count = params->max;
3210
3211 return 0;
3212}
3213EXPORT_SYMBOL_GPL(snd_soc_bytes_info_ext);
3214
3208/** 3215/**
3209 * snd_soc_info_xr_sx - signed multi register info callback 3216 * snd_soc_info_xr_sx - signed multi register info callback
3210 * @kcontrol: mreg control 3217 * @kcontrol: mreg control
@@ -3738,7 +3745,6 @@ int snd_soc_register_card(struct snd_soc_card *card)
3738 for (i = 0; i < card->num_links; i++) 3745 for (i = 0; i < card->num_links; i++)
3739 card->rtd[i].dai_link = &card->dai_link[i]; 3746 card->rtd[i].dai_link = &card->dai_link[i];
3740 3747
3741 INIT_LIST_HEAD(&card->list);
3742 INIT_LIST_HEAD(&card->dapm_dirty); 3748 INIT_LIST_HEAD(&card->dapm_dirty);
3743 card->instantiated = 0; 3749 card->instantiated = 0;
3744 mutex_init(&card->mutex); 3750 mutex_init(&card->mutex);
@@ -4271,7 +4277,6 @@ int snd_soc_register_codec(struct device *dev,
4271 codec->dapm.stream_event = codec_drv->stream_event; 4277 codec->dapm.stream_event = codec_drv->stream_event;
4272 codec->dev = dev; 4278 codec->dev = dev;
4273 codec->driver = codec_drv; 4279 codec->driver = codec_drv;
4274 codec->num_dai = num_dai;
4275 codec->component.val_bytes = codec_drv->reg_word_size; 4280 codec->component.val_bytes = codec_drv->reg_word_size;
4276 mutex_init(&codec->mutex); 4281 mutex_init(&codec->mutex);
4277 4282
@@ -4697,7 +4702,7 @@ int snd_soc_of_get_dai_name(struct device_node *of_node,
4697 4702
4698 if (id < 0 || id >= pos->num_dai) { 4703 if (id < 0 || id >= pos->num_dai) {
4699 ret = -EINVAL; 4704 ret = -EINVAL;
4700 break; 4705 continue;
4701 } 4706 }
4702 4707
4703 ret = 0; 4708 ret = 0;
diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c
index a391de058037..d2b950c99d88 100644
--- a/sound/soc/soc-pcm.c
+++ b/sound/soc/soc-pcm.c
@@ -555,7 +555,6 @@ static int soc_pcm_close(struct snd_pcm_substream *substream)
555 555
556 if (platform->driver->ops && platform->driver->ops->close) 556 if (platform->driver->ops && platform->driver->ops->close)
557 platform->driver->ops->close(substream); 557 platform->driver->ops->close(substream);
558 cpu_dai->runtime = NULL;
559 558
560 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { 559 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
561 if (snd_soc_runtime_ignore_pmdown_time(rtd)) { 560 if (snd_soc_runtime_ignore_pmdown_time(rtd)) {