Commit 863ebdde authored by Markus Pargmann's avatar Markus Pargmann Committed by Mark Brown

ASoC: mxs-saif: Handle errors in trigger function

Signed-off-by: default avatarMarkus Pargmann <mpa@pengutronix.de>
Signed-off-by: default avatarMark Brown <broonie@linaro.org>
parent 88cf632a
...@@ -494,6 +494,7 @@ static int mxs_saif_trigger(struct snd_pcm_substream *substream, int cmd, ...@@ -494,6 +494,7 @@ static int mxs_saif_trigger(struct snd_pcm_substream *substream, int cmd,
struct mxs_saif *saif = snd_soc_dai_get_drvdata(cpu_dai); struct mxs_saif *saif = snd_soc_dai_get_drvdata(cpu_dai);
struct mxs_saif *master_saif; struct mxs_saif *master_saif;
u32 delay; u32 delay;
int ret;
master_saif = mxs_saif_get_master(saif); master_saif = mxs_saif_get_master(saif);
if (!master_saif) if (!master_saif)
...@@ -508,21 +509,32 @@ static int mxs_saif_trigger(struct snd_pcm_substream *substream, int cmd, ...@@ -508,21 +509,32 @@ static int mxs_saif_trigger(struct snd_pcm_substream *substream, int cmd,
dev_dbg(cpu_dai->dev, "start\n"); dev_dbg(cpu_dai->dev, "start\n");
clk_enable(master_saif->clk); ret = clk_enable(master_saif->clk);
if (!master_saif->mclk_in_use) if (ret) {
__raw_writel(BM_SAIF_CTRL_RUN, dev_err(saif->dev, "Failed to enable master clock\n");
master_saif->base + SAIF_CTRL + MXS_SET_ADDR); return ret;
}
/* /*
* If the saif's master is not himself, we also need to enable * If the saif's master is not himself, we also need to enable
* itself clk for its internal basic logic to work. * itself clk for its internal basic logic to work.
*/ */
if (saif != master_saif) { if (saif != master_saif) {
clk_enable(saif->clk); ret = clk_enable(saif->clk);
if (ret) {
dev_err(saif->dev, "Failed to enable master clock\n");
clk_disable(master_saif->clk);
return ret;
}
__raw_writel(BM_SAIF_CTRL_RUN, __raw_writel(BM_SAIF_CTRL_RUN,
saif->base + SAIF_CTRL + MXS_SET_ADDR); saif->base + SAIF_CTRL + MXS_SET_ADDR);
} }
if (!master_saif->mclk_in_use)
__raw_writel(BM_SAIF_CTRL_RUN,
master_saif->base + SAIF_CTRL + MXS_SET_ADDR);
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
/* /*
* write data to saif data register to trigger * write data to saif data register to trigger
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment