aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Lunn <andrew@lunn.ch>2012-03-09 03:56:41 -0500
committerMike Turquette <mturquette@linaro.org>2012-05-08 19:34:03 -0400
commite919c71665d2386eec6dc2ecd58d01bae69fc0fd (patch)
treee48c032ee0b94b470e91f097a6a0ba7f0959511b
parent27e53cfbce493bb062212263aa24bbbc5a1077f4 (diff)
ARM: Orion: Audio: Add clk/clkdev support
Signed-off-by: Andrew Lunn <andrew@lunn.ch> Tested-by: Jamie Lentin <jm@lentin.co.uk> Signed-off-by: Mike Turquette <mturquette@linaro.org>
-rw-r--r--arch/arm/mach-kirkwood/common.c5
-rw-r--r--sound/soc/kirkwood/kirkwood-i2s.c13
-rw-r--r--sound/soc/kirkwood/kirkwood.h1
3 files changed, 17 insertions, 2 deletions
diff --git a/arch/arm/mach-kirkwood/common.c b/arch/arm/mach-kirkwood/common.c
index aa36e1bce87..850ba64109c 100644
--- a/arch/arm/mach-kirkwood/common.c
+++ b/arch/arm/mach-kirkwood/common.c
@@ -87,7 +87,7 @@ static struct clk __init *kirkwood_register_gate(const char *name, u8 bit_idx)
87void __init kirkwood_clk_init(void) 87void __init kirkwood_clk_init(void)
88{ 88{
89 struct clk *runit, *ge0, *ge1, *sata0, *sata1, *usb0, *sdio; 89 struct clk *runit, *ge0, *ge1, *sata0, *sata1, *usb0, *sdio;
90 struct clk *crypto, *xor0, *xor1, *pex0, *pex1; 90 struct clk *crypto, *xor0, *xor1, *pex0, *pex1, *audio;
91 91
92 tclk = clk_register_fixed_rate(NULL, "tclk", NULL, 92 tclk = clk_register_fixed_rate(NULL, "tclk", NULL,
93 CLK_IS_ROOT, kirkwood_tclk); 93 CLK_IS_ROOT, kirkwood_tclk);
@@ -104,7 +104,7 @@ void __init kirkwood_clk_init(void)
104 xor1 = kirkwood_register_gate("xor1", CGC_BIT_XOR1); 104 xor1 = kirkwood_register_gate("xor1", CGC_BIT_XOR1);
105 pex0 = kirkwood_register_gate("pex0", CGC_BIT_PEX0); 105 pex0 = kirkwood_register_gate("pex0", CGC_BIT_PEX0);
106 pex1 = kirkwood_register_gate("pex1", CGC_BIT_PEX1); 106 pex1 = kirkwood_register_gate("pex1", CGC_BIT_PEX1);
107 kirkwood_register_gate("audio", CGC_BIT_AUDIO); 107 audio = kirkwood_register_gate("audio", CGC_BIT_AUDIO);
108 kirkwood_register_gate("tdm", CGC_BIT_TDM); 108 kirkwood_register_gate("tdm", CGC_BIT_TDM);
109 kirkwood_register_gate("tsu", CGC_BIT_TSU); 109 kirkwood_register_gate("tsu", CGC_BIT_TSU);
110 110
@@ -124,6 +124,7 @@ void __init kirkwood_clk_init(void)
124 orion_clkdev_add(NULL, MV_XOR_SHARED_NAME ".1", xor1); 124 orion_clkdev_add(NULL, MV_XOR_SHARED_NAME ".1", xor1);
125 orion_clkdev_add("0", "pcie", pex0); 125 orion_clkdev_add("0", "pcie", pex0);
126 orion_clkdev_add("1", "pcie", pex1); 126 orion_clkdev_add("1", "pcie", pex1);
127 orion_clkdev_add(NULL, "kirkwood-i2s", audio);
127} 128}
128 129
129/***************************************************************************** 130/*****************************************************************************
diff --git a/sound/soc/kirkwood/kirkwood-i2s.c b/sound/soc/kirkwood/kirkwood-i2s.c
index 3cb9aa4299d..fa455675045 100644
--- a/sound/soc/kirkwood/kirkwood-i2s.c
+++ b/sound/soc/kirkwood/kirkwood-i2s.c
@@ -17,6 +17,7 @@
17#include <linux/slab.h> 17#include <linux/slab.h>
18#include <linux/mbus.h> 18#include <linux/mbus.h>
19#include <linux/delay.h> 19#include <linux/delay.h>
20#include <linux/clk.h>
20#include <sound/pcm.h> 21#include <sound/pcm.h>
21#include <sound/pcm_params.h> 22#include <sound/pcm_params.h>
22#include <sound/soc.h> 23#include <sound/soc.h>
@@ -449,6 +450,14 @@ static __devinit int kirkwood_i2s_dev_probe(struct platform_device *pdev)
449 450
450 priv->burst = data->burst; 451 priv->burst = data->burst;
451 452
453 priv->clk = clk_get(&pdev->dev, NULL);
454 if (IS_ERR(priv->clk)) {
455 dev_err(&pdev->dev, "no clock\n");
456 err = PTR_ERR(priv->clk);
457 goto err_ioremap;
458 }
459 clk_prepare_enable(priv->clk);
460
452 return snd_soc_register_dai(&pdev->dev, &kirkwood_i2s_dai); 461 return snd_soc_register_dai(&pdev->dev, &kirkwood_i2s_dai);
453 462
454err_ioremap: 463err_ioremap:
@@ -466,6 +475,10 @@ static __devexit int kirkwood_i2s_dev_remove(struct platform_device *pdev)
466 struct kirkwood_dma_data *priv = dev_get_drvdata(&pdev->dev); 475 struct kirkwood_dma_data *priv = dev_get_drvdata(&pdev->dev);
467 476
468 snd_soc_unregister_dai(&pdev->dev); 477 snd_soc_unregister_dai(&pdev->dev);
478
479 clk_disable_unprepare(priv->clk);
480 clk_put(priv->clk);
481
469 iounmap(priv->io); 482 iounmap(priv->io);
470 release_mem_region(priv->mem->start, SZ_16K); 483 release_mem_region(priv->mem->start, SZ_16K);
471 kfree(priv); 484 kfree(priv);
diff --git a/sound/soc/kirkwood/kirkwood.h b/sound/soc/kirkwood/kirkwood.h
index 9047436b393..f9084d83e6b 100644
--- a/sound/soc/kirkwood/kirkwood.h
+++ b/sound/soc/kirkwood/kirkwood.h
@@ -123,6 +123,7 @@ struct kirkwood_dma_data {
123 void __iomem *io; 123 void __iomem *io;
124 int irq; 124 int irq;
125 int burst; 125 int burst;
126 struct clk *clk;
126}; 127};
127 128
128#endif 129#endif