Unverified Commit 787a46c0 authored by Mark Brown's avatar Mark Brown
Browse files

Merge series "ASoC: Add new module driver for new ASRC" from Shengjiu Wang <shengjiu.wang@nxp.com>:

Add new module driver for new ASRC in i.MX8MN, several commits
are added for new property fsl,asrc-format

Shengjiu Wang (7):
  ASoC: fsl_asrc: rename asrc_priv to asrc
  ASoC: dt-bindings: fsl_asrc: Add new property fsl,asrc-format
  ASoC: fsl-asoc-card: Support new property fsl,asrc-format
  ASoC: fsl_asrc: Support new property fsl,asrc-format
  ASoC: fsl_asrc: Move common definition to fsl_asrc_common
  ASoC: dt-bindings: fsl_easrc: Add document for EASRC
  ASoC: fsl_easrc: Add EASRC ASoC CPU DAI drivers

changes in v9
- use lowercase for dt example.

changes in v8
- change get_pair_priv_size to pair_priv_size variable

changes in v7
- updated according to Nicoin's comments.
- add get_pair_priv_size to replace PAIR_PRIVATE_SIZE

changes in v6
- updated according to Nicoin's and Rob's comments.

changes in v5
- Add new property fsl,asrc-format, rather than change fsl,asrc-width
  to fsl,asrc-formt.
- code change for above change.

changes in v4
- Add several commit for changing DT binding asrc-width to asrc-format
- rename asrc_priv to asrc

changes in v3
- add new commit "ASoC: fsl_asrc: Change asrc_width to asrc_format"
- modify binding doc to yaml format
- remove fsl_easrc_dma.c, make fsl_asrc_dma.c useable for easrc.

changes in v2
- change i.MX815 to i.MX8MN
- Add changes in Kconfig and Makefile

 .../devicetree/bindings/sound/fsl,asrc.txt    |    4 +
 .../devicetree/bindings/sound/fsl,easrc.yaml  |  101 +
 sound/soc/fsl/Kconfig                         |   11 +
 sound/soc/fsl/Makefile                        |    2 +
 sound/soc/fsl/fsl-asoc-card.c                 |   24 +-
 sound/soc/fsl/fsl_asrc.c                      |  305 +--
 sound/soc/fsl/fsl_asrc.h                      |   74 +-
 sound/soc/fsl/fsl_asrc_common.h               |  106 +
 sound/soc/fsl/fsl_asrc_dma.c                  |   54 +-
 sound/soc/fsl/fsl_easrc.c                     | 2114 +++++++++++++++++
 sound/soc/fsl/fsl_easrc.h                     |  651 +++++
 11 files changed, 3212 insertions(+), 234 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/sound/fsl,easrc.yaml
 create mode 100644 sound/soc/fsl/fsl_asrc_common.h
 create mode 100644 sound/soc/fsl/fsl_easrc.c
 create mode 100644 sound/soc/fsl/fsl_easrc.h

--
2.21.0
parents 8baa3b5a 955ac624
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -51,6 +51,10 @@ Optional properties:
			  will be in use as default. Otherwise, the big endian
			  mode will be in use for all the device registers.

   - fsl,asrc-format	: Defines a mutual sample format used by DPCM Back
			  Ends, which can replace the fsl,asrc-width.
			  The value is 2 (S16_LE), or 6 (S24_LE).

Example:

asrc: asrc@2034000 {
+101 −0
Original line number Diff line number Diff line
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/sound/fsl,easrc.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: NXP Asynchronous Sample Rate Converter (ASRC) Controller

maintainers:
  - Shengjiu Wang <shengjiu.wang@nxp.com>

properties:
  $nodename:
    pattern: "^easrc@.*"

  compatible:
    const: fsl,imx8mn-easrc

  reg:
    maxItems: 1

  interrupts:
    maxItems: 1

  clocks:
    items:
      - description: Peripheral clock

  clock-names:
    items:
      - const: mem

  dmas:
    maxItems: 8

  dma-names:
    items:
      - const: ctx0_rx
      - const: ctx0_tx
      - const: ctx1_rx
      - const: ctx1_tx
      - const: ctx2_rx
      - const: ctx2_tx
      - const: ctx3_rx
      - const: ctx3_tx

  firmware-name:
    allOf:
      - $ref: /schemas/types.yaml#/definitions/string
      - const: imx/easrc/easrc-imx8mn.bin
    description: The coefficient table for the filters

  fsl,asrc-rate:
    allOf:
      - $ref: /schemas/types.yaml#/definitions/uint32
      - minimum: 8000
      - maximum: 192000
    description: Defines a mutual sample rate used by DPCM Back Ends

  fsl,asrc-format:
    allOf:
      - $ref: /schemas/types.yaml#/definitions/uint32
      - enum: [2, 6, 10, 32, 36]
        default: 2
    description:
      Defines a mutual sample format used by DPCM Back Ends

required:
  - compatible
  - reg
  - interrupts
  - clocks
  - clock-names
  - dmas
  - dma-names
  - firmware-name
  - fsl,asrc-rate
  - fsl,asrc-format

examples:
  - |
    #include <dt-bindings/clock/imx8mn-clock.h>

    easrc: easrc@300c0000 {
           compatible = "fsl,imx8mn-easrc";
           reg = <0x0 0x300c0000 0x0 0x10000>;
           interrupts = <0x0 122 0x4>;
           clocks = <&clk IMX8MN_CLK_ASRC_ROOT>;
           clock-names = "mem";
           dmas = <&sdma2 16 23 0> , <&sdma2 17 23 0>,
                  <&sdma2 18 23 0> , <&sdma2 19 23 0>,
                  <&sdma2 20 23 0> , <&sdma2 21 23 0>,
                  <&sdma2 22 23 0> , <&sdma2 23 23 0>;
           dma-names = "ctx0_rx", "ctx0_tx",
                       "ctx1_rx", "ctx1_tx",
                       "ctx2_rx", "ctx2_tx",
                       "ctx3_rx", "ctx3_tx";
           firmware-name = "imx/easrc/easrc-imx8mn.bin";
           fsl,asrc-rate  = <8000>;
           fsl,asrc-format = <2>;
    };
+11 −0
Original line number Diff line number Diff line
@@ -84,6 +84,17 @@ config SND_SOC_FSL_MICFIL
	  Say Y if you want to add Pulse Density Modulation microphone
	  interface (MICFIL) support for NXP.

config SND_SOC_FSL_EASRC
	tristate "Enhanced Asynchronous Sample Rate Converter (EASRC) module support"
	depends on SND_SOC_FSL_ASRC
	select REGMAP_MMIO
	select SND_SOC_GENERIC_DMAENGINE_PCM
	help
	  Say Y if you want to add Enhanced ASRC support for NXP. The ASRC is
	  a digital module that converts audio from a source sample rate to a
	  destination sample rate. It is a new design module compare with the
	  old ASRC.

config SND_SOC_FSL_UTILS
	tristate

+2 −0
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ snd-soc-fsl-micfil-objs := fsl_micfil.o
snd-soc-fsl-utils-objs := fsl_utils.o
snd-soc-fsl-dma-objs := fsl_dma.o
snd-soc-fsl-mqs-objs := fsl_mqs.o
snd-soc-fsl-easrc-objs := fsl_easrc.o

obj-$(CONFIG_SND_SOC_FSL_AUDMIX) += snd-soc-fsl-audmix.o
obj-$(CONFIG_SND_SOC_FSL_ASOC_CARD) += snd-soc-fsl-asoc-card.o
@@ -35,6 +36,7 @@ obj-$(CONFIG_SND_SOC_FSL_ESAI) += snd-soc-fsl-esai.o
obj-$(CONFIG_SND_SOC_FSL_MICFIL) += snd-soc-fsl-micfil.o
obj-$(CONFIG_SND_SOC_FSL_UTILS) += snd-soc-fsl-utils.o
obj-$(CONFIG_SND_SOC_FSL_MQS) += snd-soc-fsl-mqs.o
obj-$(CONFIG_SND_SOC_FSL_EASRC) += snd-soc-fsl-easrc.o
obj-$(CONFIG_SND_SOC_POWERPC_DMA) += snd-soc-fsl-dma.o

# MPC5200 Platform Support
+15 −9
Original line number Diff line number Diff line
@@ -680,10 +680,15 @@ static int fsl_asoc_card_probe(struct platform_device *pdev)
			goto asrc_fail;
		}

		ret = of_property_read_u32(asrc_np, "fsl,asrc-width", &width);
		ret = of_property_read_u32(asrc_np, "fsl,asrc-format",
					   &priv->asrc_format);
		if (ret) {
			dev_err(&pdev->dev, "failed to get output rate\n");
			ret = -EINVAL;
			/* Fallback to old binding; translate to asrc_format */
			ret = of_property_read_u32(asrc_np, "fsl,asrc-width",
						   &width);
			if (ret) {
				dev_err(&pdev->dev,
					"failed to decide output format\n");
				goto asrc_fail;
			}

@@ -692,6 +697,7 @@ static int fsl_asoc_card_probe(struct platform_device *pdev)
			else
				priv->asrc_format = SNDRV_PCM_FORMAT_S16_LE;
		}
	}

	/* Finish card registering */
	platform_set_drvdata(pdev, priv);
Loading