aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/intel/sst-firmware.c
diff options
context:
space:
mode:
authorMark Brown <broonie@linaro.org>2014-05-13 13:23:56 -0400
committerMark Brown <broonie@linaro.org>2014-05-13 13:23:56 -0400
commit8bee1fd482622718fcc1a537db1d7ca48d7f52f8 (patch)
tree8b40cf912a942771b0b22f2aa0ac20d5af256010 /sound/soc/intel/sst-firmware.c
parentdfe1951b0c1c6a80b8ad8702eb93f8a4dffa31f1 (diff)
parentcffd6665f57ed18f4be9185c4330c8c98c22e201 (diff)
Merge branch 'fix/intel' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into asoc-intel
Conflicts: sound/soc/intel/sst-baytrail-dsp.c
Diffstat (limited to 'sound/soc/intel/sst-firmware.c')
-rw-r--r--sound/soc/intel/sst-firmware.c25
1 files changed, 8 insertions, 17 deletions
diff --git a/sound/soc/intel/sst-firmware.c b/sound/soc/intel/sst-firmware.c
index 0c74bf1d2021..3bb43dac892d 100644
--- a/sound/soc/intel/sst-firmware.c
+++ b/sound/soc/intel/sst-firmware.c
@@ -59,14 +59,8 @@ struct sst_fw *sst_fw_new(struct sst_dsp *dsp,
59 sst_fw->private = private; 59 sst_fw->private = private;
60 sst_fw->size = fw->size; 60 sst_fw->size = fw->size;
61 61
62 err = dma_coerce_mask_and_coherent(dsp->dev, DMA_BIT_MASK(32));
63 if (err < 0) {
64 kfree(sst_fw);
65 return NULL;
66 }
67
68 /* allocate DMA buffer to store FW data */ 62 /* allocate DMA buffer to store FW data */
69 sst_fw->dma_buf = dma_alloc_coherent(dsp->dev, sst_fw->size, 63 sst_fw->dma_buf = dma_alloc_coherent(dsp->dma_dev, sst_fw->size,
70 &sst_fw->dmable_fw_paddr, GFP_DMA | GFP_KERNEL); 64 &sst_fw->dmable_fw_paddr, GFP_DMA | GFP_KERNEL);
71 if (!sst_fw->dma_buf) { 65 if (!sst_fw->dma_buf) {
72 dev_err(dsp->dev, "error: DMA alloc failed\n"); 66 dev_err(dsp->dev, "error: DMA alloc failed\n");
@@ -144,7 +138,7 @@ void sst_fw_free(struct sst_fw *sst_fw)
144 list_del(&sst_fw->list); 138 list_del(&sst_fw->list);
145 mutex_unlock(&dsp->mutex); 139 mutex_unlock(&dsp->mutex);
146 140
147 dma_free_coherent(dsp->dev, sst_fw->size, sst_fw->dma_buf, 141 dma_free_coherent(dsp->dma_dev, sst_fw->size, sst_fw->dma_buf,
148 sst_fw->dmable_fw_paddr); 142 sst_fw->dmable_fw_paddr);
149 kfree(sst_fw); 143 kfree(sst_fw);
150} 144}
@@ -240,6 +234,9 @@ static int block_alloc_contiguous(struct sst_module *module,
240 size -= block->size; 234 size -= block->size;
241 } 235 }
242 236
237 list_for_each_entry(block, &tmp, list)
238 list_add(&block->module_list, &module->block_list);
239
243 list_splice(&tmp, &dsp->used_block_list); 240 list_splice(&tmp, &dsp->used_block_list);
244 return 0; 241 return 0;
245} 242}
@@ -285,8 +282,7 @@ static int block_alloc(struct sst_module *module,
285 /* do we span > 1 blocks */ 282 /* do we span > 1 blocks */
286 if (data->size > block->size) { 283 if (data->size > block->size) {
287 ret = block_alloc_contiguous(module, data, 284 ret = block_alloc_contiguous(module, data,
288 block->offset + block->size, 285 block->offset, data->size);
289 data->size - block->size);
290 if (ret == 0) 286 if (ret == 0)
291 return ret; 287 return ret;
292 } 288 }
@@ -382,7 +378,7 @@ static int block_alloc_fixed(struct sst_module *module,
382 378
383 err = block_alloc_contiguous(module, data, 379 err = block_alloc_contiguous(module, data,
384 block->offset + block->size, 380 block->offset + block->size,
385 data->size - block->size + data->offset - block->offset); 381 data->size - block->size);
386 if (err < 0) 382 if (err < 0)
387 return -ENOMEM; 383 return -ENOMEM;
388 384
@@ -409,15 +405,10 @@ static int block_alloc_fixed(struct sst_module *module,
409 if (data->offset >= block->offset && data->offset < block_end) { 405 if (data->offset >= block->offset && data->offset < block_end) {
410 406
411 err = block_alloc_contiguous(module, data, 407 err = block_alloc_contiguous(module, data,
412 block->offset + block->size, 408 block->offset, data->size);
413 data->size - block->size);
414 if (err < 0) 409 if (err < 0)
415 return -ENOMEM; 410 return -ENOMEM;
416 411
417 /* add block */
418 block->data_type = data->data_type;
419 list_move(&block->list, &dsp->used_block_list);
420 list_add(&block->module_list, &module->block_list);
421 return 0; 412 return 0;
422 } 413 }
423 414