aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/fsl
diff options
context:
space:
mode:
authorShengjiu Wang <shengjiu.wang@freescale.com>2015-11-24 04:19:32 -0500
committerMark Brown <broonie@kernel.org>2015-11-25 07:13:46 -0500
commita2a4d6049aa18c0e105d9b53e3236cb50ea5bfa1 (patch)
tree68f47c7e2b869c5238c5a995e9f6d13bfd58b72b /sound/soc/fsl
parent8005c49d9aea74d382f474ce11afbbc7d7130bec (diff)
ASoC: fsl_esai: spba clock is needed by esai device
ESAI need to enable the spba clock, when sdma is using share peripheral script. In this case, there is two spba master port is used, if don't enable the clock, the spba bus will have arbitration issue, which may cause read/write wrong data from/to ESAI registers. Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com> Acked-by: Nicolin Chen <nicoleotsuka@gmail.com> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/fsl')
-rw-r--r--sound/soc/fsl/fsl_esai.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/sound/soc/fsl/fsl_esai.c b/sound/soc/fsl/fsl_esai.c
index 59f234e51971..6746f76a8c7f 100644
--- a/sound/soc/fsl/fsl_esai.c
+++ b/sound/soc/fsl/fsl_esai.c
@@ -35,6 +35,7 @@
35 * @coreclk: clock source to access register 35 * @coreclk: clock source to access register
36 * @extalclk: esai clock source to derive HCK, SCK and FS 36 * @extalclk: esai clock source to derive HCK, SCK and FS
37 * @fsysclk: system clock source to derive HCK, SCK and FS 37 * @fsysclk: system clock source to derive HCK, SCK and FS
38 * @spbaclk: SPBA clock (optional, depending on SoC design)
38 * @fifo_depth: depth of tx/rx FIFO 39 * @fifo_depth: depth of tx/rx FIFO
39 * @slot_width: width of each DAI slot 40 * @slot_width: width of each DAI slot
40 * @slots: number of slots 41 * @slots: number of slots
@@ -54,6 +55,7 @@ struct fsl_esai {
54 struct clk *coreclk; 55 struct clk *coreclk;
55 struct clk *extalclk; 56 struct clk *extalclk;
56 struct clk *fsysclk; 57 struct clk *fsysclk;
58 struct clk *spbaclk;
57 u32 fifo_depth; 59 u32 fifo_depth;
58 u32 slot_width; 60 u32 slot_width;
59 u32 slots; 61 u32 slots;
@@ -469,6 +471,11 @@ static int fsl_esai_startup(struct snd_pcm_substream *substream,
469 ret = clk_prepare_enable(esai_priv->coreclk); 471 ret = clk_prepare_enable(esai_priv->coreclk);
470 if (ret) 472 if (ret)
471 return ret; 473 return ret;
474 if (!IS_ERR(esai_priv->spbaclk)) {
475 ret = clk_prepare_enable(esai_priv->spbaclk);
476 if (ret)
477 goto err_spbaclk;
478 }
472 if (!IS_ERR(esai_priv->extalclk)) { 479 if (!IS_ERR(esai_priv->extalclk)) {
473 ret = clk_prepare_enable(esai_priv->extalclk); 480 ret = clk_prepare_enable(esai_priv->extalclk);
474 if (ret) 481 if (ret)
@@ -499,6 +506,9 @@ err_fsysclk:
499 if (!IS_ERR(esai_priv->extalclk)) 506 if (!IS_ERR(esai_priv->extalclk))
500 clk_disable_unprepare(esai_priv->extalclk); 507 clk_disable_unprepare(esai_priv->extalclk);
501err_extalck: 508err_extalck:
509 if (!IS_ERR(esai_priv->spbaclk))
510 clk_disable_unprepare(esai_priv->spbaclk);
511err_spbaclk:
502 clk_disable_unprepare(esai_priv->coreclk); 512 clk_disable_unprepare(esai_priv->coreclk);
503 513
504 return ret; 514 return ret;
@@ -564,6 +574,8 @@ static void fsl_esai_shutdown(struct snd_pcm_substream *substream,
564 clk_disable_unprepare(esai_priv->fsysclk); 574 clk_disable_unprepare(esai_priv->fsysclk);
565 if (!IS_ERR(esai_priv->extalclk)) 575 if (!IS_ERR(esai_priv->extalclk))
566 clk_disable_unprepare(esai_priv->extalclk); 576 clk_disable_unprepare(esai_priv->extalclk);
577 if (!IS_ERR(esai_priv->spbaclk))
578 clk_disable_unprepare(esai_priv->spbaclk);
567 clk_disable_unprepare(esai_priv->coreclk); 579 clk_disable_unprepare(esai_priv->coreclk);
568} 580}
569 581
@@ -819,6 +831,11 @@ static int fsl_esai_probe(struct platform_device *pdev)
819 dev_warn(&pdev->dev, "failed to get fsys clock: %ld\n", 831 dev_warn(&pdev->dev, "failed to get fsys clock: %ld\n",
820 PTR_ERR(esai_priv->fsysclk)); 832 PTR_ERR(esai_priv->fsysclk));
821 833
834 esai_priv->spbaclk = devm_clk_get(&pdev->dev, "spba");
835 if (IS_ERR(esai_priv->spbaclk))
836 dev_warn(&pdev->dev, "failed to get spba clock: %ld\n",
837 PTR_ERR(esai_priv->spbaclk));
838
822 irq = platform_get_irq(pdev, 0); 839 irq = platform_get_irq(pdev, 0);
823 if (irq < 0) { 840 if (irq < 0) {
824 dev_err(&pdev->dev, "no irq for node %s\n", pdev->name); 841 dev_err(&pdev->dev, "no irq for node %s\n", pdev->name);