Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions src/audio/host-zephyr.c
Original file line number Diff line number Diff line change
Expand Up @@ -957,6 +957,9 @@ static int host_verify_params(struct comp_dev *dev,
#endif

/* configure the DMA params and descriptors for host buffer IO */
/**
* @brief Configure host DMA, limiting HDA buffers to the 16-bit DGMBS range.
*/
int host_common_params(struct host_data *hd, struct comp_dev *dev,
struct sof_ipc_stream_params *params, notifier_callback_t cb)
{
Expand Down Expand Up @@ -1046,6 +1049,18 @@ int host_common_params(struct host_data *hd, struct comp_dev *dev,
if (hd->ipc_host.dma_buffer_size != 0)
buffer_size_preferred = ROUND_UP(hd->ipc_host.dma_buffer_size, buffer_size);

/* Keep deep buffers within the 16-bit HDA DGMBS limit and whole allocation units. */
if (hd->dma->plat_data.caps & SOF_DMA_CAP_HDA) {
uint32_t max_buffer_size = ROUND_DOWN(UINT16_MAX, buffer_size);

if (!max_buffer_size) {
comp_err(dev, "HDA DMA minimum buffer size %u exceeds 16-bit limit",
buffer_size);
return -EINVAL;
}
buffer_size_preferred = MIN(buffer_size_preferred, max_buffer_size);
}

/* alloc DMA buffer or change its size if exists */
/*
* Host DMA buffer cannot be shared. So we actually don't need to lock,
Expand Down
17 changes: 15 additions & 2 deletions tools/topology/topology2/platform/intel/uaol-deep-buffer.conf
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,19 @@ Object.Pipeline.deepbuffer-playback [
Object.Widget.host-copier.1 {
stream_name $UAOL_DB_PCM_NAME
pcm_id $UAOL_DB_PCM_ID
<include/formats/uaol_input_audio_formats.conf>
<include/formats/uaol_output_audio_formats_s32.conf>
}
Object.Widget.gain.1 {
Object.Control.mixer.1 {
name 'Pre Mixer $UAOL_DB_PCM_NAME Volume'
}
<include/formats/uaol_input_audio_formats_s32.conf>
<include/formats/uaol_output_audio_formats_s32.conf>
}
Object.Widget.mixin.1 {
<include/formats/uaol_input_audio_formats_s32.conf>
<include/formats/uaol_output_audio_formats_s32.conf>
}
}
]
Expand All @@ -37,14 +45,19 @@ Object.PCM.pcm [
Object.PCM.pcm_caps.1 {
name $UAOL_DB_PCM_NAME
formats 'S16_LE,S24_LE,S32_LE'
channels_min $UAOL_CHANNELS_MIN
channels_max $UAOL_CHANNELS_MAX
rates $UAOL_RATES
rate_min $UAOL_RATE_MIN
rate_max $UAOL_RATE_MAX
# To avoid DMA spinning on a buffer we need bigger
# buffer than the host buffer size, let's say twice as
# big
# (S16_LE, Stereo, 48KHz, DEEPBUFFER_FW_DMA_MS) * 2
# (S16_LE, minimum channels/rate, DEEPBUFFER_FW_DMA_MS) * 2
#
# Note: The lower limit for the buffer size is rate
# dependent
buffer_size_min "$[(((2 * $channels_min) * 48) * $DEEPBUFFER_FW_DMA_MS) * 2]"
buffer_size_min "$[(((((2 * $channels_min) * $rate_min) * $DEEPBUFFER_FW_DMA_MS) * 2) / 1000)]"
}
}
]
Expand Down
17 changes: 15 additions & 2 deletions tools/topology/topology2/platform/intel/uaol-deep-buffer1.conf
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,19 @@ Object.Pipeline.deepbuffer-playback [
Object.Widget.host-copier.1 {
stream_name $UAOL_DB1_PCM_NAME
pcm_id $UAOL_DB1_PCM_ID
<include/formats/uaol_input_audio_formats.conf>
<include/formats/uaol_output_audio_formats_s32.conf>
}
Object.Widget.gain.1 {
Object.Control.mixer.1 {
name 'Pre Mixer $UAOL_DB1_PCM_NAME Volume'
}
<include/formats/uaol_input_audio_formats_s32.conf>
<include/formats/uaol_output_audio_formats_s32.conf>
}
Object.Widget.mixin.1 {
<include/formats/uaol_input_audio_formats_s32.conf>
<include/formats/uaol_output_audio_formats_s32.conf>
}
}
]
Expand All @@ -33,14 +41,19 @@ Object.PCM.pcm [
Object.PCM.pcm_caps.1 {
name $UAOL_DB1_PCM_NAME
formats 'S16_LE,S24_LE,S32_LE'
channels_min $UAOL_CHANNELS_MIN
channels_max $UAOL_CHANNELS_MAX
rates $UAOL_RATES
rate_min $UAOL_RATE_MIN
rate_max $UAOL_RATE_MAX
# To avoid DMA spinning on a buffer we need bigger
# buffer than the host buffer size, let's say twice as
# big
# (S16_LE, Stereo, 48KHz, DEEPBUFFER_FW_DMA_MS) * 2
# (S16_LE, minimum channels/rate, DEEPBUFFER_FW_DMA_MS) * 2
#
# Note: The lower limit for the buffer size is rate
# dependent
buffer_size_min "$[(((2 * $channels_min) * 48) * $DEEPBUFFER_FW_DMA_MS) * 2]"
buffer_size_min "$[(((((2 * $channels_min) * $rate_min) * $DEEPBUFFER_FW_DMA_MS) * 2) / 1000)]"
}
}
]
Expand Down
5 changes: 2 additions & 3 deletions tools/topology/topology2/platform/intel/uaol-generic.conf
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,8 @@
# goes. The kernel narrows the PCM down to what the connected device actually
# supports.
#
# The deep buffer PCM is left at 48 kHz stereo, the default of the
# deepbuffer-playback pipeline. It can only join the mixer while the normal
# playback PCM runs at that format, or is not running at all.
# The deep buffer PCM carries the same formats as normal playback. Both PCMs
# can join the mixer when their rates and channel counts match.

# Deep buffer playback, included when UAOL_DEEP_BUFFER is true and the DMA
# buffer is 1 - 1000 ms. The deep buffers of the UAOL streams are instances of
Expand Down
Loading