/**
 * sst_drop_stream - Send msg for stopping stream
 * @str_id:		stream ID
 *
 * This function is called by any function which wants to stop
 * a stream.
 */
int sst_drop_stream(int str_id)
{
	int retval = 0, pvt_id;
	struct stream_info *str_info;
	struct ipc_post *msg = NULL;
	struct ipc_dsp_hdr dsp_hdr;

	pr_debug("SST DBG:sst_drop_stream for %d\n", str_id);
	str_info = get_stream_info(str_id);
	if (!str_info)
		return -EINVAL;

	if (str_info->status != STREAM_UN_INIT) {

		if ((sst_drv_ctx->pci_id != SST_MRFLD_PCI_ID) ||
				(sst_drv_ctx->use_32bit_ops == true)) {
			str_info->prev = STREAM_UN_INIT;
			str_info->status = STREAM_INIT;
			str_info->cumm_bytes = 0;
			sst_send_sync_msg(IPC_IA_DROP_STREAM, str_id);
		} else {
			if (sst_create_ipc_msg(&msg, true))
				return -ENOMEM;
			str_info->prev = STREAM_UN_INIT;
			str_info->status = STREAM_INIT;
			str_info->cumm_bytes = 0;
			pvt_id = sst_assign_pvt_id(sst_drv_ctx);
			sst_fill_header_mrfld(&msg->mrfld_header, IPC_CMD,
					      str_info->task_id, 1, pvt_id);

			msg->mrfld_header.p.header_low_payload = sizeof(dsp_hdr);
			sst_fill_header_dsp(&dsp_hdr, IPC_IA_DROP_STREAM_MRFLD,
					str_info->pipe_id, 0);
			memcpy(msg->mailbox_data, &dsp_hdr, sizeof(dsp_hdr));
			sst_drv_ctx->ops->sync_post_message(msg);
		}
	} else {
		retval = -EBADRQC;
		pr_debug("BADQRC for stream, state %x\n", str_info->status);
	}
	return retval;
}
Exemplo n.º 2
0
/**
 * sst_drop_stream - Send msg for stopping stream
 * @str_id:		stream ID
 *
 * This function is called by any function which wants to stop
 * a stream.
 */
int sst_drop_stream(int str_id)
{
	int retval = 0;
	struct stream_info *str_info;

	pr_debug("SST DBG:sst_drop_stream for %d\n", str_id);
	str_info = get_stream_info(str_id);
	if (!str_info)
		return -EINVAL;

	if (str_info->status != STREAM_UN_INIT) {

		str_info->prev = STREAM_UN_INIT;
		str_info->status = STREAM_INIT;
		str_info->cumm_bytes = 0;
		sst_send_sync_msg(IPC_IA_DROP_STREAM, str_id);
	} else {
		retval = -EBADRQC;
		pr_debug("BADQRC for stream, state %x\n", str_info->status);
	}
	return retval;
}