audio: auge: fix hdmi pop noise when bootup
authorXing Wang <xing.wang@amlogic.com>
Thu, 24 May 2018 15:30:01 +0000 (23:30 +0800)
committerYixun Lan <yixun.lan@amlogic.com>
Wed, 18 Jul 2018 10:13:22 +0000 (03:13 -0700)
PD#165171: audio: auge: fix hdmi pop noise when bootup

Change-Id: Ic8186b230c5c27966467e35d23b8c041309e6922
Signed-off-by: Xing Wang <xing.wang@amlogic.com>
14 files changed:
arch/arm64/boot/dts/amlogic/g12a_s905d2_skt.dts
arch/arm64/boot/dts/amlogic/g12a_s905d2_u200.dts
arch/arm64/boot/dts/amlogic/g12a_s905d2_u200_buildroot.dts
arch/arm64/boot/dts/amlogic/g12a_s905d2_u200_drm_buildroot.dts
arch/arm64/boot/dts/amlogic/g12a_s905d2_u220.dts
arch/arm64/boot/dts/amlogic/g12a_s905x2_u211.dts
arch/arm64/boot/dts/amlogic/g12a_s905x2_u211_1g.dts
arch/arm64/boot/dts/amlogic/g12a_s905x2_u211_512m.dts
arch/arm64/boot/dts/amlogic/g12a_s905x2_u211_buildroot.dts
sound/soc/amlogic/auge/ddr_mngr.c
sound/soc/amlogic/auge/ddr_mngr.h
sound/soc/amlogic/auge/spdif.c
sound/soc/amlogic/auge/spdif_hw.c
sound/soc/amlogic/auge/spdif_hw.h

index d7d8959aac38e8fffd5f7417c91b028713c3ef35..7c4e6a100f27b4e4d55a12a680c502c260d26a97 100644 (file)
                                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";
                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";
index 1ad7bc2ca7df61013392d04433c2bb927d9df0da..8ac09a18c19ddb1ee72ccb7894d70f8f20eed013 100644 (file)
 
                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>;
                        /* 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>;
                 * 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";
 
                i2s2hdmi = <1>;
 
-               status = "okay";
+               status = "disabled";
        };
 
        aml_spdif: spdif {
index abadb3735b7dadd6f5fae3677ba3c76cf77e2e50..365533b0ab7db8cec4eacc9ccc96e00d2590a014 100644 (file)
                                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";
                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";
index 495c6afa0f239a1c12fdedf61e090f1a74cf5d84..f46a70fb35a3e8e03fa19fd45910730efec16011 100644 (file)
                                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";
                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";
index e2a8ec8f4f24b0b232b774cd8798bf92ecb2e093..017abf04132268fe1daf0fcea5558c92c4996ecc 100644 (file)
 
                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>;
                        /* 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>;
                 * 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";
 
                i2s2hdmi = <1>;
 
-               status = "okay";
+               status = "disabled";
        };
 
        aml_spdif: spdif {
index 5f0bb9604d14082d99aecb39252f0e9920f9e7ab..3ab206f5084048697a5235339bc4e18eab47f7a2 100644 (file)
 
                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>;
                        /* 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>;
                 * 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";
 
                i2s2hdmi = <1>;
 
-               status = "okay";
+               status = "disabled";
        };
 
        aml_spdif: spdif {
index bd3b1cbe2d45b1c337687a9f11bef4e60c8faa73..e9c7198519ac55c4ed27bc4ea6867812e5606d81 100644 (file)
 
                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>;
                /* 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>;
                 * 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";
                 * 3: spdifout;
                 * 4: spdifout_b;
                 */
-               samesource_sel = <4>;
+               samesource_sel = <3>;
        };
 
        aml_tdmc: tdmc {
 
                i2s2hdmi = <1>;
 
-               status = "okay";
+               status = "disabled";
        };
 
        aml_spdif: spdif {
index 39fc52ce858f64dac225f3a65f957cc774f25922..a0bb8a69c8502f5b1bcb4a61588021f17b0e849e 100644 (file)
 
                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>;
                        /* 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>;
                 * 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";
 
                i2s2hdmi = <1>;
 
-               status = "okay";
+               status = "disabled";
        };
 
        aml_spdif: spdif {
index b41e5433f455cc3b63f4786904beed257dba6fe6..230dc78909cae6e38a75da10db52fe38a6af54df 100644 (file)
                                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";
                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";
index 53cdd1c1d57a73b15c5ddad44206f0f6c4059280..dc0159adc0c05118249d72395fb9f3c3b58df859 100644 (file)
@@ -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,
index 3bf104cf8f205bcdb841d997470a6ce61d17a2ed..8a5d660fe2d7531a04182f317ead7fbbcb34b525 100644 (file)
@@ -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
 
index 0fcdb2124f82eddd5736b2f4fd427c88d16c17ac..45bf8437345c75bfab2d43881c589b26084c4f7b 100644 (file)
@@ -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) {
index a988405365218e2285efe2c90112c45c0dbf327c..fa8617ec6b2c3503c7c96bdcd05a0b5ca4f0df3b 100644 (file)
@@ -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);
+}
index c963cfa51fa00429a2eea59afacc43fc412701a7..3e46eb0e5f58b66fbcd482330f9633f6e6ae1ad5 100644 (file)
@@ -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