ASoC: codecs: va-macro: move to individual clks from bulk
Using bulk clocks and referencing them individually using array index is not great for readers. So move them to individual clocks handling and also remove some unnecessary error handling in the code. Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Link: https://lore.kernel.org/r/20220224111718.6264-2-srinivas.kandagatla@linaro.org Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Родитель
6e1dda5fcd
Коммит
bed1775752
|
@ -193,7 +193,9 @@ struct va_macro {
|
|||
|
||||
int dec_mode[VA_MACRO_NUM_DECIMATORS];
|
||||
struct regmap *regmap;
|
||||
struct clk_bulk_data clks[VA_NUM_CLKS_MAX];
|
||||
struct clk *mclk;
|
||||
struct clk *macro;
|
||||
struct clk *dcodec;
|
||||
struct clk_hw hw;
|
||||
|
||||
s32 dmic_0_1_clk_cnt;
|
||||
|
@ -1321,7 +1323,7 @@ static const struct clk_ops fsgen_gate_ops = {
|
|||
|
||||
static int va_macro_register_fsgen_output(struct va_macro *va)
|
||||
{
|
||||
struct clk *parent = va->clks[2].clk;
|
||||
struct clk *parent = va->mclk;
|
||||
struct device *dev = va->dev;
|
||||
struct device_node *np = dev->of_node;
|
||||
const char *parent_clk_name;
|
||||
|
@ -1404,15 +1406,18 @@ static int va_macro_probe(struct platform_device *pdev)
|
|||
return -ENOMEM;
|
||||
|
||||
va->dev = dev;
|
||||
va->clks[0].id = "macro";
|
||||
va->clks[1].id = "dcodec";
|
||||
va->clks[2].id = "mclk";
|
||||
|
||||
ret = devm_clk_bulk_get_optional(dev, VA_NUM_CLKS_MAX, va->clks);
|
||||
if (ret) {
|
||||
dev_err(dev, "Error getting VA Clocks (%d)\n", ret);
|
||||
return ret;
|
||||
}
|
||||
va->macro = devm_clk_get_optional(dev, "macro");
|
||||
if (IS_ERR(va->macro))
|
||||
return PTR_ERR(va->macro);
|
||||
|
||||
va->dcodec = devm_clk_get_optional(dev, "dcodec");
|
||||
if (IS_ERR(va->dcodec))
|
||||
return PTR_ERR(va->dcodec);
|
||||
|
||||
va->mclk = devm_clk_get(dev, "mclk");
|
||||
if (IS_ERR(va->mclk))
|
||||
return PTR_ERR(va->mclk);
|
||||
|
||||
ret = of_property_read_u32(dev->of_node, "qcom,dmic-sample-rate",
|
||||
&sample_rate);
|
||||
|
@ -1425,12 +1430,6 @@ static int va_macro_probe(struct platform_device *pdev)
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
/* mclk rate */
|
||||
clk_set_rate(va->clks[1].clk, VA_MACRO_MCLK_FREQ);
|
||||
ret = clk_bulk_prepare_enable(VA_NUM_CLKS_MAX, va->clks);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
base = devm_platform_ioremap_resource(pdev, 0);
|
||||
if (IS_ERR(base)) {
|
||||
ret = PTR_ERR(base);
|
||||
|
@ -1444,21 +1443,41 @@ static int va_macro_probe(struct platform_device *pdev)
|
|||
}
|
||||
|
||||
dev_set_drvdata(dev, va);
|
||||
ret = va_macro_register_fsgen_output(va);
|
||||
|
||||
/* mclk rate */
|
||||
clk_set_rate(va->mclk, 2 * VA_MACRO_MCLK_FREQ);
|
||||
|
||||
ret = clk_prepare_enable(va->macro);
|
||||
if (ret)
|
||||
goto err;
|
||||
|
||||
ret = clk_prepare_enable(va->dcodec);
|
||||
if (ret)
|
||||
goto err_dcodec;
|
||||
|
||||
ret = clk_prepare_enable(va->mclk);
|
||||
if (ret)
|
||||
goto err_mclk;
|
||||
|
||||
ret = va_macro_register_fsgen_output(va);
|
||||
if (ret)
|
||||
goto err_clkout;
|
||||
|
||||
ret = devm_snd_soc_register_component(dev, &va_macro_component_drv,
|
||||
va_macro_dais,
|
||||
ARRAY_SIZE(va_macro_dais));
|
||||
if (ret)
|
||||
goto err;
|
||||
goto err_clkout;
|
||||
|
||||
return ret;
|
||||
return 0;
|
||||
|
||||
err_clkout:
|
||||
clk_disable_unprepare(va->mclk);
|
||||
err_mclk:
|
||||
clk_disable_unprepare(va->dcodec);
|
||||
err_dcodec:
|
||||
clk_disable_unprepare(va->macro);
|
||||
err:
|
||||
clk_bulk_disable_unprepare(VA_NUM_CLKS_MAX, va->clks);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -1466,7 +1485,9 @@ static int va_macro_remove(struct platform_device *pdev)
|
|||
{
|
||||
struct va_macro *va = dev_get_drvdata(&pdev->dev);
|
||||
|
||||
clk_bulk_disable_unprepare(VA_NUM_CLKS_MAX, va->clks);
|
||||
clk_disable_unprepare(va->mclk);
|
||||
clk_disable_unprepare(va->dcodec);
|
||||
clk_disable_unprepare(va->macro);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче