Add Freescale ASRC driver
Subsystems (5)
Nicolin Chen
reviewerv5 cover Add Freescale ASRC driver
This series of patches add Freescale ASRC module driver support along with the extra request in imx-sdma structure required by SDMA Device to Device script.
The previous version has been in the maillist for nearly six months without any comment and reply. So I decide to drop the SDMA part's change since this series focus on ASRC support (Later, we can send SDMA part separately.) so that ASRC driver may get upstream first.
Changelog
v5: (All follow Varka's suggestions)
* PATCH-2: Added missing '\n' to pair_err() calls.
* PATCH-2: Return the final regmap_write() for fsl_asrc_init().
* PATCH-2: Dropped fsl_asrc_devtype and use simple ids behind fsl_asrc_pm.
* PATCH-2: Use of_device_is_compatible() to differ compatible directly.
* PATCH-2: Fixed indentation for devm_regmap_init_mmio_clk() call.
v4: (All follow Varka's suggestions)
* PATCH-2: Added '\n' to dev_dbg() inside fsl_asrc_isr().
* PATCH-2: Added indentations to DT binding document.
* PATCH-2: Redefined fsl_asrc_set_watermarks() as void type.
* PATCH-2: Put fsl_asrc_isr() and fsl_asrc_ids before probe()
v3:
* PATCH-1: Added an Acked-by from Shawn Guo
* PATCH-2: Dropped THIS_MODULE as Tobias suggests
* PATCH-2: Use dma_coerce_mask_and_coherent() in fsl_asrc_dma_pcm_new()
* PATCH-2: Added substream check in fsl_asrc_dma_pcm_new()
v2:
* PATCH-1: Dropped the change to SDMA driver.
* PATCH-2: Dropped useless member in private data structures.
* PATCH-2: Refined some comments in fsl_asrc_dma.c driver.
* PATCH-2: Refined commit comments.
Nicolin Chen (2):
ARM: imx: Add the secondary request into the structure for imx-sdma
ASoC: fsl_asrc: Add ASRC ASoC CPU DAI and platform drivers
.../devicetree/bindings/sound/fsl,asrc.txt | 60 ++ include/linux/platform_data/dma-imx.h | 1 + sound/soc/fsl/Kconfig | 9 + sound/soc/fsl/Makefile | 2 + sound/soc/fsl/fsl_asrc.c | 992 +++++++++++++++++++++ sound/soc/fsl/fsl_asrc.h | 461 ++++++++++ sound/soc/fsl/fsl_asrc_dma.c | 386 ++++++++ 7 files changed, 1911 insertions(+) create mode 100644 Documentation/devicetree/bindings/sound/fsl,asrc.txt create mode 100644 sound/soc/fsl/fsl_asrc.c create mode 100644 sound/soc/fsl/fsl_asrc.h create mode 100644 sound/soc/fsl/fsl_asrc_dma.c
Signature · 1 line
1.8.4
Nicolin Chen
reviewerPATCH v5 1/2 ARM: imx: Add the secondary request into the structure for imx-sdma
SDMA supports device to device (per_2_per) scripts to handle DMA transfering between two peripheral devices. The per_2_per script, however, needs two dma requests from two sides while the current structure only defined one request.
So this patch just simply adds the secondary request so as to let SDMA and its user to add its implementation later.
[ Both change in the SDMA driver and its users like Freescale ASRC ASoC driver
should be taken along with this change in order to truly support per_2_per sciprts. However, we here make an expediency by adding this first so that we can add either side later since this patch won't break any function and meanwhile it can make merge window more smoothly: we don't need to apply the change inside dmaengine branch via ASoC tree any more. -- Nicolin ]
--- include/linux/platform_data/dma-imx.h | 1 + 1 file changed, 1 insertion(+)
include/linux/platform_data/dma-imx.h +1 -0
@@ -51,6 +51,7 @@ enum imx_dma_prio {struct imx_dma_data {int dma_request;/* DMA request line */ +int dma_request2;/* secondary DMA request line */ enum sdma_peripheral_type peripheral_type;int priority; };
Signature · 1 line
1.8.4
Nicolin Chen
reviewerPATCH v5 2/2 ASoC: fsl_asrc: Add ASRC ASoC CPU DAI and platform drivers
In reply to Nicolin ChenThe 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 DAI links such as ESAI<->CS42888 and SSI<->WM8962 and SAI. It converts the original sample rate to a common rate supported by Back Ends for playback while converts the common rate of Back Ends to a desired rate for capture. It has 3 pairs to support three different substreams within totally 10 channels.
--- .../devicetree/bindings/sound/fsl,asrc.txt | 60 ++ sound/soc/fsl/Kconfig | 9 + sound/soc/fsl/Makefile | 2 + sound/soc/fsl/fsl_asrc.c | 992 +++++++++++++++++++++ sound/soc/fsl/fsl_asrc.h | 461 ++++++++++ sound/soc/fsl/fsl_asrc_dma.c | 386 ++++++++ 6 files changed, 1910 insertions(+) create mode 100644 Documentation/devicetree/bindings/sound/fsl,asrc.txt create mode 100644 sound/soc/fsl/fsl_asrc.c create mode 100644 sound/soc/fsl/fsl_asrc.h create mode 100644 sound/soc/fsl/fsl_asrc_dma.c
Documentation/devicetree/bindings/sound/fsl,asrc.txt new file +60 -0
@@ -0,0 +1,60 @@ +Freescale 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 three pairs to support +three substreams within totally 10 channels. + +Required properties: + + - compatible : Contains "fsl,imx35-asrc" or "fsl,imx53-asrc". + + - reg : Offset and length of the register set for the device. + + - interrupts : Contains the spdif interrupt. + + - dmas : Generic dma devicetree binding as described in + Documentation/devicetree/bindings/dma/dma.txt. + + - dma-names : Contains "rxa", "rxb", "rxc", "txa", "txb" and "txc". + + - clocks : Contains an entry for each entry in clock-names. + + - clock-names : Contains the following entries + "mem" Peripheral access clock to access registers. + "ipg" Peripheral clock to driver module. + "asrck_<0-f>" Clock sources for input and output clock. + + - big-endian : If this property is absent, the native endian mode + will be in use as default, or the big endian mode + will be in use for all the device registers. + + - 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: + +asrc: asrc@02034000 { + compatible = "fsl,imx53-asrc"; + reg = <0x02034000 0x4000>; + interrupts = <0 50 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&clks 107>, <&clks 107>, <&clks 0>, + <&clks 0>, <&clks 0>, <&clks 0>, <&clks 0>, + <&clks 0>, <&clks 0>, <&clks 0>, <&clks 0>, + <&clks 0>, <&clks 0>, <&clks 0>, <&clks 0>, + <&clks 107>, <&clks 0>, <&clks 0>; + clock-names = "mem", "ipg", "asrck0", + "asrck_1", "asrck_2", "asrck_3", "asrck_4", + "asrck_5", "asrck_6", "asrck_7", "asrck_8", + "asrck_9", "asrck_a", "asrck_b", "asrck_c", + "asrck_d", "asrck_e", "asrck_f"; + dmas = <&sdma 17 23 1>, <&sdma 18 23 1>, <&sdma 19 23 1>, + <&sdma 20 23 1>, <&sdma 21 23 1>, <&sdma 22 23 1>; + dma-names = "rxa", "rxb", "rxc", + "txa", "txb", "txc"; + fsl,asrc-rate = <48000>; + fsl,asrc-width = <16>; + status = "okay"; +};
sound/soc/fsl/Kconfig +9 -0
@@ -2,6 +2,15 @@ menu "SoC Audio for Freescale CPUs" comment "Common SoC Audio options for Freescale CPUs:" +config SND_SOC_FSL_ASRC + tristate "Asynchronous Sample Rate Converter (ASRC) module support" + select REGMAP_MMIO + help + Say Y if you want to add Asynchronous Sample Rate Converter (ASRC) + support for the Freescale CPUs. + This option is only useful for out-of-tree drivers since + in-tree drivers select it automatically. + config SND_SOC_FSL_SAI tristate "Synchronous Audio Interface (SAI) module support" select REGMAP_MMIO
sound/soc/fsl/Makefile +2 -0
@@ -11,6 +11,7 @@ snd-soc-p1022-rdk-objs := p1022_rdk.o obj-$(CONFIG_SND_SOC_P1022_RDK) += snd-soc-p1022-rdk.o # Freescale SSI/DMA/SAI/SPDIF Support +snd-soc-fsl-asrc-objs := fsl_asrc.o fsl_asrc_dma.o snd-soc-fsl-sai-objs := fsl_sai.o snd-soc-fsl-ssi-y := fsl_ssi.o snd-soc-fsl-ssi-$(CONFIG_DEBUG_FS) += fsl_ssi_dbg.o
@@ -18,6 +19,7 @@ snd-soc-fsl-spdif-objs := fsl_spdif.o snd-soc-fsl-esai-objs := fsl_esai.o snd-soc-fsl-utils-objs := fsl_utils.o snd-soc-fsl-dma-objs := fsl_dma.o +obj-$(CONFIG_SND_SOC_FSL_ASRC) += snd-soc-fsl-asrc.o obj-$(CONFIG_SND_SOC_FSL_SAI) += snd-soc-fsl-sai.o obj-$(CONFIG_SND_SOC_FSL_SSI) += snd-soc-fsl-ssi.o obj-$(CONFIG_SND_SOC_FSL_SPDIF) += snd-soc-fsl-spdif.o
sound/soc/fsl/fsl_asrc.c new file +992 -0
992 lines not on this page · raw message
sound/soc/fsl/fsl_asrc.h new file +461 -0
461 lines not on this page · raw message
sound/soc/fsl/fsl_asrc_dma.c new file +386 -0
386 lines not on this page · raw message
Signature · 1 line
1.8.4
Re: [PATCH v5 2/2] ASoC: fsl_asrc: Add ASRC ASoC CPU DAI and platform drivers
Quoted 17 lines · Nicolin Chen
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 DAI links such as ESAI<->CS42888 and SSI<->WM8962 and SAI. It converts the original sample rate to a common rate supported by Back Ends for playback while converts the common rate of Back Ends to a desired rate for capture. It has 3 pairs to support three different substreams within totally 10 channels.
Signed-off-by Nicolin Chen <[email protected]>--- .../devicetree/bindings/sound/fsl,asrc.txt | 60 ++ sound/soc/fsl/Kconfig | 9 + sound/soc/fsl/Makefile | 2 + sound/soc/fsl/fsl_asrc.c | 992 +++++++++++++++++++++ sound/soc/fsl/fsl_asrc.h | 461 ++++++++++ sound/soc/fsl/fsl_asrc_dma.c | 386 ++++++++ 6 files changed, 1910 insertions(+)
Quoted 6 lines
create mode 100644
Documentation/devicetree/bindings/sound/fsl,asrc.txtcreate mode 100644sound/soc/fsl/fsl_asrc.c
create mode 100644sound/soc/fsl/fsl_asrc.h
create mode 100644sound/soc/fsl/fsl_asrc_dma.c
check patch warnings on this patch...
Signature · 7 lines
Regards, Varka Bhadram. -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v5 2/2] ASoC: fsl_asrc: Add ASRC ASoC CPU DAI and platform drivers
Hi Varka,
Quoted 24 lines · Varka Bhadram
Quoted 9 lines · Nicolin Chen
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 DAI links such as ESAI<->CS42888 and SSI<->WM8962 and SAI. It converts the original sample rate to a common rate supported by Back Ends for playback while converts the common rate of Back Ends to a desired rate for capture. It has 3 pairs to support three different substreams within totally 10 channels.
Signed-off-by Nicolin Chen <[email protected]>Quoted 14 lines
--- .../devicetree/bindings/sound/fsl,asrc.txt | 60 ++ sound/soc/fsl/Kconfig | 9 + sound/soc/fsl/Makefile | 2 + sound/soc/fsl/fsl_asrc.c | 992 +++++++++++++++++++++ sound/soc/fsl/fsl_asrc.h | 461 ++++++++++ sound/soc/fsl/fsl_asrc_dma.c | 386 ++++++++ 6 files changed, 1910 insertions(+) create mode 100644 Documentation/devicetree/bindings/sound/fsl,asrc.txt create mode 100644 sound/soc/fsl/fsl_asrc.c create mode 100644 sound/soc/fsl/fsl_asrc.h create mode 100644 sound/soc/fsl/fsl_asrc_dma.c
Quoted 1 line
check patch warnings on this patch...
[...]
./scripts/checkpatch.pl --max-line-length=128 0002-ASoC-fsl_a....patch
total: 0 errors, 0 warnings, 1928 lines checked
0002-ASoC....patch has no obvious style problems and is ready for submission
[...]
I think there's no need to be so strict by wrapping all lines inside 80 characters, especially for those that will be less readable if being wrapped and for those in header file.
Thank you
Nicolin
Re: [PATCH v5 2/2] ASoC: fsl_asrc: Add ASRC ASoC CPU DAI and platform drivers
Quoted 33 lines · Nicolin Chen
Hi Varka,
Quoted 24 lines · Varka Bhadram
Quoted 17 lines · Nicolin Chen
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 DAI links such as ESAI<->CS42888 and SSI<->WM8962 and SAI. It converts the original sample rate to a common rate supported by Back Ends for playback while converts the common rate of Back Ends to a desired rate for capture. It has 3 pairs to support three different substreams within totally 10 channels.
Signed-off-by Nicolin Chen <[email protected]>--- .../devicetree/bindings/sound/fsl,asrc.txt | 60 ++ sound/soc/fsl/Kconfig | 9 + sound/soc/fsl/Makefile | 2 + sound/soc/fsl/fsl_asrc.c | 992 +++++++++++++++++++++ sound/soc/fsl/fsl_asrc.h | 461 ++++++++++ sound/soc/fsl/fsl_asrc_dma.c | 386 ++++++++ 6 files changed, 1910 insertions(+)Quoted 6 lines
create mode 100644
Documentation/devicetree/bindings/sound/fsl,asrc.txtcreate mode 100644sound/soc/fsl/fsl_asrc.c
create mode 100644sound/soc/fsl/fsl_asrc.h
create mode 100644sound/soc/fsl/fsl_asrc_dma.cQuoted 1 line
check patch warnings on this patch...
[...]
./scripts/checkpatch.pl--max-line-length=128 0002-ASoC-fsl_a....patch
total: 0 errors, 0 warnings, 1928 lines checked
Quoted 9 lines
0002-ASoC....patch has no obvious style problems and is ready for submission
[...]
I think there's no need to be so strict by wrapping all lines inside 80 characters, especially for those that will be less readable if being wrapped and for those in header file.
Ohhh .. If this is the case, patch addressed all of comments... Thanks..
/Reviewed-by: Varka Bhadram <[email protected]>/
Signature · 2 lines
Regards, Varka Bhadram.