Skip to contentSkip to conversation

ASoC: add CSR SiRFSoC sound drivers

PATCH Applied RongJun Ying 2 participants 20 messages Mar 5, 2014 – Mar 12, 2014

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover ASoC: add CSR SiRFSoC sound drivers

From: Rongjun Ying <[email protected]>

This patchset adds CSR SiRFSoC sound drivers including:
1. The SiRF internal audio codec driver
2. The SiRF audio port driver
3. The SiRF internal audio card driver
4. The SiRF I2S controller driver
5. The SiRF hdmi card driver
6. The SiRF USP controller(DSP mode) driver
7. The SiRF bt-sco card driver

-v5:
1. Drop all inlines.
2. Reordering the Kconfig and Makefile
3. Remove the sirf_audio_codec_reg_bits struct, use the new controls instead it.
4. Add some SND_SOC_DAPM_OUT_DRV instead of HP and SPK enable driver
5. Add audio codec clock supply instead of adc event callback
6. Fixed playback and capture can't concurrent work bug.

Rongjun Ying (7):
ASoC: sirf: Add SiRF internal audio codec driver
SoC: sirf: Add SiRF audio port driver is used by SiRF internal audio
codec
ASoC: sirf: Add SiRF audio card
ASoC: sirf: Add SiRF I2S driver
ASoC: sirf: Add hdmi card
ASoC: sirf: Add usp driver which is used by dsp mode
SoC: sirf: Add bt-sco card

 .../devicetree/bindings/sound/sirf-audio-codec.txt |   17 +
 .../devicetree/bindings/sound/sirf-audio-port.txt  |   20 +
 .../devicetree/bindings/sound/sirf-audio.txt       |   41 ++
 .../devicetree/bindings/sound/sirf-bt-sco.txt      |   18 +
 .../devicetree/bindings/sound/sirf-hdmi.txt        |   15 +
 .../devicetree/bindings/sound/sirf-i2s.txt         |   27 +
 .../devicetree/bindings/sound/sirf-usp.txt         |   27 +
 sound/soc/Kconfig                                  |    1 +
 sound/soc/Makefile                                 |    1 +
 sound/soc/codecs/Kconfig                           |    5 +
 sound/soc/codecs/Makefile                          |    1 +
 sound/soc/codecs/sirf-audio-codec.c                |  533 ++++++++++++++++++++
 sound/soc/codecs/sirf-audio-codec.h                |   75 +++
 sound/soc/sirf/Kconfig                             |   34 ++
 sound/soc/sirf/Makefile                            |   13 +
 sound/soc/sirf/sirf-audio-port.c                   |  194 +++++++
 sound/soc/sirf/sirf-audio-port.h                   |   62 +++
 sound/soc/sirf/sirf-audio.c                        |  156 ++++++
 sound/soc/sirf/sirf-bt-sco.c                       |   99 ++++
 sound/soc/sirf/sirf-hdmi.c                         |   98 ++++
 sound/soc/sirf/sirf-i2s.c                          |  434 ++++++++++++++++
 sound/soc/sirf/sirf-i2s.h                          |   88 ++++
 sound/soc/sirf/sirf-usp.c                          |  448 ++++++++++++++++
 sound/soc/sirf/sirf-usp.h                          |  282 +++++++++++
 24 files changed, 2689 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/sound/sirf-audio-codec.txt
 create mode 100644 Documentation/devicetree/bindings/sound/sirf-audio-port.txt
 create mode 100644 Documentation/devicetree/bindings/sound/sirf-audio.txt
 create mode 100644 Documentation/devicetree/bindings/sound/sirf-bt-sco.txt
 create mode 100644 Documentation/devicetree/bindings/sound/sirf-hdmi.txt
 create mode 100644 Documentation/devicetree/bindings/sound/sirf-i2s.txt
 create mode 100644 Documentation/devicetree/bindings/sound/sirf-usp.txt
 create mode 100644 sound/soc/codecs/sirf-audio-codec.c
 create mode 100644 sound/soc/codecs/sirf-audio-codec.h
 create mode 100644 sound/soc/sirf/Kconfig
 create mode 100644 sound/soc/sirf/Makefile
 create mode 100644 sound/soc/sirf/sirf-audio-port.c
 create mode 100644 sound/soc/sirf/sirf-audio-port.h
 create mode 100644 sound/soc/sirf/sirf-audio.c
 create mode 100644 sound/soc/sirf/sirf-bt-sco.c
 create mode 100644 sound/soc/sirf/sirf-hdmi.c
 create mode 100644 sound/soc/sirf/sirf-i2s.c
 create mode 100644 sound/soc/sirf/sirf-i2s.h
 create mode 100644 sound/soc/sirf/sirf-usp.c
 create mode 100644 sound/soc/sirf/sirf-usp.h
Signature · 1 line
1.7.5.4
#1 lore raw

PATCH 1/7 ASoC: sirf: Add SiRF internal audio codec driver

From: Rongjun Ying <[email protected]>

SiRF internal audio codec is integrated in SiRF atlas6 and prima2 SoC. Features include:
1. Stereo DAC and ADC with 16-bit resolution amd 48KHz sample rate
2. Support headphone and/or speaker output
3. Integrate headphone and speaker output amp
4. Support LINE and MIC input
5. Support single ended and differential input mode

--v5:
1. Drop all inlines.
2. Reordering the Kconfig and Makefile
3. Remove the sirf_audio_codec_reg_bits struct, use the new controls instead it.
4. Add some SND_SOC_DAPM_OUT_DRV instead of HP and SPK enable driver
5. Add audio codec clock supply instead of adc event callback
6. Fixed playback and capture can't concurrent work bug.

--

 .../devicetree/bindings/sound/sirf-audio-codec.txt |   17 +
 sound/soc/codecs/Kconfig                           |    5 +
 sound/soc/codecs/Makefile                          |    1 +
 sound/soc/codecs/sirf-audio-codec.c                |  533 ++++++++++++++++++++
 sound/soc/codecs/sirf-audio-codec.h                |   75 +++
 5 files changed, 631 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/sound/sirf-audio-codec.txt
 create mode 100644 sound/soc/codecs/sirf-audio-codec.c
 create mode 100644 sound/soc/codecs/sirf-audio-codec.h
Documentation/devicetree/bindings/sound/sirf-audio-codec.txt new file +17 -0
new file mode 100644
index 0000000..062f5ec
@@ -0,0 +1,17 @@
+SiRF internal audio CODEC
+
+Required properties:
+
+  - compatible : "sirf,atlas6-audio-codec" or "sirf,prima2-audio-codec"
+
+  - reg : the register address of the device.
+
+  - clocks: the clock of SiRF internal audio codec
+
+Example:
+
+audiocodec: audiocodec@b0040000 {
+	compatible = "sirf,atlas6-audio-codec";
+	reg = <0xb0040000 0x10000>;
+	clocks = <&clks 27>;
+};
sound/soc/codecs/Kconfig +5 -0
index f2383eb..e19b64f 100644
@@ -71,6 +71,7 @@ config SND_SOC_ALL_CODECS
 	select SND_SOC_RT5640 if I2C
 	select SND_SOC_SGTL5000 if I2C
 	select SND_SOC_SI476X if MFD_SI476X_CORE
+	select SND_SOC_SIRF_AUDIO_CODEC
 	select SND_SOC_SN95031 if INTEL_SCU_IPC
 	select SND_SOC_SPDIF
 	select SND_SOC_SSM2518 if I2C
@@ -383,6 +384,10 @@ config SND_SOC_SIGMADSP
 	tristate
 	select CRC32
 
+config SND_SOC_SIRF_AUDIO_CODEC
+	tristate "SiRF SoC internal audio codec"
+	select REGMAP_MMIO
+
 config SND_SOC_SN95031
 	tristate
 
sound/soc/codecs/Makefile +1 -0
index 6af7a55..4c9b70a 100644
@@ -61,6 +61,7 @@ snd-soc-alc5623-objs := alc5623.o
 snd-soc-alc5632-objs := alc5632.o
 snd-soc-sigmadsp-objs := sigmadsp.o
 snd-soc-si476x-objs := si476x.o
+snd-soc-sirf-audio-codec-objs := sirf-audio-codec.o
 snd-soc-sn95031-objs := sn95031.o
 snd-soc-spdif-tx-objs := spdif_transmitter.o
 snd-soc-spdif-rx-objs := spdif_receiver.o
sound/soc/codecs/sirf-audio-codec.c new file +533 -0

533 lines not on this page · raw message

sound/soc/codecs/sirf-audio-codec.h new file +75 -0

75 lines not on this page · raw message

Signature · 1 line
1.7.5.4
#2 lore raw

PATCH 2/7 ASoC: sirf: Add SiRF audio port driver is used by SiRF internal audio codec

In reply to RongJun Ying

From: Rongjun Ying <[email protected]>

This driver is used by SIRF internal audio codec.
Use dedicated SiRF audio port TXFIFO and RXFIFO Supports two DMA channels for SiRF audio port TXFIFO and RXFIFO The audio port like as audio bus such as i2s.

---
 .../devicetree/bindings/sound/sirf-audio-port.txt  |   20 ++
 sound/soc/Kconfig                                  |    1 +
 sound/soc/Makefile                                 |    1 +
 sound/soc/sirf/Kconfig                             |    8 +
 sound/soc/sirf/Makefile                            |    3 +
 sound/soc/sirf/sirf-audio-port.c                   |  194 ++++++++++++++++++++
 sound/soc/sirf/sirf-audio-port.h                   |   62 +++++++
 7 files changed, 289 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/sound/sirf-audio-port.txt
 create mode 100644 sound/soc/sirf/Kconfig
 create mode 100644 sound/soc/sirf/Makefile
 create mode 100644 sound/soc/sirf/sirf-audio-port.c
 create mode 100644 sound/soc/sirf/sirf-audio-port.h
Documentation/devicetree/bindings/sound/sirf-audio-port.txt new file +20 -0
new file mode 100644
index 0000000..1f66de3
@@ -0,0 +1,20 @@
+* SiRF SoC audio port
+
+Required properties:
+- compatible: "sirf,audio-port"
+- reg: Base address and size entries:
+- dmas: List of DMA controller phandle and DMA request line ordered pairs.
+- dma-names: Identifier string for each DMA request line in the dmas property.
+  These strings correspond 1:1 with the ordered pairs in dmas.
+
+  One of the DMA channels will be responsible for transmission (should be
+  named "tx") and one for reception (should be named "rx").
+
+Example:
+
+audioport: audioport@b0040000 {
+	compatible = "sirf,audio-port";
+	reg = <0xb0040000 0x10000>;
+	dmas = <&dmac1 3>, <&dmac1 8>;
+	dma-names = "rx", "tx";
+};
sound/soc/Kconfig +1 -0
index d62ce48..0060b31 100644
@@ -50,6 +50,7 @@ source "sound/soc/pxa/Kconfig"
 source "sound/soc/samsung/Kconfig"
 source "sound/soc/s6000/Kconfig"
 source "sound/soc/sh/Kconfig"
+source "sound/soc/sirf/Kconfig"
 source "sound/soc/spear/Kconfig"
 source "sound/soc/tegra/Kconfig"
 source "sound/soc/txx9/Kconfig"
sound/soc/Makefile +1 -0
index 62a1822..5f1df02 100644
@@ -27,6 +27,7 @@ obj-$(CONFIG_SND_SOC)	+= pxa/
 obj-$(CONFIG_SND_SOC)	+= samsung/
 obj-$(CONFIG_SND_SOC)	+= s6000/
 obj-$(CONFIG_SND_SOC)	+= sh/
+obj-$(CONFIG_SND_SOC)	+= sirf/
 obj-$(CONFIG_SND_SOC)	+= spear/
 obj-$(CONFIG_SND_SOC)	+= tegra/
 obj-$(CONFIG_SND_SOC)	+= txx9/
sound/soc/sirf/Kconfig new file +8 -0
new file mode 100644
index 0000000..75b0344
@@ -0,0 +1,8 @@
+config SND_SOC_SIRF
+	tristate "SoC Audio for the SiRF SoC chips"
+	depends on ARCH_SIRF || COMPILE_TEST
+	select SND_SOC_GENERIC_DMAENGINE_PCM
+
+config SND_SOC_SIRF_AUDIO_PORT
+	select REGMAP_MMIO
+	tristate
sound/soc/sirf/Makefile new file +3 -0
new file mode 100644
index 0000000..fb012c8
@@ -0,0 +1,3 @@
+snd-soc-sirf-audio-port-objs := sirf-audio-port.o
+
+obj-$(CONFIG_SND_SOC_SIRF_AUDIO_PORT) += snd-soc-sirf-audio-port.o
sound/soc/sirf/sirf-audio-port.c new file +194 -0

194 lines not on this page · raw message

sound/soc/sirf/sirf-audio-port.h new file +62 -0

62 lines not on this page · raw message

Signature · 1 line
1.7.5.4
maintainer Applied
#3 lore raw

Re: [PATCH v5-resend 2/7] ASoC: sirf: Add SiRF audio port driver is used by SiRF internal audio codec

On Wed, Mar 05, 2014 at 04:34:35PM +0800, RongJun Ying wrote:

Applied, but...

sound/soc/sirf/sirf-audio-port.c line 159

Quoted 4 lines
sound/soc/sirf/sirf-audio-port.c new file +4 -0
+	base = devm_ioremap(&pdev->dev, mem_res->start,
+			resource_size(mem_res));
+	if (base == NULL)
+		return -ENOMEM;

...use devm_ioremap_resource() instead, please send a followup patch fixing this.

#4 lore raw

Re: [PATCH v5-resend 2/7] ASoC: sirf: Add SiRF audio port driver is used by SiRF internal audio codec

2014-03-06 17:20 GMT+08:00 Mark Brown <[email protected]>:

Quoted 11 lines · RongJun Ying

Applied, but...

sound/soc/sirf/sirf-audio-port.c line 159

Quoted 4 lines
sound/soc/sirf/sirf-audio-port.c new file +4 -0
+     base = devm_ioremap(&pdev->dev, mem_res->start,
+                     resource_size(mem_res));
+     if (base == NULL)
+             return -ENOMEM;

...use devm_ioremap_resource() instead, please send a followup patch fixing this.

The i2s, internal audio codec and audio port use same register physics address and size. So if one driver use the devm_ioremap_resource instead. The other driver will invoke devm_ioremap_resource failed.

Thanks

Signature · 2 lines
------------------------------
Rongjun Ying
maintainer
#5 lore raw

Re: [PATCH v5-resend 2/7] ASoC: sirf: Add SiRF audio port driver is used by SiRF internal audio codec

Quoted 8 lines · RongJun Ying

2014-03-06 17:20 GMT+08:00 Mark Brown <[email protected]>:

Quoted 2 lines

...use devm_ioremap_resource() instead, please send a followup patch fixing this.

The i2s, internal audio codec and audio port use same register physics address and size. So if one driver use the devm_ioremap_resource instead. The other driver will invoke devm_ioremap_resource failed.

That's buggy - there should only be one device for each register range, you should have a core MFD driver which gets the hardware resource and shares the regmap with the client drivers.

#6 lore raw

Re: [PATCH v5-resend 2/7] ASoC: sirf: Add SiRF audio port driver is used by SiRF internal audio codec

2014-03-07 9:49 GMT+08:00 Mark Brown <[email protected]>:

Quoted 6 lines · RongJun Ying
Quoted 4 lines

2014-03-06 17:20 GMT+08:00 Mark Brown <[email protected]>:

Quoted 2 lines

...use devm_ioremap_resource() instead, please send a followup patch fixing this.

Quoted 7 lines
Quoted 3 lines

The i2s, internal audio codec and audio port use same register physics address and size. So if one driver use the devm_ioremap_resource instead. The other driver will invoke devm_ioremap_resource failed.

That's buggy - there should only be one device for each register range, you should have a core MFD driver which gets the hardware resource and shares the regmap with the client drivers.

The I2S, internal audio codec and audio port share same register address space. Do you suggest that I write a MFD driver or write sirf-audio-core .c to share the regmap and register child audio devices (I2S, internal codec and port)?

Thanks

Signature · 2 lines
------------------------------
Rongjun Ying
maintainer
#7 lore raw

Re: [PATCH v5-resend 2/7] ASoC: sirf: Add SiRF audio port driver is used by SiRF internal audio codec

Quoted 4 lines · RongJun Ying

The I2S, internal audio codec and audio port share same register address space. Do you suggest that I write a MFD driver or write sirf-audio-core .c to share the regmap and register child audio devices (I2S, internal codec and port)?

You don't need to have a separate struct device for each ASoC function.

#8 lore raw

PATCH 3/7 ASoC: sirf: Add SiRF audio card

In reply to RongJun Ying

From: Rongjun Ying <[email protected]>

This connects platform DAI, SiRF internal audio codec DAI and SiRF auido port DAI together and works as a mach driver.

---
 .../devicetree/bindings/sound/sirf-audio.txt       |   41 +++++
 sound/soc/sirf/Kconfig                             |    6 +
 sound/soc/sirf/Makefile                            |    2 +
 sound/soc/sirf/sirf-audio.c                        |  156 ++++++++++++++++++++
 4 files changed, 205 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/sound/sirf-audio.txt
 create mode 100644 sound/soc/sirf/sirf-audio.c
Documentation/devicetree/bindings/sound/sirf-audio.txt new file +41 -0
new file mode 100644
index 0000000..c88882c
@@ -0,0 +1,41 @@
+* SiRF atlas6 and prima2 internal audio codec and port based audio setups
+
+Required properties:
+- compatible: "sirf,sirf-audio-card"
+- sirf,audio-platform: phandle for the platform node
+- sirf,audio-codec: phandle for the SiRF internal codec node
+
+Optional properties:
+- hp-pa-gpios: Need to be present if the board need control external
+  headphone amplifier.
+- spk-pa-gpios: Need to be present if the board need control external
+  speaker amplifier.
+- hp-switch-gpios: Need to be present if the board capable to detect jack
+  insertion, removal.
+
+Available audio endpoints for the audio-routing table:
+
+Board connectors:
+ * Headset Stereophone
+ * Ext Spk
+ * Line In
+ * Mic
+
+SiRF internal audio codec pins:
+ * HPOUTL
+ * HPOUTR
+ * SPKOUT
+ * Ext Mic
+ * Mic Bias
+
+Example:
+
+sound {
+		compatible = "sirf,sirf-audio-card";
+		sirf,audio-codec = <&audiocodec>;
+		sirf,audio-platform = <&audioport>;
+		hp-pa-gpios = <&gpio 44 0>;
+		spk-pa-gpios = <&gpio 46 0>;
+		hp-switch-gpios = <&gpio 45 0>;
+};
+
sound/soc/sirf/Kconfig +6 -0
index 75b0344..89e8942 100644
@@ -3,6 +3,12 @@ config SND_SOC_SIRF
 	depends on ARCH_SIRF || COMPILE_TEST
 	select SND_SOC_GENERIC_DMAENGINE_PCM
 
+config SND_SOC_SIRF_AUDIO
+	tristate "SoC Audio support for SiRF internal audio codec"
+	depends on SND_SOC_SIRF
+	select SND_SOC_SIRF_AUDIO_CODEC
+	select SND_SOC_SIRF_AUDIO_PORT
+
 config SND_SOC_SIRF_AUDIO_PORT
 	select REGMAP_MMIO
 	tristate
sound/soc/sirf/Makefile +2 -0
index fb012c8..913b932 100644
@@ -1,3 +1,5 @@
+snd-soc-sirf-audio-objs := sirf-audio.o
 snd-soc-sirf-audio-port-objs := sirf-audio-port.o
 
+obj-$(CONFIG_SND_SOC_SIRF_AUDIO) += snd-soc-sirf-audio.o
 obj-$(CONFIG_SND_SOC_SIRF_AUDIO_PORT) += snd-soc-sirf-audio-port.o
sound/soc/sirf/sirf-audio.c new file +156 -0

156 lines not on this page · raw message

Signature · 1 line
1.7.5.4
maintainer Applied
#9 lore raw

Re: [PATCH v5-resend 3/7] ASoC: sirf: Add SiRF audio card

Quoted 4 lines · RongJun Ying

From: Rongjun Ying <[email protected]>

This connects platform DAI, SiRF internal audio codec DAI and SiRF auido port DAI together and works as a mach driver.

Applied, thanks.

#10 lore raw

PATCH 4/7 ASoC: sirf: Add SiRF I2S driver

In reply to RongJun Ying

From: Rongjun Ying <[email protected]>

This patch adds ASoC support for SiRF SoCs I2S modules.
Features include:
1. I2S bus specification compliant (Released by Philips Semiconductors in June, 1996)
2. Support both master and slave mode.
3. Provides MCLK to I2S CODEC in I2S master mode
4. Supports 16-bit resolution playback
5. Supports 16-bit resolution record
6 .Supports 2 channel record
7. Supports 2 channel and 6 channel mode playback
8. Frame length, left channel length and right channel length are all programmable
9. Supports two DMA channels for TXFIFO and RXFIFO
10. Supports floating mode (x_ac97_dout can be configured as input)

---
-v5:
1. Drop all inlines.
2. Fixed returning ret twice is redundant in sirf_i2s_runtime_resume function

 .../devicetree/bindings/sound/sirf-i2s.txt         |   27 ++
 sound/soc/sirf/Kconfig                             |    4 +
 sound/soc/sirf/Makefile                            |    2 +
 sound/soc/sirf/sirf-i2s.c                          |  434 ++++++++++++++++++++
 sound/soc/sirf/sirf-i2s.h                          |   88 ++++
 5 files changed, 555 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/sound/sirf-i2s.txt
 create mode 100644 sound/soc/sirf/sirf-i2s.c
 create mode 100644 sound/soc/sirf/sirf-i2s.h
Documentation/devicetree/bindings/sound/sirf-i2s.txt new file +27 -0
new file mode 100644
index 0000000..cbff8a8
@@ -0,0 +1,27 @@
+* SiRF SoC I2S module
+
+Required properties:
+- compatible: "sirf,prima2-i2s"
+- reg: Base address and size entries:
+- dmas: List of DMA controller phandle and DMA request line ordered pairs.
+- dma-names: Identifier string for each DMA request line in the dmas property.
+  These strings correspond 1:1 with the ordered pairs in dmas.
+
+  One of the DMA channels will be responsible for transmission (should be
+  named "tx") and one for reception (should be named "rx").
+
+- clocks: I2S controller clock source
+- pinctrl-names: Must contain a "default" entry.
+- pinctrl-NNN: One property must exist for each entry in pinctrl-names.
+
+Example:
+
+i2s: i2s@b0040000 {
+	compatible = "sirf,prima2-i2s";
+	reg = <0xb0040000 0x10000>;
+	dmas = <&dmac1 6>, <&dmac1 12>;
+	dma-names = "rx", "tx";
+	clocks = <&clks 27>;
+	pinctrl-names = "default";
+	pinctrl-0 = <&i2s_pins_a>;
+};
sound/soc/sirf/Kconfig +4 -0
index 89e8942..e0b7157 100644
@@ -12,3 +12,7 @@ config SND_SOC_SIRF_AUDIO
 config SND_SOC_SIRF_AUDIO_PORT
 	select REGMAP_MMIO
 	tristate
+
+config SND_SOC_SIRF_I2S
+	select REGMAP_MMIO
+	tristate
sound/soc/sirf/Makefile +2 -0
index 913b932..d06a39e 100644
@@ -1,5 +1,7 @@
 snd-soc-sirf-audio-objs := sirf-audio.o
 snd-soc-sirf-audio-port-objs := sirf-audio-port.o
+snd-soc-sirf-i2s-objs := sirf-i2s.o
 
 obj-$(CONFIG_SND_SOC_SIRF_AUDIO) += snd-soc-sirf-audio.o
 obj-$(CONFIG_SND_SOC_SIRF_AUDIO_PORT) += snd-soc-sirf-audio-port.o
+obj-$(CONFIG_SND_SOC_SIRF_I2S) += snd-soc-sirf-i2s.o
sound/soc/sirf/sirf-i2s.c new file +434 -0

434 lines not on this page · raw message

sound/soc/sirf/sirf-i2s.h new file +88 -0

88 lines not on this page · raw message

Signature · 1 line
1.7.5.4
maintainer
#11 lore raw

Re: [PATCH v5-resend 4/7] ASoC: sirf: Add SiRF I2S driver

On Wed, Mar 05, 2014 at 04:34:37PM +0800, RongJun Ying wrote:

Mostly OK, a couple of small things below:

Quoted 9 lines
sound/soc/sirf/sirf-i2s.c new file +9 -0
+static int sirf_i2s_set_clkdiv(struct snd_soc_dai *dai, int div_id,
+	int src_rate)
+{
+	struct sirf_i2s *i2s = snd_soc_dai_get_drvdata(dai);
+
+	switch (div_id) {
+	case SIRF_I2S_EXT_CLK:
+		i2s->ext_clk = 1;
+		break;

sound/soc/sirf/sirf-i2s.c line 252

Quoted 10 lines
sound/soc/sirf/sirf-i2s.c new file +10 -0
+	case SIRF_I2S_PWM_CLK:
+		i2s->ext_clk = 0;
+		break;
+	default:
+		return -EINVAL;
+	}
+
+	i2s->src_clk_rate = src_rate;
+	return 0;
+}

This should be set_sysclk().

sound/soc/sirf/sirf-i2s.c line 375

Quoted 4 lines
sound/soc/sirf/sirf-i2s.c new file +4 -0
+	base = devm_ioremap(&pdev->dev, mem_res->start,
+		resource_size(mem_res));
+	if (base == NULL)
+		return -ENOMEM;

As mentioned on the other patch this should be devm_ioremap_resource() - if you are sharing the register range use a core device to own the register map.

#12 lore raw

Re: [PATCH v5-resend 4/7] ASoC: sirf: Add SiRF I2S driver

2014-03-07 14:05 GMT+08:00 Mark Brown <[email protected]>:

Quoted 17 lines · RongJun Ying

Mostly OK, a couple of small things below:

Quoted 13 lines
sound/soc/sirf/sirf-i2s.c new file +13 -0
+static int sirf_i2s_set_clkdiv(struct snd_soc_dai *dai, int div_id,
+     int src_rate)
+{
+     struct sirf_i2s *i2s = snd_soc_dai_get_drvdata(dai);
+
+     switch (div_id) {
+     case SIRF_I2S_EXT_CLK:
+             i2s->ext_clk = 1;
+             break;
+     case SIRF_I2S_PWM_CLK:
+             i2s->ext_clk = 0;
+             break;
+     default:
Quoted 8 lines

sound/soc/sirf/sirf-i2s.c line 252

Quoted 6 lines
sound/soc/sirf/sirf-i2s.c new file +6 -0
+             return -EINVAL;
+     }
+
+     i2s->src_clk_rate = src_rate;
+     return 0;
+}

This should be set_sysclk().

OK

Quoted 9 lines

sound/soc/sirf/sirf-i2s.c line 375

Quoted 5 lines
sound/soc/sirf/sirf-i2s.c new file +4 -0
+     base = devm_ioremap(&pdev->dev, mem_res->start,
+             resource_size(mem_res));
+     if (base == NULL)
+             return -ENOMEM;

As mentioned on the other patch this should be devm_ioremap_resource() - if you are sharing the register range use a core device to own the register map.

I may use the mfd driver to manage all shring the regsiter range.

Thanks

Signature · 2 lines
------------------------------
Rongjun Ying
#13 lore raw

Re: [PATCH v5-resend 4/7] ASoC: sirf: Add SiRF I2S driver

In reply to Mark Brown

2014-03-07 14:05 GMT+08:00 Mark Brown <[email protected]>:

Quoted 17 lines · RongJun Ying

Mostly OK, a couple of small things below:

Quoted 13 lines
sound/soc/sirf/sirf-i2s.c new file +13 -0
+static int sirf_i2s_set_clkdiv(struct snd_soc_dai *dai, int div_id,
+     int src_rate)
+{
+     struct sirf_i2s *i2s = snd_soc_dai_get_drvdata(dai);
+
+     switch (div_id) {
+     case SIRF_I2S_EXT_CLK:
+             i2s->ext_clk = 1;
+             break;
+     case SIRF_I2S_PWM_CLK:
+             i2s->ext_clk = 0;
+             break;
+     default:
Quoted 8 lines

sound/soc/sirf/sirf-i2s.c line 252

Quoted 6 lines
sound/soc/sirf/sirf-i2s.c new file +6 -0
+             return -EINVAL;
+     }
+
+     i2s->src_clk_rate = src_rate;
+     return 0;
+}

This should be set_sysclk().

OK

Quoted 9 lines

sound/soc/sirf/sirf-i2s.c line 375

Quoted 5 lines
sound/soc/sirf/sirf-i2s.c new file +4 -0
+     base = devm_ioremap(&pdev->dev, mem_res->start,
+             resource_size(mem_res));
+     if (base == NULL)
+             return -ENOMEM;

As mentioned on the other patch this should be devm_ioremap_resource() - if you are sharing the register range use a core device to own the register map.

I may use the mfd driver to manage all shring the regsiter range.

Thanks

Signature · 2 lines
------------------------------
Rongjun Ying
#14 lore raw

PATCH 5/7 ASoC: sirf: Add hdmi card

In reply to RongJun Ying

From: Rongjun Ying <[email protected]>

This connects platform DAI, hdmi audio codec DAI and SiRF I2S DAI together and works as a mach driver.

---
 .../devicetree/bindings/sound/sirf-hdmi.txt        |   15 +++
 sound/soc/sirf/Kconfig                             |    6 +
 sound/soc/sirf/Makefile                            |    2 +
 sound/soc/sirf/sirf-hdmi.c                         |   98 ++++++++++++++++++++
 4 files changed, 121 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/sound/sirf-hdmi.txt
 create mode 100644 sound/soc/sirf/sirf-hdmi.c
Documentation/devicetree/bindings/sound/sirf-hdmi.txt new file +15 -0
new file mode 100644
index 0000000..3b6eb2a
@@ -0,0 +1,15 @@
+* SiRF atlas6/prima2 hdmi audio codec based audio setups
+
+Required properties:
+- compatible: "sirf,sirf-hdmi"
+- sirf,i2s-controller: The phandle of the SiRF I2S controller.
+- sirf,hdmi-audio-codec: The phandle of the hdmi audio codec.
+
+Example:
+
+sirf-hdmi {
+	compatible = "sirf,hdmi-card";
+	sirf,i2s-controller = <&i2s>;
+	sirf,hdmi-audio-codec = <&hdmi_audio>;
+};
+
sound/soc/sirf/Kconfig +6 -0
index e0b7157..66ed994 100644
@@ -13,6 +13,12 @@ config SND_SOC_SIRF_AUDIO_PORT
 	select REGMAP_MMIO
 	tristate
 
+config SND_SOC_SIRF_HDMI
+	tristate "SoC Audio support for SiRF HDMI"
+	depends on SND_SOC_SIRF
+	select SND_SOC_SIRF_I2S
+	select SND_SOC_HDMI_CODEC
+
 config SND_SOC_SIRF_I2S
 	select REGMAP_MMIO
 	tristate
sound/soc/sirf/Makefile +2 -0
index d06a39e..c961307 100644
@@ -1,7 +1,9 @@
 snd-soc-sirf-audio-objs := sirf-audio.o
 snd-soc-sirf-audio-port-objs := sirf-audio-port.o
+snd-soc-sirf-hdmi-objs := sirf-hdmi.o
 snd-soc-sirf-i2s-objs := sirf-i2s.o
 
 obj-$(CONFIG_SND_SOC_SIRF_AUDIO) += snd-soc-sirf-audio.o
 obj-$(CONFIG_SND_SOC_SIRF_AUDIO_PORT) += snd-soc-sirf-audio-port.o
+obj-$(CONFIG_SND_SOC_SIRF_HDMI) += snd-soc-sirf-hdmi.o
 obj-$(CONFIG_SND_SOC_SIRF_I2S) += snd-soc-sirf-i2s.o
sound/soc/sirf/sirf-hdmi.c new file +98 -0

98 lines not on this page · raw message

Signature · 1 line
1.7.5.4
maintainer
#15 lore raw

Re: [PATCH v5-resend 5/7] ASoC: sirf: Add hdmi card

Quoted 4 lines · RongJun Ying

From: Rongjun Ying <[email protected]>

This connects platform DAI, hdmi audio codec DAI and SiRF I2S DAI together and works as a mach driver.

This looks like it should be able to use simple-card?

sound/soc/sirf/sirf-hdmi.c line 26

Quoted 13 lines
sound/soc/sirf/sirf-hdmi.c new file +13 -0
+static int sirf_hdmi_hw_params(struct snd_pcm_substream *substream,
+	struct snd_pcm_hw_params *params)
+{
+	struct snd_soc_pcm_runtime *rtd = substream->private_data;
+	struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
+	struct snd_soc_codec *codec = rtd->codec;
+	struct snd_soc_card *card = codec->card;
+	unsigned int fmt;
+	int ret;
+
+	fmt = card->dai_link[0].dai_fmt;
+
+	ret = snd_soc_dai_set_fmt(cpu_dai, fmt);

The whole point with dai_fmt is that the framework will do this for you.

#16 lore raw

PATCH 6/7 ASoC: sirf: Add usp driver which is used by dsp mode

In reply to RongJun Ying

From: Rongjun Ying <[email protected]>

This patch adds ASoC support for SiRF SoCs USP(DSP mode) modules. Features include:
1. Only 1 channel support.
2. Support both master and slave mode.

---
-v5:
Drop all inlines.

 .../devicetree/bindings/sound/sirf-usp.txt         |   27 ++
 sound/soc/sirf/Kconfig                             |    4 +
 sound/soc/sirf/Makefile                            |    2 +
 sound/soc/sirf/sirf-usp.c                          |  448 ++++++++++++++++++++
 sound/soc/sirf/sirf-usp.h                          |  282 ++++++++++++
 5 files changed, 763 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/sound/sirf-usp.txt
 create mode 100644 sound/soc/sirf/sirf-usp.c
 create mode 100644 sound/soc/sirf/sirf-usp.h
Documentation/devicetree/bindings/sound/sirf-usp.txt new file +27 -0
new file mode 100644
index 0000000..59601b7
@@ -0,0 +1,27 @@
+* SiRF SoC USP module
+
+Required properties:
+- compatible: "sirf,prima2-usp-pcm"
+- reg: Base address and size entries:
+- dmas: List of DMA controller phandle and DMA request line ordered pairs.
+- dma-names: Identifier string for each DMA request line in the dmas property.
+  These strings correspond 1:1 with the ordered pairs in dmas.
+
+  One of the DMA channels will be responsible for transmission (should be
+  named "tx") and one for reception (should be named "rx").
+
+- clocks: USP controller clock source
+- pinctrl-names: Must contain a "default" entry.
+- pinctrl-NNN: One property must exist for each entry in pinctrl-names.
+
+Example:
+
+usp1: usp@b0090000 {
+	compatible = "sirf,prima2-usp-pcm";
+	reg = <0xb0090000 0x10000>;
+	clocks = <&clks 29>;
+	dmas = <&dmac0 14>, <&dmac0 15>;
+	dma-names = "rx", "tx";
+	pinctrl-names = "default";
+	pinctrl-0 = <&usp0_only_utfs_pins_a>;
+};
sound/soc/sirf/Kconfig +4 -0
index 66ed994..b9c898e 100644
@@ -22,3 +22,7 @@ config SND_SOC_SIRF_HDMI
 config SND_SOC_SIRF_I2S
 	select REGMAP_MMIO
 	tristate
+
+config SND_SOC_SIRF_USP
+	select REGMAP_MMIO
+	tristate
sound/soc/sirf/Makefile +2 -0
index c961307..2b68632 100644
@@ -2,8 +2,10 @@ snd-soc-sirf-audio-objs := sirf-audio.o
 snd-soc-sirf-audio-port-objs := sirf-audio-port.o
 snd-soc-sirf-hdmi-objs := sirf-hdmi.o
 snd-soc-sirf-i2s-objs := sirf-i2s.o
+snd-soc-sirf-usp-objs := sirf-usp.o
 
 obj-$(CONFIG_SND_SOC_SIRF_AUDIO) += snd-soc-sirf-audio.o
 obj-$(CONFIG_SND_SOC_SIRF_AUDIO_PORT) += snd-soc-sirf-audio-port.o
 obj-$(CONFIG_SND_SOC_SIRF_HDMI) += snd-soc-sirf-hdmi.o
 obj-$(CONFIG_SND_SOC_SIRF_I2S) += snd-soc-sirf-i2s.o
+obj-$(CONFIG_SND_SOC_SIRF_USP) += snd-soc-sirf-usp.o
sound/soc/sirf/sirf-usp.c new file +448 -0

448 lines not on this page · raw message

sound/soc/sirf/sirf-usp.h new file +282 -0

282 lines not on this page · raw message

Signature · 1 line
1.7.5.4
maintainer
#17 lore raw

Re: [PATCH v5-resend 6/7] ASoC: sirf: Add usp driver which is used by dsp mode

Quoted 6 lines · RongJun Ying

From: Rongjun Ying <[email protected]>

This patch adds ASoC support for SiRF SoCs USP(DSP mode) modules. Features include:
1. Only 1 channel support.
2. Support both master and slave mode.

This looks good but depends on the previous changes in the Makefile and Kconfig.

#18 lore raw

PATCH 7/7 ASoC: sirf: Add bt-sco card

In reply to RongJun Ying

From: Rongjun Ying <[email protected]>

This connects platform DAI, USP(DSP mode) CPU DAI and bt-sco Codec DAI together and works as a mach driver.

---
 .../devicetree/bindings/sound/sirf-bt-sco.txt      |   18 ++++
 sound/soc/sirf/Kconfig                             |    6 +
 sound/soc/sirf/Makefile                            |    2 +
 sound/soc/sirf/sirf-bt-sco.c                       |   99 ++++++++++++++++++++
 4 files changed, 125 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/sound/sirf-bt-sco.txt
 create mode 100644 sound/soc/sirf/sirf-bt-sco.c
Documentation/devicetree/bindings/sound/sirf-bt-sco.txt new file +18 -0
new file mode 100644
index 0000000..e51de20
@@ -0,0 +1,18 @@
+* SiRF atlas6/prima2 and bt-sco based audio setups
+
+Required properties:
+- compatible: "sirf,sirf-bt-sco"
+- sirf,usp-controller: The phandle of the SiRF usp controller.
+
+Optional properties:
+- bt-sco-master: The phandle of who is master, if set,
+  the codec is master, Otherwiss, the soc is master.
+
+Example:
+
+sirf-bt-sco {
+	compatible = "sirf,sirf-bt-sco";
+	sirf,usp-controller = <&usp0>;
+	bt-sco-master;
+};
+
sound/soc/sirf/Kconfig +6 -0
index b9c898e..7c592a9 100644
@@ -13,6 +13,12 @@ config SND_SOC_SIRF_AUDIO_PORT
 	select REGMAP_MMIO
 	tristate
 
+config SND_SOC_SIRF_BT_SCO
+	tristate "SoC Audio support for BT SCO"
+	depends on SND_SOC_SIRF
+	select SND_SOC_BT_SCO
+	select SND_SOC_SIRF_USP
+
 config SND_SOC_SIRF_HDMI
 	tristate "SoC Audio support for SiRF HDMI"
 	depends on SND_SOC_SIRF
sound/soc/sirf/Makefile +2 -0
index 2b68632..7b5a9f5 100644
@@ -1,11 +1,13 @@
 snd-soc-sirf-audio-objs := sirf-audio.o
 snd-soc-sirf-audio-port-objs := sirf-audio-port.o
+snd-soc-sirf-bt-sco-objs := sirf-bt-sco.o
 snd-soc-sirf-hdmi-objs := sirf-hdmi.o
 snd-soc-sirf-i2s-objs := sirf-i2s.o
 snd-soc-sirf-usp-objs := sirf-usp.o
 
 obj-$(CONFIG_SND_SOC_SIRF_AUDIO) += snd-soc-sirf-audio.o
 obj-$(CONFIG_SND_SOC_SIRF_AUDIO_PORT) += snd-soc-sirf-audio-port.o
+obj-$(CONFIG_SND_SOC_SIRF_BT_SCO) += snd-soc-sirf-bt-sco.o
 obj-$(CONFIG_SND_SOC_SIRF_HDMI) += snd-soc-sirf-hdmi.o
 obj-$(CONFIG_SND_SOC_SIRF_I2S) += snd-soc-sirf-i2s.o
 obj-$(CONFIG_SND_SOC_SIRF_USP) += snd-soc-sirf-usp.o
sound/soc/sirf/sirf-bt-sco.c new file +99 -0

99 lines not on this page · raw message

Signature · 1 line
1.7.5.4
maintainer
#19 lore raw

Re: [PATCH v5-resend 7/7] ASoC: sirf: Add bt-sco card

Quoted 4 lines · RongJun Ying

From: Rongjun Ying <[email protected]>

This connects platform DAI, USP(DSP mode) CPU DAI and bt-sco Codec DAI together and works as a mach driver.

Again, can this use simple-card and...

sound/soc/sirf/sirf-bt-sco.c line 26

Quoted 4 lines
sound/soc/sirf/sirf-bt-sco.c new file +4 -0
+	fmt = card->dai_link[0].dai_fmt;
+
+	/* Set cpu DAI configuration */
+	ret = snd_soc_dai_set_fmt(cpu_dai, fmt);

...this shouldn't be needed.