Hi,
Dependencies
============
For va-macro bindings:
https://lore.kernel.org/r/[email protected]
NOT a dependency
================
The patchset can be applied independently of my previous fix:
https://lore.kernel.org/linux-arm-msm/[email protected]/T/#u
Logically, better if they were together, but code will work fine other way.
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-rx-macro.c | 39 +++++++--
sound/soc/codecs/lpass-tx-macro.c | 38 +++++++--
sound/soc/codecs/lpass-wsa-macro.c | 38 +++++++--
7 files changed, 256 insertions(+), 57 deletions(-)
--
2.34.1
Currently the Qualcomm RX macro codec binding allows two different clock
setups - with (for ADSP) and without macro/dcodec entries (for ADSP
bypassed). With more devices coming soon, this will keep growing, thus
rework the clocks/clock-names to be specific for each binding.
Signed-off-by: Krzysztof Kozlowski <[email protected]>
---
.../bindings/sound/qcom,lpass-rx-macro.yaml | 58 ++++++++++++++-----
1 file changed, 44 insertions(+), 14 deletions(-)
diff --git a/Documentation/devicetree/bindings/sound/qcom,lpass-rx-macro.yaml b/Documentation/devicetree/bindings/sound/qcom,lpass-rx-macro.yaml
index b0b95689d78b..8b3d617a9578 100644
--- a/Documentation/devicetree/bindings/sound/qcom,lpass-rx-macro.yaml
+++ b/Documentation/devicetree/bindings/sound/qcom,lpass-rx-macro.yaml
@@ -9,9 +9,6 @@ title: LPASS(Low Power Audio Subsystem) RX Macro audio codec
maintainers:
- Srinivas Kandagatla <[email protected]>
-allOf:
- - $ref: dai-common.yaml#
-
properties:
compatible:
enum:
@@ -34,17 +31,8 @@ properties:
maxItems: 5
clock-names:
- oneOf:
- - items: #for ADSP based platforms
- - const: mclk
- - const: npl
- - const: macro
- - const: dcodec
- - const: fsgen
- - items: #for ADSP bypass based platforms
- - const: mclk
- - const: npl
- - const: fsgen
+ minItems: 3
+ maxItems: 5
clock-output-names:
maxItems: 1
@@ -62,6 +50,48 @@ required:
- reg
- "#sound-dai-cells"
+allOf:
+ - $ref: dai-common.yaml#
+ - if:
+ properties:
+ compatible:
+ enum:
+ - qcom,sc7280-lpass-rx-macro
+ then:
+ properties:
+ clock-names:
+ oneOf:
+ - items: #for ADSP based platforms
+ - const: mclk
+ - const: npl
+ - const: macro
+ - const: dcodec
+ - const: fsgen
+ - items: #for ADSP bypass based platforms
+ - const: mclk
+ - const: npl
+ - const: fsgen
+
+ - if:
+ properties:
+ compatible:
+ enum:
+ - qcom,sc8280xp-lpass-rx-macro
+ - qcom,sm8250-lpass-rx-macro
+ - qcom,sm8450-lpass-rx-macro
+ then:
+ properties:
+ clocks:
+ minItems: 5
+ maxItems: 5
+ clock-names:
+ items:
+ - const: mclk
+ - const: npl
+ - const: macro
+ - const: dcodec
+ - const: fsgen
+
unevaluatedProperties: false
examples:
--
2.34.1
Add the RX macro codec on Qualcomm SM8550, which comes without NPL clock
exposed.
Signed-off-by: Krzysztof Kozlowski <[email protected]>
---
.../bindings/sound/qcom,lpass-rx-macro.yaml | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/Documentation/devicetree/bindings/sound/qcom,lpass-rx-macro.yaml b/Documentation/devicetree/bindings/sound/qcom,lpass-rx-macro.yaml
index 8b3d617a9578..0ae3c81abdf8 100644
--- a/Documentation/devicetree/bindings/sound/qcom,lpass-rx-macro.yaml
+++ b/Documentation/devicetree/bindings/sound/qcom,lpass-rx-macro.yaml
@@ -15,6 +15,7 @@ properties:
- qcom,sc7280-lpass-rx-macro
- qcom,sm8250-lpass-rx-macro
- qcom,sm8450-lpass-rx-macro
+ - qcom,sm8550-lpass-rx-macro
- qcom,sc8280xp-lpass-rx-macro
reg:
@@ -92,6 +93,23 @@ allOf:
- const: dcodec
- const: fsgen
+ - if:
+ properties:
+ compatible:
+ enum:
+ - qcom,sm8550-lpass-rx-macro
+ then:
+ properties:
+ clocks:
+ minItems: 4
+ maxItems: 4
+ clock-names:
+ items:
+ - const: mclk
+ - const: macro
+ - const: dcodec
+ - const: fsgen
+
unevaluatedProperties: false
examples:
--
2.34.1
Currently the Qualcomm TX macro codec binding allows two different clock
setups - with (for ADSP) and without macro/dcodec entries (for ADSP
bypassed). With more devices coming soon, this will keep growing, thus
rework the clocks/clock-names to be specific for each binding.
Signed-off-by: Krzysztof Kozlowski <[email protected]>
---
.../bindings/sound/qcom,lpass-tx-macro.yaml | 63 ++++++++++++++-----
1 file changed, 46 insertions(+), 17 deletions(-)
diff --git a/Documentation/devicetree/bindings/sound/qcom,lpass-tx-macro.yaml b/Documentation/devicetree/bindings/sound/qcom,lpass-tx-macro.yaml
index da5f70910da5..559da2509d8d 100644
--- a/Documentation/devicetree/bindings/sound/qcom,lpass-tx-macro.yaml
+++ b/Documentation/devicetree/bindings/sound/qcom,lpass-tx-macro.yaml
@@ -9,9 +9,6 @@ title: LPASS(Low Power Audio Subsystem) TX Macro audio codec
maintainers:
- Srinivas Kandagatla <[email protected]>
-allOf:
- - $ref: dai-common.yaml#
-
properties:
compatible:
enum:
@@ -30,22 +27,12 @@ properties:
const: 0
clocks:
- oneOf:
- - maxItems: 3
- - maxItems: 5
+ minItems: 3
+ maxItems: 5
clock-names:
- oneOf:
- - items: #for ADSP based platforms
- - const: mclk
- - const: npl
- - const: macro
- - const: dcodec
- - const: fsgen
- - items: #for ADSP bypass based platforms
- - const: mclk
- - const: npl
- - const: fsgen
+ minItems: 3
+ maxItems: 5
clock-output-names:
maxItems: 1
@@ -67,6 +54,48 @@ required:
- reg
- "#sound-dai-cells"
+allOf:
+ - $ref: dai-common.yaml#
+ - if:
+ properties:
+ compatible:
+ enum:
+ - qcom,sc7280-lpass-tx-macro
+ then:
+ properties:
+ clock-names:
+ oneOf:
+ - items: #for ADSP based platforms
+ - const: mclk
+ - const: npl
+ - const: macro
+ - const: dcodec
+ - const: fsgen
+ - items: #for ADSP bypass based platforms
+ - const: mclk
+ - const: npl
+ - const: fsgen
+
+ - if:
+ properties:
+ compatible:
+ enum:
+ - qcom,sc8280xp-lpass-tx-macro
+ - qcom,sm8250-lpass-tx-macro
+ - qcom,sm8450-lpass-tx-macro
+ then:
+ properties:
+ clocks:
+ minItems: 5
+ maxItems: 5
+ clock-names:
+ items:
+ - const: mclk
+ - const: npl
+ - const: macro
+ - const: dcodec
+ - const: fsgen
+
unevaluatedProperties: false
examples:
--
2.34.1
Add support for the RX macro codec on Qualcomm SM8550. SM8550 does not
use NPL clock, thus add flags allowing to skip it.
Signed-off-by: Krzysztof Kozlowski <[email protected]>
---
sound/soc/codecs/lpass-rx-macro.c | 39 ++++++++++++++++++++++++-------
1 file changed, 31 insertions(+), 8 deletions(-)
diff --git a/sound/soc/codecs/lpass-rx-macro.c b/sound/soc/codecs/lpass-rx-macro.c
index a73a7d7a1c0a..e322d918db36 100644
--- a/sound/soc/codecs/lpass-rx-macro.c
+++ b/sound/soc/codecs/lpass-rx-macro.c
@@ -395,6 +395,9 @@
#define COMP_MAX_COEFF 25
#define RX_NUM_CLKS_MAX 5
+/* NPL clock is expected */
+#define RX_MACRO_FLAG_HAS_NPL_CLOCK BIT(0)
+
struct comp_coeff_val {
u8 lsb;
u8 msb;
@@ -3491,7 +3494,10 @@ static int rx_macro_register_mclk_output(struct rx_macro *rx)
struct clk_init_data init;
int ret;
- parent_clk_name = __clk_get_name(rx->npl);
+ if (rx->npl)
+ parent_clk_name = __clk_get_name(rx->npl);
+ else
+ parent_clk_name = __clk_get_name(rx->mclk);
init.name = clk_name;
init.ops = &swclk_gate_ops;
@@ -3521,10 +3527,13 @@ static const struct snd_soc_component_driver rx_macro_component_drv = {
static int rx_macro_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
+ kernel_ulong_t flags;
struct rx_macro *rx;
void __iomem *base;
int ret;
+ flags = (kernel_ulong_t)device_get_match_data(dev);
+
rx = devm_kzalloc(dev, sizeof(*rx), GFP_KERNEL);
if (!rx)
return -ENOMEM;
@@ -3541,9 +3550,11 @@ static int rx_macro_probe(struct platform_device *pdev)
if (IS_ERR(rx->mclk))
return PTR_ERR(rx->mclk);
- rx->npl = devm_clk_get(dev, "npl");
- if (IS_ERR(rx->npl))
- return PTR_ERR(rx->npl);
+ if (flags & RX_MACRO_FLAG_HAS_NPL_CLOCK) {
+ rx->npl = devm_clk_get(dev, "npl");
+ if (IS_ERR(rx->npl))
+ return PTR_ERR(rx->npl);
+ }
rx->fsgen = devm_clk_get(dev, "fsgen");
if (IS_ERR(rx->fsgen))
@@ -3655,10 +3666,22 @@ static int rx_macro_remove(struct platform_device *pdev)
}
static const struct of_device_id rx_macro_dt_match[] = {
- { .compatible = "qcom,sc7280-lpass-rx-macro" },
- { .compatible = "qcom,sm8250-lpass-rx-macro" },
- { .compatible = "qcom,sm8450-lpass-rx-macro" },
- { .compatible = "qcom,sc8280xp-lpass-rx-macro" },
+ {
+ .compatible = "qcom,sc7280-lpass-rx-macro",
+ .data = (void *)RX_MACRO_FLAG_HAS_NPL_CLOCK,
+
+ }, {
+ .compatible = "qcom,sm8250-lpass-rx-macro",
+ .data = (void *)RX_MACRO_FLAG_HAS_NPL_CLOCK,
+ }, {
+ .compatible = "qcom,sm8450-lpass-rx-macro",
+ .data = (void *)RX_MACRO_FLAG_HAS_NPL_CLOCK,
+ }, {
+ .compatible = "qcom,sm8550-lpass-rx-macro",
+ }, {
+ .compatible = "qcom,sc8280xp-lpass-rx-macro",
+ .data = (void *)RX_MACRO_FLAG_HAS_NPL_CLOCK,
+ },
{ }
};
MODULE_DEVICE_TABLE(of, rx_macro_dt_match);
--
2.34.1
Add support for the TX macro codec on Qualcomm SM8550. SM8550 does not
use NPL clock, thus add flags allowing to skip it.
Signed-off-by: Krzysztof Kozlowski <[email protected]>
---
sound/soc/codecs/lpass-tx-macro.c | 38 ++++++++++++++++++++++++-------
1 file changed, 30 insertions(+), 8 deletions(-)
diff --git a/sound/soc/codecs/lpass-tx-macro.c b/sound/soc/codecs/lpass-tx-macro.c
index 473d3cd39554..23371b21505e 100644
--- a/sound/soc/codecs/lpass-tx-macro.c
+++ b/sound/soc/codecs/lpass-tx-macro.c
@@ -205,6 +205,9 @@
#define TX_MACRO_AMIC_HPF_DELAY_MS 300
#define MCLK_FREQ 19200000
+/* NPL clock is expected */
+#define TX_MACRO_FLAG_HAS_NPL_CLOCK BIT(0)
+
enum {
TX_MACRO_AIF_INVALID = 0,
TX_MACRO_AIF1_CAP,
@@ -1915,7 +1918,10 @@ static int tx_macro_register_mclk_output(struct tx_macro *tx)
struct clk_init_data init;
int ret;
- parent_clk_name = __clk_get_name(tx->npl);
+ if (tx->npl)
+ parent_clk_name = __clk_get_name(tx->npl);
+ else
+ parent_clk_name = __clk_get_name(tx->mclk);
init.name = clk_name;
init.ops = &swclk_gate_ops;
@@ -1946,10 +1952,13 @@ static int tx_macro_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
struct device_node *np = dev->of_node;
+ kernel_ulong_t flags;
struct tx_macro *tx;
void __iomem *base;
int ret, reg;
+ flags = (kernel_ulong_t)device_get_match_data(dev);
+
tx = devm_kzalloc(dev, sizeof(*tx), GFP_KERNEL);
if (!tx)
return -ENOMEM;
@@ -1966,9 +1975,11 @@ static int tx_macro_probe(struct platform_device *pdev)
if (IS_ERR(tx->mclk))
return PTR_ERR(tx->mclk);
- tx->npl = devm_clk_get(dev, "npl");
- if (IS_ERR(tx->npl))
- return PTR_ERR(tx->npl);
+ if (flags & TX_MACRO_FLAG_HAS_NPL_CLOCK) {
+ tx->npl = devm_clk_get(dev, "npl");
+ if (IS_ERR(tx->npl))
+ return PTR_ERR(tx->npl);
+ }
tx->fsgen = devm_clk_get(dev, "fsgen");
if (IS_ERR(tx->fsgen))
@@ -2145,10 +2156,21 @@ static const struct dev_pm_ops tx_macro_pm_ops = {
};
static const struct of_device_id tx_macro_dt_match[] = {
- { .compatible = "qcom,sc7280-lpass-tx-macro" },
- { .compatible = "qcom,sm8250-lpass-tx-macro" },
- { .compatible = "qcom,sm8450-lpass-tx-macro" },
- { .compatible = "qcom,sc8280xp-lpass-tx-macro" },
+ {
+ .compatible = "qcom,sc7280-lpass-tx-macro",
+ .data = (void *)TX_MACRO_FLAG_HAS_NPL_CLOCK,
+ }, {
+ .compatible = "qcom,sm8250-lpass-tx-macro",
+ .data = (void *)TX_MACRO_FLAG_HAS_NPL_CLOCK,
+ }, {
+ .compatible = "qcom,sm8450-lpass-tx-macro",
+ .data = (void *)TX_MACRO_FLAG_HAS_NPL_CLOCK,
+ }, {
+ .compatible = "qcom,sm8550-lpass-tx-macro",
+ }, {
+ .compatible = "qcom,sc8280xp-lpass-tx-macro",
+ .data = (void *)TX_MACRO_FLAG_HAS_NPL_CLOCK,
+ },
{ }
};
MODULE_DEVICE_TABLE(of, tx_macro_dt_match);
--
2.34.1
Add the TX macro codec on Qualcomm SM8550, which comes without NPL clock
exposed.
Signed-off-by: Krzysztof Kozlowski <[email protected]>
---
.../bindings/sound/qcom,lpass-tx-macro.yaml | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/Documentation/devicetree/bindings/sound/qcom,lpass-tx-macro.yaml b/Documentation/devicetree/bindings/sound/qcom,lpass-tx-macro.yaml
index 559da2509d8d..9d6e67524daf 100644
--- a/Documentation/devicetree/bindings/sound/qcom,lpass-tx-macro.yaml
+++ b/Documentation/devicetree/bindings/sound/qcom,lpass-tx-macro.yaml
@@ -15,6 +15,7 @@ properties:
- qcom,sc7280-lpass-tx-macro
- qcom,sm8250-lpass-tx-macro
- qcom,sm8450-lpass-tx-macro
+ - qcom,sm8550-lpass-tx-macro
- qcom,sc8280xp-lpass-tx-macro
reg:
@@ -96,6 +97,23 @@ allOf:
- const: dcodec
- const: fsgen
+ - if:
+ properties:
+ compatible:
+ enum:
+ - qcom,sm8550-lpass-tx-macro
+ then:
+ properties:
+ clocks:
+ minItems: 4
+ maxItems: 4
+ clock-names:
+ items:
+ - const: mclk
+ - const: macro
+ - const: dcodec
+ - const: fsgen
+
unevaluatedProperties: false
examples:
--
2.34.1
Add the VA macro codec on Qualcomm SM8550, which comes without NPL clock
exposed.
Signed-off-by: Krzysztof Kozlowski <[email protected]>
---
Depends on:
https://lore.kernel.org/r/[email protected]
---
.../bindings/sound/qcom,lpass-va-macro.yaml | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/Documentation/devicetree/bindings/sound/qcom,lpass-va-macro.yaml b/Documentation/devicetree/bindings/sound/qcom,lpass-va-macro.yaml
index 528b677a439c..4a56108c444b 100644
--- a/Documentation/devicetree/bindings/sound/qcom,lpass-va-macro.yaml
+++ b/Documentation/devicetree/bindings/sound/qcom,lpass-va-macro.yaml
@@ -15,6 +15,7 @@ properties:
- qcom,sc7280-lpass-va-macro
- qcom,sm8250-lpass-va-macro
- qcom,sm8450-lpass-va-macro
+ - qcom,sm8550-lpass-va-macro
- qcom,sc8280xp-lpass-va-macro
reg:
@@ -110,6 +111,23 @@ allOf:
- const: dcodec
- const: npl
+ - if:
+ properties:
+ compatible:
+ contains:
+ enum:
+ - qcom,sm8550-lpass-va-macro
+ then:
+ properties:
+ clocks:
+ minItems: 3
+ maxItems: 3
+ clock-names:
+ items:
+ - const: mclk
+ - const: macro
+ - const: dcodec
+
unevaluatedProperties: false
examples:
--
2.34.1
Add the WSA macro codec on Qualcomm SM8550, which comes without NPL clock
exposed.
Signed-off-by: Krzysztof Kozlowski <[email protected]>
---
.../bindings/sound/qcom,lpass-wsa-macro.yaml | 23 +++++++++++++++++--
1 file changed, 21 insertions(+), 2 deletions(-)
diff --git a/Documentation/devicetree/bindings/sound/qcom,lpass-wsa-macro.yaml b/Documentation/devicetree/bindings/sound/qcom,lpass-wsa-macro.yaml
index 66cbb1f5e31a..eea7609d1b33 100644
--- a/Documentation/devicetree/bindings/sound/qcom,lpass-wsa-macro.yaml
+++ b/Documentation/devicetree/bindings/sound/qcom,lpass-wsa-macro.yaml
@@ -15,6 +15,7 @@ properties:
- qcom,sc7280-lpass-wsa-macro
- qcom,sm8250-lpass-wsa-macro
- qcom,sm8450-lpass-wsa-macro
+ - qcom,sm8550-lpass-wsa-macro
- qcom,sc8280xp-lpass-wsa-macro
reg:
@@ -27,11 +28,11 @@ properties:
const: 0
clocks:
- minItems: 5
+ minItems: 4
maxItems: 6
clock-names:
- minItems: 5
+ minItems: 4
maxItems: 6
clock-output-names:
@@ -62,6 +63,7 @@ allOf:
then:
properties:
clocks:
+ minItems: 5
maxItems: 5
clock-names:
items:
@@ -89,6 +91,23 @@ allOf:
- const: va
- const: fsgen
+ - if:
+ properties:
+ compatible:
+ enum:
+ - qcom,sm8550-lpass-wsa-macro
+ then:
+ properties:
+ clocks:
+ minItems: 4
+ maxItems: 4
+ clock-names:
+ items:
+ - const: mclk
+ - const: macro
+ - const: dcodec
+ - const: fsgen
+
unevaluatedProperties: false
examples:
--
2.34.1
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 <[email protected]>
---
sound/soc/codecs/lpass-wsa-macro.c | 38 +++++++++++++++++++++++-------
1 file changed, 30 insertions(+), 8 deletions(-)
diff --git a/sound/soc/codecs/lpass-wsa-macro.c b/sound/soc/codecs/lpass-wsa-macro.c
index ba7480f3831e..5155362de111 100644
--- a/sound/soc/codecs/lpass-wsa-macro.c
+++ b/sound/soc/codecs/lpass-wsa-macro.c
@@ -246,6 +246,9 @@
#define WSA_MACRO_EC_MIX_TX1_MASK 0x18
#define WSA_MACRO_MAX_DMA_CH_PER_PORT 0x2
+/* NPL clock is expected */
+#define WSA_MACRO_FLAG_HAS_NPL_CLOCK BIT(0)
+
enum {
WSA_MACRO_GAIN_OFFSET_M1P5_DB,
WSA_MACRO_GAIN_OFFSET_0_DB,
@@ -2346,7 +2349,10 @@ static int wsa_macro_register_mclk_output(struct wsa_macro *wsa)
struct clk_init_data init;
int ret;
- parent_clk_name = __clk_get_name(wsa->npl);
+ if (wsa->npl)
+ parent_clk_name = __clk_get_name(wsa->npl);
+ else
+ parent_clk_name = __clk_get_name(wsa->mclk);
init.name = "mclk";
of_property_read_string(dev_of_node(dev), "clock-output-names",
@@ -2379,9 +2385,12 @@ static int wsa_macro_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
struct wsa_macro *wsa;
+ kernel_ulong_t flags;
void __iomem *base;
int ret;
+ flags = (kernel_ulong_t)device_get_match_data(dev);
+
wsa = devm_kzalloc(dev, sizeof(*wsa), GFP_KERNEL);
if (!wsa)
return -ENOMEM;
@@ -2398,9 +2407,11 @@ static int wsa_macro_probe(struct platform_device *pdev)
if (IS_ERR(wsa->mclk))
return PTR_ERR(wsa->mclk);
- wsa->npl = devm_clk_get(dev, "npl");
- if (IS_ERR(wsa->npl))
- return PTR_ERR(wsa->npl);
+ if (flags & WSA_MACRO_FLAG_HAS_NPL_CLOCK) {
+ wsa->npl = devm_clk_get(dev, "npl");
+ if (IS_ERR(wsa->npl))
+ return PTR_ERR(wsa->npl);
+ }
wsa->fsgen = devm_clk_get(dev, "fsgen");
if (IS_ERR(wsa->fsgen))
@@ -2553,10 +2564,21 @@ static const struct dev_pm_ops wsa_macro_pm_ops = {
};
static const struct of_device_id wsa_macro_dt_match[] = {
- {.compatible = "qcom,sc7280-lpass-wsa-macro"},
- {.compatible = "qcom,sm8250-lpass-wsa-macro"},
- {.compatible = "qcom,sm8450-lpass-wsa-macro"},
- {.compatible = "qcom,sc8280xp-lpass-wsa-macro" },
+ {
+ .compatible = "qcom,sc7280-lpass-wsa-macro",
+ .data = (void *)WSA_MACRO_FLAG_HAS_NPL_CLOCK,
+ }, {
+ .compatible = "qcom,sm8250-lpass-wsa-macro",
+ .data = (void *)WSA_MACRO_FLAG_HAS_NPL_CLOCK,
+ }, {
+ .compatible = "qcom,sm8450-lpass-wsa-macro",
+ .data = (void *)WSA_MACRO_FLAG_HAS_NPL_CLOCK,
+ }, {
+ .compatible = "qcom,sm8550-lpass-wsa-macro",
+ }, {
+ .compatible = "qcom,sc8280xp-lpass-wsa-macro",
+ .data = (void *)WSA_MACRO_FLAG_HAS_NPL_CLOCK,
+ },
{}
};
MODULE_DEVICE_TABLE(of, wsa_macro_dt_match);
--
2.34.1
On 10/03/2023 14:21, Krzysztof Kozlowski wrote:
> Hi,
>
> Dependencies
> ============
> For va-macro bindings:
> https://lore.kernel.org/r/[email protected]
>
> NOT a dependency
> ================
> The patchset can be applied independently of my previous fix:
> https://lore.kernel.org/linux-arm-msm/[email protected]/T/#u
DTS implementing the bindings is here:
https://lore.kernel.org/linux-arm-msm/[email protected]/T/#u
Best regards,
Krzysztof
Thanks Krzysztof for adding this support.
Few minor nits,
On 10/03/2023 13:21, Krzysztof Kozlowski wrote:
> Add support for the RX macro codec on Qualcomm SM8550. SM8550 does not
> use NPL clock, thus add flags allowing to skip it.
>
> Signed-off-by: Krzysztof Kozlowski <[email protected]>
> ---
> sound/soc/codecs/lpass-rx-macro.c | 39 ++++++++++++++++++++++++-------
> 1 file changed, 31 insertions(+), 8 deletions(-)
>
> diff --git a/sound/soc/codecs/lpass-rx-macro.c b/sound/soc/codecs/lpass-rx-macro.c
> index a73a7d7a1c0a..e322d918db36 100644
> --- a/sound/soc/codecs/lpass-rx-macro.c
> +++ b/sound/soc/codecs/lpass-rx-macro.c
> @@ -395,6 +395,9 @@
> #define COMP_MAX_COEFF 25
> #define RX_NUM_CLKS_MAX 5
>
> +/* NPL clock is expected */
> +#define RX_MACRO_FLAG_HAS_NPL_CLOCK BIT(0)
We could probably rename it and move it to
sound/soc/codecs/lpass-macro-common.h as this equally applies to all the
codec macros.
Once done,
Reviewed-by: Srinivas Kandagatla <[email protected]>
> +
> struct comp_coeff_val {
> u8 lsb;
> u8 msb;
> @@ -3491,7 +3494,10 @@ static int rx_macro_register_mclk_output(struct rx_macro *rx)
> struct clk_init_data init;
> int ret;
>
> - parent_clk_name = __clk_get_name(rx->npl);
> + if (rx->npl)
> + parent_clk_name = __clk_get_name(rx->npl);
> + else
> + parent_clk_name = __clk_get_name(rx->mclk);
>
> init.name = clk_name;
> init.ops = &swclk_gate_ops;
> @@ -3521,10 +3527,13 @@ static const struct snd_soc_component_driver rx_macro_component_drv = {
> static int rx_macro_probe(struct platform_device *pdev)
> {
> struct device *dev = &pdev->dev;
> + kernel_ulong_t flags;
> struct rx_macro *rx;
> void __iomem *base;
> int ret;
>
> + flags = (kernel_ulong_t)device_get_match_data(dev);
> +
> rx = devm_kzalloc(dev, sizeof(*rx), GFP_KERNEL);
> if (!rx)
> return -ENOMEM;
> @@ -3541,9 +3550,11 @@ static int rx_macro_probe(struct platform_device *pdev)
> if (IS_ERR(rx->mclk))
> return PTR_ERR(rx->mclk);
>
> - rx->npl = devm_clk_get(dev, "npl");
> - if (IS_ERR(rx->npl))
> - return PTR_ERR(rx->npl);
> + if (flags & RX_MACRO_FLAG_HAS_NPL_CLOCK) {
> + rx->npl = devm_clk_get(dev, "npl");
> + if (IS_ERR(rx->npl))
> + return PTR_ERR(rx->npl);
> + }
>
> rx->fsgen = devm_clk_get(dev, "fsgen");
> if (IS_ERR(rx->fsgen))
> @@ -3655,10 +3666,22 @@ static int rx_macro_remove(struct platform_device *pdev)
> }
>
> static const struct of_device_id rx_macro_dt_match[] = {
> - { .compatible = "qcom,sc7280-lpass-rx-macro" },
> - { .compatible = "qcom,sm8250-lpass-rx-macro" },
> - { .compatible = "qcom,sm8450-lpass-rx-macro" },
> - { .compatible = "qcom,sc8280xp-lpass-rx-macro" },
> + {
> + .compatible = "qcom,sc7280-lpass-rx-macro",
> + .data = (void *)RX_MACRO_FLAG_HAS_NPL_CLOCK,
> +
> + }, {
> + .compatible = "qcom,sm8250-lpass-rx-macro",
> + .data = (void *)RX_MACRO_FLAG_HAS_NPL_CLOCK,
> + }, {
> + .compatible = "qcom,sm8450-lpass-rx-macro",
> + .data = (void *)RX_MACRO_FLAG_HAS_NPL_CLOCK,
> + }, {
> + .compatible = "qcom,sm8550-lpass-rx-macro",
> + }, {
> + .compatible = "qcom,sc8280xp-lpass-rx-macro",
> + .data = (void *)RX_MACRO_FLAG_HAS_NPL_CLOCK,
> + },
> { }
> };
> MODULE_DEVICE_TABLE(of, rx_macro_dt_match);
On 10/03/2023 13:21, Krzysztof Kozlowski wrote:
> Add support for the TX macro codec on Qualcomm SM8550. SM8550 does not
> use NPL clock, thus add flags allowing to skip it.
>
> Signed-off-by: Krzysztof Kozlowski <[email protected]>
> ---
> sound/soc/codecs/lpass-tx-macro.c | 38 ++++++++++++++++++++++++-------
> 1 file changed, 30 insertions(+), 8 deletions(-)
>
> diff --git a/sound/soc/codecs/lpass-tx-macro.c b/sound/soc/codecs/lpass-tx-macro.c
> index 473d3cd39554..23371b21505e 100644
> --- a/sound/soc/codecs/lpass-tx-macro.c
> +++ b/sound/soc/codecs/lpass-tx-macro.c
> @@ -205,6 +205,9 @@
> #define TX_MACRO_AMIC_HPF_DELAY_MS 300
> #define MCLK_FREQ 19200000
>
> +/* NPL clock is expected */
> +#define TX_MACRO_FLAG_HAS_NPL_CLOCK BIT(0)
> +
Same nit as 3/9
Once done,
Reviewed-by: Srinivas Kandagatla <[email protected]>
--srini
> enum {
> TX_MACRO_AIF_INVALID = 0,
> TX_MACRO_AIF1_CAP,
> @@ -1915,7 +1918,10 @@ static int tx_macro_register_mclk_output(struct tx_macro *tx)
> struct clk_init_data init;
> int ret;
>
> - parent_clk_name = __clk_get_name(tx->npl);
> + if (tx->npl)
> + parent_clk_name = __clk_get_name(tx->npl);
> + else
> + parent_clk_name = __clk_get_name(tx->mclk);
>
> init.name = clk_name;
> init.ops = &swclk_gate_ops;
> @@ -1946,10 +1952,13 @@ static int tx_macro_probe(struct platform_device *pdev)
> {
> struct device *dev = &pdev->dev;
> struct device_node *np = dev->of_node;
> + kernel_ulong_t flags;
> struct tx_macro *tx;
> void __iomem *base;
> int ret, reg;
>
> + flags = (kernel_ulong_t)device_get_match_data(dev);
> +
> tx = devm_kzalloc(dev, sizeof(*tx), GFP_KERNEL);
> if (!tx)
> return -ENOMEM;
> @@ -1966,9 +1975,11 @@ static int tx_macro_probe(struct platform_device *pdev)
> if (IS_ERR(tx->mclk))
> return PTR_ERR(tx->mclk);
>
> - tx->npl = devm_clk_get(dev, "npl");
> - if (IS_ERR(tx->npl))
> - return PTR_ERR(tx->npl);
> + if (flags & TX_MACRO_FLAG_HAS_NPL_CLOCK) {
> + tx->npl = devm_clk_get(dev, "npl");
> + if (IS_ERR(tx->npl))
> + return PTR_ERR(tx->npl);
> + }
>
> tx->fsgen = devm_clk_get(dev, "fsgen");
> if (IS_ERR(tx->fsgen))
> @@ -2145,10 +2156,21 @@ static const struct dev_pm_ops tx_macro_pm_ops = {
> };
>
> static const struct of_device_id tx_macro_dt_match[] = {
> - { .compatible = "qcom,sc7280-lpass-tx-macro" },
> - { .compatible = "qcom,sm8250-lpass-tx-macro" },
> - { .compatible = "qcom,sm8450-lpass-tx-macro" },
> - { .compatible = "qcom,sc8280xp-lpass-tx-macro" },
> + {
> + .compatible = "qcom,sc7280-lpass-tx-macro",
> + .data = (void *)TX_MACRO_FLAG_HAS_NPL_CLOCK,
> + }, {
> + .compatible = "qcom,sm8250-lpass-tx-macro",
> + .data = (void *)TX_MACRO_FLAG_HAS_NPL_CLOCK,
> + }, {
> + .compatible = "qcom,sm8450-lpass-tx-macro",
> + .data = (void *)TX_MACRO_FLAG_HAS_NPL_CLOCK,
> + }, {
> + .compatible = "qcom,sm8550-lpass-tx-macro",
> + }, {
> + .compatible = "qcom,sc8280xp-lpass-tx-macro",
> + .data = (void *)TX_MACRO_FLAG_HAS_NPL_CLOCK,
> + },
> { }
> };
> MODULE_DEVICE_TABLE(of, tx_macro_dt_match);
On 11/03/2023 12:23, Srinivas Kandagatla wrote:
> Thanks Krzysztof for adding this support.
> Few minor nits,
>
> On 10/03/2023 13:21, Krzysztof Kozlowski wrote:
>> Add support for the RX macro codec on Qualcomm SM8550. SM8550 does not
>> use NPL clock, thus add flags allowing to skip it.
>>
>> Signed-off-by: Krzysztof Kozlowski <[email protected]>
>> ---
>> sound/soc/codecs/lpass-rx-macro.c | 39 ++++++++++++++++++++++++-------
>> 1 file changed, 31 insertions(+), 8 deletions(-)
>>
>> diff --git a/sound/soc/codecs/lpass-rx-macro.c b/sound/soc/codecs/lpass-rx-macro.c
>> index a73a7d7a1c0a..e322d918db36 100644
>> --- a/sound/soc/codecs/lpass-rx-macro.c
>> +++ b/sound/soc/codecs/lpass-rx-macro.c
>> @@ -395,6 +395,9 @@
>> #define COMP_MAX_COEFF 25
>> #define RX_NUM_CLKS_MAX 5
>>
>> +/* NPL clock is expected */
>> +#define RX_MACRO_FLAG_HAS_NPL_CLOCK BIT(0)
>
> We could probably rename it and move it to
> sound/soc/codecs/lpass-macro-common.h as this equally applies to all the
> codec macros.
>
>
> Once done,
>
> Reviewed-by: Srinivas Kandagatla <[email protected]>
Sure, I'll move it there.
Best regards,
Krzysztof
On 10/03/2023 13:22, Krzysztof Kozlowski wrote:
> 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 <[email protected]>
> ---
> sound/soc/codecs/lpass-wsa-macro.c | 38 +++++++++++++++++++++++-------
> 1 file changed, 30 insertions(+), 8 deletions(-)
>
> diff --git a/sound/soc/codecs/lpass-wsa-macro.c b/sound/soc/codecs/lpass-wsa-macro.c
> index ba7480f3831e..5155362de111 100644
> --- a/sound/soc/codecs/lpass-wsa-macro.c
> +++ b/sound/soc/codecs/lpass-wsa-macro.c
> @@ -246,6 +246,9 @@
> #define WSA_MACRO_EC_MIX_TX1_MASK 0x18
> #define WSA_MACRO_MAX_DMA_CH_PER_PORT 0x2
>
> +/* NPL clock is expected */
> +#define WSA_MACRO_FLAG_HAS_NPL_CLOCK BIT(0)
> +
Same nit as 3/9
Once done,
Reviewed-by: Srinivas Kandagatla <[email protected]>
--srini
> enum {
> WSA_MACRO_GAIN_OFFSET_M1P5_DB,
> WSA_MACRO_GAIN_OFFSET_0_DB,
> @@ -2346,7 +2349,10 @@ static int wsa_macro_register_mclk_output(struct wsa_macro *wsa)
> struct clk_init_data init;
> int ret;
>
> - parent_clk_name = __clk_get_name(wsa->npl);
> + if (wsa->npl)
> + parent_clk_name = __clk_get_name(wsa->npl);
> + else
> + parent_clk_name = __clk_get_name(wsa->mclk);
>
> init.name = "mclk";
> of_property_read_string(dev_of_node(dev), "clock-output-names",
> @@ -2379,9 +2385,12 @@ static int wsa_macro_probe(struct platform_device *pdev)
> {
> struct device *dev = &pdev->dev;
> struct wsa_macro *wsa;
> + kernel_ulong_t flags;
> void __iomem *base;
> int ret;
>
> + flags = (kernel_ulong_t)device_get_match_data(dev);
> +
> wsa = devm_kzalloc(dev, sizeof(*wsa), GFP_KERNEL);
> if (!wsa)
> return -ENOMEM;
> @@ -2398,9 +2407,11 @@ static int wsa_macro_probe(struct platform_device *pdev)
> if (IS_ERR(wsa->mclk))
> return PTR_ERR(wsa->mclk);
>
> - wsa->npl = devm_clk_get(dev, "npl");
> - if (IS_ERR(wsa->npl))
> - return PTR_ERR(wsa->npl);
> + if (flags & WSA_MACRO_FLAG_HAS_NPL_CLOCK) {
> + wsa->npl = devm_clk_get(dev, "npl");
> + if (IS_ERR(wsa->npl))
> + return PTR_ERR(wsa->npl);
> + }
>
> wsa->fsgen = devm_clk_get(dev, "fsgen");
> if (IS_ERR(wsa->fsgen))
> @@ -2553,10 +2564,21 @@ static const struct dev_pm_ops wsa_macro_pm_ops = {
> };
>
> static const struct of_device_id wsa_macro_dt_match[] = {
> - {.compatible = "qcom,sc7280-lpass-wsa-macro"},
> - {.compatible = "qcom,sm8250-lpass-wsa-macro"},
> - {.compatible = "qcom,sm8450-lpass-wsa-macro"},
> - {.compatible = "qcom,sc8280xp-lpass-wsa-macro" },
> + {
> + .compatible = "qcom,sc7280-lpass-wsa-macro",
> + .data = (void *)WSA_MACRO_FLAG_HAS_NPL_CLOCK,
> + }, {
> + .compatible = "qcom,sm8250-lpass-wsa-macro",
> + .data = (void *)WSA_MACRO_FLAG_HAS_NPL_CLOCK,
> + }, {
> + .compatible = "qcom,sm8450-lpass-wsa-macro",
> + .data = (void *)WSA_MACRO_FLAG_HAS_NPL_CLOCK,
> + }, {
> + .compatible = "qcom,sm8550-lpass-wsa-macro",
> + }, {
> + .compatible = "qcom,sc8280xp-lpass-wsa-macro",
> + .data = (void *)WSA_MACRO_FLAG_HAS_NPL_CLOCK,
> + },
> {}
> };
> MODULE_DEVICE_TABLE(of, wsa_macro_dt_match);