aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/fsl
diff options
context:
space:
mode:
authorShengjiu Wang <shengjiu.wang@freescale.com>2015-11-24 04:19:34 -0500
committerMark Brown <broonie@kernel.org>2015-11-25 07:14:42 -0500
commit13b8a97a760eee021558dc48fd65e77e8a362909 (patch)
tree15ebeaed447c3004c17c625547fdd84df35af2a1 /sound/soc/fsl
parent8005c49d9aea74d382f474ce11afbbc7d7130bec (diff)
ASoC: fsl_asrc: spba clock is needed by asrc device
ASRC 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 ASRC 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_asrc.c14
-rw-r--r--sound/soc/fsl/fsl_asrc.h2
2 files changed, 16 insertions, 0 deletions
diff --git a/sound/soc/fsl/fsl_asrc.c b/sound/soc/fsl/fsl_asrc.c
index 9f087d4f73ed..cf382475670b 100644
--- a/sound/soc/fsl/fsl_asrc.c
+++ b/sound/soc/fsl/fsl_asrc.c
@@ -859,6 +859,10 @@ static int fsl_asrc_probe(struct platform_device *pdev)
859 return PTR_ERR(asrc_priv->ipg_clk); 859 return PTR_ERR(asrc_priv->ipg_clk);
860 } 860 }
861 861
862 asrc_priv->spba_clk = devm_clk_get(&pdev->dev, "spba");
863 if (IS_ERR(asrc_priv->spba_clk))
864 dev_warn(&pdev->dev, "failed to get spba clock\n");
865
862 for (i = 0; i < ASRC_CLK_MAX_NUM; i++) { 866 for (i = 0; i < ASRC_CLK_MAX_NUM; i++) {
863 sprintf(tmp, "asrck_%x", i); 867 sprintf(tmp, "asrck_%x", i);
864 asrc_priv->asrck_clk[i] = devm_clk_get(&pdev->dev, tmp); 868 asrc_priv->asrck_clk[i] = devm_clk_get(&pdev->dev, tmp);
@@ -939,6 +943,11 @@ static int fsl_asrc_runtime_resume(struct device *dev)
939 ret = clk_prepare_enable(asrc_priv->ipg_clk); 943 ret = clk_prepare_enable(asrc_priv->ipg_clk);
940 if (ret) 944 if (ret)
941 goto disable_mem_clk; 945 goto disable_mem_clk;
946 if (!IS_ERR(asrc_priv->spba_clk)) {
947 ret = clk_prepare_enable(asrc_priv->spba_clk);
948 if (ret)
949 goto disable_ipg_clk;
950 }
942 for (i = 0; i < ASRC_CLK_MAX_NUM; i++) { 951 for (i = 0; i < ASRC_CLK_MAX_NUM; i++) {
943 ret = clk_prepare_enable(asrc_priv->asrck_clk[i]); 952 ret = clk_prepare_enable(asrc_priv->asrck_clk[i]);
944 if (ret) 953 if (ret)
@@ -950,6 +959,9 @@ static int fsl_asrc_runtime_resume(struct device *dev)
950disable_asrck_clk: 959disable_asrck_clk:
951 for (i--; i >= 0; i--) 960 for (i--; i >= 0; i--)
952 clk_disable_unprepare(asrc_priv->asrck_clk[i]); 961 clk_disable_unprepare(asrc_priv->asrck_clk[i]);
962 if (!IS_ERR(asrc_priv->spba_clk))
963 clk_disable_unprepare(asrc_priv->spba_clk);
964disable_ipg_clk:
953 clk_disable_unprepare(asrc_priv->ipg_clk); 965 clk_disable_unprepare(asrc_priv->ipg_clk);
954disable_mem_clk: 966disable_mem_clk:
955 clk_disable_unprepare(asrc_priv->mem_clk); 967 clk_disable_unprepare(asrc_priv->mem_clk);
@@ -963,6 +975,8 @@ static int fsl_asrc_runtime_suspend(struct device *dev)
963 975
964 for (i = 0; i < ASRC_CLK_MAX_NUM; i++) 976 for (i = 0; i < ASRC_CLK_MAX_NUM; i++)
965 clk_disable_unprepare(asrc_priv->asrck_clk[i]); 977 clk_disable_unprepare(asrc_priv->asrck_clk[i]);
978 if (!IS_ERR(asrc_priv->spba_clk))
979 clk_disable_unprepare(asrc_priv->spba_clk);
966 clk_disable_unprepare(asrc_priv->ipg_clk); 980 clk_disable_unprepare(asrc_priv->ipg_clk);
967 clk_disable_unprepare(asrc_priv->mem_clk); 981 clk_disable_unprepare(asrc_priv->mem_clk);
968 982
diff --git a/sound/soc/fsl/fsl_asrc.h b/sound/soc/fsl/fsl_asrc.h
index 4aed63c4b431..68802cdc3f28 100644
--- a/sound/soc/fsl/fsl_asrc.h
+++ b/sound/soc/fsl/fsl_asrc.h
@@ -426,6 +426,7 @@ struct fsl_asrc_pair {
426 * @paddr: physical address to the base address of registers 426 * @paddr: physical address to the base address of registers
427 * @mem_clk: clock source to access register 427 * @mem_clk: clock source to access register
428 * @ipg_clk: clock source to drive peripheral 428 * @ipg_clk: clock source to drive peripheral
429 * @spba_clk: SPBA clock (optional, depending on SoC design)
429 * @asrck_clk: clock sources to driver ASRC internal logic 430 * @asrck_clk: clock sources to driver ASRC internal logic
430 * @lock: spin lock for resource protection 431 * @lock: spin lock for resource protection
431 * @pair: pair pointers 432 * @pair: pair pointers
@@ -442,6 +443,7 @@ struct fsl_asrc {
442 unsigned long paddr; 443 unsigned long paddr;
443 struct clk *mem_clk; 444 struct clk *mem_clk;
444 struct clk *ipg_clk; 445 struct clk *ipg_clk;
446 struct clk *spba_clk;
445 struct clk *asrck_clk[ASRC_CLK_MAX_NUM]; 447 struct clk *asrck_clk[ASRC_CLK_MAX_NUM];
446 spinlock_t lock; 448 spinlock_t lock;
447 449