Skip to contentSkip to conversation

ASoC: add CSR SiRFSoC sound drivers

PATCH In review RongJun Ying 4 participants 19 messages Feb 26, 2014 – Mar 5, 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

-v4:
1. Use the generic dmaengine pcm codes instead of sirf pcm driver.
2. Add TLV information into internal audio codec driver.
3. Use the MMIO regmap instead of custom read and write callbacks.
4. Remove spin_lock.
5. Change some variable names.
6. The SiRF internal audio driver split into codec, port.
7. Add binding documents.

Rongjun Ying (7):
ASoC: sirf: Add SiRF internal audio codec driver
ASoC: 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
ASoC: 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                           |    4 +
 sound/soc/codecs/Makefile                          |    2 +
 sound/soc/codecs/sirf-audio-codec.c                |  585 ++++++++++++++++++++
 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                          |  438 +++++++++++++++
 sound/soc/sirf/sirf-i2s.h                          |   88 +++
 sound/soc/sirf/sirf-usp.c                          |  448 +++++++++++++++
 sound/soc/sirf/sirf-usp.h                          |  282 ++++++++++
 24 files changed, 2745 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]>

The 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.

---
-v4:
1. Add SiRF internal audio codec driver which split from sirf-soc-inner driver.
2. Add codec binding document.
3. Use MMIO regmap.
4. Add TLV information.

 .../devicetree/bindings/sound/sirf-audio-codec.txt |   17 +
 sound/soc/codecs/Kconfig                           |    4 +
 sound/soc/codecs/Makefile                          |    2 +
 sound/soc/codecs/sirf-audio-codec.c                |  585 ++++++++++++++++++++
 sound/soc/codecs/sirf-audio-codec.h                |   75 +++
 5 files changed, 683 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 +4 -0
index f2383eb..b6b0953 100644
@@ -141,6 +141,7 @@ config SND_SOC_ALL_CODECS
 	select SND_SOC_WM9705 if SND_SOC_AC97_BUS
 	select SND_SOC_WM9712 if SND_SOC_AC97_BUS
 	select SND_SOC_WM9713 if SND_SOC_AC97_BUS
+	select SND_SOC_SIRF_AUDIO_CODEC if SND_SOC_SIRF
         help
           Normally ASoC codec drivers are only built if a machine driver which
           uses them is also built since they are only usable with a machine
@@ -634,4 +635,7 @@ config SND_SOC_TPA6130A2
 	tristate "Texas Instruments TPA6130A2 headphone amplifier"
 	depends on I2C
 
+config SND_SOC_SIRF_AUDIO_CODEC
+	tristate "SiRF SoC internal audio codec"
+	select REGMAP_MMIO
 endmenu
sound/soc/codecs/Makefile +2 -0
index 6af7a55..6bea5ba 100644
@@ -134,6 +134,7 @@ snd-soc-wm9705-objs := wm9705.o
 snd-soc-wm9712-objs := wm9712.o
 snd-soc-wm9713-objs := wm9713.o
 snd-soc-wm-hubs-objs := wm_hubs.o
+snd-soc-sirf-audio-codec-objs := sirf-audio-codec.o
 
 # Amp
 snd-soc-max9877-objs := max9877.o
@@ -274,6 +275,7 @@ obj-$(CONFIG_SND_SOC_WM9712)	+= snd-soc-wm9712.o
 obj-$(CONFIG_SND_SOC_WM9713)	+= snd-soc-wm9713.o
 obj-$(CONFIG_SND_SOC_WM_ADSP)	+= snd-soc-wm-adsp.o
 obj-$(CONFIG_SND_SOC_WM_HUBS)	+= snd-soc-wm-hubs.o
+obj-$(CONFIG_SND_SOC_SIRF_AUDIO_CODEC) += snd-soc-sirf-audio-codec.o
 
 # Amp
 obj-$(CONFIG_SND_SOC_MAX9877)	+= snd-soc-max9877.o
sound/soc/codecs/sirf-audio-codec.c new file +585 -0

585 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
maintainer
#2 lore raw

Re: [PATCH v4-resend 1/7] ASoC: sirf: Add SiRF internal audio codec driver

On Wed, Feb 26, 2014 at 03:22:16PM +0800, RongJun Ying wrote:

Overall looks fairly good, a few issues below but they're quite small.

sound/soc/codecs/sirf-audio-codec.c line 57

Quoted 10 lines
sound/soc/codecs/sirf-audio-codec.c new file +10 -0
+static struct sirf_audio_codec_reg_bits sirf_audio_codec_reg_bits_prima2 = {
+	.dig_mic_en_bits = 20,
+	.dig_mic_freq_bits = 21,
+	.adc14b_12_bits = 22,
+	.firdac_hsl_en_bits = 23,
+	.firdac_hsr_en_bits = 24,
+	.firdac_lout_en_bits = 25,
+	.por_bits = 26,
+	.codec_clk_en_bits = 27,
+};

This looks like the sort of thing that the regmap_field layer was supposed to hide?

Quoted 4 lines
sound/soc/codecs/sirf-audio-codec.c new file +4 -0
+static int adc_event(struct snd_soc_dapm_widget *w,
+		struct snd_kcontrol *kcontrol, int event)
+{
+	struct snd_soc_codec *codec = w->codec;

sound/soc/codecs/sirf-audio-codec.c line 141

Quoted 10 lines
sound/soc/codecs/sirf-audio-codec.c new file +10 -0
+	struct sirf_audio_codec *sirf_audio_codec = dev_get_drvdata(codec->dev);
+	u32 val;
+
+	val = sirfsoc_rtc_iobrg_readl(sirf_audio_codec->sys_pwrc_reg_base +
+			PWRC_PDN_CTRL_OFFSET);
+	switch (event) {
+	case SND_SOC_DAPM_POST_PMU:
+		/* Enable capture power of codec*/
+		val |= (1 << AUDIO_POWER_EN_BIT);
+		break;

Looking at this code (and many of the other controls) I can't help but feel that there's some room for more abstraction here. The controls are all setting two bits rather than just one but for example...

sound/soc/codecs/sirf-audio-codec.c line 169

Quoted 3 lines
sound/soc/codecs/sirf-audio-codec.c new file +3 -0
+	case SND_SOC_DAPM_PRE_PMU:
+		val = (1 << sirf_audio_codec->reg_bits->firdac_hsl_en_bits);
+		break;

...this looks like a supply widget could be used to manage the bits controlled by the pre and post PMU events? The same is true for most of the events.

sound/soc/codecs/sirf-audio-codec.c line 445

Quoted 11 lines
sound/soc/codecs/sirf-audio-codec.c new file +11 -0
+	dn = of_find_compatible_node(dn, NULL, "sirf,prima2-pwrc");
+	if (!dn) {
+		dev_err(&pdev->dev, "Failed to get sirf,prima2-pwrc  node!\n");
+		return -ENODEV;
+	}
+
+	ret = of_property_read_u32(dn, "reg", &sirf_audio_codec->sys_pwrc_reg_base);
+	if (ret < 0) {
+		dev_err(&pdev->dev, "Failed tp get pwrc register base address\n");
+		return -EINVAL;
+	}

Should prima2-pwrc be a syscon? Not a blocker for merging this.

sound/soc/codecs/sirf-audio-codec.c line 513

Quoted 9 lines
sound/soc/codecs/sirf-audio-codec.c new file +9 -0
+#ifdef CONFIG_PM_RUNTIME
+static int sirf_audio_codec_runtime_suspend(struct device *dev)
+{
+	struct sirf_audio_codec *sirf_audio_codec = dev_get_drvdata(dev);
+	regmap_update_bits(sirf_audio_codec->regmap, AUDIO_IC_CODEC_CTRL1,
+		(1 << sirf_audio_codec->reg_bits->codec_clk_en_bits),
+		0);
+	return 0;
+}

Can you disable the clock in the clock API as well? This might allow further supply clocks to be disabled and is genarally good practice.

sound/soc/codecs/sirf-audio-codec.c line 539

Quoted 9 lines
sound/soc/codecs/sirf-audio-codec.c new file +9 -0
+static int sirf_audio_codec_suspend(struct device *dev)
+{
+	struct sirf_audio_codec *sirf_audio_codec = dev_get_drvdata(dev);
+
+	regmap_read(sirf_audio_codec->regmap, AUDIO_IC_CODEC_CTRL0,
+		&sirf_audio_codec->reg_ctrl0);
+	regmap_read(sirf_audio_codec->regmap, AUDIO_IC_CODEC_CTRL1,
+		&sirf_audio_codec->reg_ctrl1);
+	sirf_audio_codec_runtime_suspend(dev);

Have you seen the series Ulf has been posting regarding the integration of runtime PM and system suspend? There's all sorts of nasty cases with this stuff unfortunately. Not sure it should be a blocker for merging though since we haven't really figured out how this stuff is supposed to work.

#3 lore raw

Re: [PATCH v4-resend 1/7] ASoC: sirf: Add SiRF internal audio codec driver

Quoted 17 lines

-----Original Message-----
From: Mark Brown [mailto:[email protected]]
Sent: Thursday, February 27, 2014 1:34 PM
To: RongJun Ying
Cc: Liam Girdwood; Jaroslav Kysela; Takashi Iwai; alsa-devel@alsa- project.org; DL-SHA-WorkGroupLinux; Rongjun Ying
Subject: Re: [PATCH v4-resend 1/7] ASoC: sirf: Add SiRF internal audio codec driver

On Wed, Feb 26, 2014 at 03:22:16PM +0800, RongJun Ying wrote:

Overall looks fairly good, a few issues below but they're quite small.

Quoted 1 line

+static struct sirf_audio_codec_reg_bits

sirf_audio_codec_reg_bits_prima2 = {

Quoted 13 lines

sound/soc/codecs/sirf-audio-codec.c line 57

Quoted 9 lines
sound/soc/codecs/sirf-audio-codec.c new file +9 -0
+	.dig_mic_en_bits = 20,
+	.dig_mic_freq_bits = 21,
+	.adc14b_12_bits = 22,
+	.firdac_hsl_en_bits = 23,
+	.firdac_hsr_en_bits = 24,
+	.firdac_lout_en_bits = 25,
+	.por_bits = 26,
+	.codec_clk_en_bits = 27,
+};

This looks like the sort of thing that the regmap_field layer was supposed to hide?

Do you mean I need use the regmap_field_read/write to hide these?

Quoted 20 lines

sound/soc/codecs/sirf-audio-codec.c

Quoted 4 lines
sound/soc/codecs/sirf-audio-codec.c new file +4 -0
+static int adc_event(struct snd_soc_dapm_widget *w,
+		struct snd_kcontrol *kcontrol, int event) {
+	struct snd_soc_codec *codec = w->codec;
+	struct sirf_audio_codec *sirf_audio_codec =

dev_get_drvdata(codec->dev);

sound/soc/codecs/sirf-audio-codec.c

Quoted 3 lines
sound/soc/codecs/sirf-audio-codec.c new file +3 -0
+	u32 val;
+
+	val = sirfsoc_rtc_iobrg_readl(sirf_audio_codec->sys_pwrc_reg_base

+

sound/soc/codecs/sirf-audio-codec.c line 141

Quoted 6 lines
sound/soc/codecs/sirf-audio-codec.c new file +6 -0
+			PWRC_PDN_CTRL_OFFSET);
+	switch (event) {
+	case SND_SOC_DAPM_POST_PMU:
+		/* Enable capture power of codec*/
+		val |= (1 << AUDIO_POWER_EN_BIT);
+		break;

Looking at this code (and many of the other controls) I can't help but feel that there's some room for more abstraction here. The controls are all setting two bits rather than just one but for example...

Quoted 8 lines

sound/soc/codecs/sirf-audio-codec.c line 169

Quoted 3 lines
sound/soc/codecs/sirf-audio-codec.c new file +3 -0
+	case SND_SOC_DAPM_PRE_PMU:
+		val = (1 << sirf_audio_codec->reg_bits->firdac_hsl_en_bits);
+		break;

...this looks like a supply widget could be used to manage the bits controlled by the pre and post PMU events? The same is true for most of the events.

Ok, I will use supply widget.

Quoted 17 lines

sound/soc/codecs/sirf-audio-codec.c

Quoted 3 lines
sound/soc/codecs/sirf-audio-codec.c new file +3 -0
+	dn = of_find_compatible_node(dn, NULL, "sirf,prima2-pwrc");
+	if (!dn) {
+		dev_err(&pdev->dev, "Failed to get sirf,prima2-pwrc

node!\n");

Review

Quoted 7 lines
sound/soc/codecs/sirf-audio-codec.c new file +4 -0
+		return -ENODEV;
+	}
+
+	ret = of_property_read_u32(dn, "reg", &sirf_audio_codec-

sys_pwrc_reg_base);

(quoted diff) +2 -0
+	if (ret < 0) {
+		dev_err(&pdev->dev, "Failed tp get pwrc register base

address\n");

Review

Quoted 2 lines
(quoted diff) +2 -0
+		return -EINVAL;
+	}

Should prima2-pwrc be a syscon? Not a blocker for merging this.

Quoted 12 lines

sound/soc/codecs/sirf-audio-codec.c line 513

Quoted 8 lines
sound/soc/codecs/sirf-audio-codec.c new file +8 -0
+#ifdef CONFIG_PM_RUNTIME
+static int sirf_audio_codec_runtime_suspend(struct device *dev) {
+	struct sirf_audio_codec *sirf_audio_codec = dev_get_drvdata(dev);
+	regmap_update_bits(sirf_audio_codec->regmap, AUDIO_IC_CODEC_CTRL1,
+		(1 << sirf_audio_codec->reg_bits->codec_clk_en_bits),
+		0);
+	return 0;
+}

Can you disable the clock in the clock API as well? This might allow further supply clocks to be disabled and is genarally good practice.

This is a workaround. The capture ADC and touch ADC use a same power supply, The codec ADC's change pump set or clear will impact touch ADC unstable. So It's need enable codec clock and set change pump when the Audio driver init.

Thanks
RongJun Ying

Quoted 6 lines
Quoted 6 lines
sound/soc/codecs/sirf-audio-codec.c new file +6 -0
+static int sirf_audio_codec_suspend(struct device *dev) {
+	struct sirf_audio_codec *sirf_audio_codec = dev_get_drvdata(dev);
+
+	regmap_read(sirf_audio_codec->regmap, AUDIO_IC_CODEC_CTRL0,
+		&sirf_audio_codec->reg_ctrl0);
+	regmap_read(sirf_audio_codec->regmap, AUDIO_IC_CODEC_CTRL1,
Quoted 8 lines

sound/soc/codecs/sirf-audio-codec.c line 539

Quoted 2 lines
sound/soc/codecs/sirf-audio-codec.c new file +2 -0
+		&sirf_audio_codec->reg_ctrl1);
+	sirf_audio_codec_runtime_suspend(dev);

Have you seen the series Ulf has been posting regarding the integration of runtime PM and system suspend? There's all sorts of nasty cases with this stuff unfortunately. Not sure it should be a blocker for merging though since we haven't really figured out how this stuff is supposed to work.

Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom
More information can be found at www.csr.com. Keep up to date with CSR on our technical blog, www.csr.com/blog, CSR people blog, www.csr.com/people, YouTube, www.youtube.com/user/CSRplc, Facebook, www.facebook.com/pages/CSR/191038434253534, or follow us on Twitter at www.twitter.com/CSR_plc. New for 2014, you can now access the wide range of products powered by aptX at www.aptx.com.

maintainer
#4 lore raw

Re: [PATCH v4-resend 1/7] ASoC: sirf: Add SiRF internal audio codec driver

Quoted 9 lines · Rongjun Ying
Quoted 7 lines
Quoted 1 line

+static struct sirf_audio_codec_reg_bits

sirf_audio_codec_reg_bits_prima2 = {

sound/soc/codecs/sirf-audio-codec.c line 50

Quoted 2 lines
sound/soc/codecs/sirf-audio-codec.c new file +2 -0
+	.dig_mic_en_bits = 20,
+	.dig_mic_freq_bits = 21,

This looks like the sort of thing that the regmap_field layer was supposed to hide?

Do you mean I need use the regmap_field_read/write to hide these?

You should certainly consider it and if it's not a good approach understanding why may help us improve that API.

Quoted 11 lines
Quoted 10 lines

sound/soc/codecs/sirf-audio-codec.c line 513

Quoted 7 lines
sound/soc/codecs/sirf-audio-codec.c new file +7 -0
+static int sirf_audio_codec_runtime_suspend(struct device *dev) {
+	struct sirf_audio_codec *sirf_audio_codec = dev_get_drvdata(dev);
+	regmap_update_bits(sirf_audio_codec->regmap, AUDIO_IC_CODEC_CTRL1,
+		(1 << sirf_audio_codec->reg_bits->codec_clk_en_bits),
+		0);
+	return 0;
+}

Can you disable the clock in the clock API as well? This might allow further supply clocks to be disabled and is genarally good practice.

Quoted 3 lines

This is a workaround. The capture ADC and touch ADC use a same power supply, The codec ADC's change pump set or clear will impact touch ADC unstable. So It's need enable codec clock and set change pump when the Audio driver init.

That doesn't really answer the question for me - I wasn't asking why the clock was being disabled, I was asking why the disable wasn't also being done at the clock API level.

#5 lore raw

Re: [PATCH v4-resend 1/7] ASoC: sirf: Add SiRF internal audio codec driver

Quoted 43 lines

-----Original Message-----
From: Mark Brown [mailto:[email protected]]
Sent: Saturday, March 01, 2014 11:17 AM
To: Rongjun Ying
Cc: RongJun Ying; Liam Girdwood; Jaroslav Kysela; Takashi Iwai; alsa- [email protected]; DL-SHA-WorkGroupLinux
Subject: Re: [PATCH v4-resend 1/7] ASoC: sirf: Add SiRF internal audio codec driver

Quoted 9 lines · Rongjun Ying
Quoted 7 lines
Quoted 1 line

+static struct sirf_audio_codec_reg_bits

sirf_audio_codec_reg_bits_prima2 = {

sound/soc/codecs/sirf-audio-codec.c line 50

Quoted 2 lines
sound/soc/codecs/sirf-audio-codec.c new file +2 -0
+	.dig_mic_en_bits = 20,
+	.dig_mic_freq_bits = 21,

This looks like the sort of thing that the regmap_field layer was supposed to hide?

Do you mean I need use the regmap_field_read/write to hide these?

You should certainly consider it and if it's not a good approach understanding why may help us improve that API.

Quoted 1 line
Quoted 1 line
Quoted 1 line

+static int sirf_audio_codec_runtime_suspend(struct device *dev)

{

Quoted 1 line
Quoted 1 line

Review

Quoted 1 line
(quoted diff) +1 -0
+	struct sirf_audio_codec *sirf_audio_codec =

dev_get_drvdata(dev);

Quoted 1 line
Quoted 1 line

sound/soc/codecs/sirf-audio-codec.c line 486

Quoted 1 line
sound/soc/codecs/sirf-audio-codec.c new file +1 -0
+	regmap_update_bits(sirf_audio_codec->regmap,

AUDIO_IC_CODEC_CTRL1,

Quoted 7 lines
Quoted 7 lines

sound/soc/codecs/sirf-audio-codec.c line 513

Quoted 4 lines
sound/soc/codecs/sirf-audio-codec.c new file +4 -0
+		(1 << sirf_audio_codec->reg_bits->codec_clk_en_bits),
+		0);
+	return 0;
+}

Can you disable the clock in the clock API as well? This might allow further supply clocks to be disabled and is genarally good

practice.

Quoted 2 lines

This is a workaround. The capture ADC and touch ADC use a same power supply, The codec ADC's change pump set or clear will impact touch

Quoted 7 lines

ADC unstable.

Quoted 1 line

So It's need enable codec clock and set change pump when the Audio

driver init.

That doesn't really answer the question for me - I wasn't asking why the clock was being disabled, I was asking why the disable wasn't also being done at the clock API level.

The codec clock is only used by this driver. And this clock is not managed by clock controller. The Audio controller codec is always enable. So I think it is not need abstract to general clock API.

Thanks.
RongJun Ying

Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom
More information can be found at www.csr.com. Keep up to date with CSR on our technical blog, www.csr.com/blog, CSR people blog, www.csr.com/people, YouTube, www.youtube.com/user/CSRplc, Facebook, www.facebook.com/pages/CSR/191038434253534, or follow us on Twitter at www.twitter.com/CSR_plc. New for 2014, you can now access the wide range of products powered by aptX at www.aptx.com.

maintainer
#6 lore raw

Re: [PATCH v4-resend 1/7] ASoC: sirf: Add SiRF internal audio codec driver

Quoted 3 lines · Rongjun Ying

The codec clock is only used by this driver. And this clock is not managed by clock controller. The Audio controller codec is always enable. So I think it is not need abstract to general clock API.

No, you're still missing the point. You are requesting external clocks, why are you not managing those here?

#7 lore raw

Re: [PATCH v4-resend 1/7] ASoC: sirf: Add SiRF internal audio codec driver

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

Quoted 8 lines · Rongjun Ying
Quoted 4 lines

The codec clock is only used by this driver. And this clock is not managed by clock controller. The Audio controller codec is always enable. So I think it is not need abstract to general clock API.

No, you're still missing the point. You are requesting external clocks, why are you not managing those here?

Hi Mark,
here the clock is an internal clock in the internal codec. the external clock of audio controller is managed in system suspend/resume as you see. but they are not managed in runtime suspend/resume here because the external clock is always enabled to make sure the charge pump to be working to make the board have stable current and voltage. otherwise, touchscreen ADC will not be accurate.

Quoted 6 lines

_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

-barry

maintainer
#8 lore raw

Re: [PATCH v4-resend 1/7] ASoC: sirf: Add SiRF internal audio codec driver

Quoted 6 lines · Barry Song

here the clock is an internal clock in the internal codec. the external clock of audio controller is managed in system suspend/resume as you see. but they are not managed in runtime suspend/resume here because the external clock is always enabled to make sure the charge pump to be working to make the board have stable current and voltage. otherwise, touchscreen ADC will not be accurate.

Why aren't these drivers keeping the clock enabled themselves?

#9 lore raw

Re: [PATCH v4-resend 1/7] ASoC: sirf: Add SiRF internal audio codec driver

2014-03-04 12:58 GMT+08:00 Mark Brown <[email protected]>:

Quoted 10 lines · Barry Song
Quoted 7 lines

here the clock is an internal clock in the internal codec. the external clock of audio controller is managed in system suspend/resume as you see. but they are not managed in runtime suspend/resume here because the external clock is always enabled to make sure the charge pump to be working to make the board have stable current and voltage. otherwise, touchscreen ADC will not be accurate.

Why aren't these drivers keeping the clock enabled themselves?

The charge pump register is a part of the audio controller. But this register is impacted the touchscreen ADC stable. So when the audio codec driver probe, It always enable the audio controller's clock,
and must be set the charge pump register.

         ret = clk_prepare_enable(sirf_audio_codec->clk);
         if (ret) {
                dev_err(&pdev->dev, "Enable clock failed.\n");
                 return ret;
         }
         .....
         /*
          * Always open charge pump, if not, when the charge pump closed the
          * adc will not stable
          */
         regmap_update_bits(sirf_audio_codec->regmap, AUDIO_IC_CODEC_CTRL0,
                 IC_CPFREQ, IC_CPFREQ);

         if (of_device_is_compatible(pdev->dev.of_node,
"sirf,atlas6-audio-codec"))
                 regmap_update_bits(sirf_audio_codec->regmap,
                                 AUDIO_IC_CODEC_CTRL0, IC_CPEN, IC_CPEN);

Thanks
RongJun Ying

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

Re: [PATCH v4-resend 1/7] ASoC: sirf: Add SiRF internal audio codec driver

Quoted 10 lines · RongJun Ying

2014-03-04 12:58 GMT+08:00 Mark Brown <[email protected]>:

Quoted 8 lines · Barry Song
Quoted 7 lines

here the clock is an internal clock in the internal codec. the external clock of audio controller is managed in system suspend/resume as you see. but they are not managed in runtime suspend/resume here because the external clock is always enabled to make sure the charge pump to be working to make the board have stable current and voltage. otherwise, touchscreen ADC will not be accurate.

Quoted 7 lines
Quoted 1 line

Why aren't these drivers keeping the clock enabled themselves?

The charge pump register is a part of the audio controller. But this register is impacted the touchscreen ADC stable. So when the audio codec driver probe, It always enable the audio controller's clock,
and must be set the charge pump register.

I'm sorry but I just can't follow what you're talking about at all. In one mail above you were talking about an external clock but here you're talking about the charge pump.

#11 lore raw

Re: [PATCH v4-resend 1/7] ASoC: sirf: Add SiRF internal audio codec driver

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

Quoted 19 lines · RongJun Ying
Quoted 10 lines

2014-03-04 12:58 GMT+08:00 Mark Brown <[email protected]>:

Quoted 8 lines · Barry Song
Quoted 7 lines

here the clock is an internal clock in the internal codec. the external clock of audio controller is managed in system suspend/resume as you see. but they are not managed in runtime suspend/resume here because the external clock is always enabled to make sure the charge pump to be working to make the board have stable current and voltage. otherwise, touchscreen ADC will not be accurate.

Quoted 7 lines
Quoted 1 line

Why aren't these drivers keeping the clock enabled themselves?

The charge pump register is a part of the audio controller. But this register is impacted the touchscreen ADC stable. So when the audio codec driver probe, It always enable the audio controller's clock,
and must be set the charge pump register.

Quoted 3 lines

I'm sorry but I just can't follow what you're talking about at all. In one mail above you were talking about an external clock but here you're talking about the charge pump.

The SiRF internal audio system has two clocks. The one is the audio module clock.
The I2S, internal audio and AC97 module use same clock. This clock is managed by clock
controller. And use the clock API to enable/disable it.

       ret = clk_prepare_enable(sirf_audio_codec->clk);
....
     clk_disable_unprepare(sirf_audio_codec->clk);

This clock need keeping enabled. The reason is the charge pump need alway set. Otherwise,
the touch ADC is unstable.

The other clock is the internal audio codec clock. This clock is not managed by clock controller.
Enable and disable this clock need update the audio codec's register. When runtime resume, this clock is enabled and reset it:

+static int sirf_audio_codec_runtime_resume(struct device *dev) +{
+ struct sirf_audio_codec *sirf_audio_codec = dev_get_drvdata(dev);
+ regmap_update_bits(sirf_audio_codec->regmap, AUDIO_IC_CODEC_CTRL1,

+               (1 << sirf_audio_codec->reg_bits->codec_clk_en_bits) |
+               (1 << sirf_audio_codec->reg_bits->por_bits),
+               (1 << sirf_audio_codec->reg_bits->codec_clk_en_bits));

+ msleep(20);
+ regmap_update_bits(sirf_audio_codec->regmap, AUDIO_IC_CODEC_CTRL1,
+ (1 << sirf_audio_codec->reg_bits->por_bits),
+ (1 << sirf_audio_codec->reg_bits->por_bits));
+ return 0;
+}

And runtime suspend, this clock is disabled:

+static int sirf_audio_codec_runtime_suspend(struct device *dev) +{
+ struct sirf_audio_codec *sirf_audio_codec = dev_get_drvdata(dev);
+ regmap_update_bits(sirf_audio_codec->regmap, AUDIO_IC_CODEC_CTRL1,
+ (1 << sirf_audio_codec->reg_bits->codec_clk_en_bits),
+ 0);
+ return 0;
+}

In v5, I use the codecclk supply to instead the runtime resume/suspend:

+static void enable_and_reset_codec(struct regmap *regmap,
+ u32 codec_enable_bits, u32 codec_reset_bits)
+{
+ regmap_update_bits(regmap, AUDIO_IC_CODEC_CTRL1,

+                       codec_enable_bits | codec_reset_bits,
+                       codec_enable_bits | ~codec_reset_bits);

+ msleep(20);
+ regmap_update_bits(regmap, AUDIO_IC_CODEC_CTRL1,
+ codec_reset_bits, codec_reset_bits);
+}
+
+static int atlas6_codec_enable_and_reset_event(struct snd_soc_dapm_widget *w,
+ struct snd_kcontrol *kcontrol, int event)
+{
+#define ATLAS6_CODEC_ENABLE_BITS (1 << 29)
+#define ATLAS6_CODEC_RESET_BITS (1 << 28)
+ struct sirf_audio_codec *sirf_audio_codec =
dev_get_drvdata(w->codec->dev);
+ switch (event) {
+ case SND_SOC_DAPM_PRE_PMU:
+ enable_and_reset_codec(sirf_audio_codec->regmap,
+ ATLAS6_CODEC_ENABLE_BITS, ATLAS6_CODEC_RESET_BITS);
+ break;
+ case SND_SOC_DAPM_POST_PMD:
+ regmap_update_bits(sirf_audio_codec->regmap,
+ AUDIO_IC_CODEC_CTRL1, ATLAS6_CODEC_ENABLE_BITS,
+ ~ATLAS6_CODEC_ENABLE_BITS);
+ break;
+ default:
+ break;
+ }
+
+ return 0;
+}
+
+static int prima2_codec_enable_and_reset_event(struct snd_soc_dapm_widget *w,
+ struct snd_kcontrol *kcontrol, int event)
+{
+#define PRIMA2_CODEC_ENABLE_BITS (1 << 27)
+#define PRIMA2_CODEC_RESET_BITS (1 << 26)
+ struct sirf_audio_codec *sirf_audio_codec =
dev_get_drvdata(w->codec->dev);
+ switch (event) {
+ case SND_SOC_DAPM_POST_PMU:
+ enable_and_reset_codec(sirf_audio_codec->regmap,
+ PRIMA2_CODEC_ENABLE_BITS, PRIMA2_CODEC_RESET_BITS);
+ break;
+ case SND_SOC_DAPM_POST_PMD:
+ regmap_update_bits(sirf_audio_codec->regmap,
+ AUDIO_IC_CODEC_CTRL1, PRIMA2_CODEC_ENABLE_BITS,
+ ~PRIMA2_CODEC_ENABLE_BITS);
+ break;
+ default:
+ break;
+ }
+
+ return 0;
+}

+static const struct snd_soc_dapm_widget atlas6_codec_clock_dapm_widget =
+ SND_SOC_DAPM_SUPPLY("codecclk", SND_SOC_NOPM, 0, 0,
+ atlas6_codec_enable_and_reset_event,
+ SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD);
+
+static const struct snd_soc_dapm_widget prima2_codec_clock_dapm_widget =
+ SND_SOC_DAPM_SUPPLY("codecclk", SND_SOC_NOPM, 0, 0,
+ prima2_codec_enable_and_reset_event,
+ SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD);

Thanks

Signature · 2 lines
------------------------------
Rongjun Ying
#12 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.

---
-v4:
1. Add SiRF audio port driver split from sirf-soc-inner driver.
2. Use the generic dmaengine pcm register.
3. Add binding document.
4. Use MMIO regmap.

 .../devicetree/bindings/sound/sirf-audio-port.txt  |   20 ++
 sound/soc/Kconfig                                  |    1 +
 sound/soc/Makefile                                 |    1 +
 sound/soc/sirf/Kconfig                             |    9 +
 sound/soc/sirf/Makefile                            |    3 +
 sound/soc/sirf/sirf-audio-port.c                   |  194 ++++++++++++++++++++
 sound/soc/sirf/sirf-audio-port.h                   |   62 +++++++
 7 files changed, 290 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..23946c2 100644
@@ -54,6 +54,7 @@ source "sound/soc/spear/Kconfig"
 source "sound/soc/tegra/Kconfig"
 source "sound/soc/txx9/Kconfig"
 source "sound/soc/ux500/Kconfig"
+source "sound/soc/sirf/Kconfig"
 
 # Supported codecs
 source "sound/soc/codecs/Kconfig"
sound/soc/Makefile +1 -0
index 62a1822..f09210c 100644
@@ -31,3 +31,4 @@ obj-$(CONFIG_SND_SOC)	+= spear/
 obj-$(CONFIG_SND_SOC)	+= tegra/
 obj-$(CONFIG_SND_SOC)	+= txx9/
 obj-$(CONFIG_SND_SOC)	+= ux500/
+obj-$(CONFIG_SND_SOC)	+= sirf/
sound/soc/sirf/Kconfig new file +9 -0
new file mode 100644
index 0000000..5b5407f
@@ -0,0 +1,9 @@
+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
#13 lore raw

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

On Wed, Feb 26, 2014 at 03:22:17PM +0800, RongJun Ying wrote:

A couple of very small issues below but otherwise looks good.

sound/soc/Kconfig source "sound/soc/spear/Kconfig" · line 57

Quoted 8 lines

index d62ce48..23946c2 100644

sound/soc/Kconfig +1 -0
@@ -54,6 +54,7 @@ source "sound/soc/spear/Kconfig"
 source "sound/soc/tegra/Kconfig"
 source "sound/soc/txx9/Kconfig"
 source "sound/soc/ux500/Kconfig"
+source "sound/soc/sirf/Kconfig"

Keep Kconfig and Makefile sorted.

sound/soc/Kconfig source "sound/soc/spear/Kconfig" · line 58

Quoted 1 line
sound/soc/Kconfig +1 -0
+static inline void sirf_audio_port_tx_enable(struct sirf_audio_port *port)

Drop the inlines, let the compiler do it if it decides it's worthwhile.

#14 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                             |    5 +
 sound/soc/sirf/Makefile                            |    2 +
 sound/soc/sirf/sirf-audio.c                        |  156 ++++++++++++++++++++
 4 files changed, 204 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 +5 -0
index 5b5407f..a8e083b 100644
@@ -7,3 +7,8 @@ config SND_SOC_SIRF_AUDIO_PORT
 	select REGMAP_MMIO
 	tristate
 
+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
sound/soc/sirf/Makefile +2 -0
index fb012c8..4eea904 100644
@@ -1,3 +1,5 @@
 snd-soc-sirf-audio-port-objs := sirf-audio-port.o
+snd-soc-sirf-audio-objs := sirf-audio.o
 
 obj-$(CONFIG_SND_SOC_SIRF_AUDIO_PORT) += snd-soc-sirf-audio-port.o
+obj-$(CONFIG_SND_SOC_SIRF_AUDIO) += snd-soc-sirf-audio.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
#15 lore raw

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

In reply to RongJun Ying

From: Rongjun Ying <[email protected]>

iThis 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)

---
-v4:
1. Add binding document.
2. Use MMIO regmap.

 .../devicetree/bindings/sound/sirf-i2s.txt         |   27 ++
 sound/soc/sirf/Kconfig                             |    4 +
 sound/soc/sirf/Makefile                            |    2 +
 sound/soc/sirf/sirf-i2s.c                          |  438 ++++++++++++++++++++
 sound/soc/sirf/sirf-i2s.h                          |   88 ++++
 5 files changed, 559 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 a8e083b..2fca80a 100644
@@ -12,3 +12,7 @@ config SND_SOC_SIRF_AUDIO
 	depends on SND_SOC_SIRF
 	select SND_SOC_SIRF_AUDIO_CODEC
 	select SND_SOC_SIRF_AUDIO_PORT
+
+config SND_SOC_SIRF_I2S
+	select REGMAP_MMIO
+	tristate
sound/soc/sirf/Makefile +2 -0
index 4eea904..2de3cf8 100644
@@ -1,5 +1,7 @@
 snd-soc-sirf-audio-port-objs := sirf-audio-port.o
 snd-soc-sirf-audio-objs := sirf-audio.o
+snd-soc-sirf-i2s-objs := sirf-i2s.o
 
 obj-$(CONFIG_SND_SOC_SIRF_AUDIO_PORT) += snd-soc-sirf-audio-port.o
 obj-$(CONFIG_SND_SOC_SIRF_AUDIO) += snd-soc-sirf-audio.o
+obj-$(CONFIG_SND_SOC_SIRF_I2S) += snd-soc-sirf-i2s.o
sound/soc/sirf/sirf-i2s.c new file +438 -0

438 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
#16 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 2fca80a..dc7c71e 100644
@@ -16,3 +16,9 @@ config SND_SOC_SIRF_AUDIO
 config SND_SOC_SIRF_I2S
 	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
sound/soc/sirf/Makefile +2 -0
index 2de3cf8..ef28a38 100644
@@ -1,7 +1,9 @@
 snd-soc-sirf-audio-port-objs := sirf-audio-port.o
 snd-soc-sirf-audio-objs := sirf-audio.o
 snd-soc-sirf-i2s-objs := sirf-i2s.o
+snd-soc-sirf-hdmi-objs := sirf-hdmi.o
 
 obj-$(CONFIG_SND_SOC_SIRF_AUDIO_PORT) += snd-soc-sirf-audio-port.o
 obj-$(CONFIG_SND_SOC_SIRF_AUDIO) += snd-soc-sirf-audio.o
 obj-$(CONFIG_SND_SOC_SIRF_I2S) += snd-soc-sirf-i2s.o
+obj-$(CONFIG_SND_SOC_SIRF_HDMI) += snd-soc-sirf-hdmi.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
#17 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.

---
-v4:
1. Add binding document.
2. Use MMIO regmap.
3. Use the generic dmaengine pcm register.
4. Remove sirf_usp_*_fifo_op functions and add into sirf_usp_*_enable/disable.

 .../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 dc7c71e..bdd5869 100644
@@ -13,6 +13,10 @@ config SND_SOC_SIRF_AUDIO
 	select SND_SOC_SIRF_AUDIO_CODEC
 	select SND_SOC_SIRF_AUDIO_PORT
 
+config SND_SOC_SIRF_USP
+	select REGMAP_MMIO
+	tristate
+
 config SND_SOC_SIRF_I2S
 	select REGMAP_MMIO
 	tristate
sound/soc/sirf/Makefile +2 -0
index ef28a38..1581b5a 100644
@@ -1,9 +1,11 @@
 snd-soc-sirf-audio-port-objs := sirf-audio-port.o
 snd-soc-sirf-audio-objs := sirf-audio.o
+snd-soc-sirf-usp-objs := sirf-usp.o
 snd-soc-sirf-i2s-objs := sirf-i2s.o
 snd-soc-sirf-hdmi-objs := sirf-hdmi.o
 
 obj-$(CONFIG_SND_SOC_SIRF_AUDIO_PORT) += snd-soc-sirf-audio-port.o
 obj-$(CONFIG_SND_SOC_SIRF_AUDIO) += snd-soc-sirf-audio.o
+obj-$(CONFIG_SND_SOC_SIRF_USP) += snd-soc-sirf-usp.o
 obj-$(CONFIG_SND_SOC_SIRF_I2S) += snd-soc-sirf-i2s.o
 obj-$(CONFIG_SND_SOC_SIRF_HDMI) += snd-soc-sirf-hdmi.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
#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 bdd5869..a24a992 100644
@@ -21,6 +21,12 @@ config SND_SOC_SIRF_I2S
 	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 1581b5a..0d4a6b7 100644
@@ -2,10 +2,12 @@ snd-soc-sirf-audio-port-objs := sirf-audio-port.o
 snd-soc-sirf-audio-objs := sirf-audio.o
 snd-soc-sirf-usp-objs := sirf-usp.o
 snd-soc-sirf-i2s-objs := sirf-i2s.o
+snd-soc-sirf-bt-sco-objs := sirf-bt-sco.o
 snd-soc-sirf-hdmi-objs := sirf-hdmi.o
 
 obj-$(CONFIG_SND_SOC_SIRF_AUDIO_PORT) += snd-soc-sirf-audio-port.o
 obj-$(CONFIG_SND_SOC_SIRF_AUDIO) += snd-soc-sirf-audio.o
 obj-$(CONFIG_SND_SOC_SIRF_USP) += snd-soc-sirf-usp.o
 obj-$(CONFIG_SND_SOC_SIRF_I2S) += snd-soc-sirf-i2s.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
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