diff options
Diffstat (limited to 'sound/soc/intel')
| -rw-r--r-- | sound/soc/intel/sst-firmware.c | 13 | ||||
| -rw-r--r-- | sound/soc/intel/sst-haswell-ipc.c | 30 |
2 files changed, 37 insertions, 6 deletions
diff --git a/sound/soc/intel/sst-firmware.c b/sound/soc/intel/sst-firmware.c index ef2e8b5766a1..b3f9489794a6 100644 --- a/sound/soc/intel/sst-firmware.c +++ b/sound/soc/intel/sst-firmware.c | |||
| @@ -706,6 +706,7 @@ static int block_alloc_fixed(struct sst_dsp *dsp, struct sst_block_allocator *ba | |||
| 706 | struct list_head *block_list) | 706 | struct list_head *block_list) |
| 707 | { | 707 | { |
| 708 | struct sst_mem_block *block, *tmp; | 708 | struct sst_mem_block *block, *tmp; |
| 709 | struct sst_block_allocator ba_tmp = *ba; | ||
| 709 | u32 end = ba->offset + ba->size, block_end; | 710 | u32 end = ba->offset + ba->size, block_end; |
| 710 | int err; | 711 | int err; |
| 711 | 712 | ||
| @@ -730,9 +731,9 @@ static int block_alloc_fixed(struct sst_dsp *dsp, struct sst_block_allocator *ba | |||
| 730 | if (ba->offset >= block->offset && ba->offset < block_end) { | 731 | if (ba->offset >= block->offset && ba->offset < block_end) { |
| 731 | 732 | ||
| 732 | /* align ba to block boundary */ | 733 | /* align ba to block boundary */ |
| 733 | ba->size -= block_end - ba->offset; | 734 | ba_tmp.size -= block_end - ba->offset; |
| 734 | ba->offset = block_end; | 735 | ba_tmp.offset = block_end; |
| 735 | err = block_alloc_contiguous(dsp, ba, block_list); | 736 | err = block_alloc_contiguous(dsp, &ba_tmp, block_list); |
| 736 | if (err < 0) | 737 | if (err < 0) |
| 737 | return -ENOMEM; | 738 | return -ENOMEM; |
| 738 | 739 | ||
| @@ -767,10 +768,10 @@ static int block_alloc_fixed(struct sst_dsp *dsp, struct sst_block_allocator *ba | |||
| 767 | list_move(&block->list, &dsp->used_block_list); | 768 | list_move(&block->list, &dsp->used_block_list); |
| 768 | list_add(&block->module_list, block_list); | 769 | list_add(&block->module_list, block_list); |
| 769 | /* align ba to block boundary */ | 770 | /* align ba to block boundary */ |
| 770 | ba->size -= block_end - ba->offset; | 771 | ba_tmp.size -= block_end - ba->offset; |
| 771 | ba->offset = block_end; | 772 | ba_tmp.offset = block_end; |
| 772 | 773 | ||
| 773 | err = block_alloc_contiguous(dsp, ba, block_list); | 774 | err = block_alloc_contiguous(dsp, &ba_tmp, block_list); |
| 774 | if (err < 0) | 775 | if (err < 0) |
| 775 | return -ENOMEM; | 776 | return -ENOMEM; |
| 776 | 777 | ||
diff --git a/sound/soc/intel/sst-haswell-ipc.c b/sound/soc/intel/sst-haswell-ipc.c index 3f8c48231364..5bf14040c24a 100644 --- a/sound/soc/intel/sst-haswell-ipc.c +++ b/sound/soc/intel/sst-haswell-ipc.c | |||
| @@ -1228,6 +1228,11 @@ int sst_hsw_stream_free(struct sst_hsw *hsw, struct sst_hsw_stream *stream) | |||
| 1228 | struct sst_dsp *sst = hsw->dsp; | 1228 | struct sst_dsp *sst = hsw->dsp; |
| 1229 | unsigned long flags; | 1229 | unsigned long flags; |
| 1230 | 1230 | ||
| 1231 | if (!stream) { | ||
| 1232 | dev_warn(hsw->dev, "warning: stream is NULL, no stream to free, ignore it.\n"); | ||
| 1233 | return 0; | ||
| 1234 | } | ||
| 1235 | |||
| 1231 | /* dont free DSP streams that are not commited */ | 1236 | /* dont free DSP streams that are not commited */ |
| 1232 | if (!stream->commited) | 1237 | if (!stream->commited) |
| 1233 | goto out; | 1238 | goto out; |
| @@ -1415,6 +1420,16 @@ int sst_hsw_stream_commit(struct sst_hsw *hsw, struct sst_hsw_stream *stream) | |||
| 1415 | u32 header; | 1420 | u32 header; |
| 1416 | int ret; | 1421 | int ret; |
| 1417 | 1422 | ||
| 1423 | if (!stream) { | ||
| 1424 | dev_warn(hsw->dev, "warning: stream is NULL, no stream to commit, ignore it.\n"); | ||
| 1425 | return 0; | ||
| 1426 | } | ||
| 1427 | |||
| 1428 | if (stream->commited) { | ||
| 1429 | dev_warn(hsw->dev, "warning: stream is already committed, ignore it.\n"); | ||
| 1430 | return 0; | ||
| 1431 | } | ||
| 1432 | |||
| 1418 | trace_ipc_request("stream alloc", stream->host_id); | 1433 | trace_ipc_request("stream alloc", stream->host_id); |
| 1419 | 1434 | ||
| 1420 | header = IPC_GLB_TYPE(IPC_GLB_ALLOCATE_STREAM); | 1435 | header = IPC_GLB_TYPE(IPC_GLB_ALLOCATE_STREAM); |
| @@ -1519,6 +1534,11 @@ int sst_hsw_stream_pause(struct sst_hsw *hsw, struct sst_hsw_stream *stream, | |||
| 1519 | { | 1534 | { |
| 1520 | int ret; | 1535 | int ret; |
| 1521 | 1536 | ||
| 1537 | if (!stream) { | ||
| 1538 | dev_warn(hsw->dev, "warning: stream is NULL, no stream to pause, ignore it.\n"); | ||
| 1539 | return 0; | ||
| 1540 | } | ||
| 1541 | |||
| 1522 | trace_ipc_request("stream pause", stream->reply.stream_hw_id); | 1542 | trace_ipc_request("stream pause", stream->reply.stream_hw_id); |
| 1523 | 1543 | ||
| 1524 | ret = sst_hsw_stream_operations(hsw, IPC_STR_PAUSE, | 1544 | ret = sst_hsw_stream_operations(hsw, IPC_STR_PAUSE, |
| @@ -1535,6 +1555,11 @@ int sst_hsw_stream_resume(struct sst_hsw *hsw, struct sst_hsw_stream *stream, | |||
| 1535 | { | 1555 | { |
| 1536 | int ret; | 1556 | int ret; |
| 1537 | 1557 | ||
| 1558 | if (!stream) { | ||
| 1559 | dev_warn(hsw->dev, "warning: stream is NULL, no stream to resume, ignore it.\n"); | ||
| 1560 | return 0; | ||
| 1561 | } | ||
| 1562 | |||
| 1538 | trace_ipc_request("stream resume", stream->reply.stream_hw_id); | 1563 | trace_ipc_request("stream resume", stream->reply.stream_hw_id); |
| 1539 | 1564 | ||
| 1540 | ret = sst_hsw_stream_operations(hsw, IPC_STR_RESUME, | 1565 | ret = sst_hsw_stream_operations(hsw, IPC_STR_RESUME, |
| @@ -1550,6 +1575,11 @@ int sst_hsw_stream_reset(struct sst_hsw *hsw, struct sst_hsw_stream *stream) | |||
| 1550 | { | 1575 | { |
| 1551 | int ret, tries = 10; | 1576 | int ret, tries = 10; |
| 1552 | 1577 | ||
| 1578 | if (!stream) { | ||
| 1579 | dev_warn(hsw->dev, "warning: stream is NULL, no stream to reset, ignore it.\n"); | ||
| 1580 | return 0; | ||
| 1581 | } | ||
| 1582 | |||
| 1553 | /* dont reset streams that are not commited */ | 1583 | /* dont reset streams that are not commited */ |
| 1554 | if (!stream->commited) | 1584 | if (!stream->commited) |
| 1555 | return 0; | 1585 | return 0; |
