aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/intel/sst-mfld-platform-pcm.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/soc/intel/sst-mfld-platform-pcm.c')
-rw-r--r--sound/soc/intel/sst-mfld-platform-pcm.c154
1 files changed, 126 insertions, 28 deletions
diff --git a/sound/soc/intel/sst-mfld-platform-pcm.c b/sound/soc/intel/sst-mfld-platform-pcm.c
index aa9b600dfc9b..6032f18693be 100644
--- a/sound/soc/intel/sst-mfld-platform-pcm.c
+++ b/sound/soc/intel/sst-mfld-platform-pcm.c
@@ -101,35 +101,11 @@ static struct sst_dev_stream_map dpcm_strm_map[] = {
101 {MERR_DPCM_AUDIO, 0, SNDRV_PCM_STREAM_CAPTURE, PIPE_PCM1_OUT, SST_TASK_ID_MEDIA, 0}, 101 {MERR_DPCM_AUDIO, 0, SNDRV_PCM_STREAM_CAPTURE, PIPE_PCM1_OUT, SST_TASK_ID_MEDIA, 0},
102}; 102};
103 103
104/* MFLD - MSIC */ 104static int sst_media_digital_mute(struct snd_soc_dai *dai, int mute, int stream)
105static struct snd_soc_dai_driver sst_platform_dai[] = {
106{ 105{
107 .name = "Headset-cpu-dai", 106
108 .id = 0, 107 return sst_send_pipe_gains(dai, stream, mute);
109 .playback = { 108}
110 .channels_min = SST_STEREO,
111 .channels_max = SST_STEREO,
112 .rates = SNDRV_PCM_RATE_48000,
113 .formats = SNDRV_PCM_FMTBIT_S24_LE,
114 },
115 .capture = {
116 .channels_min = 1,
117 .channels_max = 5,
118 .rates = SNDRV_PCM_RATE_48000,
119 .formats = SNDRV_PCM_FMTBIT_S24_LE,
120 },
121},
122{
123 .name = "Compress-cpu-dai",
124 .compress_dai = 1,
125 .playback = {
126 .channels_min = SST_STEREO,
127 .channels_max = SST_STEREO,
128 .rates = SNDRV_PCM_RATE_44100|SNDRV_PCM_RATE_48000,
129 .formats = SNDRV_PCM_FMTBIT_S16_LE,
130 },
131},
132};
133 109
134/* helper functions */ 110/* helper functions */
135void sst_set_stream_status(struct sst_runtime_stream *stream, 111void sst_set_stream_status(struct sst_runtime_stream *stream,
@@ -451,12 +427,133 @@ static int sst_media_hw_free(struct snd_pcm_substream *substream,
451 return snd_pcm_lib_free_pages(substream); 427 return snd_pcm_lib_free_pages(substream);
452} 428}
453 429
430static int sst_enable_ssp(struct snd_pcm_substream *substream,
431 struct snd_soc_dai *dai)
432{
433 int ret = 0;
434
435 if (!dai->active) {
436 ret = sst_handle_vb_timer(dai, true);
437 if (ret)
438 return ret;
439 ret = send_ssp_cmd(dai, dai->name, 1);
440 }
441 return ret;
442}
443
444static void sst_disable_ssp(struct snd_pcm_substream *substream,
445 struct snd_soc_dai *dai)
446{
447 if (!dai->active) {
448 send_ssp_cmd(dai, dai->name, 0);
449 sst_handle_vb_timer(dai, false);
450 }
451}
452
454static struct snd_soc_dai_ops sst_media_dai_ops = { 453static struct snd_soc_dai_ops sst_media_dai_ops = {
455 .startup = sst_media_open, 454 .startup = sst_media_open,
456 .shutdown = sst_media_close, 455 .shutdown = sst_media_close,
457 .prepare = sst_media_prepare, 456 .prepare = sst_media_prepare,
458 .hw_params = sst_media_hw_params, 457 .hw_params = sst_media_hw_params,
459 .hw_free = sst_media_hw_free, 458 .hw_free = sst_media_hw_free,
459 .mute_stream = sst_media_digital_mute,
460};
461
462static struct snd_soc_dai_ops sst_compr_dai_ops = {
463 .mute_stream = sst_media_digital_mute,
464};
465
466static struct snd_soc_dai_ops sst_be_dai_ops = {
467 .startup = sst_enable_ssp,
468 .shutdown = sst_disable_ssp,
469};
470
471static struct snd_soc_dai_driver sst_platform_dai[] = {
472{
473 .name = "media-cpu-dai",
474 .ops = &sst_media_dai_ops,
475 .playback = {
476 .stream_name = "Headset Playback",
477 .channels_min = SST_STEREO,
478 .channels_max = SST_STEREO,
479 .rates = SNDRV_PCM_RATE_44100|SNDRV_PCM_RATE_48000,
480 .formats = SNDRV_PCM_FMTBIT_S16_LE,
481 },
482 .capture = {
483 .stream_name = "Headset Capture",
484 .channels_min = 1,
485 .channels_max = 2,
486 .rates = SNDRV_PCM_RATE_44100|SNDRV_PCM_RATE_48000,
487 .formats = SNDRV_PCM_FMTBIT_S16_LE,
488 },
489},
490{
491 .name = "compress-cpu-dai",
492 .compress_dai = 1,
493 .ops = &sst_compr_dai_ops,
494 .playback = {
495 .stream_name = "Compress Playback",
496 .channels_min = SST_STEREO,
497 .channels_max = SST_STEREO,
498 .rates = SNDRV_PCM_RATE_48000,
499 .formats = SNDRV_PCM_FMTBIT_S16_LE,
500 },
501},
502/* BE CPU Dais */
503{
504 .name = "ssp0-port",
505 .ops = &sst_be_dai_ops,
506 .playback = {
507 .stream_name = "ssp0 Tx",
508 .channels_min = SST_STEREO,
509 .channels_max = SST_STEREO,
510 .rates = SNDRV_PCM_RATE_48000,
511 .formats = SNDRV_PCM_FMTBIT_S16_LE,
512 },
513 .capture = {
514 .stream_name = "ssp0 Rx",
515 .channels_min = SST_STEREO,
516 .channels_max = SST_STEREO,
517 .rates = SNDRV_PCM_RATE_48000,
518 .formats = SNDRV_PCM_FMTBIT_S16_LE,
519 },
520},
521{
522 .name = "ssp1-port",
523 .ops = &sst_be_dai_ops,
524 .playback = {
525 .stream_name = "ssp1 Tx",
526 .channels_min = SST_STEREO,
527 .channels_max = SST_STEREO,
528 .rates = SNDRV_PCM_RATE_8000|SNDRV_PCM_RATE_16000|SNDRV_PCM_RATE_48000,
529 .formats = SNDRV_PCM_FMTBIT_S16_LE,
530 },
531 .capture = {
532 .stream_name = "ssp1 Rx",
533 .channels_min = SST_STEREO,
534 .channels_max = SST_STEREO,
535 .rates = SNDRV_PCM_RATE_8000|SNDRV_PCM_RATE_16000|SNDRV_PCM_RATE_48000,
536 .formats = SNDRV_PCM_FMTBIT_S16_LE,
537 },
538},
539{
540 .name = "ssp2-port",
541 .ops = &sst_be_dai_ops,
542 .playback = {
543 .stream_name = "ssp2 Tx",
544 .channels_min = SST_STEREO,
545 .channels_max = SST_STEREO,
546 .rates = SNDRV_PCM_RATE_48000,
547 .formats = SNDRV_PCM_FMTBIT_S16_LE,
548 },
549 .capture = {
550 .stream_name = "ssp2 Rx",
551 .channels_min = SST_STEREO,
552 .channels_max = SST_STEREO,
553 .rates = SNDRV_PCM_RATE_48000,
554 .formats = SNDRV_PCM_FMTBIT_S16_LE,
555 },
556},
460}; 557};
461 558
462static int sst_platform_open(struct snd_pcm_substream *substream) 559static int sst_platform_open(struct snd_pcm_substream *substream)
@@ -609,6 +706,7 @@ static int sst_platform_probe(struct platform_device *pdev)
609 pdata->pdev_strm_map = dpcm_strm_map; 706 pdata->pdev_strm_map = dpcm_strm_map;
610 pdata->strm_map_size = ARRAY_SIZE(dpcm_strm_map); 707 pdata->strm_map_size = ARRAY_SIZE(dpcm_strm_map);
611 drv->pdata = pdata; 708 drv->pdata = pdata;
709 drv->pdev = pdev;
612 mutex_init(&drv->lock); 710 mutex_init(&drv->lock);
613 dev_set_drvdata(&pdev->dev, drv); 711 dev_set_drvdata(&pdev->dev, drv);
614 712