aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChen-Yu Tsai <wens@csie.org>2016-11-01 02:31:55 -0400
committerMark Brown <broonie@kernel.org>2016-11-01 16:03:41 -0400
commit3716a891d65cc04217da1af5f2bccb7eaf6092c2 (patch)
tree6585676ecffd09bbbef9827ac5653e3b2fa00cc6
parent85915b63ad8b796848f431b66c9ba5e356e722e5 (diff)
ASoC: sun4i-codec: Enable bus clock after getting GPIO
In the current probe function the GPIO is acquired after the codec's bus clock is enabled. However if it fails to acquire the GPIO due to a deferred probe, it does not disable the bus clock before bailing out. This would result in the clock being enabled multiple times. Move the code that enables the bus clock after the part that gets the GPIO, maintaining a separation between resource acquisition and device enablement in the probe function. Signed-off-by: Chen-Yu Tsai <wens@csie.org> Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r--sound/soc/sunxi/sun4i-codec.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/sound/soc/sunxi/sun4i-codec.c b/sound/soc/sunxi/sun4i-codec.c
index a60707761abf..56ed9472e89f 100644
--- a/sound/soc/sunxi/sun4i-codec.c
+++ b/sound/soc/sunxi/sun4i-codec.c
@@ -829,12 +829,6 @@ static int sun4i_codec_probe(struct platform_device *pdev)
829 return PTR_ERR(scodec->clk_module); 829 return PTR_ERR(scodec->clk_module);
830 } 830 }
831 831
832 /* Enable the bus clock */
833 if (clk_prepare_enable(scodec->clk_apb)) {
834 dev_err(&pdev->dev, "Failed to enable the APB clock\n");
835 return -EINVAL;
836 }
837
838 scodec->gpio_pa = devm_gpiod_get_optional(&pdev->dev, "allwinner,pa", 832 scodec->gpio_pa = devm_gpiod_get_optional(&pdev->dev, "allwinner,pa",
839 GPIOD_OUT_LOW); 833 GPIOD_OUT_LOW);
840 if (IS_ERR(scodec->gpio_pa)) { 834 if (IS_ERR(scodec->gpio_pa)) {
@@ -844,6 +838,12 @@ static int sun4i_codec_probe(struct platform_device *pdev)
844 return ret; 838 return ret;
845 } 839 }
846 840
841 /* Enable the bus clock */
842 if (clk_prepare_enable(scodec->clk_apb)) {
843 dev_err(&pdev->dev, "Failed to enable the APB clock\n");
844 return -EINVAL;
845 }
846
847 /* DMA configuration for TX FIFO */ 847 /* DMA configuration for TX FIFO */
848 scodec->playback_dma_data.addr = res->start + SUN4I_CODEC_DAC_TXDATA; 848 scodec->playback_dma_data.addr = res->start + SUN4I_CODEC_DAC_TXDATA;
849 scodec->playback_dma_data.maxburst = 4; 849 scodec->playback_dma_data.maxburst = 4;