summaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorShengjiu Wang <shengjiu.wang@nxp.com>2018-09-04 15:39:23 +0800
committerDong Aisheng <aisheng.dong@nxp.com>2019-11-25 15:48:34 +0800
commite0e7942c70746e9487cab9a751b825d0e7ddba30 (patch)
treedab3cae1bc93cad87325b6370177d9eaef65b3ec /sound
parent9d607a7189bad77c8357a0646a353e5ee74d9d4c (diff)
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>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/fsl/fsl_asrc.c3
-rw-r--r--sound/soc/fsl/fsl_asrc_m2m.c25
2 files changed, 28 insertions, 0 deletions
diff --git a/sound/soc/fsl/fsl_asrc.c b/sound/soc/fsl/fsl_asrc.c
index ede17dddae6a..c1db84d6756a 100644
--- a/sound/soc/fsl/fsl_asrc.c
+++ b/sound/soc/fsl/fsl_asrc.c
@@ -1235,10 +1235,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 */
diff --git a/sound/soc/fsl/fsl_asrc_m2m.c b/sound/soc/fsl/fsl_asrc_m2m.c
index 2684518d26ee..9c5a2a2805f4 100644
--- a/sound/soc/fsl/fsl_asrc_m2m.c
+++ b/sound/soc/fsl/fsl_asrc_m2m.c
@@ -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);
+ }
+}