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
This commit is contained in:
Mark Brown 2023-03-28 17:40:35 +01:00
commit d6790ae09a
No known key found for this signature in database
GPG Key ID: 24D68B725D5487D0
7 changed files with 234 additions and 57 deletions

View File

@ -9,15 +9,13 @@ title: LPASS(Low Power Audio Subsystem) RX Macro audio codec
maintainers: maintainers:
- Srinivas Kandagatla <srinivas.kandagatla@linaro.org> - Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
allOf:
- $ref: dai-common.yaml#
properties: properties:
compatible: compatible:
enum: enum:
- qcom,sc7280-lpass-rx-macro - qcom,sc7280-lpass-rx-macro
- qcom,sm8250-lpass-rx-macro - qcom,sm8250-lpass-rx-macro
- qcom,sm8450-lpass-rx-macro - qcom,sm8450-lpass-rx-macro
- qcom,sm8550-lpass-rx-macro
- qcom,sc8280xp-lpass-rx-macro - qcom,sc8280xp-lpass-rx-macro
reg: reg:
@ -33,17 +31,8 @@ properties:
maxItems: 5 maxItems: 5
clock-names: clock-names:
oneOf: minItems: 3
- items: #for ADSP based platforms maxItems: 5
- const: mclk
- const: npl
- const: macro
- const: dcodec
- const: fsgen
- items: #for ADSP bypass based platforms
- const: mclk
- const: npl
- const: fsgen
clock-output-names: clock-output-names:
maxItems: 1 maxItems: 1
@ -61,6 +50,65 @@ required:
- reg - reg
- "#sound-dai-cells" - "#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
- 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 unevaluatedProperties: false
examples: examples:

View File

@ -9,15 +9,13 @@ title: LPASS(Low Power Audio Subsystem) TX Macro audio codec
maintainers: maintainers:
- Srinivas Kandagatla <srinivas.kandagatla@linaro.org> - Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
allOf:
- $ref: dai-common.yaml#
properties: properties:
compatible: compatible:
enum: enum:
- qcom,sc7280-lpass-tx-macro - qcom,sc7280-lpass-tx-macro
- qcom,sm8250-lpass-tx-macro - qcom,sm8250-lpass-tx-macro
- qcom,sm8450-lpass-tx-macro - qcom,sm8450-lpass-tx-macro
- qcom,sm8550-lpass-tx-macro
- qcom,sc8280xp-lpass-tx-macro - qcom,sc8280xp-lpass-tx-macro
reg: reg:
@ -30,22 +28,12 @@ properties:
const: 0 const: 0
clocks: clocks:
oneOf: minItems: 3
- maxItems: 3 maxItems: 5
- maxItems: 5
clock-names: clock-names:
oneOf: minItems: 3
- items: #for ADSP based platforms maxItems: 5
- const: mclk
- const: npl
- const: macro
- const: dcodec
- const: fsgen
- items: #for ADSP bypass based platforms
- const: mclk
- const: npl
- const: fsgen
clock-output-names: clock-output-names:
maxItems: 1 maxItems: 1
@ -67,6 +55,65 @@ required:
- reg - reg
- "#sound-dai-cells" - "#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
- 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 unevaluatedProperties: false
examples: examples:

View File

@ -15,6 +15,7 @@ properties:
- qcom,sc7280-lpass-wsa-macro - qcom,sc7280-lpass-wsa-macro
- qcom,sm8250-lpass-wsa-macro - qcom,sm8250-lpass-wsa-macro
- qcom,sm8450-lpass-wsa-macro - qcom,sm8450-lpass-wsa-macro
- qcom,sm8550-lpass-wsa-macro
- qcom,sc8280xp-lpass-wsa-macro - qcom,sc8280xp-lpass-wsa-macro
reg: reg:
@ -27,11 +28,11 @@ properties:
const: 0 const: 0
clocks: clocks:
minItems: 5 minItems: 4
maxItems: 6 maxItems: 6
clock-names: clock-names:
minItems: 5 minItems: 4
maxItems: 6 maxItems: 6
clock-output-names: clock-output-names:
@ -62,6 +63,7 @@ allOf:
then: then:
properties: properties:
clocks: clocks:
minItems: 5
maxItems: 5 maxItems: 5
clock-names: clock-names:
items: items:
@ -89,6 +91,23 @@ allOf:
- const: va - const: va
- const: fsgen - 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 unevaluatedProperties: false
examples: examples:

View File

@ -6,6 +6,9 @@
#ifndef __LPASS_MACRO_COMMON_H__ #ifndef __LPASS_MACRO_COMMON_H__
#define __LPASS_MACRO_COMMON_H__ #define __LPASS_MACRO_COMMON_H__
/* NPL clock is expected */
#define LPASS_MACRO_FLAG_HAS_NPL_CLOCK BIT(0)
struct lpass_macro { struct lpass_macro {
struct device *macro_pd; struct device *macro_pd;
struct device *dcodec_pd; struct device *dcodec_pd;

View File

@ -3491,7 +3491,10 @@ static int rx_macro_register_mclk_output(struct rx_macro *rx)
struct clk_init_data init; struct clk_init_data init;
int ret; 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.name = clk_name;
init.ops = &swclk_gate_ops; init.ops = &swclk_gate_ops;
@ -3521,10 +3524,13 @@ static const struct snd_soc_component_driver rx_macro_component_drv = {
static int rx_macro_probe(struct platform_device *pdev) static int rx_macro_probe(struct platform_device *pdev)
{ {
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
kernel_ulong_t flags;
struct rx_macro *rx; struct rx_macro *rx;
void __iomem *base; void __iomem *base;
int ret; int ret;
flags = (kernel_ulong_t)device_get_match_data(dev);
rx = devm_kzalloc(dev, sizeof(*rx), GFP_KERNEL); rx = devm_kzalloc(dev, sizeof(*rx), GFP_KERNEL);
if (!rx) if (!rx)
return -ENOMEM; return -ENOMEM;
@ -3541,9 +3547,11 @@ static int rx_macro_probe(struct platform_device *pdev)
if (IS_ERR(rx->mclk)) if (IS_ERR(rx->mclk))
return PTR_ERR(rx->mclk); return PTR_ERR(rx->mclk);
rx->npl = devm_clk_get(dev, "npl"); if (flags & LPASS_MACRO_FLAG_HAS_NPL_CLOCK) {
if (IS_ERR(rx->npl)) rx->npl = devm_clk_get(dev, "npl");
return PTR_ERR(rx->npl); if (IS_ERR(rx->npl))
return PTR_ERR(rx->npl);
}
rx->fsgen = devm_clk_get(dev, "fsgen"); rx->fsgen = devm_clk_get(dev, "fsgen");
if (IS_ERR(rx->fsgen)) if (IS_ERR(rx->fsgen))
@ -3653,10 +3661,22 @@ static void rx_macro_remove(struct platform_device *pdev)
} }
static const struct of_device_id rx_macro_dt_match[] = { static const struct of_device_id rx_macro_dt_match[] = {
{ .compatible = "qcom,sc7280-lpass-rx-macro" }, {
{ .compatible = "qcom,sm8250-lpass-rx-macro" }, .compatible = "qcom,sc7280-lpass-rx-macro",
{ .compatible = "qcom,sm8450-lpass-rx-macro" }, .data = (void *)LPASS_MACRO_FLAG_HAS_NPL_CLOCK,
{ .compatible = "qcom,sc8280xp-lpass-rx-macro" },
}, {
.compatible = "qcom,sm8250-lpass-rx-macro",
.data = (void *)LPASS_MACRO_FLAG_HAS_NPL_CLOCK,
}, {
.compatible = "qcom,sm8450-lpass-rx-macro",
.data = (void *)LPASS_MACRO_FLAG_HAS_NPL_CLOCK,
}, {
.compatible = "qcom,sm8550-lpass-rx-macro",
}, {
.compatible = "qcom,sc8280xp-lpass-rx-macro",
.data = (void *)LPASS_MACRO_FLAG_HAS_NPL_CLOCK,
},
{ } { }
}; };
MODULE_DEVICE_TABLE(of, rx_macro_dt_match); MODULE_DEVICE_TABLE(of, rx_macro_dt_match);

View File

@ -1915,7 +1915,10 @@ static int tx_macro_register_mclk_output(struct tx_macro *tx)
struct clk_init_data init; struct clk_init_data init;
int ret; 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.name = clk_name;
init.ops = &swclk_gate_ops; init.ops = &swclk_gate_ops;
@ -1946,10 +1949,13 @@ static int tx_macro_probe(struct platform_device *pdev)
{ {
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
struct device_node *np = dev->of_node; struct device_node *np = dev->of_node;
kernel_ulong_t flags;
struct tx_macro *tx; struct tx_macro *tx;
void __iomem *base; void __iomem *base;
int ret, reg; int ret, reg;
flags = (kernel_ulong_t)device_get_match_data(dev);
tx = devm_kzalloc(dev, sizeof(*tx), GFP_KERNEL); tx = devm_kzalloc(dev, sizeof(*tx), GFP_KERNEL);
if (!tx) if (!tx)
return -ENOMEM; return -ENOMEM;
@ -1966,9 +1972,11 @@ static int tx_macro_probe(struct platform_device *pdev)
if (IS_ERR(tx->mclk)) if (IS_ERR(tx->mclk))
return PTR_ERR(tx->mclk); return PTR_ERR(tx->mclk);
tx->npl = devm_clk_get(dev, "npl"); if (flags & LPASS_MACRO_FLAG_HAS_NPL_CLOCK) {
if (IS_ERR(tx->npl)) tx->npl = devm_clk_get(dev, "npl");
return PTR_ERR(tx->npl); if (IS_ERR(tx->npl))
return PTR_ERR(tx->npl);
}
tx->fsgen = devm_clk_get(dev, "fsgen"); tx->fsgen = devm_clk_get(dev, "fsgen");
if (IS_ERR(tx->fsgen)) if (IS_ERR(tx->fsgen))
@ -2143,10 +2151,21 @@ static const struct dev_pm_ops tx_macro_pm_ops = {
}; };
static const struct of_device_id tx_macro_dt_match[] = { static const struct of_device_id tx_macro_dt_match[] = {
{ .compatible = "qcom,sc7280-lpass-tx-macro" }, {
{ .compatible = "qcom,sm8250-lpass-tx-macro" }, .compatible = "qcom,sc7280-lpass-tx-macro",
{ .compatible = "qcom,sm8450-lpass-tx-macro" }, .data = (void *)LPASS_MACRO_FLAG_HAS_NPL_CLOCK,
{ .compatible = "qcom,sc8280xp-lpass-tx-macro" }, }, {
.compatible = "qcom,sm8250-lpass-tx-macro",
.data = (void *)LPASS_MACRO_FLAG_HAS_NPL_CLOCK,
}, {
.compatible = "qcom,sm8450-lpass-tx-macro",
.data = (void *)LPASS_MACRO_FLAG_HAS_NPL_CLOCK,
}, {
.compatible = "qcom,sm8550-lpass-tx-macro",
}, {
.compatible = "qcom,sc8280xp-lpass-tx-macro",
.data = (void *)LPASS_MACRO_FLAG_HAS_NPL_CLOCK,
},
{ } { }
}; };
MODULE_DEVICE_TABLE(of, tx_macro_dt_match); MODULE_DEVICE_TABLE(of, tx_macro_dt_match);

View File

@ -14,6 +14,8 @@
#include <linux/pm_runtime.h> #include <linux/pm_runtime.h>
#include <linux/of_platform.h> #include <linux/of_platform.h>
#include <sound/tlv.h> #include <sound/tlv.h>
#include "lpass-macro-common.h"
#include "lpass-wsa-macro.h" #include "lpass-wsa-macro.h"
#define CDC_WSA_CLK_RST_CTRL_MCLK_CONTROL (0x0000) #define CDC_WSA_CLK_RST_CTRL_MCLK_CONTROL (0x0000)
@ -2346,7 +2348,10 @@ static int wsa_macro_register_mclk_output(struct wsa_macro *wsa)
struct clk_init_data init; struct clk_init_data init;
int ret; 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"; init.name = "mclk";
of_property_read_string(dev_of_node(dev), "clock-output-names", of_property_read_string(dev_of_node(dev), "clock-output-names",
@ -2379,9 +2384,12 @@ static int wsa_macro_probe(struct platform_device *pdev)
{ {
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
struct wsa_macro *wsa; struct wsa_macro *wsa;
kernel_ulong_t flags;
void __iomem *base; void __iomem *base;
int ret; int ret;
flags = (kernel_ulong_t)device_get_match_data(dev);
wsa = devm_kzalloc(dev, sizeof(*wsa), GFP_KERNEL); wsa = devm_kzalloc(dev, sizeof(*wsa), GFP_KERNEL);
if (!wsa) if (!wsa)
return -ENOMEM; return -ENOMEM;
@ -2398,9 +2406,11 @@ static int wsa_macro_probe(struct platform_device *pdev)
if (IS_ERR(wsa->mclk)) if (IS_ERR(wsa->mclk))
return PTR_ERR(wsa->mclk); return PTR_ERR(wsa->mclk);
wsa->npl = devm_clk_get(dev, "npl"); if (flags & LPASS_MACRO_FLAG_HAS_NPL_CLOCK) {
if (IS_ERR(wsa->npl)) wsa->npl = devm_clk_get(dev, "npl");
return PTR_ERR(wsa->npl); if (IS_ERR(wsa->npl))
return PTR_ERR(wsa->npl);
}
wsa->fsgen = devm_clk_get(dev, "fsgen"); wsa->fsgen = devm_clk_get(dev, "fsgen");
if (IS_ERR(wsa->fsgen)) if (IS_ERR(wsa->fsgen))
@ -2551,10 +2561,21 @@ static const struct dev_pm_ops wsa_macro_pm_ops = {
}; };
static const struct of_device_id wsa_macro_dt_match[] = { static const struct of_device_id wsa_macro_dt_match[] = {
{.compatible = "qcom,sc7280-lpass-wsa-macro"}, {
{.compatible = "qcom,sm8250-lpass-wsa-macro"}, .compatible = "qcom,sc7280-lpass-wsa-macro",
{.compatible = "qcom,sm8450-lpass-wsa-macro"}, .data = (void *)LPASS_MACRO_FLAG_HAS_NPL_CLOCK,
{.compatible = "qcom,sc8280xp-lpass-wsa-macro" }, }, {
.compatible = "qcom,sm8250-lpass-wsa-macro",
.data = (void *)LPASS_MACRO_FLAG_HAS_NPL_CLOCK,
}, {
.compatible = "qcom,sm8450-lpass-wsa-macro",
.data = (void *)LPASS_MACRO_FLAG_HAS_NPL_CLOCK,
}, {
.compatible = "qcom,sm8550-lpass-wsa-macro",
}, {
.compatible = "qcom,sc8280xp-lpass-wsa-macro",
.data = (void *)LPASS_MACRO_FLAG_HAS_NPL_CLOCK,
},
{} {}
}; };
MODULE_DEVICE_TABLE(of, wsa_macro_dt_match); MODULE_DEVICE_TABLE(of, wsa_macro_dt_match);