aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/mxs
diff options
context:
space:
mode:
authorMarkus Pargmann <mpa@pengutronix.de>2013-10-11 06:11:04 -0400
committerMark Brown <broonie@linaro.org>2013-10-14 13:01:50 -0400
commit863ebddec85c5ce2fb2e7742e8834a3bd69a2512 (patch)
tree0dcf1d412a080712fa092d3283e6de64c7e2f4ff /sound/soc/mxs
parent88cf632a135188db35b4db412a06b155fa444eb1 (diff)
ASoC: mxs-saif: Handle errors in trigger function
Signed-off-by: Markus Pargmann <mpa@pengutronix.de> Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat (limited to 'sound/soc/mxs')
-rw-r--r--sound/soc/mxs/mxs-saif.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/sound/soc/mxs/mxs-saif.c b/sound/soc/mxs/mxs-saif.c
index c8ead011c95b..fc3d89b75d48 100644
--- a/sound/soc/mxs/mxs-saif.c
+++ b/sound/soc/mxs/mxs-saif.c
@@ -494,6 +494,7 @@ static int mxs_saif_trigger(struct snd_pcm_substream *substream, int cmd,
494 struct mxs_saif *saif = snd_soc_dai_get_drvdata(cpu_dai); 494 struct mxs_saif *saif = snd_soc_dai_get_drvdata(cpu_dai);
495 struct mxs_saif *master_saif; 495 struct mxs_saif *master_saif;
496 u32 delay; 496 u32 delay;
497 int ret;
497 498
498 master_saif = mxs_saif_get_master(saif); 499 master_saif = mxs_saif_get_master(saif);
499 if (!master_saif) 500 if (!master_saif)
@@ -508,21 +509,32 @@ static int mxs_saif_trigger(struct snd_pcm_substream *substream, int cmd,
508 509
509 dev_dbg(cpu_dai->dev, "start\n"); 510 dev_dbg(cpu_dai->dev, "start\n");
510 511
511 clk_enable(master_saif->clk); 512 ret = clk_enable(master_saif->clk);
512 if (!master_saif->mclk_in_use) 513 if (ret) {
513 __raw_writel(BM_SAIF_CTRL_RUN, 514 dev_err(saif->dev, "Failed to enable master clock\n");
514 master_saif->base + SAIF_CTRL + MXS_SET_ADDR); 515 return ret;
516 }
515 517
516 /* 518 /*
517 * If the saif's master is not himself, we also need to enable 519 * If the saif's master is not himself, we also need to enable
518 * itself clk for its internal basic logic to work. 520 * itself clk for its internal basic logic to work.
519 */ 521 */
520 if (saif != master_saif) { 522 if (saif != master_saif) {
521 clk_enable(saif->clk); 523 ret = clk_enable(saif->clk);
524 if (ret) {
525 dev_err(saif->dev, "Failed to enable master clock\n");
526 clk_disable(master_saif->clk);
527 return ret;
528 }
529
522 __raw_writel(BM_SAIF_CTRL_RUN, 530 __raw_writel(BM_SAIF_CTRL_RUN,
523 saif->base + SAIF_CTRL + MXS_SET_ADDR); 531 saif->base + SAIF_CTRL + MXS_SET_ADDR);
524 } 532 }
525 533
534 if (!master_saif->mclk_in_use)
535 __raw_writel(BM_SAIF_CTRL_RUN,
536 master_saif->base + SAIF_CTRL + MXS_SET_ADDR);
537
526 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { 538 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
527 /* 539 /*
528 * write data to saif data register to trigger 540 * write data to saif data register to trigger