Unverified Commit d6790ae0 authored by Mark Brown's avatar Mark Brown
Browse files

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
Loading
Loading
Loading
Loading
+62 −14
Original line number Diff line number Diff line
@@ -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:
+64 −17
Original line number Diff line number Diff line
@@ -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:
+21 −2
Original line number Diff line number Diff line
@@ -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:
+3 −0
Original line number Diff line number Diff line
@@ -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;
+28 −8
Original line number Diff line number Diff line
@@ -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);
Loading