Commit d6790ae0 authored by Mark Brown's avatar Mark Brown

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
parents 7739b152 6b004b83
......@@ -9,15 +9,13 @@ title: LPASS(Low Power Audio Subsystem) RX Macro audio codec
maintainers:
- Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
allOf:
- $ref: dai-common.yaml#
properties:
compatible:
enum:
- 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:
......@@ -33,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
......@@ -61,6 +50,65 @@ 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
- 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:
......
......@@ -9,15 +9,13 @@ title: LPASS(Low Power Audio Subsystem) TX Macro audio codec
maintainers:
- Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
allOf:
- $ref: dai-common.yaml#
properties:
compatible:
enum:
- 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:
......@@ -30,22 +28,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 +55,65 @@ 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
- 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:
......
......@@ -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:
......
......@@ -6,6 +6,9 @@
#ifndef __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 device *macro_pd;
struct device *dcodec_pd;
......
......@@ -3491,7 +3491,10 @@ static int rx_macro_register_mclk_output(struct rx_macro *rx)
struct clk_init_data init;
int ret;
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 +3524,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 +3547,11 @@ static int rx_macro_probe(struct platform_device *pdev)
if (IS_ERR(rx->mclk))
return PTR_ERR(rx->mclk);
if (flags & LPASS_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))
......@@ -3653,10 +3661,22 @@ static void 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 *)LPASS_MACRO_FLAG_HAS_NPL_CLOCK,
}, {
.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);
......
......@@ -1915,7 +1915,10 @@ static int tx_macro_register_mclk_output(struct tx_macro *tx)
struct clk_init_data init;
int ret;
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 +1949,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 +1972,11 @@ static int tx_macro_probe(struct platform_device *pdev)
if (IS_ERR(tx->mclk))
return PTR_ERR(tx->mclk);
if (flags & LPASS_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))
......@@ -2143,10 +2151,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 *)LPASS_MACRO_FLAG_HAS_NPL_CLOCK,
}, {
.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);
......
......@@ -14,6 +14,8 @@
#include <linux/pm_runtime.h>
#include <linux/of_platform.h>
#include <sound/tlv.h>
#include "lpass-macro-common.h"
#include "lpass-wsa-macro.h"
#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;
int ret;
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 +2384,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 +2406,11 @@ static int wsa_macro_probe(struct platform_device *pdev)
if (IS_ERR(wsa->mclk))
return PTR_ERR(wsa->mclk);
if (flags & LPASS_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))
......@@ -2551,10 +2561,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 *)LPASS_MACRO_FLAG_HAS_NPL_CLOCK,
}, {
.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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment