audio: update audio driver to the latest. [1/1]
authorShuai Li <shuai.li@amlogic.com>
Wed, 27 Mar 2019 08:37:00 +0000 (16:37 +0800)
committerNick Xie <nick@khadas.com>
Mon, 5 Aug 2019 06:24:05 +0000 (14:24 +0800)
0504a9a audio: add clk tuning_enable/start_enable control in dts [1/1]
32dd894 audio: add lock for resampler [1/1]
2ad1050 audio: set hdmi format-check threshold by input samplerate [2/2]
953435d audio: fix TDMOUT channel map error [1/1]
9eace31 audio: auge: add lower power mode for PDM & vad [1/1]
90b9c44 audio: auge: add loopback driver [1/1]
0d736dd audio: add 10ms sleep before pdn enable [1/1]
51d1794 audio: add 10ms delay before pdn enable [1/1]
998f60b audio: disable tl1 acodec dac dapm to depop [1/1]
7b0ef35 audio: enable hw resmaple pause thd [1/1]
fcb2613 audio: TM2 bringup: enable ADC for linein [1/1]
4f4dc5a audio: TM2: bringup AMP ti5805 on ab301 [1/1]
758b24b audio: fixed kernel panic when resample is disabled [1/1]
19e844f audio: TM2 audio basic function bringup [1/1]
27c68d0 audio: add codec trigger mute for depop [1/1]
d415bb5 audio: fixed the issue of PDM 16 channel capture. [1/1]
d6e5cf5 audio: always on DDR arb [1/1]
0663274 audio: add HW resample for HDMIRX [1/1]
22f4718 audio: add param check for resample [1/1]
audio: add HW resample for HDMIRX [1/1]

PD#SWPL-6118

Problem:
No resample will cause mismatch between
input and output if they are not at same
samplerate.

Solution:
Add resample for hdmirx case

Verify:
Local tested.

Change-Id: I298e401578bf49484d6b75fd736d2a74c38508e4
Signed-off-by: Shuai Li <shuai.li@amlogic.com>
Signed-off-by: Luan Yuan <luan.yuan@amlogic.com>
audio: always on DDR arb [1/1]

PD#TV-3452

Problem:
Toddr stuck after a long time playback.

Solution:
For debug usage.

Verify:
No need.

Change-Id: Ibf4446148f5e028040d7d6527c7695f23f964f7c
Signed-off-by: Shuai Li <shuai.li@amlogic.com>
Signed-off-by: Zhe Wang <Zhe.Wang@amlogic.com>
audio: fixed the issue of PDM 16 channel capture. [1/1]

PD#SWPL-5551

Problem:
cannot capture 8PDM + 8LOOPBACK.

Solution:
PDM cannot support 8PDM + 8LOOPBACK.

Verify:
s420/s400, verify pass

Change-Id: Iaf38bdcb218ebfc024666312162569cab93a76a9
Signed-off-by: Renjun Xu <renjun.xu@amlogic.com>
audio: add codec trigger mute for depop [1/1]

PD#SWPL-6944

Problem:
TV-3381
Speaker sometimes has clicking noise when playing DTV program.

Solution:
add codec trigger mute for depop

Verify:
Local verified.

Change-Id: Ib15a6b90bd3a6cdda2255afaf86daeab68ba07e2
Signed-off-by: Shuai Li <shuai.li@amlogic.com>
audio: TM2 audio basic function bringup [1/1]

PD#SWPL-6721

Problem:
TM2 bringup

Solution:
audio basic function bringup

Verify:
Verified on T962e2_ab311

Change-Id: Ic48ded3964ea87e40c4d683d71a50bbdc1975f91
Signed-off-by: Zhe Wang <Zhe.Wang@amlogic.com>
Signed-off-by: Luan Yuan <luan.yuan@amlogic.com>
audio: fixed kernel panic when resample is disabled [1/1]

PD#SWPL-7039

Problem:
Kernel Panic when resample A is disabled

Solution:
When resample is disabled,don't init resample

Verify:
Verified on T962e2_ab311

Change-Id: Id9552ffc6be40f133b828dbded4ad3f15d177ab0
Signed-off-by: Zhe Wang <Zhe.Wang@amlogic.com>
audio: TM2: bringup AMP ti5805 on ab301 [1/1]

PD#SWPL-7074

Problem:
speaker doesn't work

Solution:
bringup AMP ti5805 on ab301

Verify:
Verified on T962x3_ab301

Change-Id: Icb27691b4fd5a1e54070c4a6d3d3c68cdf3a60b7
Signed-off-by: Zhe Wang <Zhe.Wang@amlogic.com>
Signed-off-by: Luan Yuan <luan.yuan@amlogic.com>
audio: TM2 bringup: enable ADC for linein [1/1]

PD#SWPL-7027

Problem:
audio path AVin is on audio

Solution:
enable ADC for linein

Verify:
Verify on AB311

Change-Id: Iea1d694e0b605d62596635d85416d33f56dbbcb2
Signed-off-by: Zhe Wang <Zhe.Wang@amlogic.com>
Signed-off-by: Luan Yuan <luan.yuan@amlogic.com>
audio: enable hw resmaple pause thd [1/1]

PD#TV-4638

Problem:
Speaker output high frequency howling
after change from pattern 615 to pattern 1 on chroma22294.
The hw resampler keeps sending noise if it has no input.

Solution:
Enable the hw resample pause thd by default.

Verify:
TL1 X301.

Change-Id: Ib6f0924025e155eaa8ba0e3681b307f7ff56b449
Signed-off-by: Shuai Li <shuai.li@amlogic.com>
audio: disable tl1 acodec dac dapm to depop [1/1]

PD#TV-3933

Problem:
Tl1 acodec has pop sound when first sound appear.

Solution:
Disable the DAPM which disable/enable every time
start/stop the audio stream.

Verify:
Tl1 X301.

Change-Id: Iaaf7da125de513bd8297f6c6e41af0a42c9d25bd
Signed-off-by: Shuai Li <shuai.li@amlogic.com>
audio: add 10ms delay before pdn enable [1/1]

PD#SWPL-7680

Problem:
the pwn signal is self excitable

Solution:
1)add 10ms delay before pdn enable
2)set default clk for extern codec

Verify:
HW verify

Change-Id: I031b20851ee1eeb65215075fc8abe783ceddf42b
Signed-off-by: Zhe Wang <Zhe.Wang@amlogic.com>
audio: add 10ms sleep before pdn enable [1/1]

PD#SWPL-7680

Problem:
mdelay will pend the system

Solution:
change mdelay to usleep_range

Verify:
HW verify

Change-Id: I8452dc7b1056378dbc6b743fc43316eccbf525a5
Signed-off-by: Zhe Wang <Zhe.Wang@amlogic.com>
audio: auge: add loopback driver [1/1]

PD#SWPL-7240

Problem:
limit of current loopback
add loopback b for tl1
add tdmin_lb

Solution:
optimize loopback driver

Verify:
s400, u200, x301, ac200, ab301

Change-Id: I9dd4c7ad041231bb2c49513e354cfb4fb92131c4
Signed-off-by: Xing Wang <xing.wang@amlogic.com>
Signed-off-by: Luan Yuan <luan.yuan@amlogic.com>
audio: auge: add lower power mode for PDM & vad [1/1]

PD#SWPL-3825

Problem:
VAD & PDM works in 24m clks for lowpower mode when in deep suspend

Solution:
support VAD & PDM in 24m sysclk, 768k dclk

Verify:
x301

Change-Id: Ic363337ee9b0eba0f890ae62b9e0cb6bb54dcd6a
Signed-off-by: Xing Wang <xing.wang@amlogic.com>
Signed-off-by: Luan Yuan <luan.yuan@amlogic.com>
audio: fix TDMOUT channel map error [1/1]

PD#SWPL-6427

Problem:
ALSA tdmout buffer frequently underrun.
This will cause the tdmout channel map error.
And the other channels data go into the spk.

Solution:
1)Adjust the sequence of starting and stopping.
2)reserved frddrA for EQ/DRC module

Verify:
Test more that 1 hour and pass.
Need more stress test.

Change-Id: Ib9b6897f0b6c32652c611a8c2c367aa76b9f1e3f
Signed-off-by: Shuai Li <shuai.li@amlogic.com>
Signed-off-by: Zhe Wang <Zhe.Wang@amlogic.com>
Signed-off-by: Luan Yuan <luan.yuan@amlogic.com>
audio: set hdmi format-check threshold by input samplerate [2/2]

PD#SWPL-6340

Problem:
ddp audio input from hdmiin is not smooth

Solution:
set hdmiin format-check threshold by input sr

Verify:
Verified by x301.

Change-Id: Idb8ffa616c3880b1c34d61ca4e8c2917343a9ffc
Signed-off-by: Zhe Wang <Zhe.Wang@amlogic.com>
audio: add lock for resampler [1/1]

PD#SWPL-8134

Problem:
kernel NULL pointer for aml_resample_enable

Solution:
add lock for resampler

Verify:
Need stress test for x301

Change-Id: I1bbf5d7aeab681399c93f0cba9cc59195d3be0d6
Signed-off-by: Shuai Li <shuai.li@amlogic.com>
audio: add clk tuning_enable/start_enable control in dts [1/1]

PD#SWPL-8306

Problem:
speaker without audio on S400. sideeffect of SWPL-7680

Solution:
add control interface in dts to enable clk tuning
and start clk before codec init

Verify:
verify on S400

Change-Id: Ic9f4e7b13b7d4ced18852346cdc7cf5f48e510dc
Signed-off-by: Zhe Wang <Zhe.Wang@amlogic.com>
Signed-off-by: Luan Yuan <luan.yuan@amlogic.com>
audio: add param check for resample [1/1]

PD#SWPL-7798

Problem:
Crashed when audio resample setting params
are invalid.

Solution:
Add check method if the params is invalid.

Verify:
Tl1.

Change-Id: I1e0396be8d401c0a49ff0de9fd7f160f0c8133ca
Signed-off-by: Shuai Li <shuai.li@amlogic.com>
Signed-off-by: Luan Yuan <luan.yuan@amlogic.com>
138 files changed:
MAINTAINERS
arch/arm/boot/dts/amlogic/axg_s400.dts
arch/arm/boot/dts/amlogic/axg_s400_v03.dts
arch/arm/boot/dts/amlogic/axg_s400_v03gva.dts
arch/arm/boot/dts/amlogic/axg_s400_v03sbr.dts
arch/arm/boot/dts/amlogic/axg_s400emmc_512m.dts
arch/arm/boot/dts/amlogic/axg_s420.dts
arch/arm/boot/dts/amlogic/axg_s420_128m.dts
arch/arm/boot/dts/amlogic/axg_s420_v03.dts
arch/arm/boot/dts/amlogic/axg_s420_v03gva.dts
arch/arm/boot/dts/amlogic/g12a_s905d2_skt.dts
arch/arm/boot/dts/amlogic/g12a_s905d2_skt_buildroot.dts
arch/arm/boot/dts/amlogic/g12a_s905d2_u200.dts
arch/arm/boot/dts/amlogic/g12a_s905d2_u200_1g.dts
arch/arm/boot/dts/amlogic/g12a_s905d2_u200_buildroot.dts
arch/arm/boot/dts/amlogic/g12a_s905d2_u200_buildroot_vccktest.dts
arch/arm/boot/dts/amlogic/g12a_s905d2_u200_drm_buildroot.dts
arch/arm/boot/dts/amlogic/g12a_s905x2_u211.dts
arch/arm/boot/dts/amlogic/g12a_s905x2_u211_1g.dts
arch/arm/boot/dts/amlogic/g12a_s905x2_u211_512m.dts
arch/arm/boot/dts/amlogic/g12a_s905x2_u211_buildroot.dts
arch/arm/boot/dts/amlogic/g12a_s905x2_u212.dts
arch/arm/boot/dts/amlogic/g12a_s905x2_u212_1g.dts
arch/arm/boot/dts/amlogic/g12a_s905x2_u212_buildroot.dts
arch/arm/boot/dts/amlogic/g12a_s905y2_u220.dts
arch/arm/boot/dts/amlogic/g12a_s905y2_u221.dts
arch/arm/boot/dts/amlogic/g12b_a311d_skt.dts
arch/arm/boot/dts/amlogic/g12b_a311d_skt_a.dts
arch/arm/boot/dts/amlogic/g12b_a311d_w400.dts
arch/arm/boot/dts/amlogic/g12b_a311d_w400_a.dts
arch/arm/boot/dts/amlogic/g12b_a311d_w400_buildroot.dts
arch/arm/boot/dts/amlogic/g12b_a311d_w400_buildroot_a.dts
arch/arm/boot/dts/amlogic/g12b_a311d_w400_buildroot_vccktest.dts
arch/arm/boot/dts/amlogic/g12b_a311d_w400_buildroot_vccktest_a.dts
arch/arm/boot/dts/amlogic/sm1_s905d3_ac200.dts
arch/arm/boot/dts/amlogic/sm1_s905d3_ac202.dts
arch/arm/boot/dts/amlogic/sm1_s905d3_ac202_1g.dts
arch/arm/boot/dts/amlogic/sm1_s905d3_skt.dts
arch/arm/boot/dts/amlogic/sm1_s905x3_ac213.dts
arch/arm/boot/dts/amlogic/tl1_pxp.dts
arch/arm/boot/dts/amlogic/tl1_t962x2_skt.dts [deleted file]
arch/arm/boot/dts/amlogic/tl1_t962x2_t309.dts
arch/arm/boot/dts/amlogic/tl1_t962x2_x301.dts [deleted file]
arch/arm64/boot/dts/amlogic/axg_s400.dts
arch/arm64/boot/dts/amlogic/axg_s400_v03.dts
arch/arm64/boot/dts/amlogic/axg_s400_v03gva.dts
arch/arm64/boot/dts/amlogic/axg_s400_v03sbr.dts
arch/arm64/boot/dts/amlogic/axg_s400emmc_512m.dts
arch/arm64/boot/dts/amlogic/axg_s420.dts
arch/arm64/boot/dts/amlogic/axg_s420_128m.dts
arch/arm64/boot/dts/amlogic/axg_s420_v03.dts
arch/arm64/boot/dts/amlogic/axg_s420_v03gva.dts
arch/arm64/boot/dts/amlogic/g12a_s905d2_skt.dts
arch/arm64/boot/dts/amlogic/g12a_s905d2_skt_buildroot.dts
arch/arm64/boot/dts/amlogic/g12a_s905d2_u200.dts
arch/arm64/boot/dts/amlogic/g12a_s905d2_u200_1g.dts
arch/arm64/boot/dts/amlogic/g12a_s905d2_u200_buildroot.dts
arch/arm64/boot/dts/amlogic/g12a_s905d2_u200_buildroot_vccktest.dts
arch/arm64/boot/dts/amlogic/g12a_s905d2_u200_drm_buildroot.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
arch/arm64/boot/dts/amlogic/g12a_s905x2_u212.dts
arch/arm64/boot/dts/amlogic/g12a_s905x2_u212_1g.dts
arch/arm64/boot/dts/amlogic/g12a_s905x2_u212_buildroot.dts
arch/arm64/boot/dts/amlogic/g12a_s905y2_u220.dts
arch/arm64/boot/dts/amlogic/g12a_s905y2_u221.dts
arch/arm64/boot/dts/amlogic/g12b_a311d_skt.dts
arch/arm64/boot/dts/amlogic/g12b_a311d_skt_a.dts
arch/arm64/boot/dts/amlogic/g12b_a311d_w400.dts
arch/arm64/boot/dts/amlogic/g12b_a311d_w400_a.dts
arch/arm64/boot/dts/amlogic/g12b_a311d_w400_buildroot.dts
arch/arm64/boot/dts/amlogic/g12b_a311d_w400_buildroot_a.dts
arch/arm64/boot/dts/amlogic/g12b_a311d_w400_buildroot_vccktest.dts
arch/arm64/boot/dts/amlogic/g12b_a311d_w400_buildroot_vccktest_a.dts
arch/arm64/boot/dts/amlogic/g12b_a311x_w411_buildroot.dts
arch/arm64/boot/dts/amlogic/g12b_a311x_w411_buildroot_a.dts
arch/arm64/boot/dts/amlogic/sm1_s905d3_ac200.dts
arch/arm64/boot/dts/amlogic/sm1_s905d3_ac202.dts
arch/arm64/boot/dts/amlogic/sm1_s905d3_ac202_1g.dts
arch/arm64/boot/dts/amlogic/sm1_s905d3_skt.dts
arch/arm64/boot/dts/amlogic/sm1_s905x3_ac213.dts
include/dt-bindings/clock/amlogic,tm2-audio-clk.h [new file with mode: 0644]
sound/soc/amlogic/auge/Makefile
sound/soc/amlogic/auge/audio_aed_reg_list.h [new file with mode: 0644]
sound/soc/amlogic/auge/audio_clks.c
sound/soc/amlogic/auge/audio_clks.h
sound/soc/amlogic/auge/audio_controller.c
sound/soc/amlogic/auge/audio_top_reg_list.h [new file with mode: 0644]
sound/soc/amlogic/auge/audio_utils.c
sound/soc/amlogic/auge/audio_utils.h
sound/soc/amlogic/auge/card.c
sound/soc/amlogic/auge/ddr_mngr.c
sound/soc/amlogic/auge/ddr_mngr.h
sound/soc/amlogic/auge/earc.c
sound/soc/amlogic/auge/effects_hw_v2.c
sound/soc/amlogic/auge/effects_hw_v2.h
sound/soc/amlogic/auge/effects_v2.c
sound/soc/amlogic/auge/effects_v2.h
sound/soc/amlogic/auge/extn.c
sound/soc/amlogic/auge/iomap.c
sound/soc/amlogic/auge/loopback.c [new file with mode: 0644]
sound/soc/amlogic/auge/loopback.h [new file with mode: 0644]
sound/soc/amlogic/auge/loopback_hw.c
sound/soc/amlogic/auge/loopback_hw.h
sound/soc/amlogic/auge/loopback_match_table.c [new file with mode: 0644]
sound/soc/amlogic/auge/pdm.c
sound/soc/amlogic/auge/pdm.h
sound/soc/amlogic/auge/pdm_hw.c
sound/soc/amlogic/auge/pdm_hw.h
sound/soc/amlogic/auge/pdm_match_table.c
sound/soc/amlogic/auge/regs.h
sound/soc/amlogic/auge/resample.c
sound/soc/amlogic/auge/resample.h
sound/soc/amlogic/auge/resample_hw.c
sound/soc/amlogic/auge/resample_hw.h
sound/soc/amlogic/auge/sharebuffer.c
sound/soc/amlogic/auge/sharebuffer.h
sound/soc/amlogic/auge/sm1,clocks.c
sound/soc/amlogic/auge/spdif.c
sound/soc/amlogic/auge/spdif_hw.c
sound/soc/amlogic/auge/spdif_hw.h
sound/soc/amlogic/auge/spdif_match_table.c
sound/soc/amlogic/auge/tdm.c
sound/soc/amlogic/auge/tdm_hw.c
sound/soc/amlogic/auge/tdm_hw.h
sound/soc/amlogic/auge/tdm_match_table.c
sound/soc/amlogic/auge/tl1,clocks.c
sound/soc/amlogic/auge/tm2,clocks.c [new file with mode: 0644]
sound/soc/amlogic/auge/vad.c
sound/soc/amlogic/auge/vad.h
sound/soc/amlogic/auge/vad_hw.c
sound/soc/amlogic/auge/vad_hw.h
sound/soc/codecs/amlogic/ad82584f.c
sound/soc/codecs/amlogic/aml_codec_tl1_acodec.c
sound/soc/codecs/amlogic/tas5805.c
sound/soc/codecs/amlogic/tas5805.h

index 5c9389e..fc667d1 100644 (file)
@@ -13796,13 +13796,9 @@ F: arch/arm/boot/dts/amlogic>
 ANLOGIC AUDIO
 M: Xing Wang <xing.wang@amlogic.com>
 M: Zhe Wang <Zhe.Wang@amlogic.com>
-F: arch/arm64/boot/dts/amlogic/gxl_p212_1g.dts
-F: arch/arm64/boot/dts/amlogic/gxl_p212_2g.dts
-F: arch/arm64/boot/dts/amlogic/gxl_p230_2g.dts
-F: arch/arm64/boot/dts/amlogic/gxm_q200_2g.dts
-F: arch/arm64/boot/dts/amlogic/gxm_skt.dts
-F: arch/arm64/boot/dts/amlogic/mesongxl.dtsi
-F: arch/arm64/boot/dts/amlogic/mesongxm.dtsi
+M: Shuai Li <shuai.li@amlogic.com>
+F: arch/arm64/boot/dts/amlogic/*
+F: arch/arm/boot/dts/amlogic/*
 F: arch/arm64/configs/meson64_defconfig
 F: drivers/amlogic/clk/clk-mpll.c
 F: drivers/amlogic/clk/clk_misc.c
@@ -13814,7 +13810,8 @@ F: include/dt-bindings/clock/amlogic,gxl-clkc.h
 F: include/linux/amlogic/media/sound/audin_regs.h
 F: sound/soc/Kconfig
 F: sound/soc/Makefile
-F: sound/soc/amlogic/*
+F: sound/soc/amlogic/auge/*
+F: sound/soc/amlogic/meson/*
 F: sound/soc/codecs/Kconfig
 F: sound/soc/codecs/Makefile
 F: sound/soc/codecs/amlogic/*
@@ -14696,6 +14693,14 @@ F:     include/linux/amlogic/media/sound/misc.h
 F:     include/linux/amlogic/major.h
 F:     sound/soc/amlogic/auge/*
 
+AMLOGIC TL1 AUDIO EXTERANL INPUT/OUTPUT DRIVERS
+AMLOGIC AUDIO New LOOPBACK DRIVERS
+M:     Xing Wang <xing.wang@amlogic.com
+F:     sound/soc/amlogic/auge/extn.c
+F:     sound/soc/amlogic/auge/frhdmirx_hw.c
+F:     sound/soc/amlogic/auge/frhdmirx_hw.h
+F:     sound/soc/amlogic/auge/*
+
 AMLOGIC LCD DRIVERS
 M:     Evoke Zhang <evoke.zhang@amlogic.com>
 F:     arch\arm\boot\dts\amlogic\mesontl1_pxp-panel.dtsi
index 06011db..9241015 100644 (file)
                compatible = "amlogic, axg-sound-card";
                aml-audio-card,name = "AML-AUGESOUND";
 
-               aml-audio-card,loopback = <&aml_loopback>;
-
                aml-audio-card,dai-link@0 {
                        format = "dsp_a";
                        mclk-fs = <512>;
                                sound-dai = <&aml_pdm>;
                        };
                        codec {
-                               /*
-                                * enable external loopback
-                                * and tlv320adc3101 as loopback
-                                */
-                               /*sound-dai = <&pdm_codec &tlv320adc3101_32>;*/
-                               /*
-                                * enable internal loopback
-                                * or disable loopback
-                                */
                                sound-dai = <&pdm_codec>;
                        };
                };
                                sound-dai = <&dummy_codec>;
                        };
                };
+
+               aml-audio-card,dai-link@5 {
+                       mclk-fs = <256>;
+                       continuous-clock;
+                       suffix-name = "alsaPORT-loopback";
+                       cpu {
+                               sound-dai = <&loopback>;
+                               system-clock-frequency = <12288000>;
+                       };
+                       codec {
+                               sound-dai = <&dummy_codec>;
+                       };
+               };
        };
+
        audiolocker: locker {
                compatible = "amlogic, audiolocker";
                clocks = <&clkaudio CLKID_AUDIO_LOCKER_OUT
                pinctrl-0 = <&tdmc_mclk &tdmout_c &tdmin_c>;
        };
 
+       tdmlb:tdm@3 {
+               compatible = "amlogic, axg-snd-tdmlb";
+               #sound-dai-cells = <0>;
+
+               dai-tdm-lane-lb-slot-mask-in = <1 0 0 0>;
+               dai-tdm-clk-sel = <1>;
+
+               clocks = <&clkaudio CLKID_AUDIO_MCLK_B
+                               &clkc CLKID_MPLL1>;
+               clock-names = "mclk", "clk_srcpll";
+
+               /*
+                * select tdmin_lb src;
+                * AXG
+                *  0: TDMOUTA
+                *  1: TDMOUTB
+                *  2: TDMOUTC
+                *  3: PAD_TDMINA
+                *  4: PAD_TDMINB
+                *  5: PAD_TDMINC
+                *
+                * G12A/G12B
+                *  0: TDMOUTA
+                *  1: TDMOUTB
+                *  2: TDMOUTC
+                *  3: PAD_TDMINA_DIN*
+                *  4: PAD_TDMINB_DIN*
+                *  5: PAD_TDMINC_DIN*
+                *  6: PAD_TDMINA_D*, oe pin
+                *  7: PAD_TDMINB_D*, oe pin
+                *
+                * TL1
+                *  0: TDMOUTA
+                *  1: TDMOUTB
+                *  2: TDMOUTC
+                *  3: PAD_TDMINA_DIN*
+                *  4: PAD_TDMINB_DIN*
+                *  5: PAD_TDMINC_DIN*
+                *  6: PAD_TDMINA_D*
+                *  7: PAD_TDMINB_D*
+                *  8: PAD_TDMINC_D*
+                *  9: HDMIRX_I2S
+                *  10: ACODEC_ADC
+                */
+               lb-src-sel = <1>;
+
+               status = "disabled";
+       };
+
        aml_spdif: spdif {
                compatible = "amlogic, axg-snd-spdif";
                #sound-dai-cells = <0>;
                status = "okay";
        };
 
-       aml_loopback: loopback {
-               compatible = "amlogic, snd-loopback";
-
-               /*
-                * external loopback clock config
-                * enable clk while pdm record data
-                */
-               /*clocks = <&clkc CLKID_MPLL1>;*/
-               /*clock-names = "datalb_mpll";*/
+       loopback:loopback@0 {
+               compatible = "amlogic, axg-loopback";
+               #sound-dai-cells = <0>;
 
-               /*
-                * 0: out rate = in data rate;
-                * 1: out rate = loopback data rate;
-                */
-               lb_mode = <0>;
+               clocks = <&clkaudio CLKID_AUDIO_PDM
+                       &clkc CLKID_FCLK_DIV3
+                       &clkc CLKID_MPLL3
+                       &clkaudio CLKID_AUDIO_PDMIN0
+                       &clkaudio CLKID_AUDIO_PDMIN1
+                       &clkc CLKID_MPLL0
+                       &clkaudio CLKID_AUDIO_MCLK_A>;
+               clock-names = "pdm_gate",
+                       "pdm_sysclk_srcpll",
+                       "pdm_dclk_srcpll",
+                       "pdm_dclk",
+                       "pdm_sysclk",
+                       "tdminlb_mpll",
+                       "tdminlb_mclk";
 
                /* datain src
                 * 0: tdmin_a;
                 * 4: pdmin;
                 */
                datain_src = <4>;
-               datain_chnum = <8>;
-               datain_chmask = <0x7f>;
+               datain_chnum = <6>;
+               datain_chmask = <0x3f>;
+               /* config which data pin for loopback */
+               datain-lane-mask-in = <1 1 1 0>;
+
+               /* calc mclk for datalb */
+               mclk-fs = <256>;
 
                /* tdmin_lb src
                 * 0: tdmoutA
                 * 1: tdmoutB
                 * 2: tdmoutC
-                * 3: PAD_tdminA
-                * 4: PAD_tdminB
-                * 5: PAD_tdminC
+                * 3: PAD_TDMINA_DIN*, refer to core pinmux
+                * 4: PAD_TDMINB_DIN*, refer to core pinmux
+                * 5: PAD_TDMINC_DIN*, refer to core pinmux
+                * 6: PAD_TDMINA_D*, oe, refer to core pinmux
+                * 7: PAD_TDMINB_D*, oe, refer to core pinmux
                 */
-
-               /*if tdmin_lb >= 3, use external loopback*/
+               /* if tdmin_lb >= 3, use external loopback */
                datalb_src = <2>;
                datalb_chnum = <2>;
-               /*config which data pin as loopback*/
-               /*datalb-lane-mask-in = <0 0 0 1>;*/
-               datalb_chmask = <0x1>;
-
+               datalb_chmask = <0x3>;
+               /* config which data pin as loopback */
+               datalb-lane-mask-in = <1 0 0 0>;
 
                status = "okay";
        };
index 8fe15ed..b520693 100644 (file)
                compatible = "amlogic, axg-sound-card";
                aml-audio-card,name = "AML-AUGESOUND";
 
-               aml-audio-card,loopback = <&aml_loopback>;
-
                aml-audio-card,hp-det-gpio = <&gpio GPIOZ_7 GPIO_ACTIVE_LOW>;
 
                aml-audio-card,dai-link@0 {
                                sound-dai = <&aml_pdm>;
                        };
                        codec {
-                               /*
-                                *enable external loopback
-                                *and tlv320adc3101 as loopback
-                                */
-                               /*sound-dai = <&pdm_codec &tlv320adc3101_32>;*/
-                               /*
-                                * enable internal loopback
-                                * or disable loopback
-                                */
                                sound-dai = <&pdm_codec>;
                        };
                };
                                sound-dai = <&dummy_codec>;
                        };
                };
+
+               aml-audio-card,dai-link@5 {
+                       mclk-fs = <256>;
+                       continuous-clock;
+                       suffix-name = "alsaPORT-loopback";
+                       cpu {
+                               sound-dai = <&loopback>;
+                               system-clock-frequency = <12288000>;
+                       };
+                       codec {
+                               sound-dai = <&dummy_codec>;
+                       };
+               };
        };
 
        bt-dev{
                pinctrl-0 = <&tdmc_mclk &tdmout_c &tdmin_c>;
        };
 
+       tdmlb:tdm@3 {
+               compatible = "amlogic, axg-snd-tdmlb";
+               #sound-dai-cells = <0>;
+
+               dai-tdm-lane-lb-slot-mask-in = <1 0 0 0>;
+               dai-tdm-clk-sel = <1>;
+
+               clocks = <&clkaudio CLKID_AUDIO_MCLK_B
+                               &clkc CLKID_MPLL1>;
+               clock-names = "mclk", "clk_srcpll";
+
+               /*
+                * select tdmin_lb src;
+                * AXG
+                *  0: TDMOUTA
+                *  1: TDMOUTB
+                *  2: TDMOUTC
+                *  3: PAD_TDMINA
+                *  4: PAD_TDMINB
+                *  5: PAD_TDMINC
+                *
+                * G12A/G12B
+                *  0: TDMOUTA
+                *  1: TDMOUTB
+                *  2: TDMOUTC
+                *  3: PAD_TDMINA_DIN*
+                *  4: PAD_TDMINB_DIN*
+                *  5: PAD_TDMINC_DIN*
+                *  6: PAD_TDMINA_D*, oe pin
+                *  7: PAD_TDMINB_D*, oe pin
+                *
+                * TL1
+                *  0: TDMOUTA
+                *  1: TDMOUTB
+                *  2: TDMOUTC
+                *  3: PAD_TDMINA_DIN*
+                *  4: PAD_TDMINB_DIN*
+                *  5: PAD_TDMINC_DIN*
+                *  6: PAD_TDMINA_D*
+                *  7: PAD_TDMINB_D*
+                *  8: PAD_TDMINC_D*
+                *  9: HDMIRX_I2S
+                *  10: ACODEC_ADC
+                */
+               lb-src-sel = <1>;
+
+               status = "disabled";
+       };
+
        aml_spdif: spdif {
                compatible = "amlogic, axg-snd-spdif";
                #sound-dai-cells = <0>;
                status = "okay";
        };
 
-       aml_loopback: loopback {
-               compatible = "amlogic, snd-loopback";
-
-               /*
-                * external loopback clock config
-                * enable clk while pdm record data
-                */
-               /*clocks = <&clkc CLKID_MPLL1>;*/
-               /*clock-names = "datalb_mpll";*/
-
-               /*
-                * 0: out rate = in data rate;
-                * 1: out rate = loopback data rate;
-                */
+       loopback:loopback@0 {
+               compatible = "amlogic, axg-loopback";
+               #sound-dai-cells = <0>;
 
-               lb_mode = <0>;
+               clocks = <&clkaudio CLKID_AUDIO_PDM
+                       &clkc CLKID_FCLK_DIV3
+                       &clkc CLKID_MPLL3
+                       &clkaudio CLKID_AUDIO_PDMIN0
+                       &clkaudio CLKID_AUDIO_PDMIN1
+                       &clkc CLKID_MPLL0
+                       &clkaudio CLKID_AUDIO_MCLK_A>;
+               clock-names = "pdm_gate",
+                       "pdm_sysclk_srcpll",
+                       "pdm_dclk_srcpll",
+                       "pdm_dclk",
+                       "pdm_sysclk",
+                       "tdminlb_mpll",
+                       "tdminlb_mclk";
 
                /* datain src
                 * 0: tdmin_a;
                 * 4: pdmin;
                 */
                datain_src = <4>;
-               datain_chnum = <8>;
-               datain_chmask = <0x7f>;
+               datain_chnum = <6>;
+               datain_chmask = <0x3f>;
+               /* config which data pin for loopback */
+               datain-lane-mask-in = <1 1 1 0>;
+
+               /* calc mclk for datalb */
+               mclk-fs = <256>;
 
                /* tdmin_lb src
                 * 0: tdmoutA
                 * 1: tdmoutB
                 * 2: tdmoutC
-                * 3: PAD_tdminA
-                * 4: PAD_tdminB
-                * 5: PAD_tdminC
+                * 3: PAD_TDMINA_DIN*, refer to core pinmux
+                * 4: PAD_TDMINB_DIN*, refer to core pinmux
+                * 5: PAD_TDMINC_DIN*, refer to core pinmux
+                * 6: PAD_TDMINA_D*, oe, refer to core pinmux
+                * 7: PAD_TDMINB_D*, oe, refer to core pinmux
                 */
-
-               /*if tdmin_lb >= 3, use external loopback*/
+               /* if tdmin_lb >= 3, use external loopback */
                datalb_src = <2>;
                datalb_chnum = <2>;
-               /*config which data pin as loopback*/
-               /*datalb-lane-mask-in = <0 0 0 1>;*/
-               datalb_chmask = <0x1>;
+               datalb_chmask = <0x3>;
+               /* config which data pin as loopback */
+               datalb-lane-mask-in = <1 0 0 0>;
 
                status = "okay";
        };
index 3139a3b..93f4a9e 100644 (file)
                compatible = "amlogic, axg-sound-card";
                aml-audio-card,name = "AML-AUGESOUND";
 
-               aml-audio-card,loopback = <&aml_loopback>;
-
                aml-audio-card,hp-det-gpio = <&gpio GPIOZ_7 GPIO_ACTIVE_LOW>;
 
                aml-audio-card,dai-link@0 {
                                sound-dai = <&aml_pdm>;
                        };
                        codec {
-                               /*
-                                *enable external loopback
-                                *and tlv320adc3101 as loopback
-                                */
-                               /*sound-dai = <&pdm_codec &tlv320adc3101_32>;*/
-                               /*
-                                * enable internal loopback
-                                * or disable loopback
-                                */
                                sound-dai = <&pdm_codec>;
                        };
                };
                                sound-dai = <&dummy_codec>;
                        };
                };
+
+               aml-audio-card,dai-link@5 {
+                       mclk-fs = <256>;
+                       continuous-clock;
+                       suffix-name = "alsaPORT-loopback";
+                       cpu {
+                               sound-dai = <&loopback>;
+                               system-clock-frequency = <12288000>;
+                       };
+                       codec {
+                               sound-dai = <&dummy_codec>;
+                       };
+               };
        };
 
        bt-dev{
                pinctrl-0 = <&tdmc_mclk &tdmout_c &tdmin_c>;
        };
 
+       tdmlb:tdm@3 {
+               compatible = "amlogic, axg-snd-tdmlb";
+               #sound-dai-cells = <0>;
+
+               dai-tdm-lane-lb-slot-mask-in = <1 0 0 0>;
+               dai-tdm-clk-sel = <1>;
+
+               clocks = <&clkaudio CLKID_AUDIO_MCLK_B
+                               &clkc CLKID_MPLL1>;
+               clock-names = "mclk", "clk_srcpll";
+
+               /*
+                * select tdmin_lb src;
+                * AXG
+                *  0: TDMOUTA
+                *  1: TDMOUTB
+                *  2: TDMOUTC
+                *  3: PAD_TDMINA
+                *  4: PAD_TDMINB
+                *  5: PAD_TDMINC
+                *
+                * G12A/G12B
+                *  0: TDMOUTA
+                *  1: TDMOUTB
+                *  2: TDMOUTC
+                *  3: PAD_TDMINA_DIN*
+                *  4: PAD_TDMINB_DIN*
+                *  5: PAD_TDMINC_DIN*
+                *  6: PAD_TDMINA_D*, oe pin
+                *  7: PAD_TDMINB_D*, oe pin
+                *
+                * TL1
+                *  0: TDMOUTA
+                *  1: TDMOUTB
+                *  2: TDMOUTC
+                *  3: PAD_TDMINA_DIN*
+                *  4: PAD_TDMINB_DIN*
+                *  5: PAD_TDMINC_DIN*
+                *  6: PAD_TDMINA_D*
+                *  7: PAD_TDMINB_D*
+                *  8: PAD_TDMINC_D*
+                *  9: HDMIRX_I2S
+                *  10: ACODEC_ADC
+                */
+               lb-src-sel = <1>;
+
+               status = "disabled";
+       };
+
        aml_spdif: spdif {
                compatible = "amlogic, axg-snd-spdif";
                #sound-dai-cells = <0>;
                status = "okay";
        };
 
-       aml_loopback: loopback {
-               compatible = "amlogic, snd-loopback";
-
-               /*
-                * external loopback clock config
-                * enable clk while pdm record data
-                */
-               /*clocks = <&clkc CLKID_MPLL1>;*/
-               /*clock-names = "datalb_mpll";*/
-
-               /*
-                * 0: out rate = in data rate;
-                * 1: out rate = loopback data rate;
-                */
+       loopback:loopback@0 {
+               compatible = "amlogic, axg-loopback";
+               #sound-dai-cells = <0>;
 
-               lb_mode = <0>;
+               clocks = <&clkaudio CLKID_AUDIO_PDM
+                       &clkc CLKID_FCLK_DIV3
+                       &clkc CLKID_MPLL3
+                       &clkaudio CLKID_AUDIO_PDMIN0
+                       &clkaudio CLKID_AUDIO_PDMIN1
+                       &clkc CLKID_MPLL0
+                       &clkaudio CLKID_AUDIO_MCLK_A>;
+               clock-names = "pdm_gate",
+                       "pdm_sysclk_srcpll",
+                       "pdm_dclk_srcpll",
+                       "pdm_dclk",
+                       "pdm_sysclk",
+                       "tdminlb_mpll",
+                       "tdminlb_mclk";
 
                /* datain src
                 * 0: tdmin_a;
                 * 4: pdmin;
                 */
                datain_src = <4>;
-               datain_chnum = <4>;
-               datain_chmask = <0x3>;
+               datain_chnum = <6>;
+               datain_chmask = <0x3f>;
+               /* config which data pin for loopback */
+               datain-lane-mask-in = <1 1 1 0>;
+
+               /* calc mclk for datalb */
+               mclk-fs = <256>;
 
                /* tdmin_lb src
                 * 0: tdmoutA
                 * 1: tdmoutB
                 * 2: tdmoutC
-                * 3: PAD_tdminA
-                * 4: PAD_tdminB
-                * 5: PAD_tdminC
+                * 3: PAD_TDMINA_DIN*, refer to core pinmux
+                * 4: PAD_TDMINB_DIN*, refer to core pinmux
+                * 5: PAD_TDMINC_DIN*, refer to core pinmux
+                * 6: PAD_TDMINA_D*, oe, refer to core pinmux
+                * 7: PAD_TDMINB_D*, oe, refer to core pinmux
                 */
-
-               /*if tdmin_lb >= 3, use external loopback*/
+               /* if tdmin_lb >= 3, use external loopback */
                datalb_src = <2>;
                datalb_chnum = <2>;
-               /*config which data pin as loopback*/
-               /*datalb-lane-mask-in = <0 0 0 1>;*/
                datalb_chmask = <0x3>;
+               /* config which data pin as loopback */
+               datalb-lane-mask-in = <1 0 0 0>;
 
                status = "okay";
        };
+
 }; /* end of audiobus */
 
 &pinctrl_periphs {
index cf9159c..c17a829 100644 (file)
                compatible = "amlogic, axg-sound-card";
                aml-audio-card,name = "AML-AUGESOUND";
 
-               aml-audio-card,loopback = <&aml_loopback>;
-
                aml-audio-card,hp-det-gpio = <&gpio GPIOZ_7 GPIO_ACTIVE_LOW>;
 
                aml-audio-card,dai-link@0 {
                                sound-dai = <&aml_pdm>;
                        };
                        codec {
-                               /*
-                                *enable external loopback
-                                *and tlv320adc3101 as loopback
-                                */
-                               /*sound-dai = <&pdm_codec &tlv320adc3101_32>;*/
-                               /*
-                                * enable internal loopback
-                                * or disable loopback
-                                */
                                sound-dai = <&pdm_codec>;
                        };
                };
                                sound-dai = <&dummy_codec>;
                        };
                };
+
+               aml-audio-card,dai-link@5 {
+                       mclk-fs = <256>;
+                       continuous-clock;
+                       suffix-name = "alsaPORT-loopback";
+                       cpu {
+                               sound-dai = <&loopback>;
+                               system-clock-frequency = <12288000>;
+                       };
+                       codec {
+                               sound-dai = <&dummy_codec>;
+                       };
+               };
        };
 
        bt-dev{
                pinctrl-0 = <&tdmc_mclk &tdmout_c>;
        };
 
+       tdmlb:tdm@3 {
+               compatible = "amlogic, axg-snd-tdmlb";
+               #sound-dai-cells = <0>;
+
+               dai-tdm-lane-lb-slot-mask-in = <1 0 0 0>;
+               dai-tdm-clk-sel = <1>;
+
+               clocks = <&clkaudio CLKID_AUDIO_MCLK_B
+                               &clkc CLKID_MPLL1>;
+               clock-names = "mclk", "clk_srcpll";
+
+               /*
+                * select tdmin_lb src;
+                * AXG
+                *  0: TDMOUTA
+                *  1: TDMOUTB
+                *  2: TDMOUTC
+                *  3: PAD_TDMINA
+                *  4: PAD_TDMINB
+                *  5: PAD_TDMINC
+                *
+                * G12A/G12B
+                *  0: TDMOUTA
+                *  1: TDMOUTB
+                *  2: TDMOUTC
+                *  3: PAD_TDMINA_DIN*
+                *  4: PAD_TDMINB_DIN*
+                *  5: PAD_TDMINC_DIN*
+                *  6: PAD_TDMINA_D*, oe pin
+                *  7: PAD_TDMINB_D*, oe pin
+                *
+                * TL1
+                *  0: TDMOUTA
+                *  1: TDMOUTB
+                *  2: TDMOUTC
+                *  3: PAD_TDMINA_DIN*
+                *  4: PAD_TDMINB_DIN*
+                *  5: PAD_TDMINC_DIN*
+                *  6: PAD_TDMINA_D*
+                *  7: PAD_TDMINB_D*
+                *  8: PAD_TDMINC_D*
+                *  9: HDMIRX_I2S
+                *  10: ACODEC_ADC
+                */
+               lb-src-sel = <1>;
+
+               status = "disabled";
+       };
+
        aml_spdif: spdif {
                compatible = "amlogic, axg-snd-spdif";
                #sound-dai-cells = <0>;
                status = "okay";
        };
 
-       aml_loopback: loopback {
-               compatible = "amlogic, snd-loopback";
-
-               /*
-                * external loopback clock config
-                * enable clk while pdm record data
-                */
-               /*clocks = <&clkc CLKID_MPLL1>;*/
-               /*clock-names = "datalb_mpll";*/
-
-               /*
-                * 0: out rate = in data rate;
-                * 1: out rate = loopback data rate;
-                */
+       loopback:loopback@0 {
+               compatible = "amlogic, axg-loopback";
+               #sound-dai-cells = <0>;
 
-               lb_mode = <0>;
+               clocks = <&clkaudio CLKID_AUDIO_PDM
+                       &clkc CLKID_FCLK_DIV3
+                       &clkc CLKID_MPLL3
+                       &clkaudio CLKID_AUDIO_PDMIN0
+                       &clkaudio CLKID_AUDIO_PDMIN1
+                       &clkc CLKID_MPLL0
+                       &clkaudio CLKID_AUDIO_MCLK_A>;
+               clock-names = "pdm_gate",
+                       "pdm_sysclk_srcpll",
+                       "pdm_dclk_srcpll",
+                       "pdm_dclk",
+                       "pdm_sysclk",
+                       "tdminlb_mpll",
+                       "tdminlb_mclk";
 
                /* datain src
                 * 0: tdmin_a;
                 * 4: pdmin;
                 */
                datain_src = <4>;
-               datain_chnum = <8>;
-               datain_chmask = <0x7f>;
+               datain_chnum = <6>;
+               datain_chmask = <0x3f>;
+               /* config which data pin for loopback */
+               datain-lane-mask-in = <1 1 1 0>;
+
+               /* calc mclk for datalb */
+               mclk-fs = <256>;
 
                /* tdmin_lb src
                 * 0: tdmoutA
                 * 1: tdmoutB
                 * 2: tdmoutC
-                * 3: PAD_tdminA
-                * 4: PAD_tdminB
-                * 5: PAD_tdminC
+                * 3: PAD_TDMINA_DIN*, refer to core pinmux
+                * 4: PAD_TDMINB_DIN*, refer to core pinmux
+                * 5: PAD_TDMINC_DIN*, refer to core pinmux
+                * 6: PAD_TDMINA_D*, oe, refer to core pinmux
+                * 7: PAD_TDMINB_D*, oe, refer to core pinmux
                 */
-
-               /*if tdmin_lb >= 3, use external loopback*/
+               /* if tdmin_lb >= 3, use external loopback */
                datalb_src = <2>;
                datalb_chnum = <2>;
-               /*config which data pin as loopback*/
-               /*datalb-lane-mask-in = <0 0 0 1>;*/
-               datalb_chmask = <0x1>;
+               datalb_chmask = <0x3>;
+               /* config which data pin as loopback */
+               datalb-lane-mask-in = <1 0 0 0>;
 
                status = "okay";
        };
index 892b556..a0a8614 100644 (file)
                compatible = "amlogic, axg-sound-card";
                aml-audio-card,name = "AML-AUGESOUND";
 
-               aml-audio-card,loopback = <&aml_loopback>;
-
                aml-audio-card,dai-link@0 {
                        format = "dsp_a";
                        mclk-fs = <512>;
                                sound-dai = <&aml_pdm>;
                        };
                        codec {
-                               /*
-                                *enable external loopback
-                                *and tlv320adc3101 as loopback
-                                */
-                               /*sound-dai = <&pdm_codec &tlv320adc3101_32>;*/
-                               /*
-                                * enable internal loopback
-                                * or disable loopback
-                                */
                                sound-dai = <&pdm_codec>;
                        };
                };
                                sound-dai = <&dummy_codec>;
                        };
                };
+
+               aml-audio-card,dai-link@5 {
+                       mclk-fs = <256>;
+                       continuous-clock;
+                       suffix-name = "alsaPORT-loopback";
+                       cpu {
+                               sound-dai = <&loopback>;
+                               system-clock-frequency = <12288000>;
+                       };
+                       codec {
+                               sound-dai = <&dummy_codec>;
+                       };
+               };
        };
 
        bt-dev{
                pinctrl-0 = <&tdmc_mclk &tdmout_c &tdmin_c>;
        };
 
+       tdmlb:tdm@3 {
+               compatible = "amlogic, axg-snd-tdmlb";
+               #sound-dai-cells = <0>;
+
+               dai-tdm-lane-lb-slot-mask-in = <1 0 0 0>;
+               dai-tdm-clk-sel = <1>;
+
+               clocks = <&clkaudio CLKID_AUDIO_MCLK_B
+                               &clkc CLKID_MPLL1>;
+               clock-names = "mclk", "clk_srcpll";
+
+               /*
+                * select tdmin_lb src;
+                * AXG
+                *  0: TDMOUTA
+                *  1: TDMOUTB
+                *  2: TDMOUTC
+                *  3: PAD_TDMINA
+                *  4: PAD_TDMINB
+                *  5: PAD_TDMINC
+                *
+                * G12A/G12B
+                *  0: TDMOUTA
+                *  1: TDMOUTB
+                *  2: TDMOUTC
+                *  3: PAD_TDMINA_DIN*
+                *  4: PAD_TDMINB_DIN*
+                *  5: PAD_TDMINC_DIN*
+                *  6: PAD_TDMINA_D*, oe pin
+                *  7: PAD_TDMINB_D*, oe pin
+                *
+                * TL1
+                *  0: TDMOUTA
+                *  1: TDMOUTB
+                *  2: TDMOUTC
+                *  3: PAD_TDMINA_DIN*
+                *  4: PAD_TDMINB_DIN*
+                *  5: PAD_TDMINC_DIN*
+                *  6: PAD_TDMINA_D*
+                *  7: PAD_TDMINB_D*
+                *  8: PAD_TDMINC_D*
+                *  9: HDMIRX_I2S
+                *  10: ACODEC_ADC
+                */
+               lb-src-sel = <1>;
+
+               status = "disabled";
+       };
+
        aml_spdif: spdif {
                compatible = "amlogic, axg-snd-spdif";
                #sound-dai-cells = <0>;
                status = "okay";
        };
 
-       aml_loopback: loopback {
-               compatible = "amlogic, snd-loopback";
-               /*
-                * external loopback clock config
-                * enable clk while pdm record data
-                */
-               /*clocks = <&clkc CLKID_MPLL1>;*/
-               /*clock-names = "datalb_mpll";*/
+       loopback:loopback@0 {
+               compatible = "amlogic, axg-loopback";
+               #sound-dai-cells = <0>;
 
-               /*
-                * 0: out rate = in data rate;
-                * 1: out rate = loopback data rate;
-                */
-               lb_mode = <0>;
+               clocks = <&clkaudio CLKID_AUDIO_PDM
+                       &clkc CLKID_FCLK_DIV3
+                       &clkc CLKID_MPLL3
+                       &clkaudio CLKID_AUDIO_PDMIN0
+                       &clkaudio CLKID_AUDIO_PDMIN1
+                       &clkc CLKID_MPLL0
+                       &clkaudio CLKID_AUDIO_MCLK_A>;
+               clock-names = "pdm_gate",
+                       "pdm_sysclk_srcpll",
+                       "pdm_dclk_srcpll",
+                       "pdm_dclk",
+                       "pdm_sysclk",
+                       "tdminlb_mpll",
+                       "tdminlb_mclk";
 
                /* datain src
                 * 0: tdmin_a;
                 * 4: pdmin;
                 */
                datain_src = <4>;
-               datain_chnum = <8>;
-               datain_chmask = <0x7f>;
+               datain_chnum = <6>;
+               datain_chmask = <0x3f>;
+               /* config which data pin for loopback */
+               datain-lane-mask-in = <1 1 1 0>;
+
+               /* calc mclk for datalb */
+               mclk-fs = <256>;
 
                /* tdmin_lb src
                 * 0: tdmoutA
                 * 1: tdmoutB
                 * 2: tdmoutC
-                * 3: PAD_tdminA
-                * 4: PAD_tdminB
-                * 5: PAD_tdminC
+                * 3: PAD_TDMINA_DIN*, refer to core pinmux
+                * 4: PAD_TDMINB_DIN*, refer to core pinmux
+                * 5: PAD_TDMINC_DIN*, refer to core pinmux
+                * 6: PAD_TDMINA_D*, oe, refer to core pinmux
+                * 7: PAD_TDMINB_D*, oe, refer to core pinmux
                 */
-               /*if tdmin_lb >= 3, use external loopback*/
+               /* if tdmin_lb >= 3, use external loopback */
                datalb_src = <2>;
                datalb_chnum = <2>;
-               /*config which data pin as loopback*/
-               /*datalb-lane-mask-in = <0 0 0 1>;*/
-               datalb_chmask = <0x1>;
+               datalb_chmask = <0x3>;
+               /* config which data pin as loopback */
+               datalb-lane-mask-in = <1 0 0 0>;
 
                status = "okay";
        };
index fda588b..a91dd38 100644 (file)
                compatible = "amlogic, axg-sound-card";
                aml-audio-card,name = "AML-AUGESOUND";
 
-               aml-audio-card,loopback = <&aml_loopback>;
-
                aml-audio-card,dai-link@0 {
                        format = "dsp_a";
                        mclk-fs = <256>;//512
                                sound-dai = <&aml_pdm>;
                        };
                        codec {
-                               /*
-                                *enable external loopback
-                                *and tlv320adc3101 as loopback
-                                */
-                               /*sound-dai = <&pdm_codec &tlv320adc3101_32>;*/
-                               /*
-                                * enable internal loopback
-                                * or disable loopback
-                                */
                                sound-dai = <&pdm_codec>;
                        };
                };
                                sound-dai = <&dummy_codec>;
                        };
                };
+
+               aml-audio-card,dai-link@5 {
+                       mclk-fs = <256>;
+                       continuous-clock;
+                       suffix-name = "alsaPORT-loopback";
+                       cpu {
+                               sound-dai = <&loopback>;
+                               system-clock-frequency = <12288000>;
+                       };
+                       codec {
+                               sound-dai = <&dummy_codec>;
+                       };
+               };
        };
 
        bt-dev{
                pinctrl-0 = <&tdmc_mclk &tdmout_c &tdmin_c>;
        };
 
+       tdmlb:tdm@3 {
+               compatible = "amlogic, axg-snd-tdmlb";
+               #sound-dai-cells = <0>;
+
+               dai-tdm-lane-lb-slot-mask-in = <1 0 0 0>;
+               dai-tdm-clk-sel = <1>;
+
+               clocks = <&clkaudio CLKID_AUDIO_MCLK_B
+                               &clkc CLKID_MPLL1>;
+               clock-names = "mclk", "clk_srcpll";
+
+               /*
+                * select tdmin_lb src;
+                * AXG
+                *  0: TDMOUTA
+                *  1: TDMOUTB
+                *  2: TDMOUTC
+                *  3: PAD_TDMINA
+                *  4: PAD_TDMINB
+                *  5: PAD_TDMINC
+                *
+                * G12A/G12B
+                *  0: TDMOUTA
+                *  1: TDMOUTB
+                *  2: TDMOUTC
+                *  3: PAD_TDMINA_DIN*
+                *  4: PAD_TDMINB_DIN*
+                *  5: PAD_TDMINC_DIN*
+                *  6: PAD_TDMINA_D*, oe pin
+                *  7: PAD_TDMINB_D*, oe pin
+                *
+                * TL1
+                *  0: TDMOUTA
+                *  1: TDMOUTB
+                *  2: TDMOUTC
+                *  3: PAD_TDMINA_DIN*
+                *  4: PAD_TDMINB_DIN*
+                *  5: PAD_TDMINC_DIN*
+                *  6: PAD_TDMINA_D*
+                *  7: PAD_TDMINB_D*
+                *  8: PAD_TDMINC_D*
+                *  9: HDMIRX_I2S
+                *  10: ACODEC_ADC
+                */
+               lb-src-sel = <1>;
+
+               status = "disabled";
+       };
+
        aml_spdif: spdif {
                compatible = "amlogic, axg-snd-spdif";
                #sound-dai-cells = <0>;
                status = "okay";
        };
 
-       aml_loopback: loopback {
-               compatible = "amlogic, snd-loopback";
-               /*
-                * external loopback clk config
-                * enable clk while pdm record data
-                */
-               /*clocks = <&clkc CLKID_MPLL1>;*/
-               /*clock-names = "datalb_mpll";*/
+       loopback:loopback@0 {
+               compatible = "amlogic, axg-loopback";
+               #sound-dai-cells = <0>;
 
-               /*
-                * 0: out rate = in data rate;
-                * 1: out rate = loopback data rate;
-                */
-               lb_mode = <0>;
+               clocks = <&clkaudio CLKID_AUDIO_PDM
+                       &clkc CLKID_FCLK_DIV3
+                       &clkc CLKID_MPLL3
+                       &clkaudio CLKID_AUDIO_PDMIN0
+                       &clkaudio CLKID_AUDIO_PDMIN1
+                       &clkc CLKID_MPLL0
+                       &clkaudio CLKID_AUDIO_MCLK_A>;
+               clock-names = "pdm_gate",
+                       "pdm_sysclk_srcpll",
+                       "pdm_dclk_srcpll",
+                       "pdm_dclk",
+                       "pdm_sysclk",
+                       "tdminlb_mpll",
+                       "tdminlb_mclk";
 
                /* datain src
                 * 0: tdmin_a;
                 * 4: pdmin;
                 */
                datain_src = <4>;
-               datain_chnum = <8>;
-               datain_chmask = <0x7f>;
+               datain_chnum = <6>;
+               datain_chmask = <0x3f>;
+               /* config which data pin for loopback */
+               datain-lane-mask-in = <1 1 1 0>;
+
+               /* calc mclk for datalb */
+               mclk-fs = <256>;
 
                /* tdmin_lb src
                 * 0: tdmoutA
                 * 1: tdmoutB
                 * 2: tdmoutC
-                * 3: PAD_tdminA
-                * 4: PAD_tdminB
-                * 5: PAD_tdminC
+                * 3: PAD_TDMINA_DIN*, refer to core pinmux
+                * 4: PAD_TDMINB_DIN*, refer to core pinmux
+                * 5: PAD_TDMINC_DIN*, refer to core pinmux
+                * 6: PAD_TDMINA_D*, oe, refer to core pinmux
+                * 7: PAD_TDMINB_D*, oe, refer to core pinmux
                 */
-               /*if tdmin_lb >= 3, use external loopback*/
-               datalb_src = <1>;
+               /* if tdmin_lb >= 3, use external loopback */
+               datalb_src = <2>;
                datalb_chnum = <2>;
-               /*config which data pin as loopback*/
-               /*datalb-lane-mask-in = <0 1>;*/
-               datalb_chmask = <0x1>;
+               datalb_chmask = <0x3>;
+               /* config which data pin as loopback */
+               datalb-lane-mask-in = <1 0 0 0>;
 
                status = "okay";
        };
index 440bff0..ea797b9 100644 (file)
                compatible = "amlogic, axg-sound-card";
                aml-audio-card,name = "AML-AUGESOUND";
 
-               aml-audio-card,loopback = <&aml_loopback>;
-
                aml-audio-card,dai-link@0 {
                        format = "dsp_a";
                        mclk-fs = <256>;//512
                                sound-dai = <&aml_pdm>;
                        };
                        codec {
-                               /*
-                                *enable external loopback
-                                *and tlv320adc3101 as loopback
-                                */
-                               /*sound-dai = <&pdm_codec &tlv320adc3101_32>;*/
-                               /*
-                                * enable internal loopback
-                                * or disable loopback
-                                */
                                sound-dai = <&pdm_codec>;
                        };
                };
                                sound-dai = <&dummy_codec>;
                        };
                };
+
+               aml-audio-card,dai-link@5 {
+                       mclk-fs = <256>;
+                       continuous-clock;
+                       suffix-name = "alsaPORT-loopback";
+                       cpu {
+                               sound-dai = <&loopback>;
+                               system-clock-frequency = <12288000>;
+                       };
+                       codec {
+                               sound-dai = <&dummy_codec>;
+                       };
+               };
        };
 
        bt-dev{
                pinctrl-0 = <&tdmc_mclk &tdmout_c &tdmin_c>;
        };
 
+       tdmlb:tdm@3 {
+               compatible = "amlogic, axg-snd-tdmlb";
+               #sound-dai-cells = <0>;
+
+               dai-tdm-lane-lb-slot-mask-in = <1 0 0 0>;
+               dai-tdm-clk-sel = <1>;
+
+               clocks = <&clkaudio CLKID_AUDIO_MCLK_B
+                               &clkc CLKID_MPLL1>;
+               clock-names = "mclk", "clk_srcpll";
+
+               /*
+                * select tdmin_lb src;
+                * AXG
+                *  0: TDMOUTA
+                *  1: TDMOUTB
+                *  2: TDMOUTC
+                *  3: PAD_TDMINA
+                *  4: PAD_TDMINB
+                *  5: PAD_TDMINC
+                *
+                * G12A/G12B
+                *  0: TDMOUTA
+                *  1: TDMOUTB
+                *  2: TDMOUTC
+                *  3: PAD_TDMINA_DIN*
+                *  4: PAD_TDMINB_DIN*
+                *  5: PAD_TDMINC_DIN*
+                *  6: PAD_TDMINA_D*, oe pin
+                *  7: PAD_TDMINB_D*, oe pin
+                *
+                * TL1
+                *  0: TDMOUTA
+                *  1: TDMOUTB
+                *  2: TDMOUTC
+                *  3: PAD_TDMINA_DIN*
+                *  4: PAD_TDMINB_DIN*
+                *  5: PAD_TDMINC_DIN*
+                *  6: PAD_TDMINA_D*
+                *  7: PAD_TDMINB_D*
+                *  8: PAD_TDMINC_D*
+                *  9: HDMIRX_I2S
+                *  10: ACODEC_ADC
+                */
+               lb-src-sel = <1>;
+
+               status = "disabled";
+       };
+
        aml_spdif: spdif {
                compatible = "amlogic, axg-snd-spdif";
                #sound-dai-cells = <0>;
                status = "okay";
        };
 
-       aml_loopback: loopback {
-               compatible = "amlogic, snd-loopback";
-               /*
-                * external loopback clk config
-                * enable clk while pdm record data
-                */
-               /*clocks = <&clkc CLKID_MPLL1>;*/
-               /*clock-names = "datalb_mpll";*/
-               /*
-                * 0: out rate = in data rate;
-                * 1: out rate = loopback data rate;
-                */
-               lb_mode = <0>;
+       loopback:loopback@0 {
+               compatible = "amlogic, axg-loopback";
+               #sound-dai-cells = <0>;
+
+               clocks = <&clkaudio CLKID_AUDIO_PDM
+                       &clkc CLKID_FCLK_DIV3
+                       &clkc CLKID_MPLL3
+                       &clkaudio CLKID_AUDIO_PDMIN0
+                       &clkaudio CLKID_AUDIO_PDMIN1
+                       &clkc CLKID_MPLL0
+                       &clkaudio CLKID_AUDIO_MCLK_A>;
+               clock-names = "pdm_gate",
+                       "pdm_sysclk_srcpll",
+                       "pdm_dclk_srcpll",
+                       "pdm_dclk",
+                       "pdm_sysclk",
+                       "tdminlb_mpll",
+                       "tdminlb_mclk";
 
                /* datain src
                 * 0: tdmin_a;
                 * 4: pdmin;
                 */
                datain_src = <4>;
-               datain_chnum = <8>;
-               datain_chmask = <0x7f>;
+               datain_chnum = <6>;
+               datain_chmask = <0x3f>;
+               /* config which data pin for loopback */
+               datain-lane-mask-in = <1 1 1 0>;
+
+               /* calc mclk for datalb */
+               mclk-fs = <256>;
 
                /* tdmin_lb src
                 * 0: tdmoutA
                 * 1: tdmoutB
                 * 2: tdmoutC
-                * 3: PAD_tdminA
-                * 4: PAD_tdminB
-                * 5: PAD_tdminC
+                * 3: PAD_TDMINA_DIN*, refer to core pinmux
+                * 4: PAD_TDMINB_DIN*, refer to core pinmux
+                * 5: PAD_TDMINC_DIN*, refer to core pinmux
+                * 6: PAD_TDMINA_D*, oe, refer to core pinmux
+                * 7: PAD_TDMINB_D*, oe, refer to core pinmux
                 */
-               /*if tdmin_lb >= 3, use external loopback*/
+               /* if tdmin_lb >= 3, use external loopback */
                datalb_src = <2>;
                datalb_chnum = <2>;
-               /*config which data pin as loopback*/
-               /*datalb-lane-mask-in = <0 1>;*/
-               datalb_chmask = <0x1>;
+               datalb_chmask = <0x3>;
+               /* config which data pin as loopback */
+               datalb-lane-mask-in = <1 0 0 0>;
 
                status = "okay";
        };
index 05ab48d..e1808c1 100644 (file)
                compatible = "amlogic, axg-sound-card";
                aml-audio-card,name = "AML-AUGESOUND";
 
-               aml-audio-card,loopback = <&aml_loopback>;
-
                aml-audio-card,hp-det-gpio = <&gpio GPIOZ_7 GPIO_ACTIVE_LOW>;
 
                aml-audio-card,dai-link@0 {
                                sound-dai = <&aml_pdm>;
                        };
                        codec {
-                               /*
-                                *enable external loopback
-                                *and tlv320adc3101 as loopback
-                                */
-                               /*sound-dai = <&pdm_codec &tlv320adc3101_32>;*/
-                               /*
-                                * enable internal loopback
-                                * or disable loopback
-                                */
                                sound-dai = <&pdm_codec>;
                        };
                };
                                sound-dai = <&dummy_codec>;
                        };
                };
+
+               aml-audio-card,dai-link@5 {
+                       mclk-fs = <256>;
+                       continuous-clock;
+                       suffix-name = "alsaPORT-loopback";
+                       cpu {
+                               sound-dai = <&loopback>;
+                               system-clock-frequency = <12288000>;
+                       };
+                       codec {
+                               sound-dai = <&dummy_codec>;
+                       };
+               };
        };
 
        bt-dev{
                pinctrl-0 = <&tdmc_mclk &tdmout_c &tdmin_c>;
        };
 
+       tdmlb:tdm@3 {
+               compatible = "amlogic, axg-snd-tdmlb";
+               #sound-dai-cells = <0>;
+
+               dai-tdm-lane-lb-slot-mask-in = <1 0 0 0>;
+               dai-tdm-clk-sel = <1>;
+
+               clocks = <&clkaudio CLKID_AUDIO_MCLK_B
+                               &clkc CLKID_MPLL1>;
+               clock-names = "mclk", "clk_srcpll";
+
+               /*
+                * select tdmin_lb src;
+                * AXG
+                *  0: TDMOUTA
+                *  1: TDMOUTB
+                *  2: TDMOUTC
+                *  3: PAD_TDMINA
+                *  4: PAD_TDMINB
+                *  5: PAD_TDMINC
+                *
+                * G12A/G12B
+                *  0: TDMOUTA
+                *  1: TDMOUTB
+                *  2: TDMOUTC
+                *  3: PAD_TDMINA_DIN*
+                *  4: PAD_TDMINB_DIN*
+                *  5: PAD_TDMINC_DIN*
+                *  6: PAD_TDMINA_D*, oe pin
+                *  7: PAD_TDMINB_D*, oe pin
+                *
+                * TL1
+                *  0: TDMOUTA
+                *  1: TDMOUTB
+                *  2: TDMOUTC
+                *  3: PAD_TDMINA_DIN*
+                *  4: PAD_TDMINB_DIN*
+                *  5: PAD_TDMINC_DIN*
+                *  6: PAD_TDMINA_D*
+                *  7: PAD_TDMINB_D*
+                *  8: PAD_TDMINC_D*
+                *  9: HDMIRX_I2S
+                *  10: ACODEC_ADC
+                */
+               lb-src-sel = <1>;
+
+               status = "disabled";
+       };
+
        aml_spdif: spdif {
                compatible = "amlogic, axg-snd-spdif";
                #sound-dai-cells = <0>;
                status = "okay";
        };
 
-       aml_loopback: loopback {
-               compatible = "amlogic, snd-loopback";
-               /*
-                * external loopback clk config
-                * enable clk while pdm record data
-                */
-               /*clocks = <&clkc CLKID_MPLL1>;*/
-               /*clock-names = "datalb_mpll";*/
+       loopback:loopback@0 {
+               compatible = "amlogic, axg-loopback";
+               #sound-dai-cells = <0>;
 
-               /*
-                * 0: out rate = in data rate;
-                * 1: out rate = loopback data rate;
-                */
-               lb_mode = <0>;
+               clocks = <&clkaudio CLKID_AUDIO_PDM
+                       &clkc CLKID_FCLK_DIV3
+                       &clkc CLKID_MPLL3
+                       &clkaudio CLKID_AUDIO_PDMIN0
+                       &clkaudio CLKID_AUDIO_PDMIN1
+                       &clkc CLKID_MPLL0
+                       &clkaudio CLKID_AUDIO_MCLK_A>;
+               clock-names = "pdm_gate",
+                       "pdm_sysclk_srcpll",
+                       "pdm_dclk_srcpll",
+                       "pdm_dclk",
+                       "pdm_sysclk",
+                       "tdminlb_mpll",
+                       "tdminlb_mclk";
 
                /* datain src
                 * 0: tdmin_a;
                 * 4: pdmin;
                 */
                datain_src = <4>;
-               datain_chnum = <8>;
-               datain_chmask = <0x7f>;
+               datain_chnum = <6>;
+               datain_chmask = <0x3f>;
+               /* config which data pin for loopback */
+               datain-lane-mask-in = <1 1 1 0>;
+
+               /* calc mclk for datalb */
+               mclk-fs = <256>;
 
                /* tdmin_lb src
                 * 0: tdmoutA
                 * 1: tdmoutB
                 * 2: tdmoutC
-                * 3: PAD_tdminA
-                * 4: PAD_tdminB
-                * 5: PAD_tdminC
+                * 3: PAD_TDMINA_DIN*, refer to core pinmux
+                * 4: PAD_TDMINB_DIN*, refer to core pinmux
+                * 5: PAD_TDMINC_DIN*, refer to core pinmux
+                * 6: PAD_TDMINA_D*, oe, refer to core pinmux
+                * 7: PAD_TDMINB_D*, oe, refer to core pinmux
                 */
-
-               /*if tdmin_lb >= 3, use external loopback*/
+               /* if tdmin_lb >= 3, use external loopback */
                datalb_src = <2>;
                datalb_chnum = <2>;
-               /*config which data pin as loopback*/
-               /*datalb-lane-mask-in = <0 1>;*/
-               datalb_chmask = <0x1>;
+               datalb_chmask = <0x3>;
+               /* config which data pin as loopback */
+               datalb-lane-mask-in = <1 0 0 0>;
 
                status = "okay";
        };
index 481aec0..44bae5c 100644 (file)
                compatible = "amlogic, axg-sound-card";
                aml-audio-card,name = "AML-AUGESOUND";
 
-               aml-audio-card,loopback = <&aml_loopback>;
-
                aml-audio-card,hp-det-gpio = <&gpio GPIOZ_7 GPIO_ACTIVE_LOW>;
 
                aml-audio-card,dai-link@0 {
                                sound-dai = <&aml_pdm>;
                        };
                        codec {
-                               /*
-                                *enable external loopback
-                                *and tlv320adc3101 as loopback
-                                */
-                               /*sound-dai = <&pdm_codec &tlv320adc3101_32>;*/
-                               /*
-                                * enable internal loopback
-                                * or disable loopback
-                                */
                                sound-dai = <&pdm_codec>;
                        };
                };
                 *      };
                 *};
                 */
+               aml-audio-card,dai-link@5 {
+                       mclk-fs = <256>;
+                       continuous-clock;
+                       suffix-name = "alsaPORT-loopback";
+                       cpu {
+                               sound-dai = <&loopback>;
+                               system-clock-frequency = <12288000>;
+                       };
+                       codec {
+                               sound-dai = <&dummy_codec>;
+                       };
+               };
        };
 
        bt-dev{
                pinctrl-0 = <&tdmc_mclk &tdmout_c &tdmin_c>;
        };
 
+       tdmlb:tdm@3 {
+               compatible = "amlogic, axg-snd-tdmlb";
+               #sound-dai-cells = <0>;
+
+               dai-tdm-lane-lb-slot-mask-in = <1 0 0 0>;
+               dai-tdm-clk-sel = <1>;
+
+               clocks = <&clkaudio CLKID_AUDIO_MCLK_B
+                               &clkc CLKID_MPLL1>;
+               clock-names = "mclk", "clk_srcpll";
+
+               /*
+                * select tdmin_lb src;
+                * AXG
+                *  0: TDMOUTA
+                *  1: TDMOUTB
+                *  2: TDMOUTC
+                *  3: PAD_TDMINA
+                *  4: PAD_TDMINB
+                *  5: PAD_TDMINC
+                *
+                * G12A/G12B
+                *  0: TDMOUTA
+                *  1: TDMOUTB
+                *  2: TDMOUTC
+                *  3: PAD_TDMINA_DIN*
+                *  4: PAD_TDMINB_DIN*
+                *  5: PAD_TDMINC_DIN*
+                *  6: PAD_TDMINA_D*, oe pin
+                *  7: PAD_TDMINB_D*, oe pin
+                *
+                * TL1
+                *  0: TDMOUTA
+                *  1: TDMOUTB
+                *  2: TDMOUTC
+                *  3: PAD_TDMINA_DIN*
+                *  4: PAD_TDMINB_DIN*
+                *  5: PAD_TDMINC_DIN*
+                *  6: PAD_TDMINA_D*
+                *  7: PAD_TDMINB_D*
+                *  8: PAD_TDMINC_D*
+                *  9: HDMIRX_I2S
+                *  10: ACODEC_ADC
+                */
+               lb-src-sel = <1>;
+
+               status = "disabled";
+       };
+
        aml_spdif: spdif {
                compatible = "amlogic, axg-snd-spdif";
                #sound-dai-cells = <0>;
                status = "okay";
        };
 
-       aml_loopback: loopback {
-               compatible = "amlogic, snd-loopback";
-               /*
-                * external loopback clk config
-                * enable clk while pdm record data
-                */
-               /*clocks = <&clkc CLKID_MPLL1>;*/
-               /*clock-names = "datalb_mpll";*/
+       loopback:loopback@0 {
+               compatible = "amlogic, axg-loopback";
+               #sound-dai-cells = <0>;
 
-               /*
-                * 0: out rate = in data rate;
-                * 1: out rate = loopback data rate;
-                */
-               lb_mode = <0>;
+               clocks = <&clkaudio CLKID_AUDIO_PDM
+                       &clkc CLKID_FCLK_DIV3
+                       &clkc CLKID_MPLL3
+                       &clkaudio CLKID_AUDIO_PDMIN0
+                       &clkaudio CLKID_AUDIO_PDMIN1
+                       &clkc CLKID_MPLL0
+                       &clkaudio CLKID_AUDIO_MCLK_A>;
+               clock-names = "pdm_gate",
+                       "pdm_sysclk_srcpll",
+                       "pdm_dclk_srcpll",
+                       "pdm_dclk",
+                       "pdm_sysclk",
+                       "tdminlb_mpll",
+                       "tdminlb_mclk";
 
                /* datain src
                 * 0: tdmin_a;
                 * 4: pdmin;
                 */
                datain_src = <4>;
-               datain_chnum = <4>;
-               datain_chmask = <0x3>;
+               datain_chnum = <6>;
+               datain_chmask = <0x3f>;
+               /* config which data pin for loopback */
+               datain-lane-mask-in = <1 1 1 0>;
+
+               /* calc mclk for datalb */
+               mclk-fs = <256>;
 
                /* tdmin_lb src
                 * 0: tdmoutA
                 * 1: tdmoutB
                 * 2: tdmoutC
-                * 3: PAD_tdminA
-                * 4: PAD_tdminB
-                * 5: PAD_tdminC
+                * 3: PAD_TDMINA_DIN*, refer to core pinmux
+                * 4: PAD_TDMINB_DIN*, refer to core pinmux
+                * 5: PAD_TDMINC_DIN*, refer to core pinmux
+                * 6: PAD_TDMINA_D*, oe, refer to core pinmux
+                * 7: PAD_TDMINB_D*, oe, refer to core pinmux
                 */
-
-               /*if tdmin_lb >= 3, use external loopback*/
+               /* if tdmin_lb >= 3, use external loopback */
                datalb_src = <2>;
                datalb_chnum = <2>;
-               /*config which data pin as loopback*/
-               /*datalb-lane-mask-in = <0 1>;*/
                datalb_chmask = <0x3>;
+               /* config which data pin as loopback */
+               datalb-lane-mask-in = <1 0 0 0>;
 
                status = "okay";
        };
+
 }; /* end of audiobus */
 
 &pinctrl_periphs {
index 3ce2558..714281a 100644 (file)
                compatible = "amlogic, g12a-sound-card";
                aml-audio-card,name = "AML-AUGESOUND";
 
-               aml-audio-card,loopback = <&aml_loopback>;
                aml-audio-card,aux-devs = <&amlogic_codec>;
                /*avout mute gpio*/
                avout_mute-gpios = <&gpio_ao GPIOAO_2 GPIO_ACTIVE_HIGH>;
                                sound-dai = <&dummy_codec>;
                        };
                };
+
+               aml-audio-card,dai-link@6 {
+                       mclk-fs = <256>;
+                       continuous-clock;
+                       suffix-name = "alsaPORT-loopback";
+                       cpu {
+                               sound-dai = <&loopback>;
+                               system-clock-frequency = <12288000>;
+                       };
+                       codec {
+                               sound-dai = <&dummy_codec>;
+                       };
+               };
+
+               aml-audio-card,dai-link@7 {
+                       format = "i2s";
+                       mclk-fs = <256>;
+                       //continuous-clock;
+                       //bitclock-inversion;
+                       //frame-inversion;
+                       bitclock-master = <&tdmlb>;
+                       frame-master = <&tdmlb>;
+                       cpu {
+                               sound-dai = <&tdmlb>;
+                               dai-tdm-slot-rx-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";
                        "samesource_srcpll", "samesource_clk";
                pinctrl-names = "tdm_pins";
                pinctrl-0 = <&tdmb_mclk &tdmout_b &tdmin_b>;
+               mclk_pad = <0>;  /* 0: mclk_0; 1: mclk_1 */
                /*
                 * 0: tdmout_a;
                 * 1: tdmout_b;
                clock-names = "mclk", "clk_srcpll";
                pinctrl-names = "tdm_pins";
                pinctrl-0 = <&tdmc_mclk &tdmout_c &tdmin_c>;
+               mclk_pad = <1>;  /* 0: mclk_0; 1: mclk_1 */
        };
 
+       tdmlb: tdm@3 {
+               compatible = "amlogic, g12a-snd-tdmlb";
+               #sound-dai-cells = <0>;
+               dai-tdm-lane-lb-slot-mask-in = <1 0 0 0>;
+               dai-tdm-clk-sel = <1>;
+               clocks = <&clkaudio CLKID_AUDIO_MCLK_B
+                               &clkc CLKID_MPLL1>;
+               clock-names = "mclk", "clk_srcpll";
+               /*
+                * select tdmin_lb src;
+                *0: TDMOUTA
+                *1: TDMOUTB
+                *2: TDMOUTC
+                *3: PAD_TDMINA
+                *4: PAD_TDMINB
+                *5: PAD_TDMINC
+                */
+               lb-src-sel = <1>;
+
+               status = "okay";
+       };
 
        aml_spdif: spdif {
                compatible = "amlogic, g12a-snd-spdif-a";
                filter_mode = <1>; /* mode 0~4, defalut:1 */
                status = "okay";
        };
-       aml_loopback: loopback {
-               compatible = "amlogic, snd-loopback";
-               /*
-                * 0: out rate = in data rate;
-                * 1: out rate = loopback data rate;
-                */
-               lb_mode = <0>;
+
+       loopback:loopback@0 {
+               compatible = "amlogic, g12a-loopback";
+               #sound-dai-cells = <0>;
+
+               clocks = <&clkaudio CLKID_AUDIO_PDM
+                       &clkc CLKID_FCLK_DIV3
+                       &clkc CLKID_MPLL3
+                       &clkaudio CLKID_AUDIO_PDMIN0
+                       &clkaudio CLKID_AUDIO_PDMIN1
+                       &clkc CLKID_MPLL0
+                       &clkaudio CLKID_AUDIO_MCLK_A>;
+               clock-names = "pdm_gate",
+                       "pdm_sysclk_srcpll",
+                       "pdm_dclk_srcpll",
+                       "pdm_dclk",
+                       "pdm_sysclk",
+                       "tdminlb_mpll",
+                       "tdminlb_mclk";
 
                /* datain src
                 * 0: tdmin_a;
                 * 4: pdmin;
                 */
                datain_src = <4>;
-               datain_chnum = <8>;
-               datain_chmask = <0x3f>;
+               datain_chnum = <4>;
+               datain_chmask = <0xf>;
+               /* config which data pin for loopback */
+               datain-lane-mask-in = <1 0 1 0>;
+
+               /* calc mclk for datalb */
+               mclk-fs = <256>;
 
                /* tdmin_lb src
                 * 0: tdmoutA
                 * 1: tdmoutB
                 * 2: tdmoutC
-                * 3: PAD_tdminA
-                * 4: PAD_tdminB
-                * 5: PAD_tdminC
+                * 3: PAD_TDMINA_DIN*, refer to core pinmux
+                * 4: PAD_TDMINB_DIN*, refer to core pinmux
+                * 5: PAD_TDMINC_DIN*, refer to core pinmux
+                * 6: PAD_TDMINA_D*, oe, refer to core pinmux
+                * 7: PAD_TDMINB_D*, oe, refer to core pinmux
                 */
-               datalb_src = <2>;
-               datalb_chnum = <8>;
+               /* if tdmin_lb >= 3, use external loopback */
+               datalb_src = <1>;
+               datalb_chnum = <2>;
                datalb_chmask = <0x3>;
+               /* config which data pin as loopback */
+               datalb-lane-mask-in = <1 0 0 0>;
 
                status = "okay";
        };
index b412fe1..06193c8 100644 (file)
                compatible = "amlogic, g12a-sound-card";
                aml-audio-card,name = "AML-AUGESOUND";
 
-               aml-audio-card,loopback = <&aml_loopback>;
                aml-audio-card,aux-devs = <&amlogic_codec>;
                /*avout mute gpio*/
                avout_mute-gpios = <&gpio_ao GPIOAO_2 GPIO_ACTIVE_HIGH>;
                                sound-dai = <&dummy_codec>;
                        };
                };
+               aml-audio-card,dai-link@6 {
+                       mclk-fs = <256>;
+                       continuous-clock;
+                       suffix-name = "alsaPORT-loopback";
+                       cpu {
+                               sound-dai = <&loopback>;
+                               system-clock-frequency = <12288000>;
+                       };
+                       codec {
+                               sound-dai = <&dummy_codec>;
+                       };
+               };
+
+               aml-audio-card,dai-link@7 {
+                       format = "i2s";
+                       mclk-fs = <256>;
+                       //continuous-clock;
+                       //bitclock-inversion;
+                       //frame-inversion;
+                       bitclock-master = <&tdmlb>;
+                       frame-master = <&tdmlb>;
+                       cpu {
+                               sound-dai = <&tdmlb>;
+                               dai-tdm-slot-rx-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";
                clock-names = "mclk", "clk_srcpll";
                pinctrl-names = "tdm_pins";
                pinctrl-0 = <&tdmb_mclk &tdmout_b &tdmin_b>;
+               mclk_pad = <0>;  /* 0: mclk_0; 1: mclk_1 */
                /*
                 * 0: tdmout_a;
                 * 1: tdmout_b;
                clock-names = "mclk", "clk_srcpll";
                pinctrl-names = "tdm_pins";
                pinctrl-0 = <&tdmc_mclk &tdmout_c &tdmin_c>;
+               mclk_pad = <1>;  /* 0: mclk_0; 1: mclk_1 */
+       };
+
+       tdmlb: tdm@3 {
+               compatible = "amlogic, g12a-snd-tdmlb";
+               #sound-dai-cells = <0>;
+               dai-tdm-lane-lb-slot-mask-in = <1 0 0 0>;
+               dai-tdm-clk-sel = <1>;
+               clocks = <&clkaudio CLKID_AUDIO_MCLK_B
+                               &clkc CLKID_MPLL1>;
+               clock-names = "mclk", "clk_srcpll";
+               /*
+                * select tdmin_lb src;
+                *0: TDMOUTA
+                *1: TDMOUTB
+                *2: TDMOUTC
+                *3: PAD_TDMINA
+                *4: PAD_TDMINB
+                *5: PAD_TDMINC
+                */
+               lb-src-sel = <1>;
+
+               status = "okay";
        };
 
        aml_spdif: spdif {
                filter_mode = <1>; /* mode 0~4, defalut:1 */
                status = "okay";
        };
-       aml_loopback: loopback {
-               compatible = "amlogic, snd-loopback";
-               /*
-                * 0: out rate = in data rate;
-                * 1: out rate = loopback data rate;
-                */
-               lb_mode = <0>;
+
+       loopback:loopback@0 {
+               compatible = "amlogic, g12a-loopback";
+               #sound-dai-cells = <0>;
+
+               clocks = <&clkaudio CLKID_AUDIO_PDM
+                       &clkc CLKID_FCLK_DIV3
+                       &clkc CLKID_MPLL3
+                       &clkaudio CLKID_AUDIO_PDMIN0
+                       &clkaudio CLKID_AUDIO_PDMIN1
+                       &clkc CLKID_MPLL0
+                       &clkaudio CLKID_AUDIO_MCLK_A>;
+               clock-names = "pdm_gate",
+                       "pdm_sysclk_srcpll",
+                       "pdm_dclk_srcpll",
+                       "pdm_dclk",
+                       "pdm_sysclk",
+                       "tdminlb_mpll",
+                       "tdminlb_mclk";
 
                /* datain src
                 * 0: tdmin_a;
                 * 4: pdmin;
                 */
                datain_src = <4>;
-               datain_chnum = <8>;
-               datain_chmask = <0x3f>;
+               datain_chnum = <4>;
+               datain_chmask = <0xf>;
+               /* config which data pin for loopback */
+               datain-lane-mask-in = <1 0 1 0>;
+
+               /* calc mclk for datalb */
+               mclk-fs = <256>;
 
                /* tdmin_lb src
                 * 0: tdmoutA
                 * 1: tdmoutB
                 * 2: tdmoutC
-                * 3: PAD_tdminA
-                * 4: PAD_tdminB
-                * 5: PAD_tdminC
+                * 3: PAD_TDMINA_DIN*, refer to core pinmux
+                * 4: PAD_TDMINB_DIN*, refer to core pinmux
+                * 5: PAD_TDMINC_DIN*, refer to core pinmux
+                * 6: PAD_TDMINA_D*, oe, refer to core pinmux
+                * 7: PAD_TDMINB_D*, oe, refer to core pinmux
                 */
-               datalb_src = <2>;
-               datalb_chnum = <8>;
+               /* if tdmin_lb >= 3, use external loopback */
+               datalb_src = <1>;
+               datalb_chnum = <2>;
                datalb_chmask = <0x3>;
+               /* config which data pin as loopback */
+               datalb-lane-mask-in = <1 0 0 0>;
 
                status = "okay";
        };
index b8be699..b4cd599 100644 (file)
                compatible = "amlogic, g12a-sound-card";
                aml-audio-card,name = "AML-AUGESOUND";
 
-               aml-audio-card,loopback = <&aml_loopback>;
                aml-audio-card,aux-devs = <&amlogic_codec>;
                /*avout mute gpio*/
                avout_mute-gpios = <&gpio_ao GPIOAO_2 GPIO_ACTIVE_HIGH>;
                                sound-dai = <&dummy_codec>;
                        };
                };
+
+               aml-audio-card,dai-link@6 {
+                       mclk-fs = <256>;
+                       continuous-clock;
+                       suffix-name = "alsaPORT-loopback";
+                       cpu {
+                               sound-dai = <&loopback>;
+                               system-clock-frequency = <12288000>;
+                       };
+                       codec {
+                               sound-dai = <&dummy_codec>;
+                       };
+               };
+
                /*
                 * dai link for i2s to hdmix,
                 * Notice to select a tdm lane not used by hw
                        "samesource_srcpll", "samesource_clk";
                pinctrl-names = "tdm_pins";
                pinctrl-0 = <&tdmb_mclk &tdmout_b &tdmin_b>;
+               mclk_pad = <0>;  /* 0: mclk_0; 1: mclk_1 */
                /*
                 * 0: tdmout_a;
                 * 1: tdmout_b;
                clock-names = "mclk", "clk_srcpll";
                pinctrl-names = "tdm_pins";
                pinctrl-0 = <&tdmc_mclk &tdmout_c &tdmin_c>;
+               mclk_pad = <1>;  /* 0: mclk_0; 1: mclk_1 */
+       };
+
+
+       tdmlb: tdm@3 {
+               compatible = "amlogic, g12a-snd-tdmlb";
+               #sound-dai-cells = <0>;
+               dai-tdm-lane-lb-slot-mask-in = <1 0 0 0>;
+               dai-tdm-clk-sel = <1>;
+               clocks = <&clkaudio CLKID_AUDIO_MCLK_B
+                               &clkc CLKID_MPLL1>;
+               clock-names = "mclk", "clk_srcpll";
+               /*
+                * select tdmin_lb src;
+                *0: TDMOUTA
+                *1: TDMOUTB
+                *2: TDMOUTC
+                *3: PAD_TDMINA
+                *4: PAD_TDMINB
+                *5: PAD_TDMINC
+                */
+               lb-src-sel = <1>;
+
+               status = "disabled";
        };
 
        /* copy a useless tdm to output for hdmi, no pinmux */
                filter_mode = <1>; /* mode 0~4, defalut:1 */
                status = "okay";
        };
-       aml_loopback: loopback {
-               compatible = "amlogic, snd-loopback";
-               /*
-                * 0: out rate = in data rate;
-                * 1: out rate = loopback data rate;
-                */
-               lb_mode = <0>;
+
+       loopback:loopback@0 {
+               compatible = "amlogic, g12a-loopback";
+               #sound-dai-cells = <0>;
+
+               clocks = <&clkaudio CLKID_AUDIO_PDM
+                       &clkc CLKID_FCLK_DIV3
+                       &clkc CLKID_MPLL3
+                       &clkaudio CLKID_AUDIO_PDMIN0
+                       &clkaudio CLKID_AUDIO_PDMIN1
+                       &clkc CLKID_MPLL0
+                       &clkaudio CLKID_AUDIO_MCLK_A>;
+               clock-names = "pdm_gate",
+                       "pdm_sysclk_srcpll",
+                       "pdm_dclk_srcpll",
+                       "pdm_dclk",
+                       "pdm_sysclk",
+                       "tdminlb_mpll",
+                       "tdminlb_mclk";
 
                /* datain src
                 * 0: tdmin_a;
                 * 4: pdmin;
                 */
                datain_src = <4>;
-               datain_chnum = <8>;
-               datain_chmask = <0x3f>;
+               datain_chnum = <4>;
+               datain_chmask = <0xf>;
+               /* config which data pin for loopback */
+               datain-lane-mask-in = <1 0 1 0>;
+
+               /* calc mclk for datalb */
+               mclk-fs = <256>;
 
                /* tdmin_lb src
                 * 0: tdmoutA
                 * 1: tdmoutB
                 * 2: tdmoutC
-                * 3: PAD_tdminA
-                * 4: PAD_tdminB
-                * 5: PAD_tdminC
+                * 3: PAD_TDMINA_DIN*, refer to core pinmux
+                * 4: PAD_TDMINB_DIN*, refer to core pinmux
+                * 5: PAD_TDMINC_DIN*, refer to core pinmux
+                * 6: PAD_TDMINA_D*, oe, refer to core pinmux
+                * 7: PAD_TDMINB_D*, oe, refer to core pinmux
                 */
-               datalb_src = <2>;
-               datalb_chnum = <8>;
+               /* if tdmin_lb >= 3, use external loopback */
+               datalb_src = <1>;
+               datalb_chnum = <2>;
                datalb_chmask = <0x3>;
+               /* config which data pin as loopback */
+               datalb-lane-mask-in = <1 0 0 0>;
 
                status = "okay";
        };
index bf7e8f3..20507f7 100644 (file)
                compatible = "amlogic, g12a-sound-card";
                aml-audio-card,name = "AML-AUGESOUND";
 
-               aml-audio-card,loopback = <&aml_loopback>;
                aml-audio-card,aux-devs = <&amlogic_codec>;
                /*avout mute gpio*/
                avout_mute-gpios = <&gpio_ao GPIOAO_2 GPIO_ACTIVE_HIGH>;
                                sound-dai = <&dummy_codec>;
                        };
                };
+
+               aml-audio-card,dai-link@6 {
+                       mclk-fs = <256>;
+                       continuous-clock;
+                       suffix-name = "alsaPORT-loopback";
+                       cpu {
+                               sound-dai = <&loopback>;
+                               system-clock-frequency = <12288000>;
+                       };
+                       codec {
+                               sound-dai = <&dummy_codec>;
+                       };
+               };
+
                /*
                 * dai link for i2s to hdmix,
                 * Notice to select a tdm lane not used by hw
                        "samesource_srcpll", "samesource_clk";
                pinctrl-names = "tdm_pins";
                pinctrl-0 = <&tdmb_mclk &tdmout_b &tdmin_b>;
+               mclk_pad = <0>;  /* 0: mclk_0; 1: mclk_1 */
                /*
                 * 0: tdmout_a;
                 * 1: tdmout_b;
                clock-names = "mclk", "clk_srcpll";
                pinctrl-names = "tdm_pins";
                pinctrl-0 = <&tdmc_mclk &tdmout_c &tdmin_c>;
+               mclk_pad = <1>;  /* 0: mclk_0; 1: mclk_1 */
+       };
+
+
+       tdmlb: tdm@3 {
+               compatible = "amlogic, g12a-snd-tdmlb";
+               #sound-dai-cells = <0>;
+               dai-tdm-lane-lb-slot-mask-in = <1 0 0 0>;
+               dai-tdm-clk-sel = <1>;
+               clocks = <&clkaudio CLKID_AUDIO_MCLK_B
+                               &clkc CLKID_MPLL1>;
+               clock-names = "mclk", "clk_srcpll";
+               /*
+                * select tdmin_lb src;
+                *0: TDMOUTA
+                *1: TDMOUTB
+                *2: TDMOUTC
+                *3: PAD_TDMINA
+                *4: PAD_TDMINB
+                *5: PAD_TDMINC
+                */
+               lb-src-sel = <1>;
+
+               status = "disabled";
        };
 
        /* copy a useless tdm to output for hdmi, no pinmux */
                filter_mode = <1>; /* mode 0~4, defalut:1 */
                status = "okay";
        };
-       aml_loopback: loopback {
-               compatible = "amlogic, snd-loopback";
-               /*
-                * 0: out rate = in data rate;
-                * 1: out rate = loopback data rate;
-                */
-               lb_mode = <0>;
+
+       loopback:loopback@0 {
+               compatible = "amlogic, g12a-loopback";
+               #sound-dai-cells = <0>;
+
+               clocks = <&clkaudio CLKID_AUDIO_PDM
+                       &clkc CLKID_FCLK_DIV3
+                       &clkc CLKID_MPLL3
+                       &clkaudio CLKID_AUDIO_PDMIN0
+                       &clkaudio CLKID_AUDIO_PDMIN1
+                       &clkc CLKID_MPLL0
+                       &clkaudio CLKID_AUDIO_MCLK_A>;
+               clock-names = "pdm_gate",
+                       "pdm_sysclk_srcpll",
+                       "pdm_dclk_srcpll",
+                       "pdm_dclk",
+                       "pdm_sysclk",
+                       "tdminlb_mpll",
+                       "tdminlb_mclk";
 
                /* datain src
                 * 0: tdmin_a;
                 * 4: pdmin;
                 */
                datain_src = <4>;
-               datain_chnum = <8>;
-               datain_chmask = <0x3f>;
+               datain_chnum = <4>;
+               datain_chmask = <0xf>;
+               /* config which data pin for loopback */
+               datain-lane-mask-in = <1 0 1 0>;
+
+               /* calc mclk for datalb */
+               mclk-fs = <256>;
 
                /* tdmin_lb src
                 * 0: tdmoutA
                 * 1: tdmoutB
                 * 2: tdmoutC
-                * 3: PAD_tdminA
-                * 4: PAD_tdminB
-                * 5: PAD_tdminC
+                * 3: PAD_TDMINA_DIN*, refer to core pinmux
+                * 4: PAD_TDMINB_DIN*, refer to core pinmux
+                * 5: PAD_TDMINC_DIN*, refer to core pinmux
+                * 6: PAD_TDMINA_D*, oe, refer to core pinmux
+                * 7: PAD_TDMINB_D*, oe, refer to core pinmux
                 */
-               datalb_src = <2>;
-               datalb_chnum = <8>;
+               /* if tdmin_lb >= 3, use external loopback */
+               datalb_src = <1>;
+               datalb_chnum = <2>;
                datalb_chmask = <0x3>;
+               /* config which data pin as loopback */
+               datalb-lane-mask-in = <1 0 0 0>;
 
                status = "okay";
        };
index 7842c26..9c31d10 100644 (file)
                compatible = "amlogic, g12a-sound-card";
                aml-audio-card,name = "AML-AUGESOUND";
 
-               aml-audio-card,loopback = <&aml_loopback>;
                aml-audio-card,aux-devs = <&amlogic_codec>;
                /*avout mute gpio*/
                avout_mute-gpios = <&gpio_ao GPIOAO_2 GPIO_ACTIVE_HIGH>;
                                sound-dai = <&dummy_codec>;
                        };
                };
+               aml-audio-card,dai-link@6 {
+                       mclk-fs = <256>;
+                       continuous-clock;
+                       suffix-name = "alsaPORT-loopback";
+                       cpu {
+                               sound-dai = <&loopback>;
+                               system-clock-frequency = <12288000>;
+                       };
+                       codec {
+                               sound-dai = <&dummy_codec>;
+                       };
+               };
        };
        audiolocker: locker {
                compatible = "amlogic, audiolocker";
                        "samesource_srcpll", "samesource_clk";
                pinctrl-names = "tdm_pins";
                pinctrl-0 = <&tdmb_mclk &tdmout_b &tdmin_b>;
+               mclk_pad = <0>;  /* 0: mclk_0; 1: mclk_1 */
                /*
                 * 0: tdmout_a;
                 * 1: tdmout_b;
                clock-names = "mclk", "clk_srcpll";
                pinctrl-names = "tdm_pins";
                pinctrl-0 = <&tdmc_mclk &tdmout_c &tdmin_c>;
+               mclk_pad = <1>;  /* 0: mclk_0; 1: mclk_1 */
        };
 
 
+       tdmlb: tdm@3 {
+               compatible = "amlogic, g12a-snd-tdmlb";
+               #sound-dai-cells = <0>;
+               dai-tdm-lane-lb-slot-mask-in = <1 0 0 0>;
+               dai-tdm-clk-sel = <1>;
+               clocks = <&clkaudio CLKID_AUDIO_MCLK_B
+                               &clkc CLKID_MPLL1>;
+               clock-names = "mclk", "clk_srcpll";
+               /*
+                * select tdmin_lb src;
+                *0: TDMOUTA
+                *1: TDMOUTB
+                *2: TDMOUTC
+                *3: PAD_TDMINA
+                *4: PAD_TDMINB
+                *5: PAD_TDMINC
+                */
+               lb-src-sel = <1>;
+
+               status = "disabled";
+       };
+
        aml_spdif: spdif {
                compatible = "amlogic, g12a-snd-spdif-a";
                #sound-dai-cells = <0>;
                filter_mode = <1>; /* mode 0~4, defalut:1 */
                status = "okay";
        };
-       aml_loopback: loopback {
-               compatible = "amlogic, snd-loopback";
-               /*
-                * 0: out rate = in data rate;
-                * 1: out rate = loopback data rate;
-                */
-               lb_mode = <0>;
+
+       loopback:loopback@0 {
+               compatible = "amlogic, g12a-loopback";
+               #sound-dai-cells = <0>;
+
+               clocks = <&clkaudio CLKID_AUDIO_PDM
+                       &clkc CLKID_FCLK_DIV3
+                       &clkc CLKID_MPLL3
+                       &clkaudio CLKID_AUDIO_PDMIN0
+                       &clkaudio CLKID_AUDIO_PDMIN1
+                       &clkc CLKID_MPLL0
+                       &clkaudio CLKID_AUDIO_MCLK_A>;
+               clock-names = "pdm_gate",
+                       "pdm_sysclk_srcpll",
+                       "pdm_dclk_srcpll",
+                       "pdm_dclk",
+                       "pdm_sysclk",
+                       "tdminlb_mpll",
+                       "tdminlb_mclk";
 
                /* datain src
                 * 0: tdmin_a;
                 * 4: pdmin;
                 */
                datain_src = <4>;
-               datain_chnum = <8>;
-               datain_chmask = <0x3f>;
+               datain_chnum = <4>;
+               datain_chmask = <0xf>;
+               /* config which data pin for loopback */
+               datain-lane-mask-in = <1 0 1 0>;
+
+               /* calc mclk for datalb */
+               mclk-fs = <256>;
 
                /* tdmin_lb src
                 * 0: tdmoutA
                 * 1: tdmoutB
                 * 2: tdmoutC
-                * 3: PAD_tdminA
-                * 4: PAD_tdminB
-                * 5: PAD_tdminC
+                * 3: PAD_TDMINA_DIN*, refer to core pinmux
+                * 4: PAD_TDMINB_DIN*, refer to core pinmux
+                * 5: PAD_TDMINC_DIN*, refer to core pinmux
+                * 6: PAD_TDMINA_D*, oe, refer to core pinmux
+                * 7: PAD_TDMINB_D*, oe, refer to core pinmux
                 */
-               datalb_src = <2>;
-               datalb_chnum = <8>;
+               /* if tdmin_lb >= 3, use external loopback */
+               datalb_src = <1>;
+               datalb_chnum = <2>;
                datalb_chmask = <0x3>;
+               /* config which data pin as loopback */
+               datalb-lane-mask-in = <1 0 0 0>;
 
                status = "okay";
        };
index a823f7f..bb0e256 100644 (file)
                compatible = "amlogic, g12a-sound-card";
                aml-audio-card,name = "AML-AUGESOUND";
 
-               aml-audio-card,loopback = <&aml_loopback>;
                aml-audio-card,aux-devs = <&amlogic_codec>;
                /*avout mute gpio*/
                avout_mute-gpios = <&gpio_ao GPIOAO_2 GPIO_ACTIVE_HIGH>;
                                sound-dai = <&dummy_codec>;
                        };
                };
+               aml-audio-card,dai-link@6 {
+                       mclk-fs = <256>;
+                       continuous-clock;
+                       suffix-name = "alsaPORT-loopback";
+                       cpu {
+                               sound-dai = <&loopback>;
+                               system-clock-frequency = <12288000>;
+                       };
+                       codec {
+                               sound-dai = <&dummy_codec>;
+                       };
+               };
        };
        audiolocker: locker {
                compatible = "amlogic, audiolocker";
                        "samesource_srcpll", "samesource_clk";
                pinctrl-names = "tdm_pins";
                pinctrl-0 = <&tdmb_mclk &tdmout_b &tdmin_b>;
+               mclk_pad = <0>;  /* 0: mclk_0; 1: mclk_1 */
                /*
                 * 0: tdmout_a;
                 * 1: tdmout_b;
                clock-names = "mclk", "clk_srcpll";
                pinctrl-names = "tdm_pins";
                pinctrl-0 = <&tdmc_mclk &tdmout_c &tdmin_c>;
+               mclk_pad = <1>;  /* 0: mclk_0; 1: mclk_1 */
        };
 
 
+       tdmlb: tdm@3 {
+               compatible = "amlogic, g12a-snd-tdmlb";
+               #sound-dai-cells = <0>;
+               dai-tdm-lane-lb-slot-mask-in = <1 0 0 0>;
+               dai-tdm-clk-sel = <1>;
+               clocks = <&clkaudio CLKID_AUDIO_MCLK_B
+                               &clkc CLKID_MPLL1>;
+               clock-names = "mclk", "clk_srcpll";
+               /*
+                * select tdmin_lb src;
+                *0: TDMOUTA
+                *1: TDMOUTB
+                *2: TDMOUTC
+                *3: PAD_TDMINA
+                *4: PAD_TDMINB
+                *5: PAD_TDMINC
+                */
+               lb-src-sel = <1>;
+
+               status = "disabled";
+       };
+
        aml_spdif: spdif {
                compatible = "amlogic, g12a-snd-spdif-a";
                #sound-dai-cells = <0>;
                filter_mode = <1>; /* mode 0~4, defalut:1 */
                status = "okay";
        };
-       aml_loopback: loopback {
-               compatible = "amlogic, snd-loopback";
-               /*
-                * 0: out rate = in data rate;
-                * 1: out rate = loopback data rate;
-                */
-               lb_mode = <0>;
+
+       loopback:loopback@0 {
+               compatible = "amlogic, g12a-loopback";
+               #sound-dai-cells = <0>;
+
+               clocks = <&clkaudio CLKID_AUDIO_PDM
+                       &clkc CLKID_FCLK_DIV3
+                       &clkc CLKID_MPLL3
+                       &clkaudio CLKID_AUDIO_PDMIN0
+                       &clkaudio CLKID_AUDIO_PDMIN1
+                       &clkc CLKID_MPLL0
+                       &clkaudio CLKID_AUDIO_MCLK_A>;
+               clock-names = "pdm_gate",
+                       "pdm_sysclk_srcpll",
+                       "pdm_dclk_srcpll",
+                       "pdm_dclk",
+                       "pdm_sysclk",
+                       "tdminlb_mpll",
+                       "tdminlb_mclk";
 
                /* datain src
                 * 0: tdmin_a;
                 * 4: pdmin;
                 */
                datain_src = <4>;
-               datain_chnum = <8>;
-               datain_chmask = <0x3f>;
+               datain_chnum = <4>;
+               datain_chmask = <0xf>;
+               /* config which data pin for loopback */
+               datain-lane-mask-in = <1 0 1 0>;
+
+               /* calc mclk for datalb */
+               mclk-fs = <256>;
 
                /* tdmin_lb src
                 * 0: tdmoutA
                 * 1: tdmoutB
                 * 2: tdmoutC
-                * 3: PAD_tdminA
-                * 4: PAD_tdminB
-                * 5: PAD_tdminC
+                * 3: PAD_TDMINA_DIN*, refer to core pinmux
+                * 4: PAD_TDMINB_DIN*, refer to core pinmux
+                * 5: PAD_TDMINC_DIN*, refer to core pinmux
+                * 6: PAD_TDMINA_D*, oe, refer to core pinmux
+                * 7: PAD_TDMINB_D*, oe, refer to core pinmux
                 */
-               datalb_src = <2>;
-               datalb_chnum = <8>;
+               /* if tdmin_lb >= 3, use external loopback */
+               datalb_src = <1>;
+               datalb_chnum = <2>;
                datalb_chmask = <0x3>;
+               /* config which data pin as loopback */
+               datalb-lane-mask-in = <1 0 0 0>;
 
                status = "okay";
        };
index bb768ee..7b40c1c 100644 (file)
                compatible = "amlogic, g12a-sound-card";
                aml-audio-card,name = "AML-AUGESOUND";
 
-               aml-audio-card,loopback = <&aml_loopback>;
                aml-audio-card,aux-devs = <&amlogic_codec>;
                /*avout mute gpio*/
                avout_mute-gpios = <&gpio_ao GPIOAO_2 GPIO_ACTIVE_HIGH>;
                                sound-dai = <&dummy_codec>;
                        };
                };
+               aml-audio-card,dai-link@6 {
+                       mclk-fs = <256>;
+                       continuous-clock;
+                       suffix-name = "alsaPORT-loopback";
+                       cpu {
+                               sound-dai = <&loopback>;
+                               system-clock-frequency = <12288000>;
+                       };
+                       codec {
+                               sound-dai = <&dummy_codec>;
+                       };
+               };
        };
        audiolocker: locker {
                compatible = "amlogic, audiolocker";
                        "samesource_srcpll", "samesource_clk";
                pinctrl-names = "tdm_pins";
                pinctrl-0 = <&tdmb_mclk &tdmout_b &tdmin_b>;
+               mclk_pad = <0>;  /* 0: mclk_0; 1: mclk_1 */
                /*
                 * 0: tdmout_a;
                 * 1: tdmout_b;
                clock-names = "mclk", "clk_srcpll";
                pinctrl-names = "tdm_pins";
                pinctrl-0 = <&tdmc_mclk &tdmout_c &tdmin_c>;
+               mclk_pad = <1>;  /* 0: mclk_0; 1: mclk_1 */
        };
 
 
+       tdmlb: tdm@3 {
+               compatible = "amlogic, g12a-snd-tdmlb";
+               #sound-dai-cells = <0>;
+               dai-tdm-lane-lb-slot-mask-in = <1 0 0 0>;
+               dai-tdm-clk-sel = <1>;
+               clocks = <&clkaudio CLKID_AUDIO_MCLK_B
+                               &clkc CLKID_MPLL1>;
+               clock-names = "mclk", "clk_srcpll";
+               /*
+                * select tdmin_lb src;
+                *0: TDMOUTA
+                *1: TDMOUTB
+                *2: TDMOUTC
+                *3: PAD_TDMINA
+                *4: PAD_TDMINB
+                *5: PAD_TDMINC
+                */
+               lb-src-sel = <1>;
+
+               status = "disabled";
+       };
+
        aml_spdif: spdif {
                compatible = "amlogic, g12a-snd-spdif-a";
                #sound-dai-cells = <0>;
                filter_mode = <1>; /* mode 0~4, defalut:1 */
                status = "okay";
        };
-       aml_loopback: loopback {
-               compatible = "amlogic, snd-loopback";
-               /*
-                * 0: out rate = in data rate;
-                * 1: out rate = loopback data rate;
-                */
-               lb_mode = <0>;
+
+       loopback:loopback@0 {
+               compatible = "amlogic, g12a-loopback";
+               #sound-dai-cells = <0>;
+
+               clocks = <&clkaudio CLKID_AUDIO_PDM
+                       &clkc CLKID_FCLK_DIV3
+                       &clkc CLKID_MPLL3
+                       &clkaudio CLKID_AUDIO_PDMIN0
+                       &clkaudio CLKID_AUDIO_PDMIN1
+                       &clkc CLKID_MPLL0
+                       &clkaudio CLKID_AUDIO_MCLK_A>;
+               clock-names = "pdm_gate",
+                       "pdm_sysclk_srcpll",
+                       "pdm_dclk_srcpll",
+                       "pdm_dclk",
+                       "pdm_sysclk",
+                       "tdminlb_mpll",
+                       "tdminlb_mclk";
 
                /* datain src
                 * 0: tdmin_a;
                 * 4: pdmin;
                 */
                datain_src = <4>;
-               datain_chnum = <8>;
-               datain_chmask = <0x3f>;
+               datain_chnum = <4>;
+               datain_chmask = <0xf>;
+               /* config which data pin for loopback */
+               datain-lane-mask-in = <1 0 1 0>;
+
+               /* calc mclk for datalb */
+               mclk-fs = <256>;
 
                /* tdmin_lb src
                 * 0: tdmoutA
                 * 1: tdmoutB
                 * 2: tdmoutC
-                * 3: PAD_tdminA
-                * 4: PAD_tdminB
-                * 5: PAD_tdminC
+                * 3: PAD_TDMINA_DIN*, refer to core pinmux
+                * 4: PAD_TDMINB_DIN*, refer to core pinmux
+                * 5: PAD_TDMINC_DIN*, refer to core pinmux
+                * 6: PAD_TDMINA_D*, oe, refer to core pinmux
+                * 7: PAD_TDMINB_D*, oe, refer to core pinmux
                 */
-               datalb_src = <2>;
-               datalb_chnum = <8>;
+               /* if tdmin_lb >= 3, use external loopback */
+               datalb_src = <1>;
+               datalb_chnum = <2>;
                datalb_chmask = <0x3>;
+               /* config which data pin as loopback */
+               datalb-lane-mask-in = <1 0 0 0>;
 
                status = "okay";
        };
index e15e712..cc6325d 100644 (file)
                compatible = "amlogic, g12a-sound-card";
                aml-audio-card,name = "AML-AUGESOUND";
 
-               aml-audio-card,loopback = <&aml_loopback>;
                aml-audio-card,aux-devs = <&amlogic_codec>;
                /*avout mute gpio*/
                avout_mute-gpios = <&gpio_ao GPIOAO_2 GPIO_ACTIVE_HIGH>;
                                sound-dai = <&dummy_codec>;
                        };
                };
+
+               aml-audio-card,dai-link@6 {
+                       mclk-fs = <256>;
+                       continuous-clock;
+                       suffix-name = "alsaPORT-loopback";
+                       cpu {
+                               sound-dai = <&loopback>;
+                               system-clock-frequency = <12288000>;
+                       };
+                       codec {
+                               sound-dai = <&dummy_codec>;
+                       };
+               };
+
                /*
                 * dai link for i2s to hdmix,
                 * Notice to select a tdm lane not used by hw
                        "samesource_srcpll", "samesource_clk";
                pinctrl-names = "tdm_pins";
                pinctrl-0 = <&tdmb_mclk &tdmout_b &tdmin_b>;
+               mclk_pad = <0>;  /* 0: mclk_0; 1: mclk_1 */
                /*
                 * 0: tdmout_a;
                 * 1: tdmout_b;
                clock-names = "mclk", "clk_srcpll";
                pinctrl-names = "tdm_pins";
                pinctrl-0 = <&tdmc_mclk &tdmout_c &tdmin_c>;
+               mclk_pad = <1>;  /* 0: mclk_0; 1: mclk_1 */
+       };
+
+
+       tdmlb: tdm@3 {
+               compatible = "amlogic, g12a-snd-tdmlb";
+               #sound-dai-cells = <0>;
+               dai-tdm-lane-lb-slot-mask-in = <1 0 0 0>;
+               dai-tdm-clk-sel = <1>;
+               clocks = <&clkaudio CLKID_AUDIO_MCLK_B
+                               &clkc CLKID_MPLL1>;
+               clock-names = "mclk", "clk_srcpll";
+               /*
+                * select tdmin_lb src;
+                *0: TDMOUTA
+                *1: TDMOUTB
+                *2: TDMOUTC
+                *3: PAD_TDMINA
+                *4: PAD_TDMINB
+                *5: PAD_TDMINC
+                */
+               lb-src-sel = <1>;
+
+               status = "disabled";
        };
 
        /* copy a useless tdm to output for hdmi, no pinmux */
                filter_mode = <1>; /* mode 0~4, defalut:1 */
                status = "okay";
        };
-       aml_loopback: loopback {
-               compatible = "amlogic, snd-loopback";
-               /*
-                * 0: out rate = in data rate;
-                * 1: out rate = loopback data rate;
-                */
-               lb_mode = <0>;
+
+       loopback:loopback@0 {
+               compatible = "amlogic, g12a-loopback";
+               #sound-dai-cells = <0>;
+
+               clocks = <&clkaudio CLKID_AUDIO_PDM
+                       &clkc CLKID_FCLK_DIV3
+                       &clkc CLKID_MPLL3
+                       &clkaudio CLKID_AUDIO_PDMIN0
+                       &clkaudio CLKID_AUDIO_PDMIN1
+                       &clkc CLKID_MPLL0
+                       &clkaudio CLKID_AUDIO_MCLK_A>;
+               clock-names = "pdm_gate",
+                       "pdm_sysclk_srcpll",
+                       "pdm_dclk_srcpll",
+                       "pdm_dclk",
+                       "pdm_sysclk",
+                       "tdminlb_mpll",
+                       "tdminlb_mclk";
 
                /* datain src
                 * 0: tdmin_a;
                 * 4: pdmin;
                 */
                datain_src = <4>;
-               datain_chnum = <8>;
-               datain_chmask = <0x3f>;
+               datain_chnum = <4>;
+               datain_chmask = <0xf>;
+               /* config which data pin for loopback */
+               datain-lane-mask-in = <1 0 1 0>;
+
+               /* calc mclk for datalb */
+               mclk-fs = <256>;
 
                /* tdmin_lb src
                 * 0: tdmoutA
                 * 1: tdmoutB
                 * 2: tdmoutC
-                * 3: PAD_tdminA
-                * 4: PAD_tdminB
-                * 5: PAD_tdminC
+                * 3: PAD_TDMINA_DIN*, refer to core pinmux
+                * 4: PAD_TDMINB_DIN*, refer to core pinmux
+                * 5: PAD_TDMINC_DIN*, refer to core pinmux
+                * 6: PAD_TDMINA_D*, oe, refer to core pinmux
+                * 7: PAD_TDMINB_D*, oe, refer to core pinmux
                 */
-               datalb_src = <2>;
-               datalb_chnum = <8>;
+               /* if tdmin_lb >= 3, use external loopback */
+               datalb_src = <1>;
+               datalb_chnum = <2>;
                datalb_chmask = <0x3>;
+               /* config which data pin as loopback */
+               datalb-lane-mask-in = <1 0 0 0>;
 
                status = "okay";
        };
index b38fec0..b540af3 100644 (file)
                compatible = "amlogic, g12a-sound-card";
                aml-audio-card,name = "AML-AUGESOUND";
 
-               aml-audio-card,loopback = <&aml_loopback>;
                aml-audio-card,aux-devs = <&amlogic_codec>;
                /*avout mute gpio*/
                avout_mute-gpios = <&gpio_ao GPIOAO_2 GPIO_ACTIVE_HIGH>;
                                sound-dai = <&dummy_codec>;
                        };
                };
+
+               aml-audio-card,dai-link@6 {
+                       mclk-fs = <256>;
+                       continuous-clock;
+                       suffix-name = "alsaPORT-loopback";
+                       cpu {
+                               sound-dai = <&loopback>;
+                               system-clock-frequency = <12288000>;
+                       };
+                       codec {
+                               sound-dai = <&dummy_codec>;
+                       };
+               };
+
                /*
                 * dai link for i2s to hdmix,
                 * Notice to select a tdm lane not used by hw
                        "samesource_srcpll", "samesource_clk";
                pinctrl-names = "tdm_pins";
                pinctrl-0 = <&tdmb_mclk &tdmout_b &tdmin_b>;
+               mclk_pad = <0>;  /* 0: mclk_0; 1: mclk_1 */
                /*
                 * 0: tdmout_a;
                 * 1: tdmout_b;
                clock-names = "mclk", "clk_srcpll";
                pinctrl-names = "tdm_pins";
                pinctrl-0 = <&tdmc_mclk &tdmout_c &tdmin_c>;
+               mclk_pad = <1>;  /* 0: mclk_0; 1: mclk_1 */
+       };
+
+
+       tdmlb: tdm@3 {
+               compatible = "amlogic, g12a-snd-tdmlb";
+               #sound-dai-cells = <0>;
+               dai-tdm-lane-lb-slot-mask-in = <1 0 0 0>;
+               dai-tdm-clk-sel = <1>;
+               clocks = <&clkaudio CLKID_AUDIO_MCLK_B
+                               &clkc CLKID_MPLL1>;
+               clock-names = "mclk", "clk_srcpll";
+               /*
+                * select tdmin_lb src;
+                *0: TDMOUTA
+                *1: TDMOUTB
+                *2: TDMOUTC
+                *3: PAD_TDMINA
+                *4: PAD_TDMINB
+                *5: PAD_TDMINC
+                */
+               lb-src-sel = <1>;
+
+               status = "disabled";
        };
 
        /* copy a useless tdm to output for hdmi, no pinmux */
                filter_mode = <1>; /* mode 0~4, defalut:1 */
                status = "okay";
        };
-       aml_loopback: loopback {
-               compatible = "amlogic, snd-loopback";
-               /*
-                * 0: out rate = in data rate;
-                * 1: out rate = loopback data rate;
-                */
-               lb_mode = <0>;
+
+       loopback:loopback@0 {
+               compatible = "amlogic, g12a-loopback";
+               #sound-dai-cells = <0>;
+
+               clocks = <&clkaudio CLKID_AUDIO_PDM
+                       &clkc CLKID_FCLK_DIV3
+                       &clkc CLKID_MPLL3
+                       &clkaudio CLKID_AUDIO_PDMIN0
+                       &clkaudio CLKID_AUDIO_PDMIN1
+                       &clkc CLKID_MPLL0
+                       &clkaudio CLKID_AUDIO_MCLK_A>;
+               clock-names = "pdm_gate",
+                       "pdm_sysclk_srcpll",
+                       "pdm_dclk_srcpll",
+                       "pdm_dclk",
+                       "pdm_sysclk",
+                       "tdminlb_mpll",
+                       "tdminlb_mclk";
 
                /* datain src
                 * 0: tdmin_a;
                 * 4: pdmin;
                 */
                datain_src = <4>;
-               datain_chnum = <8>;
-               datain_chmask = <0x3f>;
+               datain_chnum = <4>;
+               datain_chmask = <0xf>;
+               /* config which data pin for loopback */
+               datain-lane-mask-in = <1 0 1 0>;
+
+               /* calc mclk for datalb */
+               mclk-fs = <256>;
 
                /* tdmin_lb src
                 * 0: tdmoutA
                 * 1: tdmoutB
                 * 2: tdmoutC
-                * 3: PAD_tdminA
-                * 4: PAD_tdminB
-                * 5: PAD_tdminC
+                * 3: PAD_TDMINA_DIN*, refer to core pinmux
+                * 4: PAD_TDMINB_DIN*, refer to core pinmux
+                * 5: PAD_TDMINC_DIN*, refer to core pinmux
+                * 6: PAD_TDMINA_D*, oe, refer to core pinmux
+                * 7: PAD_TDMINB_D*, oe, refer to core pinmux
                 */
-               datalb_src = <2>;
-               datalb_chnum = <8>;
+               /* if tdmin_lb >= 3, use external loopback */
+               datalb_src = <1>;
+               datalb_chnum = <2>;
                datalb_chmask = <0x3>;
+               /* config which data pin as loopback */
+               datalb-lane-mask-in = <1 0 0 0>;
 
                status = "okay";
        };
index ef84c49..a1bb0c1 100644 (file)
                compatible = "amlogic, g12a-sound-card";
                aml-audio-card,name = "AML-AUGESOUND";
 
-               aml-audio-card,loopback = <&aml_loopback>;
                aml-audio-card,aux-devs = <&amlogic_codec>;
                /*avout mute gpio*/
                avout_mute-gpios = <&gpio_ao GPIOAO_2 GPIO_ACTIVE_HIGH>;
                                sound-dai = <&dummy_codec>;
                        };
                };
+
+               aml-audio-card,dai-link@6 {
+                       mclk-fs = <256>;
+                       continuous-clock;
+                       suffix-name = "alsaPORT-loopback";
+                       cpu {
+                               sound-dai = <&loopback>;
+                               system-clock-frequency = <12288000>;
+                       };
+                       codec {
+                               sound-dai = <&dummy_codec>;
+                       };
+               };
+
                /*
                 * dai link for i2s to hdmix,
                 * Notice to select a tdm lane not used by hw
                        "samesource_srcpll", "samesource_clk";
                pinctrl-names = "tdm_pins";
                pinctrl-0 = <&tdmb_mclk &tdmout_b &tdmin_b>;
+               mclk_pad = <0>;  /* 0: mclk_0; 1: mclk_1 */
                /*
                 * 0: tdmout_a;
                 * 1: tdmout_b;
                clock-names = "mclk", "clk_srcpll";
                pinctrl-names = "tdm_pins";
                pinctrl-0 = <&tdmc_mclk &tdmout_c &tdmin_c>;
+               mclk_pad = <1>;  /* 0: mclk_0; 1: mclk_1 */
+       };
+
+
+       tdmlb: tdm@3 {
+               compatible = "amlogic, g12a-snd-tdmlb";
+               #sound-dai-cells = <0>;
+               dai-tdm-lane-lb-slot-mask-in = <1 0 0 0>;
+               dai-tdm-clk-sel = <1>;
+               clocks = <&clkaudio CLKID_AUDIO_MCLK_B
+                               &clkc CLKID_MPLL1>;
+               clock-names = "mclk", "clk_srcpll";
+               /*
+                * select tdmin_lb src;
+                *0: TDMOUTA
+                *1: TDMOUTB
+                *2: TDMOUTC
+                *3: PAD_TDMINA
+                *4: PAD_TDMINB
+                *5: PAD_TDMINC
+                */
+               lb-src-sel = <1>;
+
+               status = "disabled";
        };
 
        /* copy a useless tdm to output for hdmi, no pinmux */
                filter_mode = <1>; /* mode 0~4, defalut:1 */
                status = "okay";
        };
-       aml_loopback: loopback {
-               compatible = "amlogic, snd-loopback";
-               /*
-                * 0: out rate = in data rate;
-                * 1: out rate = loopback data rate;
-                */
-               lb_mode = <0>;
+
+       loopback:loopback@0 {
+               compatible = "amlogic, g12a-loopback";
+               #sound-dai-cells = <0>;
+
+               clocks = <&clkaudio CLKID_AUDIO_PDM
+                       &clkc CLKID_FCLK_DIV3
+                       &clkc CLKID_MPLL3
+                       &clkaudio CLKID_AUDIO_PDMIN0
+                       &clkaudio CLKID_AUDIO_PDMIN1
+                       &clkc CLKID_MPLL0
+                       &clkaudio CLKID_AUDIO_MCLK_A>;
+               clock-names = "pdm_gate",
+                       "pdm_sysclk_srcpll",
+                       "pdm_dclk_srcpll",
+                       "pdm_dclk",
+                       "pdm_sysclk",
+                       "tdminlb_mpll",
+                       "tdminlb_mclk";
 
                /* datain src
                 * 0: tdmin_a;
                 * 4: pdmin;
                 */
                datain_src = <4>;
-               datain_chnum = <8>;
-               datain_chmask = <0x3f>;
+               datain_chnum = <4>;
+               datain_chmask = <0xf>;
+               /* config which data pin for loopback */
+               datain-lane-mask-in = <1 0 1 0>;
+
+               /* calc mclk for datalb */
+               mclk-fs = <256>;
 
                /* tdmin_lb src
                 * 0: tdmoutA
                 * 1: tdmoutB
                 * 2: tdmoutC
-                * 3: PAD_tdminA
-                * 4: PAD_tdminB
-                * 5: PAD_tdminC
+                * 3: PAD_TDMINA_DIN*, refer to core pinmux
+                * 4: PAD_TDMINB_DIN*, refer to core pinmux
+                * 5: PAD_TDMINC_DIN*, refer to core pinmux
+                * 6: PAD_TDMINA_D*, oe, refer to core pinmux
+                * 7: PAD_TDMINB_D*, oe, refer to core pinmux
                 */
-               datalb_src = <2>;
-               datalb_chnum = <8>;
+               /* if tdmin_lb >= 3, use external loopback */
+               datalb_src = <1>;
+               datalb_chnum = <2>;
                datalb_chmask = <0x3>;
+               /* config which data pin as loopback */
+               datalb-lane-mask-in = <1 0 0 0>;
 
                status = "okay";
        };
index 3b09da7..9e21947 100644 (file)
                compatible = "amlogic, g12a-sound-card";
                aml-audio-card,name = "AML-AUGESOUND";
 
-               aml-audio-card,loopback = <&aml_loopback>;
                aml-audio-card,aux-devs = <&amlogic_codec>;
                /*avout mute gpio*/
                avout_mute-gpios = <&gpio_ao GPIOAO_2 GPIO_ACTIVE_HIGH>;
                                sound-dai = <&dummy_codec>;
                        };
                };
+
+               aml-audio-card,dai-link@6 {
+                       mclk-fs = <256>;
+                       continuous-clock;
+                       suffix-name = "alsaPORT-loopback";
+                       cpu {
+                               sound-dai = <&loopback>;
+                               system-clock-frequency = <12288000>;
+                       };
+                       codec {
+                               sound-dai = <&dummy_codec>;
+                       };
+               };
        };
        audiolocker: locker {
                compatible = "amlogic, audiolocker";
                        "samesource_srcpll", "samesource_clk";
                pinctrl-names = "tdm_pins";
                pinctrl-0 = <&tdmb_mclk &tdmout_b &tdmin_b>;
+               mclk_pad = <0>;  /* 0: mclk_0; 1: mclk_1 */
                /*
                 * 0: tdmout_a;
                 * 1: tdmout_b;
                clock-names = "mclk", "clk_srcpll";
                pinctrl-names = "tdm_pins";
                pinctrl-0 = <&tdmc_mclk &tdmout_c &tdmin_c>;
+               mclk_pad = <1>;  /* 0: mclk_0; 1: mclk_1 */
        };
 
 
+       tdmlb: tdm@3 {
+               compatible = "amlogic, g12a-snd-tdmlb";
+               #sound-dai-cells = <0>;
+               dai-tdm-lane-lb-slot-mask-in = <1 0 0 0>;
+               dai-tdm-clk-sel = <1>;
+               clocks = <&clkaudio CLKID_AUDIO_MCLK_B
+                               &clkc CLKID_MPLL1>;
+               clock-names = "mclk", "clk_srcpll";
+               /*
+                * select tdmin_lb src;
+                *0: TDMOUTA
+                *1: TDMOUTB
+                *2: TDMOUTC
+                *3: PAD_TDMINA
+                *4: PAD_TDMINB
+                *5: PAD_TDMINC
+                */
+               lb-src-sel = <1>;
+
+               status = "disabled";
+       };
+
        aml_spdif: spdif {
                compatible = "amlogic, g12a-snd-spdif-a";
                #sound-dai-cells = <0>;
                filter_mode = <1>; /* mode 0~4, defalut:1 */
                status = "okay";
        };
-       aml_loopback: loopback {
-               compatible = "amlogic, snd-loopback";
-               /*
-                * 0: out rate = in data rate;
-                * 1: out rate = loopback data rate;
-                */
-               lb_mode = <0>;
+
+       loopback:loopback@0 {
+               compatible = "amlogic, g12a-loopback";
+               #sound-dai-cells = <0>;
+
+               clocks = <&clkaudio CLKID_AUDIO_PDM
+                       &clkc CLKID_FCLK_DIV3
+                       &clkc CLKID_MPLL3
+                       &clkaudio CLKID_AUDIO_PDMIN0
+                       &clkaudio CLKID_AUDIO_PDMIN1
+                       &clkc CLKID_MPLL0
+                       &clkaudio CLKID_AUDIO_MCLK_A>;
+               clock-names = "pdm_gate",
+                       "pdm_sysclk_srcpll",
+                       "pdm_dclk_srcpll",
+                       "pdm_dclk",
+                       "pdm_sysclk",
+                       "tdminlb_mpll",
+                       "tdminlb_mclk";
 
                /* datain src
                 * 0: tdmin_a;
                 * 4: pdmin;
                 */
                datain_src = <4>;
-               datain_chnum = <8>;
-               datain_chmask = <0x3f>;
+               datain_chnum = <4>;
+               datain_chmask = <0xf>;
+               /* config which data pin for loopback */
+               datain-lane-mask-in = <1 0 1 0>;
+
+               /* calc mclk for datalb */
+               mclk-fs = <256>;
 
                /* tdmin_lb src
                 * 0: tdmoutA
                 * 1: tdmoutB
                 * 2: tdmoutC
-                * 3: PAD_tdminA
-                * 4: PAD_tdminB
-                * 5: PAD_tdminC
+                * 3: PAD_TDMINA_DIN*, refer to core pinmux
+                * 4: PAD_TDMINB_DIN*, refer to core pinmux
+                * 5: PAD_TDMINC_DIN*, refer to core pinmux
+                * 6: PAD_TDMINA_D*, oe, refer to core pinmux
+                * 7: PAD_TDMINB_D*, oe, refer to core pinmux
                 */
-               datalb_src = <2>;
-               datalb_chnum = <8>;
+               /* if tdmin_lb >= 3, use external loopback */
+               datalb_src = <1>;
+               datalb_chnum = <2>;
                datalb_chmask = <0x3>;
+               /* config which data pin as loopback */
+               datalb-lane-mask-in = <1 0 0 0>;
 
                status = "okay";
        };
index 019cfcc..160141e 100644 (file)
                compatible = "amlogic, g12a-sound-card";
                aml-audio-card,name = "AML-AUGESOUND";
 
-               aml-audio-card,loopback = <&aml_loopback>;
                aml-audio-card,aux-devs = <&amlogic_codec>;
                /*avout mute gpio*/
                avout_mute-gpios = <&gpio_ao GPIOAO_2 GPIO_ACTIVE_HIGH>;
                                sound-dai = <&dummy_codec>;
                        };
                };
+
+               aml-audio-card,dai-link@6 {
+                       mclk-fs = <256>;
+                       continuous-clock;
+                       suffix-name = "alsaPORT-loopback";
+                       cpu {
+                               sound-dai = <&loopback>;
+                               system-clock-frequency = <12288000>;
+                       };
+                       codec {
+                               sound-dai = <&dummy_codec>;
+                       };
+               };
+
                /*
                 * dai link for i2s to hdmix,
                 * Notice to select a tdm lane not used by hw
                        "samesource_srcpll", "samesource_clk";
                pinctrl-names = "tdm_pins";
                pinctrl-0 = <&tdmb_mclk &tdmout_b &tdmin_b>;
+               mclk_pad = <0>;  /* 0: mclk_0; 1: mclk_1 */
                /*
                 * 0: tdmout_a;
                 * 1: tdmout_b;
                clock-names = "mclk", "clk_srcpll";
                pinctrl-names = "tdm_pins";
                pinctrl-0 = <&tdmc_mclk &tdmout_c &tdmin_c>;
+               mclk_pad = <1>;  /* 0: mclk_0; 1: mclk_1 */
+       };
+
+
+       tdmlb: tdm@3 {
+               compatible = "amlogic, g12a-snd-tdmlb";
+               #sound-dai-cells = <0>;
+               dai-tdm-lane-lb-slot-mask-in = <1 0 0 0>;
+               dai-tdm-clk-sel = <1>;
+               clocks = <&clkaudio CLKID_AUDIO_MCLK_B
+                               &clkc CLKID_MPLL1>;
+               clock-names = "mclk", "clk_srcpll";
+               /*
+                * select tdmin_lb src;
+                *0: TDMOUTA
+                *1: TDMOUTB
+                *2: TDMOUTC
+                *3: PAD_TDMINA
+                *4: PAD_TDMINB
+                *5: PAD_TDMINC
+                */
+               lb-src-sel = <1>;
+
+               status = "disabled";
        };
 
        /* copy a useless tdm to output for hdmi, no pinmux */
                filter_mode = <1>; /* mode 0~4, defalut:1 */
                status = "okay";
        };
-       aml_loopback: loopback {
-               compatible = "amlogic, snd-loopback";
-               /*
-                * 0: out rate = in data rate;
-                * 1: out rate = loopback data rate;
-                */
-               lb_mode = <0>;
+
+       loopback:loopback@0 {
+               compatible = "amlogic, g12a-loopback";
+               #sound-dai-cells = <0>;
+
+               clocks = <&clkaudio CLKID_AUDIO_PDM
+                       &clkc CLKID_FCLK_DIV3
+                       &clkc CLKID_MPLL3
+                       &clkaudio CLKID_AUDIO_PDMIN0
+                       &clkaudio CLKID_AUDIO_PDMIN1
+                       &clkc CLKID_MPLL0
+                       &clkaudio CLKID_AUDIO_MCLK_A>;
+               clock-names = "pdm_gate",
+                       "pdm_sysclk_srcpll",
+                       "pdm_dclk_srcpll",
+                       "pdm_dclk",
+                       "pdm_sysclk",
+                       "tdminlb_mpll",
+                       "tdminlb_mclk";
 
                /* datain src
                 * 0: tdmin_a;
                 * 4: pdmin;
                 */
                datain_src = <4>;
-               datain_chnum = <8>;
-               datain_chmask = <0x3f>;
+               datain_chnum = <4>;
+               datain_chmask = <0xf>;
+               /* config which data pin for loopback */
+               datain-lane-mask-in = <1 0 1 0>;
+
+               /* calc mclk for datalb */
+               mclk-fs = <256>;
 
                /* tdmin_lb src
                 * 0: tdmoutA
                 * 1: tdmoutB
                 * 2: tdmoutC
-                * 3: PAD_tdminA
-                * 4: PAD_tdminB
-                * 5: PAD_tdminC
+                * 3: PAD_TDMINA_DIN*, refer to core pinmux
+                * 4: PAD_TDMINB_DIN*, refer to core pinmux
+                * 5: PAD_TDMINC_DIN*, refer to core pinmux
+                * 6: PAD_TDMINA_D*, oe, refer to core pinmux
+                * 7: PAD_TDMINB_D*, oe, refer to core pinmux
                 */
-               datalb_src = <2>;
-               datalb_chnum = <8>;
+               /* if tdmin_lb >= 3, use external loopback */
+               datalb_src = <1>;
+               datalb_chnum = <2>;
                datalb_chmask = <0x3>;
+               /* config which data pin as loopback */
+               datalb-lane-mask-in = <1 0 0 0>;
 
                status = "okay";
        };
index 30b731a..f23ada9 100644 (file)
                compatible = "amlogic, g12a-sound-card";
                aml-audio-card,name = "AML-AUGESOUND";
 
-               aml-audio-card,loopback = <&aml_loopback>;
                aml-audio-card,aux-devs = <&amlogic_codec>;
                /*avout mute gpio*/
                avout_mute-gpios = <&gpio_ao GPIOAO_2 GPIO_ACTIVE_HIGH>;
                                sound-dai = <&dummy_codec>;
                        };
                };
+
+               aml-audio-card,dai-link@6 {
+                       mclk-fs = <256>;
+                       continuous-clock;
+                       suffix-name = "alsaPORT-loopback";
+                       cpu {
+                               sound-dai = <&loopback>;
+                               system-clock-frequency = <12288000>;
+                       };
+                       codec {
+                               sound-dai = <&dummy_codec>;
+                       };
+               };
+
                /*
                 * dai link for i2s to hdmix,
                 * Notice to select a tdm lane not used by hw
                        "samesource_srcpll", "samesource_clk";
                pinctrl-names = "tdm_pins";
                pinctrl-0 = <&tdmb_mclk &tdmout_b &tdmin_b>;
+               mclk_pad = <0>;  /* 0: mclk_0; 1: mclk_1 */
                /*
                 * 0: tdmout_a;
                 * 1: tdmout_b;
                clock-names = "mclk", "clk_srcpll";
                pinctrl-names = "tdm_pins";
                pinctrl-0 = <&tdmc_mclk &tdmout_c &tdmin_c>;
+               mclk_pad = <1>;  /* 0: mclk_0; 1: mclk_1 */
+       };
+
+
+       tdmlb: tdm@3 {
+               compatible = "amlogic, g12a-snd-tdmlb";
+               #sound-dai-cells = <0>;
+               dai-tdm-lane-lb-slot-mask-in = <1 0 0 0>;
+               dai-tdm-clk-sel = <1>;
+               clocks = <&clkaudio CLKID_AUDIO_MCLK_B
+                               &clkc CLKID_MPLL1>;
+               clock-names = "mclk", "clk_srcpll";
+               /*
+                * select tdmin_lb src;
+                *0: TDMOUTA
+                *1: TDMOUTB
+                *2: TDMOUTC
+                *3: PAD_TDMINA
+                *4: PAD_TDMINB
+                *5: PAD_TDMINC
+                */
+               lb-src-sel = <1>;
+
+               status = "disabled";
        };
 
        /* copy a useless tdm to output for hdmi, no pinmux */
                filter_mode = <1>; /* mode 0~4, defalut:1 */
                status = "okay";
        };
-       aml_loopback: loopback {
-               compatible = "amlogic, snd-loopback";
-               /*
-                * 0: out rate = in data rate;
-                * 1: out rate = loopback data rate;
-                */
-               lb_mode = <0>;
+
+       loopback:loopback@0 {
+               compatible = "amlogic, g12a-loopback";
+               #sound-dai-cells = <0>;
+
+               clocks = <&clkaudio CLKID_AUDIO_PDM
+                       &clkc CLKID_FCLK_DIV3
+                       &clkc CLKID_MPLL3
+                       &clkaudio CLKID_AUDIO_PDMIN0
+                       &clkaudio CLKID_AUDIO_PDMIN1
+                       &clkc CLKID_MPLL0
+                       &clkaudio CLKID_AUDIO_MCLK_A>;
+               clock-names = "pdm_gate",
+                       "pdm_sysclk_srcpll",
+                       "pdm_dclk_srcpll",
+                       "pdm_dclk",
+                       "pdm_sysclk",
+                       "tdminlb_mpll",
+                       "tdminlb_mclk";
 
                /* datain src
                 * 0: tdmin_a;
                 * 4: pdmin;
                 */
                datain_src = <4>;
-               datain_chnum = <8>;
-               datain_chmask = <0x3f>;
+               datain_chnum = <4>;
+               datain_chmask = <0xf>;
+               /* config which data pin for loopback */
+               datain-lane-mask-in = <1 0 1 0>;
+
+               /* calc mclk for datalb */
+               mclk-fs = <256>;
 
                /* tdmin_lb src
                 * 0: tdmoutA
                 * 1: tdmoutB
                 * 2: tdmoutC
-                * 3: PAD_tdminA
-                * 4: PAD_tdminB
-                * 5: PAD_tdminC
+                * 3: PAD_TDMINA_DIN*, refer to core pinmux
+                * 4: PAD_TDMINB_DIN*, refer to core pinmux
+                * 5: PAD_TDMINC_DIN*, refer to core pinmux
+                * 6: PAD_TDMINA_D*, oe, refer to core pinmux
+                * 7: PAD_TDMINB_D*, oe, refer to core pinmux
                 */
-               datalb_src = <2>;
-               datalb_chnum = <8>;
+               /* if tdmin_lb >= 3, use external loopback */
+               datalb_src = <1>;
+               datalb_chnum = <2>;
                datalb_chmask = <0x3>;
+               /* config which data pin as loopback */
+               datalb-lane-mask-in = <1 0 0 0>;
 
                status = "okay";
        };
index e03f7db..f1ca3ad 100644 (file)
                compatible = "amlogic, g12a-sound-card";
                aml-audio-card,name = "AML-AUGESOUND";
 
-               aml-audio-card,loopback = <&aml_loopback>;
                aml-audio-card,aux-devs = <&amlogic_codec>;
                /*avout mute gpio*/
                avout_mute-gpios = <&gpio_ao GPIOAO_2 GPIO_ACTIVE_HIGH>;
                                sound-dai = <&dummy_codec>;
                        };
                };
+
+               aml-audio-card,dai-link@6 {
+                       mclk-fs = <256>;
+                       continuous-clock;
+                       suffix-name = "alsaPORT-loopback";
+                       cpu {
+                               sound-dai = <&loopback>;
+                               system-clock-frequency = <12288000>;
+                       };
+                       codec {
+                               sound-dai = <&dummy_codec>;
+                       };
+               };
        };
        audiolocker: locker {
                compatible = "amlogic, audiolocker";
                        "samesource_srcpll", "samesource_clk";
                pinctrl-names = "tdm_pins";
                pinctrl-0 = <&tdmb_mclk &tdmout_b &tdmin_b>;
+               mclk_pad = <0>;  /* 0: mclk_0; 1: mclk_1 */
                /*
                 * 0: tdmout_a;
                 * 1: tdmout_b;
                clock-names = "mclk", "clk_srcpll";
                pinctrl-names = "tdm_pins";
                pinctrl-0 = <&tdmc_mclk &tdmout_c &tdmin_c>;
+               mclk_pad = <1>;  /* 0: mclk_0; 1: mclk_1 */
        };
 
 
+       tdmlb: tdm@3 {
+               compatible = "amlogic, g12a-snd-tdmlb";
+               #sound-dai-cells = <0>;
+               dai-tdm-lane-lb-slot-mask-in = <1 0 0 0>;
+               dai-tdm-clk-sel = <1>;
+               clocks = <&clkaudio CLKID_AUDIO_MCLK_B
+                               &clkc CLKID_MPLL1>;
+               clock-names = "mclk", "clk_srcpll";
+               /*
+                * select tdmin_lb src;
+                *0: TDMOUTA
+                *1: TDMOUTB
+                *2: TDMOUTC
+                *3: PAD_TDMINA
+                *4: PAD_TDMINB
+                *5: PAD_TDMINC
+                */
+               lb-src-sel = <1>;
+
+               status = "disabled";
+       };
+
        aml_spdif: spdif {
                compatible = "amlogic, g12a-snd-spdif-a";
                #sound-dai-cells = <0>;
                filter_mode = <1>; /* mode 0~4, defalut:1 */
                status = "okay";
        };
-       aml_loopback: loopback {
-               compatible = "amlogic, snd-loopback";
-               /*
-                * 0: out rate = in data rate;
-                * 1: out rate = loopback data rate;
-                */
-               lb_mode = <0>;
+
+       loopback:loopback@0 {
+               compatible = "amlogic, g12a-loopback";
+               #sound-dai-cells = <0>;
+
+               clocks = <&clkaudio CLKID_AUDIO_PDM
+                       &clkc CLKID_FCLK_DIV3
+                       &clkc CLKID_MPLL3
+                       &clkaudio CLKID_AUDIO_PDMIN0
+                       &clkaudio CLKID_AUDIO_PDMIN1
+                       &clkc CLKID_MPLL0
+                       &clkaudio CLKID_AUDIO_MCLK_A>;
+               clock-names = "pdm_gate",
+                       "pdm_sysclk_srcpll",
+                       "pdm_dclk_srcpll",
+                       "pdm_dclk",
+                       "pdm_sysclk",
+                       "tdminlb_mpll",
+                       "tdminlb_mclk";
 
                /* datain src
                 * 0: tdmin_a;
                 * 4: pdmin;
                 */
                datain_src = <4>;
-               datain_chnum = <8>;
-               datain_chmask = <0x3f>;
+               datain_chnum = <4>;
+               datain_chmask = <0xf>;
+               /* config which data pin for loopback */
+               datain-lane-mask-in = <1 0 1 0>;
+
+               /* calc mclk for datalb */
+               mclk-fs = <256>;
 
                /* tdmin_lb src
                 * 0: tdmoutA
                 * 1: tdmoutB
                 * 2: tdmoutC
-                * 3: PAD_tdminA
-                * 4: PAD_tdminB
-                * 5: PAD_tdminC
+                * 3: PAD_TDMINA_DIN*, refer to core pinmux
+                * 4: PAD_TDMINB_DIN*, refer to core pinmux
+                * 5: PAD_TDMINC_DIN*, refer to core pinmux
+                * 6: PAD_TDMINA_D*, oe, refer to core pinmux
+                * 7: PAD_TDMINB_D*, oe, refer to core pinmux
                 */
-               datalb_src = <2>;
-               datalb_chnum = <8>;
+               /* if tdmin_lb >= 3, use external loopback */
+               datalb_src = <1>;
+               datalb_chnum = <2>;
                datalb_chmask = <0x3>;
+               /* config which data pin as loopback */
+               datalb-lane-mask-in = <1 0 0 0>;
 
                status = "okay";
        };
index 631b434..8f3390d 100644 (file)
                compatible = "amlogic, g12a-sound-card";
                aml-audio-card,name = "AML-AUGESOUND";
 
-               aml-audio-card,loopback = <&aml_loopback>;
                aml-audio-card,aux-devs = <&amlogic_codec>;
                /*avout mute gpio*/
                avout_mute-gpios = <&gpio_ao GPIOAO_2 GPIO_ACTIVE_HIGH>;
                                sound-dai = <&dummy_codec>;
                        };
                };
+
+               aml-audio-card,dai-link@6 {
+                       mclk-fs = <256>;
+                       continuous-clock;
+                       suffix-name = "alsaPORT-loopback";
+                       cpu {
+                               sound-dai = <&loopback>;
+                               system-clock-frequency = <12288000>;
+                       };
+                       codec {
+                               sound-dai = <&dummy_codec>;
+                       };
+               };
+
                /*
                 * dai link for i2s to hdmix,
                 * Notice to select a tdm lane not used by hw
                        "samesource_srcpll", "samesource_clk";
                pinctrl-names = "tdm_pins";
                pinctrl-0 = <&tdmb_mclk &tdmout_b &tdmin_b>;
+               mclk_pad = <0>;  /* 0: mclk_0; 1: mclk_1 */
                /*
                 * 0: tdmout_a;
                 * 1: tdmout_b;
                clock-names = "mclk", "clk_srcpll";
                pinctrl-names = "tdm_pins";
                pinctrl-0 = <&tdmc_mclk &tdmout_c &tdmin_c>;
+               mclk_pad = <1>;  /* 0: mclk_0; 1: mclk_1 */
+       };
+
+
+       tdmlb: tdm@3 {
+               compatible = "amlogic, g12a-snd-tdmlb";
+               #sound-dai-cells = <0>;
+               dai-tdm-lane-lb-slot-mask-in = <1 0 0 0>;
+               dai-tdm-clk-sel = <1>;
+               clocks = <&clkaudio CLKID_AUDIO_MCLK_B
+                               &clkc CLKID_MPLL1>;
+               clock-names = "mclk", "clk_srcpll";
+               /*
+                * select tdmin_lb src;
+                *0: TDMOUTA
+                *1: TDMOUTB
+                *2: TDMOUTC
+                *3: PAD_TDMINA
+                *4: PAD_TDMINB
+                *5: PAD_TDMINC
+                */
+               lb-src-sel = <1>;
+
+               status = "disabled";
        };
 
        /* copy a useless tdm to output for hdmi, no pinmux */
                filter_mode = <1>; /* mode 0~4, defalut:1 */
                status = "okay";
        };
-       aml_loopback: loopback {
-               compatible = "amlogic, snd-loopback";
-               /*
-                * 0: out rate = in data rate;
-                * 1: out rate = loopback data rate;
-                */
-               lb_mode = <0>;
+
+       loopback:loopback@0 {
+               compatible = "amlogic, g12a-loopback";
+               #sound-dai-cells = <0>;
+
+               clocks = <&clkaudio CLKID_AUDIO_PDM
+                       &clkc CLKID_FCLK_DIV3
+                       &clkc CLKID_MPLL3
+                       &clkaudio CLKID_AUDIO_PDMIN0
+                       &clkaudio CLKID_AUDIO_PDMIN1
+                       &clkc CLKID_MPLL0
+                       &clkaudio CLKID_AUDIO_MCLK_A>;
+               clock-names = "pdm_gate",
+                       "pdm_sysclk_srcpll",
+                       "pdm_dclk_srcpll",
+                       "pdm_dclk",
+                       "pdm_sysclk",
+                       "tdminlb_mpll",
+                       "tdminlb_mclk";
 
                /* datain src
                 * 0: tdmin_a;
                 * 4: pdmin;
                 */
                datain_src = <4>;
-               datain_chnum = <8>;
-               datain_chmask = <0x3f>;
+               datain_chnum = <4>;
+               datain_chmask = <0xf>;
+               /* config which data pin for loopback */
+               datain-lane-mask-in = <1 0 1 0>;
+
+               /* calc mclk for datalb */
+               mclk-fs = <256>;
 
                /* tdmin_lb src
                 * 0: tdmoutA
                 * 1: tdmoutB
                 * 2: tdmoutC
-                * 3: PAD_tdminA
-                * 4: PAD_tdminB
-                * 5: PAD_tdminC
+                * 3: PAD_TDMINA_DIN*, refer to core pinmux
+                * 4: PAD_TDMINB_DIN*, refer to core pinmux
+                * 5: PAD_TDMINC_DIN*, refer to core pinmux
+                * 6: PAD_TDMINA_D*, oe, refer to core pinmux
+                * 7: PAD_TDMINB_D*, oe, refer to core pinmux
                 */
-               datalb_src = <2>;
-               datalb_chnum = <8>;
+               /* if tdmin_lb >= 3, use external loopback */
+               datalb_src = <1>;
+               datalb_chnum = <2>;
                datalb_chmask = <0x3>;
+               /* config which data pin as loopback */
+               datalb-lane-mask-in = <1 0 0 0>;
 
                status = "okay";
        };
index 572147a..40d8376 100644 (file)
                compatible = "amlogic, g12a-sound-card";
                aml-audio-card,name = "AML-AUGESOUND";
 
-               aml-audio-card,loopback = <&aml_loopback>;
                aml-audio-card,aux-devs = <&amlogic_codec>;
                /*avout mute gpio*/
                avout_mute-gpios = <&gpio_ao GPIOAO_2 GPIO_ACTIVE_HIGH>;
                                sound-dai = <&dummy_codec>;
                        };
                };
+
+               aml-audio-card,dai-link@7 {
+                       mclk-fs = <256>;
+                       continuous-clock;
+                       suffix-name = "alsaPORT-loopback";
+                       cpu {
+                               sound-dai = <&loopback>;
+                               system-clock-frequency = <12288000>;
+                       };
+                       codec {
+                               sound-dai = <&dummy_codec>;
+                       };
+               };
        };
        audiolocker: locker {
                compatible = "amlogic, audiolocker";
                        "samesource_srcpll", "samesource_clk";
                pinctrl-names = "tdm_pins";
                pinctrl-0 = <&tdmb_mclk &tdmout_b &tdmin_b>;
+               mclk_pad = <0>;  /* 0: mclk_0; 1: mclk_1 */
                /*
                 * 0: tdmout_a;
                 * 1: tdmout_b;
                clock-names = "mclk", "clk_srcpll";
                pinctrl-names = "tdm_pins";
                pinctrl-0 = <&tdmc_mclk &tdmout_c &tdmin_c>;
+               mclk_pad = <1>;  /* 0: mclk_0; 1: mclk_1 */
+       };
+
+
+       tdmlb: tdm@3 {
+               compatible = "amlogic, g12a-snd-tdmlb";
+               #sound-dai-cells = <0>;
+               dai-tdm-lane-lb-slot-mask-in = <1 0 0 0>;
+               dai-tdm-clk-sel = <1>;
+               clocks = <&clkaudio CLKID_AUDIO_MCLK_B
+                               &clkc CLKID_MPLL1>;
+               clock-names = "mclk", "clk_srcpll";
+               /*
+                * select tdmin_lb src;
+                *0: TDMOUTA
+                *1: TDMOUTB
+                *2: TDMOUTC
+                *3: PAD_TDMINA
+                *4: PAD_TDMINB
+                *5: PAD_TDMINC
+                */
+               lb-src-sel = <1>;
+
+               status = "disabled";
        };
 
        /* copy a useless tdm to output for hdmi, no pinmux */
                filter_mode = <1>; /* mode 0~4, defalut:1 */
                status = "okay";
        };
-       aml_loopback: loopback {
-               compatible = "amlogic, snd-loopback";
-               /*
-                * 0: out rate = in data rate;
-                * 1: out rate = loopback data rate;
-                */
-               lb_mode = <0>;
+
+       loopback:loopback@0 {
+               compatible = "amlogic, g12a-loopback";
+               #sound-dai-cells = <0>;
+
+               clocks = <&clkaudio CLKID_AUDIO_PDM
+                       &clkc CLKID_FCLK_DIV3
+                       &clkc CLKID_MPLL3
+                       &clkaudio CLKID_AUDIO_PDMIN0
+                       &clkaudio CLKID_AUDIO_PDMIN1
+                       &clkc CLKID_MPLL0
+                       &clkaudio CLKID_AUDIO_MCLK_A>;
+               clock-names = "pdm_gate",
+                       "pdm_sysclk_srcpll",
+                       "pdm_dclk_srcpll",
+                       "pdm_dclk",
+                       "pdm_sysclk",
+                       "tdminlb_mpll",
+                       "tdminlb_mclk";
 
                /* datain src
                 * 0: tdmin_a;
                 * 4: pdmin;
                 */
                datain_src = <4>;
-               datain_chnum = <8>;
-               datain_chmask = <0x3f>;
+               datain_chnum = <4>;
+               datain_chmask = <0xf>;
+               /* config which data pin for loopback */
+               datain-lane-mask-in = <1 0 1 0>;
+
+               /* calc mclk for datalb */
+               mclk-fs = <256>;
 
                /* tdmin_lb src
                 * 0: tdmoutA
                 * 1: tdmoutB
                 * 2: tdmoutC
-                * 3: PAD_tdminA
-                * 4: PAD_tdminB
-                * 5: PAD_tdminC
+                * 3: PAD_TDMINA_DIN*, refer to core pinmux
+                * 4: PAD_TDMINB_DIN*, refer to core pinmux
+                * 5: PAD_TDMINC_DIN*, refer to core pinmux
+                * 6: PAD_TDMINA_D*, oe, refer to core pinmux
+                * 7: PAD_TDMINB_D*, oe, refer to core pinmux
                 */
-               datalb_src = <2>;
-               datalb_chnum = <8>;
+               /* if tdmin_lb >= 3, use external loopback */
+               datalb_src = <1>;
+               datalb_chnum = <2>;
                datalb_chmask = <0x3>;
+               /* config which data pin as loopback */
+               datalb-lane-mask-in = <1 0 0 0>;
 
                status = "okay";
        };
index 8a1fb3b..7e60eba 100644 (file)
                compatible = "amlogic, g12a-sound-card";
                aml-audio-card,name = "AML-AUGESOUND";
 
-               //aml-audio-card,loopback = <&aml_loopback>;
                //aml-audio-card,aux-devs = <&amlogic_codec>;
                /*avout mute gpio*/
                avout_mute-gpios = <&gpio_ao GPIOAO_2 GPIO_ACTIVE_HIGH>;
                                sound-dai = <&dummy_codec>;
                        };
                };
+               aml-audio-card,dai-link@6 {
+                       mclk-fs = <256>;
+                       continuous-clock;
+                       suffix-name = "alsaPORT-loopback";
+                       cpu {
+                               sound-dai = <&loopback>;
+                               system-clock-frequency = <12288000>;
+                       };
+                       codec {
+                               sound-dai = <&dummy_codec>;
+                       };
+               };
+
+               aml-audio-card,dai-link@7 {
+                       format = "i2s";
+                       mclk-fs = <256>;
+                       //continuous-clock;
+                       //bitclock-inversion;
+                       //frame-inversion;
+                       bitclock-master = <&tdmlb>;
+                       frame-master = <&tdmlb>;
+                       cpu {
+                               sound-dai = <&tdmlb>;
+                               dai-tdm-slot-rx-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";
                        "samesource_srcpll", "samesource_clk";
                pinctrl-names = "tdm_pins";
                pinctrl-0 = <&tdmb_mclk &tdmout_b &tdmin_b>;
+               mclk_pad = <0>;  /* 0: mclk_0; 1: mclk_1 */
                /*
                 * 0: tdmout_a;
                 * 1: tdmout_b;
                clock-names = "mclk", "clk_srcpll";
                pinctrl-names = "tdm_pins";
                pinctrl-0 = <&tdmc_mclk &tdmout_c &tdmin_c>;
+               mclk_pad = <1>;  /* 0: mclk_0; 1: mclk_1 */
        };
 
-       /* copy a useless tdm to output for hdmi, no pinmux */
-       aml_i2s2hdmi: i2s2hdmi {
-               compatible = "amlogic, g12a-snd-tdmc";
+       tdmlb: tdm@3 {
+               compatible = "amlogic, g12a-snd-tdmlb";
                #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>;
+               dai-tdm-lane-lb-slot-mask-in = <1 0 0 0>;
+               dai-tdm-clk-sel = <1>;
+               clocks = <&clkaudio CLKID_AUDIO_MCLK_B
+                               &clkc CLKID_MPLL1>;
                clock-names = "mclk", "clk_srcpll";
-
-               i2s2hdmi = <1>;
+               /*
+                * select tdmin_lb src;
+                *0: TDMOUTA
+                *1: TDMOUTB
+                *2: TDMOUTC
+                *3: PAD_TDMINA
+                *4: PAD_TDMINB
+                *5: PAD_TDMINC
+                */
+               lb-src-sel = <1>;
 
                status = "okay";
        };
                filter_mode = <1>; /* mode 0~4, defalut:1 */
                status = "okay";
        };
-       aml_loopback: loopback {
-               compatible = "amlogic, snd-loopback";
-               /*
-                * 0: out rate = in data rate;
-                * 1: out rate = loopback data rate;
-                */
-               lb_mode = <0>;
+
+       loopback:loopback@0 {
+               compatible = "amlogic, g12a-loopback";
+               #sound-dai-cells = <0>;
+
+               clocks = <&clkaudio CLKID_AUDIO_PDM
+                       &clkc CLKID_FCLK_DIV3
+                       &clkc CLKID_MPLL3
+                       &clkaudio CLKID_AUDIO_PDMIN0
+                       &clkaudio CLKID_AUDIO_PDMIN1
+                       &clkc CLKID_MPLL0
+                       &clkaudio CLKID_AUDIO_MCLK_A>;
+               clock-names = "pdm_gate",
+                       "pdm_sysclk_srcpll",
+                       "pdm_dclk_srcpll",
+                       "pdm_dclk",
+                       "pdm_sysclk",
+                       "tdminlb_mpll",
+                       "tdminlb_mclk";
 
                /* datain src
                 * 0: tdmin_a;
                 * 4: pdmin;
                 */
                datain_src = <4>;
-               datain_chnum = <8>;
-               datain_chmask = <0x3f>;
+               datain_chnum = <4>;
+               datain_chmask = <0xf>;
+               /* config which data pin for loopback */
+               datain-lane-mask-in = <1 0 1 0>;
+
+               /* calc mclk for datalb */
+               mclk-fs = <256>;
 
                /* tdmin_lb src
                 * 0: tdmoutA
                 * 1: tdmoutB
                 * 2: tdmoutC
-                * 3: PAD_tdminA
-                * 4: PAD_tdminB
-                * 5: PAD_tdminC
+                * 3: PAD_TDMINA_DIN*, refer to core pinmux
+                * 4: PAD_TDMINB_DIN*, refer to core pinmux
+                * 5: PAD_TDMINC_DIN*, refer to core pinmux
+                * 6: PAD_TDMINA_D*, oe, refer to core pinmux
+                * 7: PAD_TDMINB_D*, oe, refer to core pinmux
                 */
-               datalb_src = <2>;
-               datalb_chnum = <8>;
+               /* if tdmin_lb >= 3, use external loopback */
+               datalb_src = <1>;
+               datalb_chnum = <2>;
                datalb_chmask = <0x3>;
+               /* config which data pin as loopback */
+               datalb-lane-mask-in = <1 0 0 0>;
 
-               status = "disabled";
+               status = "okay";
        };
 
        audioresample: resample {
index d6044c9..3b8edc2 100644 (file)
                compatible = "amlogic, g12a-sound-card";
                aml-audio-card,name = "AML-AUGESOUND";
 
-               //aml-audio-card,loopback = <&aml_loopback>;
                //aml-audio-card,aux-devs = <&amlogic_codec>;
                /*avout mute gpio*/
                avout_mute-gpios = <&gpio_ao GPIOAO_2 GPIO_ACTIVE_HIGH>;
                                sound-dai = <&dummy_codec>;
                        };
                };
+               aml-audio-card,dai-link@6 {
+                       mclk-fs = <256>;
+                       continuous-clock;
+                       suffix-name = "alsaPORT-loopback";
+                       cpu {
+                               sound-dai = <&loopback>;
+                               system-clock-frequency = <12288000>;
+                       };
+                       codec {
+                               sound-dai = <&dummy_codec>;
+                       };
+               };
+
+               aml-audio-card,dai-link@7 {
+                       format = "i2s";
+                       mclk-fs = <256>;
+                       //continuous-clock;
+                       //bitclock-inversion;
+                       //frame-inversion;
+                       bitclock-master = <&tdmlb>;
+                       frame-master = <&tdmlb>;
+                       cpu {
+                               sound-dai = <&tdmlb>;
+                               dai-tdm-slot-rx-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";
                        "samesource_srcpll", "samesource_clk";
                pinctrl-names = "tdm_pins";
                pinctrl-0 = <&tdmb_mclk &tdmout_b &tdmin_b>;
+               mclk_pad = <0>;  /* 0: mclk_0; 1: mclk_1 */
                /*
                 * 0: tdmout_a;
                 * 1: tdmout_b;
                clock-names = "mclk", "clk_srcpll";
                pinctrl-names = "tdm_pins";
                pinctrl-0 = <&tdmc_mclk &tdmout_c &tdmin_c>;
+               mclk_pad = <1>;  /* 0: mclk_0; 1: mclk_1 */
        };
 
-       /* copy a useless tdm to output for hdmi, no pinmux */
-       aml_i2s2hdmi: i2s2hdmi {
-               compatible = "amlogic, g12a-snd-tdmc";
+       tdmlb: tdm@3 {
+               compatible = "amlogic, g12a-snd-tdmlb";
                #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>;
+               dai-tdm-lane-lb-slot-mask-in = <1 0 0 0>;
+               dai-tdm-clk-sel = <1>;
+               clocks = <&clkaudio CLKID_AUDIO_MCLK_B
+                               &clkc CLKID_MPLL1>;
                clock-names = "mclk", "clk_srcpll";
-
-               i2s2hdmi = <1>;
+               /*
+                * select tdmin_lb src;
+                *0: TDMOUTA
+                *1: TDMOUTB
+                *2: TDMOUTC
+                *3: PAD_TDMINA
+                *4: PAD_TDMINB
+                *5: PAD_TDMINC
+                */
+               lb-src-sel = <1>;
 
                status = "okay";
        };
                filter_mode = <1>; /* mode 0~4, defalut:1 */
                status = "okay";
        };
-       aml_loopback: loopback {
-               compatible = "amlogic, snd-loopback";
-               /*
-                * 0: out rate = in data rate;
-                * 1: out rate = loopback data rate;
-                */
-               lb_mode = <0>;
+
+       loopback:loopback@0 {
+               compatible = "amlogic, g12a-loopback";
+               #sound-dai-cells = <0>;
+
+               clocks = <&clkaudio CLKID_AUDIO_PDM
+                       &clkc CLKID_FCLK_DIV3
+                       &clkc CLKID_MPLL3
+                       &clkaudio CLKID_AUDIO_PDMIN0
+                       &clkaudio CLKID_AUDIO_PDMIN1
+                       &clkc CLKID_MPLL0
+                       &clkaudio CLKID_AUDIO_MCLK_A>;
+               clock-names = "pdm_gate",
+                       "pdm_sysclk_srcpll",
+                       "pdm_dclk_srcpll",
+                       "pdm_dclk",
+                       "pdm_sysclk",
+                       "tdminlb_mpll",
+                       "tdminlb_mclk";
 
                /* datain src
                 * 0: tdmin_a;
                 * 4: pdmin;
                 */
                datain_src = <4>;
-               datain_chnum = <8>;
-               datain_chmask = <0x3f>;
+               datain_chnum = <4>;
+               datain_chmask = <0xf>;
+               /* config which data pin for loopback */
+               datain-lane-mask-in = <1 0 1 0>;
+
+               /* calc mclk for datalb */
+               mclk-fs = <256>;
 
                /* tdmin_lb src
                 * 0: tdmoutA
                 * 1: tdmoutB
                 * 2: tdmoutC
-                * 3: PAD_tdminA
-                * 4: PAD_tdminB
-                * 5: PAD_tdminC
+                * 3: PAD_TDMINA_DIN*, refer to core pinmux
+                * 4: PAD_TDMINB_DIN*, refer to core pinmux
+                * 5: PAD_TDMINC_DIN*, refer to core pinmux
+                * 6: PAD_TDMINA_D*, oe, refer to core pinmux
+                * 7: PAD_TDMINB_D*, oe, refer to core pinmux
                 */
-               datalb_src = <2>;
-               datalb_chnum = <8>;
+               /* if tdmin_lb >= 3, use external loopback */
+               datalb_src = <1>;
+               datalb_chnum = <2>;
                datalb_chmask = <0x3>;
+               /* config which data pin as loopback */
+               datalb-lane-mask-in = <1 0 0 0>;
 
-               status = "disabled";
+               status = "okay";
        };
 
        audioresample: resample {
index e5b28ec..133db08 100644 (file)
                compatible = "amlogic, g12a-sound-card";
                aml-audio-card,name = "AML-AUGESOUND";
 
-               //aml-audio-card,loopback = <&aml_loopback>;
                //aml-audio-card,aux-devs = <&amlogic_codec>;
                /*avout mute gpio*/
                avout_mute-gpios = <&gpio_ao GPIOAO_2 GPIO_ACTIVE_HIGH>;
                                sound-dai = <&dummy_codec>;
                        };
                };
+               aml-audio-card,dai-link@6 {
+                       mclk-fs = <256>;
+                       continuous-clock;
+                       suffix-name = "alsaPORT-loopback";
+                       cpu {
+                               sound-dai = <&loopback>;
+                               system-clock-frequency = <12288000>;
+                       };
+                       codec {
+                               sound-dai = <&dummy_codec>;
+                       };
+               };
        };
+
        audiolocker: locker {
                compatible = "amlogic, audiolocker";
                clocks = <&clkaudio CLKID_AUDIO_LOCKER_OUT
                        "samesource_srcpll", "samesource_clk";
                pinctrl-names = "tdm_pins";
                pinctrl-0 = <&tdmb_mclk &tdmout_b &tdmin_b>;
+               mclk_pad = <0>;  /* 0: mclk_0; 1: mclk_1 */
                /*
                 * 0: tdmout_a;
                 * 1: tdmout_b;
                clock-names = "mclk", "clk_srcpll";
                pinctrl-names = "tdm_pins";
                pinctrl-0 = <&tdmc_mclk &tdmout_c &tdmin_c>;
+               mclk_pad = <1>;  /* 0: mclk_0; 1: mclk_1 */
        };
 
-       /* copy a useless tdm to output for hdmi, no pinmux */
-       aml_i2s2hdmi: i2s2hdmi {
-               compatible = "amlogic, g12a-snd-tdmc";
+       tdmlb: tdm@3 {
+               compatible = "amlogic, g12a-snd-tdmlb";
                #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>;
+               dai-tdm-lane-lb-slot-mask-in = <1 0 0 0>;
+               dai-tdm-clk-sel = <1>;
+               clocks = <&clkaudio CLKID_AUDIO_MCLK_B
+                               &clkc CLKID_MPLL1>;
                clock-names = "mclk", "clk_srcpll";
+               /*
+                * select tdmin_lb src;
+                *0: TDMOUTA
+                *1: TDMOUTB
+                *2: TDMOUTC
+                *3: PAD_TDMINA
+                *4: PAD_TDMINB
+                *5: PAD_TDMINC
+                */
+               lb-src-sel = <1>;
 
-               i2s2hdmi = <1>;
-
-               status = "okay";
+               status = "disabled";
        };
 
        aml_spdif: spdif {
                filter_mode = <1>; /* mode 0~4, defalut:1 */
                status = "okay";
        };
-       aml_loopback: loopback {
-               compatible = "amlogic, snd-loopback";
-               /*
-                * 0: out rate = in data rate;
-                * 1: out rate = loopback data rate;
-                */
-               lb_mode = <0>;
+
+       loopback:loopback@0 {
+               compatible = "amlogic, g12a-loopback";
+               #sound-dai-cells = <0>;
+
+               clocks = <&clkaudio CLKID_AUDIO_PDM
+                       &clkc CLKID_FCLK_DIV3
+                       &clkc CLKID_MPLL3
+                       &clkaudio CLKID_AUDIO_PDMIN0
+                       &clkaudio CLKID_AUDIO_PDMIN1
+                       &clkc CLKID_MPLL0
+                       &clkaudio CLKID_AUDIO_MCLK_A>;
+               clock-names = "pdm_gate",
+                       "pdm_sysclk_srcpll",
+                       "pdm_dclk_srcpll",
+                       "pdm_dclk",
+                       "pdm_sysclk",
+                       "tdminlb_mpll",
+                       "tdminlb_mclk";
 
                /* datain src
                 * 0: tdmin_a;
                 * 4: pdmin;
                 */
                datain_src = <4>;
-               datain_chnum = <8>;
-               datain_chmask = <0x3f>;
+               datain_chnum = <4>;
+               datain_chmask = <0xf>;
+               /* config which data pin for loopback */
+               datain-lane-mask-in = <1 0 1 0>;
+
+               /* calc mclk for datalb */
+               mclk-fs = <256>;
 
                /* tdmin_lb src
                 * 0: tdmoutA
                 * 1: tdmoutB
                 * 2: tdmoutC
-                * 3: PAD_tdminA
-                * 4: PAD_tdminB
-                * 5: PAD_tdminC
+                * 3: PAD_TDMINA_DIN*, refer to core pinmux
+                * 4: PAD_TDMINB_DIN*, refer to core pinmux
+                * 5: PAD_TDMINC_DIN*, refer to core pinmux
+                * 6: PAD_TDMINA_D*, oe, refer to core pinmux
+                * 7: PAD_TDMINB_D*, oe, refer to core pinmux
                 */
-               datalb_src = <2>;
-               datalb_chnum = <8>;
+               /* if tdmin_lb >= 3, use external loopback */
+               datalb_src = <1>;
+               datalb_chnum = <2>;
                datalb_chmask = <0x3>;
+               /* config which data pin as loopback */
+               datalb-lane-mask-in = <1 0 0 0>;
 
-               status = "disabled";
+               status = "okay";
        };
 
        audioresample: resample {
index 4b2d544..3eed3bd 100644 (file)
                compatible = "amlogic, g12a-sound-card";
                aml-audio-card,name = "AML-AUGESOUND";
 
-               //aml-audio-card,loopback = <&aml_loopback>;
                //aml-audio-card,aux-devs = <&amlogic_codec>;
                /*avout mute gpio*/
                avout_mute-gpios = <&gpio_ao GPIOAO_2 GPIO_ACTIVE_HIGH>;
                                sound-dai = <&dummy_codec>;
                        };
                };
+               aml-audio-card,dai-link@6 {
+                       mclk-fs = <256>;
+                       continuous-clock;
+                       suffix-name = "alsaPORT-loopback";
+                       cpu {
+                               sound-dai = <&loopback>;
+                               system-clock-frequency = <12288000>;
+                       };
+                       codec {
+                               sound-dai = <&dummy_codec>;
+                       };
+               };
        };
+
        audiolocker: locker {
                compatible = "amlogic, audiolocker";
                clocks = <&clkaudio CLKID_AUDIO_LOCKER_OUT
                        "samesource_srcpll", "samesource_clk";
                pinctrl-names = "tdm_pins";
                pinctrl-0 = <&tdmb_mclk &tdmout_b &tdmin_b>;
+               mclk_pad = <0>;  /* 0: mclk_0; 1: mclk_1 */
                /*
                 * 0: tdmout_a;
                 * 1: tdmout_b;
                clock-names = "mclk", "clk_srcpll";
                pinctrl-names = "tdm_pins";
                pinctrl-0 = <&tdmc_mclk &tdmout_c &tdmin_c>;
+               mclk_pad = <1>;  /* 0: mclk_0; 1: mclk_1 */
        };
 
-       /* copy a useless tdm to output for hdmi, no pinmux */
-       aml_i2s2hdmi: i2s2hdmi {
-               compatible = "amlogic, g12a-snd-tdmc";
+       tdmlb: tdm@3 {
+               compatible = "amlogic, g12a-snd-tdmlb";
                #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>;
+               dai-tdm-lane-lb-slot-mask-in = <1 0 0 0>;
+               dai-tdm-clk-sel = <1>;
+               clocks = <&clkaudio CLKID_AUDIO_MCLK_B
+                               &clkc CLKID_MPLL1>;
                clock-names = "mclk", "clk_srcpll";
+               /*
+                * select tdmin_lb src;
+                *0: TDMOUTA
+                *1: TDMOUTB
+                *2: TDMOUTC
+                *3: PAD_TDMINA
+                *4: PAD_TDMINB
+                *5: PAD_TDMINC
+                */
+               lb-src-sel = <1>;
 
-               i2s2hdmi = <1>;
-
-               status = "okay";
+               status = "disabled";
        };
 
        aml_spdif: spdif {
                filter_mode = <1>; /* mode 0~4, defalut:1 */
                status = "okay";
        };
-       aml_loopback: loopback {
-               compatible = "amlogic, snd-loopback";
-               /*
-                * 0: out rate = in data rate;
-                * 1: out rate = loopback data rate;
-                */
-               lb_mode = <0>;
+
+       loopback:loopback@0 {
+               compatible = "amlogic, g12a-loopback";
+               #sound-dai-cells = <0>;
+
+               clocks = <&clkaudio CLKID_AUDIO_PDM
+                       &clkc CLKID_FCLK_DIV3
+                       &clkc CLKID_MPLL3
+                       &clkaudio CLKID_AUDIO_PDMIN0
+                       &clkaudio CLKID_AUDIO_PDMIN1
+                       &clkc CLKID_MPLL0
+                       &clkaudio CLKID_AUDIO_MCLK_A>;
+               clock-names = "pdm_gate",
+                       "pdm_sysclk_srcpll",
+                       "pdm_dclk_srcpll",
+                       "pdm_dclk",
+                       "pdm_sysclk",
+                       "tdminlb_mpll",
+                       "tdminlb_mclk";
 
                /* datain src
                 * 0: tdmin_a;
                 * 4: pdmin;
                 */
                datain_src = <4>;
-               datain_chnum = <8>;
-               datain_chmask = <0x3f>;
+               datain_chnum = <4>;
+               datain_chmask = <0xf>;
+               /* config which data pin for loopback */
+               datain-lane-mask-in = <1 0 1 0>;
+
+               /* calc mclk for datalb */
+               mclk-fs = <256>;
 
                /* tdmin_lb src
                 * 0: tdmoutA
                 * 1: tdmoutB
                 * 2: tdmoutC
-                * 3: PAD_tdminA
-                * 4: PAD_tdminB
-                * 5: PAD_tdminC
+                * 3: PAD_TDMINA_DIN*, refer to core pinmux
+                * 4: PAD_TDMINB_DIN*, refer to core pinmux
+                * 5: PAD_TDMINC_DIN*, refer to core pinmux
+                * 6: PAD_TDMINA_D*, oe, refer to core pinmux
+                * 7: PAD_TDMINB_D*, oe, refer to core pinmux
                 */
-               datalb_src = <2>;
-               datalb_chnum = <8>;
+               /* if tdmin_lb >= 3, use external loopback */
+               datalb_src = <1>;
+               datalb_chnum = <2>;
                datalb_chmask = <0x3>;
+               /* config which data pin as loopback */
+               datalb-lane-mask-in = <1 0 0 0>;
 
-               status = "disabled";
+               status = "okay";
        };
 
        audioresample: resample {
index 5047bdb..ab04b50 100644 (file)
                compatible = "amlogic, g12a-sound-card";
                aml-audio-card,name = "AML-AUGESOUND";
 
-               //aml-audio-card,loopback = <&aml_loopback>;
                //aml-audio-card,aux-devs = <&amlogic_codec>;
                /*avout mute gpio*/
                avout_mute-gpios = <&gpio_ao GPIOAO_2 GPIO_ACTIVE_HIGH>;
                                sound-dai = <&dummy_codec>;
                        };
                };
+               aml-audio-card,dai-link@6 {
+                       mclk-fs = <256>;
+                       continuous-clock;
+                       suffix-name = "alsaPORT-loopback";
+                       cpu {
+                               sound-dai = <&loopback>;
+                               system-clock-frequency = <12288000>;
+                       };
+                       codec {
+                               sound-dai = <&dummy_codec>;
+                       };
+               };
        };
+
        audiolocker: locker {
                compatible = "amlogic, audiolocker";
                clocks = <&clkaudio CLKID_AUDIO_LOCKER_OUT
                        "samesource_srcpll", "samesource_clk";
                pinctrl-names = "tdm_pins";
                pinctrl-0 = <&tdmb_mclk &tdmout_b &tdmin_b>;
+               mclk_pad = <0>;  /* 0: mclk_0; 1: mclk_1 */
                /*
                 * 0: tdmout_a;
                 * 1: tdmout_b;
                clock-names = "mclk", "clk_srcpll";
                pinctrl-names = "tdm_pins";
                pinctrl-0 = <&tdmc_mclk &tdmout_c &tdmin_c>;
+               mclk_pad = <1>;  /* 0: mclk_0; 1: mclk_1 */
        };
 
-       /* copy a useless tdm to output for hdmi, no pinmux */
-       aml_i2s2hdmi: i2s2hdmi {
-               compatible = "amlogic, g12a-snd-tdmc";
+       tdmlb: tdm@3 {
+               compatible = "amlogic, g12a-snd-tdmlb";
                #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>;
+               dai-tdm-lane-lb-slot-mask-in = <1 0 0 0>;
+               dai-tdm-clk-sel = <1>;
+               clocks = <&clkaudio CLKID_AUDIO_MCLK_B
+                               &clkc CLKID_MPLL1>;
                clock-names = "mclk", "clk_srcpll";
+               /*
+                * select tdmin_lb src;
+                *0: TDMOUTA
+                *1: TDMOUTB
+                *2: TDMOUTC
+                *3: PAD_TDMINA
+                *4: PAD_TDMINB
+                *5: PAD_TDMINC
+                */
+               lb-src-sel = <1>;
 
-               i2s2hdmi = <1>;
-
-               status = "okay";
+               status = "disabled";
        };
 
        aml_spdif: spdif {
                filter_mode = <1>; /* mode 0~4, defalut:1 */
                status = "okay";
        };
-       aml_loopback: loopback {
-               compatible = "amlogic, snd-loopback";
-               /*
-                * 0: out rate = in data rate;
-                * 1: out rate = loopback data rate;
-                */
-               lb_mode = <0>;
+
+       loopback:loopback@0 {
+               compatible = "amlogic, g12a-loopback";
+               #sound-dai-cells = <0>;
+
+               clocks = <&clkaudio CLKID_AUDIO_PDM
+                       &clkc CLKID_FCLK_DIV3
+                       &clkc CLKID_MPLL3
+                       &clkaudio CLKID_AUDIO_PDMIN0
+                       &clkaudio CLKID_AUDIO_PDMIN1
+                       &clkc CLKID_MPLL0
+                       &clkaudio CLKID_AUDIO_MCLK_A>;
+               clock-names = "pdm_gate",
+                       "pdm_sysclk_srcpll",
+                       "pdm_dclk_srcpll",
+                       "pdm_dclk",
+                       "pdm_sysclk",
+                       "tdminlb_mpll",
+                       "tdminlb_mclk";
 
                /* datain src
                 * 0: tdmin_a;
                 * 4: pdmin;
                 */
                datain_src = <4>;
-               datain_chnum = <8>;
-               datain_chmask = <0x3f>;
+               datain_chnum = <4>;
+               datain_chmask = <0xf>;
+               /* config which data pin for loopback */
+               datain-lane-mask-in = <1 0 1 0>;
+
+               /* calc mclk for datalb */
+               mclk-fs = <256>;
 
                /* tdmin_lb src
                 * 0: tdmoutA
                 * 1: tdmoutB
                 * 2: tdmoutC
-                * 3: PAD_tdminA
-                * 4: PAD_tdminB
-                * 5: PAD_tdminC
+                * 3: PAD_TDMINA_DIN*, refer to core pinmux
+                * 4: PAD_TDMINB_DIN*, refer to core pinmux
+                * 5: PAD_TDMINC_DIN*, refer to core pinmux
+                * 6: PAD_TDMINA_D*, oe, refer to core pinmux
+                * 7: PAD_TDMINB_D*, oe, refer to core pinmux
                 */
-               datalb_src = <2>;
-               datalb_chnum = <8>;
+               /* if tdmin_lb >= 3, use external loopback */
+               datalb_src = <1>;
+               datalb_chnum = <2>;
                datalb_chmask = <0x3>;
+               /* config which data pin as loopback */
+               datalb-lane-mask-in = <1 0 0 0>;
 
-               status = "disabled";
+               status = "okay";
        };
 
        audioresample: resample {
index c972c12..4439114 100644 (file)
                compatible = "amlogic, g12a-sound-card";
                aml-audio-card,name = "AML-AUGESOUND";
 
-               //aml-audio-card,loopback = <&aml_loopback>;
                //aml-audio-card,aux-devs = <&amlogic_codec>;
                /*avout mute gpio*/
                avout_mute-gpios = <&gpio_ao GPIOAO_2 GPIO_ACTIVE_HIGH>;
                                sound-dai = <&dummy_codec>;
                        };
                };
+               aml-audio-card,dai-link@6 {
+                       mclk-fs = <256>;
+                       continuous-clock;
+                       suffix-name = "alsaPORT-loopback";
+                       cpu {
+                               sound-dai = <&loopback>;
+                               system-clock-frequency = <12288000>;
+                       };
+                       codec {
+                               sound-dai = <&dummy_codec>;
+                       };
+               };
        };
        audiolocker: locker {
                compatible = "amlogic, audiolocker";
                        "samesource_srcpll", "samesource_clk";
                pinctrl-names = "tdm_pins";
                pinctrl-0 = <&tdmb_mclk &tdmout_b &tdmin_b>;
+               mclk_pad = <0>;  /* 0: mclk_0; 1: mclk_1 */
                /*
                 * 0: tdmout_a;
                 * 1: tdmout_b;
                clock-names = "mclk", "clk_srcpll";
                pinctrl-names = "tdm_pins";
                pinctrl-0 = <&tdmc_mclk &tdmout_c &tdmin_c>;
+               mclk_pad = <1>;  /* 0: mclk_0; 1: mclk_1 */
        };
 
-       /* copy a useless tdm to output for hdmi, no pinmux */
-       aml_i2s2hdmi: i2s2hdmi {
-               compatible = "amlogic, g12a-snd-tdmc";
+       tdmlb: tdm@3 {
+               compatible = "amlogic, g12a-snd-tdmlb";
                #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>;
+               dai-tdm-lane-lb-slot-mask-in = <1 0 0 0>;
+               dai-tdm-clk-sel = <1>;
+               clocks = <&clkaudio CLKID_AUDIO_MCLK_B
+                               &clkc CLKID_MPLL1>;
                clock-names = "mclk", "clk_srcpll";
+               /*
+                * select tdmin_lb src;
+                *0: TDMOUTA
+                *1: TDMOUTB
+                *2: TDMOUTC
+                *3: PAD_TDMINA
+                *4: PAD_TDMINB
+                *5: PAD_TDMINC
+                */
+               lb-src-sel = <1>;
 
-               i2s2hdmi = <1>;
-
-               status = "okay";
+               status = "disabled";
        };
 
        aml_spdif: spdif {
                filter_mode = <1>; /* mode 0~4, defalut:1 */
                status = "okay";
        };
-       aml_loopback: loopback {
-               compatible = "amlogic, snd-loopback";
-               /*
-                * 0: out rate = in data rate;
-                * 1: out rate = loopback data rate;
-                */
-               lb_mode = <0>;
+
+       loopback:loopback@0 {
+               compatible = "amlogic, g12a-loopback";
+               #sound-dai-cells = <0>;
+
+               clocks = <&clkaudio CLKID_AUDIO_PDM
+                       &clkc CLKID_FCLK_DIV3
+                       &clkc CLKID_MPLL3
+                       &clkaudio CLKID_AUDIO_PDMIN0
+                       &clkaudio CLKID_AUDIO_PDMIN1
+                       &clkc CLKID_MPLL0
+                       &clkaudio CLKID_AUDIO_MCLK_A>;
+               clock-names = "pdm_gate",
+                       "pdm_sysclk_srcpll",
+                       "pdm_dclk_srcpll",
+                       "pdm_dclk",
+                       "pdm_sysclk",
+                       "tdminlb_mpll",
+                       "tdminlb_mclk";
 
                /* datain src
                 * 0: tdmin_a;
                 * 4: pdmin;
                 */
                datain_src = <4>;
-               datain_chnum = <8>;
-               datain_chmask = <0x3f>;
+               datain_chnum = <4>;
+               datain_chmask = <0xf>;
+               /* config which data pin for loopback */
+               datain-lane-mask-in = <1 0 1 0>;
+
+               /* calc mclk for datalb */
+               mclk-fs = <256>;
 
                /* tdmin_lb src
                 * 0: tdmoutA
                 * 1: tdmoutB
                 * 2: tdmoutC
-                * 3: PAD_tdminA
-                * 4: PAD_tdminB
-                * 5: PAD_tdminC
+                * 3: PAD_TDMINA_DIN*, refer to core pinmux
+                * 4: PAD_TDMINB_DIN*, refer to core pinmux
+                * 5: PAD_TDMINC_DIN*, refer to core pinmux
+                * 6: PAD_TDMINA_D*, oe, refer to core pinmux
+                * 7: PAD_TDMINB_D*, oe, refer to core pinmux
                 */
-               datalb_src = <2>;
-               datalb_chnum = <8>;
+               /* if tdmin_lb >= 3, use external loopback */
+               datalb_src = <1>;
+               datalb_chnum = <2>;
                datalb_chmask = <0x3>;
+               /* config which data pin as loopback */
+               datalb-lane-mask-in = <1 0 0 0>;
 
-               status = "disabled";
+               status = "okay";
        };
 
        audioresample: resample {
index 8e469c0..96ac027 100644 (file)
                compatible = "amlogic, g12a-sound-card";
                aml-audio-card,name = "AML-AUGESOUND";
 
-               //aml-audio-card,loopback = <&aml_loopback>;
                //aml-audio-card,aux-devs = <&amlogic_codec>;
                /*avout mute gpio*/
                avout_mute-gpios = <&gpio_ao GPIOAO_2 GPIO_ACTIVE_HIGH>;
                                sound-dai = <&dummy_codec>;
                        };
                };
+               aml-audio-card,dai-link@6 {
+                       mclk-fs = <256>;
+                       continuous-clock;
+                       suffix-name = "alsaPORT-loopback";
+                       cpu {
+                               sound-dai = <&loopback>;
+                               system-clock-frequency = <12288000>;
+                       };
+                       codec {
+                               sound-dai = <&dummy_codec>;
+                       };
+               };
        };
        audiolocker: locker {
                compatible = "amlogic, audiolocker";
                        "samesource_srcpll", "samesource_clk";
                pinctrl-names = "tdm_pins";
                pinctrl-0 = <&tdmb_mclk &tdmout_b &tdmin_b>;
+               mclk_pad = <0>;  /* 0: mclk_0; 1: mclk_1 */
                /*
                 * 0: tdmout_a;
                 * 1: tdmout_b;
                clock-names = "mclk", "clk_srcpll";
                pinctrl-names = "tdm_pins";
                pinctrl-0 = <&tdmc_mclk &tdmout_c &tdmin_c>;
+               mclk_pad = <1>;  /* 0: mclk_0; 1: mclk_1 */
        };
 
-       /* copy a useless tdm to output for hdmi, no pinmux */
-       aml_i2s2hdmi: i2s2hdmi {
-               compatible = "amlogic, g12a-snd-tdmc";
+       tdmlb: tdm@3 {
+               compatible = "amlogic, g12a-snd-tdmlb";
                #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>;
+               dai-tdm-lane-lb-slot-mask-in = <1 0 0 0>;
+               dai-tdm-clk-sel = <1>;
+               clocks = <&clkaudio CLKID_AUDIO_MCLK_B
+                               &clkc CLKID_MPLL1>;
                clock-names = "mclk", "clk_srcpll";
+               /*
+                * select tdmin_lb src;
+                *0: TDMOUTA
+                *1: TDMOUTB
+                *2: TDMOUTC
+                *3: PAD_TDMINA
+                *4: PAD_TDMINB
+                *5: PAD_TDMINC
+                */
+               lb-src-sel = <1>;
 
-               i2s2hdmi = <1>;
-
-               status = "okay";
+               status = "disabled";
        };
 
        aml_spdif: spdif {
                filter_mode = <1>; /* mode 0~4, defalut:1 */
                status = "okay";
        };
-       aml_loopback: loopback {
-               compatible = "amlogic, snd-loopback";
-               /*
-                * 0: out rate = in data rate;
-                * 1: out rate = loopback data rate;
-                */
-               lb_mode = <0>;
+
+       loopback:loopback@0 {
+               compatible = "amlogic, g12a-loopback";
+               #sound-dai-cells = <0>;
+
+               clocks = <&clkaudio CLKID_AUDIO_PDM
+                       &clkc CLKID_FCLK_DIV3
+                       &clkc CLKID_MPLL3
+                       &clkaudio CLKID_AUDIO_PDMIN0
+                       &clkaudio CLKID_AUDIO_PDMIN1
+                       &clkc CLKID_MPLL0
+                       &clkaudio CLKID_AUDIO_MCLK_A>;
+               clock-names = "pdm_gate",
+                       "pdm_sysclk_srcpll",
+                       "pdm_dclk_srcpll",
+                       "pdm_dclk",
+                       "pdm_sysclk",
+                       "tdminlb_mpll",
+                       "tdminlb_mclk";
 
                /* datain src
                 * 0: tdmin_a;
                 * 4: pdmin;
                 */
                datain_src = <4>;
-               datain_chnum = <8>;
-               datain_chmask = <0x3f>;
+               datain_chnum = <4>;
+               datain_chmask = <0xf>;
+               /* config which data pin for loopback */
+               datain-lane-mask-in = <1 0 1 0>;
+
+               /* calc mclk for datalb */
+               mclk-fs = <256>;
 
                /* tdmin_lb src
                 * 0: tdmoutA
                 * 1: tdmoutB
                 * 2: tdmoutC
-                * 3: PAD_tdminA
-                * 4: PAD_tdminB
-                * 5: PAD_tdminC
+                * 3: PAD_TDMINA_DIN*, refer to core pinmux
+                * 4: PAD_TDMINB_DIN*, refer to core pinmux
+                * 5: PAD_TDMINC_DIN*, refer to core pinmux
+                * 6: PAD_TDMINA_D*, oe, refer to core pinmux
+                * 7: PAD_TDMINB_D*, oe, refer to core pinmux
                 */
-               datalb_src = <2>;
-               datalb_chnum = <8>;
+               /* if tdmin_lb >= 3, use external loopback */
+               datalb_src = <1>;
+               datalb_chnum = <2>;
                datalb_chmask = <0x3>;
+               /* config which data pin as loopback */
+               datalb-lane-mask-in = <1 0 0 0>;
 
-               status = "disabled";
+               status = "okay";
        };
 
        audioresample: resample {
index 7edfad7..29d4347 100644 (file)
                compatible = "amlogic, g12a-sound-card";
                aml-audio-card,name = "AML-AUGESOUND";
 
-               //aml-audio-card,loopback = <&aml_loopback>;
                //aml-audio-card,aux-devs = <&amlogic_codec>;
                /*avout mute gpio*/
                avout_mute-gpios = <&gpio_ao GPIOAO_2 GPIO_ACTIVE_HIGH>;
                                sound-dai = <&dummy_codec>;
                        };
                };
+               aml-audio-card,dai-link@6 {
+                       mclk-fs = <256>;
+                       continuous-clock;
+                       suffix-name = "alsaPORT-loopback";
+                       cpu {
+                               sound-dai = <&loopback>;
+                               system-clock-frequency = <12288000>;
+                       };
+                       codec {
+                               sound-dai = <&dummy_codec>;
+                       };
+               };
        };
        audiolocker: locker {
                compatible = "amlogic, audiolocker";
                        "samesource_srcpll", "samesource_clk";
                pinctrl-names = "tdm_pins";
                pinctrl-0 = <&tdmb_mclk &tdmout_b &tdmin_b>;
+               mclk_pad = <0>;  /* 0: mclk_0; 1: mclk_1 */
                /*
                 * 0: tdmout_a;
                 * 1: tdmout_b;
                clock-names = "mclk", "clk_srcpll";
                pinctrl-names = "tdm_pins";
                pinctrl-0 = <&tdmc_mclk &tdmout_c &tdmin_c>;
+               mclk_pad = <1>;  /* 0: mclk_0; 1: mclk_1 */
        };
 
-       /* copy a useless tdm to output for hdmi, no pinmux */
-       aml_i2s2hdmi: i2s2hdmi {
-               compatible = "amlogic, g12a-snd-tdmc";
+       tdmlb: tdm@3 {
+               compatible = "amlogic, g12a-snd-tdmlb";
                #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>;
+               dai-tdm-lane-lb-slot-mask-in = <1 0 0 0>;
+               dai-tdm-clk-sel = <1>;
+               clocks = <&clkaudio CLKID_AUDIO_MCLK_B
+                               &clkc CLKID_MPLL1>;
                clock-names = "mclk", "clk_srcpll";
+               /*
+                * select tdmin_lb src;
+                *0: TDMOUTA
+                *1: TDMOUTB
+                *2: TDMOUTC
+                *3: PAD_TDMINA
+                *4: PAD_TDMINB
+                *5: PAD_TDMINC
+                */
+               lb-src-sel = <1>;
 
-               i2s2hdmi = <1>;
-
-               status = "okay";
+               status = "disabled";
        };
 
        aml_spdif: spdif {
                filter_mode = <1>; /* mode 0~4, defalut:1 */
                status = "okay";
        };
-       aml_loopback: loopback {
-               compatible = "amlogic, snd-loopback";
-               /*
-                * 0: out rate = in data rate;
-                * 1: out rate = loopback data rate;
-                */
-               lb_mode = <0>;
+
+       loopback:loopback@0 {
+               compatible = "amlogic, g12a-loopback";
+               #sound-dai-cells = <0>;
+
+               clocks = <&clkaudio CLKID_AUDIO_PDM
+                       &clkc CLKID_FCLK_DIV3
+                       &clkc CLKID_MPLL3
+                       &clkaudio CLKID_AUDIO_PDMIN0
+                       &clkaudio CLKID_AUDIO_PDMIN1
+                       &clkc CLKID_MPLL0
+                       &clkaudio CLKID_AUDIO_MCLK_A>;
+               clock-names = "pdm_gate",
+                       "pdm_sysclk_srcpll",
+                       "pdm_dclk_srcpll",
+                       "pdm_dclk",
+                       "pdm_sysclk",
+                       "tdminlb_mpll",
+                       "tdminlb_mclk";
 
                /* datain src
                 * 0: tdmin_a;
                 * 4: pdmin;
                 */
                datain_src = <4>;
-               datain_chnum = <8>;
-               datain_chmask = <0x3f>;
+               datain_chnum = <4>;
+               datain_chmask = <0xf>;
+               /* config which data pin for loopback */
+               datain-lane-mask-in = <1 0 1 0>;
+
+               /* calc mclk for datalb */
+               mclk-fs = <256>;
 
                /* tdmin_lb src
                 * 0: tdmoutA
                 * 1: tdmoutB
                 * 2: tdmoutC
-                * 3: PAD_tdminA
-                * 4: PAD_tdminB
-                * 5: PAD_tdminC
+                * 3: PAD_TDMINA_DIN*, refer to core pinmux
+                * 4: PAD_TDMINB_DIN*, refer to core pinmux
+                * 5: PAD_TDMINC_DIN*, refer to core pinmux
+                * 6: PAD_TDMINA_D*, oe, refer to core pinmux
+                * 7: PAD_TDMINB_D*, oe, refer to core pinmux
                 */
-               datalb_src = <2>;
-               datalb_chnum = <8>;
+               /* if tdmin_lb >= 3, use external loopback */
+               datalb_src = <1>;
+               datalb_chnum = <2>;
                datalb_chmask = <0x3>;
+               /* config which data pin as loopback */
+               datalb-lane-mask-in = <1 0 0 0>;
 
-               status = "disabled";
+               status = "okay";
        };
 
        audioresample: resample {
index 32b63c7..8632ff4 100644 (file)
                                sound-dai = <&dummy_codec>;
                        };
                };
+
                aml-audio-card,dai-link@6 {
                        mclk-fs = <256>;
                        suffix-name = "alsaPORT-earc";
                                sound-dai = <&dummy_codec>;
                        };
                };
+
+               aml-audio-card,dai-link@7 {
+                       mclk-fs = <256>;
+                       continuous-clock;
+                       suffix-name = "alsaPORT-loopback";
+                       cpu {
+                               sound-dai = <&loopbacka>;
+                               system-clock-frequency = <12288000>;
+                       };
+                       codec {
+                               sound-dai = <&dummy_codec>;
+                       };
+               };
        };
        audiolocker: locker {
                compatible = "amlogic, audiolocker";
                 */
                samesource_sel = <3>;
 
+               /*enable default mclk(12.288M), before extern codec start*/
+               start_clk_enable = <1>;
+
+               /*tdm clk tuning enable*/
+               clk_tuning_enable = <1>;
+
                status = "okay";
        };
 
                status = "okay";
        };
 
+       tdmlb:tdm@3 {
+               compatible = "amlogic, sm1-snd-tdmlb";
+               #sound-dai-cells = <0>;
+
+               dai-tdm-lane-lb-slot-mask-in = <1 0 0 0>;
+               dai-tdm-clk-sel = <1>;
+
+               clocks = <&clkaudio CLKID_AUDIO_MCLK_B
+                               &clkc CLKID_MPLL1>;
+               clock-names = "mclk", "clk_srcpll";
+
+               /*
+                * select tdmin_lb src;
+                * AXG
+                *  0: TDMOUTA
+                *  1: TDMOUTB
+                *  2: TDMOUTC
+                *  3: PAD_TDMINA
+                *  4: PAD_TDMINB
+                *  5: PAD_TDMINC
+                *
+                * G12A/G12B
+                *  0: TDMOUTA
+                *  1: TDMOUTB
+                *  2: TDMOUTC
+                *  3: PAD_TDMINA_DIN*
+                *  4: PAD_TDMINB_DIN*
+                *  5: PAD_TDMINC_DIN*
+                *  6: PAD_TDMINA_D*, oe pin
+                *  7: PAD_TDMINB_D*, oe pin
+                *
+                * TL1/SM1
+                *  0: TDMOUTA
+                *  1: TDMOUTB
+                *  2: TDMOUTC
+                *  3: PAD_TDMINA_DIN*
+                *  4: PAD_TDMINB_DIN*
+                *  5: PAD_TDMINC_DIN*
+                *  6: PAD_TDMINA_D*
+                *  7: PAD_TDMINB_D*
+                *  8: PAD_TDMINC_D*
+                *  9: HDMIRX_I2S
+                *  10: ACODEC_ADC
+                */
+               lb-src-sel = <1>;
+
+               status = "disabled";
+       };
+
        spdifa: spdif@0 {
                compatible = "amlogic, sm1-snd-spdif-a";
                #sound-dai-cells = <0>;
                pinctrl-names = "spdif_pins";
                pinctrl-0 = <&spdifout &spdifin>;
 
+               /*spdif clk tuning enable*/
+               clk_tuning_enable = <1>;
+
                status = "okay";
        };
        spdifb: spdif@1 {
 
                status = "okay";
        };
+
+       loopbacka:loopback@0 {
+               compatible = "amlogic, sm1-loopbacka";
+               #sound-dai-cells = <0>;
+
+               clocks = <&clkaudio CLKID_AUDIO_GATE_PDM
+                       &clkc CLKID_FCLK_DIV3
+                       &clkc CLKID_MPLL3
+                       &clkaudio CLKID_AUDIO_PDMIN0
+                       &clkaudio CLKID_AUDIO_PDMIN1
+                       &clkc CLKID_MPLL0
+                       &clkaudio CLKID_AUDIO_MCLK_A>;
+               clock-names = "pdm_gate",
+                       "pdm_sysclk_srcpll",
+                       "pdm_dclk_srcpll",
+                       "pdm_dclk",
+                       "pdm_sysclk",
+                       "tdminlb_mpll",
+                       "tdminlb_mclk";
+
+               /* datain src
+                * 0: tdmin_a;
+                * 1: tdmin_b;
+                * 2: tdmin_c;
+                * 3: spdifin;
+                * 4: pdmin;
+                */
+               datain_src = <4>;
+               datain_chnum = <6>;
+               datain_chmask = <0x3f>;
+               /* config which data pin for loopback */
+               datain-lane-mask-in = <1 1 1 0>;
+
+               /* calc mclk for datalb */
+               mclk-fs = <256>;
+
+               /* tdmin_lb src
+                * 0: tdmoutA
+                * 1: tdmoutB
+                * 2: tdmoutC
+                * 3: PAD_TDMINA_DIN*, refer to core pinmux
+                * 4: PAD_TDMINB_DIN*, refer to core pinmux
+                * 5: PAD_TDMINC_DIN*, refer to core pinmux
+                * 6: PAD_TDMINA_D*, oe, refer to core pinmux
+                * 7: PAD_TDMINB_D*, oe, refer to core pinmux
+                */
+               /* if tdmin_lb >= 3, use external loopback */
+               datalb_src = <1>;
+               datalb_chnum = <2>;
+               datalb_chmask = <0x3>;
+               /* config which data pin as loopback */
+               datalb-lane-mask-in = <1 0 0 0>;
+
+               status = "okay";
+       };
+
+       loopbackb:loopback@1 {
+               compatible = "amlogic, sm1-loopbackb";
+               #sound-dai-cells = <0>;
+
+               clocks = <&clkaudio CLKID_AUDIO_GATE_PDM
+                       &clkc CLKID_FCLK_DIV3
+                       &clkc CLKID_MPLL3
+                       &clkaudio CLKID_AUDIO_PDMIN0
+                       &clkaudio CLKID_AUDIO_PDMIN1
+                       &clkc CLKID_MPLL0
+                       &clkaudio CLKID_AUDIO_MCLK_A>;
+               clock-names = "pdm_gate",
+                       "pdm_sysclk_srcpll",
+                       "pdm_dclk_srcpll",
+                       "pdm_dclk",
+                       "pdm_sysclk",
+                       "tdminlb_mpll",
+                       "tdminlb_mclk";
+
+               /* calc mclk for datain_lb */
+               mclk-fs = <256>;
+
+               /* datain src
+                * 0: tdmin_a;
+                * 1: tdmin_b;
+                * 2: tdmin_c;
+                * 3: spdifin;
+                * 4: pdmin;
+                */
+               datain_src = <4>;
+               datain_chnum = <4>;
+               datain_chmask = <0xf>;
+               /* config which data pin for loopback */
+               datain-lane-mask-in = <1 0 1 0>;
+
+               /* tdmin_lb src
+                * 0: tdmoutA
+                * 1: tdmoutB
+                * 2: tdmoutC
+                * 3: PAD_TDMINA_DIN*, refer to core pinmux
+                * 4: PAD_TDMINB_DIN*, refer to core pinmux
+                * 5: PAD_TDMINC_DIN*, refer to core pinmux
+                * 6: PAD_TDMINA_D*, oe, refer to core pinmux
+                * 7: PAD_TDMINB_D*, oe, refer to core pinmux
+                */
+               /* if tdmin_lb >= 3, use external loopback */
+               datalb_src = <1>;
+               datalb_chnum = <2>;
+               datalb_chmask = <0x3>;
+               /* config which data pin as loopback */
+               datalb-lane-mask-in = <1 0 0 0>;
+
+               status = "disabled";
+       };
 }; /* end of audiobus */
 
 &pinctrl_periphs {
index b4c97f4..874c032 100644 (file)
                 */
                samesource_sel = <3>;
 
+               /*enable default mclk(12.288M), before extern codec start*/
+               start_clk_enable = <1>;
+
+               /*tdm clk tuning enable*/
+               clk_tuning_enable = <1>;
+
                status = "okay";
        };
 
                clocks = <&clkaudio CLKID_AUDIO_MCLK_B
                                &clkc CLKID_MPLL1>;
                clock-names = "mclk", "clk_srcpll";
+               lb-src-sel = <1>;
 
                /*
                 * select tdmin_lb src;
                pinctrl-names = "spdif_pins";
                pinctrl-0 = <&spdifout>; /* bob remove &spdifin*/
 
+               /*spdif clk tuning enable*/
+               clk_tuning_enable = <1>;
+
                status = "okay";
        };
        spdifb: spdif@1 {
index 1fbfb81..69d12ba 100644 (file)
                 */
                samesource_sel = <3>;
 
+               /*enable default mclk(12.288M), before extern codec start*/
+               start_clk_enable = <1>;
+
+               /*tdm clk tuning enable*/
+               clk_tuning_enable = <1>;
+
                status = "okay";
        };
 
                pinctrl-names = "spdif_pins";
                pinctrl-0 = <&spdifout>;/* bob remove &spdifin*/
 
+               /*spdif clk tuning enable*/
+               clk_tuning_enable = <1>;
+
                status = "okay";
        };
        spdifb: spdif@1 {
index d6b4912..0f741a6 100644 (file)
                                sound-dai = <&dummy_codec>;
                        };
                };
+
                aml-audio-card,dai-link@6 {
                        mclk-fs = <256>;
                        suffix-name = "alsaPORT-earc";
                                sound-dai = <&dummy_codec>;
                        };
                };
+
+               aml-audio-card,dai-link@7 {
+                       mclk-fs = <256>;
+                       continuous-clock;
+                       suffix-name = "alsaPORT-loopback";
+                       cpu {
+                               sound-dai = <&loopbacka>;
+                               system-clock-frequency = <12288000>;
+                       };
+                       codec {
+                               sound-dai = <&dummy_codec>;
+                       };
+               };
+
+               aml-audio-card,dai-link@8 {
+                       format = "i2s";
+                       mclk-fs = <256>;
+                       //continuous-clock;
+                       //bitclock-inversion;
+                       //frame-inversion;
+                       /* master mode */
+                       bitclock-master = <&tdmlb>;
+                       frame-master = <&tdmlb>;
+                       /* slave mode */
+                       //bitclock-master = <&tdmlbcodec>;
+                       //frame-master = <&tdmlbcodec>;
+                       /* suffix-name, sync with android audio hal used for */
+                       //suffix-name = "alsaPORT-tdmlb";
+                       cpu {
+                               sound-dai = <&tdmlb>;
+                               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>;
+                       };
+                       tdmlbcodec: codec {
+                               sound-dai = <&dummy_codec>;
+                       };
+               };
        };
        audiolocker: locker {
                compatible = "amlogic, audiolocker";
                 */
                samesource_sel = <3>;
 
+               /*enable default mclk(12.288M), before extern codec start*/
+               start_clk_enable = <0>;
+
+               /*tdm clk tuning enable*/
+               clk_tuning_enable = <1>;
+
                status = "okay";
        };
 
                status = "okay";
        };
 
+       tdmlb:tdm@3 {
+               compatible = "amlogic, sm1-snd-tdmlb";
+               #sound-dai-cells = <0>;
+
+               dai-tdm-lane-lb-slot-mask-in = <1 0 0 0>;
+               dai-tdm-clk-sel = <1>;
+
+               clocks = <&clkaudio CLKID_AUDIO_MCLK_B
+                               &clkc CLKID_MPLL1>;
+               clock-names = "mclk", "clk_srcpll";
+
+               /*
+                * select tdmin_lb src;
+                * AXG
+                *  0: TDMOUTA
+                *  1: TDMOUTB
+                *  2: TDMOUTC
+                *  3: PAD_TDMINA
+                *  4: PAD_TDMINB
+                *  5: PAD_TDMINC
+                *
+                * G12A/G12B
+                *  0: TDMOUTA
+                *  1: TDMOUTB
+                *  2: TDMOUTC
+                *  3: PAD_TDMINA_DIN*
+                *  4: PAD_TDMINB_DIN*
+                *  5: PAD_TDMINC_DIN*
+                *  6: PAD_TDMINA_D*, oe pin
+                *  7: PAD_TDMINB_D*, oe pin
+                *
+                * TL1/SM1
+                *  0: TDMOUTA
+                *  1: TDMOUTB
+                *  2: TDMOUTC
+                *  3: PAD_TDMINA_DIN*
+                *  4: PAD_TDMINB_DIN*
+                *  5: PAD_TDMINC_DIN*
+                *  6: PAD_TDMINA_D*
+                *  7: PAD_TDMINB_D*
+                *  8: PAD_TDMINC_D*
+                *  9: HDMIRX_I2S
+                *  10: ACODEC_ADC
+                */
+               lb-src-sel = <1>;
+
+               status = "okay";
+       };
+
        spdifa: spdif@0 {
                compatible = "amlogic, sm1-snd-spdif-a";
                #sound-dai-cells = <0>;
                pinctrl-names = "spdif_pins";
                pinctrl-0 = <&spdifout &spdifin>;
 
+               /*spdif clk tuning enable*/
+               clk_tuning_enable = <1>;
+
                status = "okay";
        };
        spdifb: spdif@1 {
 
                status = "okay";
        };
+
+       loopbacka:loopback@0 {
+               compatible = "amlogic, sm1-loopbacka";
+               #sound-dai-cells = <0>;
+
+               clocks = <&clkaudio CLKID_AUDIO_GATE_PDM
+                       &clkc CLKID_FCLK_DIV3
+                       &clkc CLKID_MPLL3
+                       &clkaudio CLKID_AUDIO_PDMIN0
+                       &clkaudio CLKID_AUDIO_PDMIN1
+                       &clkc CLKID_MPLL0
+                       &clkaudio CLKID_AUDIO_MCLK_A>;
+               clock-names = "pdm_gate",
+                       "pdm_sysclk_srcpll",
+                       "pdm_dclk_srcpll",
+                       "pdm_dclk",
+                       "pdm_sysclk",
+                       "tdminlb_mpll",
+                       "tdminlb_mclk";
+
+               /* datain src
+                * 0: tdmin_a;
+                * 1: tdmin_b;
+                * 2: tdmin_c;
+                * 3: spdifin;
+                * 4: pdmin;
+                */
+               datain_src = <4>;
+               datain_chnum = <6>;
+               datain_chmask = <0x3f>;
+               /* config which data pin for loopback */
+               datain-lane-mask-in = <1 1 1 0>;
+
+               /* calc mclk for datalb */
+               mclk-fs = <256>;
+
+               /* tdmin_lb src
+                * 0: tdmoutA
+                * 1: tdmoutB
+                * 2: tdmoutC
+                * 3: PAD_TDMINA_DIN*, refer to core pinmux
+                * 4: PAD_TDMINB_DIN*, refer to core pinmux
+                * 5: PAD_TDMINC_DIN*, refer to core pinmux
+                * 6: PAD_TDMINA_D*, oe, refer to core pinmux
+                * 7: PAD_TDMINB_D*, oe, refer to core pinmux
+                */
+               /* if tdmin_lb >= 3, use external loopback */
+               datalb_src = <1>;
+               datalb_chnum = <2>;
+               datalb_chmask = <0x3>;
+               /* config which data pin as loopback */
+               datalb-lane-mask-in = <1 0 0 0>;
+
+               status = "okay";
+       };
+
+       loopbackb:loopback@1 {
+               compatible = "amlogic, sm1-loopbackb";
+               #sound-dai-cells = <0>;
+
+               clocks = <&clkaudio CLKID_AUDIO_GATE_PDM
+                       &clkc CLKID_FCLK_DIV3
+                       &clkc CLKID_MPLL3
+                       &clkaudio CLKID_AUDIO_PDMIN0
+                       &clkaudio CLKID_AUDIO_PDMIN1
+                       &clkc CLKID_MPLL0
+                       &clkaudio CLKID_AUDIO_MCLK_A>;
+               clock-names = "pdm_gate",
+                       "pdm_sysclk_srcpll",
+                       "pdm_dclk_srcpll",
+                       "pdm_dclk",
+                       "pdm_sysclk",
+                       "tdminlb_mpll",
+                       "tdminlb_mclk";
+
+               /* calc mclk for datain_lb */
+               mclk-fs = <256>;
+
+               /* datain src
+                * 0: tdmin_a;
+                * 1: tdmin_b;
+                * 2: tdmin_c;
+                * 3: spdifin;
+                * 4: pdmin;
+                */
+               datain_src = <4>;
+               datain_chnum = <4>;
+               datain_chmask = <0xf>;
+               /* config which data pin for loopback */
+               datain-lane-mask-in = <1 0 1 0>;
+
+               /* tdmin_lb src
+                * 0: tdmoutA
+                * 1: tdmoutB
+                * 2: tdmoutC
+                * 3: PAD_TDMINA_DIN*, refer to core pinmux
+                * 4: PAD_TDMINB_DIN*, refer to core pinmux
+                * 5: PAD_TDMINC_DIN*, refer to core pinmux
+                * 6: PAD_TDMINA_D*, oe, refer to core pinmux
+                * 7: PAD_TDMINB_D*, oe, refer to core pinmux
+                */
+               /* if tdmin_lb >= 3, use external loopback */
+               datalb_src = <1>;
+               datalb_chnum = <2>;
+               datalb_chmask = <0x3>;
+               /* config which data pin as loopback */
+               datalb-lane-mask-in = <1 0 0 0>;
+
+               status = "disabled";
+       };
 }; /* end of audiobus */
 
 &pinctrl_periphs {
index 4bc8b07..012c626 100644 (file)
                                sound-dai = <&dummy_codec>;
                        };
                };
+
+               aml-audio-card,dai-link@7 {
+                       mclk-fs = <256>;
+                       continuous-clock;
+                       suffix-name = "alsaPORT-loopback";
+                       cpu {
+                               sound-dai = <&loopbacka>;
+                               system-clock-frequency = <12288000>;
+                       };
+                       codec {
+                               sound-dai = <&dummy_codec>;
+                       };
+               };
        };
        audiolocker: locker {
                compatible = "amlogic, audiolocker";
                 */
                samesource_sel = <3>;
 
+               /*enable default mclk(12.288M), before extern codec start*/
+               start_clk_enable = <1>;
+
+               /*tdm clk tuning enable*/
+               clk_tuning_enable = <1>;
+
                status = "okay";
        };
 
                status = "okay";
        };
 
+       tdmlb:tdm@3 {
+               compatible = "amlogic, sm1-snd-tdmlb";
+               #sound-dai-cells = <0>;
+
+               dai-tdm-lane-lb-slot-mask-in = <1 0 0 0>;
+               dai-tdm-clk-sel = <1>;
+
+               clocks = <&clkaudio CLKID_AUDIO_MCLK_B
+                               &clkc CLKID_MPLL1>;
+               clock-names = "mclk", "clk_srcpll";
+
+               /*
+                * select tdmin_lb src;
+                * AXG
+                *  0: TDMOUTA
+                *  1: TDMOUTB
+                *  2: TDMOUTC
+                *  3: PAD_TDMINA
+                *  4: PAD_TDMINB
+                *  5: PAD_TDMINC
+                *
+                * G12A/G12B
+                *  0: TDMOUTA
+                *  1: TDMOUTB
+                *  2: TDMOUTC
+                *  3: PAD_TDMINA_DIN*
+                *  4: PAD_TDMINB_DIN*
+                *  5: PAD_TDMINC_DIN*
+                *  6: PAD_TDMINA_D*, oe pin
+                *  7: PAD_TDMINB_D*, oe pin
+                *
+                * TL1/SM1
+                *  0: TDMOUTA
+                *  1: TDMOUTB
+                *  2: TDMOUTC
+                *  3: PAD_TDMINA_DIN*
+                *  4: PAD_TDMINB_DIN*
+                *  5: PAD_TDMINC_DIN*
+                *  6: PAD_TDMINA_D*
+                *  7: PAD_TDMINB_D*
+                *  8: PAD_TDMINC_D*
+                *  9: HDMIRX_I2S
+                *  10: ACODEC_ADC
+                */
+               lb-src-sel = <1>;
+
+               status = "disabled";
+       };
+
        spdifa: spdif@0 {
                compatible = "amlogic, sm1-snd-spdif-a";
                #sound-dai-cells = <0>;
                pinctrl-names = "spdif_pins";
                pinctrl-0 = <&spdifout &spdifin>;
 
+               /*spdif clk tuning enable*/
+               clk_tuning_enable = <1>;
+
                status = "okay";
        };
        spdifb: spdif@1 {
                filter_mode = <1>;
                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 = "okay";
-       };
        earc:earc {
                compatible = "amlogic, sm1-snd-earc";
                #sound-dai-cells = <0>;
 
                status = "okay";
        };
+
+       loopbacka:loopback@0 {
+               compatible = "amlogic, sm1-loopbacka";
+               #sound-dai-cells = <0>;
+
+               clocks = <&clkaudio CLKID_AUDIO_GATE_PDM
+                       &clkc CLKID_FCLK_DIV3
+                       &clkc CLKID_MPLL3
+                       &clkaudio CLKID_AUDIO_PDMIN0
+                       &clkaudio CLKID_AUDIO_PDMIN1
+                       &clkc CLKID_MPLL0
+                       &clkaudio CLKID_AUDIO_MCLK_A>;
+               clock-names = "pdm_gate",
+                       "pdm_sysclk_srcpll",
+                       "pdm_dclk_srcpll",
+                       "pdm_dclk",
+                       "pdm_sysclk",
+                       "tdminlb_mpll",
+                       "tdminlb_mclk";
+
+               /* datain src
+                * 0: tdmin_a;
+                * 1: tdmin_b;
+                * 2: tdmin_c;
+                * 3: spdifin;
+                * 4: pdmin;
+                */
+               datain_src = <4>;
+               datain_chnum = <6>;
+               datain_chmask = <0x3f>;
+               /* config which data pin for loopback */
+               datain-lane-mask-in = <1 1 1 0>;
+
+               /* calc mclk for datalb */
+               mclk-fs = <256>;
+
+               /* tdmin_lb src
+                * 0: tdmoutA
+                * 1: tdmoutB
+                * 2: tdmoutC
+                * 3: PAD_TDMINA_DIN*, refer to core pinmux
+                * 4: PAD_TDMINB_DIN*, refer to core pinmux
+                * 5: PAD_TDMINC_DIN*, refer to core pinmux
+                * 6: PAD_TDMINA_D*, oe, refer to core pinmux
+                * 7: PAD_TDMINB_D*, oe, refer to core pinmux
+                */
+               /* if tdmin_lb >= 3, use external loopback */
+               datalb_src = <1>;
+               datalb_chnum = <2>;
+               datalb_chmask = <0x3>;
+               /* config which data pin as loopback */
+               datalb-lane-mask-in = <1 0 0 0>;
+
+               status = "okay";
+       };
+
+       loopbackb:loopback@1 {
+               compatible = "amlogic, sm1-loopbackb";
+               #sound-dai-cells = <0>;
+
+               clocks = <&clkaudio CLKID_AUDIO_GATE_PDM
+                       &clkc CLKID_FCLK_DIV3
+                       &clkc CLKID_MPLL3
+                       &clkaudio CLKID_AUDIO_PDMIN0
+                       &clkaudio CLKID_AUDIO_PDMIN1
+                       &clkc CLKID_MPLL0
+                       &clkaudio CLKID_AUDIO_MCLK_A>;
+               clock-names = "pdm_gate",
+                       "pdm_sysclk_srcpll",
+                       "pdm_dclk_srcpll",
+                       "pdm_dclk",
+                       "pdm_sysclk",
+                       "tdminlb_mpll",
+                       "tdminlb_mclk";
+
+               /* calc mclk for datain_lb */
+               mclk-fs = <256>;
+
+               /* datain src
+                * 0: tdmin_a;
+                * 1: tdmin_b;
+                * 2: tdmin_c;
+                * 3: spdifin;
+                * 4: pdmin;
+                */
+               datain_src = <4>;
+               datain_chnum = <4>;
+               datain_chmask = <0xf>;
+               /* config which data pin for loopback */
+               datain-lane-mask-in = <1 0 1 0>;
+
+               /* tdmin_lb src
+                * 0: tdmoutA
+                * 1: tdmoutB
+                * 2: tdmoutC
+                * 3: PAD_TDMINA_DIN*, refer to core pinmux
+                * 4: PAD_TDMINB_DIN*, refer to core pinmux
+                * 5: PAD_TDMINC_DIN*, refer to core pinmux
+                * 6: PAD_TDMINA_D*, oe, refer to core pinmux
+                * 7: PAD_TDMINB_D*, oe, refer to core pinmux
+                */
+               /* if tdmin_lb >= 3, use external loopback */
+               datalb_src = <1>;
+               datalb_chnum = <2>;
+               datalb_chmask = <0x3>;
+               /* config which data pin as loopback */
+               datalb-lane-mask-in = <1 0 0 0>;
+
+               status = "disabled";
+       };
 }; /* end of audiobus */
 
 &pinctrl_periphs {
index d073d02..92a55d7 100644 (file)
                        };
                };
 
+#if 0
+               aml-audio-card,dai-link@7 {
+                       format = "i2s";
+                       mclk-fs = <256>;
+                       //continuous-clock;
+                       //bitclock-inversion;
+                       //frame-inversion;
+                       bitclock-master = <&tdmlb>;
+                       frame-master = <&tdmlb>;
+                       cpu {
+                               sound-dai = <&tdmlb>;
+                               dai-tdm-slot-rx-mask = <1 1>;
+                               dai-tdm-slot-num = <2>;
+                               dai-tdm-slot-width = <32>;
+                               system-clock-frequency = <12288000>;
+                       };
+                       codec {
+                               sound-dai = <&dummy_codec>;
+                       };
+               };
+#endif
+               aml-audio-card,dai-link@8 {
+                       mclk-fs = <256>;
+                       continuous-clock;
+                       cpu {
+                               sound-dai = <&loopbacka>;
+                               system-clock-frequency = <12288000>;
+                       };
+                       codec {
+                               sound-dai = <&dummy_codec>;
+                       };
+               };
+               aml-audio-card,dai-link@9 {
+                       mclk-fs = <256>;
+                       continuous-clock;
+                       cpu {
+                               sound-dai = <&loopbackb>;
+                               system-clock-frequency = <12288000>;
+                       };
+                       codec {
+                               sound-dai = <&dummy_codec>;
+                       };
+               };
        };
        /* Audio Related end */
 
                                &clkc CLKID_MPLL1>;
                clock-names = "mclk", "clk_srcpll";
 
+               mclk_pad = <0>;  /* 0: mclk_0; 1: mclk_1 */
+
                status = "okay";
        };
 
                pinctrl-names = "tdm_pins";
                pinctrl-0 = <&tdmout_c &tdmin_c>;
 
+               mclk_pad = <0>;  /* 0: mclk_0; 1: mclk_1 */
+
+               status = "okay";
+       };
+
+       tdmlb:tdm@3 {
+               compatible = "amlogic, tl1-snd-tdmlb";
+               #sound-dai-cells = <0>;
+
+               dai-tdm-lane-lb-slot-mask-in = <1 0 0 0>;
+               dai-tdm-clk-sel = <1>;
+
+               clocks = <&clkaudio CLKID_AUDIO_MCLK_B
+                               &clkc CLKID_MPLL1>;
+               clock-names = "mclk", "clk_srcpll";
+
+               /*
+                * select tdmin_lb src;
+                * AXG
+                *  0: TDMOUTA
+                *  1: TDMOUTB
+                *  2: TDMOUTC
+                *  3: PAD_TDMINA
+                *  4: PAD_TDMINB
+                *  5: PAD_TDMINC
+                *
+                * G12A/G12B
+                *  0: TDMOUTA
+                *  1: TDMOUTB
+                *  2: TDMOUTC
+                *  3: PAD_TDMINA_DIN*
+                *  4: PAD_TDMINB_DIN*
+                *  5: PAD_TDMINC_DIN*
+                *  6: PAD_TDMINA_D*, oe pin
+                *  7: PAD_TDMINB_D*, oe pin
+                *
+                * TL1
+                *  0: TDMOUTA
+                *  1: TDMOUTB
+                *  2: TDMOUTC
+                *  3: PAD_TDMINA_DIN*
+                *  4: PAD_TDMINB_DIN*
+                *  5: PAD_TDMINC_DIN*
+                *  6: PAD_TDMINA_D*
+                *  7: PAD_TDMINB_D*
+                *  8: PAD_TDMINC_D*
+                *  9: HDMIRX_I2S
+                *  10: ACODEC_ADC
+                */
+               lb-src-sel = <1>;
+
                status = "okay";
        };
 
                clocks = <&clkaudio CLKID_AUDIO_GATE_EQDRC
                        &clkc CLKID_FCLK_DIV5
                        &clkaudio CLKID_AUDIO_EQDRC>;
-               clock-names = "gate", "clk_srcpll", "eqdrc";
+               clock-names = "gate", "srcpll", "eqdrc";
 
                eq_enable = <1>;
                multiband_drc_enable = <0>;
                status = "disabled";
        };
 
+       loopbacka:loopback@0 {
+               compatible = "amlogic, tl1-loopbacka";
+               #sound-dai-cells = <0>;
+
+               clocks = <&clkaudio CLKID_AUDIO_GATE_PDM
+                       &clkc CLKID_FCLK_DIV3
+                       &clkc CLKID_MPLL3
+                       &clkaudio CLKID_AUDIO_PDMIN0
+                       &clkaudio CLKID_AUDIO_PDMIN1>;
+               clock-names = "gate",
+                       "sysclk_srcpll",
+                       "dclk_srcpll",
+                       "pdm_dclk",
+                       "pdm_sysclk";
+
+               /* calc mclk for datain_lb */
+               mclk-fs = <256>;
+
+               /*
+                * 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_DIN*, refer to core pinmux
+                * 4: PAD_TDMINB_DIN*, refer to core pinmux
+                * 5: PAD_TDMINC_DIN*, refer to core pinmux
+                * 6: PAD_TDMINA_D*, oe, refer to core pinmux
+                * 7: PAD_TDMINB_D*, oe, refer to core pinmux
+                */
+               /* if tdmin_lb >= 3, use external loopback */
+               datalb_src = <1>;
+               datalb_chnum = <2>;
+               datalb_chmask = <0x3>;
+
+               /* config which data pin as loopback */
+               datalb-lane-mask-in = <1 0 0 0>;
+
+               status = "okay";
+       };
+
+       loopbackb:loopback@1 {
+               compatible = "amlogic, tl1-loopbackb";
+               #sound-dai-cells = <0>;
+
+               clocks = <&clkaudio CLKID_AUDIO_GATE_PDM
+                       &clkc CLKID_FCLK_DIV3
+                       &clkc CLKID_MPLL3
+                       &clkaudio CLKID_AUDIO_PDMIN0
+                       &clkaudio CLKID_AUDIO_PDMIN1>;
+               clock-names = "gate",
+                       "sysclk_srcpll",
+                       "dclk_srcpll",
+                       "pdm_dclk",
+                       "pdm_sysclk";
+
+               /* calc mclk for datain_lb */
+               mclk-fs = <256>;
+
+               /*
+                * 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_DIN*, refer to core pinmux
+                * 4: PAD_TDMINB_DIN*, refer to core pinmux
+                * 5: PAD_TDMINC_DIN*, refer to core pinmux
+                * 6: PAD_TDMINA_D*, oe, refer to core pinmux
+                * 7: PAD_TDMINB_D*, oe, refer to core pinmux
+                */
+               /* if tdmin_lb >= 3, use external loopback */
+               datalb_src = <1>;
+               datalb_chnum = <2>;
+               datalb_chmask = <0x3>;
+
+               /* config which data pin as loopback */
+               datalb-lane-mask-in = <1 0 0 0>;
+
+               status = "okay";
+       };
 }; /* end of audiobus */
 
 &pinctrl_periphs {
diff --git a/arch/arm/boot/dts/amlogic/tl1_t962x2_skt.dts b/arch/arm/boot/dts/amlogic/tl1_t962x2_skt.dts
deleted file mode 100644 (file)
index 3b696a7..0000000
+++ /dev/null
@@ -1,1447 +0,0 @@
-/*
- * arch/arm/boot/dts/amlogic/tl1_t962x2_skt.dts
- *
- * Copyright (C) 2018 Amlogic, Inc. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
- * more details.
- *
- */
-
-/dts-v1/;
-
-#include "mesontl1.dtsi"
-#include "partition_mbox_normal_P_32.dtsi"
-#include "mesontl1_skt-panel.dtsi"
-
-/ {
-       model = "Amlogic TL1 T962X2 SKT";
-       amlogic-dt-id = "tl1_t962x2_skt";
-       compatible = "amlogic, tl1_t962x2_skt";
-
-       aliases {
-               serial0 = &uart_AO;
-               serial1 = &uart_A;
-               serial2 = &uart_B;
-               serial3 = &uart_C;
-               serial4 = &uart_AO_B;
-               tsensor0 = &p_tsensor;
-               tsensor1 = &d_tsensor;
-               i2c0 = &i2c0;
-               i2c1 = &i2c1;
-               i2c2 = &i2c2;
-               i2c3 = &i2c3;
-               i2c4 = &i2c_AO;
-       };
-
-       memory@00000000 {
-               device_type = "memory";
-               linux,usable-memory = <0x0 0x80000000>;
-       };
-
-       reserved-memory {
-               #address-cells = <1>;
-               #size-cells = <1>;
-               ranges;
-               /* global autoconfigured region for contiguous allocations */
-               ramoops@0x07400000 {
-                       compatible = "ramoops";
-                       reg = <0x07400000 0x00100000>;
-                       record-size = <0x8000>;
-                       console-size = <0x8000>;
-                       ftrace-size = <0x20000>;
-               };
-
-               secmon_reserved: linux,secmon {
-                       compatible = "shared-dma-pool";
-                       reusable;
-                       size = <0x400000>;
-                       alignment = <0x400000>;
-                       alloc-ranges = <0x05000000 0x400000>;
-               };
-
-               codec_mm_cma:linux,codec_mm_cma {
-                       compatible = "shared-dma-pool";
-                       reusable;
-                       /* ion_codec_mm max can alloc size 80M*/
-                       size = <0x13400000>;
-                       alignment = <0x400000>;
-                       linux,contiguous-region;
-                       alloc-ranges = <0x12000000 0x13400000>;
-               };
-
-               /* codec shared reserved */
-               codec_mm_reserved:linux,codec_mm_reserved {
-                       compatible = "amlogic, codec-mm-reserved";
-                       size = <0x0>;
-                       alignment = <0x100000>;
-                       //no-map;
-               };
-
-               logo_reserved:linux,meson-fb {
-                       compatible = "shared-dma-pool";
-                       reusable;
-                       size = <0x800000>;
-                       alignment = <0x400000>;
-                       alloc-ranges = <0x7f800000 0x800000>;
-               };
-
-               ion_cma_reserved:linux,ion-dev {
-                       compatible = "shared-dma-pool";
-                       reusable;
-                       size = <0x8000000>;
-                       alignment = <0x400000>;
-               };
-
-               /*  vdin0 CMA pool */
-               //vdin0_cma_reserved:linux,vdin0_cma {
-               //      compatible = "shared-dma-pool";
-               //      reusable;
-                       /* 3840x2160x4x4 ~=128 M */
-               //      size = <0xc400000>;
-               //      alignment = <0x400000>;
-               //};
-
-               /*  vdin1 CMA pool */
-               vdin1_cma_reserved:linux,vdin1_cma {
-                       compatible = "shared-dma-pool";
-                       reusable;
-                       /* 1920x1080x2x4  =16 M */
-                       size = <0x1400000>;
-                       alignment = <0x400000>;
-               };
-
-               /* for hdmi rx emp use */
-               hdmirx_emp_cma_reserved:linux,emp_cma {
-                       compatible = "shared-dma-pool";
-                       /*linux,phandle = <5>;*/
-                       reusable;
-                       /* 4M for emp to ddr */
-                       /* 32M for tmds to ddr */
-                       size = <0x2000000>;
-                       alignment = <0x400000>;
-                       /* alloc-ranges = <0x400000 0x2000000>; */
-               };
-
-               /* POST PROCESS MANAGER */
-               ppmgr_reserved:linux,ppmgr {
-                       compatible = "amlogic, ppmgr_memory";
-                       size = <0x0>;
-               };
-       }; /* end of reserved-memory */
-
-       codec_mm {
-               compatible = "amlogic, codec, mm";
-               status = "okay";
-               memory-region = <&codec_mm_cma &codec_mm_reserved>;
-       };
-
-       ppmgr {
-               compatible = "amlogic, ppmgr";
-               memory-region = <&ppmgr_reserved>;
-               status = "okay";
-       };
-
-       vout {
-               compatible = "amlogic, vout";
-               status = "okay";
-               fr_auto_policy = <0>;
-       };
-
-       /* Audio Related start */
-       pdm_codec:dummy {
-               #sound-dai-cells = <0>;
-               compatible = "amlogic, pdm_dummy_codec";
-               status = "okay";
-       };
-
-       dummy_codec:dummy {
-               #sound-dai-cells = <0>;
-               compatible = "amlogic, aml_dummy_codec";
-               status = "okay";
-       };
-
-       tl1_codec:codec {
-               #sound-dai-cells = <0>;
-               compatible = "amlogic, tl1_acodec";
-               status = "okay";
-               reg = <0xff632000 0x1c>;
-               tdmout_index = <0>;
-               tdmin_index = <0>;
-       };
-
-       auge_sound {
-               compatible = "amlogic, tl1-sound-card";
-               aml-audio-card,name = "AML-AUGESOUND";
-
-               aml-audio-card,dai-link@0 {
-                       format = "i2s";
-                       mclk-fs = <256>;
-                       //continuous-clock;
-                       bitclock-inversion;
-                       //frame-inversion;
-                       /* master mode */
-                       bitclock-master = <&tdma>;
-                       frame-master = <&tdma>;
-                       /* slave mode */
-                       /*
-                        * bitclock-master = <&tdmacodec>;
-                        * frame-master = <&tdmacodec>;
-                        */
-                       /* suffix-name, sync with android audio hal used for */
-                       suffix-name = "alsaPORT-pcm";
-                       tdmacpu: cpu {
-                               sound-dai = <&tdma>;
-                               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>;
-                       };
-                       tdmacodec: codec {
-                               //sound-dai = <&dummy_codec>;
-                               sound-dai = <&tl1_codec>;
-                       };
-               };
-
-               aml-audio-card,dai-link@1 {
-                       format = "i2s";
-                       mclk-fs = <256>;
-                       //continuous-clock;
-                       //bitclock-inversion;
-                       //frame-inversion;
-                       /* master mode */
-                       bitclock-master = <&tdmb>;
-                       frame-master = <&tdmb>;
-                       /* slave mode */
-                       //bitclock-master = <&tdmbcodec>;
-                       //frame-master = <&tdmbcodec>;
-                       /* suffix-name, sync with android audio hal used for */
-                       suffix-name = "alsaPORT-i2s";
-                       cpu {
-                               sound-dai = <&tdmb>;
-                               dai-tdm-slot-tx-mask = <1 1>;
-                               dai-tdm-slot-rx-mask = <1 1>;
-                               dai-tdm-slot-num = <2>;
-                               /*
-                                * dai-tdm-slot-tx-mask =
-                                *      <1 1 1 1 1 1 1 1>;
-                                * dai-tdm-slot-rx-mask =
-                                *      <1 1 1 1 1 1 1 1>;
-                                * dai-tdm-slot-num = <8>;
-                                */
-                               dai-tdm-slot-width = <32>;
-                               system-clock-frequency = <12288000>;
-                       };
-                       tdmbcodec: codec {
-                               sound-dai = <&dummy_codec>;
-                       };
-               };
-
-               aml-audio-card,dai-link@2 {
-                       format = "i2s";
-                       mclk-fs = <256>;
-                       //continuous-clock;
-                       //bitclock-inversion;
-                       //frame-inversion;
-                       /* master mode */
-                       bitclock-master = <&tdmc>;
-                       frame-master = <&tdmc>;
-                       /* slave mode */
-                       //bitclock-master = <&tdmccodec>;
-                       //frame-master = <&tdmccodec>;
-                       /* suffix-name, sync with android audio hal used for */
-                       //suffix-name = "alsaPORT-tdm";
-                       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>;
-                       };
-                       tdmccodec: codec {
-                               sound-dai = <&dummy_codec>;
-                       };
-               };
-
-               aml-audio-card,dai-link@3 {
-                       mclk-fs = <64>;
-                       /* suffix-name, sync with android audio hal used for */
-                       suffix-name = "alsaPORT-pdm";
-                       cpu {
-                               sound-dai = <&pdm>;
-                       };
-                       codec {
-                               sound-dai = <&pdm_codec>;
-                       };
-               };
-
-               aml-audio-card,dai-link@4 {
-                       mclk-fs = <128>;
-                       /* suffix-name, sync with android audio hal used for */
-                       suffix-name = "alsaPORT-spdif";
-                       cpu {
-                               sound-dai = <&spdifa>;
-                               system-clock-frequency = <6144000>;
-                       };
-                       codec {
-                               sound-dai = <&dummy_codec>;
-                       };
-               };
-
-               aml-audio-card,dai-link@5 {
-                       mclk-fs = <128>;
-                       cpu {
-                               sound-dai = <&spdifb>;
-                               system-clock-frequency = <6144000>;
-                       };
-                       codec {
-                               sound-dai = <&dummy_codec>;
-                       };
-               };
-
-               aml-audio-card,dai-link@6 {
-                       mclk-fs = <256>;
-                       cpu {
-                               sound-dai = <&extn>;
-                               system-clock-frequency = <12288000>;
-                       };
-                       codec {
-                               sound-dai = <&dummy_codec>;
-                       };
-               };
-       };
-
-       /* Audio Related end */
-       dvb {
-               compatible = "amlogic, dvb";
-               status = "okay";
-               fe0_mode = "internal";
-               fe0_tuner = <&tuner>;
-
-               /*"parallel","serial","disable"*/
-               ts2 = "parallel";
-               ts2_control = <0>;
-               ts2_invert = <0>;
-               interrupts = <0 23 1
-                               0 5 1
-                               0 53 1
-                               0 19 1
-                               0 25 1
-                               0 17 1>;
-               interrupt-names = "demux0_irq",
-                               "demux1_irq",
-                               "demux2_irq",
-                               "dvr0_irq",
-                               "dvr1_irq",
-                               "dvr2_irq";
-               clocks = <&clkc CLKID_DEMUX
-                       &clkc CLKID_ASYNC_FIFO
-                       &clkc CLKID_AHB_ARB0
-               /*&clkc CLKID_DOS_PARSER>;*/
-               &clkc CLKID_U_PARSER>;
-               clock-names = "demux", "asyncfifo", "ahbarb0", "uparsertop";
-       };
-
-       tvafe_avin_detect {
-               compatible = "amlogic, tl1_tvafe_avin_detect";
-               status = "okay";
-               device_mask = <1>;/*bit0:ch1;bit1:ch2*/
-               interrupts = <0 12 1>,
-                               <0 13 1>;
-       };
-
-       amlvecm {
-               compatible = "amlogic, vecm";
-               dev_name = "aml_vecm";
-               status = "okay";
-               gamma_en = <1>;/*1:enabel ;0:disable*/
-               wb_en = <1>;/*1:enabel ;0:disable*/
-               cm_en = <1>;/*1:enabel ;0:disable*/
-               wb_sel = <1>;/*1:mtx ;0:gainoff*/
-               vlock_en = <1>;/*1:enable;0:disable*/
-               vlock_mode = <0x4>;
-               /* vlock work mode:
-                *bit0:auto ENC
-                *bit1:auto PLL
-                *bit2:manual PLL
-                *bit3:manual ENC
-                *bit4:manual soft ENC
-                *bit5:manual MIX PLL ENC
-                */
-                vlock_pll_m_limit = <1>;
-                vlock_line_limit = <3>;
-       };
-
-       vdin@0 {
-               compatible = "amlogic, vdin";
-               /*memory-region = <&vdin0_cma_reserved>;*/
-               status = "okay";
-               /*bit0:(1:share with codec_mm;0:cma alone)
-                *bit8:(1:alloc in discontinus way;0:alone in continuous way)
-                */
-               flag_cma = <0x101>;
-               /*MByte, if 10bit disable: 64M(YUV422),
-                *if 10bit enable: 64*1.5 = 96M(YUV422)
-                *if support 4K2K-YUV444-10bit-WR:3840*2160*4*4 ~= 128M
-                *if support 4K2K-YUV422-10bit-wr:3840*2160*3*4 ~= 96M
-                *if support 4K2K-YUV422-8BIT-WR:3840*2160*2*4 ~= 64M
-                *if support 1080p-YUV422-8BIT-WR:1920*1080*2*4 ~= 16M
-                */
-               cma_size = <190>;
-               interrupts = <0 83 1>;
-               rdma-irq = <2>;
-               clocks = <&clkc CLKID_FCLK_DIV5>,
-                       <&clkc CLKID_VDIN_MEAS_COMP>;
-               clock-names = "fclk_div5", "cts_vdin_meas_clk";
-               vdin_id = <0>;
-               /*vdin write mem color depth support:
-                * bit0:support 8bit
-                * bit1:support 9bit
-                * bit2:support 10bit
-                * bit3:support 12bit
-                * bit4:support yuv422 10bit full pack mode (from txl new add)
-                * bit8:use 8bit  at 4k_50/60hz_10bit
-                * bit9:use 10bit at 4k_50/60hz_10bit
-                */
-               tv_bit_mode = <0x215>;
-               /* afbce_bit_mode: (amlogic frame buff compression encoder)
-                * 0: normal mode, not use afbce
-                * 1: use afbce non-mmu mode
-                * 2: use afbce mmu mode
-                */
-               afbce_bit_mode = <0>;
-       };
-
-       vdin@1 {
-               compatible = "amlogic, vdin";
-               memory-region = <&vdin1_cma_reserved>;
-               status = "okay";
-               /*bit0:(1:share with codec_mm;0:cma alone)
-                *bit8:(1:alloc in discontinus way;0:alone in continuous way)
-                */
-               flag_cma = <0>;
-               interrupts = <0 85 1>;
-               rdma-irq = <4>;
-               clocks = <&clkc CLKID_FCLK_DIV5>,
-                       <&clkc CLKID_VDIN_MEAS_COMP>;
-               clock-names = "fclk_div5", "cts_vdin_meas_clk";
-               vdin_id = <1>;
-               /*vdin write mem color depth support:
-                *bit0:support 8bit
-                *bit1:support 9bit
-                *bit2:support 10bit
-                *bit3:support 12bit
-                */
-               tv_bit_mode = <0x15>;
-       };
-
-       unifykey {
-               compatible = "amlogic, unifykey";
-               status = "okay";
-
-               unifykey-num = <19>;
-               unifykey-index-0 = <&keysn_0>;
-               unifykey-index-1 = <&keysn_1>;
-               unifykey-index-2 = <&keysn_2>;
-               unifykey-index-3 = <&keysn_3>;
-               unifykey-index-4 = <&keysn_4>;
-               unifykey-index-5 = <&keysn_5>;
-               unifykey-index-6 = <&keysn_6>;
-               unifykey-index-7 = <&keysn_7>;
-               unifykey-index-8 = <&keysn_8>;
-               unifykey-index-9 = <&keysn_9>;
-               unifykey-index-10= <&keysn_10>;
-               unifykey-index-11 = <&keysn_11>;
-               unifykey-index-12 = <&keysn_12>;
-               unifykey-index-13 = <&keysn_13>;
-               unifykey-index-14 = <&keysn_14>;
-               unifykey-index-15 = <&keysn_15>;
-               unifykey-index-16 = <&keysn_16>;
-               unifykey-index-17 = <&keysn_17>;
-               unifykey-index-18 = <&keysn_18>;
-
-               keysn_0: key_0{
-                       key-name = "usid";
-                       key-device = "normal";
-                       key-permit = "read","write","del";
-               };
-               keysn_1:key_1{
-                       key-name = "mac";
-                       key-device  = "normal";
-                       key-permit = "read","write","del";
-               };
-               keysn_2:key_2{
-                       key-name = "hdcp";
-                       key-device = "secure";
-                       key-type  = "sha1";
-                       key-permit = "read","write","del";
-               };
-               keysn_3:key_3{
-                       key-name = "secure_boot_set";
-                       key-device = "efuse";
-                       key-permit = "write";
-               };
-               keysn_4:key_4{
-                       key-name = "mac_bt";
-                       key-device = "normal";
-                       key-permit = "read","write","del";
-                       key-type  = "mac";
-               };
-               keysn_5:key_5{
-                       key-name = "mac_wifi";
-                       key-device = "normal";
-                       key-permit = "read","write","del";
-                       key-type  = "mac";
-               };
-               keysn_6:key_6{
-                       key-name = "hdcp2_tx";
-                       key-device = "normal";
-                       key-permit = "read","write","del";
-               };
-               keysn_7:key_7{
-                       key-name = "hdcp2_rx";
-                       key-device = "normal";
-                       key-permit = "read","write","del";
-               };
-               keysn_8:key_8{
-                       key-name = "widevinekeybox";
-                       key-device = "secure";
-                       key-type = "sha1";
-                       key-permit = "read","write","del";
-               };
-               keysn_9:key_9{
-                       key-name = "deviceid";
-                       key-device = "normal";
-                       key-permit = "read","write","del";
-               };
-               keysn_10:key_10{
-                       key-name = "hdcp22_fw_private";
-                       key-device = "secure";
-                       key-permit = "read","write","del";
-               };
-               keysn_11:key_11{
-                       key-name = "hdcp22_rx_private";
-                       key-device = "secure";
-                       key-permit = "read","write","del";
-               };
-               keysn_12:key_12{
-                       key-name = "hdcp22_rx_fw";
-                       key-device = "normal";
-                       key-permit = "read","write","del";
-               };
-               keysn_13:key_13{
-                       key-name = "hdcp14_rx";
-                       key-device = "normal";
-                       key-type  = "sha1";
-                       key-permit = "read","write","del";
-               };
-               keysn_14:key_14{
-                       key-name = "prpubkeybox";// PlayReady
-                       key-device = "secure";
-                       key-permit = "read","write","del";
-               };
-               keysn_15:key_15{
-                       key-name = "prprivkeybox";// PlayReady
-                       key-device = "secure";
-                       key-permit = "read","write","del";
-               };
-               keysn_16:key_16{
-                       key-name = "lcd";
-                       key-device = "normal";
-                       key-permit = "read","write","del";
-               };
-               keysn_17:key_17{
-                       key-name = "lcd_extern";
-                       key-device = "normal";
-                       key-permit = "read","write","del";
-               };
-               keysn_18:key_18{
-                       key-name = "backlight";
-                       key-device = "normal";
-                       key-permit = "read","write","del";
-               };
-       }; /* End unifykey */
-
-       hdmirx {
-               compatible = "amlogic, hdmirx_tl1";
-               #address-cells=<1>;
-               #size-cells=<1>;
-               memory-region = <&hdmirx_emp_cma_reserved>;
-               status = "okay";
-               pinctrl-names = "default";
-               pinctrl-0 = <&hdmirx_a_mux &hdmirx_b_mux
-                       &hdmirx_c_mux>;
-               repeat = <0>;
-               interrupts = <0 56 1>;
-               clocks = <&clkc CLKID_HDMIRX_MODET_COMP>,
-                          <&clkc CLKID_HDMIRX_CFG_COMP>,
-                          <&clkc CLKID_HDMIRX_ACR_COMP>,
-                          <&clkc CLKID_HDMIRX_METER_COMP>,
-                          <&xtal>,
-                          <&clkc CLKID_FCLK_DIV5>,
-                          <&clkc CLKID_FCLK_DIV7>,
-                          <&clkc CLKID_HDCP22_SKP_COMP>,
-                          <&clkc CLKID_HDCP22_ESM_COMP>;
-               //         <&clkc CLK_AUD_PLL2FS>,
-               //         <&clkc CLK_AUD_PLL4FS>,
-               //         <&clkc CLK_AUD_OUT>;
-               clock-names = "hdmirx_modet_clk",
-                       "hdmirx_cfg_clk",
-                               "hdmirx_acr_ref_clk",
-                               "cts_hdmirx_meter_clk",
-                               "xtal",
-                               "fclk_div5",
-                               "fclk_div7",
-                               "hdcp_rx22_skp",
-                               "hdcp_rx22_esm";
-               //              "hdmirx_aud_pll2fs",
-               //              "hdmirx_aud_pll4f",
-               //              "clk_aud_out";
-               hdmirx_id = <0>;
-               en_4k_2_2k = <0>;
-               hpd_low_cec_off = <1>;
-               /* bit4: enable feature, bit3~0: port number */
-               disable_port = <0x0>;
-               /* MAP_ADDR_MODULE_CBUS */
-               /* MAP_ADDR_MODULE_HIU */
-               /* MAP_ADDR_MODULE_HDMIRX_CAPB3 */
-               /* MAP_ADDR_MODULE_SEC_AHB */
-               /* MAP_ADDR_MODULE_SEC_AHB2 */
-               /* MAP_ADDR_MODULE_APB4 */
-               /* MAP_ADDR_MODULE_TOP */
-               reg = < 0x0 0x0
-                       0xff63C000 0x2000
-                       0xffe0d000 0x2000
-                       0x0 0x0
-                       0x0 0x0
-                       0x0 0x0
-                       0xff610000 0xa000>;
-       };
-
-       aocec: aocec {
-               compatible = "amlogic, aocec-tl1";
-               /*device_name = "aocec";*/
-               status = "okay";
-               vendor_name = "Amlogic"; /* Max Chars: 8         */
-               /* Refer to the following URL at:
-                * http://standards.ieee.org/develop/regauth/oui/oui.txt
-                */
-               vendor_id = <0x000000>;
-               product_desc = "TL1"; /* Max Chars: 16    */
-               cec_osd_string = "AML_TV"; /* Max Chars: 14    */
-               port_num = <3>;
-               ee_cec;
-               arc_port_mask = <0x2>;
-               interrupts = <0 205 1
-                                       0 199 1>;
-               interrupt-names = "hdmi_aocecb","hdmi_aocec";
-               pinctrl-names = "default","hdmitx_aocecb","cec_pin_sleep";
-               pinctrl-0=<&aoceca_mux>;
-               pinctrl-1=<&aocecb_mux>;
-               pinctrl-2=<&aoceca_mux>;
-               reg = <0xFF80023c 0x4
-                          0xFF800000 0x400>;
-               reg-names = "ao_exit","ao";
-       };
-
-       p_tsensor: p_tsensor@ff634800 {
-               compatible = "amlogic, r1p1-tsensor";
-               status = "okay";
-               reg = <0xff634800 0x50>,
-                       <0xff800268 0x4>;
-               cal_type = <0x1>;
-               cal_a = <324>;
-               cal_b = <424>;
-               cal_c = <3159>;
-               cal_d = <9411>;
-               rtemp = <115000>;
-               interrupts = <0 35 0>;
-               clocks = <&clkc CLKID_TS_CLK_COMP>; /* CLKID_TS_COMP>;*/
-               clock-names = "ts_comp";
-               #thermal-sensor-cells = <1>;
-       };
-
-       d_tsensor: d_tsensor@ff634c00 {
-               compatible = "amlogic, r1p1-tsensor";
-               status = "okay";
-               reg = <0xff634c00 0x50>,
-                       <0xff800230 0x4>;
-               cal_type = <0x1>;
-               cal_a = <324>;
-               cal_b = <424>;
-               cal_c = <3159>;
-               cal_d = <9411>;
-               rtemp = <115000>;
-               interrupts = <0 36 0>;
-               clocks = <&clkc CLKID_TS_CLK_COMP>; /* CLKID_TS_COMP>;*/
-               clock-names = "ts_comp";
-               #thermal-sensor-cells = <1>;
-       };
-
-       meson_cooldev: meson-cooldev@0 {
-               status = "okay";
-               compatible = "amlogic, meson-cooldev";
-               cooling_devices {
-                       cpufreq_cool_cluster0 {
-                               min_state = <1000000>;
-                               dyn_coeff = <115>;
-                               gpu_pp = <2>;
-                               cluster_id = <0>;
-                               node_name = "cpufreq_cool0";
-                               device_type = "cpufreq";
-                       };
-                       cpucore_cool_cluster0 {
-                               min_state = <1>;
-                               dyn_coeff = <0>;
-                               gpu_pp = <2>;
-                               cluster_id = <0>;
-                               node_name = "cpucore_cool0";
-                               device_type = "cpucore";
-                       };
-                       gpufreq_cool {
-                               min_state = <400>;
-                               dyn_coeff = <358>;
-                               gpu_pp = <2>;
-                               cluster_id = <0>;
-                               node_name = "gpufreq_cool0";
-                               device_type = "gpufreq";
-                       };
-                       gpucore_cool {
-                               min_state = <1>;
-                               dyn_coeff = <0>;
-                               gpu_pp = <2>;
-                               cluster_id = <0>;
-                               node_name = "gpucore_cool0";
-                               device_type = "gpucore";
-                       };
-               };
-               cpufreq_cool0:cpufreq_cool0 {
-                       #cooling-cells = <2>; /* min followed by max */
-               };
-               cpucore_cool0:cpucore_cool0 {
-                       #cooling-cells = <2>; /* min followed by max */
-               };
-               gpufreq_cool0:gpufreq_cool0 {
-                       #cooling-cells = <2>; /* min followed by max */
-               };
-               gpucore_cool0:gpucore_cool0 {
-                       #cooling-cells = <2>; /* min followed by max */
-               };
-       };/*meson cooling devices end*/
-
-       thermal-zones {
-               pll_thermal: pll_thermal {
-                       polling-delay = <1000>;
-                       polling-delay-passive = <100>;
-                       sustainable-power = <1410>;
-                       thermal-sensors = <&p_tsensor 0>;
-                       trips {
-                               pswitch_on: trip-point@0 {
-                                       temperature = <60000>;
-                                       hysteresis = <5000>;
-                                       type = "passive";
-                               };
-                               pcontrol: trip-point@1 {
-                                       temperature = <75000>;
-                                       hysteresis = <5000>;
-                                       type = "passive";
-                               };
-                               phot: trip-point@2 {
-                                       temperature = <85000>;
-                                       hysteresis = <5000>;
-                                       type = "hot";
-                               };
-                               pcritical: trip-point@3 {
-                                       temperature = <110000>;
-                                       hysteresis = <1000>;
-                                       type = "critical";
-                               };
-                       };
-                       cooling-maps {
-                               cpufreq_cooling_map {
-                                       trip = <&pcontrol>;
-                                       cooling-device = <&cpufreq_cool0 0 4>;
-                                       contribution = <1024>;
-                               };
-                               gpufreq_cooling_map {
-                                       trip = <&pcontrol>;
-                                       cooling-device = <&gpufreq_cool0 0 4>;
-                                       contribution = <1024>;
-                               };
-                       };
-               };
-               ddr_thermal: ddr_thermal {
-                       polling-delay = <1000>;
-                       polling-delay-passive = <250>;
-                       sustainable-power = <1460>;
-                       thermal-sensors = <&d_tsensor 1>;
-                       trips {
-                               dswitch_on: trip-point@0 {
-                                       temperature = <60000>;
-                                       hysteresis = <5000>;
-                                       type = "passive";
-                               };
-                               dcontrol: trip-point@1 {
-                                       temperature = <75000>;
-                                       hysteresis = <5000>;
-                                       type = "passive";
-                               };
-                               dhot: trip-point@2 {
-                                       temperature = <85000>;
-                                       hysteresis = <5000>;
-                                       type = "hot";
-                               };
-                               dcritical: trip-point@3 {
-                                       temperature = <110000>;
-                                       hysteresis = <1000>;
-                                       type = "critical";
-                               };
-                       };
-               };
-       };/*thermal zone end*/
-
-       /*DCDC for MP8756GD*/
-       cpu_opp_table0: cpu_opp_table0 {
-               compatible = "operating-points-v2";
-               opp-shared;
-
-               opp00 {
-                       opp-hz = /bits/ 64 <100000000>;
-                       opp-microvolt = <731000>;
-               };
-               opp01 {
-                       opp-hz = /bits/ 64 <250000000>;
-                       opp-microvolt = <731000>;
-               };
-               opp02 {
-                       opp-hz = /bits/ 64 <500000000>;
-                       opp-microvolt = <731000>;
-               };
-               opp03 {
-                       opp-hz = /bits/ 64 <667000000>;
-                       opp-microvolt = <761000>;
-               };
-               opp04 {
-                       opp-hz = /bits/ 64 <1000000000>;
-                       opp-microvolt = <791000>;
-               };
-               opp05 {
-                       opp-hz = /bits/ 64 <1200000000>;
-                       opp-microvolt = <801000>;
-               };
-               opp06 {
-                       opp-hz = /bits/ 64 <1404000000>;
-                       opp-microvolt = <831000>;
-               };
-               opp07 {
-                       opp-hz = /bits/ 64 <1500000000>;
-                       opp-microvolt = <861000>;
-               };
-               opp08 {
-                       opp-hz = /bits/ 64 <1608000000>;
-                       opp-microvolt = <891000>;
-               };
-               opp09 {
-                       opp-hz = /bits/ 64 <1704000000>;
-                       opp-microvolt = <921000>;
-               };
-               opp10 {
-                       opp-hz = /bits/ 64 <1800000000>;
-                       opp-microvolt = <981000>;
-               };
-               opp11 {
-                       opp-hz = /bits/ 64 <1908000000>;
-                       opp-microvolt = <1011000>;
-               };
-       };
-
-       cpufreq-meson {
-               compatible = "amlogic, cpufreq-meson";
-               pinctrl-names = "default";
-               pinctrl-0 = <&pwm_ao_d_pins3>;
-               status = "okay";
-       };
-
-       tuner: tuner {
-               status = "okay";
-               tuner_name = "mxl661_tuner";
-               tuner_i2c_adap = <&i2c0>;
-               tuner_i2c_addr = <0x60>;
-               tuner_xtal = <1>; /* 0: 16MHz, 1: 24MHz */
-               tuner_xtal_mode = <3>;
-                                       /* NO_SHARE_XTAL(0)
-                                        * SLAVE_XTAL_SHARE(3)
-                                        */
-               tuner_xtal_cap = <25>; /* when tuner_xtal_mode = 3, set 25 */
-       };
-
-       bt-dev{
-               compatible = "amlogic, bt-dev";
-               status = "okay";
-               gpio_reset = <&gpio       GPIOC_13       GPIO_ACTIVE_HIGH>;
-       };
-
-       wifi{
-               compatible = "amlogic, aml_wifi";
-               status = "okay";
-               interrupt_pin = <&gpio       GPIOC_12       GPIO_ACTIVE_HIGH>;
-               irq_trigger_type = "GPIO_IRQ_LOW";
-               dhd_static_buf;    //dhd_static_buf support
-               power_on_pin = <&gpio       GPIOC_11       GPIO_ACTIVE_HIGH>;
-               pinctrl-names = "default";
-               pinctrl-0 = <&pwm_b_pins1>;
-               pwm_config = <&wifi_pwm_conf>;
-       };
-
-       wifi_pwm_conf:wifi_pwm_conf{
-               pwm_channel1_conf {
-                       pwms = <&pwm_ab MESON_PWM_1 30040 0>;
-                       duty-cycle = <15020>;
-                       times = <8>;
-               };
-               pwm_channel2_conf {
-                       pwms = <&pwm_ab MESON_PWM_3 30030 0>;
-                       duty-cycle = <15015>;
-                       times = <12>;
-               };
-       };
-
-}; /* end of / */
-
-&i2c0 {
-       status = "okay";
-       clock-frequency = <300000>;
-       pinctrl-names="default";
-       pinctrl-0=<&i2c0_dv_pins>;
-};
-
-&audiobus {
-       tdma:tdm@0 {
-               compatible = "amlogic, tl1-snd-tdma";
-               #sound-dai-cells = <0>;
-
-               dai-tdm-lane-slot-mask-in = <1 0>;
-               dai-tdm-lane-slot-mask-out = <1 0>;
-               dai-tdm-clk-sel = <0>;
-
-               clocks = <&clkaudio CLKID_AUDIO_MCLK_A
-                               &clkc CLKID_MPLL0
-                               &clkc CLKID_MPLL1
-                               &clkaudio CLKID_AUDIO_SPDIFOUT_A>;
-               clock-names = "mclk", "clk_srcpll",
-                       "samesource_srcpll", "samesource_clk";
-
-               pinctrl-names = "tdm_pins";
-               pinctrl-0 = <&tdma_mclk &tdmout_a &tdmin_a>;
-
-               status = "okay";
-
-               /* !!!For --TV platform-- ONLY */
-               Channel_Mask {
-                       /*i2s has 4 pins, 8channel, mux output*/
-                       Spdif_samesource_Channel_Mask = "i2s_2/3";
-               };
-       };
-
-       tdmb:tdm@1 {
-               compatible = "amlogic, tl1-snd-tdmb";
-               #sound-dai-cells = <0>;
-
-               dai-tdm-lane-slot-mask-in = <1 0 0 0>;
-               dai-tdm-lane-slot-mask-out = <1 0 0 0>;
-               dai-tdm-clk-sel = <1>;
-
-               clocks = <&clkaudio CLKID_AUDIO_MCLK_B
-                               &clkc CLKID_MPLL1>;
-               clock-names = "mclk", "clk_srcpll";
-
-               status = "okay";
-       };
-
-       tdmc:tdm@2 {
-               compatible = "amlogic, tl1-snd-tdmc";
-               #sound-dai-cells = <0>;
-
-               dai-tdm-lane-slot-mask-in = <1 0 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";
-
-               pinctrl-names = "tdm_pins";
-               pinctrl-0 = <&tdmout_c &tdmin_c>;
-
-               status = "okay";
-       };
-
-       spdifa:spdif@0 {
-               compatible = "amlogic, tl1-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 =
-                               <GIC_SPI 151 IRQ_TYPE_EDGE_RISING>;
-               interrupt-names = "irq_spdifin";
-
-               pinctrl-names = "spdif_pins",
-                               "spdif_pins_mute";
-
-               pinctrl-0 = <&spdifout_a &spdifin_a>;
-               pinctrl-1 = <&spdifout_a_mute>;
-
-               /*
-                * whether do asrc for pcm and resample a or b
-                * if raw data, asrc is disabled automatically
-                * 0: "Disable",
-                * 1: "Enable:32K",
-                * 2: "Enable:44K",
-                * 3: "Enable:48K",
-                * 4: "Enable:88K",
-                * 5: "Enable:96K",
-                * 6: "Enable:176K",
-                * 7: "Enable:192K",
-                */
-               asrc_id = <0>;
-               auto_asrc = <0>;
-
-               status = "okay";
-       };
-
-       spdifb:spdif@1 {
-               compatible = "amlogic, tl1-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";
-       };
-
-       pdm:pdm {
-               compatible = "amlogic, tl1-snd-pdm";
-               #sound-dai-cells = <0>;
-
-               clocks = <&clkaudio CLKID_AUDIO_GATE_PDM
-                       &clkc CLKID_FCLK_DIV3
-                       &clkc CLKID_MPLL3
-                       &clkaudio CLKID_AUDIO_PDMIN0
-                       &clkaudio CLKID_AUDIO_PDMIN1>;
-               clock-names = "gate",
-                       "sysclk_srcpll",
-                       "dclk_srcpll",
-                       "pdm_dclk",
-                       "pdm_sysclk";
-
-               pinctrl-names = "pdm_pins";
-               pinctrl-0 = <&pdmin>;
-
-               /* mode 0~4, defalut:1 */
-               filter_mode = <1>;
-
-               status = "okay";
-       };
-
-       extn:extn {
-               compatible = "amlogic, snd-extn";
-               #sound-dai-cells = <0>;
-
-               interrupts =
-                               <GIC_SPI 158 IRQ_TYPE_EDGE_RISING>;
-               interrupt-names = "irq_frhdmirx";
-
-               status = "okay";
-       };
-
-       aed:effect {
-               compatible = "amlogic, snd-effect-v2";
-               #sound-dai-cells = <0>;
-
-               clocks = <&clkaudio CLKID_AUDIO_GATE_EQDRC
-                       &clkc CLKID_FCLK_DIV5
-                       &clkaudio CLKID_AUDIO_EQDRC>;
-               clock-names = "gate", "srcpll", "eqdrc";
-
-               eq_enable = <1>;
-               multiband_drc_enable = <0>;
-               fullband_drc_enable = <0>;
-               /*
-                * 0:tdmout_a
-                * 1:tdmout_b
-                * 2:tdmout_c
-                * 3:spdifout
-                * 4:spdifout_b
-                */
-               eqdrc_module = <0>;
-               /* max 0xf, each bit for one lane, usually one lane */
-               lane_mask = <0x1>;
-               /* max 0xff, each bit for one channel */
-               channel_mask = <0x3>;
-
-               status = "okay";
-       };
-
-       asrca: resample@0 {
-               compatible = "amlogic, tl1-resample-a";
-               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 = <3>;
-
-               status = "disabled";
-       };
-
-       asrcb: resample@1 {
-               compatible = "amlogic, tl1-resample-b";
-
-               clocks = <&clkc CLKID_MPLL3
-                       &clkaudio CLKID_AUDIO_MCLK_F
-                       &clkaudio CLKID_AUDIO_RESAMPLE_B>;
-               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 = <3>;
-
-               status = "disabled";
-       };
-
-       vad:vad {
-               compatible = "amlogic, snd-vad";
-               #sound-dai-cells = <0>;
-
-               clocks = <&clkaudio CLKID_AUDIO_GATE_TOVAD
-                       &clkc CLKID_FCLK_DIV5
-                       &clkaudio CLKID_AUDIO_VAD>;
-               clock-names = "gate", "pll", "clk";
-
-               interrupts = <GIC_SPI 155 IRQ_TYPE_EDGE_RISING
-                               GIC_SPI 47 IRQ_TYPE_EDGE_RISING>;
-               interrupt-names = "irq_wakeup", "irq_frame_sync";
-
-               /*
-                * Data src sel:
-                * 0: tdmin_a;
-                * 1: tdmin_b;
-                * 2: tdmin_c;
-                * 3: spdifin;
-                * 4: pdmin;
-                * 5: loopback_b;
-                * 6: tdmin_lb;
-                * 7: loopback_a;
-                */
-               src = <4>;
-
-               status = "disabled";
-       };
-}; /* end of audiobus */
-
-&pinctrl_periphs {
-       /* audio pin mux */
-
-       tdma_mclk: tdma_mclk {
-               mux { /* GPIOZ_0 */
-                       groups = "mclk0_z";
-                       function = "mclk0";
-               };
-       };
-
-       tdmout_a: tdmout_a {
-               mux { /* GPIOZ_1, GPIOZ_2, GPIOZ_3, GPIOZ_5, GPIOZ_6 */
-                       groups = "tdma_sclk_z",
-                               "tdma_fs_z",
-                               "tdma_dout0_z",
-                               "tdma_dout2_z",
-                               "tdma_dout3_z";
-                       function = "tdma_out";
-                       bias-disable;
-               };
-       };
-
-       tdmin_a: tdmin_a {
-               mux { /* GPIOZ_9 */
-                       groups = "tdma_din2_z";
-                       function = "tdma_in";
-               };
-       };
-#if 0 //verify tdm/i2s in
-       tdmin_a: tdmin_a {
-               mux { /* GPIOZ_7 */
-                       groups = "tdma_din0_z";
-                       function = "tdma_in";
-               };
-       };
-#endif
-       tdmout_c: tdmout_c {
-               mux { /* GPIODV_7, GPIODV_8, GPIODV_9 */
-                       groups = "tdmc_sclk",
-                               "tdmc_fs",
-                               "tdmc_dout0";
-                       function = "tdmc_out";
-               };
-       };
-
-       tdmin_c: tdmin_c {
-               mux { /* GPIODV_10 */
-                       groups = "tdmc_din1";
-                       function = "tdmc_in";
-               };
-       };
-
-       spdifin_a: spdifin_a {
-               mux { /* GPIODV_5 */
-                       groups = "spdif_in";
-                       function = "spdif_in";
-               };
-       };
-
-       spdifout_a: spdifout_a {
-               mux { /* GPIODV_4 */
-                       groups = "spdif_out_dv4";
-                       function = "spdif_out";
-               };
-       };
-
-       spdifout_a_mute: spdifout_a_mute {
-               mux { /* GPIODV_4 */
-                       groups = "GPIODV_4";
-                       function = "gpio_periphs";
-               };
-       };
-
-       pdmin: pdmin {
-               mux { /* GPIOZ_7, GPIOZ_8, pdm_din2_z4 */
-                       groups = "pdm_dclk_z",
-                               "pdm_din0_z",
-                               "pdm_din2_z4";
-                       function = "pdm";
-               };
-       };
-
-
-}; /* end of pinctrl_periphs */
-
-&pinctrl_aobus {
-       spdifout: spdifout {
-               mux { /* gpiao_10 */
-                       groups = "spdif_out_ao";
-                       function = "spdif_out_ao";
-               };
-       };
-};  /* end of pinctrl_aobus */
-
-&audio_data{
-       status = "okay";
-};
-
-&sd_emmc_c {
-       status = "okay";
-       emmc {
-               caps = "MMC_CAP_8_BIT_DATA",
-                        "MMC_CAP_MMC_HIGHSPEED",
-                        "MMC_CAP_SD_HIGHSPEED",
-                        "MMC_CAP_NONREMOVABLE",
-                       /* "MMC_CAP_1_8V_DDR", */
-                        "MMC_CAP_HW_RESET",
-                        "MMC_CAP_ERASE",
-                        "MMC_CAP_CMD23";
-               caps2 = "MMC_CAP2_HS200";
-               /* "MMC_CAP2_HS400";*/
-               f_min = <400000>;
-               f_max = <200000000>;
-       };
-};
-
-&sd_emmc_b {
-       status = "okay";
-       sd {
-               caps = "MMC_CAP_4_BIT_DATA",
-                       "MMC_CAP_MMC_HIGHSPEED",
-                       "MMC_CAP_SD_HIGHSPEED",
-                       "MMC_CAP_NONREMOVABLE"; /**ptm debug */
-               f_min = <400000>;
-               f_max = <200000000>;
-       };
-};
-
-&spifc {
-       status = "disabled";
-       spi-nor@0 {
-               cs_gpios = <&gpio BOOT_13 GPIO_ACTIVE_HIGH>;
-       };
-};
-
-&slc_nand {
-       status = "disabled";
-       plat-names = "bootloader", "nandnormal";
-       plat-num = <2>;
-       plat-part-0 = <&bootloader>;
-       plat-part-1 = <&nandnormal>;
-       bootloader: bootloader{
-               enable_pad = "ce0";
-               busy_pad = "rb0";
-               timming_mode = "mode5";
-               bch_mode = "bch8_1k";
-               t_rea = <20>;
-               t_rhoh = <15>;
-               chip_num = <1>;
-               part_num = <0>;
-               rb_detect = <1>;
-       };
-       nandnormal: nandnormal{
-               enable_pad = "ce0";
-               busy_pad = "rb0";
-               timming_mode = "mode5";
-               bch_mode = "bch8_1k";
-               plane_mode = "twoplane";
-               t_rea = <20>;
-               t_rhoh = <15>;
-               chip_num = <2>;
-               part_num = <3>;
-               partition = <&nand_partitions>;
-               rb_detect = <1>;
-       };
-       nand_partitions:nand_partition{
-               /*
-                * if bl_mode is 1, tpl size was generate by
-                * fip_copies * fip_size which
-                * will not skip bad when calculating
-                * the partition size;
-                *
-                * if bl_mode is 0,
-                * tpl partition must be comment out.
-                */
-               tpl{
-                       offset=<0x0 0x0>;
-                       size=<0x0 0x0>;
-               };
-               logo{
-                       offset=<0x0 0x0>;
-                       size=<0x0 0x200000>;
-               };
-               recovery{
-                       offset=<0x0 0x0>;
-                       size=<0x0 0x1000000>;
-               };
-               boot{
-                       offset=<0x0 0x0>;
-                       size=<0x0 0x1000000>;
-               };
-               system{
-                       offset=<0x0 0x0>;
-                       size=<0x0 0x4000000>;
-               };
-               data{
-                       offset=<0xffffffff 0xffffffff>;
-                       size=<0x0 0x0>;
-               };
-       };
-};
-
-&ethmac {
-       status = "okay";
-       pinctrl-names = "internal_eth_pins";
-       pinctrl-0 = <&internal_eth_pins>;
-       mc_val = <0x4be04>;
-
-       internal_phy=<1>;
-};
-
-&uart_A {
-       status = "okay";
-};
-
-&dwc3 {
-       status = "okay";
-};
-
-&usb2_phy_v2 {
-       status = "okay";
-       portnum = <3>;
-};
-
-&usb3_phy_v2 {
-       status = "okay";
-       portnum = <0>;
-       otg = <0>;
-};
-
-&dwc2_a {
-       status = "okay";
-       /** 0: normal, 1: otg+dwc3 host only, 2: otg+dwc3 device only*/
-       controller-type = <1>;
-};
-
-&spicc0 {
-       status = "okay";
-       pinctrl-names = "default";
-       pinctrl-0 = <&spicc0_pins_h>;
-       cs-gpios = <&gpio GPIOH_20 0>;
-};
-
-&meson_fb {
-       status = "okay";
-       display_size_default = <1920 1080 1920 2160 32>;
-       mem_size = <0x00800000 0x1980000 0x100000 0x800000>;
-       logo_addr = "0x7f800000";
-       mem_alloc = <0>;
-       pxp_mode = <0>; /** 0:normal mode 1:pxp mode */
-};
-
-&pwm_AO_cd {
-       status = "okay";
-};
-
-&saradc {
-       status = "okay";
-};
-
-&pwm_ab {
-       status = "okay";
-};
-
-&efuse {
-       status = "okay";
-};
index 4f87df5..dc3014d 100644 (file)
                        };
                        tdmacodec: codec {
                                //sound-dai = <&dummy_codec>;
+                               prefix-names = "AMP";
                                sound-dai = <&ad82584f &tl1_codec>;
                        };
                };
                        };
                };
 
+               aml-audio-card,dai-link@7 {
+                       mclk-fs = <256>;
+                       continuous-clock;
+                       suffix-name = "alsaPORT-loopback";
+                       cpu {
+                               sound-dai = <&loopbacka>;
+                               system-clock-frequency = <12288000>;
+                       };
+                       codec {
+                               sound-dai = <&dummy_codec>;
+                       };
+               };
+               aml-audio-card,dai-link@8 {
+                       mclk-fs = <256>;
+                       suffix-name = "alsaPORT-loopbackb";
+                       cpu {
+                               sound-dai = <&loopbackb>;
+                               system-clock-frequency = <12288000>;
+                       };
+                       codec {
+                               sound-dai = <&dummy_codec>;
+                       };
+               };
        };
        /* Audio Related end */
 
 
                /* In for ACODEC_ADC */
                acodec_adc = <1>;
+               mclk_pad = <0>;  /* 0: mclk_0; 1: mclk_1 */
+
+               /*enable default mclk(12.288M), before extern codec start*/
+               start_clk_enable = <1>;
 
+               /*tdm clk tuning enable*/
+               clk_tuning_enable = <1>;
                status = "okay";
 
                /* !!!For --TV platform-- ONLY */
                                &clkc CLKID_MPLL1>;
                clock-names = "mclk", "clk_srcpll";
 
+               mclk_pad = <0>;  /* 0: mclk_0; 1: mclk_1 */
+
                status = "okay";
        };
 
                pinctrl-names = "tdm_pins";
                pinctrl-0 = <&tdmout_c &tdmin_c>;
 
+               mclk_pad = <0>;  /* 0: mclk_0; 1: mclk_1 */
+
                status = "okay";
        };
 
+       tdmlb:tdm@3 {
+               compatible = "amlogic, tl1-snd-tdmlb";
+               #sound-dai-cells = <0>;
+
+               dai-tdm-lane-lb-slot-mask-in = <1 0 0 0>;
+               dai-tdm-clk-sel = <1>;
+
+               clocks = <&clkaudio CLKID_AUDIO_MCLK_B
+                               &clkc CLKID_MPLL1>;
+               clock-names = "mclk", "clk_srcpll";
+
+               /*
+                * select tdmin_lb src;
+                * AXG
+                *  0: TDMOUTA
+                *  1: TDMOUTB
+                *  2: TDMOUTC
+                *  3: PAD_TDMINA
+                *  4: PAD_TDMINB
+                *  5: PAD_TDMINC
+                *
+                * G12A/G12B
+                *  0: TDMOUTA
+                *  1: TDMOUTB
+                *  2: TDMOUTC
+                *  3: PAD_TDMINA_DIN*
+                *  4: PAD_TDMINB_DIN*
+                *  5: PAD_TDMINC_DIN*
+                *  6: PAD_TDMINA_D*, oe pin
+                *  7: PAD_TDMINB_D*, oe pin
+                *
+                * TL1
+                *  0: TDMOUTA
+                *  1: TDMOUTB
+                *  2: TDMOUTC
+                *  3: PAD_TDMINA_DIN*
+                *  4: PAD_TDMINB_DIN*
+                *  5: PAD_TDMINC_DIN*
+                *  6: PAD_TDMINA_D*
+                *  7: PAD_TDMINB_D*
+                *  8: PAD_TDMINC_D*
+                *  9: HDMIRX_I2S
+                *  10: ACODEC_ADC
+                */
+               lb-src-sel = <1>;
+
+               status = "disabled";
+       };
+
        spdifa:spdif@0 {
                compatible = "amlogic, tl1-snd-spdif-a";
                #sound-dai-cells = <0>;
                pinctrl-0 = <&spdifout_a>;
                pinctrl-1 = <&spdifout_a_mute>;
 
-
                /*
                 * whether do asrc for pcm and resample a or b
                 * if raw data, asrc is disabled automatically
                asrc_id = <0>;
                auto_asrc = <3>;
 
+               /*spdif clk tuning enable*/
+               clk_tuning_enable = <1>;
                status = "okay";
        };
 
                 *      NONE,
                 *      TDMIN_LB, 6
                 *      LOOPBACK, 7
+                *      FRHDMIRX, 8
                 */
-               resample_module = <3>;
+               resample_module = <8>;
 
                status = "okay";
        };
                status = "disabled";
        };
 
+       vad:vad {
+               compatible = "amlogic, snd-vad";
+               #sound-dai-cells = <0>;
+
+               clocks = <&clkaudio CLKID_AUDIO_GATE_TOVAD
+                       &clkc CLKID_FCLK_DIV5
+                       &clkaudio CLKID_AUDIO_VAD>;
+               clock-names = "gate", "pll", "clk";
+
+               interrupts = <GIC_SPI 155 IRQ_TYPE_EDGE_RISING
+                               GIC_SPI 47 IRQ_TYPE_EDGE_RISING>;
+               interrupt-names = "irq_wakeup", "irq_frame_sync";
+
+               /*
+                * Data src sel:
+                * 0: tdmin_a;
+                * 1: tdmin_b;
+                * 2: tdmin_c;
+                * 3: spdifin;
+                * 4: pdmin;
+                * 5: loopback_b;
+                * 6: tdmin_lb;
+                * 7: loopback_a;
+                */
+               src = <4>;
+
+               /*
+                * deal with hot word in user space or kernel space
+                * 0: in user space
+                * 1: in kernel space
+                */
+               level = <1>;
+
+               status = "disabled";
+       };
+
+       loopbacka:loopback@0 {
+               compatible = "amlogic, tl1-loopbacka";
+               #sound-dai-cells = <0>;
+
+               clocks = <&clkaudio CLKID_AUDIO_GATE_PDM
+                       &clkc CLKID_FCLK_DIV3
+                       &clkc CLKID_MPLL3
+                       &clkaudio CLKID_AUDIO_PDMIN0
+                       &clkaudio CLKID_AUDIO_PDMIN1
+                       &clkc CLKID_MPLL0
+                       &clkaudio CLKID_AUDIO_MCLK_A>;
+               clock-names = "pdm_gate",
+                       "pdm_sysclk_srcpll",
+                       "pdm_dclk_srcpll",
+                       "pdm_dclk",
+                       "pdm_sysclk",
+                       "tdminlb_mpll",
+                       "tdminlb_mclk";
+
+               /* datain src
+                * 0: tdmin_a;
+                * 1: tdmin_b;
+                * 2: tdmin_c;
+                * 3: spdifin;
+                * 4: pdmin;
+                */
+               datain_src = <4>;
+               datain_chnum = <4>;
+               datain_chmask = <0xf>;
+               /* config which data pin for loopback */
+               datain-lane-mask-in = <1 0 1 0>;
+
+               /* calc mclk for datalb */
+               mclk-fs = <256>;
+
+               /* tdmin_lb src
+                * 0: tdmoutA
+                * 1: tdmoutB
+                * 2: tdmoutC
+                * 3: PAD_TDMINA_DIN*, refer to core pinmux
+                * 4: PAD_TDMINB_DIN*, refer to core pinmux
+                * 5: PAD_TDMINC_DIN*, refer to core pinmux
+                * 6: PAD_TDMINA_D*, oe, refer to core pinmux
+                * 7: PAD_TDMINB_D*, oe, refer to core pinmux
+                */
+               /* if tdmin_lb >= 3, use external loopback */
+               datalb_src = <0>;
+               datalb_chnum = <2>;
+               datalb_chmask = <0x3>;
+               /* config which data pin as loopback */
+               datalb-lane-mask-in = <1 0 0 0>;
+
+               status = "okay";
+       };
+
+       loopbackb:loopback@1 {
+               compatible = "amlogic, tl1-loopbackb";
+               #sound-dai-cells = <0>;
+
+               clocks = <&clkaudio CLKID_AUDIO_GATE_PDM
+                       &clkc CLKID_FCLK_DIV3
+                       &clkc CLKID_MPLL3
+                       &clkaudio CLKID_AUDIO_PDMIN0
+                       &clkaudio CLKID_AUDIO_PDMIN1
+                       &clkc CLKID_MPLL0
+                       &clkaudio CLKID_AUDIO_MCLK_A>;
+               clock-names = "pdm_gate",
+                       "pdm_sysclk_srcpll",
+                       "pdm_dclk_srcpll",
+                       "pdm_dclk",
+                       "pdm_sysclk",
+                       "tdminlb_mpll",
+                       "tdminlb_mclk";
+
+               /* calc mclk for datain_lb */
+               mclk-fs = <256>;
+
+               /* datain src
+                * 0: tdmin_a;
+                * 1: tdmin_b;
+                * 2: tdmin_c;
+                * 3: spdifin;
+                * 4: pdmin;
+                */
+               datain_src = <4>;
+               datain_chnum = <4>;
+               datain_chmask = <0xf>;
+               /* config which data pin for loopback */
+               datain-lane-mask-in = <1 0 1 0>;
+
+               /* tdmin_lb src
+                * 0: tdmoutA
+                * 1: tdmoutB
+                * 2: tdmoutC
+                * 3: PAD_TDMINA_DIN*, refer to core pinmux
+                * 4: PAD_TDMINB_DIN*, refer to core pinmux
+                * 5: PAD_TDMINC_DIN*, refer to core pinmux
+                * 6: PAD_TDMINA_D*, oe, refer to core pinmux
+                * 7: PAD_TDMINB_D*, oe, refer to core pinmux
+                */
+               /* if tdmin_lb >= 3, use external loopback */
+               datalb_src = <1>;
+               datalb_chnum = <2>;
+               datalb_chmask = <0x3>;
+               /* config which data pin as loopback */
+               datalb-lane-mask-in = <1 0 0 0>;
+
+               status = "okay";
+       };
 }; /* end of audiobus */
 
 &pinctrl_periphs {
diff --git a/arch/arm/boot/dts/amlogic/tl1_t962x2_x301.dts b/arch/arm/boot/dts/amlogic/tl1_t962x2_x301.dts
deleted file mode 100644 (file)
index d5741b9..0000000
+++ /dev/null
@@ -1,1477 +0,0 @@
-/*
- * arch/arm/boot/dts/amlogic/tl1_t962x2_x301.dts
- *
- * Copyright (C) 2018 Amlogic, Inc. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
- * more details.
- *
- */
-
-/dts-v1/;
-
-#include "mesontl1.dtsi"
-#include "partition_mbox_normal_P_32.dtsi"
-#include "mesontl1_skt-panel.dtsi"
-
-/ {
-       model = "Amlogic TL1 T962X2 X301";
-       amlogic-dt-id = "tl1_t962x2_x301";
-       compatible = "amlogic, tl1_t962x2_x301";
-
-       aliases {
-               serial0 = &uart_AO;
-               serial1 = &uart_A;
-               serial2 = &uart_B;
-               serial3 = &uart_C;
-               serial4 = &uart_AO_B;
-               tsensor0 = &p_tsensor;
-               tsensor1 = &d_tsensor;
-               i2c0 = &i2c0;
-               i2c1 = &i2c1;
-               i2c2 = &i2c2;
-               i2c3 = &i2c3;
-               i2c4 = &i2c_AO;
-       };
-
-       memory@00000000 {
-               device_type = "memory";
-               linux,usable-memory = <0x0 0x80000000>;
-       };
-
-       reserved-memory {
-               #address-cells = <1>;
-               #size-cells = <1>;
-               ranges;
-               /* global autoconfigured region for contiguous allocations */
-               ramoops@0x07400000 {
-                       compatible = "ramoops";
-                       reg = <0x07400000 0x00100000>;
-                       record-size = <0x8000>;
-                       console-size = <0x8000>;
-                       ftrace-size = <0x20000>;
-               };
-
-               secmon_reserved: linux,secmon {
-                       compatible = "shared-dma-pool";
-                       reusable;
-                       size = <0x400000>;
-                       alignment = <0x400000>;
-                       alloc-ranges = <0x05000000 0x400000>;
-               };
-
-               codec_mm_cma:linux,codec_mm_cma {
-                       compatible = "shared-dma-pool";
-                       reusable;
-                       /* ion_codec_mm max can alloc size 80M*/
-                       size = <0x13400000>;
-                       alignment = <0x400000>;
-                       linux,contiguous-region;
-                       alloc-ranges = <0x12000000 0x13400000>;
-               };
-
-               /* codec shared reserved */
-               codec_mm_reserved:linux,codec_mm_reserved {
-                       compatible = "amlogic, codec-mm-reserved";
-                       size = <0x0>;
-                       alignment = <0x100000>;
-                       //no-map;
-               };
-
-               logo_reserved:linux,meson-fb {
-                       compatible = "shared-dma-pool";
-                       reusable;
-                       size = <0x800000>;
-                       alignment = <0x400000>;
-                       alloc-ranges = <0x7f800000 0x800000>;
-               };
-
-               ion_cma_reserved:linux,ion-dev {
-                       compatible = "shared-dma-pool";
-                       reusable;
-                       size = <0x8000000>;
-                       alignment = <0x400000>;
-               };
-
-               /*  vdin0 CMA pool */
-               //vdin0_cma_reserved:linux,vdin0_cma {
-               //      compatible = "shared-dma-pool";
-               //      reusable;
-                       /* 3840x2160x4x4 ~=128 M */
-               //      size = <0xc400000>;
-               //      alignment = <0x400000>;
-               //};
-
-               /*  vdin1 CMA pool */
-               vdin1_cma_reserved:linux,vdin1_cma {
-                       compatible = "shared-dma-pool";
-                       reusable;
-                       /* 1920x1080x2x4  =16 M */
-                       size = <0x1400000>;
-                       alignment = <0x400000>;
-               };
-
-               /* for hdmi rx emp use */
-               hdmirx_emp_cma_reserved:linux,emp_cma {
-                       compatible = "shared-dma-pool";
-                       /*linux,phandle = <5>;*/
-                       reusable;
-                       /* 4M for emp to ddr */
-                       /* 32M for tmds to ddr */
-                       size = <0x2000000>;
-                       alignment = <0x400000>;
-                       /* alloc-ranges = <0x400000 0x2000000>; */
-               };
-
-               /* POST PROCESS MANAGER */
-               ppmgr_reserved:linux,ppmgr {
-                       compatible = "amlogic, ppmgr_memory";
-                       size = <0x0>;
-               };
-       }; /* end of reserved-memory */
-
-       codec_mm {
-               compatible = "amlogic, codec, mm";
-               status = "okay";
-               memory-region = <&codec_mm_cma &codec_mm_reserved>;
-       };
-
-       ppmgr {
-               compatible = "amlogic, ppmgr";
-               memory-region = <&ppmgr_reserved>;
-               status = "okay";
-       };
-
-       vout {
-               compatible = "amlogic, vout";
-               status = "okay";
-               fr_auto_policy = <0>;
-       };
-
-       /* Audio Related start */
-       pdm_codec:dummy {
-               #sound-dai-cells = <0>;
-               compatible = "amlogic, pdm_dummy_codec";
-               status = "okay";
-       };
-
-       dummy_codec:dummy {
-               #sound-dai-cells = <0>;
-               compatible = "amlogic, aml_dummy_codec";
-               status = "okay";
-       };
-
-       tl1_codec:codec {
-               #sound-dai-cells = <0>;
-               compatible = "amlogic, tl1_acodec";
-               status = "okay";
-               reg = <0xff632000 0x1c>;
-               tdmout_index = <0>;
-               tdmin_index = <0>;
-               dat1_ch_sel = <1>;
-       };
-
-       auge_sound {
-               compatible = "amlogic, tl1-sound-card";
-               aml-audio-card,name = "AML-AUGESOUND";
-
-               avout_mute-gpios = <&gpio GPIODV_3 GPIO_ACTIVE_HIGH>;
-
-               aml-audio-card,dai-link@0 {
-                       format = "i2s";
-                       mclk-fs = <256>;
-                       continuous-clock;
-                       //bitclock-inversion;
-                       //frame-inversion;
-                       /* master mode */
-                       bitclock-master = <&tdma>;
-                       frame-master = <&tdma>;
-                       /* slave mode */
-                       /*
-                        * bitclock-master = <&tdmacodec>;
-                        * frame-master = <&tdmacodec>;
-                        */
-                       /* suffix-name, sync with android audio hal used for */
-                       suffix-name = "alsaPORT-i2s";
-                       tdmacpu: cpu {
-                               sound-dai = <&tdma>;
-                               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>;
-                       };
-                       tdmacodec: codec {
-                               //sound-dai = <&dummy_codec>;
-                               sound-dai = <&ad82584f &tl1_codec>;
-                       };
-               };
-
-               aml-audio-card,dai-link@1 {
-                       status = "disabled";
-
-                       format = "i2s";
-                       mclk-fs = <256>;
-                       //continuous-clock;
-                       //bitclock-inversion;
-                       //frame-inversion;
-                       /* master mode */
-                       bitclock-master = <&tdmb>;
-                       frame-master = <&tdmb>;
-                       /* slave mode */
-                       //bitclock-master = <&tdmbcodec>;
-                       //frame-master = <&tdmbcodec>;
-                       /* suffix-name, sync with android audio hal used for */
-                       suffix-name = "alsaPORT-pcm";
-                       cpu {
-                               sound-dai = <&tdmb>;
-                               dai-tdm-slot-tx-mask = <1 1>;
-                               dai-tdm-slot-rx-mask = <1 1>;
-                               dai-tdm-slot-num = <2>;
-                               /*
-                                * dai-tdm-slot-tx-mask =
-                                *      <1 1 1 1 1 1 1 1>;
-                                * dai-tdm-slot-rx-mask =
-                                *      <1 1 1 1 1 1 1 1>;
-                                * dai-tdm-slot-num = <8>;
-                                */
-                               dai-tdm-slot-width = <32>;
-                               system-clock-frequency = <12288000>;
-                       };
-                       tdmbcodec: codec {
-                               sound-dai = <&dummy_codec>;
-                       };
-               };
-
-               aml-audio-card,dai-link@2 {
-                       status = "disabled";
-
-                       format = "i2s";
-                       mclk-fs = <256>;
-                       //continuous-clock;
-                       //bitclock-inversion;
-                       //frame-inversion;
-                       /* master mode */
-                       bitclock-master = <&tdmc>;
-                       frame-master = <&tdmc>;
-                       /* slave mode */
-                       //bitclock-master = <&tdmccodec>;
-                       //frame-master = <&tdmccodec>;
-                       /* suffix-name, sync with android audio hal used for */
-                       //suffix-name = "alsaPORT-tdm";
-                       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>;
-                       };
-                       tdmccodec: codec {
-                               sound-dai = <&dummy_codec>;
-                       };
-               };
-
-               aml-audio-card,dai-link@3 {
-                       mclk-fs = <64>;
-                       /* suffix-name, sync with android audio hal used for */
-                       suffix-name = "alsaPORT-pdm";
-                       cpu {
-                               sound-dai = <&pdm>;
-                       };
-                       codec {
-                               sound-dai = <&pdm_codec>;
-                       };
-               };
-
-               aml-audio-card,dai-link@4 {
-                       mclk-fs = <128>;
-                       continuous-clock;
-                       /* suffix-name, sync with android audio hal used for */
-                       suffix-name = "alsaPORT-spdif";
-                       cpu {
-                               sound-dai = <&spdifa>;
-                               system-clock-frequency = <6144000>;
-                       };
-                       codec {
-                               sound-dai = <&dummy_codec>;
-                       };
-               };
-
-               aml-audio-card,dai-link@5 {
-                       mclk-fs = <128>;
-                       cpu {
-                               sound-dai = <&spdifb>;
-                               system-clock-frequency = <6144000>;
-                       };
-                       codec {
-                               sound-dai = <&dummy_codec>;
-                       };
-               };
-
-               aml-audio-card,dai-link@6 {
-                       mclk-fs = <256>;
-                       suffix-name = "alsaPORT-tv";
-                       cpu {
-                               sound-dai = <&extn>;
-                               system-clock-frequency = <12288000>;
-                       };
-                       codec {
-                               sound-dai = <&dummy_codec>;
-                       };
-               };
-
-       };
-       /* Audio Related end */
-
-       dvb {
-               compatible = "amlogic, dvb";
-               status = "okay";
-               fe0_mode = "internal";
-               fe0_tuner = <&tuner>;
-
-               /*"parallel","serial","disable"*/
-               ts2 = "parallel";
-               ts2_control = <0>;
-               ts2_invert = <0>;
-               interrupts = <0 23 1
-                               0 5 1
-                               0 53 1
-                               0 19 1
-                               0 25 1
-                               0 17 1>;
-               interrupt-names = "demux0_irq",
-                               "demux1_irq",
-                               "demux2_irq",
-                               "dvr0_irq",
-                               "dvr1_irq",
-                               "dvr2_irq";
-               clocks = <&clkc CLKID_DEMUX
-                       &clkc CLKID_ASYNC_FIFO
-                       &clkc CLKID_AHB_ARB0
-/*             &clkc CLKID_DOS_PARSER>;*/
-               &clkc CLKID_U_PARSER>;
-               clock-names = "demux", "asyncfifo", "ahbarb0", "uparsertop";
-       };
-
-       tvafe_avin_detect {
-               compatible = "amlogic, tl1_tvafe_avin_detect";
-               status = "okay";
-               device_mask = <1>;/*bit0:ch1;bit1:ch2*/
-               interrupts = <0 12 1>,
-                               <0 13 1>;
-       };
-
-       amlvecm {
-               compatible = "amlogic, vecm";
-               dev_name = "aml_vecm";
-               status = "okay";
-               gamma_en = <1>;/*1:enabel ;0:disable*/
-               wb_en = <1>;/*1:enabel ;0:disable*/
-               cm_en = <1>;/*1:enabel ;0:disable*/
-               wb_sel = <1>;/*1:mtx ;0:gainoff*/
-               vlock_en = <1>;/*1:enable;0:disable*/
-               vlock_mode = <0x4>;
-               /* vlock work mode:
-                *bit0:auto ENC
-                *bit1:auto PLL
-                *bit2:manual PLL
-                *bit3:manual ENC
-                *bit4:manual soft ENC
-                *bit5:manual MIX PLL ENC
-                */
-                vlock_pll_m_limit = <1>;
-                vlock_line_limit = <3>;
-       };
-
-       vdin@0 {
-               compatible = "amlogic, vdin";
-               /*memory-region = <&vdin0_cma_reserved>;*/
-               status = "okay";
-               /*bit0:(1:share with codec_mm;0:cma alone)
-                *bit8:(1:alloc in discontinus way;0:alone in continuous way)
-                */
-               flag_cma = <0x101>;
-               /*MByte, if 10bit disable: 64M(YUV422),
-                *if 10bit enable: 64*1.5 = 96M(YUV422)
-                *if support 4K2K-YUV444-10bit-WR:3840*2160*4*4 ~= 128M
-                *if support 4K2K-YUV422-10bit-wr:3840*2160*3*4 ~= 96M
-                *if support 4K2K-YUV422-8BIT-WR:3840*2160*2*4 ~= 64M
-                *if support 1080p-YUV422-8BIT-WR:1920*1080*2*4 ~= 16M
-                */
-               cma_size = <190>;
-               interrupts = <0 83 1>;
-               rdma-irq = <2>;
-               clocks = <&clkc CLKID_FCLK_DIV5>,
-                       <&clkc CLKID_VDIN_MEAS_COMP>;
-               clock-names = "fclk_div5", "cts_vdin_meas_clk";
-               vdin_id = <0>;
-               /*vdin write mem color depth support:
-                * bit0:support 8bit
-                * bit1:support 9bit
-                * bit2:support 10bit
-                * bit3:support 12bit
-                * bit4:support yuv422 10bit full pack mode (from txl new add)
-                * bit8:use 8bit  at 4k_50/60hz_10bit
-                * bit9:use 10bit at 4k_50/60hz_10bit
-                */
-               tv_bit_mode = <0x215>;
-               /* afbce_bit_mode: (amlogic frame buff compression encoder)
-                * 0: normal mode, not use afbce
-                * 1: use afbce non-mmu mode
-                * 2: use afbce mmu mode
-                */
-               afbce_bit_mode = <0>;
-       };
-
-       vdin@1 {
-               compatible = "amlogic, vdin";
-               memory-region = <&vdin1_cma_reserved>;
-               status = "okay";
-               /*bit0:(1:share with codec_mm;0:cma alone)
-                *bit8:(1:alloc in discontinus way;0:alone in continuous way)
-                */
-               flag_cma = <0>;
-               interrupts = <0 85 1>;
-               rdma-irq = <4>;
-               clocks = <&clkc CLKID_FCLK_DIV5>,
-                       <&clkc CLKID_VDIN_MEAS_COMP>;
-               clock-names = "fclk_div5", "cts_vdin_meas_clk";
-               vdin_id = <1>;
-               /*vdin write mem color depth support:
-                *bit0:support 8bit
-                *bit1:support 9bit
-                *bit2:support 10bit
-                *bit3:support 12bit
-                */
-               tv_bit_mode = <0x15>;
-       };
-
-       unifykey {
-               compatible = "amlogic, unifykey";
-               status = "okay";
-
-               unifykey-num = <19>;
-               unifykey-index-0 = <&keysn_0>;
-               unifykey-index-1 = <&keysn_1>;
-               unifykey-index-2 = <&keysn_2>;
-               unifykey-index-3 = <&keysn_3>;
-               unifykey-index-4 = <&keysn_4>;
-               unifykey-index-5 = <&keysn_5>;
-               unifykey-index-6 = <&keysn_6>;
-               unifykey-index-7 = <&keysn_7>;
-               unifykey-index-8 = <&keysn_8>;
-               unifykey-index-9 = <&keysn_9>;
-               unifykey-index-10= <&keysn_10>;
-               unifykey-index-11 = <&keysn_11>;
-               unifykey-index-12 = <&keysn_12>;
-               unifykey-index-13 = <&keysn_13>;
-               unifykey-index-14 = <&keysn_14>;
-               unifykey-index-15 = <&keysn_15>;
-               unifykey-index-16 = <&keysn_16>;
-               unifykey-index-17 = <&keysn_17>;
-               unifykey-index-18 = <&keysn_18>;
-
-               keysn_0: key_0{
-                       key-name = "usid";
-                       key-device = "normal";
-                       key-permit = "read","write","del";
-               };
-               keysn_1:key_1{
-                       key-name = "mac";
-                       key-device  = "normal";
-                       key-permit = "read","write","del";
-               };
-               keysn_2:key_2{
-                       key-name = "hdcp";
-                       key-device = "secure";
-                       key-type  = "sha1";
-                       key-permit = "read","write","del";
-               };
-               keysn_3:key_3{
-                       key-name = "secure_boot_set";
-                       key-device = "efuse";
-                       key-permit = "write";
-               };
-               keysn_4:key_4{
-                       key-name = "mac_bt";
-                       key-device = "normal";
-                       key-permit = "read","write","del";
-                       key-type  = "mac";
-               };
-               keysn_5:key_5{
-                       key-name = "mac_wifi";
-                       key-device = "normal";
-                       key-permit = "read","write","del";
-                       key-type  = "mac";
-               };
-               keysn_6:key_6{
-                       key-name = "hdcp2_tx";
-                       key-device = "normal";
-                       key-permit = "read","write","del";
-               };
-               keysn_7:key_7{
-                       key-name = "hdcp2_rx";
-                       key-device = "normal";
-                       key-permit = "read","write","del";
-               };
-               keysn_8:key_8{
-                       key-name = "widevinekeybox";
-                       key-device = "secure";
-                       key-type = "sha1";
-                       key-permit = "read","write","del";
-               };
-               keysn_9:key_9{
-                       key-name = "deviceid";
-                       key-device = "normal";
-                       key-permit = "read","write","del";
-               };
-               keysn_10:key_10{
-                       key-name = "hdcp22_fw_private";
-                       key-device = "secure";
-                       key-permit = "read","write","del";
-               };
-               keysn_11:key_11{
-                       key-name = "hdcp22_rx_private";
-                       key-device = "secure";
-                       key-permit = "read","write","del";
-               };
-               keysn_12:key_12{
-                       key-name = "hdcp22_rx_fw";
-                       key-device = "normal";
-                       key-permit = "read","write","del";
-               };
-               keysn_13:key_13{
-                       key-name = "hdcp14_rx";
-                       key-device = "normal";
-                       key-type  = "sha1";
-                       key-permit = "read","write","del";
-               };
-               keysn_14:key_14{
-                       key-name = "prpubkeybox";// PlayReady
-                       key-device = "secure";
-                       key-permit = "read","write","del";
-               };
-               keysn_15:key_15{
-                       key-name = "prprivkeybox";// PlayReady
-                       key-device = "secure";
-                       key-permit = "read","write","del";
-               };
-               keysn_16:key_16{
-                       key-name = "lcd";
-                       key-device = "normal";
-                       key-permit = "read","write","del";
-               };
-               keysn_17:key_17{
-                       key-name = "lcd_extern";
-                       key-device = "normal";
-                       key-permit = "read","write","del";
-               };
-               keysn_18:key_18{
-                       key-name = "backlight";
-                       key-device = "normal";
-                       key-permit = "read","write","del";
-               };
-       }; /* End unifykey */
-
-       hdmirx {
-               compatible = "amlogic, hdmirx_tl1";
-               #address-cells=<1>;
-               #size-cells=<1>;
-               memory-region = <&hdmirx_emp_cma_reserved>;
-               status = "okay";
-               pinctrl-names = "default";
-               pinctrl-0 = <&hdmirx_a_mux &hdmirx_b_mux
-                       &hdmirx_c_mux>;
-               repeat = <0>;
-               interrupts = <0 56 1>;
-               clocks = <&clkc CLKID_HDMIRX_MODET_COMP>,
-                          <&clkc CLKID_HDMIRX_CFG_COMP>,
-                          <&clkc CLKID_HDMIRX_ACR_COMP>,
-                          <&clkc CLKID_HDMIRX_METER_COMP>,
-                          <&xtal>,
-                          <&clkc CLKID_FCLK_DIV5>,
-                          <&clkc CLKID_FCLK_DIV7>,
-                          <&clkc CLKID_HDCP22_SKP_COMP>,
-                          <&clkc CLKID_HDCP22_ESM_COMP>;
-               //         <&clkc CLK_AUD_PLL2FS>,
-               //         <&clkc CLK_AUD_PLL4FS>,
-               //         <&clkc CLK_AUD_OUT>;
-               clock-names = "hdmirx_modet_clk",
-                       "hdmirx_cfg_clk",
-                               "hdmirx_acr_ref_clk",
-                               "cts_hdmirx_meter_clk",
-                               "xtal",
-                               "fclk_div5",
-                               "fclk_div7",
-                               "hdcp_rx22_skp",
-                               "hdcp_rx22_esm";
-               //              "hdmirx_aud_pll2fs",
-               //              "hdmirx_aud_pll4f",
-               //              "clk_aud_out";
-               hdmirx_id = <0>;
-               en_4k_2_2k = <0>;
-               hpd_low_cec_off = <1>;
-               /* bit4: enable feature, bit3~0: port number */
-               disable_port = <0x0>;
-               /* MAP_ADDR_MODULE_CBUS */
-               /* MAP_ADDR_MODULE_HIU */
-               /* MAP_ADDR_MODULE_HDMIRX_CAPB3 */
-               /* MAP_ADDR_MODULE_SEC_AHB */
-               /* MAP_ADDR_MODULE_SEC_AHB2 */
-               /* MAP_ADDR_MODULE_APB4 */
-               /* MAP_ADDR_MODULE_TOP */
-               reg = < 0x0 0x0
-                       0xff63C000 0x2000
-                       0xffe0d000 0x2000
-                       0x0 0x0
-                       0x0 0x0
-                       0x0 0x0
-                       0xff610000 0xa000>;
-       };
-
-       aocec: aocec {
-               compatible = "amlogic, aocec-tl1";
-               /*device_name = "aocec";*/
-               status = "okay";
-               vendor_name = "Amlogic"; /* Max Chars: 8         */
-               /* Refer to the following URL at:
-                * http://standards.ieee.org/develop/regauth/oui/oui.txt
-                */
-               vendor_id = <0x000000>;
-               product_desc = "TL1"; /* Max Chars: 16    */
-               cec_osd_string = "AML_TV"; /* Max Chars: 14    */
-               port_num = <3>;
-               ee_cec;
-               arc_port_mask = <0x2>;
-               interrupts = <0 205 1
-                                       0 199 1>;
-               interrupt-names = "hdmi_aocecb","hdmi_aocec";
-               pinctrl-names = "default","hdmitx_aocecb","cec_pin_sleep";
-               pinctrl-0=<&aoceca_mux>;
-               pinctrl-1=<&aocecb_mux>;
-               pinctrl-2=<&aoceca_mux>;
-               reg = <0xFF80023c 0x4
-                          0xFF800000 0x400>;
-               reg-names = "ao_exit","ao";
-       };
-
-       p_tsensor: p_tsensor@ff634800 {
-               compatible = "amlogic, r1p1-tsensor";
-               status = "okay";
-               reg = <0xff634800 0x50>,
-                       <0xff800268 0x4>;
-               cal_type = <0x1>;
-               cal_a = <324>;
-               cal_b = <424>;
-               cal_c = <3159>;
-               cal_d = <9411>;
-               rtemp = <115000>;
-               interrupts = <0 35 0>;
-               clocks = <&clkc CLKID_TS_CLK_COMP>; /* CLKID_TS_COMP>;*/
-               clock-names = "ts_comp";
-               #thermal-sensor-cells = <1>;
-       };
-
-       d_tsensor: d_tsensor@ff634c00 {
-               compatible = "amlogic, r1p1-tsensor";
-               status = "okay";
-               reg = <0xff634c00 0x50>,
-                       <0xff800230 0x4>;
-               cal_type = <0x1>;
-               cal_a = <324>;
-               cal_b = <424>;
-               cal_c = <3159>;
-               cal_d = <9411>;
-               rtemp = <115000>;
-               interrupts = <0 36 0>;
-               clocks = <&clkc CLKID_TS_CLK_COMP>; /* CLKID_TS_COMP>;*/
-               clock-names = "ts_comp";
-               #thermal-sensor-cells = <1>;
-       };
-
-       meson_cooldev: meson-cooldev@0 {
-               status = "okay";
-               compatible = "amlogic, meson-cooldev";
-               cooling_devices {
-                       cpufreq_cool_cluster0 {
-                               min_state = <1000000>;
-                               dyn_coeff = <115>;
-                               gpu_pp = <2>;
-                               cluster_id = <0>;
-                               node_name = "cpufreq_cool0";
-                               device_type = "cpufreq";
-                       };
-                       cpucore_cool_cluster0 {
-                               min_state = <1>;
-                               dyn_coeff = <0>;
-                               gpu_pp = <2>;
-                               cluster_id = <0>;
-                               node_name = "cpucore_cool0";
-                               device_type = "cpucore";
-                       };
-                       gpufreq_cool {
-                               min_state = <400>;
-                               dyn_coeff = <358>;
-                               gpu_pp = <2>;
-                               cluster_id = <0>;
-                               node_name = "gpufreq_cool0";
-                               device_type = "gpufreq";
-                       };
-                       gpucore_cool {
-                               min_state = <1>;
-                               dyn_coeff = <0>;
-                               gpu_pp = <2>;
-                               cluster_id = <0>;
-                               node_name = "gpucore_cool0";
-                               device_type = "gpucore";
-                       };
-               };
-               cpufreq_cool0:cpufreq_cool0 {
-                       #cooling-cells = <2>; /* min followed by max */
-               };
-               cpucore_cool0:cpucore_cool0 {
-                       #cooling-cells = <2>; /* min followed by max */
-               };
-               gpufreq_cool0:gpufreq_cool0 {
-                       #cooling-cells = <2>; /* min followed by max */
-               };
-               gpucore_cool0:gpucore_cool0 {
-                       #cooling-cells = <2>; /* min followed by max */
-               };
-       };/*meson cooling devices end*/
-
-       thermal-zones {
-               pll_thermal: pll_thermal {
-                       polling-delay = <1000>;
-                       polling-delay-passive = <100>;
-                       sustainable-power = <1410>;
-                       thermal-sensors = <&p_tsensor 0>;
-                       trips {
-                               pswitch_on: trip-point@0 {
-                                       temperature = <60000>;
-                                       hysteresis = <5000>;
-                                       type = "passive";
-                               };
-                               pcontrol: trip-point@1 {
-                                       temperature = <75000>;
-                                       hysteresis = <5000>;
-                                       type = "passive";
-                               };
-                               phot: trip-point@2 {
-                                       temperature = <85000>;
-                                       hysteresis = <5000>;
-                                       type = "hot";
-                               };
-                               pcritical: trip-point@3 {
-                                       temperature = <110000>;
-                                       hysteresis = <1000>;
-                                       type = "critical";
-                               };
-                       };
-                       cooling-maps {
-                               cpufreq_cooling_map {
-                                       trip = <&pcontrol>;
-                                       cooling-device = <&cpufreq_cool0 0 4>;
-                                       contribution = <1024>;
-                               };
-                               gpufreq_cooling_map {
-                                       trip = <&pcontrol>;
-                                       cooling-device = <&gpufreq_cool0 0 4>;
-                                       contribution = <1024>;
-                               };
-                       };
-               };
-               ddr_thermal: ddr_thermal {
-                       polling-delay = <1000>;
-                       polling-delay-passive = <250>;
-                       sustainable-power = <1460>;
-                       thermal-sensors = <&d_tsensor 1>;
-                       trips {
-                               dswitch_on: trip-point@0 {
-                                       temperature = <60000>;
-                                       hysteresis = <5000>;
-                                       type = "passive";
-                               };
-                               dcontrol: trip-point@1 {
-                                       temperature = <75000>;
-                                       hysteresis = <5000>;
-                                       type = "passive";
-                               };
-                               dhot: trip-point@2 {
-                                       temperature = <85000>;
-                                       hysteresis = <5000>;
-                                       type = "hot";
-                               };
-                               dcritical: trip-point@3 {
-                                       temperature = <110000>;
-                                       hysteresis = <1000>;
-                                       type = "critical";
-                               };
-                       };
-               };
-       }; /*thermal zone end*/
-
-       /*DCDC for MP8756GD*/
-       cpu_opp_table0: cpu_opp_table0 {
-               compatible = "operating-points-v2";
-               opp-shared;
-
-               opp00 {
-                       opp-hz = /bits/ 64 <100000000>;
-                       opp-microvolt = <731000>;
-               };
-               opp01 {
-                       opp-hz = /bits/ 64 <250000000>;
-                       opp-microvolt = <731000>;
-               };
-               opp02 {
-                       opp-hz = /bits/ 64 <500000000>;
-                       opp-microvolt = <731000>;
-               };
-               opp03 {
-                       opp-hz = /bits/ 64 <667000000>;
-                       opp-microvolt = <761000>;
-               };
-               opp04 {
-                       opp-hz = /bits/ 64 <1000000000>;
-                       opp-microvolt = <791000>;
-               };
-               opp05 {
-                       opp-hz = /bits/ 64 <1200000000>;
-                       opp-microvolt = <801000>;
-               };
-               opp06 {
-                       opp-hz = /bits/ 64 <1404000000>;
-                       opp-microvolt = <831000>;
-               };
-               opp07 {
-                       opp-hz = /bits/ 64 <1500000000>;
-                       opp-microvolt = <861000>;
-               };
-               opp08 {
-                       opp-hz = /bits/ 64 <1608000000>;
-                       opp-microvolt = <891000>;
-               };
-               opp09 {
-                       opp-hz = /bits/ 64 <1704000000>;
-                       opp-microvolt = <921000>;
-               };
-               opp10 {
-                       opp-hz = /bits/ 64 <1800000000>;
-                       opp-microvolt = <981000>;
-               };
-               opp11 {
-                       opp-hz = /bits/ 64 <1908000000>;
-                       opp-microvolt = <1011000>;
-               };
-       };
-
-       cpufreq-meson {
-               compatible = "amlogic, cpufreq-meson";
-               pinctrl-names = "default";
-               pinctrl-0 = <&pwm_ao_d_pins3>;
-               status = "okay";
-       };
-
-       tuner: tuner {
-               status = "okay";
-               tuner_name = "mxl661_tuner";
-               tuner_i2c_adap = <&i2c0>;
-               tuner_i2c_addr = <0x60>;
-               tuner_xtal = <1>; /* 0: 16MHz, 1: 24MHz */
-               tuner_xtal_mode = <3>;
-                                       /* NO_SHARE_XTAL(0)
-                                        * SLAVE_XTAL_SHARE(3)
-                                        */
-               tuner_xtal_cap = <25>; /* when tuner_xtal_mode = 3, set 25 */
-       };
-
-       bt-dev{
-               compatible = "amlogic, bt-dev";
-               status = "okay";
-               gpio_reset = <&gpio       GPIOC_13       GPIO_ACTIVE_HIGH>;
-       };
-
-       wifi{
-               compatible = "amlogic, aml_wifi";
-               status = "okay";
-               interrupt_pin = <&gpio       GPIOC_12       GPIO_ACTIVE_HIGH>;
-               irq_trigger_type = "GPIO_IRQ_LOW";
-               dhd_static_buf;    //dhd_static_buf support
-               power_on_pin = <&gpio       GPIOC_11       GPIO_ACTIVE_HIGH>;
-               pinctrl-names = "default";
-               pinctrl-0 = <&pwm_b_pins1>;
-               pwm_config = <&wifi_pwm_conf>;
-       };
-
-       wifi_pwm_conf:wifi_pwm_conf{
-               pwm_channel1_conf {
-                       pwms = <&pwm_ab MESON_PWM_1 30040 0>;
-                       duty-cycle = <15020>;
-                       times = <8>;
-               };
-               pwm_channel2_conf {
-                       pwms = <&pwm_ab MESON_PWM_3 30030 0>;
-                       duty-cycle = <15015>;
-                       times = <12>;
-               };
-       };
-
-}; /* end of / */
-
-&i2c0 {
-       status = "okay";
-       clock-frequency = <300000>;
-       pinctrl-names="default";
-       pinctrl-0=<&i2c0_dv_pins>;
-};
-
-&audiobus {
-       tdma:tdm@0 {
-               compatible = "amlogic, tl1-snd-tdma";
-               #sound-dai-cells = <0>;
-
-               dai-tdm-lane-slot-mask-in = <1 0>;
-               dai-tdm-lane-slot-mask-out = <1 1 1 1>;
-               dai-tdm-clk-sel = <0>;
-
-               clocks = <&clkaudio CLKID_AUDIO_MCLK_A
-                               &clkc CLKID_MPLL0
-                               &clkc CLKID_MPLL1
-                               &clkaudio CLKID_AUDIO_SPDIFOUT_A>;
-               clock-names = "mclk", "clk_srcpll",
-                       "samesource_srcpll", "samesource_clk";
-
-               pinctrl-names = "tdm_pins";
-               pinctrl-0 = <&tdma_mclk &tdmout_a>;
-
-               /*
-                * 0: tdmout_a;
-                * 1: tdmout_b;
-                * 2: tdmout_c;
-                * 3: spdifout;
-                * 4: spdifout_b;
-                */
-               samesource_sel = <3>;
-
-               /* In for ACODEC_ADC */
-               acodec_adc = <1>;
-
-               status = "okay";
-
-               /* !!!For --TV platform-- ONLY */
-               Channel_Mask {
-                       /*i2s has 4 pins, 8channel, mux output*/
-                       Spdif_samesource_Channel_Mask = "i2s_2/3";
-               };
-       };
-
-       tdmb:tdm@1 {
-               compatible = "amlogic, tl1-snd-tdmb";
-               #sound-dai-cells = <0>;
-
-               dai-tdm-lane-slot-mask-in = <1 0 0 0>;
-               dai-tdm-lane-slot-mask-out = <1 0 0 0>;
-               dai-tdm-clk-sel = <1>;
-
-               clocks = <&clkaudio CLKID_AUDIO_MCLK_B
-                               &clkc CLKID_MPLL1>;
-               clock-names = "mclk", "clk_srcpll";
-
-               status = "okay";
-       };
-
-       tdmc:tdm@2 {
-               compatible = "amlogic, tl1-snd-tdmc";
-               #sound-dai-cells = <0>;
-
-               dai-tdm-lane-slot-mask-in = <1 0 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";
-
-               pinctrl-names = "tdm_pins";
-               pinctrl-0 = <&tdmout_c &tdmin_c>;
-
-               status = "okay";
-       };
-
-       spdifa:spdif@0 {
-               compatible = "amlogic, tl1-snd-spdif-a";
-               #sound-dai-cells = <0>;
-
-               clocks = <&clkc CLKID_MPLL1
-                               &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 =
-                               <GIC_SPI 151 IRQ_TYPE_EDGE_RISING>;
-               interrupt-names = "irq_spdifin";
-
-               pinctrl-names = "spdif_pins",
-                               "spdif_pins_mute";
-               pinctrl-0 = <&spdifout_a>;
-               pinctrl-1 = <&spdifout_a_mute>;
-
-               /*
-                * whether do asrc for pcm and resample a or b
-                * if raw data, asrc is disabled automatically
-                * 0: "Disable",
-                * 1: "Enable:32K",
-                * 2: "Enable:44K",
-                * 3: "Enable:48K",
-                * 4: "Enable:88K",
-                * 5: "Enable:96K",
-                * 6: "Enable:176K",
-                * 7: "Enable:192K",
-                */
-               asrc_id = <0>;
-               auto_asrc = <3>;
-
-               status = "okay";
-       };
-
-       spdifb:spdif@1 {
-               compatible = "amlogic, tl1-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";
-       };
-
-       pdm:pdm {
-               compatible = "amlogic, tl1-snd-pdm";
-               #sound-dai-cells = <0>;
-
-               clocks = <&clkaudio CLKID_AUDIO_GATE_PDM
-                       &clkc CLKID_FCLK_DIV3
-                       &clkc CLKID_MPLL3
-                       &clkaudio CLKID_AUDIO_PDMIN0
-                       &clkaudio CLKID_AUDIO_PDMIN1>;
-               clock-names = "gate",
-                       "sysclk_srcpll",
-                       "dclk_srcpll",
-                       "pdm_dclk",
-                       "pdm_sysclk";
-
-               pinctrl-names = "pdm_pins";
-               pinctrl-0 = <&pdmin>;
-
-               /* mode 0~4, defalut:1 */
-               filter_mode = <1>;
-
-               status = "okay";
-       };
-
-       extn:extn {
-               compatible = "amlogic, snd-extn";
-               #sound-dai-cells = <0>;
-
-               interrupts =
-                               <GIC_SPI 158 IRQ_TYPE_EDGE_RISING>;
-               interrupt-names = "irq_frhdmirx";
-
-               status = "okay";
-       };
-
-       aed:effect {
-               compatible = "amlogic, snd-effect-v2";
-               #sound-dai-cells = <0>;
-
-               clocks = <&clkaudio CLKID_AUDIO_GATE_EQDRC
-                       &clkc CLKID_FCLK_DIV5
-                       &clkaudio CLKID_AUDIO_EQDRC>;
-               clock-names = "gate", "srcpll", "eqdrc";
-
-               /*
-                * 0:tdmout_a
-                * 1:tdmout_b
-                * 2:tdmout_c
-                * 3:spdifout
-                * 4:spdifout_b
-                */
-               eqdrc_module = <0>;
-               /* max 0xf, each bit for one lane, usually one lane */
-               lane_mask = <0x1>;
-               /* max 0xff, each bit for one channel */
-               channel_mask = <0xff>;
-
-               status = "okay";
-       };
-
-       asrca: resample@0 {
-               compatible = "amlogic, tl1-resample-a";
-               clocks = <&clkc CLKID_MPLL0
-                               &clkaudio CLKID_AUDIO_MCLK_A
-                               &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 = <3>;
-
-               status = "okay";
-       };
-
-       asrcb: resample@1 {
-               compatible = "amlogic, tl1-resample-b";
-
-               clocks = <&clkc CLKID_MPLL3
-                       &clkaudio CLKID_AUDIO_MCLK_F
-                       &clkaudio CLKID_AUDIO_RESAMPLE_B>;
-               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 = <3>;
-
-               status = "disabled";
-       };
-
-       vad:vad {
-               compatible = "amlogic, snd-vad";
-               #sound-dai-cells = <0>;
-
-               clocks = <&clkaudio CLKID_AUDIO_GATE_TOVAD
-                       &clkc CLKID_FCLK_DIV5
-                       &clkaudio CLKID_AUDIO_VAD>;
-               clock-names = "gate", "pll", "clk";
-
-               interrupts = <GIC_SPI 155 IRQ_TYPE_EDGE_RISING
-                               GIC_SPI 47 IRQ_TYPE_EDGE_RISING>;
-               interrupt-names = "irq_wakeup", "irq_frame_sync";
-
-               /*
-                * Data src sel:
-                * 0: tdmin_a;
-                * 1: tdmin_b;
-                * 2: tdmin_c;
-                * 3: spdifin;
-                * 4: pdmin;
-                * 5: loopback_b;
-                * 6: tdmin_lb;
-                * 7: loopback_a;
-                */
-               src = <4>;
-
-               /*
-                * deal with hot word in user space or kernel space
-                * 0: in user space
-                * 1: in kernel space
-                */
-               level = <1>;
-
-               status = "disabled";
-       };
-}; /* end of audiobus */
-
-&pinctrl_periphs {
-       /* audio pin mux */
-
-       tdma_mclk: tdma_mclk {
-               mux { /* GPIOZ_0 */
-                       groups = "mclk0_z";
-                       function = "mclk0";
-               };
-       };
-
-       tdmout_a: tdmout_a {
-               mux { /* GPIOZ_1, GPIOZ_2, GPIOZ_3 */
-                       groups = "tdma_sclk_z",
-                               "tdma_fs_z",
-                               "tdma_dout0_z";
-                       function = "tdma_out";
-                       bias-disable;
-               };
-       };
-
-       tdmin_a: tdmin_a {
-               mux { /* GPIOZ_9 */
-                       groups = "tdma_din2_z";
-                       function = "tdma_in";
-               };
-       };
-
-       tdmout_c: tdmout_c {
-               mux { /* GPIODV_7, GPIODV_8, GPIODV_9 */
-                       groups = "tdmc_sclk",
-                               "tdmc_fs",
-                               "tdmc_dout0";
-                       function = "tdmc_out";
-               };
-       };
-
-       tdmin_c: tdmin_c {
-               mux { /* GPIODV_10 */
-                       groups = "tdmc_din1";
-                       function = "tdmc_in";
-               };
-       };
-
-       spdifin_a: spdifin_a {
-               mux { /* GPIODV_5 */
-                       groups = "spdif_in";
-                       function = "spdif_in";
-               };
-       };
-
-       spdifout_a: spdifout_a {
-               mux { /* GPIODV_4 */
-                       groups = "spdif_out_dv4";
-                       function = "spdif_out";
-               };
-       };
-
-       spdifout_a_mute: spdifout_a_mute {
-               mux { /* GPIODV_4 */
-                       groups = "GPIODV_4";
-                       function = "gpio_periphs";
-               };
-       };
-
-       pdmin: pdmin {
-               mux { /* GPIOZ_7, GPIOZ_8, pdm_din2_z4 */
-                       groups = "pdm_dclk_z",
-                               "pdm_din0_z",
-                               "pdm_din2_z4";
-                       function = "pdm";
-               };
-       };
-
-
-}; /* end of pinctrl_periphs */
-
-&audio_data{
-       status = "okay";
-};
-
-&i2c2 {
-       status = "okay";
-       pinctrl-names="default";
-       pinctrl-0=<&i2c2_z_pins>;
-       clock-frequency = <400000>;
-
-       tas5805: tas5805@36 {
-               compatible = "ti,tas5805";
-               #sound-dai-cells = <0>;
-               codec_name = "tas5805";
-               reg = <0x2d>;
-               status = "disable";
-       };
-
-       ad82584f: ad82584f@62 {
-               compatible = "ESMT, ad82584f";
-               #sound-dai-cells = <0>;
-               reg = <0x31>;
-               status = "okay";
-               reset_pin = <&gpio_ao GPIOAO_6 0>;
-       };
-
-};
-
-&sd_emmc_c {
-       status = "okay";
-       emmc {
-               caps = "MMC_CAP_8_BIT_DATA",
-                        "MMC_CAP_MMC_HIGHSPEED",
-                        "MMC_CAP_SD_HIGHSPEED",
-                        "MMC_CAP_NONREMOVABLE",
-                       /* "MMC_CAP_1_8V_DDR", */
-                        "MMC_CAP_HW_RESET",
-                        "MMC_CAP_ERASE",
-                        "MMC_CAP_CMD23";
-               caps2 = "MMC_CAP2_HS200", "MMC_CAP2_HS400";
-               f_min = <400000>;
-               f_max = <198000000>;
-       };
-};
-
-&sd_emmc_b {
-       status = "okay";
-       sd {
-               caps = "MMC_CAP_4_BIT_DATA",
-                       "MMC_CAP_MMC_HIGHSPEED",
-                       "MMC_CAP_SD_HIGHSPEED",
-                       "MMC_CAP_NONREMOVABLE"; /**ptm debug */
-               f_min = <400000>;
-               f_max = <200000000>;
-       };
-};
-
-&spifc {
-       status = "disabled";
-       spi-nor@0 {
-               cs_gpios = <&gpio BOOT_13 GPIO_ACTIVE_HIGH>;
-       };
-};
-
-&slc_nand {
-       status = "disabled";
-       plat-names = "bootloader", "nandnormal";
-       plat-num = <2>;
-       plat-part-0 = <&bootloader>;
-       plat-part-1 = <&nandnormal>;
-       bootloader: bootloader{
-               enable_pad = "ce0";
-               busy_pad = "rb0";
-               timming_mode = "mode5";
-               bch_mode = "bch8_1k";
-               t_rea = <20>;
-               t_rhoh = <15>;
-               chip_num = <1>;
-               part_num = <0>;
-               rb_detect = <1>;
-       };
-       nandnormal: nandnormal{
-               enable_pad = "ce0";
-               busy_pad = "rb0";
-               timming_mode = "mode5";
-               bch_mode = "bch8_1k";
-               plane_mode = "twoplane";
-               t_rea = <20>;
-               t_rhoh = <15>;
-               chip_num = <2>;
-               part_num = <3>;
-               partition = <&nand_partitions>;
-               rb_detect = <1>;
-       };
-       nand_partitions:nand_partition{
-               /*
-                * if bl_mode is 1, tpl size was generate by
-                * fip_copies * fip_size which
-                * will not skip bad when calculating
-                * the partition size;
-                *
-                * if bl_mode is 0,
-                * tpl partition must be comment out.
-                */
-               tpl{
-                       offset=<0x0 0x0>;
-                       size=<0x0 0x0>;
-               };
-               logo{
-                       offset=<0x0 0x0>;
-                       size=<0x0 0x200000>;
-               };
-               recovery{
-                       offset=<0x0 0x0>;
-                       size=<0x0 0x1000000>;
-               };
-               boot{
-                       offset=<0x0 0x0>;
-                       size=<0x0 0x1000000>;
-               };
-               system{
-                       offset=<0x0 0x0>;
-                       size=<0x0 0x4000000>;
-               };
-               data{
-                       offset=<0xffffffff 0xffffffff>;
-                       size=<0x0 0x0>;
-               };
-       };
-};
-
-&ethmac {
-       status = "okay";
-       pinctrl-names = "internal_eth_pins";
-       pinctrl-0 = <&internal_eth_pins>;
-       mc_val = <0x4be04>;
-
-       internal_phy=<1>;
-};
-
-&uart_A {
-       status = "okay";
-};
-
-&dwc3 {
-       status = "okay";
-};
-
-&usb2_phy_v2 {
-       status = "okay";
-       portnum = <3>;
-};
-
-&usb3_phy_v2 {
-       status = "okay";
-       portnum = <0>;
-       otg = <0>;
-};
-
-&dwc2_a {
-       status = "okay";
-       /** 0: normal, 1: otg+dwc3 host only, 2: otg+dwc3 device only*/
-       controller-type = <1>;
-};
-
-&spicc0 {
-       status = "okay";
-       pinctrl-names = "default";
-       pinctrl-0 = <&spicc0_pins_h>;
-       cs-gpios = <&gpio GPIOH_20 0>;
-};
-
-&meson_fb {
-       status = "okay";
-       display_size_default = <1920 1080 1920 2160 32>;
-       mem_size = <0x00800000 0x1980000 0x100000 0x800000>;
-       logo_addr = "0x7f800000";
-       mem_alloc = <0>;
-       pxp_mode = <0>; /** 0:normal mode 1:pxp mode */
-};
-
-&pwm_AO_cd {
-       status = "okay";
-};
-
-&saradc {
-       status = "okay";
-};
-
-&pwm_ab {
-       status = "okay";
-};
-
-&efuse {
-       status = "okay";
-};
index 58383ab..d75eddb 100644 (file)
                compatible = "amlogic, axg-sound-card";
                aml-audio-card,name = "AML-AUGESOUND";
 
-               aml-audio-card,loopback = <&aml_loopback>;
-
                aml-audio-card,dai-link@0 {
                        format = "dsp_a";
                        mclk-fs = <512>;
                                sound-dai = <&aml_pdm>;
                        };
                        codec {
-                               /*
-                                * enable external loopback
-                                * and tlv320adc3101 as loopback
-                                */
-                               /*sound-dai = <&pdm_codec &tlv320adc3101_32>;*/
-                               /*
-                                * enable internal loopback
-                                * or disable loopback
-                                */
                                sound-dai = <&pdm_codec>;
                        };
                };
                                sound-dai = <&dummy_codec>;
                        };
                };
+
+               aml-audio-card,dai-link@5 {
+                       mclk-fs = <256>;
+                       continuous-clock;
+                       suffix-name = "alsaPORT-loopback";
+                       cpu {
+                               sound-dai = <&loopback>;
+                               system-clock-frequency = <12288000>;
+                       };
+                       codec {
+                               sound-dai = <&dummy_codec>;
+                       };
+               };
        };
+
        audiolocker: locker {
                compatible = "amlogic, audiolocker";
                clocks = <&clkaudio CLKID_AUDIO_LOCKER_OUT
                pinctrl-0 = <&tdmc_mclk &tdmout_c &tdmin_c>;
        };
 
+       tdmlb:tdm@3 {
+               compatible = "amlogic, axg-snd-tdmlb";
+               #sound-dai-cells = <0>;
+
+               dai-tdm-lane-lb-slot-mask-in = <1 0 0 0>;
+               dai-tdm-clk-sel = <1>;
+
+               clocks = <&clkaudio CLKID_AUDIO_MCLK_B
+                               &clkc CLKID_MPLL1>;
+               clock-names = "mclk", "clk_srcpll";
+
+               /*
+                * select tdmin_lb src;
+                * AXG
+                *  0: TDMOUTA
+                *  1: TDMOUTB
+                *  2: TDMOUTC
+                *  3: PAD_TDMINA
+                *  4: PAD_TDMINB
+                *  5: PAD_TDMINC
+                *
+                * G12A/G12B
+                *  0: TDMOUTA
+                *  1: TDMOUTB
+                *  2: TDMOUTC
+                *  3: PAD_TDMINA_DIN*
+                *  4: PAD_TDMINB_DIN*
+                *  5: PAD_TDMINC_DIN*
+                *  6: PAD_TDMINA_D*, oe pin
+                *  7: PAD_TDMINB_D*, oe pin
+                *
+                * TL1
+                *  0: TDMOUTA
+                *  1: TDMOUTB
+                *  2: TDMOUTC
+                *  3: PAD_TDMINA_DIN*
+                *  4: PAD_TDMINB_DIN*
+                *  5: PAD_TDMINC_DIN*
+                *  6: PAD_TDMINA_D*
+                *  7: PAD_TDMINB_D*
+                *  8: PAD_TDMINC_D*
+                *  9: HDMIRX_I2S
+                *  10: ACODEC_ADC
+                */
+               lb-src-sel = <1>;
+
+               status = "disabled";
+       };
+
        aml_spdif: spdif {
                compatible = "amlogic, axg-snd-spdif";
                #sound-dai-cells = <0>;
                status = "okay";
        };
 
-       aml_loopback: loopback {
-               compatible = "amlogic, snd-loopback";
-
-               /*
-                * external loopback clock config
-                * enable clk while pdm record data
-                */
-               /*clocks = <&clkc CLKID_MPLL1>;*/
-               /*clock-names = "datalb_mpll";*/
+       loopback:loopback@0 {
+               compatible = "amlogic, axg-loopback";
+               #sound-dai-cells = <0>;
 
-               /*
-                * 0: out rate = in data rate;
-                * 1: out rate = loopback data rate;
-                */
-               lb_mode = <0>;
+               clocks = <&clkaudio CLKID_AUDIO_PDM
+                       &clkc CLKID_FCLK_DIV3
+                       &clkc CLKID_MPLL3
+                       &clkaudio CLKID_AUDIO_PDMIN0
+                       &clkaudio CLKID_AUDIO_PDMIN1
+                       &clkc CLKID_MPLL0
+                       &clkaudio CLKID_AUDIO_MCLK_A>;
+               clock-names = "pdm_gate",
+                       "pdm_sysclk_srcpll",
+                       "pdm_dclk_srcpll",
+                       "pdm_dclk",
+                       "pdm_sysclk",
+                       "tdminlb_mpll",
+                       "tdminlb_mclk";
 
                /* datain src
                 * 0: tdmin_a;
                 * 4: pdmin;
                 */
                datain_src = <4>;
-               datain_chnum = <8>;
-               datain_chmask = <0x7f>;
+               datain_chnum = <6>;
+               datain_chmask = <0x3f>;
+               /* config which data pin for loopback */
+               datain-lane-mask-in = <1 1 1 0>;
+
+               /* calc mclk for datalb */
+               mclk-fs = <256>;
 
                /* tdmin_lb src
                 * 0: tdmoutA
                 * 1: tdmoutB
                 * 2: tdmoutC
-                * 3: PAD_tdminA
-                * 4: PAD_tdminB
-                * 5: PAD_tdminC
+                * 3: PAD_TDMINA_DIN*, refer to core pinmux
+                * 4: PAD_TDMINB_DIN*, refer to core pinmux
+                * 5: PAD_TDMINC_DIN*, refer to core pinmux
+                * 6: PAD_TDMINA_D*, oe, refer to core pinmux
+                * 7: PAD_TDMINB_D*, oe, refer to core pinmux
                 */
-
-               /*if tdmin_lb >= 3, use external loopback*/
+               /* if tdmin_lb >= 3, use external loopback */
                datalb_src = <2>;
                datalb_chnum = <2>;
-               /*config which data pin as loopback*/
-               /*datalb-lane-mask-in = <0 0 0 1>;*/
-               datalb_chmask = <0x1>;
-
+               datalb_chmask = <0x3>;
+               /* config which data pin as loopback */
+               datalb-lane-mask-in = <1 0 0 0>;
 
                status = "okay";
        };
index ee09047..d7ca51b 100644 (file)
                compatible = "amlogic, axg-sound-card";
                aml-audio-card,name = "AML-AUGESOUND";
 
-               aml-audio-card,loopback = <&aml_loopback>;
-
                aml-audio-card,hp-det-gpio = <&gpio GPIOZ_7 GPIO_ACTIVE_LOW>;
 
                aml-audio-card,dai-link@0 {
                                sound-dai = <&aml_pdm>;
                        };
                        codec {
-                               /*
-                                *enable external loopback
-                                *and tlv320adc3101 as loopback
-                                */
-                               /*sound-dai = <&pdm_codec &tlv320adc3101_32>;*/
-                               /*
-                                * enable internal loopback
-                                * or disable loopback
-                                */
                                sound-dai = <&pdm_codec>;
                        };
                };
                                sound-dai = <&dummy_codec>;
                        };
                };
+
+               aml-audio-card,dai-link@5 {
+                       mclk-fs = <256>;
+                       continuous-clock;
+                       suffix-name = "alsaPORT-loopback";
+                       cpu {
+                               sound-dai = <&loopback>;
+                               system-clock-frequency = <12288000>;
+                       };
+                       codec {
+                               sound-dai = <&dummy_codec>;
+                       };
+               };
        };
 
        bt-dev{
                pinctrl-0 = <&tdmc_mclk &tdmout_c &tdmin_c>;
        };
 
+       tdmlb:tdm@3 {
+               compatible = "amlogic, axg-snd-tdmlb";
+               #sound-dai-cells = <0>;
+
+               dai-tdm-lane-lb-slot-mask-in = <1 0 0 0>;
+               dai-tdm-clk-sel = <1>;
+
+               clocks = <&clkaudio CLKID_AUDIO_MCLK_B
+                               &clkc CLKID_MPLL1>;
+               clock-names = "mclk", "clk_srcpll";
+
+               /*
+                * select tdmin_lb src;
+                * AXG
+                *  0: TDMOUTA
+                *  1: TDMOUTB
+                *  2: TDMOUTC
+                *  3: PAD_TDMINA
+                *  4: PAD_TDMINB
+                *  5: PAD_TDMINC
+                *
+                * G12A/G12B
+                *  0: TDMOUTA
+                *  1: TDMOUTB
+                *  2: TDMOUTC
+                *  3: PAD_TDMINA_DIN*
+                *  4: PAD_TDMINB_DIN*
+                *  5: PAD_TDMINC_DIN*
+                *  6: PAD_TDMINA_D*, oe pin
+                *  7: PAD_TDMINB_D*, oe pin
+                *
+                * TL1
+                *  0: TDMOUTA
+                *  1: TDMOUTB
+                *  2: TDMOUTC
+                *  3: PAD_TDMINA_DIN*
+                *  4: PAD_TDMINB_DIN*
+                *  5: PAD_TDMINC_DIN*
+                *  6: PAD_TDMINA_D*
+                *  7: PAD_TDMINB_D*
+                *  8: PAD_TDMINC_D*
+                *  9: HDMIRX_I2S
+                *  10: ACODEC_ADC
+                */
+               lb-src-sel = <1>;
+
+               status = "disabled";
+       };
+
        aml_spdif: spdif {
                compatible = "amlogic, axg-snd-spdif";
                #sound-dai-cells = <0>;
                status = "okay";
        };
 
-       aml_loopback: loopback {
-               compatible = "amlogic, snd-loopback";
-
-               /*
-                * external loopback clock config
-                * enable clk while pdm record data
-                */
-               /*clocks = <&clkc CLKID_MPLL1>;*/
-               /*clock-names = "datalb_mpll";*/
-
-               /*
-                * 0: out rate = in data rate;
-                * 1: out rate = loopback data rate;
-                */
+       loopback:loopback@0 {
+               compatible = "amlogic, axg-loopback";
+               #sound-dai-cells = <0>;
 
-               lb_mode = <0>;
+               clocks = <&clkaudio CLKID_AUDIO_PDM
+                       &clkc CLKID_FCLK_DIV3
+                       &clkc CLKID_MPLL3
+                       &clkaudio CLKID_AUDIO_PDMIN0
+                       &clkaudio CLKID_AUDIO_PDMIN1
+                       &clkc CLKID_MPLL0
+                       &clkaudio CLKID_AUDIO_MCLK_A>;
+               clock-names = "pdm_gate",
+                       "pdm_sysclk_srcpll",
+                       "pdm_dclk_srcpll",
+                       "pdm_dclk",
+                       "pdm_sysclk",
+                       "tdminlb_mpll",
+                       "tdminlb_mclk";
 
                /* datain src
                 * 0: tdmin_a;
                 * 4: pdmin;
                 */
                datain_src = <4>;
-               datain_chnum = <8>;
-               datain_chmask = <0x7f>;
+               datain_chnum = <6>;
+               datain_chmask = <0x3f>;
+               /* config which data pin for loopback */
+               datain-lane-mask-in = <1 1 1 0>;
+
+               /* calc mclk for datalb */
+               mclk-fs = <256>;
 
                /* tdmin_lb src
                 * 0: tdmoutA
                 * 1: tdmoutB
                 * 2: tdmoutC
-                * 3: PAD_tdminA
-                * 4: PAD_tdminB
-                * 5: PAD_tdminC
+                * 3: PAD_TDMINA_DIN*, refer to core pinmux
+                * 4: PAD_TDMINB_DIN*, refer to core pinmux
+                * 5: PAD_TDMINC_DIN*, refer to core pinmux
+                * 6: PAD_TDMINA_D*, oe, refer to core pinmux
+                * 7: PAD_TDMINB_D*, oe, refer to core pinmux
                 */
-
-               /*if tdmin_lb >= 3, use external loopback*/
+               /* if tdmin_lb >= 3, use external loopback */
                datalb_src = <2>;
                datalb_chnum = <2>;
-               /*config which data pin as loopback*/
-               /*datalb-lane-mask-in = <0 0 0 1>;*/
-               datalb_chmask = <0x1>;
+               datalb_chmask = <0x3>;
+               /* config which data pin as loopback */
+               datalb-lane-mask-in = <1 0 0 0>;
 
                status = "okay";
        };
index 39c733f..ef1c95a 100644 (file)
                compatible = "amlogic, axg-sound-card";
                aml-audio-card,name = "AML-AUGESOUND";
 
-               aml-audio-card,loopback = <&aml_loopback>;
-
                aml-audio-card,hp-det-gpio = <&gpio GPIOZ_7 GPIO_ACTIVE_LOW>;
 
                aml-audio-card,dai-link@0 {
                                sound-dai = <&aml_pdm>;
                        };
                        codec {
-                               /*
-                                *enable external loopback
-                                *and tlv320adc3101 as loopback
-                                */
-                               /*sound-dai = <&pdm_codec &tlv320adc3101_32>;*/
-                               /*
-                                * enable internal loopback
-                                * or disable loopback
-                                */
                                sound-dai = <&pdm_codec>;
                        };
                };
                                sound-dai = <&dummy_codec>;
                        };
                };
+
+               aml-audio-card,dai-link@5 {
+                       mclk-fs = <256>;
+                       continuous-clock;
+                       suffix-name = "alsaPORT-loopback";
+                       cpu {
+                               sound-dai = <&loopback>;
+                               system-clock-frequency = <12288000>;
+                       };
+                       codec {
+                               sound-dai = <&dummy_codec>;
+                       };
+               };
        };
 
        bt-dev{
                pinctrl-0 = <&tdmc_mclk &tdmout_c &tdmin_c>;
        };
 
+       tdmlb:tdm@3 {
+               compatible = "amlogic, axg-snd-tdmlb";
+               #sound-dai-cells = <0>;
+
+               dai-tdm-lane-lb-slot-mask-in = <1 0 0 0>;
+               dai-tdm-clk-sel = <1>;
+
+               clocks = <&clkaudio CLKID_AUDIO_MCLK_B
+                               &clkc CLKID_MPLL1>;
+               clock-names = "mclk", "clk_srcpll";
+
+               /*
+                * select tdmin_lb src;
+                * AXG
+                *  0: TDMOUTA
+                *  1: TDMOUTB
+                *  2: TDMOUTC
+                *  3: PAD_TDMINA
+                *  4: PAD_TDMINB
+                *  5: PAD_TDMINC
+                *
+                * G12A/G12B
+                *  0: TDMOUTA
+                *  1: TDMOUTB
+                *  2: TDMOUTC
+                *  3: PAD_TDMINA_DIN*
+                *  4: PAD_TDMINB_DIN*
+                *  5: PAD_TDMINC_DIN*
+                *  6: PAD_TDMINA_D*, oe pin
+                *  7: PAD_TDMINB_D*, oe pin
+                *
+                * TL1
+                *  0: TDMOUTA
+                *  1: TDMOUTB
+                *  2: TDMOUTC
+                *  3: PAD_TDMINA_DIN*
+                *  4: PAD_TDMINB_DIN*
+                *  5: PAD_TDMINC_DIN*
+                *  6: PAD_TDMINA_D*
+                *  7: PAD_TDMINB_D*
+                *  8: PAD_TDMINC_D*
+                *  9: HDMIRX_I2S
+                *  10: ACODEC_ADC
+                */
+               lb-src-sel = <1>;
+
+               status = "disabled";
+       };
+
        aml_spdif: spdif {
                compatible = "amlogic, axg-snd-spdif";
                #sound-dai-cells = <0>;
                status = "okay";
        };
 
-       aml_loopback: loopback {
-               compatible = "amlogic, snd-loopback";
-
-               /*
-                * external loopback clock config
-                * enable clk while pdm record data
-                */
-               /*clocks = <&clkc CLKID_MPLL1>;*/
-               /*clock-names = "datalb_mpll";*/
-
-               /*
-                * 0: out rate = in data rate;
-                * 1: out rate = loopback data rate;
-                */
+       loopback:loopback@0 {
+               compatible = "amlogic, axg-loopback";
+               #sound-dai-cells = <0>;
 
-               lb_mode = <0>;
+               clocks = <&clkaudio CLKID_AUDIO_PDM
+                       &clkc CLKID_FCLK_DIV3
+                       &clkc CLKID_MPLL3
+                       &clkaudio CLKID_AUDIO_PDMIN0
+                       &clkaudio CLKID_AUDIO_PDMIN1
+                       &clkc CLKID_MPLL0
+                       &clkaudio CLKID_AUDIO_MCLK_A>;
+               clock-names = "pdm_gate",
+                       "pdm_sysclk_srcpll",
+                       "pdm_dclk_srcpll",
+                       "pdm_dclk",
+                       "pdm_sysclk",
+                       "tdminlb_mpll",
+                       "tdminlb_mclk";
 
                /* datain src
                 * 0: tdmin_a;
                 * 4: pdmin;
                 */
                datain_src = <4>;
-               datain_chnum = <4>;
-               datain_chmask = <0x3>;
+               datain_chnum = <6>;
+               datain_chmask = <0x3f>;
+               /* config which data pin for loopback */
+               datain-lane-mask-in = <1 1 1 0>;
+
+               /* calc mclk for datalb */
+               mclk-fs = <256>;
 
                /* tdmin_lb src
                 * 0: tdmoutA
                 * 1: tdmoutB
                 * 2: tdmoutC
-                * 3: PAD_tdminA
-                * 4: PAD_tdminB
-                * 5: PAD_tdminC
+                * 3: PAD_TDMINA_DIN*, refer to core pinmux
+                * 4: PAD_TDMINB_DIN*, refer to core pinmux
+                * 5: PAD_TDMINC_DIN*, refer to core pinmux
+                * 6: PAD_TDMINA_D*, oe, refer to core pinmux
+                * 7: PAD_TDMINB_D*, oe, refer to core pinmux
                 */
-
-               /*if tdmin_lb >= 3, use external loopback*/
+               /* if tdmin_lb >= 3, use external loopback */
                datalb_src = <2>;
                datalb_chnum = <2>;
-               /*config which data pin as loopback*/
-               /*datalb-lane-mask-in = <0 0 0 1>;*/
                datalb_chmask = <0x3>;
+               /* config which data pin as loopback */
+               datalb-lane-mask-in = <1 0 0 0>;
 
                status = "okay";
        };
index 79b4d42..082717a 100644 (file)
                compatible = "amlogic, axg-sound-card";
                aml-audio-card,name = "AML-AUGESOUND";
 
-               aml-audio-card,loopback = <&aml_loopback>;
-
                aml-audio-card,hp-det-gpio = <&gpio GPIOZ_7 GPIO_ACTIVE_LOW>;
 
                aml-audio-card,dai-link@0 {
                                sound-dai = <&aml_pdm>;
                        };
                        codec {
-                               /*
-                                *enable external loopback
-                                *and tlv320adc3101 as loopback
-                                */
-                               /*sound-dai = <&pdm_codec &tlv320adc3101_32>;*/
-                               /*
-                                * enable internal loopback
-                                * or disable loopback
-                                */
                                sound-dai = <&pdm_codec>;
                        };
                };
                                sound-dai = <&dummy_codec>;
                        };
                };
+
+               aml-audio-card,dai-link@5 {
+                       mclk-fs = <256>;
+                       continuous-clock;
+                       suffix-name = "alsaPORT-loopback";
+                       cpu {
+                               sound-dai = <&loopback>;
+                               system-clock-frequency = <12288000>;
+                       };
+                       codec {
+                               sound-dai = <&dummy_codec>;
+                       };
+               };
        };
 
        bt-dev{
                pinctrl-0 = <&tdmc_mclk &tdmout_c>;
        };
 
+       tdmlb:tdm@3 {
+               compatible = "amlogic, axg-snd-tdmlb";
+               #sound-dai-cells = <0>;
+
+               dai-tdm-lane-lb-slot-mask-in = <1 0 0 0>;
+               dai-tdm-clk-sel = <1>;
+
+               clocks = <&clkaudio CLKID_AUDIO_MCLK_B
+                               &clkc CLKID_MPLL1>;
+               clock-names = "mclk", "clk_srcpll";
+
+               /*
+                * select tdmin_lb src;
+                * AXG
+                *  0: TDMOUTA
+                *  1: TDMOUTB
+                *  2: TDMOUTC
+                *  3: PAD_TDMINA
+                *  4: PAD_TDMINB
+                *  5: PAD_TDMINC
+                *
+                * G12A/G12B
+                *  0: TDMOUTA
+                *  1: TDMOUTB
+                *  2: TDMOUTC
+                *  3: PAD_TDMINA_DIN*
+                *  4: PAD_TDMINB_DIN*
+                *  5: PAD_TDMINC_DIN*
+                *  6: PAD_TDMINA_D*, oe pin
+                *  7: PAD_TDMINB_D*, oe pin
+                *
+                * TL1
+                *  0: TDMOUTA
+                *  1: TDMOUTB
+                *  2: TDMOUTC
+                *  3: PAD_TDMINA_DIN*
+                *  4: PAD_TDMINB_DIN*
+                *  5: PAD_TDMINC_DIN*
+                *  6: PAD_TDMINA_D*
+                *  7: PAD_TDMINB_D*
+                *  8: PAD_TDMINC_D*
+                *  9: HDMIRX_I2S
+                *  10: ACODEC_ADC
+                */
+               lb-src-sel = <1>;
+
+               status = "disabled";
+       };
+
        aml_spdif: spdif {
                compatible = "amlogic, axg-snd-spdif";
                #sound-dai-cells = <0>;
                status = "okay";
        };
 
-       aml_loopback: loopback {
-               compatible = "amlogic, snd-loopback";
-
-               /*
-                * external loopback clock config
-                * enable clk while pdm record data
-                */
-               /*clocks = <&clkc CLKID_MPLL1>;*/
-               /*clock-names = "datalb_mpll";*/
-
-               /*
-                * 0: out rate = in data rate;
-                * 1: out rate = loopback data rate;
-                */
+       loopback:loopback@0 {
+               compatible = "amlogic, axg-loopback";
+               #sound-dai-cells = <0>;
 
-               lb_mode = <0>;
+               clocks = <&clkaudio CLKID_AUDIO_PDM
+                       &clkc CLKID_FCLK_DIV3
+                       &clkc CLKID_MPLL3
+                       &clkaudio CLKID_AUDIO_PDMIN0
+                       &clkaudio CLKID_AUDIO_PDMIN1
+                       &clkc CLKID_MPLL0
+                       &clkaudio CLKID_AUDIO_MCLK_A>;
+               clock-names = "pdm_gate",
+                       "pdm_sysclk_srcpll",
+                       "pdm_dclk_srcpll",
+                       "pdm_dclk",
+                       "pdm_sysclk",
+                       "tdminlb_mpll",
+                       "tdminlb_mclk";
 
                /* datain src
                 * 0: tdmin_a;
                 * 4: pdmin;
                 */
                datain_src = <4>;
-               datain_chnum = <8>;
-               datain_chmask = <0x7f>;
+               datain_chnum = <6>;
+               datain_chmask = <0x3f>;
+               /* config which data pin for loopback */
+               datain-lane-mask-in = <1 1 1 0>;
+
+               /* calc mclk for datalb */
+               mclk-fs = <256>;
 
                /* tdmin_lb src
                 * 0: tdmoutA
                 * 1: tdmoutB
                 * 2: tdmoutC
-                * 3: PAD_tdminA
-                * 4: PAD_tdminB
-                * 5: PAD_tdminC
+                * 3: PAD_TDMINA_DIN*, refer to core pinmux
+                * 4: PAD_TDMINB_DIN*, refer to core pinmux
+                * 5: PAD_TDMINC_DIN*, refer to core pinmux
+                * 6: PAD_TDMINA_D*, oe, refer to core pinmux
+                * 7: PAD_TDMINB_D*, oe, refer to core pinmux
                 */
-
-               /*if tdmin_lb >= 3, use external loopback*/
+               /* if tdmin_lb >= 3, use external loopback */
                datalb_src = <2>;
                datalb_chnum = <2>;
-               /*config which data pin as loopback*/
-               /*datalb-lane-mask-in = <0 0 0 1>;*/
-               datalb_chmask = <0x1>;
+               datalb_chmask = <0x3>;
+               /* config which data pin as loopback */
+               datalb-lane-mask-in = <1 0 0 0>;
 
                status = "okay";
        };
index 445b849..b68fbcc 100644 (file)
                compatible = "amlogic, axg-sound-card";
                aml-audio-card,name = "AML-AUGESOUND";
 
-               aml-audio-card,loopback = <&aml_loopback>;
-
                aml-audio-card,dai-link@0 {
                        format = "dsp_a";
                        mclk-fs = <512>;
                                sound-dai = <&aml_pdm>;
                        };
                        codec {
-                               /*
-                                *enable external loopback
-                                *and tlv320adc3101 as loopback
-                                */
-                               /*sound-dai = <&pdm_codec &tlv320adc3101_32>;*/
-                               /*
-                                * enable internal loopback
-                                * or disable loopback
-                                */
                                sound-dai = <&pdm_codec>;
                        };
                };
                                sound-dai = <&dummy_codec>;
                        };
                };
+
+               aml-audio-card,dai-link@5 {
+                       mclk-fs = <256>;
+                       continuous-clock;
+                       suffix-name = "alsaPORT-loopback";
+                       cpu {
+                               sound-dai = <&loopback>;
+                               system-clock-frequency = <12288000>;
+                       };
+                       codec {
+                               sound-dai = <&dummy_codec>;
+                       };
+               };
        };
 
        bt-dev{
                pinctrl-0 = <&tdmc_mclk &tdmout_c &tdmin_c>;
        };
 
+       tdmlb:tdm@3 {
+               compatible = "amlogic, axg-snd-tdmlb";
+               #sound-dai-cells = <0>;
+
+               dai-tdm-lane-lb-slot-mask-in = <1 0 0 0>;
+               dai-tdm-clk-sel = <1>;
+
+               clocks = <&clkaudio CLKID_AUDIO_MCLK_B
+                               &clkc CLKID_MPLL1>;
+               clock-names = "mclk", "clk_srcpll";
+
+               /*
+                * select tdmin_lb src;
+                * AXG
+                *  0: TDMOUTA
+                *  1: TDMOUTB
+                *  2: TDMOUTC
+                *  3: PAD_TDMINA
+                *  4: PAD_TDMINB
+                *  5: PAD_TDMINC
+                *
+                * G12A/G12B
+                *  0: TDMOUTA
+                *  1: TDMOUTB
+                *  2: TDMOUTC
+                *  3: PAD_TDMINA_DIN*
+                *  4: PAD_TDMINB_DIN*
+                *  5: PAD_TDMINC_DIN*
+                *  6: PAD_TDMINA_D*, oe pin
+                *  7: PAD_TDMINB_D*, oe pin
+                *
+                * TL1
+                *  0: TDMOUTA
+                *  1: TDMOUTB
+                *  2: TDMOUTC
+                *  3: PAD_TDMINA_DIN*
+                *  4: PAD_TDMINB_DIN*
+                *  5: PAD_TDMINC_DIN*
+                *  6: PAD_TDMINA_D*
+                *  7: PAD_TDMINB_D*
+                *  8: PAD_TDMINC_D*
+                *  9: HDMIRX_I2S
+                *  10: ACODEC_ADC
+                */
+               lb-src-sel = <1>;
+
+               status = "disabled";
+       };
+
        aml_spdif: spdif {
                compatible = "amlogic, axg-snd-spdif";
                #sound-dai-cells = <0>;
                status = "okay";
        };
 
-       aml_loopback: loopback {
-               compatible = "amlogic, snd-loopback";
-               /*
-                * external loopback clock config
-                * enable clk while pdm record data
-                */
-               /*clocks = <&clkc CLKID_MPLL1>;*/
-               /*clock-names = "datalb_mpll";*/
+       loopback:loopback@0 {
+               compatible = "amlogic, axg-loopback";
+               #sound-dai-cells = <0>;
 
-               /*
-                * 0: out rate = in data rate;
-                * 1: out rate = loopback data rate;
-                */
-               lb_mode = <0>;
+               clocks = <&clkaudio CLKID_AUDIO_PDM
+                       &clkc CLKID_FCLK_DIV3
+                       &clkc CLKID_MPLL3
+                       &clkaudio CLKID_AUDIO_PDMIN0
+                       &clkaudio CLKID_AUDIO_PDMIN1
+                       &clkc CLKID_MPLL0
+                       &clkaudio CLKID_AUDIO_MCLK_A>;
+               clock-names = "pdm_gate",
+                       "pdm_sysclk_srcpll",
+                       "pdm_dclk_srcpll",
+                       "pdm_dclk",
+                       "pdm_sysclk",
+                       "tdminlb_mpll",
+                       "tdminlb_mclk";
 
                /* datain src
                 * 0: tdmin_a;
                 * 4: pdmin;
                 */
                datain_src = <4>;
-               datain_chnum = <8>;
-               datain_chmask = <0x7f>;
+               datain_chnum = <6>;
+               datain_chmask = <0x3f>;
+               /* config which data pin for loopback */
+               datain-lane-mask-in = <1 1 1 0>;
+
+               /* calc mclk for datalb */
+               mclk-fs = <256>;
 
                /* tdmin_lb src
                 * 0: tdmoutA
                 * 1: tdmoutB
                 * 2: tdmoutC
-                * 3: PAD_tdminA
-                * 4: PAD_tdminB
-                * 5: PAD_tdminC
+                * 3: PAD_TDMINA_DIN*, refer to core pinmux
+                * 4: PAD_TDMINB_DIN*, refer to core pinmux
+                * 5: PAD_TDMINC_DIN*, refer to core pinmux
+                * 6: PAD_TDMINA_D*, oe, refer to core pinmux
+                * 7: PAD_TDMINB_D*, oe, refer to core pinmux
                 */
-               /*if tdmin_lb >= 3, use external loopback*/
+               /* if tdmin_lb >= 3, use external loopback */
                datalb_src = <2>;
                datalb_chnum = <2>;
-               /*config which data pin as loopback*/
-               /*datalb-lane-mask-in = <0 0 0 1>;*/
-               datalb_chmask = <0x1>;
+               datalb_chmask = <0x3>;
+               /* config which data pin as loopback */
+               datalb-lane-mask-in = <1 0 0 0>;
 
                status = "okay";
        };
index 6f1c708..4e9e0a2 100644 (file)
                compatible = "amlogic, axg-sound-card";
                aml-audio-card,name = "AML-AUGESOUND";
 
-               aml-audio-card,loopback = <&aml_loopback>;
-
                aml-audio-card,dai-link@0 {
                        format = "dsp_a";
                        mclk-fs = <256>;//512
                                sound-dai = <&aml_pdm>;
                        };
                        codec {
-                               /*
-                                *enable external loopback
-                                *and tlv320adc3101 as loopback
-                                */
-                               /*sound-dai = <&pdm_codec &tlv320adc3101_32>;*/
-                               /*
-                                * enable internal loopback
-                                * or disable loopback
-                                */
                                sound-dai = <&pdm_codec>;
                        };
                };
                                sound-dai = <&dummy_codec>;
                        };
                };
+
+               aml-audio-card,dai-link@5 {
+                       mclk-fs = <256>;
+                       continuous-clock;
+                       suffix-name = "alsaPORT-loopback";
+                       cpu {
+                               sound-dai = <&loopback>;
+                               system-clock-frequency = <12288000>;
+                       };
+                       codec {
+                               sound-dai = <&dummy_codec>;
+                       };
+               };
        };
 
        bt-dev{
                pinctrl-0 = <&tdmc_mclk &tdmout_c &tdmin_c>;
        };
 
+       tdmlb:tdm@3 {
+               compatible = "amlogic, axg-snd-tdmlb";
+               #sound-dai-cells = <0>;
+
+               dai-tdm-lane-lb-slot-mask-in = <1 0 0 0>;
+               dai-tdm-clk-sel = <1>;
+
+               clocks = <&clkaudio CLKID_AUDIO_MCLK_B
+                               &clkc CLKID_MPLL1>;
+               clock-names = "mclk", "clk_srcpll";
+
+               /*
+                * select tdmin_lb src;
+                * AXG
+                *  0: TDMOUTA
+                *  1: TDMOUTB
+                *  2: TDMOUTC
+                *  3: PAD_TDMINA
+                *  4: PAD_TDMINB
+                *  5: PAD_TDMINC
+                *
+                * G12A/G12B
+                *  0: TDMOUTA
+                *  1: TDMOUTB
+                *  2: TDMOUTC
+                *  3: PAD_TDMINA_DIN*
+                *  4: PAD_TDMINB_DIN*
+                *  5: PAD_TDMINC_DIN*
+                *  6: PAD_TDMINA_D*, oe pin
+                *  7: PAD_TDMINB_D*, oe pin
+                *
+                * TL1
+                *  0: TDMOUTA
+                *  1: TDMOUTB
+                *  2: TDMOUTC
+                *  3: PAD_TDMINA_DIN*
+                *  4: PAD_TDMINB_DIN*
+                *  5: PAD_TDMINC_DIN*
+                *  6: PAD_TDMINA_D*
+                *  7: PAD_TDMINB_D*
+                *  8: PAD_TDMINC_D*
+                *  9: HDMIRX_I2S
+                *  10: ACODEC_ADC
+                */
+               lb-src-sel = <1>;
+
+               status = "disabled";
+       };
+
        aml_spdif: spdif {
                compatible = "amlogic, axg-snd-spdif";
                #sound-dai-cells = <0>;
                status = "okay";
        };
 
-       aml_loopback: loopback {
-               compatible = "amlogic, snd-loopback";
-               /*
-                * external loopback clk config
-                * enable clk while pdm record data
-                */
-               /*clocks = <&clkc CLKID_MPLL1>;*/
-               /*clock-names = "datalb_mpll";*/
+       loopback:loopback@0 {
+               compatible = "amlogic, axg-loopback";
+               #sound-dai-cells = <0>;
 
-               /*
-                * 0: out rate = in data rate;
-                * 1: out rate = loopback data rate;
-                */
-               lb_mode = <0>;
+               clocks = <&clkaudio CLKID_AUDIO_PDM
+                       &clkc CLKID_FCLK_DIV3
+                       &clkc CLKID_MPLL3
+                       &clkaudio CLKID_AUDIO_PDMIN0
+                       &clkaudio CLKID_AUDIO_PDMIN1
+                       &clkc CLKID_MPLL0
+                       &clkaudio CLKID_AUDIO_MCLK_A>;
+               clock-names = "pdm_gate",
+                       "pdm_sysclk_srcpll",
+                       "pdm_dclk_srcpll",
+                       "pdm_dclk",
+                       "pdm_sysclk",
+                       "tdminlb_mpll",
+                       "tdminlb_mclk";
 
                /* datain src
                 * 0: tdmin_a;
                 * 4: pdmin;
                 */
                datain_src = <4>;
-               datain_chnum = <8>;
-               datain_chmask = <0x7f>;
+               datain_chnum = <6>;
+               datain_chmask = <0x3f>;
+               /* config which data pin for loopback */
+               datain-lane-mask-in = <1 1 1 0>;
+
+               /* calc mclk for datalb */
+               mclk-fs = <256>;
 
                /* tdmin_lb src
                 * 0: tdmoutA
                 * 1: tdmoutB
                 * 2: tdmoutC
-                * 3: PAD_tdminA
-                * 4: PAD_tdminB
-                * 5: PAD_tdminC
+                * 3: PAD_TDMINA_DIN*, refer to core pinmux
+                * 4: PAD_TDMINB_DIN*, refer to core pinmux
+                * 5: PAD_TDMINC_DIN*, refer to core pinmux
+                * 6: PAD_TDMINA_D*, oe, refer to core pinmux
+                * 7: PAD_TDMINB_D*, oe, refer to core pinmux
                 */
-               /*if tdmin_lb >= 3, use external loopback*/
-               datalb_src = <1>;
+               /* if tdmin_lb >= 3, use external loopback */
+               datalb_src = <2>;
                datalb_chnum = <2>;
-               /*config which data pin as loopback*/
-               /*datalb-lane-mask-in = <0 1>;*/
-               datalb_chmask = <0x1>;
+               datalb_chmask = <0x3>;
+               /* config which data pin as loopback */
+               datalb-lane-mask-in = <1 0 0 0>;
 
                status = "okay";
        };
index c5232e1..59892ab 100644 (file)
                compatible = "amlogic, axg-sound-card";
                aml-audio-card,name = "AML-AUGESOUND";
 
-               aml-audio-card,loopback = <&aml_loopback>;
-
                aml-audio-card,dai-link@0 {
                        format = "dsp_a";
                        mclk-fs = <256>;//512
                                sound-dai = <&aml_pdm>;
                        };
                        codec {
-                               /*
-                                *enable external loopback
-                                *and tlv320adc3101 as loopback
-                                */
-                               /*sound-dai = <&pdm_codec &tlv320adc3101_32>;*/
-                               /*
-                                * enable internal loopback
-                                * or disable loopback
-                                */
                                sound-dai = <&pdm_codec>;
                        };
                };
                                sound-dai = <&dummy_codec>;
                        };
                };
+
+               aml-audio-card,dai-link@5 {
+                       mclk-fs = <256>;
+                       continuous-clock;
+                       suffix-name = "alsaPORT-loopback";
+                       cpu {
+                               sound-dai = <&loopback>;
+                               system-clock-frequency = <12288000>;
+                       };
+                       codec {
+                               sound-dai = <&dummy_codec>;
+                       };
+               };
        };
 
        bt-dev{
                pinctrl-0 = <&tdmc_mclk &tdmout_c &tdmin_c>;
        };
 
+       tdmlb:tdm@3 {
+               compatible = "amlogic, axg-snd-tdmlb";
+               #sound-dai-cells = <0>;
+
+               dai-tdm-lane-lb-slot-mask-in = <1 0 0 0>;
+               dai-tdm-clk-sel = <1>;
+
+               clocks = <&clkaudio CLKID_AUDIO_MCLK_B
+                               &clkc CLKID_MPLL1>;
+               clock-names = "mclk", "clk_srcpll";
+
+               /*
+                * select tdmin_lb src;
+                * AXG
+                *  0: TDMOUTA
+                *  1: TDMOUTB
+                *  2: TDMOUTC
+                *  3: PAD_TDMINA
+                *  4: PAD_TDMINB
+                *  5: PAD_TDMINC
+                *
+                * G12A/G12B
+                *  0: TDMOUTA
+                *  1: TDMOUTB
+                *  2: TDMOUTC
+                *  3: PAD_TDMINA_DIN*
+                *  4: PAD_TDMINB_DIN*
+                *  5: PAD_TDMINC_DIN*
+                *  6: PAD_TDMINA_D*, oe pin
+                *  7: PAD_TDMINB_D*, oe pin
+                *
+                * TL1
+                *  0: TDMOUTA
+                *  1: TDMOUTB
+                *  2: TDMOUTC
+                *  3: PAD_TDMINA_DIN*
+                *  4: PAD_TDMINB_DIN*
+                *  5: PAD_TDMINC_DIN*
+                *  6: PAD_TDMINA_D*
+                *  7: PAD_TDMINB_D*
+                *  8: PAD_TDMINC_D*
+                *  9: HDMIRX_I2S
+                *  10: ACODEC_ADC
+                */
+               lb-src-sel = <1>;
+
+               status = "disabled";
+       };
+
        aml_spdif: spdif {
                compatible = "amlogic, axg-snd-spdif";
                #sound-dai-cells = <0>;
                status = "okay";
        };
 
-       aml_loopback: loopback {
-               compatible = "amlogic, snd-loopback";
-               /*
-                * external loopback clk config
-                * enable clk while pdm record data
-                */
-               /*clocks = <&clkc CLKID_MPLL1>;*/
-               /*clock-names = "datalb_mpll";*/
-               /*
-                * 0: out rate = in data rate;
-                * 1: out rate = loopback data rate;
-                */
-               lb_mode = <0>;
+       loopback:loopback@0 {
+               compatible = "amlogic, axg-loopback";
+               #sound-dai-cells = <0>;
+
+               clocks = <&clkaudio CLKID_AUDIO_PDM
+                       &clkc CLKID_FCLK_DIV3
+                       &clkc CLKID_MPLL3
+                       &clkaudio CLKID_AUDIO_PDMIN0
+                       &clkaudio CLKID_AUDIO_PDMIN1
+                       &clkc CLKID_MPLL0
+                       &clkaudio CLKID_AUDIO_MCLK_A>;
+               clock-names = "pdm_gate",
+                       "pdm_sysclk_srcpll",
+                       "pdm_dclk_srcpll",
+                       "pdm_dclk",
+                       "pdm_sysclk",
+                       "tdminlb_mpll",
+                       "tdminlb_mclk";
 
                /* datain src
                 * 0: tdmin_a;
                 * 4: pdmin;
                 */
                datain_src = <4>;
-               datain_chnum = <8>;
-               datain_chmask = <0x7f>;
+               datain_chnum = <6>;
+               datain_chmask = <0x3f>;
+               /* config which data pin for loopback */
+               datain-lane-mask-in = <1 1 1 0>;
+
+               /* calc mclk for datalb */
+               mclk-fs = <256>;
 
                /* tdmin_lb src
                 * 0: tdmoutA
                 * 1: tdmoutB
                 * 2: tdmoutC
-                * 3: PAD_tdminA
-                * 4: PAD_tdminB
-                * 5: PAD_tdminC
+                * 3: PAD_TDMINA_DIN*, refer to core pinmux
+                * 4: PAD_TDMINB_DIN*, refer to core pinmux
+                * 5: PAD_TDMINC_DIN*, refer to core pinmux
+                * 6: PAD_TDMINA_D*, oe, refer to core pinmux
+                * 7: PAD_TDMINB_D*, oe, refer to core pinmux
                 */
-               /*if tdmin_lb >= 3, use external loopback*/
+               /* if tdmin_lb >= 3, use external loopback */
                datalb_src = <2>;
                datalb_chnum = <2>;
-               /*config which data pin as loopback*/
-               /*datalb-lane-mask-in = <0 1>;*/
-               datalb_chmask = <0x1>;
+               datalb_chmask = <0x3>;
+               /* config which data pin as loopback */
+               datalb-lane-mask-in = <1 0 0 0>;
 
                status = "okay";
        };
index 6033259..a74b896 100644 (file)
                compatible = "amlogic, axg-sound-card";
                aml-audio-card,name = "AML-AUGESOUND";
 
-               aml-audio-card,loopback = <&aml_loopback>;
-
                aml-audio-card,hp-det-gpio = <&gpio GPIOZ_7 GPIO_ACTIVE_LOW>;
 
                aml-audio-card,dai-link@0 {
                                sound-dai = <&aml_pdm>;
                        };
                        codec {
-                               /*
-                                *enable external loopback
-                                *and tlv320adc3101 as loopback
-                                */
-                               /*sound-dai = <&pdm_codec &tlv320adc3101_32>;*/
-                               /*
-                                * enable internal loopback
-                                * or disable loopback
-                                */
                                sound-dai = <&pdm_codec>;
                        };
                };
                                sound-dai = <&dummy_codec>;
                        };
                };
+
+               aml-audio-card,dai-link@5 {
+                       mclk-fs = <256>;
+                       continuous-clock;
+                       suffix-name = "alsaPORT-loopback";
+                       cpu {
+                               sound-dai = <&loopback>;
+                               system-clock-frequency = <12288000>;
+                       };
+                       codec {
+                               sound-dai = <&dummy_codec>;
+                       };
+               };
        };
 
        bt-dev{
                pinctrl-0 = <&tdmc_mclk &tdmout_c &tdmin_c>;
        };
 
+       tdmlb:tdm@3 {
+               compatible = "amlogic, axg-snd-tdmlb";
+               #sound-dai-cells = <0>;
+
+               dai-tdm-lane-lb-slot-mask-in = <1 0 0 0>;
+               dai-tdm-clk-sel = <1>;
+
+               clocks = <&clkaudio CLKID_AUDIO_MCLK_B
+                               &clkc CLKID_MPLL1>;
+               clock-names = "mclk", "clk_srcpll";
+
+               /*
+                * select tdmin_lb src;
+                * AXG
+                *  0: TDMOUTA
+                *  1: TDMOUTB
+                *  2: TDMOUTC
+                *  3: PAD_TDMINA
+                *  4: PAD_TDMINB
+                *  5: PAD_TDMINC
+                *
+                * G12A/G12B
+                *  0: TDMOUTA
+                *  1: TDMOUTB
+                *  2: TDMOUTC
+                *  3: PAD_TDMINA_DIN*
+                *  4: PAD_TDMINB_DIN*
+                *  5: PAD_TDMINC_DIN*
+                *  6: PAD_TDMINA_D*, oe pin
+                *  7: PAD_TDMINB_D*, oe pin
+                *
+                * TL1
+                *  0: TDMOUTA
+                *  1: TDMOUTB
+                *  2: TDMOUTC
+                *  3: PAD_TDMINA_DIN*
+                *  4: PAD_TDMINB_DIN*
+                *  5: PAD_TDMINC_DIN*
+                *  6: PAD_TDMINA_D*
+                *  7: PAD_TDMINB_D*
+                *  8: PAD_TDMINC_D*
+                *  9: HDMIRX_I2S
+                *  10: ACODEC_ADC
+                */
+               lb-src-sel = <1>;
+
+               status = "disabled";
+       };
+
        aml_spdif: spdif {
                compatible = "amlogic, axg-snd-spdif";
                #sound-dai-cells = <0>;
                status = "okay";
        };
 
-       aml_loopback: loopback {
-               compatible = "amlogic, snd-loopback";
-               /*
-                * external loopback clk config
-                * enable clk while pdm record data
-                */
-               /*clocks = <&clkc CLKID_MPLL1>;*/
-               /*clock-names = "datalb_mpll";*/
+       loopback:loopback@0 {
+               compatible = "amlogic, axg-loopback";
+               #sound-dai-cells = <0>;
 
-               /*
-                * 0: out rate = in data rate;
-                * 1: out rate = loopback data rate;
-                */
-               lb_mode = <0>;
+               clocks = <&clkaudio CLKID_AUDIO_PDM
+                       &clkc CLKID_FCLK_DIV3
+                       &clkc CLKID_MPLL3
+                       &clkaudio CLKID_AUDIO_PDMIN0
+                       &clkaudio CLKID_AUDIO_PDMIN1
+                       &clkc CLKID_MPLL0
+                       &clkaudio CLKID_AUDIO_MCLK_A>;
+               clock-names = "pdm_gate",
+                       "pdm_sysclk_srcpll",
+                       "pdm_dclk_srcpll",
+                       "pdm_dclk",
+                       "pdm_sysclk",
+                       "tdminlb_mpll",
+                       "tdminlb_mclk";
 
                /* datain src
                 * 0: tdmin_a;
                 * 4: pdmin;
                 */
                datain_src = <4>;
-               datain_chnum = <8>;
-               datain_chmask = <0x7f>;
+               datain_chnum = <6>;
+               datain_chmask = <0x3f>;
+               /* config which data pin for loopback */
+               datain-lane-mask-in = <1 1 1 0>;
+
+               /* calc mclk for datalb */
+               mclk-fs = <256>;
 
                /* tdmin_lb src
                 * 0: tdmoutA
                 * 1: tdmoutB
                 * 2: tdmoutC
-                * 3: PAD_tdminA
-                * 4: PAD_tdminB
-                * 5: PAD_tdminC
+                * 3: PAD_TDMINA_DIN*, refer to core pinmux
+                * 4: PAD_TDMINB_DIN*, refer to core pinmux
+                * 5: PAD_TDMINC_DIN*, refer to core pinmux
+                * 6: PAD_TDMINA_D*, oe, refer to core pinmux
+                * 7: PAD_TDMINB_D*, oe, refer to core pinmux
                 */
-
-               /*if tdmin_lb >= 3, use external loopback*/
+               /* if tdmin_lb >= 3, use external loopback */
                datalb_src = <2>;
                datalb_chnum = <2>;
-               /*config which data pin as loopback*/
-               /*datalb-lane-mask-in = <0 1>;*/
-               datalb_chmask = <0x1>;
+               datalb_chmask = <0x3>;
+               /* config which data pin as loopback */
+               datalb-lane-mask-in = <1 0 0 0>;
 
                status = "okay";
        };
index 99b3a97..8890a4e 100644 (file)
                compatible = "amlogic, axg-sound-card";
                aml-audio-card,name = "AML-AUGESOUND";
 
-               aml-audio-card,loopback = <&aml_loopback>;
-
                aml-audio-card,hp-det-gpio = <&gpio GPIOZ_7 GPIO_ACTIVE_LOW>;
 
                aml-audio-card,dai-link@0 {
                                sound-dai = <&aml_pdm>;
                        };
                        codec {
-                               /*
-                                *enable external loopback
-                                *and tlv320adc3101 as loopback
-                                */
-                               /*sound-dai = <&pdm_codec &tlv320adc3101_32>;*/
-                               /*
-                                * enable internal loopback
-                                * or disable loopback
-                                */
                                sound-dai = <&pdm_codec>;
                        };
                };
 
-               /*aml-audio-card,dai-link@4 {
-                *      mclk-fs = <128>;
-                *      cpu {
-                *              sound-dai = <&aml_spdif>;
-                *      };
-                *      codec {
-                *              sound-dai = <&dummy_codec>;
-                *      };
-                *};
-                */
+               aml-audio-card,dai-link@4 {
+                       mclk-fs = <128>;
+                       cpu {
+                               sound-dai = <&aml_spdif>;
+                       };
+                       codec {
+                               sound-dai = <&dummy_codec>;
+                       };
+               };
+
+               aml-audio-card,dai-link@5 {
+                       mclk-fs = <256>;
+                       continuous-clock;
+                       suffix-name = "alsaPORT-loopback";
+                       cpu {
+                               sound-dai = <&loopback>;
+                               system-clock-frequency = <12288000>;
+                       };
+                       codec {
+                               sound-dai = <&dummy_codec>;
+                       };
+               };
        };
 
        bt-dev{
                pinctrl-0 = <&tdmc_mclk &tdmout_c &tdmin_c>;
        };
 
+       tdmlb:tdm@3 {
+               compatible = "amlogic, axg-snd-tdmlb";
+               #sound-dai-cells = <0>;
+
+               dai-tdm-lane-lb-slot-mask-in = <1 0 0 0>;
+               dai-tdm-clk-sel = <1>;
+
+               clocks = <&clkaudio CLKID_AUDIO_MCLK_B
+                               &clkc CLKID_MPLL1>;
+               clock-names = "mclk", "clk_srcpll";
+
+               /*
+                * select tdmin_lb src;
+                * AXG
+                *  0: TDMOUTA
+                *  1: TDMOUTB
+                *  2: TDMOUTC
+                *  3: PAD_TDMINA
+                *  4: PAD_TDMINB
+                *  5: PAD_TDMINC
+                *
+                * G12A/G12B
+                *  0: TDMOUTA
+                *  1: TDMOUTB
+                *  2: TDMOUTC
+                *  3: PAD_TDMINA_DIN*
+                *  4: PAD_TDMINB_DIN*
+                *  5: PAD_TDMINC_DIN*
+                *  6: PAD_TDMINA_D*, oe pin
+                *  7: PAD_TDMINB_D*, oe pin
+                *
+                * TL1
+                *  0: TDMOUTA
+                *  1: TDMOUTB
+                *  2: TDMOUTC
+                *  3: PAD_TDMINA_DIN*
+                *  4: PAD_TDMINB_DIN*
+                *  5: PAD_TDMINC_DIN*
+                *  6: PAD_TDMINA_D*
+                *  7: PAD_TDMINB_D*
+                *  8: PAD_TDMINC_D*
+                *  9: HDMIRX_I2S
+                *  10: ACODEC_ADC
+                */
+               lb-src-sel = <1>;
+
+               status = "disabled";
+       };
+
        aml_spdif: spdif {
                compatible = "amlogic, axg-snd-spdif";
                #sound-dai-cells = <0>;
                status = "okay";
        };
 
-       aml_loopback: loopback {
-               compatible = "amlogic, snd-loopback";
-               /*
-                * external loopback clk config
-                * enable clk while pdm record data
-                */
-               /*clocks = <&clkc CLKID_MPLL1>;*/
-               /*clock-names = "datalb_mpll";*/
+       loopback:loopback@0 {
+               compatible = "amlogic, axg-loopback";
+               #sound-dai-cells = <0>;
 
-               /*
-                * 0: out rate = in data rate;
-                * 1: out rate = loopback data rate;
-                */
-               lb_mode = <0>;
+               clocks = <&clkaudio CLKID_AUDIO_PDM
+                       &clkc CLKID_FCLK_DIV3
+                       &clkc CLKID_MPLL3
+                       &clkaudio CLKID_AUDIO_PDMIN0
+                       &clkaudio CLKID_AUDIO_PDMIN1
+                       &clkc CLKID_MPLL0
+                       &clkaudio CLKID_AUDIO_MCLK_A>;
+               clock-names = "pdm_gate",
+                       "pdm_sysclk_srcpll",
+                       "pdm_dclk_srcpll",
+                       "pdm_dclk",
+                       "pdm_sysclk",
+                       "tdminlb_mpll",
+                       "tdminlb_mclk";
 
                /* datain src
                 * 0: tdmin_a;
                 * 4: pdmin;
                 */
                datain_src = <4>;
-               datain_chnum = <4>;
-               datain_chmask = <0x3>;
+               datain_chnum = <6>;
+               datain_chmask = <0x3f>;
+               /* config which data pin for loopback */
+               datain-lane-mask-in = <1 1 1 0>;
+
+               /* calc mclk for datalb */
+               mclk-fs = <256>;
 
                /* tdmin_lb src
                 * 0: tdmoutA
                 * 1: tdmoutB
                 * 2: tdmoutC
-                * 3: PAD_tdminA
-                * 4: PAD_tdminB
-                * 5: PAD_tdminC
+                * 3: PAD_TDMINA_DIN*, refer to core pinmux
+                * 4: PAD_TDMINB_DIN*, refer to core pinmux
+                * 5: PAD_TDMINC_DIN*, refer to core pinmux
+                * 6: PAD_TDMINA_D*, oe, refer to core pinmux
+                * 7: PAD_TDMINB_D*, oe, refer to core pinmux
                 */
-
-               /*if tdmin_lb >= 3, use external loopback*/
+               /* if tdmin_lb >= 3, use external loopback */
                datalb_src = <2>;
                datalb_chnum = <2>;
-               /*config which data pin as loopback*/
-               /*datalb-lane-mask-in = <0 1>;*/
                datalb_chmask = <0x3>;
+               /* config which data pin as loopback */
+               datalb-lane-mask-in = <1 0 0 0>;
 
                status = "okay";
        };
index 76eb019..998a34e 100644 (file)
                compatible = "amlogic, g12a-sound-card";
                aml-audio-card,name = "AML-AUGESOUND";
 
-               aml-audio-card,loopback = <&aml_loopback>;
                aml-audio-card,aux-devs = <&amlogic_codec>;
                /*avout mute gpio*/
                avout_mute-gpios = <&gpio_ao GPIOAO_2 GPIO_ACTIVE_HIGH>;
                                sound-dai = <&dummy_codec>;
                        };
                };
+
+               aml-audio-card,dai-link@6 {
+                       mclk-fs = <256>;
+                       continuous-clock;
+                       suffix-name = "alsaPORT-loopback";
+                       cpu {
+                               sound-dai = <&loopback>;
+                               system-clock-frequency = <12288000>;
+                       };
+                       codec {
+                               sound-dai = <&dummy_codec>;
+                       };
+               };
+
+               aml-audio-card,dai-link@7 {
+                       format = "i2s";
+                       mclk-fs = <256>;
+                       //continuous-clock;
+                       //bitclock-inversion;
+                       //frame-inversion;
+                       bitclock-master = <&tdmlb>;
+                       frame-master = <&tdmlb>;
+                       cpu {
+                               sound-dai = <&tdmlb>;
+                               dai-tdm-slot-rx-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";
                        "samesource_srcpll", "samesource_clk";
                pinctrl-names = "tdm_pins";
                pinctrl-0 = <&tdmb_mclk &tdmout_b &tdmin_b>;
+               mclk_pad = <0>;  /* 0: mclk_0; 1: mclk_1 */
                /*
                 * 0: tdmout_a;
                 * 1: tdmout_b;
                clock-names = "mclk", "clk_srcpll";
                pinctrl-names = "tdm_pins";
                pinctrl-0 = <&tdmc_mclk &tdmout_c &tdmin_c>;
+               mclk_pad = <1>;  /* 0: mclk_0; 1: mclk_1 */
        };
 
+       tdmlb: tdm@3 {
+               compatible = "amlogic, g12a-snd-tdmlb";
+               #sound-dai-cells = <0>;
+               dai-tdm-lane-lb-slot-mask-in = <1 0 0 0>;
+               dai-tdm-clk-sel = <1>;
+               clocks = <&clkaudio CLKID_AUDIO_MCLK_B
+                               &clkc CLKID_MPLL1>;
+               clock-names = "mclk", "clk_srcpll";
+               /*
+                * select tdmin_lb src;
+                *0: TDMOUTA
+                *1: TDMOUTB
+                *2: TDMOUTC
+                *3: PAD_TDMINA
+                *4: PAD_TDMINB
+                *5: PAD_TDMINC
+                */
+               lb-src-sel = <1>;
+
+               status = "okay";
+       };
 
        aml_spdif: spdif {
                compatible = "amlogic, g12a-snd-spdif-a";
                filter_mode = <1>; /* mode 0~4, defalut:1 */
                status = "okay";
        };
-       aml_loopback: loopback {
-               compatible = "amlogic, snd-loopback";
-               /*
-                * 0: out rate = in data rate;
-                * 1: out rate = loopback data rate;
-                */
-               lb_mode = <0>;
+
+       loopback:loopback@0 {
+               compatible = "amlogic, g12a-loopback";
+               #sound-dai-cells = <0>;
+
+               clocks = <&clkaudio CLKID_AUDIO_PDM
+                       &clkc CLKID_FCLK_DIV3
+                       &clkc CLKID_MPLL3
+                       &clkaudio CLKID_AUDIO_PDMIN0
+                       &clkaudio CLKID_AUDIO_PDMIN1
+                       &clkc CLKID_MPLL0
+                       &clkaudio CLKID_AUDIO_MCLK_A>;
+               clock-names = "pdm_gate",
+                       "pdm_sysclk_srcpll",
+                       "pdm_dclk_srcpll",
+                       "pdm_dclk",
+                       "pdm_sysclk",
+                       "tdminlb_mpll",
+                       "tdminlb_mclk";
 
                /* datain src
                 * 0: tdmin_a;
                 * 4: pdmin;
                 */
                datain_src = <4>;
-               datain_chnum = <8>;
-               datain_chmask = <0x3f>;
+               datain_chnum = <4>;
+               datain_chmask = <0xf>;
+               /* config which data pin for loopback */
+               datain-lane-mask-in = <1 0 1 0>;
+
+               /* calc mclk for datalb */
+               mclk-fs = <256>;
 
                /* tdmin_lb src
                 * 0: tdmoutA
                 * 1: tdmoutB
                 * 2: tdmoutC
-                * 3: PAD_tdminA
-                * 4: PAD_tdminB
-                * 5: PAD_tdminC
+                * 3: PAD_TDMINA_DIN*, refer to core pinmux
+                * 4: PAD_TDMINB_DIN*, refer to core pinmux
+                * 5: PAD_TDMINC_DIN*, refer to core pinmux
+                * 6: PAD_TDMINA_D*, oe, refer to core pinmux
+                * 7: PAD_TDMINB_D*, oe, refer to core pinmux
                 */
-               datalb_src = <2>;
-               datalb_chnum = <8>;
+               /* if tdmin_lb >= 3, use external loopback */
+               datalb_src = <1>;
+               datalb_chnum = <2>;
                datalb_chmask = <0x3>;
+               /* config which data pin as loopback */
+               datalb-lane-mask-in = <1 0 0 0>;
 
                status = "okay";
        };
index 8b3e7a3..af188c7 100644 (file)
                compatible = "amlogic, g12a-sound-card";
                aml-audio-card,name = "AML-AUGESOUND";
 
-               aml-audio-card,loopback = <&aml_loopback>;
                aml-audio-card,aux-devs = <&amlogic_codec>;
                /*avout mute gpio*/
                avout_mute-gpios = <&gpio_ao GPIOAO_2 GPIO_ACTIVE_HIGH>;
                                sound-dai = <&dummy_codec>;
                        };
                };
+
+               aml-audio-card,dai-link@6 {
+                       mclk-fs = <256>;
+                       continuous-clock;
+                       suffix-name = "alsaPORT-loopback";
+                       cpu {
+                               sound-dai = <&loopback>;
+                               system-clock-frequency = <12288000>;
+                       };
+                       codec {
+                               sound-dai = <&dummy_codec>;
+                       };
+               };
+
+               aml-audio-card,dai-link@7 {
+                       format = "i2s";
+                       mclk-fs = <256>;
+                       //continuous-clock;
+                       //bitclock-inversion;
+                       //frame-inversion;
+                       bitclock-master = <&tdmlb>;
+                       frame-master = <&tdmlb>;
+                       cpu {
+                               sound-dai = <&tdmlb>;
+                               dai-tdm-slot-rx-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";
                clock-names = "mclk", "clk_srcpll";
                pinctrl-names = "tdm_pins";
                pinctrl-0 = <&tdmb_mclk &tdmout_b &tdmin_b>;
+               mclk_pad = <0>;  /* 0: mclk_0; 1: mclk_1 */
                /*
                 * 0: tdmout_a;
                 * 1: tdmout_b;
                clock-names = "mclk", "clk_srcpll";
                pinctrl-names = "tdm_pins";
                pinctrl-0 = <&tdmc_mclk &tdmout_c &tdmin_c>;
+               mclk_pad = <1>;  /* 0: mclk_0; 1: mclk_1 */
+       };
+
+       tdmlb: tdm@3 {
+               compatible = "amlogic, g12a-snd-tdmlb";
+               #sound-dai-cells = <0>;
+               dai-tdm-lane-lb-slot-mask-in = <1 0 0 0>;
+               dai-tdm-clk-sel = <1>;
+               clocks = <&clkaudio CLKID_AUDIO_MCLK_B
+                               &clkc CLKID_MPLL1>;
+               clock-names = "mclk", "clk_srcpll";
+               /*
+                * select tdmin_lb src;
+                *0: TDMOUTA
+                *1: TDMOUTB
+                *2: TDMOUTC
+                *3: PAD_TDMINA
+                *4: PAD_TDMINB
+                *5: PAD_TDMINC
+                */
+               lb-src-sel = <1>;
+
+               status = "okay";
        };
 
        aml_spdif: spdif {
                filter_mode = <1>; /* mode 0~4, defalut:1 */
                status = "okay";
        };
-       aml_loopback: loopback {
-               compatible = "amlogic, snd-loopback";
-               /*
-                * 0: out rate = in data rate;
-                * 1: out rate = loopback data rate;
-                */
-               lb_mode = <0>;
+
+       loopback:loopback@0 {
+               compatible = "amlogic, g12a-loopback";
+               #sound-dai-cells = <0>;
+
+               clocks = <&clkaudio CLKID_AUDIO_PDM
+                       &clkc CLKID_FCLK_DIV3
+                       &clkc CLKID_MPLL3
+                       &clkaudio CLKID_AUDIO_PDMIN0
+                       &clkaudio CLKID_AUDIO_PDMIN1
+                       &clkc CLKID_MPLL0
+                       &clkaudio CLKID_AUDIO_MCLK_A>;
+               clock-names = "pdm_gate",
+                       "pdm_sysclk_srcpll",
+                       "pdm_dclk_srcpll",
+                       "pdm_dclk",
+                       "pdm_sysclk",
+                       "tdminlb_mpll",
+                       "tdminlb_mclk";
 
                /* datain src
                 * 0: tdmin_a;
                 * 4: pdmin;
                 */
                datain_src = <4>;
-               datain_chnum = <8>;
-               datain_chmask = <0x3f>;
+               datain_chnum = <4>;
+               datain_chmask = <0xf>;
+               /* config which data pin for loopback */
+               datain-lane-mask-in = <1 0 1 0>;
+
+               /* calc mclk for datalb */
+               mclk-fs = <256>;
 
                /* tdmin_lb src
                 * 0: tdmoutA
                 * 1: tdmoutB
                 * 2: tdmoutC
-                * 3: PAD_tdminA
-                * 4: PAD_tdminB
-                * 5: PAD_tdminC
+                * 3: PAD_TDMINA_DIN*, refer to core pinmux
+                * 4: PAD_TDMINB_DIN*, refer to core pinmux
+                * 5: PAD_TDMINC_DIN*, refer to core pinmux
+                * 6: PAD_TDMINA_D*, oe, refer to core pinmux
+                * 7: PAD_TDMINB_D*, oe, refer to core pinmux
                 */
-               datalb_src = <2>;
-               datalb_chnum = <8>;
+               /* if tdmin_lb >= 3, use external loopback */
+               datalb_src = <1>;
+               datalb_chnum = <2>;
                datalb_chmask = <0x3>;
+               /* config which data pin as loopback */
+               datalb-lane-mask-in = <1 0 0 0>;
 
                status = "okay";
        };
index 6264b94..7236072 100644 (file)
                compatible = "amlogic, g12a-sound-card";
                aml-audio-card,name = "AML-AUGESOUND";
 
-               aml-audio-card,loopback = <&aml_loopback>;
                aml-audio-card,aux-devs = <&amlogic_codec>;
                /*avout mute gpio*/
                avout_mute-gpios = <&gpio_ao GPIOAO_2 GPIO_ACTIVE_HIGH>;
                                sound-dai = <&dummy_codec>;
                        };
                };
+
                /* spdif_b to hdmi, only playback */
                aml-audio-card,dai-link@5 {
                        mclk-fs = <128>;
                                sound-dai = <&dummy_codec>;
                        };
                };
+
+               aml-audio-card,dai-link@6 {
+                       mclk-fs = <256>;
+                       continuous-clock;
+                       suffix-name = "alsaPORT-loopback";
+                       cpu {
+                               sound-dai = <&loopback>;
+                               system-clock-frequency = <12288000>;
+                       };
+                       codec {
+                               sound-dai = <&dummy_codec>;
+                       };
+               };
+
+
                /*
                 * dai link for i2s to hdmix,
                 * Notice to select a tdm lane not used by hw
                        "samesource_srcpll", "samesource_clk";
                pinctrl-names = "tdm_pins";
                pinctrl-0 = <&tdmb_mclk &tdmout_b &tdmin_b>;
+               mclk_pad = <0>;  /* 0: mclk_0; 1: mclk_1 */
                /*
                 * 0: tdmout_a;
                 * 1: tdmout_b;
                clock-names = "mclk", "clk_srcpll";
                pinctrl-names = "tdm_pins";
                pinctrl-0 = <&tdmc_mclk &tdmout_c &tdmin_c>;
+               mclk_pad = <1>;  /* 0: mclk_0; 1: mclk_1 */
+       };
+
+       tdmlb: tdm@3 {
+               compatible = "amlogic, g12a-snd-tdmlb";
+               #sound-dai-cells = <0>;
+               dai-tdm-lane-lb-slot-mask-in = <1 0 0 0>;
+               dai-tdm-clk-sel = <1>;
+               clocks = <&clkaudio CLKID_AUDIO_MCLK_B
+                               &clkc CLKID_MPLL1>;
+               clock-names = "mclk", "clk_srcpll";
+               /*
+                * select tdmin_lb src;
+                *0: TDMOUTA
+                *1: TDMOUTB
+                *2: TDMOUTC
+                *3: PAD_TDMINA
+                *4: PAD_TDMINB
+                *5: PAD_TDMINC
+                */
+               lb-src-sel = <1>;
+
+               status = "disabled";
        };
 
        /* copy a useless tdm to output for hdmi, no pinmux */
                filter_mode = <1>; /* mode 0~4, defalut:1 */
                status = "okay";
        };
-       aml_loopback: loopback {
-               compatible = "amlogic, snd-loopback";
-               /*
-                * 0: out rate = in data rate;
-                * 1: out rate = loopback data rate;
-                */
-               lb_mode = <0>;
+
+       loopback:loopback@0 {
+               compatible = "amlogic, g12a-loopback";
+               #sound-dai-cells = <0>;
+
+               clocks = <&clkaudio CLKID_AUDIO_PDM
+                       &clkc CLKID_FCLK_DIV3
+                       &clkc CLKID_MPLL3
+                       &clkaudio CLKID_AUDIO_PDMIN0
+                       &clkaudio CLKID_AUDIO_PDMIN1
+                       &clkc CLKID_MPLL0
+                       &clkaudio CLKID_AUDIO_MCLK_A>;
+               clock-names = "pdm_gate",
+                       "pdm_sysclk_srcpll",
+                       "pdm_dclk_srcpll",
+                       "pdm_dclk",
+                       "pdm_sysclk",
+                       "tdminlb_mpll",
+                       "tdminlb_mclk";
 
                /* datain src
                 * 0: tdmin_a;
                 * 4: pdmin;
                 */
                datain_src = <4>;
-               datain_chnum = <8>;
-               datain_chmask = <0x3f>;
+               datain_chnum = <4>;
+               datain_chmask = <0xf>;
+               /* config which data pin for loopback */
+               datain-lane-mask-in = <1 0 1 0>;
+
+               /* calc mclk for datalb */
+               mclk-fs = <256>;
 
                /* tdmin_lb src
                 * 0: tdmoutA
                 * 1: tdmoutB
                 * 2: tdmoutC
-                * 3: PAD_tdminA
-                * 4: PAD_tdminB
-                * 5: PAD_tdminC
+                * 3: PAD_TDMINA_DIN*, refer to core pinmux
+                * 4: PAD_TDMINB_DIN*, refer to core pinmux
+                * 5: PAD_TDMINC_DIN*, refer to core pinmux
+                * 6: PAD_TDMINA_D*, oe, refer to core pinmux
+                * 7: PAD_TDMINB_D*, oe, refer to core pinmux
                 */
-               datalb_src = <2>;
-               datalb_chnum = <8>;
+               /* if tdmin_lb >= 3, use external loopback */
+               datalb_src = <1>;
+               datalb_chnum = <2>;
                datalb_chmask = <0x3>;
+               /* config which data pin as loopback */
+               datalb-lane-mask-in = <1 0 0 0>;
 
                status = "okay";
        };
index 07b6741..4193aff 100644 (file)
                compatible = "amlogic, g12a-sound-card";
                aml-audio-card,name = "AML-AUGESOUND";
 
-               aml-audio-card,loopback = <&aml_loopback>;
                aml-audio-card,aux-devs = <&amlogic_codec>;
                /*avout mute gpio*/
                avout_mute-gpios = <&gpio_ao GPIOAO_2 GPIO_ACTIVE_HIGH>;
                                sound-dai = <&dummy_codec>;
                        };
                };
+
+               aml-audio-card,dai-link@6 {
+                       mclk-fs = <256>;
+                       continuous-clock;
+                       suffix-name = "alsaPORT-loopback";
+                       cpu {
+                               sound-dai = <&loopback>;
+                               system-clock-frequency = <12288000>;
+                       };
+                       codec {
+                               sound-dai = <&dummy_codec>;
+                       };
+               };
+
+
                /*
                 * dai link for i2s to hdmix,
                 * Notice to select a tdm lane not used by hw
                        "samesource_srcpll", "samesource_clk";
                pinctrl-names = "tdm_pins";
                pinctrl-0 = <&tdmb_mclk &tdmout_b &tdmin_b>;
+               mclk_pad = <0>;  /* 0: mclk_0; 1: mclk_1 */
                /*
                 * 0: tdmout_a;
                 * 1: tdmout_b;
                clock-names = "mclk", "clk_srcpll";
                pinctrl-names = "tdm_pins";
                pinctrl-0 = <&tdmc_mclk &tdmout_c &tdmin_c>;
+               mclk_pad = <1>;  /* 0: mclk_0; 1: mclk_1 */
+       };
+
+       tdmlb: tdm@3 {
+               compatible = "amlogic, g12a-snd-tdmlb";
+               #sound-dai-cells = <0>;
+               dai-tdm-lane-lb-slot-mask-in = <1 0 0 0>;
+               dai-tdm-clk-sel = <1>;
+               clocks = <&clkaudio CLKID_AUDIO_MCLK_B
+                               &clkc CLKID_MPLL1>;
+               clock-names = "mclk", "clk_srcpll";
+               /*
+                * select tdmin_lb src;
+                *0: TDMOUTA
+                *1: TDMOUTB
+                *2: TDMOUTC
+                *3: PAD_TDMINA
+                *4: PAD_TDMINB
+                *5: PAD_TDMINC
+                */
+               lb-src-sel = <1>;
+
+               status = "disabled";
        };
 
        /* copy a useless tdm to output for hdmi, no pinmux */
                filter_mode = <1>; /* mode 0~4, defalut:1 */
                status = "okay";
        };
-       aml_loopback: loopback {
-               compatible = "amlogic, snd-loopback";
-               /*
-                * 0: out rate = in data rate;
-                * 1: out rate = loopback data rate;
-                */
-               lb_mode = <0>;
+
+       loopback:loopback@0 {
+               compatible = "amlogic, g12a-loopback";
+               #sound-dai-cells = <0>;
+
+               clocks = <&clkaudio CLKID_AUDIO_PDM
+                       &clkc CLKID_FCLK_DIV3
+                       &clkc CLKID_MPLL3
+                       &clkaudio CLKID_AUDIO_PDMIN0
+                       &clkaudio CLKID_AUDIO_PDMIN1
+                       &clkc CLKID_MPLL0
+                       &clkaudio CLKID_AUDIO_MCLK_A>;
+               clock-names = "pdm_gate",
+                       "pdm_sysclk_srcpll",
+                       "pdm_dclk_srcpll",
+                       "pdm_dclk",
+                       "pdm_sysclk",
+                       "tdminlb_mpll",
+                       "tdminlb_mclk";
 
                /* datain src
                 * 0: tdmin_a;
                 * 4: pdmin;
                 */
                datain_src = <4>;
-               datain_chnum = <8>;
-               datain_chmask = <0x3f>;
+               datain_chnum = <4>;
+               datain_chmask = <0xf>;
+               /* config which data pin for loopback */
+               datain-lane-mask-in = <1 0 1 0>;
+
+               /* calc mclk for datalb */
+               mclk-fs = <256>;
 
                /* tdmin_lb src
                 * 0: tdmoutA
                 * 1: tdmoutB
                 * 2: tdmoutC
-                * 3: PAD_tdminA
-                * 4: PAD_tdminB
-                * 5: PAD_tdminC
+                * 3: PAD_TDMINA_DIN*, refer to core pinmux
+                * 4: PAD_TDMINB_DIN*, refer to core pinmux
+                * 5: PAD_TDMINC_DIN*, refer to core pinmux
+                * 6: PAD_TDMINA_D*, oe, refer to core pinmux
+                * 7: PAD_TDMINB_D*, oe, refer to core pinmux
                 */
-               datalb_src = <2>;
-               datalb_chnum = <8>;
+               /* if tdmin_lb >= 3, use external loopback */
+               datalb_src = <1>;
+               datalb_chnum = <2>;
                datalb_chmask = <0x3>;
+               /* config which data pin as loopback */
+               datalb-lane-mask-in = <1 0 0 0>;
 
                status = "okay";
        };
index 9eb88d8..63a5fc6 100644 (file)
                compatible = "amlogic, g12a-sound-card";
                aml-audio-card,name = "AML-AUGESOUND";
 
-               aml-audio-card,loopback = <&aml_loopback>;
                aml-audio-card,aux-devs = <&amlogic_codec>;
                /*avout mute gpio*/
                avout_mute-gpios = <&gpio_ao GPIOAO_2 GPIO_ACTIVE_HIGH>;
                                sound-dai = <&dummy_codec>;
                        };
                };
+
+               aml-audio-card,dai-link@6 {
+                       mclk-fs = <256>;
+                       continuous-clock;
+                       suffix-name = "alsaPORT-loopback";
+                       cpu {
+                               sound-dai = <&loopback>;
+                               system-clock-frequency = <12288000>;
+                       };
+                       codec {
+                               sound-dai = <&dummy_codec>;
+                       };
+               };
        };
        audiolocker: locker {
                compatible = "amlogic, audiolocker";
                        "samesource_srcpll", "samesource_clk";
                pinctrl-names = "tdm_pins";
                pinctrl-0 = <&tdmb_mclk &tdmout_b &tdmin_b>;
+               mclk_pad = <0>;  /* 0: mclk_0; 1: mclk_1 */
                /*
                 * 0: tdmout_a;
                 * 1: tdmout_b;
                clock-names = "mclk", "clk_srcpll";
                pinctrl-names = "tdm_pins";
                pinctrl-0 = <&tdmc_mclk &tdmout_c &tdmin_c>;
+               mclk_pad = <1>;  /* 0: mclk_0; 1: mclk_1 */
        };
 
+       tdmlb: tdm@3 {
+               compatible = "amlogic, g12a-snd-tdmlb";
+               #sound-dai-cells = <0>;
+               dai-tdm-lane-lb-slot-mask-in = <1 0 0 0>;
+               dai-tdm-clk-sel = <1>;
+               clocks = <&clkaudio CLKID_AUDIO_MCLK_B
+                               &clkc CLKID_MPLL1>;
+               clock-names = "mclk", "clk_srcpll";
+               /*
+                * select tdmin_lb src;
+                *0: TDMOUTA
+                *1: TDMOUTB
+                *2: TDMOUTC
+                *3: PAD_TDMINA
+                *4: PAD_TDMINB
+                *5: PAD_TDMINC
+                */
+               lb-src-sel = <1>;
+
+               status = "disabled";
+       };
 
        aml_spdif: spdif {
                compatible = "amlogic, g12a-snd-spdif-a";
                filter_mode = <1>; /* mode 0~4, defalut:1 */
                status = "okay";
        };
-       aml_loopback: loopback {
-               compatible = "amlogic, snd-loopback";
-               /*
-                * 0: out rate = in data rate;
-                * 1: out rate = loopback data rate;
-                */
-               lb_mode = <0>;
+
+       loopback:loopback@0 {
+               compatible = "amlogic, g12a-loopback";
+               #sound-dai-cells = <0>;
+
+               clocks = <&clkaudio CLKID_AUDIO_PDM
+                       &clkc CLKID_FCLK_DIV3
+                       &clkc CLKID_MPLL3
+                       &clkaudio CLKID_AUDIO_PDMIN0
+                       &clkaudio CLKID_AUDIO_PDMIN1
+                       &clkc CLKID_MPLL0
+                       &clkaudio CLKID_AUDIO_MCLK_A>;
+               clock-names = "pdm_gate",
+                       "pdm_sysclk_srcpll",
+                       "pdm_dclk_srcpll",
+                       "pdm_dclk",
+                       "pdm_sysclk",
+                       "tdminlb_mpll",
+                       "tdminlb_mclk";
 
                /* datain src
                 * 0: tdmin_a;
                 * 4: pdmin;
                 */
                datain_src = <4>;
-               datain_chnum = <8>;
-               datain_chmask = <0x3f>;
+               datain_chnum = <4>;
+               datain_chmask = <0xf>;
+               /* config which data pin for loopback */
+               datain-lane-mask-in = <1 0 1 0>;
+
+               /* calc mclk for datalb */
+               mclk-fs = <256>;
 
                /* tdmin_lb src
                 * 0: tdmoutA
                 * 1: tdmoutB
                 * 2: tdmoutC
-                * 3: PAD_tdminA
-                * 4: PAD_tdminB
-                * 5: PAD_tdminC
+                * 3: PAD_TDMINA_DIN*, refer to core pinmux
+                * 4: PAD_TDMINB_DIN*, refer to core pinmux
+                * 5: PAD_TDMINC_DIN*, refer to core pinmux
+                * 6: PAD_TDMINA_D*, oe, refer to core pinmux
+                * 7: PAD_TDMINB_D*, oe, refer to core pinmux
                 */
-               datalb_src = <2>;
-               datalb_chnum = <8>;
+               /* if tdmin_lb >= 3, use external loopback */
+               datalb_src = <1>;
+               datalb_chnum = <2>;
                datalb_chmask = <0x3>;
+               /* config which data pin as loopback */
+               datalb-lane-mask-in = <1 0 0 0>;
 
                status = "okay";
        };
index c94598e..0348f7d 100644 (file)
                compatible = "amlogic, g12a-sound-card";
                aml-audio-card,name = "AML-AUGESOUND";
 
-               aml-audio-card,loopback = <&aml_loopback>;
                aml-audio-card,aux-devs = <&amlogic_codec>;
                /*avout mute gpio*/
                avout_mute-gpios = <&gpio_ao GPIOAO_2 GPIO_ACTIVE_HIGH>;
                                sound-dai = <&dummy_codec>;
                        };
                };
+
+               aml-audio-card,dai-link@6 {
+                       mclk-fs = <256>;
+                       continuous-clock;
+                       suffix-name = "alsaPORT-loopback";
+                       cpu {
+                               sound-dai = <&loopback>;
+                               system-clock-frequency = <12288000>;
+                       };
+                       codec {
+                               sound-dai = <&dummy_codec>;
+                       };
+               };
        };
        audiolocker: locker {
                compatible = "amlogic, audiolocker";
                        "samesource_srcpll", "samesource_clk";
                pinctrl-names = "tdm_pins";
                pinctrl-0 = <&tdmb_mclk &tdmout_b &tdmin_b>;
+               mclk_pad = <0>;  /* 0: mclk_0; 1: mclk_1 */
                /*
                 * 0: tdmout_a;
                 * 1: tdmout_b;
                clock-names = "mclk", "clk_srcpll";
                pinctrl-names = "tdm_pins";
                pinctrl-0 = <&tdmc_mclk &tdmout_c &tdmin_c>;
+               mclk_pad = <1>;  /* 0: mclk_0; 1: mclk_1 */
        };
 
+       tdmlb: tdm@3 {
+               compatible = "amlogic, g12a-snd-tdmlb";
+               #sound-dai-cells = <0>;
+               dai-tdm-lane-lb-slot-mask-in = <1 0 0 0>;
+               dai-tdm-clk-sel = <1>;
+               clocks = <&clkaudio CLKID_AUDIO_MCLK_B
+                               &clkc CLKID_MPLL1>;
+               clock-names = "mclk", "clk_srcpll";
+               /*
+                * select tdmin_lb src;
+                *0: TDMOUTA
+                *1: TDMOUTB
+                *2: TDMOUTC
+                *3: PAD_TDMINA
+                *4: PAD_TDMINB
+                *5: PAD_TDMINC
+                */
+               lb-src-sel = <1>;
+
+               status = "disabled";
+       };
 
        aml_spdif: spdif {
                compatible = "amlogic, g12a-snd-spdif-a";
                filter_mode = <1>; /* mode 0~4, defalut:1 */
                status = "okay";
        };
-       aml_loopback: loopback {
-               compatible = "amlogic, snd-loopback";
-               /*
-                * 0: out rate = in data rate;
-                * 1: out rate = loopback data rate;
-                */
-               lb_mode = <0>;
+
+       loopback:loopback@0 {
+               compatible = "amlogic, g12a-loopback";
+               #sound-dai-cells = <0>;
+
+               clocks = <&clkaudio CLKID_AUDIO_PDM
+                       &clkc CLKID_FCLK_DIV3
+                       &clkc CLKID_MPLL3
+                       &clkaudio CLKID_AUDIO_PDMIN0
+                       &clkaudio CLKID_AUDIO_PDMIN1
+                       &clkc CLKID_MPLL0
+                       &clkaudio CLKID_AUDIO_MCLK_A>;
+               clock-names = "pdm_gate",
+                       "pdm_sysclk_srcpll",
+                       "pdm_dclk_srcpll",
+                       "pdm_dclk",
+                       "pdm_sysclk",
+                       "tdminlb_mpll",
+                       "tdminlb_mclk";
 
                /* datain src
                 * 0: tdmin_a;
                 * 4: pdmin;
                 */
                datain_src = <4>;
-               datain_chnum = <8>;
-               datain_chmask = <0x3f>;
+               datain_chnum = <4>;
+               datain_chmask = <0xf>;
+               /* config which data pin for loopback */
+               datain-lane-mask-in = <1 0 1 0>;
+
+               /* calc mclk for datalb */
+               mclk-fs = <256>;
 
                /* tdmin_lb src
                 * 0: tdmoutA
                 * 1: tdmoutB
                 * 2: tdmoutC
-                * 3: PAD_tdminA
-                * 4: PAD_tdminB
-                * 5: PAD_tdminC
+                * 3: PAD_TDMINA_DIN*, refer to core pinmux
+                * 4: PAD_TDMINB_DIN*, refer to core pinmux
+                * 5: PAD_TDMINC_DIN*, refer to core pinmux
+                * 6: PAD_TDMINA_D*, oe, refer to core pinmux
+                * 7: PAD_TDMINB_D*, oe, refer to core pinmux
                 */
-               datalb_src = <2>;
-               datalb_chnum = <8>;
+               /* if tdmin_lb >= 3, use external loopback */
+               datalb_src = <1>;
+               datalb_chnum = <2>;
                datalb_chmask = <0x3>;
+               /* config which data pin as loopback */
+               datalb-lane-mask-in = <1 0 0 0>;
 
                status = "okay";
        };
index 9d35b05..380ba94 100644 (file)
                compatible = "amlogic, g12a-sound-card";
                aml-audio-card,name = "AML-AUGESOUND";
 
-               aml-audio-card,loopback = <&aml_loopback>;
                aml-audio-card,aux-devs = <&amlogic_codec>;
                /*avout mute gpio*/
                avout_mute-gpios = <&gpio_ao GPIOAO_2 GPIO_ACTIVE_HIGH>;
                                sound-dai = <&dummy_codec>;
                        };
                };
+
+               aml-audio-card,dai-link@6 {
+                       mclk-fs = <256>;
+                       continuous-clock;
+                       suffix-name = "alsaPORT-loopback";
+                       cpu {
+                               sound-dai = <&loopback>;
+                               system-clock-frequency = <12288000>;
+                       };
+                       codec {
+                               sound-dai = <&dummy_codec>;
+                       };
+               };
        };
        audiolocker: locker {
                compatible = "amlogic, audiolocker";
                        "samesource_srcpll", "samesource_clk";
                pinctrl-names = "tdm_pins";
                pinctrl-0 = <&tdmb_mclk &tdmout_b &tdmin_b>;
+               mclk_pad = <0>;  /* 0: mclk_0; 1: mclk_1 */
                /*
                 * 0: tdmout_a;
                 * 1: tdmout_b;
                clock-names = "mclk", "clk_srcpll";
                pinctrl-names = "tdm_pins";
                pinctrl-0 = <&tdmc_mclk &tdmout_c &tdmin_c>;
+               mclk_pad = <1>;  /* 0: mclk_0; 1: mclk_1 */
        };
 
+       tdmlb: tdm@3 {
+               compatible = "amlogic, g12a-snd-tdmlb";
+               #sound-dai-cells = <0>;
+               dai-tdm-lane-lb-slot-mask-in = <1 0 0 0>;
+               dai-tdm-clk-sel = <1>;
+               clocks = <&clkaudio CLKID_AUDIO_MCLK_B
+                               &clkc CLKID_MPLL1>;
+               clock-names = "mclk", "clk_srcpll";
+               /*
+                * select tdmin_lb src;
+                *0: TDMOUTA
+                *1: TDMOUTB
+                *2: TDMOUTC
+                *3: PAD_TDMINA
+                *4: PAD_TDMINB
+                *5: PAD_TDMINC
+                */
+               lb-src-sel = <1>;
+
+               status = "disabled";
+       };
 
        aml_spdif: spdif {
                compatible = "amlogic, g12a-snd-spdif-a";
                filter_mode = <1>; /* mode 0~4, defalut:1 */
                status = "okay";
        };
-       aml_loopback: loopback {
-               compatible = "amlogic, snd-loopback";
-               /*
-                * 0: out rate = in data rate;
-                * 1: out rate = loopback data rate;
-                */
-               lb_mode = <0>;
+
+       loopback:loopback@0 {
+               compatible = "amlogic, g12a-loopback";
+               #sound-dai-cells = <0>;
+
+               clocks = <&clkaudio CLKID_AUDIO_PDM
+                       &clkc CLKID_FCLK_DIV3
+                       &clkc CLKID_MPLL3
+                       &clkaudio CLKID_AUDIO_PDMIN0
+                       &clkaudio CLKID_AUDIO_PDMIN1
+                       &clkc CLKID_MPLL0
+                       &clkaudio CLKID_AUDIO_MCLK_A>;
+               clock-names = "pdm_gate",
+                       "pdm_sysclk_srcpll",
+                       "pdm_dclk_srcpll",
+                       "pdm_dclk",
+                       "pdm_sysclk",
+                       "tdminlb_mpll",
+                       "tdminlb_mclk";
 
                /* datain src
                 * 0: tdmin_a;
                 * 4: pdmin;
                 */
                datain_src = <4>;
-               datain_chnum = <8>;
-               datain_chmask = <0x3f>;
+               datain_chnum = <4>;
+               datain_chmask = <0xf>;
+               /* config which data pin for loopback */
+               datain-lane-mask-in = <1 0 1 0>;
+
+               /* calc mclk for datalb */
+               mclk-fs = <256>;
 
                /* tdmin_lb src
                 * 0: tdmoutA
                 * 1: tdmoutB
                 * 2: tdmoutC
-                * 3: PAD_tdminA
-                * 4: PAD_tdminB
-                * 5: PAD_tdminC
+                * 3: PAD_TDMINA_DIN*, refer to core pinmux
+                * 4: PAD_TDMINB_DIN*, refer to core pinmux
+                * 5: PAD_TDMINC_DIN*, refer to core pinmux
+                * 6: PAD_TDMINA_D*, oe, refer to core pinmux
+                * 7: PAD_TDMINB_D*, oe, refer to core pinmux
                 */
-               datalb_src = <2>;
-               datalb_chnum = <8>;
+               /* if tdmin_lb >= 3, use external loopback */
+               datalb_src = <1>;
+               datalb_chnum = <2>;
                datalb_chmask = <0x3>;
+               /* config which data pin as loopback */
+               datalb-lane-mask-in = <1 0 0 0>;
 
                status = "okay";
        };
index 08d52a0..68cf950 100644 (file)
                compatible = "amlogic, g12a-sound-card";
                aml-audio-card,name = "AML-AUGESOUND";
 
-               aml-audio-card,loopback = <&aml_loopback>;
                aml-audio-card,aux-devs = <&amlogic_codec>;
                /*avout mute gpio*/
                avout_mute-gpios = <&gpio_ao GPIOAO_2 GPIO_ACTIVE_HIGH>;
                                sound-dai = <&dummy_codec>;
                        };
                };
+
+               aml-audio-card,dai-link@6 {
+                       mclk-fs = <256>;
+                       continuous-clock;
+                       suffix-name = "alsaPORT-loopback";
+                       cpu {
+                               sound-dai = <&loopback>;
+                               system-clock-frequency = <12288000>;
+                       };
+                       codec {
+                               sound-dai = <&dummy_codec>;
+                       };
+               };
+
+
                /*
                 * dai link for i2s to hdmix,
                 * Notice to select a tdm lane not used by hw
                        "samesource_srcpll", "samesource_clk";
                pinctrl-names = "tdm_pins";
                pinctrl-0 = <&tdmb_mclk &tdmout_b &tdmin_b>;
+               mclk_pad = <0>;  /* 0: mclk_0; 1: mclk_1 */
                /*
                 * 0: tdmout_a;
                 * 1: tdmout_b;
                clock-names = "mclk", "clk_srcpll";
                pinctrl-names = "tdm_pins";
                pinctrl-0 = <&tdmc_mclk &tdmout_c &tdmin_c>;
+               mclk_pad = <1>;  /* 0: mclk_0; 1: mclk_1 */
+       };
+
+       tdmlb: tdm@3 {
+               compatible = "amlogic, g12a-snd-tdmlb";
+               #sound-dai-cells = <0>;
+               dai-tdm-lane-lb-slot-mask-in = <1 0 0 0>;
+               dai-tdm-clk-sel = <1>;
+               clocks = <&clkaudio CLKID_AUDIO_MCLK_B
+                               &clkc CLKID_MPLL1>;
+               clock-names = "mclk", "clk_srcpll";
+               /*
+                * select tdmin_lb src;
+                *0: TDMOUTA
+                *1: TDMOUTB
+                *2: TDMOUTC
+                *3: PAD_TDMINA
+                *4: PAD_TDMINB
+                *5: PAD_TDMINC
+                */
+               lb-src-sel = <1>;
+
+               status = "disabled";
        };
 
        /* copy a useless tdm to output for hdmi, no pinmux */
                filter_mode = <1>; /* mode 0~4, defalut:1 */
                status = "okay";
        };
-       aml_loopback: loopback {
-               compatible = "amlogic, snd-loopback";
-               /*
-                * 0: out rate = in data rate;
-                * 1: out rate = loopback data rate;
-                */
-               lb_mode = <0>;
+
+       loopback:loopback@0 {
+               compatible = "amlogic, g12a-loopback";
+               #sound-dai-cells = <0>;
+
+               clocks = <&clkaudio CLKID_AUDIO_PDM
+                       &clkc CLKID_FCLK_DIV3
+                       &clkc CLKID_MPLL3
+                       &clkaudio CLKID_AUDIO_PDMIN0
+                       &clkaudio CLKID_AUDIO_PDMIN1
+                       &clkc CLKID_MPLL0
+                       &clkaudio CLKID_AUDIO_MCLK_A>;
+               clock-names = "pdm_gate",
+                       "pdm_sysclk_srcpll",
+                       "pdm_dclk_srcpll",
+                       "pdm_dclk",
+                       "pdm_sysclk",
+                       "tdminlb_mpll",
+                       "tdminlb_mclk";
 
                /* datain src
                 * 0: tdmin_a;
                 * 4: pdmin;
                 */
                datain_src = <4>;
-               datain_chnum = <8>;
-               datain_chmask = <0x3f>;
+               datain_chnum = <4>;
+               datain_chmask = <0xf>;
+               /* config which data pin for loopback */
+               datain-lane-mask-in = <1 0 1 0>;
+
+               /* calc mclk for datalb */
+               mclk-fs = <256>;
 
                /* tdmin_lb src
                 * 0: tdmoutA
                 * 1: tdmoutB
                 * 2: tdmoutC
-                * 3: PAD_tdminA
-                * 4: PAD_tdminB
-                * 5: PAD_tdminC
+                * 3: PAD_TDMINA_DIN*, refer to core pinmux
+                * 4: PAD_TDMINB_DIN*, refer to core pinmux
+                * 5: PAD_TDMINC_DIN*, refer to core pinmux
+                * 6: PAD_TDMINA_D*, oe, refer to core pinmux
+                * 7: PAD_TDMINB_D*, oe, refer to core pinmux
                 */
-               datalb_src = <2>;
-               datalb_chnum = <8>;
+               /* if tdmin_lb >= 3, use external loopback */
+               datalb_src = <1>;
+               datalb_chnum = <2>;
                datalb_chmask = <0x3>;
+               /* config which data pin as loopback */
+               datalb-lane-mask-in = <1 0 0 0>;
 
                status = "okay";
        };
index 1dce4d3..ce79f0e 100644 (file)
                compatible = "amlogic, g12a-sound-card";
                aml-audio-card,name = "AML-AUGESOUND";
 
-               aml-audio-card,loopback = <&aml_loopback>;
                aml-audio-card,aux-devs = <&amlogic_codec>;
                /*avout mute gpio*/
                avout_mute-gpios = <&gpio_ao GPIOAO_2 GPIO_ACTIVE_HIGH>;
                                sound-dai = <&dummy_codec>;
                        };
                };
+
+               aml-audio-card,dai-link@6 {
+                       mclk-fs = <256>;
+                       continuous-clock;
+                       suffix-name = "alsaPORT-loopback";
+                       cpu {
+                               sound-dai = <&loopback>;
+                               system-clock-frequency = <12288000>;
+                       };
+                       codec {
+                               sound-dai = <&dummy_codec>;
+                       };
+               };
+
+
                /*
                 * dai link for i2s to hdmix,
                 * Notice to select a tdm lane not used by hw
                        "samesource_srcpll", "samesource_clk";
                pinctrl-names = "tdm_pins";
                pinctrl-0 = <&tdmb_mclk &tdmout_b &tdmin_b>;
+               mclk_pad = <0>;  /* 0: mclk_0; 1: mclk_1 */
                /*
                 * 0: tdmout_a;
                 * 1: tdmout_b;
                clock-names = "mclk", "clk_srcpll";
                pinctrl-names = "tdm_pins";
                pinctrl-0 = <&tdmc_mclk &tdmout_c &tdmin_c>;
+               mclk_pad = <1>;  /* 0: mclk_0; 1: mclk_1 */
+       };
+
+       tdmlb: tdm@3 {
+               compatible = "amlogic, g12a-snd-tdmlb";
+               #sound-dai-cells = <0>;
+               dai-tdm-lane-lb-slot-mask-in = <1 0 0 0>;
+               dai-tdm-clk-sel = <1>;
+               clocks = <&clkaudio CLKID_AUDIO_MCLK_B
+                               &clkc CLKID_MPLL1>;
+               clock-names = "mclk", "clk_srcpll";
+               /*
+                * select tdmin_lb src;
+                *0: TDMOUTA
+                *1: TDMOUTB
+                *2: TDMOUTC
+                *3: PAD_TDMINA
+                *4: PAD_TDMINB
+                *5: PAD_TDMINC
+                */
+               lb-src-sel = <1>;
+
+               status = "disabled";
        };
 
        /* copy a useless tdm to output for hdmi, no pinmux */
                filter_mode = <1>; /* mode 0~4, defalut:1 */
                status = "okay";
        };
-       aml_loopback: loopback {
-               compatible = "amlogic, snd-loopback";
-               /*
-                * 0: out rate = in data rate;
-                * 1: out rate = loopback data rate;
-                */
-               lb_mode = <0>;
+
+       loopback:loopback@0 {
+               compatible = "amlogic, g12a-loopback";
+               #sound-dai-cells = <0>;
+
+               clocks = <&clkaudio CLKID_AUDIO_PDM
+                       &clkc CLKID_FCLK_DIV3
+                       &clkc CLKID_MPLL3
+                       &clkaudio CLKID_AUDIO_PDMIN0
+                       &clkaudio CLKID_AUDIO_PDMIN1
+                       &clkc CLKID_MPLL0
+                       &clkaudio CLKID_AUDIO_MCLK_A>;
+               clock-names = "pdm_gate",
+                       "pdm_sysclk_srcpll",
+                       "pdm_dclk_srcpll",
+                       "pdm_dclk",
+                       "pdm_sysclk",
+                       "tdminlb_mpll",
+                       "tdminlb_mclk";
 
                /* datain src
                 * 0: tdmin_a;
                 * 4: pdmin;
                 */
                datain_src = <4>;
-               datain_chnum = <8>;
-               datain_chmask = <0x3f>;
+               datain_chnum = <4>;
+               datain_chmask = <0xf>;
+               /* config which data pin for loopback */
+               datain-lane-mask-in = <1 0 1 0>;
+
+               /* calc mclk for datalb */
+               mclk-fs = <256>;
 
                /* tdmin_lb src
                 * 0: tdmoutA
                 * 1: tdmoutB
                 * 2: tdmoutC
-                * 3: PAD_tdminA
-                * 4: PAD_tdminB
-                * 5: PAD_tdminC
+                * 3: PAD_TDMINA_DIN*, refer to core pinmux
+                * 4: PAD_TDMINB_DIN*, refer to core pinmux
+                * 5: PAD_TDMINC_DIN*, refer to core pinmux
+                * 6: PAD_TDMINA_D*, oe, refer to core pinmux
+                * 7: PAD_TDMINB_D*, oe, refer to core pinmux
                 */
-               datalb_src = <2>;
-               datalb_chnum = <8>;
+               /* if tdmin_lb >= 3, use external loopback */
+               datalb_src = <1>;
+               datalb_chnum = <2>;
                datalb_chmask = <0x3>;
+               /* config which data pin as loopback */
+               datalb-lane-mask-in = <1 0 0 0>;
 
                status = "okay";
        };
index 7e8d963..e8e9153 100644 (file)
                compatible = "amlogic, g12a-sound-card";
                aml-audio-card,name = "AML-AUGESOUND";
 
-               aml-audio-card,loopback = <&aml_loopback>;
                aml-audio-card,aux-devs = <&amlogic_codec>;
                /*avout mute gpio*/
                avout_mute-gpios = <&gpio_ao GPIOAO_2 GPIO_ACTIVE_HIGH>;
                                sound-dai = <&dummy_codec>;
                        };
                };
+
+               aml-audio-card,dai-link@6 {
+                       mclk-fs = <256>;
+                       continuous-clock;
+                       suffix-name = "alsaPORT-loopback";
+                       cpu {
+                               sound-dai = <&loopback>;
+                               system-clock-frequency = <12288000>;
+                       };
+                       codec {
+                               sound-dai = <&dummy_codec>;
+                       };
+               };
+
+
                /*
                 * dai link for i2s to hdmix,
                 * Notice to select a tdm lane not used by hw
                        "samesource_srcpll", "samesource_clk";
                pinctrl-names = "tdm_pins";
                pinctrl-0 = <&tdmb_mclk &tdmout_b &tdmin_b>;
+               mclk_pad = <0>;  /* 0: mclk_0; 1: mclk_1 */
                /*
                 * 0: tdmout_a;
                 * 1: tdmout_b;
                clock-names = "mclk", "clk_srcpll";
                pinctrl-names = "tdm_pins";
                pinctrl-0 = <&tdmc_mclk &tdmout_c &tdmin_c>;
+               mclk_pad = <1>;  /* 0: mclk_0; 1: mclk_1 */
+       };
+
+       tdmlb: tdm@3 {
+               compatible = "amlogic, g12a-snd-tdmlb";
+               #sound-dai-cells = <0>;
+               dai-tdm-lane-lb-slot-mask-in = <1 0 0 0>;
+               dai-tdm-clk-sel = <1>;
+               clocks = <&clkaudio CLKID_AUDIO_MCLK_B
+                               &clkc CLKID_MPLL1>;
+               clock-names = "mclk", "clk_srcpll";
+               /*
+                * select tdmin_lb src;
+                *0: TDMOUTA
+                *1: TDMOUTB
+                *2: TDMOUTC
+                *3: PAD_TDMINA
+                *4: PAD_TDMINB
+                *5: PAD_TDMINC
+                */
+               lb-src-sel = <1>;
+
+               status = "disabled";
        };
 
        /* copy a useless tdm to output for hdmi, no pinmux */
                filter_mode = <1>; /* mode 0~4, defalut:1 */
                status = "okay";
        };
-       aml_loopback: loopback {
-               compatible = "amlogic, snd-loopback";
-               /*
-                * 0: out rate = in data rate;
-                * 1: out rate = loopback data rate;
-                */
-               lb_mode = <0>;
+
+       loopback:loopback@0 {
+               compatible = "amlogic, g12a-loopback";
+               #sound-dai-cells = <0>;
+
+               clocks = <&clkaudio CLKID_AUDIO_PDM
+                       &clkc CLKID_FCLK_DIV3
+                       &clkc CLKID_MPLL3
+                       &clkaudio CLKID_AUDIO_PDMIN0
+                       &clkaudio CLKID_AUDIO_PDMIN1
+                       &clkc CLKID_MPLL0
+                       &clkaudio CLKID_AUDIO_MCLK_A>;
+               clock-names = "pdm_gate",
+                       "pdm_sysclk_srcpll",
+                       "pdm_dclk_srcpll",
+                       "pdm_dclk",
+                       "pdm_sysclk",
+                       "tdminlb_mpll",
+                       "tdminlb_mclk";
 
                /* datain src
                 * 0: tdmin_a;
                 * 4: pdmin;
                 */
                datain_src = <4>;
-               datain_chnum = <8>;
-               datain_chmask = <0x3f>;
+               datain_chnum = <4>;
+               datain_chmask = <0xf>;
+               /* config which data pin for loopback */
+               datain-lane-mask-in = <1 0 1 0>;
+
+               /* calc mclk for datalb */
+               mclk-fs = <256>;
 
                /* tdmin_lb src
                 * 0: tdmoutA
                 * 1: tdmoutB
                 * 2: tdmoutC
-                * 3: PAD_tdminA
-                * 4: PAD_tdminB
-                * 5: PAD_tdminC
+                * 3: PAD_TDMINA_DIN*, refer to core pinmux
+                * 4: PAD_TDMINB_DIN*, refer to core pinmux
+                * 5: PAD_TDMINC_DIN*, refer to core pinmux
+                * 6: PAD_TDMINA_D*, oe, refer to core pinmux
+                * 7: PAD_TDMINB_D*, oe, refer to core pinmux
                 */
-               datalb_src = <2>;
-               datalb_chnum = <8>;
+               /* if tdmin_lb >= 3, use external loopback */
+               datalb_src = <1>;
+               datalb_chnum = <2>;
                datalb_chmask = <0x3>;
+               /* config which data pin as loopback */
+               datalb-lane-mask-in = <1 0 0 0>;
 
                status = "okay";
        };
index 110986b..3a2d8b2 100644 (file)
                compatible = "amlogic, g12a-sound-card";
                aml-audio-card,name = "AML-AUGESOUND";
 
-               aml-audio-card,loopback = <&aml_loopback>;
                aml-audio-card,aux-devs = <&amlogic_codec>;
                /*avout mute gpio*/
                avout_mute-gpios = <&gpio_ao GPIOAO_2 GPIO_ACTIVE_HIGH>;
                                sound-dai = <&dummy_codec>;
                        };
                };
+
+               aml-audio-card,dai-link@6 {
+                       mclk-fs = <256>;
+                       continuous-clock;
+                       suffix-name = "alsaPORT-loopback";
+                       cpu {
+                               sound-dai = <&loopback>;
+                               system-clock-frequency = <12288000>;
+                       };
+                       codec {
+                               sound-dai = <&dummy_codec>;
+                       };
+               };
        };
        audiolocker: locker {
                compatible = "amlogic, audiolocker";
                        "samesource_srcpll", "samesource_clk";
                pinctrl-names = "tdm_pins";
                pinctrl-0 = <&tdmb_mclk &tdmout_b &tdmin_b>;
+               mclk_pad = <0>;  /* 0: mclk_0; 1: mclk_1 */
                /*
                 * 0: tdmout_a;
                 * 1: tdmout_b;
                clock-names = "mclk", "clk_srcpll";
                pinctrl-names = "tdm_pins";
                pinctrl-0 = <&tdmc_mclk &tdmout_c &tdmin_c>;
+               mclk_pad = <1>;  /* 0: mclk_0; 1: mclk_1 */
        };
 
+       tdmlb: tdm@3 {
+               compatible = "amlogic, g12a-snd-tdmlb";
+               #sound-dai-cells = <0>;
+               dai-tdm-lane-lb-slot-mask-in = <1 0 0 0>;
+               dai-tdm-clk-sel = <1>;
+               clocks = <&clkaudio CLKID_AUDIO_MCLK_B
+                               &clkc CLKID_MPLL1>;
+               clock-names = "mclk", "clk_srcpll";
+               /*
+                * select tdmin_lb src;
+                *0: TDMOUTA
+                *1: TDMOUTB
+                *2: TDMOUTC
+                *3: PAD_TDMINA
+                *4: PAD_TDMINB
+                *5: PAD_TDMINC
+                */
+               lb-src-sel = <1>;
+
+               status = "disabled";
+       };
 
        aml_spdif: spdif {
                compatible = "amlogic, g12a-snd-spdif-a";
                filter_mode = <1>; /* mode 0~4, defalut:1 */
                status = "okay";
        };
-       aml_loopback: loopback {
-               compatible = "amlogic, snd-loopback";
-               /*
-                * 0: out rate = in data rate;
-                * 1: out rate = loopback data rate;
-                */
-               lb_mode = <0>;
+
+       loopback:loopback@0 {
+               compatible = "amlogic, g12a-loopback";
+               #sound-dai-cells = <0>;
+
+               clocks = <&clkaudio CLKID_AUDIO_PDM
+                       &clkc CLKID_FCLK_DIV3
+                       &clkc CLKID_MPLL3
+                       &clkaudio CLKID_AUDIO_PDMIN0
+                       &clkaudio CLKID_AUDIO_PDMIN1
+                       &clkc CLKID_MPLL0
+                       &clkaudio CLKID_AUDIO_MCLK_A>;
+               clock-names = "pdm_gate",
+                       "pdm_sysclk_srcpll",
+                       "pdm_dclk_srcpll",
+                       "pdm_dclk",
+                       "pdm_sysclk",
+                       "tdminlb_mpll",
+                       "tdminlb_mclk";
 
                /* datain src
                 * 0: tdmin_a;
                 * 4: pdmin;
                 */
                datain_src = <4>;
-               datain_chnum = <8>;
-               datain_chmask = <0x3f>;
+               datain_chnum = <4>;
+               datain_chmask = <0xf>;
+               /* config which data pin for loopback */
+               datain-lane-mask-in = <1 0 1 0>;
+
+               /* calc mclk for datalb */
+               mclk-fs = <256>;
 
                /* tdmin_lb src
                 * 0: tdmoutA
                 * 1: tdmoutB
                 * 2: tdmoutC
-                * 3: PAD_tdminA
-                * 4: PAD_tdminB
-                * 5: PAD_tdminC
+                * 3: PAD_TDMINA_DIN*, refer to core pinmux
+                * 4: PAD_TDMINB_DIN*, refer to core pinmux
+                * 5: PAD_TDMINC_DIN*, refer to core pinmux
+                * 6: PAD_TDMINA_D*, oe, refer to core pinmux
+                * 7: PAD_TDMINB_D*, oe, refer to core pinmux
                 */
-               datalb_src = <2>;
-               datalb_chnum = <8>;
+               /* if tdmin_lb >= 3, use external loopback */
+               datalb_src = <1>;
+               datalb_chnum = <2>;
                datalb_chmask = <0x3>;
+               /* config which data pin as loopback */
+               datalb-lane-mask-in = <1 0 0 0>;
 
                status = "okay";
        };
index e38063f..3015d5d 100644 (file)
                compatible = "amlogic, g12a-sound-card";
                aml-audio-card,name = "AML-AUGESOUND";
 
-               aml-audio-card,loopback = <&aml_loopback>;
                aml-audio-card,aux-devs = <&amlogic_codec>;
                /*avout mute gpio*/
                avout_mute-gpios = <&gpio_ao GPIOAO_2 GPIO_ACTIVE_HIGH>;
                                sound-dai = <&dummy_codec>;
                        };
                };
+
+               aml-audio-card,dai-link@6 {
+                       mclk-fs = <256>;
+                       continuous-clock;
+                       suffix-name = "alsaPORT-loopback";
+                       cpu {
+                               sound-dai = <&loopback>;
+                               system-clock-frequency = <12288000>;
+                       };
+                       codec {
+                               sound-dai = <&dummy_codec>;
+                       };
+               };
+
                /*
                 * dai link for i2s to hdmix,
                 * Notice to select a tdm lane not used by hw
                        "samesource_srcpll", "samesource_clk";
                pinctrl-names = "tdm_pins";
                pinctrl-0 = <&tdmb_mclk &tdmout_b &tdmin_b>;
+               mclk_pad = <0>;  /* 0: mclk_0; 1: mclk_1 */
                /*
                 * 0: tdmout_a;
                 * 1: tdmout_b;
                clock-names = "mclk", "clk_srcpll";
                pinctrl-names = "tdm_pins";
                pinctrl-0 = <&tdmc_mclk &tdmout_c &tdmin_c>;
+               mclk_pad = <1>;  /* 0: mclk_0; 1: mclk_1 */
+       };
+
+       tdmlb: tdm@3 {
+               compatible = "amlogic, g12a-snd-tdmlb";
+               #sound-dai-cells = <0>;
+               dai-tdm-lane-lb-slot-mask-in = <1 0 0 0>;
+               dai-tdm-clk-sel = <1>;
+               clocks = <&clkaudio CLKID_AUDIO_MCLK_B
+                               &clkc CLKID_MPLL1>;
+               clock-names = "mclk", "clk_srcpll";
+               /*
+                * select tdmin_lb src;
+                *0: TDMOUTA
+                *1: TDMOUTB
+                *2: TDMOUTC
+                *3: PAD_TDMINA
+                *4: PAD_TDMINB
+                *5: PAD_TDMINC
+                */
+               lb-src-sel = <1>;
+
+               status = "disabled";
        };
 
        /* copy a useless tdm to output for hdmi, no pinmux */
                filter_mode = <1>; /* mode 0~4, defalut:1 */
                status = "okay";
        };
-       aml_loopback: loopback {
-               compatible = "amlogic, snd-loopback";
-               /*
-                * 0: out rate = in data rate;
-                * 1: out rate = loopback data rate;
-                */
-               lb_mode = <0>;
+
+       loopback:loopback@0 {
+               compatible = "amlogic, g12a-loopback";
+               #sound-dai-cells = <0>;
+
+               clocks = <&clkaudio CLKID_AUDIO_PDM
+                       &clkc CLKID_FCLK_DIV3
+                       &clkc CLKID_MPLL3
+                       &clkaudio CLKID_AUDIO_PDMIN0
+                       &clkaudio CLKID_AUDIO_PDMIN1
+                       &clkc CLKID_MPLL0
+                       &clkaudio CLKID_AUDIO_MCLK_A>;
+               clock-names = "pdm_gate",
+                       "pdm_sysclk_srcpll",
+                       "pdm_dclk_srcpll",
+                       "pdm_dclk",
+                       "pdm_sysclk",
+                       "tdminlb_mpll",
+                       "tdminlb_mclk";
 
                /* datain src
                 * 0: tdmin_a;
                 * 4: pdmin;
                 */
                datain_src = <4>;
-               datain_chnum = <8>;
-               datain_chmask = <0x3f>;
+               datain_chnum = <4>;
+               datain_chmask = <0xf>;
+               /* config which data pin for loopback */
+               datain-lane-mask-in = <1 0 1 0>;
+
+               /* calc mclk for datalb */
+               mclk-fs = <256>;
 
                /* tdmin_lb src
                 * 0: tdmoutA
                 * 1: tdmoutB
                 * 2: tdmoutC
-                * 3: PAD_tdminA
-                * 4: PAD_tdminB
-                * 5: PAD_tdminC
+                * 3: PAD_TDMINA_DIN*, refer to core pinmux
+                * 4: PAD_TDMINB_DIN*, refer to core pinmux
+                * 5: PAD_TDMINC_DIN*, refer to core pinmux
+                * 6: PAD_TDMINA_D*, oe, refer to core pinmux
+                * 7: PAD_TDMINB_D*, oe, refer to core pinmux
                 */
-               datalb_src = <2>;
-               datalb_chnum = <8>;
+               /* if tdmin_lb >= 3, use external loopback */
+               datalb_src = <1>;
+               datalb_chnum = <2>;
                datalb_chmask = <0x3>;
+               /* config which data pin as loopback */
+               datalb-lane-mask-in = <1 0 0 0>;
 
                status = "okay";
        };
index 799ed0b..e80ae48 100644 (file)
                compatible = "amlogic, g12a-sound-card";
                aml-audio-card,name = "AML-AUGESOUND";
 
-               aml-audio-card,loopback = <&aml_loopback>;
                aml-audio-card,aux-devs = <&amlogic_codec>;
                /*avout mute gpio*/
                avout_mute-gpios = <&gpio_ao GPIOAO_2 GPIO_ACTIVE_HIGH>;
                                sound-dai = <&dummy_codec>;
                        };
                };
+
+               aml-audio-card,dai-link@6 {
+                       mclk-fs = <256>;
+                       continuous-clock;
+                       suffix-name = "alsaPORT-loopback";
+                       cpu {
+                               sound-dai = <&loopback>;
+                               system-clock-frequency = <12288000>;
+                       };
+                       codec {
+                               sound-dai = <&dummy_codec>;
+                       };
+               };
+
                /*
                 * dai link for i2s to hdmix,
                 * Notice to select a tdm lane not used by hw
                        "samesource_srcpll", "samesource_clk";
                pinctrl-names = "tdm_pins";
                pinctrl-0 = <&tdmb_mclk &tdmout_b &tdmin_b>;
+               mclk_pad = <0>;  /* 0: mclk_0; 1: mclk_1 */
                /*
                 * 0: tdmout_a;
                 * 1: tdmout_b;
                clock-names = "mclk", "clk_srcpll";
                pinctrl-names = "tdm_pins";
                pinctrl-0 = <&tdmc_mclk &tdmout_c &tdmin_c>;
+               mclk_pad = <1>;  /* 0: mclk_0; 1: mclk_1 */
+       };
+
+       tdmlb: tdm@3 {
+               compatible = "amlogic, g12a-snd-tdmlb";
+               #sound-dai-cells = <0>;
+               dai-tdm-lane-lb-slot-mask-in = <1 0 0 0>;
+               dai-tdm-clk-sel = <1>;
+               clocks = <&clkaudio CLKID_AUDIO_MCLK_B
+                               &clkc CLKID_MPLL1>;
+               clock-names = "mclk", "clk_srcpll";
+               /*
+                * select tdmin_lb src;
+                *0: TDMOUTA
+                *1: TDMOUTB
+                *2: TDMOUTC
+                *3: PAD_TDMINA
+                *4: PAD_TDMINB
+                *5: PAD_TDMINC
+                */
+               lb-src-sel = <1>;
+
+               status = "disabled";
        };
 
        /* copy a useless tdm to output for hdmi, no pinmux */
                filter_mode = <1>; /* mode 0~4, defalut:1 */
                status = "okay";
        };
-       aml_loopback: loopback {
-               compatible = "amlogic, snd-loopback";
-               /*
-                * 0: out rate = in data rate;
-                * 1: out rate = loopback data rate;
-                */
-               lb_mode = <0>;
+
+       loopback:loopback@0 {
+               compatible = "amlogic, g12a-loopback";
+               #sound-dai-cells = <0>;
+
+               clocks = <&clkaudio CLKID_AUDIO_PDM
+                       &clkc CLKID_FCLK_DIV3
+                       &clkc CLKID_MPLL3
+                       &clkaudio CLKID_AUDIO_PDMIN0
+                       &clkaudio CLKID_AUDIO_PDMIN1
+                       &clkc CLKID_MPLL0
+                       &clkaudio CLKID_AUDIO_MCLK_A>;
+               clock-names = "pdm_gate",
+                       "pdm_sysclk_srcpll",
+                       "pdm_dclk_srcpll",
+                       "pdm_dclk",
+                       "pdm_sysclk",
+                       "tdminlb_mpll",
+                       "tdminlb_mclk";
 
                /* datain src
                 * 0: tdmin_a;
                 * 4: pdmin;
                 */
                datain_src = <4>;
-               datain_chnum = <8>;
-               datain_chmask = <0x3f>;
+               datain_chnum = <4>;
+               datain_chmask = <0xf>;
+               /* config which data pin for loopback */
+               datain-lane-mask-in = <1 0 1 0>;
+
+               /* calc mclk for datalb */
+               mclk-fs = <256>;
 
                /* tdmin_lb src
                 * 0: tdmoutA
                 * 1: tdmoutB
                 * 2: tdmoutC
-                * 3: PAD_tdminA
-                * 4: PAD_tdminB
-                * 5: PAD_tdminC
+                * 3: PAD_TDMINA_DIN*, refer to core pinmux
+                * 4: PAD_TDMINB_DIN*, refer to core pinmux
+                * 5: PAD_TDMINC_DIN*, refer to core pinmux
+                * 6: PAD_TDMINA_D*, oe, refer to core pinmux
+                * 7: PAD_TDMINB_D*, oe, refer to core pinmux
                 */
-               datalb_src = <2>;
-               datalb_chnum = <8>;
+               /* if tdmin_lb >= 3, use external loopback */
+               datalb_src = <1>;
+               datalb_chnum = <2>;
                datalb_chmask = <0x3>;
+               /* config which data pin as loopback */
+               datalb-lane-mask-in = <1 0 0 0>;
 
                status = "okay";
        };
index 4b5d755..caf13a1 100644 (file)
                compatible = "amlogic, g12a-sound-card";
                aml-audio-card,name = "AML-AUGESOUND";
 
-               aml-audio-card,loopback = <&aml_loopback>;
                aml-audio-card,aux-devs = <&amlogic_codec>;
                /*avout mute gpio*/
                avout_mute-gpios = <&gpio_ao GPIOAO_2 GPIO_ACTIVE_HIGH>;
                                sound-dai = <&dummy_codec>;
                        };
                };
+
+               aml-audio-card,dai-link@6 {
+                       mclk-fs = <256>;
+                       continuous-clock;
+                       suffix-name = "alsaPORT-loopback";
+                       cpu {
+                               sound-dai = <&loopback>;
+                               system-clock-frequency = <12288000>;
+                       };
+                       codec {
+                               sound-dai = <&dummy_codec>;
+                       };
+               };
        };
        audiolocker: locker {
                compatible = "amlogic, audiolocker";
                        "samesource_srcpll", "samesource_clk";
                pinctrl-names = "tdm_pins";
                pinctrl-0 = <&tdmb_mclk &tdmout_b &tdmin_b>;
+               mclk_pad = <0>;  /* 0: mclk_0; 1: mclk_1 */
                /*
                 * 0: tdmout_a;
                 * 1: tdmout_b;
                clock-names = "mclk", "clk_srcpll";
                pinctrl-names = "tdm_pins";
                pinctrl-0 = <&tdmc_mclk &tdmout_c &tdmin_c>;
+               mclk_pad = <1>;  /* 0: mclk_0; 1: mclk_1 */
        };
 
+       tdmlb: tdm@3 {
+               compatible = "amlogic, g12a-snd-tdmlb";
+               #sound-dai-cells = <0>;
+               dai-tdm-lane-lb-slot-mask-in = <1 0 0 0>;
+               dai-tdm-clk-sel = <1>;
+               clocks = <&clkaudio CLKID_AUDIO_MCLK_B
+                               &clkc CLKID_MPLL1>;
+               clock-names = "mclk", "clk_srcpll";
+               /*
+                * select tdmin_lb src;
+                *0: TDMOUTA
+                *1: TDMOUTB
+                *2: TDMOUTC
+                *3: PAD_TDMINA
+                *4: PAD_TDMINB
+                *5: PAD_TDMINC
+                */
+               lb-src-sel = <1>;
+
+               status = "disabled";
+       };
 
        aml_spdif: spdif {
                compatible = "amlogic, g12a-snd-spdif-a";
                filter_mode = <1>; /* mode 0~4, defalut:1 */
                status = "okay";
        };
-       aml_loopback: loopback {
-               compatible = "amlogic, snd-loopback";
-               /*
-                * 0: out rate = in data rate;
-                * 1: out rate = loopback data rate;
-                */
-               lb_mode = <0>;
+
+       loopback:loopback@0 {
+               compatible = "amlogic, g12a-loopback";
+               #sound-dai-cells = <0>;
+
+               clocks = <&clkaudio CLKID_AUDIO_PDM
+                       &clkc CLKID_FCLK_DIV3
+                       &clkc CLKID_MPLL3
+                       &clkaudio CLKID_AUDIO_PDMIN0
+                       &clkaudio CLKID_AUDIO_PDMIN1
+                       &clkc CLKID_MPLL0
+                       &clkaudio CLKID_AUDIO_MCLK_A>;
+               clock-names = "pdm_gate",
+                       "pdm_sysclk_srcpll",
+                       "pdm_dclk_srcpll",
+                       "pdm_dclk",
+                       "pdm_sysclk",
+                       "tdminlb_mpll",
+                       "tdminlb_mclk";
 
                /* datain src
                 * 0: tdmin_a;
                 * 4: pdmin;
                 */
                datain_src = <4>;
-               datain_chnum = <8>;
-               datain_chmask = <0x3f>;
+               datain_chnum = <4>;
+               datain_chmask = <0xf>;
+               /* config which data pin for loopback */
+               datain-lane-mask-in = <1 0 1 0>;
+
+               /* calc mclk for datalb */
+               mclk-fs = <256>;
 
                /* tdmin_lb src
                 * 0: tdmoutA
                 * 1: tdmoutB
                 * 2: tdmoutC
-                * 3: PAD_tdminA
-                * 4: PAD_tdminB
-                * 5: PAD_tdminC
+                * 3: PAD_TDMINA_DIN*, refer to core pinmux
+                * 4: PAD_TDMINB_DIN*, refer to core pinmux
+                * 5: PAD_TDMINC_DIN*, refer to core pinmux
+                * 6: PAD_TDMINA_D*, oe, refer to core pinmux
+                * 7: PAD_TDMINB_D*, oe, refer to core pinmux
                 */
-               datalb_src = <2>;
-               datalb_chnum = <8>;
+               /* if tdmin_lb >= 3, use external loopback */
+               datalb_src = <1>;
+               datalb_chnum = <2>;
                datalb_chmask = <0x3>;
+               /* config which data pin as loopback */
+               datalb-lane-mask-in = <1 0 0 0>;
 
                status = "okay";
        };
index 738792d..094a569 100644 (file)
                compatible = "amlogic, g12a-sound-card";
                aml-audio-card,name = "AML-AUGESOUND";
 
-               aml-audio-card,loopback = <&aml_loopback>;
                aml-audio-card,aux-devs = <&amlogic_codec>;
                /*avout mute gpio*/
                avout_mute-gpios = <&gpio_ao GPIOAO_2 GPIO_ACTIVE_HIGH>;
                                sound-dai = <&dummy_codec>;
                        };
                };
+
+               aml-audio-card,dai-link@6 {
+                       mclk-fs = <256>;
+                       continuous-clock;
+                       suffix-name = "alsaPORT-loopback";
+                       cpu {
+                               sound-dai = <&loopback>;
+                               system-clock-frequency = <12288000>;
+                       };
+                       codec {
+                               sound-dai = <&dummy_codec>;
+                       };
+               };
+
                /*
                 * dai link for i2s to hdmix,
                 * Notice to select a tdm lane not used by hw
                        "samesource_srcpll", "samesource_clk";
                pinctrl-names = "tdm_pins";
                pinctrl-0 = <&tdmb_mclk &tdmout_b &tdmin_b>;
+               mclk_pad = <0>;  /* 0: mclk_0; 1: mclk_1 */
                /*
                 * 0: tdmout_a;
                 * 1: tdmout_b;
                clock-names = "mclk", "clk_srcpll";
                pinctrl-names = "tdm_pins";
                pinctrl-0 = <&tdmc_mclk &tdmout_c &tdmin_c>;
+               mclk_pad = <1>;  /* 0: mclk_0; 1: mclk_1 */
+       };
+
+       tdmlb: tdm@3 {
+               compatible = "amlogic, g12a-snd-tdmlb";
+               #sound-dai-cells = <0>;
+               dai-tdm-lane-lb-slot-mask-in = <1 0 0 0>;
+               dai-tdm-clk-sel = <1>;
+               clocks = <&clkaudio CLKID_AUDIO_MCLK_B
+                               &clkc CLKID_MPLL1>;
+               clock-names = "mclk", "clk_srcpll";
+               /*
+                * select tdmin_lb src;
+                *0: TDMOUTA
+                *1: TDMOUTB
+                *2: TDMOUTC
+                *3: PAD_TDMINA
+                *4: PAD_TDMINB
+                *5: PAD_TDMINC
+                */
+               lb-src-sel = <1>;
+
+               status = "disabled";
        };
 
        /* copy a useless tdm to output for hdmi, no pinmux */
                filter_mode = <1>; /* mode 0~4, defalut:1 */
                status = "okay";
        };
-       aml_loopback: loopback {
-               compatible = "amlogic, snd-loopback";
-               /*
-                * 0: out rate = in data rate;
-                * 1: out rate = loopback data rate;
-                */
-               lb_mode = <0>;
+
+       loopback:loopback@0 {
+               compatible = "amlogic, g12a-loopback";
+               #sound-dai-cells = <0>;
+
+               clocks = <&clkaudio CLKID_AUDIO_PDM
+                       &clkc CLKID_FCLK_DIV3
+                       &clkc CLKID_MPLL3
+                       &clkaudio CLKID_AUDIO_PDMIN0
+                       &clkaudio CLKID_AUDIO_PDMIN1
+                       &clkc CLKID_MPLL0
+                       &clkaudio CLKID_AUDIO_MCLK_A>;
+               clock-names = "pdm_gate",
+                       "pdm_sysclk_srcpll",
+                       "pdm_dclk_srcpll",
+                       "pdm_dclk",
+                       "pdm_sysclk",
+                       "tdminlb_mpll",
+                       "tdminlb_mclk";
 
                /* datain src
                 * 0: tdmin_a;
                 * 4: pdmin;
                 */
                datain_src = <4>;
-               datain_chnum = <8>;
-               datain_chmask = <0x3f>;
+               datain_chnum = <4>;
+               datain_chmask = <0xf>;
+               /* config which data pin for loopback */
+               datain-lane-mask-in = <1 0 1 0>;
+
+               /* calc mclk for datalb */
+               mclk-fs = <256>;
 
                /* tdmin_lb src
                 * 0: tdmoutA
                 * 1: tdmoutB
                 * 2: tdmoutC
-                * 3: PAD_tdminA
-                * 4: PAD_tdminB
-                * 5: PAD_tdminC
+                * 3: PAD_TDMINA_DIN*, refer to core pinmux
+                * 4: PAD_TDMINB_DIN*, refer to core pinmux
+                * 5: PAD_TDMINC_DIN*, refer to core pinmux
+                * 6: PAD_TDMINA_D*, oe, refer to core pinmux
+                * 7: PAD_TDMINB_D*, oe, refer to core pinmux
                 */
-               datalb_src = <2>;
-               datalb_chnum = <8>;
+               /* if tdmin_lb >= 3, use external loopback */
+               datalb_src = <1>;
+               datalb_chnum = <2>;
                datalb_chmask = <0x3>;
+               /* config which data pin as loopback */
+               datalb-lane-mask-in = <1 0 0 0>;
 
                status = "okay";
        };
index 2ae7ce4..87e704d 100644 (file)
                compatible = "amlogic, g12a-sound-card";
                aml-audio-card,name = "AML-AUGESOUND";
 
-               aml-audio-card,loopback = <&aml_loopback>;
                aml-audio-card,aux-devs = <&amlogic_codec>;
                /*avout mute gpio*/
                avout_mute-gpios = <&gpio_ao GPIOAO_2 GPIO_ACTIVE_HIGH>;
                                sound-dai = <&dummy_codec>;
                        };
                };
+
                /*
                 * dai link for i2s to hdmix,
                 * Notice to select a tdm lane not used by hw
                                sound-dai = <&dummy_codec>;
                        };
                };
+
+               aml-audio-card,dai-link@7 {
+                       mclk-fs = <256>;
+                       continuous-clock;
+                       suffix-name = "alsaPORT-loopback";
+                       cpu {
+                               sound-dai = <&loopback>;
+                               system-clock-frequency = <12288000>;
+                       };
+                       codec {
+                               sound-dai = <&dummy_codec>;
+                       };
+               };
        };
        audiolocker: locker {
                compatible = "amlogic, audiolocker";
                        "samesource_srcpll", "samesource_clk";
                pinctrl-names = "tdm_pins";
                pinctrl-0 = <&tdmb_mclk &tdmout_b &tdmin_b>;
+               mclk_pad = <0>;  /* 0: mclk_0; 1: mclk_1 */
                /*
                 * 0: tdmout_a;
                 * 1: tdmout_b;
                clock-names = "mclk", "clk_srcpll";
                pinctrl-names = "tdm_pins";
                pinctrl-0 = <&tdmc_mclk &tdmout_c &tdmin_c>;
+               mclk_pad = <1>;  /* 0: mclk_0; 1: mclk_1 */
+       };
+
+       tdmlb: tdm@3 {
+               compatible = "amlogic, g12a-snd-tdmlb";
+               #sound-dai-cells = <0>;
+               dai-tdm-lane-lb-slot-mask-in = <1 0 0 0>;
+               dai-tdm-clk-sel = <1>;
+               clocks = <&clkaudio CLKID_AUDIO_MCLK_B
+                               &clkc CLKID_MPLL1>;
+               clock-names = "mclk", "clk_srcpll";
+               /*
+                * select tdmin_lb src;
+                *0: TDMOUTA
+                *1: TDMOUTB
+                *2: TDMOUTC
+                *3: PAD_TDMINA
+                *4: PAD_TDMINB
+                *5: PAD_TDMINC
+                */
+               lb-src-sel = <1>;
+
+               status = "disabled";
        };
 
        /* copy a useless tdm to output for hdmi, no pinmux */
                filter_mode = <1>; /* mode 0~4, defalut:1 */
                status = "okay";
        };
-       aml_loopback: loopback {
-               compatible = "amlogic, snd-loopback";
-               /*
-                * 0: out rate = in data rate;
-                * 1: out rate = loopback data rate;
-                */
-               lb_mode = <0>;
+       loopback:loopback@0 {
+               compatible = "amlogic, g12a-loopback";
+               #sound-dai-cells = <0>;
+
+               clocks = <&clkaudio CLKID_AUDIO_PDM
+                       &clkc CLKID_FCLK_DIV3
+                       &clkc CLKID_MPLL3
+                       &clkaudio CLKID_AUDIO_PDMIN0
+                       &clkaudio CLKID_AUDIO_PDMIN1
+                       &clkc CLKID_MPLL0
+                       &clkaudio CLKID_AUDIO_MCLK_A>;
+               clock-names = "pdm_gate",
+                       "pdm_sysclk_srcpll",
+                       "pdm_dclk_srcpll",
+                       "pdm_dclk",
+                       "pdm_sysclk",
+                       "tdminlb_mpll",
+                       "tdminlb_mclk";
 
                /* datain src
                 * 0: tdmin_a;
                 * 4: pdmin;
                 */
                datain_src = <4>;
-               datain_chnum = <8>;
-               datain_chmask = <0x3f>;
+               datain_chnum = <4>;
+               datain_chmask = <0xf>;
+               /* config which data pin for loopback */
+               datain-lane-mask-in = <1 0 1 0>;
+
+               /* calc mclk for datalb */
+               mclk-fs = <256>;
 
                /* tdmin_lb src
                 * 0: tdmoutA
                 * 1: tdmoutB
                 * 2: tdmoutC
-                * 3: PAD_tdminA
-                * 4: PAD_tdminB
-                * 5: PAD_tdminC
+                * 3: PAD_TDMINA_DIN*, refer to core pinmux
+                * 4: PAD_TDMINB_DIN*, refer to core pinmux
+                * 5: PAD_TDMINC_DIN*, refer to core pinmux
+                * 6: PAD_TDMINA_D*, oe, refer to core pinmux
+                * 7: PAD_TDMINB_D*, oe, refer to core pinmux
                 */
-               datalb_src = <2>;
-               datalb_chnum = <8>;
+               /* if tdmin_lb >= 3, use external loopback */
+               datalb_src = <1>;
+               datalb_chnum = <2>;
                datalb_chmask = <0x3>;
+               /* config which data pin as loopback */
+               datalb-lane-mask-in = <1 0 0 0>;
 
                status = "okay";
        };
index 370672e..6ec28d0 100644 (file)
                compatible = "amlogic, g12a-sound-card";
                aml-audio-card,name = "AML-AUGESOUND";
 
-               //aml-audio-card,loopback = <&aml_loopback>;
+
                //aml-audio-card,aux-devs = <&amlogic_codec>;
                /*avout mute gpio*/
                avout_mute-gpios = <&gpio_ao GPIOAO_2 GPIO_ACTIVE_HIGH>;
                                sound-dai = <&dummy_codec>;
                        };
                };
+
+               aml-audio-card,dai-link@6 {
+                       mclk-fs = <256>;
+                       continuous-clock;
+                       suffix-name = "alsaPORT-loopback";
+                       cpu {
+                               sound-dai = <&loopback>;
+                               system-clock-frequency = <12288000>;
+                       };
+                       codec {
+                               sound-dai = <&dummy_codec>;
+                       };
+               };
+
+               aml-audio-card,dai-link@7 {
+                       format = "i2s";
+                       mclk-fs = <256>;
+                       //continuous-clock;
+                       //bitclock-inversion;
+                       //frame-inversion;
+                       bitclock-master = <&tdmlb>;
+                       frame-master = <&tdmlb>;
+                       cpu {
+                               sound-dai = <&tdmlb>;
+                               dai-tdm-slot-rx-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";
                        "samesource_srcpll", "samesource_clk";
                pinctrl-names = "tdm_pins";
                pinctrl-0 = <&tdmb_mclk &tdmout_b &tdmin_b>;
+               mclk_pad = <0>;  /* 0: mclk_0; 1: mclk_1 */
                /*
                 * 0: tdmout_a;
                 * 1: tdmout_b;
                clock-names = "mclk", "clk_srcpll";
                pinctrl-names = "tdm_pins";
                pinctrl-0 = <&tdmc_mclk &tdmout_c &tdmin_c>;
+               mclk_pad = <1>;  /* 0: mclk_0; 1: mclk_1 */
        };
 
-       /* copy a useless tdm to output for hdmi, no pinmux */
-       aml_i2s2hdmi: i2s2hdmi {
-               compatible = "amlogic, g12a-snd-tdmc";
+       tdmlb: tdm@3 {
+               compatible = "amlogic, g12a-snd-tdmlb";
                #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>;
+               dai-tdm-lane-lb-slot-mask-in = <1 0 0 0>;
+               dai-tdm-clk-sel = <1>;
+               clocks = <&clkaudio CLKID_AUDIO_MCLK_B
+                               &clkc CLKID_MPLL1>;
                clock-names = "mclk", "clk_srcpll";
-
-               i2s2hdmi = <1>;
+               /*
+                * select tdmin_lb src;
+                *0: TDMOUTA
+                *1: TDMOUTB
+                *2: TDMOUTC
+                *3: PAD_TDMINA
+                *4: PAD_TDMINB
+                *5: PAD_TDMINC
+                */
+               lb-src-sel = <1>;
 
                status = "okay";
        };
                filter_mode = <1>; /* mode 0~4, defalut:1 */
                status = "okay";
        };
-       aml_loopback: loopback {
-               compatible = "amlogic, snd-loopback";
-               /*
-                * 0: out rate = in data rate;
-                * 1: out rate = loopback data rate;
-                */
-               lb_mode = <0>;
+
+       loopback:loopback@0 {
+               compatible = "amlogic, g12a-loopback";
+               #sound-dai-cells = <0>;
+
+               clocks = <&clkaudio CLKID_AUDIO_PDM
+                       &clkc CLKID_FCLK_DIV3
+                       &clkc CLKID_MPLL3
+                       &clkaudio CLKID_AUDIO_PDMIN0
+                       &clkaudio CLKID_AUDIO_PDMIN1
+                       &clkc CLKID_MPLL0
+                       &clkaudio CLKID_AUDIO_MCLK_A>;
+               clock-names = "pdm_gate",
+                       "pdm_sysclk_srcpll",
+                       "pdm_dclk_srcpll",
+                       "pdm_dclk",
+                       "pdm_sysclk",
+                       "tdminlb_mpll",
+                       "tdminlb_mclk";
 
                /* datain src
                 * 0: tdmin_a;
                 * 4: pdmin;
                 */
                datain_src = <4>;
-               datain_chnum = <8>;
-               datain_chmask = <0x3f>;
+               datain_chnum = <4>;
+               datain_chmask = <0xf>;
+               /* config which data pin for loopback */
+               datain-lane-mask-in = <1 0 1 0>;
+
+               /* calc mclk for datalb */
+               mclk-fs = <256>;
 
                /* tdmin_lb src
                 * 0: tdmoutA
                 * 1: tdmoutB
                 * 2: tdmoutC
-                * 3: PAD_tdminA
-                * 4: PAD_tdminB
-                * 5: PAD_tdminC
+                * 3: PAD_TDMINA_DIN*, refer to core pinmux
+                * 4: PAD_TDMINB_DIN*, refer to core pinmux
+                * 5: PAD_TDMINC_DIN*, refer to core pinmux
+                * 6: PAD_TDMINA_D*, oe, refer to core pinmux
+                * 7: PAD_TDMINB_D*, oe, refer to core pinmux
                 */
-               datalb_src = <2>;
-               datalb_chnum = <8>;
+               /* if tdmin_lb >= 3, use external loopback */
+               datalb_src = <1>;
+               datalb_chnum = <2>;
                datalb_chmask = <0x3>;
+               /* config which data pin as loopback */
+               datalb-lane-mask-in = <1 0 0 0>;
 
-               status = "disabled";
+               status = "okay";
        };
 
        audioresample: resample {
index 23966d1..bc047b3 100644 (file)
                compatible = "amlogic, g12a-sound-card";
                aml-audio-card,name = "AML-AUGESOUND";
 
-               //aml-audio-card,loopback = <&aml_loopback>;
+
                //aml-audio-card,aux-devs = <&amlogic_codec>;
                /*avout mute gpio*/
                avout_mute-gpios = <&gpio_ao GPIOAO_2 GPIO_ACTIVE_HIGH>;
                                sound-dai = <&dummy_codec>;
                        };
                };
+
+               aml-audio-card,dai-link@6 {
+                       mclk-fs = <256>;
+                       continuous-clock;
+                       suffix-name = "alsaPORT-loopback";
+                       cpu {
+                               sound-dai = <&loopback>;
+                               system-clock-frequency = <12288000>;
+                       };
+                       codec {
+                               sound-dai = <&dummy_codec>;
+                       };
+               };
+
+               aml-audio-card,dai-link@7 {
+                       format = "i2s";
+                       mclk-fs = <256>;
+                       //continuous-clock;
+                       //bitclock-inversion;
+                       //frame-inversion;
+                       bitclock-master = <&tdmlb>;
+                       frame-master = <&tdmlb>;
+                       cpu {
+                               sound-dai = <&tdmlb>;
+                               dai-tdm-slot-rx-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";
                        "samesource_srcpll", "samesource_clk";
                pinctrl-names = "tdm_pins";
                pinctrl-0 = <&tdmb_mclk &tdmout_b &tdmin_b>;
+               mclk_pad = <0>;  /* 0: mclk_0; 1: mclk_1 */
                /*
                 * 0: tdmout_a;
                 * 1: tdmout_b;
                clock-names = "mclk", "clk_srcpll";
                pinctrl-names = "tdm_pins";
                pinctrl-0 = <&tdmc_mclk &tdmout_c &tdmin_c>;
+               mclk_pad = <1>;  /* 0: mclk_0; 1: mclk_1 */
        };
 
-       /* copy a useless tdm to output for hdmi, no pinmux */
-       aml_i2s2hdmi: i2s2hdmi {
-               compatible = "amlogic, g12a-snd-tdmc";
+       tdmlb: tdm@3 {
+               compatible = "amlogic, g12a-snd-tdmlb";
                #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>;
+               dai-tdm-lane-lb-slot-mask-in = <1 0 0 0>;
+               dai-tdm-clk-sel = <1>;
+               clocks = <&clkaudio CLKID_AUDIO_MCLK_B
+                               &clkc CLKID_MPLL1>;
                clock-names = "mclk", "clk_srcpll";
-
-               i2s2hdmi = <1>;
+               /*
+                * select tdmin_lb src;
+                *0: TDMOUTA
+                *1: TDMOUTB
+                *2: TDMOUTC
+                *3: PAD_TDMINA
+                *4: PAD_TDMINB
+                *5: PAD_TDMINC
+                */
+               lb-src-sel = <1>;
 
                status = "okay";
        };
                filter_mode = <1>; /* mode 0~4, defalut:1 */
                status = "okay";
        };
-       aml_loopback: loopback {
-               compatible = "amlogic, snd-loopback";
-               /*
-                * 0: out rate = in data rate;
-                * 1: out rate = loopback data rate;
-                */
-               lb_mode = <0>;
+
+       loopback:loopback@0 {
+               compatible = "amlogic, g12a-loopback";
+               #sound-dai-cells = <0>;
+
+               clocks = <&clkaudio CLKID_AUDIO_PDM
+                       &clkc CLKID_FCLK_DIV3
+                       &clkc CLKID_MPLL3
+                       &clkaudio CLKID_AUDIO_PDMIN0
+                       &clkaudio CLKID_AUDIO_PDMIN1
+                       &clkc CLKID_MPLL0
+                       &clkaudio CLKID_AUDIO_MCLK_A>;
+               clock-names = "pdm_gate",
+                       "pdm_sysclk_srcpll",
+                       "pdm_dclk_srcpll",
+                       "pdm_dclk",
+                       "pdm_sysclk",
+                       "tdminlb_mpll",
+                       "tdminlb_mclk";
 
                /* datain src
                 * 0: tdmin_a;
                 * 4: pdmin;
                 */
                datain_src = <4>;
-               datain_chnum = <8>;
-               datain_chmask = <0x3f>;
+               datain_chnum = <4>;
+               datain_chmask = <0xf>;
+               /* config which data pin for loopback */
+               datain-lane-mask-in = <1 0 1 0>;
+
+               /* calc mclk for datalb */
+               mclk-fs = <256>;
 
                /* tdmin_lb src
                 * 0: tdmoutA
                 * 1: tdmoutB
                 * 2: tdmoutC
-                * 3: PAD_tdminA
-                * 4: PAD_tdminB
-                * 5: PAD_tdminC
+                * 3: PAD_TDMINA_DIN*, refer to core pinmux
+                * 4: PAD_TDMINB_DIN*, refer to core pinmux
+                * 5: PAD_TDMINC_DIN*, refer to core pinmux
+                * 6: PAD_TDMINA_D*, oe, refer to core pinmux
+                * 7: PAD_TDMINB_D*, oe, refer to core pinmux
                 */
-               datalb_src = <2>;
-               datalb_chnum = <8>;
+               /* if tdmin_lb >= 3, use external loopback */
+               datalb_src = <1>;
+               datalb_chnum = <2>;
                datalb_chmask = <0x3>;
+               /* config which data pin as loopback */
+               datalb-lane-mask-in = <1 0 0 0>;
 
-               status = "disabled";
+               status = "okay";
        };
 
        audioresample: resample {
index 304ceee..44bc11f 100644 (file)
                compatible = "amlogic, g12a-sound-card";
                aml-audio-card,name = "AML-AUGESOUND";
 
-               //aml-audio-card,loopback = <&aml_loopback>;
+
                //aml-audio-card,aux-devs = <&amlogic_codec>;
                /*avout mute gpio*/
                avout_mute-gpios = <&gpio_ao GPIOAO_2 GPIO_ACTIVE_HIGH>;
                                sound-dai = <&dummy_codec>;
                        };
                };
+
+               aml-audio-card,dai-link@6 {
+                       mclk-fs = <256>;
+                       continuous-clock;
+                       suffix-name = "alsaPORT-loopback";
+                       cpu {
+                               sound-dai = <&loopback>;
+                               system-clock-frequency = <12288000>;
+                       };
+                       codec {
+                               sound-dai = <&dummy_codec>;
+                       };
+               };
        };
        audiolocker: locker {
                compatible = "amlogic, audiolocker";
                        "samesource_srcpll", "samesource_clk";
                pinctrl-names = "tdm_pins";
                pinctrl-0 = <&tdmb_mclk &tdmout_b &tdmin_b>;
+               mclk_pad = <0>;  /* 0: mclk_0; 1: mclk_1 */
                /*
                 * 0: tdmout_a;
                 * 1: tdmout_b;
                clock-names = "mclk", "clk_srcpll";
                pinctrl-names = "tdm_pins";
                pinctrl-0 = <&tdmc_mclk &tdmout_c &tdmin_c>;
+               mclk_pad = <1>;  /* 0: mclk_0; 1: mclk_1 */
        };
 
-       /* copy a useless tdm to output for hdmi, no pinmux */
-       aml_i2s2hdmi: i2s2hdmi {
-               compatible = "amlogic, g12a-snd-tdmc";
+       tdmlb: tdm@3 {
+               compatible = "amlogic, g12a-snd-tdmlb";
                #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>;
+               dai-tdm-lane-lb-slot-mask-in = <1 0 0 0>;
+               dai-tdm-clk-sel = <1>;
+               clocks = <&clkaudio CLKID_AUDIO_MCLK_B
+                               &clkc CLKID_MPLL1>;
                clock-names = "mclk", "clk_srcpll";
-
-               i2s2hdmi = <1>;
+               /*
+                * select tdmin_lb src;
+                *0: TDMOUTA
+                *1: TDMOUTB
+                *2: TDMOUTC
+                *3: PAD_TDMINA
+                *4: PAD_TDMINB
+                *5: PAD_TDMINC
+                */
+               lb-src-sel = <1>;
 
                status = "okay";
        };
                filter_mode = <1>; /* mode 0~4, defalut:1 */
                status = "okay";
        };
-       aml_loopback: loopback {
-               compatible = "amlogic, snd-loopback";
-               /*
-                * 0: out rate = in data rate;
-                * 1: out rate = loopback data rate;
-                */
-               lb_mode = <0>;
+
+       loopback:loopback@0 {
+               compatible = "amlogic, g12a-loopback";
+               #sound-dai-cells = <0>;
+
+               clocks = <&clkaudio CLKID_AUDIO_PDM
+                       &clkc CLKID_FCLK_DIV3
+                       &clkc CLKID_MPLL3
+                       &clkaudio CLKID_AUDIO_PDMIN0
+                       &clkaudio CLKID_AUDIO_PDMIN1
+                       &clkc CLKID_MPLL0
+                       &clkaudio CLKID_AUDIO_MCLK_A>;
+               clock-names = "pdm_gate",
+                       "pdm_sysclk_srcpll",
+                       "pdm_dclk_srcpll",
+                       "pdm_dclk",
+                       "pdm_sysclk",
+                       "tdminlb_mpll",
+                       "tdminlb_mclk";
 
                /* datain src
                 * 0: tdmin_a;
                 * 4: pdmin;
                 */
                datain_src = <4>;
-               datain_chnum = <8>;
-               datain_chmask = <0x3f>;
+               datain_chnum = <4>;
+               datain_chmask = <0xf>;
+               /* config which data pin for loopback */
+               datain-lane-mask-in = <1 0 1 0>;
+
+               /* calc mclk for datalb */
+               mclk-fs = <256>;
 
                /* tdmin_lb src
                 * 0: tdmoutA
                 * 1: tdmoutB
                 * 2: tdmoutC
-                * 3: PAD_tdminA
-                * 4: PAD_tdminB
-                * 5: PAD_tdminC
+                * 3: PAD_TDMINA_DIN*, refer to core pinmux
+                * 4: PAD_TDMINB_DIN*, refer to core pinmux
+                * 5: PAD_TDMINC_DIN*, refer to core pinmux
+                * 6: PAD_TDMINA_D*, oe, refer to core pinmux
+                * 7: PAD_TDMINB_D*, oe, refer to core pinmux
                 */
-               datalb_src = <2>;
-               datalb_chnum = <8>;
+               /* if tdmin_lb >= 3, use external loopback */
+               datalb_src = <1>;
+               datalb_chnum = <2>;
                datalb_chmask = <0x3>;
+               /* config which data pin as loopback */
+               datalb-lane-mask-in = <1 0 0 0>;
 
-               status = "disabled";
+               status = "okay";
        };
 
        audioresample: resample {
index 36c3170..5f1dbe1 100644 (file)
                compatible = "amlogic, g12a-sound-card";
                aml-audio-card,name = "AML-AUGESOUND";
 
-               //aml-audio-card,loopback = <&aml_loopback>;
+
                //aml-audio-card,aux-devs = <&amlogic_codec>;
                /*avout mute gpio*/
                avout_mute-gpios = <&gpio_ao GPIOAO_2 GPIO_ACTIVE_HIGH>;
                                sound-dai = <&dummy_codec>;
                        };
                };
+
+               aml-audio-card,dai-link@6 {
+                       mclk-fs = <256>;
+                       continuous-clock;
+                       suffix-name = "alsaPORT-loopback";
+                       cpu {
+                               sound-dai = <&loopback>;
+                               system-clock-frequency = <12288000>;
+                       };
+                       codec {
+                               sound-dai = <&dummy_codec>;
+                       };
+               };
        };
        audiolocker: locker {
                compatible = "amlogic, audiolocker";
                        "samesource_srcpll", "samesource_clk";
                pinctrl-names = "tdm_pins";
                pinctrl-0 = <&tdmb_mclk &tdmout_b &tdmin_b>;
+               mclk_pad = <0>;  /* 0: mclk_0; 1: mclk_1 */
                /*
                 * 0: tdmout_a;
                 * 1: tdmout_b;
                clock-names = "mclk", "clk_srcpll";
                pinctrl-names = "tdm_pins";
                pinctrl-0 = <&tdmc_mclk &tdmout_c &tdmin_c>;
+               mclk_pad = <1>;  /* 0: mclk_0; 1: mclk_1 */
        };
 
-       /* copy a useless tdm to output for hdmi, no pinmux */
-       aml_i2s2hdmi: i2s2hdmi {
-               compatible = "amlogic, g12a-snd-tdmc";
+       tdmlb: tdm@3 {
+               compatible = "amlogic, g12a-snd-tdmlb";
                #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>;
+               dai-tdm-lane-lb-slot-mask-in = <1 0 0 0>;
+               dai-tdm-clk-sel = <1>;
+               clocks = <&clkaudio CLKID_AUDIO_MCLK_B
+                               &clkc CLKID_MPLL1>;
                clock-names = "mclk", "clk_srcpll";
-
-               i2s2hdmi = <1>;
+               /*
+                * select tdmin_lb src;
+                *0: TDMOUTA
+                *1: TDMOUTB
+                *2: TDMOUTC
+                *3: PAD_TDMINA
+                *4: PAD_TDMINB
+                *5: PAD_TDMINC
+                */
+               lb-src-sel = <1>;
 
                status = "okay";
        };
                filter_mode = <1>; /* mode 0~4, defalut:1 */
                status = "okay";
        };
-       aml_loopback: loopback {
-               compatible = "amlogic, snd-loopback";
-               /*
-                * 0: out rate = in data rate;
-                * 1: out rate = loopback data rate;
-                */
-               lb_mode = <0>;
+
+       loopback:loopback@0 {
+               compatible = "amlogic, g12a-loopback";
+               #sound-dai-cells = <0>;
+
+               clocks = <&clkaudio CLKID_AUDIO_PDM
+                       &clkc CLKID_FCLK_DIV3
+                       &clkc CLKID_MPLL3
+                       &clkaudio CLKID_AUDIO_PDMIN0
+                       &clkaudio CLKID_AUDIO_PDMIN1
+                       &clkc CLKID_MPLL0
+                       &clkaudio CLKID_AUDIO_MCLK_A>;
+               clock-names = "pdm_gate",
+                       "pdm_sysclk_srcpll",
+                       "pdm_dclk_srcpll",
+                       "pdm_dclk",
+                       "pdm_sysclk",
+                       "tdminlb_mpll",
+                       "tdminlb_mclk";
 
                /* datain src
                 * 0: tdmin_a;
                 * 4: pdmin;
                 */
                datain_src = <4>;
-               datain_chnum = <8>;
-               datain_chmask = <0x3f>;
+               datain_chnum = <4>;
+               datain_chmask = <0xf>;
+               /* config which data pin for loopback */
+               datain-lane-mask-in = <1 0 1 0>;
+
+               /* calc mclk for datalb */
+               mclk-fs = <256>;
 
                /* tdmin_lb src
                 * 0: tdmoutA
                 * 1: tdmoutB
                 * 2: tdmoutC
-                * 3: PAD_tdminA
-                * 4: PAD_tdminB
-                * 5: PAD_tdminC
+                * 3: PAD_TDMINA_DIN*, refer to core pinmux
+                * 4: PAD_TDMINB_DIN*, refer to core pinmux
+                * 5: PAD_TDMINC_DIN*, refer to core pinmux
+                * 6: PAD_TDMINA_D*, oe, refer to core pinmux
+                * 7: PAD_TDMINB_D*, oe, refer to core pinmux
                 */
-               datalb_src = <2>;
-               datalb_chnum = <8>;
+               /* if tdmin_lb >= 3, use external loopback */
+               datalb_src = <1>;
+               datalb_chnum = <2>;
                datalb_chmask = <0x3>;
+               /* config which data pin as loopback */
+               datalb-lane-mask-in = <1 0 0 0>;
 
-               status = "disabled";
+               status = "okay";
        };
 
        audioresample: resample {
index c5e4f56..6f00beb 100644 (file)
                compatible = "amlogic, g12a-sound-card";
                aml-audio-card,name = "AML-AUGESOUND";
 
-               //aml-audio-card,loopback = <&aml_loopback>;
+
                //aml-audio-card,aux-devs = <&amlogic_codec>;
                /*avout mute gpio*/
                avout_mute-gpios = <&gpio_ao GPIOAO_2 GPIO_ACTIVE_HIGH>;
                                sound-dai = <&dummy_codec>;
                        };
                };
+
+               aml-audio-card,dai-link@6 {
+                       mclk-fs = <256>;
+                       continuous-clock;
+                       suffix-name = "alsaPORT-loopback";
+                       cpu {
+                               sound-dai = <&loopback>;
+                               system-clock-frequency = <12288000>;
+                       };
+                       codec {
+                               sound-dai = <&dummy_codec>;
+                       };
+               };
        };
        audiolocker: locker {
                compatible = "amlogic, audiolocker";
                        "samesource_srcpll", "samesource_clk";
                pinctrl-names = "tdm_pins";
                pinctrl-0 = <&tdmb_mclk &tdmout_b &tdmin_b>;
+               mclk_pad = <0>;  /* 0: mclk_0; 1: mclk_1 */
                /*
                 * 0: tdmout_a;
                 * 1: tdmout_b;
                clock-names = "mclk", "clk_srcpll";
                pinctrl-names = "tdm_pins";
                pinctrl-0 = <&tdmc_mclk &tdmout_c &tdmin_c>;
+               mclk_pad = <1>;  /* 0: mclk_0; 1: mclk_1 */
        };
 
-       /* copy a useless tdm to output for hdmi, no pinmux */
-       aml_i2s2hdmi: i2s2hdmi {
-               compatible = "amlogic, g12a-snd-tdmc";
+       tdmlb: tdm@3 {
+               compatible = "amlogic, g12a-snd-tdmlb";
                #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>;
+               dai-tdm-lane-lb-slot-mask-in = <1 0 0 0>;
+               dai-tdm-clk-sel = <1>;
+               clocks = <&clkaudio CLKID_AUDIO_MCLK_B
+                               &clkc CLKID_MPLL1>;
                clock-names = "mclk", "clk_srcpll";
-
-               i2s2hdmi = <1>;
+               /*
+                * select tdmin_lb src;
+                *0: TDMOUTA
+                *1: TDMOUTB
+                *2: TDMOUTC
+                *3: PAD_TDMINA
+                *4: PAD_TDMINB
+                *5: PAD_TDMINC
+                */
+               lb-src-sel = <1>;
 
                status = "okay";
        };
                filter_mode = <1>; /* mode 0~4, defalut:1 */
                status = "okay";
        };
-       aml_loopback: loopback {
-               compatible = "amlogic, snd-loopback";
-               /*
-                * 0: out rate = in data rate;
-                * 1: out rate = loopback data rate;
-                */
-               lb_mode = <0>;
+
+       loopback:loopback@0 {
+               compatible = "amlogic, g12a-loopback";
+               #sound-dai-cells = <0>;
+
+               clocks = <&clkaudio CLKID_AUDIO_PDM
+                       &clkc CLKID_FCLK_DIV3
+                       &clkc CLKID_MPLL3
+                       &clkaudio CLKID_AUDIO_PDMIN0
+                       &clkaudio CLKID_AUDIO_PDMIN1
+                       &clkc CLKID_MPLL0
+                       &clkaudio CLKID_AUDIO_MCLK_A>;
+               clock-names = "pdm_gate",
+                       "pdm_sysclk_srcpll",
+                       "pdm_dclk_srcpll",
+                       "pdm_dclk",
+                       "pdm_sysclk",
+                       "tdminlb_mpll",
+                       "tdminlb_mclk";
 
                /* datain src
                 * 0: tdmin_a;
                 * 4: pdmin;
                 */
                datain_src = <4>;
-               datain_chnum = <8>;
-               datain_chmask = <0x3f>;
+               datain_chnum = <4>;
+               datain_chmask = <0xf>;
+               /* config which data pin for loopback */
+               datain-lane-mask-in = <1 0 1 0>;
+
+               /* calc mclk for datalb */
+               mclk-fs = <256>;
 
                /* tdmin_lb src
                 * 0: tdmoutA
                 * 1: tdmoutB
                 * 2: tdmoutC
-                * 3: PAD_tdminA
-                * 4: PAD_tdminB
-                * 5: PAD_tdminC
+                * 3: PAD_TDMINA_DIN*, refer to core pinmux
+                * 4: PAD_TDMINB_DIN*, refer to core pinmux
+                * 5: PAD_TDMINC_DIN*, refer to core pinmux
+                * 6: PAD_TDMINA_D*, oe, refer to core pinmux
+                * 7: PAD_TDMINB_D*, oe, refer to core pinmux
                 */
-               datalb_src = <2>;
-               datalb_chnum = <8>;
+               /* if tdmin_lb >= 3, use external loopback */
+               datalb_src = <1>;
+               datalb_chnum = <2>;
                datalb_chmask = <0x3>;
+               /* config which data pin as loopback */
+               datalb-lane-mask-in = <1 0 0 0>;
 
-               status = "disabled";
+               status = "okay";
        };
 
        audioresample: resample {
index 3b3dd3b..55955d3 100644 (file)
                compatible = "amlogic, g12a-sound-card";
                aml-audio-card,name = "AML-AUGESOUND";
 
-               //aml-audio-card,loopback = <&aml_loopback>;
+
                //aml-audio-card,aux-devs = <&amlogic_codec>;
                /*avout mute gpio*/
                avout_mute-gpios = <&gpio_ao GPIOAO_2 GPIO_ACTIVE_HIGH>;
                                sound-dai = <&dummy_codec>;
                        };
                };
+
+               aml-audio-card,dai-link@6 {
+                       mclk-fs = <256>;
+                       continuous-clock;
+                       suffix-name = "alsaPORT-loopback";
+                       cpu {
+                               sound-dai = <&loopback>;
+                               system-clock-frequency = <12288000>;
+                       };
+                       codec {
+                               sound-dai = <&dummy_codec>;
+                       };
+               };
        };
        audiolocker: locker {
                compatible = "amlogic, audiolocker";
                        "samesource_srcpll", "samesource_clk";
                pinctrl-names = "tdm_pins";
                pinctrl-0 = <&tdmb_mclk &tdmout_b &tdmin_b>;
+               mclk_pad = <0>;  /* 0: mclk_0; 1: mclk_1 */
                /*
                 * 0: tdmout_a;
                 * 1: tdmout_b;
                clock-names = "mclk", "clk_srcpll";
                pinctrl-names = "tdm_pins";
                pinctrl-0 = <&tdmc_mclk &tdmout_c &tdmin_c>;
+               mclk_pad = <1>;  /* 0: mclk_0; 1: mclk_1 */
        };
 
-       /* copy a useless tdm to output for hdmi, no pinmux */
-       aml_i2s2hdmi: i2s2hdmi {
-               compatible = "amlogic, g12a-snd-tdmc";
+       tdmlb: tdm@3 {
+               compatible = "amlogic, g12a-snd-tdmlb";
                #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>;
+               dai-tdm-lane-lb-slot-mask-in = <1 0 0 0>;
+               dai-tdm-clk-sel = <1>;
+               clocks = <&clkaudio CLKID_AUDIO_MCLK_B
+                               &clkc CLKID_MPLL1>;
                clock-names = "mclk", "clk_srcpll";
-
-               i2s2hdmi = <1>;
+               /*
+                * select tdmin_lb src;
+                *0: TDMOUTA
+                *1: TDMOUTB
+                *2: TDMOUTC
+                *3: PAD_TDMINA
+                *4: PAD_TDMINB
+                *5: PAD_TDMINC
+                */
+               lb-src-sel = <1>;
 
                status = "okay";
        };
                filter_mode = <1>; /* mode 0~4, defalut:1 */
                status = "okay";
        };
-       aml_loopback: loopback {
-               compatible = "amlogic, snd-loopback";
-               /*
-                * 0: out rate = in data rate;
-                * 1: out rate = loopback data rate;
-                */
-               lb_mode = <0>;
+
+       loopback:loopback@0 {
+               compatible = "amlogic, g12a-loopback";
+               #sound-dai-cells = <0>;
+
+               clocks = <&clkaudio CLKID_AUDIO_PDM
+                       &clkc CLKID_FCLK_DIV3
+                       &clkc CLKID_MPLL3
+                       &clkaudio CLKID_AUDIO_PDMIN0
+                       &clkaudio CLKID_AUDIO_PDMIN1
+                       &clkc CLKID_MPLL0
+                       &clkaudio CLKID_AUDIO_MCLK_A>;
+               clock-names = "pdm_gate",
+                       "pdm_sysclk_srcpll",
+                       "pdm_dclk_srcpll",
+                       "pdm_dclk",
+                       "pdm_sysclk",
+                       "tdminlb_mpll",
+                       "tdminlb_mclk";
 
                /* datain src
                 * 0: tdmin_a;
                 * 4: pdmin;
                 */
                datain_src = <4>;
-               datain_chnum = <8>;
-               datain_chmask = <0x3f>;
+               datain_chnum = <4>;
+               datain_chmask = <0xf>;
+               /* config which data pin for loopback */
+               datain-lane-mask-in = <1 0 1 0>;
+
+               /* calc mclk for datalb */
+               mclk-fs = <256>;
 
                /* tdmin_lb src
                 * 0: tdmoutA
                 * 1: tdmoutB
                 * 2: tdmoutC
-                * 3: PAD_tdminA
-                * 4: PAD_tdminB
-                * 5: PAD_tdminC
+                * 3: PAD_TDMINA_DIN*, refer to core pinmux
+                * 4: PAD_TDMINB_DIN*, refer to core pinmux
+                * 5: PAD_TDMINC_DIN*, refer to core pinmux
+                * 6: PAD_TDMINA_D*, oe, refer to core pinmux
+                * 7: PAD_TDMINB_D*, oe, refer to core pinmux
                 */
-               datalb_src = <2>;
-               datalb_chnum = <8>;
+               /* if tdmin_lb >= 3, use external loopback */
+               datalb_src = <1>;
+               datalb_chnum = <2>;
                datalb_chmask = <0x3>;
+               /* config which data pin as loopback */
+               datalb-lane-mask-in = <1 0 0 0>;
 
-               status = "disabled";
+               status = "okay";
        };
 
        audioresample: resample {
index 280a07a..5ceb254 100644 (file)
                compatible = "amlogic, g12a-sound-card";
                aml-audio-card,name = "AML-AUGESOUND";
 
-               //aml-audio-card,loopback = <&aml_loopback>;
+
                //aml-audio-card,aux-devs = <&amlogic_codec>;
                /*avout mute gpio*/
                avout_mute-gpios = <&gpio_ao GPIOAO_2 GPIO_ACTIVE_HIGH>;
                                sound-dai = <&dummy_codec>;
                        };
                };
+
+               aml-audio-card,dai-link@6 {
+                       mclk-fs = <256>;
+                       continuous-clock;
+                       suffix-name = "alsaPORT-loopback";
+                       cpu {
+                               sound-dai = <&loopback>;
+                               system-clock-frequency = <12288000>;
+                       };
+                       codec {
+                               sound-dai = <&dummy_codec>;
+                       };
+               };
        };
        audiolocker: locker {
                compatible = "amlogic, audiolocker";
                        "samesource_srcpll", "samesource_clk";
                pinctrl-names = "tdm_pins";
                pinctrl-0 = <&tdmb_mclk &tdmout_b &tdmin_b>;
+               mclk_pad = <0>;  /* 0: mclk_0; 1: mclk_1 */
                /*
                 * 0: tdmout_a;
                 * 1: tdmout_b;
                clock-names = "mclk", "clk_srcpll";
                pinctrl-names = "tdm_pins";
                pinctrl-0 = <&tdmc_mclk &tdmout_c &tdmin_c>;
+               mclk_pad = <1>;  /* 0: mclk_0; 1: mclk_1 */
        };
 
-       /* copy a useless tdm to output for hdmi, no pinmux */
-       aml_i2s2hdmi: i2s2hdmi {
-               compatible = "amlogic, g12a-snd-tdmc";
+       tdmlb: tdm@3 {
+               compatible = "amlogic, g12a-snd-tdmlb";
                #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>;
+               dai-tdm-lane-lb-slot-mask-in = <1 0 0 0>;
+               dai-tdm-clk-sel = <1>;
+               clocks = <&clkaudio CLKID_AUDIO_MCLK_B
+                               &clkc CLKID_MPLL1>;
                clock-names = "mclk", "clk_srcpll";
-
-               i2s2hdmi = <1>;
+               /*
+                * select tdmin_lb src;
+                *0: TDMOUTA
+                *1: TDMOUTB
+                *2: TDMOUTC
+                *3: PAD_TDMINA
+                *4: PAD_TDMINB
+                *5: PAD_TDMINC
+                */
+               lb-src-sel = <1>;
 
                status = "okay";
        };
                filter_mode = <1>; /* mode 0~4, defalut:1 */
                status = "okay";
        };
-       aml_loopback: loopback {
-               compatible = "amlogic, snd-loopback";
-               /*
-                * 0: out rate = in data rate;
-                * 1: out rate = loopback data rate;
-                */
-               lb_mode = <0>;
+
+       loopback:loopback@0 {
+               compatible = "amlogic, g12a-loopback";
+               #sound-dai-cells = <0>;
+
+               clocks = <&clkaudio CLKID_AUDIO_PDM
+                       &clkc CLKID_FCLK_DIV3
+                       &clkc CLKID_MPLL3
+                       &clkaudio CLKID_AUDIO_PDMIN0
+                       &clkaudio CLKID_AUDIO_PDMIN1
+                       &clkc CLKID_MPLL0
+                       &clkaudio CLKID_AUDIO_MCLK_A>;
+               clock-names = "pdm_gate",
+                       "pdm_sysclk_srcpll",
+                       "pdm_dclk_srcpll",
+                       "pdm_dclk",
+                       "pdm_sysclk",
+                       "tdminlb_mpll",
+                       "tdminlb_mclk";
 
                /* datain src
                 * 0: tdmin_a;
                 * 4: pdmin;
                 */
                datain_src = <4>;
-               datain_chnum = <8>;
-               datain_chmask = <0x3f>;
+               datain_chnum = <4>;
+               datain_chmask = <0xf>;
+               /* config which data pin for loopback */
+               datain-lane-mask-in = <1 0 1 0>;
+
+               /* calc mclk for datalb */
+               mclk-fs = <256>;
 
                /* tdmin_lb src
                 * 0: tdmoutA
                 * 1: tdmoutB
                 * 2: tdmoutC
-                * 3: PAD_tdminA
-                * 4: PAD_tdminB
-                * 5: PAD_tdminC
+                * 3: PAD_TDMINA_DIN*, refer to core pinmux
+                * 4: PAD_TDMINB_DIN*, refer to core pinmux
+                * 5: PAD_TDMINC_DIN*, refer to core pinmux
+                * 6: PAD_TDMINA_D*, oe, refer to core pinmux
+                * 7: PAD_TDMINB_D*, oe, refer to core pinmux
                 */
-               datalb_src = <2>;
-               datalb_chnum = <8>;
+               /* if tdmin_lb >= 3, use external loopback */
+               datalb_src = <1>;
+               datalb_chnum = <2>;
                datalb_chmask = <0x3>;
+               /* config which data pin as loopback */
+               datalb-lane-mask-in = <1 0 0 0>;
 
-               status = "disabled";
+               status = "okay";
        };
 
        audioresample: resample {
index ac5ca36..63527bf 100644 (file)
                compatible = "amlogic, g12a-sound-card";
                aml-audio-card,name = "AML-AUGESOUND";
 
-               //aml-audio-card,loopback = <&aml_loopback>;
+
                //aml-audio-card,aux-devs = <&amlogic_codec>;
                /*avout mute gpio*/
                avout_mute-gpios = <&gpio_ao GPIOAO_2 GPIO_ACTIVE_HIGH>;
                                sound-dai = <&dummy_codec>;
                        };
                };
+
+               aml-audio-card,dai-link@6 {
+                       mclk-fs = <256>;
+                       continuous-clock;
+                       suffix-name = "alsaPORT-loopback";
+                       cpu {
+                               sound-dai = <&loopback>;
+                               system-clock-frequency = <12288000>;
+                       };
+                       codec {
+                               sound-dai = <&dummy_codec>;
+                       };
+               };
        };
        audiolocker: locker {
                compatible = "amlogic, audiolocker";
                        "samesource_srcpll", "samesource_clk";
                pinctrl-names = "tdm_pins";
                pinctrl-0 = <&tdmb_mclk &tdmout_b &tdmin_b>;
+               mclk_pad = <0>;  /* 0: mclk_0; 1: mclk_1 */
                /*
                 * 0: tdmout_a;
                 * 1: tdmout_b;
                clock-names = "mclk", "clk_srcpll";
                pinctrl-names = "tdm_pins";
                pinctrl-0 = <&tdmc_mclk &tdmout_c &tdmin_c>;
+               mclk_pad = <1>;  /* 0: mclk_0; 1: mclk_1 */
        };
 
-       /* copy a useless tdm to output for hdmi, no pinmux */
-       aml_i2s2hdmi: i2s2hdmi {
-               compatible = "amlogic, g12a-snd-tdmc";
+       tdmlb: tdm@3 {
+               compatible = "amlogic, g12a-snd-tdmlb";
                #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>;
+               dai-tdm-lane-lb-slot-mask-in = <1 0 0 0>;
+               dai-tdm-clk-sel = <1>;
+               clocks = <&clkaudio CLKID_AUDIO_MCLK_B
+                               &clkc CLKID_MPLL1>;
                clock-names = "mclk", "clk_srcpll";
-
-               i2s2hdmi = <1>;
+               /*
+                * select tdmin_lb src;
+                *0: TDMOUTA
+                *1: TDMOUTB
+                *2: TDMOUTC
+                *3: PAD_TDMINA
+                *4: PAD_TDMINB
+                *5: PAD_TDMINC
+                */
+               lb-src-sel = <1>;
 
                status = "okay";
        };
                filter_mode = <1>; /* mode 0~4, defalut:1 */
                status = "okay";
        };
-       aml_loopback: loopback {
-               compatible = "amlogic, snd-loopback";
-               /*
-                * 0: out rate = in data rate;
-                * 1: out rate = loopback data rate;
-                */
-               lb_mode = <0>;
+
+       loopback:loopback@0 {
+               compatible = "amlogic, g12a-loopback";
+               #sound-dai-cells = <0>;
+
+               clocks = <&clkaudio CLKID_AUDIO_PDM
+                       &clkc CLKID_FCLK_DIV3
+                       &clkc CLKID_MPLL3
+                       &clkaudio CLKID_AUDIO_PDMIN0
+                       &clkaudio CLKID_AUDIO_PDMIN1
+                       &clkc CLKID_MPLL0
+                       &clkaudio CLKID_AUDIO_MCLK_A>;
+               clock-names = "pdm_gate",
+                       "pdm_sysclk_srcpll",
+                       "pdm_dclk_srcpll",
+                       "pdm_dclk",
+                       "pdm_sysclk",
+                       "tdminlb_mpll",
+                       "tdminlb_mclk";
 
                /* datain src
                 * 0: tdmin_a;
                 * 4: pdmin;
                 */
                datain_src = <4>;
-               datain_chnum = <8>;
-               datain_chmask = <0x3f>;
+               datain_chnum = <4>;
+               datain_chmask = <0xf>;
+               /* config which data pin for loopback */
+               datain-lane-mask-in = <1 0 1 0>;
+
+               /* calc mclk for datalb */
+               mclk-fs = <256>;
 
                /* tdmin_lb src
                 * 0: tdmoutA
                 * 1: tdmoutB
                 * 2: tdmoutC
-                * 3: PAD_tdminA
-                * 4: PAD_tdminB
-                * 5: PAD_tdminC
+                * 3: PAD_TDMINA_DIN*, refer to core pinmux
+                * 4: PAD_TDMINB_DIN*, refer to core pinmux
+                * 5: PAD_TDMINC_DIN*, refer to core pinmux
+                * 6: PAD_TDMINA_D*, oe, refer to core pinmux
+                * 7: PAD_TDMINB_D*, oe, refer to core pinmux
                 */
-               datalb_src = <2>;
-               datalb_chnum = <8>;
+               /* if tdmin_lb >= 3, use external loopback */
+               datalb_src = <1>;
+               datalb_chnum = <2>;
                datalb_chmask = <0x3>;
+               /* config which data pin as loopback */
+               datalb-lane-mask-in = <1 0 0 0>;
 
-               status = "disabled";
+               status = "okay";
        };
 
        audioresample: resample {
index 3ef296f..37291cd 100644 (file)
                compatible = "amlogic, g12a-sound-card";
                aml-audio-card,name = "AML-AUGESOUND";
 
-               //aml-audio-card,loopback = <&aml_loopback>;
+
                //aml-audio-card,aux-devs = <&amlogic_codec>;
                /*avout mute gpio*/
                avout_mute-gpios = <&gpio_ao GPIOAO_6 GPIO_ACTIVE_HIGH>;
                                sound-dai = <&dummy_codec>;
                        };
                };
+
+               aml-audio-card,dai-link@6 {
+                       mclk-fs = <256>;
+                       continuous-clock;
+                       suffix-name = "alsaPORT-loopback";
+                       cpu {
+                               sound-dai = <&loopback>;
+                               system-clock-frequency = <12288000>;
+                       };
+                       codec {
+                               sound-dai = <&dummy_codec>;
+                       };
+               };
        };
        audiolocker: locker {
                compatible = "amlogic, audiolocker";
                        "samesource_srcpll", "samesource_clk";
                pinctrl-names = "tdm_pins";
                pinctrl-0 = <&tdmb_mclk &tdmout_b &tdmin_b>;
+               mclk_pad = <0>;  /* 0: mclk_0; 1: mclk_1 */
                /*
                 * 0: tdmout_a;
                 * 1: tdmout_b;
                clock-names = "mclk", "clk_srcpll";
                pinctrl-names = "tdm_pins";
                pinctrl-0 = <&tdmc_mclk &tdmout_c &tdmin_c>;
+               mclk_pad = <1>;  /* 0: mclk_0; 1: mclk_1 */
        };
 
-       /* copy a useless tdm to output for hdmi, no pinmux */
-       aml_i2s2hdmi: i2s2hdmi {
-               compatible = "amlogic, g12a-snd-tdmc";
+       tdmlb: tdm@3 {
+               compatible = "amlogic, g12a-snd-tdmlb";
                #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>;
+               dai-tdm-lane-lb-slot-mask-in = <1 0 0 0>;
+               dai-tdm-clk-sel = <1>;
+               clocks = <&clkaudio CLKID_AUDIO_MCLK_B
+                               &clkc CLKID_MPLL1>;
                clock-names = "mclk", "clk_srcpll";
-
-               i2s2hdmi = <1>;
+               /*
+                * select tdmin_lb src;
+                *0: TDMOUTA
+                *1: TDMOUTB
+                *2: TDMOUTC
+                *3: PAD_TDMINA
+                *4: PAD_TDMINB
+                *5: PAD_TDMINC
+                */
+               lb-src-sel = <1>;
 
                status = "okay";
        };
                filter_mode = <1>; /* mode 0~4, defalut:1 */
                status = "okay";
        };
-       aml_loopback: loopback {
-               compatible = "amlogic, snd-loopback";
-               /*
-                * 0: out rate = in data rate;
-                * 1: out rate = loopback data rate;
-                */
-               lb_mode = <0>;
+
+       loopback:loopback@0 {
+               compatible = "amlogic, g12a-loopback";
+               #sound-dai-cells = <0>;
+
+               clocks = <&clkaudio CLKID_AUDIO_PDM
+                       &clkc CLKID_FCLK_DIV3
+                       &clkc CLKID_MPLL3
+                       &clkaudio CLKID_AUDIO_PDMIN0
+                       &clkaudio CLKID_AUDIO_PDMIN1
+                       &clkc CLKID_MPLL0
+                       &clkaudio CLKID_AUDIO_MCLK_A>;
+               clock-names = "pdm_gate",
+                       "pdm_sysclk_srcpll",
+                       "pdm_dclk_srcpll",
+                       "pdm_dclk",
+                       "pdm_sysclk",
+                       "tdminlb_mpll",
+                       "tdminlb_mclk";
 
                /* datain src
                 * 0: tdmin_a;
                 * 4: pdmin;
                 */
                datain_src = <4>;
-               datain_chnum = <8>;
-               datain_chmask = <0x3f>;
+               datain_chnum = <4>;
+               datain_chmask = <0xf>;
+               /* config which data pin for loopback */
+               datain-lane-mask-in = <1 0 1 0>;
+
+               /* calc mclk for datalb */
+               mclk-fs = <256>;
 
                /* tdmin_lb src
                 * 0: tdmoutA
                 * 1: tdmoutB
                 * 2: tdmoutC
-                * 3: PAD_tdminA
-                * 4: PAD_tdminB
-                * 5: PAD_tdminC
+                * 3: PAD_TDMINA_DIN*, refer to core pinmux
+                * 4: PAD_TDMINB_DIN*, refer to core pinmux
+                * 5: PAD_TDMINC_DIN*, refer to core pinmux
+                * 6: PAD_TDMINA_D*, oe, refer to core pinmux
+                * 7: PAD_TDMINB_D*, oe, refer to core pinmux
                 */
-               datalb_src = <2>;
-               datalb_chnum = <8>;
+               /* if tdmin_lb >= 3, use external loopback */
+               datalb_src = <1>;
+               datalb_chnum = <2>;
                datalb_chmask = <0x3>;
+               /* config which data pin as loopback */
+               datalb-lane-mask-in = <1 0 0 0>;
 
-               status = "disabled";
+               status = "okay";
        };
 
        audioresample: resample {
index e83acce..a18e712 100644 (file)
                compatible = "amlogic, g12a-sound-card";
                aml-audio-card,name = "AML-AUGESOUND";
 
-               //aml-audio-card,loopback = <&aml_loopback>;
+
                //aml-audio-card,aux-devs = <&amlogic_codec>;
                /*avout mute gpio*/
                avout_mute-gpios = <&gpio_ao GPIOAO_6 GPIO_ACTIVE_HIGH>;
                                sound-dai = <&dummy_codec>;
                        };
                };
+
+               aml-audio-card,dai-link@6 {
+                       mclk-fs = <256>;
+                       continuous-clock;
+                       suffix-name = "alsaPORT-loopback";
+                       cpu {
+                               sound-dai = <&loopback>;
+                               system-clock-frequency = <12288000>;
+                       };
+                       codec {
+                               sound-dai = <&dummy_codec>;
+                       };
+               };
        };
        audiolocker: locker {
                compatible = "amlogic, audiolocker";
                        "samesource_srcpll", "samesource_clk";
                pinctrl-names = "tdm_pins";
                pinctrl-0 = <&tdmb_mclk &tdmout_b &tdmin_b>;
+               mclk_pad = <0>;  /* 0: mclk_0; 1: mclk_1 */
                /*
                 * 0: tdmout_a;
                 * 1: tdmout_b;
                clock-names = "mclk", "clk_srcpll";
                pinctrl-names = "tdm_pins";
                pinctrl-0 = <&tdmc_mclk &tdmout_c &tdmin_c>;
+               mclk_pad = <1>;  /* 0: mclk_0; 1: mclk_1 */
        };
 
-       /* copy a useless tdm to output for hdmi, no pinmux */
-       aml_i2s2hdmi: i2s2hdmi {
-               compatible = "amlogic, g12a-snd-tdmc";
+       tdmlb: tdm@3 {
+               compatible = "amlogic, g12a-snd-tdmlb";
                #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>;
+               dai-tdm-lane-lb-slot-mask-in = <1 0 0 0>;
+               dai-tdm-clk-sel = <1>;
+               clocks = <&clkaudio CLKID_AUDIO_MCLK_B
+                               &clkc CLKID_MPLL1>;
                clock-names = "mclk", "clk_srcpll";
-
-               i2s2hdmi = <1>;
+               /*
+                * select tdmin_lb src;
+                *0: TDMOUTA
+                *1: TDMOUTB
+                *2: TDMOUTC
+                *3: PAD_TDMINA
+                *4: PAD_TDMINB
+                *5: PAD_TDMINC
+                */
+               lb-src-sel = <1>;
 
                status = "okay";
        };
                filter_mode = <1>; /* mode 0~4, defalut:1 */
                status = "okay";
        };
-       aml_loopback: loopback {
-               compatible = "amlogic, snd-loopback";
-               /*
-                * 0: out rate = in data rate;
-                * 1: out rate = loopback data rate;
-                */
-               lb_mode = <0>;
+
+       loopback:loopback@0 {
+               compatible = "amlogic, g12a-loopback";
+               #sound-dai-cells = <0>;
+
+               clocks = <&clkaudio CLKID_AUDIO_PDM
+                       &clkc CLKID_FCLK_DIV3
+                       &clkc CLKID_MPLL3
+                       &clkaudio CLKID_AUDIO_PDMIN0
+                       &clkaudio CLKID_AUDIO_PDMIN1
+                       &clkc CLKID_MPLL0
+                       &clkaudio CLKID_AUDIO_MCLK_A>;
+               clock-names = "pdm_gate",
+                       "pdm_sysclk_srcpll",
+                       "pdm_dclk_srcpll",
+                       "pdm_dclk",
+                       "pdm_sysclk",
+                       "tdminlb_mpll",
+                       "tdminlb_mclk";
 
                /* datain src
                 * 0: tdmin_a;
                 * 4: pdmin;
                 */
                datain_src = <4>;
-               datain_chnum = <8>;
-               datain_chmask = <0x3f>;
+               datain_chnum = <4>;
+               datain_chmask = <0xf>;
+               /* config which data pin for loopback */
+               datain-lane-mask-in = <1 0 1 0>;
+
+               /* calc mclk for datalb */
+               mclk-fs = <256>;
 
                /* tdmin_lb src
                 * 0: tdmoutA
                 * 1: tdmoutB
                 * 2: tdmoutC
-                * 3: PAD_tdminA
-                * 4: PAD_tdminB
-                * 5: PAD_tdminC
+                * 3: PAD_TDMINA_DIN*, refer to core pinmux
+                * 4: PAD_TDMINB_DIN*, refer to core pinmux
+                * 5: PAD_TDMINC_DIN*, refer to core pinmux
+                * 6: PAD_TDMINA_D*, oe, refer to core pinmux
+                * 7: PAD_TDMINB_D*, oe, refer to core pinmux
                 */
-               datalb_src = <2>;
-               datalb_chnum = <8>;
+               /* if tdmin_lb >= 3, use external loopback */
+               datalb_src = <1>;
+               datalb_chnum = <2>;
                datalb_chmask = <0x3>;
+               /* config which data pin as loopback */
+               datalb-lane-mask-in = <1 0 0 0>;
 
-               status = "disabled";
+               status = "okay";
        };
 
        audioresample: resample {
index e252876..bd88f36 100644 (file)
                                sound-dai = <&dummy_codec>;
                        };
                };
+
                aml-audio-card,dai-link@6 {
                        mclk-fs = <256>;
                        suffix-name = "alsaPORT-earc";
                                sound-dai = <&dummy_codec>;
                        };
                };
+
+               aml-audio-card,dai-link@7 {
+                       mclk-fs = <256>;
+                       continuous-clock;
+                       suffix-name = "alsaPORT-loopback";
+                       cpu {
+                               sound-dai = <&loopbacka>;
+                               system-clock-frequency = <12288000>;
+                       };
+                       codec {
+                               sound-dai = <&dummy_codec>;
+                       };
+               };
        };
        audiolocker: locker {
                compatible = "amlogic, audiolocker";
                 */
                samesource_sel = <3>;
 
+               /*enable default mclk(12.288M), before extern codec start*/
+               start_clk_enable = <1>;
+
+               /*tdm clk tuning enable*/
+               clk_tuning_enable = <1>;
+
                status = "okay";
        };
 
                status = "okay";
        };
 
+       tdmlb:tdm@3 {
+               compatible = "amlogic, sm1-snd-tdmlb";
+               #sound-dai-cells = <0>;
+
+               dai-tdm-lane-lb-slot-mask-in = <1 0 0 0>;
+               dai-tdm-clk-sel = <1>;
+
+               clocks = <&clkaudio CLKID_AUDIO_MCLK_B
+                               &clkc CLKID_MPLL1>;
+               clock-names = "mclk", "clk_srcpll";
+
+               /*
+                * select tdmin_lb src;
+                * AXG
+                *  0: TDMOUTA
+                *  1: TDMOUTB
+                *  2: TDMOUTC
+                *  3: PAD_TDMINA
+                *  4: PAD_TDMINB
+                *  5: PAD_TDMINC
+                *
+                * G12A/G12B
+                *  0: TDMOUTA
+                *  1: TDMOUTB
+                *  2: TDMOUTC
+                *  3: PAD_TDMINA_DIN*
+                *  4: PAD_TDMINB_DIN*
+                *  5: PAD_TDMINC_DIN*
+                *  6: PAD_TDMINA_D*, oe pin
+                *  7: PAD_TDMINB_D*, oe pin
+                *
+                * TL1/SM1
+                *  0: TDMOUTA
+                *  1: TDMOUTB
+                *  2: TDMOUTC
+                *  3: PAD_TDMINA_DIN*
+                *  4: PAD_TDMINB_DIN*
+                *  5: PAD_TDMINC_DIN*
+                *  6: PAD_TDMINA_D*
+                *  7: PAD_TDMINB_D*
+                *  8: PAD_TDMINC_D*
+                *  9: HDMIRX_I2S
+                *  10: ACODEC_ADC
+                */
+               lb-src-sel = <1>;
+
+               status = "disabled";
+       };
+
        spdifa: spdif@0 {
                compatible = "amlogic, sm1-snd-spdif-a";
                #sound-dai-cells = <0>;
                pinctrl-names = "spdif_pins";
                pinctrl-0 = <&spdifout /* &spdifin */>;
 
+               /*spdif clk tuning enable*/
+               clk_tuning_enable = <1>;
+
                status = "okay";
        };
        spdifb: spdif@1 {
 
                status = "okay";
        };
+
+       loopbacka:loopback@0 {
+               compatible = "amlogic, sm1-loopbacka";
+               #sound-dai-cells = <0>;
+
+               clocks = <&clkaudio CLKID_AUDIO_GATE_PDM
+                       &clkc CLKID_FCLK_DIV3
+                       &clkc CLKID_MPLL3
+                       &clkaudio CLKID_AUDIO_PDMIN0
+                       &clkaudio CLKID_AUDIO_PDMIN1
+                       &clkc CLKID_MPLL0
+                       &clkaudio CLKID_AUDIO_MCLK_A>;
+               clock-names = "pdm_gate",
+                       "pdm_sysclk_srcpll",
+                       "pdm_dclk_srcpll",
+                       "pdm_dclk",
+                       "pdm_sysclk",
+                       "tdminlb_mpll",
+                       "tdminlb_mclk";
+
+               /* datain src
+                * 0: tdmin_a;
+                * 1: tdmin_b;
+                * 2: tdmin_c;
+                * 3: spdifin;
+                * 4: pdmin;
+                */
+               datain_src = <4>;
+               datain_chnum = <6>;
+               datain_chmask = <0x3f>;
+               /* config which data pin for loopback */
+               datain-lane-mask-in = <1 1 1 0>;
+
+               /* calc mclk for datalb */
+               mclk-fs = <256>;
+
+               /* tdmin_lb src
+                * 0: tdmoutA
+                * 1: tdmoutB
+                * 2: tdmoutC
+                * 3: PAD_TDMINA_DIN*, refer to core pinmux
+                * 4: PAD_TDMINB_DIN*, refer to core pinmux
+                * 5: PAD_TDMINC_DIN*, refer to core pinmux
+                * 6: PAD_TDMINA_D*, oe, refer to core pinmux
+                * 7: PAD_TDMINB_D*, oe, refer to core pinmux
+                */
+               /* if tdmin_lb >= 3, use external loopback */
+               datalb_src = <1>;
+               datalb_chnum = <2>;
+               datalb_chmask = <0x3>;
+               /* config which data pin as loopback */
+               datalb-lane-mask-in = <1 0 0 0>;
+
+               status = "okay";
+       };
+
+       loopbackb:loopback@1 {
+               compatible = "amlogic, sm1-loopbackb";
+               #sound-dai-cells = <0>;
+
+               clocks = <&clkaudio CLKID_AUDIO_GATE_PDM
+                       &clkc CLKID_FCLK_DIV3
+                       &clkc CLKID_MPLL3
+                       &clkaudio CLKID_AUDIO_PDMIN0
+                       &clkaudio CLKID_AUDIO_PDMIN1
+                       &clkc CLKID_MPLL0
+                       &clkaudio CLKID_AUDIO_MCLK_A>;
+               clock-names = "pdm_gate",
+                       "pdm_sysclk_srcpll",
+                       "pdm_dclk_srcpll",
+                       "pdm_dclk",
+                       "pdm_sysclk",
+                       "tdminlb_mpll",
+                       "tdminlb_mclk";
+
+               /* calc mclk for datain_lb */
+               mclk-fs = <256>;
+
+               /* datain src
+                * 0: tdmin_a;
+                * 1: tdmin_b;
+                * 2: tdmin_c;
+                * 3: spdifin;
+                * 4: pdmin;
+                */
+               datain_src = <4>;
+               datain_chnum = <4>;
+               datain_chmask = <0xf>;
+               /* config which data pin for loopback */
+               datain-lane-mask-in = <1 0 1 0>;
+
+               /* tdmin_lb src
+                * 0: tdmoutA
+                * 1: tdmoutB
+                * 2: tdmoutC
+                * 3: PAD_TDMINA_DIN*, refer to core pinmux
+                * 4: PAD_TDMINB_DIN*, refer to core pinmux
+                * 5: PAD_TDMINC_DIN*, refer to core pinmux
+                * 6: PAD_TDMINA_D*, oe, refer to core pinmux
+                * 7: PAD_TDMINB_D*, oe, refer to core pinmux
+                */
+               /* if tdmin_lb >= 3, use external loopback */
+               datalb_src = <1>;
+               datalb_chnum = <2>;
+               datalb_chmask = <0x3>;
+               /* config which data pin as loopback */
+               datalb-lane-mask-in = <1 0 0 0>;
+
+               status = "disabled";
+       };
 }; /* end of audiobus */
 
 &pinctrl_periphs {
index e6c7d24..d3e0666 100644 (file)
                 */
                samesource_sel = <3>;
 
+               /*enable default mclk(12.288M), before extern codec start*/
+               start_clk_enable = <1>;
+
+               /*tdm clk tuning enable*/
+               clk_tuning_enable = <1>;
+
                status = "okay";
        };
 
                pinctrl-names = "spdif_pins";
                pinctrl-0 = <&spdifout /* &spdifin */>;
 
+               /*spdif clk tuning enable*/
+               clk_tuning_enable = <1>;
+
                status = "okay";
        };
        spdifb: spdif@1 {
index ea75088..f89640c 100644 (file)
                 */
                samesource_sel = <3>;
 
+               /*enable default mclk(12.288M), before extern codec start*/
+               start_clk_enable = <1>;
+
+               /*tdm clk tuning enable*/
+               clk_tuning_enable = <1>;
+
                status = "okay";
        };
 
                pinctrl-names = "spdif_pins";
                pinctrl-0 = <&spdifout /* &spdifin */>;
 
+               /*spdif clk tuning enable*/
+               clk_tuning_enable = <1>;
+
                status = "okay";
        };
        spdifb: spdif@1 {
index 5c48744..4551965 100644 (file)
                                sound-dai = <&dummy_codec>;
                        };
                };
+
                aml-audio-card,dai-link@6 {
                        mclk-fs = <256>;
                        suffix-name = "alsaPORT-earc";
                                sound-dai = <&dummy_codec>;
                        };
                };
+
+               aml-audio-card,dai-link@7 {
+                       mclk-fs = <256>;
+                       continuous-clock;
+                       suffix-name = "alsaPORT-loopback";
+                       cpu {
+                               sound-dai = <&loopbacka>;
+                               system-clock-frequency = <12288000>;
+                       };
+                       codec {
+                               sound-dai = <&dummy_codec>;
+                       };
+               };
+
+               aml-audio-card,dai-link@8 {
+                       format = "i2s";
+                       mclk-fs = <256>;
+                       //continuous-clock;
+                       //bitclock-inversion;
+                       //frame-inversion;
+                       /* master mode */
+                       bitclock-master = <&tdmlb>;
+                       frame-master = <&tdmlb>;
+                       /* slave mode */
+                       //bitclock-master = <&tdmlbcodec>;
+                       //frame-master = <&tdmlbcodec>;
+                       /* suffix-name, sync with android audio hal used for */
+                       //suffix-name = "alsaPORT-tdmlb";
+                       cpu {
+                               sound-dai = <&tdmlb>;
+                               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>;
+                       };
+                       tdmlbcodec: codec {
+                               sound-dai = <&dummy_codec>;
+                       };
+               };
        };
        audiolocker: locker {
                compatible = "amlogic, audiolocker";
                 */
                samesource_sel = <3>;
 
+               /*enable default mclk(12.288M), before extern codec start*/
+               start_clk_enable = <0>;
+
+               /*tdm clk tuning enable*/
+               clk_tuning_enable = <1>;
+
                status = "okay";
        };
 
                status = "okay";
        };
 
+       tdmlb:tdm@3 {
+               compatible = "amlogic, sm1-snd-tdmlb";
+               #sound-dai-cells = <0>;
+
+               dai-tdm-lane-lb-slot-mask-in = <1 0 0 0>;
+               dai-tdm-clk-sel = <1>;
+
+               clocks = <&clkaudio CLKID_AUDIO_MCLK_B
+                               &clkc CLKID_MPLL1>;
+               clock-names = "mclk", "clk_srcpll";
+
+               /*
+                * select tdmin_lb src;
+                * AXG
+                *  0: TDMOUTA
+                *  1: TDMOUTB
+                *  2: TDMOUTC
+                *  3: PAD_TDMINA
+                *  4: PAD_TDMINB
+                *  5: PAD_TDMINC
+                *
+                * G12A/G12B
+                *  0: TDMOUTA
+                *  1: TDMOUTB
+                *  2: TDMOUTC
+                *  3: PAD_TDMINA_DIN*
+                *  4: PAD_TDMINB_DIN*
+                *  5: PAD_TDMINC_DIN*
+                *  6: PAD_TDMINA_D*, oe pin
+                *  7: PAD_TDMINB_D*, oe pin
+                *
+                * TL1/SM1
+                *  0: TDMOUTA
+                *  1: TDMOUTB
+                *  2: TDMOUTC
+                *  3: PAD_TDMINA_DIN*
+                *  4: PAD_TDMINB_DIN*
+                *  5: PAD_TDMINC_DIN*
+                *  6: PAD_TDMINA_D*
+                *  7: PAD_TDMINB_D*
+                *  8: PAD_TDMINC_D*
+                *  9: HDMIRX_I2S
+                *  10: ACODEC_ADC
+                */
+               lb-src-sel = <1>;
+
+               status = "okay";
+       };
+
        spdifa: spdif@0 {
                compatible = "amlogic, sm1-snd-spdif-a";
                #sound-dai-cells = <0>;
                pinctrl-names = "spdif_pins";
                pinctrl-0 = <&spdifout &spdifin>;
 
+               /*spdif clk tuning enable*/
+               clk_tuning_enable = <1>;
+
                status = "okay";
        };
        spdifb: spdif@1 {
 
                status = "okay";
        };
+
+       loopbacka:loopback@0 {
+               compatible = "amlogic, sm1-loopbacka";
+               #sound-dai-cells = <0>;
+
+               clocks = <&clkaudio CLKID_AUDIO_GATE_PDM
+                       &clkc CLKID_FCLK_DIV3
+                       &clkc CLKID_MPLL3
+                       &clkaudio CLKID_AUDIO_PDMIN0
+                       &clkaudio CLKID_AUDIO_PDMIN1
+                       &clkc CLKID_MPLL0
+                       &clkaudio CLKID_AUDIO_MCLK_A>;
+               clock-names = "pdm_gate",
+                       "pdm_sysclk_srcpll",
+                       "pdm_dclk_srcpll",
+                       "pdm_dclk",
+                       "pdm_sysclk",
+                       "tdminlb_mpll",
+                       "tdminlb_mclk";
+
+               /* datain src
+                * 0: tdmin_a;
+                * 1: tdmin_b;
+                * 2: tdmin_c;
+                * 3: spdifin;
+                * 4: pdmin;
+                */
+               datain_src = <4>;
+               datain_chnum = <6>;
+               datain_chmask = <0x3f>;
+               /* config which data pin for loopback */
+               datain-lane-mask-in = <1 1 1 0>;
+
+               /* calc mclk for datalb */
+               mclk-fs = <256>;
+
+               /* tdmin_lb src
+                * 0: tdmoutA
+                * 1: tdmoutB
+                * 2: tdmoutC
+                * 3: PAD_TDMINA_DIN*, refer to core pinmux
+                * 4: PAD_TDMINB_DIN*, refer to core pinmux
+                * 5: PAD_TDMINC_DIN*, refer to core pinmux
+                * 6: PAD_TDMINA_D*, oe, refer to core pinmux
+                * 7: PAD_TDMINB_D*, oe, refer to core pinmux
+                */
+               /* if tdmin_lb >= 3, use external loopback */
+               datalb_src = <1>;
+               datalb_chnum = <2>;
+               datalb_chmask = <0x3>;
+               /* config which data pin as loopback */
+               datalb-lane-mask-in = <1 0 0 0>;
+
+               status = "okay";
+       };
+
+       loopbackb:loopback@1 {
+               compatible = "amlogic, sm1-loopbackb";
+               #sound-dai-cells = <0>;
+
+               clocks = <&clkaudio CLKID_AUDIO_GATE_PDM
+                       &clkc CLKID_FCLK_DIV3
+                       &clkc CLKID_MPLL3
+                       &clkaudio CLKID_AUDIO_PDMIN0
+                       &clkaudio CLKID_AUDIO_PDMIN1
+                       &clkc CLKID_MPLL0
+                       &clkaudio CLKID_AUDIO_MCLK_A>;
+               clock-names = "pdm_gate",
+                       "pdm_sysclk_srcpll",
+                       "pdm_dclk_srcpll",
+                       "pdm_dclk",
+                       "pdm_sysclk",
+                       "tdminlb_mpll",
+                       "tdminlb_mclk";
+
+               /* calc mclk for datain_lb */
+               mclk-fs = <256>;
+
+               /* datain src
+                * 0: tdmin_a;
+                * 1: tdmin_b;
+                * 2: tdmin_c;
+                * 3: spdifin;
+                * 4: pdmin;
+                */
+               datain_src = <4>;
+               datain_chnum = <4>;
+               datain_chmask = <0xf>;
+               /* config which data pin for loopback */
+               datain-lane-mask-in = <1 0 1 0>;
+
+               /* tdmin_lb src
+                * 0: tdmoutA
+                * 1: tdmoutB
+                * 2: tdmoutC
+                * 3: PAD_TDMINA_DIN*, refer to core pinmux
+                * 4: PAD_TDMINB_DIN*, refer to core pinmux
+                * 5: PAD_TDMINC_DIN*, refer to core pinmux
+                * 6: PAD_TDMINA_D*, oe, refer to core pinmux
+                * 7: PAD_TDMINB_D*, oe, refer to core pinmux
+                */
+               /* if tdmin_lb >= 3, use external loopback */
+               datalb_src = <1>;
+               datalb_chnum = <2>;
+               datalb_chmask = <0x3>;
+               /* config which data pin as loopback */
+               datalb-lane-mask-in = <1 0 0 0>;
+
+               status = "disabled";
+       };
 }; /* end of audiobus */
 
 &pinctrl_periphs {
index 25fafea..d25c671 100644 (file)
                                sound-dai = <&dummy_codec>;
                        };
                };
+
+               aml-audio-card,dai-link@7 {
+                       mclk-fs = <256>;
+                       continuous-clock;
+                       suffix-name = "alsaPORT-loopback";
+                       cpu {
+                               sound-dai = <&loopbacka>;
+                               system-clock-frequency = <12288000>;
+                       };
+                       codec {
+                               sound-dai = <&dummy_codec>;
+                       };
+               };
        };
        audiolocker: locker {
                compatible = "amlogic, audiolocker";
                 */
                samesource_sel = <3>;
 
+               /*enable default mclk(12.288M), before extern codec start*/
+               start_clk_enable = <1>;
+
+               /*tdm clk tuning enable*/
+               clk_tuning_enable = <1>;
+
                status = "okay";
        };
 
                status = "okay";
        };
 
+       tdmlb:tdm@3 {
+               compatible = "amlogic, sm1-snd-tdmlb";
+               #sound-dai-cells = <0>;
+
+               dai-tdm-lane-lb-slot-mask-in = <1 0 0 0>;
+               dai-tdm-clk-sel = <1>;
+
+               clocks = <&clkaudio CLKID_AUDIO_MCLK_B
+                               &clkc CLKID_MPLL1>;
+               clock-names = "mclk", "clk_srcpll";
+
+               /*
+                * select tdmin_lb src;
+                * AXG
+                *  0: TDMOUTA
+                *  1: TDMOUTB
+                *  2: TDMOUTC
+                *  3: PAD_TDMINA
+                *  4: PAD_TDMINB
+                *  5: PAD_TDMINC
+                *
+                * G12A/G12B
+                *  0: TDMOUTA
+                *  1: TDMOUTB
+                *  2: TDMOUTC
+                *  3: PAD_TDMINA_DIN*
+                *  4: PAD_TDMINB_DIN*
+                *  5: PAD_TDMINC_DIN*
+                *  6: PAD_TDMINA_D*, oe pin
+                *  7: PAD_TDMINB_D*, oe pin
+                *
+                * TL1/SM1
+                *  0: TDMOUTA
+                *  1: TDMOUTB
+                *  2: TDMOUTC
+                *  3: PAD_TDMINA_DIN*
+                *  4: PAD_TDMINB_DIN*
+                *  5: PAD_TDMINC_DIN*
+                *  6: PAD_TDMINA_D*
+                *  7: PAD_TDMINB_D*
+                *  8: PAD_TDMINC_D*
+                *  9: HDMIRX_I2S
+                *  10: ACODEC_ADC
+                */
+               lb-src-sel = <1>;
+
+               status = "disabled";
+       };
+
        spdifa: spdif@0 {
                compatible = "amlogic, sm1-snd-spdif-a";
                #sound-dai-cells = <0>;
                pinctrl-names = "spdif_pins";
                pinctrl-0 = <&spdifout &spdifin>;
 
+               /*spdif clk tuning enable*/
+               clk_tuning_enable = <1>;
+
                status = "okay";
        };
        spdifb: spdif@1 {
 
                status = "okay";
        };
+
+       loopbacka:loopback@0 {
+               compatible = "amlogic, sm1-loopbacka";
+               #sound-dai-cells = <0>;
+
+               clocks = <&clkaudio CLKID_AUDIO_GATE_PDM
+                       &clkc CLKID_FCLK_DIV3
+                       &clkc CLKID_MPLL3
+                       &clkaudio CLKID_AUDIO_PDMIN0
+                       &clkaudio CLKID_AUDIO_PDMIN1
+                       &clkc CLKID_MPLL0
+                       &clkaudio CLKID_AUDIO_MCLK_A>;
+               clock-names = "pdm_gate",
+                       "pdm_sysclk_srcpll",
+                       "pdm_dclk_srcpll",
+                       "pdm_dclk",
+                       "pdm_sysclk",
+                       "tdminlb_mpll",
+                       "tdminlb_mclk";
+
+               /* datain src
+                * 0: tdmin_a;
+                * 1: tdmin_b;
+                * 2: tdmin_c;
+                * 3: spdifin;
+                * 4: pdmin;
+                */
+               datain_src = <4>;
+               datain_chnum = <6>;
+               datain_chmask = <0x3f>;
+               /* config which data pin for loopback */
+               datain-lane-mask-in = <1 1 1 0>;
+
+               /* calc mclk for datalb */
+               mclk-fs = <256>;
+
+               /* tdmin_lb src
+                * 0: tdmoutA
+                * 1: tdmoutB
+                * 2: tdmoutC
+                * 3: PAD_TDMINA_DIN*, refer to core pinmux
+                * 4: PAD_TDMINB_DIN*, refer to core pinmux
+                * 5: PAD_TDMINC_DIN*, refer to core pinmux
+                * 6: PAD_TDMINA_D*, oe, refer to core pinmux
+                * 7: PAD_TDMINB_D*, oe, refer to core pinmux
+                */
+               /* if tdmin_lb >= 3, use external loopback */
+               datalb_src = <1>;
+               datalb_chnum = <2>;
+               datalb_chmask = <0x3>;
+               /* config which data pin as loopback */
+               datalb-lane-mask-in = <1 0 0 0>;
+
+               status = "okay";
+       };
+
+       loopbackb:loopback@1 {
+               compatible = "amlogic, sm1-loopbackb";
+               #sound-dai-cells = <0>;
+
+               clocks = <&clkaudio CLKID_AUDIO_GATE_PDM
+                       &clkc CLKID_FCLK_DIV3
+                       &clkc CLKID_MPLL3
+                       &clkaudio CLKID_AUDIO_PDMIN0
+                       &clkaudio CLKID_AUDIO_PDMIN1
+                       &clkc CLKID_MPLL0
+                       &clkaudio CLKID_AUDIO_MCLK_A>;
+               clock-names = "pdm_gate",
+                       "pdm_sysclk_srcpll",
+                       "pdm_dclk_srcpll",
+                       "pdm_dclk",
+                       "pdm_sysclk",
+                       "tdminlb_mpll",
+                       "tdminlb_mclk";
+
+               /* calc mclk for datain_lb */
+               mclk-fs = <256>;
+
+               /* datain src
+                * 0: tdmin_a;
+                * 1: tdmin_b;
+                * 2: tdmin_c;
+                * 3: spdifin;
+                * 4: pdmin;
+                */
+               datain_src = <4>;
+               datain_chnum = <4>;
+               datain_chmask = <0xf>;
+               /* config which data pin for loopback */
+               datain-lane-mask-in = <1 0 1 0>;
+
+               /* tdmin_lb src
+                * 0: tdmoutA
+                * 1: tdmoutB
+                * 2: tdmoutC
+                * 3: PAD_TDMINA_DIN*, refer to core pinmux
+                * 4: PAD_TDMINB_DIN*, refer to core pinmux
+                * 5: PAD_TDMINC_DIN*, refer to core pinmux
+                * 6: PAD_TDMINA_D*, oe, refer to core pinmux
+                * 7: PAD_TDMINB_D*, oe, refer to core pinmux
+                */
+               /* if tdmin_lb >= 3, use external loopback */
+               datalb_src = <1>;
+               datalb_chnum = <2>;
+               datalb_chmask = <0x3>;
+               /* config which data pin as loopback */
+               datalb-lane-mask-in = <1 0 0 0>;
+
+               status = "disabled";
+       };
 }; /* end of audiobus */
 
 &pinctrl_periphs {
diff --git a/include/dt-bindings/clock/amlogic,tm2-audio-clk.h b/include/dt-bindings/clock/amlogic,tm2-audio-clk.h
new file mode 100644 (file)
index 0000000..a70cf1e
--- /dev/null
@@ -0,0 +1,97 @@
+/*
+ * include/dt-bindings/clock/amlogic,tm2-audio-clk.h
+ *
+ * Copyright (C) 2018 Amlogic, Inc. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ *
+ */
+
+#ifndef __TM2_AUDIO_CLK_H__
+#define __TM2_AUDIO_CLK_H__
+
+/*
+ * CLKID audio index values
+ */
+
+#define CLKID_AUDIO_GATE_DDR_ARB                0
+#define CLKID_AUDIO_GATE_PDM                    1
+#define CLKID_AUDIO_GATE_TDMINA                 2
+#define CLKID_AUDIO_GATE_TDMINB                 3
+#define CLKID_AUDIO_GATE_TDMINC                 4
+#define CLKID_AUDIO_GATE_TDMINLB                5
+#define CLKID_AUDIO_GATE_TDMOUTA                6
+#define CLKID_AUDIO_GATE_TDMOUTB                7
+#define CLKID_AUDIO_GATE_TDMOUTC                8
+#define CLKID_AUDIO_GATE_FRDDRA                 9
+#define CLKID_AUDIO_GATE_FRDDRB                 10
+#define CLKID_AUDIO_GATE_FRDDRC                 11
+#define CLKID_AUDIO_GATE_TODDRA                 12
+#define CLKID_AUDIO_GATE_TODDRB                 13
+#define CLKID_AUDIO_GATE_TODDRC                 14
+#define CLKID_AUDIO_GATE_LOOPBACKA              15
+#define CLKID_AUDIO_GATE_SPDIFIN                16
+#define CLKID_AUDIO_GATE_SPDIFOUT_A             17
+#define CLKID_AUDIO_GATE_RESAMPLEA              18
+#define CLKID_AUDIO_GATE_RESERVED0              19
+#define CLKID_AUDIO_GATE_RESERVED1              20
+#define CLKID_AUDIO_GATE_SPDIFOUT_B             21
+#define CLKID_AUDIO_GATE_EQDRC                  22
+#define CLKID_AUDIO_GATE_RESERVED2              23
+#define CLKID_AUDIO_GATE_RESERVED3              24
+#define CLKID_AUDIO_GATE_RESERVED4              25
+#define CLKID_AUDIO_GATE_RESAMPLEB              26
+#define CLKID_AUDIO_GATE_TOVAD                  27
+#define CLKID_AUDIO_GATE_AUDIOLOCKER            28
+#define CLKID_AUDIO_GATE_SPDIFIN_LB             29
+#define CLKID_AUDIO_GATE_FRATV                  30
+#define CLKID_AUDIO_GATE_FRHDMIRX               31
+
+/* Gate En1 */
+#define CLKID_AUDIO_GATE_FRDDRD                 32
+#define CLKID_AUDIO_GATE_TODDRD                 33
+#define CLKID_AUDIO_GATE_LOOPBACKB              34
+#define CLKID_AUDIO_GATE_FRDDRE                 35
+#define CLKID_AUDIO_GATE_TODDRE                 36
+#define CLKID_AUDIO_GATE_EARCTX                 37
+#define CLKID_AUDIO_GATE_EARCRX                 38
+#define CLKID_AUDIO_GATE_RESAMPLEB_OLD          39
+#define CLKID_AUDIO_GATE_LOCKER                 40
+
+#define CLKID_AUDIO_GATE_MAX                    41
+
+#define MCLK_BASE                               CLKID_AUDIO_GATE_MAX
+#define CLKID_AUDIO_MCLK_A                      (MCLK_BASE + 0)
+#define CLKID_AUDIO_MCLK_B                      (MCLK_BASE + 1)
+#define CLKID_AUDIO_MCLK_C                      (MCLK_BASE + 2)
+#define CLKID_AUDIO_MCLK_D                      (MCLK_BASE + 3)
+#define CLKID_AUDIO_MCLK_E                      (MCLK_BASE + 4)
+#define CLKID_AUDIO_MCLK_F                      (MCLK_BASE + 5)
+
+#define CLKID_AUDIO_SPDIFIN                     (MCLK_BASE + 6)
+#define CLKID_AUDIO_SPDIFOUT_A                  (MCLK_BASE + 7)
+#define CLKID_AUDIO_RESAMPLE_A                  (MCLK_BASE + 8)
+#define CLKID_AUDIO_LOCKER_OUT                  (MCLK_BASE + 9)
+#define CLKID_AUDIO_LOCKER_IN                   (MCLK_BASE + 10)
+#define CLKID_AUDIO_PDMIN0                      (MCLK_BASE + 11)
+#define CLKID_AUDIO_PDMIN1                      (MCLK_BASE + 12)
+#define CLKID_AUDIO_SPDIFOUT_B                  (MCLK_BASE + 13)
+#define CLKID_AUDIO_RESAMPLE_B                  (MCLK_BASE + 14)
+#define CLKID_AUDIO_SPDIFIN_LB                  (MCLK_BASE + 15)
+#define CLKID_AUDIO_EQDRC                       (MCLK_BASE + 16)
+#define CLKID_AUDIO_VAD                         (MCLK_BASE + 17)
+#define CLKID_EARCTX_CMDC                       (MCLK_BASE + 18)
+#define CLKID_EARCTX_DMAC                       (MCLK_BASE + 19)
+#define CLKID_EARCRX_CMDC                       (MCLK_BASE + 20)
+#define CLKID_EARCRX_DMAC                       (MCLK_BASE + 21)
+
+#define NUM_AUDIO_CLKS                          (MCLK_BASE + 22)
+#endif /* __TM2_AUDIO_CLK_H__ */
index 91825bf..fb7a973 100644 (file)
@@ -5,6 +5,7 @@ obj-$(CONFIG_AMLOGIC_SND_SOC_AUGE)      += audio_controller.o \
                                                g12a,clocks.o \
                                                tl1,clocks.o \
                                                sm1,clocks.o \
+                                               tm2,clocks.o \
                                                card.o \
                                                card_utils.o \
                                                tdm.o \
@@ -16,6 +17,7 @@ obj-$(CONFIG_AMLOGIC_SND_SOC_AUGE)    += audio_controller.o \
                                                pdm_hw_coeff.o \
                                                iomap.o \
                                                ddr_mngr.o \
+                                               loopback.o \
                                                loopback_hw.o \
                                                audio_utils.o \
                                                locker.o \
diff --git a/sound/soc/amlogic/auge/audio_aed_reg_list.h b/sound/soc/amlogic/auge/audio_aed_reg_list.h
new file mode 100644 (file)
index 0000000..3f27902
--- /dev/null
@@ -0,0 +1,159 @@
+/*
+ * sound/soc/amlogic/auge/audio_aed_reg_list.h
+ *
+ * Copyright (C) 2017 Amlogic, Inc. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ *
+ */
+
+#ifndef __AML_AUDIO_AED_REG_H_
+#define __AML_AUDIO_AED_REG_H_
+
+#include "regs.h"
+
+static const struct register_table aed_register_table[] = {
+{"AED_COEF_RAM_CNTL           ",     0x00},
+{"AED_COEF_RAM_DATA           ",     0x01},
+{"AED_EQ_EN                   ",     0x02},
+{"AED_EQ_TAP_CNTL             ",     0x03},
+{"AED_EQ_VOLUME               ",     0x04},
+{"AED_EQ_VOLUME_SLEW_CNT      ",     0x05},
+{"AED_MUTE                    ",     0x06},
+{"AED_DRC_CNTL                ",     0x07},
+{"AED_DRC_RMS_COEF0           ",     0x08},
+{"AED_DRC_RMS_COEF1           ",     0x09},
+{"AED_DRC_THD0                ",     0x0a},
+{"AED_DRC_THD1                ",     0x0b},
+{"AED_DRC_THD2                ",     0x0c},
+{"AED_DRC_THD3                ",     0x0d},
+{"AED_DRC_THD4                ",     0x0e},
+{"AED_DRC_K0                  ",     0x0f},
+{"AED_DRC_K1                  ",     0x10},
+{"AED_DRC_K2                  ",     0x11},
+{"AED_DRC_K3                  ",     0x12},
+{"AED_DRC_K4                  ",     0x13},
+{"AED_DRC_K5                  ",     0x14},
+{"AED_DRC_THD_OUT0            ",     0x15},
+{"AED_DRC_THD_OUT1            ",     0x16},
+{"AED_DRC_THD_OUT2            ",     0x17},
+{"AED_DRC_THD_OUT3            ",     0x18},
+{"AED_DRC_OFFSET              ",     0x19},
+{"AED_DRC_RELEASE_COEF00      ",     0x1a},
+{"AED_DRC_RELEASE_COEF01      ",     0x1b},
+{"AED_DRC_RELEASE_COEF10      ",     0x1c},
+{"AED_DRC_RELEASE_COEF11      ",     0x1d},
+{"AED_DRC_RELEASE_COEF20      ",     0x1e},
+{"AED_DRC_RELEASE_COEF21      ",     0x1f},
+{"AED_DRC_RELEASE_COEF30      ",     0x20},
+{"AED_DRC_RELEASE_COEF31      ",     0x21},
+{"AED_DRC_RELEASE_COEF40      ",     0x22},
+{"AED_DRC_RELEASE_COEF41      ",     0x23},
+{"AED_DRC_RELEASE_COEF50      ",     0x24},
+{"AED_DRC_RELEASE_COEF51      ",     0x25},
+{"AED_DRC_ATTACK_COEF00       ",     0x26},
+{"AED_DRC_ATTACK_COEF01       ",     0x27},
+{"AED_DRC_ATTACK_COEF10       ",     0x28},
+{"AED_DRC_ATTACK_COEF11       ",     0x29},
+{"AED_DRC_ATTACK_COEF20       ",     0x2a},
+{"AED_DRC_ATTACK_COEF21       ",     0x2b},
+{"AED_DRC_ATTACK_COEF30       ",     0x2c},
+{"AED_DRC_ATTACK_COEF31       ",     0x2d},
+{"AED_DRC_ATTACK_COEF40       ",     0x2e},
+{"AED_DRC_ATTACK_COEF41       ",     0x2f},
+{"AED_DRC_ATTACK_COEF50       ",     0x30},
+{"AED_DRC_ATTACK_COEF51       ",     0x31},
+{"AED_DRC_LOOPBACK_CNTL       ",     0x32},
+{"AED_MDRC_CNTL               ",     0x33},
+{"AED_MDRC_RMS_COEF00         ",     0x34},
+{"AED_MDRC_RMS_COEF01         ",     0x35},
+{"AED_MDRC_RELEASE_COEF00     ",     0x36},
+{"AED_MDRC_RELEASE_COEF01     ",     0x37},
+{"AED_MDRC_ATTACK_COEF00      ",     0x38},
+{"AED_MDRC_ATTACK_COEF01      ",     0x39},
+{"AED_MDRC_THD0               ",     0x3a},
+{"AED_MDRC_K0                 ",     0x3b},
+{"AED_MDRC_LOW_GAIN           ",     0x3c},
+{"AED_MDRC_OFFSET0            ",     0x3d},
+{"AED_MDRC_RMS_COEF10         ",     0x3e},
+{"AED_MDRC_RMS_COEF11         ",     0x3f},
+{"AED_MDRC_RELEASE_COEF10     ",     0x40},
+{"AED_MDRC_RELEASE_COEF11     ",     0x41},
+{"AED_MDRC_ATTACK_COEF10      ",     0x42},
+{"AED_MDRC_ATTACK_COEF11      ",     0x43},
+{"AED_MDRC_THD1               ",     0x44},
+{"AED_MDRC_K1                 ",     0x45},
+{"AED_MDRC_OFFSET1            ",     0x46},
+{"AED_MDRC_MID_GAIN           ",     0x47},
+{"AED_MDRC_RMS_COEF20         ",     0x48},
+{"AED_MDRC_RMS_COEF21         ",     0x49},
+{"AED_MDRC_RELEASE_COEF20     ",     0x4a},
+{"AED_MDRC_RELEASE_COEF21     ",     0x4b},
+{"AED_MDRC_ATTACK_COEF20      ",     0x4c},
+{"AED_MDRC_ATTACK_COEF21      ",     0x4d},
+{"AED_MDRC_THD2               ",     0x4e},
+{"AED_MDRC_K2                 ",     0x4f},
+{"AED_MDRC_OFFSET2            ",     0x50},
+{"AED_MDRC_HIGH_GAIN          ",     0x51},
+{"AED_ED_CNTL                 ",     0x52},
+{"AED_DC_EN                   ",     0x53},
+{"AED_ND_LOW_THD              ",     0x54},
+{"AED_ND_HIGH_THD             ",     0x55},
+{"AED_ND_CNT_THD              ",     0x56},
+{"AED_ND_SUM_NUM              ",     0x57},
+{"AED_ND_CZ_NUM               ",     0x58},
+{"AED_ND_SUM_THD0             ",     0x59},
+{"AED_ND_SUM_THD1             ",     0x5a},
+{"AED_ND_CZ_THD0              ",     0x5b},
+{"AED_ND_CZ_THD1              ",     0x5c},
+{"AED_ND_COND_CNTL            ",     0x5d},
+{"AED_ND_RELEASE_COEF0        ",     0x5e},
+{"AED_ND_RELEASE_COEF1        ",     0x5f},
+{"AED_ND_ATTACK_COEF0         ",     0x60},
+{"AED_ND_ATTACK_COEF1         ",     0x61},
+{"AED_ND_CNTL                 ",     0x62},
+{"AED_MIX0_LL                 ",     0x63},
+{"AED_MIX0_RL                 ",     0x64},
+{"AED_MIX0_LR                 ",     0x65},
+{"AED_MIX0_RR                 ",     0x66},
+{"AED_CLIP_THD                ",     0x67},
+{"AED_CH1_ND_SUM_OUT          ",     0x68},
+{"AED_CH2_ND_SUM_OUT          ",     0x69},
+{"AED_CH1_ND_CZ_OUT           ",     0x6a},
+{"AED_CH2_ND_CZ_OUT           ",     0x6b},
+{"AED_NOISE_STATUS            ",     0x6c},
+{"AED_POW_CURRENT_S0          ",     0x6d},
+{"AED_POW_CURRENT_S1          ",     0x6e},
+{"AED_POW_CURRENT_S2          ",     0x6f},
+{"AED_POW_OUT0                ",     0x70},
+{"AED_POW_OUT1                ",     0x71},
+{"AED_POW_OUT2                ",     0x72},
+{"AED_POW_ADJ_INDEX0          ",     0x73},
+{"AED_POW_ADJ_INDEX1          ",     0x74},
+{"AED_POW_ADJ_INDEX2          ",     0x75},
+{"AED_DRC_GAIN_INDEX0         ",     0x76},
+{"AED_DRC_GAIN_INDEX1         ",     0x77},
+{"AED_DRC_GAIN_INDEX2         ",     0x78},
+{"AED_CH1_VOLUME_STATE        ",     0x79},
+{"AED_CH2_VOLUME_STATE        ",     0x7a},
+{"AED_CH1_VOLUME_GAIN         ",     0x7b},
+{"AED_CH2_VOLUME_GAIN         ",     0x7c},
+{"AED_FULL_POW_CURRENT        ",     0x7d},
+{"AED_FULL_POW_OUT            ",     0x7e},
+{"AED_FULL_POW_ADJ            ",     0x7f},
+{"AED_FULL_DRC_GAIN           ",     0x80},
+{"AED_MASTER_VOLUME_STATE     ",     0x81},
+{"AED_MASTER_VOLUME_GAIN      ",     0x82},
+{"AED_TOP_CTL                 ",     0x83},
+{"AED_TOP_REQ_CTL             ",     0x84},
+};
+
+#endif
index e02f2a5..4aa82c3 100644 (file)
@@ -40,6 +40,10 @@ static const struct of_device_id audio_clocks_of_match[] = {
                .compatible = "amlogic, sm1-audio-clocks",
                .data           = &sm1_audio_clks_init,
        },
+       {
+               .compatible = "amlogic, tm2-audio-clocks",
+               .data           = &tm2_audio_clks_init,
+       },
        {},
 };
 MODULE_DEVICE_TABLE(of, audio_clocks_of_match);
index 56a0a67..ede4ec9 100644 (file)
@@ -94,6 +94,7 @@ extern struct audio_clk_init axg_audio_clks_init;
 extern struct audio_clk_init g12a_audio_clks_init;
 extern struct audio_clk_init tl1_audio_clks_init;
 extern struct audio_clk_init sm1_audio_clks_init;
+extern struct audio_clk_init tm2_audio_clks_init;
 
 struct clk_chipinfo {
        /* force clock source as oscin(24M) */
index 1b50eac..9a175aa 100644 (file)
@@ -15,6 +15,9 @@
  *
  */
 
+
+/*#define DEBUG*/
+
 #include <linux/device.h>
 #include <linux/module.h>
 #include <linux/moduleparam.h>
@@ -28,6 +31,8 @@
 
 #include "audio_io.h"
 #include "regs.h"
+#include "audio_aed_reg_list.h"
+#include "audio_top_reg_list.h"
 
 #define DRV_NAME "aml-audio-controller"
 
@@ -46,7 +51,10 @@ static int aml_audio_mmio_write(struct aml_audio_controller *actrlr,
                        unsigned int reg, unsigned int value)
 {
        struct regmap *regmap = actrlr->regmap;
-
+       pr_debug("audio top reg:[%s] addr: [%#x] val: [%#x]\n",
+                       top_register_table[reg].name,
+                       top_register_table[reg].addr,
+                       value);
        return regmap_write(regmap, (reg << 2), value);
 }
 
@@ -54,7 +62,10 @@ static int aml_audio_mmio_update_bits(struct aml_audio_controller *actrlr,
                        unsigned int reg, unsigned int mask, unsigned int value)
 {
        struct regmap *regmap = actrlr->regmap;
-
+       pr_debug("audio top reg:[%s] addr: [%#x] mask: [%#x] val: [%#x]\n",
+                       top_register_table[reg].name,
+                       top_register_table[reg].addr,
+                       mask, value);
        return regmap_update_bits(regmap, (reg << 2), mask, value);
 }
 
@@ -104,6 +115,7 @@ static int register_audio_controller(struct platform_device *pdev,
 
        /* gate on all clks on bringup stage, need gate separately */
        aml_audiobus_write(actrl, EE_AUDIO_CLK_GATE_EN0, 0xffffffff);
+       aml_audiobus_write(actrl, EE_AUDIO_CLK_GATE_EN1, 0xffffffff);
 
        return 0;
 }
diff --git a/sound/soc/amlogic/auge/audio_top_reg_list.h b/sound/soc/amlogic/auge/audio_top_reg_list.h
new file mode 100644 (file)
index 0000000..916f747
--- /dev/null
@@ -0,0 +1,599 @@
+/*
+ * sound/soc/amlogic/auge/audio_top_reg_list.h
+ *
+ * Copyright (C) 2017 Amlogic, Inc. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ *
+ */
+
+#ifndef __AML_AUDIO_TOP_REG_H_
+#define __AML_AUDIO_TOP_REG_H_
+
+#include "regs.h"
+
+static const struct register_table top_register_table[] = {
+{"AUDIO_CLK_GATE_EN0        ",  0x00},
+{"AUDIO_CLK_GATE_EN1        ",  0x01},
+{"AUDIO_MCLK_A_CTRL         ",  0x02},
+{"AUDIO_MCLK_B_CTRL         ",  0x03},
+{"AUDIO_MCLK_C_CTRL         ",  0x04},
+{"AUDIO_MCLK_D_CTRL         ",  0x05},
+{"AUDIO_MCLK_E_CTRL         ",  0x06},
+{"AUDIO_MCLK_F_CTRL         ",  0x07},
+{"AUDIO_PAD_CTRL0           ",  0x08},
+{"AUDIO_PAD_CTRL1           ",  0x09},
+{"AUDIO_SW_RESET0           ",  0x0a},
+{"AUDIO_SW_RESET1           ",  0x0b},
+{"AUDIO_CLK81_CTRL          ",  0x0c},
+{"AUDIO_CLK81_EN            ",  0x0d},
+{"AUDIO_RESV_ADDR_0xe       ",  0x0e},
+{"AUDIO_RESV_ADDR_0xf       ",  0x0f},
+{"AUDIO_MST_A_SCLK_CTRL0    ",  0x10},
+{"AUDIO_MST_A_SCLK_CTRL1    ",  0x11},
+{"AUDIO_MST_B_SCLK_CTRL0    ",  0x12},
+{"AUDIO_MST_B_SCLK_CTRL1    ",  0x13},
+{"AUDIO_MST_C_SCLK_CTRL0    ",  0x14},
+{"AUDIO_MST_C_SCLK_CTRL1    ",  0x15},
+{"AUDIO_MST_D_SCLK_CTRL0    ",  0x16},
+{"AUDIO_MST_D_SCLK_CTRL1    ",  0x17},
+{"AUDIO_MST_E_SCLK_CTRL0    ",  0x18},
+{"AUDIO_MST_E_SCLK_CTRL1    ",  0x19},
+{"AUDIO_MST_F_SCLK_CTRL0    ",  0x1a},
+{"AUDIO_MST_F_SCLK_CTRL1    ",  0x1b},
+{"AUDIO_RESV_ADDR_0x1c      ",  0x1c},
+{"AUDIO_RESV_ADDR_0x1d      ",  0x1d},
+{"AUDIO_RESV_ADDR_0x1e      ",  0x1e},
+{"AUDIO_RESV_ADDR_0x1f      ",  0x1f},
+{"AUDIO_CLK_TDMIN_A_CTRL    ",  0x20},
+{"AUDIO_CLK_TDMIN_B_CTRL    ",  0x21},
+{"AUDIO_CLK_TDMIN_C_CTRL    ",  0x22},
+{"AUDIO_CLK_TDMIN_LB_CTRL   ",  0x23},
+{"AUDIO_CLK_TDMOUT_A_CTRL   ",  0x24},
+{"AUDIO_CLK_TDMOUT_B_CTRL   ",  0x25},
+{"AUDIO_CLK_TDMOUT_C_CTRL   ",  0x26},
+{"AUDIO_CLK_SPDIFIN_CTRL    ",  0x27},
+{"AUDIO_CLK_SPDIFOUT_CTRL   ",  0x28},
+{"AUDIO_CLK_RESAMPLEA_CTRL  ",  0x29},
+{"AUDIO_CLK_LOCKER_CTRL     ",  0x2a},
+{"AUDIO_CLK_PDMIN_CTRL0     ",  0x2b},
+{"AUDIO_CLK_PDMIN_CTRL1     ",  0x2c},
+{"AUDIO_CLK_SPDIFOUT_B_CTRL ",  0x2d},
+{"AUDIO_CLK_RESAMPLEB_CTRL  ",  0x2e},
+{"AUDIO_CLK_SPDIFIN_LB_CTRL ",  0x2f},
+{"AUDIO_CLK_EQDRC_CTRL0     ",  0x30},
+{"AUDIO_VAD_CLK_CTRL        ",  0x31},
+{"AUDIO_RESV_ADDR_0x32      ",  0x32},
+{"AUDIO_RESV_ADDR_0x33      ",  0x33},
+{"AUDIO_RESV_ADDR_0x34      ",  0x34},
+{"AUDIO_RESV_ADDR_0x35      ",  0x35},
+{"AUDIO_RESV_ADDR_0x36      ",  0x36},
+{"AUDIO_RESV_ADDR_0x37      ",  0x37},
+{"AUDIO_RESV_ADDR_0x38      ",  0x38},
+{"AUDIO_RESV_ADDR_0x39      ",  0x39},
+{"AUDIO_RESV_ADDR_0x3a      ",  0x3a},
+{"AUDIO_RESV_ADDR_0x3b      ",  0x3b},
+{"AUDIO_RESV_ADDR_0x3c      ",  0x3c},
+{"AUDIO_RESV_ADDR_0x3d      ",  0x3d},
+{"AUDIO_RESV_ADDR_0x3e      ",  0x3e},
+{"AUDIO_RESV_ADDR_0x3f      ",  0x3f},
+{"AUDIO_TODDR_A_CTRL0       ",  0x40},
+{"AUDIO_TODDR_A_CTRL1       ",  0x41},
+{"AUDIO_TODDR_A_START_ADDR  ",  0x42},
+{"AUDIO_TODDR_A_FINISH_ADDR ",  0x43},
+{"AUDIO_TODDR_A_INT_ADDR    ",  0x44},
+{"AUDIO_TODDR_A_STATUS1     ",  0x45},
+{"AUDIO_TODDR_A_STATUS2     ",  0x46},
+{"AUDIO_TODDR_A_START_ADDRB ",  0x47},
+{"AUDIO_TODDR_A_FINISH_ADDRB",  0x48},
+{"AUDIO_TODDR_A_INIT_ADDR   ",  0x49},
+{"AUDIO_TODDR_A_CTRL2       ",  0x4a},
+{"AUDIO_RESV_ADDR_0x4b      ",  0x4b},
+{"AUDIO_RESV_ADDR_0x4c      ",  0x4c},
+{"AUDIO_RESV_ADDR_0x4d      ",  0x4d},
+{"AUDIO_RESV_ADDR_0x4e      ",  0x4e},
+{"AUDIO_RESV_ADDR_0x4f      ",  0x4f},
+{"AUDIO_TODDR_B_CTRL0       ",  0x50},
+{"AUDIO_TODDR_B_CTRL1       ",  0x51},
+{"AUDIO_TODDR_B_START_ADDR  ",  0x52},
+{"AUDIO_TODDR_B_FINISH_ADDR ",  0x53},
+{"AUDIO_TODDR_B_INT_ADDR    ",  0x54},
+{"AUDIO_TODDR_B_STATUS1     ",  0x55},
+{"AUDIO_TODDR_B_STATUS2     ",  0x56},
+{"AUDIO_TODDR_B_START_ADDRB ",  0x57},
+{"AUDIO_TODDR_B_FINISH_ADDRB",  0x58},
+{"AUDIO_TODDR_B_INIT_ADDR   ",  0x59},
+{"AUDIO_TODDR_B_CTRL2       ",  0x5a},
+{"AUDIO_RESV_ADDR_0x5b      ",  0x5b},
+{"AUDIO_RESV_ADDR_0x5c      ",  0x5c},
+{"AUDIO_RESV_ADDR_0x5d      ",  0x5d},
+{"AUDIO_RESV_ADDR_0x5e      ",  0x5e},
+{"AUDIO_RESV_ADDR_0x5f      ",  0x5f},
+{"AUDIO_TODDR_C_CTRL0       ",  0x60},
+{"AUDIO_TODDR_C_CTRL1       ",  0x61},
+{"AUDIO_TODDR_C_START_ADDR  ",  0x62},
+{"AUDIO_TODDR_C_FINISH_ADDR ",  0x63},
+{"AUDIO_TODDR_C_INT_ADDR    ",  0x64},
+{"AUDIO_TODDR_C_STATUS1     ",  0x65},
+{"AUDIO_TODDR_C_STATUS2     ",  0x66},
+{"AUDIO_TODDR_C_START_ADDRB ",  0x67},
+{"AUDIO_TODDR_C_FINISH_ADDRB",  0x68},
+{"AUDIO_TODDR_C_INIT_ADDR   ",  0x69},
+{"AUDIO_TODDR_C_CTRL2       ",  0x6a},
+{"AUDIO_RESV_ADDR_0x6b      ",  0x6b},
+{"AUDIO_RESV_ADDR_0x6c      ",  0x6c},
+{"AUDIO_RESV_ADDR_0x6d      ",  0x6d},
+{"AUDIO_RESV_ADDR_0x6e      ",  0x6e},
+{"AUDIO_RESV_ADDR_0x6f      ",  0x6f},
+{"AUDIO_FRDDR_A_CTRL0       ",  0x70},
+{"AUDIO_FRDDR_A_CTRL1       ",  0x71},
+{"AUDIO_FRDDR_A_START_ADDR  ",  0x72},
+{"AUDIO_FRDDR_A_FINISH_ADDR ",  0x73},
+{"AUDIO_FRDDR_A_INT_ADDR    ",  0x74},
+{"AUDIO_FRDDR_A_STATUS1     ",  0x75},
+{"AUDIO_FRDDR_A_STATUS2     ",  0x76},
+{"AUDIO_FRDDR_A_START_ADDRB ",  0x77},
+{"AUDIO_FRDDR_A_FINISH_ADDRB",  0x78},
+{"AUDIO_FRDDR_A_INIT_ADDR   ",  0x79},
+{"AUDIO_FRDDR_A_CTRL2       ",  0x7a},
+{"AUDIO_RESV_ADDR_0x7b      ",  0x7b},
+{"AUDIO_RESV_ADDR_0x7c      ",  0x7c},
+{"AUDIO_RESV_ADDR_0x7d      ",  0x7d},
+{"AUDIO_RESV_ADDR_0x7e      ",  0x7e},
+{"AUDIO_RESV_ADDR_0x7f      ",  0x7f},
+{"AUDIO_FRDDR_B_CTRL0       ",  0x80},
+{"AUDIO_FRDDR_B_CTRL1       ",  0x81},
+{"AUDIO_FRDDR_B_START_ADDR  ",  0x82},
+{"AUDIO_FRDDR_B_FINISH_ADDR ",  0x83},
+{"AUDIO_FRDDR_B_INT_ADDR    ",  0x84},
+{"AUDIO_FRDDR_B_STATUS1     ",  0x85},
+{"AUDIO_FRDDR_B_STATUS2     ",  0x86},
+{"AUDIO_FRDDR_B_START_ADDRB ",  0x87},
+{"AUDIO_FRDDR_B_FINISH_ADDRB",  0x88},
+{"AUDIO_FRDDR_B_INIT_ADDR   ",  0x89},
+{"AUDIO_FRDDR_B_CTRL2       ",  0x8a},
+{"AUDIO_RESV_ADDR_0x8b      ",  0x8b},
+{"AUDIO_RESV_ADDR_0x8c      ",  0x8c},
+{"AUDIO_RESV_ADDR_0x8d      ",  0x8d},
+{"AUDIO_RESV_ADDR_0x8e      ",  0x8e},
+{"AUDIO_RESV_ADDR_0x8f      ",  0x8f},
+{"AUDIO_FRDDR_C_CTRL0       ",  0x90},
+{"AUDIO_FRDDR_C_CTRL1       ",  0x91},
+{"AUDIO_FRDDR_C_START_ADDR  ",  0x92},
+{"AUDIO_FRDDR_C_FINISH_ADDR ",  0x93},
+{"AUDIO_FRDDR_C_INT_ADDR    ",  0x94},
+{"AUDIO_FRDDR_C_STATUS1     ",  0x95},
+{"AUDIO_FRDDR_C_STATUS2     ",  0x96},
+{"AUDIO_FRDDR_C_START_ADDRB ",  0x97},
+{"AUDIO_FRDDR_C_FINISH_ADDRB",  0x98},
+{"AUDIO_FRDDR_C_INIT_ADDR   ",  0x99},
+{"AUDIO_FRDDR_C_CTRL2       ",  0x9a},
+{"AUDIO_RESV_ADDR_0x9b      ",  0x9b},
+{"AUDIO_RESV_ADDR_0x9c      ",  0x9c},
+{"AUDIO_RESV_ADDR_0x9d      ",  0x9d},
+{"AUDIO_RESV_ADDR_0x9e      ",  0x9e},
+{"AUDIO_RESV_ADDR_0x9f      ",  0x9f},
+{"AUDIO_ARB_CTRL            ",  0xa0},
+{"AUDIO_RESV_ADDR_0xa1      ",  0xa1},
+{"AUDIO_RESV_ADDR_0xa2      ",  0xa2},
+{"AUDIO_RESV_ADDR_0xa3      ",  0xa3},
+{"AUDIO_RESV_ADDR_0xa4      ",  0xa4},
+{"AUDIO_RESV_ADDR_0xa5      ",  0xa5},
+{"AUDIO_RESV_ADDR_0xa6      ",  0xa6},
+{"AUDIO_RESV_ADDR_0xa7      ",  0xa7},
+{"AUDIO_RESV_ADDR_0xa8      ",  0xa8},
+{"AUDIO_RESV_ADDR_0xa9      ",  0xa9},
+{"AUDIO_RESV_ADDR_0xaa      ",  0xaa},
+{"AUDIO_RESV_ADDR_0xab      ",  0xab},
+{"AUDIO_RESV_ADDR_0xac      ",  0xac},
+{"AUDIO_RESV_ADDR_0xad      ",  0xad},
+{"AUDIO_RESV_ADDR_0xae      ",  0xae},
+{"AUDIO_RESV_ADDR_0xaf      ",  0xaf},
+{"AUDIO_LB_A_CTRL0          ",  0xb0},
+{"AUDIO_LB_A_CTRL1          ",  0xb1},
+{"AUDIO_LB_A_CTRL2          ",  0xb2},
+{"AUDIO_LB_A_CTRL3          ",  0xb3},
+{"AUDIO_LB_A_DAT_CH_ID0     ",  0xb4},
+{"AUDIO_LB_A_DAT_CH_ID1     ",  0xb5},
+{"AUDIO_LB_A_DAT_CH_ID2     ",  0xb6},
+{"AUDIO_LB_A_DAT_CH_ID3     ",  0xb7},
+{"AUDIO_LB_A_LB_CH_ID0      ",  0xb8},
+{"AUDIO_LB_A_LB_CH_ID1      ",  0xb9},
+{"AUDIO_LB_A_LB_CH_ID2      ",  0xba},
+{"AUDIO_LB_A_LB_CH_ID3      ",  0xbb},
+{"AUDIO_LB_A_STS            ",  0xbc},
+{"AUDIO_RESV_ADDR_0xbd      ",  0xbd},
+{"AUDIO_RESV_ADDR_0xbe      ",  0xbe},
+{"AUDIO_RESV_ADDR_0xbf      ",  0xbf},
+{"AUDIO_TDMIN_A_CTRL        ",  0xc0},
+{"AUDIO_TDMIN_A_SWAP        ",  0xc1},
+{"AUDIO_TDMIN_A_MASK0       ",  0xc2},
+{"AUDIO_TDMIN_A_MASK1       ",  0xc3},
+{"AUDIO_TDMIN_A_MASK2       ",  0xc4},
+{"AUDIO_TDMIN_A_MASK3       ",  0xc5},
+{"AUDIO_TDMIN_A_STAT        ",  0xc6},
+{"AUDIO_TDMIN_A_MUTE_VAL    ",  0xc7},
+{"AUDIO_TDMIN_A_MUTE0       ",  0xc8},
+{"AUDIO_TDMIN_A_MUTE1       ",  0xc9},
+{"AUDIO_TDMIN_A_MUTE2       ",  0xca},
+{"AUDIO_TDMIN_A_MUTE3       ",  0xcb},
+{"AUDIO_RESV_ADDR_0xcc      ",  0xcc},
+{"AUDIO_RESV_ADDR_0xcd      ",  0xcd},
+{"AUDIO_RESV_ADDR_0xce      ",  0xce},
+{"AUDIO_RESV_ADDR_0xcf      ",  0xcf},
+{"AUDIO_TDMIN_B_CTRL        ",  0xd0},
+{"AUDIO_TDMIN_B_SWAP        ",  0xd1},
+{"AUDIO_TDMIN_B_MASK0       ",  0xd2},
+{"AUDIO_TDMIN_B_MASK1       ",  0xd3},
+{"AUDIO_TDMIN_B_MASK2       ",  0xd4},
+{"AUDIO_TDMIN_B_MASK3       ",  0xd5},
+{"AUDIO_TDMIN_B_STAT        ",  0xd6},
+{"AUDIO_TDMIN_B_MUTE_VAL    ",  0xd7},
+{"AUDIO_TDMIN_B_MUTE0       ",  0xd8},
+{"AUDIO_TDMIN_B_MUTE1       ",  0xd9},
+{"AUDIO_TDMIN_B_MUTE2       ",  0xda},
+{"AUDIO_TDMIN_B_MUTE3       ",  0xdb},
+{"AUDIO_RESV_ADDR_0xdc      ",  0xdc},
+{"AUDIO_RESV_ADDR_0xdd      ",  0xdd},
+{"AUDIO_RESV_ADDR_0xde      ",  0xde},
+{"AUDIO_RESV_ADDR_0xdf      ",  0xdf},
+{"AUDIO_TDMIN_C_CTRL        ",  0xe0},
+{"AUDIO_TDMIN_C_SWAP        ",  0xe1},
+{"AUDIO_TDMIN_C_MASK0       ",  0xe2},
+{"AUDIO_TDMIN_C_MASK1       ",  0xe3},
+{"AUDIO_TDMIN_C_MASK2       ",  0xe4},
+{"AUDIO_TDMIN_C_MASK3       ",  0xe5},
+{"AUDIO_TDMIN_C_STAT        ",  0xe6},
+{"AUDIO_TDMIN_C_MUTE_VAL    ",  0xe7},
+{"AUDIO_TDMIN_C_MUTE0       ",  0xe8},
+{"AUDIO_TDMIN_C_MUTE1       ",  0xe9},
+{"AUDIO_TDMIN_C_MUTE2       ",  0xea},
+{"AUDIO_TDMIN_C_MUTE3       ",  0xeb},
+{"AUDIO_RESV_ADDR_0xec      ",  0xec},
+{"AUDIO_RESV_ADDR_0xed      ",  0xed},
+{"AUDIO_RESV_ADDR_0xee      ",  0xee},
+{"AUDIO_RESV_ADDR_0xef      ",  0xef},
+{"AUDIO_TDMIN_LB_CTRL       ",  0xf0},
+{"AUDIO_TDMIN_LB_SWAP       ",  0xf1},
+{"AUDIO_TDMIN_LB_MASK0      ",  0xf2},
+{"AUDIO_TDMIN_LB_MASK1      ",  0xf3},
+{"AUDIO_TDMIN_LB_MASK2      ",  0xf4},
+{"AUDIO_TDMIN_LB_MASK3      ",  0xf5},
+{"AUDIO_TDMIN_LB_STAT       ",  0xf6},
+{"AUDIO_TDMIN_LB_MUTE_VAL   ",  0xf7},
+{"AUDIO_TDMIN_LB_MUTE0      ",  0xf8},
+{"AUDIO_TDMIN_LB_MUTE1      ",  0xf9},
+{"AUDIO_TDMIN_LB_MUTE2      ",  0xfa},
+{"AUDIO_TDMIN_LB_MUTE3      ",  0xfb},
+{"AUDIO_RESV_ADDR_0xfc      ",  0xfc},
+{"AUDIO_RESV_ADDR_0xfd      ",  0xfd},
+{"AUDIO_RESV_ADDR_0xfe      ",  0xfe},
+{"AUDIO_RESV_ADDR_0xff      ",  0xff},
+{"AUDIO_SPDIFIN_CTRL0       ", 0x100},
+{"AUDIO_SPDIFIN_CTRL1       ", 0x101},
+{"AUDIO_SPDIFIN_CTRL2       ", 0x102},
+{"AUDIO_SPDIFIN_CTRL3       ", 0x103},
+{"AUDIO_SPDIFIN_CTRL4       ", 0x104},
+{"AUDIO_SPDIFIN_CTRL5       ", 0x105},
+{"AUDIO_SPDIFIN_CTRL6       ", 0x106},
+{"AUDIO_SPDIFIN_STAT0       ", 0x107},
+{"AUDIO_SPDIFIN_STAT1       ", 0x108},
+{"AUDIO_SPDIFIN_STAT2       ", 0x109},
+{"AUDIO_SPDIFIN_MUTE_VAL    ", 0x10a},
+{"AUDIO_RESV_ADDR_0x10b     ", 0x10b},
+{"AUDIO_RESV_ADDR_0x10c     ", 0x10c},
+{"AUDIO_RESV_ADDR_0x10d     ", 0x10d},
+{"AUDIO_RESV_ADDR_0x10e     ", 0x10e},
+{"AUDIO_RESV_ADDR_0x10f     ", 0x10f},
+{"AUDIO_RESAMPLEA_CTRL0     ", 0x110},
+{"AUDIO_RESAMPLEA_CTRL1     ", 0x111},
+{"AUDIO_RESAMPLEA_CTRL2     ", 0x112},
+{"AUDIO_RESAMPLEA_CTRL3     ", 0x113},
+{"AUDIO_RESAMPLEA_COEF0     ", 0x114},
+{"AUDIO_RESAMPLEA_COEF1     ", 0x115},
+{"AUDIO_RESAMPLEA_COEF2     ", 0x116},
+{"AUDIO_RESAMPLEA_COEF3     ", 0x117},
+{"AUDIO_RESAMPLEA_COEF4     ", 0x118},
+{"AUDIO_RESAMPLEA_STATUS1   ", 0x119},
+{"AUDIO_RESV_ADDR_0x11a     ", 0x11a},
+{"AUDIO_RESV_ADDR_0x11b     ", 0x11b},
+{"AUDIO_RESV_ADDR_0x11c     ", 0x11c},
+{"AUDIO_RESV_ADDR_0x11d     ", 0x11d},
+{"AUDIO_RESV_ADDR_0x11e     ", 0x11e},
+{"AUDIO_RESV_ADDR_0x11f     ", 0x11f},
+{"AUDIO_SPDIFOUT_STAT       ", 0x120},
+{"AUDIO_SPDIFOUT_GAIN0      ", 0x121},
+{"AUDIO_SPDIFOUT_GAIN1      ", 0x122},
+{"AUDIO_SPDIFOUT_CTRL0      ", 0x123},
+{"AUDIO_SPDIFOUT_CTRL1      ", 0x124},
+{"AUDIO_SPDIFOUT_PREAMB     ", 0x125},
+{"AUDIO_SPDIFOUT_SWAP       ", 0x126},
+{"AUDIO_SPDIFOUT_CHSTS0     ", 0x127},
+{"AUDIO_SPDIFOUT_CHSTS1     ", 0x128},
+{"AUDIO_SPDIFOUT_CHSTS2     ", 0x129},
+{"AUDIO_SPDIFOUT_CHSTS3     ", 0x12a},
+{"AUDIO_SPDIFOUT_CHSTS4     ", 0x12b},
+{"AUDIO_SPDIFOUT_CHSTS5     ", 0x12c},
+{"AUDIO_SPDIFOUT_CHSTS6     ", 0x12d},
+{"AUDIO_SPDIFOUT_CHSTS7     ", 0x12e},
+{"AUDIO_SPDIFOUT_CHSTS8     ", 0x12f},
+{"AUDIO_SPDIFOUT_CHSTS9     ", 0x130},
+{"AUDIO_SPDIFOUT_CHSTSA     ", 0x131},
+{"AUDIO_SPDIFOUT_CHSTSB     ", 0x132},
+{"AUDIO_SPDIFOUT_MUTE_VAL   ", 0x133},
+{"AUDIO_RESV_ADDR_0x134     ", 0x134},
+{"AUDIO_RESV_ADDR_0x135     ", 0x135},
+{"AUDIO_RESV_ADDR_0x136     ", 0x136},
+{"AUDIO_RESV_ADDR_0x137     ", 0x137},
+{"AUDIO_RESV_ADDR_0x138     ", 0x138},
+{"AUDIO_RESV_ADDR_0x139     ", 0x139},
+{"AUDIO_RESV_ADDR_0x13a     ", 0x13a},
+{"AUDIO_RESV_ADDR_0x13b     ", 0x13b},
+{"AUDIO_RESV_ADDR_0x13c     ", 0x13c},
+{"AUDIO_RESV_ADDR_0x13d     ", 0x13d},
+{"AUDIO_RESV_ADDR_0x13e     ", 0x13e},
+{"AUDIO_RESV_ADDR_0x13f     ", 0x13f},
+{"AUDIO_TDMOUT_A_CTRL0      ", 0x140},
+{"AUDIO_TDMOUT_A_CTRL1      ", 0x141},
+{"AUDIO_TDMOUT_A_SWAP       ", 0x142},
+{"AUDIO_TDMOUT_A_MASK0      ", 0x143},
+{"AUDIO_TDMOUT_A_MASK1      ", 0x144},
+{"AUDIO_TDMOUT_A_MASK2      ", 0x145},
+{"AUDIO_TDMOUT_A_MASK3      ", 0x146},
+{"AUDIO_TDMOUT_A_STAT       ", 0x147},
+{"AUDIO_TDMOUT_A_GAIN0      ", 0x148},
+{"AUDIO_TDMOUT_A_GAIN1      ", 0x149},
+{"AUDIO_TDMOUT_A_MUTE_VAL   ", 0x14a},
+{"AUDIO_TDMOUT_A_MUTE0      ", 0x14b},
+{"AUDIO_TDMOUT_A_MUTE1      ", 0x14c},
+{"AUDIO_TDMOUT_A_MUTE2      ", 0x14d},
+{"AUDIO_TDMOUT_A_MUTE3      ", 0x14e},
+{"AUDIO_TDMOUT_A_MASK_VAL   ", 0x14f},
+{"AUDIO_TDMOUT_B_CTRL0      ", 0x150},
+{"AUDIO_TDMOUT_B_CTRL1      ", 0x151},
+{"AUDIO_TDMOUT_B_SWAP       ", 0x152},
+{"AUDIO_TDMOUT_B_MASK0      ", 0x153},
+{"AUDIO_TDMOUT_B_MASK1      ", 0x154},
+{"AUDIO_TDMOUT_B_MASK2      ", 0x155},
+{"AUDIO_TDMOUT_B_MASK3      ", 0x156},
+{"AUDIO_TDMOUT_B_STAT       ", 0x157},
+{"AUDIO_TDMOUT_B_GAIN0      ", 0x158},
+{"AUDIO_TDMOUT_B_GAIN1      ", 0x159},
+{"AUDIO_TDMOUT_B_MUTE_VAL   ", 0x15a},
+{"AUDIO_TDMOUT_B_MUTE0      ", 0x15b},
+{"AUDIO_TDMOUT_B_MUTE1      ", 0x15c},
+{"AUDIO_TDMOUT_B_MUTE2      ", 0x15d},
+{"AUDIO_TDMOUT_B_MUTE3      ", 0x15e},
+{"AUDIO_TDMOUT_B_MASK_VAL   ", 0x15f},
+{"AUDIO_TDMOUT_C_CTRL0      ", 0x160},
+{"AUDIO_TDMOUT_C_CTRL1      ", 0x161},
+{"AUDIO_TDMOUT_C_SWAP       ", 0x162},
+{"AUDIO_TDMOUT_C_MASK0      ", 0x163},
+{"AUDIO_TDMOUT_C_MASK1      ", 0x164},
+{"AUDIO_TDMOUT_C_MASK2      ", 0x165},
+{"AUDIO_TDMOUT_C_MASK3      ", 0x166},
+{"AUDIO_TDMOUT_C_STAT       ", 0x167},
+{"AUDIO_TDMOUT_C_GAIN0      ", 0x168},
+{"AUDIO_TDMOUT_C_GAIN1      ", 0x169},
+{"AUDIO_TDMOUT_C_MUTE_VAL   ", 0x16a},
+{"AUDIO_TDMOUT_C_MUTE0      ", 0x16b},
+{"AUDIO_TDMOUT_C_MUTE1      ", 0x16c},
+{"AUDIO_TDMOUT_C_MUTE2      ", 0x16d},
+{"AUDIO_TDMOUT_C_MUTE3      ", 0x16e},
+{"AUDIO_TDMOUT_C_MASK_VAL   ", 0x16f},
+{"AUDIO_RESV_ADDR_0x170     ", 0x170},
+{"AUDIO_RESV_ADDR_0x171     ", 0x171},
+{"AUDIO_RESV_ADDR_0x172     ", 0x172},
+{"AUDIO_RESV_ADDR_0x173     ", 0x173},
+{"AUDIO_RESV_ADDR_0x174     ", 0x174},
+{"AUDIO_RESV_ADDR_0x175     ", 0x175},
+{"AUDIO_RESV_ADDR_0x176     ", 0x176},
+{"AUDIO_RESV_ADDR_0x177     ", 0x177},
+{"AUDIO_RESV_ADDR_0x178     ", 0x178},
+{"AUDIO_RESV_ADDR_0x179     ", 0x179},
+{"AUDIO_RESV_ADDR_0x17a     ", 0x17a},
+{"AUDIO_RESV_ADDR_0x17b     ", 0x17b},
+{"AUDIO_RESV_ADDR_0x17c     ", 0x17c},
+{"AUDIO_RESV_ADDR_0x17d     ", 0x17d},
+{"AUDIO_RESV_ADDR_0x17e     ", 0x17e},
+{"AUDIO_RESV_ADDR_0x17f     ", 0x17f},
+{"AUDIO_RESV_ADDR_0x180     ", 0x180},
+{"AUDIO_RESV_ADDR_0x181     ", 0x181},
+{"AUDIO_RESV_ADDR_0x182     ", 0x182},
+{"AUDIO_RESV_ADDR_0x183     ", 0x183},
+{"AUDIO_RESV_ADDR_0x184     ", 0x184},
+{"AUDIO_RESV_ADDR_0x185     ", 0x185},
+{"AUDIO_RESV_ADDR_0x186     ", 0x186},
+{"AUDIO_RESV_ADDR_0x187     ", 0x187},
+{"AUDIO_RESV_ADDR_0x188     ", 0x188},
+{"AUDIO_RESV_ADDR_0x189     ", 0x189},
+{"AUDIO_RESV_ADDR_0x18a     ", 0x18a},
+{"AUDIO_RESV_ADDR_0x18b     ", 0x18b},
+{"AUDIO_RESV_ADDR_0x18c     ", 0x18c},
+{"AUDIO_RESV_ADDR_0x18d     ", 0x18d},
+{"AUDIO_RESV_ADDR_0x18e     ", 0x18e},
+{"AUDIO_RESV_ADDR_0x18f     ", 0x18f},
+{"AUDIO_SECURITY_CTRL0      ", 0x190},
+{"AUDIO_SECURITY_CTRL1      ", 0x191},
+{"AUDIO_RESV_ADDR_0x192     ", 0x192},
+{"AUDIO_RESV_ADDR_0x193     ", 0x193},
+{"AUDIO_RESV_ADDR_0x194     ", 0x194},
+{"AUDIO_RESV_ADDR_0x195     ", 0x195},
+{"AUDIO_RESV_ADDR_0x196     ", 0x196},
+{"AUDIO_RESV_ADDR_0x197     ", 0x197},
+{"AUDIO_RESV_ADDR_0x198     ", 0x198},
+{"AUDIO_RESV_ADDR_0x199     ", 0x199},
+{"AUDIO_RESV_ADDR_0x19a     ", 0x19a},
+{"AUDIO_RESV_ADDR_0x19b     ", 0x19b},
+{"AUDIO_RESV_ADDR_0x19c     ", 0x19c},
+{"AUDIO_RESV_ADDR_0x19d     ", 0x19d},
+{"AUDIO_RESV_ADDR_0x19e     ", 0x19e},
+{"AUDIO_RESV_ADDR_0x19f     ", 0x19f},
+{"AUDIO_SPDIFOUT_B_STAT     ", 0x1a0},
+{"AUDIO_SPDIFOUT_B_GAIN0    ", 0x1a1},
+{"AUDIO_SPDIFOUT_B_GAIN1    ", 0x1a2},
+{"AUDIO_SPDIFOUT_B_CTRL0    ", 0x1a3},
+{"AUDIO_SPDIFOUT_B_CTRL1    ", 0x1a4},
+{"AUDIO_SPDIFOUT_B_PREAMB   ", 0x1a5},
+{"AUDIO_SPDIFOUT_B_SWAP     ", 0x1a6},
+{"AUDIO_SPDIFOUT_B_CHSTS0   ", 0x1a7},
+{"AUDIO_SPDIFOUT_B_CHSTS1   ", 0x1a8},
+{"AUDIO_SPDIFOUT_B_CHSTS2   ", 0x1a9},
+{"AUDIO_SPDIFOUT_B_CHSTS3   ", 0x1aa},
+{"AUDIO_SPDIFOUT_B_CHSTS4   ", 0x1ab},
+{"AUDIO_SPDIFOUT_B_CHSTS5   ", 0x1ac},
+{"AUDIO_SPDIFOUT_B_CHSTS6   ", 0x1ad},
+{"AUDIO_SPDIFOUT_B_CHSTS7   ", 0x1ae},
+{"AUDIO_SPDIFOUT_B_CHSTS8   ", 0x1af},
+{"AUDIO_SPDIFOUT_B_CHSTS9   ", 0x1b0},
+{"AUDIO_SPDIFOUT_B_CHSTSA   ", 0x1b1},
+{"AUDIO_SPDIFOUT_B_CHSTSB   ", 0x1b2},
+{"AUDIO_SPDIFOUT_B_MUTE_VAL ", 0x1b3},
+{"AUDIO_RESV_ADDR_0x1b4     ", 0x1b4},
+{"AUDIO_RESV_ADDR_0x1b5     ", 0x1b5},
+{"AUDIO_RESV_ADDR_0x1b6     ", 0x1b6},
+{"AUDIO_RESV_ADDR_0x1b7     ", 0x1b7},
+{"AUDIO_RESV_ADDR_0x1b8     ", 0x1b8},
+{"AUDIO_RESV_ADDR_0x1b9     ", 0x1b9},
+{"AUDIO_RESV_ADDR_0x1ba     ", 0x1ba},
+{"AUDIO_RESV_ADDR_0x1bb     ", 0x1bb},
+{"AUDIO_RESV_ADDR_0x1bc     ", 0x1bc},
+{"AUDIO_RESV_ADDR_0x1bd     ", 0x1bd},
+{"AUDIO_RESV_ADDR_0x1be     ", 0x1be},
+{"AUDIO_RESV_ADDR_0x1bf     ", 0x1bf},
+{"AUDIO_TORAM_CTRL0         ", 0x1c0},
+{"AUDIO_TORAM_CTRL1         ", 0x1c1},
+{"AUDIO_TORAM_START_ADDR    ", 0x1c2},
+{"AUDIO_TORAM_FINISH_ADDR   ", 0x1c3},
+{"AUDIO_TORAM_INT_ADDR      ", 0x1c4},
+{"AUDIO_TORAM_STATUS1       ", 0x1c5},
+{"AUDIO_TORAM_STATUS2       ", 0x1c6},
+{"AUDIO_TORAM_INIT_ADDR     ", 0x1c7},
+{"AUDIO_RESV_ADDR_0x1c8     ", 0x1c8},
+{"AUDIO_RESV_ADDR_0x1c9     ", 0x1c9},
+{"AUDIO_RESV_ADDR_0x1ca     ", 0x1ca},
+{"AUDIO_RESV_ADDR_0x1cb     ", 0x1cb},
+{"AUDIO_RESV_ADDR_0x1cc     ", 0x1cc},
+{"AUDIO_RESV_ADDR_0x1cd     ", 0x1cd},
+{"AUDIO_RESV_ADDR_0x1ce     ", 0x1ce},
+{"AUDIO_RESV_ADDR_0x1cf     ", 0x1cf},
+{"AUDIO_TOACODEC_CTRL0      ", 0x1d0},
+{"AUDIO_TOHDMITX_CTRL0      ", 0x1d1},
+{"AUDIO_TOVAD_CTRL0         ", 0x1d2},
+{"AUDIO_FRATV_CTRL0         ", 0x1d3},
+{"AUDIO_RESV_ADDR_0x1d4     ", 0x1d4},
+{"AUDIO_RESV_ADDR_0x1d5     ", 0x1d5},
+{"AUDIO_RESV_ADDR_0x1d6     ", 0x1d6},
+{"AUDIO_RESV_ADDR_0x1d7     ", 0x1d7},
+{"AUDIO_RESV_ADDR_0x1d8     ", 0x1d8},
+{"AUDIO_RESV_ADDR_0x1d9     ", 0x1d9},
+{"AUDIO_RESV_ADDR_0x1da     ", 0x1da},
+{"AUDIO_RESV_ADDR_0x1db     ", 0x1db},
+{"AUDIO_RESV_ADDR_0x1dc     ", 0x1dc},
+{"AUDIO_RESV_ADDR_0x1dd     ", 0x1dd},
+{"AUDIO_RESV_ADDR_0x1de     ", 0x1de},
+{"AUDIO_RESV_ADDR_0x1df     ", 0x1df},
+{"AUDIO_RESAMPLEB_CTRL0     ", 0x1e0},
+{"AUDIO_RESAMPLEB_CTRL1     ", 0x1e1},
+{"AUDIO_RESAMPLEB_CTRL2     ", 0x1e2},
+{"AUDIO_RESAMPLEB_CTRL3     ", 0x1e3},
+{"AUDIO_RESAMPLEB_COEF0     ", 0x1e4},
+{"AUDIO_RESAMPLEB_COEF1     ", 0x1e5},
+{"AUDIO_RESAMPLEB_COEF2     ", 0x1e6},
+{"AUDIO_RESAMPLEB_COEF3     ", 0x1e7},
+{"AUDIO_RESAMPLEB_COEF4     ", 0x1e8},
+{"AUDIO_RESAMPLEB_STATUS1   ", 0x1e9},
+{"AUDIO_RESV_ADDR_0x1ea     ", 0x1ea},
+{"AUDIO_RESV_ADDR_0x1eb     ", 0x1eb},
+{"AUDIO_RESV_ADDR_0x1ec     ", 0x1ec},
+{"AUDIO_RESV_ADDR_0x1ed     ", 0x1ed},
+{"AUDIO_RESV_ADDR_0x1ee     ", 0x1ee},
+{"AUDIO_RESV_ADDR_0x1ef     ", 0x1ef},
+{"AUDIO_SPDIFIN_LB_CTRL0    ", 0x1f0},
+{"AUDIO_SPDIFIN_LB_CTRL1    ", 0x1f1},
+{"AUDIO_RESV_ADDR_0x1f2     ", 0x1f2},
+{"AUDIO_RESV_ADDR_0x1f3     ", 0x1f3},
+{"AUDIO_RESV_ADDR_0x1f4     ", 0x1f4},
+{"AUDIO_RESV_ADDR_0x1f5     ", 0x1f5},
+{"AUDIO_SPDIFIN_LB_CTRL6    ", 0x1f6},
+{"AUDIO_SPDIFIN_LB_STAT0    ", 0x1f7},
+{"AUDIO_SPDIFIN_LB_STAT1    ", 0x1f8},
+{"AUDIO_RESV_ADDR_0x1f9     ", 0x1f9},
+{"AUDIO_SPDIFIN_LB_MUTE_VAL ", 0x1fa},
+{"AUDIO_RESV_ADDR_0x1fb     ", 0x1fb},
+{"AUDIO_RESV_ADDR_0x1fc     ", 0x1fc},
+{"AUDIO_RESV_ADDR_0x1fd     ", 0x1fd},
+{"AUDIO_RESV_ADDR_0x1fe     ", 0x1fe},
+{"AUDIO_RESV_ADDR_0x1ff     ", 0x1ff},
+{"AUDIO_FRHDMIRX_CTRL0      ", 0x200},
+{"AUDIO_FRHDMIRX_CTRL1      ", 0x201},
+{"AUDIO_FRHDMIRX_CTRL2      ", 0x202},
+{"AUDIO_FRHDMIRX_CTRL3      ", 0x203},
+{"AUDIO_FRHDMIRX_CTRL4      ", 0x204},
+{"AUDIO_FRHDMIRX_CTRL5      ", 0x205},
+{"AUDIO_RESV_ADDR_0x206     ", 0x206},
+{"AUDIO_RESV_ADDR_0x207     ", 0x207},
+{"AUDIO_RESV_ADDR_0x208     ", 0x208},
+{"AUDIO_RESV_ADDR_0x209     ", 0x209},
+{"AUDIO_FRHDMIRX_STAT0      ", 0x20a},
+{"AUDIO_FRHDMIRX_STAT1      ", 0x20b},
+{"AUDIO_RESV_ADDR_0x20c     ", 0x20c},
+{"AUDIO_RESV_ADDR_0x20d     ", 0x20d},
+{"AUDIO_RESV_ADDR_0x20e     ", 0x20e},
+{"AUDIO_RESV_ADDR_0x20f     ", 0x20f},
+{"AUDIO_TODDR_D_CTRL0       ", 0x210},
+{"AUDIO_TODDR_D_CTRL1       ", 0x211},
+{"AUDIO_TODDR_D_START_ADDR  ", 0x212},
+{"AUDIO_TODDR_D_FINISH_ADDR ", 0x213},
+{"AUDIO_TODDR_D_INT_ADDR    ", 0x214},
+{"AUDIO_TODDR_D_STATUS1     ", 0x215},
+{"AUDIO_TODDR_D_STATUS2     ", 0x216},
+{"AUDIO_TODDR_D_START_ADDRB ", 0x217},
+{"AUDIO_TODDR_D_FINISH_ADDRB", 0x218},
+{"AUDIO_TODDR_D_INIT_ADDR   ", 0x219},
+{"AUDIO_TODDR_D_CTRL2       ", 0x21a},
+{"AUDIO_RESV_ADDR_0x21b     ", 0x21b},
+{"AUDIO_RESV_ADDR_0x21c     ", 0x21c},
+{"AUDIO_RESV_ADDR_0x21d     ", 0x21d},
+{"AUDIO_RESV_ADDR_0x21e     ", 0x21e},
+{"AUDIO_RESV_ADDR_0x21f     ", 0x21f},
+{"AUDIO_FRDDR_D_CTRL0       ", 0x220},
+{"AUDIO_FRDDR_D_CTRL1       ", 0x221},
+{"AUDIO_FRDDR_D_START_ADDR  ", 0x222},
+{"AUDIO_FRDDR_D_FINISH_ADDR ", 0x223},
+{"AUDIO_FRDDR_D_INT_ADDR    ", 0x224},
+{"AUDIO_FRDDR_D_STATUS1     ", 0x225},
+{"AUDIO_FRDDR_D_STATUS2     ", 0x226},
+{"AUDIO_FRDDR_D_START_ADDRB ", 0x227},
+{"AUDIO_FRDDR_D_FINISH_ADDRB", 0x228},
+{"AUDIO_FRDDR_D_INIT_ADDR   ", 0x229},
+{"AUDIO_FRDDR_D_CTRL2       ", 0x22a},
+{"AUDIO_RESV_ADDR_0x22b     ", 0x22b},
+{"AUDIO_RESV_ADDR_0x22c     ", 0x22c},
+{"AUDIO_RESV_ADDR_0x22d     ", 0x22d},
+{"AUDIO_RESV_ADDR_0x22e     ", 0x22e},
+{"AUDIO_RESV_ADDR_0x22f     ", 0x22f},
+{"AUDIO_LB_B_CTRL0          ", 0x230},
+{"AUDIO_LB_B_CTRL1          ", 0x231},
+{"AUDIO_LB_B_CTRL2          ", 0x232},
+{"AUDIO_LB_B_CTRL3          ", 0x233},
+{"AUDIO_LB_B_DAT_CH_ID0     ", 0x234},
+{"AUDIO_LB_B_DAT_CH_ID1     ", 0x235},
+{"AUDIO_LB_B_DAT_CH_ID2     ", 0x236},
+{"AUDIO_LB_B_DAT_CH_ID3     ", 0x237},
+{"AUDIO_LB_B_LB_CH_ID0      ", 0x238},
+{"AUDIO_LB_B_LB_CH_ID1      ", 0x239},
+{"AUDIO_LB_B_LB_CH_ID2      ", 0x23a},
+{"AUDIO_LB_B_LB_CH_ID3      ", 0x23b},
+{"AUDIO_LB_B_STS            ", 0x23c},
+};
+
+#endif
index 505f994..f5205a1 100644 (file)
  * more details.
  *
  */
-
 #include "audio_utils.h"
 #include "regs.h"
 #include "iomap.h"
-#include "loopback_hw.h"
 #include "spdif_hw.h"
-#include "pdm_hw.h"
-#include "tdm_hw.h"
-#include "ddr_mngr.h"
 #include "resample.h"
 #include "effects_v2.h"
 #include "vad.h"
+#include "ddr_mngr.h"
 
 #include <linux/amlogic/iomap.h>
 #include <linux/amlogic/media/sound/auge_utils.h>
 
-#include <linux/of_platform.h>
-
 struct snd_elem_info {
        struct soc_enum *ee;
        int reg;
@@ -39,132 +33,8 @@ struct snd_elem_info {
        u32 mask;
 };
 
-static unsigned int loopback_enable;
-static unsigned int loopback_is_running;
-static unsigned int datain_datalb_total;
 static unsigned int audio_inskew;
 
-static const char *const loopback_enable_texts[] = {
-       "Disable",
-       "Enable",
-};
-
-static const struct soc_enum loopback_enable_enum =
-       SOC_ENUM_SINGLE(EE_AUDIO_LB_CTRL0,
-                       31,
-                       ARRAY_SIZE(loopback_enable_texts),
-                       loopback_enable_texts);
-
-
-static int loopback_enable_get_enum(
-       struct snd_kcontrol *kcontrol,
-       struct snd_ctl_elem_value *ucontrol)
-{
-       ucontrol->value.enumerated.item[0] = loopback_enable;
-
-       return 0;
-}
-
-static int loopback_enable_set_enum(
-       struct snd_kcontrol *kcontrol,
-       struct snd_ctl_elem_value *ucontrol)
-{
-       loopback_enable = ucontrol->value.enumerated.item[0];
-
-       return 0;
-}
-
-static int datain_datalb_total_get_param(
-       struct snd_kcontrol *kcontrol,
-       struct snd_ctl_elem_value *ucontrol)
-{
-       ucontrol->value.bytes.data[0] = datain_datalb_total;
-
-       return 0;
-}
-
-static int datain_datalb_total_set_param(
-       struct snd_kcontrol *kcontrol,
-       struct snd_ctl_elem_value *ucontrol)
-{
-       datain_datalb_total = ucontrol->value.bytes.data[0];
-
-       return 0;
-}
-
-static unsigned int loopback_datain;
-
-static const char *const loopback_datain_texts[] = {
-       "TDMIN_A",
-       "TDMIN_B",
-       "TDMIN_C",
-       "SPDIFIN",
-       "PDMIN",
-};
-
-static const struct soc_enum loopback_datain_enum =
-       SOC_ENUM_SINGLE(EE_AUDIO_LB_CTRL0, 0, ARRAY_SIZE(loopback_datain_texts),
-                       loopback_datain_texts);
-
-
-static int loopback_datain_get_enum(
-       struct snd_kcontrol *kcontrol,
-       struct snd_ctl_elem_value *ucontrol)
-{
-       ucontrol->value.enumerated.item[0] = loopback_datain;
-
-       return 0;
-}
-
-static int loopback_datain_set_enum(
-       struct snd_kcontrol *kcontrol,
-       struct snd_ctl_elem_value *ucontrol)
-{
-       loopback_datain = ucontrol->value.enumerated.item[0];
-       audiobus_update_bits(EE_AUDIO_LB_CTRL0, 0, loopback_datain);
-
-       return 0;
-}
-
-static unsigned int loopback_tdminlb;
-
-static const char *const loopback_tdminlb_texts[] = {
-       "TDMOUT_A",
-       "TDMOUT_B",
-       "TDMOUT_C",
-       "TDMIN_A",
-       "TDMIN_B",
-       "TDMIN_C",
-};
-
-static const struct soc_enum loopback_tdminlb_enum =
-       SOC_ENUM_SINGLE(EE_AUDIO_TDMIN_LB_CTRL,
-                       20,
-                       ARRAY_SIZE(loopback_tdminlb_texts),
-                       loopback_tdminlb_texts);
-
-
-static int loopback_tdminlb_get_enum(
-       struct snd_kcontrol *kcontrol,
-       struct snd_ctl_elem_value *ucontrol)
-{
-       ucontrol->value.enumerated.item[0] = loopback_tdminlb;
-
-       return 0;
-}
-
-static int loopback_tdminlb_set_enum(
-       struct snd_kcontrol *kcontrol,
-       struct snd_ctl_elem_value *ucontrol)
-{
-       loopback_tdminlb = ucontrol->value.enumerated.item[0];
-       audiobus_update_bits(EE_AUDIO_TDMIN_LB_CTRL,
-               0xf << 20,
-               loopback_datain);
-
-       return 0;
-}
-
 #if 0
 static int snd_int_info(struct snd_kcontrol *kcontrol,
                struct snd_ctl_elem_info *uinfo)
@@ -726,27 +596,6 @@ static int tdmout_c_binv_set_enum(
        SND_BYTE(xname, type, func, xshift, xmask)
 
 static const struct snd_kcontrol_new snd_auge_controls[] = {
-       /* loopback enable */
-       SOC_ENUM_EXT("Loopback Enable",
-                    loopback_enable_enum,
-                    loopback_enable_get_enum,
-                    loopback_enable_set_enum),
-
-       SND_SOC_BYTES_EXT("datain_datalb_total", 1,
-                          datain_datalb_total_get_param,
-                          datain_datalb_total_set_param),
-
-       /* loopback data in source */
-       SOC_ENUM_EXT("Loopback datain source",
-                    loopback_datain_enum,
-                    loopback_datain_get_enum,
-                    loopback_datain_set_enum),
-
-       /* loopback data tdmin lb */
-       SOC_ENUM_EXT("Loopback tmdin lb source",
-                    loopback_tdminlb_enum,
-                    loopback_tdminlb_get_enum,
-                    loopback_tdminlb_set_enum),
 #if 0
        /*TDMIN_A swap*/
        SND_SWAP("TDMIN_A Ch0 Swap", TDMIN_A, in_swap_channel_enum, 0, 0x7),
@@ -1058,519 +907,6 @@ int snd_card_add_kcontrols(struct snd_soc_card *card)
 
 }
 
-int loopback_parse_of(struct device_node *node,
-       struct loopback_cfg *lb_cfg)
-{
-       struct platform_device *pdev;
-       const __be32 *of_slot_mask;
-       unsigned int lane_mask = 0;
-       int i, ret, set_num = 0;
-       u32 val;
-
-       pdev = of_find_device_by_node(node);
-       if (!pdev) {
-               dev_err(&pdev->dev, "failed to find platform device\n");
-               ret = -EINVAL;
-               goto fail;
-       }
-
-       /*mpll used for tdmin*/
-       lb_cfg->tdmin_mpll = devm_clk_get(&pdev->dev, "datalb_mpll");
-       if (IS_ERR(lb_cfg->tdmin_mpll)) {
-               dev_err(&pdev->dev,
-                       "Can't retrieve tdmin_mpll clock\n");
-               lb_cfg->tdmin_mpll = NULL;
-       }
-
-       ret = of_property_read_u32(node, "lb_mode",
-               &lb_cfg->lb_mode);
-       if (ret) {
-               pr_err("failed to get lb_mode, set it default\n");
-               lb_cfg->lb_mode = 0;
-               ret = 0;
-       }
-
-       ret = of_property_read_u32(node, "datain_src",
-               &lb_cfg->datain_src);
-       if (ret) {
-               pr_err("failed to get datain_src\n");
-               ret = -EINVAL;
-               goto fail;
-       }
-       ret = of_property_read_u32(node, "datain_chnum",
-               &lb_cfg->datain_chnum);
-       if (ret) {
-               pr_err("failed to get datain_chnum\n");
-               ret = -EINVAL;
-               goto fail;
-       }
-       ret = of_property_read_u32(node, "datain_chmask",
-               &lb_cfg->datain_chmask);
-       if (ret) {
-               pr_err("failed to get datain_chmask\n");
-               ret = -EINVAL;
-               goto fail;
-       }
-
-       ret = of_property_read_u32(node, "datalb_src",
-               &lb_cfg->datalb_src);
-       if (ret) {
-               pr_err("failed to get datalb_src\n");
-               ret = -EINVAL;
-               goto fail;
-       }
-       ret = of_property_read_u32(node, "datalb_chnum",
-               &lb_cfg->datalb_chnum);
-       if (ret) {
-               pr_err("failed to get datalb_chnum\n");
-               ret = -EINVAL;
-               goto fail;
-       }
-       ret = of_property_read_u32(node, "datalb_chmask",
-               &lb_cfg->datalb_chmask);
-       if (ret) {
-               pr_err("failed to get datalb_chmask\n");
-               ret = -EINVAL;
-               goto fail;
-       }
-
-       of_slot_mask = of_get_property(node, "datalb-lane-mask-in", &val);
-       if (!of_slot_mask) {
-               pr_err("if use extern loopback, pls set datalb-lane-mask-in\n");
-       } else {
-               val /= sizeof(u32);
-               for (i = 0; i < val; i++)
-                       if (be32_to_cpup(&of_slot_mask[i]))
-                               lane_mask |= (1 << i);
-               for (i = 0; i < 4; i++) {
-                       if ((1 << i) & lane_mask) {
-                               /*each lane only L/R masked*/
-                               lb_cfg->datalb_chswap |=
-                                       (i * 2) << (set_num++ * 4);
-                               lb_cfg->datalb_chswap |=
-                                       (i * 2 + 1) << (set_num++ * 4);
-                       }
-               }
-       }
-       ret = of_property_read_u32(node, "datalb_clk",
-               &lb_cfg->datalb_clk);
-       if (ret) {
-               pr_err("if no datalb_clk on dts, it equal is datalb_src\n");
-               lb_cfg->datalb_clk = lb_cfg->datalb_src;
-       }
-
-       ret = of_property_read_u32(node, "datain_datalb_total",
-               &lb_cfg->datain_datalb_total);
-       if (ret) {
-               pr_err("no register datain_datalb_total,it also can work\n");
-               lb_cfg->datain_datalb_total = 0;
-       } else {
-               if (lb_cfg->datain_datalb_total > 8) {
-                       lb_cfg->datain_chnum = 8;
-                       lb_cfg->datain_chmask = 0xff;
-                       lb_cfg->datalb_chnum = 8;
-                       lb_cfg->datalb_chmask = 0xff;
-                       lb_cfg->datalb_chswap = 0x76543210;
-               }
-       }
-       datain_datalb_total = lb_cfg->datain_datalb_total;
-
-       loopback_datain = lb_cfg->datain_src;
-       loopback_tdminlb = lb_cfg->datalb_src;
-
-       pr_info("parse loopback:, \tlb mode:%d\n",
-               lb_cfg->lb_mode);
-       pr_info("\tdatain_src:%d, datain_chnum:%d, datain_chumask:%x\n",
-               lb_cfg->datain_src,
-               lb_cfg->datain_chnum,
-               lb_cfg->datain_chmask);
-       pr_info("\tdatalb_src:%d, datalb_chnum:%d\n",
-               lb_cfg->datalb_src,
-               lb_cfg->datalb_chnum);
-       pr_info("\tdatalb_chswap:0x%x,datalb_chmask:%x\n",
-               lb_cfg->datalb_chswap,
-               lb_cfg->datalb_chmask);
-
-fail:
-       return ret;
-}
-
-int loopback_hw_params(struct snd_pcm_substream *substream,
-                                     struct snd_pcm_hw_params *params,
-                                     struct loopback_cfg *lb_cfg,
-                                     unsigned int mclk)
-{
-       struct snd_pcm_runtime *runtime = substream->runtime;
-       unsigned int bclk_sel, fsclk_sel;
-       int bit_depth;
-
-       if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
-               return 0;
-       bit_depth = snd_pcm_format_width(runtime->format);
-
-       if (lb_cfg->datalb_src >= 3) {
-               /*tdm in*/
-               /*for i2s mode*/
-               unsigned int sclk_div = 4 - 1;
-               unsigned int ratio = params_channels(params) * bit_depth - 1;
-               unsigned int fsclk_hi;
-               unsigned int clk_id = lb_cfg->datalb_src - 3;
-               unsigned int mul = 2;
-               unsigned int mpll_freq, offset, reg;
-
-               /*lrclk sclk depend on default 8ch setting,*/
-               /* so if num of channels is 4, to change ratio*/
-               if (params_channels(params) == 4)
-                       ratio = ratio*2;
-
-               fsclk_hi = ratio/2;
-
-               pr_info("%s, channels:%d, format:%d, ratio:%d\n",
-                               __func__,
-                               params_channels(params),
-                               bit_depth,
-                               ratio);
-
-               bclk_sel = clk_id;
-               fsclk_sel = clk_id;
-
-               /*mclk*/
-               mpll_freq = mclk * mul;
-               clk_set_rate(lb_cfg->tdmin_mpll, mpll_freq);
-               pr_info("mpll freq:%d, %lu\n", mpll_freq,
-                       clk_get_rate(lb_cfg->tdmin_mpll));
-               offset = EE_AUDIO_MCLK_B_CTRL(0) - EE_AUDIO_MCLK_A_CTRL(0);
-               reg = EE_AUDIO_MCLK_A_CTRL(0) + offset * clk_id;
-               audiobus_write(reg,
-                               1 << 31 | /*clk enable*/
-                               clk_id << 24 | /*clk src*/
-                               (mul - 1)); /*clk_div mclk*/
-
-               /*sclk, lrclk*/
-               offset = EE_AUDIO_MST_B_SCLK_CTRL0 - EE_AUDIO_MST_A_SCLK_CTRL0;
-               reg = EE_AUDIO_MST_A_SCLK_CTRL0 + offset * clk_id;
-               audiobus_update_bits(reg,
-                               0x3 << 30 | 0x3ff << 20 | 0x3ff<<10 | 0x3ff,
-                               0x3 << 30 | sclk_div << 20 | fsclk_hi << 10
-                               | ratio);
-
-               audiobus_update_bits(
-                       EE_AUDIO_CLK_TDMIN_LB_CTRL,
-                       0x3 << 30 | 1 << 29 | 0xf << 24 | 0xf << 20,
-                       0x3 << 30 | 1 << 29 | bclk_sel << 24 | fsclk_sel << 20);
-       }
-       return 0;
-}
-
-int loopback_prepare(
-       struct snd_pcm_substream *substream,
-       struct loopback_cfg *lb_cfg)
-{
-       struct snd_pcm_runtime *runtime = substream->runtime;
-       unsigned int bitwidth;
-       unsigned int datain_toddr_type, datalb_toddr_type;
-       unsigned int datain_msb, datain_lsb, datalb_msb, datalb_lsb;
-       struct lb_cfg datain_cfg;
-       struct lb_cfg datalb_cfg;
-       struct audio_data ddrdata;
-       struct data_in datain;
-       struct data_lb datalb;
-
-       if (!lb_cfg)
-               return -EINVAL;
-
-       pr_info("%s\n", __func__);
-
-       bitwidth = snd_pcm_format_width(runtime->format);
-       switch (lb_cfg->datain_src) {
-       case DATAIN_TDMA:
-       case DATAIN_TDMB:
-       case DATAIN_TDMC:
-       case DATAIN_PDM:
-               datain_toddr_type = 0;
-               datain_msb = 32 - 1;
-               datain_lsb = 0;
-               break;
-       case DATAIN_SPDIF:
-               datain_toddr_type = 3;
-               datain_msb = 27;
-               datain_lsb = 4;
-               if (bitwidth <= 24)
-                       datain_lsb = 28 - bitwidth;
-               else
-                       datain_lsb = 4;
-               break;
-       default:
-               pr_err("unsupport data in source:%d\n",
-                       lb_cfg->datain_src);
-               return -EINVAL;
-       }
-
-       switch (lb_cfg->datalb_src) {
-       case TDMINLB_TDMOUTA:
-       case TDMINLB_TDMOUTB:
-       case TDMINLB_TDMOUTC:
-       case TDMINLB_PAD_TDMINA:
-       case TDMINLB_PAD_TDMINB:
-       case TDMINLB_PAD_TDMINC:
-               if (bitwidth == 24) {
-                       datalb_toddr_type = 4;
-                       datalb_msb = 32 - 1;
-                       datalb_lsb = 32 - bitwidth;
-               } else {
-                       datalb_toddr_type = 0;
-                       datalb_msb = 32 - 1;
-                       datalb_lsb = 0;
-               }
-               break;
-       default:
-               pr_err("unsupport data lb source:%d\n",
-                       lb_cfg->datalb_src);
-               return -EINVAL;
-       }
-
-       datain_cfg.ext_signed    = 0;
-       datain_cfg.chnum         = lb_cfg->datain_chnum;
-       datain_cfg.chmask        = lb_cfg->datain_chmask;
-       ddrdata.combined_type    = datain_toddr_type;
-       ddrdata.msb              = datain_msb;
-       ddrdata.lsb              = datain_lsb;
-       ddrdata.src              = lb_cfg->datain_src;
-       datain.config            = &datain_cfg;
-       datain.ddrdata           = &ddrdata;
-
-       datalb_cfg.ext_signed    = 0;
-       datalb_cfg.chnum         = lb_cfg->datalb_chnum;
-       datalb_cfg.chmask        = lb_cfg->datalb_chmask;
-       datalb.config            = &datalb_cfg;
-       datalb.ddr_type          = datalb_toddr_type;
-       datalb.msb               = datalb_msb;
-       datalb.lsb               = datalb_lsb;
-
-       datain_config(&datain);
-       datalb_config(&datalb);
-
-       lb_cfg->datain_datalb_total = datain_datalb_total;
-
-       if (lb_cfg->datain_datalb_total > 8) {
-               lb_cfg->datain_chnum = 8;
-               lb_cfg->datain_chmask = 0xff;
-               lb_cfg->datalb_chnum = 8;
-               lb_cfg->datalb_chmask = 0xff;
-               lb_cfg->datalb_chswap = 0x76543210;
-       }
-       datalb_ctrl(lb_cfg);
-       lb_mode(lb_cfg->lb_mode);
-
-       return 0;
-}
-
-void toddr_enable(int is_enable, int toddr_index)
-{
-       int offset = EE_AUDIO_TODDR_B_CTRL0 - EE_AUDIO_TODDR_A_CTRL0;
-       int reg = EE_AUDIO_TODDR_A_CTRL0 + offset * toddr_index;
-
-       audiobus_update_bits(
-               reg,
-               0x1 << 31,
-               is_enable << 31);
-}
-
-void frddr_enable(int is_enable, int frddr_index)
-{
-       int offset = EE_AUDIO_FRDDR_B_CTRL0 - EE_AUDIO_FRDDR_A_CTRL0;
-       int reg = EE_AUDIO_FRDDR_A_CTRL0 + offset * frddr_index;
-
-       audiobus_update_bits(
-               reg,
-               0x1 << 31,
-               is_enable << 31);
-}
-
-static void loopback_modules_disable(
-       struct loopback_cfg *lb_cfg,
-       int tdm_index,
-       int frddr_index, int toddr_index)
-{
-       /* tdminLB */
-       tdmin_lb_fifo_enable(0);
-       tdmin_lb_enable(tdm_index, 0);
-
-       /* datain src */
-       switch (lb_cfg->datain_src) {
-       case 0:
-       case 1:
-       case 2:
-               /*tdm in*/
-               break;
-       case 3:
-               /*spdif in*/
-               break;
-       case 4:
-               /*pdm in*/
-               pdm_enable(0);
-               break;
-       default:
-               pr_err("unsupport datain source!!\n");
-               return;
-       }
-       /* loopback */
-       lb_enable(0);
-
-       /* toddr */
-       if (toddr_index >= 0)
-               toddr_enable(0, toddr_index);
-
-       /* frddr */
-       if (frddr_index >= 3)
-               toddr_enable(0, frddr_index - 3);
-       else if (frddr_index >= 0)
-               frddr_enable(0, frddr_index);
-
-       /* tdmout */
-       if (frddr_index >= 0) {
-               tdm_fifo_enable(tdm_index, 0);
-               tdm_enable(tdm_index, 0);
-       }
-}
-
-static void loopback_modules_enable(
-       struct loopback_cfg *lb_cfg,
-       int tdm_index,
-       int frddr_index, int toddr_index)
-{
-       /*
-        * Loopback enable in sequence:
-        * tdmout->frddr->toddr->loopback->pdmin->tdminLB
-        */
-
-       /* tdmout */
-       if (frddr_index >= 0) {
-               tdm_fifo_enable(tdm_index, 1);
-               tdm_enable(tdm_index, 1);
-       }
-
-       /* frddr */
-       if (frddr_index >= 3)
-               toddr_enable(1, frddr_index - 3);
-       else if (frddr_index >= 0)
-               frddr_enable(1, frddr_index);
-
-       tdm_fifo_enable(tdm_index, 1);
-       tdm_enable(tdm_index, 1);
-        frddr_enable(1, frddr_index);
-       /* toddr */
-       if (toddr_index >= 0)
-               toddr_enable(1, toddr_index);
-
-       /* loopback */
-       lb_enable(1);
-
-       /* datain src */
-       switch (lb_cfg->datain_src) {
-       case 0:
-       case 1:
-       case 2:
-               /*tdm in*/
-               break;
-       case 3:
-               /*spdif in*/
-               break;
-       case 4:
-               /*pdm in*/
-               pdm_enable(1);
-               break;
-       default:
-               pr_err("unsupport datain source!!\n");
-               return;
-       }
-       /*tdminLB*/
-       tdmin_lb_fifo_enable(1);
-       tdmin_lb_enable(tdm_index, 1);
-}
-
-int loopback_trigger(
-       struct snd_pcm_substream *substream,
-       int cmd,
-       struct loopback_cfg *lb_cfg)
-{
-       switch (cmd) {
-       case SNDRV_PCM_TRIGGER_START:
-       case SNDRV_PCM_TRIGGER_RESUME:
-       case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
-               if (loopback_enable && loopback_is_running) {
-                       pr_info("loopback enable\n");
-
-                       /*
-                        * toddr/frdd is selected in dai_prepare already.
-                        * check toddr index of datain
-                        * check frddr index of datalb
-                        */
-                       lb_cfg->toddr_index = fetch_toddr_index_by_src(
-                                                       lb_cfg->datain_src);
-                       /* check datalb is from tdmout or tdmin */
-                       if (lb_cfg->datalb_src >= 3)
-                               lb_cfg->frddr_index = fetch_toddr_index_by_src(
-                                                       lb_cfg->datalb_src - 3);
-                       else
-                               lb_cfg->frddr_index = fetch_frddr_index_by_src(
-                                                       lb_cfg->datalb_src);
-
-                       pr_info("loopback toddr index:%d, frddr index:%d\n",
-                               lb_cfg->toddr_index,
-                               lb_cfg->frddr_index);
-
-                       pr_info("loopback modules in sequence!\n");
-                       /*if pdm overrun, re-set up the sequence*/
-                       if (lb_cfg->frddr_index >= 0)
-                               loopback_modules_disable(
-                                       lb_cfg,
-                                       lb_cfg->datalb_src,
-                                       lb_cfg->frddr_index,
-                                       lb_cfg->toddr_index);
-
-                       loopback_modules_enable(
-                                       lb_cfg,
-                                       lb_cfg->datalb_src,
-                                       lb_cfg->frddr_index,
-                                       lb_cfg->toddr_index);
-               }
-               break;
-       case SNDRV_PCM_TRIGGER_STOP:
-       case SNDRV_PCM_TRIGGER_SUSPEND:
-       case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
-               if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) {
-                       if (loopback_enable) {
-                               pr_info("loopback disable\n");
-                               lb_enable(0);
-                               tdmin_lb_enable(lb_cfg->datalb_src, 0);
-                       }
-               }
-               break;
-       default:
-               return -EINVAL;
-       }
-
-       return 0;
-}
-
-void loopback_set_status(int is_running)
-{
-       loopback_is_running = is_running;
-}
-
-int loopback_is_enable(void)
-{
-       return (loopback_enable == 1);
-}
-
-int loopback_check_enable(int src)
-{
-       return (src <= PDMIN)
-               && (loopback_datain == src)
-               && (loopback_enable == 1);
-}
-
 void auge_acodec_reset(void)
 {
        audioreset_update_bits(EE_RESET1, 1 << 29, 1 << 29);
index d044447..2698181 100644 (file)
 #ifndef __AML_AUDIO_UTILS_H__
 #define __AML_AUDIO_UTILS_H__
 
-#include <linux/clk.h>
-#include <linux/types.h>
 #include <sound/soc.h>
-#include <sound/tlv.h>
-
-/* datain src
- * [4]: pdmin;
- * [3]: spdifin;
- * [2]: tdmin_c;
- * [1]: tdmin_b;
- * [0]: tdmin_a;
- */
-enum datain_src {
-       DATAIN_TDMA = 0,
-       DATAIN_TDMB,
-       DATAIN_TDMC,
-       DATAIN_SPDIF,
-       DATAIN_PDM,
-};
-
-/* datalb src/tdmlb src
- * [0]: tdmoutA
- * [1]: tdmoutB
- * [2]: tdmoutC
- * [3]: PAD_tdminA
- * [4]: PAD_tdminB
- * [5]: PAD_tdminC
- */
-enum tdmin_lb_src {
-       TDMINLB_TDMOUTA = 0,
-       TDMINLB_TDMOUTB,
-       TDMINLB_TDMOUTC,
-       TDMINLB_PAD_TDMINA,
-       TDMINLB_PAD_TDMINB,
-       TDMINLB_PAD_TDMINC,
-};
-
-/* toddr_src_sel
- *             [7]: loopback;
- *             [6]: tdmin_lb;
- *             [5]: reserved;
- *             [4]: pdmin;
- *             [3]: spdifin;
- *             [2]: tdmin_c;
- *             [1]: tdmin_b;
- *             [0]: tdmin_a;
- */
-enum fifoin_src {
-       FIFOIN_TDMINA   = 0,
-       FIFOIN_TDMINB   = 1,
-       FIFOIN_TDMINC   = 2,
-       FIFOIN_SPDIF    = 3,
-       FIFOIN_PDM      = 4,
-       FIFOIN_TDMINLB  = 6,
-       FIFOIN_LOOPBACK = 7
-};
-
-/* audio data selected to ddr */
-struct audio_data {
-       unsigned int resample;
-       /* reg_dat_sel
-        *      0: combined data[m:n] without gap;
-        *              like S0[m:n],S1[m:n],S2[m:n],
-        *      1: combined data[m:n] as 16bits;
-        *              like {S0[11:0],4'd0},{S1[11:0],4'd0}
-        *      2: combined data[m:n] as 16bits;
-        *              like {4'd0,S0[11:0]},{4'd0,{S1[11:0]}
-        *      3: combined data[m:n] as 32bits;
-        *              like {S0[27:4],8'd0},{S1[27:4],8'd0}
-        *      4: combined data[m:n] as 32bits;
-        *              like {8'd0,S0[27:4]},{8'd0,{S1[27:4]}
-        */
-       unsigned int combined_type;
-       /* the msb positioin in data */
-       unsigned int msb;
-       /* the lsb position in data */
-       unsigned int lsb;
-       /* toddr_src_sel
-        *      [7]: loopback;
-        *      [6]: tdmin_lb;
-        *      [5]: reserved;
-        *      [4]: pdmin;
-        *      [3]: spdifin;
-        *      [2]: tdmin_c;
-        *      [1]: tdmin_b;
-        *      [0]: tdmin_a;
-        */
-       unsigned int src;
-};
-
-/**/
-struct loopback_cfg {
-       struct clk *tdmin_mpll;
-       /* lb_mode
-        * 0: out rate = in data rate;
-        * 1: out rate = loopback data rate;
-        */
-       unsigned int lb_mode;
-
-       enum datain_src datain_src;
-       unsigned int datain_chnum;
-       unsigned int datain_chmask;
-       int toddr_index;
-
-       enum tdmin_lb_src datalb_src;
-       enum tdmin_lb_src datalb_clk;
-       unsigned int datalb_chnum;
-       unsigned int datalb_chswap;
-       unsigned int datalb_chmask;
-       int frddr_index;
-       unsigned int datain_datalb_total;
-};
-
-extern void loopback_set_status(int is_running);
-
-extern int loopback_is_enable(void);
-
-extern int loopback_check_enable(int src);
 
 extern int snd_card_add_kcontrols(struct snd_soc_card *card);
 
-extern int loopback_parse_of(struct device_node *node,
-                               struct loopback_cfg *lb_cfg);
-
-extern int loopback_hw_params(struct snd_pcm_substream *substream,
-                               struct snd_pcm_hw_params *params,
-                               struct loopback_cfg *lb_cfg,
-                               unsigned int mclk);
-
-extern int loopback_prepare(
-       struct snd_pcm_substream *substream,
-       struct loopback_cfg *lb_cfg);
-
-extern int loopback_trigger(
-       struct snd_pcm_substream *substream,
-       int cmd,
-       struct loopback_cfg *lb_cfg);
-
 extern void audio_locker_set(int enable);
 
 extern int audio_locker_get(void);
index c4d4582..4002587 100644 (file)
@@ -69,7 +69,6 @@ struct aml_card_data {
        int spk_mute_gpio;
        bool spk_mute_active_low;
        struct gpio_desc *avout_mute_desc;
-       struct loopback_cfg lb_cfg;
        struct timer_list timer;
        struct work_struct work;
        bool hp_last_state;
@@ -462,8 +461,6 @@ static int aml_card_hw_params(struct snd_pcm_substream *substream,
                        goto err;
        }
 
-       if (loopback_is_enable() && mclk)
-               loopback_hw_params(substream, params, &priv->lb_cfg, mclk);
        return 0;
 err:
        return ret;
@@ -471,23 +468,11 @@ err:
 
 int aml_card_prepare(struct snd_pcm_substream *substream)
 {
-       struct snd_soc_pcm_runtime *rtd = substream->private_data;
-       struct aml_card_data *priv = snd_soc_card_get_drvdata(rtd->card);
-
-       if (loopback_is_enable())
-               loopback_prepare(substream, &priv->lb_cfg);
-
        return 0;
 }
 
 int aml_card_trigger(struct snd_pcm_substream *substream, int cmd)
 {
-       struct snd_soc_pcm_runtime *rtd = substream->private_data;
-       struct aml_card_data *priv = snd_soc_card_get_drvdata(rtd->card);
-
-       if (loopback_is_enable())
-               loopback_trigger(substream, cmd, &priv->lb_cfg);
-
        return 0;
 }
 
@@ -645,7 +630,7 @@ static int aml_card_dai_link_of(struct device_node *node,
 
        dai_link->ops = &aml_card_ops;
        dai_link->init = aml_card_dai_init;
-
+       dai_link->nonatomic = 1;
        dev_dbg(dev, "\tname : %s\n", dai_link->stream_name);
        dev_dbg(dev, "\tformat : %04x\n", dai_link->dai_fmt);
        dev_dbg(dev, "\tcpu : %s / %d\n",
@@ -779,7 +764,6 @@ static int aml_card_parse_of(struct device_node *node,
 {
        struct device *dev = aml_priv_to_dev(priv);
        struct device_node *dai_link;
-       struct device_node *lb_link;
        int ret;
 
        if (!node)
@@ -806,14 +790,6 @@ static int aml_card_parse_of(struct device_node *node,
        /* Factor to mclk, used in hw_params() */
        of_property_read_u32(node, PREFIX "mclk-fs", &priv->mclk_fs);
 
-       /* Loopback */
-       lb_link = of_parse_phandle(node, PREFIX "loopback", 0);
-       if (lb_link) {
-               ret = loopback_parse_of(lb_link, &priv->lb_cfg);
-               if (ret < 0)
-                       pr_err("failed parse loopback, ignore it\n");
-       }
-
        /* Single/Muti DAI link(s) & New style of DT node */
        if (dai_link) {
                struct device_node *np = NULL;
@@ -844,12 +820,10 @@ static int aml_card_parse_of(struct device_node *node,
 
 card_parse_end:
        of_node_put(dai_link);
-       of_node_put(lb_link);
 
        return ret;
 }
 
-
 static struct aml_chipset_info g12a_chipset_info = {
        .spdif_b        = true,
        .eqdrc_fn       = true,
@@ -871,6 +845,10 @@ static const struct of_device_id auge_of_match[] = {
                .compatible = "amlogic, tl1-sound-card",
                .data       = &tl1_chipset_info,
        },
+       {
+               .compatible = "amlogic, tm2-sound-card",
+               .data       = &tl1_chipset_info,
+       },
        {},
 };
 MODULE_DEVICE_TABLE(of, auge_of_match);
@@ -895,6 +873,13 @@ static int aml_card_probe(struct platform_device *pdev)
        if (!priv)
                return -ENOMEM;
 
+       /* chipset related */
+       priv->chipinfo = (struct aml_chipset_info *)
+               of_device_get_match_data(&pdev->dev);
+
+       if (!priv->chipinfo)
+               pr_warn_once("check whether to update sound card init data\n");
+
        dai_props = devm_kzalloc(dev, sizeof(*dai_props) * num, GFP_KERNEL);
        dai_link  = devm_kzalloc(dev, sizeof(*dai_link)  * num, GFP_KERNEL);
        if (!dai_props || !dai_link)
@@ -913,9 +898,8 @@ static int aml_card_probe(struct platform_device *pdev)
 
                ret = aml_card_parse_of(np, priv);
                if (ret < 0) {
-                       if (ret != -EPROBE_DEFER)
-                               dev_err(dev, "%s, parse error %d\n",
-                                       __func__, ret);
+                       dev_err(dev, "%s, parse error %d\n",
+                           __func__, ret);
                        goto err;
                }
 
@@ -953,13 +937,6 @@ static int aml_card_probe(struct platform_device *pdev)
                                        sizeof(priv->dai_props->codec_dai));
        }
 
-
-       priv->chipinfo = (struct aml_chipset_info *)
-               of_device_get_match_data(&pdev->dev);
-
-       if (!priv->chipinfo)
-               pr_warn_once("check whether to update sound card init data\n");
-
        snd_soc_card_set_drvdata(&priv->snd_card, priv);
 
        ret = devm_snd_soc_register_card(&pdev->dev, &priv->snd_card);
index 636c905..baa4fa7 100644 (file)
@@ -29,7 +29,6 @@
 
 #include "regs.h"
 #include "ddr_mngr.h"
-#include "audio_utils.h"
 
 #include "resample.h"
 #include "resample_hw.h"
@@ -64,8 +63,12 @@ static void aml_check_vad(struct toddr *to, bool enable);
 
 /* Audio EQ DRC */
 static struct frddr_attach attach_aed;
-static void aml_check_aed(bool enable, int dst);
-static bool aml_check_aed_module(int dst);
+
+static irqreturn_t aml_ddr_isr(int irq, void *devid)
+{
+       (void)devid;
+       return IRQ_WAKE_THREAD;
+}
 
 /* to DDRS */
 static struct toddr *register_toddr_l(struct device *dev,
@@ -88,16 +91,17 @@ static struct toddr *register_toddr_l(struct device *dev,
        to = &toddrs[i];
 
        /* irqs request */
-       ret = request_irq(to->irq, handler,
-               0, dev_name(dev), data);
+       ret = request_threaded_irq(to->irq, aml_ddr_isr, handler,
+               IRQF_SHARED, dev_name(dev), data);
        if (ret) {
                dev_err(dev, "failed to claim irq %u\n", to->irq);
                return NULL;
        }
        /* enable audio ddr arb */
        mask_bit = i;
-       aml_audiobus_update_bits(actrl, EE_AUDIO_ARB_CTRL,
-                       1<<31|1<<mask_bit, 1<<31|1<<mask_bit);
+       /*aml_audiobus_update_bits(actrl, EE_AUDIO_ARB_CTRL,*/
+       /*              (1 << 31)|(1 << mask_bit),*/
+       /*              (1 << 31)|(1 << mask_bit));*/
 
        to->dev = dev;
        to->actrl = actrl;
@@ -127,22 +131,17 @@ static int unregister_toddr_l(struct device *dev, void *data)
 
        to = &toddrs[i];
 
-       /* check for loopback */
-       if (to->is_lb) {
-               loopback_set_status(0);
-               to->is_lb = 0;
-       }
-
        /* disable audio ddr arb */
        mask_bit = i;
        actrl = to->actrl;
-       aml_audiobus_update_bits(actrl, EE_AUDIO_ARB_CTRL,
-                       1<<mask_bit, 0<<mask_bit);
+       /*aml_audiobus_update_bits(actrl, EE_AUDIO_ARB_CTRL,*/
+       /*              1 << mask_bit, 0 << mask_bit);*/
+
        /* no ddr active, disable arb switch */
        value = aml_audiobus_read(actrl, EE_AUDIO_ARB_CTRL) & 0x77;
-       if (value == 0)
-               aml_audiobus_update_bits(actrl, EE_AUDIO_ARB_CTRL,
-                               1<<31, 0<<31);
+       /*if (value == 0)*/
+       /*      aml_audiobus_update_bits(actrl, EE_AUDIO_ARB_CTRL,*/
+       /*                      1 << 31, 0 << 31);*/
 
        free_irq(to->irq, data);
        to->dev = NULL;
@@ -279,7 +278,7 @@ int aml_toddr_set_intrpt(struct toddr *to, unsigned int intrpt)
        reg = calc_toddr_address(EE_AUDIO_TODDR_A_INT_ADDR, reg_base);
        aml_audiobus_write(actrl, reg, intrpt);
        reg = calc_toddr_address(EE_AUDIO_TODDR_A_CTRL0, reg_base);
-       aml_audiobus_update_bits(actrl, reg, 0xff<<16, 4<<16);
+       aml_audiobus_update_bits(actrl, reg, 0xff << 16, 0x34 << 16);
 
        return 0;
 }
@@ -317,7 +316,7 @@ unsigned int aml_toddr_get_addr(struct toddr *to, enum status_sel sel)
        /* reset to default, current write addr */
        aml_audiobus_update_bits(actrl, reg_sel,
                0xf << 8,
-               0x0 << 8);
+               0x2 << 8);
 
        return addr;
 }
@@ -358,13 +357,6 @@ void aml_toddr_select_src(struct toddr *to, enum toddr_src src)
        /* store to check toddr num */
        to->src = src;
 
-       /* check whether loopback enable */
-       if (loopback_check_enable(src)) {
-               loopback_set_status(1);
-               to->is_lb = 1; /* in loopback */
-               src = LOOPBACK_A;
-       }
-
        if (to->chipinfo
                && to->chipinfo->src_sel_ctrl) {
                reg = calc_toddr_address(EE_AUDIO_TODDR_A_CTRL1, reg_base);
@@ -388,17 +380,17 @@ void aml_toddr_set_fifos(struct toddr *to, unsigned int thresh)
        if (to->chipinfo
                        && to->chipinfo->src_sel_ctrl) {
                mask = 0xfff << 12 | 0xf << 8;
-               val = (thresh-1) << 12 | 2 << 8;
+               val = (thresh-2) << 12 | 2 << 8;
        } else {
                mask = 0xff << 16 | 0xf << 8;
-               val = (thresh-1) << 16 | 2 << 8;
+               val = (thresh-2) << 16 | 2 << 8;
        }
 
        aml_audiobus_update_bits(actrl, reg, mask, val);
 
        if (to->chipinfo && to->chipinfo->ugt) {
                reg = calc_toddr_address(EE_AUDIO_TODDR_A_CTRL0, reg_base);
-               aml_audiobus_update_bits(actrl, reg, 0x0 << 0, 0x1 << 0);
+               aml_audiobus_update_bits(actrl, reg, 0x1, 0x1);
        }
 }
 
@@ -448,6 +440,29 @@ void aml_toddr_set_format(struct toddr *to, struct toddr_fmt *fmt)
                fmt->msb << 8 | fmt->lsb << 3);
 }
 
+unsigned int aml_toddr_get_status(struct toddr *to)
+{
+       struct aml_audio_controller *actrl = to->actrl;
+       unsigned int reg_base = to->reg_base;
+       unsigned int reg;
+
+       reg = calc_toddr_address(EE_AUDIO_TODDR_A_STATUS1, reg_base);
+
+       return aml_audiobus_read(actrl, reg);
+}
+
+void aml_toddr_ack_irq(struct toddr *to, int status)
+{
+       struct aml_audio_controller *actrl = to->actrl;
+       unsigned int reg_base = to->reg_base;
+       unsigned int reg;
+
+       reg = calc_toddr_address(EE_AUDIO_TODDR_A_CTRL1, reg_base);
+
+       aml_audiobus_update_bits(actrl, reg, MEMIF_INT_MASK, status);
+       aml_audiobus_update_bits(actrl, reg, MEMIF_INT_MASK, 0);
+}
+
 void aml_toddr_insert_chanum(struct toddr *to)
 {
        struct aml_audio_controller *actrl = to->actrl;
@@ -480,27 +495,62 @@ void aml_toddr_write(struct toddr *to, unsigned int val)
        aml_audiobus_write(actrl, reg, val);
 }
 
-void aml_toddr_set_resample(struct toddr *to, bool enable)
+unsigned int aml_toddr_read1(struct toddr *to)
 {
        struct aml_audio_controller *actrl = to->actrl;
        unsigned int reg_base = to->reg_base;
        unsigned int reg;
 
-       reg = calc_toddr_address(EE_AUDIO_TODDR_A_CTRL0, reg_base);
-       aml_audiobus_update_bits(actrl, reg, 1<<30, enable<<30);
+       reg = calc_toddr_address(EE_AUDIO_TODDR_A_CTRL1, reg_base);
+
+       return aml_audiobus_read(actrl, reg);
 }
 
-void aml_toddr_set_resample_ab(struct toddr *to, int asrc_src_sel, bool enable)
+void aml_toddr_write1(struct toddr *to, unsigned int val)
 {
        struct aml_audio_controller *actrl = to->actrl;
        unsigned int reg_base = to->reg_base;
        unsigned int reg;
 
        reg = calc_toddr_address(EE_AUDIO_TODDR_A_CTRL1, reg_base);
-       if (asrc_src_sel == 0)
-               aml_audiobus_update_bits(actrl, reg, 1 << 27, enable << 27);
-       else
-               aml_audiobus_update_bits(actrl, reg, 1 << 26, enable << 26);
+
+       aml_audiobus_write(actrl, reg, val);
+}
+
+unsigned int aml_toddr_read_status2(struct toddr *to)
+{
+       struct aml_audio_controller *actrl = to->actrl;
+       unsigned int reg_base = to->reg_base;
+       unsigned int reg;
+
+       reg = calc_toddr_address(EE_AUDIO_TODDR_A_STATUS2, reg_base);
+
+       return aml_audiobus_read(actrl, reg);
+}
+
+/* not for tl1 */
+static void aml_toddr_set_resample(struct toddr *to, bool enable)
+{
+       struct aml_audio_controller *actrl = to->actrl;
+       unsigned int reg_base = to->reg_base;
+       unsigned int reg;
+
+       reg = calc_toddr_address(EE_AUDIO_TODDR_A_CTRL0, reg_base);
+       aml_audiobus_update_bits(actrl, reg, 1<<30, !!enable<<30);
+}
+/* tl1 after */
+static void aml_toddr_set_resample_ab(struct toddr *to,
+               enum resample_idx index, bool enable)
+{
+       struct aml_audio_controller *actrl = to->actrl;
+       unsigned int reg_base = to->reg_base;
+       unsigned int reg;
+
+       reg = calc_toddr_address(EE_AUDIO_TODDR_A_CTRL1, reg_base);
+       if (index == RESAMPLE_A)
+               aml_audiobus_update_bits(actrl, reg, 1 << 27, !!enable << 27);
+       else if (index == RESAMPLE_B)
+               aml_audiobus_update_bits(actrl, reg, 1 << 26, !!enable << 26);
 }
 
 static void aml_resample_enable(
@@ -508,12 +558,15 @@ static void aml_resample_enable(
        struct toddr_attach *p_attach_resample,
        bool enable)
 {
-       if (!to)
+       if (!to || !p_attach_resample) {
+               pr_err("%s(), NULL pointer.", __func__);
                return;
+       }
 
        if (to->chipinfo
                        && to->chipinfo->asrc_src_sel_ctrl) {
                /* fix asrc_src_sel */
+               /*
                switch (p_attach_resample->attach_module) {
                case LOOPBACK_A:
                        to->asrc_src_sel = ASRC_LOOPBACK_A;
@@ -525,21 +578,24 @@ static void aml_resample_enable(
                        to->asrc_src_sel = to->fifo_id;
                        break;
                }
+               */
+               to->asrc_src_sel = p_attach_resample->attach_module;
        }
 
        pr_info("toddr %d selects data to %s resample_%c for module:%s\n",
                to->fifo_id,
                enable ? "enable" : "disable",
-               (p_attach_resample->id == 0) ? 'a' : 'b',
+               (p_attach_resample->id == RESAMPLE_A) ? 'a' : 'b',
                toddr_src_get_str(p_attach_resample->attach_module)
                );
 
        if (enable) {
                int bitwidth = to->bitdepth;
                /* channels and bit depth for resample */
+
                if (to->chipinfo
                        && to->chipinfo->asrc_only_left_j
-                       && (to->src == SPDIFIN)
+                       /*&& (to->src == SPDIFIN)*/
                        && (bitwidth == 32)) {
                        struct aml_audio_controller *actrl = to->actrl;
                        unsigned int reg_base = to->reg_base;
@@ -583,13 +639,14 @@ static void aml_resample_enable(
                aml_toddr_set_resample(to, enable);
 }
 
-void aml_set_resample(int id, bool enable, int resample_module)
+void aml_set_resample(enum resample_idx id,
+               bool enable, enum toddr_src resample_module)
 {
        struct toddr_attach *p_attach_resample;
        struct toddr *to;
        bool update_running = false;
 
-       if (id == 0)
+       if (id == RESAMPLE_A)
                p_attach_resample = &attach_resample_a;
        else
                p_attach_resample = &attach_resample_b;
@@ -598,8 +655,13 @@ void aml_set_resample(int id, bool enable, int resample_module)
        p_attach_resample->id            = id;
        p_attach_resample->attach_module = resample_module;
 
+       mutex_lock(&ddr_mutex);
        to = fetch_toddr_by_src(
                p_attach_resample->attach_module);
+       if (to == NULL) {
+               pr_info("%s(), toddr NULL\n", __func__);
+               goto exit;
+       }
 
        if (enable) {
                if ((p_attach_resample->status == DISABLED)
@@ -622,6 +684,9 @@ void aml_set_resample(int id, bool enable, int resample_module)
 
        if (update_running && to)
                aml_resample_enable(to, p_attach_resample, enable);
+
+exit:
+       mutex_unlock(&ddr_mutex);
 }
 
 /*
@@ -811,15 +876,22 @@ static void aml_check_vad(struct toddr *to, bool enable)
 /* from DDRS */
 static struct frddr *register_frddr_l(struct device *dev,
        struct aml_audio_controller *actrl,
-       irq_handler_t handler, void *data)
+       irq_handler_t handler, void *data, bool rvd_dst)
 {
        struct frddr *from;
        unsigned int mask_bit;
        int i, ret;
 
-       /* lookup unused frddr */
        for (i = 0; i < DDRMAX; i++) {
-               if (!frddrs[i].in_use)
+               /* lookup reserved frddr */
+               if (frddrs[i].in_use == false &&
+                       frddrs[i].reserved == true &&
+                       rvd_dst == true)
+                       break;
+               /* lookup unused frddr */
+               if (frddrs[i].in_use == false &&
+                       frddrs[i].reserved == false &&
+                       rvd_dst == false)
                        break;
        }
 
@@ -830,12 +902,13 @@ static struct frddr *register_frddr_l(struct device *dev,
 
        /* enable audio ddr arb */
        mask_bit = i + 4;
-       aml_audiobus_update_bits(actrl, EE_AUDIO_ARB_CTRL,
-                       1<<31|1<<mask_bit, 1<<31|1<<mask_bit);
+       /*aml_audiobus_update_bits(actrl, EE_AUDIO_ARB_CTRL,*/
+       /*              (1 << 31)|(1 << mask_bit),*/
+       /*              (1 << 31)|(1 << mask_bit));*/
 
        /* irqs request */
-       ret = request_irq(from->irq, handler,
-               0, dev_name(dev), data);
+       ret = request_threaded_irq(from->irq, aml_ddr_isr, handler,
+               IRQF_SHARED, dev_name(dev), data);
        if (ret) {
                dev_err(dev, "failed to claim irq %u\n", from->irq);
                return NULL;
@@ -871,13 +944,14 @@ static int unregister_frddr_l(struct device *dev, void *data)
        /* disable audio ddr arb */
        mask_bit = i + 4;
        actrl = from->actrl;
-       aml_audiobus_update_bits(actrl, EE_AUDIO_ARB_CTRL,
-                       1<<mask_bit, 0<<mask_bit);
+       /*aml_audiobus_update_bits(actrl, EE_AUDIO_ARB_CTRL,*/
+       /*              1 << mask_bit, 0 << mask_bit);*/
+
        /* no ddr active, disable arb switch */
        value = aml_audiobus_read(actrl, EE_AUDIO_ARB_CTRL) & 0x77;
-       if (value == 0)
-               aml_audiobus_update_bits(actrl, EE_AUDIO_ARB_CTRL,
-                               1<<31, 0<<31);
+       /*if (value == 0)*/
+       /*      aml_audiobus_update_bits(actrl, EE_AUDIO_ARB_CTRL,*/
+       /*                      1 << 31, 0 << 31);*/
 
        free_irq(from->irq, data);
        from->dev = NULL;
@@ -917,12 +991,12 @@ struct frddr *fetch_frddr_by_src(int frddr_src)
 
 struct frddr *aml_audio_register_frddr(struct device *dev,
        struct aml_audio_controller *actrl,
-       irq_handler_t handler, void *data)
+       irq_handler_t handler, void *data, bool rvd_dst)
 {
        struct frddr *fr = NULL;
 
        mutex_lock(&ddr_mutex);
-       fr = register_frddr_l(dev, actrl, handler, data);
+       fr = register_frddr_l(dev, actrl, handler, data, rvd_dst);
        mutex_unlock(&ddr_mutex);
        return fr;
 }
@@ -1005,11 +1079,6 @@ static void frddr_set_sharebuffer_enable(
                                sel);
                        break;
                }
-               s_m |= 0xff << 24;
-               if (enable)
-                       s_v |= (fr->channels - 1) << 24;
-               else
-                       s_v |= 0x0 << 24;
        } else {
                reg = calc_frddr_address(EE_AUDIO_FRDDR_A_CTRL0,
                                reg_base);
@@ -1141,10 +1210,6 @@ void aml_frddr_enable(struct frddr *fr, bool enable)
                        aml_audiobus_write(actrl, reg, 0x0);
                }
        }
-
-       /* check for Audio EQ/DRC */
-       if (aml_check_aed_module(fr->dest))
-               aml_check_aed(enable, fr->dest);
 }
 
 void aml_frddr_select_dst(struct frddr *fr, enum frddr_dest dst)
@@ -1159,6 +1224,9 @@ void aml_frddr_select_dst(struct frddr *fr, enum frddr_dest dst)
                && fr->chipinfo->src_sel_ctrl) {
                reg = calc_frddr_address(EE_AUDIO_FRDDR_A_CTRL2, reg_base);
                src_sel_en = 4;
+               /*update frddr channel*/
+               aml_audiobus_update_bits(actrl, reg,
+                       0xff << 24, (fr->channels - 1) << 24);
        } else {
                reg = calc_frddr_address(EE_AUDIO_FRDDR_A_CTRL0, reg_base);
                src_sel_en = 3;
@@ -1193,9 +1261,10 @@ void aml_frddr_select_dst_ss(struct frddr *fr,
        /* same source en */
        if (fr->chipinfo
                && fr->chipinfo->same_src_fn
-               && ss_valid
-       )
-               frddr_set_sharebuffer_enable(fr, dst, sel, enable);
+               && ss_valid) {
+               frddr_set_sharebuffer_enable(fr,
+                       dst, sel, enable);
+       }
 }
 
 void aml_frddr_set_fifos(struct frddr *fr,
@@ -1211,8 +1280,8 @@ void aml_frddr_set_fifos(struct frddr *fr,
                        (depth - 1)<<24 | (thresh - 1)<<16 | 2<<8);
 
        if (fr->chipinfo && fr->chipinfo->ugt) {
-               reg = calc_toddr_address(EE_AUDIO_FRDDR_A_CTRL0, reg_base);
-               aml_audiobus_update_bits(actrl, reg, 0x0 << 0, 0x1 << 0);
+               reg = calc_frddr_address(EE_AUDIO_FRDDR_A_CTRL0, reg_base);
+               aml_audiobus_update_bits(actrl, reg, 0x1, 0x1);
        }
 }
 
@@ -1241,12 +1310,18 @@ static void aml_aed_enable(struct frddr_attach *p_attach_aed, bool enable)
                unsigned int reg;
 
                reg = calc_frddr_address(EE_AUDIO_FRDDR_A_CTRL2, reg_base);
-               aml_audiobus_update_bits(actrl,
-                       reg, 0x1 << 3, enable << 3);
-
-               aed_set_ctrl(enable, 0, p_attach_aed->attach_module);
-               aed_set_format(fr->msb, fr->type, fr->fifo_id);
-               aed_enable(enable);
+               if (enable) {
+                       aml_audiobus_update_bits(actrl,
+                               reg, 0x1 << 3, enable << 3);
+                       aed_set_ctrl(enable, 0, p_attach_aed->attach_module);
+                       aed_set_format(fr->msb, fr->type, fr->fifo_id);
+                       aed_enable(enable);
+               } else {
+                       aed_enable(enable);
+                       aed_set_ctrl(enable, 0, p_attach_aed->attach_module);
+                       aml_audiobus_update_bits(actrl,
+                               reg, 0x1 << 3, enable << 3);
+               }
        } else {
                if (enable) {
                        /* frddr type and bit depth for AED */
@@ -1256,66 +1331,98 @@ static void aml_aed_enable(struct frddr_attach *p_attach_aed, bool enable)
        }
 }
 
-void aml_set_aed(bool enable, int aed_module)
+static bool aml_check_aed_module(int dst)
 {
-       bool update_running = false;
-
-       /* when try to enable AED, if frddr is not in used,
-        * set AED status as ready
-        */
-       attach_aed.enable = enable;
-       attach_aed.attach_module = aed_module;
+       bool is_module_aed = false;
 
-       if (enable) {
-               if ((attach_aed.status == DISABLED)
-                       || (attach_aed.status == READY)) {
-                       struct frddr *fr = fetch_frddr_by_src(aed_module);
+       if (attach_aed.enable
+               && (dst == attach_aed.attach_module))
+               is_module_aed = true;
 
-                       if (!fr) {
-                               attach_aed.status = READY;
-                       } else {
-                               attach_aed.status = RUNNING;
-                               update_running = true;
-                               pr_info("Playback with AED\n");
-                       }
-               }
-       } else {
-               if (attach_aed.status == RUNNING)
-                       update_running = true;
+       return is_module_aed;
+}
 
-               attach_aed.status = DISABLED;
-       }
+void aml_set_aed(bool enable, int aed_module)
+{
+       attach_aed.enable = enable;
+       attach_aed.attach_module = aed_module;
+}
 
-       if (update_running)
+void aml_aed_top_enable(struct frddr *fr, bool enable)
+{
+       if (aml_check_aed_module(fr->dest))
                aml_aed_enable(&attach_aed, enable);
 }
 
-static bool aml_check_aed_module(int dst)
+void aml_aed_set_frddr_reserved(void)
 {
-       bool is_module_aed = false;
+       frddrs[DDR_A].reserved = true;
+}
 
-       if (attach_aed.enable
-               && (dst == attach_aed.attach_module))
-               is_module_aed = true;
+void aml_frddr_check(struct frddr *fr)
+{
+       unsigned int tmp, tmp1, i = 0;
+       struct aml_audio_controller *actrl = fr->actrl;
+       unsigned int reg_base = fr->reg_base;
+       unsigned int reg;
 
-       return is_module_aed;
+       /*max 200us delay*/
+       for (i = 0; i < 200; i++) {
+               reg = calc_frddr_address(EE_AUDIO_FRDDR_A_CTRL1, reg_base);
+               aml_audiobus_update_bits(actrl, reg, 0xf << 8, 0x0 << 8);
+               reg = calc_frddr_address(EE_AUDIO_FRDDR_A_STATUS2, reg_base);
+               tmp = aml_audiobus_read(actrl, reg);
+
+               reg = calc_frddr_address(EE_AUDIO_FRDDR_A_CTRL1, reg_base);
+               aml_audiobus_update_bits(actrl, reg, 0xf << 8, 0x2 << 8);
+               reg = calc_frddr_address(EE_AUDIO_FRDDR_A_STATUS2, reg_base);
+               tmp1 = aml_audiobus_read(actrl, reg);
+
+               if (tmp == tmp1)
+                       return;
+
+               udelay(1);
+               pr_debug("delay:[%dus]; FRDDR_STATUS2: [0x%x] [0x%x]\n",
+                       i, tmp, tmp1);
+       }
+       pr_err("Error: 200us time out, FRDDR_STATUS2: [0x%x] [0x%x]\n",
+                               tmp, tmp1);
+       return;
 }
 
-static void aml_check_aed(bool enable, int dst)
+void aml_frddr_reset(struct frddr *fr, int offset)
 {
-       /* check effect module is sync with crruent frddr dst */
-       if (attach_aed.attach_module != dst)
+       unsigned int reg = 0, val = 0;
+
+       if (fr == NULL) {
+               pr_err("%s(), frddr NULL pointer\n", __func__);
                return;
+       }
 
-       /* AED in enable */
-       if (attach_aed.enable) {
-               if (enable)
-                       attach_aed.status = RUNNING;
-               else
-                       attach_aed.status = DISABLED;
+       if ((offset != 0) && (offset != 1)) {
+               pr_err("%s(), invalid offset = %d\n", __func__, offset);
+               return;
+       }
 
-               aml_aed_enable(&attach_aed, enable);
+       if (fr->fifo_id == 0) {
+               reg = EE_AUDIO_SW_RESET0(offset);
+               val = REG_BIT_RESET_FRDDRA;
+       } else if (fr->fifo_id == 1) {
+               reg = EE_AUDIO_SW_RESET0(offset);
+               val = REG_BIT_RESET_FRDDRB;
+       } else if (fr->fifo_id == 2) {
+               reg = EE_AUDIO_SW_RESET0(offset);
+               val = REG_BIT_RESET_FRDDRC;
+       } else if (fr->fifo_id == 3) {
+               reg = EE_AUDIO_SW_RESET1;
+               val = REG_BIT_RESET_FRDDRD;
+       } else {
+               pr_err("invalid frddr id %d\n", fr->fifo_id);
+               return;
        }
+
+       audiobus_update_bits(reg, val, val);
+       audiobus_update_bits(reg, val, 0);
 }
 
 void frddr_init_without_mngr(unsigned int frddr_index, unsigned int src0_sel)
@@ -1370,13 +1477,13 @@ void frddr_deinit_without_mngr(unsigned int frddr_index)
        audiobus_write(reg, 0x0);
 }
 
-static int toddr_src_idx = -1;
+static enum toddr_src toddr_src_idx = TODDR_INVAL;
 
 static const char *const toddr_src_sel_texts[] = {
        "TDMIN_A", "TDMIN_B", "TDMIN_C", "SPDIFIN",
        "PDMIN", "FRATV", "TDMIN_LB", "LOOPBACK_A",
        "FRHDMIRX", "LOOPBACK_B", "SPDIFIN_LB",
-       "EARCRX_DMAC", "RESERVED", "RESERVED", "RESERVED",
+       "EARCRX_DMAC", "RESERVED_0", "RESERVED_1", "RESERVED_2",
        "VAD"
 };
 
@@ -1384,14 +1491,14 @@ static const struct soc_enum toddr_input_source_enum =
        SOC_ENUM_SINGLE(SND_SOC_NOPM, 0, ARRAY_SIZE(toddr_src_sel_texts),
                toddr_src_sel_texts);
 
-int toddr_src_get(void)
+enum toddr_src toddr_src_get(void)
 {
        return toddr_src_idx;
 }
 
-const char *toddr_src_get_str(int idx)
+const char *toddr_src_get_str(enum toddr_src idx)
 {
-       if (idx < 0 || idx > 15)
+       if (idx < TDMIN_A || idx > VAD)
                return NULL;
 
        return toddr_src_sel_texts[idx];
@@ -1409,6 +1516,8 @@ static int toddr_src_enum_set(struct snd_kcontrol *kcontrol,
        struct snd_ctl_elem_value *ucontrol)
 {
        toddr_src_idx = ucontrol->value.enumerated.item[0];
+       /* also update to resample src */
+       //set_resample_source(toddr_src_idx);
 
        return 0;
 }
index cfb92ee..c9e2203 100644 (file)
 #include <sound/soc.h>
 #include "audio_io.h"
 
+#define MEMIF_INT_ADDR_FINISH       BIT(0)
+#define MEMIF_INT_ADDR_INT          BIT(1)
+#define MEMIF_INT_COUNT_REPEAT      BIT(2)
+#define MEMIF_INT_COUNT_ONCE        BIT(3)
+#define MEMIF_INT_FIFO_ZERO         BIT(4)
+#define MEMIF_INT_FIFO_DEPTH        BIT(5)
+#define MEMIF_INT_MASK              GENMASK(7, 0)
+
 enum ddr_num {
        DDR_A,
        DDR_B,
@@ -42,19 +50,29 @@ enum ddr_types {
  * from tl1, add new source FRATV, FRHDMIRX, LOOPBACK_B, SPDIFIN_LB, VAD
  */
 enum toddr_src {
-       TDMIN_A,
-       TDMIN_B,
-       TDMIN_C,
-       SPDIFIN,
-       PDMIN,
-       FRATV, /* NONE for axg, g12a, g12b */
-       TDMIN_LB,
-       LOOPBACK_A,
-       FRHDMIRX, /* from tl1 chipset*/
-       LOOPBACK_B,
-       SPDIFIN_LB,
-       EARCRX_DMAC, /* from sm1 chipset */
-       VAD,
+       TODDR_INVAL = -1,
+       TDMIN_A = 0,
+       TDMIN_B = 1,
+       TDMIN_C = 2,
+       SPDIFIN = 3,
+       PDMIN = 4,
+       FRATV = 5, /* NONE for axg, g12a, g12b */
+       TDMIN_LB = 6,
+       LOOPBACK_A = 7,
+       FRHDMIRX = 8, /* from tl1 chipset*/
+       LOOPBACK_B = 9,
+       SPDIFIN_LB = 10,
+       EARCRX_DMAC = 11,/* from sm1 chipset */
+       RESERVED_0 = 12,
+       RESERVED_1 = 13,
+       RESERVED_2 = 14,
+       VAD = 15,
+       TODDR_SRC_MAX = 16
+};
+
+enum resample_idx {
+       RESAMPLE_A,
+       RESAMPLE_B
 };
 
 enum resample_src {
@@ -94,27 +112,6 @@ struct toddr_fmt {
        unsigned int rate;
 };
 
-#if 0
-struct ddr_desc {
-       /* start address of DDR */
-       unsigned int start;
-       /* finish address of DDR */
-       unsigned int finish;
-       /* interrupt address or counts of DDR blocks */
-       unsigned int intrpt;
-       /* fifo total counts */
-       unsigned int fifo_depth;
-       /* fifo start threshold */
-       unsigned int fifo_thr;
-       enum ddr_types data_type;
-       unsigned int edian;
-       unsigned int pp_mode;
-       //unsigned int reg_base;
-       struct clk *ddr;
-       struct clk *ddr_arb;
-};
-#endif
-
 struct ddr_chipinfo {
        /* INT and Start address is same or separated */
        bool int_start_same_addr;
@@ -160,7 +157,6 @@ struct ddr_chipinfo {
 };
 
 struct toddr {
-       //struct ddr_desc dscrpt;
        struct device *dev;
        unsigned int resample: 1;
        unsigned int ext_signed: 1;
@@ -177,7 +173,7 @@ struct toddr {
        enum toddr_src src;
        unsigned int fifo_id;
 
-       unsigned int asrc_src_sel;
+       enum toddr_src asrc_src_sel;
 
        int is_lb; /* check whether for loopback */
        int irq;
@@ -194,7 +190,7 @@ enum status {
 
 struct toddr_attach {
        bool enable;
-       int id;
+       enum resample_idx id;
        int status;
        /* which module should be attached,
         * check which toddr in use should be attached
@@ -212,7 +208,6 @@ struct frddr_attach {
 };
 
 struct frddr {
-       //struct ddr_desc dscrpt;
        struct device *dev;
        enum frddr_dest dest;
 
@@ -231,10 +226,11 @@ struct frddr {
        int irq;
        bool in_use;
        struct ddr_chipinfo *chipinfo;
+
+       bool reserved;
 };
 
 /* to ddrs */
-int fetch_toddr_index_by_src(int toddr_src);
 struct toddr *fetch_toddr_by_src(int toddr_src);
 struct toddr *aml_audio_register_toddr(struct device *dev,
                struct aml_audio_controller *actrl,
@@ -254,24 +250,31 @@ void aml_toddr_set_fifos(struct toddr *to, unsigned int thresh);
 void aml_toddr_update_fifos_rd_th(struct toddr *to, int th);
 void aml_toddr_force_finish(struct toddr *to);
 void aml_toddr_set_format(struct toddr *to, struct toddr_fmt *fmt);
+
+unsigned int aml_toddr_get_status(struct toddr *to);
+void aml_toddr_ack_irq(struct toddr *to, int status);
+
 void aml_toddr_insert_chanum(struct toddr *to);
 unsigned int aml_toddr_read(struct toddr *to);
 void aml_toddr_write(struct toddr *to, unsigned int val);
+unsigned int aml_toddr_read1(struct toddr *to);
+void aml_toddr_write1(struct toddr *to, unsigned int val);
+unsigned int aml_toddr_read_status2(struct toddr *to);
 
 /* resample */
-void aml_set_resample(int id, bool enable, int resample_module);
+void aml_set_resample(enum resample_idx id,
+               bool enable, enum toddr_src resample_module);
 /* power detect */
 void aml_pwrdet_enable(bool enable, int pwrdet_module);
 /* Voice Activity Detection */
 void aml_set_vad(bool enable, int module);
 
 /* from ddrs */
-int fetch_frddr_index_by_src(int frddr_src);
 struct frddr *fetch_frddr_by_src(int frddr_src);
 
 struct frddr *aml_audio_register_frddr(struct device *dev,
                struct aml_audio_controller *actrl,
-               irq_handler_t handler, void *data);
+               irq_handler_t handler, void *data, bool rvd_dst);
 int aml_audio_unregister_frddr(struct device *dev, void *data);
 int aml_frddr_set_buf(struct frddr *fr, unsigned int start,
                        unsigned int end);
@@ -291,14 +294,18 @@ void aml_frddr_set_format(struct frddr *fr,
        unsigned int chnum,
        unsigned int msb,
        unsigned int frddr_type);
+
+void aml_frddr_reset(struct frddr *fr, int offset);
+
 /* audio eq drc */
 void aml_set_aed(bool enable, int aed_module);
+void aml_aed_top_enable(struct frddr *fr, bool enable);
 
 void frddr_init_without_mngr(unsigned int frddr_index, unsigned int src0_sel);
 void frddr_deinit_without_mngr(unsigned int frddr_index);
 
-int toddr_src_get(void);
-const char *toddr_src_get_str(int idx);
+enum toddr_src toddr_src_get(void);
+const char *toddr_src_get_str(enum toddr_src idx);
 int frddr_src_get(void);
 const char *frddr_src_get_str(int idx);
 
@@ -307,5 +314,8 @@ int card_add_ddr_kcontrols(struct snd_soc_card *card);
 void pm_audio_set_suspend(bool is_suspend);
 bool pm_audio_is_suspend(void);
 
+void aml_frddr_check(struct frddr *fr);
+void aml_aed_set_frddr_reserved(void);
+
 #endif
 
index 355e7db..c284417 100644 (file)
@@ -144,7 +144,7 @@ static int earc_open(struct snd_pcm_substream *substream)
        if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
                p_earc->fddr = aml_audio_register_frddr(dev,
                        p_earc->actrl,
-                       earc_ddr_isr, substream);
+                       earc_ddr_isr, substream, false);
                if (p_earc->fddr == NULL) {
                        dev_err(dev, "failed to claim from ddr\n");
                        return -ENXIO;
@@ -625,6 +625,9 @@ static const struct of_device_id earc_device_id[] = {
        {
                .compatible = "amlogic, sm1-snd-earc",
        },
+       {
+               .compatible = "amlogic, tm2-snd-earc",
+       },
        {},
 };
 
@@ -664,7 +667,7 @@ static int earc_platform_probe(struct platform_device *pdev)
        if (IS_ERR(p_earc->clk_rx_gate)) {
                dev_err(&pdev->dev,
                        "Can't get earc gate\n");
-               return PTR_ERR(p_earc->clk_rx_gate);
+               /*return PTR_ERR(p_earc->clk_rx_gate);*/
        }
        /* RX */
        p_earc->clk_rx_cmdc = devm_clk_get(&pdev->dev, "rx_cmdc");
index b5db9d6..fcf3ce2 100644 (file)
@@ -280,19 +280,26 @@ void aed_set_format(int msb, enum ddr_types frddr_type, enum ddr_num source)
 
 void aed_enable(bool enable)
 {
+       /*don't change this flow*/
        if (enable) {
                eqdrc_write(AED_ED_CNTL, 0x1);
-               eqdrc_write(AED_ED_CNTL, 0x0);
-
-               eqdrc_update_bits(AED_TOP_CTL, 0x1 << 1, 0x1 << 1);
-               eqdrc_update_bits(AED_TOP_CTL, 0x1 << 2, 0x1 << 2);
-       } else
-               eqdrc_update_bits(AED_TOP_CTL, 0x3 << 1, 0x0 << 1);
-
-       eqdrc_update_bits(AED_TOP_CTL, 0x1 << 0, enable << 0);
+               eqdrc_write(AED_ED_CNTL, 0x1);
 
-       /* start en */
-       if (enable)
+               eqdrc_update_bits(AED_TOP_CTL, 0x3 << 1, 0x3 << 1);
+               eqdrc_update_bits(AED_TOP_CTL, 0x1 << 0, 0x1 << 0);
                eqdrc_update_bits(AED_TOP_CTL, 0x1 << 31, 0x1 << 31);
+       } else {
+               eqdrc_update_bits(AED_TOP_CTL, 0x1 << 0, 0x0 << 0);
+               eqdrc_write(AED_ED_CNTL, 0x1);
+               eqdrc_write(AED_ED_CNTL, 0x1);
+               eqdrc_update_bits(AED_TOP_CTL, 0x3 << 1, 0x0 << 1);
+       }
 }
 
+void aed_module_reset(int offset)
+{
+       audiobus_update_bits(EE_AUDIO_SW_RESET0(offset),
+               REG_BIT_RESET_EQDRC, REG_BIT_RESET_EQDRC);
+       audiobus_update_bits(EE_AUDIO_SW_RESET0(offset),
+               REG_BIT_RESET_EQDRC, 0);
+}
index cfa8e0f..b7e65c5 100644 (file)
@@ -40,5 +40,6 @@ void aed_set_mixer_params(void);
 void aed_eq_taps(unsigned int eq1_taps);
 void aed_set_multiband_drc_param(void);
 void aed_set_fullband_drc_param(int tap);
+void aed_module_reset(int offset);
 
 #endif
index 86a696b..d03f846 100644 (file)
@@ -51,6 +51,7 @@ struct effect_chipinfo {
         * v2 is for tl1
         */
        bool v2;
+       bool reserved_frddr;
 };
 
 struct audioeffect {
@@ -65,12 +66,6 @@ struct audioeffect {
 
        struct effect_chipinfo *chipinfo;
 
-       bool dc_en;
-       bool nd_en;
-       bool eq_en;
-       bool multiband_drc_en;
-       bool fullband_drc_en;
-
        int lane_mask;
        int ch_mask;
 
@@ -90,6 +85,16 @@ static struct audioeffect *get_audioeffects(void)
        return s_effect;
 }
 
+int get_aed_dst(void)
+{
+       struct audioeffect *p_effect = get_audioeffects();
+
+       if (!p_effect)
+               return -1;
+       else
+               return p_effect->effect_module;
+}
+
 bool check_aed_v2(void)
 {
        struct audioeffect *p_effect = get_audioeffects();
@@ -411,52 +416,6 @@ static int mixer_set_fullband_DRC_params(struct snd_kcontrol *kcontrol,
        return 0;
 }
 
-/* aed module
- * check to sync with enum frddr_dest in ddr_mngr.h
- */
-static const char *const aed_module_texts[] = {
-       "TDMOUT_A",
-       "TDMOUT_B",
-       "TDMOUT_C",
-       "SPDIFOUT_A",
-       "SPDIFOUT_B",
-};
-
-static const struct soc_enum aed_module_enum =
-       SOC_ENUM_SINGLE(SND_SOC_NOPM, 0, ARRAY_SIZE(aed_module_texts),
-                       aed_module_texts);
-
-static int aed_module_get_enum(
-       struct snd_kcontrol *kcontrol,
-       struct snd_ctl_elem_value *ucontrol)
-{
-       struct audioeffect *p_effect =  snd_kcontrol_chip(kcontrol);
-
-       if (!p_effect)
-               return -EINVAL;
-
-       ucontrol->value.enumerated.item[0] = p_effect->effect_module;
-
-       return 0;
-}
-
-static int aed_module_set_enum(
-       struct snd_kcontrol *kcontrol,
-       struct snd_ctl_elem_value *ucontrol)
-{
-       struct audioeffect *p_effect =  snd_kcontrol_chip(kcontrol);
-
-       if (!p_effect)
-               return -EINVAL;
-
-       p_effect->effect_module = ucontrol->value.enumerated.item[0];
-
-       /* update info to ddr and modules */
-       aml_set_aed(1, p_effect->effect_module);
-
-       return 0;
-}
-
 static void aed_set_filter_data(void)
 {
        int *p;
@@ -534,11 +493,6 @@ static const struct snd_kcontrol_new snd_effect_controls[] = {
                mixer_get_fullband_DRC_params,
                mixer_set_fullband_DRC_params),
 
-       SOC_ENUM_EXT("AED module",
-               aed_module_enum,
-               aed_module_get_enum,
-               aed_module_set_enum),
-
        SOC_SINGLE_EXT_TLV("AED Lch volume",
                AED_EQ_VOLUME, 0, 0xFF, 1,
                mixer_aed_read, mixer_aed_write,
@@ -578,6 +532,7 @@ int card_add_effect_v2_kcontrols(struct snd_soc_card *card)
 
 static struct effect_chipinfo tl1_effect_chipinfo = {
        .v2 = true,
+       .reserved_frddr = true,
 };
 
 static const struct of_device_id effect_device_id[] = {
@@ -601,9 +556,6 @@ static int effect_platform_probe(struct platform_device *pdev)
        struct audioeffect *p_effect;
        struct device *dev = &pdev->dev;
        struct effect_chipinfo *p_chipinfo;
-       bool eq_enable = false;
-       bool multiband_drc_enable = false;
-       bool fullband_drc_enable = false;
        int lane_mask = -1, channel_mask = -1, eqdrc_module = -1;
        int ret;
 
@@ -694,9 +646,6 @@ static int effect_platform_probe(struct platform_device *pdev)
                );
 
        /* config from dts */
-       p_effect->eq_en            = eq_enable;
-       p_effect->multiband_drc_en = multiband_drc_enable;
-       p_effect->fullband_drc_en  = fullband_drc_enable;
        p_effect->lane_mask        = lane_mask;
        p_effect->ch_mask          = channel_mask;
        p_effect->effect_module    = eqdrc_module;
@@ -724,6 +673,11 @@ static int effect_platform_probe(struct platform_device *pdev)
        s_effect = p_effect;
        dev_set_drvdata(&pdev->dev, p_effect);
 
+       if (p_effect->chipinfo &&
+               p_effect->chipinfo->reserved_frddr) {
+               aml_aed_set_frddr_reserved();
+       }
+
        return 0;
 }
 
index 9c5051a..30576b7 100644 (file)
@@ -19,5 +19,6 @@
 
 extern bool check_aed_v2(void);
 extern int card_add_effect_v2_kcontrols(struct snd_soc_card *card);
+extern int get_aed_dst(void);
 
 #endif
index 712c6aa..e90909d 100644 (file)
@@ -17,6 +17,8 @@
  * such as fratv, frhdmirx
  */
 
+/*#define DEBUG*/
+
 #include <linux/module.h>
 #include <linux/moduleparam.h>
 #include <linux/platform_device.h>
@@ -37,6 +39,7 @@
 #include "ddr_mngr.h"
 #include "audio_utils.h"
 #include "frhdmirx_hw.h"
+#include "resample.h"
 
 #include <linux/amlogic/media/sound/misc.h>
 
@@ -133,6 +136,17 @@ static irqreturn_t extn_ddr_isr(int irq, void *devid)
        struct snd_soc_pcm_runtime *rtd = substream->private_data;
        struct device *dev = rtd->platform->dev;
        struct extn *p_extn = (struct extn *)dev_get_drvdata(dev);
+       int timeout_thres = 5;
+
+#ifdef CONFIG_AMLOGIC_MEDIA_TVIN_HDMI
+       int sample_rate_index = get_hdmi_sample_rate_index();
+
+       /*192K audio*/
+       if (sample_rate_index == 7)
+               timeout_thres = 10;
+       else
+               timeout_thres = 5;
+#endif
 
        if (!snd_pcm_running(substream))
                return IRQ_HANDLED;
@@ -147,7 +161,7 @@ static irqreturn_t extn_ddr_isr(int irq, void *devid)
 
                        p_extn->frhdmirx_same_cnt++;
 
-                       if (p_extn->frhdmirx_same_cnt > 5)
+                       if (p_extn->frhdmirx_same_cnt > timeout_thres)
                                frhdmirx_nonpcm2pcm_clr_reset(p_extn);
 
                        if (p_extn->frhdmirx_cnt == 0)
@@ -190,7 +204,7 @@ static int extn_open(struct snd_pcm_substream *substream)
        if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
                p_extn->fddr = aml_audio_register_frddr(dev,
                        p_extn->actrl,
-                       extn_ddr_isr, substream);
+                       extn_ddr_isr, substream, false);
                if (p_extn->fddr == NULL) {
                        dev_err(dev, "failed to claim from ddr\n");
                        return -ENXIO;
@@ -371,6 +385,9 @@ static int extn_dai_startup(
        struct snd_pcm_substream *substream,
        struct snd_soc_dai *cpu_dai)
 {
+       if (get_audioresample(RESAMPLE_A))
+               resample_set_inner_rate(RESAMPLE_A);
+
        return 0;
 }
 
@@ -378,6 +395,7 @@ static void extn_dai_shutdown(
        struct snd_pcm_substream *substream,
        struct snd_soc_dai *cpu_dai)
 {
+       //resample_set(RESAMPLE_A, RATE_OFF);
 }
 
 static int extn_dai_prepare(
@@ -401,7 +419,7 @@ static int extn_dai_prepare(
        } else {
                struct toddr *to = p_extn->tddr;
                unsigned int msb = 0, lsb = 0, toddr_type = 0;
-               unsigned int src = toddr_src_get();
+               enum toddr_src src = toddr_src_get();
                struct toddr_fmt fmt;
 
                if (bit_depth == 24)
@@ -472,7 +490,7 @@ static int extn_dai_trigger(struct snd_pcm_substream *substream, int cmd,
                               struct snd_soc_dai *cpu_dai)
 {
        struct extn *p_extn = snd_soc_dai_get_drvdata(cpu_dai);
-       unsigned int src = toddr_src_get();
+       enum toddr_src src = toddr_src_get();
 
        switch (cmd) {
        case SNDRV_PCM_TRIGGER_START:
index e196591..3ee30b7 100644 (file)
  *
  */
 
+/*#define DEBUG*/
+
 #include <linux/of.h>
 #include <linux/io.h>
 #include <linux/of_address.h>
 #include <linux/platform_device.h>
 
 #include "iomap.h"
+#include "audio_aed_reg_list.h"
+#include "audio_top_reg_list.h"
 
 #define DEV_NAME       "auge_snd_iomap"
 
 static void __iomem *aml_snd_reg_map[IO_MAX];
 
+#ifdef DEBUG
+static void register_debug(u32 base_type, unsigned int reg, unsigned int val)
+{
+       if (base_type == IO_AUDIO_BUS) {
+               pr_debug("audio top reg:[%s] addr: [%#x] val: [%#x]\n",
+                       top_register_table[reg].name,
+                       top_register_table[reg].addr, val);
+       } else if (base_type == IO_EQDRC_BUS) {
+               pr_debug("audio aed reg:[%s] addr: [%#x] val: [%#x]\n",
+                       aed_register_table[reg].name,
+                       aed_register_table[reg].addr, val);
+       }
+}
+#endif
 
 static int aml_snd_read(u32 base_type, unsigned int reg, unsigned int *val)
 {
@@ -43,7 +61,9 @@ static void aml_snd_write(u32 base_type, unsigned int reg, unsigned int val)
 
        if (base_type < IO_MAX) {
                writel(val, (aml_snd_reg_map[base_type] + (reg << 2)));
-
+#ifdef DEBUG
+               register_debug(base_type, reg, val);
+#endif
                return;
        }
 
diff --git a/sound/soc/amlogic/auge/loopback.c b/sound/soc/amlogic/auge/loopback.c
new file mode 100644 (file)
index 0000000..95178bd
--- /dev/null
@@ -0,0 +1,1433 @@
+/*
+ * sound/soc/amlogic/auge/loopback.c
+ *
+ * Copyright (C) 2018 Amlogic, Inc. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ *
+ */
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/of.h>
+#include <linux/of_device.h>
+#include <linux/platform_device.h>
+#include <linux/clk.h>
+
+#include <sound/pcm_params.h>
+
+#include "loopback.h"
+#include "loopback_hw.h"
+#include "loopback_match_table.c"
+#include "ddr_mngr.h"
+#include "tdm_hw.h"
+#include "pdm_hw.h"
+
+#define DRV_NAME "loopback"
+
+/*#define __PTM_PDM_CLK__*/
+/*#define __PTM_TDM_CLK__*/
+
+struct loopback {
+       struct device *dev;
+       struct aml_audio_controller *actrl;
+       unsigned int id;
+
+       /*
+        * datain
+        */
+
+       /* PDM clocks */
+       struct clk *pdm_clk_gate;
+       struct clk *pdm_sysclk_srcpll;
+       struct clk *pdm_dclk_srcpll;
+       struct clk *pdm_sysclk;
+       struct clk *pdm_dclk;
+       unsigned int dclk_idx;
+       /* TDM clocks */
+       struct clk *tdmin_mpll;
+       struct clk *tdmin_mclk;
+
+       /* datain info */
+       enum datain_src datain_src;
+       unsigned int datain_chnum;
+       unsigned int datain_chmask;
+       unsigned int datain_lane_mask; /* related with data lane */
+
+       /*
+        * datalb
+        */
+
+       /* TDMIN_LB clocks */
+       struct clk *tdminlb_mpll;
+       struct clk *tdminlb_mclk;
+       unsigned int mclk_fs_ratio;
+
+       /* datalb info */
+       enum datalb_src datalb_src;
+       unsigned int datalb_chnum;
+       unsigned int datalb_chmask;
+       unsigned int datalb_lane_mask; /* related with data lane */
+
+       unsigned int sysclk_freq;
+
+       struct toddr *tddr;
+
+       struct loopback_chipinfo *chipinfo;
+};
+
+#define LOOPBACK_RATES      (SNDRV_PCM_RATE_8000_192000)
+#define LOOPBACK_FORMATS    (SNDRV_PCM_FMTBIT_S16_LE |\
+                                               SNDRV_PCM_FMTBIT_S24_LE |\
+                                               SNDRV_PCM_FMTBIT_S32_LE)
+
+static const struct snd_pcm_hardware loopback_hardware = {
+       .info =
+               SNDRV_PCM_INFO_MMAP |
+               SNDRV_PCM_INFO_MMAP_VALID |
+               SNDRV_PCM_INFO_INTERLEAVED |
+               SNDRV_PCM_INFO_BLOCK_TRANSFER |
+               SNDRV_PCM_INFO_PAUSE,
+
+       .formats = LOOPBACK_FORMATS,
+
+       .period_bytes_max = 256 * 64,
+       .buffer_bytes_max = 512 * 1024,
+       .period_bytes_min = 64,
+       .periods_min = 1,
+       .periods_max = 1024,
+
+       .rate_min = 8000,
+       .rate_max = 192000,
+       .channels_min = 1,
+       .channels_max = 32,
+};
+
+static irqreturn_t loopback_ddr_isr(int irq, void *data)
+{
+       struct snd_pcm_substream *ss = (struct snd_pcm_substream *)data;
+       struct snd_soc_pcm_runtime *rtd = ss->private_data;
+       struct device *dev = rtd->platform->dev;
+       struct loopback *p_loopback = (struct loopback *)dev_get_drvdata(dev);
+       unsigned int status;
+
+       if (!snd_pcm_running(ss))
+               return IRQ_NONE;
+
+       status = aml_toddr_get_status(p_loopback->tddr) & MEMIF_INT_MASK;
+       if (status & MEMIF_INT_COUNT_REPEAT) {
+               snd_pcm_period_elapsed(ss);
+
+               aml_toddr_ack_irq(p_loopback->tddr, MEMIF_INT_COUNT_REPEAT);
+       } else
+               dev_dbg(dev, "unexpected irq - STS 0x%02x\n",
+                       status);
+
+       return !status ? IRQ_NONE : IRQ_HANDLED;
+}
+
+static int loopback_open(struct snd_pcm_substream *ss)
+{
+       struct snd_pcm_runtime *runtime = ss->runtime;
+       struct snd_soc_pcm_runtime *rtd = ss->private_data;
+       struct device *dev = rtd->platform->dev;
+       struct loopback *p_loopback = (struct loopback *)dev_get_drvdata(dev);
+
+       snd_soc_set_runtime_hwparams(ss, &loopback_hardware);
+
+       if (ss->stream == SNDRV_PCM_STREAM_CAPTURE) {
+               p_loopback->tddr = aml_audio_register_toddr(dev,
+                       p_loopback->actrl,
+                       loopback_ddr_isr, ss);
+               if (p_loopback->tddr == NULL) {
+                       dev_err(dev, "failed to claim to ddr\n");
+                       return -ENXIO;
+               }
+       }
+
+       runtime->private_data = p_loopback;
+
+       return 0;
+}
+
+static int loopback_close(struct snd_pcm_substream *ss)
+{
+       struct snd_pcm_runtime *runtime = ss->runtime;
+       struct loopback *p_loopback = runtime->private_data;
+
+       if (ss->stream == SNDRV_PCM_STREAM_CAPTURE)
+               aml_audio_unregister_toddr(p_loopback->dev, ss);
+
+       runtime->private_data = NULL;
+
+       return 0;
+}
+
+static int loopback_hw_params(
+       struct snd_pcm_substream *ss,
+        struct snd_pcm_hw_params *hw_params)
+{
+       return snd_pcm_lib_malloc_pages(ss, params_buffer_bytes(hw_params));
+}
+
+static int loopback_hw_free(struct snd_pcm_substream *ss)
+{
+       snd_pcm_lib_free_pages(ss);
+
+       return 0;
+}
+
+static int loopback_trigger(
+       struct snd_pcm_substream *ss,
+       int cmd)
+{
+       return 0;
+}
+
+static int loopback_prepare(struct snd_pcm_substream *ss)
+{
+       struct snd_pcm_runtime *runtime = ss->runtime;
+       struct loopback *p_loopback = runtime->private_data;
+       unsigned int start_addr, end_addr, int_addr;
+
+       start_addr = runtime->dma_addr;
+       end_addr = start_addr + runtime->dma_bytes - 8;
+       int_addr = frames_to_bytes(runtime, runtime->period_size) / 8;
+
+       if (ss->stream == SNDRV_PCM_STREAM_CAPTURE) {
+               struct toddr *to = p_loopback->tddr;
+
+               aml_toddr_set_buf(to, start_addr, end_addr);
+               aml_toddr_set_intrpt(to, int_addr);
+       }
+
+       return 0;
+}
+
+static snd_pcm_uframes_t loopback_pointer(
+       struct snd_pcm_substream *ss)
+{
+       struct snd_pcm_runtime *runtime = ss->runtime;
+       struct loopback *p_loopback = runtime->private_data;
+       unsigned int addr, start_addr;
+       snd_pcm_uframes_t frames = 0;
+
+       if (ss->stream == SNDRV_PCM_STREAM_CAPTURE) {
+               start_addr = runtime->dma_addr;
+               addr = aml_toddr_get_position(p_loopback->tddr);
+
+               frames = bytes_to_frames(runtime, addr - start_addr);
+       }
+       if (frames > runtime->buffer_size)
+               frames = 0;
+
+       return frames;
+}
+
+int loopback_silence(
+       struct snd_pcm_substream *ss,
+       int channel,
+       snd_pcm_uframes_t pos,
+       snd_pcm_uframes_t count)
+{
+       struct snd_pcm_runtime *runtime = ss->runtime;
+       char *ppos;
+       int n;
+
+       n = frames_to_bytes(runtime, count);
+       ppos = runtime->dma_area + frames_to_bytes(runtime, pos);
+       memset(ppos, 0, n);
+
+       return 0;
+}
+
+static int loopback_mmap(struct snd_pcm_substream *ss,
+                       struct vm_area_struct *vma)
+{
+       return snd_pcm_lib_default_mmap(ss, vma);
+}
+
+static struct snd_pcm_ops loopback_ops = {
+       .open      = loopback_open,
+       .close     = loopback_close,
+       .ioctl     = snd_pcm_lib_ioctl,
+       .hw_params = loopback_hw_params,
+       .hw_free   = loopback_hw_free,
+       .prepare   = loopback_prepare,
+       .trigger   = loopback_trigger,
+       .pointer   = loopback_pointer,
+       .silence   = loopback_silence,
+       .mmap      = loopback_mmap,
+};
+
+static int loopback_pcm_new(struct snd_soc_pcm_runtime *rtd)
+{
+       struct snd_pcm *pcm = rtd->pcm;
+       struct snd_pcm_substream *ss;
+       int size = loopback_hardware.buffer_bytes_max;
+       int ret = -EINVAL;
+
+       /* only capture */
+       ss = pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream;
+       if (ss) {
+               ret = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV,
+                                       rtd->platform->dev,
+                                       size, &ss->dma_buffer);
+               if (ret) {
+                       dev_err(rtd->dev, "Cannot allocate buffer(s)\n");
+                       return ret;
+               }
+       }
+
+       return ret;
+}
+
+static void loopback_pcm_free(struct snd_pcm *pcm)
+{
+       struct snd_pcm_substream *ss;
+
+       ss = pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream;
+       if (ss) {
+               snd_dma_free_pages(&ss->dma_buffer);
+               ss->dma_buffer.area = NULL;
+               ss->dma_buffer.addr = 0;
+       }
+}
+
+struct snd_soc_platform_driver loopback_platform_drv = {
+       .pcm_new  = loopback_pcm_new,
+       .pcm_free = loopback_pcm_free,
+       .ops      = &loopback_ops,
+};
+
+static int loopback_dai_probe(struct snd_soc_dai *dai)
+{
+       return 0;
+}
+
+static int loopback_dai_remove(struct snd_soc_dai *dai)
+{
+       return 0;
+}
+
+static int datain_pdm_startup(struct loopback *p_loopback)
+{
+       int ret;
+
+       /* enable clock gate */
+       ret = clk_prepare_enable(p_loopback->pdm_clk_gate);
+
+       /* enable clock */
+       ret = clk_prepare_enable(p_loopback->pdm_sysclk_srcpll);
+       if (ret) {
+               pr_err("Can't enable pcm pdm_sysclk_srcpll clock: %d\n", ret);
+               goto err;
+       }
+
+       ret = clk_prepare_enable(p_loopback->pdm_dclk_srcpll);
+       if (ret) {
+               pr_err("Can't enable pcm pdm_dclk_srcpll clock: %d\n", ret);
+               goto err;
+       }
+
+       ret = clk_prepare_enable(p_loopback->pdm_sysclk);
+       if (ret) {
+               pr_err("Can't enable pcm pdm_sysclk clock: %d\n", ret);
+               goto err;
+       }
+
+       ret = clk_prepare_enable(p_loopback->pdm_dclk);
+       if (ret) {
+               pr_err("Can't enable pcm pdm_dclk clock: %d\n", ret);
+               goto err;
+       }
+
+       return 0;
+err:
+       pr_err("failed enable pdm clock\n");
+       return -EINVAL;
+}
+
+static void datain_pdm_shutdown(struct loopback *p_loopback)
+{
+       /* disable clock and gate */
+       clk_disable_unprepare(p_loopback->pdm_dclk);
+       clk_disable_unprepare(p_loopback->pdm_sysclk);
+       clk_disable_unprepare(p_loopback->pdm_sysclk_srcpll);
+       clk_disable_unprepare(p_loopback->pdm_dclk_srcpll);
+       clk_disable_unprepare(p_loopback->pdm_clk_gate);
+}
+
+static int tdminlb_startup(struct loopback *p_loopback)
+{
+       int ret;
+
+       /* enable clock */
+       ret = clk_prepare_enable(p_loopback->tdminlb_mpll);
+       if (ret) {
+               pr_err("Can't enable tdminlb_mpll clock: %d\n", ret);
+               goto err;
+       }
+
+       ret = clk_prepare_enable(p_loopback->tdminlb_mclk);
+       if (ret) {
+               pr_err("Can't enable tdminlb_mclk clock: %d\n", ret);
+               goto err;
+       }
+
+       return 0;
+err:
+       pr_err("failed enable pdm clock\n");
+       return -EINVAL;
+}
+
+static void tdminlb_shutdown(struct loopback *p_loopback)
+{
+       /* disable clock and gate */
+       clk_disable_unprepare(p_loopback->tdminlb_mclk);
+       clk_disable_unprepare(p_loopback->tdminlb_mpll);
+}
+
+static int loopback_dai_startup(
+       struct snd_pcm_substream *ss,
+       struct snd_soc_dai *dai)
+{
+       struct loopback *p_loopback = snd_soc_dai_get_drvdata(dai);
+       int ret = 0;
+
+       if (ss->stream != SNDRV_PCM_STREAM_CAPTURE) {
+               ret = -EINVAL;
+               goto err;
+       }
+
+       pr_info("%s\n", __func__);
+
+       /* datain */
+       switch (p_loopback->datain_src) {
+       case DATAIN_TDMA:
+       case DATAIN_TDMB:
+       case DATAIN_TDMC:
+               break;
+       case DATAIN_SPDIF:
+               break;
+       case DATAIN_PDM:
+               ret = datain_pdm_startup(p_loopback);
+               if (ret < 0)
+                       goto err;
+               break;
+       case DATAIN_LOOPBACK:
+               break;
+       default:
+               break;
+       }
+
+       /* datalb */
+       switch (p_loopback->datalb_src) {
+       case TDMINLB_TDMOUTA ... TDMINLB_PAD_TDMINC:
+               tdminlb_startup(p_loopback);
+               break;
+       case SPDIFINLB_SPDIFOUTA ... SPDIFINLB_SPDIFOUTB:
+               break;
+       default:
+               break;
+       }
+
+       return ret;
+err:
+       pr_err("Failed to enable datain clock\n");
+       return ret;
+}
+
+static void loopback_dai_shutdown(
+       struct snd_pcm_substream *ss,
+       struct snd_soc_dai *dai)
+{
+       struct loopback *p_loopback = snd_soc_dai_get_drvdata(dai);
+
+       pr_info("%s\n", __func__);
+
+       /* datain */
+       switch (p_loopback->datain_src) {
+       case DATAIN_TDMA:
+       case DATAIN_TDMB:
+       case DATAIN_TDMC:
+               break;
+       case DATAIN_SPDIF:
+               break;
+       case DATAIN_PDM:
+               datain_pdm_shutdown(p_loopback);
+               break;
+       case DATAIN_LOOPBACK:
+               break;
+       default:
+               break;
+       }
+
+       /* datalb */
+       switch (p_loopback->datalb_src) {
+       case TDMINLB_TDMOUTA ... TDMINLB_PAD_TDMINC:
+               tdminlb_shutdown(p_loopback);
+               break;
+       case SPDIFINLB_SPDIFOUTA ... SPDIFINLB_SPDIFOUTB:
+               break;
+       default:
+               break;
+       }
+
+}
+
+static void loopback_set_clk(struct loopback *p_loopback,
+       int rate, bool enable)
+{
+       unsigned int mul = 2;
+       unsigned int mpll_freq, mclk_freq;
+       /* assume datain_lb in i2s format, 2ch, 32bit */
+       unsigned int bit_depth = 32, i2s_ch = 2;
+       unsigned int sclk_div = 4 - 1;
+       unsigned int ratio = i2s_ch * bit_depth - 1;
+
+       /* lb_datain clk is set
+        * prepare clocks for tdmin_lb
+        */
+
+       /* mpll, mclk */
+       if (p_loopback->datalb_src >= 3) {
+               mclk_freq = rate * p_loopback->mclk_fs_ratio;
+               mpll_freq = mclk_freq * mul;
+               clk_set_rate(p_loopback->tdminlb_mpll, mpll_freq);
+               clk_set_rate(p_loopback->tdminlb_mclk, mclk_freq);
+               pr_info("%s, rate:%d  mclk:%d, mpll:%d, get mclk:%lu mpll:%lu\n",
+                       __func__,
+                       rate,
+                       mclk_freq,
+                       mpll_freq,
+                       clk_get_rate(p_loopback->tdminlb_mclk),
+                       clk_get_rate(p_loopback->tdminlb_mpll));
+       }
+
+#ifdef __PTM_TDM_CLK__
+       ratio = 18 * 2;
+#endif
+
+       tdminlb_set_clk(p_loopback->datalb_src, sclk_div, ratio, enable);
+}
+
+static int loopback_set_ctrl(struct loopback *p_loopback, int bitwidth)
+{
+       unsigned int datain_toddr_type, datalb_toddr_type;
+       unsigned int datain_msb, datain_lsb, datalb_msb, datalb_lsb;
+       struct data_cfg datain_cfg;
+       struct data_cfg datalb_cfg;
+
+       if (!p_loopback)
+               return -EINVAL;
+
+       switch (p_loopback->datain_src) {
+       case DATAIN_TDMA:
+       case DATAIN_TDMB:
+       case DATAIN_TDMC:
+       case DATAIN_PDM:
+               datain_toddr_type = 0;
+               datain_msb = 32 - 1;
+               datain_lsb = 0;
+               break;
+       case DATAIN_SPDIF:
+               datain_toddr_type = 3;
+               datain_msb = 27;
+               datain_lsb = 4;
+               if (bitwidth <= 24)
+                       datain_lsb = 28 - bitwidth;
+               else
+                       datain_lsb = 4;
+               break;
+       default:
+               pr_err("unsupport data in source:%d\n",
+               p_loopback->datain_src);
+               return -EINVAL;
+       }
+
+       switch (p_loopback->datalb_src) {
+       case TDMINLB_TDMOUTA:
+       case TDMINLB_TDMOUTB:
+       case TDMINLB_TDMOUTC:
+       case TDMINLB_PAD_TDMINA:
+       case TDMINLB_PAD_TDMINB:
+       case TDMINLB_PAD_TDMINC:
+               if (bitwidth == 24) {
+                       datalb_toddr_type = 4;
+                       datalb_msb = 32 - 1;
+                       datalb_lsb = 32 - bitwidth;
+               } else {
+                       datalb_toddr_type = 0;
+                       datalb_msb = 32 - 1;
+                       datalb_lsb = 0;
+               }
+               break;
+       default:
+               pr_err("unsupport data lb source:%d\n",
+               p_loopback->datalb_src);
+               return -EINVAL;
+       }
+
+       datain_cfg.ext_signed = 0;
+       datain_cfg.chnum      = p_loopback->datain_chnum;
+       datain_cfg.chmask     = p_loopback->datain_chmask;
+       datain_cfg.type       = datain_toddr_type;
+       datain_cfg.m          = datain_msb;
+       datain_cfg.n          = datain_lsb;
+       datain_cfg.src        = p_loopback->datain_src;
+
+       datalb_cfg.ext_signed  = 0;
+       datalb_cfg.chnum       = p_loopback->datalb_chnum;
+       datalb_cfg.chmask      = p_loopback->datalb_chmask;
+       datalb_cfg.type        = datalb_toddr_type;
+       datalb_cfg.m           = datalb_msb;
+       datalb_cfg.n           = datalb_lsb;
+       datalb_cfg.datalb_src  = p_loopback->datalb_src;
+
+       if (p_loopback->chipinfo) {
+               datain_cfg.ch_ctrl_switch = p_loopback->chipinfo->ch_ctrl;
+               datalb_cfg.ch_ctrl_switch = p_loopback->chipinfo->ch_ctrl;
+       } else {
+               datain_cfg.ch_ctrl_switch = 0;
+               datalb_cfg.ch_ctrl_switch = 0;
+       }
+
+       lb_set_datain_cfg(p_loopback->id, &datain_cfg);
+       lb_set_datalb_cfg(p_loopback->id, &datalb_cfg);
+
+       tdminlb_set_format(1); /* tdmin_lb i2s mode */
+       tdminlb_set_lanemask_and_chswap(0x76543210,
+               p_loopback->datalb_lane_mask);
+       tdminlb_set_ctrl(p_loopback->datalb_src);
+
+       return 0;
+}
+
+static void datatin_pdm_cfg(
+       struct snd_pcm_runtime *runtime,
+       struct loopback *p_loopback)
+{
+       unsigned int bit_depth = snd_pcm_format_width(runtime->format);
+       unsigned int osr;
+       struct pdm_info info;
+
+       info.bitdepth     = bit_depth;
+       info.channels     = p_loopback->datain_chnum;
+       info.lane_masks   = p_loopback->datain_lane_mask;
+       info.dclk_idx     = p_loopback->dclk_idx;
+       info.bypass       = 0;
+       info.sample_count = pdm_get_sample_count(0, p_loopback->dclk_idx);
+       aml_pdm_ctrl(&info);
+
+       /* filter for pdm */
+       osr = pdm_get_ors(p_loopback->dclk_idx, runtime->rate);
+
+       aml_pdm_filter_ctrl(osr, 1);
+}
+
+static int loopback_dai_prepare(
+       struct snd_pcm_substream *ss,
+       struct snd_soc_dai *dai)
+{
+       struct snd_pcm_runtime *runtime = ss->runtime;
+       struct loopback *p_loopback = snd_soc_dai_get_drvdata(dai);
+       unsigned int bit_depth = snd_pcm_format_width(runtime->format);
+
+       if (ss->stream == SNDRV_PCM_STREAM_CAPTURE) {
+               struct toddr *to = p_loopback->tddr;
+               unsigned int msb = 32 - 1;
+               unsigned int lsb = 32 - bit_depth;
+               unsigned int toddr_type;
+               struct toddr_fmt fmt;
+               unsigned int src;
+
+               if (p_loopback->id == 0)
+                       src = LOOPBACK_A;
+               else
+                       src = LOOPBACK_B;
+
+               pr_info("%s Expected toddr src:%s\n",
+                       __func__,
+                       toddr_src_get_str(src));
+
+               switch (bit_depth) {
+               case 8:
+               case 16:
+               case 32:
+                       toddr_type = 0;
+                       break;
+               case 24:
+                       toddr_type = 4;
+                       break;
+               default:
+                       dev_err(p_loopback->dev,
+                               "invalid bit_depth: %d\n",
+                               bit_depth);
+                       return -EINVAL;
+               }
+
+               fmt.type      = toddr_type;
+               fmt.msb       = msb;
+               fmt.lsb       = lsb;
+               fmt.endian    = 0;
+               fmt.bit_depth = bit_depth;
+               fmt.ch_num    = runtime->channels;
+               fmt.rate      = runtime->rate;
+
+               aml_toddr_select_src(to, src);
+               aml_toddr_set_format(to, &fmt);
+               aml_toddr_set_fifos(to, 0x40);
+
+               switch (p_loopback->datain_src) {
+               case DATAIN_TDMA:
+               case DATAIN_TDMB:
+               case DATAIN_TDMC:
+                       break;
+               case DATAIN_SPDIF:
+                       break;
+               case DATAIN_PDM:
+                       datatin_pdm_cfg(runtime, p_loopback);
+                       break;
+               case DATAIN_LOOPBACK:
+                       break;
+               default:
+                       dev_err(p_loopback->dev,
+                               "unexpected datain src 0x%02x\n",
+                               p_loopback->datain_src);
+                       return -EINVAL;
+               }
+
+               switch (p_loopback->datalb_src) {
+               case TDMINLB_TDMOUTA:
+               case TDMINLB_TDMOUTB:
+               case TDMINLB_TDMOUTC:
+                       break;
+               case TDMINLB_PAD_TDMINA:
+               case TDMINLB_PAD_TDMINB:
+               case TDMINLB_PAD_TDMINC:
+                       break;
+               case SPDIFINLB_SPDIFOUTA:
+               case SPDIFINLB_SPDIFOUTB:
+                       break;
+               default:
+                       dev_err(p_loopback->dev,
+                               "unexpected datalb src 0x%02x\n",
+                               p_loopback->datalb_src);
+                       return -EINVAL;
+               }
+
+               /* config for loopback, datain, datalb */
+               loopback_set_ctrl(p_loopback, bit_depth);
+       }
+
+       return 0;
+}
+
+static int loopback_dai_trigger(
+       struct snd_pcm_substream *ss,
+       int cmd,
+       struct snd_soc_dai *dai)
+{
+       struct loopback *p_loopback = snd_soc_dai_get_drvdata(dai);
+
+       pr_info("%s\n", __func__);
+
+       switch (cmd) {
+       case SNDRV_PCM_TRIGGER_START:
+       case SNDRV_PCM_TRIGGER_RESUME:
+       case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
+               if (ss->stream == SNDRV_PCM_STREAM_CAPTURE) {
+                       dev_info(ss->pcm->card->dev, "Loopback Capture enable\n");
+
+                       pdm_fifo_reset();
+                       tdminlb_fifo_enable(true);
+
+                       aml_toddr_enable(p_loopback->tddr, true);
+                       /* loopback */
+                       lb_enable(p_loopback->id, true);
+                       /* tdminLB */
+                       tdminlb_enable(p_loopback->datalb_src, true);
+                       /* pdm */
+                       pdm_enable(1);
+               }
+               break;
+       case SNDRV_PCM_TRIGGER_STOP:
+       case SNDRV_PCM_TRIGGER_SUSPEND:
+       case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
+               if (ss->stream == SNDRV_PCM_STREAM_CAPTURE) {
+                       dev_info(ss->pcm->card->dev, "Loopback Capture disable\n");
+                       pdm_enable(0);
+
+                       /* loopback */
+                       lb_enable(p_loopback->id, false);
+                       /* tdminLB */
+                       tdminlb_fifo_enable(false);
+                       tdminlb_enable(p_loopback->datalb_src, false);
+
+                       aml_toddr_enable(p_loopback->tddr, false);
+               }
+               break;
+       default:
+               return -EINVAL;
+       }
+
+       return 0;
+}
+
+static void datain_pdm_set_clk(struct loopback *p_loopback)
+{
+       unsigned int pdm_sysclk_srcpll_freq, pdm_dclk_srcpll_freq;
+
+       pdm_sysclk_srcpll_freq = clk_get_rate(p_loopback->pdm_sysclk_srcpll);
+       pdm_dclk_srcpll_freq = clk_get_rate(p_loopback->pdm_dclk_srcpll);
+
+#ifdef __PTM_PDM_CLK__
+       clk_set_rate(p_loopback->pdm_sysclk, 133333351);
+       clk_set_rate(p_loopback->pdm_dclk_srcpll, 24576000 * 15); /* 350m */
+       clk_set_rate(p_loopback->pdm_dclk, 3072000);
+#else
+       clk_set_rate(p_loopback->pdm_sysclk, 133333351);
+
+       if (pdm_dclk_srcpll_freq == 0)
+               clk_set_rate(p_loopback->pdm_dclk_srcpll, 24576000);
+       else
+               pr_info("pdm pdm_dclk_srcpll:%lu\n",
+                       clk_get_rate(p_loopback->pdm_dclk_srcpll));
+#endif
+
+       clk_set_rate(p_loopback->pdm_dclk,
+               pdm_dclkidx2rate(p_loopback->dclk_idx));
+
+       pr_info("pdm pdm_sysclk:%lu pdm_dclk:%lu\n",
+               clk_get_rate(p_loopback->pdm_sysclk),
+               clk_get_rate(p_loopback->pdm_dclk));
+}
+
+static void datalb_tdminlb_set_clk(struct loopback *p_loopback)
+{
+       int mpll_freq = p_loopback->sysclk_freq * 2;
+
+       clk_set_rate(p_loopback->tdminlb_mpll, mpll_freq);
+       clk_set_rate(p_loopback->tdminlb_mclk, p_loopback->sysclk_freq);
+
+       pr_info("tdmin lb mpll:%lu mclk:%lu\n",
+               clk_get_rate(p_loopback->tdminlb_mpll),
+               clk_get_rate(p_loopback->tdminlb_mclk));
+}
+
+static int loopback_dai_hw_params(
+       struct snd_pcm_substream *ss,
+       struct snd_pcm_hw_params *params,
+       struct snd_soc_dai *dai)
+{
+       struct snd_pcm_runtime *runtime = ss->runtime;
+       struct loopback *p_loopback = snd_soc_dai_get_drvdata(dai);
+       unsigned int rate, channels;
+       snd_pcm_format_t format;
+       int ret = 0;
+
+       rate = params_rate(params);
+       channels = params_channels(params);
+       format = params_format(params);
+
+       pr_info("%s:rate:%d, sysclk:%d\n",
+               __func__,
+               rate,
+               p_loopback->sysclk_freq);
+
+       switch (p_loopback->datain_src) {
+       case DATAIN_TDMA:
+       case DATAIN_TDMB:
+       case DATAIN_TDMC:
+               break;
+       case DATAIN_SPDIF:
+               break;
+       case DATAIN_PDM:
+               datain_pdm_set_clk(p_loopback);
+               break;
+       case DATAIN_LOOPBACK:
+               break;
+       default:
+               break;
+       }
+
+       /* datalb */
+       switch (p_loopback->datalb_src) {
+       case TDMINLB_TDMOUTA ... TDMINLB_PAD_TDMINC:
+               datalb_tdminlb_set_clk(p_loopback);
+               break;
+       case SPDIFINLB_SPDIFOUTA ... SPDIFINLB_SPDIFOUTB:
+               break;
+       default:
+               break;
+       }
+
+       loopback_set_clk(p_loopback, runtime->rate, true);
+
+       return ret;
+}
+
+int loopback_dai_hw_free(
+       struct snd_pcm_substream *ss,
+       struct snd_soc_dai *dai)
+{
+       struct snd_pcm_runtime *runtime = ss->runtime;
+       struct loopback *p_loopback = snd_soc_dai_get_drvdata(dai);
+
+       pr_info("%s\n", __func__);
+
+       if (0)
+               loopback_set_clk(p_loopback, runtime->rate, false);
+
+       return 0;
+}
+
+static int loopback_dai_set_fmt(
+       struct snd_soc_dai *dai,
+       unsigned int fmt)
+{
+       struct loopback *p_loopback = snd_soc_dai_get_drvdata(dai);
+
+       pr_info("asoc loopback_dai_set_fmt, %#x, %p\n", fmt, p_loopback);
+
+       return 0;
+}
+
+static int loopback_dai_set_sysclk(
+       struct snd_soc_dai *dai,
+       int clk_id, unsigned int freq, int dir)
+{
+       struct loopback *p_loopback = snd_soc_dai_get_drvdata(dai);
+
+       p_loopback->sysclk_freq = freq;
+       pr_info("\n%s, %d, %d, %d\n",
+               __func__,
+               clk_id, freq, dir);
+
+       return 0;
+}
+
+static struct snd_soc_dai_ops loopback_dai_ops = {
+       .startup    = loopback_dai_startup,
+       .shutdown   = loopback_dai_shutdown,
+       .prepare    = loopback_dai_prepare,
+       .trigger    = loopback_dai_trigger,
+       .hw_params  = loopback_dai_hw_params,
+       .hw_free    = loopback_dai_hw_free,
+       .set_fmt    = loopback_dai_set_fmt,
+       .set_sysclk = loopback_dai_set_sysclk,
+};
+
+static struct snd_soc_dai_driver loopback_dai[] = {
+       {
+               .name    = "LOOPBACK-A",
+               .id      = 0,
+               .probe   = loopback_dai_probe,
+               .remove  = loopback_dai_remove,
+
+               .capture = {
+                    .channels_min = 1,
+                    .channels_max = 32,
+                    .rates        = LOOPBACK_RATES,
+                    .formats      = LOOPBACK_FORMATS,
+               },
+               .ops     = &loopback_dai_ops,
+       },
+       {
+               .name    = "LOOPBACK-B",
+               .id      = 1,
+               .probe   = loopback_dai_probe,
+               .remove  = loopback_dai_remove,
+
+               .capture = {
+                    .channels_min = 1,
+                    .channels_max = 32,
+                    .rates        = LOOPBACK_RATES,
+                    .formats      = LOOPBACK_FORMATS,
+               },
+               .ops     = &loopback_dai_ops,
+       },
+};
+
+static const char *const datain_src_texts[] = {
+       "TDMIN_A",
+       "TDMIN_B",
+       "TDMIN_C",
+       "SPDIFIN",
+       "PDMIN",
+};
+
+static const struct soc_enum datain_src_enum =
+       SOC_ENUM_SINGLE(EE_AUDIO_LB_CTRL0, 0, ARRAY_SIZE(datain_src_texts),
+       datain_src_texts);
+
+static int datain_src_get_enum(
+       struct snd_kcontrol *kcontrol,
+       struct snd_ctl_elem_value *ucontrol)
+{
+       struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
+       struct loopback *p_loopback = dev_get_drvdata(component->dev);
+
+       if (!p_loopback)
+               return 0;
+
+       ucontrol->value.enumerated.item[0] = p_loopback->datain_src;
+
+       return 0;
+}
+
+static int datain_src_set_enum(
+       struct snd_kcontrol *kcontrol,
+       struct snd_ctl_elem_value *ucontrol)
+{
+       struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
+       struct loopback *p_loopback = dev_get_drvdata(component->dev);
+
+       if (!p_loopback)
+               return 0;
+
+       p_loopback->datain_src = ucontrol->value.enumerated.item[0];
+
+       lb_set_datain_src(p_loopback->id, p_loopback->datain_src);
+
+       return 0;
+}
+
+static const char *const datalb_tdminlb_texts[] = {
+       "TDMOUT_A",
+       "TDMOUT_B",
+       "TDMOUT_C",
+       "TDMIN_A",
+       "TDMIN_B",
+       "TDMIN_C",
+};
+
+static const struct soc_enum datalb_tdminlb_enum =
+       SOC_ENUM_SINGLE(EE_AUDIO_TDMIN_LB_CTRL,
+               20,
+               ARRAY_SIZE(datalb_tdminlb_texts),
+               datalb_tdminlb_texts);
+
+static int datalb_tdminlb_get_enum(
+       struct snd_kcontrol *kcontrol,
+       struct snd_ctl_elem_value *ucontrol)
+{
+       struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
+       struct loopback *p_loopback = dev_get_drvdata(component->dev);
+
+       if (!p_loopback)
+               return 0;
+
+       ucontrol->value.enumerated.item[0] = p_loopback->datalb_src;
+
+       return 0;
+}
+
+static int datalb_tdminlb_set_enum(
+       struct snd_kcontrol *kcontrol,
+       struct snd_ctl_elem_value *ucontrol)
+{
+       struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
+       struct loopback *p_loopback = dev_get_drvdata(component->dev);
+
+       if (!p_loopback)
+               return 0;
+
+       p_loopback->datalb_src = ucontrol->value.enumerated.item[0];
+
+       tdminlb_set_src(p_loopback->datalb_src);
+
+       return 0;
+}
+
+static const struct snd_kcontrol_new snd_loopback_controls[] = {
+       /* loopback data in source */
+       SOC_ENUM_EXT("Loopback datain source",
+               datain_src_enum,
+               datain_src_get_enum,
+               datain_src_set_enum),
+
+       /* loopback data tdmin lb */
+       SOC_ENUM_EXT("Loopback tdmin lb source",
+               datalb_tdminlb_enum,
+               datalb_tdminlb_get_enum,
+               datalb_tdminlb_set_enum),
+};
+
+static const struct snd_soc_component_driver loopback_component = {
+       .name         = DRV_NAME,
+       .controls     = snd_loopback_controls,
+       .num_controls = ARRAY_SIZE(snd_loopback_controls),
+};
+
+static int snd_soc_of_get_slot_mask(
+       struct device_node *np,
+       const char *prop_name,
+       unsigned int *mask)
+{
+       u32 val;
+       const __be32 *of_slot_mask = of_get_property(np, prop_name, &val);
+       int i;
+
+       if (!of_slot_mask)
+               return -EINVAL;
+
+       val /= sizeof(u32);
+       for (i = 0; i < val; i++)
+               if (be32_to_cpup(&of_slot_mask[i]))
+                       *mask |= (1 << i);
+
+       return val;
+}
+
+static int datain_pdm_parse_of(
+       struct device *dev,
+       struct loopback *p_loopback)
+{
+       int ret;
+
+       /* clock gate */
+       p_loopback->pdm_clk_gate = devm_clk_get(dev, "pdm_gate");
+       if (IS_ERR(p_loopback->pdm_clk_gate)) {
+               dev_err(dev,
+                       "Can't get pdm gate\n");
+               return PTR_ERR(p_loopback->pdm_clk_gate);
+       }
+
+       p_loopback->pdm_sysclk_srcpll = devm_clk_get(dev, "pdm_sysclk_srcpll");
+       if (IS_ERR(p_loopback->pdm_sysclk_srcpll)) {
+               dev_err(dev,
+                       "Can't retrieve pll clock\n");
+               ret = PTR_ERR(p_loopback->pdm_sysclk_srcpll);
+               goto err;
+       }
+
+       p_loopback->pdm_dclk_srcpll = devm_clk_get(dev, "pdm_dclk_srcpll");
+       if (IS_ERR(p_loopback->pdm_dclk_srcpll)) {
+               dev_err(dev,
+                       "Can't retrieve data src clock\n");
+               ret = PTR_ERR(p_loopback->pdm_dclk_srcpll);
+               goto err;
+       }
+
+       p_loopback->pdm_sysclk = devm_clk_get(dev, "pdm_sysclk");
+       if (IS_ERR(p_loopback->pdm_sysclk)) {
+               dev_err(dev,
+                       "Can't retrieve pdm_sysclk clock\n");
+               ret = PTR_ERR(p_loopback->pdm_sysclk);
+               goto err;
+       }
+
+       p_loopback->pdm_dclk = devm_clk_get(dev, "pdm_dclk");
+       if (IS_ERR(p_loopback->pdm_dclk)) {
+               dev_err(dev,
+                       "Can't retrieve pdm_dclk clock\n");
+               ret = PTR_ERR(p_loopback->pdm_dclk);
+               goto err;
+       }
+
+       ret = clk_set_parent(p_loopback->pdm_sysclk,
+                       p_loopback->pdm_sysclk_srcpll);
+       if (ret) {
+               dev_err(dev,
+                       "Can't set pdm_sysclk parent clock\n");
+               ret = PTR_ERR(p_loopback->pdm_sysclk);
+               goto err;
+       }
+
+       ret = clk_set_parent(p_loopback->pdm_dclk,
+                       p_loopback->pdm_dclk_srcpll);
+       if (ret) {
+               dev_err(dev,
+                       "Can't set pdm_dclk parent clock\n");
+               ret = PTR_ERR(p_loopback->pdm_dclk);
+               goto err;
+       }
+
+       return 0;
+
+err:
+       return ret;
+}
+
+static int datain_parse_of(
+       struct device_node *node,
+       struct loopback *p_loopback)
+{
+       struct platform_device *pdev;
+       int ret;
+
+       pdev = of_find_device_by_node(node);
+       if (!pdev) {
+               dev_err(&pdev->dev,
+                       "failed to find platform device\n");
+               return -EINVAL;
+       }
+
+       switch (p_loopback->datain_src) {
+       case DATAIN_TDMA:
+       case DATAIN_TDMB:
+       case DATAIN_TDMC:
+               break;
+       case DATAIN_SPDIF:
+               break;
+       case DATAIN_PDM:
+               ret = datain_pdm_parse_of(&pdev->dev, p_loopback);
+               if (ret < 0)
+                       goto err;
+               break;
+       case DATAIN_LOOPBACK:
+               break;
+       default:
+               break;
+       }
+
+       return 0;
+err:
+       pr_err("%s, error:%d\n", __func__, ret);
+       return -EINVAL;
+}
+
+static int datalb_tdminlb_parse_of(
+       struct device_node *node,
+       struct loopback *p_loopback)
+{
+       struct platform_device *pdev;
+       int ret;
+
+       pdev = of_find_device_by_node(node);
+       if (!pdev) {
+               dev_err(&pdev->dev,
+                       "failed to find platform device\n");
+               return -EINVAL;
+       }
+
+       /* mpll used for tdmin_lb */
+       p_loopback->tdminlb_mpll = devm_clk_get(&pdev->dev, "tdminlb_mpll");
+       if (IS_ERR(p_loopback->tdminlb_mpll)) {
+               dev_err(&pdev->dev,
+                       "Can't retrieve tdminlb_mpll clock\n");
+               return PTR_ERR(p_loopback->tdminlb_mpll);
+       }
+       p_loopback->tdminlb_mclk = devm_clk_get(&pdev->dev, "tdminlb_mclk");
+       if (IS_ERR(p_loopback->tdminlb_mclk)) {
+               dev_err(&pdev->dev,
+                       "Can't retrieve tdminlb_mclk clock\n");
+               return PTR_ERR(p_loopback->tdminlb_mclk);
+       }
+
+       ret = clk_set_parent(p_loopback->tdminlb_mclk,
+                       p_loopback->tdminlb_mpll);
+       if (ret) {
+               dev_err(&pdev->dev,
+                       "Can't set tdminlb_mclk parent clock\n");
+               ret = PTR_ERR(p_loopback->tdminlb_mpll);
+               goto err;
+       }
+
+       ret = of_property_read_u32(node, "mclk-fs",
+               &p_loopback->mclk_fs_ratio);
+       if (ret) {
+               pr_warn_once("failed to get mclk-fs node, set it default\n");
+               p_loopback->mclk_fs_ratio = 256;
+               ret = 0;
+       }
+
+       return 0;
+err:
+       pr_err("%s, error:%d\n", __func__, ret);
+       return -EINVAL;
+}
+
+static int loopback_parse_of(
+       struct device_node *node,
+       struct loopback *p_loopback)
+{
+       struct platform_device *pdev;
+       int ret;
+
+       pdev = of_find_device_by_node(node);
+       if (!pdev) {
+               dev_err(&pdev->dev, "failed to find platform device\n");
+               ret = -EINVAL;
+               goto fail;
+       }
+
+       ret = of_property_read_u32(node, "datain_src",
+               &p_loopback->datain_src);
+       if (ret) {
+               pr_err("failed to get datain_src\n");
+               ret = -EINVAL;
+               goto fail;
+       }
+       ret = of_property_read_u32(node, "datain_chnum",
+               &p_loopback->datain_chnum);
+       if (ret) {
+               pr_err("failed to get datain_chnum\n");
+               ret = -EINVAL;
+               goto fail;
+       }
+       ret = of_property_read_u32(node, "datain_chmask",
+               &p_loopback->datain_chmask);
+       if (ret) {
+               pr_err("failed to get datain_chmask\n");
+               ret = -EINVAL;
+               goto fail;
+       }
+       ret = snd_soc_of_get_slot_mask(node, "datain-lane-mask-in",
+               &p_loopback->datain_lane_mask);
+       if (ret < 0) {
+               ret = -EINVAL;
+               dev_err(&pdev->dev, "datain lane-slot-mask should be set\n");
+               goto fail;
+       }
+
+       ret = of_property_read_u32(node, "datalb_src",
+               &p_loopback->datalb_src);
+       if (ret) {
+               pr_err("failed to get datalb_src\n");
+               ret = -EINVAL;
+               goto fail;
+       }
+       ret = of_property_read_u32(node, "datalb_chnum",
+               &p_loopback->datalb_chnum);
+       if (ret) {
+               pr_err("failed to get datalb_chnum\n");
+               ret = -EINVAL;
+               goto fail;
+       }
+       ret = of_property_read_u32(node, "datalb_chmask",
+               &p_loopback->datalb_chmask);
+       if (ret) {
+               pr_err("failed to get datalb_chmask\n");
+               ret = -EINVAL;
+               goto fail;
+       }
+
+       ret = snd_soc_of_get_slot_mask(node, "datalb-lane-mask-in",
+               &p_loopback->datalb_lane_mask);
+       if (ret < 0) {
+               ret = -EINVAL;
+               pr_err("datalb lane-slot-mask should be set\n");
+               goto fail;
+       }
+
+       pr_info("\tdatain_src:%d, datain_chnum:%d, datain_chumask:%x\n",
+               p_loopback->datain_src,
+               p_loopback->datain_chnum,
+               p_loopback->datain_chmask);
+       pr_info("\tdatalb_src:%d, datalb_chnum:%d, datalb_chmask:%x\n",
+               p_loopback->datalb_src,
+               p_loopback->datalb_chnum,
+               p_loopback->datalb_chmask);
+       pr_info("\tdatain_lane_mask:0x%x, datalb_lane_mask:0x%x\n",
+               p_loopback->datain_lane_mask,
+               p_loopback->datalb_lane_mask);
+
+       ret = datain_parse_of(node, p_loopback);
+       if (ret) {
+               dev_err(&pdev->dev,
+                       "failed to parse datain\n");
+               return ret;
+       }
+       ret = datalb_tdminlb_parse_of(node, p_loopback);
+       if (ret) {
+               dev_err(&pdev->dev,
+                       "failed to parse datalb\n");
+               return ret;
+       }
+
+       return 0;
+
+fail:
+       return ret;
+}
+
+static int loopback_platform_probe(struct platform_device *pdev)
+{
+       struct device *dev = &pdev->dev;
+       struct device_node *node = pdev->dev.of_node;
+       struct loopback *p_loopback = NULL;
+       struct loopback_chipinfo *p_chipinfo = NULL;
+       struct device_node *node_prt = NULL;
+       struct platform_device *pdev_parent = NULL;
+       struct aml_audio_controller *actrl = NULL;
+       int ret = 0;
+
+       p_loopback = devm_kzalloc(&pdev->dev,
+                       sizeof(struct loopback),
+                       GFP_KERNEL);
+       if (!p_loopback)
+               return -ENOMEM;
+
+       /* match data */
+       p_chipinfo = (struct loopback_chipinfo *)
+               of_device_get_match_data(dev);
+       if (p_chipinfo) {
+               p_loopback->chipinfo = p_chipinfo;
+               p_loopback->id = p_chipinfo->id;
+       } else
+               dev_warn_once(dev,
+                       "check whether to update loopback chipinfo\n");
+
+       /* get audio controller */
+       node_prt = of_get_parent(node);
+       if (node_prt == NULL)
+               return -ENXIO;
+
+       pdev_parent = of_find_device_by_node(node_prt);
+       of_node_put(node_prt);
+       actrl = (struct aml_audio_controller *)
+                               platform_get_drvdata(pdev_parent);
+       p_loopback->actrl = actrl;
+
+       ret = loopback_parse_of(dev->of_node, p_loopback);
+       if (ret) {
+               dev_err(&pdev->dev,
+                       "failed to parse loopback info\n");
+               return ret;
+       }
+
+       p_loopback->dev = &pdev->dev;
+       dev_set_drvdata(&pdev->dev, p_loopback);
+
+       ret = devm_snd_soc_register_component(&pdev->dev,
+                               &loopback_component,
+                               &loopback_dai[p_loopback->id],
+                               1);
+       if (ret) {
+               dev_err(&pdev->dev,
+                       "snd_soc_register_component failed\n");
+               return ret;
+       }
+
+       pr_info("%s, p_loopback->id:%d register soc platform\n",
+               __func__,
+               p_loopback->id);
+
+       return devm_snd_soc_register_platform(dev,
+               &loopback_platform_drv);
+}
+
+static struct platform_driver loopback_platform_driver = {
+       .driver = {
+               .name           = DRV_NAME,
+               .owner          = THIS_MODULE,
+               .of_match_table = of_match_ptr(loopback_device_id),
+       },
+       .probe  = loopback_platform_probe,
+};
+module_platform_driver(loopback_platform_driver);
+
+MODULE_AUTHOR("AMLogic, Inc.");
+MODULE_DESCRIPTION("Amlogic Loopback driver");
+MODULE_LICENSE("GPL");
+MODULE_ALIAS("platform:" DRV_NAME);
diff --git a/sound/soc/amlogic/auge/loopback.h b/sound/soc/amlogic/auge/loopback.h
new file mode 100644 (file)
index 0000000..bc0c075
--- /dev/null
@@ -0,0 +1,61 @@
+/*
+ * sound/soc/amlogic/auge/loopback.h
+ *
+ * Copyright (C) 2018 Amlogic, Inc. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ *
+ */
+#ifndef __AML_AUDIO_LOOPBACK_H__
+#define __AML_AUDIO_LOOPBACK_H__
+#include <sound/soc.h>
+#include <sound/tlv.h>
+
+/* datain src
+ * [4]: pdmin;
+ * [3]: spdifin;
+ * [2]: tdmin_c;
+ * [1]: tdmin_b;
+ * [0]: tdmin_a;
+ */
+enum datain_src {
+       DATAIN_TDMA = 0,
+       DATAIN_TDMB,
+       DATAIN_TDMC,
+       DATAIN_SPDIF,
+       DATAIN_PDM,
+       DATAIN_LOOPBACK,
+};
+
+/* datalb src
+ * /tdmin_lb src
+ *     [0]: tdmoutA
+ *     [1]: tdmoutB
+ *     [2]: tdmoutC
+ *     [3]: PAD_tdminA
+ *     [4]: PAD_tdminB
+ *     [5]: PAD_tdminC
+ * /spdifin_lb src
+ *     spdifout_a
+ *     spdifout_b
+ */
+enum datalb_src {
+       TDMINLB_TDMOUTA = 0,
+       TDMINLB_TDMOUTB,
+       TDMINLB_TDMOUTC,
+       TDMINLB_PAD_TDMINA,
+       TDMINLB_PAD_TDMINB,
+       TDMINLB_PAD_TDMINC,
+
+       SPDIFINLB_SPDIFOUTA,
+       SPDIFINLB_SPDIFOUTB,
+};
+#endif
index 15144b9..0508769 100644 (file)
  * more details.
  *
  */
-#include <sound/soc.h>
+#define DEBUG
+
+#include "linux/kernel.h"
 
-#include "regs.h"
 #include "loopback_hw.h"
+#include "regs.h"
 #include "iomap.h"
 
-void datain_config(struct data_in *datain)
-{
-       audiobus_update_bits(
-               EE_AUDIO_LB_CTRL0,
-               1 << 29 | 0x7 << 24 | 0xff << 16 |
-               0x7 << 13 | 0x1f << 8 | 0x1f << 3 |
-               0x7 << 0,
-               datain->config->ext_signed  << 29 |
-               (datain->config->chnum - 1) << 24 |
-               datain->config->chmask      << 16 |
-               datain->ddrdata->combined_type << 13 |
-               datain->ddrdata->msb        << 8  |
-               datain->ddrdata->lsb        << 3  |
-               datain->ddrdata->src        << 0
-               );
-}
 
-void datalb_config(struct data_lb *datalb)
+void tdminlb_set_clk(int datatlb_src, int sclk_div, int ratio, bool enable)
 {
-       audiobus_write(
-               EE_AUDIO_LB_CTRL1,
-               datalb->config->ext_signed  << 29 |
-               (datalb->config->chnum - 1) << 24 |
-               datalb->config->chmask      << 16 |
-               datalb->ddr_type            << 13 |
-               datalb->msb                 << 8  |
-               datalb->lsb                 << 3
-               );
-}
-
-void datalb_ctrl(struct loopback_cfg *lb_cfg)
-{
-       int id = lb_cfg->datalb_src;
-       int offset = 0;
-       int reg, reg_base;
+       unsigned int bclk_sel, fsclk_sel;
+       unsigned int tdmin_src;
+
+       /* config for external codec */
+       if (datatlb_src >= 3) {
+               unsigned int clk_id = datatlb_src - 3;
+               unsigned int offset, reg;
+               unsigned int fsclk_hi;
+
+               fsclk_hi = ratio / 2;
+               bclk_sel = clk_id;
+               fsclk_sel = clk_id;
+
+               /*sclk, lrclk*/
+               offset = EE_AUDIO_MST_B_SCLK_CTRL0 - EE_AUDIO_MST_A_SCLK_CTRL0;
+               reg = EE_AUDIO_MST_A_SCLK_CTRL0 + offset * clk_id;
+               audiobus_update_bits(reg,
+                       0x3 << 30 | 0x3ff << 20 | 0x3ff<<10 | 0x3ff,
+                       (enable ? 0x3 : 0x0) << 30
+                       | sclk_div << 20 | fsclk_hi << 10
+                       | ratio);
+
+
+               tdmin_src = datatlb_src - 3;
+       } else
+               tdmin_src = datatlb_src;
 
        audiobus_update_bits(
-               EE_AUDIO_TDMIN_LB_CTRL,
-               0xf << 28 | 0xf << 20 | 0x7 << 16 | 0x1f << 0,
-               1 << 31 |
-               /*0:tdm mode; 1: i2s mode;*/
-               1 << 30 |
-               1 << 29 |
-               1 << 28 |
-               lb_cfg->datalb_src << 20 |
-               3 << 16|
-               31 << 0
-               );
-
-       if (id >= 0 && id <= 2) {
-               /* tdmout_a, tdmout_b, tdmout_c */
-               reg_base = EE_AUDIO_TDMOUT_A_SWAP0;
-               offset = EE_AUDIO_TDMOUT_B_SWAP0 - EE_AUDIO_TDMOUT_A_SWAP0;
-       } else if (id < 6) {
-               /*lb_cfg->datalb_src for pad tdm in,
-                *pad from tdmin_a, tdmin_b, tdmin_c
-                */
-               /* id offset from tdmin_a */
-               id -= 3;
-
-               reg_base = EE_AUDIO_TDMIN_A_CTRL;
-               offset = EE_AUDIO_TDMIN_B_CTRL - EE_AUDIO_TDMIN_A_CTRL;
-               reg = reg_base + offset * id;
-               audiobus_update_bits(reg, 3<<28, 0);
-               audiobus_update_bits(reg, 1<<29, 1<<29);
-               audiobus_update_bits(reg, 1<<28, 1<<28);
-
-               /* just assume lb from tdm in is i2s mode */
-               audiobus_update_bits(
-                       reg,
-                       0xf << 28 | 0xf << 20 | 0x7 << 16 | 0x1f << 0,
-                       1 << 31 |
-                       /* 0:tdm mode; 1: i2s mode */
-                       1 << 30 |
-                       1 << 29 |
-                       1 << 28 |
-                       id << 20 |
-                       3 << 16|
-                       31 << 0
-                       );
-
-               pr_info("reg:0x%x, EE_AUDIO_TDMIN_A_CTRL:0x%x\n",
-                       reg,
-                       audiobus_read(EE_AUDIO_TDMIN_A_CTRL));
-               /* swap */
-               reg += 1;
-               audiobus_write(
-                       reg,
-                       lb_cfg->datalb_chswap);
-
-               /* mask 0 */
-               reg += 1;
-               audiobus_write(
-                       reg,
-                       lb_cfg->datalb_chmask);
-               reg_base = EE_AUDIO_TDMIN_A_SWAP0;
-               offset = EE_AUDIO_TDMIN_B_SWAP0 - EE_AUDIO_TDMIN_A_SWAP0;
-       } else {
-               pr_err("unsupport datalb_src\n");
-               return;
-       }
-
-       if (lb_cfg->datain_datalb_total > 8) {
-               audiobus_write(
-                               EE_AUDIO_TDMIN_LB_SWAP0,
-                               lb_cfg->datalb_chswap);
-
-               audiobus_write(EE_AUDIO_TDMIN_LB_MASK0, 3);
-               audiobus_write(EE_AUDIO_TDMIN_LB_MASK1, 3);
-               audiobus_write(EE_AUDIO_TDMIN_LB_MASK2, 3);
-               audiobus_write(EE_AUDIO_TDMIN_LB_MASK3, 3);
-       } else {
-               /*swap same as tdmout */
-               reg = reg_base + offset * id;
-               audiobus_write(EE_AUDIO_TDMIN_LB_SWAP0,
-                               audiobus_read(reg));
-
-               /*mask same as datalb*/
-               /* mask 0 */
-               reg += 1;
-               audiobus_write(
-                               EE_AUDIO_TDMIN_LB_MASK0,
-                               audiobus_read(reg));
-
-               /* mask 1 */
-               reg += 1;
-               audiobus_write(
-                               EE_AUDIO_TDMIN_LB_MASK1,
-                               audiobus_read(reg));
-
-               /* mask 2 */
-               reg += 1;
-               audiobus_write(
-                               EE_AUDIO_TDMIN_LB_MASK2,
-                               audiobus_read(reg));
-
-               /* mask 3 */
-               reg += 1;
-               audiobus_write(
-                               EE_AUDIO_TDMIN_LB_MASK3,
-                               audiobus_read(reg));
-       }
+               EE_AUDIO_CLK_TDMIN_LB_CTRL,
+               0x3 << 30 | 1 << 29 | 0xf << 24 | 0xf << 20,
+               (enable ? 0x3 : 0x0) << 30 |
+               1 << 29 | tdmin_src << 24 | tdmin_src << 20
+       );
 }
 
-void lb_mode(int mode)
+void tdminlb_enable(int tdm_index, int is_enable)
 {
-// TODO:
-       return;
-#if 0
        audiobus_update_bits(
-               EE_AUDIO_LB_CTRL0,
-               0x1 << 30,
-               mode << 30
-               );
-#endif
+               EE_AUDIO_TDMIN_LB_CTRL,
+               0x1 << 31,
+               is_enable << 31);
 }
 
-static void tdmin_lb_clk_enalbe(int tdm_src, int is_enable)
+void tdminlb_set_format(int i2s_fmt)
 {
-       if (tdm_src <= 2)
-               audiobus_update_bits(
-                       EE_AUDIO_CLK_TDMIN_LB_CTRL,
-                       0x3 << 30 | 1 << 29 | 0xf << 24 | 0xf << 20,
-                       0x3 << 30 | 1 << 29 | tdm_src << 24 | tdm_src << 20
-                       );
-       else
-               pr_warn_once("pad from tdmin_a, tdmin_b, tdmin_c needs clks\n");
+       audiobus_update_bits(EE_AUDIO_TDMIN_LB_CTRL,
+               0x1 << 30,
+               i2s_fmt << 30 /* 0:tdm mode; 1: i2s mode; */
+       );
 }
 
-void tdmin_lb_enable(int tdm_index, int is_enable)
+void tdminlb_set_ctrl(int src)
 {
-       if (is_enable)
-               tdmin_lb_clk_enalbe(tdm_index, is_enable);
-
        audiobus_update_bits(
                EE_AUDIO_TDMIN_LB_CTRL,
-               0x1 << 31,
-               is_enable << 31);
+               0xf << 20 | 0x7 << 16 | 0x1f << 0,
+               src << 20 |  /* in src */
+               3   << 16 |  /* skew */
+               31  << 0     /* bit width */
+       );
 }
 
-void tdmin_lb_fifo_enable(int is_enable)
+void tdminlb_fifo_enable(int is_enable)
 {
        if (is_enable) {
                audiobus_update_bits(EE_AUDIO_TDMIN_LB_CTRL, 1<<29, 1<<29);
@@ -209,39 +96,123 @@ void tdmin_lb_fifo_enable(int is_enable)
                audiobus_update_bits(EE_AUDIO_TDMIN_LB_CTRL, 3<<28, 0);
 }
 
-
-void lb_set_datain_src(int src)
+static void tdminlb_set_lane_mask(int lane, int mask)
 {
+       audiobus_write(EE_AUDIO_TDMIN_LB_MASK0 + lane, mask);
 }
 
-void lb_set_tdminlb_src(int src)
+void tdminlb_set_lanemask_and_chswap(int swap, int lane_mask)
 {
+       unsigned int mask;
+       unsigned int i;
+
+       pr_debug("tdmin_lb lane swap:0x%x mask:0x%x\n", swap, lane_mask);
+
+       mask = 0x3; /* i2s format */
+
+       /* channel swap */
+       audiobus_write(EE_AUDIO_TDMIN_LB_SWAP0, swap);
+
+       /* lane mask */
+       for (i = 0; i < 4; i++)
+               if ((1 << i) & lane_mask)
+                       tdminlb_set_lane_mask(i, mask);
 }
 
-void lb_set_tdminlb_enable(bool is_enable)
+void tdminlb_set_src(int src)
 {
+       audiobus_update_bits(EE_AUDIO_TDMIN_LB_CTRL, 0xf << 20, src);
 }
 
-int lb_is_enable(void)
+void lb_set_datain_src(int id, int src)
 {
-       return (audiobus_read(EE_AUDIO_LB_CTRL0) & 0x80000000) >> 31;
+       int offset = EE_AUDIO_LB_B_CTRL0 - EE_AUDIO_LB_A_CTRL0;
+       int reg = EE_AUDIO_LB_A_CTRL0 + offset * id;
+
+       audiobus_update_bits(reg, 0x7 << 0, src);
 }
 
-void lb_enable(bool is_enable)
+void lb_set_datain_cfg(int id, struct data_cfg *datain_cfg)
 {
-       audiobus_update_bits(
-               EE_AUDIO_LB_CTRL0,
-               0x1           << 31,
-               is_enable     << 31
+       int offset = EE_AUDIO_LB_B_CTRL0 - EE_AUDIO_LB_A_CTRL0;
+       int reg = EE_AUDIO_LB_A_CTRL0 + offset * id;
+
+       if (!datain_cfg)
+               return;
+
+       if (datain_cfg->ch_ctrl_switch) {
+               audiobus_update_bits(reg,
+                       1 << 29 | 0x7 << 13 | 0x1f << 8 | 0x1f << 3 | 0x7 << 0,
+                       datain_cfg->ext_signed << 29 |
+                       datain_cfg->type       << 13 |
+                       datain_cfg->m          << 8  |
+                       datain_cfg->n          << 3  |
+                       datain_cfg->src        << 0
+               );
+
+               /* channel and mask */
+               offset = EE_AUDIO_LB_B_CTRL2 - EE_AUDIO_LB_A_CTRL2;
+               reg = EE_AUDIO_LB_A_CTRL2 + offset * id;
+               audiobus_write(reg,
+                       (datain_cfg->chnum - 1) << 16 |
+                       datain_cfg->chmask      << 0
+               );
+       } else
+               audiobus_update_bits(reg,
+                       1 << 29 | 0x7 << 24 | 0xff << 16 |
+                       0x7 << 13 | 0x1f << 8 | 0x1f << 3 |
+                       0x7 << 0,
+                       datain_cfg->ext_signed  << 29 |
+                       (datain_cfg->chnum - 1) << 24 |
+                       datain_cfg->chmask      << 16 |
+                       datain_cfg->type        << 13 |
+                       datain_cfg->m           << 8  |
+                       datain_cfg->n           << 3  |
+                       datain_cfg->src         << 0
                );
 }
 
-void lb_set_mode(int mode)
+void lb_set_datalb_cfg(int id, struct data_cfg *datalb_cfg)
 {
-       audiobus_update_bits(
-               EE_AUDIO_LB_CTRL0,
-               0x1           << 30,
-               mode          << 30
+       int offset = EE_AUDIO_LB_B_CTRL1 - EE_AUDIO_LB_A_CTRL1;
+       int reg = EE_AUDIO_LB_A_CTRL1 + offset * id;
+
+       if (!datalb_cfg)
+               return;
+
+       if (datalb_cfg->ch_ctrl_switch) {
+               audiobus_update_bits(reg,
+                       0x1 << 29 | 0x7 << 13 | 0x1f << 8
+                       | 0x1f << 3 | 0x1 << 1,
+                       datalb_cfg->ext_signed << 29 |
+                       datalb_cfg->type       << 13 |
+                       datalb_cfg->m          << 8  |
+                       datalb_cfg->n          << 3  |
+                       datalb_cfg->datalb_src << 0
+               );
+
+               /* channel and mask */
+               offset = EE_AUDIO_LB_B_CTRL3 - EE_AUDIO_LB_A_CTRL3;
+               reg = EE_AUDIO_LB_A_CTRL3 + offset * id;
+               audiobus_write(reg,
+                       (datalb_cfg->chnum - 1) << 16 |
+                       datalb_cfg->chmask      << 0
+               );
+       } else
+               audiobus_write(reg,
+                       datalb_cfg->ext_signed   << 29 |
+                       (datalb_cfg->chnum - 1)  << 24 |
+                       datalb_cfg->chmask       << 16 |
+                       datalb_cfg->type         << 13 |
+                       datalb_cfg->m            << 8  |
+                       datalb_cfg->n            << 3
                );
 }
 
+void lb_enable(int id, bool enable)
+{
+       int offset = EE_AUDIO_LB_B_CTRL0 - EE_AUDIO_LB_A_CTRL0;
+       int reg = EE_AUDIO_LB_A_CTRL0 + offset * id;
+
+       audiobus_update_bits(reg, 0x1 << 31, enable << 31);
+}
index 13115d8..776299a 100644 (file)
 #ifndef __AML_LOOPBACK_HW_H__
 #define __AML_LOOPBACK_HW_H__
 
-#include "audio_utils.h"
+#include <linux/types.h>
 
-struct lb_cfg {
+struct data_cfg {
        /*
         * 0: extend bits as "0"
         * 1: extend bits as "msb"
         */
        unsigned int ext_signed;
-       /* total channel number */
+       /* channel number */
        unsigned int chnum;
-       /* which channel is selected for loopback */
+       /* channel selected */
        unsigned int chmask;
-};
+       /* combined data */
+       unsigned int type;
+       /* the msb positioin in data */
+       unsigned int m;
+       /* the lsb position in data */
+       unsigned int n;
 
-struct data_in {
-       struct lb_cfg *config;
-       struct audio_data *ddrdata;
-};
+       /* loopback datalb src */
+       unsigned int src;
 
-struct data_lb {
-       struct lb_cfg *config;
-       unsigned int ddr_type;
-       unsigned int msb;
-       unsigned int lsb;
+       unsigned int datalb_src;
+
+       /* channel and mask in new ctrol register */
+       bool ch_ctrl_switch;
 };
 
-struct loopback {
-       struct device *dev;
-       unsigned int lb_mode;
+extern void tdminlb_set_clk(int datatlb_src,
+       int sclk_div, int ratio, bool enable);
 
-       struct data_in *datain;
-       struct data_lb *datalb;
-};
+extern void tdminlb_set_format(int i2s_fmt);
 
+extern void tdminlb_set_ctrl(int src);
 
-extern void datain_config(struct data_in *datain);
+extern void tdminlb_enable(int tdm_index, int in_enable);
 
-extern void datalb_config(struct data_lb *datalb);
+extern void tdminlb_fifo_enable(int is_enable);
 
-extern void datalb_ctrl(struct loopback_cfg *lb_cfg);
+extern void tdminlb_set_format(int i2s_fmt);
+extern void tdminlb_set_lanemask_and_chswap(int swap, int lane_mask);
 
-extern int lb_is_enable(void);
 
-extern void lb_enable(bool is_enable);
+extern void tdminlb_set_src(int src);
+extern void lb_set_datain_src(int id, int src);
 
-extern void lb_mode(int mode);
+extern void lb_set_datain_cfg(int id, struct data_cfg *datain_cfg);
+extern void lb_set_datalb_cfg(int id, struct data_cfg *datalb_cfg);
 
-extern void tdmin_lb_enable(int tdm_index, int in_enable);
+extern void lb_enable(int id, bool enable);
 
-extern void tdmin_lb_fifo_enable(int is_enable);
 #endif
diff --git a/sound/soc/amlogic/auge/loopback_match_table.c b/sound/soc/amlogic/auge/loopback_match_table.c
new file mode 100644 (file)
index 0000000..566e106
--- /dev/null
@@ -0,0 +1,104 @@
+/*
+ * sound/soc/amlogic/auge/loopback_match_table.c
+ *
+ * Copyright (C) 2019 Amlogic, Inc. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ *
+ */
+
+#define LOOPBACKA    0
+#define LOOPBACKB    1
+
+struct loopback_chipinfo {
+       unsigned int id;
+
+       /* reset all modules, after g12a
+        * it has reset bits control for modules
+        */
+       bool is_reset_all;
+
+       /* channel and mask switch to ctrl2, ctrl3 from tl1
+        * for datain, 0: channel and mask is controlled by ctrl0
+        *             1: channel and mask is controlled by ctrl2
+        * for datalb, 0: channel and mask is controlled by ctrl1
+        *             1: channel and mask is controlled by ctrl3
+        */
+       bool ch_ctrl;
+};
+
+static struct loopback_chipinfo tl1_loopbacka_chipinfo = {
+       .id      = LOOPBACKA,
+       .ch_ctrl = true,
+};
+
+static struct loopback_chipinfo tl1_loopbackb_chipinfo = {
+       .id      = LOOPBACKB,
+       .ch_ctrl = true,
+};
+
+static struct loopback_chipinfo sm1_loopbacka_chipinfo = {
+       .id      = LOOPBACKA,
+       .ch_ctrl = true,
+};
+
+static struct loopback_chipinfo sm1_loopbackb_chipinfo = {
+       .id      = LOOPBACKB,
+       .ch_ctrl = true,
+};
+
+static struct loopback_chipinfo tm2_loopbacka_chipinfo = {
+       .id      = LOOPBACKA,
+       .ch_ctrl = true,
+};
+
+static struct loopback_chipinfo tm2_loopbackb_chipinfo = {
+       .id      = LOOPBACKB,
+       .ch_ctrl = true,
+};
+
+static const struct of_device_id loopback_device_id[] = {
+       {
+               .compatible = "amlogic, snd-loopback",
+       },
+       {
+               .compatible = "amlogic, axg-loopback",
+       },
+       {
+               .compatible = "amlogic, g12a-loopback",
+       },
+       {
+               .compatible = "amlogic, tl1-loopbacka",
+               .data           = &tl1_loopbacka_chipinfo,
+       },
+       {
+               .compatible = "amlogic, tl1-loopbackb",
+               .data           = &tl1_loopbackb_chipinfo,
+       },
+       {
+               .compatible = "amlogic, sm1-loopbacka",
+               .data           = &sm1_loopbacka_chipinfo,
+       },
+       {
+               .compatible = "amlogic, sm1-loopbackb",
+               .data           = &sm1_loopbackb_chipinfo,
+       },
+       {
+               .compatible = "amlogic, tm2-loopbacka",
+               .data           = &tm2_loopbacka_chipinfo,
+       },
+       {
+               .compatible = "amlogic, tm2-loopbackb",
+               .data           = &tm2_loopbackb_chipinfo,
+       },
+       {}
+};
+MODULE_DEVICE_TABLE(of, loopback_device_id);
index 744bc97..bc90f43 100644 (file)
@@ -28,6 +28,8 @@
 #include <sound/soc.h>
 #include <sound/tlv.h>
 
+#include <linux/amlogic/pm.h>
+
 #include "pdm.h"
 #include "pdm_hw.h"
 #include "pdm_match_table.c"
@@ -76,8 +78,6 @@ static struct snd_pcm_hw_constraint_list hw_constraints_period_sizes = {
        .mask = 0
 };
 
-static int s_pdm_filter_mode;
-
 static const char *const pdm_filter_mode_texts[] = {
        "Filter Mode 0",
        "Filter Mode 1",
@@ -94,7 +94,13 @@ static int aml_pdm_filter_mode_get_enum(
        struct snd_kcontrol *kcontrol,
        struct snd_ctl_elem_value *ucontrol)
 {
-       ucontrol->value.enumerated.item[0] = s_pdm_filter_mode;
+       struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
+       struct aml_pdm *p_pdm = dev_get_drvdata(component->dev);
+
+       if (!p_pdm)
+               return 0;
+
+       ucontrol->value.enumerated.item[0] = p_pdm->filter_mode;
 
        return 0;
 }
@@ -103,7 +109,13 @@ static int aml_pdm_filter_mode_set_enum(
        struct snd_kcontrol *kcontrol,
        struct snd_ctl_elem_value *ucontrol)
 {
-       s_pdm_filter_mode = ucontrol->value.enumerated.item[0];
+       struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
+       struct aml_pdm *p_pdm = dev_get_drvdata(component->dev);
+
+       if (!p_pdm)
+               return 0;
+
+       p_pdm->filter_mode = ucontrol->value.enumerated.item[0];
 
        return 0;
 }
@@ -137,8 +149,6 @@ static int pdm_hcic_shift_gain_set_enum(
        return 0;
 }
 
-int pdm_dclk;
-
 static const char *const pdm_dclk_texts[] = {
        "PDM Dclk 3.072m, support 8k/16k/32k/48k/64k/96k",
        "PDM Dclk 1.024m, support 8k/16k",
@@ -153,7 +163,13 @@ static int pdm_dclk_get_enum(
        struct snd_kcontrol *kcontrol,
        struct snd_ctl_elem_value *ucontrol)
 {
-       ucontrol->value.enumerated.item[0] = pdm_dclk;
+       struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
+       struct aml_pdm *p_pdm = dev_get_drvdata(component->dev);
+
+       if (!p_pdm)
+               return 0;
+
+       ucontrol->value.enumerated.item[0] = p_pdm->dclk_idx;
 
        return 0;
 }
@@ -162,7 +178,150 @@ static int pdm_dclk_set_enum(
        struct snd_kcontrol *kcontrol,
        struct snd_ctl_elem_value *ucontrol)
 {
-       pdm_dclk = ucontrol->value.enumerated.item[0];
+       struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
+       struct aml_pdm *p_pdm = dev_get_drvdata(component->dev);
+
+       if (!p_pdm)
+               return 0;
+
+       p_pdm->dclk_idx = ucontrol->value.enumerated.item[0];
+
+       return 0;
+}
+
+
+static const char *const pdm_bypass_texts[] = {
+       "PCM Data",
+       "Raw Data/Bypass Data",
+};
+
+static const struct soc_enum pdm_bypass_enum =
+       SOC_ENUM_SINGLE(SND_SOC_NOPM, 0, ARRAY_SIZE(pdm_bypass_texts),
+                       pdm_bypass_texts);
+
+static int pdm_bypass_get_enum(
+       struct snd_kcontrol *kcontrol,
+       struct snd_ctl_elem_value *ucontrol)
+{
+       struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
+       struct aml_pdm *p_pdm = dev_get_drvdata(component->dev);
+
+       if (!p_pdm)
+               return 0;
+
+       ucontrol->value.enumerated.item[0] = p_pdm->bypass;
+
+       return 0;
+}
+
+static int pdm_bypass_set_enum(
+       struct snd_kcontrol *kcontrol,
+       struct snd_ctl_elem_value *ucontrol)
+{
+       struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
+       struct aml_pdm *p_pdm = dev_get_drvdata(component->dev);
+
+       if (!p_pdm)
+               return 0;
+
+       p_pdm->bypass = ucontrol->value.enumerated.item[0];
+
+       if (p_pdm->clk_on)
+               pdm_set_bypass_data((bool)p_pdm->bypass);
+
+       return 0;
+}
+
+static const char *const pdm_lowpower_texts[] = {
+       "PDM Normal Mode",
+       "PDM Low Power Mode",
+};
+
+static const struct soc_enum pdm_lowpower_enum =
+       SOC_ENUM_SINGLE(SND_SOC_NOPM, 0, ARRAY_SIZE(pdm_lowpower_texts),
+                       pdm_lowpower_texts);
+
+static void pdm_set_lowpower_mode(struct aml_pdm *p_pdm, bool isLowPower)
+{
+       if (p_pdm->isLowPower == isLowPower)
+               return;
+
+       p_pdm->isLowPower = isLowPower;
+
+       if (p_pdm->clk_on) {
+               int osr, filter_mode, dclk_idx;
+
+               if (p_pdm->isLowPower) {
+                       /* dclk for 768k */
+                       dclk_idx = 2;
+
+                       pr_info("%s force pdm sysclk to 24m, dclk 768k\n",
+                               __func__);
+               } else
+                       dclk_idx = p_pdm->dclk_idx;
+
+               clk_set_rate(p_pdm->clk_pdm_dclk,
+                       pdm_dclkidx2rate(dclk_idx));
+
+               /* filter for pdm */
+               osr = pdm_get_ors(dclk_idx, p_pdm->rate);
+               if (!osr)
+                       osr = 192;
+
+               filter_mode = p_pdm->isLowPower ? 4 : p_pdm->filter_mode;
+               aml_pdm_filter_ctrl(osr, filter_mode);
+
+               /* update sample count */
+               pdm_set_channel_ctrl(
+                       pdm_get_sample_count(
+                               p_pdm->isLowPower,
+                               dclk_idx)
+                       );
+
+               /* check to set pdm sysclk */
+               pdm_force_sysclk_to_oscin(p_pdm->isLowPower);
+
+               pr_info("\n%s, pdm_sysclk:%lu pdm_dclk:%lu, dclk_srcpll:%lu\n",
+                       __func__,
+                       clk_get_rate(p_pdm->clk_pdm_sysclk),
+                       clk_get_rate(p_pdm->clk_pdm_dclk),
+                       clk_get_rate(p_pdm->dclk_srcpll));
+
+               /* Check to set vad for Low Power */
+               if (vad_pdm_is_running())
+                       vad_set_lowerpower_mode(p_pdm->isLowPower);
+       }
+}
+
+static int pdm_lowpower_get_enum(
+       struct snd_kcontrol *kcontrol,
+       struct snd_ctl_elem_value *ucontrol)
+{
+       struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
+       struct aml_pdm *p_pdm = dev_get_drvdata(component->dev);
+
+       if (!p_pdm)
+               return 0;
+
+       ucontrol->value.enumerated.item[0] = p_pdm->isLowPower;
+
+       return 0;
+}
+
+
+static int pdm_lowpower_set_enum(
+       struct snd_kcontrol *kcontrol,
+       struct snd_ctl_elem_value *ucontrol)
+{
+       struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
+       struct aml_pdm *p_pdm = dev_get_drvdata(component->dev);
+       bool isLowPower;
+
+       if (!p_pdm)
+               return 0;
+
+       isLowPower = (bool)ucontrol->value.enumerated.item[0];
+       pdm_set_lowpower_mode(p_pdm, isLowPower);
 
        return 0;
 }
@@ -180,8 +339,11 @@ static int pdm_train_get_enum(
        struct snd_kcontrol *kcontrol,
        struct snd_ctl_elem_value *ucontrol)
 {
-       struct snd_soc_dai *cpu_dai = snd_kcontrol_chip(kcontrol);
-       struct aml_pdm *p_pdm = snd_soc_dai_get_drvdata(cpu_dai);
+       struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
+       struct aml_pdm *p_pdm = dev_get_drvdata(component->dev);
+
+       if (!p_pdm)
+               return 0;
 
        ucontrol->value.enumerated.item[0] = p_pdm->train_en;
 
@@ -192,10 +354,11 @@ static int pdm_train_set_enum(
        struct snd_kcontrol *kcontrol,
        struct snd_ctl_elem_value *ucontrol)
 {
-       struct snd_soc_dai *cpu_dai = snd_kcontrol_chip(kcontrol);
-       struct aml_pdm *p_pdm = snd_soc_dai_get_drvdata(cpu_dai);
+       struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
+       struct aml_pdm *p_pdm = dev_get_drvdata(component->dev);
 
-       if (!p_pdm->chipinfo ||
+       if (!p_pdm ||
+               !p_pdm->chipinfo ||
                !p_pdm->chipinfo->train ||
                (p_pdm->train_en == ucontrol->value.enumerated.item[0]))
                return 0;
@@ -226,10 +389,20 @@ static const struct snd_kcontrol_new snd_pdm_controls[] = {
                     pdm_dclk_get_enum,
                     pdm_dclk_set_enum),
 
+       SOC_ENUM_EXT("PDM Low Power mode",
+                       pdm_lowpower_enum,
+                       pdm_lowpower_get_enum,
+                       pdm_lowpower_set_enum),
+
        SOC_ENUM_EXT("PDM Train",
                     pdm_train_enum,
                     pdm_train_get_enum,
                     pdm_train_set_enum),
+
+       SOC_ENUM_EXT("PDM Bypass",
+                    pdm_bypass_enum,
+                    pdm_bypass_get_enum,
+                    pdm_bypass_set_enum),
 };
 
 #if 0
@@ -252,7 +425,7 @@ static int pdm_mute_val_get(struct snd_kcontrol *kcontrol,
        val = pdm_get_mute_value();
        ucontrol->value.integer.value[0] = val;
 
-       pr_info("%s:get mute_val:0x%x\n",
+       pr_info("%sget mute_val:0x%x\n",
                __func__,
                val);
 
@@ -264,7 +437,7 @@ static int pdm_mute_val_set(struct snd_kcontrol *kcontrol,
 {
        int val  = (int)ucontrol->value.integer.value[0];
 
-       pr_info("%s:set mute_val:0x%x\n",
+       pr_info("%sset mute_val:0x%x\n",
                __func__,
                val);
 
@@ -302,7 +475,7 @@ static int pdm_mute_chmask_get(struct snd_kcontrol *kcontrol,
 
        ucontrol->value.integer.value[0] = val;
 
-       pr_info("%s:get pdm channel mask val:0x%x\n",
+       pr_info("%sget pdm channel mask val:0x%x\n",
                __func__,
                val);
 
@@ -319,7 +492,7 @@ static int pdm_mute_chmask_set(struct snd_kcontrol *kcontrol,
        if (val > 255)
                val = 255;
 
-       pr_info("%s:set pdm channel mask val:0x%x\n",
+       pr_info("%sset pdm channel mask val:0x%x\n",
                __func__,
                val);
 
@@ -379,11 +552,25 @@ static irqreturn_t aml_pdm_isr_handler(int irq, void *data)
 {
        struct snd_pcm_substream *substream =
                (struct snd_pcm_substream *)data;
+       struct snd_soc_pcm_runtime *rtd = substream->private_data;
+       struct device *dev = rtd->platform->dev;
+       struct aml_pdm *p_pdm = (struct aml_pdm *)dev_get_drvdata(dev);
+       unsigned int status;
        int train_sts = pdm_train_sts();
 
        pr_debug("%s\n", __func__);
 
-       snd_pcm_period_elapsed(substream);
+       if (!snd_pcm_running(substream))
+               return IRQ_NONE;
+
+       status = aml_toddr_get_status(p_pdm->tddr) & MEMIF_INT_MASK;
+       if (status & MEMIF_INT_COUNT_REPEAT) {
+               snd_pcm_period_elapsed(substream);
+
+               aml_toddr_ack_irq(p_pdm->tddr, MEMIF_INT_COUNT_REPEAT);
+       } else
+               dev_dbg(dev, "unexpected irq - STS 0x%02x\n",
+                       status);
 
        if (train_sts) {
                pr_debug("%s train result:0x%x\n",
@@ -392,7 +579,7 @@ static irqreturn_t aml_pdm_isr_handler(int irq, void *data)
                pdm_train_clr();
        }
 
-       return IRQ_HANDLED;
+       return !status ? IRQ_NONE : IRQ_HANDLED;
 }
 
 static int aml_pdm_open(struct snd_pcm_substream *substream)
@@ -404,7 +591,7 @@ static int aml_pdm_open(struct snd_pcm_substream *substream)
                                                        dev_get_drvdata(dev);
        int ret;
 
-       pr_info("%s, stream:%d\n",
+       pr_debug("%s, stream:%d\n",
                __func__, substream->stream);
 
        snd_soc_set_runtime_hwparams(substream, &aml_pdm_hardware);
@@ -453,7 +640,7 @@ static int aml_pdm_close(struct snd_pcm_substream *substream)
        struct device *dev = rtd->platform->dev;
        struct aml_pdm *p_pdm = (struct aml_pdm *)dev_get_drvdata(dev);
 
-       pr_info("enter %s type: %d\n",
+       pr_debug("enter %s type: %d\n",
                __func__, substream->stream);
 
        aml_audio_unregister_toddr(p_pdm->dev, substream);
@@ -469,7 +656,7 @@ static int aml_pdm_hw_params(
        struct snd_pcm_runtime *runtime = substream->runtime;
        int ret = 0;
 
-       pr_info("enter %s\n", __func__);
+       pr_debug("enter %s\n", __func__);
 
        snd_pcm_set_runtime_buffer(substream, &substream->dma_buffer);
        runtime->dma_bytes = params_buffer_bytes(params);
@@ -480,7 +667,7 @@ static int aml_pdm_hw_params(
 
 static int aml_pdm_hw_free(struct snd_pcm_substream *substream)
 {
-       pr_info("%s\n", __func__);
+       pr_debug("%s\n", __func__);
        snd_pcm_lib_free_pages(substream);
 
        return 0;
@@ -547,7 +734,7 @@ static int aml_pdm_silence(
        unsigned char *ppos = NULL;
        ssize_t n;
 
-       pr_info("%s\n", __func__);
+       pr_debug("%s\n", __func__);
 
        n = frames_to_bytes(runtime, count);
        ppos = runtime->dma_area + frames_to_bytes(runtime, pos);
@@ -564,7 +751,7 @@ static int aml_pdm_pcm_new(struct snd_soc_pcm_runtime *soc_runtime)
        int size = aml_pdm_hardware.buffer_bytes_max;
        int ret = -EINVAL;
 
-       pr_info("%s dai->name: %s dai->id: %d\n",
+       pr_debug("%s dai->name: %s dai->id: %d\n",
                __func__, dai->name, dai->id);
 
        /* only capture for PDM */
@@ -586,7 +773,7 @@ static void aml_pdm_pcm_free(struct snd_pcm *pcm)
 {
        struct snd_pcm_substream *substream;
 
-       pr_info("%s\n", __func__);
+       pr_debug("%s\n", __func__);
 
        substream = pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream;
        if (substream) {
@@ -611,7 +798,7 @@ static struct snd_pcm_ops aml_pdm_ops = {
 
 static int aml_pdm_probe(struct snd_soc_platform *platform)
 {
-       pr_info("%s\n", __func__);
+       pr_debug("%s\n", __func__);
 
        return 0;
 }
@@ -638,7 +825,6 @@ static int aml_pdm_dai_set_fmt(
        return 0;
 }
 
-
 static int aml_pdm_dai_prepare(
        struct snd_pcm_substream *substream,
        struct snd_soc_dai *cpu_dai)
@@ -652,6 +838,8 @@ static int aml_pdm_dai_prepare(
                && pm_audio_is_suspend())
                return 0;
 
+       p_pdm->rate = runtime->rate;
+
        /* set bclk */
        bitwidth = snd_pcm_format_width(runtime->format);
        lsb = 32 - bitwidth;
@@ -670,17 +858,16 @@ static int aml_pdm_dai_prepare(
                return -1;
        }
 
-       pr_info("%s rate:%d, bits:%d, channels:%d\n",
+       pr_debug("%s rate:%d, bits:%d, channels:%d\n",
                __func__,
                runtime->rate,
                bitwidth,
                runtime->channels);
 
-
        if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) {
                struct toddr *to = p_pdm->tddr;
                struct toddr_fmt fmt;
-               unsigned int osr = 192;
+               unsigned int osr = 192, filter_mode, dclk_idx;
                struct pdm_info info;
 
                /* to ddr pdmin */
@@ -695,52 +882,42 @@ static int aml_pdm_dai_prepare(
                aml_toddr_set_format(to, &fmt);
                aml_toddr_set_fifos(to, 0x40);
 
+               /* force pdm sysclk to 24m */
+               if (p_pdm->isLowPower) {
+                       /* dclk for 768k */
+                       dclk_idx = 2;
+                       filter_mode = 4;
+                       pdm_force_sysclk_to_oscin(true);
+                       if (vad_pdm_is_running())
+                               vad_set_lowerpower_mode(true);
+
+               } else {
+                       dclk_idx = p_pdm->dclk_idx;
+                       filter_mode = p_pdm->filter_mode;
+               }
+
+               /* filter for pdm */
+               osr = pdm_get_ors(dclk_idx, runtime->rate);
+               if (!osr)
+                       return -EINVAL;
+
+               pr_info("%s, pdm_dclk:%d, osr:%d, rate:%d filter mode:%d\n",
+                       __func__,
+                       pdm_dclkidx2rate(dclk_idx),
+                       osr,
+                       runtime->rate,
+                       p_pdm->filter_mode);
+
                info.bitdepth   = bitwidth;
                info.channels   = runtime->channels;
                info.lane_masks = p_pdm->lane_mask_in;
-               info.dclk_idx   = pdm_dclk;
+               info.dclk_idx   = dclk_idx;
                info.bypass     = p_pdm->bypass;
-               aml_pdm_ctrl(&info);
+               info.sample_count = pdm_get_sample_count(p_pdm->isLowPower,
+                                                               dclk_idx);
 
-               /* filter for pdm */
-               if (pdm_dclk == 1) {
-                       if (runtime->rate == 16000)
-                               osr = 64;
-                       else if (runtime->rate == 8000)
-                               osr = 128;
-                       else {
-                               pr_err("Not support rate:%d\n", runtime->rate);
-                               return -EINVAL;
-                       }
-               } else if (pdm_dclk == 2) {
-                       if (runtime->rate == 16000)
-                               osr = 48;
-                       else if (runtime->rate == 8000)
-                               osr = 96;
-                       else {
-                               pr_err("Not support rate:%d\n", runtime->rate);
-                               return -EINVAL;
-                       }
-               } else {
-                       if (runtime->rate == 96000)
-                               osr = 32;
-                       else if (runtime->rate == 64000)
-                               osr = 48;
-                       else if (runtime->rate == 48000)
-                               osr = 64;
-                       else if (runtime->rate == 32000)
-                               osr = 96;
-                       else if (runtime->rate == 16000)
-                               osr = 192;
-                       else if (runtime->rate == 8000)
-                               osr = 384;
-                       else {
-                               pr_err("Not support rate:%d\n", runtime->rate);
-                               return -EINVAL;
-                       }
-               }
-               p_pdm->filter_mode = s_pdm_filter_mode;
-               aml_pdm_filter_ctrl(osr, p_pdm->filter_mode);
+               aml_pdm_ctrl(&info);
+               aml_pdm_filter_ctrl(osr, filter_mode);
 
                if (p_pdm->chipinfo && p_pdm->chipinfo->truncate_data)
                        pdm_init_truncate_data(runtime->rate);
@@ -755,7 +932,7 @@ static int aml_pdm_dai_trigger(
 {
        struct aml_pdm *p_pdm = snd_soc_dai_get_drvdata(cpu_dai);
 
-       pr_info("%s, cmd:%d\n", __func__, cmd);
+       pr_debug("%s\n", __func__);
 
        switch (cmd) {
        case SNDRV_PCM_TRIGGER_START:
@@ -773,7 +950,7 @@ static int aml_pdm_dai_trigger(
                pdm_fifo_reset();
 
                if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) {
-                       dev_info(substream->pcm->card->dev, "pdm capture start\n");
+                       dev_info(substream->pcm->card->dev, "PDM Capture start\n");
                        aml_toddr_enable(p_pdm->tddr, 1);
                        pdm_enable(1);
                }
@@ -807,6 +984,11 @@ static int aml_pdm_dai_set_sysclk(struct snd_soc_dai *cpu_dai,
 {
        struct aml_pdm *p_pdm = snd_soc_dai_get_drvdata(cpu_dai);
        unsigned int sysclk_srcpll_freq, dclk_srcpll_freq;
+       unsigned int dclk_idx = p_pdm->dclk_idx;
+
+       /* lowpower, force dclk to 768k */
+       if (p_pdm->isLowPower)
+               dclk_idx = 2;
 
        sysclk_srcpll_freq = clk_get_rate(p_pdm->sysclk_srcpll);
        dclk_srcpll_freq = clk_get_rate(p_pdm->dclk_srcpll);
@@ -820,37 +1002,21 @@ static int aml_pdm_dai_set_sysclk(struct snd_soc_dai *cpu_dai,
 
        if (dclk_srcpll_freq == 0)
                clk_set_rate(p_pdm->dclk_srcpll, 24576000);
-       else
-               pr_info("pdm dclk_srcpll:%lu\n",
-                       clk_get_rate(p_pdm->dclk_srcpll));
 #endif
-       if (pdm_dclk == 1)
-               clk_set_rate(p_pdm->clk_pdm_dclk, 1024000);
-       else if (pdm_dclk == 2)
-               clk_set_rate(p_pdm->clk_pdm_dclk, 768000);
-       else
-               clk_set_rate(p_pdm->clk_pdm_dclk, 3072000);
-
-       pr_info("pdm pdm_sysclk:%lu clk_pdm_dclk:%lu\n",
+       clk_set_rate(p_pdm->clk_pdm_dclk,
+               pdm_dclkidx2rate(dclk_idx));
+
+       pr_info("\n%s, pdm_sysclk:%lu pdm_dclk:%lu, dclk_srcpll:%lu\n",
+               __func__,
                clk_get_rate(p_pdm->clk_pdm_sysclk),
-               clk_get_rate(p_pdm->clk_pdm_dclk));
+               clk_get_rate(p_pdm->clk_pdm_dclk),
+               clk_get_rate(p_pdm->dclk_srcpll));
 
        return 0;
 }
 
 static int aml_pdm_dai_probe(struct snd_soc_dai *cpu_dai)
 {
-       int ret = 0;
-
-       ret = snd_soc_add_dai_controls(cpu_dai, snd_pdm_controls,
-                               ARRAY_SIZE(snd_pdm_controls));
-       if (ret < 0) {
-               pr_err("%s, failed add snd pdm controls\n", __func__);
-               return ret;
-       }
-
-       pr_info("%s\n", __func__);
-
        return 0;
 }
 
@@ -919,6 +1085,12 @@ void aml_pdm_dai_shutdown(struct snd_pcm_substream *substream,
 #endif
 
        p_pdm->clk_on = false;
+       p_pdm->rate = 0;
+
+       if (p_pdm->isLowPower) {
+               pdm_force_sysclk_to_oscin(false);
+               vad_set_lowerpower_mode(false);
+       }
 
        /* disable clock and gate */
        clk_disable_unprepare(p_pdm->clk_pdm_dclk);
@@ -943,7 +1115,7 @@ struct snd_soc_dai_driver aml_pdm_dai[] = {
                .name = "PDM",
                .capture = {
                        .channels_min = PDM_CHANNELS_MIN,
-                       .channels_max = PDM_CHANNELS_MAX,
+                       .channels_max = PDM_CHANNELS_LB_MAX,
                        .rates        = PDM_RATES,
                        .formats      = PDM_FORMATS,
                },
@@ -955,6 +1127,8 @@ EXPORT_SYMBOL_GPL(aml_pdm_dai);
 
 static const struct snd_soc_component_driver aml_pdm_component = {
        .name = DRV_NAME,
+       .controls = snd_pdm_controls,
+       .num_controls = ARRAY_SIZE(snd_pdm_controls),
 };
 
 static int snd_soc_of_get_slot_mask(
@@ -1094,7 +1268,6 @@ static int aml_pdm_platform_probe(struct platform_device *pdev)
                /* defulat set 1 */
                p_pdm->filter_mode = 1;
        }
-       s_pdm_filter_mode = p_pdm->filter_mode;
        pr_info("%s pdm filter mode from dts:%d\n",
                __func__, p_pdm->filter_mode);
 
@@ -1126,30 +1299,62 @@ err:
 
 static int aml_pdm_platform_remove(struct platform_device *pdev)
 {
-       struct aml_pdm *pdm_priv = dev_get_drvdata(&pdev->dev);
+       struct aml_pdm *p_pdm = dev_get_drvdata(&pdev->dev);
 
-       clk_disable_unprepare(pdm_priv->sysclk_srcpll);
-       clk_disable_unprepare(pdm_priv->clk_pdm_dclk);
+       clk_disable_unprepare(p_pdm->sysclk_srcpll);
+       clk_disable_unprepare(p_pdm->clk_pdm_dclk);
 
        snd_soc_unregister_component(&pdev->dev);
 
-       snd_soc_unregister_codec(&pdev->dev);
+       snd_soc_unregister_platform(&pdev->dev);
+
+       return 0;
+}
+
+static int pdm_platform_suspend(
+       struct platform_device *pdev, pm_message_t state)
+{
+       struct aml_pdm *p_pdm = dev_get_drvdata(&pdev->dev);
+
+       /* whether in freeze */
+       if (is_pm_freeze_mode()
+               && vad_pdm_is_running()) {
+               pr_info("%s, Entry in freeze\n", __func__);
+               pdm_set_lowpower_mode(p_pdm, true);
+       }
+
+       return 0;
+}
+
+static int pdm_platform_resume(
+       struct platform_device *pdev)
+{
+       struct aml_pdm *p_pdm = dev_get_drvdata(&pdev->dev);
+
+       /* whether in freeze mode */
+       if (is_pm_freeze_mode()
+               && vad_pdm_is_running()) {
+               pr_info("%s, Exist from freeze\n", __func__);
+               pdm_set_lowpower_mode(p_pdm, false);
+       }
 
        return 0;
 }
 
+
 struct platform_driver aml_pdm_driver = {
-       .driver = {
-               .name = DRV_NAME,
-               .owner = THIS_MODULE,
+       .driver  = {
+               .name           = DRV_NAME,
+               .owner          = THIS_MODULE,
                .of_match_table = of_match_ptr(aml_pdm_device_id),
        },
-       .probe = aml_pdm_platform_probe,
-       .remove = aml_pdm_platform_remove,
+       .probe   = aml_pdm_platform_probe,
+       .remove  = aml_pdm_platform_remove,
+       .suspend = pdm_platform_suspend,
+       .resume  = pdm_platform_resume,
 };
 module_platform_driver(aml_pdm_driver);
 
-
 MODULE_AUTHOR("AMLogic, Inc.");
 MODULE_DESCRIPTION("Amlogic PDM ASoc driver");
 MODULE_LICENSE("GPL");
index 39bf6ab..e39153a 100644 (file)
@@ -30,7 +30,6 @@
 /* 8ch pdm in, 8 ch tdmin_lb */
 #define PDM_CHANNELS_LB_MAX            (PDM_CHANNELS_MAX + 8)
 
-
 #define PDM_RATES                      (SNDRV_PCM_RATE_96000 |\
                                        SNDRV_PCM_RATE_64000 |\
                                        SNDRV_PCM_RATE_48000 |\
@@ -70,6 +69,12 @@ struct aml_pdm {
        struct clk *clk_pdm_sysclk;
        struct clk *clk_pdm_dclk;
        struct toddr *tddr;
+
+       struct pdm_chipinfo *chipinfo;
+       struct snd_kcontrol *controls[PDM_RUN_MAX];
+
+       /* sample rate */
+       int rate;
        /*
         * filter mode:0~4,
         * from mode 0 to 4, the performance is from high to low,
@@ -90,8 +95,8 @@ struct aml_pdm {
        /* train */
        bool train_en;
 
-       struct pdm_chipinfo *chipinfo;
-       struct snd_kcontrol *controls[PDM_RUN_MAX];
+       /* low power mode, for dclk_sycpll to 24m */
+       bool isLowPower;
 };
 
 #endif /*__AML_PDM_H__*/
index 1b4d2e1..4a861ac 100644 (file)
@@ -59,22 +59,33 @@ void pdm_fifo_reset(void)
                0x1 << 16);
 }
 
+void pdm_force_sysclk_to_oscin(bool force)
+{
+       audiobus_update_bits(EE_AUDIO_CLK_PDMIN_CTRL1, 0x1 << 30, force << 30);
+}
+
+void pdm_set_channel_ctrl(int sample_count)
+{
+       aml_pdm_write(PDM_CHAN_CTRL, ((sample_count << 24) |
+                                       (sample_count << 16) |
+                                       (sample_count << 8) |
+                                       (sample_count << 0)
+               ));
+       aml_pdm_write(PDM_CHAN_CTRL1, ((sample_count << 24) |
+                                       (sample_count << 16) |
+                                       (sample_count << 8) |
+                                       (sample_count << 0)
+               ));
+}
+
 void aml_pdm_ctrl(struct pdm_info *info)
 {
-       int mode, i, ch_mask = 0, sample_count;
+       int mode, i, ch_mask = 0;
        int pdm_chs, lane_chs = 0;
 
        if (!info)
                return;
 
-       /* sameple count */
-       if (info->dclk_idx == 1)
-               sample_count = 38;
-       else if (info->dclk_idx == 2)
-               sample_count = 48;
-       else
-               sample_count = 18;
-
        if (info->bitdepth == 32)
                mode = 0;
        else
@@ -113,7 +124,6 @@ void aml_pdm_ctrl(struct pdm_info *info)
        /* must be sure that clk and pdm is enable */
        aml_pdm_update_bits(PDM_CTRL,
                                (0x7 << 28 | 0xff << 8 | 0xff << 0),
-                               /*(1 << 31) |*/
                                /* invert the PDM_DCLK or not */
                                (0 << 30) |
                                /* output mode:  1: 24bits. 0: 32 bits */
@@ -128,16 +138,7 @@ void aml_pdm_ctrl(struct pdm_info *info)
                                (ch_mask << 0)
                                );
 
-       aml_pdm_write(PDM_CHAN_CTRL, ((sample_count << 24) |
-                                       (sample_count << 16) |
-                                       (sample_count << 8) |
-                                       (sample_count << 0)
-               ));
-       aml_pdm_write(PDM_CHAN_CTRL1, ((sample_count << 24) |
-                                       (sample_count << 16) |
-                                       (sample_count << 8) |
-                                       (sample_count << 0)
-               ));
+       pdm_set_channel_ctrl(info->sample_count);
 }
 
 void aml_pdm_arb_config(struct aml_audio_controller *actrl)
@@ -340,9 +341,6 @@ void aml_pdm_filter_ctrl(int osr, int mode)
        int lpf1_len, lpf2_len, lpf3_len;
        const int *lpf1_coeff, *lpf2_coeff, *lpf3_coeff;
 
-       pr_info("%s, osr:%d, mode:%d\n",
-               __func__, osr, mode);
-
        /* select LPF coefficent
         * For filter 1 and filter 3,
         * it's only relative with coefficent mode
@@ -478,6 +476,11 @@ void pdm_set_mute_channel(int mute_chmask)
                (mute_chmask << 20 | mute_en << 17));
 }
 
+void pdm_set_bypass_data(bool bypass)
+{
+       aml_pdm_update_bits(PDM_CTRL, 0x1 << 28, bypass << 28);
+}
+
 void pdm_init_truncate_data(int freq)
 {
        int mask_val;
@@ -508,3 +511,74 @@ int pdm_train_sts(void)
 
        return ((val >> 4) & 0xff);
 }
+
+int pdm_dclkidx2rate(int idx)
+{
+       int rate;
+
+       if (idx == 2)
+               rate = 768000;
+       else if (idx == 1)
+               rate = 1024000;
+       else
+               rate = 3072000;
+
+       return rate;
+}
+
+int pdm_get_sample_count(int isLowPower, int dclk_idx)
+{
+       int count = 0;
+
+       if (isLowPower)
+               count = 0;
+       else if (dclk_idx == 1)
+               count = 38;
+       else if (dclk_idx  == 2)
+               count = 48;
+       else
+               count = 18;
+
+       return count;
+}
+
+int pdm_get_ors(int dclk_idx, int sample_rate)
+{
+       int osr = 0;
+
+       if (dclk_idx == 1) {
+               if (sample_rate == 16000)
+                       osr = 64;
+               else if (sample_rate == 8000)
+                       osr = 128;
+               else
+                       pr_err("%s, Not support rate:%d\n",
+                               __func__, sample_rate);
+       } else if (dclk_idx == 2) {
+               if (sample_rate == 16000)
+                       osr = 48;
+               else if (sample_rate == 8000)
+                       osr = 96;
+               else
+                       pr_err("%s, Not support rate:%d\n",
+                               __func__, sample_rate);
+       } else {
+               if (sample_rate == 96000)
+                       osr = 32;
+               else if (sample_rate == 64000)
+                       osr = 48;
+               else if (sample_rate == 48000)
+                       osr = 64;
+               else if (sample_rate == 32000)
+                       osr = 96;
+               else if (sample_rate == 16000)
+                       osr = 192;
+               else if (sample_rate == 8000)
+                       osr = 384;
+               else
+                       pr_err("%s, Not support rate:%d\n",
+                               __func__, sample_rate);
+       }
+
+       return osr;
+}
index b1d8424..2f0c897 100644 (file)
@@ -29,10 +29,14 @@ struct pdm_info {
 
        int dclk_idx;  /* mapping for dclk value */
        int bypass;    /* bypass all filter, capture raw data */
+       int sample_count;
 };
 
 extern void aml_pdm_ctrl(struct pdm_info *info);
 
+extern void pdm_force_sysclk_to_oscin(bool force);
+extern void pdm_set_channel_ctrl(int sample_count);
+
 extern void aml_pdm_arb_config(struct aml_audio_controller *actrl);
 
 extern int aml_pmd_set_HPF_filter_parameters(void *array);
@@ -47,14 +51,16 @@ extern int pdm_get_mute_value(void);
 extern void pdm_set_mute_value(int val);
 extern int pdm_get_mute_channel(void);
 extern void pdm_set_mute_channel(int mute_chmask);
-
+extern void pdm_set_bypass_data(bool bypass);
 extern void pdm_init_truncate_data(int freq);
-
 extern void pdm_train_en(bool en);
 extern void pdm_train_clr(void);
 extern int pdm_train_sts(void);
 
+extern int pdm_dclkidx2rate(int idx);
+extern int pdm_get_sample_count(int isLowPower, int dclk_idx);
+extern int pdm_get_ors(int dclk_idx, int sample_rate);
+
 extern int pdm_hcic_shift_gain;
-extern int pdm_dclk;
 
 #endif /*__AML_PDM_HW_H__*/
index 850b509..27ce1dd 100644 (file)
@@ -31,6 +31,12 @@ static struct pdm_chipinfo sm1_pdm_chipinfo = {
        .train           = true,
 };
 
+static struct pdm_chipinfo tm2_pdm_chipinfo = {
+       .mute_fn         = true,
+       .truncate_data   = false,
+       .train           = true,
+};
+
 static const struct of_device_id aml_pdm_device_id[] = {
        {
                .compatible = "amlogic, axg-snd-pdm",
@@ -47,6 +53,10 @@ static const struct of_device_id aml_pdm_device_id[] = {
                .compatible = "amlogic, sm1-snd-pdm",
                .data           = &sm1_pdm_chipinfo,
        },
+       {
+               .compatible = "amlogic, tm2-snd-pdm",
+               .data           = &tm2_pdm_chipinfo,
+       },
 
        {}
 };
index 2a97ec1..cbecb17 100644 (file)
@@ -37,6 +37,11 @@ enum clk_sel {
        SLAVE_J
 };
 
+struct register_table {
+       char *name;
+       unsigned int addr;
+};
+
 #define AUD_ADDR_OFFSET(addr)              ((addr) << 2)
 
 /*
@@ -71,7 +76,46 @@ enum clk_sel {
 #define EE_AUDIO_MCLK_F_CTRL(offset)       (0x006 + offset)
 #define EE_AUDIO_MST_PAD_CTRL0(offset)     (0x007 + offset)
 #define EE_AUDIO_MST_PAD_CTRL1(offset)     (0x008 + offset)
+
+#define REG_BIT_RESET_PDM                              (1)
+#define REG_BIT_RESET_TDMINA                           (1 << 1)
+#define REG_BIT_RESET_TDMINB                           (1 << 2)
+#define REG_BIT_RESET_TDMINC                           (1 << 3)
+#define REG_BIT_RESET_TDMIN_LB                         (1 << 4)
+#define REG_BIT_RESET_LOOPBACK                         (1 << 5)
+#define REG_BIT_RESET_TODDRA                           (1 << 6)
+#define REG_BIT_RESET_TODDRB                           (1 << 7)
+#define REG_BIT_RESET_TODDRC                           (1 << 8)
+#define REG_BIT_RESET_FRDDRA                           (1 << 9)
+#define REG_BIT_RESET_FRDDRB                           (1 << 10)
+#define REG_BIT_RESET_FRDDRC                           (1 << 11)
+#define REG_BIT_RESET_TDMOUTA                          (1 << 12)
+#define REG_BIT_RESET_TDMOUTB                          (1 << 13)
+#define REG_BIT_RESET_TDMOUTC                          (1 << 14)
+#define REG_BIT_RESET_SPDIFOUTA                                (1 << 15)
+#define REG_BIT_RESET_SPDIFOUTB                                (1 << 16)
+#define REG_BIT_RESET_SPDIFIN                          (1 << 17)
+#define REG_BIT_RESET_EQDRC                            (1 << 18)
+#define REG_BIT_RESET_RESAMPLE                         (1 << 19)
+#define REG_BIT_RESET_DDRARB                           (1 << 20)
+#define REG_BIT_RESET_POWDET                           (1 << 21)
+#define REG_BIT_RESET_TORAM                            (1 << 22)
+#define REG_BIT_RESET_TOACODEC                         (1 << 23)
+#define REG_BIT_RESET_TOHDMITX                         (1 << 24)
+#define REG_BIT_RESET_CLKTREE                          (1 << 25)
+#define REG_BIT_RESET_RESAMPLEB                                (1 << 26)
+#define REG_BIT_RESET_TOVAD                            (1 << 27)
+#define REG_BIT_RESET_LOCKER                           (1 << 28)
+#define REG_BIT_RESET_SPDIFIN_LB                       (1 << 29)
+#define REG_BIT_RESET_FRATV                            (1 << 30)
+#define REG_BIT_RESET_FRHDMIRX                         (1 << 31)
+
 #define EE_AUDIO_SW_RESET0(offset)         (0x009 + offset)
+
+#define REG_BIT_RESET_FRDDRD                           (1)
+#define REG_BIT_RESET_TODDRD                           (1 << 1)
+#define REG_BIT_RESET_LOOPBACKB                                (1 << 2)
+
 #define EE_AUDIO_SW_RESET1                 0x00b
 #define EE_AUDIO_CLK81_CTRL                0x00c
 #define EE_AUDIO_CLK81_EN                  0x00d
@@ -107,7 +151,7 @@ enum clk_sel {
 #define EE_AUDIO_CLK_RESAMPLEB_CTRL        0x02e
 #define EE_AUDIO_CLK_SPDIFIN_LB_CTRL       0x02f
 #define EE_AUDIO_CLK_EQDRC_CTRL0           0x030
-#define EE_AUDIO_VAD_CLK_CTRL              0x031
+#define EE_AUDIO_CLK_VAD_CTRL              0x031
 #define EE_AUDIO_EARCTX_CMDC_CLK_CTRL      0x032
 #define EE_AUDIO_EARCTX_DMAC_CLK_CTRL      0x033
 #define EE_AUDIO_EARCRX_CMDC_CLK_CTRL      0x034
@@ -197,16 +241,41 @@ enum clk_sel {
 #define EE_AUDIO_ARB_CTRL                  0x0a0
 
 /*
- *     AUDIO TDM
+ *     AUDIO LOOPBACK
  */
 #define EE_AUDIO_LB_CTRL0                  0x0b0
-#define EE_AUDIO_LB_CTRL1                  0x0b1
-#define EE_AUDIO_DAT_ID0                   0x0b2
-#define EE_AUDIO_DAT_ID1                   0x0b3
-#define EE_AUDIO_LB_ID0                    0x0b4
-#define EE_AUDIO_LB_ID1                    0x0b5
-#define EE_AUDIO_LB_STS                    0x0b6
 
+#define EE_AUDIO_LB_A_CTRL0                0xb0
+#define EE_AUDIO_LB_A_CTRL1                0xb1
+#define EE_AUDIO_LB_A_CTRL2                0xb2
+#define EE_AUDIO_LB_A_CTRL3                0xb3
+#define EE_AUDIO_LB_A_DAT_CH_ID0           0xb4
+#define EE_AUDIO_LB_A_DAT_CH_ID1           0xb5
+#define EE_AUDIO_LB_A_DAT_CH_ID2           0xb6
+#define EE_AUDIO_LB_A_DAT_CH_ID3           0xb7
+#define EE_AUDIO_LB_A_LB_CH_ID0            0xb8
+#define EE_AUDIO_LB_A_LB_CH_ID1            0xb9
+#define EE_AUDIO_LB_A_LB_CH_ID2            0xba
+#define EE_AUDIO_LB_A_LB_CH_ID3            0xbb
+#define EE_AUDIO_LB_A_STS                  0xbc
+
+#define EE_AUDIO_LB_B_CTRL0                0x230
+#define EE_AUDIO_LB_B_CTRL1                0x231
+#define EE_AUDIO_LB_B_CTRL2                0x232
+#define EE_AUDIO_LB_B_CTRL3                0x233
+#define EE_AUDIO_LB_B_DAT_CH_ID0           0x234
+#define EE_AUDIO_LB_B_DAT_CH_ID1           0x235
+#define EE_AUDIO_LB_B_DAT_CH_ID2           0x236
+#define EE_AUDIO_LB_B_DAT_CH_ID3           0x237
+#define EE_AUDIO_LB_B_LB_CH_ID0            0x238
+#define EE_AUDIO_LB_B_LB_CH_ID1            0x239
+#define EE_AUDIO_LB_B_LB_CH_ID2            0x23a
+#define EE_AUDIO_LB_B_LB_CH_ID3            0x23b
+#define EE_AUDIO_LB_B_STS                  0x23c
+
+/*
+ *     AUDIO TDM
+ */
 #define EE_AUDIO_TDMIN_A_CTRL              0x0c0
 #define EE_AUDIO_TDMIN_A_SWAP0             0x0c1
 #define EE_AUDIO_TDMIN_A_SWAP1             0x260
@@ -544,20 +613,6 @@ enum clk_sel {
 #define EE_AUDIO_FRDDR_D_INIT_ADDR         0x229
 #define EE_AUDIO_FRDDR_D_CTRL2             0x22a
 
-#define EE_AUDIO_LB_B_CTRL0                0x230
-#define EE_AUDIO_LB_B_CTRL1                0x231
-#define EE_AUDIO_LB_B_CTRL2                0x232
-#define EE_AUDIO_LB_B_CTRL3                0x233
-#define EE_AUDIO_LB_B_DAT_CH_ID0           0x234
-#define EE_AUDIO_LB_B_DAT_CH_ID1           0x235
-#define EE_AUDIO_LB_B_DAT_CH_ID2           0x236
-#define EE_AUDIO_LB_B_DAT_CH_ID3           0x237
-#define EE_AUDIO_LB_B_LB_CH_ID0            0x238
-#define EE_AUDIO_LB_B_LB_CH_ID1            0x239
-#define EE_AUDIO_LB_B_LB_CH_ID2            0x23a
-#define EE_AUDIO_LB_B_LB_CH_ID3            0x23b
-#define EE_AUDIO_LB_B_STS                  0x23c
-
 /*
  *     AUDIO LOCKER
  */
index e429f4d..6b2fb6d 100644 (file)
@@ -27,8 +27,6 @@
 #include <sound/tlv.h>
 
 #include "resample.h"
-#include "resample_hw.h"
-#include "ddr_mngr.h"
 #include "regs.h"
 #include "iomap.h"
 
 
 /*#define __PTM_RESAMPLE_CLK__*/
 
-#define RESAMPLE_A    0
-#define RESAMPLE_B    1
+//#define RESAMPLE_A    0
+//#define RESAMPLE_B    1
 
 struct resample_chipinfo {
        int num;    /* support resample a/b */
-       int id;
+       enum resample_idx id;
 
        bool dividor_fn;
 };
@@ -60,15 +58,15 @@ struct audioresample {
 
        struct resample_chipinfo *chipinfo;
 
-       int id;
+       enum resample_idx id;
 
        /*which module should be resampled */
-       int resample_module;
+       enum toddr_src resample_module;
        /*  resample to the rate */
        int out_rate;
 
        /* sync with auge_resample_texts */
-       int asrc_rate_idx;
+       enum samplerate_index asrc_rate_idx;
 
        bool enable;
 };
@@ -77,11 +75,11 @@ struct audioresample *s_resample_a;
 
 struct audioresample *s_resample_b;
 
-static struct audioresample *get_audioresample(int id)
+struct audioresample *get_audioresample(enum resample_idx id)
 {
        struct audioresample *p_resample;
 
-       p_resample = ((id == 0) ? s_resample_a : s_resample_b);
+       p_resample = ((id == RESAMPLE_A) ? s_resample_a : s_resample_b);
 
        if (!p_resample) {
                pr_debug("Not init audio resample\n");
@@ -93,7 +91,7 @@ static struct audioresample *get_audioresample(int id)
 
 int get_resample_module_num(void)
 {
-       struct audioresample *p_resample = get_audioresample(0);
+       struct audioresample *p_resample = get_audioresample(RESAMPLE_A);
 
        if (p_resample && p_resample->chipinfo)
                return p_resample->chipinfo->num;
@@ -101,6 +99,32 @@ int get_resample_module_num(void)
        return 1;
 }
 
+int set_resample_source(enum resample_idx id, enum toddr_src src)
+{
+       struct audioresample *p_resample = get_audioresample(id);
+       (void)p_resample;
+       (void)src;
+       //p_resample->resample_module = src;
+       return 0;
+}
+
+static int set_resample_rate_index(
+               enum resample_idx id, enum samplerate_index index)
+{
+       struct audioresample *p_resample = get_audioresample(id);
+
+       p_resample->asrc_rate_idx = index;
+       return 0;
+}
+
+static enum samplerate_index get_resample_rate_index(
+               enum resample_idx id)
+{
+       struct audioresample *p_resample = get_audioresample(id);
+
+       return p_resample->asrc_rate_idx;
+}
+
 static int resample_clk_set(struct audioresample *p_resample)
 {
        int ret = 0;
@@ -126,7 +150,7 @@ static int resample_clk_set(struct audioresample *p_resample)
                        clk_set_rate(p_resample->sclk, 48000 * CLK_RATIO);
                        clk_set_rate(p_resample->clk, 48000 * CLK_RATIO);
                }
-
+#if 0
                ret = clk_prepare_enable(p_resample->pll);
                if (ret) {
                        pr_err("Can't enable pll clock: %d\n", ret);
@@ -146,6 +170,7 @@ static int resample_clk_set(struct audioresample *p_resample)
                                ret);
                        return -EINVAL;
                }
+#endif
 
                pr_info("%s, resample_pll:%lu, sclk:%lu, clk:%lu\n",
                        __func__,
@@ -153,9 +178,11 @@ static int resample_clk_set(struct audioresample *p_resample)
                        clk_get_rate(p_resample->sclk),
                        clk_get_rate(p_resample->clk));
        } else {
+#if 0
                clk_disable_unprepare(p_resample->clk);
                clk_disable_unprepare(p_resample->sclk);
                clk_disable_unprepare(p_resample->pll);
+#endif
        }
 
        return ret;
@@ -194,25 +221,25 @@ static const char *const auge_resample_texts[] = {
        "Enable:192K",
 };
 
-static int resample_idx2rate(int index)
+static int resample_idx2rate(enum samplerate_index index)
 {
        int rate = 0;
 
-       if (index == 0)
+       if (index == RATE_OFF)
                rate = 0;
-       else if (index == 1)
+       else if (index == RATE_32K)
                rate = 32000;
-       else if (index == 2)
+       else if (index == RATE_44K)
                rate = 44100;
-       else if (index == 3)
+       else if (index == RATE_48K)
                rate = 48000;
-       else if (index == 4)
+       else if (index == RATE_88K)
                rate = 88200;
-       else if (index == 5)
+       else if (index == RATE_96K)
                rate = 96000;
-       else if (index == 6)
+       else if (index == RATE_176K)
                rate = 176400;
-       else if (index == 7)
+       else if (index == RATE_192K)
                rate = 192000;
 
        return rate;
@@ -238,15 +265,16 @@ static int resample_get_enum(
        return 0;
 }
 
-int resample_set(int id, int index)
+int resample_set(enum resample_idx id, enum samplerate_index index)
 {
-       int resample_rate = resample_idx2rate(index);
+       int resample_rate = 0;
        struct audioresample *p_resample = get_audioresample(id);
+       int ret = 0;
 
        if (!p_resample)
                return 0;
 
-       if (index < 0 || index > 7) {
+       if (index < RATE_OFF || index > RATE_192K) {
                pr_err("%s(), invalid index %d\n", __func__, index);
                return 0;
        }
@@ -257,25 +285,37 @@ int resample_set(int id, int index)
                auge_resample_texts[index],
                auge_resample_texts[p_resample->asrc_rate_idx]);
 
+#if 0
        if (index == p_resample->asrc_rate_idx)
                return 0;
+#endif
+       set_resample_rate_index(id, index);
 
-       p_resample->asrc_rate_idx = index;
-
-       if (audio_resample_set(p_resample, (bool)index, resample_rate))
-               return 0;
+       resample_rate = resample_idx2rate(index);
+       ret = audio_resample_set(p_resample, (bool)index, resample_rate);
+       if (ret)
+               return ret;
 
-       if ((index == 0) || (resample_rate == 0))
+       if (index == RATE_OFF)
                resample_disable(p_resample->id);
        else {
                resample_init(p_resample->id, resample_rate);
 
-               resample_set_hw_param(p_resample->id, index - 1);
+               resample_set_hw_param(p_resample->id, index);
        }
 
        return 0;
 }
 
+int resample_set_inner_rate(enum resample_idx id)
+{
+       enum samplerate_index index = get_resample_rate_index(id);
+
+       pr_debug("%s() index %d\n", __func__, id);
+
+       return resample_set(id, index);
+}
+
 static int resample_set_enum(
        struct snd_kcontrol *kcontrol,
        struct snd_ctl_elem_value *ucontrol)
@@ -288,7 +328,8 @@ static int resample_set_enum(
                return 0;
        }
 
-       resample_set(p_resample->id, index);
+       set_resample_rate_index(p_resample->id, index);
+       resample_set_inner_rate(p_resample->id);
 
        return 0;
 }
@@ -351,6 +392,10 @@ static const char *const auge_resample_module_texts[] = {
        "FRHDMIRX", /* from tl1 chipset*/
        "LOOPBACK_B",
        "SPDIFIN_LB",
+       "RESERVED_0",
+       "RESERVED_1",
+       "RESERVED_2",
+       "RESERVED_3",
        "VAD",
 };
 
@@ -394,7 +439,6 @@ static int resample_module_set_enum(
 
        return 0;
 }
-
 static const struct snd_kcontrol_new asrc_a_controls[] = {
        SOC_ENUM_EXT("Hardware resample enable",
                     auge_resample_enum,
@@ -405,7 +449,7 @@ static const struct snd_kcontrol_new asrc_a_controls[] = {
                         mixer_audiobus_read, mixer_audiobus_write,
                         NULL),
        SOC_SINGLE_EXT_TLV("Hw resample pause thd",
-                        EE_AUDIO_RESAMPLEA_CTRL2, 0, 0xffffff, 0,
+                        EE_AUDIO_RESAMPLEA_CTRL2, 11, 0x1fff, 0,
                         mixer_audiobus_read, mixer_audiobus_write,
                         NULL),
        SOC_ENUM_EXT("Hw resample module",
@@ -424,7 +468,7 @@ static const struct snd_kcontrol_new asrc_b_controls[] = {
                         mixer_audiobus_read, mixer_audiobus_write,
                         NULL),
        SOC_SINGLE_EXT_TLV("Hw resample b pause thd",
-                        EE_AUDIO_RESAMPLEB_CTRL2, 0, 0xffffff, 0,
+                        EE_AUDIO_RESAMPLEB_CTRL2, 11, 0x1fff, 0,
                         mixer_audiobus_read, mixer_audiobus_write,
                         NULL),
        SOC_ENUM_EXT("Hw resample b module",
@@ -572,6 +616,13 @@ static int resample_platform_probe(struct platform_device *pdev)
                return ret;
        }
 
+       ret = clk_prepare_enable(p_resample->clk);
+       if (ret) {
+               pr_err("Can't enable resample_clk clock: %d\n",
+                       ret);
+               return ret;
+       }
+
        p_resample->dev = dev;
 
        if (p_chipinfo && p_chipinfo->id == 1)
index a86c8c0..b82aac3 100644 (file)
 #ifndef __AML_AUDIO_RESAMPLE_H__
 #define __AML_AUDIO_RESAMPLE_H__
 
+#include "resample_hw.h"
+
 extern int card_add_resample_kcontrols(struct snd_soc_card *card);
 
-extern int resample_set(int id, int index);
+extern int resample_set(enum resample_idx id, enum samplerate_index index);
 
 extern int get_resample_module_num(void);
 
+int set_resample_source(enum resample_idx id, enum toddr_src src);
+
+int resample_set_inner_rate(enum resample_idx id);
+
+struct audioresample *get_audioresample(enum resample_idx id);
+
 #endif
index 1722ce8..73c7dd3 100644 (file)
@@ -40,7 +40,7 @@ static u32 resample_coef_parameters_table[7][5] = {
        {0x00800000, 0x0, 0x0, 0x0, 0x0},
 };
 
-void resample_enable(int id, bool enable)
+void resample_enable(enum resample_idx id, bool enable)
 {
        int offset = EE_AUDIO_RESAMPLEB_CTRL0 - EE_AUDIO_RESAMPLEA_CTRL0;
        int reg = EE_AUDIO_RESAMPLEA_CTRL0 + offset * id;
@@ -58,7 +58,7 @@ void resample_enable(int id, bool enable)
                enable << 28);
 }
 
-int resample_init(int id, int input_sr)
+int resample_init(enum resample_idx id, int input_sr)
 {
        u16 Avg_cnt_init = 0;
        unsigned int clk_rate = 167000000;//clk81;
@@ -77,15 +77,15 @@ int resample_init(int id, int input_sr)
                Avg_cnt_init);
 
        audiobus_update_bits(reg,
-               0x3 << 26 | 0x3ff << 16 | 0xffff << 0,
+               0x3 << 26 | 0x3ff << 16 | 0xffff,
                0x0 << 26 | /* method0 */
                RESAMPLE_CNT_CONTROL << 16 |
-               Avg_cnt_init << 0);
+               Avg_cnt_init);
 
        return 0;
 }
 
-int resample_disable(int id)
+int resample_disable(enum resample_idx id)
 {
        int offset = EE_AUDIO_RESAMPLEB_CTRL0 - EE_AUDIO_RESAMPLEA_CTRL0;
        int reg = EE_AUDIO_RESAMPLEA_CTRL0 + offset * id;
@@ -95,33 +95,39 @@ int resample_disable(int id)
        return 0;
 }
 
-int resample_set_hw_param(int id, int index)
+int resample_set_hw_param(enum resample_idx id,
+               enum samplerate_index rate_index)
 {
        int i, reg, offset;
 
+       if (rate_index < RATE_32K) {
+               pr_info("%s(), inval index %d", __func__, rate_index);
+               return -EINVAL;
+       }
        offset = EE_AUDIO_RESAMPLEB_COEF0 - EE_AUDIO_RESAMPLEA_COEF0;
        reg = EE_AUDIO_RESAMPLEA_COEF0 + offset * id;
        for (i = 0; i < 5; i++) {
                audiobus_write((reg + i),
-                       resample_coef_parameters_table[index][i]);
+                       resample_coef_parameters_table[rate_index - 1][i]);
        }
 
        offset = EE_AUDIO_RESAMPLEB_CTRL2 - EE_AUDIO_RESAMPLEA_CTRL2;
        reg = EE_AUDIO_RESAMPLEA_CTRL2 + offset * id;
        audiobus_update_bits(reg,
                        1 << 25, 1 << 25);
+       resample_set_hw_pause_thd(id, 128);
 
        return 0;
 }
-
+/* not avail for tl1 */
 void resample_src_select(int src)
 {
        audiobus_update_bits(EE_AUDIO_RESAMPLEA_CTRL0,
                0x3 << 29,
                src << 29);
 }
-
-void resample_src_select_ab(int id, int src)
+/* for tl1 and after */
+void resample_src_select_ab(enum resample_idx id, enum toddr_src src)
 {
        int offset = EE_AUDIO_RESAMPLEB_CTRL3 - EE_AUDIO_RESAMPLEA_CTRL3;
        int reg = EE_AUDIO_RESAMPLEA_CTRL3 + offset * id;
@@ -131,7 +137,7 @@ void resample_src_select_ab(int id, int src)
                src << 16);
 }
 
-void resample_format_set(int id, int ch_num, int bits)
+void resample_format_set(enum resample_idx id, int ch_num, int bits)
 {
        int offset = EE_AUDIO_RESAMPLEB_CTRL3 - EE_AUDIO_RESAMPLEA_CTRL3;
        int reg = EE_AUDIO_RESAMPLEA_CTRL3 + offset * id;
@@ -140,7 +146,7 @@ void resample_format_set(int id, int ch_num, int bits)
                ch_num << 8 | (bits - 1) << 0);
 }
 
-int resample_ctrl_read(int id)
+int resample_ctrl_read(enum resample_idx id)
 {
        int offset = EE_AUDIO_RESAMPLEB_CTRL0 - EE_AUDIO_RESAMPLEA_CTRL0;
        int reg = EE_AUDIO_RESAMPLEA_CTRL0 + offset * id;
@@ -148,10 +154,20 @@ int resample_ctrl_read(int id)
        return audiobus_read(reg);
 }
 
-void resample_ctrl_write(int id, int value)
+void resample_ctrl_write(enum resample_idx id, int value)
 {
        int offset = EE_AUDIO_RESAMPLEB_CTRL0 - EE_AUDIO_RESAMPLEA_CTRL0;
        int reg = EE_AUDIO_RESAMPLEA_CTRL0 + offset * id;
 
        audiobus_write(reg, value);
 }
+
+int resample_set_hw_pause_thd(enum resample_idx id, unsigned int thd)
+{
+       int offset = EE_AUDIO_RESAMPLEB_CTRL2 - EE_AUDIO_RESAMPLEA_CTRL2;
+       int reg = EE_AUDIO_RESAMPLEA_CTRL2 + offset * id;
+
+       audiobus_write(reg, 1 << 24 | thd << 11);
+
+       return 0;
+}
index 1ec4b16..61b0629 100644 (file)
 #ifndef __AML_AUDIO_RESAMPLE_HW_H__
 #define __AML_AUDIO_RESAMPLE_HW_H__
 
-extern void resample_enable(int id, bool enable);
-extern int resample_init(int id, int input_sr);
-extern int resample_disable(int id);
-extern int resample_set_hw_param(int id, int index);
+#include "ddr_mngr.h"
+
+enum samplerate_index {
+       RATE_OFF,
+       RATE_32K,
+       RATE_44K,
+       RATE_48K,
+       RATE_88K,
+       RATE_96K,
+       RATE_176K,
+       RATE_192K,
+};
+
+extern void resample_enable(enum resample_idx id, bool enable);
+extern int resample_init(enum resample_idx id, int input_sr);
+extern int resample_disable(enum resample_idx id);
+extern int resample_set_hw_param(enum resample_idx id,
+               enum samplerate_index rate_index);
 extern void resample_src_select(int src);
-extern void resample_src_select_ab(int id, int src);
-extern void resample_format_set(int id, int ch_num, int bits);
+extern void resample_src_select_ab(enum resample_idx id, enum toddr_src src);
+extern void resample_format_set(enum resample_idx id, int ch_num, int bits);
 
-extern int resample_ctrl_read(int id);
-extern void resample_ctrl_write(int id, int value);
+extern int resample_ctrl_read(enum resample_idx id);
+extern void resample_ctrl_write(enum resample_idx id, int value);
+int resample_set_hw_pause_thd(enum resample_idx id, unsigned int thd);
 
 #endif
index 1a740c4..9c0f4bd 100644 (file)
@@ -83,7 +83,7 @@ void sharebuffer_enable(int sel, bool enable, bool reenable)
 }
 
 int sharebuffer_prepare(struct snd_pcm_substream *substream,
-       void *pfrddr, int samesource_sel, int lane_i2s)
+       void *pfrddr, int samesource_sel, int lane_i2s, int offset)
 {
        struct frddr *fr = (struct frddr *)pfrddr;
 
index c8e39c5..6455bfe 100644 (file)
@@ -18,7 +18,7 @@
 #define __AML_AUDIO_SHAREBUFFER_H__
 
 extern int sharebuffer_prepare(struct snd_pcm_substream *substream,
-       void *pfrddr, int samesource_sel, int lane_i2s);
+       void *pfrddr, int samesource_sel, int lane_i2s, int offset);
 extern int sharebuffer_free(struct snd_pcm_substream *substream,
                void *pfrddr, int samesource_sel);
 extern int sharebuffer_trigger(int cmd, int samesource_sel, bool reenable);
index 6a234b2..0d40d68 100644 (file)
@@ -244,9 +244,9 @@ CLOCK_COM_MUX(eqdrc, AUD_ADDR_OFFSET(EE_AUDIO_CLK_EQDRC_CTRL0), 0x7, 24);
 CLOCK_COM_DIV(eqdrc, AUD_ADDR_OFFSET(EE_AUDIO_CLK_EQDRC_CTRL0), 0, 16);
 CLOCK_COM_GATE(eqdrc, AUD_ADDR_OFFSET(EE_AUDIO_CLK_EQDRC_CTRL0), 31);
 /* audio vad  */
-CLOCK_COM_MUX(vad, AUD_ADDR_OFFSET(EE_AUDIO_VAD_CLK_CTRL), 0x7, 24);
-CLOCK_COM_DIV(vad, AUD_ADDR_OFFSET(EE_AUDIO_VAD_CLK_CTRL), 0, 16);
-CLOCK_COM_GATE(vad, AUD_ADDR_OFFSET(EE_AUDIO_VAD_CLK_CTRL), 31);
+CLOCK_COM_MUX(vad, AUD_ADDR_OFFSET(EE_AUDIO_CLK_VAD_CTRL), 0x7, 24);
+CLOCK_COM_DIV(vad, AUD_ADDR_OFFSET(EE_AUDIO_CLK_VAD_CTRL), 0, 16);
+CLOCK_COM_GATE(vad, AUD_ADDR_OFFSET(EE_AUDIO_CLK_VAD_CTRL), 31);
 /* EARC TX CMDC */
 CLOCK_COM_MUX(earctx_cmdc,
        AUD_ADDR_OFFSET(EE_AUDIO_EARCTX_CMDC_CLK_CTRL), 0x7, 24);
index 54d4b3e..852c3f2 100644 (file)
@@ -36,7 +36,6 @@
 #include "ddr_mngr.h"
 #include "spdif_hw.h"
 #include "spdif_match_table.c"
-#include "audio_utils.h"
 #include "resample.h"
 #include "resample_hw.h"
 
@@ -86,11 +85,11 @@ struct aml_spdif {
        /*
         * resample a/b do asrc for spdif in
         */
-       unsigned int asrc_id;
+       enum resample_idx asrc_id;
        /* spdif in do asrc for pcm,
         * if raw data, disable it automatically.
         */
-       unsigned int auto_asrc;
+       enum samplerate_index auto_asrc;
 
        /* check spdifin channel status for pcm or nonpcm */
        struct timer_list timer;
@@ -115,6 +114,7 @@ struct aml_spdif {
        /* mixer control vals */
        bool mute;
        enum SPDIF_SRC spdifin_src;
+       int clk_tuning_enable;
 };
 
 static const struct snd_pcm_hardware aml_spdif_hardware = {
@@ -401,7 +401,9 @@ static const struct snd_kcontrol_new snd_spdif_controls[] = {
                                0, aml_get_hdmi_out_audio,
                                aml_set_hdmi_out_audio),
 #endif
+};
 
+static const struct snd_kcontrol_new snd_spdif_clk_controls[] = {
        SOC_SINGLE_EXT("SPDIF CLK Fine Setting",
                                0, 0, 2000000, 0,
                                spdif_clk_get,
@@ -457,7 +459,7 @@ static void spdifin_audio_type_work_func(struct work_struct *work)
 
        if (val & 0x2)
                /* nonpcm, resample disable */
-               resample_set(p_spdif->asrc_id, 0);
+               resample_set(p_spdif->asrc_id, RATE_OFF);
        else
                /* pcm, resample which rate ? */
                resample_set(p_spdif->asrc_id, p_spdif->auto_asrc);
@@ -668,7 +670,7 @@ static void spdifin_status_event(struct aml_spdif *p_spdif)
 #ifdef __SPDIFIN_AUDIO_TYPE_HW__
                        /* resample disable, by hw */
                        if (!spdifin_check_audiotype_by_sw(p_spdif))
-                               resample_set(p_spdif->asrc_id, 0);
+                               resample_set(p_spdif->asrc_id, RATE_OFF);
 #endif
 #endif
                }
@@ -749,7 +751,7 @@ static int aml_spdif_open(struct snd_pcm_substream *substream)
        if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
                p_spdif->fddr = aml_audio_register_frddr(dev,
                        p_spdif->actrl,
-                       aml_spdif_ddr_isr, substream);
+                       aml_spdif_ddr_isr, substream, false);
                if (p_spdif->fddr == NULL) {
                        dev_err(dev, "failed to claim from ddr\n");
                        return -ENXIO;
@@ -986,6 +988,15 @@ static int aml_dai_spdif_probe(struct snd_soc_dai *cpu_dai)
                        pr_err("%s, failed add snd spdif controls\n", __func__);
        }
 
+       if (p_spdif->clk_tuning_enable == 1) {
+               ret = snd_soc_add_dai_controls(cpu_dai,
+                               snd_spdif_clk_controls,
+                               ARRAY_SIZE(snd_spdif_clk_controls));
+               if (ret < 0)
+                       pr_err("%s, failed add snd spdif clk controls\n",
+                               __func__);
+       }
+
        return 0;
 }
 
@@ -1091,7 +1102,7 @@ static void aml_dai_spdif_shutdown(
 #ifdef __SPDIFIN_AUDIO_TYPE_HW__
                /* resample disabled, by hw */
                if (!spdifin_check_audiotype_by_sw(p_spdif))
-                       resample_set(p_spdif->asrc_id, 0);
+                       resample_set(p_spdif->asrc_id, RATE_OFF);
 #endif
                clk_disable_unprepare(p_spdif->clk_spdifin);
                clk_disable_unprepare(p_spdif->fixed_clk);
@@ -1152,50 +1163,30 @@ static int aml_dai_spdif_prepare(
                struct toddr_fmt fmt;
                unsigned int msb, lsb, toddr_type;
 
-               if (loopback_is_enable()) {
-                       switch (bit_depth) {
-                       case 8:
-                       case 16:
-                       case 32:
-                               toddr_type = 0;
-                               break;
-                       case 24:
-                               toddr_type = 4;
-                               break;
-                       default:
-                               pr_err(
-                                       "runtime format invalid bit_depth: %d\n",
-                                       bit_depth);
-                               return -EINVAL;
-                       }
-                       msb = 32 - 1;
-                       lsb = 32 - bit_depth;
-               } else {
-                       switch (bit_depth) {
-                       case 8:
-                       case 16:
-                               toddr_type = 0;
-                               break;
-                       case 24:
-                               toddr_type = 4;
-                               break;
-                       case 32:
-                               toddr_type = 3;
-                               break;
-                       default:
-                               dev_err(p_spdif->dev,
-                                       "runtime format invalid bit_depth: %d\n",
-                                       bit_depth);
-                               return -EINVAL;
-                       }
-
-                       msb = 28 - 1;
-                       if (bit_depth <= 24)
-                               lsb = 28 - bit_depth;
-                       else
-                               lsb = 4;
+               switch (bit_depth) {
+               case 8:
+               case 16:
+                       toddr_type = 0;
+                       break;
+               case 24:
+                       toddr_type = 4;
+                       break;
+               case 32:
+                       toddr_type = 3;
+                       break;
+               default:
+                       dev_err(p_spdif->dev,
+                               "runtime format invalid bit_depth: %d\n",
+                               bit_depth);
+                       return -EINVAL;
                }
 
+               msb = 28 - 1;
+               if (bit_depth <= 24)
+                       lsb = 28 - bit_depth;
+               else
+                       lsb = 4;
+
                // to ddr spdifin
                fmt.type       = toddr_type;
                fmt.msb        = msb;
@@ -1240,6 +1231,8 @@ static int aml_dai_spdif_trigger(struct snd_pcm_substream *substream, int cmd,
 
                if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
                        dev_info(substream->pcm->card->dev, "S/PDIF Playback enable\n");
+                       aml_spdif_enable(p_spdif->actrl,
+                           substream->stream, p_spdif->id, true);
                        aml_frddr_enable(p_spdif->fddr, 1);
                        udelay(100);
                        aml_spdif_mute(p_spdif->actrl,
@@ -1247,32 +1240,38 @@ static int aml_dai_spdif_trigger(struct snd_pcm_substream *substream, int cmd,
                } else {
                        dev_info(substream->pcm->card->dev, "S/PDIF Capture enable\n");
                        aml_toddr_enable(p_spdif->tddr, 1);
+                       aml_spdif_enable(p_spdif->actrl,
+                           substream->stream, p_spdif->id, true);
                }
 
-               aml_spdif_enable(p_spdif->actrl,
-                       substream->stream, p_spdif->id, true);
-
                break;
        case SNDRV_PCM_TRIGGER_STOP:
        case SNDRV_PCM_TRIGGER_SUSPEND:
        case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
                if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
                        dev_info(substream->pcm->card->dev, "S/PDIF Playback disable\n");
+                       /* continuous-clock, spdif out is not disable,
+                        * only mute, ensure spdif outputs zero data.
+                        */
+                       if (p_spdif->clk_cont) {
+                               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);
+                       }
+
+                       if (p_spdif->chipinfo &&
+                               p_spdif->chipinfo->async_fifo)
+                               aml_frddr_check(p_spdif->fddr);
                        aml_frddr_enable(p_spdif->fddr, 0);
                } else {
                        dev_info(substream->pcm->card->dev, "S/PDIF Capture disable\n");
                        aml_toddr_enable(p_spdif->tddr, 0);
-               }
-               /* continuous-clock, spdif out is not disable,
-                * only mute, ensure spdif outputs zero data.
-                */
-               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);
+                                       substream->stream, p_spdif->id, false);
+               }
+
                break;
        default:
                return -EINVAL;
@@ -1492,11 +1491,11 @@ static int aml_spdif_parse_of(struct platform_device *pdev)
                if (ret < 0)
                        p_spdif->auto_asrc = 0;
 
-               if (p_spdif->auto_asrc < 0 ||
-                               p_spdif->auto_asrc > 7) {
+               if (p_spdif->auto_asrc < RATE_OFF ||
+                               p_spdif->auto_asrc > RATE_192K) {
                        pr_info("%s(), inval asrc setting %d\n",
                                __func__, p_spdif->auto_asrc);
-                       p_spdif->auto_asrc = 0;
+                       p_spdif->auto_asrc = RATE_OFF;
                }
                pr_debug("SPDIF id %d asrc_id:%d auto_asrc:%d\n",
                        p_spdif->id,
@@ -1524,6 +1523,15 @@ static int aml_spdif_parse_of(struct platform_device *pdev)
                return PTR_ERR(p_spdif->clk_spdifout);
        }
 
+       ret = of_property_read_u32(pdev->dev.of_node,
+                               "clk_tuning_enable",
+                               &p_spdif->clk_tuning_enable);
+       if (ret < 0)
+               p_spdif->clk_tuning_enable = 0;
+       else
+               pr_info("Spdif id %d tuning clk enable:%d\n",
+                       p_spdif->id, p_spdif->clk_tuning_enable);
+
        return 0;
 }
 
index 971d29b..d7f1c2e 100644 (file)
@@ -694,3 +694,28 @@ void spdifout_play_with_zerodata_free(unsigned int spdif_id)
        /* free frddr, then frddr in mngr */
        frddr_deinit_without_mngr(spdif_id);
 }
+
+void aml_spdif_out_reset(unsigned int spdif_id, int offset)
+{
+       unsigned int reg = 0, val = 0;
+
+       if ((offset != 0) && (offset != 1)) {
+               pr_err("%s(), invalid offset = %d\n", __func__, offset);
+               return;
+       }
+
+       if (spdif_id == 0) {
+               reg = EE_AUDIO_SW_RESET0(offset);
+               val = REG_BIT_RESET_SPDIFOUTA;
+       } else if (spdif_id == 1) {
+               reg = EE_AUDIO_SW_RESET0(offset);
+               val = REG_BIT_RESET_SPDIFOUTB;
+       } else {
+               pr_err("invalid spdif id %d\n", spdif_id);
+               return;
+       }
+
+       audiobus_update_bits(reg, val, val);
+       audiobus_update_bits(reg, val, 0);
+}
+
index e15efa3..fb4c2a1 100644 (file)
@@ -93,4 +93,6 @@ extern void spdif_set_channel_status_info(
 extern void spdifout_play_with_zerodata(unsigned int spdif_id, bool reenable);
 extern void spdifout_play_with_zerodata_free(unsigned int spdif_id);
 extern void spdifin_set_src(int src);
+void aml_spdif_out_reset(unsigned int spdif_id, int offset);
+
 #endif
index 0253015..5f6734f 100644 (file)
@@ -39,6 +39,8 @@ struct spdif_chipinfo {
        bool pcpd_separated;
        /* same source, spdif re-enable */
        bool same_src_spdif_reen;
+       /* async fifo */
+       bool async_fifo;
 };
 
 struct spdif_chipinfo axg_spdif_chipinfo = {
@@ -69,6 +71,7 @@ struct spdif_chipinfo tl1_spdif_a_chipinfo = {
        .chnum_en     = true,
        .hold_start   = true,
        .eq_drc_en    = true,
+       .async_fifo   = true,
 };
 
 struct spdif_chipinfo tl1_spdif_b_chipinfo = {
@@ -76,6 +79,7 @@ struct spdif_chipinfo tl1_spdif_b_chipinfo = {
        .chnum_en     = true,
        .hold_start   = true,
        .eq_drc_en    = true,
+       .async_fifo   = true,
 };
 
 struct spdif_chipinfo sm1_spdif_a_chipinfo = {
@@ -83,6 +87,7 @@ struct spdif_chipinfo sm1_spdif_a_chipinfo = {
        .chnum_en     = true,
        .hold_start   = true,
        .eq_drc_en    = true,
+       .async_fifo   = true,
 };
 
 struct spdif_chipinfo sm1_spdif_b_chipinfo = {
@@ -90,6 +95,23 @@ struct spdif_chipinfo sm1_spdif_b_chipinfo = {
        .chnum_en     = true,
        .hold_start   = true,
        .eq_drc_en    = true,
+       .async_fifo   = true,
+};
+
+struct spdif_chipinfo tm2_spdif_a_chipinfo = {
+       .id           = SPDIF_A,
+       .chnum_en     = true,
+       .hold_start   = true,
+       .eq_drc_en    = true,
+       .async_fifo   = true,
+};
+
+struct spdif_chipinfo tm2_spdif_b_chipinfo = {
+       .id           = SPDIF_B,
+       .chnum_en     = true,
+       .hold_start   = true,
+       .eq_drc_en    = true,
+       .async_fifo   = true,
 };
 
 static const struct of_device_id aml_spdif_device_id[] = {
@@ -121,6 +143,14 @@ static const struct of_device_id aml_spdif_device_id[] = {
                .compatible = "amlogic, sm1-snd-spdif-b",
                .data           = &sm1_spdif_b_chipinfo,
        },
+       {
+               .compatible = "amlogic, tm2-snd-spdif-a",
+               .data           = &tm2_spdif_a_chipinfo,
+       },
+       {
+               .compatible = "amlogic, tm2-snd-spdif-b",
+               .data           = &tm2_spdif_b_chipinfo,
+       },
        {},
 };
 MODULE_DEVICE_TABLE(of, aml_spdif_device_id);
index 8c824cc..e31c9f0 100644 (file)
@@ -41,8 +41,8 @@
 #include "sharebuffer.h"
 #include "vad.h"
 #include "spdif_hw.h"
-
 #include "tdm_match_table.c"
+#include "effects_v2.h"
 
 /*#define __PTM_TDM_CLK__*/
 
@@ -107,6 +107,11 @@ struct aml_tdm {
 
        bool en_share;
        unsigned int lane_cnt;
+
+       /* tdmin_lb src sel */
+       int tdmin_lb_src;
+       int start_clk_enable;
+       int clk_tuning_enable;
 };
 
 static const struct snd_pcm_hardware aml_tdm_hardware = {
@@ -196,21 +201,19 @@ static const struct soc_enum i2sin_clk_enum[] = {
                        i2sin_clk),
 };
 
-
-
 static const struct snd_kcontrol_new snd_tdm_controls[] = {
        SOC_ENUM_EXT("I2SIn CLK", i2sin_clk_enum,
                                tdmin_clk_get,
                                NULL),
+};
 
+static const struct snd_kcontrol_new snd_tdm_clk_controls[] = {
        SOC_SINGLE_EXT("TDM MCLK Fine Setting",
                                0, 0, 2000000, 0,
                                tdm_clk_get,
                                tdm_clk_set),
 };
 
-
-
 static irqreturn_t aml_tdm_ddr_isr(int irq, void *devid)
 {
        struct snd_pcm_substream *substream = (struct snd_pcm_substream *)devid;
@@ -312,13 +315,20 @@ static int aml_tdm_open(struct snd_pcm_substream *substream)
        struct device *dev = rtd->platform->dev;
        struct aml_tdm *p_tdm;
 
+       pr_info("%s\n", __func__);
        p_tdm = (struct aml_tdm *)dev_get_drvdata(dev);
 
        snd_soc_set_runtime_hwparams(substream, &aml_tdm_hardware);
 
        if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+               int dst_id = get_aed_dst();
+               bool aed_dst_status = false;
+
+               if (dst_id == p_tdm->id)
+                       aed_dst_status = true;
                p_tdm->fddr = aml_audio_register_frddr(dev,
-                       p_tdm->actrl, aml_tdm_ddr_isr, substream);
+                       p_tdm->actrl, aml_tdm_ddr_isr,
+                       substream, aed_dst_status);
                if (p_tdm->fddr == NULL) {
                        dev_err(dev, "failed to claim from ddr\n");
                        return -ENXIO;
@@ -376,6 +386,21 @@ static int aml_tdm_prepare(struct snd_pcm_substream *substream)
        if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
                struct frddr *fr = p_tdm->fddr;
 
+               if (p_tdm->chipinfo && p_tdm->chipinfo->async_fifo) {
+                       int offset = p_tdm->chipinfo->reset_reg_offset;
+
+                       pr_debug("%s(), reset fddr\n", __func__);
+                       aml_frddr_reset(p_tdm->fddr, offset);
+                       aml_tdm_out_reset(p_tdm->id, offset);
+
+                       if (p_tdm->chipinfo->same_src_fn
+                               && (p_tdm->samesource_sel >= 0)
+                               && (aml_check_sharebuffer_valid(p_tdm->fddr,
+                                       p_tdm->samesource_sel))
+                               && p_tdm->en_share)
+                               aml_spdif_out_reset(p_tdm->samesource_sel - 3,
+                                               offset);
+               }
                aml_frddr_set_buf(fr, start_addr, end_addr);
                aml_frddr_set_intrpt(fr, int_addr);
        } else {
@@ -458,11 +483,12 @@ static int aml_dai_tdm_prepare(struct snd_pcm_substream *substream,
                        p_tdm->chipinfo->same_src_fn
                        && (p_tdm->samesource_sel >= 0)
                        && (aml_check_sharebuffer_valid(p_tdm->fddr,
-                                       p_tdm->samesource_sel))
+                               p_tdm->samesource_sel))
                        && p_tdm->en_share) {
                                sharebuffer_prepare(substream,
                                        fr, p_tdm->samesource_sel,
-                                       p_tdm->lane_ss);
+                                       p_tdm->lane_ss,
+                                       p_tdm->chipinfo->reset_reg_offset);
                }
 
                /* i2s source to hdmix */
@@ -526,7 +552,7 @@ static int aml_dai_tdm_prepare(struct snd_pcm_substream *substream,
                        return -EINVAL;
                }
 
-               dev_info(substream->pcm->card->dev, "tdm prepare----capture\n");
+               dev_info(substream->pcm->card->dev, "tdm prepare capture\n");
                switch (p_tdm->id) {
                case 0:
                        src = TDMIN_A;
@@ -537,6 +563,9 @@ static int aml_dai_tdm_prepare(struct snd_pcm_substream *substream,
                case 2:
                        src = TDMIN_C;
                break;
+               case 3:
+                       src = TDMIN_LB;
+               break;
                default:
                        dev_err(p_tdm->dev, "invalid id: %d\n",
                                        p_tdm->id);
@@ -580,18 +609,6 @@ static int aml_dai_tdm_trigger(struct snd_pcm_substream *substream, int cmd,
 {
        struct aml_tdm *p_tdm = snd_soc_dai_get_drvdata(cpu_dai);
 
-       /* share buffer trigger */
-       if ((substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
-               && p_tdm->chipinfo
-               && p_tdm->chipinfo->same_src_fn
-               && (p_tdm->samesource_sel >= 0)
-               && (aml_check_sharebuffer_valid(p_tdm->fddr,
-                               p_tdm->samesource_sel))
-               && p_tdm->en_share)
-               sharebuffer_trigger(cmd,
-                       p_tdm->samesource_sel,
-                       p_tdm->chipinfo->same_src_spdif_reen);
-
        switch (cmd) {
        case SNDRV_PCM_TRIGGER_START:
        case SNDRV_PCM_TRIGGER_RESUME:
@@ -612,13 +629,31 @@ static int aml_dai_tdm_trigger(struct snd_pcm_substream *substream, int cmd,
                aml_tdm_fifo_reset(p_tdm->actrl, substream->stream, p_tdm->id);
 
                if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+                       /* output START sequence:
+                        * 1. Frddr/TDMOUT/SPDIF reset(may cause the AVR mute)
+                        * 2. ctrl0 set to 0
+                        * 3. TDMOUT enable
+                        * 4. SPDIFOUT enable
+                        * 5. FRDDR enable
+                        */
                        dev_info(substream->pcm->card->dev, "tdm playback enable\n");
-                       aml_frddr_enable(p_tdm->fddr, 1);
+                       /*don't change this flow*/
+                       aml_aed_top_enable(p_tdm->fddr, true);
                        aml_tdm_enable(p_tdm->actrl,
                                substream->stream, p_tdm->id, true);
+                       if (p_tdm->chipinfo
+                               && p_tdm->chipinfo->same_src_fn
+                               && (p_tdm->samesource_sel >= 0)
+                               && (aml_check_sharebuffer_valid(p_tdm->fddr,
+                                               p_tdm->samesource_sel))
+                               && p_tdm->en_share)
+                               sharebuffer_trigger(cmd,
+                                       p_tdm->samesource_sel,
+                                       p_tdm->chipinfo->same_src_spdif_reen);
+
+                       aml_frddr_enable(p_tdm->fddr, true);
                        udelay(100);
-                       aml_tdm_mute_playback(p_tdm->actrl, p_tdm->id,
-                                       false, p_tdm->lane_cnt);
+                       aml_tdmout_enable_gain(p_tdm->id, false);
                        if (p_tdm->chipinfo
                                && p_tdm->chipinfo->same_src_fn
                                && (p_tdm->samesource_sel >= 0)
@@ -646,10 +681,15 @@ static int aml_dai_tdm_trigger(struct snd_pcm_substream *substream, int cmd,
                }
 
                if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+                       /* output STOP sequence:
+                        * 1. TDMOUT->muteval
+                        * 2. SPDIFOUT->muteval
+                        * 3. TDMOUT/SPDIF Disable
+                        * 4. FRDDR Disable
+                        */
                        dev_info(substream->pcm->card->dev, "tdm playback stop\n");
-                       aml_frddr_enable(p_tdm->fddr, 0);
-                       aml_tdm_mute_playback(p_tdm->actrl, p_tdm->id,
-                                       true, p_tdm->lane_cnt);
+                       /*don't change this flow*/
+                       aml_tdmout_enable_gain(p_tdm->id, true);
                        if (p_tdm->chipinfo
                                && p_tdm->chipinfo->same_src_fn
                                && (p_tdm->samesource_sel >= 0)
@@ -658,12 +698,30 @@ static int aml_dai_tdm_trigger(struct snd_pcm_substream *substream, int cmd,
                                && p_tdm->en_share) {
                                aml_spdifout_mute_without_actrl(0, true);
                        }
+                       aml_aed_top_enable(p_tdm->fddr, false);
+                       aml_tdm_enable(p_tdm->actrl,
+                               substream->stream, p_tdm->id, false);
+                       if (p_tdm->chipinfo     && p_tdm->chipinfo->same_src_fn
+                               && (p_tdm->samesource_sel >= 0)
+                               && (aml_check_sharebuffer_valid(p_tdm->fddr,
+                                               p_tdm->samesource_sel))
+                               && p_tdm->en_share)
+                               sharebuffer_trigger(cmd,
+                                       p_tdm->samesource_sel,
+                                       p_tdm->chipinfo->same_src_spdif_reen);
+
+                       if (p_tdm->chipinfo     &&
+                               p_tdm->chipinfo->async_fifo)
+                               aml_frddr_check(p_tdm->fddr);
+
+                       aml_frddr_enable(p_tdm->fddr, false);
                } else {
                        dev_info(substream->pcm->card->dev, "tdm capture stop\n");
-                       aml_toddr_enable(p_tdm->tddr, 0);
+                       aml_toddr_enable(p_tdm->tddr, false);
+                       aml_tdm_enable(p_tdm->actrl,
+                               substream->stream, p_tdm->id, false);
                }
-               aml_tdm_enable(p_tdm->actrl,
-                       substream->stream, p_tdm->id, false);
+
                break;
        default:
                return -EINVAL;
@@ -703,13 +761,11 @@ static int aml_tdm_set_lanes(struct aml_tdm *p_tdm,
        unsigned int set_num = 0;
        unsigned int i;
 
-       pr_debug("asoc channels:%d, slots:%d, lane_cnt:%d\n",
-           channels, setting->slots, p_tdm->lane_cnt);
-
        /* calc lanes by channels and slots */
        lanes = (channels - 1) / setting->slots + 1;
        if (lanes > p_tdm->lane_cnt) {
-               pr_err("lanes setting error\n");
+               pr_err("set lane error! asoc channels:%d, slots:%d, lane_cnt:%d\n",
+               channels, setting->slots, p_tdm->lane_cnt);
                return -EINVAL;
        }
 
@@ -934,7 +990,7 @@ static int aml_dai_tdm_hw_free(struct snd_pcm_substream *substream,
        struct frddr *fr = p_tdm->fddr;
        int i;
 
-       for (i = 0; i < 4; i++)
+       for (i = 0; i < p_tdm->lane_cnt; i++)
                aml_tdm_set_channel_mask(p_tdm->actrl,
                        substream->stream, p_tdm->id, i, 0);
 
@@ -1177,20 +1233,15 @@ static int aml_dai_set_tdm_slot(struct snd_soc_dai *cpu_dai,
                        oe_val = p_tdm->setting.lane_oe_mask_out;
                }
 
-               if (lanes_lb_cnt) {
-                       in_src = p_tdm->id + 6;
-                       if (in_src > 7) {
-                               pr_err("unknown src(%d) for tdmin\n", in_src);
-                               return -EINVAL;
-                       }
-               }
+               if (lanes_lb_cnt)
+                       in_src = p_tdm->tdmin_lb_src;
                if (lanes_oe_in_cnt)
                        in_src = p_tdm->id + 3;
                if (lanes_in_cnt)
                        in_src = p_tdm->id;
        } else {
                if (lanes_lb_cnt)
-                       in_src = p_tdm->id + 3;
+                       in_src = p_tdm->tdmin_lb_src;
                if (lanes_in_cnt && lanes_in_cnt <= 4)
                        in_src = p_tdm->id;
                if (in_src > 5) {
@@ -1232,7 +1283,16 @@ static int aml_dai_tdm_probe(struct snd_soc_dai *cpu_dai)
        ret = snd_soc_add_dai_controls(cpu_dai, snd_tdm_controls,
                                        ARRAY_SIZE(snd_tdm_controls));
        if (ret < 0)
-               pr_err("%s, failed add snd spdif controls\n", __func__);
+               pr_err("%s, failed add snd tdm controls\n", __func__);
+
+       if (p_tdm->clk_tuning_enable == 1) {
+               ret = snd_soc_add_dai_controls(cpu_dai,
+                               snd_tdm_clk_controls,
+                               ARRAY_SIZE(snd_tdm_clk_controls));
+               if (ret < 0)
+                       pr_err("%s, failed add snd tdm clk controls\n",
+                               __func__);
+       }
 
        /* config ddr arb */
        aml_tdm_arb_config(p_tdm->actrl);
@@ -1264,6 +1324,32 @@ static int aml_dai_tdm_mute_stream(struct snd_soc_dai *cpu_dai,
        return 0;
 }
 
+static int aml_set_default_tdm_clk(struct aml_tdm *tdm)
+{
+       unsigned int mclk = 12288000;
+       unsigned int ratio = aml_mpll_mclk_ratio(mclk);
+       unsigned int lrclk_hi;
+
+       /*set default i2s clk for codec sequence*/
+       tdm->setting.bclk_lrclk_ratio = 64;
+       tdm->setting.sysclk_bclk_ratio = 4;
+       tdm->clk_sel = 0;
+       lrclk_hi = tdm->setting.bclk_lrclk_ratio - 1;
+
+       aml_tdm_set_lrclkdiv(tdm->actrl, tdm->clk_sel,
+               tdm->setting.sysclk_bclk_ratio - 1);
+
+       aml_tdm_set_bclk_ratio(tdm->actrl,
+               tdm->clk_sel, lrclk_hi/2, lrclk_hi);
+
+       clk_prepare_enable(tdm->mclk);
+       clk_set_rate(tdm->clk, mclk*ratio);
+       clk_set_rate(tdm->mclk, mclk);
+
+       return 0;
+}
+
+
 static struct snd_soc_dai_ops aml_dai_tdm_ops = {
        .prepare = aml_dai_tdm_prepare,
        .trigger = aml_dai_tdm_trigger,
@@ -1283,69 +1369,85 @@ static struct snd_soc_dai_ops aml_dai_tdm_ops = {
 
 static struct snd_soc_dai_driver aml_tdm_dai[] = {
        {
-       .name = "TDM-A",
-       .id = 1,
-       .probe = aml_dai_tdm_probe,
-       .remove = aml_dai_tdm_remove,
-       .playback = {
-             .channels_min = 1,
-             .channels_max = 32,
-             .rates = AML_DAI_TDM_RATES,
-             .formats = AML_DAI_TDM_FORMATS,
-       },
-       .capture = {
-            .channels_min = 1,
-            .channels_max = 32,
-            .rates = AML_DAI_TDM_RATES,
-            .formats = AML_DAI_TDM_FORMATS,
-       },
-       .ops = &aml_dai_tdm_ops,
-       .symmetric_rates = 1,
+               .name = "TDM-A",
+               .id = 1,
+               .probe = aml_dai_tdm_probe,
+               .remove = aml_dai_tdm_remove,
+               .playback = {
+                     .channels_min = 1,
+                     .channels_max = 32,
+                     .rates = AML_DAI_TDM_RATES,
+                     .formats = AML_DAI_TDM_FORMATS,
+               },
+               .capture = {
+                    .channels_min = 1,
+                    .channels_max = 32,
+                    .rates = AML_DAI_TDM_RATES,
+                    .formats = AML_DAI_TDM_FORMATS,
+               },
+               .ops = &aml_dai_tdm_ops,
+               .symmetric_rates = 1,
        },
        {
-       .name = "TDM-B",
-       .id = 2,
-       .probe = aml_dai_tdm_probe,
-       .remove = aml_dai_tdm_remove,
-       .playback = {
-             .channels_min = 1,
-             .channels_max = 32,
-             .rates = AML_DAI_TDM_RATES,
-             .formats = AML_DAI_TDM_FORMATS,
-       },
-       .capture = {
-            .channels_min = 1,
-            .channels_max = 32,
-            .rates = AML_DAI_TDM_RATES,
-            .formats = AML_DAI_TDM_FORMATS,
-       },
-       .ops = &aml_dai_tdm_ops,
-       .symmetric_rates = 1,
+
+               .name = "TDM-B",
+               .id = 2,
+               .probe = aml_dai_tdm_probe,
+               .remove = aml_dai_tdm_remove,
+               .playback = {
+                     .channels_min = 1,
+                     .channels_max = 32,
+                     .rates = AML_DAI_TDM_RATES,
+                     .formats = AML_DAI_TDM_FORMATS,
+               },
+               .capture = {
+                    .channels_min = 1,
+                    .channels_max = 32,
+                    .rates = AML_DAI_TDM_RATES,
+                    .formats = AML_DAI_TDM_FORMATS,
+               },
+               .ops = &aml_dai_tdm_ops,
+               .symmetric_rates = 1,
        },
        {
-       .name = "TDM-C",
-       .id = 3,
-       .probe = aml_dai_tdm_probe,
-       .remove = aml_dai_tdm_remove,
-       .playback = {
-             .channels_min = 1,
-             .channels_max = 32,
-             .rates = AML_DAI_TDM_RATES,
-             .formats = AML_DAI_TDM_FORMATS,
-       },
-       .capture = {
-            .channels_min = 1,
-            .channels_max = 32,
-            .rates = AML_DAI_TDM_RATES,
-            .formats = AML_DAI_TDM_FORMATS,
-       },
-       .ops = &aml_dai_tdm_ops,
-       .symmetric_rates = 1,
+               .name = "TDM-C",
+               .id = 3,
+               .probe = aml_dai_tdm_probe,
+               .remove = aml_dai_tdm_remove,
+               .playback = {
+                     .channels_min = 1,
+                     .channels_max = 32,
+                     .rates = AML_DAI_TDM_RATES,
+                     .formats = AML_DAI_TDM_FORMATS,
+               },
+               .capture = {
+                    .channels_min = 1,
+                    .channels_max = 32,
+                    .rates = AML_DAI_TDM_RATES,
+                    .formats = AML_DAI_TDM_FORMATS,
+               },
+               .ops = &aml_dai_tdm_ops,
+               .symmetric_rates = 1,
        },
+       {
+               .name = "TDMIN-LB",
+               .id = 4,
+               .probe = aml_dai_tdm_probe,
+               .remove = aml_dai_tdm_remove,
+
+               .capture = {
+                       .channels_min = 1,
+                       .channels_max = 32,
+                       .rates = AML_DAI_TDM_RATES,
+                       .formats = AML_DAI_TDM_FORMATS,
+               },
+               .ops = &aml_dai_tdm_ops,
+               .symmetric_rates = 1,
+       }
 };
 
 static const struct snd_soc_component_driver aml_tdm_component = {
-       .name              = DRV_NAME,
+       .name           = DRV_NAME,
 };
 
 static int check_channel_mask(const char *str)
@@ -1493,9 +1595,23 @@ static int aml_tdm_platform_probe(struct platform_device *pdev)
                        &p_tdm->i2s2hdmitx);
        if (ret < 0)
                p_tdm->i2s2hdmitx = 0;
-       pr_info("TDM id %d i2s2hdmi:%d\n",
-               p_tdm->id,
-               p_tdm->i2s2hdmitx);
+       else
+               pr_info("TDM id %d i2s2hdmi:%d\n",
+                       p_tdm->id,
+                       p_tdm->i2s2hdmitx);
+
+       if (p_tdm->id == TDM_LB) {
+               ret = of_property_read_u32(node, "lb-src-sel",
+                               &p_tdm->tdmin_lb_src);
+               if (ret < 0 || (p_tdm->tdmin_lb_src > 7)) {
+                       dev_err(&pdev->dev, "invalid lb-src-sel:%d\n",
+                               p_tdm->tdmin_lb_src);
+                       return -EINVAL;
+               }
+               pr_info("TDM id %d lb-src-sel:%d\n",
+                       p_tdm->id,
+                       p_tdm->tdmin_lb_src);
+       }
 
        /* get tdm lanes info. if not, set to default 0 */
        ret = of_parse_tdm_lane_slot_in(node,
@@ -1558,6 +1674,18 @@ static int aml_tdm_platform_probe(struct platform_device *pdev)
                /*return PTR_ERR(p_tdm->pin_ctl);*/
        }
 
+       ret = of_property_read_u32(node, "start_clk_enable",
+                               &p_tdm->start_clk_enable);
+       if (ret < 0)
+               p_tdm->start_clk_enable = 0;
+       else
+               pr_info("TDM id %d output clk enable:%d\n",
+                       p_tdm->id, p_tdm->start_clk_enable);
+
+       /*set default clk for output*/
+       if (p_tdm->start_clk_enable == 1)
+               aml_set_default_tdm_clk(p_tdm);
+
        /* mclk pad ctrl */
        ret = of_property_read_u32(node, "mclk_pad",
                        &p_tdm->mclk_pad);
@@ -1567,6 +1695,7 @@ static int aml_tdm_platform_probe(struct platform_device *pdev)
        p_tdm->dev = dev;
        /* For debug to disable share buffer */
        p_tdm->en_share = 1;
+       pr_info("%s(), share en = %d", __func__, p_tdm->en_share);
        dev_set_drvdata(dev, p_tdm);
 
        /* spdif same source with i2s */
@@ -1579,6 +1708,14 @@ static int aml_tdm_platform_probe(struct platform_device *pdev)
                return ret;
        }
 
+       ret = of_property_read_u32(node, "clk_tuning_enable",
+                               &p_tdm->clk_tuning_enable);
+       if (ret < 0)
+               p_tdm->clk_tuning_enable = 0;
+       else
+               pr_info("TDM id %d tuning clk enable:%d\n",
+                       p_tdm->id, p_tdm->clk_tuning_enable);
+
        return devm_snd_soc_register_platform(dev, &aml_tdm_platform);
 }
 
index 08cc846..15016a4 100644 (file)
@@ -808,3 +808,28 @@ void aml_tdm_mute_capture(
        }
 }
 
+void aml_tdm_out_reset(unsigned int tdm_id, int offset)
+{
+       unsigned int reg = 0, val = 0;
+
+       if ((offset != 0) && (offset != 1)) {
+               pr_err("%s(), invalid offset = %d\n", __func__, offset);
+               return;
+       }
+
+       if (tdm_id == 0) {
+               reg = EE_AUDIO_SW_RESET0(offset);
+               val = REG_BIT_RESET_TDMOUTA;
+       } else if (tdm_id == 1) {
+               reg = EE_AUDIO_SW_RESET0(offset);
+               val = REG_BIT_RESET_TDMOUTB;
+       } else if (tdm_id == 2) {
+               reg = EE_AUDIO_SW_RESET0(offset);
+               val = REG_BIT_RESET_TDMOUTC;
+       } else {
+               pr_err("invalid tdmout id %d\n", tdm_id);
+               return;
+       }
+       audiobus_update_bits(reg, val, val);
+       audiobus_update_bits(reg, val, 0);
+}
index 9bb21ac..6a4b5a8 100644 (file)
@@ -24,6 +24,7 @@
 #define TDM_A  0
 #define TDM_B  1
 #define TDM_C  2
+#define TDM_LB 3
 
 #define LANE_MAX0 2
 #define LANE_MAX1 4
@@ -162,4 +163,5 @@ void aml_tdm_mute_capture(
                int tdm_index,
                bool mute,
                int lane_cnt);
+void aml_tdm_out_reset(unsigned int tdm_id, int offset);
 #endif
index fd56921..957bb1e 100644 (file)
@@ -42,6 +42,12 @@ struct tdm_chipinfo {
 
        /* mclk pad offset */
        bool mclkpad_no_offset;
+
+       /* offset config for SW_RESET in reg.h */
+       int reset_reg_offset;
+
+       /* async fifo */
+       bool async_fifo;
 };
 
 
@@ -60,6 +66,11 @@ struct tdm_chipinfo axg_tdmc_chipinfo = {
        .no_mclkpad_ctrl = true,
 };
 
+struct tdm_chipinfo axg_tdminlb_chipinfo = {
+       .id          = TDM_LB,
+       .no_mclkpad_ctrl = true,
+};
+
 struct tdm_chipinfo g12a_tdma_chipinfo = {
        .id          = TDM_A,
        .sclk_ws_inv = true,
@@ -84,12 +95,22 @@ struct tdm_chipinfo g12a_tdmc_chipinfo = {
        .mclkpad_no_offset = true,
 };
 
+struct tdm_chipinfo g12a_tdminlb_chipinfo = {
+       .id          = TDM_LB,
+       .sclk_ws_inv = true,
+       .oe_fn       = true,
+       .same_src_fn = true,
+       .mclkpad_no_offset = true,
+};
+
 struct tdm_chipinfo tl1_tdma_chipinfo = {
        .id          = TDM_A,
        .sclk_ws_inv = true,
        .oe_fn       = true,
        .same_src_fn = true,
        .adc_fn      = true,
+       .reset_reg_offset = 1,
+       .async_fifo  = true,
 };
 
 struct tdm_chipinfo tl1_tdmb_chipinfo = {
@@ -98,6 +119,8 @@ struct tdm_chipinfo tl1_tdmb_chipinfo = {
        .oe_fn       = true,
        .same_src_fn = true,
        .adc_fn      = true,
+       .reset_reg_offset = 1,
+       .async_fifo  = true,
 };
 
 struct tdm_chipinfo tl1_tdmc_chipinfo = {
@@ -106,6 +129,17 @@ struct tdm_chipinfo tl1_tdmc_chipinfo = {
        .oe_fn       = true,
        .same_src_fn = true,
        .adc_fn      = true,
+       .reset_reg_offset = 1,
+       .async_fifo  = true,
+};
+
+struct tdm_chipinfo tl1_tdminlb_chipinfo = {
+       .id          = TDM_LB,
+       .sclk_ws_inv = true,
+       .oe_fn       = true,
+       .same_src_fn = true,
+       .adc_fn      = true,
+       .async_fifo  = true,
 };
 
 struct tdm_chipinfo sm1_tdma_chipinfo = {
@@ -114,6 +148,8 @@ struct tdm_chipinfo sm1_tdma_chipinfo = {
        .oe_fn       = true,
        .same_src_fn = true,
        .lane_cnt    = LANE_MAX0,
+       .reset_reg_offset = 1,
+       .async_fifo  = true,
 };
 
 struct tdm_chipinfo sm1_tdmb_chipinfo = {
@@ -122,6 +158,8 @@ struct tdm_chipinfo sm1_tdmb_chipinfo = {
        .oe_fn       = true,
        .same_src_fn = true,
        .lane_cnt    = LANE_MAX3,
+       .reset_reg_offset = 1,
+       .async_fifo  = true,
 };
 
 struct tdm_chipinfo sm1_tdmc_chipinfo = {
@@ -130,6 +168,59 @@ struct tdm_chipinfo sm1_tdmc_chipinfo = {
        .oe_fn       = true,
        .same_src_fn = true,
        .lane_cnt    = LANE_MAX1,
+       .reset_reg_offset = 1,
+       .async_fifo  = true,
+};
+
+struct tdm_chipinfo sm1_tdminlb_chipinfo = {
+       .id          = TDM_LB,
+       .sclk_ws_inv = true,
+       .oe_fn       = true,
+       .same_src_fn = true,
+       .lane_cnt    = LANE_MAX3,
+       .async_fifo  = true,
+};
+
+struct tdm_chipinfo tm2_tdma_chipinfo = {
+       .id          = TDM_A,
+       .sclk_ws_inv = true,
+       .oe_fn       = true,
+       .same_src_fn = true,
+       .adc_fn      = true,
+       .lane_cnt    = LANE_MAX3,
+       .reset_reg_offset = 1,
+       .async_fifo  = true,
+};
+
+struct tdm_chipinfo tm2_tdmb_chipinfo = {
+       .id          = TDM_B,
+       .sclk_ws_inv = true,
+       .oe_fn       = true,
+       .same_src_fn = true,
+       .adc_fn      = true,
+       .lane_cnt    = LANE_MAX1,
+       .reset_reg_offset = 1,
+       .async_fifo  = true,
+};
+
+struct tdm_chipinfo tm2_tdmc_chipinfo = {
+       .id          = TDM_C,
+       .sclk_ws_inv = true,
+       .oe_fn       = true,
+       .same_src_fn = true,
+       .adc_fn      = true,
+       .lane_cnt    = LANE_MAX1,
+       .reset_reg_offset = 1,
+       .async_fifo  = true,
+};
+
+struct tdm_chipinfo tm2_tdminlb_chipinfo = {
+       .id          = TDM_LB,
+       .sclk_ws_inv = true,
+       .oe_fn       = true,
+       .same_src_fn = true,
+       .lane_cnt    = LANE_MAX3,
+       .async_fifo  = true,
 };
 
 static const struct of_device_id aml_tdm_device_id[] = {
@@ -146,6 +237,10 @@ static const struct of_device_id aml_tdm_device_id[] = {
                .data       = &axg_tdmc_chipinfo,
        },
        {
+               .compatible = "amlogic, axg-snd-tdmlb",
+               .data       = &axg_tdminlb_chipinfo,
+       },
+       {
                .compatible = "amlogic, g12a-snd-tdma",
                .data       = &g12a_tdma_chipinfo,
        },
@@ -158,6 +253,10 @@ static const struct of_device_id aml_tdm_device_id[] = {
                .data       = &g12a_tdmc_chipinfo,
        },
        {
+               .compatible = "amlogic, g12a-snd-tdmlb",
+               .data       = &g12a_tdminlb_chipinfo,
+       },
+       {
                .compatible = "amlogic, tl1-snd-tdma",
                .data       = &tl1_tdma_chipinfo,
        },
@@ -170,16 +269,40 @@ static const struct of_device_id aml_tdm_device_id[] = {
                .data       = &tl1_tdmc_chipinfo,
        },
        {
+               .compatible = "amlogic, tl1-snd-tdmlb",
+               .data       = &tl1_tdminlb_chipinfo,
+       },
+       {
                .compatible = "amlogic, sm1-snd-tdma",
-               .data           = &sm1_tdma_chipinfo,
+               .data       = &sm1_tdma_chipinfo,
        },
        {
                .compatible = "amlogic, sm1-snd-tdmb",
-               .data           = &sm1_tdmb_chipinfo,
+               .data       = &sm1_tdmb_chipinfo,
        },
        {
                .compatible = "amlogic, sm1-snd-tdmc",
-               .data           = &sm1_tdmc_chipinfo,
+               .data       = &sm1_tdmc_chipinfo,
+       },
+       {
+               .compatible = "amlogic, sm1-snd-tdmlb",
+               .data       = &sm1_tdminlb_chipinfo,
+       },
+       {
+               .compatible = "amlogic, tm2-snd-tdma",
+               .data       = &tm2_tdma_chipinfo,
+       },
+       {
+               .compatible = "amlogic, tm2-snd-tdmb",
+               .data       = &tm2_tdmb_chipinfo,
+       },
+       {
+               .compatible = "amlogic, tm2-snd-tdmc",
+               .data       = &tm2_tdmc_chipinfo,
+       },
+       {
+               .compatible = "amlogic, tm2-snd-tdmlb",
+               .data       = &tm2_tdminlb_chipinfo,
        },
        {},
 };
index f8d4c7d..7f18e89 100644 (file)
@@ -231,9 +231,9 @@ CLOCK_COM_MUX(eqdrc, AUD_ADDR_OFFSET(EE_AUDIO_CLK_EQDRC_CTRL0), 0x7, 24);
 CLOCK_COM_DIV(eqdrc, AUD_ADDR_OFFSET(EE_AUDIO_CLK_EQDRC_CTRL0), 0, 16);
 CLOCK_COM_GATE(eqdrc, AUD_ADDR_OFFSET(EE_AUDIO_CLK_EQDRC_CTRL0), 31);
 /* audio vad  */
-CLOCK_COM_MUX(vad, AUD_ADDR_OFFSET(EE_AUDIO_VAD_CLK_CTRL), 0x7, 24);
-CLOCK_COM_DIV(vad, AUD_ADDR_OFFSET(EE_AUDIO_VAD_CLK_CTRL), 0, 16);
-CLOCK_COM_GATE(vad, AUD_ADDR_OFFSET(EE_AUDIO_VAD_CLK_CTRL), 31);
+CLOCK_COM_MUX(vad, AUD_ADDR_OFFSET(EE_AUDIO_CLK_VAD_CTRL), 0x7, 24);
+CLOCK_COM_DIV(vad, AUD_ADDR_OFFSET(EE_AUDIO_CLK_VAD_CTRL), 0, 16);
+CLOCK_COM_GATE(vad, AUD_ADDR_OFFSET(EE_AUDIO_CLK_VAD_CTRL), 31);
 
 static int tl1_clks_init(struct clk **clks, void __iomem *iobase)
 {
diff --git a/sound/soc/amlogic/auge/tm2,clocks.c b/sound/soc/amlogic/auge/tm2,clocks.c
new file mode 100644 (file)
index 0000000..5dce5ba
--- /dev/null
@@ -0,0 +1,392 @@
+/*
+ * sound/soc/amlogic/auge/tm2_clocks.c
+ *
+ * Copyright (C) 2019 Amlogic, Inc. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ *
+ */
+#undef pr_fmt
+#define pr_fmt(fmt) "tm2_audio_clocks: " fmt
+
+#include <dt-bindings/clock/amlogic,tm2-audio-clk.h>
+
+#include "audio_clks.h"
+#include "regs.h"
+
+static spinlock_t aclk_lock;
+
+static const char *const mclk_parent_names[] = {
+       "mpll0", "mpll1", "mpll2", "mpll3", "hifi_pll",
+       "fclk_div3", "fclk_div4", "fclk_div5"};
+
+static const char *const audioclk_parent_names[] = {
+       "mclk_a", "mclk_b", "mclk_c", "mclk_d", "mclk_e",
+       "mclk_f", "i_slv_sclk_a", "i_slv_sclk_b", "i_slv_sclk_c",
+       "i_slv_sclk_d", "i_slv_sclk_e", "i_slv_sclk_f", "i_slv_sclk_g",
+       "i_slv_sclk_h", "i_slv_sclk_i", "i_slv_sclk_j"};
+
+CLOCK_GATE(audio_ddr_arb, AUD_ADDR_OFFSET(EE_AUDIO_CLK_GATE_EN0), 0);
+CLOCK_GATE(audio_pdm, AUD_ADDR_OFFSET(EE_AUDIO_CLK_GATE_EN0), 1);
+CLOCK_GATE(audio_tdmina, AUD_ADDR_OFFSET(EE_AUDIO_CLK_GATE_EN0), 2);
+CLOCK_GATE(audio_tdminb, AUD_ADDR_OFFSET(EE_AUDIO_CLK_GATE_EN0), 3);
+CLOCK_GATE(audio_tdminc, AUD_ADDR_OFFSET(EE_AUDIO_CLK_GATE_EN0), 4);
+CLOCK_GATE(audio_tdminlb, AUD_ADDR_OFFSET(EE_AUDIO_CLK_GATE_EN0), 5);
+CLOCK_GATE(audio_tdmouta, AUD_ADDR_OFFSET(EE_AUDIO_CLK_GATE_EN0), 6);
+CLOCK_GATE(audio_tdmoutb, AUD_ADDR_OFFSET(EE_AUDIO_CLK_GATE_EN0), 7);
+CLOCK_GATE(audio_tdmoutc, AUD_ADDR_OFFSET(EE_AUDIO_CLK_GATE_EN0), 8);
+CLOCK_GATE(audio_frddra, AUD_ADDR_OFFSET(EE_AUDIO_CLK_GATE_EN0), 9);
+CLOCK_GATE(audio_frddrb, AUD_ADDR_OFFSET(EE_AUDIO_CLK_GATE_EN0), 10);
+CLOCK_GATE(audio_frddrc, AUD_ADDR_OFFSET(EE_AUDIO_CLK_GATE_EN0), 11);
+CLOCK_GATE(audio_toddra, AUD_ADDR_OFFSET(EE_AUDIO_CLK_GATE_EN0), 12);
+CLOCK_GATE(audio_toddrb, AUD_ADDR_OFFSET(EE_AUDIO_CLK_GATE_EN0), 13);
+CLOCK_GATE(audio_toddrc, AUD_ADDR_OFFSET(EE_AUDIO_CLK_GATE_EN0), 14);
+CLOCK_GATE(audio_loopbacka, AUD_ADDR_OFFSET(EE_AUDIO_CLK_GATE_EN0), 15);
+CLOCK_GATE(audio_spdifin, AUD_ADDR_OFFSET(EE_AUDIO_CLK_GATE_EN0), 16);
+CLOCK_GATE(audio_spdifout, AUD_ADDR_OFFSET(EE_AUDIO_CLK_GATE_EN0), 17);
+CLOCK_GATE(audio_resamplea, AUD_ADDR_OFFSET(EE_AUDIO_CLK_GATE_EN0), 18);
+CLOCK_GATE(audio_reserved0, AUD_ADDR_OFFSET(EE_AUDIO_CLK_GATE_EN0), 19);
+CLOCK_GATE(audio_reserved1, AUD_ADDR_OFFSET(EE_AUDIO_CLK_GATE_EN0), 20);
+CLOCK_GATE(audio_spdifoutb, AUD_ADDR_OFFSET(EE_AUDIO_CLK_GATE_EN0), 21);
+CLOCK_GATE(audio_eqdrc, AUD_ADDR_OFFSET(EE_AUDIO_CLK_GATE_EN0), 22);
+CLOCK_GATE(audio_reserved2, AUD_ADDR_OFFSET(EE_AUDIO_CLK_GATE_EN0), 23);
+CLOCK_GATE(audio_reserved3, AUD_ADDR_OFFSET(EE_AUDIO_CLK_GATE_EN0), 24);
+CLOCK_GATE(audio_reserved4, AUD_ADDR_OFFSET(EE_AUDIO_CLK_GATE_EN0), 25);
+CLOCK_GATE(audio_resampleb, AUD_ADDR_OFFSET(EE_AUDIO_CLK_GATE_EN0), 26);
+CLOCK_GATE(audio_tovad, AUD_ADDR_OFFSET(EE_AUDIO_CLK_GATE_EN0), 27);
+CLOCK_GATE(audio_audiolocker, AUD_ADDR_OFFSET(EE_AUDIO_CLK_GATE_EN0), 28);
+CLOCK_GATE(audio_spdifin_lb, AUD_ADDR_OFFSET(EE_AUDIO_CLK_GATE_EN0), 29);
+CLOCK_GATE(audio_fratv, AUD_ADDR_OFFSET(EE_AUDIO_CLK_GATE_EN0), 30);
+CLOCK_GATE(audio_frhdmirx, AUD_ADDR_OFFSET(EE_AUDIO_CLK_GATE_EN0), 31);
+
+CLOCK_GATE(audio_frddrd, AUD_ADDR_OFFSET(EE_AUDIO_CLK_GATE_EN1), 0);
+CLOCK_GATE(audio_toddrd, AUD_ADDR_OFFSET(EE_AUDIO_CLK_GATE_EN1), 1);
+CLOCK_GATE(audio_loopbackb, AUD_ADDR_OFFSET(EE_AUDIO_CLK_GATE_EN1), 2);
+CLOCK_GATE(audio_frddre, AUD_ADDR_OFFSET(EE_AUDIO_CLK_GATE_EN1), 3);
+CLOCK_GATE(audio_toddre, AUD_ADDR_OFFSET(EE_AUDIO_CLK_GATE_EN1), 4);
+CLOCK_GATE(audio_earctx, AUD_ADDR_OFFSET(EE_AUDIO_CLK_GATE_EN1), 5);
+CLOCK_GATE(audio_earcrx, AUD_ADDR_OFFSET(EE_AUDIO_CLK_GATE_EN1), 6);
+CLOCK_GATE(audio_resampleb_old, AUD_ADDR_OFFSET(EE_AUDIO_CLK_GATE_EN1), 7);
+CLOCK_GATE(audio_locker, AUD_ADDR_OFFSET(EE_AUDIO_CLK_GATE_EN1), 8);
+
+
+static struct clk_gate *tm2_audio_clk_gates[] = {
+       &audio_ddr_arb,
+       &audio_pdm,
+       &audio_tdmina,
+       &audio_tdminb,
+       &audio_tdminc,
+       &audio_tdminlb,
+       &audio_tdmouta,
+       &audio_tdmoutb,
+       &audio_tdmoutc,
+       &audio_frddra,
+       &audio_frddrb,
+       &audio_frddrc,
+       &audio_toddra,
+       &audio_toddrb,
+       &audio_toddrc,
+       &audio_loopbacka,
+       &audio_spdifin,
+       &audio_spdifout,
+       &audio_resamplea,
+       &audio_reserved0,
+       &audio_reserved1,
+       &audio_spdifoutb,
+       &audio_eqdrc,
+       &audio_reserved2,
+       &audio_reserved3,
+       &audio_reserved4,
+       &audio_resampleb,
+       &audio_tovad,
+       &audio_audiolocker,
+       &audio_spdifin_lb,
+       &audio_fratv,
+       &audio_frhdmirx,
+
+       &audio_frddrd,
+       &audio_toddrd,
+       &audio_loopbackb,
+       &audio_frddre,
+       &audio_toddre,
+       &audio_earctx,
+       &audio_earcrx,
+       &audio_resampleb_old,
+       &audio_locker,
+};
+
+/* Array of all clocks provided by this provider */
+static struct clk_hw *tm2_audio_clk_hws[] = {
+       [CLKID_AUDIO_GATE_DDR_ARB]     = &audio_ddr_arb.hw,
+       [CLKID_AUDIO_GATE_PDM]         = &audio_pdm.hw,
+       [CLKID_AUDIO_GATE_TDMINA]      = &audio_tdmina.hw,
+       [CLKID_AUDIO_GATE_TDMINB]      = &audio_tdminb.hw,
+       [CLKID_AUDIO_GATE_TDMINC]      = &audio_tdminc.hw,
+       [CLKID_AUDIO_GATE_TDMINLB]     = &audio_tdminlb.hw,
+       [CLKID_AUDIO_GATE_TDMOUTA]     = &audio_tdmouta.hw,
+       [CLKID_AUDIO_GATE_TDMOUTB]     = &audio_tdmoutb.hw,
+       [CLKID_AUDIO_GATE_TDMOUTC]     = &audio_tdmoutc.hw,
+       [CLKID_AUDIO_GATE_FRDDRA]      = &audio_frddra.hw,
+       [CLKID_AUDIO_GATE_FRDDRB]      = &audio_frddrb.hw,
+       [CLKID_AUDIO_GATE_FRDDRC]      = &audio_frddrc.hw,
+       [CLKID_AUDIO_GATE_TODDRA]      = &audio_toddra.hw,
+       [CLKID_AUDIO_GATE_TODDRB]      = &audio_toddrb.hw,
+       [CLKID_AUDIO_GATE_TODDRC]      = &audio_toddrc.hw,
+       [CLKID_AUDIO_GATE_LOOPBACKA]   = &audio_loopbacka.hw,
+       [CLKID_AUDIO_GATE_SPDIFIN]     = &audio_spdifin.hw,
+       [CLKID_AUDIO_GATE_SPDIFOUT_A]  = &audio_spdifout.hw,
+       [CLKID_AUDIO_GATE_RESAMPLEA]   = &audio_resamplea.hw,
+       [CLKID_AUDIO_GATE_RESERVED0]   = &audio_reserved0.hw,
+       [CLKID_AUDIO_GATE_RESERVED1]   = &audio_reserved1.hw,
+       [CLKID_AUDIO_GATE_SPDIFOUT_B]  = &audio_spdifoutb.hw,
+       [CLKID_AUDIO_GATE_EQDRC]       = &audio_eqdrc.hw,
+       [CLKID_AUDIO_GATE_RESERVED2]   = &audio_reserved2.hw,
+       [CLKID_AUDIO_GATE_RESERVED3]   = &audio_reserved3.hw,
+       [CLKID_AUDIO_GATE_RESERVED4]   = &audio_reserved4.hw,
+       [CLKID_AUDIO_GATE_RESAMPLEB]   = &audio_resampleb.hw,
+       [CLKID_AUDIO_GATE_TOVAD]       = &audio_tovad.hw,
+       [CLKID_AUDIO_GATE_AUDIOLOCKER] = &audio_audiolocker.hw,
+       [CLKID_AUDIO_GATE_SPDIFIN_LB]  = &audio_spdifin_lb.hw,
+       [CLKID_AUDIO_GATE_FRATV]       = &audio_fratv.hw,
+       [CLKID_AUDIO_GATE_FRHDMIRX]    = &audio_frhdmirx.hw,
+
+       [CLKID_AUDIO_GATE_FRDDRD]      = &audio_frddrd.hw,
+       [CLKID_AUDIO_GATE_TODDRD]      = &audio_toddrd.hw,
+       [CLKID_AUDIO_GATE_LOOPBACKB]   = &audio_loopbackb.hw,
+       [CLKID_AUDIO_GATE_FRDDRE]      = &audio_frddre.hw,
+       [CLKID_AUDIO_GATE_TODDRE]      = &audio_toddre.hw,
+       [CLKID_AUDIO_GATE_EARCTX]      = &audio_earctx.hw,
+       [CLKID_AUDIO_GATE_EARCRX]      = &audio_earcrx.hw,
+       [CLKID_AUDIO_GATE_RESAMPLEB_OLD] = &audio_resampleb_old.hw,
+       [CLKID_AUDIO_GATE_LOCKER]      = &audio_locker.hw,
+};
+
+static int tm2_clk_gates_init(struct clk **clks, void __iomem *iobase)
+{
+       int clkid;
+
+       if (ARRAY_SIZE(tm2_audio_clk_gates) != MCLK_BASE) {
+               pr_err("check clk gates number\n");
+               return -EINVAL;
+       }
+
+       for (clkid = 0; clkid < MCLK_BASE; clkid++) {
+               tm2_audio_clk_gates[clkid]->reg = iobase;
+               clks[clkid] = clk_register(NULL, tm2_audio_clk_hws[clkid]);
+               WARN_ON(IS_ERR_OR_NULL(clks[clkid]));
+       }
+
+       return 0;
+}
+
+/* mclk_a */
+CLOCK_COM_MUX(mclk_a, AUD_ADDR_OFFSET(EE_AUDIO_MCLK_A_CTRL(1)), 0x7, 24);
+CLOCK_COM_DIV(mclk_a, AUD_ADDR_OFFSET(EE_AUDIO_MCLK_A_CTRL(1)), 0, 16);
+CLOCK_COM_GATE(mclk_a, AUD_ADDR_OFFSET(EE_AUDIO_MCLK_A_CTRL(1)), 31);
+/* mclk_b */
+CLOCK_COM_MUX(mclk_b, AUD_ADDR_OFFSET(EE_AUDIO_MCLK_B_CTRL(1)), 0x7, 24);
+CLOCK_COM_DIV(mclk_b, AUD_ADDR_OFFSET(EE_AUDIO_MCLK_B_CTRL(1)), 0, 16);
+CLOCK_COM_GATE(mclk_b, AUD_ADDR_OFFSET(EE_AUDIO_MCLK_B_CTRL(1)), 31);
+/* mclk_c */
+CLOCK_COM_MUX(mclk_c, AUD_ADDR_OFFSET(EE_AUDIO_MCLK_C_CTRL(1)), 0x7, 24);
+CLOCK_COM_DIV(mclk_c, AUD_ADDR_OFFSET(EE_AUDIO_MCLK_C_CTRL(1)), 0, 16);
+CLOCK_COM_GATE(mclk_c, AUD_ADDR_OFFSET(EE_AUDIO_MCLK_C_CTRL(1)), 31);
+/* mclk_d */
+CLOCK_COM_MUX(mclk_d, AUD_ADDR_OFFSET(EE_AUDIO_MCLK_D_CTRL(1)), 0x7, 24);
+CLOCK_COM_DIV(mclk_d, AUD_ADDR_OFFSET(EE_AUDIO_MCLK_D_CTRL(1)), 0, 16);
+CLOCK_COM_GATE(mclk_d, AUD_ADDR_OFFSET(EE_AUDIO_MCLK_D_CTRL(1)), 31);
+/* mclk_e */
+CLOCK_COM_MUX(mclk_e, AUD_ADDR_OFFSET(EE_AUDIO_MCLK_E_CTRL(1)), 0x7, 24);
+CLOCK_COM_DIV(mclk_e, AUD_ADDR_OFFSET(EE_AUDIO_MCLK_E_CTRL(1)), 0, 16);
+CLOCK_COM_GATE(mclk_e, AUD_ADDR_OFFSET(EE_AUDIO_MCLK_E_CTRL(1)), 31);
+/* mclk_f */
+CLOCK_COM_MUX(mclk_f, AUD_ADDR_OFFSET(EE_AUDIO_MCLK_F_CTRL(1)), 0x7, 24);
+CLOCK_COM_DIV(mclk_f, AUD_ADDR_OFFSET(EE_AUDIO_MCLK_F_CTRL(1)), 0, 16);
+CLOCK_COM_GATE(mclk_f, AUD_ADDR_OFFSET(EE_AUDIO_MCLK_F_CTRL(1)), 31);
+/* spdifin */
+CLOCK_COM_MUX(spdifin, AUD_ADDR_OFFSET(EE_AUDIO_CLK_SPDIFIN_CTRL), 0x7, 24);
+CLOCK_COM_DIV(spdifin, AUD_ADDR_OFFSET(EE_AUDIO_CLK_SPDIFIN_CTRL), 0, 8);
+CLOCK_COM_GATE(spdifin, AUD_ADDR_OFFSET(EE_AUDIO_CLK_SPDIFIN_CTRL), 31);
+/* spdifout */
+CLOCK_COM_MUX(spdifout, AUD_ADDR_OFFSET(EE_AUDIO_CLK_SPDIFOUT_CTRL), 0x7, 24);
+CLOCK_COM_DIV(spdifout, AUD_ADDR_OFFSET(EE_AUDIO_CLK_SPDIFOUT_CTRL), 0, 10);
+CLOCK_COM_GATE(spdifout, AUD_ADDR_OFFSET(EE_AUDIO_CLK_SPDIFOUT_CTRL), 31);
+/* audio resample_a */
+CLOCK_COM_MUX(resample_a,
+       AUD_ADDR_OFFSET(EE_AUDIO_CLK_RESAMPLEA_CTRL), 0xf, 24);
+CLOCK_COM_DIV(resample_a, AUD_ADDR_OFFSET(EE_AUDIO_CLK_RESAMPLEA_CTRL), 0, 8);
+CLOCK_COM_GATE(resample_a, AUD_ADDR_OFFSET(EE_AUDIO_CLK_RESAMPLEA_CTRL), 31);
+/* audio locker_out */
+CLOCK_COM_MUX(locker_out, AUD_ADDR_OFFSET(EE_AUDIO_CLK_LOCKER_CTRL), 0xf, 24);
+CLOCK_COM_DIV(locker_out, AUD_ADDR_OFFSET(EE_AUDIO_CLK_LOCKER_CTRL), 16, 8);
+CLOCK_COM_GATE(locker_out, AUD_ADDR_OFFSET(EE_AUDIO_CLK_LOCKER_CTRL), 31);
+/* audio locker_in */
+CLOCK_COM_MUX(locker_in, AUD_ADDR_OFFSET(EE_AUDIO_CLK_LOCKER_CTRL), 0xf, 8);
+CLOCK_COM_DIV(locker_in, AUD_ADDR_OFFSET(EE_AUDIO_CLK_LOCKER_CTRL), 0, 8);
+CLOCK_COM_GATE(locker_in, AUD_ADDR_OFFSET(EE_AUDIO_CLK_LOCKER_CTRL), 15);
+/* pdmin0 */
+CLOCK_COM_MUX(pdmin0, AUD_ADDR_OFFSET(EE_AUDIO_CLK_PDMIN_CTRL0), 0x7, 24);
+CLOCK_COM_DIV(pdmin0, AUD_ADDR_OFFSET(EE_AUDIO_CLK_PDMIN_CTRL0), 0, 16);
+CLOCK_COM_GATE(pdmin0, AUD_ADDR_OFFSET(EE_AUDIO_CLK_PDMIN_CTRL0), 31);
+/* pdmin1 */
+CLOCK_COM_MUX(pdmin1, AUD_ADDR_OFFSET(EE_AUDIO_CLK_PDMIN_CTRL1), 0x7, 24);
+CLOCK_COM_DIV(pdmin1, AUD_ADDR_OFFSET(EE_AUDIO_CLK_PDMIN_CTRL1), 0, 16);
+CLOCK_COM_GATE(pdmin1, AUD_ADDR_OFFSET(EE_AUDIO_CLK_PDMIN_CTRL1), 31);
+/* spdifout b*/
+CLOCK_COM_MUX(spdifout_b,
+       AUD_ADDR_OFFSET(EE_AUDIO_CLK_SPDIFOUT_B_CTRL), 0x7, 24);
+CLOCK_COM_DIV(spdifout_b, AUD_ADDR_OFFSET(EE_AUDIO_CLK_SPDIFOUT_B_CTRL), 0, 10);
+CLOCK_COM_GATE(spdifout_b, AUD_ADDR_OFFSET(EE_AUDIO_CLK_SPDIFOUT_B_CTRL), 31);
+/* audio resample_b */
+CLOCK_COM_MUX(resample_b,
+       AUD_ADDR_OFFSET(EE_AUDIO_CLK_RESAMPLEB_CTRL), 0xf, 24);
+CLOCK_COM_DIV(resample_b, AUD_ADDR_OFFSET(EE_AUDIO_CLK_RESAMPLEB_CTRL), 0, 8);
+CLOCK_COM_GATE(resample_b, AUD_ADDR_OFFSET(EE_AUDIO_CLK_RESAMPLEB_CTRL), 31);
+/* spdifin_lb, div is a fake */
+CLOCK_COM_MUX(spdifin_lb,
+       AUD_ADDR_OFFSET(EE_AUDIO_CLK_SPDIFOUT_B_CTRL), 0x1, 30);
+CLOCK_COM_DIV(spdifin_lb, AUD_ADDR_OFFSET(EE_AUDIO_CLK_SPDIFOUT_B_CTRL), 0, 29);
+CLOCK_COM_GATE(spdifin_lb, AUD_ADDR_OFFSET(EE_AUDIO_CLK_SPDIFOUT_B_CTRL), 31);
+/* audio eqdrc  */
+CLOCK_COM_MUX(eqdrc, AUD_ADDR_OFFSET(EE_AUDIO_CLK_EQDRC_CTRL0), 0x7, 24);
+CLOCK_COM_DIV(eqdrc, AUD_ADDR_OFFSET(EE_AUDIO_CLK_EQDRC_CTRL0), 0, 16);
+CLOCK_COM_GATE(eqdrc, AUD_ADDR_OFFSET(EE_AUDIO_CLK_EQDRC_CTRL0), 31);
+/* audio vad  */
+CLOCK_COM_MUX(vad, AUD_ADDR_OFFSET(EE_AUDIO_CLK_VAD_CTRL), 0x7, 24);
+CLOCK_COM_DIV(vad, AUD_ADDR_OFFSET(EE_AUDIO_CLK_VAD_CTRL), 0, 16);
+CLOCK_COM_GATE(vad, AUD_ADDR_OFFSET(EE_AUDIO_CLK_VAD_CTRL), 31);
+/* EARC TX CMDC */
+CLOCK_COM_MUX(earctx_cmdc,
+       AUD_ADDR_OFFSET(EE_AUDIO_EARCTX_CMDC_CLK_CTRL), 0x7, 24);
+CLOCK_COM_DIV(earctx_cmdc,
+       AUD_ADDR_OFFSET(EE_AUDIO_EARCTX_CMDC_CLK_CTRL), 0, 16);
+CLOCK_COM_GATE(earctx_cmdc,
+       AUD_ADDR_OFFSET(EE_AUDIO_EARCTX_CMDC_CLK_CTRL), 31);
+/* EARC TX DMAC */
+CLOCK_COM_MUX(earctx_dmac,
+       AUD_ADDR_OFFSET(EE_AUDIO_EARCTX_DMAC_CLK_CTRL), 0x7, 24);
+CLOCK_COM_DIV(earctx_dmac,
+       AUD_ADDR_OFFSET(EE_AUDIO_EARCTX_DMAC_CLK_CTRL), 0, 16);
+CLOCK_COM_GATE(earctx_dmac,
+       AUD_ADDR_OFFSET(EE_AUDIO_EARCTX_DMAC_CLK_CTRL), 31);
+/* EARC RX CMDC */
+CLOCK_COM_MUX(earcrx_cmdc,
+       AUD_ADDR_OFFSET(EE_AUDIO_EARCRX_CMDC_CLK_CTRL), 0x7, 24);
+CLOCK_COM_DIV(earcrx_cmdc,
+       AUD_ADDR_OFFSET(EE_AUDIO_EARCRX_CMDC_CLK_CTRL), 0, 16);
+CLOCK_COM_GATE(earcrx_cmdc,
+       AUD_ADDR_OFFSET(EE_AUDIO_EARCRX_CMDC_CLK_CTRL), 31);
+/* EARC RX DMAC */
+CLOCK_COM_MUX(earcrx_dmac,
+       AUD_ADDR_OFFSET(EE_AUDIO_EARCRX_DMAC_CLK_CTRL), 0x7, 24);
+CLOCK_COM_DIV(earcrx_dmac,
+       AUD_ADDR_OFFSET(EE_AUDIO_EARCRX_DMAC_CLK_CTRL), 0, 16);
+CLOCK_COM_GATE(earcrx_dmac,
+       AUD_ADDR_OFFSET(EE_AUDIO_EARCRX_DMAC_CLK_CTRL), 31);
+
+static int tm2_clks_init(struct clk **clks, void __iomem *iobase)
+{
+       IOMAP_COM_CLK(mclk_a, iobase);
+       clks[CLKID_AUDIO_MCLK_A] = REGISTER_CLK_COM(mclk_a);
+       WARN_ON(IS_ERR_OR_NULL(clks[CLKID_AUDIO_MCLK_A]));
+
+       IOMAP_COM_CLK(mclk_b, iobase);
+       clks[CLKID_AUDIO_MCLK_B] = REGISTER_CLK_COM(mclk_b);
+       WARN_ON(IS_ERR_OR_NULL(clks[CLKID_AUDIO_MCLK_B]));
+
+       IOMAP_COM_CLK(mclk_c, iobase);
+       clks[CLKID_AUDIO_MCLK_C] = REGISTER_CLK_COM(mclk_c);
+       WARN_ON(IS_ERR_OR_NULL(clks[CLKID_AUDIO_MCLK_C]));
+
+       IOMAP_COM_CLK(mclk_d, iobase);
+       clks[CLKID_AUDIO_MCLK_D] = REGISTER_CLK_COM(mclk_d);
+       WARN_ON(IS_ERR_OR_NULL(clks[CLKID_AUDIO_MCLK_D]));
+
+       IOMAP_COM_CLK(mclk_e, iobase);
+       clks[CLKID_AUDIO_MCLK_E] = REGISTER_CLK_COM(mclk_e);
+       WARN_ON(IS_ERR_OR_NULL(clks[CLKID_AUDIO_MCLK_E]));
+
+       IOMAP_COM_CLK(mclk_f, iobase);
+       clks[CLKID_AUDIO_MCLK_F] = REGISTER_CLK_COM(mclk_f);
+       WARN_ON(IS_ERR_OR_NULL(clks[CLKID_AUDIO_MCLK_F]));
+
+       IOMAP_COM_CLK(spdifin, iobase);
+       clks[CLKID_AUDIO_SPDIFIN] = REGISTER_CLK_COM(spdifin);
+       WARN_ON(IS_ERR_OR_NULL(clks[CLKID_AUDIO_SPDIFIN]));
+
+       IOMAP_COM_CLK(spdifout, iobase);
+       clks[CLKID_AUDIO_SPDIFOUT_A] = REGISTER_CLK_COM(spdifout);
+       WARN_ON(IS_ERR_OR_NULL(clks[CLKID_AUDIO_SPDIFOUT_A]));
+
+       IOMAP_COM_CLK(resample_a, iobase);
+       clks[CLKID_AUDIO_RESAMPLE_A] = REGISTER_AUDIOCLK_COM(resample_a);
+       WARN_ON(IS_ERR_OR_NULL(clks[CLKID_AUDIO_RESAMPLE_A]));
+
+       IOMAP_COM_CLK(locker_out, iobase);
+       clks[CLKID_AUDIO_LOCKER_OUT] = REGISTER_AUDIOCLK_COM(locker_out);
+       WARN_ON(IS_ERR_OR_NULL(clks[CLKID_AUDIO_LOCKER_OUT]));
+
+       IOMAP_COM_CLK(locker_in, iobase);
+       clks[CLKID_AUDIO_LOCKER_IN] = REGISTER_AUDIOCLK_COM(locker_in);
+       WARN_ON(IS_ERR_OR_NULL(clks[CLKID_AUDIO_LOCKER_IN]));
+
+       IOMAP_COM_CLK(pdmin0, iobase);
+       clks[CLKID_AUDIO_PDMIN0] = REGISTER_CLK_COM(pdmin0);
+       WARN_ON(IS_ERR_OR_NULL(clks[CLKID_AUDIO_PDMIN0]));
+
+       IOMAP_COM_CLK(pdmin1, iobase);
+       clks[CLKID_AUDIO_PDMIN1] = REGISTER_CLK_COM(pdmin1);
+       WARN_ON(IS_ERR_OR_NULL(clks[CLKID_AUDIO_PDMIN1]));
+
+       IOMAP_COM_CLK(spdifout_b, iobase);
+       clks[CLKID_AUDIO_SPDIFOUT_B] = REGISTER_CLK_COM(spdifout_b);
+       WARN_ON(IS_ERR_OR_NULL(clks[CLKID_AUDIO_SPDIFOUT_B]));
+
+       IOMAP_COM_CLK(resample_b, iobase);
+       clks[CLKID_AUDIO_RESAMPLE_B] = REGISTER_AUDIOCLK_COM(resample_b);
+       WARN_ON(IS_ERR_OR_NULL(clks[CLKID_AUDIO_RESAMPLE_B]));
+
+       IOMAP_COM_CLK(spdifin_lb, iobase);
+       clks[CLKID_AUDIO_SPDIFIN_LB] = REGISTER_CLK_COM(spdifin_lb);
+       WARN_ON(IS_ERR_OR_NULL(clks[CLKID_AUDIO_SPDIFIN_LB]));
+
+       IOMAP_COM_CLK(eqdrc, iobase);
+       clks[CLKID_AUDIO_EQDRC] = REGISTER_CLK_COM(eqdrc);
+       WARN_ON(IS_ERR_OR_NULL(clks[CLKID_AUDIO_EQDRC]));
+
+       IOMAP_COM_CLK(vad, iobase);
+       clks[CLKID_AUDIO_VAD] = REGISTER_CLK_COM(vad);
+       WARN_ON(IS_ERR_OR_NULL(clks[CLKID_AUDIO_VAD]));
+
+       IOMAP_COM_CLK(earctx_cmdc, iobase);
+       clks[CLKID_EARCTX_CMDC] = REGISTER_CLK_COM(earctx_cmdc);
+       WARN_ON(IS_ERR_OR_NULL(clks[CLKID_EARCTX_CMDC]));
+
+       IOMAP_COM_CLK(earctx_dmac, iobase);
+       clks[CLKID_EARCTX_DMAC] = REGISTER_CLK_COM(earctx_dmac);
+       WARN_ON(IS_ERR_OR_NULL(clks[CLKID_EARCTX_DMAC]));
+
+       IOMAP_COM_CLK(earcrx_cmdc, iobase);
+       clks[CLKID_EARCRX_CMDC] = REGISTER_CLK_COM(earcrx_cmdc);
+       WARN_ON(IS_ERR_OR_NULL(clks[CLKID_EARCRX_CMDC]));
+
+       IOMAP_COM_CLK(earcrx_dmac, iobase);
+       clks[CLKID_EARCRX_DMAC] = REGISTER_CLK_COM(earcrx_dmac);
+       WARN_ON(IS_ERR_OR_NULL(clks[CLKID_EARCRX_DMAC]));
+
+       return 0;
+}
+
+struct audio_clk_init tm2_audio_clks_init = {
+       .clk_num   = NUM_AUDIO_CLKS,
+       .clk_gates = tm2_clk_gates_init,
+       .clks      = tm2_clks_init,
+};
index 8a260bb..5f09029 100644 (file)
@@ -541,6 +541,11 @@ static void vad_deinit(struct vad *p_vad)
        vad_set_clks(p_vad, false);
 }
 
+void vad_set_lowerpower_mode(bool isLowPower)
+{
+       vad_force_clk_to_oscin(isLowPower);
+}
+
 void vad_update_buffer(int isvad)
 {
        struct vad *p_vad = get_vad();
@@ -561,7 +566,7 @@ void vad_update_buffer(int isvad)
                p_vad->start_last = tddr->start_addr;
                p_vad->end_last   = tddr->end_addr;
 
-               rd_th = 0x100;
+               rd_th = 0x800;
 
                pr_debug("Switch to VAD buffer\n");
                pr_debug("\t ASAL start:%x, end:%x, bytes:%d\n",
@@ -1003,7 +1008,8 @@ static int vad_platform_probe(struct platform_device *pdev)
        return 0;
 }
 
-int vad_platform_suspend(struct platform_device *pdev, pm_message_t state)
+static int vad_platform_suspend(
+       struct platform_device *pdev, pm_message_t state)
 {
        struct device *dev = &pdev->dev;
        struct vad *p_vad = dev_get_drvdata(dev);
@@ -1022,7 +1028,8 @@ int vad_platform_suspend(struct platform_device *pdev, pm_message_t state)
        return 0;
 }
 
-int vad_platform_resume(struct platform_device *pdev)
+static int vad_platform_resume(
+       struct platform_device *pdev)
 {
        struct device *dev = &pdev->dev;
        struct vad *p_vad = dev_get_drvdata(dev);
index cd09468..f3964a3 100644 (file)
@@ -44,4 +44,5 @@ extern void vad_set_trunk_data_readable(bool en);
 
 extern int card_add_vad_kcontrols(struct snd_soc_card *card);
 
+extern void vad_set_lowerpower_mode(bool isLowPower);
 #endif
index c122dd0..ba9b2d5 100644 (file)
@@ -107,3 +107,8 @@ void vad_set_enable(bool enable)
                vad_write(VAD_TOP_CTRL1, 0x0);
        }
 }
+
+void vad_force_clk_to_oscin(bool force)
+{
+       audiobus_update_bits(EE_AUDIO_CLK_VAD_CTRL, 0x1 << 30, force << 30);
+}
index 44a1224..af0659c 100644 (file)
@@ -35,4 +35,6 @@ extern void vad_set_src(int src);
 extern void vad_set_in(void);
 
 extern void vad_set_enable(bool enable);
+
+extern void vad_force_clk_to_oscin(bool force);
 #endif
index 51f61b0..aa87176 100644 (file)
@@ -19,32 +19,33 @@ static void ad82584f_early_suspend(struct early_suspend *h);
 static void ad82584f_late_resume(struct early_suspend *h);
 #endif
 
-#define AD82584F_RATES (SNDRV_PCM_RATE_32000 | \
-                      SNDRV_PCM_RATE_44100 | \
-                      SNDRV_PCM_RATE_48000 | \
-                      SNDRV_PCM_RATE_64000 | \
-                      SNDRV_PCM_RATE_88200 | \
-                      SNDRV_PCM_RATE_96000 | \
-                      SNDRV_PCM_RATE_176400 | \
-                      SNDRV_PCM_RATE_192000)
+#define AD82584F_RATES (SNDRV_PCM_RATE_16000 | \
+       SNDRV_PCM_RATE_32000 | \
+       SNDRV_PCM_RATE_44100 | \
+       SNDRV_PCM_RATE_48000 | \
+       SNDRV_PCM_RATE_64000 | \
+       SNDRV_PCM_RATE_88200 | \
+       SNDRV_PCM_RATE_96000 | \
+       SNDRV_PCM_RATE_176400 | \
+       SNDRV_PCM_RATE_192000)
 
 #define AD82584F_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | \
-        SNDRV_PCM_FMTBIT_S24_LE | \
-        SNDRV_PCM_FMTBIT_S32_LE)
+       SNDRV_PCM_FMTBIT_S24_LE | \
+       SNDRV_PCM_FMTBIT_S32_LE)
 
 static const DECLARE_TLV_DB_SCALE(mvol_tlv, -10300, 50, 1);
 static const DECLARE_TLV_DB_SCALE(chvol_tlv, -10300, 50, 1);
 
 static const struct snd_kcontrol_new ad82584f_snd_controls[] = {
-       SOC_SINGLE_TLV("AMP Master Volume", MVOL, 0,
+       SOC_SINGLE_TLV("Master Volume", MVOL, 0,
                                0xff, 1, mvol_tlv),
-       SOC_SINGLE_TLV("AMP Ch1 Volume", C1VOL, 0,
+       SOC_SINGLE_TLV("Ch1 Volume", C1VOL, 0,
                                0xff, 1, chvol_tlv),
-       SOC_SINGLE_TLV("AMP Ch2 Volume", C2VOL, 0,
+       SOC_SINGLE_TLV("Ch2 Volume", C2VOL, 0,
                        0xff, 1, chvol_tlv),
 
-       SOC_SINGLE("AMP Ch1 Switch", MUTE, 5, 1, 1),
-       SOC_SINGLE("AMP Ch2 Switch", MUTE, 4, 1, 1),
+       SOC_SINGLE("Ch1 Switch", MUTE, 5, 1, 1),
+       SOC_SINGLE("Ch2 Switch", MUTE, 4, 1, 1),
 };
 
 static int ad82584f_reg_init(struct snd_soc_codec *codec);
@@ -773,9 +774,9 @@ static int reset_ad82584f_GPIO(struct snd_soc_codec *codec)
                return -1;
 
        gpio_direction_output(pdata->reset_pin, GPIOF_OUT_INIT_LOW);
-       mdelay(1);
+       usleep_range(10 * 1000, 11 * 1000);
        gpio_direction_output(pdata->reset_pin, GPIOF_OUT_INIT_HIGH);
-       mdelay(1);
+       usleep_range(1 * 1000, 2 * 1000);
 
        return 0;
 }
@@ -830,8 +831,10 @@ static int ad82584f_init(struct snd_soc_codec *codec)
        /* for de-pop */
        udelay(100);
 
+       snd_soc_write(codec, MVOL, 0x11);
+
        /* unmute, default power-on is mute. */
-       snd_soc_write(codec, 0x02, 0x00);
+       snd_soc_write(codec, MUTE, 0x00);
 
        return 0;
 }
index 2df8a74..a0de3d1 100644 (file)
@@ -355,10 +355,10 @@ static const struct snd_soc_dapm_widget tl1_acodec_dapm_widgets[] = {
                         0, 0, &lir_mux),
 
        /*ADC capture stream */
-       SND_SOC_DAPM_ADC("Left ADC", "Capture", ACODEC_0,
-                        ADCL_EN, 0),
-       SND_SOC_DAPM_ADC("Right ADC", "Capture", ACODEC_0,
-                        ADCR_EN, 0),
+       SND_SOC_DAPM_ADC("Left ADC", "Capture", SND_SOC_NOPM,
+                        0, 0),
+       SND_SOC_DAPM_ADC("Right ADC", "Capture", SND_SOC_NOPM,
+                        0, 0),
 
        /*Output */
        SND_SOC_DAPM_OUTPUT("Lineout 1 left"),
@@ -368,19 +368,19 @@ static const struct snd_soc_dapm_widget tl1_acodec_dapm_widgets[] = {
 
        /*DAC playback stream */
        SND_SOC_DAPM_DAC("Left DAC", "Playback",
-                       ACODEC_0,
-                       DACL_EN, 0),
+                       SND_SOC_NOPM,
+                       0, 0),
        SND_SOC_DAPM_DAC("Right DAC", "Playback",
-                       ACODEC_0,
-                       DACR_EN, 0),
+                       SND_SOC_NOPM,
+                       0, 0),
 
        /*DAC 2 playback stream */
        SND_SOC_DAPM_DAC("Left DAC2", "Playback",
-                       ACODEC_5,
-                       DAC2L_EN, 0),
+                       SND_SOC_NOPM,
+                       0, 0),
        SND_SOC_DAPM_DAC("Right DAC2", "Playback",
-                       ACODEC_5,
-                       DAC2R_EN, 0),
+                       SND_SOC_NOPM,
+                       0, 0),
 
        /*DRV output */
        SND_SOC_DAPM_OUT_DRV("LO1L_OUT_EN", ACODEC_0,
index 615320e..c4d202d 100644 (file)
@@ -53,6 +53,7 @@
 #define TAS5805M_REG_2A      (0x2a)
 #define TAS5805M_REG_2B      (0x2b)
 #define TAS5805M_REG_35      (0x35)
+#define TAS5805M_DIG_VAL_CTL (0x4c)
 #define TAS5805M_REG_7F      (0x7f)
 
 #define TAS5805M_PAGE_00     (0x00)
@@ -61,7 +62,7 @@
 #define TAS5805M_BOOK_00     (0x00)
 #define TAS5805M_BOOK_8C     (0x8c)
 
-#define TAS5805M_VOLUME_MAX  (158)
+#define TAS5805M_VOLUME_MAX  (578)
 #define TAS5805M_VOLUME_MIN  (0)
 
 const uint32_t tas5805m_volume[] = {
@@ -145,92 +146,520 @@ const uint32_t tas5805m_volume[] = {
        0x0002DD96,             //77, -33dB
        0x00033718,             //78, -32dB
        0x00039B87,             //79, -31dB
-       0x00040C37,             //80, -30dB
-       0x00048AA7,             //81, -29dB
-       0x00051884,             //82, -28dB
-       0x0005B7B1,             //83, -27dB
-       0x00066A4A,             //84, -26dB
-       0x000732AE,             //85, -25dB
-       0x00081385,             //86, -24dB
-       0x00090FCC,             //87, -23dB
-       0x000A2ADB,             //88, -22dB
-       0x000B6873,             //89, -21dB
-       0x000CCCCD,             //90, -20dB
-       0x000E5CA1,             //91, -19dB
-       0x00101D3F,             //92, -18dB
-       0x0012149A,             //93, -17dB
-       0x00144961,             //94, -16dB
-       0x0016C311,             //95, -15dB
-       0x00198A13,             //96, -14dB
-       0x001CA7D7,             //97, -13dB
-       0x002026F3,             //98, -12dB
-       0x00241347,             //99, -11dB
-       0x00287A27,             //100, -10dB
-       0x002D6A86,             //101, -9dB
-       0x0032F52D,             //102, -8dB
-       0x00392CEE,             //103, -7dB
-       0x004026E7,             //104, -6dB
-       0x0047FACD,             //105, -5dB
-       0x0050C336,             //106, -4dB
-       0x005A9DF8,             //107, -3dB
-       0x0065AC8C,             //108, -2dB
-       0x00721483,             //109, -1dB
-       0x00800000,             //110, 0dB
-       0x008F9E4D,             //111, 1dB
-       0x00A12478,             //112, 2dB
-       0x00B4CE08,             //113, 3dB
-       0x00CADDC8,             //114, 4dB
-       0x00E39EA9,             //115, 5dB
-       0x00FF64C1,             //116, 6dB
-       0x011E8E6A,             //117, 7dB
-       0x0141857F,             //118, 8dB
-       0x0168C0C6,             //119, 9dB
-       0x0194C584,             //120, 10dB
-       0x01C62940,             //121, 11dB
-       0x01FD93C2,             //122, 12dB
-       0x023BC148,             //123, 13dB
-       0x02818508,             //124, 14dB
-       0x02CFCC01,             //125, 15dB
-       0x0327A01A,             //126, 16dB
-       0x038A2BAD,             //127, 17dB
-       0x03F8BD7A,             //128, 18dB
-       0x0474CD1B,             //129, 19dB
-       0x05000000,             //130, 20dB
-       0x059C2F02,             //131, 21dB
-       0x064B6CAE,             //132, 22dB
-       0x07100C4D,             //133, 23dB
-       0x07ECA9CD,             //134, 24dB
-       0x08E43299,             //135, 25dB
-       0x09F9EF8E,             //136, 26dB
-       0x0B319025,             //137, 27dB
-       0x0C8F36F2,             //138, 28dB
-       0x0E1787B8,             //139, 29dB
-       0x0FCFB725,             //140, 30dB
-       0x11BD9C84,             //141, 31dB
-       0x13E7C594,             //142, 32dB
-       0x16558CCB,             //143, 33dB
-       0x190F3254,             //144, 34dB
-       0x1C1DF80E,             //145, 35dB
-       0x1F8C4107,             //146, 36dB
-       0x2365B4BF,             //147, 37dB
-       0x27B766C2,             //148, 38dB
-       0x2C900313,             //149, 39dB
-       0x32000000,             //150, 40dB
-       0x3819D612,             //151, 41dB
-       0x3EF23ECA,             //152, 42dB
-       0x46A07B07,             //153, 43dB
-       0x4F3EA203,             //154, 44dB
-       0x58E9F9F9,             //155, 45dB
-       0x63C35B8E,             //156, 46dB
-       0x6FEFA16D,             //157, 47dB
-       0x7D982575,             //158, 48dB
+       0x00040C37,             //80    -30
+       0x00041B3C,             //81    -29.875
+       0x00042A79,             //82    -29.75
+       0x000439EE,             //83    -29.625
+       0x0004499D,             //84    -29.5
+       0x00045986,             //85    -29.375
+       0x000469AA,             //86    -29.25
+       0x00047A0A,             //87    -29.125
+       0x00048AA7,             //88    -29
+       0x00049B81,             //89    -28.875
+       0x0004AC9A,             //90    -28.75
+       0x0004BDF2,             //91    -28.625
+       0x0004CF8B,             //92    -28.5
+       0x0004E165,             //93    -28.375
+       0x0004F381,             //94    -28.25
+       0x000505E0,             //95    -28.125
+       0x00051884,             //96    -28
+       0x00052B6D,             //97    -27.875
+       0x00053E9C,             //98    -27.75
+       0x00055212,             //99    -27.625
+       0x000565D0,             //100   -27.5
+       0x000579D8,             //101   -27.375
+       0x00058E2A,             //102   -27.25
+       0x0005A2C7,             //103   -27.125
+       0x0005B7B1,             //104   -27
+       0x0005CCE8,             //105   -26.875
+       0x0005E26E,             //106   -26.75
+       0x0005F844,             //107   -26.625
+       0x00060E6C,             //108   -26.5
+       0x000624E5,             //109   -26.375
+       0x00063BB1,             //110   -26.25
+       0x000652D3,             //111   -26.125
+       0x00066A4A,             //112   -26
+       0x00068218,             //113   -25.875
+       0x00069A3E,             //114   -25.75
+       0x0006B2BF,             //115   -25.625
+       0x0006CB9A,             //116   -25.5
+       0x0006E4D1,             //117   -25.375
+       0x0006FE66,             //118   -25.25
+       0x0007185A,             //119   -25.125
+       0x000732AE,             //120   -25
+       0x00074D63,             //121   -24.875
+       0x0007687C,             //122   -24.75
+       0x000783FA,             //123   -24.625
+       0x00079FDD,             //124   -24.5
+       0x0007BC28,             //125   -24.375
+       0x0007D8DC,             //126   -24.25
+       0x0007F5FA,             //127   -24.125
+       0x00081385,             //128   -24
+       0x0008317D,             //129   -23.875
+       0x00084FE4,             //130   -23.75
+       0x00086EBC,             //131   -23.625
+       0x00088E07,             //132   -23.5
+       0x0008ADC6,             //133   -23.375
+       0x0008CDFA,             //134   -23.25
+       0x0008EEA6,             //135   -23.125
+       0x00090FCB,             //136   -23
+       0x0009316C,             //137   -22.875
+       0x00095389,             //138   -22.75
+       0x00097624,             //139   -22.625
+       0x00099940,             //140   -22.5
+       0x0009BCDF,             //141   -22.375
+       0x0009E101,             //142   -22.25
+       0x000A05AA,             //143   -22.125
+       0x000A2ADA,             //144   -22
+       0x000A5095,             //145   -21.875
+       0x000A76DC,             //146   -21.75
+       0x000A9DB0,             //147   -21.625
+       0x000AC515,             //148   -21.5
+       0x000AED0C,             //149   -21.375
+       0x000B1597,             //150   -21.25
+       0x000B3EB9,             //151   -21.125
+       0x000B6873,             //152   -21
+       0x000B92C8,             //153   -20.875
+       0x000BBDBA,             //154   -20.75
+       0x000BE94C,             //155   -20.625
+       0x000C157F,             //156   -20.5
+       0x000C4256,             //157   -20.375
+       0x000C6FD4,             //158   -20.25
+       0x000C9DFB,             //159   -20.125
+       0x000CCCCC,             //160   -20
+       0x000CFC4C,             //161   -19.875
+       0x000D2C7B,             //162   -19.75
+       0x000D5D5E,             //163   -19.625
+       0x000D8EF6,             //164   -19.5
+       0x000DC146,             //165   -19.375
+       0x000DF451,             //166   -19.25
+       0x000E2819,             //167   -19.125
+       0x000E5CA1,             //168   -19
+       0x000E91EC,             //169   -18.875
+       0x000EC7FD,             //170   -18.75
+       0x000EFED6,             //171   -18.625
+       0x000F367B,             //172   -18.5
+       0x000F6EEF,             //173   -18.375
+       0x000FA834,             //174   -18.25
+       0x000FE24E,             //175   -18.125
+       0x00101D3F,             //176   -18
+       0x0010590B,             //177   -17.875
+       0x001095B4,             //178   -17.75
+       0x0010D33F,             //179   -17.625
+       0x001111AE,             //180   -17.5
+       0x00115105,             //181   -17.375
+       0x00119147,             //182   -17.25
+       0x0011D278,             //183   -17.125
+       0x0012149A,             //184   -17
+       0x001257B2,             //185   -16.875
+       0x00129BC2,             //186   -16.75
+       0x0012E0CF,             //187   -16.625
+       0x001326DD,             //188   -16.5
+       0x00136DEE,             //189   -16.375
+       0x0013B607,             //190   -16.25
+       0x0013FF2C,             //191   -16.125
+       0x00144960,             //192   -16
+       0x001494A8,             //193   -15.875
+       0x0014E107,             //194   -15.75
+       0x00152E81,             //195   -15.625
+       0x00157D1A,             //196   -15.5
+       0x0015CCD8,             //197   -15.375
+       0x00161DBD,             //198   -15.25
+       0x00166FCE,             //199   -15.125
+       0x0016C310,             //200   -15
+       0x00171787,             //201   -14.875
+       0x00176D38,             //202   -14.75
+       0x0017C426,             //203   -14.625
+       0x00181C57,             //204   -14.5
+       0x001875CF,             //205   -14.375
+       0x0018D093,             //206   -14.25
+       0x00192CA8,             //207   -14.125
+       0x00198A13,             //208   -14
+       0x0019E8D8,             //209   -13.875
+       0x001A48FD,             //210   -13.75
+       0x001AAA87,             //211   -13.625
+       0x001B0D7B,             //212   -13.5
+       0x001B71DD,             //213   -13.375
+       0x001BD7B5,             //214   -13.25
+       0x001C3F06,             //215   -13.125
+       0x001CA7D7,             //216   -13
+       0x001D122D,             //217   -12.875
+       0x001D7E0D,             //218   -12.75
+       0x001DEB7D,             //219   -12.625
+       0x001E5A84,             //220   -12.5
+       0x001ECB27,             //221   -12.375
+       0x001F3D6B,             //222   -12.25
+       0x001FB158,             //223   -12.125
+       0x002026F3,             //224   -12
+       0x00209E42,             //225   -11.875
+       0x0021174C,             //226   -11.75
+       0x00219217,             //227   -11.625
+       0x00220EA9,             //228   -11.5
+       0x00228D0A,             //229   -11.375
+       0x00230D40,             //230   -11.25
+       0x00238F52,             //231   -11.125
+       0x00241346,             //232   -11
+       0x00249924,             //233   -10.875
+       0x002520F3,             //234   -10.75
+       0x0025AABA,             //235   -10.625
+       0x00263680,             //236   -10.5
+       0x0026C44D,             //237   -10.375
+       0x00275427,             //238   -10.25
+       0x0027E618,             //239   -10.125
+       0x00287A26,             //240   -10
+       0x0029105A,             //241   -9.875
+       0x0029A8BB,             //242   -9.75
+       0x002A4351,             //243   -9.625
+       0x002AE025,             //244   -9.5
+       0x002B7F3F,             //245   -9.375
+       0x002C20A8,             //246   -9.25
+       0x002CC467,             //247   -9.125
+       0x002D6A86,             //248   -9
+       0x002E130D,             //249   -8.875
+       0x002EBE06,             //250   -8.75
+       0x002F6B79,             //251   -8.625
+       0x00301B70,             //252   -8.5
+       0x0030CDF4,             //253   -8.375
+       0x0031830E,             //254   -8.25
+       0x00323AC8,             //255   -8.125
+       0x0032F52C,             //256   -8
+       0x0033B244,             //257   -7.875
+       0x0034721A,             //258   -7.75
+       0x003534B7,             //259   -7.625
+       0x0035FA26,             //260   -7.5
+       0x0036C272,             //261   -7.375
+       0x00378DA5,             //262   -7.25
+       0x00385BCB,             //263   -7.125
+       0x00392CED,             //264   -7
+       0x003A0117,             //265   -6.875
+       0x003AD855,             //266   -6.75
+       0x003BB2B1,             //267   -6.625
+       0x003C9038,             //268   -6.5
+       0x003D70F5,             //269   -6.375
+       0x003E54F3,             //270   -6.25
+       0x003F3C40,             //271   -6.125
+       0x004026E7,             //272   -6
+       0x004114F4,             //273   -5.875
+       0x00420675,             //274   -5.75
+       0x0042FB77,             //275   -5.625
+       0x0043F405,             //276   -5.5
+       0x0044F02E,             //277   -5.375
+       0x0045EFFE,             //278   -5.25
+       0x0046F384,             //279   -5.125
+       0x0047FACC,             //280   -5
+       0x004905E6,             //281   -4.875
+       0x004A14DF,             //282   -4.75
+       0x004B27C5,             //283   -4.625
+       0x004C3EA8,             //284   -4.5
+       0x004D5995,             //285   -4.375
+       0x004E789C,             //286   -4.25
+       0x004F9BCD,             //287   -4.125
+       0x0050C335,             //288   -4
+       0x0051EEE6,             //289   -3.875
+       0x00531EEF,             //290   -3.75
+       0x00545361,             //291   -3.625
+       0x00558C4B,             //292   -3.5
+       0x0056C9BE,             //293   -3.375
+       0x00580BCB,             //294   -3.25
+       0x00595283,             //295   -3.125
+       0x005A9DF7,             //296   -3
+       0x005BEE3A,             //297   -2.875
+       0x005D435C,             //298   -2.75
+       0x005E9D70,             //299   -2.625
+       0x005FFC88,             //300   -2.5
+       0x006160B7,             //301   -2.375
+       0x0062CA10,             //302   -2.25
+       0x006438A6,             //303   -2.125
+       0x0065AC8C,             //304   -2
+       0x006725D6,             //305   -1.875
+       0x0068A498,             //306   -1.75
+       0x006A28E6,             //307   -1.625
+       0x006BB2D6,             //308   -1.5
+       0x006D427B,             //309   -1.375
+       0x006ED7EB,             //310   -1.25
+       0x0070733B,             //311   -1.125
+       0x00721482,             //312   -1
+       0x0073BBD6,             //313   -0.875
+       0x0075694C,             //314   -0.75
+       0x00771CFC,             //315   -0.625
+       0x0078D6FC,             //316   -0.5
+       0x007A9765,             //317   -0.375
+       0x007C5E4E,             //318   -0.25
+       0x007E2BCE,             //319   -0.125
+       0x00800000,             //320   0
+       0x0081DAFA,             //321   0.125
+       0x0083BCD7,             //322   0.25
+       0x0085A5B1,             //323   0.375
+       0x008795A0,             //324   0.5
+       0x00898CBF,             //325   0.625
+       0x008B8B2A,             //326   0.75
+       0x008D90FA,             //327   0.875
+       0x008F9E4C,             //328   1
+       0x0091B33C,             //329   1.125
+       0x0093CFE5,             //330   1.25
+       0x0095F464,             //331   1.375
+       0x009820D7,             //332   1.5
+       0x009A555A,             //333   1.625
+       0x009C920D,             //334   1.75
+       0x009ED70C,             //335   1.875
+       0x00A12477,             //336   2
+       0x00A37A6E,             //337   2.125
+       0x00A5D90F,             //338   2.25
+       0x00A8407C,             //339   2.375
+       0x00AAB0D4,             //340   2.5
+       0x00AD2A39,             //341   2.625
+       0x00AFACCC,             //342   2.75
+       0x00B238B0,             //343   2.875
+       0x00B4CE07,             //344   3
+       0x00B76CF4,             //345   3.125
+       0x00BA159B,             //346   3.25
+       0x00BCC81F,             //347   3.375
+       0x00BF84A6,             //348   3.5
+       0x00C24B54,             //349   3.625
+       0x00C51C4F,             //350   3.75
+       0x00C7F7BE,             //351   3.875
+       0x00CADDC7,             //352   4
+       0x00CDCE92,             //353   4.125
+       0x00D0CA46,             //354   4.25
+       0x00D3D10B,             //355   4.375
+       0x00D6E30C,             //356   4.5
+       0x00DA0072,             //357   4.625
+       0x00DD2966,             //358   4.75
+       0x00E05E15,             //359   4.875
+       0x00E39EA8,             //360   5
+       0x00E6EB4E,             //361   5.125
+       0x00EA4431,             //362   5.25
+       0x00EDA980,             //363   5.375
+       0x00F11B69,             //364   5.5
+       0x00F49A1B,             //365   5.625
+       0x00F825C5,             //366   5.75
+       0x00FBBE96,             //367   5.875
+       0x00FF64C1,             //368   6
+       0x01031876,             //369   6.125
+       0x0106D9E8,             //370   6.25
+       0x010AA94A,             //371   6.375
+       0x010E86CF,             //372   6.5
+       0x011272AB,             //373   6.625
+       0x01166D15,             //374   6.75
+       0x011A7643,             //375   6.875
+       0x011E8E6A,             //376   7
+       0x0122B5C2,             //377   7.125
+       0x0126EC84,             //378   7.25
+       0x012B32EA,             //379   7.375
+       0x012F892C,             //380   7.5
+       0x0133EF86,             //381   7.625
+       0x01386634,             //382   7.75
+       0x013CED72,             //383   7.875
+       0x0141857E,             //384   8
+       0x01462E96,             //385   8.125
+       0x014AE8F9,             //386   8.25
+       0x014FB4E8,             //387   8.375
+       0x015492A3,             //388   8.5
+       0x0159826D,             //389   8.625
+       0x015E8488,             //390   8.75
+       0x01639939,             //391   8.875
+       0x0168C0C5,             //392   9
+       0x016DFB71,             //393   9.125
+       0x01734985,             //394   9.25
+       0x0178AB48,             //395   9.375
+       0x017E2104,             //396   9.5
+       0x0183AB02,             //397   9.625
+       0x0189498F,             //398   9.75
+       0x018EFCF5,             //399   9.875
+       0x0194C583,             //400   10
+       0x019AA387,             //401   10.125
+       0x01A09751,             //402   10.25
+       0x01A6A131,             //403   10.375
+       0x01ACC179,             //404   10.5
+       0x01B2F87D,             //405   10.625
+       0x01B94691,             //406   10.75
+       0x01BFAC0A,             //407   10.875
+       0x01C62940,             //408   11
+       0x01CCBE8A,             //409   11.125
+       0x01D36C42,             //410   11.25
+       0x01DA32C2,             //411   11.375
+       0x01E11266,             //412   11.5
+       0x01E80B8C,             //413   11.625
+       0x01EF1E92,             //414   11.75
+       0x01F64BD9,             //415   11.875
+       0x01FD93C1,             //416   12
+       0x0204F6AE,             //417   12.125
+       0x020C7504,             //418   12.25
+       0x02140F28,             //419   12.375
+       0x021BC582,             //420   12.5
+       0x0223987A,             //421   12.625
+       0x022B887B,             //422   12.75
+       0x023395F0,             //423   12.875
+       0x023BC147,             //424   13
+       0x02440AEE,             //425   13.125
+       0x024C7356,             //426   13.25
+       0x0254FAF2,             //427   13.375
+       0x025DA234,             //428   13.5
+       0x02666992,             //429   13.625
+       0x026F5184,             //430   13.75
+       0x02785A83,             //431   13.875
+       0x02818508,             //432   14
+       0x028AD191,             //433   14.125
+       0x0294409B,             //434   14.25
+       0x029DD2A7,             //435   14.375
+       0x02A78836,             //436   14.5
+       0x02B161CD,             //437   14.625
+       0x02BB5FF1,             //438   14.75
+       0x02C5832A,             //439   14.875
+       0x02CFCC01,             //440   15
+       0x02DA3B02,             //441   15.125
+       0x02E4D0BA,             //442   15.25
+       0x02EF8DB9,             //443   15.375
+       0x02FA7292,             //444   15.5
+       0x03057FD7,             //445   15.625
+       0x0310B61F,             //446   15.75
+       0x031C1602,             //447   15.875
+       0x0327A01A,             //448   16
+       0x03335504,             //449   16.125
+       0x033F355F,             //450   16.25
+       0x034B41CC,             //451   16.375
+       0x03577AEF,             //452   16.5
+       0x0363E16D,             //453   16.625
+       0x037075EF,             //454   16.75
+       0x037D3920,             //455   16.875
+       0x038A2BAC,             //456   17
+       0x03974E44,             //457   17.125
+       0x03A4A19A,             //458   17.25
+       0x03B22662,             //459   17.375
+       0x03BFDD55,             //460   17.5
+       0x03CDC72C,             //461   17.625
+       0x03DBE4A4,             //462   17.75
+       0x03EA367D,             //463   17.875
+       0x03F8BD79,             //464   18
+       0x04077A5E,             //465   18.125
+       0x04166DF2,             //466   18.25
+       0x04259902,             //467   18.375
+       0x0434FC5C,             //468   18.5
+       0x044498CF,             //469   18.625
+       0x04546F30,             //470   18.75
+       0x04648056,             //471   18.875
+       0x0474CD1B,             //472   19
+       0x0485565C,             //473   19.125
+       0x04961CFA,             //474   19.25
+       0x04A721D8,             //475   19.375
+       0x04B865DE,             //476   19.5
+       0x04C9E9F5,             //477   19.625
+       0x04DBAF0C,             //478   19.75
+       0x04EDB613,             //479   19.875
+       0x05000000,             //480   20
+       0x05128DCA,             //481   20.125
+       0x0525606D,             //482   20.25
+       0x053878EA,             //483   20.375
+       0x054BD842,             //484   20.5
+       0x055F7F7E,             //485   20.625
+       0x05736FA7,             //486   20.75
+       0x0587A9CD,             //487   20.875
+       0x059C2F01,             //488   21
+       0x05B1005B,             //489   21.125
+       0x05C61EF5,             //490   21.25
+       0x05DB8BEE,             //491   21.375
+       0x05F14868,             //492   21.5
+       0x0607558B,             //493   21.625
+       0x061DB482,             //494   21.75
+       0x0634667C,             //495   21.875
+       0x064B6CAD,             //496   22
+       0x0662C84F,             //497   22.125
+       0x067A7A9D,             //498   22.25
+       0x069284DB,             //499   22.375
+       0x06AAE84D,             //500   22.5
+       0x06C3A63F,             //501   22.625
+       0x06DCC001,             //502   22.75
+       0x06F636E8,             //503   22.875
+       0x07100C4D,             //504   23
+       0x072A418F,             //505   23.125
+       0x0744D811,             //506   23.25
+       0x075FD13C,             //507   23.375
+       0x077B2E7F,             //508   23.5
+       0x0796F14D,             //509   23.625
+       0x07B31B1F,             //510   23.75
+       0x07CFAD73,             //511   23.875
+       0x07ECA9CD,             //512   24
+       0x080A11B5,             //513   24.125
+       0x0827E6BD,             //514   24.25
+       0x08462A77,             //515   24.375
+       0x0864DE80,             //516   24.5
+       0x08840477,             //517   24.625
+       0x08A39E04,             //518   24.75
+       0x08C3ACD3,             //519   24.875
+       0x08E43298,             //520   25
+       0x0905310C,             //521   25.125
+       0x0926A9EF,             //522   25.25
+       0x09489F07,             //523   25.375
+       0x096B1222,             //524   25.5
+       0x098E0512,             //525   25.625
+       0x09B179B2,             //526   25.75
+       0x09D571E3,             //527   25.875
+       0x09F9EF8E,             //528   26
+       0x0A1EF4A1,             //529   26.125
+       0x0A448314,             //530   26.25
+       0x0A6A9CE4,             //531   26.375
+       0x0A914416,             //532   26.5
+       0x0AB87AB7,             //533   26.625
+       0x0AE042DB,             //534   26.75
+       0x0B089E9E,             //535   26.875
+       0x0B319024,             //536   27
+       0x0B5B1998,             //537   27.125
+       0x0B853D2F,             //538   27.25
+       0x0BAFFD24,             //539   27.375
+       0x0BDB5BBC,             //540   27.5
+       0x0C075B43,             //541   27.625
+       0x0C33FE0E,             //542   27.75
+       0x0C61467B,             //543   27.875
+       0x0C8F36F2,             //544   28
+       0x0CBDD1E0,             //545   28.125
+       0x0CED19C0,             //546   28.25
+       0x0D1D1113,             //547   28.375
+       0x0D4DBA63,             //548   28.5
+       0x0D7F1845,             //549   28.625
+       0x0DB12D58,             //550   28.75
+       0x0DE3FC43,             //551   28.875
+       0x0E1787B8,             //552   29
+       0x0E4BD272,             //553   29.125
+       0x0E80DF37,             //554   29.25
+       0x0EB6B0D7,             //555   29.375
+       0x0EED4A2D,             //556   29.5
+       0x0F24AE1D,             //557   29.625
+       0x0F5CDF98,             //558   29.75
+       0x0F95E199,             //559   29.875
+       0x0FCFB724,             //560   30
+       0x11BD9C84,             //561   31dB
+       0x13E7C594,             //562   32dB
+       0x16558CCB,             //563   33dB
+       0x190F3254,             //564   34dB
+       0x1C1DF80E,             //565   35dB
+       0x1F8C4107,             //566   36dB
+       0x2365B4BF,             //567   37dB
+       0x27B766C2,             //568   38dB
+       0x2C900313,             //569   39dB
+       0x32000000,             //570   40dB
+       0x3819D612,             //571   41dB
+       0x3EF23ECA,             //572   42dB
+       0x46A07B07,             //573   43dB
+       0x4F3EA203,             //574   44dB
+       0x58E9F9F9,             //575   45dB
+       0x63C35B8E,             //576   46dB
+       0x6FEFA16D,             //577   47dB
+       0x7D982575,             //578   48dB
 };
+#define TAS5805_EQPARAM_LENGTH 610
+#define TAS5805_EQ_LENGTH 245
+#define FILTER_PARAM_BYTE 244
+static  int m_eq_tab[TAS5805_EQPARAM_LENGTH][2] = {0};
+#define TAS5805_DRC_PARAM_LENGTH 29
+#define TAS5805_DRC_PARAM_COUNT  58
+static  int m_drc_tab[TAS5805_DRC_PARAM_LENGTH][2] = {0};
 
 struct tas5805m_priv {
        struct regmap *regmap;
        struct tas5805m_platform_data *pdata;
        int vol;
        int mute;
+       struct snd_soc_codec *codec;
 };
 
 const struct regmap_config tas5805m_regmap = {
@@ -340,7 +769,6 @@ static int tas5805m_vol_locked_put(struct snd_kcontrol *kcontrol,
        tas5805m->vol = ucontrol->value.integer.value[0];
        tas5805m_set_volume(codec, tas5805m->vol);
 
-
        return 0;
 }
 
@@ -389,10 +817,110 @@ static int tas5805m_mute_locked_get(struct snd_kcontrol *kcontrol,
        return 0;
 }
 
+static int tas5805_set_EQ_enum(struct snd_kcontrol *kcontrol,
+                                  struct snd_ctl_elem_value *ucontrol)
+{
+       return 0;
+}
+
+static int tas5805_get_EQ_enum(struct snd_kcontrol *kcontrol,
+                                       struct snd_ctl_elem_value *ucontrol)
+{
+       return 0;
+}
+
+static int tas5805_set_DRC_enum(struct snd_kcontrol *kcontrol,
+                                  struct snd_ctl_elem_value *ucontrol)
+{
+       return 0;
+}
+
+static int tas5805_get_DRC_enum(struct snd_kcontrol *kcontrol,
+                                       struct snd_ctl_elem_value *ucontrol)
+{
+       return 0;
+}
+
+static int tas5805_set_DRC_param(struct snd_kcontrol *kcontrol,
+                                  struct snd_ctl_elem_value *ucontrol)
+{
+       struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
+       void *data;
+       char tmp_string[TAS5805_DRC_PARAM_COUNT];
+       char *p_string = &tmp_string[0];
+       u8 *val;
+       unsigned int i = 0;
+
+       data = kmemdup(ucontrol->value.bytes.data,
+               TAS5805_DRC_PARAM_COUNT, GFP_KERNEL | GFP_DMA);
+       if (!data)
+               return -ENOMEM;
+
+       val = (u8 *)data;
+       memcpy(p_string, val, TAS5805_DRC_PARAM_COUNT);
+
+       for (i = 0; i < TAS5805_DRC_PARAM_COUNT/2; i++) {
+               m_drc_tab[i][0] = tmp_string[2*i];
+               m_drc_tab[i][1] = tmp_string[2*i+1];
+       }
+
+       for (i = 0; i < TAS5805_DRC_PARAM_LENGTH; i++)
+               snd_soc_write(codec, m_drc_tab[i][0], m_drc_tab[i][1]);
+
+       kfree(data);
+       return 0;
+}
+
+static int tas5805_get_DRC_param(struct snd_kcontrol *kcontrol,
+                                       struct snd_ctl_elem_value *ucontrol)
+{
+       return 0;
+}
+
+
+static int tas5805_set_EQ_param(struct snd_kcontrol *kcontrol,
+                                  struct snd_ctl_elem_value *ucontrol)
+{
+       struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
+       void *data;
+       char tmp_string[TAS5805_EQ_LENGTH];
+       char *p_string = &tmp_string[0];
+       u8 *val;
+       int band_id;
+       unsigned int i = 0, j = 0;
+
+       data = kmemdup(ucontrol->value.bytes.data,
+               TAS5805_EQ_LENGTH, GFP_KERNEL | GFP_DMA);
+       if (!data)
+               return -ENOMEM;
+
+       val = (u8 *) data;
+       memcpy(p_string, val, TAS5805_EQ_LENGTH);
+       band_id = tmp_string[0];
+       for (j = 0, i = band_id * FILTER_PARAM_BYTE / 2;
+                       j < FILTER_PARAM_BYTE / 2; i++, j++) {
+               m_eq_tab[i][0] = tmp_string[2*j+1];
+               m_eq_tab[i][1] = tmp_string[2*j+2];
+       }
+       if (band_id == 4) {
+               for (i = 0; i < TAS5805_EQPARAM_LENGTH; i++)
+                       snd_soc_write(codec, m_eq_tab[i][0], m_eq_tab[i][1]);
+       }
+       kfree(data);
+       return 0;
+}
+
+static int tas5805_get_EQ_param(struct snd_kcontrol *kcontrol,
+                                       struct snd_ctl_elem_value *ucontrol)
+{
+       return 0;
+}
+
+
 static const struct snd_kcontrol_new tas5805m_vol_control[] = {
        {
         .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
-        .name = "Master Playback Volume",
+        .name = "Master Volume",
         .info = tas5805m_vol_info,
         .get = tas5805m_vol_locked_get,
         .put = tas5805m_vol_locked_put,
@@ -403,7 +931,15 @@ static const struct snd_kcontrol_new tas5805m_vol_control[] = {
         .info = tas5805m_mute_info,
         .get = tas5805m_mute_locked_get,
         .put = tas5805m_mute_locked_put,
-       }
+       },
+       SOC_SINGLE_BOOL_EXT("Set EQ Enable", 0,
+                          tas5805_get_EQ_enum, tas5805_set_EQ_enum),
+       SOC_SINGLE_BOOL_EXT("Set DRC Enable", 0,
+                          tas5805_get_DRC_enum, tas5805_set_DRC_enum),
+       SND_SOC_BYTES_EXT("EQ table", TAS5805_EQ_LENGTH,
+                          tas5805_get_EQ_param, tas5805_set_EQ_param),
+       SND_SOC_BYTES_EXT("DRC table", TAS5805_DRC_PARAM_COUNT,
+                          tas5805_get_DRC_param, tas5805_set_DRC_param),
 };
 
 static int tas5805m_set_bias_level(struct snd_soc_codec *codec,
@@ -431,31 +967,105 @@ static int tas5805m_set_bias_level(struct snd_soc_codec *codec,
        return 0;
 }
 
-static int tas5805m_snd_probe(struct snd_soc_codec *codec)
+static int tas5805m_trigger(struct snd_pcm_substream *substream, int cmd,
+                              struct snd_soc_dai *codec_dai)
 {
-       int ret;
+       struct tas5805m_priv *tas5805m = snd_soc_dai_get_drvdata(codec_dai);
+       struct snd_soc_codec *codec = tas5805m->codec;
+
+       if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+               switch (cmd) {
+               case SNDRV_PCM_TRIGGER_START:
+               case SNDRV_PCM_TRIGGER_RESUME:
+               case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
+                       pr_debug("%s(), start\n", __func__);
+                       snd_soc_write(codec, TAS5805M_REG_00, TAS5805M_PAGE_00);
+                       snd_soc_write(codec, TAS5805M_REG_7F, TAS5805M_BOOK_00);
+                       snd_soc_write(codec, TAS5805M_REG_00, TAS5805M_PAGE_00);
+                       snd_soc_write(codec, TAS5805M_DIG_VAL_CTL, 0x30);
+                       break;
+               case SNDRV_PCM_TRIGGER_STOP:
+               case SNDRV_PCM_TRIGGER_SUSPEND:
+               case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
+                       pr_debug("%s(), stop\n", __func__);
+                       snd_soc_write(codec, TAS5805M_REG_00, TAS5805M_PAGE_00);
+                       snd_soc_write(codec, TAS5805M_REG_7F, TAS5805M_BOOK_00);
+                       snd_soc_write(codec, TAS5805M_REG_00, TAS5805M_PAGE_00);
+                       snd_soc_write(codec, TAS5805M_DIG_VAL_CTL, 0xff);
+                       break;
+               }
+       }
+       return 0;
+}
+static int reset_tas5805m_GPIO(struct device *dev)
+{
+       struct tas5805m_priv *tas5805m =  dev_get_drvdata(dev);
+       struct tas5805m_platform_data *pdata = tas5805m->pdata;
+       int ret = 0;
+
+       if (pdata->reset_pin < 0)
+               return 0;
 
-       ret = snd_soc_add_codec_controls(codec, tas5805m_vol_control, 2);
+       ret = devm_gpio_request_one(dev, pdata->reset_pin,
+                                           GPIOF_OUT_INIT_LOW,
+                                           "tas5805m-reset-pin");
+       if (ret < 0)
+               return -1;
 
-       return ret;
+       gpio_direction_output(pdata->reset_pin, GPIOF_OUT_INIT_LOW);
+       usleep_range(1 * 1000, 2 * 1000);
+       gpio_direction_output(pdata->reset_pin, GPIOF_OUT_INIT_HIGH);
+       usleep_range(5 * 1000, 6 * 1000);
+
+       return 0;
 }
 
 static int tas5805m_snd_suspend(struct snd_soc_codec *codec)
 {
+       struct tas5805m_priv *tas5805m = snd_soc_codec_get_drvdata(codec);
+       struct tas5805m_platform_data *pdata = tas5805m->pdata;
        dev_info(codec->dev, "tas5805m_suspend!\n");
        tas5805m_set_bias_level(codec, SND_SOC_BIAS_OFF);
+
+       if (pdata->reset_pin)
+               gpio_direction_output(pdata->reset_pin, GPIOF_OUT_INIT_LOW);
+       udelay(10);
+       return 0;
+}
+
+
+static int tas5805m_reg_init(struct snd_soc_codec *codec)
+{
+       int i, j = 0;
+
+       for (j = 0; j < ARRAY_SIZE(tas5805m_reset); j++) {
+               snd_soc_write(codec, tas5805m_reset[j][0],
+                       tas5805m_reset[j][1]);
+       };
+       usleep_range(10 * 1000, 11 * 1000);
+       for (i = 0; i < ARRAY_SIZE(tas5805m_init_sequence); i++) {
+               snd_soc_write(codec, tas5805m_init_sequence[i][0],
+                       tas5805m_init_sequence[i][1]);
+       };
        return 0;
+
 }
 
 static int tas5805m_snd_resume(struct snd_soc_codec *codec)
 {
        int ret;
        struct tas5805m_priv *tas5805m = snd_soc_codec_get_drvdata(codec);
-
+       struct tas5805m_platform_data *pdata = tas5805m->pdata;
        dev_info(codec->dev, "tas5805m_snd_resume!\n");
-       ret =
-           regmap_register_patch(tas5805m->regmap, tas5805m_init_sequence,
-                                 ARRAY_SIZE(tas5805m_init_sequence));
+
+       if (pdata->reset_pin)
+               gpio_direction_output(pdata->reset_pin, GPIOF_OUT_INIT_HIGH);
+
+       usleep_range(3 * 1000, 4 * 1000);
+
+       ret = tas5805m_reg_init(codec);
+//         regmap_register_patch(tas5805m->regmap, tas5805m_init_sequence,
+//                               ARRAY_SIZE(tas5805m_init_sequence));
        if (ret != 0) {
                dev_err(codec->dev, "Failed to initialize TAS5805M: %d\n", ret);
                goto err;
@@ -469,8 +1079,51 @@ err:
        return ret;
 }
 
+
+
+
+static int tas5805m_probe(struct snd_soc_codec *codec)
+{
+       int ret;
+       struct tas5805m_priv *tas5805m = snd_soc_codec_get_drvdata(codec);
+
+//     ret =
+//         regmap_register_patch(tas5805m->regmap, tas5805m_init_sequence,
+//                               ARRAY_SIZE(tas5805m_init_sequence));
+       usleep_range(20 * 1000, 21 * 1000);
+       ret = tas5805m_reg_init(codec);
+       if (ret != 0)
+               goto err;
+
+       if (tas5805m)
+               tas5805m_set_volume(codec, tas5805m->vol);
+
+       snd_soc_add_codec_controls(codec, tas5805m_vol_control,
+                       ARRAY_SIZE(tas5805m_vol_control));
+       tas5805m->codec = codec;
+       return 0;
+
+err:
+       return ret;
+
+}
+
+static int tas5805m_remove(struct snd_soc_codec *codec)
+{
+       struct tas5805m_priv *tas5805m = snd_soc_codec_get_drvdata(codec);
+       struct tas5805m_platform_data *pdata = tas5805m->pdata;
+
+       if (pdata->reset_pin)
+               gpio_direction_output(pdata->reset_pin, GPIOF_OUT_INIT_LOW);
+
+       udelay(10);
+
+       return 0;
+}
+
 static struct snd_soc_codec_driver soc_codec_tas5805m = {
-       .probe = tas5805m_snd_probe,
+       .probe = tas5805m_probe,
+       .remove = tas5805m_remove,
        .suspend = tas5805m_snd_suspend,
        .resume = tas5805m_snd_resume,
        .set_bias_level = tas5805m_set_bias_level,
@@ -478,6 +1131,7 @@ static struct snd_soc_codec_driver soc_codec_tas5805m = {
 
 static const struct snd_soc_dai_ops tas5805m_dai_ops = {
        //.digital_mute = tas5805m_mute,
+       .trigger = tas5805m_trigger,
 };
 
 static struct snd_soc_dai_driver tas5805m_dai = {
@@ -492,29 +1146,6 @@ static struct snd_soc_dai_driver tas5805m_dai = {
        .ops = &tas5805m_dai_ops,
 };
 
-static int reset_tas5805m_GPIO(struct device *dev)
-{
-       struct tas5805m_priv *tas5805m = dev_get_drvdata(dev);
-       struct tas5805m_platform_data *pdata = tas5805m->pdata;
-       int ret = 0;
-
-       if (pdata->reset_pin < 0)
-               return 0;
-
-       ret = devm_gpio_request_one(dev, pdata->reset_pin,
-                                           GPIOF_OUT_INIT_LOW,
-                                           "tas5805m-reset-pin");
-       if (ret < 0)
-               return -1;
-
-       gpio_direction_output(pdata->reset_pin, GPIOF_OUT_INIT_LOW);
-       mdelay(1);
-       gpio_direction_output(pdata->reset_pin, GPIOF_OUT_INIT_HIGH);
-       mdelay(1);
-
-       return 0;
-}
-
 static int tas5805m_parse_dt(
        struct tas5805m_priv *tas5805m,
        struct device_node *np)
@@ -535,34 +1166,6 @@ static int tas5805m_parse_dt(
        return ret;
 }
 
-static int tas5805m_probe(struct device *dev, struct regmap *regmap)
-{
-       int ret;
-
-       reset_tas5805m_GPIO(dev);
-       ret =
-           regmap_register_patch(regmap, tas5805m_init_sequence,
-                                 ARRAY_SIZE(tas5805m_init_sequence));
-       if (ret != 0) {
-               dev_err(dev, "Failed to initialize TAS5805M: %d\n", ret);
-               goto err;
-       }
-
-       ret =
-           snd_soc_register_codec(dev, &soc_codec_tas5805m, &tas5805m_dai, 1);
-       if (ret != 0) {
-               dev_err(dev, "Failed to register CODEC: %d\n", ret);
-               goto err;
-       }
-
-       return 0;
-
-err:
-       return ret;
-
-}
-
-
 static int tas5805m_i2c_probe(struct i2c_client *i2c,
                              const struct i2c_device_id *id)
 {
@@ -570,6 +1173,7 @@ static int tas5805m_i2c_probe(struct i2c_client *i2c,
        struct regmap_config config = tas5805m_regmap;
        struct tas5805m_priv *tas5805m;
        struct tas5805m_platform_data *pdata;
+       int ret = 0;
 
        tas5805m = devm_kzalloc(&i2c->dev,
                sizeof(struct tas5805m_priv), GFP_KERNEL);
@@ -595,19 +1199,20 @@ static int tas5805m_i2c_probe(struct i2c_client *i2c,
 
        dev_set_drvdata(&i2c->dev, tas5805m);
 
-       return tas5805m_probe(&i2c->dev, regmap);
-}
+       ret =
+               snd_soc_register_codec(&i2c->dev, &soc_codec_tas5805m,
+                       &tas5805m_dai, 1);
+       if (ret != 0)
+               return -ENOMEM;
 
-static int tas5805m_remove(struct device *dev)
-{
-       snd_soc_unregister_codec(dev);
+       reset_tas5805m_GPIO(&i2c->dev);
 
-       return 0;
+       return ret;
 }
 
 static int tas5805m_i2c_remove(struct i2c_client *i2c)
 {
-       tas5805m_remove(&i2c->dev);
+       devm_kfree(&i2c->dev, i2c_get_clientdata(i2c));
 
        return 0;
 }
index 5f3fdeb..46a2115 100644 (file)
 #include <linux/regmap.h>
-static const struct reg_sequence tas5805m_init_sequence[] = {
-       {0x00, 0x00},
-       {0x7f, 0x00},
-       {0x03, 0x02},
-       {0x01, 0x11},
-       {0x00, 0x00},
-       {0x00, 0x00},
-       {0x00, 0x00},
-       {0x00, 0x00},
-       {0x29, 0x7c},
-       {0x03, 0x02},
-       {0x00, 0x00},
-       {0x00, 0x00},
-       {0x00, 0x00},
-       {0x00, 0x00},
-       {0x00, 0x00},
-       {0x29, 0x00},
-       {0x00, 0x00},
-       {0x7f, 0x00},
-       {0x46, 0x11},
-       {0x03, 0x0f},
-       {0x00, 0x00},
-       {0x00, 0x00},
-       {0x00, 0x00},
-       {0x00, 0x00},
-       {0x00, 0x00},
-       {0x7f, 0x00},
-       {0x00, 0x00},
-       {0x02, 0x11},//Fsw=384kHz, BD Mode, 1SPW Mode
-       {0x66, 0x85},
-       {0x6b, 0x03},//Enable SS
-       {0x6c, 0x03},//Set Tri-freq to 24Hz, SS range 336~432kHz
-       {0x00, 0x00},
-       {0x7f, 0x8c},
-       {0x00, 0x2a},
-       {0x24, 0x00},
-       {0x25, 0x28},
-       {0x26, 0x7a},
-       {0x27, 0x27},
-       {0x00, 0x00},
-       {0x7f, 0x8c},
-       {0x00, 0x2a},
-       {0x28, 0x00},
-       {0x29, 0x28},
-       {0x2a, 0x7a},
-       {0x2b, 0x27},
-       {0x00, 0x00},
-       {0x7f, 0x8c},
-       {0x00, 0x0b},
-       {0x28, 0x00},
-       {0x29, 0x80},
-       {0x2a, 0x00},
-       {0x2b, 0x00},
-       {0x00, 0x00},
-       {0x7f, 0x8c},
-       {0x00, 0x0b},
-       {0x2c, 0x00},
-       {0x2d, 0x00},
-       {0x2e, 0x00},
-       {0x2f, 0x00},
-       {0x00, 0x00},
-       {0x7f, 0x8c},
-       {0x00, 0x29},
-       {0x18, 0x00},
-       {0x19, 0x80},
-       {0x1a, 0x00},
-       {0x1b, 0x00},
-       {0x00, 0x00},
-       {0x7f, 0x8c},
-       {0x00, 0x29},
-       {0x1c, 0x00},
-       {0x1d, 0x00},
-       {0x1e, 0x00},
-       {0x1f, 0x00},
-       {0x00, 0x00},
-       {0x7f, 0x8c},
-       {0x00, 0x29},
-       {0x20, 0x00},
-       {0x21, 0x00},
-       {0x22, 0x00},
-       {0x23, 0x00},
-       {0x00, 0x00},
-       {0x7f, 0x8c},
-       {0x00, 0x29},
-       {0x24, 0x00},
-       {0x25, 0x80},
-       {0x26, 0x00},
-       {0x27, 0x00},
-       {0x00, 0x00},
-       {0x7f, 0x8c},
-       {0x00, 0x2a},
-       {0x24, 0x00},
-       {0x25, 0x28},
-       {0x26, 0x7a},
-       {0x27, 0x27},
-       {0x00, 0x00},
-       {0x7f, 0x8c},
-       {0x00, 0x2a},
-       {0x28, 0x00},
-       {0x29, 0x28},
-       {0x2a, 0x7a},
-       {0x2b, 0x27},
-       {0x00, 0x00},
-       {0x7f, 0x8c},
-       {0x00, 0x2a},
-       {0x30, 0x00},
-       {0x31, 0xe2},
-       {0x32, 0xc4},
-       {0x33, 0x6b},
-       {0x00, 0x00},
-       {0x7f, 0x8c},
-       {0x00, 0x2c},
-       {0x0c, 0x00},
-       {0x0d, 0x00},
-       {0x0e, 0x00},
-       {0x0f, 0x00},
-       {0x00, 0x00},
-       {0x7f, 0x8c},
-       {0x00, 0x2c},
-       {0x10, 0x00},
-       {0x11, 0x00},
-       {0x12, 0x00},
-       {0x13, 0x00},
-       {0x00, 0x00},
-       {0x7f, 0x8c},
-       {0x00, 0x2c},
-       {0x14, 0x00},
-       {0x15, 0x80},
-       {0x16, 0x00},
-       {0x17, 0x00},
-       {0x00, 0x00},
-       {0x7f, 0x8c},
-       {0x00, 0x2c},
-       {0x18, 0x00},
-       {0x19, 0x00},
-       {0x1a, 0x00},
-       {0x1b, 0x00},
-       {0x00, 0x00},
-       {0x7f, 0x8c},
-       {0x00, 0x2c},
-       {0x1c, 0x00},
-       {0x1d, 0x80},
-       {0x1e, 0x00},
-       {0x1f, 0x00},
-       {0x00, 0x00},
-       {0x7f, 0x8c},
-       {0x00, 0x2c},
-       {0x20, 0x00},
-       {0x21, 0x00},
-       {0x22, 0x00},
-       {0x23, 0x00},
-       {0x00, 0x00},
-       {0x7f, 0x8c},
-       {0x00, 0x2c},
-       {0x28, 0x00},
-       {0x29, 0x00},
-       {0x2a, 0x00},
-       {0x2b, 0x00},
-       {0x00, 0x00},
-       {0x7f, 0x8c},
-       {0x00, 0x2c},
-       {0x2c, 0x00},
-       {0x2d, 0x80},
-       {0x2e, 0x00},
-       {0x2f, 0x00},
-       {0x00, 0x00},
-       {0x7f, 0x8c},
-       {0x00, 0x2c},
-       {0x34, 0x00},
-       {0x35, 0x80},
-       {0x36, 0x00},
-       {0x37, 0x00},
-       {0x00, 0x00},
-       {0x7f, 0x8c},
-       {0x00, 0x2c},
-       {0x38, 0x00},
-       {0x39, 0x00},
-       {0x3a, 0x00},
-       {0x3b, 0x00},
-       {0x00, 0x00},
-       {0x7f, 0x8c},
-       {0x00, 0x2c},
-       {0x48, 0x00},
-       {0x49, 0x00},
-       {0x4a, 0x00},
-       {0x4b, 0x00},
-       {0x00, 0x00},
-       {0x7f, 0x8c},
-       {0x00, 0x2c},
-       {0x4c, 0x00},
-       {0x4d, 0x80},
-       {0x4e, 0x00},
-       {0x4f, 0x00},
-       {0x00, 0x00},
-       {0x7f, 0x8c},
-       {0x00, 0x2c},
-       {0x5c, 0x00},
-       {0x5d, 0x00},
-       {0x5e, 0x57},
-       {0x5f, 0x62},
-       {0x00, 0x00},
-       {0x7f, 0x8c},
-       {0x00, 0x2c},
-       {0x60, 0x00},
-       {0x61, 0x03},
-       {0x62, 0x69},
-       {0x63, 0xd0},
-       {0x00, 0x00},
-       {0x7f, 0x8c},
-       {0x00, 0x2c},
-       {0x64, 0x00},
-       {0x65, 0xce},
-       {0x66, 0xc0},
-       {0x67, 0x8a},
-       {0x00, 0x00},
-       {0x7f, 0x8c},
-       {0x00, 0x2c},
-       {0x68, 0x40},
-       {0x69, 0x00},
-       {0x6a, 0x00},
-       {0x6b, 0x00},
-       {0x00, 0x00},
-       {0x7f, 0x8c},
-       {0x00, 0x2c},
-       {0x6c, 0x05},
-       {0x6d, 0x1f},
-       {0x6e, 0x97},
-       {0x6f, 0x37},
-       {0x00, 0x00},
-       {0x7f, 0x8c},
-       {0x00, 0x2d},
-       {0x18, 0x7a},
-       {0x19, 0xe0},
-       {0x1a, 0x68},
-       {0x1b, 0xc9},
-       {0x00, 0x00},
-       {0x7f, 0x8c},
-       {0x00, 0x2d},
-       {0x1c, 0x00},
-       {0x1d, 0x00},
-       {0x1e, 0xae},
-       {0x1f, 0xc3},
-       {0x00, 0x00},
-       {0x7f, 0x8c},
-       {0x00, 0x2d},
-       {0x20, 0x00},
-       {0x21, 0x00},
-       {0x22, 0x00},
-       {0x23, 0x00},
-       {0x00, 0x00},
-       {0x7f, 0x8c},
-       {0x00, 0x2d},
-       {0x24, 0x00},
-       {0x25, 0x00},
-       {0x26, 0x00},
-       {0x27, 0x00},
-       {0x00, 0x00},
-       {0x7f, 0x8c},
-       {0x00, 0x2d},
-       {0x28, 0x00},
-       {0x29, 0x00},
-       {0x2a, 0x00},
-       {0x2b, 0x00},
-       {0x00, 0x00},
-       {0x7f, 0x8c},
-       {0x00, 0x2d},
-       {0x2c, 0x00},
-       {0x2d, 0x80},
-       {0x2e, 0x00},
-       {0x2f, 0x00},
-       {0x00, 0x00},
-       {0x7f, 0x8c},
-       {0x00, 0x31},
-       {0x48, 0x40},
-       {0x49, 0x00},
-       {0x4a, 0x00},
-       {0x4b, 0x00},
-       {0x4c, 0x00},
-       {0x4d, 0x00},
-       {0x4e, 0x00},
-       {0x4f, 0x00},
-       {0x50, 0x00},
-       {0x51, 0x00},
-       {0x52, 0x00},
-       {0x53, 0x00},
-       {0x54, 0x00},
-       {0x55, 0x00},
-       {0x56, 0x00},
-       {0x57, 0x00},
-       {0x58, 0x00},
-       {0x59, 0x00},
-       {0x5a, 0x00},
-       {0x5b, 0x00},
-       {0x5c, 0x00},
-       {0x5d, 0x00},
-       {0x5e, 0x00},
-       {0x5f, 0x00},
-       {0x60, 0x00},
-       {0x61, 0x00},
-       {0x62, 0x00},
-       {0x63, 0x00},
-       {0x64, 0x00},
-       {0x65, 0x00},
-       {0x66, 0x00},
-       {0x67, 0x00},
-       {0x68, 0x00},
-       {0x69, 0x00},
-       {0x6a, 0x00},
-       {0x6b, 0x00},
-       {0x6c, 0x00},
-       {0x6d, 0x00},
-       {0x6e, 0x00},
-       {0x6f, 0x00},
-       {0x70, 0x00},
-       {0x71, 0x00},
-       {0x72, 0x00},
-       {0x73, 0x00},
-       {0x74, 0x00},
-       {0x75, 0x00},
-       {0x76, 0x00},
-       {0x77, 0x00},
-       {0x78, 0x00},
-       {0x79, 0x00},
-       {0x7a, 0x00},
-       {0x7b, 0x00},
-       {0x7c, 0x00},
-       {0x7d, 0x00},
-       {0x7e, 0x00},
-       {0x7f, 0x00},
-       {0x00, 0x00},
-       {0x7f, 0x8c},
-       {0x00, 0x32},
-       {0x08, 0x00},
-       {0x09, 0x00},
-       {0x0a, 0x00},
-       {0x0b, 0x00},
-       {0x0c, 0x00},
-       {0x0d, 0x00},
-       {0x0e, 0x00},
-       {0x0f, 0x00},
-       {0x10, 0x00},
-       {0x11, 0x00},
-       {0x12, 0x00},
-       {0x13, 0x00},
-       {0x14, 0x00},
-       {0x15, 0x00},
-       {0x16, 0x00},
-       {0x17, 0x00},
-       {0x18, 0x00},
-       {0x19, 0x00},
-       {0x1a, 0x00},
-       {0x1b, 0x00},
-       {0x1c, 0x00},
-       {0x1d, 0x00},
-       {0x1e, 0x00},
-       {0x1f, 0x00},
-       {0x20, 0x00},
-       {0x21, 0x00},
-       {0x22, 0x00},
-       {0x23, 0x00},
-       {0x24, 0x00},
-       {0x25, 0x00},
-       {0x26, 0x00},
-       {0x27, 0x00},
-       {0x28, 0x00},
-       {0x29, 0x00},
-       {0x2a, 0x00},
-       {0x2b, 0x00},
-       {0x2c, 0x00},
-       {0x2d, 0x00},
-       {0x2e, 0x00},
-       {0x2f, 0x00},
-       {0x30, 0x00},
-       {0x31, 0x00},
-       {0x32, 0x00},
-       {0x33, 0x00},
-       {0x34, 0x00},
-       {0x35, 0x00},
-       {0x36, 0x00},
-       {0x37, 0x00},
-       {0x38, 0x00},
-       {0x39, 0x00},
-       {0x3a, 0x00},
-       {0x3b, 0x00},
-       {0x3c, 0x00},
-       {0x3d, 0x00},
-       {0x3e, 0x00},
-       {0x3f, 0x00},
-       {0x40, 0x00},
-       {0x41, 0x00},
-       {0x42, 0x00},
-       {0x43, 0x00},
-       {0x44, 0x00},
-       {0x45, 0x00},
-       {0x46, 0x00},
-       {0x47, 0x00},
-       {0x48, 0x00},
-       {0x49, 0x00},
-       {0x4a, 0x00},
-       {0x4b, 0x00},
-       {0x4c, 0x00},
-       {0x4d, 0x00},
-       {0x4e, 0x00},
-       {0x4f, 0x00},
-       {0x50, 0x00},
-       {0x51, 0x00},
-       {0x52, 0x00},
-       {0x53, 0x00},
-       {0x54, 0x00},
-       {0x55, 0x00},
-       {0x56, 0x00},
-       {0x57, 0x00},
-       {0x58, 0x00},
-       {0x59, 0x00},
-       {0x5a, 0x00},
-       {0x5b, 0x00},
-       {0x5c, 0x00},
-       {0x5d, 0x00},
-       {0x5e, 0x00},
-       {0x5f, 0x00},
-       {0x60, 0x00},
-       {0x61, 0x00},
-       {0x62, 0x00},
-       {0x63, 0x00},
-       {0x64, 0x00},
-       {0x65, 0x00},
-       {0x66, 0x00},
-       {0x67, 0x00},
-       {0x68, 0x00},
-       {0x69, 0x00},
-       {0x6a, 0x00},
-       {0x6b, 0x00},
-       {0x6c, 0x00},
-       {0x6d, 0x00},
-       {0x6e, 0x00},
-       {0x6f, 0x00},
-       {0x70, 0x00},
-       {0x71, 0x00},
-       {0x72, 0x00},
-       {0x73, 0x00},
-       {0x74, 0x00},
-       {0x75, 0x00},
-       {0x76, 0x00},
-       {0x77, 0x00},
-       {0x78, 0x00},
-       {0x79, 0x00},
-       {0x7a, 0x00},
-       {0x7b, 0x00},
-       {0x7c, 0x00},
-       {0x7d, 0x00},
-       {0x7e, 0x00},
-       {0x7f, 0x00},
-       {0x00, 0x00},
-       {0x7f, 0x8c},
-       {0x00, 0x33},
-       {0x08, 0x00},
-       {0x09, 0x00},
-       {0x0a, 0x00},
-       {0x0b, 0x00},
-       {0x0c, 0x00},
-       {0x0d, 0x00},
-       {0x0e, 0x00},
-       {0x0f, 0x00},
-       {0x10, 0x00},
-       {0x11, 0x00},
-       {0x12, 0x00},
-       {0x13, 0x00},
-       {0x14, 0x00},
-       {0x15, 0x00},
-       {0x16, 0x00},
-       {0x17, 0x00},
-       {0x18, 0x00},
-       {0x19, 0x00},
-       {0x1a, 0x00},
-       {0x1b, 0x00},
-       {0x1c, 0x00},
-       {0x1d, 0x00},
-       {0x1e, 0x00},
-       {0x1f, 0x00},
-       {0x20, 0x00},
-       {0x21, 0x00},
-       {0x22, 0x00},
-       {0x23, 0x00},
-       {0x24, 0x00},
-       {0x25, 0x00},
-       {0x26, 0x00},
-       {0x27, 0x00},
-       {0x28, 0x00},
-       {0x29, 0x00},
-       {0x2a, 0x00},
-       {0x2b, 0x00},
-       {0x2c, 0x00},
-       {0x2d, 0x00},
-       {0x2e, 0x00},
-       {0x2f, 0x00},
-       {0x30, 0x00},
-       {0x31, 0x00},
-       {0x32, 0x00},
-       {0x33, 0x00},
-       {0x34, 0x00},
-       {0x35, 0x00},
-       {0x36, 0x00},
-       {0x37, 0x00},
-       {0x38, 0x00},
-       {0x39, 0x00},
-       {0x3a, 0x00},
-       {0x3b, 0x00},
-       {0x3c, 0x00},
-       {0x3d, 0x00},
-       {0x3e, 0x00},
-       {0x3f, 0x00},
-       {0x40, 0x00},
-       {0x41, 0x00},
-       {0x42, 0x00},
-       {0x43, 0x00},
-       {0x44, 0x00},
-       {0x45, 0x00},
-       {0x46, 0x00},
-       {0x47, 0x00},
-       {0x48, 0x00},
-       {0x49, 0x00},
-       {0x4a, 0x00},
-       {0x4b, 0x00},
-       {0x4c, 0x00},
-       {0x4d, 0x00},
-       {0x4e, 0x00},
-       {0x4f, 0x00},
-       {0x50, 0x00},
-       {0x51, 0x00},
-       {0x52, 0x00},
-       {0x53, 0x00},
-       {0x54, 0x00},
-       {0x55, 0x00},
-       {0x56, 0x00},
-       {0x57, 0x00},
-       {0x58, 0x00},
-       {0x59, 0x00},
-       {0x5a, 0x00},
-       {0x5b, 0x00},
-       {0x5c, 0x00},
-       {0x5d, 0x00},
-       {0x5e, 0x00},
-       {0x5f, 0x00},
-       {0x60, 0x00},
-       {0x61, 0x00},
-       {0x62, 0x00},
-       {0x63, 0x00},
-       {0x64, 0x00},
-       {0x65, 0x00},
-       {0x66, 0x00},
-       {0x67, 0x00},
-       {0x68, 0x00},
-       {0x69, 0x00},
-       {0x6a, 0x00},
-       {0x6b, 0x00},
-       {0x6c, 0x00},
-       {0x6d, 0x00},
-       {0x6e, 0x00},
-       {0x6f, 0x00},
-       {0x70, 0x00},
-       {0x71, 0x00},
-       {0x72, 0x00},
-       {0x73, 0x00},
-       {0x74, 0x00},
-       {0x75, 0x00},
-       {0x76, 0x00},
-       {0x77, 0x00},
-       {0x78, 0x00},
-       {0x79, 0x00},
-       {0x7a, 0x00},
-       {0x7b, 0x00},
-       {0x7c, 0x00},
-       {0x7d, 0x00},
-       {0x7e, 0x00},
-       {0x7f, 0x00},
-       {0x00, 0x00},
-       {0x7f, 0x8c},
-       {0x00, 0x34},
-       {0x08, 0x00},
-       {0x09, 0x00},
-       {0x0a, 0x00},
-       {0x0b, 0x00},
-       {0x0c, 0x00},
-       {0x0d, 0x00},
-       {0x0e, 0x00},
-       {0x0f, 0x00},
-       {0x10, 0x00},
-       {0x11, 0x00},
-       {0x12, 0x00},
-       {0x13, 0x00},
-       {0x14, 0x00},
-       {0x15, 0x00},
-       {0x16, 0x00},
-       {0x17, 0x00},
-       {0x18, 0x00},
-       {0x19, 0x00},
-       {0x1a, 0x00},
-       {0x1b, 0x00},
-       {0x1c, 0x00},
-       {0x1d, 0x00},
-       {0x1e, 0x00},
-       {0x1f, 0x00},
-       {0x20, 0x00},
-       {0x21, 0x00},
-       {0x22, 0x00},
-       {0x23, 0x00},
-       {0x24, 0x00},
-       {0x25, 0x00},
-       {0x26, 0x00},
-       {0x27, 0x00},
-       {0x28, 0x00},
-       {0x29, 0x00},
-       {0x2a, 0x00},
-       {0x2b, 0x00},
-       {0x2c, 0x00},
-       {0x2d, 0x00},
-       {0x2e, 0x00},
-       {0x2f, 0x00},
-       {0x30, 0x00},
-       {0x31, 0x00},
-       {0x32, 0x00},
-       {0x33, 0x00},
-       {0x34, 0x00},
-       {0x35, 0x00},
-       {0x36, 0x00},
-       {0x37, 0x00},
-       {0x38, 0x00},
-       {0x39, 0x00},
-       {0x3a, 0x00},
-       {0x3b, 0x00},
-       {0x3c, 0x00},
-       {0x3d, 0x00},
-       {0x3e, 0x00},
-       {0x3f, 0x00},
-       {0x40, 0x00},
-       {0x41, 0x00},
-       {0x42, 0x00},
-       {0x43, 0x00},
-       {0x44, 0x00},
-       {0x45, 0x00},
-       {0x46, 0x00},
-       {0x47, 0x00},
-       {0x48, 0x00},
-       {0x49, 0x00},
-       {0x4a, 0x00},
-       {0x4b, 0x00},
-       {0x4c, 0x00},
-       {0x4d, 0x00},
-       {0x4e, 0x00},
-       {0x4f, 0x00},
-       {0x50, 0x00},
-       {0x51, 0x00},
-       {0x52, 0x00},
-       {0x53, 0x00},
-       {0x54, 0x00},
-       {0x55, 0x00},
-       {0x56, 0x00},
-       {0x57, 0x00},
-       {0x58, 0x00},
-       {0x59, 0x00},
-       {0x5a, 0x00},
-       {0x5b, 0x00},
-       {0x5c, 0x00},
-       {0x5d, 0x00},
-       {0x5e, 0x00},
-       {0x5f, 0x00},
-       {0x60, 0x00},
-       {0x61, 0x00},
-       {0x62, 0x00},
-       {0x63, 0x00},
-       {0x64, 0x00},
-       {0x65, 0x00},
-       {0x66, 0x00},
-       {0x67, 0x00},
-       {0x68, 0x00},
-       {0x69, 0x00},
-       {0x6a, 0x00},
-       {0x6b, 0x00},
-       {0x6c, 0x00},
-       {0x6d, 0x00},
-       {0x6e, 0x00},
-       {0x6f, 0x00},
-       {0x70, 0x00},
-       {0x71, 0x00},
-       {0x72, 0x00},
-       {0x73, 0x00},
-       {0x74, 0x00},
-       {0x75, 0x00},
-       {0x76, 0x00},
-       {0x77, 0x00},
-       {0x78, 0x00},
-       {0x79, 0x00},
-       {0x7a, 0x00},
-       {0x7b, 0x00},
-       {0x7c, 0x00},
-       {0x7d, 0x00},
-       {0x7e, 0x00},
-       {0x7f, 0x00},
-       {0x00, 0x00},
-       {0x7f, 0x8c},
-       {0x00, 0x35},
-       {0x08, 0x00},
-       {0x09, 0x00},
-       {0x0a, 0x00},
-       {0x0b, 0x00},
-       {0x0c, 0x00},
-       {0x0d, 0x00},
-       {0x0e, 0x00},
-       {0x0f, 0x00},
-       {0x10, 0x00},
-       {0x11, 0x00},
-       {0x12, 0x00},
-       {0x13, 0x00},
-       {0x14, 0x00},
-       {0x15, 0x00},
-       {0x16, 0x00},
-       {0x17, 0x00},
-       {0x18, 0x00},
-       {0x19, 0x00},
-       {0x1a, 0x00},
-       {0x1b, 0x00},
-       {0x1c, 0x00},
-       {0x1d, 0x00},
-       {0x1e, 0x00},
-       {0x1f, 0x00},
-       {0x20, 0x00},
-       {0x21, 0x00},
-       {0x22, 0x00},
-       {0x23, 0x00},
-       {0x24, 0x00},
-       {0x25, 0x00},
-       {0x26, 0x00},
-       {0x27, 0x00},
-       {0x28, 0x00},
-       {0x29, 0x00},
-       {0x2a, 0x00},
-       {0x2b, 0x00},
-       {0x2c, 0x00},
-       {0x2d, 0x00},
-       {0x2e, 0x00},
-       {0x2f, 0x00},
-       {0x30, 0x00},
-       {0x31, 0x00},
-       {0x32, 0x00},
-       {0x33, 0x00},
-       {0x34, 0x00},
-       {0x35, 0x00},
-       {0x36, 0x00},
-       {0x37, 0x00},
-       {0x38, 0x00},
-       {0x39, 0x00},
-       {0x3a, 0x00},
-       {0x3b, 0x00},
-       {0x3c, 0x00},
-       {0x3d, 0x00},
-       {0x3e, 0x00},
-       {0x3f, 0x00},
-       {0x40, 0x00},
-       {0x41, 0x00},
-       {0x42, 0x00},
-       {0x43, 0x00},
-       {0x44, 0x00},
-       {0x45, 0x00},
-       {0x46, 0x00},
-       {0x47, 0x00},
-       {0x48, 0x00},
-       {0x49, 0x00},
-       {0x4a, 0x00},
-       {0x4b, 0x00},
-       {0x4c, 0x00},
-       {0x4d, 0x00},
-       {0x4e, 0x00},
-       {0x4f, 0x00},
-       {0x50, 0x00},
-       {0x51, 0x00},
-       {0x52, 0x00},
-       {0x53, 0x00},
-       {0x54, 0x00},
-       {0x55, 0x00},
-       {0x56, 0x00},
-       {0x57, 0x00},
-       {0x58, 0x00},
-       {0x59, 0x00},
-       {0x5a, 0x00},
-       {0x5b, 0x00},
-       {0x5c, 0x00},
-       {0x5d, 0x00},
-       {0x5e, 0x00},
-       {0x5f, 0x00},
-       {0x60, 0x00},
-       {0x61, 0x00},
-       {0x62, 0x00},
-       {0x63, 0x00},
-       {0x64, 0x00},
-       {0x65, 0x00},
-       {0x66, 0x00},
-       {0x67, 0x00},
-       {0x00, 0x00},
-       {0x7f, 0xaa},
-       {0x00, 0x24},
-       {0x18, 0x08},
-       {0x19, 0x00},
-       {0x1a, 0x00},
-       {0x1b, 0x00},
-       {0x1c, 0x00},
-       {0x1d, 0x00},
-       {0x1e, 0x00},
-       {0x1f, 0x00},
-       {0x20, 0x00},
-       {0x21, 0x00},
-       {0x22, 0x00},
-       {0x23, 0x00},
-       {0x24, 0x00},
-       {0x25, 0x00},
-       {0x26, 0x00},
-       {0x27, 0x00},
-       {0x28, 0x00},
-       {0x29, 0x00},
-       {0x2a, 0x00},
-       {0x2b, 0x00},
-       {0x00, 0x00},
-       {0x7f, 0xaa},
-       {0x00, 0x24},
-       {0x2c, 0x08},
-       {0x2d, 0x00},
-       {0x2e, 0x00},
-       {0x2f, 0x00},
-       {0x30, 0x00},
-       {0x31, 0x00},
-       {0x32, 0x00},
-       {0x33, 0x00},
-       {0x34, 0x00},
-       {0x35, 0x00},
-       {0x36, 0x00},
-       {0x37, 0x00},
-       {0x38, 0x00},
-       {0x39, 0x00},
-       {0x3a, 0x00},
-       {0x3b, 0x00},
-       {0x3c, 0x00},
-       {0x3d, 0x00},
-       {0x3e, 0x00},
-       {0x3f, 0x00},
-       {0x00, 0x00},
-       {0x7f, 0xaa},
-       {0x00, 0x24},
-       {0x40, 0x08},
-       {0x41, 0x00},
-       {0x42, 0x00},
-       {0x43, 0x00},
-       {0x44, 0x00},
-       {0x45, 0x00},
-       {0x46, 0x00},
-       {0x47, 0x00},
-       {0x48, 0x00},
-       {0x49, 0x00},
-       {0x4a, 0x00},
-       {0x4b, 0x00},
-       {0x4c, 0x00},
-       {0x4d, 0x00},
-       {0x4e, 0x00},
-       {0x4f, 0x00},
-       {0x50, 0x00},
-       {0x51, 0x00},
-       {0x52, 0x00},
-       {0x53, 0x00},
-       {0x00, 0x00},
-       {0x7f, 0xaa},
-       {0x00, 0x24},
-       {0x54, 0x08},
-       {0x55, 0x00},
-       {0x56, 0x00},
-       {0x57, 0x00},
-       {0x58, 0x00},
-       {0x59, 0x00},
-       {0x5a, 0x00},
-       {0x5b, 0x00},
-       {0x5c, 0x00},
-       {0x5d, 0x00},
-       {0x5e, 0x00},
-       {0x5f, 0x00},
-       {0x60, 0x00},
-       {0x61, 0x00},
-       {0x62, 0x00},
-       {0x63, 0x00},
-       {0x64, 0x00},
-       {0x65, 0x00},
-       {0x66, 0x00},
-       {0x67, 0x00},
-       {0x00, 0x00},
-       {0x7f, 0xaa},
-       {0x00, 0x24},
-       {0x68, 0x08},
-       {0x69, 0x00},
-       {0x6a, 0x00},
-       {0x6b, 0x00},
-       {0x6c, 0x00},
-       {0x6d, 0x00},
-       {0x6e, 0x00},
-       {0x6f, 0x00},
-       {0x70, 0x00},
-       {0x71, 0x00},
-       {0x72, 0x00},
-       {0x73, 0x00},
-       {0x74, 0x00},
-       {0x75, 0x00},
-       {0x76, 0x00},
-       {0x77, 0x00},
-       {0x78, 0x00},
-       {0x79, 0x00},
-       {0x7a, 0x00},
-       {0x7b, 0x00},
-       {0x00, 0x00},
-       {0x7f, 0xaa},
-       {0x00, 0x24},
-       {0x7c, 0x08},
-       {0x7d, 0x00},
-       {0x7e, 0x00},
-       {0x7f, 0x00},
-       {0x00, 0x00},
-       {0x7f, 0xaa},
-       {0x00, 0x25},
-       {0x08, 0x00},
-       {0x09, 0x00},
-       {0x0a, 0x00},
-       {0x0b, 0x00},
-       {0x0c, 0x00},
-       {0x0d, 0x00},
-       {0x0e, 0x00},
-       {0x0f, 0x00},
-       {0x10, 0x00},
-       {0x11, 0x00},
-       {0x12, 0x00},
-       {0x13, 0x00},
-       {0x14, 0x00},
-       {0x15, 0x00},
-       {0x16, 0x00},
-       {0x17, 0x00},
-       {0x00, 0x00},
-       {0x7f, 0xaa},
-       {0x00, 0x25},
-       {0x18, 0x08},
-       {0x19, 0x00},
-       {0x1a, 0x00},
-       {0x1b, 0x00},
-       {0x1c, 0x00},
-       {0x1d, 0x00},
-       {0x1e, 0x00},
-       {0x1f, 0x00},
-       {0x20, 0x00},
-       {0x21, 0x00},
-       {0x22, 0x00},
-       {0x23, 0x00},
-       {0x24, 0x00},
-       {0x25, 0x00},
-       {0x26, 0x00},
-       {0x27, 0x00},
-       {0x28, 0x00},
-       {0x29, 0x00},
-       {0x2a, 0x00},
-       {0x2b, 0x00},
-       {0x00, 0x00},
-       {0x7f, 0xaa},
-       {0x00, 0x25},
-       {0x2c, 0x08},
-       {0x2d, 0x00},
-       {0x2e, 0x00},
-       {0x2f, 0x00},
-       {0x30, 0x00},
-       {0x31, 0x00},
-       {0x32, 0x00},
-       {0x33, 0x00},
-       {0x34, 0x00},
-       {0x35, 0x00},
-       {0x36, 0x00},
-       {0x37, 0x00},
-       {0x38, 0x00},
-       {0x39, 0x00},
-       {0x3a, 0x00},
-       {0x3b, 0x00},
-       {0x3c, 0x00},
-       {0x3d, 0x00},
-       {0x3e, 0x00},
-       {0x3f, 0x00},
-       {0x00, 0x00},
-       {0x7f, 0xaa},
-       {0x00, 0x25},
-       {0x40, 0x08},
-       {0x41, 0x00},
-       {0x42, 0x00},
-       {0x43, 0x00},
-       {0x44, 0x00},
-       {0x45, 0x00},
-       {0x46, 0x00},
-       {0x47, 0x00},
-       {0x48, 0x00},
-       {0x49, 0x00},
-       {0x4a, 0x00},
-       {0x4b, 0x00},
-       {0x4c, 0x00},
-       {0x4d, 0x00},
-       {0x4e, 0x00},
-       {0x4f, 0x00},
-       {0x50, 0x00},
-       {0x51, 0x00},
-       {0x52, 0x00},
-       {0x53, 0x00},
-       {0x00, 0x00},
-       {0x7f, 0xaa},
-       {0x00, 0x25},
-       {0x54, 0x08},
-       {0x55, 0x00},
-       {0x56, 0x00},
-       {0x57, 0x00},
-       {0x58, 0x00},
-       {0x59, 0x00},
-       {0x5a, 0x00},
-       {0x5b, 0x00},
-       {0x5c, 0x00},
-       {0x5d, 0x00},
-       {0x5e, 0x00},
-       {0x5f, 0x00},
-       {0x60, 0x00},
-       {0x61, 0x00},
-       {0x62, 0x00},
-       {0x63, 0x00},
-       {0x64, 0x00},
-       {0x65, 0x00},
-       {0x66, 0x00},
-       {0x67, 0x00},
-       {0x00, 0x00},
-       {0x7f, 0xaa},
-       {0x00, 0x25},
-       {0x68, 0x08},
-       {0x69, 0x00},
-       {0x6a, 0x00},
-       {0x6b, 0x00},
-       {0x6c, 0x00},
-       {0x6d, 0x00},
-       {0x6e, 0x00},
-       {0x6f, 0x00},
-       {0x70, 0x00},
-       {0x71, 0x00},
-       {0x72, 0x00},
-       {0x73, 0x00},
-       {0x74, 0x00},
-       {0x75, 0x00},
-       {0x76, 0x00},
-       {0x77, 0x00},
-       {0x78, 0x00},
-       {0x79, 0x00},
-       {0x7a, 0x00},
-       {0x7b, 0x00},
-       {0x00, 0x00},
-       {0x7f, 0xaa},
-       {0x00, 0x25},
-       {0x7c, 0x08},
-       {0x7d, 0x00},
-       {0x7e, 0x00},
-       {0x7f, 0x00},
-       {0x00, 0x00},
-       {0x7f, 0xaa},
-       {0x00, 0x26},
-       {0x08, 0x00},
-       {0x09, 0x00},
-       {0x0a, 0x00},
-       {0x0b, 0x00},
-       {0x0c, 0x00},
-       {0x0d, 0x00},
-       {0x0e, 0x00},
-       {0x0f, 0x00},
-       {0x10, 0x00},
-       {0x11, 0x00},
-       {0x12, 0x00},
-       {0x13, 0x00},
-       {0x14, 0x00},
-       {0x15, 0x00},
-       {0x16, 0x00},
-       {0x17, 0x00},
-       {0x00, 0x00},
-       {0x7f, 0xaa},
-       {0x00, 0x26},
-       {0x18, 0x08},
-       {0x19, 0x00},
-       {0x1a, 0x00},
-       {0x1b, 0x00},
-       {0x1c, 0x00},
-       {0x1d, 0x00},
-       {0x1e, 0x00},
-       {0x1f, 0x00},
-       {0x20, 0x00},
-       {0x21, 0x00},
-       {0x22, 0x00},
-       {0x23, 0x00},
-       {0x24, 0x00},
-       {0x25, 0x00},
-       {0x26, 0x00},
-       {0x27, 0x00},
-       {0x28, 0x00},
-       {0x29, 0x00},
-       {0x2a, 0x00},
-       {0x2b, 0x00},
-       {0x00, 0x00},
-       {0x7f, 0xaa},
-       {0x00, 0x26},
-       {0x2c, 0x08},
-       {0x2d, 0x00},
-       {0x2e, 0x00},
-       {0x2f, 0x00},
-       {0x30, 0x00},
-       {0x31, 0x00},
-       {0x32, 0x00},
-       {0x33, 0x00},
-       {0x34, 0x00},
-       {0x35, 0x00},
-       {0x36, 0x00},
-       {0x37, 0x00},
-       {0x38, 0x00},
-       {0x39, 0x00},
-       {0x3a, 0x00},
-       {0x3b, 0x00},
-       {0x3c, 0x00},
-       {0x3d, 0x00},
-       {0x3e, 0x00},
-       {0x3f, 0x00},
-       {0x00, 0x00},
-       {0x7f, 0xaa},
-       {0x00, 0x26},
-       {0x40, 0x08},
-       {0x41, 0x00},
-       {0x42, 0x00},
-       {0x43, 0x00},
-       {0x44, 0x00},
-       {0x45, 0x00},
-       {0x46, 0x00},
-       {0x47, 0x00},
-       {0x48, 0x00},
-       {0x49, 0x00},
-       {0x4a, 0x00},
-       {0x4b, 0x00},
-       {0x4c, 0x00},
-       {0x4d, 0x00},
-       {0x4e, 0x00},
-       {0x4f, 0x00},
-       {0x50, 0x00},
-       {0x51, 0x00},
-       {0x52, 0x00},
-       {0x53, 0x00},
-       {0x00, 0x00},
-       {0x7f, 0xaa},
-       {0x00, 0x26},
-       {0x54, 0x08},
-       {0x55, 0x00},
-       {0x56, 0x00},
-       {0x57, 0x00},
-       {0x58, 0x00},
-       {0x59, 0x00},
-       {0x5a, 0x00},
-       {0x5b, 0x00},
-       {0x5c, 0x00},
-       {0x5d, 0x00},
-       {0x5e, 0x00},
-       {0x5f, 0x00},
-       {0x60, 0x00},
-       {0x61, 0x00},
-       {0x62, 0x00},
-       {0x63, 0x00},
-       {0x64, 0x00},
-       {0x65, 0x00},
-       {0x66, 0x00},
-       {0x67, 0x00},
-       {0x00, 0x00},
-       {0x7f, 0xaa},
-       {0x00, 0x26},
-       {0x68, 0x08},
-       {0x69, 0x00},
-       {0x6a, 0x00},
-       {0x6b, 0x00},
-       {0x6c, 0x00},
-       {0x6d, 0x00},
-       {0x6e, 0x00},
-       {0x6f, 0x00},
-       {0x70, 0x00},
-       {0x71, 0x00},
-       {0x72, 0x00},
-       {0x73, 0x00},
-       {0x74, 0x00},
-       {0x75, 0x00},
-       {0x76, 0x00},
-       {0x77, 0x00},
-       {0x78, 0x00},
-       {0x79, 0x00},
-       {0x7a, 0x00},
-       {0x7b, 0x00},
-       {0x00, 0x00},
-       {0x7f, 0xaa},
-       {0x00, 0x26},
-       {0x7c, 0x08},
-       {0x7d, 0x00},
-       {0x7e, 0x00},
-       {0x7f, 0x00},
-       {0x00, 0x00},
-       {0x7f, 0xaa},
-       {0x00, 0x27},
-       {0x08, 0x00},
-       {0x09, 0x00},
-       {0x0a, 0x00},
-       {0x0b, 0x00},
-       {0x0c, 0x00},
-       {0x0d, 0x00},
-       {0x0e, 0x00},
-       {0x0f, 0x00},
-       {0x10, 0x00},
-       {0x11, 0x00},
-       {0x12, 0x00},
-       {0x13, 0x00},
-       {0x14, 0x00},
-       {0x15, 0x00},
-       {0x16, 0x00},
-       {0x17, 0x00},
-       {0x00, 0x00},
-       {0x7f, 0xaa},
-       {0x00, 0x27},
-       {0x18, 0x08},
-       {0x19, 0x00},
-       {0x1a, 0x00},
-       {0x1b, 0x00},
-       {0x1c, 0x00},
-       {0x1d, 0x00},
-       {0x1e, 0x00},
-       {0x1f, 0x00},
-       {0x20, 0x00},
-       {0x21, 0x00},
-       {0x22, 0x00},
-       {0x23, 0x00},
-       {0x24, 0x00},
-       {0x25, 0x00},
-       {0x26, 0x00},
-       {0x27, 0x00},
-       {0x28, 0x00},
-       {0x29, 0x00},
-       {0x2a, 0x00},
-       {0x2b, 0x00},
-       {0x00, 0x00},
-       {0x7f, 0xaa},
-       {0x00, 0x27},
-       {0x2c, 0x08},
-       {0x2d, 0x00},
-       {0x2e, 0x00},
-       {0x2f, 0x00},
-       {0x30, 0x00},
-       {0x31, 0x00},
-       {0x32, 0x00},
-       {0x33, 0x00},
-       {0x34, 0x00},
-       {0x35, 0x00},
-       {0x36, 0x00},
-       {0x37, 0x00},
-       {0x38, 0x00},
-       {0x39, 0x00},
-       {0x3a, 0x00},
-       {0x3b, 0x00},
-       {0x3c, 0x00},
-       {0x3d, 0x00},
-       {0x3e, 0x00},
-       {0x3f, 0x00},
-       {0x00, 0x00},
-       {0x7f, 0xaa},
-       {0x00, 0x27},
-       {0x40, 0x08},
-       {0x41, 0x00},
-       {0x42, 0x00},
-       {0x43, 0x00},
-       {0x44, 0x00},
-       {0x45, 0x00},
-       {0x46, 0x00},
-       {0x47, 0x00},
-       {0x48, 0x00},
-       {0x49, 0x00},
-       {0x4a, 0x00},
-       {0x4b, 0x00},
-       {0x4c, 0x00},
-       {0x4d, 0x00},
-       {0x4e, 0x00},
-       {0x4f, 0x00},
-       {0x50, 0x00},
-       {0x51, 0x00},
-       {0x52, 0x00},
-       {0x53, 0x00},
-       {0x00, 0x00},
-       {0x7f, 0xaa},
-       {0x00, 0x27},
-       {0x54, 0x08},
-       {0x55, 0x00},
-       {0x56, 0x00},
-       {0x57, 0x00},
-       {0x58, 0x00},
-       {0x59, 0x00},
-       {0x5a, 0x00},
-       {0x5b, 0x00},
-       {0x5c, 0x00},
-       {0x5d, 0x00},
-       {0x5e, 0x00},
-       {0x5f, 0x00},
-       {0x60, 0x00},
-       {0x61, 0x00},
-       {0x62, 0x00},
-       {0x63, 0x00},
-       {0x64, 0x00},
-       {0x65, 0x00},
-       {0x66, 0x00},
-       {0x67, 0x00},
-       {0x00, 0x00},
-       {0x7f, 0xaa},
-       {0x00, 0x27},
-       {0x68, 0x08},
-       {0x69, 0x00},
-       {0x6a, 0x00},
-       {0x6b, 0x00},
-       {0x6c, 0x00},
-       {0x6d, 0x00},
-       {0x6e, 0x00},
-       {0x6f, 0x00},
-       {0x70, 0x00},
-       {0x71, 0x00},
-       {0x72, 0x00},
-       {0x73, 0x00},
-       {0x74, 0x00},
-       {0x75, 0x00},
-       {0x76, 0x00},
-       {0x77, 0x00},
-       {0x78, 0x00},
-       {0x79, 0x00},
-       {0x7a, 0x00},
-       {0x7b, 0x00},
-       {0x00, 0x00},
-       {0x7f, 0xaa},
-       {0x00, 0x27},
-       {0x7c, 0x08},
-       {0x7d, 0x00},
-       {0x7e, 0x00},
-       {0x7f, 0x00},
-       {0x00, 0x00},
-       {0x7f, 0xaa},
-       {0x00, 0x28},
-       {0x08, 0x00},
-       {0x09, 0x00},
-       {0x0a, 0x00},
-       {0x0b, 0x00},
-       {0x0c, 0x00},
-       {0x0d, 0x00},
-       {0x0e, 0x00},
-       {0x0f, 0x00},
-       {0x10, 0x00},
-       {0x11, 0x00},
-       {0x12, 0x00},
-       {0x13, 0x00},
-       {0x14, 0x00},
-       {0x15, 0x00},
-       {0x16, 0x00},
-       {0x17, 0x00},
-       {0x00, 0x00},
-       {0x7f, 0xaa},
-       {0x00, 0x28},
-       {0x18, 0x08},
-       {0x19, 0x00},
-       {0x1a, 0x00},
-       {0x1b, 0x00},
-       {0x1c, 0x00},
-       {0x1d, 0x00},
-       {0x1e, 0x00},
-       {0x1f, 0x00},
-       {0x20, 0x00},
-       {0x21, 0x00},
-       {0x22, 0x00},
-       {0x23, 0x00},
-       {0x24, 0x00},
-       {0x25, 0x00},
-       {0x26, 0x00},
-       {0x27, 0x00},
-       {0x28, 0x00},
-       {0x29, 0x00},
-       {0x2a, 0x00},
-       {0x2b, 0x00},
-       {0x00, 0x00},
-       {0x7f, 0xaa},
-       {0x00, 0x28},
-       {0x2c, 0x08},
-       {0x2d, 0x00},
-       {0x2e, 0x00},
-       {0x2f, 0x00},
-       {0x30, 0x00},
-       {0x31, 0x00},
-       {0x32, 0x00},
-       {0x33, 0x00},
-       {0x34, 0x00},
-       {0x35, 0x00},
-       {0x36, 0x00},
-       {0x37, 0x00},
-       {0x38, 0x00},
-       {0x39, 0x00},
-       {0x3a, 0x00},
-       {0x3b, 0x00},
-       {0x3c, 0x00},
-       {0x3d, 0x00},
-       {0x3e, 0x00},
-       {0x3f, 0x00},
-       {0x00, 0x00},
-       {0x7f, 0xaa},
-       {0x00, 0x28},
-       {0x40, 0x08},
-       {0x41, 0x00},
-       {0x42, 0x00},
-       {0x43, 0x00},
-       {0x44, 0x00},
-       {0x45, 0x00},
-       {0x46, 0x00},
-       {0x47, 0x00},
-       {0x48, 0x00},
-       {0x49, 0x00},
-       {0x4a, 0x00},
-       {0x4b, 0x00},
-       {0x4c, 0x00},
-       {0x4d, 0x00},
-       {0x4e, 0x00},
-       {0x4f, 0x00},
-       {0x50, 0x00},
-       {0x51, 0x00},
-       {0x52, 0x00},
-       {0x53, 0x00},
-       {0x00, 0x00},
-       {0x7f, 0xaa},
-       {0x00, 0x28},
-       {0x54, 0x08},
-       {0x55, 0x00},
-       {0x56, 0x00},
-       {0x57, 0x00},
-       {0x58, 0x00},
-       {0x59, 0x00},
-       {0x5a, 0x00},
-       {0x5b, 0x00},
-       {0x5c, 0x00},
-       {0x5d, 0x00},
-       {0x5e, 0x00},
-       {0x5f, 0x00},
-       {0x60, 0x00},
-       {0x61, 0x00},
-       {0x62, 0x00},
-       {0x63, 0x00},
-       {0x64, 0x00},
-       {0x65, 0x00},
-       {0x66, 0x00},
-       {0x67, 0x00},
-       {0x00, 0x00},
-       {0x7f, 0xaa},
-       {0x00, 0x28},
-       {0x68, 0x08},
-       {0x69, 0x00},
-       {0x6a, 0x00},
-       {0x6b, 0x00},
-       {0x6c, 0x00},
-       {0x6d, 0x00},
-       {0x6e, 0x00},
-       {0x6f, 0x00},
-       {0x70, 0x00},
-       {0x71, 0x00},
-       {0x72, 0x00},
-       {0x73, 0x00},
-       {0x74, 0x00},
-       {0x75, 0x00},
-       {0x76, 0x00},
-       {0x77, 0x00},
-       {0x78, 0x00},
-       {0x79, 0x00},
-       {0x7a, 0x00},
-       {0x7b, 0x00},
-       {0x00, 0x00},
-       {0x7f, 0xaa},
-       {0x00, 0x28},
-       {0x7c, 0x08},
-       {0x7d, 0x00},
-       {0x7e, 0x00},
-       {0x7f, 0x00},
-       {0x00, 0x00},
-       {0x7f, 0xaa},
-       {0x00, 0x29},
-       {0x08, 0x00},
-       {0x09, 0x00},
-       {0x0a, 0x00},
-       {0x0b, 0x00},
-       {0x0c, 0x00},
-       {0x0d, 0x00},
-       {0x0e, 0x00},
-       {0x0f, 0x00},
-       {0x10, 0x00},
-       {0x11, 0x00},
-       {0x12, 0x00},
-       {0x13, 0x00},
-       {0x14, 0x00},
-       {0x15, 0x00},
-       {0x16, 0x00},
-       {0x17, 0x00},
-       {0x00, 0x00},
-       {0x7f, 0x8c},
-       {0x00, 0x2e},
-       {0x08, 0x00},
-       {0x09, 0x80},
-       {0x0a, 0x00},
-       {0x0b, 0x00},
-       {0x00, 0x00},
-       {0x7f, 0x8c},
-       {0x00, 0x2e},
-       {0x0c, 0x00},
-       {0x0d, 0x00},
-       {0x0e, 0x00},
-       {0x0f, 0x00},
-       {0x00, 0x00},
-       {0x7f, 0x8c},
-       {0x00, 0x2e},
-       {0x10, 0x00},
-       {0x11, 0x00},
-       {0x12, 0x00},
-       {0x13, 0x00},
-       {0x00, 0x00},
-       {0x7f, 0xaa},
-       {0x00, 0x2a},
-       {0x48, 0x7f},
-       {0x49, 0xff},
-       {0x4a, 0xff},
-       {0x4b, 0xff},
-       {0x4c, 0x00},
-       {0x4d, 0x00},
-       {0x4e, 0x00},
-       {0x4f, 0x00},
-       {0x50, 0x00},
-       {0x51, 0x00},
-       {0x52, 0x00},
-       {0x53, 0x00},
-       {0x54, 0x00},
-       {0x55, 0x00},
-       {0x56, 0x00},
-       {0x57, 0x00},
-       {0x58, 0x00},
-       {0x59, 0x00},
-       {0x5a, 0x00},
-       {0x5b, 0x00},
-       {0x00, 0x00},
-       {0x7f, 0x8c},
-       {0x00, 0x2d},
-       {0x58, 0x00},
-       {0x59, 0x06},
-       {0x5a, 0xd3},
-       {0x5b, 0x72},
-       {0x5c, 0x00},
-       {0x5d, 0x02},
-       {0x5e, 0xbb},
-       {0x5f, 0x06},
-       {0x60, 0x00},
-       {0x61, 0x03},
-       {0x62, 0x69},
-       {0x63, 0xc5},
-       {0x64, 0x00},
-       {0x65, 0x00},
-       {0x66, 0x00},
-       {0x67, 0x00},
-       {0x68, 0x00},
-       {0x69, 0x00},
-       {0x6a, 0x00},
-       {0x6b, 0x00},
-       {0x6c, 0x00},
-       {0x6d, 0x00},
-       {0x6e, 0x00},
-       {0x6f, 0x00},
-       {0x70, 0xf9},
-       {0x71, 0xda},
-       {0x72, 0xbc},
-       {0x73, 0x21},
-       {0x74, 0xfc},
-       {0x75, 0x58},
-       {0x76, 0x8b},
-       {0x77, 0x89},
-       {0x78, 0x00},
-       {0x79, 0x00},
-       {0x7a, 0x00},
-       {0x7b, 0x00},
-       {0x7c, 0x00},
-       {0x7d, 0x00},
-       {0x7e, 0x00},
-       {0x7f, 0x00},
-       {0x00, 0x00},
-       {0x7f, 0x8c},
-       {0x00, 0x2b},
-       {0x34, 0x00},
-       {0x35, 0x06},
-       {0x36, 0xd3},
-       {0x37, 0x72},
-       {0x38, 0x00},
-       {0x39, 0x02},
-       {0x3a, 0xbb},
-       {0x3b, 0x06},
-       {0x3c, 0x00},
-       {0x3d, 0x03},
-       {0x3e, 0x69},
-       {0x3f, 0xc5},
-       {0x40, 0x00},
-       {0x41, 0x00},
-       {0x42, 0x00},
-       {0x43, 0x00},
-       {0x44, 0x00},
-       {0x45, 0x00},
-       {0x46, 0x00},
-       {0x47, 0x00},
-       {0x48, 0x00},
-       {0x49, 0x00},
-       {0x4a, 0x00},
-       {0x4b, 0x00},
-       {0x4c, 0xf9},
-       {0x4d, 0xda},
-       {0x4e, 0xbc},
-       {0x4f, 0x21},
-       {0x50, 0xfc},
-       {0x51, 0x58},
-       {0x52, 0x8b},
-       {0x53, 0x89},
-       {0x54, 0x00},
-       {0x55, 0x00},
-       {0x56, 0x00},
-       {0x57, 0x00},
-       {0x58, 0x00},
-       {0x59, 0x00},
-       {0x5a, 0x00},
-       {0x5b, 0x00},
-       {0x00, 0x00},
-       {0x7f, 0xaa},
-       {0x00, 0x2a},
-       {0x34, 0x7f},
-       {0x35, 0xff},
-       {0x36, 0xff},
-       {0x37, 0xff},
-       {0x38, 0x00},
-       {0x39, 0x00},
-       {0x3a, 0x00},
-       {0x3b, 0x00},
-       {0x3c, 0x00},
-       {0x3d, 0x00},
-       {0x3e, 0x00},
-       {0x3f, 0x00},
-       {0x40, 0x00},
-       {0x41, 0x00},
-       {0x42, 0x00},
-       {0x43, 0x00},
-       {0x44, 0x00},
-       {0x45, 0x00},
-       {0x46, 0x00},
-       {0x47, 0x00},
-       {0x00, 0x00},
-       {0x7f, 0x8c},
-       {0x00, 0x2d},
-       {0x30, 0x00},
-       {0x31, 0x06},
-       {0x32, 0xd3},
-       {0x33, 0x72},
-       {0x34, 0x00},
-       {0x35, 0x02},
-       {0x36, 0xbb},
-       {0x37, 0x06},
-       {0x38, 0x00},
-       {0x39, 0x03},
-       {0x3a, 0x69},
-       {0x3b, 0xc5},
-       {0x3c, 0x00},
-       {0x3d, 0x00},
-       {0x3e, 0x00},
-       {0x3f, 0x00},
-       {0x40, 0x00},
-       {0x41, 0x00},
-       {0x42, 0x00},
-       {0x43, 0x00},
-       {0x44, 0x00},
-       {0x45, 0x00},
-       {0x46, 0x00},
-       {0x47, 0x00},
-       {0x48, 0xf9},
-       {0x49, 0xda},
-       {0x4a, 0xbc},
-       {0x4b, 0x21},
-       {0x4c, 0xfc},
-       {0x4d, 0x58},
-       {0x4e, 0x8b},
-       {0x4f, 0x89},
-       {0x50, 0x00},
-       {0x51, 0x00},
-       {0x52, 0x00},
-       {0x53, 0x00},
-       {0x54, 0x00},
-       {0x55, 0x00},
-       {0x56, 0x00},
-       {0x57, 0x00},
-       {0x00, 0x00},
-       {0x7f, 0xaa},
-       {0x00, 0x2a},
-       {0x5c, 0x7f},
-       {0x5d, 0xff},
-       {0x5e, 0xff},
-       {0x5f, 0xff},
-       {0x60, 0x00},
-       {0x61, 0x00},
-       {0x62, 0x00},
-       {0x63, 0x00},
-       {0x64, 0x00},
-       {0x65, 0x00},
-       {0x66, 0x00},
-       {0x67, 0x00},
-       {0x68, 0x00},
-       {0x69, 0x00},
-       {0x6a, 0x00},
-       {0x6b, 0x00},
-       {0x6c, 0x00},
-       {0x6d, 0x00},
-       {0x6e, 0x00},
-       {0x6f, 0x00},
-       {0x00, 0x00},
-       {0x7f, 0xaa},
-       {0x00, 0x2a},
-       {0x70, 0x7f},
-       {0x71, 0xff},
-       {0x72, 0xff},
-       {0x73, 0xff},
-       {0x74, 0x00},
-       {0x75, 0x00},
-       {0x76, 0x00},
-       {0x77, 0x00},
-       {0x78, 0x00},
-       {0x79, 0x00},
-       {0x7a, 0x00},
-       {0x7b, 0x00},
-       {0x7c, 0x00},
-       {0x7d, 0x00},
-       {0x7e, 0x00},
-       {0x7f, 0x00},
-       {0x00, 0x00},
-       {0x7f, 0xaa},
-       {0x00, 0x2b},
-       {0x08, 0x00},
-       {0x09, 0x00},
-       {0x0a, 0x00},
-       {0x0b, 0x00},
-       {0x00, 0x00},
-       {0x7f, 0xaa},
-       {0x00, 0x2b},
-       {0x0c, 0x7f},
-       {0x0d, 0xff},
-       {0x0e, 0xff},
-       {0x0f, 0xff},
-       {0x10, 0x00},
-       {0x11, 0x00},
-       {0x12, 0x00},
-       {0x13, 0x00},
-       {0x14, 0x00},
-       {0x15, 0x00},
-       {0x16, 0x00},
-       {0x17, 0x00},
-       {0x18, 0x00},
-       {0x19, 0x00},
-       {0x1a, 0x00},
-       {0x1b, 0x00},
-       {0x1c, 0x00},
-       {0x1d, 0x00},
-       {0x1e, 0x00},
-       {0x1f, 0x00},
-       {0x00, 0x00},
-       {0x7f, 0xaa},
-       {0x00, 0x2b},
-       {0x20, 0x7f},
-       {0x21, 0xff},
-       {0x22, 0xff},
-       {0x23, 0xff},
-       {0x24, 0x00},
-       {0x25, 0x00},
-       {0x26, 0x00},
-       {0x27, 0x00},
-       {0x28, 0x00},
-       {0x29, 0x00},
-       {0x2a, 0x00},
-       {0x2b, 0x00},
-       {0x2c, 0x00},
-       {0x2d, 0x00},
-       {0x2e, 0x00},
-       {0x2f, 0x00},
-       {0x30, 0x00},
-       {0x31, 0x00},
-       {0x32, 0x00},
-       {0x33, 0x00},
-       {0x00, 0x00},
-       {0x7f, 0xaa},
-       {0x00, 0x2e},
-       {0x40, 0x7f},
-       {0x41, 0xff},
-       {0x42, 0xff},
-       {0x43, 0xff},
-       {0x44, 0x00},
-       {0x45, 0x00},
-       {0x46, 0x00},
-       {0x47, 0x00},
-       {0x48, 0x00},
-       {0x49, 0x00},
-       {0x4a, 0x00},
-       {0x4b, 0x00},
-       {0x4c, 0x00},
-       {0x4d, 0x00},
-       {0x4e, 0x00},
-       {0x4f, 0x00},
-       {0x50, 0x00},
-       {0x51, 0x00},
-       {0x52, 0x00},
-       {0x53, 0x00},
-       {0x00, 0x00},
-       {0x7f, 0xaa},
-       {0x00, 0x2e},
-       {0x54, 0x7f},
-       {0x55, 0xff},
-       {0x56, 0xff},
-       {0x57, 0xff},
-       {0x58, 0x00},
-       {0x59, 0x00},
-       {0x5a, 0x00},
-       {0x5b, 0x00},
-       {0x5c, 0x00},
-       {0x5d, 0x00},
-       {0x5e, 0x00},
-       {0x5f, 0x00},
-       {0x60, 0x00},
-       {0x61, 0x00},
-       {0x62, 0x00},
-       {0x63, 0x00},
-       {0x64, 0x00},
-       {0x65, 0x00},
-       {0x66, 0x00},
-       {0x67, 0x00},
-       {0x00, 0x00},
-       {0x7f, 0x8c},
-       {0x00, 0x2e},
-       {0x18, 0x00},
-       {0x19, 0x80},
-       {0x1a, 0x00},
-       {0x1b, 0x00},
-       {0x00, 0x00},
-       {0x7f, 0x8c},
-       {0x00, 0x2e},
-       {0x1c, 0x40},
-       {0x1d, 0x00},
-       {0x1e, 0x00},
-       {0x1f, 0x00},
-       {0x00, 0x00},
-       {0x7f, 0x8c},
-       {0x00, 0x2e},
-       {0x20, 0x40},
-       {0x21, 0x00},
-       {0x22, 0x00},
-       {0x23, 0x00},
+//#define TAS5805_REGISTER_COUNT 1879
+
+static const int tas5805m_reset[][2] = {
+//RESET
+       { 0x00, 0x00 },
+       { 0x7f, 0x00 },
+       { 0x03, 0x02 },
+       { 0x01, 0x11 },
+       { 0x00, 0x00 },
+       { 0x00, 0x00 },
+       { 0x00, 0x00 },
+       { 0x00, 0x00 },
+       { 0x00, 0x00 },
+       { 0x7f, 0x00 },
+       { 0x03, 0x02 },
+};
+
+static const int  tas5805m_init_sequence[][2] = {
+       { 0x00, 0x00 },
+       { 0x7f, 0x00 },
+       { 0x03, 0x00 },
+       { 0x00, 0x00 },
+       { 0x7f, 0x00 },
+       { 0x46, 0x11 },
+
+       { 0x00, 0x00 },
+       { 0x7f, 0x00 },
+       { 0x03, 0x02 },
+       { 0x00, 0x00 },
+       { 0x7f, 0x00 },
+       { 0x78, 0x80 },
+
+       { 0x00, 0x00 },
+       { 0x7f, 0x00 },
+       { 0x61, 0x0b },
+       { 0x60, 0x01 },
+
+       { 0x00, 0x00 },
+       { 0x02, 0x11 },//Fsw=384kHz, BD Mode, 1SPW Mode
+       { 0x66, 0x85 },
+       { 0x6b, 0x03 },//Enable SS
+       { 0x6c, 0x03 },//Set Tri-freq to 24Hz, SS range 336~432kHz
+       { 0x3a, 0xf8 },
+       { 0x53, 0x00 },
+       { 0x54, 0x00 },
+       { 0x00, 0x00 },
+       { 0x00, 0x00 },
+       { 0x00, 0x00 },
+       { 0x00, 0x00 },
+
+       { 0x00, 0x00 },
+       { 0x7f, 0x00 },
+       { 0x66, 0x87 },
+       { 0x7f, 0x8c },
+       { 0x00, 0x29 },
+       { 0x18, 0x00 },
+       { 0x19, 0x80 },
+       { 0x1a, 0x00 },
+       { 0x1b, 0x00 },
+       { 0x1c, 0x00 },
+       { 0x1d, 0x00 },
+       { 0x1e, 0x00 },
+       { 0x1f, 0x00 },
+       { 0x20, 0x00 },
+       { 0x21, 0x00 },
+       { 0x22, 0x00 },
+       { 0x23, 0x00 },
+       { 0x24, 0x00 },
+       { 0x25, 0x80 },
+       { 0x26, 0x00 },
+       { 0x27, 0x00 },
+       { 0x00, 0x2a },
+       { 0x24, 0x00 },
+       { 0x25, 0x28 },
+       { 0x26, 0x7a },
+       { 0x27, 0x27 },
+       { 0x28, 0x00 },
+       { 0x29, 0x28 },
+       { 0x2a, 0x7a },
+       { 0x2b, 0x27 },
+       { 0x30, 0x00 },
+       { 0x31, 0xe2 },
+       { 0x32, 0xc4 },
+       { 0x33, 0x6b },
+       { 0x00, 0x2c },
+       { 0x0c, 0x00 },
+       { 0x0d, 0x00 },
+       { 0x0e, 0x00 },
+       { 0x0f, 0x00 },
+       { 0x10, 0x00 },
+       { 0x11, 0x00 },
+       { 0x12, 0x00 },
+       { 0x13, 0x00 },
+       { 0x14, 0x00 },
+       { 0x15, 0x80 },
+       { 0x16, 0x00 },
+       { 0x17, 0x00 },
+       { 0x18, 0x00 },
+       { 0x19, 0x00 },
+       { 0x1a, 0x00 },
+       { 0x1b, 0x00 },
+       { 0x1c, 0x00 },
+       { 0x1d, 0x80 },
+       { 0x1e, 0x00 },
+       { 0x1f, 0x00 },
+       { 0x20, 0x00 },
+       { 0x21, 0x00 },
+       { 0x22, 0x00 },
+       { 0x23, 0x00 },
+       { 0x28, 0x00 },
+       { 0x29, 0x00 },
+       { 0x2a, 0x00 },
+       { 0x2b, 0x00 },
+       { 0x2c, 0x00 },
+       { 0x2d, 0x80 },
+       { 0x2e, 0x00 },
+       { 0x2f, 0x00 },
+       { 0x34, 0x00 },
+       { 0x35, 0x80 },
+       { 0x36, 0x00 },
+       { 0x37, 0x00 },
+       { 0x38, 0x00 },
+       { 0x39, 0x00 },
+       { 0x3a, 0x00 },
+       { 0x3b, 0x00 },
+       { 0x48, 0x00 },
+       { 0x49, 0x00 },
+       { 0x4a, 0x00 },
+       { 0x4b, 0x00 },
+       { 0x4c, 0x00 },
+       { 0x4d, 0x80 },
+       { 0x4e, 0x00 },
+       { 0x4f, 0x00 },
+       { 0x5c, 0x00 },
+       { 0x5d, 0x00 },
+       { 0x5e, 0xae },
+       { 0x5f, 0xc3 },
+       { 0x60, 0x01 },
+       { 0x61, 0x12 },
+       { 0x62, 0x6e },
+       { 0x63, 0x98 },
+       { 0x64, 0x08 },
+       { 0x65, 0x13 },
+       { 0x66, 0x85 },
+       { 0x67, 0x62 },
+       { 0x68, 0x40 },
+       { 0x69, 0x00 },
+       { 0x6a, 0x00 },
+       { 0x6b, 0x00 },
+       { 0x6c, 0x04 },
+       { 0x6d, 0xc1 },
+       { 0x6e, 0xff },
+       { 0x6f, 0x93 },
+       { 0x00, 0x2d },
+       { 0x18, 0x7b },
+       { 0x19, 0x3e },
+       { 0x1a, 0x00 },
+       { 0x1b, 0x6d },
+       { 0x1c, 0x00 },
+       { 0x1d, 0x00 },
+       { 0x1e, 0xae },
+       { 0x1f, 0xc3 },
+       { 0x20, 0x00 },
+       { 0x21, 0x00 },
+       { 0x22, 0x00 },
+       { 0x23, 0x00 },
+       { 0x24, 0x00 },
+       { 0x25, 0x00 },
+       { 0x26, 0x00 },
+       { 0x27, 0x00 },
+       { 0x28, 0x00 },
+       { 0x29, 0x00 },
+       { 0x2a, 0x00 },
+       { 0x2b, 0x00 },
+       { 0x2c, 0x00 },
+       { 0x2d, 0x80 },
+       { 0x2e, 0x00 },
+       { 0x2f, 0x00 },
+       { 0x00, 0x00 },
+       { 0x7f, 0xaa },
+       { 0x00, 0x24 },
+       { 0x18, 0x08 },
+       { 0x19, 0x00 },
+       { 0x1a, 0x00 },
+       { 0x1b, 0x00 },
+       { 0x1c, 0x00 },
+       { 0x1d, 0x00 },
+       { 0x1e, 0x00 },
+       { 0x1f, 0x00 },
+       { 0x20, 0x00 },
+       { 0x21, 0x00 },
+       { 0x22, 0x00 },
+       { 0x23, 0x00 },
+       { 0x24, 0x00 },
+       { 0x25, 0x00 },
+       { 0x26, 0x00 },
+       { 0x27, 0x00 },
+       { 0x28, 0x00 },
+       { 0x29, 0x00 },
+       { 0x2a, 0x00 },
+       { 0x2b, 0x00 },
+       { 0x2c, 0x08 },
+       { 0x2d, 0x00 },
+       { 0x2e, 0x00 },
+       { 0x2f, 0x00 },
+       { 0x30, 0x00 },
+       { 0x31, 0x00 },
+       { 0x32, 0x00 },
+       { 0x33, 0x00 },
+       { 0x34, 0x00 },
+       { 0x35, 0x00 },
+       { 0x36, 0x00 },
+       { 0x37, 0x00 },
+       { 0x38, 0x00 },
+       { 0x39, 0x00 },
+       { 0x3a, 0x00 },
+       { 0x3b, 0x00 },
+       { 0x3c, 0x00 },
+       { 0x3d, 0x00 },
+       { 0x3e, 0x00 },
+       { 0x3f, 0x00 },
+       { 0x40, 0x08 },
+       { 0x41, 0x00 },
+       { 0x42, 0x00 },
+       { 0x43, 0x00 },
+       { 0x44, 0x00 },
+       { 0x45, 0x00 },
+       { 0x46, 0x00 },
+       { 0x47, 0x00 },
+       { 0x48, 0x00 },
+       { 0x49, 0x00 },
+       { 0x4a, 0x00 },
+       { 0x4b, 0x00 },
+       { 0x4c, 0x00 },
+       { 0x4d, 0x00 },
+       { 0x4e, 0x00 },
+       { 0x4f, 0x00 },
+       { 0x50, 0x00 },
+       { 0x51, 0x00 },
+       { 0x52, 0x00 },
+       { 0x53, 0x00 },
+       { 0x54, 0x08 },
+       { 0x55, 0x00 },
+       { 0x56, 0x00 },
+       { 0x57, 0x00 },
+       { 0x58, 0x00 },
+       { 0x59, 0x00 },
+       { 0x5a, 0x00 },
+       { 0x5b, 0x00 },
+       { 0x5c, 0x00 },
+       { 0x5d, 0x00 },
+       { 0x5e, 0x00 },
+       { 0x5f, 0x00 },
+       { 0x60, 0x00 },
+       { 0x61, 0x00 },
+       { 0x62, 0x00 },
+       { 0x63, 0x00 },
+       { 0x64, 0x00 },
+       { 0x65, 0x00 },
+       { 0x66, 0x00 },
+       { 0x67, 0x00 },
+       { 0x68, 0x08 },
+       { 0x69, 0x00 },
+       { 0x6a, 0x00 },
+       { 0x6b, 0x00 },
+       { 0x6c, 0x00 },
+       { 0x6d, 0x00 },
+       { 0x6e, 0x00 },
+       { 0x6f, 0x00 },
+       { 0x70, 0x00 },
+       { 0x71, 0x00 },
+       { 0x72, 0x00 },
+       { 0x73, 0x00 },
+       { 0x74, 0x00 },
+       { 0x75, 0x00 },
+       { 0x76, 0x00 },
+       { 0x77, 0x00 },
+       { 0x78, 0x00 },
+       { 0x79, 0x00 },
+       { 0x7a, 0x00 },
+       { 0x7b, 0x00 },
+       { 0x7c, 0x08 },
+       { 0x7d, 0x00 },
+       { 0x7e, 0x00 },
+       { 0x7f, 0x00 },
+       { 0x00, 0x25 },
+       { 0x08, 0x00 },
+       { 0x09, 0x00 },
+       { 0x0a, 0x00 },
+       { 0x0b, 0x00 },
+       { 0x0c, 0x00 },
+       { 0x0d, 0x00 },
+       { 0x0e, 0x00 },
+       { 0x0f, 0x00 },
+       { 0x10, 0x00 },
+       { 0x11, 0x00 },
+       { 0x12, 0x00 },
+       { 0x13, 0x00 },
+       { 0x14, 0x00 },
+       { 0x15, 0x00 },
+       { 0x16, 0x00 },
+       { 0x17, 0x00 },
+       { 0x18, 0x08 },
+       { 0x19, 0x00 },
+       { 0x1a, 0x00 },
+       { 0x1b, 0x00 },
+       { 0x1c, 0x00 },
+       { 0x1d, 0x00 },
+       { 0x1e, 0x00 },
+       { 0x1f, 0x00 },
+       { 0x20, 0x00 },
+       { 0x21, 0x00 },
+       { 0x22, 0x00 },
+       { 0x23, 0x00 },
+       { 0x24, 0x00 },
+       { 0x25, 0x00 },
+       { 0x26, 0x00 },
+       { 0x27, 0x00 },
+       { 0x28, 0x00 },
+       { 0x29, 0x00 },
+       { 0x2a, 0x00 },
+       { 0x2b, 0x00 },
+       { 0x2c, 0x08 },
+       { 0x2d, 0x00 },
+       { 0x2e, 0x00 },
+       { 0x2f, 0x00 },
+       { 0x30, 0x00 },
+       { 0x31, 0x00 },
+       { 0x32, 0x00 },
+       { 0x33, 0x00 },
+       { 0x34, 0x00 },
+       { 0x35, 0x00 },
+       { 0x36, 0x00 },
+       { 0x37, 0x00 },
+       { 0x38, 0x00 },
+       { 0x39, 0x00 },
+       { 0x3a, 0x00 },
+       { 0x3b, 0x00 },
+       { 0x3c, 0x00 },
+       { 0x3d, 0x00 },
+       { 0x3e, 0x00 },
+       { 0x3f, 0x00 },
+       { 0x40, 0x08 },
+       { 0x41, 0x00 },
+       { 0x42, 0x00 },
+       { 0x43, 0x00 },
+       { 0x44, 0x00 },
+       { 0x45, 0x00 },
+       { 0x46, 0x00 },
+       { 0x47, 0x00 },
+       { 0x48, 0x00 },
+       { 0x49, 0x00 },
+       { 0x4a, 0x00 },
+       { 0x4b, 0x00 },
+       { 0x4c, 0x00 },
+       { 0x4d, 0x00 },
+       { 0x4e, 0x00 },
+       { 0x4f, 0x00 },
+       { 0x50, 0x00 },
+       { 0x51, 0x00 },
+       { 0x52, 0x00 },
+       { 0x53, 0x00 },
+       { 0x54, 0x08 },
+       { 0x55, 0x00 },
+       { 0x56, 0x00 },
+       { 0x57, 0x00 },
+       { 0x58, 0x00 },
+       { 0x59, 0x00 },
+       { 0x5a, 0x00 },
+       { 0x5b, 0x00 },
+       { 0x5c, 0x00 },
+       { 0x5d, 0x00 },
+       { 0x5e, 0x00 },
+       { 0x5f, 0x00 },
+       { 0x60, 0x00 },
+       { 0x61, 0x00 },
+       { 0x62, 0x00 },
+       { 0x63, 0x00 },
+       { 0x64, 0x00 },
+       { 0x65, 0x00 },
+       { 0x66, 0x00 },
+       { 0x67, 0x00 },
+       { 0x68, 0x08 },
+       { 0x69, 0x00 },
+       { 0x6a, 0x00 },
+       { 0x6b, 0x00 },
+       { 0x6c, 0x00 },
+       { 0x6d, 0x00 },
+       { 0x6e, 0x00 },
+       { 0x6f, 0x00 },
+       { 0x70, 0x00 },
+       { 0x71, 0x00 },
+       { 0x72, 0x00 },
+       { 0x73, 0x00 },
+       { 0x74, 0x00 },
+       { 0x75, 0x00 },
+       { 0x76, 0x00 },
+       { 0x77, 0x00 },
+       { 0x78, 0x00 },
+       { 0x79, 0x00 },
+       { 0x7a, 0x00 },
+       { 0x7b, 0x00 },
+       { 0x7c, 0x08 },
+       { 0x7d, 0x00 },
+       { 0x7e, 0x00 },
+       { 0x7f, 0x00 },
+       { 0x00, 0x26 },
+       { 0x08, 0x00 },
+       { 0x09, 0x00 },
+       { 0x0a, 0x00 },
+       { 0x0b, 0x00 },
+       { 0x0c, 0x00 },
+       { 0x0d, 0x00 },
+       { 0x0e, 0x00 },
+       { 0x0f, 0x00 },
+       { 0x10, 0x00 },
+       { 0x11, 0x00 },
+       { 0x12, 0x00 },
+       { 0x13, 0x00 },
+       { 0x14, 0x00 },
+       { 0x15, 0x00 },
+       { 0x16, 0x00 },
+       { 0x17, 0x00 },
+       { 0x18, 0x08 },
+       { 0x19, 0x00 },
+       { 0x1a, 0x00 },
+       { 0x1b, 0x00 },
+       { 0x1c, 0x00 },
+       { 0x1d, 0x00 },
+       { 0x1e, 0x00 },
+       { 0x1f, 0x00 },
+       { 0x20, 0x00 },
+       { 0x21, 0x00 },
+       { 0x22, 0x00 },
+       { 0x23, 0x00 },
+       { 0x24, 0x00 },
+       { 0x25, 0x00 },
+       { 0x26, 0x00 },
+       { 0x27, 0x00 },
+       { 0x28, 0x00 },
+       { 0x29, 0x00 },
+       { 0x2a, 0x00 },
+       { 0x2b, 0x00 },
+       { 0x2c, 0x08 },
+       { 0x2d, 0x00 },
+       { 0x2e, 0x00 },
+       { 0x2f, 0x00 },
+       { 0x30, 0x00 },
+       { 0x31, 0x00 },
+       { 0x32, 0x00 },
+       { 0x33, 0x00 },
+       { 0x34, 0x00 },
+       { 0x35, 0x00 },
+       { 0x36, 0x00 },
+       { 0x37, 0x00 },
+       { 0x38, 0x00 },
+       { 0x39, 0x00 },
+       { 0x3a, 0x00 },
+       { 0x3b, 0x00 },
+       { 0x3c, 0x00 },
+       { 0x3d, 0x00 },
+       { 0x3e, 0x00 },
+       { 0x3f, 0x00 },
+       { 0x40, 0x08 },
+       { 0x41, 0x00 },
+       { 0x42, 0x00 },
+       { 0x43, 0x00 },
+       { 0x44, 0x00 },
+       { 0x45, 0x00 },
+       { 0x46, 0x00 },
+       { 0x47, 0x00 },
+       { 0x48, 0x00 },
+       { 0x49, 0x00 },
+       { 0x4a, 0x00 },
+       { 0x4b, 0x00 },
+       { 0x4c, 0x00 },
+       { 0x4d, 0x00 },
+       { 0x4e, 0x00 },
+       { 0x4f, 0x00 },
+       { 0x50, 0x00 },
+       { 0x51, 0x00 },
+       { 0x52, 0x00 },
+       { 0x53, 0x00 },
+       { 0x54, 0x08 },
+       { 0x55, 0x00 },
+       { 0x56, 0x00 },
+       { 0x57, 0x00 },
+       { 0x58, 0x00 },
+       { 0x59, 0x00 },
+       { 0x5a, 0x00 },
+       { 0x5b, 0x00 },
+       { 0x5c, 0x00 },
+       { 0x5d, 0x00 },
+       { 0x5e, 0x00 },
+       { 0x5f, 0x00 },
+       { 0x60, 0x00 },
+       { 0x61, 0x00 },
+       { 0x62, 0x00 },
+       { 0x63, 0x00 },
+       { 0x64, 0x00 },
+       { 0x65, 0x00 },
+       { 0x66, 0x00 },
+       { 0x67, 0x00 },
+       { 0x68, 0x08 },
+       { 0x69, 0x00 },
+       { 0x6a, 0x00 },
+       { 0x6b, 0x00 },
+       { 0x6c, 0x00 },
+       { 0x6d, 0x00 },
+       { 0x6e, 0x00 },
+       { 0x6f, 0x00 },
+       { 0x70, 0x00 },
+       { 0x71, 0x00 },
+       { 0x72, 0x00 },
+       { 0x73, 0x00 },
+       { 0x74, 0x00 },
+       { 0x75, 0x00 },
+       { 0x76, 0x00 },
+       { 0x77, 0x00 },
+       { 0x78, 0x00 },
+       { 0x79, 0x00 },
+       { 0x7a, 0x00 },
+       { 0x7b, 0x00 },
+       { 0x7c, 0x08 },
+       { 0x7d, 0x00 },
+       { 0x7e, 0x00 },
+       { 0x7f, 0x00 },
+       { 0x00, 0x27 },
+       { 0x08, 0x00 },
+       { 0x09, 0x00 },
+       { 0x0a, 0x00 },
+       { 0x0b, 0x00 },
+       { 0x0c, 0x00 },
+       { 0x0d, 0x00 },
+       { 0x0e, 0x00 },
+       { 0x0f, 0x00 },
+       { 0x10, 0x00 },
+       { 0x11, 0x00 },
+       { 0x12, 0x00 },
+       { 0x13, 0x00 },
+       { 0x14, 0x00 },
+       { 0x15, 0x00 },
+       { 0x16, 0x00 },
+       { 0x17, 0x00 },
+       { 0x18, 0x08 },
+       { 0x19, 0x00 },
+       { 0x1a, 0x00 },
+       { 0x1b, 0x00 },
+       { 0x1c, 0x00 },
+       { 0x1d, 0x00 },
+       { 0x1e, 0x00 },
+       { 0x1f, 0x00 },
+       { 0x20, 0x00 },
+       { 0x21, 0x00 },
+       { 0x22, 0x00 },
+       { 0x23, 0x00 },
+       { 0x24, 0x00 },
+       { 0x25, 0x00 },
+       { 0x26, 0x00 },
+       { 0x27, 0x00 },
+       { 0x28, 0x00 },
+       { 0x29, 0x00 },
+       { 0x2a, 0x00 },
+       { 0x2b, 0x00 },
+       { 0x2c, 0x08 },
+       { 0x2d, 0x00 },
+       { 0x2e, 0x00 },
+       { 0x2f, 0x00 },
+       { 0x30, 0x00 },
+       { 0x31, 0x00 },
+       { 0x32, 0x00 },
+       { 0x33, 0x00 },
+       { 0x34, 0x00 },
+       { 0x35, 0x00 },
+       { 0x36, 0x00 },
+       { 0x37, 0x00 },
+       { 0x38, 0x00 },
+       { 0x39, 0x00 },
+       { 0x3a, 0x00 },
+       { 0x3b, 0x00 },
+       { 0x3c, 0x00 },
+       { 0x3d, 0x00 },
+       { 0x3e, 0x00 },
+       { 0x3f, 0x00 },
+       { 0x40, 0x08 },
+       { 0x41, 0x00 },
+       { 0x42, 0x00 },
+       { 0x43, 0x00 },
+       { 0x44, 0x00 },
+       { 0x45, 0x00 },
+       { 0x46, 0x00 },
+       { 0x47, 0x00 },
+       { 0x48, 0x00 },
+       { 0x49, 0x00 },
+       { 0x4a, 0x00 },
+       { 0x4b, 0x00 },
+       { 0x4c, 0x00 },
+       { 0x4d, 0x00 },
+       { 0x4e, 0x00 },
+       { 0x4f, 0x00 },
+       { 0x50, 0x00 },
+       { 0x51, 0x00 },
+       { 0x52, 0x00 },
+       { 0x53, 0x00 },
+       { 0x54, 0x08 },
+       { 0x55, 0x00 },
+       { 0x56, 0x00 },
+       { 0x57, 0x00 },
+       { 0x58, 0x00 },
+       { 0x59, 0x00 },
+       { 0x5a, 0x00 },
+       { 0x5b, 0x00 },
+       { 0x5c, 0x00 },
+       { 0x5d, 0x00 },
+       { 0x5e, 0x00 },
+       { 0x5f, 0x00 },
+       { 0x60, 0x00 },
+       { 0x61, 0x00 },
+       { 0x62, 0x00 },
+       { 0x63, 0x00 },
+       { 0x64, 0x00 },
+       { 0x65, 0x00 },
+       { 0x66, 0x00 },
+       { 0x67, 0x00 },
+       { 0x68, 0x08 },
+       { 0x69, 0x00 },
+       { 0x6a, 0x00 },
+       { 0x6b, 0x00 },
+       { 0x6c, 0x00 },
+       { 0x6d, 0x00 },
+       { 0x6e, 0x00 },
+       { 0x6f, 0x00 },
+       { 0x70, 0x00 },
+       { 0x71, 0x00 },
+       { 0x72, 0x00 },
+       { 0x73, 0x00 },
+       { 0x74, 0x00 },
+       { 0x75, 0x00 },
+       { 0x76, 0x00 },
+       { 0x77, 0x00 },
+       { 0x78, 0x00 },
+       { 0x79, 0x00 },
+       { 0x7a, 0x00 },
+       { 0x7b, 0x00 },
+       { 0x7c, 0x08 },
+       { 0x7d, 0x00 },
+       { 0x7e, 0x00 },
+       { 0x7f, 0x00 },
+       { 0x00, 0x28 },
+       { 0x08, 0x00 },
+       { 0x09, 0x00 },
+       { 0x0a, 0x00 },
+       { 0x0b, 0x00 },
+       { 0x0c, 0x00 },
+       { 0x0d, 0x00 },
+       { 0x0e, 0x00 },
+       { 0x0f, 0x00 },
+       { 0x10, 0x00 },
+       { 0x11, 0x00 },
+       { 0x12, 0x00 },
+       { 0x13, 0x00 },
+       { 0x14, 0x00 },
+       { 0x15, 0x00 },
+       { 0x16, 0x00 },
+       { 0x17, 0x00 },
+       { 0x18, 0x08 },
+       { 0x19, 0x00 },
+       { 0x1a, 0x00 },
+       { 0x1b, 0x00 },
+       { 0x1c, 0x00 },
+       { 0x1d, 0x00 },
+       { 0x1e, 0x00 },
+       { 0x1f, 0x00 },
+       { 0x20, 0x00 },
+       { 0x21, 0x00 },
+       { 0x22, 0x00 },
+       { 0x23, 0x00 },
+       { 0x24, 0x00 },
+       { 0x25, 0x00 },
+       { 0x26, 0x00 },
+       { 0x27, 0x00 },
+       { 0x28, 0x00 },
+       { 0x29, 0x00 },
+       { 0x2a, 0x00 },
+       { 0x2b, 0x00 },
+       { 0x2c, 0x08 },
+       { 0x2d, 0x00 },
+       { 0x2e, 0x00 },
+       { 0x2f, 0x00 },
+       { 0x30, 0x00 },
+       { 0x31, 0x00 },
+       { 0x32, 0x00 },
+       { 0x33, 0x00 },
+       { 0x34, 0x00 },
+       { 0x35, 0x00 },
+       { 0x36, 0x00 },
+       { 0x37, 0x00 },
+       { 0x38, 0x00 },
+       { 0x39, 0x00 },
+       { 0x3a, 0x00 },
+       { 0x3b, 0x00 },
+       { 0x3c, 0x00 },
+       { 0x3d, 0x00 },
+       { 0x3e, 0x00 },
+       { 0x3f, 0x00 },
+       { 0x40, 0x08 },
+       { 0x41, 0x00 },
+       { 0x42, 0x00 },
+       { 0x43, 0x00 },
+       { 0x44, 0x00 },
+       { 0x45, 0x00 },
+       { 0x46, 0x00 },
+       { 0x47, 0x00 },
+       { 0x48, 0x00 },
+       { 0x49, 0x00 },
+       { 0x4a, 0x00 },
+       { 0x4b, 0x00 },
+       { 0x4c, 0x00 },
+       { 0x4d, 0x00 },
+       { 0x4e, 0x00 },
+       { 0x4f, 0x00 },
+       { 0x50, 0x00 },
+       { 0x51, 0x00 },
+       { 0x52, 0x00 },
+       { 0x53, 0x00 },
+       { 0x54, 0x08 },
+       { 0x55, 0x00 },
+       { 0x56, 0x00 },
+       { 0x57, 0x00 },
+       { 0x58, 0x00 },
+       { 0x59, 0x00 },
+       { 0x5a, 0x00 },
+       { 0x5b, 0x00 },
+       { 0x5c, 0x00 },
+       { 0x5d, 0x00 },
+       { 0x5e, 0x00 },
+       { 0x5f, 0x00 },
+       { 0x60, 0x00 },
+       { 0x61, 0x00 },
+       { 0x62, 0x00 },
+       { 0x63, 0x00 },
+       { 0x64, 0x00 },
+       { 0x65, 0x00 },
+       { 0x66, 0x00 },
+       { 0x67, 0x00 },
+       { 0x68, 0x08 },
+       { 0x69, 0x00 },
+       { 0x6a, 0x00 },
+       { 0x6b, 0x00 },
+       { 0x6c, 0x00 },
+       { 0x6d, 0x00 },
+       { 0x6e, 0x00 },
+       { 0x6f, 0x00 },
+       { 0x70, 0x00 },
+       { 0x71, 0x00 },
+       { 0x72, 0x00 },
+       { 0x73, 0x00 },
+       { 0x74, 0x00 },
+       { 0x75, 0x00 },
+       { 0x76, 0x00 },
+       { 0x77, 0x00 },
+       { 0x78, 0x00 },
+       { 0x79, 0x00 },
+       { 0x7a, 0x00 },
+       { 0x7b, 0x00 },
+       { 0x7c, 0x08 },
+       { 0x7d, 0x00 },
+       { 0x7e, 0x00 },
+       { 0x7f, 0x00 },
+       { 0x00, 0x29 },
+       { 0x08, 0x00 },
+       { 0x09, 0x00 },
+       { 0x0a, 0x00 },
+       { 0x0b, 0x00 },
+       { 0x0c, 0x00 },
+       { 0x0d, 0x00 },
+       { 0x0e, 0x00 },
+       { 0x0f, 0x00 },
+       { 0x10, 0x00 },
+       { 0x11, 0x00 },
+       { 0x12, 0x00 },
+       { 0x13, 0x00 },
+       { 0x14, 0x00 },
+       { 0x15, 0x00 },
+       { 0x16, 0x00 },
+       { 0x17, 0x00 },
+       { 0x00, 0x2e },
+       { 0x7c, 0x08 },
+       { 0x7d, 0x00 },
+       { 0x7e, 0x00 },
+       { 0x7f, 0x00 },
+       { 0x00, 0x2f },
+       { 0x08, 0x00 },
+       { 0x09, 0x00 },
+       { 0x0a, 0x00 },
+       { 0x0b, 0x00 },
+       { 0x0c, 0x00 },
+       { 0x0d, 0x00 },
+       { 0x0e, 0x00 },
+       { 0x0f, 0x00 },
+       { 0x10, 0x00 },
+       { 0x11, 0x00 },
+       { 0x12, 0x00 },
+       { 0x13, 0x00 },
+       { 0x14, 0x00 },
+       { 0x15, 0x00 },
+       { 0x16, 0x00 },
+       { 0x17, 0x00 },
+       { 0x1c, 0x08 },
+       { 0x1d, 0x00 },
+       { 0x1e, 0x00 },
+       { 0x1f, 0x00 },
+       { 0x20, 0x00 },
+       { 0x21, 0x00 },
+       { 0x22, 0x00 },
+       { 0x23, 0x00 },
+       { 0x24, 0x00 },
+       { 0x25, 0x00 },
+       { 0x26, 0x00 },
+       { 0x27, 0x00 },
+       { 0x28, 0x00 },
+       { 0x29, 0x00 },
+       { 0x2a, 0x00 },
+       { 0x2b, 0x00 },
+       { 0x2c, 0x00 },
+       { 0x2d, 0x00 },
+       { 0x2e, 0x00 },
+       { 0x2f, 0x00 },
+       { 0x00, 0x2a },
+       { 0x48, 0x00 },
+       { 0x49, 0x05 },
+       { 0x4a, 0x83 },
+       { 0x4b, 0x2a },
+       { 0x4c, 0x00 },
+       { 0x4d, 0x05 },
+       { 0x4e, 0x83 },
+       { 0x4f, 0x2a },
+       { 0x50, 0x00 },
+       { 0x51, 0x05 },
+       { 0x52, 0x83 },
+       { 0x53, 0x2a },
+       { 0x54, 0x7d },
+       { 0x55, 0xa1 },
+       { 0x56, 0x77 },
+       { 0x57, 0x3d },
+       { 0x58, 0x84 },
+       { 0x59, 0xa7 },
+       { 0x5a, 0x04 },
+       { 0x5b, 0xdf },
+       { 0x00, 0x00 },
+       { 0x7f, 0x8c },
+       { 0x00, 0x2b },
+       { 0x34, 0x00 },
+       { 0x35, 0x1b },
+       { 0x36, 0x4b },
+       { 0x37, 0x98 },
+       { 0x38, 0x00 },
+       { 0x39, 0x1b },
+       { 0x3a, 0x4b },
+       { 0x3b, 0x98 },
+       { 0x3c, 0x00 },
+       { 0x3d, 0x0d },
+       { 0x3e, 0xa6 },
+       { 0x3f, 0x86 },
+       { 0x40, 0x00 },
+       { 0x41, 0x00 },
+       { 0x42, 0x00 },
+       { 0x43, 0x00 },
+       { 0x44, 0x00 },
+       { 0x45, 0x00 },
+       { 0x46, 0x00 },
+       { 0x47, 0x00 },
+       { 0x48, 0xff },
+       { 0x49, 0x81 },
+       { 0x4a, 0x47 },
+       { 0x4b, 0xae },
+       { 0x4c, 0xf9 },
+       { 0x4d, 0x06 },
+       { 0x4e, 0x21 },
+       { 0x4f, 0xa9 },
+       { 0x50, 0xfe },
+       { 0x51, 0x01 },
+       { 0x52, 0xc0 },
+       { 0x53, 0x79 },
+       { 0x54, 0x00 },
+       { 0x55, 0x00 },
+       { 0x56, 0x00 },
+       { 0x57, 0x00 },
+       { 0x58, 0x00 },
+       { 0x59, 0x00 },
+       { 0x5a, 0x00 },
+       { 0x5b, 0x00 },
+       { 0x00, 0x2d },
+       { 0x58, 0x02 },
+       { 0x59, 0xa3 },
+       { 0x5a, 0x9a },
+       { 0x5b, 0xcc },
+       { 0x5c, 0x02 },
+       { 0x5d, 0xa3 },
+       { 0x5e, 0x9a },
+       { 0x5f, 0xcc },
+       { 0x60, 0x00 },
+       { 0x61, 0x44 },
+       { 0x62, 0x32 },
+       { 0x63, 0x13 },
+       { 0x64, 0x00 },
+       { 0x65, 0x00 },
+       { 0x66, 0x00 },
+       { 0x67, 0x00 },
+       { 0x68, 0x00 },
+       { 0x69, 0x00 },
+       { 0x6a, 0x00 },
+       { 0x6b, 0x00 },
+       { 0x6c, 0xff },
+       { 0x6d, 0x81 },
+       { 0x6e, 0x47 },
+       { 0x6f, 0xae },
+       { 0x70, 0xf9 },
+       { 0x71, 0x06 },
+       { 0x72, 0x21 },
+       { 0x73, 0xa9 },
+       { 0x74, 0xfe },
+       { 0x75, 0x01 },
+       { 0x76, 0xc0 },
+       { 0x77, 0x79 },
+       { 0x78, 0x00 },
+       { 0x79, 0x00 },
+       { 0x7a, 0x00 },
+       { 0x7b, 0x00 },
+       { 0x7c, 0x00 },
+       { 0x7d, 0x00 },
+       { 0x7e, 0x00 },
+       { 0x7f, 0x00 },
+       { 0x00, 0x00 },
+       { 0x7f, 0xaa },
+       { 0x00, 0x2e },
+       { 0x40, 0x06 },
+       { 0x41, 0x55 },
+       { 0x42, 0xaf },
+       { 0x43, 0xd8 },
+       { 0x44, 0x06 },
+       { 0x45, 0x55 },
+       { 0x46, 0xaf },
+       { 0x47, 0xd8 },
+       { 0x48, 0x06 },
+       { 0x49, 0x55 },
+       { 0x4a, 0xaf },
+       { 0x4b, 0xd8 },
+       { 0x4c, 0x51 },
+       { 0x4d, 0xe5 },
+       { 0x4e, 0x7f },
+       { 0x4f, 0x65 },
+       { 0x50, 0xc2 },
+       { 0x51, 0xde },
+       { 0x52, 0x41 },
+       { 0x53, 0xd5 },
+       { 0x00, 0x2b },
+       { 0x20, 0x58 },
+       { 0x21, 0x3b },
+       { 0x22, 0x2f },
+       { 0x23, 0x3d },
+       { 0x24, 0xa7 },
+       { 0x25, 0xc4 },
+       { 0x26, 0xd0 },
+       { 0x27, 0xc3 },
+       { 0x28, 0x58 },
+       { 0x29, 0x3b },
+       { 0x2a, 0x2f },
+       { 0x2b, 0x3d },
+       { 0x2c, 0x51 },
+       { 0x2d, 0xe5 },
+       { 0x2e, 0x7f },
+       { 0x2f, 0x65 },
+       { 0x30, 0xc2 },
+       { 0x31, 0xde },
+       { 0x32, 0x41 },
+       { 0x33, 0xd5 },
+       { 0x0c, 0x58 },
+       { 0x0d, 0x3b },
+       { 0x0e, 0x2f },
+       { 0x0f, 0x3d },
+       { 0x10, 0xa7 },
+       { 0x11, 0xc4 },
+       { 0x12, 0xd0 },
+       { 0x13, 0xc3 },
+       { 0x14, 0x58 },
+       { 0x15, 0x3b },
+       { 0x16, 0x2f },
+       { 0x17, 0x3d },
+       { 0x18, 0x51 },
+       { 0x19, 0xe5 },
+       { 0x1a, 0x7f },
+       { 0x1b, 0x65 },
+       { 0x1c, 0xc2 },
+       { 0x1d, 0xde },
+       { 0x1e, 0x41 },
+       { 0x1f, 0xd5 },
+       { 0x00, 0x2a },
+       { 0x34, 0x00 },
+       { 0x35, 0x05 },
+       { 0x36, 0x83 },
+       { 0x37, 0x2a },
+       { 0x38, 0x00 },
+       { 0x39, 0x05 },
+       { 0x3a, 0x83 },
+       { 0x3b, 0x2a },
+       { 0x3c, 0x00 },
+       { 0x3d, 0x05 },
+       { 0x3e, 0x83 },
+       { 0x3f, 0x2a },
+       { 0x40, 0x7d },
+       { 0x41, 0xa1 },
+       { 0x42, 0x77 },
+       { 0x43, 0x3d },
+       { 0x44, 0x84 },
+       { 0x45, 0xa7 },
+       { 0x46, 0x04 },
+       { 0x47, 0xdf },
+       { 0x00, 0x00 },
+       { 0x7f, 0x8c },
+       { 0x00, 0x2d },
+       { 0x30, 0x02 },
+       { 0x31, 0xa3 },
+       { 0x32, 0x9a },
+       { 0x33, 0xcc },
+       { 0x34, 0x02 },
+       { 0x35, 0xa3 },
+       { 0x36, 0x9a },
+       { 0x37, 0xcc },
+       { 0x38, 0x00 },
+       { 0x39, 0x06 },
+       { 0x3a, 0xd3 },
+       { 0x3b, 0x72 },
+       { 0x3c, 0x00 },
+       { 0x3d, 0x00 },
+       { 0x3e, 0x00 },
+       { 0x3f, 0x00 },
+       { 0x40, 0x00 },
+       { 0x41, 0x00 },
+       { 0x42, 0x00 },
+       { 0x43, 0x00 },
+       { 0x44, 0xff },
+       { 0x45, 0x81 },
+       { 0x46, 0x47 },
+       { 0x47, 0xae },
+       { 0x48, 0xf9 },
+       { 0x49, 0x06 },
+       { 0x4a, 0x21 },
+       { 0x4b, 0xa9 },
+       { 0x4c, 0xfe },
+       { 0x4d, 0x01 },
+       { 0x4e, 0xc0 },
+       { 0x4f, 0x79 },
+       { 0x50, 0x00 },
+       { 0x51, 0x00 },
+       { 0x52, 0x00 },
+       { 0x53, 0x00 },
+       { 0x54, 0x00 },
+       { 0x55, 0x00 },
+       { 0x56, 0x00 },
+       { 0x57, 0x00 },
+       { 0x00, 0x00 },
+       { 0x7f, 0xaa },
+       { 0x00, 0x2a },
+       { 0x5c, 0x7d },
+       { 0x5d, 0xa6 },
+       { 0x5e, 0xfa },
+       { 0x5f, 0x66 },
+       { 0x60, 0x82 },
+       { 0x61, 0x59 },
+       { 0x62, 0x05 },
+       { 0x63, 0x9a },
+       { 0x64, 0x7d },
+       { 0x65, 0xa6 },
+       { 0x66, 0xfa },
+       { 0x67, 0x66 },
+       { 0x68, 0x7d },
+       { 0x69, 0xa1 },
+       { 0x6a, 0x77 },
+       { 0x6b, 0x3d },
+       { 0x6c, 0x84 },
+       { 0x6d, 0xa7 },
+       { 0x6e, 0x04 },
+       { 0x6f, 0xdf },
+       { 0x70, 0x7d },
+       { 0x71, 0xa6 },
+       { 0x72, 0xfa },
+       { 0x73, 0x66 },
+       { 0x74, 0x82 },
+       { 0x75, 0x59 },
+       { 0x76, 0x05 },
+       { 0x77, 0x9a },
+       { 0x78, 0x7d },
+       { 0x79, 0xa6 },
+       { 0x7a, 0xfa },
+       { 0x7b, 0x66 },
+       { 0x7c, 0x7d },
+       { 0x7d, 0xa1 },
+       { 0x7e, 0x77 },
+       { 0x7f, 0x3d },
+       { 0x00, 0x2b },
+       { 0x08, 0x84 },
+       { 0x09, 0xa7 },
+       { 0x0a, 0x04 },
+       { 0x0b, 0xdf },
+       { 0x00, 0x2e },
+       { 0x54, 0x06 },
+       { 0x55, 0x55 },
+       { 0x56, 0xaf },
+       { 0x57, 0xd8 },
+       { 0x58, 0x06 },
+       { 0x59, 0x55 },
+       { 0x5a, 0xaf },
+       { 0x5b, 0xd8 },
+       { 0x5c, 0x06 },
+       { 0x5d, 0x55 },
+       { 0x5e, 0xaf },
+       { 0x5f, 0xd8 },
+       { 0x60, 0x51 },
+       { 0x61, 0xe5 },
+       { 0x62, 0x7f },
+       { 0x63, 0x65 },
+       { 0x64, 0xc2 },
+       { 0x65, 0xde },
+       { 0x66, 0x41 },
+       { 0x67, 0xd5 },
+       { 0x00, 0x00 },
+       { 0x7f, 0x8c },
+       { 0x00, 0x2e },
+       { 0x10, 0x00 },
+       { 0x11, 0x80 },
+       { 0x12, 0x00 },
+       { 0x13, 0x00 },
+       { 0x0c, 0x00 },
+       { 0x0d, 0x80 },
+       { 0x0e, 0x00 },
+       { 0x0f, 0x00 },
+       { 0x08, 0x00 },
+       { 0x09, 0x80 },
+       { 0x0a, 0x00 },
+       { 0x0b, 0x00 },
+       { 0x18, 0x00 },
+       { 0x19, 0x80 },
+       { 0x1a, 0x00 },
+       { 0x1b, 0x00 },
+       { 0x1c, 0x40 },
+       { 0x1d, 0x00 },
+       { 0x1e, 0x00 },
+       { 0x1f, 0x00 },
+       { 0x20, 0x40 },
+       { 0x21, 0x00 },
+       { 0x22, 0x00 },
+       { 0x23, 0x00 },
+
 //Register Tuning
-       {0x00, 0x00},
-       {0x7f, 0x00},
-       {0x00, 0x00},
-       {0x30, 0x00},
-       {0x60, 0x00},
-       {0x62, 0x00},
-       {0x00, 0x00},
-       {0x7f, 0x00},
-       {0x00, 0x00},
-       {0x4c, 0x30},
-       {0x4d, 0x30},
-       {0x00, 0x00},
-       {0x7f, 0x00},
-       {0x00, 0x00},
-       {0x02, 0x11},//Fsw=384kHz, 1SPW Mode
-       {0x00, 0x00},
-       {0x7f, 0x00},
-       {0x00, 0x00},
-       {0x03, 0x03},
-       {0x35, 0x11},
+       { 0x00, 0x00 },
+       { 0x7f, 0x00 },
+       { 0x30, 0x00 },
+       { 0x4c, 0x30 },
+       { 0x03, 0x03 },
+       { 0x02, 0x11 },//Fsw=384kHz, 1SPW Mode
+
+       { 0x00, 0x00 },
+       { 0x7f, 0x00 },
+       { 0x78, 0x80 },
 };
 
 struct tas5805m_platform_data {