ASoC: meson: add axg spdif input support
Subsystems (5)
Jerome Brunet
maintainercover ASoC: meson: add axg spdif input support
This patchset adds the initial support the spdif input found on the axg SoC family.
The capture itself works well but the rate detection could be enhanced in the future.
Like several other drivers of this type, no check is done to verify if the rate of the input stream is consistent with the rate requested in hw_params()
The automatic rate detection mechanism of this device and the related IRQ proved difficult to work with, as documented in the driver. Several approaches to work around this minor issue have been tried but none provided a complete and reliable solution so far. Hopefully more eyes on this will help figure this out.
Since I authored all Amlogic ASoC drivers (and the related bugs) merged so far, I have added myself as maintainer of them in the last patch of this series.
Jerome Brunet (4):
ASoC: meson: axg-toddr: add support for spdifin backend
ASoC: meson: add axg spdif input DT binding documentation
ASoC: meson: add axg spdif input
MAINTAINERS: Add Amlogic sound drivers entry
.../bindings/sound/amlogic,axg-spdifin.txt | 22 + MAINTAINERS | 7 + sound/soc/meson/Kconfig | 9 +- sound/soc/meson/Makefile | 2 + sound/soc/meson/axg-fifo.h | 3 +- sound/soc/meson/axg-spdifin.c | 521 ++++++++++++++++++ sound/soc/meson/axg-toddr.c | 15 +- 7 files changed, 567 insertions(+), 12 deletions(-) create mode 100644 Documentation/devicetree/bindings/sound/amlogic,axg-spdifin.txt create mode 100644 sound/soc/meson/axg-spdifin.c
Signature · 1 line
2.19.2
Jerome Brunet
maintainerPATCH 1/4 ASoC: meson: axg-toddr: add support for spdifin backend
add IEC958_SUBFRAME_LE to the list of format accepted by the fifo frontend.
As opposed to what was initially noted in the toddr dai driver, the spdifin does not place the msb at bit 28, it just output a whole spdif subframe.
Placing the msb at bit 28 in the toddr driver just filters out the parity, user, channel status and validity bits. It is better to just provide the whole spdif subframe to the userspace and let the iec958 plugin deal with it.
--- sound/soc/meson/axg-fifo.h | 3 ++- sound/soc/meson/axg-toddr.c | 15 +++++---------- 2 files changed, 7 insertions(+), 11 deletions(-)
sound/soc/meson/axg-fifo.h +2 -1
@@ -25,7 +25,8 @@ struct snd_soc_pcm_runtime; SNDRV_PCM_FMTBIT_S16_LE | \ SNDRV_PCM_FMTBIT_S20_LE | \ SNDRV_PCM_FMTBIT_S24_LE | \ - SNDRV_PCM_FMTBIT_S32_LE) + SNDRV_PCM_FMTBIT_S32_LE | \ + SNDRV_PCM_FMTBIT_IEC958_SUBFRAME_LE)#define AXG_FIFO_BURST 8#define AXG_FIFO_MIN_CNT 64
sound/soc/meson/axg-toddr.c +5 -10
@@ -25,6 +25,8 @@#define CTRL0_TODDR_LSB_POS_MASK GENMASK(7, 3)#define CTRL0_TODDR_LSB_POS (x) ((x) << 3) +#define TODDR_MSB_POS 31 +static int axg_toddr_pcm_new (struct snd_soc_pcm_runtime *rtd,struct snd_soc_dai *dai) {
@@ -36,14 +38,7 @@ static int axg_toddr_dai_hw_params(struct snd_pcm_substream *substream, struct snd_soc_dai *dai) {struct axg_fifo *fifo =snd_soc_dai_get_drvdata (dai); -unsigned int type, width, msb =31 ; - -/* -* NOTE: -* Almost all backend will place the MSB at bit 31, except SPDIF Input -* which will put it at index 28. When adding support for the SPDIF -* Input, we'll need to find which type of backend we are connected to. -*/ +unsigned int type, width;switch (params_physical_width (params)) {case 8 :
@@ -66,8 +61,8 @@ static int axg_toddr_dai_hw_params(struct snd_pcm_substream *substream,CTRL0_TODDR_MSB_POS_MASK |CTRL0_TODDR_LSB_POS_MASK ,CTRL0_TODDR_TYPE (type) | -CTRL0_TODDR_MSB_POS (msb) | - CTRL0_TODDR_LSB_POS(msb - (width - 1))); +CTRL0_TODDR_MSB_POS (TODDR_MSB_POS ) | + CTRL0_TODDR_LSB_POS(TODDR_MSB_POS - (width - 1)));return 0 ; }
Signature · 1 line
2.19.2
Jerome Brunet
maintainerPATCH 2/4 ASoC: meson: add axg spdif input DT binding documentation
In reply to Jerome BrunetAdd the DT binding documentation for axg's SPDIF input.
--- .../bindings/sound/amlogic,axg-spdifin.txt | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 Documentation/devicetree/bindings/sound/amlogic,axg-spdifin.txt
Documentation/devicetree/bindings/sound/amlogic,axg-spdifin.txt new file +22 -0
@@ -0,0 +1,22 @@ +* Amlogic Audio SPDIF Input + +Required properties: +- compatible: 'amlogic,axg-spdifin' +- interrupts: interrupt specifier for the spdif input. +- clocks: list of clock phandle, one for each entry clock-names. +- clock-names: should contain the following: + * "pclk" : peripheral clock. + * "refclk" : spdif input reference clock +- #sound-dai-cells: must be 0. + +Example on the A113 SoC: + +spdifin: audio-controller@400 { + compatible = "amlogic,axg-spdifin"; + reg = <0x0 0x400 0x0 0x30>; + #sound-dai-cells = <0>; + interrupts = <GIC_SPI 87 IRQ_TYPE_EDGE_RISING>; + clocks = <&clkc_audio AUD_CLKID_SPDIFIN>, + <&clkc_audio AUD_CLKID_SPDIFIN_CLK>; + clock-names = "pclk", "refclk"; +};
Signature · 1 line
2.19.2
Jerome Brunet
maintainerPATCH 3/4 ASoC: meson: add axg spdif input
In reply to Jerome BrunetAdd support for the spdif input decoder of the axg SoC family
--- sound/soc/meson/Kconfig | 9 +- sound/soc/meson/Makefile | 2 + sound/soc/meson/axg-spdifin.c | 521 ++++++++++++++++++++++++++++++++++ 3 files changed, 531 insertions(+), 1 deletion(-) create mode 100644 sound/soc/meson/axg-spdifin.c
sound/soc/meson/Kconfig +8 -1
@@ -54,6 +54,7 @@ config SND_MESON_AXG_SOUND_CARD imply SND_MESON_AXG_TDMIN imply SND_MESON_AXG_TDMOUT imply SND_MESON_AXG_SPDIFOUT + imply SND_MESON_AXG_SPDIFIN imply SND_MESON_AXG_PDM help Select Y or M to add support for the AXG SoC sound card
@@ -67,6 +68,13 @@ config SND_MESON_AXG_SPDIFOUT Select Y or M to add support for SPDIF output serializer embedded in the Amlogic AXG SoC family +config SND_MESON_AXG_SPDIFIN + tristate "Amlogic AXG SPDIF Input Support" + imply SND_SOC_SPDIF + help + Select Y or M to add support for SPDIF input embedded + in the Amlogic AXG SoC family + config SND_MESON_AXG_PDM tristate "Amlogic AXG PDM Input Support" imply SND_SOC_DMIC
@@ -74,5 +82,4 @@ config SND_MESON_AXG_PDM help Select Y or M to add support for PDM input embedded in the Amlogic AXG SoC family - endmenu
sound/soc/meson/Makefile +2 -0
@@ -8,6 +8,7 @@ snd-soc-meson-axg-tdm-interface-objs := axg-tdm-interface.o snd-soc-meson-axg-tdmin-objs := axg-tdmin.o snd-soc-meson-axg-tdmout-objs := axg-tdmout.o snd-soc-meson-axg-sound-card-objs := axg-card.o +snd-soc-meson-axg-spdifin-objs := axg-spdifin.o snd-soc-meson-axg-spdifout-objs := axg-spdifout.o snd-soc-meson-axg-pdm-objs := axg-pdm.o
@@ -19,5 +20,6 @@ obj-$(CONFIG_SND_MESON_AXG_TDM_INTERFACE) += snd-soc-meson-axg-tdm-interface.o obj-$(CONFIG_SND_MESON_AXG_TDMIN) += snd-soc-meson-axg-tdmin.o obj-$(CONFIG_SND_MESON_AXG_TDMOUT) += snd-soc-meson-axg-tdmout.o obj-$(CONFIG_SND_MESON_AXG_SOUND_CARD) += snd-soc-meson-axg-sound-card.o +obj-$(CONFIG_SND_MESON_AXG_SPDIFIN) += snd-soc-meson-axg-spdifin.o obj-$(CONFIG_SND_MESON_AXG_SPDIFOUT) += snd-soc-meson-axg-spdifout.o obj-$(CONFIG_SND_MESON_AXG_PDM) += snd-soc-meson-axg-pdm.o
sound/soc/meson/axg-spdifin.c new file +521 -0
521 lines not on this page · raw message
Signature · 1 line
2.19.2
Jerome Brunet
maintainerPATCH 4/4 MAINTAINERS: Add Amlogic sound drivers entry
In reply to Jerome BrunetAdd sound/soc/meson drivers entry for Amlogic audio drivers.
--- MAINTAINERS | 7 +++++++ 1 file changed, 7 insertions(+)
MAINTAINERS +7 -0
@@ -1310,6 +1310,13 @@ F: drivers/pinctrl/meson/ F: drivers/mmc/host/meson* N: meson +ARM/Amlogic Meson SoC Sound Drivers +M: Jerome Brunet <[email protected]> +L: [email protected] (moderated for non-subscribers) +S: Maintained +F: sound/soc/meson/ +F: Documentation/devicetree/bindings/sound/amlogic* + ARM/Annapurna Labs ALPINE ARCHITECTURE M: Tsahee Zidenberg <[email protected]> M: Antoine Tenart <[email protected]>
Signature · 1 line
2.19.2
Mark Brown
maintainerApplied "MAINTAINERS: Add Amlogic sound drivers entry" to the asoc tree
The patch
MAINTAINERS: Add Amlogic sound drivers entry
has been applied to the asoc tree at
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark
Quoted 1 line
From
1b46ed96961db1a826b3e5cadac18c7c4857f054Mon Sep 17 00:00:00 2001
From: Jerome Brunet <[email protected]>
Date: Tue, 11 Dec 2018 14:47:13 +0100
Subject: [PATCH] MAINTAINERS: Add Amlogic sound drivers entry
Add sound/soc/meson drivers entry for Amlogic audio drivers.
--- MAINTAINERS | 7 +++++++ 1 file changed, 7 insertions(+)
MAINTAINERS +7 -0
@@ -1309,6 +1309,13 @@ F: drivers/pinctrl/meson/ F: drivers/mmc/host/meson* N: meson +ARM/Amlogic Meson SoC Sound Drivers +M: Jerome Brunet <[email protected]> +L: [email protected] (moderated for non-subscribers) +S: Maintained +F: sound/soc/meson/ +F: Documentation/devicetree/bindings/sound/amlogic* + ARM/Annapurna Labs ALPINE ARCHITECTURE M: Tsahee Zidenberg <[email protected]> M: Antoine Tenart <[email protected]>
Signature · 1 line
2.19.0.rc2
Mark Brown
maintainerApplied "ASoC: meson: add axg spdif input" to the asoc tree
In reply to Jerome BrunetThe patch
ASoC: meson: add axg spdif input
has been applied to the asoc tree at
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark
Quoted 1 line
From
5ce5658375e6de2468c4884f7ae474c4ed40a13fMon Sep 17 00:00:00 2001
From: Jerome Brunet <[email protected]>
Date: Tue, 11 Dec 2018 14:47:12 +0100
Subject: [PATCH] ASoC: meson: add axg spdif input
Add support for the spdif input decoder of the axg SoC family
--- sound/soc/meson/Kconfig | 9 +- sound/soc/meson/Makefile | 2 + sound/soc/meson/axg-spdifin.c | 521 ++++++++++++++++++++++++++++++++++ 3 files changed, 531 insertions(+), 1 deletion(-) create mode 100644 sound/soc/meson/axg-spdifin.c
sound/soc/meson/Kconfig +8 -1
@@ -54,6 +54,7 @@ config SND_MESON_AXG_SOUND_CARD imply SND_MESON_AXG_TDMIN imply SND_MESON_AXG_TDMOUT imply SND_MESON_AXG_SPDIFOUT + imply SND_MESON_AXG_SPDIFIN imply SND_MESON_AXG_PDM help Select Y or M to add support for the AXG SoC sound card
@@ -67,6 +68,13 @@ config SND_MESON_AXG_SPDIFOUT Select Y or M to add support for SPDIF output serializer embedded in the Amlogic AXG SoC family +config SND_MESON_AXG_SPDIFIN + tristate "Amlogic AXG SPDIF Input Support" + imply SND_SOC_SPDIF + help + Select Y or M to add support for SPDIF input embedded + in the Amlogic AXG SoC family + config SND_MESON_AXG_PDM tristate "Amlogic AXG PDM Input Support" imply SND_SOC_DMIC
@@ -74,5 +82,4 @@ config SND_MESON_AXG_PDM help Select Y or M to add support for PDM input embedded in the Amlogic AXG SoC family - endmenu
sound/soc/meson/Makefile +2 -0
@@ -8,6 +8,7 @@ snd-soc-meson-axg-tdm-interface-objs := axg-tdm-interface.o snd-soc-meson-axg-tdmin-objs := axg-tdmin.o snd-soc-meson-axg-tdmout-objs := axg-tdmout.o snd-soc-meson-axg-sound-card-objs := axg-card.o +snd-soc-meson-axg-spdifin-objs := axg-spdifin.o snd-soc-meson-axg-spdifout-objs := axg-spdifout.o snd-soc-meson-axg-pdm-objs := axg-pdm.o
@@ -19,5 +20,6 @@ obj-$(CONFIG_SND_MESON_AXG_TDM_INTERFACE) += snd-soc-meson-axg-tdm-interface.o obj-$(CONFIG_SND_MESON_AXG_TDMIN) += snd-soc-meson-axg-tdmin.o obj-$(CONFIG_SND_MESON_AXG_TDMOUT) += snd-soc-meson-axg-tdmout.o obj-$(CONFIG_SND_MESON_AXG_SOUND_CARD) += snd-soc-meson-axg-sound-card.o +obj-$(CONFIG_SND_MESON_AXG_SPDIFIN) += snd-soc-meson-axg-spdifin.o obj-$(CONFIG_SND_MESON_AXG_SPDIFOUT) += snd-soc-meson-axg-spdifout.o obj-$(CONFIG_SND_MESON_AXG_PDM) += snd-soc-meson-axg-pdm.o
sound/soc/meson/axg-spdifin.c new file +521 -0
521 lines not on this page · raw message
Signature · 1 line
2.19.0.rc2
Mark Brown
maintainerApplied "ASoC: meson: add axg spdif input DT binding documentation" to the asoc tree
In reply to Jerome BrunetThe patch
ASoC: meson: add axg spdif input DT binding documentation
has been applied to the asoc tree at
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark
Quoted 1 line
From
18dc4665fb6f3bb617c2e6d7da3f19586d06ab17Mon Sep 17 00:00:00 2001
From: Jerome Brunet <[email protected]>
Date: Tue, 11 Dec 2018 14:47:11 +0100
Subject: [PATCH] ASoC: meson: add axg spdif input DT binding documentation
Add the DT binding documentation for axg's SPDIF input.
--- .../bindings/sound/amlogic,axg-spdifin.txt | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 Documentation/devicetree/bindings/sound/amlogic,axg-spdifin.txt
Documentation/devicetree/bindings/sound/amlogic,axg-spdifin.txt new file +22 -0
@@ -0,0 +1,22 @@ +* Amlogic Audio SPDIF Input + +Required properties: +- compatible: 'amlogic,axg-spdifin' +- interrupts: interrupt specifier for the spdif input. +- clocks: list of clock phandle, one for each entry clock-names. +- clock-names: should contain the following: + * "pclk" : peripheral clock. + * "refclk" : spdif input reference clock +- #sound-dai-cells: must be 0. + +Example on the A113 SoC: + +spdifin: audio-controller@400 { + compatible = "amlogic,axg-spdifin"; + reg = <0x0 0x400 0x0 0x30>; + #sound-dai-cells = <0>; + interrupts = <GIC_SPI 87 IRQ_TYPE_EDGE_RISING>; + clocks = <&clkc_audio AUD_CLKID_SPDIFIN>, + <&clkc_audio AUD_CLKID_SPDIFIN_CLK>; + clock-names = "pclk", "refclk"; +};
Signature · 1 line
2.19.0.rc2
Mark Brown
maintainerApplied "ASoC: meson: axg-toddr: add support for spdifin backend" to the asoc tree
In reply to Jerome BrunetThe patch
ASoC: meson: axg-toddr: add support for spdifin backend
has been applied to the asoc tree at
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark
Quoted 1 line
From
984463a94d5cb23120bfe7d689077b940c25128bMon Sep 17 00:00:00 2001
From: Jerome Brunet <[email protected]>
Date: Tue, 11 Dec 2018 14:47:10 +0100
Subject: [PATCH] ASoC: meson: axg-toddr: add support for spdifin backend
add IEC958_SUBFRAME_LE to the list of format accepted by the fifo frontend.
As opposed to what was initially noted in the toddr dai driver, the spdifin does not place the msb at bit 28, it just output a whole spdif subframe.
Placing the msb at bit 28 in the toddr driver just filters out the parity, user, channel status and validity bits. It is better to just provide the whole spdif subframe to the userspace and let the iec958 plugin deal with it.
--- sound/soc/meson/axg-fifo.h | 3 ++- sound/soc/meson/axg-toddr.c | 15 +++++---------- 2 files changed, 7 insertions(+), 11 deletions(-)
sound/soc/meson/axg-fifo.h +2 -1
@@ -25,7 +25,8 @@ struct snd_soc_pcm_runtime; SNDRV_PCM_FMTBIT_S16_LE | \ SNDRV_PCM_FMTBIT_S20_LE | \ SNDRV_PCM_FMTBIT_S24_LE | \ - SNDRV_PCM_FMTBIT_S32_LE) + SNDRV_PCM_FMTBIT_S32_LE | \ + SNDRV_PCM_FMTBIT_IEC958_SUBFRAME_LE)#define AXG_FIFO_BURST 8#define AXG_FIFO_MIN_CNT 64
sound/soc/meson/axg-toddr.c +5 -10
@@ -25,6 +25,8 @@#define CTRL0_TODDR_LSB_POS_MASK GENMASK(7, 3)#define CTRL0_TODDR_LSB_POS (x) ((x) << 3) +#define TODDR_MSB_POS 31 +static int axg_toddr_pcm_new (struct snd_soc_pcm_runtime *rtd,struct snd_soc_dai *dai) {
@@ -36,14 +38,7 @@ static int axg_toddr_dai_hw_params(struct snd_pcm_substream *substream, struct snd_soc_dai *dai) {struct axg_fifo *fifo =snd_soc_dai_get_drvdata (dai); -unsigned int type, width, msb =31 ; - -/* -* NOTE: -* Almost all backend will place the MSB at bit 31, except SPDIF Input -* which will put it at index 28. When adding support for the SPDIF -* Input, we'll need to find which type of backend we are connected to. -*/ +unsigned int type, width;switch (params_physical_width (params)) {case 8 :
@@ -66,8 +61,8 @@ static int axg_toddr_dai_hw_params(struct snd_pcm_substream *substream,CTRL0_TODDR_MSB_POS_MASK |CTRL0_TODDR_LSB_POS_MASK ,CTRL0_TODDR_TYPE (type) | -CTRL0_TODDR_MSB_POS (msb) | - CTRL0_TODDR_LSB_POS(msb - (width - 1))); +CTRL0_TODDR_MSB_POS (TODDR_MSB_POS ) | + CTRL0_TODDR_LSB_POS(TODDR_MSB_POS - (width - 1)));return 0 ; }
Signature · 1 line
2.19.0.rc2