dai: host: move notifier calls to valid locations

Moves notifier_register and notifier_unregister calls to original
valid locations. It has been moved previously to comp_trigger due
to the specific implementation of SMP. Now they can be moved back,
since every component is created on dedicated core.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
This commit is contained in:
Tomasz Lauda 2020-01-21 13:38:34 +01:00 committed by Liam Girdwood
parent b0e9f91699
commit e22d6e940f
2 changed files with 19 additions and 12 deletions

View File

@ -209,8 +209,10 @@ static void dai_free(struct comp_dev *dev)
{
struct dai_data *dd = comp_get_drvdata(dev);
if (dd->chan)
if (dd->chan) {
notifier_unregister(dev, dd->chan, NOTIFIER_ID_DMA_COPY);
dma_channel_put(dd->chan);
}
dma_put(dd->dma);
@ -546,11 +548,6 @@ static int dai_comp_trigger(struct comp_dev *dev, int cmd)
if (ret == COMP_STATUS_STATE_ALREADY_SET)
return PPL_STATUS_PATH_STOP;
/* setup callback */
notifier_unregister(dev, dd->chan, NOTIFIER_ID_DMA_COPY);
notifier_register(dev, dd->chan, NOTIFIER_ID_DMA_COPY,
dai_dma_cb);
switch (cmd) {
case COMP_TRIGGER_START:
trace_dai_with_ids(dev, "dai_comp_trigger(), START");
@ -792,7 +789,11 @@ static int dai_config(struct comp_dev *dev, struct sof_ipc_dai_config *config)
platform_shared_commit(dd->dai, sizeof(*dd->dai));
if (channel != DMA_CHAN_INVALID) {
if (!dd->chan)
if (dd->chan)
/* remove callback */
notifier_unregister(dev, dd->chan,
NOTIFIER_ID_DMA_COPY);
else
/* get dma channel at first config only */
dd->chan = dma_channel_get(dd->dma, channel);
@ -802,6 +803,10 @@ static int dai_config(struct comp_dev *dev, struct sof_ipc_dai_config *config)
dd->chan = NULL;
return -EIO;
}
/* setup callback */
notifier_register(dev, dd->chan, NOTIFIER_ID_DMA_COPY,
dai_dma_cb);
}
return dai_set_config(dd->dai, config);

View File

@ -309,10 +309,6 @@ static int host_trigger(struct comp_dev *dev, int cmd)
return ret;
}
/* set up callback */
notifier_unregister(dev, hd->chan, NOTIFIER_ID_DMA_COPY);
notifier_register(dev, hd->chan, NOTIFIER_ID_DMA_COPY, host_dma_cb);
/* we should ignore any trigger commands besides start
* when doing one shot, because transfers will stop automatically
*/
@ -608,6 +604,9 @@ static int host_params(struct comp_dev *dev,
return err;
}
/* set up callback */
notifier_register(dev, hd->chan, NOTIFIER_ID_DMA_COPY, host_dma_cb);
/* set processing function */
hd->process =
pcm_get_conversion_function(hd->local_buffer->stream.frame_fmt,
@ -666,8 +665,11 @@ static int host_reset(struct comp_dev *dev)
trace_host_with_ids(dev, "host_reset()");
if (hd->chan)
if (hd->chan) {
/* remove callback */
notifier_unregister(dev, hd->chan, NOTIFIER_ID_DMA_COPY);
dma_channel_put(hd->chan);
}
/* free all DMA elements */
dma_sg_free(&hd->host.elem_array);