/* read format from topology */
snd_mask_none(fmt);
- switch (dai->comp_dai.config.frame_fmt) {
+ switch (dai->comp_dai->config.frame_fmt) {
case SOF_IPC_FRAME_S16_LE:
snd_mask_set_format(fmt, SNDRV_PCM_FORMAT_S16_LE);
break;
break;
case SOF_DAI_INTEL_DMIC:
/* DMIC only supports 16 or 32 bit formats */
- if (dai->comp_dai.config.frame_fmt == SOF_IPC_FRAME_S24_4LE) {
+ if (dai->comp_dai->config.frame_fmt == SOF_IPC_FRAME_S24_4LE) {
dev_err(component->dev,
"error: invalid fmt %d for DAI type %d\n",
- dai->comp_dai.config.frame_fmt,
+ dai->comp_dai->config.frame_fmt,
dai->dai_config->type);
}
break;
struct sof_ipc_cmd_hdr *hdr;
struct sof_ipc_comp *comp;
struct snd_sof_dai *dai;
- size_t ipc_size;
int ret;
/* skip if there is no private data */
switch (swidget->id) {
case snd_soc_dapm_dai_in:
case snd_soc_dapm_dai_out:
- ipc_size = sizeof(struct sof_ipc_comp_dai) + sizeof(struct sof_ipc_comp_ext);
- comp = kzalloc(ipc_size, GFP_KERNEL);
- if (!comp) {
- ret = -ENOMEM;
- goto core_put;
- }
-
dai = swidget->private;
+ comp = &dai->comp_dai->comp;
dai->configured = false;
- memcpy(comp, &dai->comp_dai, sizeof(struct sof_ipc_comp_dai));
- /* append extended data to the end of the component */
- memcpy((u8 *)comp + sizeof(struct sof_ipc_comp_dai), &swidget->comp_ext,
- sizeof(swidget->comp_ext));
-
- ret = sof_ipc_tx_message(sdev->ipc, comp->hdr.cmd, comp, ipc_size, &r, sizeof(r));
- kfree(comp);
+ ret = sof_ipc_tx_message(sdev->ipc, comp->hdr.cmd, dai->comp_dai, comp->hdr.size,
+ &r, sizeof(r));
if (ret < 0) {
dev_err(sdev->dev, "error: failed to load widget %s\n",
swidget->widget->name);
struct snd_soc_component *scomp;
const char *name;
- struct sof_ipc_comp_dai comp_dai;
+ struct sof_ipc_comp_dai *comp_dai;
int number_configs;
int current_config;
bool configured; /* DAI configured during BE hw_params */
if (ret != 0) {
dev_err(scomp->dev, "error: parse dai tokens failed %d\n",
le32_to_cpu(private->size));
- goto finish;
+ return ret;
}
ret = sof_parse_tokens(scomp, &comp_dai->config, comp_tokens,
if (ret != 0) {
dev_err(scomp->dev, "error: parse dai.cfg tokens failed %d\n",
private->size);
- goto finish;
+ return ret;
}
dev_dbg(scomp->dev, "dai %s: type %d index %d\n",
if (dai) {
dai->scomp = scomp;
-
- /*
- * copy only the sof_ipc_comp_dai to avoid collapsing
- * the snd_sof_dai, the extended data is kept in the
- * snd_sof_widget.
- */
- memcpy(&dai->comp_dai, comp_dai, sizeof(*comp_dai));
+ dai->comp_dai = comp_dai;
}
-finish:
- kfree(comp_dai);
return ret;
}
dai = swidget->private;
if (dai) {
+ kfree(dai->comp_dai);
/* free dai config */
kfree(dai->dai_config);
list_del(&dai->list);
* dai_index.
*/
for (i = 0; i < num_conf; i++)
- config[i].dai_index = dai->comp_dai.dai_index;
+ config[i].dai_index = dai->comp_dai->dai_index;
dev_dbg(sdev->dev, "set DAI config for %s index %d\n",
dai->name, config[curr_conf].dai_index);