aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/intel/sst-haswell-dsp.c
diff options
context:
space:
mode:
authorJie Yang <yang.jie@intel.com>2014-07-14 05:11:10 -0400
committerMark Brown <broonie@linaro.org>2014-07-14 14:12:09 -0400
commit548793232fd29cfa1553bb45247aa5963632405c (patch)
tree20f8398bc8fc09cd763ef3f0003fdb4a9a18a765 /sound/soc/intel/sst-haswell-dsp.c
parent15446c0b8dc79f5dfabfb689879609023713f421 (diff)
ASoC: Intel: Use a table for ADSP SRAM shift
Use a table for ADSP IRAM/DRAM bit shift. Signed-off-by: Jie Yang <yang.jie@intel.com> Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat (limited to 'sound/soc/intel/sst-haswell-dsp.c')
-rw-r--r--sound/soc/intel/sst-haswell-dsp.c39
1 files changed, 29 insertions, 10 deletions
diff --git a/sound/soc/intel/sst-haswell-dsp.c b/sound/soc/intel/sst-haswell-dsp.c
index 4720382260b0..40bb0205d5c0 100644
--- a/sound/soc/intel/sst-haswell-dsp.c
+++ b/sound/soc/intel/sst-haswell-dsp.c
@@ -337,21 +337,40 @@ static int hsw_acpi_resource_map(struct sst_dsp *sst, struct sst_pdata *pdata)
337 return 0; 337 return 0;
338} 338}
339 339
340struct sst_sram_shift {
341 u32 dev_id; /* SST Device IDs */
342 u32 iram_shift;
343 u32 dram_shift;
344};
345
346static const struct sst_sram_shift sram_shift[] = {
347 {SST_DEV_ID_LYNX_POINT, 6, 16}, /* lp */
348 {SST_DEV_ID_WILDCAT_POINT, 2, 12}, /* wpt */
349};
340static u32 hsw_block_get_bit(struct sst_mem_block *block) 350static u32 hsw_block_get_bit(struct sst_mem_block *block)
341{ 351{
342 u32 bit = 0, shift = 0; 352 u32 bit = 0, shift = 0, index;
353 struct sst_dsp *sst = block->dsp;
343 354
344 switch (block->type) { 355 for (index = 0; index < ARRAY_SIZE(sram_shift); index++) {
345 case SST_MEM_DRAM: 356 if (sram_shift[index].dev_id == sst->id)
346 shift = 16; 357 break;
347 break;
348 case SST_MEM_IRAM:
349 shift = 6;
350 break;
351 default:
352 return 0;
353 } 358 }
354 359
360 if (index < ARRAY_SIZE(sram_shift)) {
361 switch (block->type) {
362 case SST_MEM_DRAM:
363 shift = sram_shift[index].dram_shift;
364 break;
365 case SST_MEM_IRAM:
366 shift = sram_shift[index].iram_shift;
367 break;
368 default:
369 shift = 0;
370 }
371 } else
372 shift = 0;
373
355 bit = 1 << (block->index + shift); 374 bit = 1 << (block->index + shift);
356 375
357 return bit; 376 return bit;