From e919c71665d2386eec6dc2ecd58d01bae69fc0fd Mon Sep 17 00:00:00 2001 From: Andrew Lunn Date: Fri, 9 Mar 2012 09:56:41 +0100 Subject: [PATCH] ARM: Orion: Audio: Add clk/clkdev support Signed-off-by: Andrew Lunn Tested-by: Jamie Lentin Signed-off-by: Mike Turquette --- arch/arm/mach-kirkwood/common.c | 5 +++-- sound/soc/kirkwood/kirkwood-i2s.c | 13 +++++++++++++ sound/soc/kirkwood/kirkwood.h | 1 + 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/arch/arm/mach-kirkwood/common.c b/arch/arm/mach-kirkwood/common.c index aa36e1bce874..850ba64109cb 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) void __init kirkwood_clk_init(void) { struct clk *runit, *ge0, *ge1, *sata0, *sata1, *usb0, *sdio; - struct clk *crypto, *xor0, *xor1, *pex0, *pex1; + struct clk *crypto, *xor0, *xor1, *pex0, *pex1, *audio; tclk = clk_register_fixed_rate(NULL, "tclk", NULL, CLK_IS_ROOT, kirkwood_tclk); @@ -104,7 +104,7 @@ void __init kirkwood_clk_init(void) xor1 = kirkwood_register_gate("xor1", CGC_BIT_XOR1); pex0 = kirkwood_register_gate("pex0", CGC_BIT_PEX0); pex1 = kirkwood_register_gate("pex1", CGC_BIT_PEX1); - kirkwood_register_gate("audio", CGC_BIT_AUDIO); + audio = kirkwood_register_gate("audio", CGC_BIT_AUDIO); kirkwood_register_gate("tdm", CGC_BIT_TDM); kirkwood_register_gate("tsu", CGC_BIT_TSU); @@ -124,6 +124,7 @@ void __init kirkwood_clk_init(void) orion_clkdev_add(NULL, MV_XOR_SHARED_NAME ".1", xor1); orion_clkdev_add("0", "pcie", pex0); orion_clkdev_add("1", "pcie", pex1); + orion_clkdev_add(NULL, "kirkwood-i2s", audio); } /***************************************************************************** diff --git a/sound/soc/kirkwood/kirkwood-i2s.c b/sound/soc/kirkwood/kirkwood-i2s.c index 3cb9aa4299d3..fa4556750451 100644 --- a/sound/soc/kirkwood/kirkwood-i2s.c +++ b/sound/soc/kirkwood/kirkwood-i2s.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -449,6 +450,14 @@ static __devinit int kirkwood_i2s_dev_probe(struct platform_device *pdev) priv->burst = data->burst; + priv->clk = clk_get(&pdev->dev, NULL); + if (IS_ERR(priv->clk)) { + dev_err(&pdev->dev, "no clock\n"); + err = PTR_ERR(priv->clk); + goto err_ioremap; + } + clk_prepare_enable(priv->clk); + return snd_soc_register_dai(&pdev->dev, &kirkwood_i2s_dai); err_ioremap: @@ -466,6 +475,10 @@ static __devexit int kirkwood_i2s_dev_remove(struct platform_device *pdev) struct kirkwood_dma_data *priv = dev_get_drvdata(&pdev->dev); snd_soc_unregister_dai(&pdev->dev); + + clk_disable_unprepare(priv->clk); + clk_put(priv->clk); + iounmap(priv->io); release_mem_region(priv->mem->start, SZ_16K); kfree(priv); diff --git a/sound/soc/kirkwood/kirkwood.h b/sound/soc/kirkwood/kirkwood.h index 9047436b3937..f9084d83e6bd 100644 --- a/sound/soc/kirkwood/kirkwood.h +++ b/sound/soc/kirkwood/kirkwood.h @@ -123,6 +123,7 @@ struct kirkwood_dma_data { void __iomem *io; int irq; int burst; + struct clk *clk; }; #endif -- 2.30.2