From 4d1e3c608c83e99fc3615cb952c48bb0e8289ffd Mon Sep 17 00:00:00 2001 From: "Kevin.Kim" Date: Fri, 28 Jun 2019 14:21:21 +0900 Subject: [PATCH] ODROID-C4: Add sound card driver Change-Id: Ie91640c3f324076076be6b19b71eb54a74483e1f --- .../boot/dts/amlogic/meson64_odroidc4.dts | 136 ++++++++++ .../dts/amlogic/mesonsm1_odroid_common.dtsi | 235 ------------------ sound/soc/amlogic/auge/spdif_hw.c | 2 +- 3 files changed, 137 insertions(+), 236 deletions(-) diff --git a/arch/arm64/boot/dts/amlogic/meson64_odroidc4.dts b/arch/arm64/boot/dts/amlogic/meson64_odroidc4.dts index bdee97908af6..88396663cd8f 100644 --- a/arch/arm64/boot/dts/amlogic/meson64_odroidc4.dts +++ b/arch/arm64/boot/dts/amlogic/meson64_odroidc4.dts @@ -620,8 +620,144 @@ status = "okay"; }; + /* Audio Related start */ + dummy_codec:dummy{ + #sound-dai-cells = <0>; + compatible = "amlogic, aml_dummy_codec"; + 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>; + status = "okay"; + }; + audio_effect:eqdrc{ + /*eq_enable = <1>;*/ + /*drc_enable = <1>;*/ + /* + * 0:tdmout_a + * 1:tdmout_b + * 2:tdmout_c + * 3:spdifout + * 4:spdifout_b + */ + eqdrc_module = <1>; + /* max 0xf, each bit for one lane, usually one lane */ + lane_mask = <0x1>; + /* max 0xff, each bit for one channel */ + channel_mask = <0x3>; + }; + auge_sound { + compatible = "amlogic, g12a-sound-card"; + aml-audio-card,name = "AML-AUGESOUND"; + + /*avout mute gpio*/ + avout_mute-gpios = <&gpio_ao GPIOAO_2 GPIO_ACTIVE_HIGH>; + + aml-audio-card,dai-link@0 { + mclk-fs = <128>; + continuous-clock; + suffix-name = "alsaPORT-spdif"; + cpu { + sound-dai = <&spdifa>; + system-clock-frequency = <6144000>; + }; + codec { + sound-dai = <&dummy_codec>; + }; + }; + + aml-audio-card,dai-link@1 { + format = "i2s"; + mclk-fs = <256>; + bitclock-master = <&tdmc>; + frame-master = <&tdmc>; + continuous-clock; + suffix-name = "alsaPORT-i2s"; + cpu { + sound-dai = <&tdmc>; + dai-tdm-slot-tx-mask = <1 1>; + dai-tdm-slot-rx-mask = <1 1>; + dai-tdm-slot-num = <2>; + dai-tdm-slot-width = <32>; + system-clock-frequency = <12288000>; + }; + codec { + sound-dai = <&amlogic_codec>; + }; + }; + }; + audiolocker: locker { + compatible = "amlogic, audiolocker"; + clocks = <&clkaudio CLKID_AUDIO_LOCKER_OUT + &clkaudio CLKID_AUDIO_LOCKER_IN + &clkaudio CLKID_AUDIO_MCLK_D + &clkaudio CLKID_AUDIO_MCLK_E + &clkc CLKID_MPLL1 + &clkc CLKID_MPLL2>; + clock-names = "lock_out", "lock_in", "out_src", + "in_src", "out_calc", "in_ref"; + interrupts = ; + interrupt-names = "irq"; + frequency = <49000000>; /* pll */ + dividor = <49>; /* locker's parent */ + status = "okay"; + }; + /* Audio Related end */ }; /* end of / */ +&audiobus { + tdmc: tdm@2 { + compatible = "amlogic, sm1-snd-tdmc"; + #sound-dai-cells = <0>; + dai-tdm-lane-slot-mask-in = <0 1 0 0>; + dai-tdm-lane-slot-mask-out = <1 0 0 0>; + dai-tdm-clk-sel = <2>; + clocks = <&clkaudio CLKID_AUDIO_MCLK_C + &clkc CLKID_MPLL2>; + clock-names = "mclk", "clk_srcpll"; + mclk_pad = <0>; /* 0: mclk_0; 1: mclk_1 */ + i2s2hdmi = <1>; + status = "okay"; + }; + + spdifa: spdif@0 { + compatible = "amlogic, sm1-snd-spdif-a"; + #sound-dai-cells = <0>; + clocks = <&clkc CLKID_MPLL0 + &clkc CLKID_FCLK_DIV4 + &clkaudio CLKID_AUDIO_GATE_SPDIFIN + &clkaudio CLKID_AUDIO_GATE_SPDIFOUT_A + &clkaudio CLKID_AUDIO_SPDIFIN + &clkaudio CLKID_AUDIO_SPDIFOUT_A>; + clock-names = "sysclk", "fixed_clk", "gate_spdifin", + "gate_spdifout", "clk_spdifin", "clk_spdifout"; + interrupts = + ; + + interrupt-names = "irq_spdifin"; + pinctrl-names = "spdif_pins"; + pinctrl-0 = <&spdifout>; + + status = "okay"; + }; + spdifb: spdif@1 { + compatible = "amlogic, sm1-snd-spdif-b"; + #sound-dai-cells = <0>; + clocks = <&clkc CLKID_MPLL0 /*CLKID_HIFI_PLL*/ + &clkaudio CLKID_AUDIO_GATE_SPDIFOUT_B + &clkaudio CLKID_AUDIO_SPDIFOUT_B>; + clock-names = "sysclk", + "gate_spdifout", "clk_spdifout"; + + status = "okay"; + }; +}; /* end of audiobus */ + &uart_A { status = "okay"; }; diff --git a/arch/arm64/boot/dts/amlogic/mesonsm1_odroid_common.dtsi b/arch/arm64/boot/dts/amlogic/mesonsm1_odroid_common.dtsi index f0e6722863b8..74a46210fd66 100644 --- a/arch/arm64/boot/dts/amlogic/mesonsm1_odroid_common.dtsi +++ b/arch/arm64/boot/dts/amlogic/mesonsm1_odroid_common.dtsi @@ -59,118 +59,6 @@ status = "okay"; }; - /* Audio Related start */ - dummy_codec:dummy{ - #sound-dai-cells = <0>; - compatible = "amlogic, aml_dummy_codec"; - 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 */ - tdmout_index = <2>; - status = "okay"; - }; - audio_effect:eqdrc{ - /*eq_enable = <1>;*/ - /*drc_enable = <1>;*/ - /* - * 0:tdmout_a - * 1:tdmout_b - * 2:tdmout_c - * 3:spdifout - * 4:spdifout_b - */ - eqdrc_module = <1>; - /* max 0xf, each bit for one lane, usually one lane */ - lane_mask = <0x1>; - /* max 0xff, each bit for one channel */ - channel_mask = <0x3>; - }; - auge_sound { - compatible = "amlogic, g12a-sound-card"; - aml-audio-card,name = "AML-AUGESOUND"; - /*line-out mute gpio*/ - mute_gpio = <&gpio_ao GPIOAO_2 GPIO_ACTIVE_LOW>; - /*for audio effect ,eqdrc */ - aml-audio-card,effect = <&audio_effect>; - - aml-audio-card,dai-link@0 { - format = "i2s";// "dsp_a"; - mclk-fs = <256>; - bitclock-master = <&aml_tdmc>; - frame-master = <&aml_tdmc>; - continuous-clock; - /* suffix-name, sync with android audio hal - * what's the dai link used for - */ - suffix-name = "alsaPORT-i2s"; - cpu { - sound-dai = <&aml_tdmc>; - dai-tdm-slot-tx-mask = <1 1>; - dai-tdm-slot-rx-mask = <1 1>; - dai-tdm-slot-num = <2>; - dai-tdm-slot-width = <32>; - system-clock-frequency = <12288000>; - }; - codec { - sound-dai = <&amlogic_codec>; - }; - }; - - /* spdif_b to hdmi, only playback */ - aml-audio-card,dai-link@1 { - mclk-fs = <128>; - continuous-clock; - /* suffix-name, sync with android audio hal - * what's the dai link used for - */ - suffix-name = "alsaPORT-spdifb2hdmi"; - cpu { - sound-dai = <&spdifb>; - system-clock-frequency = <6144000>; - }; - codec { - sound-dai = <&dummy_codec>; - }; - }; - - /* spdif_out GPIOA_11 */ - aml-audio-card,dai-link@2 { - mclk-fs = <128>; - /* suffix-name, sync with android audio hal - * what's the dai link used for - */ - suffix-name = "alsaPORT-spdif"; - cpu { - sound-dai = <&spdifa>; - system-clock-frequency = <6144000>; - }; - codec { - sound-dai = <&dummy_codec>; - }; - }; - }; - audiolocker: locker { - compatible = "amlogic, audiolocker"; - clocks = <&clkaudio CLKID_AUDIO_LOCKER_OUT - &clkaudio CLKID_AUDIO_LOCKER_IN - &clkaudio CLKID_AUDIO_MCLK_D - &clkaudio CLKID_AUDIO_MCLK_E - &clkc CLKID_MPLL1 - &clkc CLKID_MPLL2>; - clock-names = "lock_out", "lock_in", "out_src", - "in_src", "out_calc", "in_ref"; - interrupts = ; - interrupt-names = "irq"; - frequency = <49000000>; /* pll */ - dividor = <49>; /* locker's parent */ - status = "okay"; - }; - /* Audio Related end */ - leds { compatible = "gpio-leds"; blueled { @@ -345,129 +233,6 @@ }; }; -&audiobus { - /* tdmc to internal DAC output, no pinmux */ - aml_tdmc: tdmc { - compatible = "amlogic, g12a-snd-tdmc"; - #sound-dai-cells = <0>; - dai-tdm-lane-slot-mask-in = <0 1 0 0>; - dai-tdm-lane-slot-mask-out = <1 0 0 0>; - dai-tdm-clk-sel = <2>; - clocks = <&clkaudio CLKID_AUDIO_MCLK_C - &clkc CLKID_MPLL2>; - clock-names = "mclk", "clk_srcpll"; - i2s2hdmi = <1>; - status = "okay"; - }; - - spdifa: spdif@0 { - compatible = "amlogic, sm1-snd-spdif-a"; - #sound-dai-cells = <0>; - clocks = <&clkc CLKID_MPLL0 - &clkc CLKID_FCLK_DIV4 - &clkaudio CLKID_AUDIO_GATE_SPDIFOUT_A - &clkaudio CLKID_AUDIO_SPDIFOUT_A>; - clock-names = "sysclk", "fixed_clk", "gate_spdifin", - "gate_spdifout", "clk_spdifin", "clk_spdifout"; - interrupts = - ; - - interrupt-names = "irq_spdifin"; - pinctrl-names = "spdif_pins"; - pinctrl-0 = <&spdifout>; - - status = "okay"; - }; - spdifb: spdif@1 { - compatible = "amlogic, sm1-snd-spdif-b"; - #sound-dai-cells = <0>; - clocks = <&clkc CLKID_MPLL0 /*CLKID_HIFI_PLL*/ - &clkaudio CLKID_AUDIO_GATE_SPDIFOUT_B - &clkaudio CLKID_AUDIO_SPDIFOUT_B>; - clock-names = "sysclk", - "gate_spdifout", "clk_spdifout"; - - status = "okay"; - }; - - aml_loopback: loopback { - compatible = "amlogic, snd-loopback"; - /* - * 0: out rate = in data rate; - * 1: out rate = loopback data rate; - */ - lb_mode = <0>; - - /* datain src - * 0: tdmin_a; - * 1: tdmin_b; - * 2: tdmin_c; - * 3: spdifin; - * 4: pdmin; - */ - datain_src = <4>; - datain_chnum = <8>; - datain_chmask = <0x3f>; - - /* tdmin_lb src - * 0: tdmoutA - * 1: tdmoutB - * 2: tdmoutC - * 3: PAD_tdminA - * 4: PAD_tdminB - * 5: PAD_tdminC - */ - datalb_src = <2>; - datalb_chnum = <8>; - datalb_chmask = <0x3>; - - status = "disabled"; - }; - - asrca: resample { - compatible = "amlogic, sm1-resample"; - clocks = <&clkc CLKID_MPLL3 - &clkaudio CLKID_AUDIO_MCLK_F - &clkaudio CLKID_AUDIO_RESAMPLE_A>; - clock-names = "resample_pll", "resample_src", "resample_clk"; - /*same with toddr_src - * TDMIN_A, 0 - * TDMIN_B, 1 - * TDMIN_C, 2 - * SPDIFIN, 3 - * PDMIN, 4 - * NONE, - * TDMIN_LB, 6 - * LOOPBACK, 7 - */ - resample_module = <4>; - status = "disabled"; - }; - aml_pwrdet: pwrdet { - compatible = "amlogic, sm1-power-detect"; - - interrupts = ; - interrupt-names = "pwrdet_irq"; - - /* pwrdet source sel - * 7: loopback; - * 6: tdmin_lb; - * 5: reserved; - * 4: pdmin; - * 3: spdifin; - * 2: tdmin_c; - * 1: tdmin_b; - * 0: tdmin_a; - */ - pwrdet_src = <4>; - - hi_th = <0x70000>; - lo_th = <0x16000>; - - status = "disabled"; - }; -}; /* end of audiobus */ - &audio_data { status = "okay"; }; diff --git a/sound/soc/amlogic/auge/spdif_hw.c b/sound/soc/amlogic/auge/spdif_hw.c index 930e723b126d..42e123d49151 100644 --- a/sound/soc/amlogic/auge/spdif_hw.c +++ b/sound/soc/amlogic/auge/spdif_hw.c @@ -664,7 +664,7 @@ void spdifout_play_with_zerodata(unsigned int spdif_id, bool reenable) /* spdif clk */ //spdifout_clk_ctrl(spdif_id, true); /* spdif to hdmitx */ -#if defined(CONFIG_ARCH_MESON64_ODROID_COMMON) +#if defined(CONFIG_ARCH_MESON64_ODROIDN2) /* ODROID spdif_b only to hdmitx */ if (spdif_id == 1) #endif