static int sst_cdev_open(struct device *dev, struct snd_sst_params *str_params, struct sst_compress_cb *cb) { int str_id, retval; struct stream_info *stream; struct intel_sst_drv *ctx = dev_get_drvdata(dev); retval = pm_runtime_get_sync(ctx->dev); if (retval < 0) return retval; str_id = sst_get_stream(ctx, str_params); if (str_id > 0) { dev_dbg(dev, "stream allocated in sst_cdev_open %d\n", str_id); stream = &ctx->streams[str_id]; stream->compr_cb = cb->compr_cb; stream->compr_cb_param = cb->param; stream->drain_notify = cb->drain_notify; stream->drain_cb_param = cb->drain_cb_param; } else { dev_err(dev, "stream encountered error during alloc %d\n", str_id); str_id = -EINVAL; sst_pm_runtime_put(ctx); } return str_id; }
/* * sst_open_pcm_stream - Open PCM interface * * @str_param: parameters of pcm stream * * This function is called by MID sound card driver to open * a new pcm interface */ static int sst_open_pcm_stream(struct device *dev, struct snd_sst_params *str_param) { int retval; struct intel_sst_drv *ctx = dev_get_drvdata(dev); if (!str_param) return -EINVAL; retval = sst_get_stream(ctx, str_param); if (retval > 0) ctx->stream_cnt++; else dev_err(ctx->dev, "sst_get_stream returned err %d\n", retval); return retval; }
/* * sst_open_pcm_stream - Open PCM interface * * @str_param: parameters of pcm stream * * This function is called by MID sound card driver to open * a new pcm interface */ int sst_open_pcm_stream(struct snd_sst_params *str_param) { struct stream_info *str_info; int retval; pm_runtime_get_sync(&sst_drv_ctx->pci->dev); if (sst_drv_ctx->sst_state == SST_SUSPENDED) { /* LPE is suspended, resume it before proceeding*/ pr_debug("Resuming from Suspended state\n"); retval = intel_sst_resume(sst_drv_ctx->pci); if (retval) { pr_err("Resume Failed = %#x, abort\n", retval); pm_runtime_put(&sst_drv_ctx->pci->dev); return retval; } } if (sst_drv_ctx->sst_state == SST_UN_INIT) { /* FW is not downloaded */ pr_debug("DSP Downloading FW now...\n"); retval = sst_download_fw(); if (retval) { pr_err("FW download fail %x, abort\n", retval); pm_runtime_put(&sst_drv_ctx->pci->dev); return retval; } send_intial_rx_timeslot(); } if (!str_param) { pm_runtime_put(&sst_drv_ctx->pci->dev); return -EINVAL; } retval = sst_get_stream(str_param); if (retval > 0) { sst_drv_ctx->stream_cnt++; str_info = &sst_drv_ctx->streams[retval]; str_info->src = MAD_DRV; } else pm_runtime_put(&sst_drv_ctx->pci->dev); return retval; }