Commit 23618f5b authored by Wu Bo's avatar Wu Bo Committed by Mark Brown

ASoC: dwc: change to use devm_clk_get_enabled() helpers

Make the code cleaner and avoid call clk_disable_unprepare()
Signed-off-by: default avatarWu Bo <bo.wu@vivo.com>
Link: https://patch.msgid.link/20240822095249.1642713-1-bo.wu@vivo.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 61c80c77
...@@ -995,16 +995,12 @@ static int dw_i2s_probe(struct platform_device *pdev) ...@@ -995,16 +995,12 @@ static int dw_i2s_probe(struct platform_device *pdev)
goto err_assert_reset; goto err_assert_reset;
} }
} }
dev->clk = devm_clk_get(&pdev->dev, clk_id); dev->clk = devm_clk_get_enabled(&pdev->dev, clk_id);
if (IS_ERR(dev->clk)) { if (IS_ERR(dev->clk)) {
ret = PTR_ERR(dev->clk); ret = PTR_ERR(dev->clk);
goto err_assert_reset; goto err_assert_reset;
} }
ret = clk_prepare_enable(dev->clk);
if (ret < 0)
goto err_assert_reset;
} }
dev_set_drvdata(&pdev->dev, dev); dev_set_drvdata(&pdev->dev, dev);
...@@ -1012,7 +1008,7 @@ static int dw_i2s_probe(struct platform_device *pdev) ...@@ -1012,7 +1008,7 @@ static int dw_i2s_probe(struct platform_device *pdev)
dw_i2s_dai, 1); dw_i2s_dai, 1);
if (ret != 0) { if (ret != 0) {
dev_err(&pdev->dev, "not able to register dai\n"); dev_err(&pdev->dev, "not able to register dai\n");
goto err_clk_disable; goto err_assert_reset;
} }
if (!pdata || dev->is_jh7110) { if (!pdata || dev->is_jh7110) {
...@@ -1030,16 +1026,13 @@ static int dw_i2s_probe(struct platform_device *pdev) ...@@ -1030,16 +1026,13 @@ static int dw_i2s_probe(struct platform_device *pdev)
if (ret) { if (ret) {
dev_err(&pdev->dev, "could not register pcm: %d\n", dev_err(&pdev->dev, "could not register pcm: %d\n",
ret); ret);
goto err_clk_disable; goto err_assert_reset;
} }
} }
pm_runtime_enable(&pdev->dev); pm_runtime_enable(&pdev->dev);
return 0; return 0;
err_clk_disable:
if (dev->capability & DW_I2S_MASTER)
clk_disable_unprepare(dev->clk);
err_assert_reset: err_assert_reset:
reset_control_assert(dev->reset); reset_control_assert(dev->reset);
return ret; return ret;
...@@ -1049,9 +1042,6 @@ static void dw_i2s_remove(struct platform_device *pdev) ...@@ -1049,9 +1042,6 @@ static void dw_i2s_remove(struct platform_device *pdev)
{ {
struct dw_i2s_dev *dev = dev_get_drvdata(&pdev->dev); struct dw_i2s_dev *dev = dev_get_drvdata(&pdev->dev);
if (dev->capability & DW_I2S_MASTER)
clk_disable_unprepare(dev->clk);
reset_control_assert(dev->reset); reset_control_assert(dev->reset);
pm_runtime_disable(&pdev->dev); pm_runtime_disable(&pdev->dev);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment