From 8836389fc415d4b2bdda1cbdc928ef7dea9dd88d Mon Sep 17 00:00:00 2001 From: ckkim Date: Fri, 22 May 2020 12:21:08 +0900 Subject: [PATCH] ODROID-C4:Support I2S sound card.(HiFi-shield series) Signed-off-by: ckkim Change-Id: I09872a79dd879da6cd606edf1ed97653a4732a44 --- .../boot/dts/amlogic/meson64_odroidc4.dts | 114 +++++++++++++++--- .../boot/dts/amlogic/meson64_odroidn2.dts | 4 - .../dts/amlogic/mesong12_odroid_common.dtsi | 4 + arch/arm64/configs/odroidg12_defconfig | 4 +- sound/soc/amlogic/auge/Kconfig | 1 + sound/soc/amlogic/auge/spdif.c | 3 + 6 files changed, 108 insertions(+), 22 deletions(-) diff --git a/arch/arm64/boot/dts/amlogic/meson64_odroidc4.dts b/arch/arm64/boot/dts/amlogic/meson64_odroidc4.dts index 336ee7f13fdd..932a591e41b9 100644 --- a/arch/arm64/boot/dts/amlogic/meson64_odroidc4.dts +++ b/arch/arm64/boot/dts/amlogic/meson64_odroidc4.dts @@ -625,13 +625,23 @@ compatible = "amlogic, aml_dummy_codec"; status = "okay"; }; + pcm5102a: pcm5102a { + compatible = "ti,pcm5102a"; + #sound-dai-cells = <0>; + status = "okay"; + }; + spdif_dit:spdif{ + #sound-dai-cells = <0>; + compatible = "linux,spdif-dit"; + status = "okay"; + }; amlogic_codec:t9015{ #sound-dai-cells = <0>; compatible = "amlogic, aml_codec_T9015"; reg = <0x0 0xFF632000 0x0 0x2000>; is_auge_used = <1>; /* meson or auge chipset used */ - tocodec_inout = <0>; - tdmout_index = <2>; + tocodec_inout = <1>; + tdmout_index = <0>; status = "okay"; }; audio_effect:eqdrc{ @@ -650,9 +660,9 @@ /* max 0xff, each bit for one channel */ channel_mask = <0x3>; }; - auge_sound { + odroid_hdmi { compatible = "amlogic, g12a-sound-card"; - aml-audio-card,name = "AML-AUGESOUND"; + aml-audio-card,name = "ODROID-HDMI"; /* ODROID-C4: spdif_out GPIOAO_10(J7.2), HDMI out*/ aml-audio-card,dai-link@0 { @@ -663,29 +673,59 @@ system-clock-frequency = <6144000>; }; codec { - sound-dai = <&dummy_codec>; + sound-dai = <&spdif_dit>; }; }; + }; + odroid_hifi { + compatible = "amlogic, g12a-sound-card"; + aml-audio-card,name = "ODROID-HIFI"; + status = "disabled"; /* ODROID-C4: I2S out(J7)*/ - aml-audio-card,dai-link@1 { + aml-audio-card,dai-link@0 { format = "i2s"; mclk-fs = <256>; - bitclock-master = <&tdmb>; - frame-master = <&tdmb>; continuous-clock; + bitclock-master = <&tdma>; + frame-master = <&tdma>; cpu { - sound-dai = <&tdmb>; + sound-dai = <&tdma>; dai-tdm-slot-tx-mask = <1 1>; dai-tdm-slot-num = <2>; dai-tdm-slot-width = <32>; system-clock-frequency = <12288000>; }; codec { - sound-dai = <&dummy_codec>; + sound-dai = <&pcm5102a &dummy_codec>; }; }; }; + odroid_hifi2 { + compatible = "amlogic, g12a-sound-card"; + aml-audio-card,name = "ODROID-HIFI2"; + status = "disabled"; + + /* ODROID-C4: I2S out(J7)*/ + aml-audio-card,dai-link@0 { + format = "i2s"; + mclk-fs = <256>; + continuous-clock; + bitclock-master = <&tdma>; + frame-master = <&tdma>; + cpu { + sound-dai = <&tdma>; + dai-tdm-slot-tx-mask = <1 1>; + dai-tdm-slot-num = <2>; + dai-tdm-slot-width = <32>; + system-clock-frequency = <12288000>; + }; + codec { + sound-dai = <&pcm5242 &dummy_codec>; + }; + }; + }; + audiolocker: locker { compatible = "amlogic, audiolocker"; clocks = <&clkaudio CLKID_AUDIO_LOCKER_OUT @@ -779,20 +819,40 @@ }; /* end of / */ &audiobus { + tdma: tdm@0 { + compatible = "amlogic, sm1-snd-tdma"; + #sound-dai-cells = <0>; + dai-tdm-lane-slot-mask-out = <1 0>; + dai-tdm-clk-sel = <0>; + clocks = <&clkaudio CLKID_AUDIO_MCLK_A + &clkaudio CLKID_AUDIO_MCLK_PAD0 + &clkc CLKID_MPLL0>; + clock-names = "mclk", "mclk_pad", "clk_srcpll"; + pinctrl-names = "tdm_pins"; + pinctrl-0 = <&tdmout_a>; + i2s2hdmi = <0>; + status = "disabled"; + }; + tdmb: tdm@1 { compatible = "amlogic, sm1-snd-tdmb"; #sound-dai-cells = <0>; dai-tdm-lane-slot-mask-out = <1 0 0 0>; dai-tdm-clk-sel = <0>; clocks = <&clkaudio CLKID_AUDIO_MCLK_A + &clkaudio CLKID_AUDIO_MCLK_PAD0 &clkc CLKID_MPLL0>; - clock-names = "mclk", "clk_srcpll"; + clock-names = "mclk", "mclk_pad", "clk_srcpll"; pinctrl-names = "tdm_pins"; - pinctrl-0 = <&tdmb_mclk &tdmout_b>; - mclk_pad = <0>; /* 0: mclk_0; 1: mclk_1 */ + pinctrl-0 = <&tdmb_mclk_ao &tdmout_b_ao>; i2s2hdmi = <0>; + /*enable default mclk(12.288M), before extern codec start*/ + start_clk_enable = <1>; + /*tdm clk tuning enable*/ + clk_tuning_enable = <1>; status = "okay"; }; + spdifa: spdif@0 { compatible = "amlogic, sm1-snd-spdif-a"; #sound-dai-cells = <0>; @@ -938,7 +998,14 @@ }; &pinctrl_periphs { - + tdmout_a: tdmout_a { + mux { + groups = "tdma_sclk", + "tdma_fs", + "tdma_dout0"; + function = "tdma_out"; + }; + }; }; &pinctrl_aobus { @@ -948,14 +1015,14 @@ function = "spdif_out_ao"; }; }; - tdmb_mclk: tdmb_mclk { - mux { + tdmb_mclk_ao: mclk0_ao { + mux { /* GPIOAO_9 */ groups = "mclk0_ao"; function = "mclk0_ao"; drive-strength = <2>; }; }; - tdmout_b: tdmout_b { + tdmout_b_ao: tdmout_b { mux { /* GPIOAO_8, GPIOAO_7, GPIOAO_4 */ groups = "tdmb_sclk_ao", "tdmb_fs_ao", @@ -1058,6 +1125,19 @@ compatible = "nxp,pcf8563"; reg = <0x51>; }; + + pcm5242: pcm5242@4c { + compatible = "ti,pcm5242"; + reg = <0x4c>; + #sound-dai-cells = <0>; + status = "disabled"; + + /* + AVDD-supply = <®_3v3_analog>; + DVDD-supply = <®_1v8>; + CPVDD-supply = <®_3v3>; + */ + }; }; &i2c3 { diff --git a/arch/arm64/boot/dts/amlogic/meson64_odroidn2.dts b/arch/arm64/boot/dts/amlogic/meson64_odroidn2.dts index 0102cdd81f6b..9dd7f308184e 100644 --- a/arch/arm64/boot/dts/amlogic/meson64_odroidn2.dts +++ b/arch/arm64/boot/dts/amlogic/meson64_odroidn2.dts @@ -651,10 +651,6 @@ status = "okay"; }; -&irblaster { - status = "disabled"; -}; - &reboot { sd_volsw_gpio = <&gpio_ao GPIOAO_9 GPIO_ACTIVE_HIGH>; sd_power_gpio = <&gpio_ao GPIOAO_8 GPIO_ACTIVE_HIGH>; diff --git a/arch/arm64/boot/dts/amlogic/mesong12_odroid_common.dtsi b/arch/arm64/boot/dts/amlogic/mesong12_odroid_common.dtsi index 9f74a12816f7..a53b95e3e12e 100644 --- a/arch/arm64/boot/dts/amlogic/mesong12_odroid_common.dtsi +++ b/arch/arm64/boot/dts/amlogic/mesong12_odroid_common.dtsi @@ -157,6 +157,10 @@ status = "okay"; }; +&irblaster { + status = "disabled"; +}; + &i2c2 { status = "okay"; pinctrl-names = "default","gpio_periphs"; diff --git a/arch/arm64/configs/odroidg12_defconfig b/arch/arm64/configs/odroidg12_defconfig index 6db25a16cd53..0a4ea385e32a 100644 --- a/arch/arm64/configs/odroidg12_defconfig +++ b/arch/arm64/configs/odroidg12_defconfig @@ -4529,7 +4529,9 @@ CONFIG_SND_SOC_I2C_AND_SPI=y # CONFIG_SND_SOC_PCM179X_SPI is not set # CONFIG_SND_SOC_PCM3168A_I2C is not set # CONFIG_SND_SOC_PCM3168A_SPI is not set -# CONFIG_SND_SOC_PCM512x_I2C is not set +CONFIG_SND_SOC_PCM5102A=y +CONFIG_SND_SOC_PCM512x=y +CONFIG_SND_SOC_PCM512x_I2C=y # CONFIG_SND_SOC_PCM512x_SPI is not set # CONFIG_SND_SOC_RT5616 is not set # CONFIG_SND_SOC_RT5631 is not set diff --git a/sound/soc/amlogic/auge/Kconfig b/sound/soc/amlogic/auge/Kconfig index eafeb0d45de5..99a320c1a537 100644 --- a/sound/soc/amlogic/auge/Kconfig +++ b/sound/soc/amlogic/auge/Kconfig @@ -1,5 +1,6 @@ menuconfig AMLOGIC_SND_SOC_AUGE bool "Amlogic Auge ASoC" + select SND_SOC_PCM5102A default n help Say Y or M if you want to add support for codecs attached to diff --git a/sound/soc/amlogic/auge/spdif.c b/sound/soc/amlogic/auge/spdif.c index 12bb7854aa0d..fd294240d938 100644 --- a/sound/soc/amlogic/auge/spdif.c +++ b/sound/soc/amlogic/auge/spdif.c @@ -1086,6 +1086,9 @@ static int aml_dai_spdif_probe(struct snd_soc_dai *cpu_dai) __func__); } + /* config ddr arb */ + aml_spdif_arb_config(p_spdif->actrl); + return 0; }