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

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

ASoC: Intel: Use a table for ADSP SRAM shift



Use a table for ADSP IRAM/DRAM bit shift.

Signed-off-by: default avatarJie Yang <yang.jie@intel.com>
Signed-off-by: default avatarMark Brown <broonie@linaro.org>
parent 15446c0b
Loading
Loading
Loading
Loading
+29 −10
Original line number Original line Diff line number Diff line
@@ -337,20 +337,39 @@ static int hsw_acpi_resource_map(struct sst_dsp *sst, struct sst_pdata *pdata)
	return 0;
	return 0;
}
}


struct sst_sram_shift {
	u32 dev_id;	/* SST Device IDs  */
	u32 iram_shift;
	u32 dram_shift;
};

static const struct sst_sram_shift sram_shift[] = {
	{SST_DEV_ID_LYNX_POINT, 6, 16}, /* lp */
	{SST_DEV_ID_WILDCAT_POINT, 2, 12}, /* wpt */
};
static u32 hsw_block_get_bit(struct sst_mem_block *block)
static u32 hsw_block_get_bit(struct sst_mem_block *block)
{
{
	u32 bit = 0, shift = 0;
	u32 bit = 0, shift = 0, index;
	struct sst_dsp *sst = block->dsp;


	for (index = 0; index < ARRAY_SIZE(sram_shift); index++) {
		if (sram_shift[index].dev_id == sst->id)
			break;
	}

	if (index < ARRAY_SIZE(sram_shift)) {
		switch (block->type) {
		switch (block->type) {
		case SST_MEM_DRAM:
		case SST_MEM_DRAM:
		shift = 16;
			shift = sram_shift[index].dram_shift;
			break;
			break;
		case SST_MEM_IRAM:
		case SST_MEM_IRAM:
		shift = 6;
			shift = sram_shift[index].iram_shift;
			break;
			break;
		default:
		default:
		return 0;
			shift = 0;
		}
		}
	} else
		shift = 0;


	bit = 1 << (block->index + shift);
	bit = 1 << (block->index + shift);