dmaengine: ep93xx: Prepare clock before using it
authorAlexander Sverdlin <alexander.sverdlin@gmail.com>
Mon, 26 Jul 2021 13:59:53 +0000 (16:59 +0300)
committerVinod Koul <vkoul@kernel.org>
Mon, 2 Aug 2021 06:57:10 +0000 (12:27 +0530)
Use clk_prepare_enable()/clk_disable_unprepare() in preparation for switch
to Common Clock Framework, otherwise the following is visible:

WARNING: CPU: 0 PID: 1 at drivers/clk/clk.c:1011 clk_core_enable+0x9c/0xbc
Enabling unprepared m2p0
...
Hardware name: Cirrus Logic EDB9302 Evaluation Board
...
clk_core_enable
clk_core_enable_lock
ep93xx_dma_alloc_chan_resources
dma_chan_get
find_candidate
__dma_request_channel
snd_dmaengine_pcm_request_channel
dmaengine_pcm_new
snd_soc_pcm_component_new
soc_new_pcm
snd_soc_bind_card
edb93xx_probe
...
ep93xx-i2s ep93xx-i2s: Missing dma channel for stream: 0
ep93xx-i2s ep93xx-i2s: ASoC: error at snd_soc_pcm_component_new on ep93xx-i2s: -22
edb93xx-audio edb93xx-audio: ASoC: can't create pcm CS4271 HiFi :-22
edb93xx-audio edb93xx-audio: snd_soc_register_card() failed: -22
edb93xx-audio: probe of edb93xx-audio failed with error -22

Signed-off-by: Alexander Sverdlin <alexander.sverdlin@gmail.com>
Signed-off-by: Nikita Shubin <nikita.shubin@maquefel.me>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20210726140001.24820-6-nikita.shubin@maquefel.me
Signed-off-by: Vinod Koul <vkoul@kernel.org>
drivers/dma/ep93xx_dma.c

index 0102777..98f9ee7 100644 (file)
@@ -897,7 +897,7 @@ static int ep93xx_dma_alloc_chan_resources(struct dma_chan *chan)
        if (data && data->name)
                name = data->name;
 
-       ret = clk_enable(edmac->clk);
+       ret = clk_prepare_enable(edmac->clk);
        if (ret)
                return ret;
 
@@ -936,7 +936,7 @@ static int ep93xx_dma_alloc_chan_resources(struct dma_chan *chan)
 fail_free_irq:
        free_irq(edmac->irq, edmac);
 fail_clk_disable:
-       clk_disable(edmac->clk);
+       clk_disable_unprepare(edmac->clk);
 
        return ret;
 }
@@ -969,7 +969,7 @@ static void ep93xx_dma_free_chan_resources(struct dma_chan *chan)
        list_for_each_entry_safe(desc, d, &list, node)
                kfree(desc);
 
-       clk_disable(edmac->clk);
+       clk_disable_unprepare(edmac->clk);
        free_irq(edmac->irq, edmac);
 }