PinePhone BT audio bringup
Subsystems (3)
Samuel Holland
maintainerv3 cover PinePhone BT audio bringup
This series uses the additional DAIs added to the sun8i-codec driver to add hardware routing for BT SCO (headset) audio on the PinePhone.
The BT audio connection is represented by the "dummy" bt-sco codec. The connection to the Quectel EG-25G modem via AIF2 works as well, but I do not include it here because there is no appropriate codec driver in tree. We have been using an out-of-tree "dummy" codec driver for the modem similar to bt-sco, and I'm not sure if such a driver would be desired upstream.
Changes from v2:
- Also accept #sound-dai-cells in the binding. Since dt-core.yaml already sets the type of this property, it is not possible to use oneOf, nor make a specific value deprecated.
Changes from v1:
- Fixed DT binding example to follow new binding
Arnaud Ferraris (1):
arm64: dts: allwinner: pinephone: Set audio card name
Samuel Holland (6):
ASoC: dt-bindings: sun8i-codec: Increase #sound-dai-cells
ARM: dts: sun8i-a33: Allow using multiple codec DAIs
arm64: dts: allwinner: a64: Allow using multiple codec DAIs
arm64: dts: allwinner: a64: Add pinmux nodes for AIF2/AIF3
arm64: dts: allwinner: a64: Allow multiple DAI links
arm64: dts: allwinner: pinephone: Add support for Bluetooth audio
.../sound/allwinner,sun8i-a33-codec.yaml | 8 +++- arch/arm/boot/dts/sun8i-a33.dtsi | 4 +- .../dts/allwinner/sun50i-a64-pinephone.dtsi | 25 +++++++++++++ arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi | 37 ++++++++++++++----- 4 files changed, 60 insertions(+), 14 deletions(-)
Signature · 1 line
2.26.3
Samuel Holland
maintainerPATCH v3 1/7 ASoC: dt-bindings: sun8i-codec: Increase #sound-dai-cells
Increase sound-dai-cells to 1 to allow using the DAIs in the codec corresponding to AIF2 and AIF3.
The generic ASoC OF code supports a #sound-dai-cells value of 0 or 1 with no impact to the driver, so this is a backward-compatible change.
--- .../bindings/sound/allwinner,sun8i-a33-codec.yaml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
Documentation/devicetree/bindings/sound/allwinner,sun8i-a33-codec.yaml +6 -2
@@ -12,7 +12,11 @@ maintainers: properties: "#sound-dai-cells": - const: 0 + minimum: 0 + maximum: 1 + description: + A value of 0 is deprecated. When used, it only allows access to + the ADC/DAC and AIF1 (the CPU DAI), not the other two AIFs/DAIs. compatible: oneOf:
@@ -50,7 +54,7 @@ additionalProperties: false examples: - | audio-codec@1c22e00 { - #sound-dai-cells = <0>; + #sound-dai-cells = <1>; compatible = "allwinner,sun8i-a33-codec"; reg = <0x01c22e00 0x400>; interrupts = <0 29 4>;
Signature · 1 line
2.26.3
Re: [PATCH v3 1/7] ASoC: dt-bindings: sun8i-codec: Increase #sound-dai-cells
Quoted 11 lines · Samuel Holland
Increase sound-dai-cells to 1 to allow using the DAIs in the codec corresponding to AIF2 and AIF3.
The generic ASoC OF code supports a #sound-dai-cells value of 0 or 1 with no impact to the driver, so this is a backward-compatible change.
Signed-off-by Samuel Holland <[email protected]>--- .../bindings/sound/allwinner,sun8i-a33-codec.yaml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
Samuel Holland
maintainerPATCH v3 2/7 ARM: dts: sun8i-a33: Allow using multiple codec DAIs
In reply to Samuel HollandIncrease #sound-dai-cells on the digital codec to allow using the other DAIs provided by the codec for AIF2 and AIF3.
--- arch/arm/boot/dts/sun8i-a33.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/boot/dts/sun8i-a33.dtsi +2 -2
@@ -198,7 +198,7 @@ simple-audio-card,cpu { }; link_codec: simple-audio-card,codec { - sound-dai = <&codec>; + sound-dai = <&codec 0>; }; };
@@ -238,7 +238,7 @@ dai: dai@1c22c00 { }; codec: codec@1c22e00 { - #sound-dai-cells = <0>; + #sound-dai-cells = <1>; compatible = "allwinner,sun8i-a33-codec"; reg = <0x01c22e00 0x400>; interrupts = <GIC_SPI 29 IRQ_TYPE_LEVEL_HIGH>;
Signature · 1 line
2.26.3
Samuel Holland
maintainerPATCH v3 3/7 arm64: dts: allwinner: a64: Allow using multiple codec DAIs
In reply to Samuel HollandIncrease #sound-dai-cells on the digital codec to allow using the other DAIs provided by the codec for AIF2 and AIF3.
--- arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi +2 -2
@@ -150,7 +150,7 @@ cpudai: simple-audio-card,cpu { }; link_codec: simple-audio-card,codec { - sound-dai = <&codec>; + sound-dai = <&codec 0>; }; };
@@ -878,7 +878,7 @@ dai: dai@1c22c00 { }; codec: codec@1c22e00 { - #sound-dai-cells = <0>; + #sound-dai-cells = <1>; compatible = "allwinner,sun50i-a64-codec", "allwinner,sun8i-a33-codec"; reg = <0x01c22e00 0x600>;
Signature · 1 line
2.26.3
Samuel Holland
maintainerPATCH v3 4/7 arm64: dts: allwinner: a64: Add pinmux nodes for AIF2/AIF3
In reply to Samuel HollandNow that the sun8i-codec driver supports AIF2 and AIF3, boards can use them in DAI links. Add the necessary pinmux nodes.
--- arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi | 12 ++++++++++++ 1 file changed, 12 insertions(+)
arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi +12 -0
@@ -658,6 +658,18 @@ pio: pinctrl@1c20800 { interrupt-controller; #interrupt-cells = <3>; + /omit-if-no-ref/ + aif2_pins: aif2-pins { + pins = "PB4", "PB5", "PB6", "PB7"; + function = "aif2"; + }; + + /omit-if-no-ref/ + aif3_pins: aif3-pins { + pins = "PG10", "PG11", "PG12", "PG13"; + function = "aif3"; + }; + csi_pins: csi-pins { pins = "PE0", "PE2", "PE3", "PE4", "PE5", "PE6", "PE7", "PE8", "PE9", "PE10", "PE11";
Signature · 1 line
2.26.3
Samuel Holland
maintainerPATCH v3 5/7 arm64: dts: allwinner: a64: Allow multiple DAI links
In reply to Samuel Hollandsimple-audio-card supports either a single DAI link at the top level, or subnodes with one or more DAI links. To use the secondary AIFs on the codec, we need to add additional DAI links to the same sound card, so we need to use the other binding.
--- arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi | 23 +++++++++++-------- 1 file changed, 14 insertions(+), 9 deletions(-)
arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi +14 -9
@@ -131,12 +131,10 @@ psci { }; sound: sound { + #address-cells = <1>; + #size-cells = <0>; compatible = "simple-audio-card"; simple-audio-card,name = "sun50i-a64-audio"; - simple-audio-card,format = "i2s"; - simple-audio-card,frame-master = <&cpudai>; - simple-audio-card,bitclock-master = <&cpudai>; - simple-audio-card,mclk-fs = <128>; simple-audio-card,aux-devs = <&codec_analog>; simple-audio-card,routing = "Left DAC", "DACL",
@@ -145,12 +143,19 @@ sound: sound { "ADCR", "Right ADC"; status = "disabled"; - cpudai: simple-audio-card,cpu { - sound-dai = <&dai>; - }; + simple-audio-card,dai-link@0 { + format = "i2s"; + frame-master = <&link0_cpu>; + bitclock-master = <&link0_cpu>; + mclk-fs = <128>; - link_codec: simple-audio-card,codec { - sound-dai = <&codec 0>; + link0_cpu: cpu { + sound-dai = <&dai>; + }; + + link0_codec: codec { + sound-dai = <&codec 0>; + }; }; };
Signature · 1 line
2.26.3
Samuel Holland
maintainerPATCH v3 6/7 arm64: dts: allwinner: pinephone: Add support for Bluetooth audio
In reply to Samuel HollandThe PinePhone has a Bluetooth chip with its PCM interface connected to AIF3. Add the DAI link so headeset audio can be routed in hardware.
Even though the link is 16 bit PCM, configuring the link a 32-bit slot is required for compatibility with AIF2, which also uses a 32-bit slot, and which shares clock dividers with AIF3. Using equal clock frequencies allows the modem and headset to be used at the same time.
--- .../dts/allwinner/sun50i-a64-pinephone.dtsi | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+)
arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi +24 -0
@@ -25,6 +25,11 @@ backlight: backlight { /* Backlight configuration differs per PinePhone revision. */ }; + bt_sco_codec: bt-sco-codec { + #sound-dai-cells = <1>; + compatible = "linux,bt-sco"; + }; + chosen { stdout-path = "serial0:115200n8"; };
@@ -91,6 +96,8 @@ vibrator { }; &codec { + pinctrl-names = "default"; + pinctrl-0 = <&aif3_pins>; status = "okay"; };
@@ -447,6 +454,23 @@ &sound { "MIC1", "Internal Microphone", "Headset Microphone", "HBIAS", "MIC2", "Headset Microphone"; + + simple-audio-card,dai-link@2 { + format = "dsp_a"; + frame-master = <&link2_codec>; + bitclock-master = <&link2_codec>; + bitclock-inversion; + + link2_cpu: cpu { + sound-dai = <&bt_sco_codec 0>; + }; + + link2_codec: codec { + sound-dai = <&codec 2>; + dai-tdm-slot-num = <1>; + dai-tdm-slot-width = <32>; + }; + }; }; &uart0 {
Signature · 1 line
2.26.3
Samuel Holland
maintainerPATCH v3 7/7 arm64: dts: allwinner: pinephone: Set audio card name
In reply to Samuel HollandFrom: Arnaud Ferraris <[email protected]>
Add the "PinePhone" name to the sound card: this will make upstreaming an ALSA UCM config easier as we can use a unique name.
It also avoids an issue where the default card name is truncated.
--- arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi | 1 + 1 file changed, 1 insertion(+)
arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi +1 -0
@@ -433,6 +433,7 @@ ®_rtc_ldo { &sound { status = "okay"; + simple-audio-card,name = "PinePhone"; simple-audio-card,aux-devs = <&codec_analog>, <&speaker_amp>; simple-audio-card,widgets = "Microphone", "Headset Microphone", "Microphone", "Internal Microphone",
Signature · 1 line
2.26.3
Re: [PATCH v3 7/7] arm64: dts: allwinner: pinephone: Set audio card name
Hi,
Quoted 19 lines · Samuel Holland
From: Arnaud Ferraris <[email protected]>
Add the "PinePhone" name to the sound card: this will make upstreaming an ALSA UCM config easier as we can use a unique name.
It also avoids an issue where the default card name is truncated.
Signed-off-by Arnaud Ferraris <[email protected]>[Samuel: Split out change, updated commit message]Signed-off-by Samuel Holland <[email protected]>--- arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi | 1 + 1 file changed, 1 insertion(+)arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi +0
-0
arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi ®_rtc_ldo { · line 439
Quoted 7 lines
arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi +1
-0@@ -433,6 +433,7 @@ ®_rtc_ldo { &sound { status = "okay"; + simple-audio-card,name = "PinePhone"; simple-audio-card,aux-devs = <&codec_analog>, <&speaker_amp>; simple-audio-card,widgets = "Microphone", "Headset Microphone", "Microphone", "Internal Microphone",
Isn't that reported to the userspace? I'm not sure we can just change it without breaking it.
Maxime
Samuel Holland
maintainerRe: [PATCH v3 7/7] arm64: dts: allwinner: pinephone: Set audio card name
Quoted 23 lines · Maxime Ripard
Hi,
Quoted 20 lines · Samuel Holland
From: Arnaud Ferraris <[email protected]>
Add the "PinePhone" name to the sound card: this will make upstreaming an ALSA UCM config easier as we can use a unique name.
It also avoids an issue where the default card name is truncated.
Signed-off-by Arnaud Ferraris <[email protected]>[Samuel: Split out change, updated commit message]Signed-off-by Samuel Holland <[email protected]>--- arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi | 1 + 1 file changed, 1 insertion(+)arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi +0
-0@@ -433,6 +433,7 @@ ®_rtc_ldo {
Quoted 9 lines
arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi ®_rtc_ldo { · line 439
Quoted 6 lines
arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi +1
-0&sound { status = "okay"; + simple-audio-card,name = "PinePhone"; simple-audio-card,aux-devs = <&codec_analog>, <&speaker_amp>; simple-audio-card,widgets = "Microphone", "Headset Microphone", "Microphone", "Internal Microphone",Isn't that reported to the userspace? I'm not sure we can just change it without breaking it.
Yes, this is seen by userspace.
Ideally, we would add this property with a unique value when enabling audio for any board, but as you mention, it would be a breaking change to add those properties now.
In practice, all distributions supporting the PinePhone are already carrying this patch, because the ALSA setup needed for the PinePhone is very different from most other boards. So it would be similarly breaking for them (and their users) to drop this patch.
Regards,
Samuel
Re: [PATCH v3 7/7] arm64: dts: allwinner: pinephone: Set audio card name
Quoted 18 lines · Samuel Holland
Quoted 17 lines · Maxime Ripard
Hi,
Quoted 14 lines · Samuel Holland
From: Arnaud Ferraris <[email protected]>
Add the "PinePhone" name to the sound card: this will make upstreaming an ALSA UCM config easier as we can use a unique name.
It also avoids an issue where the default card name is truncated.
Signed-off-by Arnaud Ferraris <[email protected]>[Samuel: Split out change, updated commit message]Signed-off-by Samuel Holland <[email protected]>--- arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi | 1 + 1 file changed, 1 insertion(+)
Quoted 3 lines
Quoted 3 lines
arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi
Quoted 3 lines
arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi +0
-1--- a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi
g> >> +++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi
Quoted 14 lines
Quoted 11 lines
arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi ®_rtc_ldo { · line 439
Quoted 8 lines
arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi +1
-0@@ -433,6 +433,7 @@ ®_rtc_ldo { &sound { status = "okay"; + simple-audio-card,name = "PinePhone"; simple-audio-card,aux-devs = <&codec_analog>, <&speaker_amp>; simple-audio-card,widgets = "Microphone", "Headset Microphone", "Microphone", "Internal Microphone",Isn't that reported to the userspace? I'm not sure we can just change it without breaking it.
Yes, this is seen by userspace.
Quoted 8 lines
Ideally, we would add this property with a unique value when enabling audio for any board, but as you mention, it would be a breaking change to add those properties now.
In practice, all distributions supporting the PinePhone are already carrying this patch, because the ALSA setup needed for the PinePhone is very different from most other boards. So it would be similarly breaking for them (and their users) to drop this patch.
Ack :)
Since no one else complained, I merged this patch too
Thanks!
Maxime
Quoted 9 lines · Samuel Holland
This series uses the additional DAIs added to the sun8i-codec driver to add hardware routing for BT SCO (headset) audio on the PinePhone.
The BT audio connection is represented by the "dummy" bt-sco codec. The connection to the Quectel EG-25G modem via AIF2 works as well, but I do not include it here because there is no appropriate codec driver in tree. We have been using an out-of-tree "dummy" codec driver for the modem similar to bt-sco, and I'm not sure if such a driver would be desired upstream.
I've applied patches 1-6
Maxime
Mark Brown
maintainerRe: (subset) [PATCH v3 0/7] PinePhone BT audio bringup
In reply to Samuel HollandQuoted 11 lines · Samuel Holland
This series uses the additional DAIs added to the sun8i-codec driver to add hardware routing for BT SCO (headset) audio on the PinePhone.
The BT audio connection is represented by the "dummy" bt-sco codec. The connection to the Quectel EG-25G modem via AIF2 works as well, but I do not include it here because there is no appropriate codec driver in tree. We have been using an out-of-tree "dummy" codec driver for the modem similar to bt-sco, and I'm not sure if such a driver would be desired upstream.
[...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
Thanks!
[1/7] ASoC: dt-bindings: sun8i-codec: Increase #sound-dai-cells
commit: 880e007f15a31f446b9e1713720c6ae5a539f3f4
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark