Skip to content

Commit 1bf52db

Browse files
committed
hda-dma fix: align DGMBS value to 32 bytes
APL/CNL: If DSP Gateway Minimum Buffer Size (DGMBS) is not aligned to 32 bytes they occur glitches in output signal (the buffer will be overwritten during work). It can be observed during playback in following configuration: - 8Khz 16bits 1 channel - 24kHz 16bits 1 channel Signed-off-by: Kamil Kulesza <kamil.kulesza@linux.intel.com>
1 parent 0375c21 commit 1bf52db

3 files changed

Lines changed: 10 additions & 1 deletion

File tree

src/drivers/hda-dma.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,9 @@
4444
#include <sof/ipc.h>
4545
#include <sof/pm_runtime.h>
4646
#include <sof/wait.h>
47+
#include <sof/audio/format.h>
4748
#include <platform/dma.h>
49+
#include <platform/platform.h>
4850
#include <arch/cache.h>
4951
#include <uapi/ipc.h>
5052

@@ -367,7 +369,8 @@ static int hda_dma_set_config(struct dma *dma, int channel,
367369
host_dma_reg_write(dma, channel, DGBS, buffer_bytes);
368370
host_dma_reg_write(dma, channel, DGBFPI, 0);
369371
host_dma_reg_write(dma, channel, DGBSP, period_bytes);
370-
host_dma_reg_write(dma, channel, DGMBS, period_bytes);
372+
host_dma_reg_write(dma, channel, DGMBS,
373+
ALIGN_UP(period_bytes, PLATFORM_HDA_BUFFER_ALIGNMENT));
371374
host_dma_reg_write(dma, channel, DGLLPI, 0);
372375
host_dma_reg_write(dma, channel, DGLPIBI, 0);
373376

src/platform/apollolake/include/platform/platform.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@
4141

4242
struct sof;
4343

44+
/* DGMBS align value */
45+
#define PLATFORM_HDA_BUFFER_ALIGNMENT 0x20
46+
4447
/* Host page size */
4548
#define HOST_PAGE_SIZE 4096
4649
#define PLATFORM_PAGE_TABLE_SIZE 256

src/platform/cannonlake/include/platform/platform.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ struct sof;
4747
#define PLATFORM_SSP_COUNT 3
4848
#define MAX_GPDMA_COUNT 2
4949

50+
/* DGMBS align value */
51+
#define PLATFORM_HDA_BUFFER_ALIGNMENT 0x20
52+
5053
/* Host page size */
5154
#define HOST_PAGE_SIZE 4096
5255
#define PLATFORM_PAGE_TABLE_SIZE 256

0 commit comments

Comments
 (0)