1
0
Fork 0

MLK-18979-1: ASoC: fsl_asrc: add resume function for asrc_m2m

There will be "output DMA task timeout" after suspend and resume.
The reason is there is not enough data in the input FIFO.

In the fsl_asrc_start_pair function we initialize the FIFO with
zero data after pair is enabled, it looks like we add more data
to input FIFO. For example if the input buffer length is 100,
but the actual length is 100 + channel*4. so we need to do same
work in resume for the asrc pair is disabled in suspend, the
input FIFO is cleared.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
pull/10/head
Shengjiu Wang 2018-09-04 15:39:23 +08:00 committed by Jason Liu
parent 9188a04e21
commit 7268718ae3
2 changed files with 28 additions and 0 deletions

View File

@ -1320,10 +1320,13 @@ static int fsl_asrc_suspend(struct device *dev)
static int fsl_asrc_resume(struct device *dev)
{
struct fsl_asrc *asrc_priv = dev_get_drvdata(dev);
int ret;
ret = pm_runtime_force_resume(dev);
fsl_asrc_m2m_resume(asrc_priv);
return ret;
}
#endif /* CONFIG_PM_SLEEP */

View File

@ -1021,3 +1021,28 @@ static void fsl_asrc_m2m_suspend(struct fsl_asrc *asrc_priv)
spin_unlock_irqrestore(&asrc_priv->lock, lock_flags);
}
}
static void fsl_asrc_m2m_resume(struct fsl_asrc *asrc_priv)
{
struct fsl_asrc_pair *pair;
struct fsl_asrc_m2m *m2m;
unsigned long lock_flags;
enum asrc_pair_index index;
int i, j;
for (i = 0; i < ASRC_PAIR_MAX_NUM; i++) {
spin_lock_irqsave(&asrc_priv->lock, lock_flags);
pair = asrc_priv->pair[i];
if (!pair || !pair->private) {
spin_unlock_irqrestore(&asrc_priv->lock, lock_flags);
continue;
}
m2m = pair->private;
index = pair->index;
for (j = 0; j < pair->channels * 4; j++)
regmap_write(asrc_priv->regmap, REG_ASRDI(index), 0);
spin_unlock_irqrestore(&asrc_priv->lock, lock_flags);
}
}