Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ASoC: codecs: lpass-wsa-macro: add support for SM8550

Add support for the WSA macro codec on Qualcomm SM8550. SM8550 does not
use NPL clock, thus add flags allowing to skip it.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20230327132254.147975-11-krzysztof.kozlowski@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Krzysztof Kozlowski and committed by
Mark Brown
63e280a5 5d83b5ce

+29 -8
+29 -8
sound/soc/codecs/lpass-wsa-macro.c
··· 14 14 #include <linux/pm_runtime.h> 15 15 #include <linux/of_platform.h> 16 16 #include <sound/tlv.h> 17 + 18 + #include "lpass-macro-common.h" 17 19 #include "lpass-wsa-macro.h" 18 20 19 21 #define CDC_WSA_CLK_RST_CTRL_MCLK_CONTROL (0x0000) ··· 2348 2346 struct clk_init_data init; 2349 2347 int ret; 2350 2348 2351 - parent_clk_name = __clk_get_name(wsa->npl); 2349 + if (wsa->npl) 2350 + parent_clk_name = __clk_get_name(wsa->npl); 2351 + else 2352 + parent_clk_name = __clk_get_name(wsa->mclk); 2352 2353 2353 2354 init.name = "mclk"; 2354 2355 of_property_read_string(dev_of_node(dev), "clock-output-names", ··· 2384 2379 { 2385 2380 struct device *dev = &pdev->dev; 2386 2381 struct wsa_macro *wsa; 2382 + kernel_ulong_t flags; 2387 2383 void __iomem *base; 2388 2384 int ret; 2385 + 2386 + flags = (kernel_ulong_t)device_get_match_data(dev); 2389 2387 2390 2388 wsa = devm_kzalloc(dev, sizeof(*wsa), GFP_KERNEL); 2391 2389 if (!wsa) ··· 2406 2398 if (IS_ERR(wsa->mclk)) 2407 2399 return PTR_ERR(wsa->mclk); 2408 2400 2409 - wsa->npl = devm_clk_get(dev, "npl"); 2410 - if (IS_ERR(wsa->npl)) 2411 - return PTR_ERR(wsa->npl); 2401 + if (flags & LPASS_MACRO_FLAG_HAS_NPL_CLOCK) { 2402 + wsa->npl = devm_clk_get(dev, "npl"); 2403 + if (IS_ERR(wsa->npl)) 2404 + return PTR_ERR(wsa->npl); 2405 + } 2412 2406 2413 2407 wsa->fsgen = devm_clk_get(dev, "fsgen"); 2414 2408 if (IS_ERR(wsa->fsgen)) ··· 2561 2551 }; 2562 2552 2563 2553 static const struct of_device_id wsa_macro_dt_match[] = { 2564 - {.compatible = "qcom,sc7280-lpass-wsa-macro"}, 2565 - {.compatible = "qcom,sm8250-lpass-wsa-macro"}, 2566 - {.compatible = "qcom,sm8450-lpass-wsa-macro"}, 2567 - {.compatible = "qcom,sc8280xp-lpass-wsa-macro" }, 2554 + { 2555 + .compatible = "qcom,sc7280-lpass-wsa-macro", 2556 + .data = (void *)LPASS_MACRO_FLAG_HAS_NPL_CLOCK, 2557 + }, { 2558 + .compatible = "qcom,sm8250-lpass-wsa-macro", 2559 + .data = (void *)LPASS_MACRO_FLAG_HAS_NPL_CLOCK, 2560 + }, { 2561 + .compatible = "qcom,sm8450-lpass-wsa-macro", 2562 + .data = (void *)LPASS_MACRO_FLAG_HAS_NPL_CLOCK, 2563 + }, { 2564 + .compatible = "qcom,sm8550-lpass-wsa-macro", 2565 + }, { 2566 + .compatible = "qcom,sc8280xp-lpass-wsa-macro", 2567 + .data = (void *)LPASS_MACRO_FLAG_HAS_NPL_CLOCK, 2568 + }, 2568 2569 {} 2569 2570 }; 2570 2571 MODULE_DEVICE_TABLE(of, wsa_macro_dt_match);