mirror of https://github.com/thesofproject/sof.git
lib: dai: expose and rename dai_config_reset()
Move the function dai_config_reset to the common DAI code so it can be reused. Also, rename it to dai_dma_release as it does not really reset the DAI config but rather releases the DMA channel. Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
This commit is contained in:
parent
4c3aafea4c
commit
500e96b6ac
|
@ -609,27 +609,6 @@ static int dai_config_prepare(struct comp_dev *dev)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void dai_config_reset(struct comp_dev *dev)
|
||||
{
|
||||
struct dai_data *dd = comp_get_drvdata(dev);
|
||||
|
||||
/* cannot configure DAI while active */
|
||||
if (dev->state == COMP_STATE_ACTIVE) {
|
||||
comp_info(dev, "dai_config(): Component is in active state. Ignore resetting");
|
||||
return;
|
||||
}
|
||||
|
||||
/* put the allocated DMA channel first */
|
||||
if (dd->chan) {
|
||||
dma_channel_put(dd->chan);
|
||||
dd->chan = NULL;
|
||||
|
||||
/* remove callback */
|
||||
notifier_unregister(dev, dd->chan,
|
||||
NOTIFIER_ID_DMA_COPY);
|
||||
}
|
||||
}
|
||||
|
||||
static int dai_prepare(struct comp_dev *dev)
|
||||
{
|
||||
struct dai_data *dd = comp_get_drvdata(dev);
|
||||
|
@ -686,7 +665,7 @@ static int dai_reset(struct comp_dev *dev)
|
|||
|
||||
comp_info(dev, "dai_reset()");
|
||||
|
||||
dai_config_reset(dev);
|
||||
dai_dma_release(dev);
|
||||
|
||||
dma_sg_free(&config->elem_array);
|
||||
|
||||
|
|
|
@ -508,6 +508,11 @@ static inline const struct dai_info *dai_info_get(void)
|
|||
*/
|
||||
int dai_config_dma_channel(struct comp_dev *dev, void *config);
|
||||
|
||||
/**
|
||||
* \brief Reset DAI DMA config
|
||||
*/
|
||||
void dai_dma_release(struct comp_dev *dev);
|
||||
|
||||
/**
|
||||
* \brief Configure DAI physical interface.
|
||||
*/
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#include <sof/ipc/msg.h>
|
||||
#include <sof/ipc/driver.h>
|
||||
#include <sof/lib/dai.h>
|
||||
#include <sof/lib/notifier.h>
|
||||
#include <sof/drivers/afe-dai.h>
|
||||
#include <sof/drivers/edma.h>
|
||||
#include <errno.h>
|
||||
|
@ -247,6 +248,25 @@ int ipc_comp_dai_config(struct ipc *ipc, struct ipc_config_dai *common_config,
|
|||
return ret;
|
||||
}
|
||||
|
||||
void dai_dma_release(struct comp_dev *dev)
|
||||
{
|
||||
struct dai_data *dd = comp_get_drvdata(dev);
|
||||
|
||||
/* cannot configure DAI while active */
|
||||
if (dev->state == COMP_STATE_ACTIVE) {
|
||||
comp_info(dev, "dai_config(): Component is in active state. Ignore resetting");
|
||||
return;
|
||||
}
|
||||
|
||||
/* put the allocated DMA channel first */
|
||||
if (dd->chan) {
|
||||
/* remove callback */
|
||||
notifier_unregister(dev, dd->chan, NOTIFIER_ID_DMA_COPY);
|
||||
dma_channel_put(dd->chan);
|
||||
dd->chan = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
int dai_config(struct comp_dev *dev, struct ipc_config_dai *common_config,
|
||||
void *spec_config)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue