Re: [PATCH 04/11] ASoC: qcom: lpass-cpu: Make "ahbix-clk" an optional clock.

From: Srinivas Kandagatla
Date: Thu Apr 16 2020 - 03:56:48 EST




On 11/04/2020 09:02, Ajit Pandey wrote:
AHB-I/X bus clocks inside LPASS coreis not a mandatory clocks for
s/coreis/core is/
newer lpass variants, hence make it an optional one.


Can you add more detail on which version of IP would not have this clk.

Signed-off-by: Ajit Pandey <ajitp@xxxxxxxxxxxxxx>
---
sound/soc/qcom/lpass-cpu.c | 31 ++++++++++++++++++-------------
1 file changed, 18 insertions(+), 13 deletions(-)

diff --git a/sound/soc/qcom/lpass-cpu.c b/sound/soc/qcom/lpass-cpu.c
index 492f27b..f177932 100644
--- a/sound/soc/qcom/lpass-cpu.c
+++ b/sound/soc/qcom/lpass-cpu.c
@@ -504,26 +504,31 @@ int asoc_qcom_lpass_cpu_platform_probe(struct platform_device *pdev)
return ret;
}
- drvdata->ahbix_clk = devm_clk_get(&pdev->dev, "ahbix-clk");
+ drvdata->ahbix_clk = devm_clk_get_optional(&pdev->dev, "ahbix-clk");
if (IS_ERR(drvdata->ahbix_clk)) {
dev_err(&pdev->dev, "error getting ahbix-clk: %ld\n",
PTR_ERR(drvdata->ahbix_clk));
return PTR_ERR(drvdata->ahbix_clk);
}
- ret = clk_set_rate(drvdata->ahbix_clk, LPASS_AHBIX_CLOCK_FREQUENCY);
- if (ret) {
- dev_err(&pdev->dev, "error setting rate on ahbix_clk: %d\n",
- ret);
- return ret;
- }
- dev_dbg(&pdev->dev, "set ahbix_clk rate to %lu\n",
- clk_get_rate(drvdata->ahbix_clk));
+ if (drvdata->ahbix_clk != NULL) {

No need for NULL checks here, clk apis already have checks.

--srini

+ ret = clk_set_rate(drvdata->ahbix_clk,
+ LPASS_AHBIX_CLOCK_FREQUENCY);
+ if (ret) {
+ dev_err(&pdev->dev,
+ "error setting rate on ahbix_clk: %d\n", ret);
+ return ret;
+ }
- ret = clk_prepare_enable(drvdata->ahbix_clk);
- if (ret) {
- dev_err(&pdev->dev, "error enabling ahbix_clk: %d\n", ret);
- return ret;
+ dev_dbg(&pdev->dev, "set ahbix_clk rate to %lu\n",
+ clk_get_rate(drvdata->ahbix_clk));
+
+ ret = clk_prepare_enable(drvdata->ahbix_clk);
+ if (ret) {
+ dev_err(&pdev->dev,
+ "error enabling ahbix_clk: %d\n", ret);
+ return ret;
+ }
}
ret = devm_snd_soc_register_component(&pdev->dev,