Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c761b583 authored by Jie Yang's avatar Jie Yang Committed by Mark Brown
Browse files

ASoC: Intel: Add dummy read for SRAM block enable



Add dummy read after each block enable, to workaround
SRAM write missing bytes issue.

Signed-off-by: default avatarJie Yang <yang.jie@intel.com>
Signed-off-by: default avatarMark Brown <broonie@linaro.org>
parent 8e897618
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -359,6 +359,17 @@ static u32 hsw_block_get_bit(struct sst_mem_block *block)
	return bit;
}

/*dummy read a SRAM block.*/
static void sst_mem_block_dummy_read(struct sst_mem_block *block)
{
	u32 size;
	u8 tmp_buf[4];
	struct sst_dsp *sst = block->dsp;

	size = block->size > 4 ? 4 : block->size;
	memcpy_fromio(tmp_buf, sst->addr.lpe + block->offset, size);
}

/* enable 32kB memory block - locks held by caller */
static int hsw_block_enable(struct sst_mem_block *block)
{
@@ -378,6 +389,8 @@ static int hsw_block_enable(struct sst_mem_block *block)
	/* wait 18 DSP clock ticks */
	udelay(10);

	/*add a dummy read before the SRAM block is written, otherwise the writing may miss bytes sometimes.*/
	sst_mem_block_dummy_read(block);
	return 0;
}