Add audio support for Broadcom Cygnus SoC
Subsystems (4)
v2 cover Add audio support for Broadcom Cygnus SoC
Hi,
This patchset contains audio support for Broadcom's Cygnus SoC. It contains DT bindings and core audio driver. 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-v2
Changes from v1:
- Address code review comments. Fixed print format of type size_t and pointer.
Simran Rai (2):
dt-bindings: sound: Add DT bindings for Broadcom Cygnus audio VOIP-5227 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
PATCH v2 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
@@ -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 · 6 lines
1.7.9.5 -- 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
Mark Brown
maintainerRe: [PATCH v2 1/2] dt-bindings: sound: Add DT bindings for Broadcom Cygnus audio
Documentation/devicetree/bindings/sound/brcm,cygnus-audio.txt line 24
Quoted 5 lines · Simran Rai
+- channel-group: Surround sound grouping that controls which channel
Documentation/devicetree/bindings/sound/brcm,cygnus-audio.txt new file +4
-0+ 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".
I don't really understand what this means or why this is not runtime configured.
Re: [PATCH v2 1/2] dt-bindings: sound: Add DT bindings for Broadcom Cygnus audio
Hi Mark,
Quoted 9 lines · Mark Brown
Documentation/devicetree/bindings/sound/brcm,cygnus-audio.txt line 24
Quoted 5 lines · Simran Rai
+- channel-group: Surround sound grouping that controls which channel
Documentation/devicetree/bindings/sound/brcm,cygnus-audio.txt new file +4
-0+ 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".I don't really understand what this means or why this is not runtime configured.
By runtime configured, do you mean passing the channel grouping through machine file? Is there any specific callback that I can use?
I will implement your suggestions from other patches too and send out next revision by early next week.
Thanks,
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
Mark Brown
maintainerRe: [PATCH v2 1/2] dt-bindings: sound: Add DT bindings for Broadcom Cygnus audio
Quoted 7 lines · Simran Rai
Quoted 5 lines · Mark Brown
Quoted 3 lines · Simran Rai
Documentation/devicetree/bindings/sound/brcm,cygnus-audio.txt new file +3
-0+ 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".
Quoted 5 lines
Quoted 2 lines
I don't really understand what this means or why this is not runtime configured.
By runtime configured, do you mean passing the channel grouping through machine file? Is there any specific callback that I can use?
No, this appears to just be setting the number of channels which is normally configured depending on how many channels userspace is playing.
Re: [PATCH v2 1/2] dt-bindings: sound: Add DT bindings for Broadcom Cygnus audio
Hi Mark,
Quoted 6 lines · Mark Brown
Quoted 5 lines · Simran Rai
Quoted 4 lines · Mark Brown
Quoted 3 lines · Simran Rai
Documentation/devicetree/bindings/sound/brcm,cygnus-audio.txt new file +3
-0+ 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".
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
I don't really understand what this means or why this is not runtime configured.
By runtime configured, do you mean passing the channel grouping through machine file? Is there any specific callback that I can use?
No, this appears to just be setting the number of channels which is normally configured depending on how many channels userspace is playing.
This audio driver uses 'params_channels()' to determine the number of channels requested by userspace in TDM mode (multiple channels on one audio port). Channel grouping is another mode where more than one audio ports are grouped together to form 3.1 or 5.1 surround sound and this feature has been implemented through device tree settings.
At this point, I will take out channel grouping functionality because it does not work as intended. In near future, once this feature is fixed, how do you suggest implementing it in the driver?
Thanks,
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
PATCH v2 2/2 sound: soc: Add Cygnus audio driver
In reply to Simran RaiThis patch adds Cygnus audio driver. It supports I2S, TDM and SPDIF modes and uses three clocks derived from PLL.
This patchset has been tested on Cygnus wireless audio bcm958305K board.
--- 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
@@ -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
@@ -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
Mark Brown
maintainerRe: [PATCH v2 2/2] sound: soc: Add Cygnus audio driver
Quoted 5 lines · Simran Rai
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 ++++
This is a very big patch which contains at least two drivers (a DMA driver and a DAI driver). Please split it into at least per-driver patches for ease of review.
sound/soc/bcm/Kconfig config SND_BCM2835_SOC_I2S · line 27
Quoted 8 lines
sound/soc/bcm/Kconfig +8
-0+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.
These look like extremely specific diagnostics that I'd have expected to be mostly doable using the standard kernel trace infrastructure which is very low overhead and can just be left in the kernel all the time. Why is this a configurable option?
Quoted 4 lines
+/*
+ * Enable diagnostics through menuconfig to debug the time intervals
+ * when each playback interrupt happens.
+ */
This should've been in the Kconfig help text.
sound/soc/bcm/cygnus-pcm.c line 436
Quoted 1 line
sound/soc/bcm/cygnus-pcm.c new file +1
-0+ is_play = (substream->stream ==SNDRV_PCM_STREAM_PLAYBACK );
Why is_play? It's only looked at once and makes things a bit more confusing.
sound/soc/bcm/cygnus-pcm.c line 617
Quoted 12 lines
sound/soc/bcm/cygnus-pcm.c new file +12
-0+/* If playback interrupt happened */ +if (ANY_PLAYBACK_IRQ & r5_status) +handle_playback_irq (cygaud); + +/* If capture interrupt happened */ +if (ANY_CAPTURE_IRQ & r5_status) +handle_capture_irq (cygaud); + +/* +* clear r5 interrupts after servicing them +*/ +writel (r5_status, cygaud->audio +INTH_R5F_CLEAR_OFFSET );
This will ack interrupts we didn't handle, it'd be better to mask out unhandled interrupts.
sound/soc/bcm/cygnus-ssp.c line 469
Quoted 8 lines
sound/soc/bcm/cygnus-ssp.c new file +6
-0+if (aio->port_type ==PORT_TDM ) { + }else if (aio->port_type ==PORT_SPDIF ) { + }else { +dev_err (aio->cygaud->dev,"Port not supported\n" ); +return -EINVAL ; + }
This looks like it should be a switch statement, you've got some other similar constructs in the code.
sound/soc/bcm/cygnus-ssp.c line 736
Quoted 3 lines
sound/soc/bcm/cygnus-ssp.c new file +3
-0+ error =configure_vco (cygaud, p_entry); +if (error) +return error;
We appear to have multiple things calling configure_vco() but I can't see what's ensuring that they all agree with each other about the settings.
sound/soc/bcm/cygnus-ssp.c line 1119
Quoted 3 lines
sound/soc/bcm/cygnus-ssp.c new file +3
-0+/* Slot Width is either 16 or 32 */ +if (slot_width <=16 ) + bits_per_slot =1 ;
The check doesnn't match the comment here.
sound/soc/bcm/cygnus-ssp.c line 1174
Quoted 2 lines
sound/soc/bcm/cygnus-ssp.c new file +2
-0+} +static int cygnus_ssp_resume (struct snd_soc_dai *cpu_dai)
Blank line between functions and remove empty functions. Though I'm not clear why the result doesn't undo what the suspend did...
sound/soc/bcm/cygnus-ssp.c line 1274
Quoted 1 line
sound/soc/bcm/cygnus-ssp.c new file +1
-0+ ssp_regs[0 ] = (struct cygnus_ssp_regs )INIT_SSP_REGS (0 );
Why the casts?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20151104/e64e063f/attachment.sig>
Mark Brown
maintainerQuoted 3 lines · Simran Rai
Simran Rai (2):
dt-bindings: sound: Add DT bindings for Broadcom Cygnus audio VOIP-5227 Add Broadcom Cygnus audio driver.
Please use subject lines matching the style for the subsystem. This
makes it easier for people to identify relevant patches.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20151104/6c1f9047/attachment.sig>