Skip to contentSkip to conversation

Add audio support for Broadcom Cygnus SoC

PATCH Superseded Simran Rai 3 participants 7 messages Oct 30, 2015

Subsystems (4)

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

Simran Rai

author
#0 lore raw

cover Add audio support for Broadcom Cygnus SoC

Hi,

This patchset contains audio support for Broadcom's Cygnus SoC. It contains DT bindings, core audio driver and dts. The audio driver supports both capture and playback of Audio PCM samples over I2S/TDM interface and provides playback support over SPDIF interface.

This patchset is derived from a previously submitted patchset:
http://lkml.iu.edu/hypermail/linux/kernel/1503.3/05434.html

This patchset has been tested on Cygnus wireless audio bcm958305K board. It is based on v4.3-rc5 and is available from github:

repo: https://github.com/Broadcom/cygnus-linux/tree/cygnus-sound-v1

Simran Rai (2):
dt-bindings: sound: Add DT bindings for Broadcom Cygnus audio
sound: soc: Add Broadcom Cygnus audio driver.

 .../bindings/sound/brcm,cygnus-audio.txt           |   63 +
 sound/soc/bcm/Kconfig                              |   18 +
 sound/soc/bcm/Makefile                             |    5 +
 sound/soc/bcm/cygnus-pcm.c                         |  903 ++++++++++++
 sound/soc/bcm/cygnus-ssp.c                         | 1532 ++++++++++++++++++++
 sound/soc/bcm/cygnus-ssp.h                         |  129 ++
 6 files changed, 2650 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/sound/brcm,cygnus-audio.txt
 create mode 100644 sound/soc/bcm/cygnus-pcm.c
 create mode 100644 sound/soc/bcm/cygnus-ssp.c
 create mode 100644 sound/soc/bcm/cygnus-ssp.h
Signature · 1 line
1.7.9.5
author
#1 lore raw

PATCH 1/2 dt-bindings: sound: Add DT bindings for Broadcom Cygnus audio

Add bindings for audio driver in Broadcom Cygnus.

---
 .../bindings/sound/brcm,cygnus-audio.txt           |   63 ++++++++++++++++++++
 1 file changed, 63 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/sound/brcm,cygnus-audio.txt
Documentation/devicetree/bindings/sound/brcm,cygnus-audio.txt new file +63 -0
new file mode 100644
index 0000000..73cddb3
@@ -0,0 +1,63 @@
+BROADCOM Cygnus Audio I2S/TDM/SPDIF controller
+
+Required properties:
+	- compatible : "brcm,cygnus-audio"
+	- #address-cells: 32bit valued, 1 cell.
+	- #size-cells:  32bit valued, 0 cell.
+	- reg : Should contain audio registers location and length
+	- reg-names: names of the registers listed in "reg" property
+		Valid names are "aud" and "i2s_in". "aud" contains a
+		set of DMA, I2S_OUT and SPDIF registers. "i2s_in" contains
+		a set of I2S_IN registers.
+	- clocks: PLL and leaf clocks used by audio ports
+	- clock-names: names of 3 leaf clocks used by audio ports
+		Valid names are "ch0_audio", "ch1_audio", "ch2_audio"
+	- interrupts: audio DMA interrupt number
+
+SSP Subnode properties:
+- reg: The index of ssp port interface to use
+	Valid value are 0, 1, 2, or 3 (for spdif)
+- channel-group: Surround sound grouping that controls which channel
+  outputs belong to a group, specifically useful in Multi-channel
+  Interfaces grouping of serial port. In multi-channel stereo, use
+  "2_0", in 3.1 multi-channel grouping, use "3_1" and in 5.1
+  multi-channel grouping, use "5_1".
+
+
+Example:
+	cygnus_audio: audio@180ae000 {
+		compatible = "brcm,cygnus-audio";
+		#address-cells = <1>;
+		#size-cells = <0>;
+		reg = <0x180ae000 0xafd>, <0x180aec00 0x1f8>;
+		reg-names = "aud", "i2s_in";
+		clocks = <&audiopll BCM_CYGNUS_AUDIOPLL_CH0>,
+				<&audiopll BCM_CYGNUS_AUDIOPLL_CH1>,
+				<&audiopll BCM_CYGNUS_AUDIOPLL_CH2>;
+		clock-names = "ch0_audio", "ch1_audio", "ch2_audio";
+		interrupts = <GIC_SPI 143 IRQ_TYPE_LEVEL_HIGH>;
+
+		ssp0: ssp_port@0 {
+			reg = <0>;
+			channel-group = "2_0"; /* Use 2_0, 3_1, 5_1 */
+			status = "okay";
+		};
+
+		ssp1: ssp_port@1 {
+			reg = <1>;
+			channel-group = "2_0"; /* Use 2_0, 3_1, 5_1 */
+			status = "disabled";
+		};
+
+		ssp2: ssp_port@2 {
+			reg = <2>;
+			channel-group = "2_0"; /* Use 2_0, 3_1, 5_1 */
+			status = "disabled";
+		};
+
+		spdif: spdif_port@3 {
+			reg = <3>;
+			channel-group = "2_0"; /* Use 2_0, 3_1, 5_1 */
+			status = "disabled";
+		};
+	};
Signature · 1 line
1.7.9.5
author
#2 lore raw

PATCH 2/2 sound: soc: Add Cygnus audio driver

In reply to Simran Rai

This patch adds Cygnus audio driver. It supports I2S, TDM and SPDIF modes and uses three clocks derived from PLL.

---
 sound/soc/bcm/Kconfig      |   18 +
 sound/soc/bcm/Makefile     |    5 +
 sound/soc/bcm/cygnus-pcm.c |  903 ++++++++++++++++++++++++++
 sound/soc/bcm/cygnus-ssp.c | 1532 ++++++++++++++++++++++++++++++++++++++++++++
 sound/soc/bcm/cygnus-ssp.h |  129 ++++
 5 files changed, 2587 insertions(+)
 create mode 100644 sound/soc/bcm/cygnus-pcm.c
 create mode 100644 sound/soc/bcm/cygnus-ssp.c
 create mode 100644 sound/soc/bcm/cygnus-ssp.h
sound/soc/bcm/Kconfig +18 -0
index 6a834e1..4015b35 100644
@@ -7,3 +7,21 @@ config SND_BCM2835_SOC_I2S
 	  Say Y or M if you want to add support for codecs attached to
 	  the BCM2835 I2S interface. You will also need
 	  to select the audio interfaces to support below.
+
+config SND_SOC_CYGNUS
+	tristate "SoC platform audio for Broadcom Cygnus chips"
+	depends on ARCH_BCM_CYGNUS || COMPILE_TEST
+	help
+	  Say Y if you want to add support for ASoC audio on Broadcom
+	  Cygnus chips (bcm958300, bcm958305, bcm911360)
+
+	  If you don't know what to do here, say N.
+
+config SND_SOC_CYGNUS_DIAG
+	bool "SoC platform audio for Broadcom Cygnus chips diagnostics"
+	depends on SND_SOC_CYGNUS
+	help
+	  Say Y if you want to add diagnostics support in ASoC audio
+	  on Broadcom Cygnus chips (bcm958300, bcm958305, bcm911360)
+
+	  If you don't know what to do here, say N.
sound/soc/bcm/Makefile +5 -0
index bc816b7..fc739d0 100644
@@ -3,3 +3,8 @@ snd-soc-bcm2835-i2s-objs := bcm2835-i2s.o
 
 obj-$(CONFIG_SND_BCM2835_SOC_I2S) += snd-soc-bcm2835-i2s.o
 
+# CYGNUS Platform Support
+snd-soc-cygnus-objs := cygnus-pcm.o cygnus-ssp.o
+
+obj-$(CONFIG_SND_SOC_CYGNUS) += snd-soc-cygnus.o
+
sound/soc/bcm/cygnus-pcm.c new file +903 -0

903 lines not on this page · raw message

sound/soc/bcm/cygnus-ssp.c new file +1532 -0

1,532 lines not on this page · raw message

sound/soc/bcm/cygnus-ssp.h new file +129 -0

129 lines not on this page · raw message

Signature · 1 line
1.7.9.5
#3 lore raw

Re: [PATCH 2/2] sound: soc: Add Cygnus audio driver

reproduce:

Hi Simran,

[auto build test WARNING on asoc/for-next -- if it's inappropriate base, please suggest rules for selecting the more suitable base]

url:    https://github.com/0day-ci/linux/commits/Simran-Rai/Add-audio-support-for-Broadcom-Cygnus-SoC/20151031-025721
config: x86_64-allmodconfig (attached as .config)
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All warnings (new ones prefixed by >>):

In file included from include/linux/printk.h:277:0,

                    from include/linux/kernel.h:13,
                    from include/linux/list.h:8,
                    from include/linux/wait.h:6,
                    from include/linux/fs.h:5,
                    from include/linux/debugfs.h:18,
                    from sound/soc/bcm/cygnus-pcm.c:13:
   sound/soc/bcm/cygnus-pcm.c: In function 'cygnus_pcm_preallocate_dma_buffer':
>> sound/soc/bcm/cygnus-pcm.c:785:29: warning: format '%x' expects argument of type 'unsigned int', but argument 5 has type 'size_t {aka long unsigned int}' [-Wformat=]
     dev_dbg(rtd->cpu_dai->dev, "%s: size 0x%x @ 0x%p\n",
                                ^
   include/linux/dynamic_debug.h:86:39: note: in definition of macro 'dynamic_dev_dbg'
      __dynamic_dev_dbg(&descriptor, dev, fmt, \
                                          ^
>> sound/soc/bcm/cygnus-pcm.c:785:2: note: in expansion of macro 'dev_dbg'
     dev_dbg(rtd->cpu_dai->dev, "%s: size 0x%x @ 0x%p\n",
     ^

vim +785 sound/soc/bcm/cygnus-pcm.c

769
770 static int cygnus_pcm_preallocate_dma_buffer(struct snd_pcm *pcm, int stream)
771 {
772 struct snd_pcm_substream *substream = pcm->streams[stream].substream;
773 struct snd_soc_pcm_runtime *rtd = substream->private_data;
774 struct snd_dma_buffer *buf = &substream->dma_buffer;
775 size_t size;
776
777 size = cygnus_pcm_hw.buffer_bytes_max;
778
779 buf->dev.type = SNDRV_DMA_TYPE_DEV;
780 buf->dev.dev = pcm->card->dev;
781 buf->private_data = NULL;
782 buf->area = dma_alloc_coherent(pcm->card->dev, size,
783 &buf->addr, GFP_KERNEL);
784

 > 785		dev_dbg(rtd->cpu_dai->dev, "%s: size 0x%x @ 0x%p\n",

786 __func__, size, buf->area);
787
788 if (!buf->area) {
789 dev_err(rtd->cpu_dai->dev, "%s: dma_alloc failed\n", __func__);
790 return -ENOMEM;
791 }
792 buf->bytes = size;
793

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

#4 lore raw

Re: [PATCH 2/2] sound: soc: Add Cygnus audio driver

In reply to Simran Rai
reproduce: wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # save the attached .config to linux build tree…

Hi Simran,

[auto build test WARNING on asoc/for-next -- if it's inappropriate base, please suggest rules for selecting the more suitable base]

url:    https://github.com/0day-ci/linux/commits/Simran-Rai/Add-audio-support-for-Broadcom-Cygnus-SoC/20151031-025721
config: tile-allmodconfig (attached as .config)

reproduce:
wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=tile

All warnings (new ones prefixed by >>):

sound/soc/bcm/cygnus-pcm.c: In function 'cygnus_pcm_preallocate_dma_buffer':

>> sound/soc/bcm/cygnus-pcm.c:785:2: warning: format '%x' expects argument of type 'unsigned int', but argument 5 has type 'size_t' [-Wformat]

vim +785 sound/soc/bcm/cygnus-pcm.c

769
770 static int cygnus_pcm_preallocate_dma_buffer(struct snd_pcm *pcm, int stream)
771 {
772 struct snd_pcm_substream *substream = pcm->streams[stream].substream;
773 struct snd_soc_pcm_runtime *rtd = substream->private_data;
774 struct snd_dma_buffer *buf = &substream->dma_buffer;
775 size_t size;
776
777 size = cygnus_pcm_hw.buffer_bytes_max;
778
779 buf->dev.type = SNDRV_DMA_TYPE_DEV;
780 buf->dev.dev = pcm->card->dev;
781 buf->private_data = NULL;
782 buf->area = dma_alloc_coherent(pcm->card->dev, size,
783 &buf->addr, GFP_KERNEL);
784

 > 785		dev_dbg(rtd->cpu_dai->dev, "%s: size 0x%x @ 0x%p\n",

786 __func__, size, buf->area);
787
788 if (!buf->area) {
789 dev_err(rtd->cpu_dai->dev, "%s: dma_alloc failed\n", __func__);
790 return -ENOMEM;
791 }
792 buf->bytes = size;
793

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

#5 lore raw

Re: [PATCH 2/2] sound: soc: Add Cygnus audio driver

Quoted 3 lines · On Saturday 31 October 2015 07:20:17 kbuild test robot wrote:
Quoted 1 line

785 dev_dbg(rtd->cpu_dai->dev, "%s: size 0x%x @ 0x%p\n",

786 __func__, size, buf->area);

Both reports are for the same bug: the "0x%x" should be "0x%zx".

There is another bug in the same line: "0x%p" should be "%pK", to avoid the duplicate "0x" and to not leak the pointer when kptr_restrict is set.

Arnd

author
#6 lore raw

Re: [PATCH 2/2] sound: soc: Add Cygnus audio driver

Hi Arnd,

Quoted 11 lines · Arnd Bergmann
Quoted 3 lines · On Saturday 31 October 2015 07:20:17 kbuild test robot wrote:
Quoted 1 line

785 dev_dbg(rtd->cpu_dai->dev, "%s: size 0x%x @ 0x%p\n",

    786                                  __func__, size, buf->area);

Both reports are for the same bug: the "0x%x" should be "0x%zx".

There is another bug in the same line: "0x%p" should be "%pK", to avoid the duplicate "0x" and to not leak the pointer when kptr_restrict is set.

Arnd

I will fix both of these in the next patchset, early next week. If there are any other comments/suggestions, please let me know. Thanks for the feedback.

Simran
--
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