int free_stream_context(struct intel_sst_drv *ctx, unsignedint str_id)
{ struct stream_info *stream; int ret = 0;
stream = get_stream_info(ctx, str_id); if (stream) { /* str_id is valid, so stream is alloacted */
ret = sst_free_stream(ctx, str_id); if (ret)
sst_clean_stream(&ctx->streams[str_id]); return ret;
} else {
dev_err(ctx->dev, "we tried to free stream context %d which was freed!!!\n", str_id);
} return ret;
}
/* * sst_get_sfreq - this function returns the frequency of the stream * * @str_param : stream params
*/ int sst_get_sfreq(struct snd_sst_params *str_param)
{ switch (str_param->codec) { case SST_CODEC_TYPE_PCM: return str_param->sparams.uc.pcm_params.sfreq; case SST_CODEC_TYPE_AAC: return str_param->sparams.uc.aac_params.externalsr; case SST_CODEC_TYPE_MP3: return 0; default: return -EINVAL;
}
}
/* * sst_get_num_channel - get number of channels for the stream * * @str_param : stream params
*/ int sst_get_num_channel(struct snd_sst_params *str_param)
{ switch (str_param->codec) { case SST_CODEC_TYPE_PCM: return str_param->sparams.uc.pcm_params.num_chan; case SST_CODEC_TYPE_MP3: return str_param->sparams.uc.mp3_params.num_chan; case SST_CODEC_TYPE_AAC: return str_param->sparams.uc.aac_params.num_chan; default: return -EINVAL;
}
}
/* * sst_get_stream - this function prepares for stream allocation * * @str_param : stream param
*/ int sst_get_stream(struct intel_sst_drv *ctx, struct snd_sst_params *str_param)
{ int retval; struct stream_info *str_info;
/* stream is not allocated, we are allocating */
retval = ctx->ops->alloc_stream(ctx, str_param); if (retval <= 0) { return -EIO;
} /* store sampling freq */
str_info = &ctx->streams[retval];
str_info->sfreq = sst_get_sfreq(str_param);
return retval;
}
staticint sst_power_control(struct device *dev, bool state)
{ struct intel_sst_drv *ctx = dev_get_drvdata(dev); int ret = 0; int usage_count = 0;
if (state) {
ret = pm_runtime_resume_and_get(dev);
usage_count = GET_USAGE_COUNT(dev);
dev_dbg(ctx->dev, "Enable: pm usage count: %d\n", usage_count); if (ret < 0) {
dev_err(ctx->dev, "Runtime get failed with err: %d\n", ret); return ret;
} if ((ctx->sst_state == SST_RESET) && (usage_count == 1)) {
ret = sst_load_fw(ctx); if (ret) {
dev_err(dev, "FW download fail %d\n", ret);
sst_set_fw_state_locked(ctx, SST_RESET);
ret = sst_pm_runtime_put(ctx);
}
}
} else {
usage_count = GET_USAGE_COUNT(dev);
dev_dbg(ctx->dev, "Disable: pm usage count: %d\n", usage_count); return sst_pm_runtime_put(ctx);
} return ret;
}
/* * 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
*/ staticint 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);
/* * sst_close_pcm_stream - Close PCM interface * * @str_id: stream id to be closed * * This function is called by MID sound card driver to close * an existing pcm interface
*/ staticint sst_close_pcm_stream(struct device *dev, unsignedint str_id)
{ struct stream_info *stream; int retval = 0; struct intel_sst_drv *ctx = dev_get_drvdata(dev);
stream = get_stream_info(ctx, str_id); if (!stream) {
dev_err(ctx->dev, "stream info is NULL for str %d!!!\n", str_id); return -EINVAL;
}
/* * sst_set_byte_stream - Set generic params * * @cmd: control cmd to be set * @arg: command argument * * This function is called by MID sound card driver to configure * SST runtime params.
*/ staticint sst_send_byte_stream(struct device *dev, struct snd_sst_bytes_v2 *bytes)
{ int ret_val = 0; struct intel_sst_drv *ctx = dev_get_drvdata(dev);
if (NULL == bytes) return -EINVAL;
ret_val = pm_runtime_resume_and_get(ctx->dev); if (ret_val < 0) return ret_val;
/* * sst_register - function to register DSP * * This functions registers DSP with the platform driver
*/ int sst_register(struct device *dev)
{ int ret_val;
sst_dsp_device.dev = dev;
ret_val = sst_register_dsp(&sst_dsp_device); if (ret_val)
dev_err(dev, "Unable to register DSP with platform driver\n");
return ret_val;
}
int sst_unregister(struct device *dev)
{ return sst_unregister_dsp(&sst_dsp_device);
}
Messung V0.5
¤ Dauer der Verarbeitung: 0.4 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.