From: Xing Wang Date: Thu, 24 May 2018 15:30:01 +0000 (+0800) Subject: audio: auge: fix hdmi pop noise when bootup X-Git-Tag: khadas-vims-v0.9.6-release~1669 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d4ef94cef831005501829ef1f6c07a9490b35af3;p=platform%2Fkernel%2Flinux-amlogic.git audio: auge: fix hdmi pop noise when bootup PD#165171: audio: auge: fix hdmi pop noise when bootup Change-Id: Ic8186b230c5c27966467e35d23b8c041309e6922 Signed-off-by: Xing Wang --- diff --git a/arch/arm64/boot/dts/amlogic/g12a_s905d2_skt.dts b/arch/arm64/boot/dts/amlogic/g12a_s905d2_skt.dts index d7d8959..7c4e6a1 100644 --- a/arch/arm64/boot/dts/amlogic/g12a_s905d2_skt.dts +++ b/arch/arm64/boot/dts/amlogic/g12a_s905d2_skt.dts @@ -593,33 +593,6 @@ sound-dai = <&dummy_codec>; }; }; - /* - * dai link for i2s to hdmix, - * Notice to select a tdm lane not used by hw - */ - aml-audio-card,dai-link@6 { - format = "i2s"; - mclk-fs = <256>; - //continuous-clock; - //bitclock-inversion; - //frame-inversion; - bitclock-master = <&aml_i2s2hdmi>; - frame-master = <&aml_i2s2hdmi>; - /* suffix-name, sync with android audio hal - * what's the dai link used for - */ - suffix-name = "alsaPORT-i2s2hdmi"; - cpu { - sound-dai = <&aml_i2s2hdmi>; - 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>; - }; - }; }; audiolocker: locker { compatible = "amlogic, audiolocker"; @@ -839,20 +812,6 @@ pinctrl-0 = <&tdmc_mclk &tdmout_c &tdmin_c>; }; - /* copy a useless tdm to output for hdmi, no pinmux */ - aml_i2s2hdmi: i2s2hdmi { - compatible = "amlogic, g12a-snd-tdmc"; - #sound-dai-cells = <0>; - dai-tdm-lane-slot-mask-out = <1 1 1 1>; - dai-tdm-clk-sel = <2>; - clocks = <&clkaudio CLKID_AUDIO_MCLK_C - &clkc CLKID_MPLL2>; - clock-names = "mclk", "clk_srcpll"; - - i2s2hdmi = <1>; - - status = "okay"; - }; aml_spdif: spdif { compatible = "amlogic, g12a-snd-spdif-a"; diff --git a/arch/arm64/boot/dts/amlogic/g12a_s905d2_u200.dts b/arch/arm64/boot/dts/amlogic/g12a_s905d2_u200.dts index 1ad7bc2..8ac09a1 100644 --- a/arch/arm64/boot/dts/amlogic/g12a_s905d2_u200.dts +++ b/arch/arm64/boot/dts/amlogic/g12a_s905d2_u200.dts @@ -610,11 +610,11 @@ aml-audio-card,dai-link@4 { mclk-fs = <128>; - //continuous-clock; + continuous-clock; /* suffix-name, sync with android audio hal * what's the dai link used for */ - suffix-name = "alsaPORT-spdif"; + suffix-name = "alsaPORT-spdifb2hdmi"; cpu { sound-dai = <&aml_spdif>; system-clock-frequency = <6144000>; @@ -630,7 +630,7 @@ /* suffix-name, sync with android audio hal * what's the dai link used for */ - suffix-name = "alsaPORT-spdifb2hdmi"; + suffix-name = "alsaPORT-spdif"; cpu { sound-dai = <&aml_spdif_b>; system-clock-frequency = <6144000>; @@ -643,29 +643,28 @@ * dai link for i2s to hdmix, * Notice to select a tdm lane not used by hw */ - aml-audio-card,dai-link@6 { - format = "i2s"; - mclk-fs = <256>; - //continuous-clock; - //bitclock-inversion; - //frame-inversion; - bitclock-master = <&aml_i2s2hdmi>; - frame-master = <&aml_i2s2hdmi>; - /* suffix-name, sync with android audio hal - * what's the dai link used for - */ - suffix-name = "alsaPORT-i2s2hdmi"; - cpu { - sound-dai = <&aml_i2s2hdmi>; - 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>; - }; - }; + /* + * aml-audio-card,dai-link@6 { + * format = "i2s"; + * mclk-fs = <256>; + * //continuous-clock; + * //bitclock-inversion; + * //frame-inversion; + * bitclock-master = <&aml_i2s2hdmi>; + * frame-master = <&aml_i2s2hdmi>; + * suffix-name = "alsaPORT-i2s2hdmi"; + * cpu { + * sound-dai = <&aml_i2s2hdmi>; + * 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>; + * }; + * }; + */ }; audiolocker: locker { compatible = "amlogic, audiolocker"; @@ -892,7 +891,7 @@ i2s2hdmi = <1>; - status = "okay"; + status = "disabled"; }; aml_spdif: spdif { diff --git a/arch/arm64/boot/dts/amlogic/g12a_s905d2_u200_buildroot.dts b/arch/arm64/boot/dts/amlogic/g12a_s905d2_u200_buildroot.dts index abadb37..365533b 100644 --- a/arch/arm64/boot/dts/amlogic/g12a_s905d2_u200_buildroot.dts +++ b/arch/arm64/boot/dts/amlogic/g12a_s905d2_u200_buildroot.dts @@ -699,33 +699,6 @@ sound-dai = <&dummy_codec>; }; }; - /* - * dai link for i2s to hdmix, - * Notice to select a tdm lane not used by hw - */ - aml-audio-card,dai-link@6 { - format = "i2s"; - mclk-fs = <256>; - //continuous-clock; - //bitclock-inversion; - //frame-inversion; - bitclock-master = <&aml_i2s2hdmi>; - frame-master = <&aml_i2s2hdmi>; - /* suffix-name, sync with android audio hal - * what's the dai link used for - */ - suffix-name = "alsaPORT-i2s2hdmi"; - cpu { - sound-dai = <&aml_i2s2hdmi>; - 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>; - }; - }; }; audiolocker: locker { compatible = "amlogic, audiolocker"; @@ -940,20 +913,6 @@ pinctrl-0 = <&tdmc_mclk &tdmout_c &tdmin_c>; }; - /* copy a useless tdm to output for hdmi, no pinmux */ - aml_i2s2hdmi: i2s2hdmi { - compatible = "amlogic, g12a-snd-tdmc"; - #sound-dai-cells = <0>; - dai-tdm-lane-slot-mask-out = <1 1 1 1>; - dai-tdm-clk-sel = <2>; - clocks = <&clkaudio CLKID_AUDIO_MCLK_C - &clkc CLKID_MPLL2>; - clock-names = "mclk", "clk_srcpll"; - - i2s2hdmi = <1>; - - status = "okay"; - }; aml_spdif: spdif { compatible = "amlogic, g12a-snd-spdif-a"; diff --git a/arch/arm64/boot/dts/amlogic/g12a_s905d2_u200_drm_buildroot.dts b/arch/arm64/boot/dts/amlogic/g12a_s905d2_u200_drm_buildroot.dts index 495c6af..f46a70f 100644 --- a/arch/arm64/boot/dts/amlogic/g12a_s905d2_u200_drm_buildroot.dts +++ b/arch/arm64/boot/dts/amlogic/g12a_s905d2_u200_drm_buildroot.dts @@ -700,33 +700,6 @@ sound-dai = <&dummy_codec>; }; }; - /* - * dai link for i2s to hdmix, - * Notice to select a tdm lane not used by hw - */ - aml-audio-card,dai-link@6 { - format = "i2s"; - mclk-fs = <256>; - //continuous-clock; - //bitclock-inversion; - //frame-inversion; - bitclock-master = <&aml_i2s2hdmi>; - frame-master = <&aml_i2s2hdmi>; - /* suffix-name, sync with android audio hal - * what's the dai link used for - */ - suffix-name = "alsaPORT-i2s2hdmi"; - cpu { - sound-dai = <&aml_i2s2hdmi>; - 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>; - }; - }; }; audiolocker: locker { compatible = "amlogic, audiolocker"; @@ -949,20 +922,6 @@ pinctrl-0 = <&tdmc_mclk &tdmout_c &tdmin_c>; }; - /* copy a useless tdm to output for hdmi, no pinmux */ - aml_i2s2hdmi: i2s2hdmi { - compatible = "amlogic, g12a-snd-tdmc"; - #sound-dai-cells = <0>; - dai-tdm-lane-slot-mask-out = <1 1 1 1>; - dai-tdm-clk-sel = <2>; - clocks = <&clkaudio CLKID_AUDIO_MCLK_C - &clkc CLKID_MPLL2>; - clock-names = "mclk", "clk_srcpll"; - - i2s2hdmi = <1>; - - status = "okay"; - }; aml_spdif: spdif { compatible = "amlogic, g12a-snd-spdif-a"; diff --git a/arch/arm64/boot/dts/amlogic/g12a_s905d2_u220.dts b/arch/arm64/boot/dts/amlogic/g12a_s905d2_u220.dts index e2a8ec8..017abf0 100644 --- a/arch/arm64/boot/dts/amlogic/g12a_s905d2_u220.dts +++ b/arch/arm64/boot/dts/amlogic/g12a_s905d2_u220.dts @@ -586,10 +586,11 @@ aml-audio-card,dai-link@4 { mclk-fs = <128>; + continuous-clock; /* suffix-name, sync with android audio hal * what's the dai link used for */ - suffix-name = "alsaPORT-spdif"; + suffix-name = "alsaPORT-spdifb2hdmi"; cpu { sound-dai = <&aml_spdif>; system-clock-frequency = <6144000>; @@ -605,7 +606,7 @@ /* suffix-name, sync with android audio hal * what's the dai link used for */ - suffix-name = "alsaPORT-spdifb2hdmi"; + suffix-name = "alsaPORT-spdif"; cpu { sound-dai = <&aml_spdif_b>; system-clock-frequency = <6144000>; @@ -618,29 +619,28 @@ * dai link for i2s to hdmix, * Notice to select a tdm lane not used by hw */ - aml-audio-card,dai-link@6 { - format = "i2s"; - mclk-fs = <256>; - //continuous-clock; - //bitclock-inversion; - //frame-inversion; - bitclock-master = <&aml_i2s2hdmi>; - frame-master = <&aml_i2s2hdmi>; - /* suffix-name, sync with android audio hal - * what's the dai link used for - */ - suffix-name = "alsaPORT-i2s2hdmi"; - cpu { - sound-dai = <&aml_i2s2hdmi>; - 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>; - }; - }; + /* + * aml-audio-card,dai-link@6 { + * format = "i2s"; + * mclk-fs = <256>; + * //continuous-clock; + * //bitclock-inversion; + * //frame-inversion; + * bitclock-master = <&aml_i2s2hdmi>; + * frame-master = <&aml_i2s2hdmi>; + * suffix-name = "alsaPORT-i2s2hdmi"; + * cpu { + * sound-dai = <&aml_i2s2hdmi>; + * 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>; + * }; + * }; + */ }; audiolocker: locker { compatible = "amlogic, audiolocker"; @@ -861,7 +861,7 @@ i2s2hdmi = <1>; - status = "okay"; + status = "disabled"; }; aml_spdif: spdif { diff --git a/arch/arm64/boot/dts/amlogic/g12a_s905x2_u211.dts b/arch/arm64/boot/dts/amlogic/g12a_s905x2_u211.dts index 5f0bb96..3ab206f 100644 --- a/arch/arm64/boot/dts/amlogic/g12a_s905x2_u211.dts +++ b/arch/arm64/boot/dts/amlogic/g12a_s905x2_u211.dts @@ -601,10 +601,11 @@ aml-audio-card,dai-link@4 { mclk-fs = <128>; + continuous-clock; /* suffix-name, sync with android audio hal * what's the dai link used for */ - suffix-name = "alsaPORT-spdif"; + suffix-name = "alsaPORT-spdifb2hdmi"; cpu { sound-dai = <&aml_spdif>; system-clock-frequency = <6144000>; @@ -620,7 +621,7 @@ /* suffix-name, sync with android audio hal * what's the dai link used for */ - suffix-name = "alsaPORT-spdifb2hdmi"; + suffix-name = "alsaPORT-spdif"; cpu { sound-dai = <&aml_spdif_b>; system-clock-frequency = <6144000>; @@ -633,29 +634,28 @@ * dai link for i2s to hdmix, * Notice to select a tdm lane not used by hw */ - aml-audio-card,dai-link@6 { - format = "i2s"; - mclk-fs = <256>; - //continuous-clock; - //bitclock-inversion; - //frame-inversion; - bitclock-master = <&aml_i2s2hdmi>; - frame-master = <&aml_i2s2hdmi>; - /* suffix-name, sync with android audio hal - * what's the dai link used for - */ - suffix-name = "alsaPORT-i2s2hdmi"; - cpu { - sound-dai = <&aml_i2s2hdmi>; - 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>; - }; - }; + /* + * aml-audio-card,dai-link@6 { + * format = "i2s"; + * mclk-fs = <256>; + * //continuous-clock; + * //bitclock-inversion; + * //frame-inversion; + * bitclock-master = <&aml_i2s2hdmi>; + * frame-master = <&aml_i2s2hdmi>; + * suffix-name = "alsaPORT-i2s2hdmi"; + * cpu { + * sound-dai = <&aml_i2s2hdmi>; + * 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>; + * }; + * }; + */ }; audiolocker: locker { compatible = "amlogic, audiolocker"; @@ -868,7 +868,7 @@ i2s2hdmi = <1>; - status = "okay"; + status = "disabled"; }; aml_spdif: spdif { diff --git a/arch/arm64/boot/dts/amlogic/g12a_s905x2_u211_1g.dts b/arch/arm64/boot/dts/amlogic/g12a_s905x2_u211_1g.dts index bd3b1cb..e9c7198 100644 --- a/arch/arm64/boot/dts/amlogic/g12a_s905x2_u211_1g.dts +++ b/arch/arm64/boot/dts/amlogic/g12a_s905x2_u211_1g.dts @@ -593,10 +593,11 @@ aml-audio-card,dai-link@4 { mclk-fs = <128>; + continuous-clock; /* suffix-name, sync with android audio hal * what's the dai link used for */ - suffix-name = "alsaPORT-spdif"; + suffix-name = "alsaPORT-spdifb2hdmi"; cpu { sound-dai = <&aml_spdif>; system-clock-frequency = <6144000>; @@ -608,10 +609,11 @@ /* spdif_b to hdmi, only playback */ aml-audio-card,dai-link@5 { mclk-fs = <128>; + continuous-clock; /* suffix-name, sync with android audio hal * what's the dai link used for */ - suffix-name = "alsaPORT-spdifb2hdmi"; + suffix-name = "alsaPORT-spdif"; cpu { sound-dai = <&aml_spdif_b>; system-clock-frequency = <6144000>; @@ -624,29 +626,28 @@ * dai link for i2s to hdmix, * Notice to select a tdm lane not used by hw */ - aml-audio-card,dai-link@6 { - format = "i2s"; - mclk-fs = <256>; - //continuous-clock; - //bitclock-inversion; - //frame-inversion; - bitclock-master = <&aml_i2s2hdmi>; - frame-master = <&aml_i2s2hdmi>; - /* suffix-name, sync with android audio hal - * what's the dai link used for - */ - suffix-name = "alsaPORT-i2s2hdmi"; - cpu { - sound-dai = <&aml_i2s2hdmi>; - 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>; - }; - }; + /* + * aml-audio-card,dai-link@6 { + * format = "i2s"; + * mclk-fs = <256>; + * //continuous-clock; + * //bitclock-inversion; + * //frame-inversion; + * bitclock-master = <&aml_i2s2hdmi>; + * frame-master = <&aml_i2s2hdmi>; + * suffix-name = "alsaPORT-i2s2hdmi"; + * cpu { + * sound-dai = <&aml_i2s2hdmi>; + * 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>; + * }; + * }; + */ }; audiolocker: locker { compatible = "amlogic, audiolocker"; @@ -828,7 +829,7 @@ * 3: spdifout; * 4: spdifout_b; */ - samesource_sel = <4>; + samesource_sel = <3>; }; aml_tdmc: tdmc { @@ -858,7 +859,7 @@ i2s2hdmi = <1>; - status = "okay"; + status = "disabled"; }; aml_spdif: spdif { diff --git a/arch/arm64/boot/dts/amlogic/g12a_s905x2_u211_512m.dts b/arch/arm64/boot/dts/amlogic/g12a_s905x2_u211_512m.dts index 39fc52c..a0bb8a69 100644 --- a/arch/arm64/boot/dts/amlogic/g12a_s905x2_u211_512m.dts +++ b/arch/arm64/boot/dts/amlogic/g12a_s905x2_u211_512m.dts @@ -598,10 +598,11 @@ aml-audio-card,dai-link@4 { mclk-fs = <128>; + continuous-clock; /* suffix-name, sync with android audio hal * what's the dai link used for */ - suffix-name = "alsaPORT-spdif"; + suffix-name = "alsaPORT-spdifb2hdmi"; cpu { sound-dai = <&aml_spdif>; system-clock-frequency = <6144000>; @@ -617,7 +618,7 @@ /* suffix-name, sync with android audio hal * what's the dai link used for */ - suffix-name = "alsaPORT-spdifb2hdmi"; + suffix-name = "alsaPORT-spdif"; cpu { sound-dai = <&aml_spdif_b>; system-clock-frequency = <6144000>; @@ -630,29 +631,28 @@ * dai link for i2s to hdmix, * Notice to select a tdm lane not used by hw */ - aml-audio-card,dai-link@6 { - format = "i2s"; - mclk-fs = <256>; - //continuous-clock; - //bitclock-inversion; - //frame-inversion; - bitclock-master = <&aml_i2s2hdmi>; - frame-master = <&aml_i2s2hdmi>; - /* suffix-name, sync with android audio hal - * what's the dai link used for - */ - suffix-name = "alsaPORT-i2s2hdmi"; - cpu { - sound-dai = <&aml_i2s2hdmi>; - 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>; - }; - }; + /* + * aml-audio-card,dai-link@6 { + * format = "i2s"; + * mclk-fs = <256>; + * //continuous-clock; + * //bitclock-inversion; + * //frame-inversion; + * bitclock-master = <&aml_i2s2hdmi>; + * frame-master = <&aml_i2s2hdmi>; + * suffix-name = "alsaPORT-i2s2hdmi"; + * cpu { + * sound-dai = <&aml_i2s2hdmi>; + * 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>; + * }; + * }; + */ }; audiolocker: locker { compatible = "amlogic, audiolocker"; @@ -865,7 +865,7 @@ i2s2hdmi = <1>; - status = "okay"; + status = "disabled"; }; aml_spdif: spdif { diff --git a/arch/arm64/boot/dts/amlogic/g12a_s905x2_u211_buildroot.dts b/arch/arm64/boot/dts/amlogic/g12a_s905x2_u211_buildroot.dts index b41e543..230dc78 100644 --- a/arch/arm64/boot/dts/amlogic/g12a_s905x2_u211_buildroot.dts +++ b/arch/arm64/boot/dts/amlogic/g12a_s905x2_u211_buildroot.dts @@ -716,33 +716,6 @@ sound-dai = <&dummy_codec>; }; }; - /* - * dai link for i2s to hdmix, - * Notice to select a tdm lane not used by hw - */ - aml-audio-card,dai-link@6 { - format = "i2s"; - mclk-fs = <256>; - //continuous-clock; - //bitclock-inversion; - //frame-inversion; - bitclock-master = <&aml_i2s2hdmi>; - frame-master = <&aml_i2s2hdmi>; - /* suffix-name, sync with android audio hal - * what's the dai link used for - */ - suffix-name = "alsaPORT-i2s2hdmi"; - cpu { - sound-dai = <&aml_i2s2hdmi>; - 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>; - }; - }; }; audiolocker: locker { compatible = "amlogic, audiolocker"; @@ -934,20 +907,6 @@ pinctrl-0 = <&tdmc_mclk &tdmout_c &tdmin_c>; }; - /* copy a useless tdm to output for hdmi, no pinmux */ - aml_i2s2hdmi: i2s2hdmi { - compatible = "amlogic, g12a-snd-tdmc"; - #sound-dai-cells = <0>; - dai-tdm-lane-slot-mask-out = <1 1 1 1>; - dai-tdm-clk-sel = <2>; - clocks = <&clkaudio CLKID_AUDIO_MCLK_C - &clkc CLKID_MPLL2>; - clock-names = "mclk", "clk_srcpll"; - - i2s2hdmi = <1>; - - status = "okay"; - }; aml_spdif: spdif { compatible = "amlogic, g12a-snd-spdif-a"; diff --git a/sound/soc/amlogic/auge/ddr_mngr.c b/sound/soc/amlogic/auge/ddr_mngr.c index 53cdd1c1..dc0159a 100644 --- a/sound/soc/amlogic/auge/ddr_mngr.c +++ b/sound/soc/amlogic/auge/ddr_mngr.c @@ -739,6 +739,7 @@ void aml_frddr_enable(struct frddr *fr, bool enable) unsigned int reg; reg = calc_frddr_address(EE_AUDIO_FRDDR_A_CTRL0, reg_base); + /* ensure disable before enable frddr */ aml_audiobus_update_bits(actrl, reg, 1<<31, enable<<31); if (!enable) @@ -886,7 +887,7 @@ static void aml_check_aed(bool enable, int dst) } } -void frddr_init_default(unsigned int frddr_index, unsigned int src0_sel) +void frddr_init_without_mngr(unsigned int frddr_index, unsigned int src0_sel) { unsigned int offset, reg; unsigned int start_addr, end_addr, int_addr; @@ -929,6 +930,15 @@ void frddr_init_default(unsigned int frddr_index, unsigned int src0_sel) ); } +void frddr_deinit_without_mngr(unsigned int frddr_index) +{ + unsigned int offset, reg; + + offset = EE_AUDIO_FRDDR_B_CTRL0 - EE_AUDIO_FRDDR_A_CTRL0; + reg = EE_AUDIO_FRDDR_A_CTRL0 + offset * frddr_index; + audiobus_write(reg, 0x0); +} + static struct ddr_chipinfo g12a_ddr_chipinfo = { .addr_separated = true, .same_src_fn = true, diff --git a/sound/soc/amlogic/auge/ddr_mngr.h b/sound/soc/amlogic/auge/ddr_mngr.h index 3bf104c..8a5d660 100644 --- a/sound/soc/amlogic/auge/ddr_mngr.h +++ b/sound/soc/amlogic/auge/ddr_mngr.h @@ -103,6 +103,7 @@ unsigned int aml_frddr_get_fifo_id(struct frddr *fr); /* audio eq drc */ void aml_aed_enable(bool enable, int aed_module); -void frddr_init_default(unsigned int frddr_index, unsigned int src0_sel); +void frddr_init_without_mngr(unsigned int frddr_index, unsigned int src0_sel); +void frddr_deinit_without_mngr(unsigned int frddr_index); #endif diff --git a/sound/soc/amlogic/auge/spdif.c b/sound/soc/amlogic/auge/spdif.c index 0fcdb21..45bf843 100644 --- a/sound/soc/amlogic/auge/spdif.c +++ b/sound/soc/amlogic/auge/spdif.c @@ -463,6 +463,19 @@ static struct snd_pcm_ops aml_spdif_ops = { #define PREALLOC_BUFFER_MAX (256 * 1024) static int aml_spdif_new(struct snd_soc_pcm_runtime *rtd) { + struct device *dev = rtd->platform->dev; + struct aml_spdif *p_spdif; + + p_spdif = (struct aml_spdif *)dev_get_drvdata(dev); + + pr_info("%s spdif_%s, clk continuous:%d\n", + __func__, + (p_spdif->id == 0) ? "a":"b", + p_spdif->clk_cont); + /* keep frddr, when spdif init done, frddr can be released. */ + if (p_spdif->clk_cont) + spdifout_play_with_zerodata_free(p_spdif->id); + return snd_pcm_lib_preallocate_pages_for_all( rtd->pcm, SNDRV_DMA_TYPE_DEV, rtd->card->snd_card->dev, @@ -732,7 +745,12 @@ static int aml_dai_spdif_trigger(struct snd_pcm_substream *substream, int cmd, dev_info(substream->pcm->card->dev, "spdif capture disable\n"); aml_toddr_enable(p_spdif->tddr, 0); } - if (!p_spdif->clk_cont) + /* continuous, spdif out is only mute, not disable */ + if (p_spdif->clk_cont + && (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)) + aml_spdif_mute(p_spdif->actrl, + substream->stream, p_spdif->id, true); + else aml_spdif_enable(p_spdif->actrl, substream->stream, p_spdif->id, false); break; @@ -1034,12 +1052,9 @@ static int aml_spdif_platform_probe(struct platform_device *pdev) /* for spdif_b, clk be continuous, * and keep silence when no valid data */ - if (aml_spdif->id == 1) + /*if (aml_spdif->id == 1)*/ aml_spdif->clk_cont = 1; - if (aml_spdif->clk_cont) - spdifout_play_with_zerodata(aml_spdif->id); - aml_spdif->chipinfo = p_spdif_chipinfo; } else dev_warn_once(dev, @@ -1062,6 +1077,9 @@ static int aml_spdif_platform_probe(struct platform_device *pdev) if (ret) return -EINVAL; + if (aml_spdif->clk_cont) + spdifout_play_with_zerodata(aml_spdif->id); + ret = devm_snd_soc_register_component(dev, &aml_spdif_component, &aml_spdif_dai[aml_spdif->id], 1); if (ret) { diff --git a/sound/soc/amlogic/auge/spdif_hw.c b/sound/soc/amlogic/auge/spdif_hw.c index a988405..fa8617e 100644 --- a/sound/soc/amlogic/auge/spdif_hw.c +++ b/sound/soc/amlogic/auge/spdif_hw.c @@ -50,6 +50,30 @@ void aml_spdif_enable( } } +void aml_spdif_mute( + struct aml_audio_controller *actrl, + int stream, + int index, + bool is_mute) +{ + int mute_lr = 0; + + if (is_mute) + mute_lr = 0x3; + + if (stream == SNDRV_PCM_STREAM_PLAYBACK) { + unsigned int offset, reg; + + offset = EE_AUDIO_SPDIFOUT_B_CTRL0 - EE_AUDIO_SPDIFOUT_CTRL0; + reg = EE_AUDIO_SPDIFOUT_CTRL0 + offset * index; + aml_audiobus_update_bits(actrl, + reg, 0x3 << 21, mute_lr << 21); + } else { + aml_audiobus_update_bits(actrl, + EE_AUDIO_SPDIFIN_CTRL0, 0x3 << 6, mute_lr << 6); + } +} + void aml_spdif_arb_config(struct aml_audio_controller *actrl) { /* config ddr arb */ @@ -351,16 +375,6 @@ void spdifout_fifo_ctrl(int spdif_id, int fifo_id, int bitwidth) audiobus_update_bits(reg, 1<<28, 1<<28); } -static void spdifout_mute(int spdif_id) -{ - unsigned int offset, reg; - - /* mute */ - offset = EE_AUDIO_SPDIFOUT_B_CTRL0 - EE_AUDIO_SPDIFOUT_CTRL0; - reg = EE_AUDIO_SPDIFOUT_CTRL0 + offset * spdif_id; - audiobus_update_bits(reg, 0x3 << 21, 0x3 << 21); -} - static bool spdifout_is_enable(int spdif_id) { unsigned int offset, reg, val; @@ -403,8 +417,8 @@ void spdifout_samesource_set(int spdif_index, int fifo_id, spdif_id = 0; /* clk for spdif_b is always on */ - if (!spdif_id) - spdifout_clk_ctrl(spdif_id, is_enable); + /*if (!spdif_id)*/ + spdifout_clk_ctrl(spdif_id, /*is_enable*/true); if (is_enable) spdifout_fifo_ctrl(spdif_id, fifo_id, bitwidth); @@ -507,7 +521,7 @@ void spdifout_play_with_zerodata(unsigned int spdif_id) struct snd_pcm_runtime runtime; substream.runtime = &runtime; - runtime.rate = 48000; + runtime.rate = sample_rate; runtime.format = SNDRV_PCM_FORMAT_S16_LE; runtime.channels = 2; runtime.sample_bits = 16; @@ -516,6 +530,11 @@ void spdifout_play_with_zerodata(unsigned int spdif_id) if (spdif_id == 0) src0_sel = 3; + /* spdif clk */ + spdifout_clk_ctrl(spdif_id, true); + /* spdif to hdmitx */ + spdifoutb_to_hdmitx_ctrl(spdif_id); + /* spdif ctrl */ spdifout_fifo_ctrl(spdif_id, frddr_index, bitwidth); @@ -524,13 +543,20 @@ void spdifout_play_with_zerodata(unsigned int spdif_id) spdif_set_channel_status_info(&chsts, spdif_id); /* notify hdmitx audio */ - spdifoutb_to_hdmitx_ctrl(spdif_id); aout_notifier_call_chain(0x1, &substream); - frddr_init_default(frddr_index, src0_sel); + /* init frddr to output zero data. */ + frddr_init_without_mngr(frddr_index, src0_sel); + /* spdif enable */ spdifout_enable(spdif_id, true); - - spdifout_mute(spdif_id); } } + +void spdifout_play_with_zerodata_free(unsigned int spdif_id) +{ + pr_info("%s, spdif id:%d\n", __func__, spdif_id); + + /* free frddr, then frddr in mngr */ + frddr_deinit_without_mngr(spdif_id); +} diff --git a/sound/soc/amlogic/auge/spdif_hw.h b/sound/soc/amlogic/auge/spdif_hw.h index c963cfa..3e46eb0 100644 --- a/sound/soc/amlogic/auge/spdif_hw.h +++ b/sound/soc/amlogic/auge/spdif_hw.h @@ -28,6 +28,12 @@ extern void aml_spdif_enable( int index, bool is_enable); +extern void aml_spdif_mute( + struct aml_audio_controller *actrl, + int stream, + int index, + bool is_mute); + extern void aml_spdif_arb_config(struct aml_audio_controller *actrl); extern int aml_spdifin_status_check( @@ -69,4 +75,5 @@ extern void spdif_set_channel_status_info( struct iec958_chsts *chsts, int spdif_id); extern void spdifout_play_with_zerodata(unsigned int spdif_id); +extern void spdifout_play_with_zerodata_free(unsigned int spdif_id); #endif