Add support for audiocodec in Allwinner A64
Subsystems (4)
v7 cover Add support for audiocodec in Allwinner A64
v2: - Use simple-amplifier for speaker amp on Pinebook
- Rename sun50i-a64-i2s to sun50i-a64-codec-i2s to preserve compatible string for other 3 I2S modules in A64 in case if there's any incompatibility with H3
v3: - renamed sunxi-adda-pr-regmap to sun8i-adda-pr-regmap
- use ilog2() to calculate reg value for LRCK div instead of using a table
v4: - dts: don't use 'Mic' and 'Headset Mic' widgets from sun8i-codec,
define our board-level widgets instead.
v5: - collect all the tags
v6: - driver patches has been merged through ASoC tree
- rebase onto 4.20-rc1
- Drop 'Speaker' from routes on sopine and pine64, they don't have speaker.
v7: - drop 'Mic' and 'Headset Mic' from dtsi
- move AIF1 Slot 0 ADC to ADC route to sun8i-codec
- drop BIAS routes for Pine64 and SoPine
Vasily Khoruzhick (4):
ASoC: sun8i-codec: add missing route for ADC
arm64: dts: allwinner: a64: add nodes necessary for analog sound
support
arm64: dts: allwinner: a64: enable sound on Pine64 and SoPine
arm64: dts: allwinner: a64: enable sound on Pinebook
.../boot/dts/allwinner/sun50i-a64-pine64.dts | 25 +++++++++ .../dts/allwinner/sun50i-a64-pinebook.dts | 40 ++++++++++++++ .../allwinner/sun50i-a64-sopine-baseboard.dts | 25 +++++++++ arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi | 54 +++++++++++++++++++ sound/soc/sunxi/sun8i-codec.c | 6 ++- 5 files changed, 149 insertions(+), 1 deletion(-)
Signature · 1 line
2.19.1
PATCH v7 1/4 ASoC: sun8i-codec: add missing route for ADC
sun8i-codec misses a route from ADC to AIF1 Slot 0 ADC. Add it to the driver to avoid adding it to every dts.
--- sound/soc/sunxi/sun8i-codec.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
sound/soc/sunxi/sun8i-codec.c +5 -1
@@ -481,7 +481,11 @@ static const struct snd_soc_dapm_route sun8i_codec_dapm_routes[] = { {"Right Digital DAC Mixer" ,"AIF1 Slot 0 Digital DAC Playback Switch" , "AIF1 Slot 0 Right"}, -/* ADC routes */ +/* ADC Routes */ + { "AIF1 Slot 0 Right ADC", NULL, "ADC" }, + { "AIF1 Slot 0 Left ADC", NULL, "ADC" }, + +/* ADC Mixer Routes */ { "Left Digital ADC Mixer", "AIF1 Data Digital ADC Capture Switch", "AIF1 Slot 0 Left ADC" }, { "Right Digital ADC Mixer", "AIF1 Data Digital ADC Capture Switch",
Signature · 1 line
2.19.1
Mark Brown
maintainerApplied "ASoC: sun8i-codec: add missing route for ADC" to the asoc tree
The patch
ASoC: sun8i-codec: add missing route for ADC
has been applied to the asoc tree at
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git
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
Quoted 1 line
From
9ee325d029c4abb75716851ce38863845911d605Mon Sep 17 00:00:00 2001
From: Vasily Khoruzhick <[email protected]>
Date: Thu, 8 Nov 2018 20:24:19 -0800
Subject: [PATCH] ASoC: sun8i-codec: add missing route for ADC
sun8i-codec misses a route from ADC to AIF1 Slot 0 ADC. Add it to the driver to avoid adding it to every dts.
--- sound/soc/sunxi/sun8i-codec.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
sound/soc/sunxi/sun8i-codec.c +5 -1
@@ -481,7 +481,11 @@ static const struct snd_soc_dapm_route sun8i_codec_dapm_routes[] = { {"Right Digital DAC Mixer" ,"AIF1 Slot 0 Digital DAC Playback Switch" , "AIF1 Slot 0 Right"}, -/* ADC routes */ +/* ADC Routes */ + { "AIF1 Slot 0 Right ADC", NULL, "ADC" }, + { "AIF1 Slot 0 Left ADC", NULL, "ADC" }, + +/* ADC Mixer Routes */ { "Left Digital ADC Mixer", "AIF1 Data Digital ADC Capture Switch", "AIF1 Slot 0 Left ADC" }, { "Right Digital ADC Mixer", "AIF1 Data Digital ADC Capture Switch",
Signature · 1 line
2.19.1
PATCH v7 2/4 arm64: dts: allwinner: a64: add nodes necessary for analog sound support
In reply to Vasily KhoruzhickAdd nodes for i2s, digital and analog parts of audiocodec on A64
--- arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi | 54 +++++++++++++++++++ 1 file changed, 54 insertions(+)
arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi +54 -0
@@ -173,6 +173,30 @@ compatible = "linux,spdif-dit"; }; + sound: sound { + 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 = <512>; + simple-audio-card,aux-devs = <&codec_analog>; + simple-audio-card,routing = + "Left DAC", "AIF1 Slot 0 Left", + "Right DAC", "AIF1 Slot 0 Right", + "AIF1 Slot 0 Left ADC", "Left ADC", + "AIF1 Slot 0 Right ADC", "Right ADC"; + status = "disabled"; + + cpudai: simple-audio-card,cpu { + sound-dai = <&dai>; + }; + + link_codec: simple-audio-card,codec { + sound-dai = <&codec>; + }; + }; + timer { compatible = "arm,armv8-timer"; interrupts = <GIC_PPI 13
@@ -665,6 +689,30 @@ status = "disabled"; }; + dai: dai@1c22c00 { + #sound-dai-cells = <0>; + compatible = "allwinner,sun50i-a64-codec-i2s"; + reg = <0x01c22c00 0x200>; + interrupts = <GIC_SPI 29 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&ccu CLK_BUS_CODEC>, <&ccu CLK_AC_DIG>; + clock-names = "apb", "mod"; + resets = <&ccu RST_BUS_CODEC>; + reset-names = "rst"; + dmas = <&dma 15>, <&dma 15>; + dma-names = "rx", "tx"; + status = "disabled"; + }; + + codec: codec at 1c22e00 { + #sound-dai-cells = <0>; + compatible = "allwinner,sun8i-a33-codec"; + reg = <0x01c22e00 0x600>; + interrupts = <GIC_SPI 28 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&ccu CLK_BUS_CODEC>, <&ccu CLK_AC_DIG>; + clock-names = "bus", "mod"; + status = "disabled"; + }; + uart0: serial at 1c28000 { compatible = "snps,dw-apb-uart"; reg = <0x01c28000 0x400>;
@@ -902,6 +950,12 @@ #reset-cells = <1>; }; + codec_analog: codec-analog at 1f015c0 { + compatible = "allwinner,sun50i-a64-codec-analog"; + reg = <0x01f015c0 0x4>; + status = "disabled"; + }; + r_i2c: i2c at 1f02400 { compatible = "allwinner,sun50i-a64-i2c", "allwinner,sun6i-a31-i2c";
Signature · 1 line
2.19.1
PATCH v7 3/4 arm64: dts: allwinner: a64: enable sound on Pine64 and SoPine
In reply to Vasily KhoruzhickThis commit enables I2S, digital and analog parts of audiocodec on Pine64 and SoPine boards.
--- .../boot/dts/allwinner/sun50i-a64-pine64.dts | 25 +++++++++++++++++++ .../allwinner/sun50i-a64-sopine-baseboard.dts | 25 +++++++++++++++++++ 2 files changed, 50 insertions(+)
arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts +25 -0
@@ -75,6 +75,18 @@ }; }; +&codec { + status = "okay"; +}; + +&codec_analog { + status = "okay"; +}; + +&dai { + status = "okay"; +}; + &de { status = "okay"; };
@@ -264,6 +276,19 @@ status = "disabled"; }; +&sound { + status = "okay"; + simple-audio-card,widgets = "Microphone", "Microphone Jack", + "Headphone", "Headphone Jack"; + simple-audio-card,routing = + "Left DAC", "AIF1 Slot 0 Left", + "Right DAC", "AIF1 Slot 0 Right", + "Headphone Jack", "HP", + "AIF1 Slot 0 Left ADC", "Left ADC", + "AIF1 Slot 0 Right ADC", "Right ADC", + "MIC2", "Microphone Jack"; +}; + /* On Exp and Euler connectors */ &uart0 { pinctrl-names = "default";
arch/arm64/boot/dts/allwinner/sun50i-a64-sopine-baseboard.dts +25 -0
@@ -80,6 +80,18 @@ }; }; +&codec { + status = "okay"; +}; + +&codec_analog { + status = "okay"; +}; + +&dai { + status = "okay"; +}; + &de { status = "okay"; };
@@ -164,6 +176,19 @@ vcc-hdmi-supply = <®_dldo1>; }; +&sound { + status = "okay"; + simple-audio-card,widgets = "Microphone", "Microphone Jack", + "Headphone", "Headphone Jack"; + simple-audio-card,routing = + "Left DAC", "AIF1 Slot 0 Left", + "Right DAC", "AIF1 Slot 0 Right", + "Headphone Jack", "HP", + "AIF1 Slot 0 Left ADC", "Left ADC", + "AIF1 Slot 0 Right ADC", "Right ADC", + "MIC2", "Microphone Jack"; +}; + &uart0 { pinctrl-names = "default"; pinctrl-0 = <&uart0_pb_pins>;
Signature · 1 line
2.19.1
PATCH v7 4/4 arm64: dts: allwinner: a64: enable sound on Pinebook
In reply to Vasily KhoruzhickThis commit enables I2S, digital and analog parts of audiocodec on Pinebook
--- .../dts/allwinner/sun50i-a64-pinebook.dts | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+)
arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts +40 -0
@@ -64,6 +64,23 @@ compatible = "mmc-pwrseq-simple"; reset-gpios = <&r_pio 0 2 GPIO_ACTIVE_LOW>; /* PL2 */ }; + + speaker_amp: speaker_amp { + compatible = "simple-audio-amplifier"; + enable-gpios = <&pio 7 7 GPIO_ACTIVE_HIGH>; /* PH7 */ + }; +}; + +&codec { + status = "okay"; +}; + +&codec_analog { + status = "okay"; +}; + +&dai { + status = "okay"; }; &ehci0 {
@@ -267,6 +284,29 @@ vcc-hdmi-supply = <®_dldo1>; }; +&sound { + status = "okay"; + simple-audio-card,widgets = "Microphone", "Internal Microphone Left", + "Microphone", "Internal Microphone Right", + "Headphone", "Headphone Jack", + "Speaker", "Internal Speaker"; + simple-audio-card,aux-devs = <&codec_analog>, <&speaker_amp>; + simple-audio-card,routing = + "Left DAC", "AIF1 Slot 0 Left", + "Right DAC", "AIF1 Slot 0 Right", + "INL", "LINEOUT", + "INR", "LINEOUT", + "Internal Speaker", "OUTL", + "Internal Speaker", "OUTR", + "Headphone Jack", "HP", + "AIF1 Slot 0 Left ADC", "Left ADC", + "AIF1 Slot 0 Right ADC", "Right ADC", + "Internal Microphone Left", "MBIAS", + "MIC1", "Internal Microphone Left", + "Internal Microphone Right", "HBIAS", + "MIC2", "Internal Microphone Right"; +}; + &uart0 { pinctrl-names = "default"; pinctrl-0 = <&uart0_pb_pins>;
Signature · 1 line
2.19.1