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

ASoC: add audio digital codecs for Qualcomm SM8550

Merge series from Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>:

Hi,

Dependencies
============
For va-macro bindings:
https://lore.kernel.org/r/20221118071849.25506-2-srinivas.kandagatla@linaro.org

NOT a dependency
================
The patchset can be applied independently of my previous fix:
https://lore.kernel.org/linux-arm-msm/20230310100937.32485-1-krzysztof.kozlowski@linaro.org/T/#u

Logically, better if they were together, but code will work fine other way.

Changes since v1
================
1. Move the flag define to common header.

Best regards,
Krzysztof

Krzysztof Kozlowski (9):
ASoC: dt-bindings: qcom,lpass-rx-macro: narrow clocks per variants
ASoC: dt-bindings: qcom,lpass-rx-macro: Add SM8550 RX macro
ASoC: codecs: lpass-rx-macro: add support for SM8550
ASoC: dt-bindings: qcom,lpass-tx-macro: narrow clocks per variants
ASoC: dt-bindings: qcom,lpass-tx-macro: Add SM8550 TX macro
ASoC: codecs: lpass-tx-macro: add support for SM8550
ASoC: dt-bindings: qcom,lpass-va-macro: Add SM8550 VA macro
ASoC: dt-bindings: qcom,lpass-wsa-macro: Add SM8550 WSA macro
ASoC: codecs: lpass-wsa-macro: add support for SM8550

.../bindings/sound/qcom,lpass-rx-macro.yaml | 76 +++++++++++++----
.../bindings/sound/qcom,lpass-tx-macro.yaml | 81 +++++++++++++++----
.../bindings/sound/qcom,lpass-va-macro.yaml | 18 +++++
.../bindings/sound/qcom,lpass-wsa-macro.yaml | 23 +++++-
sound/soc/codecs/lpass-macro-common.h | 3 +
sound/soc/codecs/lpass-rx-macro.c | 36 +++++++--
sound/soc/codecs/lpass-tx-macro.c | 35 ++++++--
sound/soc/codecs/lpass-wsa-macro.c | 37 +++++++--
8 files changed, 252 insertions(+), 57 deletions(-)

--
2.34.1

+234 -57
+62 -14
Documentation/devicetree/bindings/sound/qcom,lpass-rx-macro.yaml
··· 9 9 maintainers: 10 10 - Srinivas Kandagatla <srinivas.kandagatla@linaro.org> 11 11 12 - allOf: 13 - - $ref: dai-common.yaml# 14 - 15 12 properties: 16 13 compatible: 17 14 enum: 18 15 - qcom,sc7280-lpass-rx-macro 19 16 - qcom,sm8250-lpass-rx-macro 20 17 - qcom,sm8450-lpass-rx-macro 18 + - qcom,sm8550-lpass-rx-macro 21 19 - qcom,sc8280xp-lpass-rx-macro 22 20 23 21 reg: ··· 31 33 maxItems: 5 32 34 33 35 clock-names: 34 - oneOf: 35 - - items: #for ADSP based platforms 36 - - const: mclk 37 - - const: npl 38 - - const: macro 39 - - const: dcodec 40 - - const: fsgen 41 - - items: #for ADSP bypass based platforms 42 - - const: mclk 43 - - const: npl 44 - - const: fsgen 36 + minItems: 3 37 + maxItems: 5 45 38 46 39 clock-output-names: 47 40 maxItems: 1 ··· 49 60 - compatible 50 61 - reg 51 62 - "#sound-dai-cells" 63 + 64 + allOf: 65 + - $ref: dai-common.yaml# 66 + - if: 67 + properties: 68 + compatible: 69 + enum: 70 + - qcom,sc7280-lpass-rx-macro 71 + then: 72 + properties: 73 + clock-names: 74 + oneOf: 75 + - items: #for ADSP based platforms 76 + - const: mclk 77 + - const: npl 78 + - const: macro 79 + - const: dcodec 80 + - const: fsgen 81 + - items: #for ADSP bypass based platforms 82 + - const: mclk 83 + - const: npl 84 + - const: fsgen 85 + 86 + - if: 87 + properties: 88 + compatible: 89 + enum: 90 + - qcom,sc8280xp-lpass-rx-macro 91 + - qcom,sm8250-lpass-rx-macro 92 + - qcom,sm8450-lpass-rx-macro 93 + then: 94 + properties: 95 + clocks: 96 + minItems: 5 97 + maxItems: 5 98 + clock-names: 99 + items: 100 + - const: mclk 101 + - const: npl 102 + - const: macro 103 + - const: dcodec 104 + - const: fsgen 105 + 106 + - if: 107 + properties: 108 + compatible: 109 + enum: 110 + - qcom,sm8550-lpass-rx-macro 111 + then: 112 + properties: 113 + clocks: 114 + minItems: 4 115 + maxItems: 4 116 + clock-names: 117 + items: 118 + - const: mclk 119 + - const: macro 120 + - const: dcodec 121 + - const: fsgen 52 122 53 123 unevaluatedProperties: false 54 124
+64 -17
Documentation/devicetree/bindings/sound/qcom,lpass-tx-macro.yaml
··· 9 9 maintainers: 10 10 - Srinivas Kandagatla <srinivas.kandagatla@linaro.org> 11 11 12 - allOf: 13 - - $ref: dai-common.yaml# 14 - 15 12 properties: 16 13 compatible: 17 14 enum: 18 15 - qcom,sc7280-lpass-tx-macro 19 16 - qcom,sm8250-lpass-tx-macro 20 17 - qcom,sm8450-lpass-tx-macro 18 + - qcom,sm8550-lpass-tx-macro 21 19 - qcom,sc8280xp-lpass-tx-macro 22 20 23 21 reg: ··· 28 30 const: 0 29 31 30 32 clocks: 31 - oneOf: 32 - - maxItems: 3 33 - - maxItems: 5 33 + minItems: 3 34 + maxItems: 5 34 35 35 36 clock-names: 36 - oneOf: 37 - - items: #for ADSP based platforms 38 - - const: mclk 39 - - const: npl 40 - - const: macro 41 - - const: dcodec 42 - - const: fsgen 43 - - items: #for ADSP bypass based platforms 44 - - const: mclk 45 - - const: npl 46 - - const: fsgen 37 + minItems: 3 38 + maxItems: 5 47 39 48 40 clock-output-names: 49 41 maxItems: 1 ··· 54 66 - compatible 55 67 - reg 56 68 - "#sound-dai-cells" 69 + 70 + allOf: 71 + - $ref: dai-common.yaml# 72 + - if: 73 + properties: 74 + compatible: 75 + enum: 76 + - qcom,sc7280-lpass-tx-macro 77 + then: 78 + properties: 79 + clock-names: 80 + oneOf: 81 + - items: #for ADSP based platforms 82 + - const: mclk 83 + - const: npl 84 + - const: macro 85 + - const: dcodec 86 + - const: fsgen 87 + - items: #for ADSP bypass based platforms 88 + - const: mclk 89 + - const: npl 90 + - const: fsgen 91 + 92 + - if: 93 + properties: 94 + compatible: 95 + enum: 96 + - qcom,sc8280xp-lpass-tx-macro 97 + - qcom,sm8250-lpass-tx-macro 98 + - qcom,sm8450-lpass-tx-macro 99 + then: 100 + properties: 101 + clocks: 102 + minItems: 5 103 + maxItems: 5 104 + clock-names: 105 + items: 106 + - const: mclk 107 + - const: npl 108 + - const: macro 109 + - const: dcodec 110 + - const: fsgen 111 + 112 + - if: 113 + properties: 114 + compatible: 115 + enum: 116 + - qcom,sm8550-lpass-tx-macro 117 + then: 118 + properties: 119 + clocks: 120 + minItems: 4 121 + maxItems: 4 122 + clock-names: 123 + items: 124 + - const: mclk 125 + - const: macro 126 + - const: dcodec 127 + - const: fsgen 57 128 58 129 unevaluatedProperties: false 59 130
+21 -2
Documentation/devicetree/bindings/sound/qcom,lpass-wsa-macro.yaml
··· 15 15 - qcom,sc7280-lpass-wsa-macro 16 16 - qcom,sm8250-lpass-wsa-macro 17 17 - qcom,sm8450-lpass-wsa-macro 18 + - qcom,sm8550-lpass-wsa-macro 18 19 - qcom,sc8280xp-lpass-wsa-macro 19 20 20 21 reg: ··· 28 27 const: 0 29 28 30 29 clocks: 31 - minItems: 5 30 + minItems: 4 32 31 maxItems: 6 33 32 34 33 clock-names: 35 - minItems: 5 34 + minItems: 4 36 35 maxItems: 6 37 36 38 37 clock-output-names: ··· 63 62 then: 64 63 properties: 65 64 clocks: 65 + minItems: 5 66 66 maxItems: 5 67 67 clock-names: 68 68 items: ··· 89 87 - const: macro 90 88 - const: dcodec 91 89 - const: va 90 + - const: fsgen 91 + 92 + - if: 93 + properties: 94 + compatible: 95 + enum: 96 + - qcom,sm8550-lpass-wsa-macro 97 + then: 98 + properties: 99 + clocks: 100 + minItems: 4 101 + maxItems: 4 102 + clock-names: 103 + items: 104 + - const: mclk 105 + - const: macro 106 + - const: dcodec 92 107 - const: fsgen 93 108 94 109 unevaluatedProperties: false
+3
sound/soc/codecs/lpass-macro-common.h
··· 6 6 #ifndef __LPASS_MACRO_COMMON_H__ 7 7 #define __LPASS_MACRO_COMMON_H__ 8 8 9 + /* NPL clock is expected */ 10 + #define LPASS_MACRO_FLAG_HAS_NPL_CLOCK BIT(0) 11 + 9 12 struct lpass_macro { 10 13 struct device *macro_pd; 11 14 struct device *dcodec_pd;
+28 -8
sound/soc/codecs/lpass-rx-macro.c
··· 3491 3491 struct clk_init_data init; 3492 3492 int ret; 3493 3493 3494 - parent_clk_name = __clk_get_name(rx->npl); 3494 + if (rx->npl) 3495 + parent_clk_name = __clk_get_name(rx->npl); 3496 + else 3497 + parent_clk_name = __clk_get_name(rx->mclk); 3495 3498 3496 3499 init.name = clk_name; 3497 3500 init.ops = &swclk_gate_ops; ··· 3524 3521 static int rx_macro_probe(struct platform_device *pdev) 3525 3522 { 3526 3523 struct device *dev = &pdev->dev; 3524 + kernel_ulong_t flags; 3527 3525 struct rx_macro *rx; 3528 3526 void __iomem *base; 3529 3527 int ret; 3528 + 3529 + flags = (kernel_ulong_t)device_get_match_data(dev); 3530 3530 3531 3531 rx = devm_kzalloc(dev, sizeof(*rx), GFP_KERNEL); 3532 3532 if (!rx) ··· 3547 3541 if (IS_ERR(rx->mclk)) 3548 3542 return PTR_ERR(rx->mclk); 3549 3543 3550 - rx->npl = devm_clk_get(dev, "npl"); 3551 - if (IS_ERR(rx->npl)) 3552 - return PTR_ERR(rx->npl); 3544 + if (flags & LPASS_MACRO_FLAG_HAS_NPL_CLOCK) { 3545 + rx->npl = devm_clk_get(dev, "npl"); 3546 + if (IS_ERR(rx->npl)) 3547 + return PTR_ERR(rx->npl); 3548 + } 3553 3549 3554 3550 rx->fsgen = devm_clk_get(dev, "fsgen"); 3555 3551 if (IS_ERR(rx->fsgen)) ··· 3661 3653 } 3662 3654 3663 3655 static const struct of_device_id rx_macro_dt_match[] = { 3664 - { .compatible = "qcom,sc7280-lpass-rx-macro" }, 3665 - { .compatible = "qcom,sm8250-lpass-rx-macro" }, 3666 - { .compatible = "qcom,sm8450-lpass-rx-macro" }, 3667 - { .compatible = "qcom,sc8280xp-lpass-rx-macro" }, 3656 + { 3657 + .compatible = "qcom,sc7280-lpass-rx-macro", 3658 + .data = (void *)LPASS_MACRO_FLAG_HAS_NPL_CLOCK, 3659 + 3660 + }, { 3661 + .compatible = "qcom,sm8250-lpass-rx-macro", 3662 + .data = (void *)LPASS_MACRO_FLAG_HAS_NPL_CLOCK, 3663 + }, { 3664 + .compatible = "qcom,sm8450-lpass-rx-macro", 3665 + .data = (void *)LPASS_MACRO_FLAG_HAS_NPL_CLOCK, 3666 + }, { 3667 + .compatible = "qcom,sm8550-lpass-rx-macro", 3668 + }, { 3669 + .compatible = "qcom,sc8280xp-lpass-rx-macro", 3670 + .data = (void *)LPASS_MACRO_FLAG_HAS_NPL_CLOCK, 3671 + }, 3668 3672 { } 3669 3673 }; 3670 3674 MODULE_DEVICE_TABLE(of, rx_macro_dt_match);
+27 -8
sound/soc/codecs/lpass-tx-macro.c
··· 1915 1915 struct clk_init_data init; 1916 1916 int ret; 1917 1917 1918 - parent_clk_name = __clk_get_name(tx->npl); 1918 + if (tx->npl) 1919 + parent_clk_name = __clk_get_name(tx->npl); 1920 + else 1921 + parent_clk_name = __clk_get_name(tx->mclk); 1919 1922 1920 1923 init.name = clk_name; 1921 1924 init.ops = &swclk_gate_ops; ··· 1949 1946 { 1950 1947 struct device *dev = &pdev->dev; 1951 1948 struct device_node *np = dev->of_node; 1949 + kernel_ulong_t flags; 1952 1950 struct tx_macro *tx; 1953 1951 void __iomem *base; 1954 1952 int ret, reg; 1953 + 1954 + flags = (kernel_ulong_t)device_get_match_data(dev); 1955 1955 1956 1956 tx = devm_kzalloc(dev, sizeof(*tx), GFP_KERNEL); 1957 1957 if (!tx) ··· 1972 1966 if (IS_ERR(tx->mclk)) 1973 1967 return PTR_ERR(tx->mclk); 1974 1968 1975 - tx->npl = devm_clk_get(dev, "npl"); 1976 - if (IS_ERR(tx->npl)) 1977 - return PTR_ERR(tx->npl); 1969 + if (flags & LPASS_MACRO_FLAG_HAS_NPL_CLOCK) { 1970 + tx->npl = devm_clk_get(dev, "npl"); 1971 + if (IS_ERR(tx->npl)) 1972 + return PTR_ERR(tx->npl); 1973 + } 1978 1974 1979 1975 tx->fsgen = devm_clk_get(dev, "fsgen"); 1980 1976 if (IS_ERR(tx->fsgen)) ··· 2151 2143 }; 2152 2144 2153 2145 static const struct of_device_id tx_macro_dt_match[] = { 2154 - { .compatible = "qcom,sc7280-lpass-tx-macro" }, 2155 - { .compatible = "qcom,sm8250-lpass-tx-macro" }, 2156 - { .compatible = "qcom,sm8450-lpass-tx-macro" }, 2157 - { .compatible = "qcom,sc8280xp-lpass-tx-macro" }, 2146 + { 2147 + .compatible = "qcom,sc7280-lpass-tx-macro", 2148 + .data = (void *)LPASS_MACRO_FLAG_HAS_NPL_CLOCK, 2149 + }, { 2150 + .compatible = "qcom,sm8250-lpass-tx-macro", 2151 + .data = (void *)LPASS_MACRO_FLAG_HAS_NPL_CLOCK, 2152 + }, { 2153 + .compatible = "qcom,sm8450-lpass-tx-macro", 2154 + .data = (void *)LPASS_MACRO_FLAG_HAS_NPL_CLOCK, 2155 + }, { 2156 + .compatible = "qcom,sm8550-lpass-tx-macro", 2157 + }, { 2158 + .compatible = "qcom,sc8280xp-lpass-tx-macro", 2159 + .data = (void *)LPASS_MACRO_FLAG_HAS_NPL_CLOCK, 2160 + }, 2158 2161 { } 2159 2162 }; 2160 2163 MODULE_DEVICE_TABLE(of, tx_macro_dt_match);
+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);