2 * Intel SST Haswell/Broadwell PCM Support
4 * Copyright (C) 2013, Intel Corporation. All rights reserved.
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License version
8 * 2 as published by the Free Software Foundation.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
17 #include <linux/module.h>
18 #include <linux/dma-mapping.h>
19 #include <linux/slab.h>
20 #include <linux/delay.h>
21 #include <linux/pm_runtime.h>
23 #include <asm/pgtable.h>
24 #include <sound/core.h>
25 #include <sound/pcm.h>
26 #include <sound/pcm_params.h>
27 #include <sound/dmaengine_pcm.h>
28 #include <sound/soc.h>
29 #include <sound/tlv.h>
30 #include <sound/compress_driver.h>
32 #include "../haswell/sst-haswell-ipc.h"
33 #include "../common/sst-dsp-priv.h"
34 #include "../common/sst-dsp.h"
36 #define HSW_PCM_COUNT 6
37 #define HSW_VOLUME_MAX 0x7FFFFFFF /* 0dB */
39 #define SST_OLD_POSITION(d, r, o) ((d) + \
40 frames_to_bytes(r, o))
41 #define SST_SAMPLES(r, x) (bytes_to_samples(r, \
42 frames_to_bytes(r, (x))))
44 /* simple volume table */
45 static const u32 volume_map[] = {
79 #define HSW_PCM_PERIODS_MAX 64
80 #define HSW_PCM_PERIODS_MIN 2
82 #define HSW_PCM_DAI_ID_SYSTEM 0
83 #define HSW_PCM_DAI_ID_OFFLOAD0 1
84 #define HSW_PCM_DAI_ID_OFFLOAD1 2
85 #define HSW_PCM_DAI_ID_LOOPBACK 3
88 static const struct snd_pcm_hardware hsw_pcm_hardware = {
89 .info = SNDRV_PCM_INFO_MMAP |
90 SNDRV_PCM_INFO_MMAP_VALID |
91 SNDRV_PCM_INFO_INTERLEAVED |
92 SNDRV_PCM_INFO_PAUSE |
93 SNDRV_PCM_INFO_RESUME |
94 SNDRV_PCM_INFO_NO_PERIOD_WAKEUP |
95 SNDRV_PCM_INFO_DRAIN_TRIGGER,
96 .formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_LE |
97 SNDRV_PCM_FMTBIT_S32_LE,
98 .period_bytes_min = PAGE_SIZE,
99 .period_bytes_max = (HSW_PCM_PERIODS_MAX / HSW_PCM_PERIODS_MIN) * PAGE_SIZE,
100 .periods_min = HSW_PCM_PERIODS_MIN,
101 .periods_max = HSW_PCM_PERIODS_MAX,
102 .buffer_bytes_max = HSW_PCM_PERIODS_MAX * PAGE_SIZE,
105 struct hsw_pcm_module_map {
108 enum sst_hsw_module_id mod_id;
111 /* private data for each PCM DSP stream */
112 struct hsw_pcm_data {
114 struct sst_hsw_stream *stream;
115 struct sst_module_runtime *runtime;
116 struct sst_module_runtime_context context;
117 struct snd_pcm *hsw_pcm;
119 struct snd_pcm_substream *substream;
120 struct snd_compr_stream *cstream;
124 int persistent_offset;
129 HSW_PM_STATE_RTD3 = 1,
133 /* private data for the driver */
134 struct hsw_priv_data {
138 enum hsw_pm_state pm_state;
139 struct snd_soc_card *soc_card;
140 struct sst_module_runtime *runtime_waves; /* sound effect module */
143 struct snd_dma_buffer dmab[HSW_PCM_COUNT][2];
146 struct hsw_pcm_data pcm[HSW_PCM_COUNT][2];
150 /* static mappings between PCMs and modules - may be dynamic in future */
151 static struct hsw_pcm_module_map mod_map[] = {
152 {HSW_PCM_DAI_ID_SYSTEM, 0, SST_HSW_MODULE_PCM_SYSTEM},
153 {HSW_PCM_DAI_ID_OFFLOAD0, 0, SST_HSW_MODULE_PCM},
154 {HSW_PCM_DAI_ID_OFFLOAD1, 0, SST_HSW_MODULE_PCM},
155 {HSW_PCM_DAI_ID_LOOPBACK, 1, SST_HSW_MODULE_PCM_REFERENCE},
156 {HSW_PCM_DAI_ID_SYSTEM, 1, SST_HSW_MODULE_PCM_CAPTURE},
159 static u32 hsw_notify_pointer(struct sst_hsw_stream *stream, void *data);
161 static inline u32 hsw_mixer_to_ipc(unsigned int value)
163 if (value >= ARRAY_SIZE(volume_map))
164 return volume_map[0];
166 return volume_map[value];
169 static inline unsigned int hsw_ipc_to_mixer(u32 value)
173 for (i = 0; i < ARRAY_SIZE(volume_map); i++) {
174 if (volume_map[i] >= value)
181 static int hsw_stream_volume_put(struct snd_kcontrol *kcontrol,
182 struct snd_ctl_elem_value *ucontrol)
184 struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
185 struct soc_mixer_control *mc =
186 (struct soc_mixer_control *)kcontrol->private_value;
187 struct hsw_priv_data *pdata =
188 snd_soc_component_get_drvdata(component);
189 struct hsw_pcm_data *pcm_data;
190 struct sst_hsw *hsw = pdata->hsw;
194 dai = mod_map[mc->reg].dai_id;
195 stream = mod_map[mc->reg].stream;
196 pcm_data = &pdata->pcm[dai][stream];
198 mutex_lock(&pcm_data->mutex);
199 pm_runtime_get_sync(pdata->dev);
201 if (!pcm_data->stream) {
202 pcm_data->volume[0] =
203 hsw_mixer_to_ipc(ucontrol->value.integer.value[0]);
204 pcm_data->volume[1] =
205 hsw_mixer_to_ipc(ucontrol->value.integer.value[1]);
206 pm_runtime_mark_last_busy(pdata->dev);
207 pm_runtime_put_autosuspend(pdata->dev);
208 mutex_unlock(&pcm_data->mutex);
212 if (ucontrol->value.integer.value[0] ==
213 ucontrol->value.integer.value[1]) {
214 volume = hsw_mixer_to_ipc(ucontrol->value.integer.value[0]);
215 /* apply volume value to all channels */
216 sst_hsw_stream_set_volume(hsw, pcm_data->stream, 0, SST_HSW_CHANNELS_ALL, volume);
218 volume = hsw_mixer_to_ipc(ucontrol->value.integer.value[0]);
219 sst_hsw_stream_set_volume(hsw, pcm_data->stream, 0, 0, volume);
220 volume = hsw_mixer_to_ipc(ucontrol->value.integer.value[1]);
221 sst_hsw_stream_set_volume(hsw, pcm_data->stream, 0, 1, volume);
224 pm_runtime_mark_last_busy(pdata->dev);
225 pm_runtime_put_autosuspend(pdata->dev);
226 mutex_unlock(&pcm_data->mutex);
230 static int hsw_stream_volume_get(struct snd_kcontrol *kcontrol,
231 struct snd_ctl_elem_value *ucontrol)
233 struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
234 struct soc_mixer_control *mc =
235 (struct soc_mixer_control *)kcontrol->private_value;
236 struct hsw_priv_data *pdata =
237 snd_soc_component_get_drvdata(component);
238 struct hsw_pcm_data *pcm_data;
239 struct sst_hsw *hsw = pdata->hsw;
243 dai = mod_map[mc->reg].dai_id;
244 stream = mod_map[mc->reg].stream;
245 pcm_data = &pdata->pcm[dai][stream];
247 mutex_lock(&pcm_data->mutex);
248 pm_runtime_get_sync(pdata->dev);
250 if (!pcm_data->stream) {
251 ucontrol->value.integer.value[0] =
252 hsw_ipc_to_mixer(pcm_data->volume[0]);
253 ucontrol->value.integer.value[1] =
254 hsw_ipc_to_mixer(pcm_data->volume[1]);
255 pm_runtime_mark_last_busy(pdata->dev);
256 pm_runtime_put_autosuspend(pdata->dev);
257 mutex_unlock(&pcm_data->mutex);
261 sst_hsw_stream_get_volume(hsw, pcm_data->stream, 0, 0, &volume);
262 ucontrol->value.integer.value[0] = hsw_ipc_to_mixer(volume);
263 sst_hsw_stream_get_volume(hsw, pcm_data->stream, 0, 1, &volume);
264 ucontrol->value.integer.value[1] = hsw_ipc_to_mixer(volume);
266 pm_runtime_mark_last_busy(pdata->dev);
267 pm_runtime_put_autosuspend(pdata->dev);
268 mutex_unlock(&pcm_data->mutex);
273 static int hsw_volume_put(struct snd_kcontrol *kcontrol,
274 struct snd_ctl_elem_value *ucontrol)
276 struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
277 struct hsw_priv_data *pdata = snd_soc_component_get_drvdata(component);
278 struct sst_hsw *hsw = pdata->hsw;
281 pm_runtime_get_sync(pdata->dev);
283 if (ucontrol->value.integer.value[0] ==
284 ucontrol->value.integer.value[1]) {
286 volume = hsw_mixer_to_ipc(ucontrol->value.integer.value[0]);
287 sst_hsw_mixer_set_volume(hsw, 0, SST_HSW_CHANNELS_ALL, volume);
290 volume = hsw_mixer_to_ipc(ucontrol->value.integer.value[0]);
291 sst_hsw_mixer_set_volume(hsw, 0, 0, volume);
293 volume = hsw_mixer_to_ipc(ucontrol->value.integer.value[1]);
294 sst_hsw_mixer_set_volume(hsw, 0, 1, volume);
297 pm_runtime_mark_last_busy(pdata->dev);
298 pm_runtime_put_autosuspend(pdata->dev);
302 static int hsw_volume_get(struct snd_kcontrol *kcontrol,
303 struct snd_ctl_elem_value *ucontrol)
305 struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
306 struct hsw_priv_data *pdata = snd_soc_component_get_drvdata(component);
307 struct sst_hsw *hsw = pdata->hsw;
308 unsigned int volume = 0;
310 pm_runtime_get_sync(pdata->dev);
311 sst_hsw_mixer_get_volume(hsw, 0, 0, &volume);
312 ucontrol->value.integer.value[0] = hsw_ipc_to_mixer(volume);
314 sst_hsw_mixer_get_volume(hsw, 0, 1, &volume);
315 ucontrol->value.integer.value[1] = hsw_ipc_to_mixer(volume);
317 pm_runtime_mark_last_busy(pdata->dev);
318 pm_runtime_put_autosuspend(pdata->dev);
322 static int hsw_waves_switch_get(struct snd_kcontrol *kcontrol,
323 struct snd_ctl_elem_value *ucontrol)
325 struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
326 struct hsw_priv_data *pdata = snd_soc_component_get_drvdata(component);
327 struct sst_hsw *hsw = pdata->hsw;
328 enum sst_hsw_module_id id = SST_HSW_MODULE_WAVES;
330 ucontrol->value.integer.value[0] =
331 (sst_hsw_is_module_active(hsw, id) ||
332 sst_hsw_is_module_enabled_rtd3(hsw, id));
336 static int hsw_waves_switch_put(struct snd_kcontrol *kcontrol,
337 struct snd_ctl_elem_value *ucontrol)
339 struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
340 struct hsw_priv_data *pdata = snd_soc_component_get_drvdata(component);
341 struct sst_hsw *hsw = pdata->hsw;
343 enum sst_hsw_module_id id = SST_HSW_MODULE_WAVES;
344 bool switch_on = (bool)ucontrol->value.integer.value[0];
346 /* if module is in RAM on the DSP, apply user settings to module through
347 * ipc. If module is not in RAM on the DSP, store user setting for
349 if (sst_hsw_is_module_loaded(hsw, id)) {
350 if (switch_on == sst_hsw_is_module_active(hsw, id))
354 ret = sst_hsw_module_enable(hsw, id, 0);
356 ret = sst_hsw_module_disable(hsw, id, 0);
358 if (switch_on == sst_hsw_is_module_enabled_rtd3(hsw, id))
362 sst_hsw_set_module_enabled_rtd3(hsw, id);
364 sst_hsw_set_module_disabled_rtd3(hsw, id);
370 static int hsw_waves_param_get(struct snd_kcontrol *kcontrol,
371 struct snd_ctl_elem_value *ucontrol)
373 struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
374 struct hsw_priv_data *pdata = snd_soc_component_get_drvdata(component);
375 struct sst_hsw *hsw = pdata->hsw;
377 /* return a matching line from param buffer */
378 return sst_hsw_load_param_line(hsw, ucontrol->value.bytes.data);
381 static int hsw_waves_param_put(struct snd_kcontrol *kcontrol,
382 struct snd_ctl_elem_value *ucontrol)
384 struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
385 struct hsw_priv_data *pdata = snd_soc_component_get_drvdata(component);
386 struct sst_hsw *hsw = pdata->hsw;
388 enum sst_hsw_module_id id = SST_HSW_MODULE_WAVES;
389 int param_id = ucontrol->value.bytes.data[0];
390 int param_size = WAVES_PARAM_COUNT;
392 /* clear param buffer and reset buffer index */
393 if (param_id == 0xFF) {
394 sst_hsw_reset_param_buf(hsw);
398 /* store params into buffer */
399 ret = sst_hsw_store_param_line(hsw, ucontrol->value.bytes.data);
403 if (sst_hsw_is_module_active(hsw, id))
404 ret = sst_hsw_module_set_param(hsw, id, 0, param_id,
405 param_size, ucontrol->value.bytes.data);
409 /* TLV used by both global and stream volumes */
410 static const DECLARE_TLV_DB_SCALE(hsw_vol_tlv, -9000, 300, 1);
412 /* System Pin has no volume control */
413 static const struct snd_kcontrol_new hsw_volume_controls[] = {
414 /* Global DSP volume */
415 SOC_DOUBLE_EXT_TLV("Master Playback Volume", 0, 0, 8,
416 ARRAY_SIZE(volume_map) - 1, 0,
417 hsw_volume_get, hsw_volume_put, hsw_vol_tlv),
418 /* Offload 0 volume */
419 SOC_DOUBLE_EXT_TLV("Media0 Playback Volume", 1, 0, 8,
420 ARRAY_SIZE(volume_map) - 1, 0,
421 hsw_stream_volume_get, hsw_stream_volume_put, hsw_vol_tlv),
422 /* Offload 1 volume */
423 SOC_DOUBLE_EXT_TLV("Media1 Playback Volume", 2, 0, 8,
424 ARRAY_SIZE(volume_map) - 1, 0,
425 hsw_stream_volume_get, hsw_stream_volume_put, hsw_vol_tlv),
426 /* Mic Capture volume */
427 SOC_DOUBLE_EXT_TLV("Mic Capture Volume", 4, 0, 8,
428 ARRAY_SIZE(volume_map) - 1, 0,
429 hsw_stream_volume_get, hsw_stream_volume_put, hsw_vol_tlv),
430 /* enable/disable module waves */
431 SOC_SINGLE_BOOL_EXT("Waves Switch", 0,
432 hsw_waves_switch_get, hsw_waves_switch_put),
433 /* set parameters to module waves */
434 SND_SOC_BYTES_EXT("Waves Set Param", WAVES_PARAM_COUNT,
435 hsw_waves_param_get, hsw_waves_param_put),
438 /* Create DMA buffer page table for DSP */
439 static int create_adsp_page_table(struct snd_pcm_substream *substream,
440 struct hsw_priv_data *pdata, struct snd_soc_pcm_runtime *rtd,
441 unsigned char *dma_area, size_t size, int pcm)
443 struct snd_dma_buffer *dmab = snd_pcm_get_dma_buf(substream);
444 int i, pages, stream = substream->stream;
446 pages = snd_sgbuf_aligned_pages(size);
448 dev_dbg(rtd->dev, "generating page table for %p size 0x%zx pages %d\n",
449 dma_area, size, pages);
451 for (i = 0; i < pages; i++) {
452 u32 idx = (((i << 2) + i)) >> 1;
453 u32 pfn = snd_sgbuf_get_addr(dmab, i * PAGE_SIZE) >> PAGE_SHIFT;
456 dev_dbg(rtd->dev, "pfn i %i idx %d pfn %x\n", i, idx, pfn);
458 pg_table = (u32 *)(pdata->dmab[pcm][stream].area + idx);
461 *pg_table |= (pfn << 4);
469 /* this may get called several times by oss emulation */
470 static int hsw_pcm_hw_params(struct snd_pcm_substream *substream,
471 struct snd_pcm_hw_params *params)
473 struct snd_soc_pcm_runtime *rtd = substream->private_data;
474 struct snd_pcm_runtime *runtime = substream->runtime;
475 struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
476 struct hsw_priv_data *pdata = snd_soc_component_get_drvdata(component);
477 struct hsw_pcm_data *pcm_data;
478 struct sst_hsw *hsw = pdata->hsw;
479 struct sst_module *module_data;
481 struct snd_dma_buffer *dmab;
482 enum sst_hsw_stream_type stream_type;
483 enum sst_hsw_stream_path_id path_id;
484 u32 rate, bits, map, pages, module_id;
488 dai = mod_map[rtd->cpu_dai->id].dai_id;
489 pcm_data = &pdata->pcm[dai][substream->stream];
491 /* check if we are being called a subsequent time */
492 if (pcm_data->allocated) {
493 ret = sst_hsw_stream_reset(hsw, pcm_data->stream);
495 dev_dbg(rtd->dev, "error: reset stream failed %d\n",
498 ret = sst_hsw_stream_free(hsw, pcm_data->stream);
500 dev_dbg(rtd->dev, "error: free stream failed %d\n",
504 pcm_data->allocated = false;
506 pcm_data->stream = sst_hsw_stream_new(hsw, rtd->cpu_dai->id,
507 hsw_notify_pointer, pcm_data);
508 if (pcm_data->stream == NULL) {
509 dev_err(rtd->dev, "error: failed to create stream\n");
514 /* stream direction */
515 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
516 path_id = SST_HSW_STREAM_PATH_SSP0_OUT;
518 path_id = SST_HSW_STREAM_PATH_SSP0_IN;
520 /* DSP stream type depends on DAI ID */
521 switch (rtd->cpu_dai->id) {
523 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
524 stream_type = SST_HSW_STREAM_TYPE_SYSTEM;
525 module_id = SST_HSW_MODULE_PCM_SYSTEM;
528 stream_type = SST_HSW_STREAM_TYPE_CAPTURE;
529 module_id = SST_HSW_MODULE_PCM_CAPTURE;
534 stream_type = SST_HSW_STREAM_TYPE_RENDER;
535 module_id = SST_HSW_MODULE_PCM;
538 /* path ID needs to be OUT for loopback */
539 stream_type = SST_HSW_STREAM_TYPE_LOOPBACK;
540 path_id = SST_HSW_STREAM_PATH_SSP0_OUT;
541 module_id = SST_HSW_MODULE_PCM_REFERENCE;
544 dev_err(rtd->dev, "error: invalid DAI ID %d\n",
549 ret = sst_hsw_stream_format(hsw, pcm_data->stream,
550 path_id, stream_type, SST_HSW_STREAM_FORMAT_PCM_FORMAT);
552 dev_err(rtd->dev, "error: failed to set format %d\n", ret);
556 rate = params_rate(params);
557 ret = sst_hsw_stream_set_rate(hsw, pcm_data->stream, rate);
559 dev_err(rtd->dev, "error: could not set rate %d\n", rate);
563 switch (params_format(params)) {
564 case SNDRV_PCM_FORMAT_S16_LE:
565 bits = SST_HSW_DEPTH_16BIT;
566 sst_hsw_stream_set_valid(hsw, pcm_data->stream, 16);
568 case SNDRV_PCM_FORMAT_S24_LE:
569 bits = SST_HSW_DEPTH_32BIT;
570 sst_hsw_stream_set_valid(hsw, pcm_data->stream, 24);
572 case SNDRV_PCM_FORMAT_S8:
573 bits = SST_HSW_DEPTH_8BIT;
574 sst_hsw_stream_set_valid(hsw, pcm_data->stream, 8);
576 case SNDRV_PCM_FORMAT_S32_LE:
577 bits = SST_HSW_DEPTH_32BIT;
578 sst_hsw_stream_set_valid(hsw, pcm_data->stream, 32);
581 dev_err(rtd->dev, "error: invalid format %d\n",
582 params_format(params));
586 ret = sst_hsw_stream_set_bits(hsw, pcm_data->stream, bits);
588 dev_err(rtd->dev, "error: could not set bits %d\n", bits);
592 channels = params_channels(params);
593 map = create_channel_map(SST_HSW_CHANNEL_CONFIG_STEREO);
594 sst_hsw_stream_set_map_config(hsw, pcm_data->stream,
595 map, SST_HSW_CHANNEL_CONFIG_STEREO);
597 ret = sst_hsw_stream_set_channels(hsw, pcm_data->stream, channels);
599 dev_err(rtd->dev, "error: could not set channels %d\n",
604 ret = snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(params));
606 dev_err(rtd->dev, "error: could not allocate %d bytes for PCM %d\n",
607 params_buffer_bytes(params), ret);
611 dmab = snd_pcm_get_dma_buf(substream);
613 ret = create_adsp_page_table(substream, pdata, rtd, runtime->dma_area,
614 runtime->dma_bytes, rtd->cpu_dai->id);
618 sst_hsw_stream_set_style(hsw, pcm_data->stream,
619 SST_HSW_INTERLEAVING_PER_CHANNEL);
621 if (runtime->dma_bytes % PAGE_SIZE)
622 pages = (runtime->dma_bytes / PAGE_SIZE) + 1;
624 pages = runtime->dma_bytes / PAGE_SIZE;
626 ret = sst_hsw_stream_buffer(hsw, pcm_data->stream,
627 pdata->dmab[rtd->cpu_dai->id][substream->stream].addr,
628 pages, runtime->dma_bytes, 0,
629 snd_sgbuf_get_addr(dmab, 0) >> PAGE_SHIFT);
631 dev_err(rtd->dev, "error: failed to set DMA buffer %d\n", ret);
635 dsp = sst_hsw_get_dsp(hsw);
637 module_data = sst_module_get_from_id(dsp, module_id);
638 if (module_data == NULL) {
639 dev_err(rtd->dev, "error: failed to get module config\n");
643 sst_hsw_stream_set_module_info(hsw, pcm_data->stream,
646 ret = sst_hsw_stream_commit(hsw, pcm_data->stream);
648 dev_err(rtd->dev, "error: failed to commit stream %d\n", ret);
652 if (!pcm_data->allocated) {
653 /* Set previous saved volume */
654 sst_hsw_stream_set_volume(hsw, pcm_data->stream, 0,
655 0, pcm_data->volume[0]);
656 sst_hsw_stream_set_volume(hsw, pcm_data->stream, 0,
657 1, pcm_data->volume[1]);
658 pcm_data->allocated = true;
661 ret = sst_hsw_stream_pause(hsw, pcm_data->stream, 1);
663 dev_err(rtd->dev, "error: failed to pause %d\n", ret);
668 static int hsw_pcm_hw_free(struct snd_pcm_substream *substream)
670 snd_pcm_lib_free_pages(substream);
674 static int hsw_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
676 struct snd_soc_pcm_runtime *rtd = substream->private_data;
677 struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
678 struct hsw_priv_data *pdata = snd_soc_component_get_drvdata(component);
679 struct hsw_pcm_data *pcm_data;
680 struct sst_hsw_stream *sst_stream;
681 struct sst_hsw *hsw = pdata->hsw;
682 struct snd_pcm_runtime *runtime = substream->runtime;
683 snd_pcm_uframes_t pos;
686 dai = mod_map[rtd->cpu_dai->id].dai_id;
687 pcm_data = &pdata->pcm[dai][substream->stream];
688 sst_stream = pcm_data->stream;
691 case SNDRV_PCM_TRIGGER_START:
692 case SNDRV_PCM_TRIGGER_RESUME:
693 case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
694 sst_hsw_stream_set_silence_start(hsw, sst_stream, false);
695 sst_hsw_stream_resume(hsw, pcm_data->stream, 0);
697 case SNDRV_PCM_TRIGGER_STOP:
698 case SNDRV_PCM_TRIGGER_SUSPEND:
699 case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
700 sst_hsw_stream_set_silence_start(hsw, sst_stream, false);
701 sst_hsw_stream_pause(hsw, pcm_data->stream, 0);
703 case SNDRV_PCM_TRIGGER_DRAIN:
704 pos = runtime->control->appl_ptr % runtime->buffer_size;
705 sst_hsw_stream_set_old_position(hsw, pcm_data->stream, pos);
706 sst_hsw_stream_set_silence_start(hsw, sst_stream, true);
715 static u32 hsw_notify_pointer(struct sst_hsw_stream *stream, void *data)
717 struct hsw_pcm_data *pcm_data = data;
718 struct snd_pcm_substream *substream = pcm_data->substream;
719 struct snd_pcm_runtime *runtime = substream->runtime;
720 struct snd_soc_pcm_runtime *rtd = substream->private_data;
721 struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
722 struct hsw_priv_data *pdata = snd_soc_component_get_drvdata(component);
723 struct sst_hsw *hsw = pdata->hsw;
725 snd_pcm_uframes_t position = bytes_to_frames(runtime,
726 sst_hsw_get_dsp_position(hsw, pcm_data->stream));
727 unsigned char *dma_area = runtime->dma_area;
728 snd_pcm_uframes_t dma_frames =
729 bytes_to_frames(runtime, runtime->dma_bytes);
730 snd_pcm_uframes_t old_position;
733 pos = frames_to_bytes(runtime,
734 (runtime->control->appl_ptr % runtime->buffer_size));
736 dev_vdbg(rtd->dev, "PCM: App pointer %d bytes\n", pos);
738 /* SST fw don't know where to stop dma
739 * So, SST driver need to clean the data which has been consumed
741 if (dma_area == NULL || dma_frames <= 0
742 || (substream->stream == SNDRV_PCM_STREAM_CAPTURE)
743 || !sst_hsw_stream_get_silence_start(hsw, stream)) {
744 snd_pcm_period_elapsed(substream);
748 old_position = sst_hsw_stream_get_old_position(hsw, stream);
749 if (position > old_position) {
750 if (position < dma_frames) {
751 samples = SST_SAMPLES(runtime, position - old_position);
752 snd_pcm_format_set_silence(runtime->format,
753 SST_OLD_POSITION(dma_area,
754 runtime, old_position),
757 dev_err(rtd->dev, "PCM: position is wrong\n");
759 if (old_position < dma_frames) {
760 samples = SST_SAMPLES(runtime,
761 dma_frames - old_position);
762 snd_pcm_format_set_silence(runtime->format,
763 SST_OLD_POSITION(dma_area,
764 runtime, old_position),
767 dev_err(rtd->dev, "PCM: dma_bytes is wrong\n");
768 if (position < dma_frames) {
769 samples = SST_SAMPLES(runtime, position);
770 snd_pcm_format_set_silence(runtime->format,
773 dev_err(rtd->dev, "PCM: position is wrong\n");
775 sst_hsw_stream_set_old_position(hsw, stream, position);
777 /* let alsa know we have play a period */
778 snd_pcm_period_elapsed(substream);
782 static snd_pcm_uframes_t hsw_pcm_pointer(struct snd_pcm_substream *substream)
784 struct snd_soc_pcm_runtime *rtd = substream->private_data;
785 struct snd_pcm_runtime *runtime = substream->runtime;
786 struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
787 struct hsw_priv_data *pdata = snd_soc_component_get_drvdata(component);
788 struct hsw_pcm_data *pcm_data;
789 struct sst_hsw *hsw = pdata->hsw;
790 snd_pcm_uframes_t offset;
795 dai = mod_map[rtd->cpu_dai->id].dai_id;
796 pcm_data = &pdata->pcm[dai][substream->stream];
797 position = sst_hsw_get_dsp_position(hsw, pcm_data->stream);
799 offset = bytes_to_frames(runtime, position);
800 ppos = sst_hsw_get_dsp_presentation_position(hsw, pcm_data->stream);
802 dev_vdbg(rtd->dev, "PCM: DMA pointer %du bytes, pos %llu\n",
807 static int hsw_pcm_open(struct snd_pcm_substream *substream)
809 struct snd_soc_pcm_runtime *rtd = substream->private_data;
810 struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
811 struct hsw_priv_data *pdata = snd_soc_component_get_drvdata(component);
812 struct hsw_pcm_data *pcm_data;
813 struct sst_hsw *hsw = pdata->hsw;
816 dai = mod_map[rtd->cpu_dai->id].dai_id;
817 pcm_data = &pdata->pcm[dai][substream->stream];
819 mutex_lock(&pcm_data->mutex);
820 pm_runtime_get_sync(pdata->dev);
822 pcm_data->substream = substream;
824 snd_soc_set_runtime_hwparams(substream, &hsw_pcm_hardware);
826 pcm_data->stream = sst_hsw_stream_new(hsw, rtd->cpu_dai->id,
827 hsw_notify_pointer, pcm_data);
828 if (pcm_data->stream == NULL) {
829 dev_err(rtd->dev, "error: failed to create stream\n");
830 pm_runtime_mark_last_busy(pdata->dev);
831 pm_runtime_put_autosuspend(pdata->dev);
832 mutex_unlock(&pcm_data->mutex);
836 mutex_unlock(&pcm_data->mutex);
840 static int hsw_pcm_close(struct snd_pcm_substream *substream)
842 struct snd_soc_pcm_runtime *rtd = substream->private_data;
843 struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
844 struct hsw_priv_data *pdata = snd_soc_component_get_drvdata(component);
845 struct hsw_pcm_data *pcm_data;
846 struct sst_hsw *hsw = pdata->hsw;
849 dai = mod_map[rtd->cpu_dai->id].dai_id;
850 pcm_data = &pdata->pcm[dai][substream->stream];
852 mutex_lock(&pcm_data->mutex);
853 ret = sst_hsw_stream_reset(hsw, pcm_data->stream);
855 dev_dbg(rtd->dev, "error: reset stream failed %d\n", ret);
859 ret = sst_hsw_stream_free(hsw, pcm_data->stream);
861 dev_dbg(rtd->dev, "error: free stream failed %d\n", ret);
864 pcm_data->allocated = 0;
865 pcm_data->stream = NULL;
868 pm_runtime_mark_last_busy(pdata->dev);
869 pm_runtime_put_autosuspend(pdata->dev);
870 mutex_unlock(&pcm_data->mutex);
874 static const struct snd_pcm_ops hsw_pcm_ops = {
875 .open = hsw_pcm_open,
876 .close = hsw_pcm_close,
877 .ioctl = snd_pcm_lib_ioctl,
878 .hw_params = hsw_pcm_hw_params,
879 .hw_free = hsw_pcm_hw_free,
880 .trigger = hsw_pcm_trigger,
881 .pointer = hsw_pcm_pointer,
882 .page = snd_pcm_sgbuf_ops_page,
885 static int hsw_pcm_create_modules(struct hsw_priv_data *pdata)
887 struct sst_hsw *hsw = pdata->hsw;
888 struct hsw_pcm_data *pcm_data;
891 for (i = 0; i < ARRAY_SIZE(mod_map); i++) {
892 pcm_data = &pdata->pcm[mod_map[i].dai_id][mod_map[i].stream];
894 /* create new runtime module, use same offset if recreated */
895 pcm_data->runtime = sst_hsw_runtime_module_create(hsw,
896 mod_map[i].mod_id, pcm_data->persistent_offset);
897 if (pcm_data->runtime == NULL)
899 pcm_data->persistent_offset =
900 pcm_data->runtime->persistent_offset;
903 /* create runtime blocks for module waves */
904 if (sst_hsw_is_module_loaded(hsw, SST_HSW_MODULE_WAVES)) {
905 pdata->runtime_waves = sst_hsw_runtime_module_create(hsw,
906 SST_HSW_MODULE_WAVES, 0);
907 if (pdata->runtime_waves == NULL)
914 for (--i; i >= 0; i--) {
915 pcm_data = &pdata->pcm[mod_map[i].dai_id][mod_map[i].stream];
916 sst_hsw_runtime_module_free(pcm_data->runtime);
922 static void hsw_pcm_free_modules(struct hsw_priv_data *pdata)
924 struct sst_hsw *hsw = pdata->hsw;
925 struct hsw_pcm_data *pcm_data;
928 for (i = 0; i < ARRAY_SIZE(mod_map); i++) {
929 pcm_data = &pdata->pcm[mod_map[i].dai_id][mod_map[i].stream];
930 if (pcm_data->runtime){
931 sst_hsw_runtime_module_free(pcm_data->runtime);
932 pcm_data->runtime = NULL;
935 if (sst_hsw_is_module_loaded(hsw, SST_HSW_MODULE_WAVES) &&
936 pdata->runtime_waves) {
937 sst_hsw_runtime_module_free(pdata->runtime_waves);
938 pdata->runtime_waves = NULL;
942 static int hsw_pcm_new(struct snd_soc_pcm_runtime *rtd)
944 struct snd_pcm *pcm = rtd->pcm;
945 struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
946 struct sst_pdata *pdata = dev_get_platdata(component->dev);
947 struct hsw_priv_data *priv_data = dev_get_drvdata(component->dev);
948 struct device *dev = pdata->dma_dev;
951 if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream ||
952 pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream) {
953 ret = snd_pcm_lib_preallocate_pages_for_all(pcm,
954 SNDRV_DMA_TYPE_DEV_SG,
956 hsw_pcm_hardware.buffer_bytes_max,
957 hsw_pcm_hardware.buffer_bytes_max);
959 dev_err(rtd->dev, "dma buffer allocation failed %d\n",
964 if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream)
965 priv_data->pcm[rtd->cpu_dai->id][SNDRV_PCM_STREAM_PLAYBACK].hsw_pcm = pcm;
966 if (pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream)
967 priv_data->pcm[rtd->cpu_dai->id][SNDRV_PCM_STREAM_CAPTURE].hsw_pcm = pcm;
972 #define HSW_FORMATS \
973 (SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S16_LE)
975 static struct snd_soc_dai_driver hsw_dais[] = {
977 .name = "System Pin",
978 .id = HSW_PCM_DAI_ID_SYSTEM,
980 .stream_name = "System Playback",
983 .rates = SNDRV_PCM_RATE_48000,
984 .formats = SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S16_LE,
987 .stream_name = "Analog Capture",
990 .rates = SNDRV_PCM_RATE_48000,
991 .formats = SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S16_LE,
996 .name = "Offload0 Pin",
997 .id = HSW_PCM_DAI_ID_OFFLOAD0,
999 .stream_name = "Offload0 Playback",
1002 .rates = SNDRV_PCM_RATE_8000_192000,
1003 .formats = HSW_FORMATS,
1008 .name = "Offload1 Pin",
1009 .id = HSW_PCM_DAI_ID_OFFLOAD1,
1011 .stream_name = "Offload1 Playback",
1014 .rates = SNDRV_PCM_RATE_8000_192000,
1015 .formats = HSW_FORMATS,
1019 .name = "Loopback Pin",
1020 .id = HSW_PCM_DAI_ID_LOOPBACK,
1022 .stream_name = "Loopback Capture",
1025 .rates = SNDRV_PCM_RATE_48000,
1026 .formats = SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S16_LE,
1031 static const struct snd_soc_dapm_widget widgets[] = {
1034 SND_SOC_DAPM_AIF_IN("SSP0 CODEC IN", NULL, 0, SND_SOC_NOPM, 0, 0),
1035 SND_SOC_DAPM_AIF_OUT("SSP0 CODEC OUT", NULL, 0, SND_SOC_NOPM, 0, 0),
1036 SND_SOC_DAPM_AIF_IN("SSP1 BT IN", NULL, 0, SND_SOC_NOPM, 0, 0),
1037 SND_SOC_DAPM_AIF_OUT("SSP1 BT OUT", NULL, 0, SND_SOC_NOPM, 0, 0),
1039 /* Global Playback Mixer */
1040 SND_SOC_DAPM_MIXER("Playback VMixer", SND_SOC_NOPM, 0, 0, NULL, 0),
1043 static const struct snd_soc_dapm_route graph[] = {
1045 /* Playback Mixer */
1046 {"Playback VMixer", NULL, "System Playback"},
1047 {"Playback VMixer", NULL, "Offload0 Playback"},
1048 {"Playback VMixer", NULL, "Offload1 Playback"},
1050 {"SSP0 CODEC OUT", NULL, "Playback VMixer"},
1052 {"Analog Capture", NULL, "SSP0 CODEC IN"},
1055 static int hsw_pcm_probe(struct snd_soc_component *component)
1057 struct hsw_priv_data *priv_data = snd_soc_component_get_drvdata(component);
1058 struct sst_pdata *pdata = dev_get_platdata(component->dev);
1059 struct device *dma_dev, *dev;
1065 dev = component->dev;
1066 dma_dev = pdata->dma_dev;
1068 priv_data->hsw = pdata->dsp;
1069 priv_data->dev = dev;
1070 priv_data->pm_state = HSW_PM_STATE_D0;
1071 priv_data->soc_card = component->card;
1073 /* allocate DSP buffer page tables */
1074 for (i = 0; i < ARRAY_SIZE(hsw_dais); i++) {
1077 if (hsw_dais[i].playback.channels_min) {
1078 mutex_init(&priv_data->pcm[i][SNDRV_PCM_STREAM_PLAYBACK].mutex);
1079 ret = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, dma_dev,
1080 PAGE_SIZE, &priv_data->dmab[i][0]);
1086 if (hsw_dais[i].capture.channels_min) {
1087 mutex_init(&priv_data->pcm[i][SNDRV_PCM_STREAM_CAPTURE].mutex);
1088 ret = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, dma_dev,
1089 PAGE_SIZE, &priv_data->dmab[i][1]);
1095 /* allocate runtime modules */
1096 ret = hsw_pcm_create_modules(priv_data);
1100 /* enable runtime PM with auto suspend */
1101 pm_runtime_set_autosuspend_delay(dev, SST_RUNTIME_SUSPEND_DELAY);
1102 pm_runtime_use_autosuspend(dev);
1103 pm_runtime_enable(dev);
1104 pm_runtime_idle(dev);
1109 for (--i; i >= 0; i--) {
1110 if (hsw_dais[i].playback.channels_min)
1111 snd_dma_free_pages(&priv_data->dmab[i][0]);
1112 if (hsw_dais[i].capture.channels_min)
1113 snd_dma_free_pages(&priv_data->dmab[i][1]);
1118 static void hsw_pcm_remove(struct snd_soc_component *component)
1120 struct hsw_priv_data *priv_data =
1121 snd_soc_component_get_drvdata(component);
1124 pm_runtime_disable(component->dev);
1125 hsw_pcm_free_modules(priv_data);
1127 for (i = 0; i < ARRAY_SIZE(hsw_dais); i++) {
1128 if (hsw_dais[i].playback.channels_min)
1129 snd_dma_free_pages(&priv_data->dmab[i][0]);
1130 if (hsw_dais[i].capture.channels_min)
1131 snd_dma_free_pages(&priv_data->dmab[i][1]);
1135 static const struct snd_soc_component_driver hsw_dai_component = {
1137 .probe = hsw_pcm_probe,
1138 .remove = hsw_pcm_remove,
1139 .ops = &hsw_pcm_ops,
1140 .pcm_new = hsw_pcm_new,
1141 .controls = hsw_volume_controls,
1142 .num_controls = ARRAY_SIZE(hsw_volume_controls),
1143 .dapm_widgets = widgets,
1144 .num_dapm_widgets = ARRAY_SIZE(widgets),
1145 .dapm_routes = graph,
1146 .num_dapm_routes = ARRAY_SIZE(graph),
1149 static int hsw_pcm_dev_probe(struct platform_device *pdev)
1151 struct sst_pdata *sst_pdata = dev_get_platdata(&pdev->dev);
1152 struct hsw_priv_data *priv_data;
1158 priv_data = devm_kzalloc(&pdev->dev, sizeof(*priv_data), GFP_KERNEL);
1162 ret = sst_hsw_dsp_init(&pdev->dev, sst_pdata);
1166 priv_data->hsw = sst_pdata->dsp;
1167 platform_set_drvdata(pdev, priv_data);
1169 ret = devm_snd_soc_register_component(&pdev->dev, &hsw_dai_component,
1170 hsw_dais, ARRAY_SIZE(hsw_dais));
1177 sst_hsw_dsp_free(&pdev->dev, sst_pdata);
1181 static int hsw_pcm_dev_remove(struct platform_device *pdev)
1183 struct sst_pdata *sst_pdata = dev_get_platdata(&pdev->dev);
1185 sst_hsw_dsp_free(&pdev->dev, sst_pdata);
1192 static int hsw_pcm_runtime_idle(struct device *dev)
1197 static int hsw_pcm_suspend(struct device *dev)
1199 struct hsw_priv_data *pdata = dev_get_drvdata(dev);
1200 struct sst_hsw *hsw = pdata->hsw;
1202 /* enter D3 state and stall */
1203 sst_hsw_dsp_runtime_suspend(hsw);
1204 /* free all runtime modules */
1205 hsw_pcm_free_modules(pdata);
1206 /* put the DSP to sleep, fw unloaded after runtime modules freed */
1207 sst_hsw_dsp_runtime_sleep(hsw);
1211 static int hsw_pcm_runtime_suspend(struct device *dev)
1213 struct hsw_priv_data *pdata = dev_get_drvdata(dev);
1214 struct sst_hsw *hsw = pdata->hsw;
1217 if (pdata->pm_state >= HSW_PM_STATE_RTD3)
1220 /* fw modules will be unloaded on RTD3, set flag to track */
1221 if (sst_hsw_is_module_active(hsw, SST_HSW_MODULE_WAVES)) {
1222 ret = sst_hsw_module_disable(hsw, SST_HSW_MODULE_WAVES, 0);
1225 sst_hsw_set_module_enabled_rtd3(hsw, SST_HSW_MODULE_WAVES);
1227 hsw_pcm_suspend(dev);
1228 pdata->pm_state = HSW_PM_STATE_RTD3;
1233 static int hsw_pcm_runtime_resume(struct device *dev)
1235 struct hsw_priv_data *pdata = dev_get_drvdata(dev);
1236 struct sst_hsw *hsw = pdata->hsw;
1239 if (pdata->pm_state != HSW_PM_STATE_RTD3)
1242 ret = sst_hsw_dsp_load(hsw);
1244 dev_err(dev, "failed to reload %d\n", ret);
1248 ret = hsw_pcm_create_modules(pdata);
1250 dev_err(dev, "failed to create modules %d\n", ret);
1254 ret = sst_hsw_dsp_runtime_resume(hsw);
1257 else if (ret == 1) /* no action required */
1260 /* check flag when resume */
1261 if (sst_hsw_is_module_enabled_rtd3(hsw, SST_HSW_MODULE_WAVES)) {
1262 ret = sst_hsw_module_enable(hsw, SST_HSW_MODULE_WAVES, 0);
1265 /* put parameters from buffer to dsp */
1266 ret = sst_hsw_launch_param_buf(hsw);
1270 sst_hsw_set_module_disabled_rtd3(hsw, SST_HSW_MODULE_WAVES);
1273 pdata->pm_state = HSW_PM_STATE_D0;
1278 #define hsw_pcm_runtime_idle NULL
1279 #define hsw_pcm_runtime_suspend NULL
1280 #define hsw_pcm_runtime_resume NULL
1285 static void hsw_pcm_complete(struct device *dev)
1287 struct hsw_priv_data *pdata = dev_get_drvdata(dev);
1288 struct sst_hsw *hsw = pdata->hsw;
1289 struct hsw_pcm_data *pcm_data;
1292 if (pdata->pm_state != HSW_PM_STATE_D3)
1295 err = sst_hsw_dsp_load(hsw);
1297 dev_err(dev, "failed to reload %d\n", err);
1301 err = hsw_pcm_create_modules(pdata);
1303 dev_err(dev, "failed to create modules %d\n", err);
1307 for (i = 0; i < ARRAY_SIZE(mod_map); i++) {
1308 pcm_data = &pdata->pcm[mod_map[i].dai_id][mod_map[i].stream];
1310 if (!pcm_data->substream)
1313 err = sst_module_runtime_restore(pcm_data->runtime,
1314 &pcm_data->context);
1316 dev_err(dev, "failed to restore context for PCM %d\n", i);
1319 snd_soc_resume(pdata->soc_card->dev);
1321 err = sst_hsw_dsp_runtime_resume(hsw);
1324 else if (err == 1) /* no action required */
1327 pdata->pm_state = HSW_PM_STATE_D0;
1331 static int hsw_pcm_prepare(struct device *dev)
1333 struct hsw_priv_data *pdata = dev_get_drvdata(dev);
1334 struct hsw_pcm_data *pcm_data;
1337 if (pdata->pm_state == HSW_PM_STATE_D3)
1339 else if (pdata->pm_state == HSW_PM_STATE_D0) {
1340 /* suspend all active streams */
1341 for (i = 0; i < ARRAY_SIZE(mod_map); i++) {
1342 pcm_data = &pdata->pcm[mod_map[i].dai_id][mod_map[i].stream];
1344 if (!pcm_data->substream)
1346 dev_dbg(dev, "suspending pcm %d\n", i);
1347 snd_pcm_suspend_all(pcm_data->hsw_pcm);
1349 /* We need to wait until the DSP FW stops the streams */
1353 /* preserve persistent memory */
1354 for (i = 0; i < ARRAY_SIZE(mod_map); i++) {
1355 pcm_data = &pdata->pcm[mod_map[i].dai_id][mod_map[i].stream];
1357 if (!pcm_data->substream)
1360 dev_dbg(dev, "saving context pcm %d\n", i);
1361 err = sst_module_runtime_save(pcm_data->runtime,
1362 &pcm_data->context);
1364 dev_err(dev, "failed to save context for PCM %d\n", i);
1366 hsw_pcm_suspend(dev);
1369 snd_soc_suspend(pdata->soc_card->dev);
1370 snd_soc_poweroff(pdata->soc_card->dev);
1372 pdata->pm_state = HSW_PM_STATE_D3;
1378 #define hsw_pcm_prepare NULL
1379 #define hsw_pcm_complete NULL
1382 static const struct dev_pm_ops hsw_pcm_pm = {
1383 .runtime_idle = hsw_pcm_runtime_idle,
1384 .runtime_suspend = hsw_pcm_runtime_suspend,
1385 .runtime_resume = hsw_pcm_runtime_resume,
1386 .prepare = hsw_pcm_prepare,
1387 .complete = hsw_pcm_complete,
1390 static struct platform_driver hsw_pcm_driver = {
1392 .name = "haswell-pcm-audio",
1396 .probe = hsw_pcm_dev_probe,
1397 .remove = hsw_pcm_dev_remove,
1399 module_platform_driver(hsw_pcm_driver);
1401 MODULE_AUTHOR("Liam Girdwood, Xingchao Wang");
1402 MODULE_DESCRIPTION("Haswell/Lynxpoint + Broadwell/Wildcatpoint PCM");
1403 MODULE_LICENSE("GPL v2");
1404 MODULE_ALIAS("platform:haswell-pcm-audio");