ALSA: Add SAI driver and enable SGT15000 codec
Subsystems (4)
v3 cover ALSA: Add SAI driver and enable SGT15000 codec
This patch series is mostly Freescale's SAI SoC Digital Audio Interface driver implementation. And the implementation is only compatible with device tree definition.
This patch series is based on linux-next and has been tested on Vybrid VF610 Tower board using device tree.
Changed in v3:
- Add big-endian mode support.
- Revise some commit comments, coding styles,etc.
- Keep header files ordered by alphabet,etc.
- Add MODULE_ALIAS("platform:fsl-sai") for SAI driver.
- Rename the files to be in a same pattern with the existed ones.
- Remove some not useful functions or code.
- Only enable the clock while the device is in active use.
- Revise one error message according to Bill.
Changed in v2:
- Use default settings for the generic dmaengine PCM driver.
- Separate receive and transmit setting in most functions, but some couldn't for the HW limitation.
- Drop some not reduntant code.
- Use devm_snd_soc_register_component() instead of snd_soc_register_component().
- Use devm_snd_soc_register_card() instead of devm_snd_soc_register_card().
- Adjust the code sentences sequence.
- Make the namespacing consistent.
- Rename CONFIG_SND_SOC_FSL_SGTL5000 to CONFIG_SND_SOC_FSL_SGTL5000_VF610.
- Drop some meaningless lines.
- Rename the binding document file.
Added in v1:
- Add SAI SoC Digital Audio Interface driver.
- Add Freescale SAI ALSA SoC Digital Audio Interface node for VF610.
- Enables SAI ALSA SoC DAI device for Vybrid VF610 TOWER board.
- Add device tree bindings for Freescale SAI.
- Revise the bugs about the sgt15000 codec.
- Add SGT15000 based audio machine driver.
- Enable SGT15000 codec based audio driver node for VF610.
- Add device tree bindings for Freescale VF610 sound.
PATCH v3 1/7 ALSA: Add SAI SoC Digital Audio Interface driver.
Fix the description of one comment.
This adds Freescale SAI ASoC Audio support.
This implementation is only compatible with device tree definition. Features:
o Supports playback/capture
o Supports 16/20/24 bit PCM
o Supports 8k - 96k sample rates
o Supports master and slave mode.
--- sound/soc/fsl/Kconfig | 4 + sound/soc/fsl/Makefile | 4 +- sound/soc/fsl/fsl_sai.c | 492 ++++++++++++++++++++++++++++++++++++++++++++++++ sound/soc/fsl/fsl_sai.h | 114 +++++++++++ 4 files changed, 613 insertions(+), 1 deletion(-) create mode 100644 sound/soc/fsl/fsl_sai.c create mode 100644 sound/soc/fsl/fsl_sai.h
sound/soc/fsl/Kconfig +4 -0
@@ -1,3 +1,7 @@ +config SND_SOC_FSL_SAI + tristate + select SND_SOC_GENERIC_DMAENGINE_PCM + config SND_SOC_FSL_SSI tristate
sound/soc/fsl/Makefile +3 -1
@@ -10,11 +10,13 @@ obj-$(CONFIG_SND_SOC_P1022_DS) += snd-soc-p1022-ds.o snd-soc-p1022-rdk-objs := p1022_rdk.o obj-$(CONFIG_SND_SOC_P1022_RDK) += snd-soc-p1022-rdk.o -# Freescale PowerPC SSI/DMA Platform Support +# Freescale SSI/DMA/SAI/SPDIF Support +snd-soc-fsl-sai-objs := fsl_sai.o snd-soc-fsl-ssi-objs := fsl_ssi.o snd-soc-fsl-spdif-objs := fsl_spdif.o snd-soc-fsl-utils-objs := fsl_utils.o snd-soc-fsl-dma-objs := fsl_dma.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 obj-$(CONFIG_SND_SOC_FSL_UTILS) += snd-soc-fsl-utils.o
sound/soc/fsl/fsl_sai.c new file +492 -0
492 lines not on this page · raw message
sound/soc/fsl/fsl_sai.h new file +114 -0
114 lines not on this page · raw message
Signature · 1 line
1.8.4
Mark Brown
maintainerRe: [PATCHv3 1/7] ALSA: Add SAI SoC Digital Audio Interface driver.
Quoted 2 lines · Xiubo Li
This adds Freescale SAI ASoC Audio support.
This implementation is only compatible with device tree definition.
This is mostly good, there are two small issues below but I've applied it since they don't really affect the driver as a whole. Please send followup patches to fix the issues below.
sound/soc/fsl/fsl_sai.c line 381
Quoted 6 lines
sound/soc/fsl/fsl_sai.c new file +6
-0+static int fsl_sai_dai_probe (struct snd_soc_dai *cpu_dai) +{ +struct fsl_sai *sai =dev_get_drvdata (cpu_dai->dev); + + cpu_dai->playback_dma_data = &sai->dma_params_tx; + cpu_dai->capture_dma_data = &sai->dma_params_rx;
You should use snd_soc_dai_init_dma_data() for this.
sound/soc/fsl/fsl_sai.c line 396
Quoted 9 lines
sound/soc/fsl/fsl_sai.c new file +9
-0+static int fsl_sai_dai_remove (struct snd_soc_dai *cpu_dai) +{ + cpu_dai->playback_dma_data =NULL ; + cpu_dai->capture_dma_data =NULL ; + +snd_soc_dai_set_drvdata (cpu_dai,NULL ); + +return 0 ; +}
This is all unneeded and this function should be removed entirely.
Re: [PATCHv3 1/7] ALSA: Add SAI SoC Digital Audio Interface driver.
Quoted 9 lines · Xiubo Li
Quoted 3 lines
This adds Freescale SAI ASoC Audio support.
This implementation is only compatible with device tree definition.This is mostly good, there are two small issues below but I've applied it since they don't really affect the driver as a whole. Please send followup patches to fix the issues below.
Quoted 8 lines
sound/soc/fsl/fsl_sai.c line 381
Quoted 5 lines
sound/soc/fsl/fsl_sai.c new file +5
-0+static int fsl_sai_dai_probe (struct snd_soc_dai *cpu_dai) { +struct fsl_sai *sai =dev_get_drvdata (cpu_dai->dev); + + cpu_dai->playback_dma_data = &sai->dma_params_tx; + cpu_dai->capture_dma_data = &sai->dma_params_rx;You should use
snd_soc_dai_init_dma_data()for this.
Yes, I will use it.
Quoted 10 lines
sound/soc/fsl/fsl_sai.c line 396
Quoted 8 lines
sound/soc/fsl/fsl_sai.c new file +8
-0+static int fsl_sai_dai_remove (struct snd_soc_dai *cpu_dai) { + cpu_dai->playback_dma_data =NULL ; + cpu_dai->capture_dma_data =NULL ; + +snd_soc_dai_set_drvdata (cpu_dai,NULL ); + +return 0 ; +}This is all unneeded and this function should be removed entirely.
I will remove this and other unneeded functions like this.
Best Regards,
Xiubo
PATCH v3 2/7 ARM: dts: Add Freescale SAI ALSA SoC Digital Audio Interface node for VF610.
In reply to Xiubo LiThis patch adds the SAI's edma mux Tx and Rx support.
--- arch/arm/boot/dts/vf610.dtsi | 3 +++ 1 file changed, 3 insertions(+)
arch/arm/boot/dts/vf610.dtsi +3 -0
@@ -166,6 +166,9 @@ interrupts = <0 86 0x04>; clocks = <&clks VF610_CLK_SAI2>; clock-names = "sai"; + dma-names = "tx", "rx"; + dmas = <&edma0 0 VF610_EDMA_MUXID0_SAI2_TX>, + <&edma0 0 VF610_EDMA_MUXID0_SAI2_RX>; status = "disabled"; };
Signature · 7 lines
1.8.4 -- 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
PATCH v3 3/7 ARM: dts: Enable SAI ALSA SoC DAI device for Vybrid VF610 TOWER board.
In reply to Xiubo LiThis patch adds and enables the SAI device.
--- arch/arm/boot/dts/vf610-twr.dts | 6 ++++++ 1 file changed, 6 insertions(+)
arch/arm/boot/dts/vf610-twr.dts +6 -0
@@ -74,6 +74,12 @@ status = "okay"; }; +&sai2 { + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_sai2_1>; + status = "okay"; +}; + &uart1 { pinctrl-names = "default"; pinctrl-0 = <&pinctrl_uart1_1>;
Signature · 7 lines
1.8.4 -- 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
PATCH v3 4/7 Documentation: Add device tree bindings for Freescale SAI.
In reply to Xiubo LiThis adds the Document for Freescale SAI driver under Documentation/devicetree/bindings/sound/.
--- .../devicetree/bindings/sound/fsl-sai.txt | 40 ++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 Documentation/devicetree/bindings/sound/fsl-sai.txt
Documentation/devicetree/bindings/sound/fsl-sai.txt new file +40 -0
@@ -0,0 +1,40 @@ +Freescale Synchronous Audio Interface (SAI). + +The SAI is based on I2S module that used communicating with audio codecs, +which provides a synchronous audio interface that supports fullduplex +serial interfaces with frame synchronization such as I2S, AC97, TDM, and +codec/DSP interfaces. + + +Required properties: +- compatible: Compatible list, contains "fsl,vf610-sai". +- reg: Offset and length of the register set for the device. +- clocks: Must contain an entry for each entry in clock-names. +- clock-names : Must include the "sai" entry. +- dmas : Generic dma devicetree binding as described in + Documentation/devicetree/bindings/dma/dma.txt. +- dma-names : Two dmas have to be defined, "tx" and "rx". +- pinctrl-names: Must contain a "default" entry. +- pinctrl-NNN: One property must exist for each entry in pinctrl-names. + See ../pinctrl/pinctrl-bindings.txt for details of the property values. +- big-endian-regs: If this property is absent, the little endian mode will + be in use as default, or the big endian mode will be in use for all the + device registers. +- big-endian-data: If this property is absent, the little endian mode will + be in use as default, or the big endian mode will be in use for all the + fifo data. + +Example: +sai2: sai@40031000 { + compatible = "fsl,vf610-sai"; + reg = <0x40031000 0x1000>; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_sai2_1>; + clocks = <&clks VF610_CLK_SAI2>; + clock-names = "sai"; + dma-names = "tx", "rx"; + dmas = <&edma0 0 VF610_EDMA_MUXID0_SAI2_TX>, + <&edma0 0 VF610_EDMA_MUXID0_SAI2_RX>; + big-endian_regs; + big-endian_data; +};
Signature · 1 line
1.8.4
Re: [PATCHv3 4/7] Documentation: Add device tree bindings for Freescale SAI.
Documentation/devicetree/bindings/sound/fsl-sai.txt line 39
Quoted 2 lines · Xiubo Li
Documentation/devicetree/bindings/sound/fsl-sai.txt new file +2
-0+ big-endian_regs; + big-endian_data;
I've applied this and fixed these two typos, thanks.
Re: [PATCHv3 4/7] Documentation: Add device tree bindings for Freescale SAI.
Hi Mark,
Quoted 6 lines · Xiubo Li
Documentation/devicetree/bindings/sound/fsl-sai.txt line 39
Quoted 3 lines
Documentation/devicetree/bindings/sound/fsl-sai.txt new file +2
-0+ big-endian_regs; + big-endian_data;I've applied this and fixed these two typos, thanks.
There is something wrong with my mails these days.
I will revise this then.
Thanks very much,
Best Regards,
Xiubo
PATCH v3 5/7 ASoC: fsl: Add SGTL5000 based audio machine driver.
In reply to Xiubo LiThis is the SGTL5000 codec based audio driver supported with both playback and capture dai link implemention.
This implementation is only compatible with device tree definition.
--- sound/soc/fsl/Kconfig | 22 +++++ sound/soc/fsl/Makefile | 4 + sound/soc/fsl/vf610-sgtl5000.c | 178 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 204 insertions(+) create mode 100644 sound/soc/fsl/vf610-sgtl5000.c
sound/soc/fsl/Kconfig +22 -0
@@ -217,3 +217,25 @@ config SND_SOC_IMX_MC13783 select SND_SOC_IMX_PCM_DMA endif # SND_IMX_SOC + +menuconfig SND_FSL_SOC + tristate "SoC Audio for Freescale VF610 CPUs" + help + Say Y or M if you want to add support for codecs attached to + the VF610 CPUs. + + This will enable Freeacale SAI and SGTL5000 codec, and an extra + TWR-AUDIO-SGTL sub-board is needed for SGTL5000. + +if SND_FSL_SOC + +config SND_SOC_VF610_SGTL5000 + tristate "SoC Audio support for VF610 boards with SGTL5000" + depends on OF && I2C + select SND_SOC_FSL_SAI + select SND_SOC_SGTL5000 + help + Say Y if you want to add support for SoC audio on an VF610 board with + a SGTL5000 codec and a SAI. + +endif # SND_FSL_SOC
sound/soc/fsl/Makefile +4 -0
@@ -22,6 +22,10 @@ obj-$(CONFIG_SND_SOC_FSL_SPDIF) += snd-soc-fsl-spdif.o obj-$(CONFIG_SND_SOC_FSL_UTILS) += snd-soc-fsl-utils.o obj-$(CONFIG_SND_SOC_POWERPC_DMA) += snd-soc-fsl-dma.o +# VF610 Platform Support +snd-soc-vf610-sgtl5000-objs := vf610-sgtl5000.o +obj-$(CONFIG_SND_SOC_VF610_SGTL5000) += snd-soc-vf610-sgtl5000.o + # MPC5200 Platform Support obj-$(CONFIG_SND_MPC52xx_DMA) += mpc5200_dma.o obj-$(CONFIG_SND_SOC_MPC5200_I2S) += mpc5200_psc_i2s.o
sound/soc/fsl/vf610-sgtl5000.c new file +178 -0
178 lines not on this page · raw message
Signature · 1 line
1.8.4
Mark Brown
maintainerRe: [PATCHv3 5/7] ASoC: fsl: Add SGTL5000 based audio machine driver.
Quoted 4 lines · Xiubo Li
This is the SGTL5000 codec based audio driver supported with both playback and capture dai link implemention.
This implementation is only compatible with device tree definition.
It looks like these cards should be supportable using the generic simple card bindings that Morimoto-san implemented, you can see these in -next as "ASoC: simple-card: add Device Tree support". Can you check to see if that's the case? If it is you'll still need Kconfig to enable building the SoC and CODEC drivers.
sound/soc/fsl/Kconfig config SND_SOC_IMX_MC13783 · line 228
Quoted 8 lines
sound/soc/fsl/Kconfig +8
-0+menuconfig SND_FSL_SOC + tristate "SoC Audio for Freescale VF610 CPUs" + help + Say Y or M if you want to add support for codecs attached to + the VF610 CPUs. + + This will enable Freeacale SAI and SGTL5000 codec, and an extra + TWR-AUDIO-SGTL sub-board is needed for SGTL5000.
This should select the dmaengine helpers (and should really have been split out as part of the first patch).
Re: [PATCHv3 5/7] ASoC: fsl: Add SGTL5000 based audio machine driver.
Quoted 5 lines · Xiubo Li
Quoted 3 lines
This is the SGTL5000 codec based audio driver supported with both playback and capture dai link implemention.
Quoted 8 lines
Quoted 1 line
This implementation is only compatible with device tree definition.
It looks like these cards should be supportable using the generic simple card bindings that Morimoto-san implemented, you can see these in -next as "ASoC:
simple-card: add Device Tree support". Can you check to see if that's the case? If it is you'll still needKconfigto enable building the SoC and CODEC drivers.
Yes, almost, but maybe still need to do some adjust about it.
In this series of patches, the PATCH1~PATCH4 are about SAI only, and can be apart from VF610-twr sound driver, I will sent the SAI driver and VF610-twr sound driver separately. Could you apply the SAI's first if they are all fine?
I will use the simpe-card driver for the VF610-twr later.
Quoted 11 lines
sound/soc/fsl/Kconfig config SND_SOC_IMX_MC13783 · line 228
Quoted 8 lines
sound/soc/fsl/Kconfig +8
-0+menuconfig SND_FSL_SOC + tristate "SoC Audio for Freescale VF610 CPUs" + help + Say Y or M if you want to add support for codecs attached to + the VF610 CPUs. + + This will enable Freeacale SAI and SGTL5000 codec, and an extra + TWR-AUDIO-SGTL sub-board is needed for SGTL5000.This should select the dmaengine helpers (and should really have been split out as part of the first patch).
I will revise this.
Best Regards,
Xiubo
Mark Brown
maintainerRe: [PATCHv3 5/7] ASoC: fsl: Add SGTL5000 based audio machine driver.
Quoted 3 lines · On Thu, Dec 19, 2013 at 05:19:26AM +0000, [email protected] wrote:
In this series of patches, the PATCH1~PATCH4 are about SAI only, and can be apart from VF610-twr sound driver, I will sent the SAI driver and VF610-twr sound driver separately. Could you apply the SAI's first if they are all fine?
What are you asking me to apply here? I already applied your first patch as I said, is that not everything?
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Re: [PATCHv3 5/7] ASoC: fsl: Add SGTL5000 based audio machine driver.
Hi Mark,
Quoted 9 lines · Li.Xiubo at freescale.com
Quoted 4 lines
In this series of patches, the PATCH1~PATCH4 are about SAI only, and can be apart from VF610-twr sound driver, I will sent the SAI driver and VF610-twr sound driver separately. Could you apply the SAI's first if they are all
fine?
What are you asking me to apply here? I already applied your first patch as I said, is that not everything?
Sorry for understanding.
Please ignore the series of patches for v4.
I will send the followed patch to fix that issues you have pointed.
Thanks,
Best Regards,
Xiubo
PATCH v3 6/7 ARM: dts: Enable SGTL5000 codec based audio driver node for VF610 TOWER.
In reply to Xiubo LiThis patch adds and enables SGTL5000 codec support, and also specified the corresponding SAI node.
--- arch/arm/boot/dts/vf610-twr.dts | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+)
arch/arm/boot/dts/vf610-twr.dts +33 -0
@@ -34,6 +34,31 @@ }; }; + regulators { + compatible = "simple-bus"; + + reg_3p3v: 3p3v { + compatible = "regulator-fixed"; + regulator-name = "3P3V"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-always-on; + }; + }; + + sound { + compatible = "fsl,vf610-sgtl5000"; + model = "vf610-sgtl5000"; + saif-controller = <&sai2>; + audio-codec = <&codec>; + audio-routing = + "MIC_IN", "Mic Jack", + "Mic Jack", "Mic Bias", + "LINE_IN", "Line In Jack", + "Headphone Jack", "HP_OUT", + "Ext Spk", "LINE_OUT"; + }; + }; &dspi0 {
@@ -72,6 +97,14 @@ pinctrl-names = "default"; pinctrl-0 = <&pinctrl_i2c0_1>; status = "okay"; + + codec: sgtl5000@0a { + compatible = "fsl,sgtl5000"; + reg = <0x0a>; + VDDA-supply = <®_3p3v>; + VDDIO-supply = <®_3p3v>; + clocks = <&clks VF610_CLK_SAI2>; + }; }; &sai2 {
Signature · 1 line
1.8.4
PATCH v3 7/7 Documentation: Add device tree bindings for Freescale VF610 sound.
In reply to Xiubo LiThis adds the Document for Freescale VF610 sound driver under Documentation/devicetree/bindings/sound/.
--- .../bindings/sound/vf610-audio-sgt15000.txt | 46 ++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 Documentation/devicetree/bindings/sound/vf610-audio-sgt15000.txt
Documentation/devicetree/bindings/sound/vf610-audio-sgt15000.txt new file +46 -0
@@ -0,0 +1,46 @@ +Freescale VF610 audio complex with SGTL5000 codec + +Required properties: +- compatible: "fsl,vf610-sgtl5000" +- model: The user-visible name of this sound complex. +- saif-controllers: The phandle list of the SAI controller. +- audio-codec: The phandle of the SGTL5000 audio codec. +- audio-routing : A list of the connections between audio components. + Each entry is a pair of strings, the first being the connection's sink, + the second being the connection's source. Valid names could be power + supplies, SGTL5000 pins, and the jacks on the board: + + -- Power supplies: + * Mic Bias + + -- Board connectors: + * Mic Jack + * Line In Jack + * Headphone Jack + * Line Out Jack + * Ext Spk + +Example: + +sound { + compatible = "fsl,vf610-sgtl5000"; + model = "vf610-sgtl5000"; + saif-controller = <&sai2>; + audio-codec = <&codec>; + audio-routing = + "MIC_IN", "Mic Jack", + "Mic Jack", "Mic Bias", + "LINE_IN", "Line In Jack", + "Headphone Jack", "HP_OUT", + "Ext Spk", "LINE_OUT"; +}; + +&i2c0 { + ... + + codec: sgtl5000@0a { + compatible = "fsl,sgtl5000"; + reg = <0x0a>; + clocks = <&clks VF610_CLK_SAI2>; + }; +};
Signature · 1 line
1.8.4