Commit 70a5e96b authored by Srinivas Kandagatla's avatar Srinivas Kandagatla Committed by Mark Brown

ASoC: codecs: rx-macro: move clk provider to managed variants

move clk provider registration to managed api variants, this should help
with some code tidyup.
Signed-off-by: default avatarSrinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20220224111718.6264-3-srinivas.kandagatla@linaro.orgSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent bed17757
...@@ -3475,10 +3475,9 @@ static const struct clk_ops swclk_gate_ops = { ...@@ -3475,10 +3475,9 @@ static const struct clk_ops swclk_gate_ops = {
}; };
static struct clk *rx_macro_register_mclk_output(struct rx_macro *rx) static int rx_macro_register_mclk_output(struct rx_macro *rx)
{ {
struct device *dev = rx->dev; struct device *dev = rx->dev;
struct device_node *np = dev->of_node;
const char *parent_clk_name = NULL; const char *parent_clk_name = NULL;
const char *clk_name = "lpass-rx-mclk"; const char *clk_name = "lpass-rx-mclk";
struct clk_hw *hw; struct clk_hw *hw;
...@@ -3494,13 +3493,11 @@ static struct clk *rx_macro_register_mclk_output(struct rx_macro *rx) ...@@ -3494,13 +3493,11 @@ static struct clk *rx_macro_register_mclk_output(struct rx_macro *rx)
init.num_parents = 1; init.num_parents = 1;
rx->hw.init = &init; rx->hw.init = &init;
hw = &rx->hw; hw = &rx->hw;
ret = clk_hw_register(rx->dev, hw); ret = devm_clk_hw_register(rx->dev, hw);
if (ret) if (ret)
return ERR_PTR(ret); return ret;
of_clk_add_provider(np, of_clk_src_simple_get, hw->clk);
return NULL; return devm_of_clk_add_hw_provider(dev, of_clk_hw_simple_get, hw);
} }
static const struct snd_soc_component_driver rx_macro_component_drv = { static const struct snd_soc_component_driver rx_macro_component_drv = {
...@@ -3558,22 +3555,26 @@ static int rx_macro_probe(struct platform_device *pdev) ...@@ -3558,22 +3555,26 @@ static int rx_macro_probe(struct platform_device *pdev)
if (ret) if (ret)
return ret; return ret;
rx_macro_register_mclk_output(rx); ret = rx_macro_register_mclk_output(rx);
if (ret)
goto err;
ret = devm_snd_soc_register_component(dev, &rx_macro_component_drv, ret = devm_snd_soc_register_component(dev, &rx_macro_component_drv,
rx_macro_dai, rx_macro_dai,
ARRAY_SIZE(rx_macro_dai)); ARRAY_SIZE(rx_macro_dai));
if (ret) if (ret)
clk_bulk_disable_unprepare(RX_NUM_CLKS_MAX, rx->clks); goto err;
return ret; return ret;
err:
clk_bulk_disable_unprepare(RX_NUM_CLKS_MAX, rx->clks);
return ret;
} }
static int rx_macro_remove(struct platform_device *pdev) static int rx_macro_remove(struct platform_device *pdev)
{ {
struct rx_macro *rx = dev_get_drvdata(&pdev->dev); struct rx_macro *rx = dev_get_drvdata(&pdev->dev);
of_clk_del_provider(pdev->dev.of_node);
clk_bulk_disable_unprepare(RX_NUM_CLKS_MAX, rx->clks); clk_bulk_disable_unprepare(RX_NUM_CLKS_MAX, rx->clks);
return 0; return 0;
} }
......
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