Skip to contentSkip to conversation

Add new module driver for new ASRC

PATCH Superseded Shengjiu Wang 4 participants 8 messages Feb 12, 2020 – Feb 13, 2020

Subsystems (4)

v1 of 9 Superseded Latest is v9 →

lore
Share & tools
lore
#0 lore raw

cover Add new module driver for new ASRC

Add new module driver for new ASRC in i.MX815/865

Shengjiu Wang (3):
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 and platform drivers

 .../devicetree/bindings/sound/fsl,easrc.txt   |   57 +
 sound/soc/fsl/fsl_asrc.h                      |   11 +-
 sound/soc/fsl/fsl_asrc_common.h               |   22 +
 sound/soc/fsl/fsl_easrc.c                     | 2265 +++++++++++++++++
 sound/soc/fsl/fsl_easrc.h                     |  668 +++++
 sound/soc/fsl/fsl_easrc_dma.c                 |  440 ++++
 6 files changed, 3453 insertions(+), 10 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/sound/fsl,easrc.txt
 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
 create mode 100644 sound/soc/fsl/fsl_easrc_dma.c
Signature · 1 line
2.21.0
#1 lore raw

PATCH 1/3 ASoC: fsl_asrc: Move common definition to fsl_asrc_common

There is a new ASRC included in i.MX serial platform, there are some common definition can be shared with each other. So move the common definition to a separate header file.

---
 sound/soc/fsl/fsl_asrc.h        | 11 +----------
 sound/soc/fsl/fsl_asrc_common.h | 21 +++++++++++++++++++++
 2 files changed, 22 insertions(+), 10 deletions(-)
 create mode 100644 sound/soc/fsl/fsl_asrc_common.h
sound/soc/fsl/fsl_asrc.h +1 -10
index 8a821132d9d0..e8abb27ffeda 100644
@@ -10,8 +10,7 @@
 #ifndef _FSL_ASRC_H
 #define _FSL_ASRC_H
 
-#define IN	0
-#define OUT	1
+#include  "fsl_asrc_common.h"
 
 #define ASRC_DMA_BUFFER_NUM		2
 #define ASRC_INPUTFIFO_THRESHOLD	32
@@ -283,14 +282,6 @@
 #define ASRMCR1i_OW16_MASK		(1 << ASRMCR1i_OW16_SHIFT)
 #define ASRMCR1i_OW16(v)		((v) << ASRMCR1i_OW16_SHIFT)
 
-
-enum asrc_pair_index {
-	ASRC_INVALID_PAIR = -1,
-	ASRC_PAIR_A = 0,
-	ASRC_PAIR_B = 1,
-	ASRC_PAIR_C = 2,
-};
-
 #define ASRC_PAIR_MAX_NUM	(ASRC_PAIR_C + 1)
 
 enum asrc_inclk {
sound/soc/fsl/fsl_asrc_common.h new file +21 -0
new file mode 100644
index 000000000000..8acc55778ff2
@@ -0,0 +1,21 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright 2019 NXP
+ *
+ */
+
+#ifndef _FSL_ASRC_COMMON_H
+#define _FSL_ASRC_COMMON_H
+
+/* directions */
+#define IN	0
+#define OUT	1
+
+enum asrc_pair_index {
+	ASRC_INVALID_PAIR = -1,
+	ASRC_PAIR_A = 0,
+	ASRC_PAIR_B = 1,
+	ASRC_PAIR_C = 2,
+};
+
+#endif /* _FSL_ASRC_COMMON_H */
Signature · 1 line
2.21.0
#2 lore raw

PATCH 2/3 ASoC: dt-bindings: fsl_easrc: Add document for EASRC

In reply to Shengjiu Wang

EASRC (Enhanced Asynchronous Sample Rate Converter) is a new IP module found on i.MX815.

---
 .../devicetree/bindings/sound/fsl,easrc.txt   | 57 +++++++++++++++++++
 1 file changed, 57 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/sound/fsl,easrc.txt
Documentation/devicetree/bindings/sound/fsl,easrc.txt new file +57 -0
new file mode 100644
index 000000000000..0e8153165e3b
@@ -0,0 +1,57 @@
+NXP Asynchronous Sample Rate Converter (ASRC) Controller
+
+The Asynchronous Sample Rate Converter (ASRC) converts the sampling rate of a
+signal associated with an input clock into a signal associated with a different
+output clock. The driver currently works as a Front End of DPCM with other Back
+Ends Audio controller such as ESAI, SSI and SAI. It has four context to support
+four substreams within totally 32 channels.
+
+Required properties:
+- compatible:                Contains "fsl,imx8mn-easrc".
+
+- reg:                       Offset and length of the register set for the
+			     device.
+
+- interrupts:                Contains the asrc interrupt.
+
+- dmas:                      Generic dma devicetree binding as described in
+		             Documentation/devicetree/bindings/dma/dma.txt.
+
+- dma-names:                 Contains "ctx0_rx", "ctx0_tx",
+				      "ctx1_rx", "ctx1_tx",
+			              "ctx2_rx", "ctx2_tx",
+				      "ctx3_rx", "ctx3_tx".
+
+- clocks:                    Contains an entry for each entry in clock-names.
+
+- clock-names:               "mem" - Peripheral clock to driver module.
+
+- fsl,easrc-ram-script-name: The coefficient table for the filters
+
+- fsl,asrc-rate:             Defines a mutual sample rate used by DPCM Back
+			     Ends.
+
+- fsl,asrc-width:            Defines a mutual sample width used by DPCM Back
+			     Ends.
+
+Example:
+
+easrc: easrc@300C0000 {
+	compatible = "fsl,imx8mn-easrc";
+	reg = <0x0 0x300C0000 0x0 0x10000>;
+	interrupts = <GIC_SPI 122 IRQ_TYPE_LEVEL_HIGH>;
+	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";
+	fsl,easrc-ram-script-name = "imx/easrc/easrc-imx8mn.bin";
+	fsl,asrc-rate  = <8000>;
+	fsl,asrc-width = <16>;
+	status = "disabled";
+};
Signature · 1 line
2.21.0
#5 lore raw

PATCH 3/3 ASoC: fsl_easrc: Add EASRC ASoC CPU DAI and platform drivers

In reply to Shengjiu Wang

EASRC (Enhanced Asynchronous Sample Rate Converter) is a new IP module found on i.MX815. It is different with old ASRC module.

The primary features for the EASRC are as follows:
- 4 Contexts - groups of channels with an independent time base
- Fully independent and concurrent context control
- Simultaneous processing of up to 32 audio channels
- Programmable filter charachteristics for each context
- 32, 24, 20, and 16-bit fixed point audio sample support
- 32-bit floating point audio sample support
- 8kHz to 384kHz sample rate
- 1/16 to 8x sample rate conversion ratio

---
 sound/soc/fsl/fsl_asrc_common.h |    1 +
 sound/soc/fsl/fsl_easrc.c       | 2265 +++++++++++++++++++++++++++++++
 sound/soc/fsl/fsl_easrc.h       |  668 +++++++++
 sound/soc/fsl/fsl_easrc_dma.c   |  440 ++++++
 4 files changed, 3374 insertions(+)
 create mode 100644 sound/soc/fsl/fsl_easrc.c
 create mode 100644 sound/soc/fsl/fsl_easrc.h
 create mode 100644 sound/soc/fsl/fsl_easrc_dma.c
sound/soc/fsl/fsl_asrc_common.h +1 -0
index 8acc55778ff2..c2056b661f15 100644
@@ -16,6 +16,7 @@ enum asrc_pair_index {
 	ASRC_PAIR_A = 0,
 	ASRC_PAIR_B = 1,
 	ASRC_PAIR_C = 2,
+	ASRC_PAIR_D = 3,
 };
 
 #endif /* _FSL_ASRC_COMMON_H */
sound/soc/fsl/fsl_easrc.c new file +2265 -0

2,265 lines not on this page · raw message

sound/soc/fsl/fsl_easrc.h new file +668 -0

668 lines not on this page · raw message

sound/soc/fsl/fsl_easrc_dma.c new file +440 -0

60 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.21.0

Part of the diff is not shown here. View the raw message.

#6 lore raw
In reply to Shengjiu Wang
Quoted 7 lines · Shengjiu Wang

Add new module driver for new ASRC in i.MX815/865

Shengjiu Wang (3):
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 and platform drivers

Quoted 13 lines
 .../devicetree/bindings/sound/fsl,easrc.txt   |   57 +
 sound/soc/fsl/fsl_asrc.h                      |   11 +-
 sound/soc/fsl/fsl_asrc_common.h               |   22 +
 sound/soc/fsl/fsl_easrc.c                     | 2265 +++++++++++++++++
 sound/soc/fsl/fsl_easrc.h                     |  668 +++++
 sound/soc/fsl/fsl_easrc_dma.c                 |  440 ++++
 6 files changed, 3453 insertions(+), 10 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/sound/fsl,easrc.txt
 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
 create mode 100644 sound/soc/fsl/fsl_easrc_dma.c

Hi,

Is this patch series missing Kconfig, Makefile, and possibly MAINTAINERS patches?

thanks.

Signature · 1 line
~Randy
maintainer
#7 lore raw
Quoted 23 lines · Randy Dunlap
Quoted 7 lines · Shengjiu Wang

Add new module driver for new ASRC in i.MX815/865

Shengjiu Wang (3):
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 and platform drivers

Quoted 13 lines
 .../devicetree/bindings/sound/fsl,easrc.txt   |   57 +
 sound/soc/fsl/fsl_asrc.h                      |   11 +-
 sound/soc/fsl/fsl_asrc_common.h               |   22 +
 sound/soc/fsl/fsl_easrc.c                     | 2265 +++++++++++++++++
 sound/soc/fsl/fsl_easrc.h                     |  668 +++++
 sound/soc/fsl/fsl_easrc_dma.c                 |  440 ++++
 6 files changed, 3453 insertions(+), 10 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/sound/fsl,easrc.txt
 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
 create mode 100644 sound/soc/fsl/fsl_easrc_dma.c
Quoted 5 lines

Hi,

Is this patch series missing Kconfig, Makefile, and possibly MAINTAINERS patches?

yes, Kconfig, Makefile is missed, will add in next version, and no maintainers patch.

best regards
wang shengjiu

reviewer
#3 lore raw

Re: [PATCH 2/3] ASoC: dt-bindings: fsl_easrc: Add document for EASRC

In reply to Shengjiu Wang
Quoted 3 lines · Shengjiu Wang

EASRC (Enhanced Asynchronous Sample Rate Converter) is a new IP module found on i.MX815.

i.MX815 in an internal terminology. Please avoid it on the commit log.

Quoted 73 lines
---
 .../devicetree/bindings/sound/fsl,easrc.txt   | 57 +++++++++++++++++++
 1 file changed, 57 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/sound/fsl,easrc.txt
Documentation/devicetree/bindings/sound/fsl,easrc.txt new file +57 -1
new file mode 100644
index 000000000000..0e8153165e3b
@@ -0,0 +1,57 @@
+NXP Asynchronous Sample Rate Converter (ASRC) Controller
+
+The Asynchronous Sample Rate Converter (ASRC) converts the sampling rate of a
+signal associated with an input clock into a signal associated with a different
+output clock. The driver currently works as a Front End of DPCM with other Back
+Ends Audio controller such as ESAI, SSI and SAI. It has four context to support
+four substreams within totally 32 channels.
+
+Required properties:
+- compatible:                Contains "fsl,imx8mn-easrc".
+
+- reg:                       Offset and length of the register set for the
+                            device.
+
+- interrupts:                Contains the asrc interrupt.
+
+- dmas:                      Generic dma devicetree binding as described in
+                            Documentation/devicetree/bindings/dma/dma.txt.
+
+- dma-names:                 Contains "ctx0_rx", "ctx0_tx",
+                                     "ctx1_rx", "ctx1_tx",
+                                     "ctx2_rx", "ctx2_tx",
+                                     "ctx3_rx", "ctx3_tx".
+
+- clocks:                    Contains an entry for each entry in clock-names.
+
+- clock-names:               "mem" - Peripheral clock to driver module.
+
+- fsl,easrc-ram-script-name: The coefficient table for the filters
+
+- fsl,asrc-rate:             Defines a mutual sample rate used by DPCM Back
+                            Ends.
+
+- fsl,asrc-width:            Defines a mutual sample width used by DPCM Back
+                            Ends.
+
+Example:
+
+easrc: easrc@300C0000 {
+       compatible = "fsl,imx8mn-easrc";
+       reg = <0x0 0x300C0000 0x0 0x10000>;
+       interrupts = <GIC_SPI 122 IRQ_TYPE_LEVEL_HIGH>;
+       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";
+       fsl,easrc-ram-script-name = "imx/easrc/easrc-imx8mn.bin";
+       fsl,asrc-rate  = <8000>;
+       fsl,asrc-width = <16>;
+       status = "disabled";
+};
--

2.21.0

maintainer
#4 lore raw

Re: [alsa-devel] [PATCH 2/3] ASoC: dt-bindings: fsl_easrc: Add document for EASRC

Hi

Quoted 8 lines · Fabio Estevam
Quoted 3 lines · Shengjiu Wang

EASRC (Enhanced Asynchronous Sample Rate Converter) is a new IP module found on i.MX815.

i.MX815 in an internal terminology. Please avoid it on the commit log.

Ok, will use i.MX8MN instead.