aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/mxs/mxs-saif.c
diff options
context:
space:
mode:
authorMark Brown <broonie@linaro.org>2013-07-04 13:30:02 -0400
committerMark Brown <broonie@linaro.org>2013-07-04 13:30:02 -0400
commit1b36881105249c8a3a0e56434e43d3e2fbbef704 (patch)
tree17b22b6267a6e217182d9394d573379efb172147 /sound/soc/mxs/mxs-saif.c
parent986a622df307644af14618bee54c901aa74816da (diff)
parent7c9e6150f2e7cbd60e0bc9a19118ca1dc97d2780 (diff)
Merge remote-tracking branch 'asoc/fix/mxs' into asoc-linus
Diffstat (limited to 'sound/soc/mxs/mxs-saif.c')
-rw-r--r--sound/soc/mxs/mxs-saif.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/sound/soc/mxs/mxs-saif.c b/sound/soc/mxs/mxs-saif.c
index 49d870034bc3..54511c5e6a7c 100644
--- a/sound/soc/mxs/mxs-saif.c
+++ b/sound/soc/mxs/mxs-saif.c
@@ -24,6 +24,7 @@
24#include <linux/slab.h> 24#include <linux/slab.h>
25#include <linux/dma-mapping.h> 25#include <linux/dma-mapping.h>
26#include <linux/clk.h> 26#include <linux/clk.h>
27#include <linux/clk-provider.h>
27#include <linux/delay.h> 28#include <linux/delay.h>
28#include <linux/time.h> 29#include <linux/time.h>
29#include <sound/core.h> 30#include <sound/core.h>
@@ -658,6 +659,33 @@ static irqreturn_t mxs_saif_irq(int irq, void *dev_id)
658 return IRQ_HANDLED; 659 return IRQ_HANDLED;
659} 660}
660 661
662static int mxs_saif_mclk_init(struct platform_device *pdev)
663{
664 struct mxs_saif *saif = platform_get_drvdata(pdev);
665 struct device_node *np = pdev->dev.of_node;
666 struct clk *clk;
667 int ret;
668
669 clk = clk_register_divider(&pdev->dev, "mxs_saif_mclk",
670 __clk_get_name(saif->clk), 0,
671 saif->base + SAIF_CTRL,
672 BP_SAIF_CTRL_BITCLK_MULT_RATE, 3,
673 0, NULL);
674 if (IS_ERR(clk)) {
675 ret = PTR_ERR(clk);
676 if (ret == -EEXIST)
677 return 0;
678 dev_err(&pdev->dev, "failed to register mclk: %d\n", ret);
679 return PTR_ERR(clk);
680 }
681
682 ret = of_clk_add_provider(np, of_clk_src_simple_get, clk);
683 if (ret)
684 return ret;
685
686 return 0;
687}
688
661static int mxs_saif_probe(struct platform_device *pdev) 689static int mxs_saif_probe(struct platform_device *pdev)
662{ 690{
663 struct device_node *np = pdev->dev.of_node; 691 struct device_node *np = pdev->dev.of_node;
@@ -734,6 +762,13 @@ static int mxs_saif_probe(struct platform_device *pdev)
734 762
735 platform_set_drvdata(pdev, saif); 763 platform_set_drvdata(pdev, saif);
736 764
765 /* We only support saif0 being tx and clock master */
766 if (saif->id == 0) {
767 ret = mxs_saif_mclk_init(pdev);
768 if (ret)
769 dev_warn(&pdev->dev, "failed to init clocks\n");
770 }
771
737 ret = snd_soc_register_component(&pdev->dev, &mxs_saif_component, 772 ret = snd_soc_register_component(&pdev->dev, &mxs_saif_component,
738 &mxs_saif_dai, 1); 773 &mxs_saif_dai, 1);
739 if (ret) { 774 if (ret) {