Skip to content

Commit f96878a

Browse files
author
Marcin Maka
committed
dai: support for hda cyclic mode dai added
There are no buffer completion int's, so work queue timers are used by hda-dma in cyclic mode. Buffer segment completion programming removed. W/A to observed work queue timer inaccuracy applied. Signed-off-by: Marcin Maka <marcin.maka@linux.intel.com>
1 parent b30658d commit f96878a

8 files changed

Lines changed: 379 additions & 43 deletions

File tree

src/audio/dai.c

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -197,9 +197,21 @@ static struct comp_dev *dai_new(struct sof_ipc_comp *comp)
197197
/* TODO: hda: retrieve req'ed caps from the dai,
198198
* dmas are not cross-compatible.
199199
*/
200-
dir = DMA_DIR_MEM_TO_DEV | DMA_DIR_DEV_TO_MEM;
201-
caps = DMA_CAP_GP_LP | DMA_CAP_GP_HP;
202-
dma_dev = DMA_DEV_SSP | DMA_DEV_DMIC;
200+
switch (dai->type) {
201+
case SOF_DAI_INTEL_HDA:
202+
dir = dai->direction == SOF_IPC_STREAM_PLAYBACK ?
203+
DMA_DIR_DEV_TO_MEM : DMA_DIR_MEM_TO_DEV;
204+
caps = DMA_CAP_HDA;
205+
dma_dev = DMA_DEV_HDA;
206+
break;
207+
case SOF_DAI_INTEL_SSP:
208+
case SOF_DAI_INTEL_DMIC:
209+
default:
210+
dir = DMA_DIR_MEM_TO_DEV | DMA_DIR_DEV_TO_MEM;
211+
caps = DMA_CAP_GP_LP | DMA_CAP_GP_HP;
212+
dma_dev = DMA_DEV_SSP | DMA_DEV_DMIC;
213+
break;
214+
}
203215
dd->dma = dma_get(dir, caps, dma_dev, DMA_ACCESS_SHARED);
204216
if (dd->dma == NULL) {
205217
trace_dai_error("eDd");
@@ -702,6 +714,13 @@ static int dai_config(struct comp_dev *dev, struct sof_ipc_dai_config *config)
702714
trace_value(config->dmic.pdm[0].enable_mic_b);
703715
trace_value(dev->frame_bytes);
704716
break;
717+
case SOF_DAI_INTEL_HDA:
718+
/* set to some non-zero value to satisfy the condition below,
719+
* it is recalculated in dai_params() later
720+
* this is temp until dai/hda model is changed.
721+
*/
722+
dev->frame_bytes = 4;
723+
break;
705724
default:
706725
/* other types of DAIs not handled for now */
707726
trace_dai_error("de2");

src/audio/host.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -863,7 +863,8 @@ static int host_copy(struct comp_dev *dev)
863863

864864
#if defined CONFIG_DMA_GW
865865
/* tell gateway to copy another period */
866-
ret = dma_copy(hd->dma, hd->chan, hd->period_bytes);
866+
/* TODO: flags to be used by preload */
867+
ret = dma_copy(hd->dma, hd->chan, hd->period_bytes, 0);
867868
if (ret < 0)
868869
goto out;
869870

src/drivers/Makefile.am

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ if BUILD_APOLLOLAKE
2727
libdrivers_a_SOURCES += \
2828
apl-ssp.c \
2929
hda-dma.c \
30+
cavs-hda.c \
3031
dmic.c
3132
endif
3233

src/drivers/cavs-hda.c

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
/*
2+
* Copyright (c) 2018, Intel Corporation
3+
* All rights reserved.
4+
*
5+
* Redistribution and use in source and binary forms, with or without
6+
* modification, are permitted provided that the following conditions are met:
7+
* * Redistributions of source code must retain the above copyright
8+
* notice, this list of conditions and the following disclaimer.
9+
* * Redistributions in binary form must reproduce the above copyright
10+
* notice, this list of conditions and the following disclaimer in the
11+
* documentation and/or other materials provided with the distribution.
12+
* * Neither the name of the Intel Corporation nor the
13+
* names of its contributors may be used to endorse or promote products
14+
* derived from this software without specific prior written permission.
15+
*
16+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17+
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19+
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
20+
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21+
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22+
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23+
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24+
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25+
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26+
* POSSIBILITY OF SUCH DAMAGE.
27+
*
28+
* Author: Marcin Maka <marcin.maka@linux.intel.com
29+
*/
30+
31+
#include <errno.h>
32+
#include <sof/dai.h>
33+
34+
static int hda_trigger(struct dai *dai, int cmd, int direction)
35+
{
36+
return 0;
37+
}
38+
39+
static int hda_set_config(struct dai *dai,
40+
struct sof_ipc_dai_config *config)
41+
{
42+
return 0;
43+
}
44+
45+
static int hda_dummy(struct dai *dai)
46+
{
47+
return 0;
48+
}
49+
50+
static int hda_set_loopback_mode(struct dai *dai, uint32_t lbm)
51+
{
52+
return -EINVAL;
53+
}
54+
55+
const struct dai_ops hda_ops = {
56+
.trigger = hda_trigger,
57+
.set_config = hda_set_config,
58+
.pm_context_store = hda_dummy,
59+
.pm_context_restore = hda_dummy,
60+
.probe = hda_dummy,
61+
.set_loopback_mode = hda_set_loopback_mode
62+
};

0 commit comments

Comments
 (0)