author | Jianxin Pan <jianxin.pan@amlogic.com> | 2019-09-23 01:38:41 (GMT) |
---|---|---|
committer | Jianxin Pan <jianxin.pan@amlogic.com> | 2019-09-23 01:55:58 (GMT) |
commit | 6301574f55192ab50e8dcc219e793f7efb8158e7 (patch) | |
tree | fde5ed6cac242794224836e75dfb33f04be206e9 | |
parent | 0f03d8f5fe11fae3e96bcd0845d6dbe319021dc6 (diff) | |
parent | 485ae37b252212cf2e734b5b55b7a1ca2e8c402d (diff) | |
download | common-6301574f55192ab50e8dcc219e793f7efb8158e7.zip common-6301574f55192ab50e8dcc219e793f7efb8158e7.tar.gz common-6301574f55192ab50e8dcc219e793f7efb8158e7.tar.bz2 |
Merge branch 'amlogic-4.9-dev' into bringup/amlogic-4.9/sync20190611_forQ
PD#SWPL-14054
Change-Id: Iee246510ea09a641918a7c564dcf17b9a9f33b97
Signed-off-by: Jianxin Pan <jianxin.pan@amlogic.com>
210 files changed, 3581 insertions, 1918 deletions
diff --git a/MAINTAINERS b/MAINTAINERS index 438424e..961d6da 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -13831,6 +13831,7 @@ F: sound/soc/codecs/Makefile F: sound/soc/codecs/amlogic/* F: drivers/amlogic/audiodsp/* + AMLOGIC PPMGR DRIVER M: Guosong Zhou <guosong.zhou@amlogic.com> F: arch/arm64/boot/dts/amlogic/gxl_p212_1g.dts @@ -15175,3 +15176,8 @@ M: shunzhou jiang <shunzhou.jiang@amlogic.com> F: drivers/amlogic/firmware/bl40_module.c F: drivers/amlogic/firmware/Makefile F: drivers/amlogic/firmware/Kconfig + +AMLOGIC VAD WAKEUP POWER +M: Zhiqiang Liang <zhiqiang.liang@amlogic.com> +F: drivers/amlogic/pm/vad_power.c +F: drivers/amlogic/pm/vad_power.h diff --git a/arch/arm/boot/dts/amlogic/atom.dts b/arch/arm/boot/dts/amlogic/atom.dts index ba5bce1..0062db5 100644 --- a/arch/arm/boot/dts/amlogic/atom.dts +++ b/arch/arm/boot/dts/amlogic/atom.dts @@ -245,7 +245,7 @@ reg = <0xff3f0000 0x10000 0xff634540 0x8 0xff634558 0xc - 0xffd01084 0x4>; + 0xffd01008 0x4>; interrupts = <0 8 1 0 9 1>; diff --git a/arch/arm/boot/dts/amlogic/axg_a113d_skt.dts b/arch/arm/boot/dts/amlogic/axg_a113d_skt.dts index ff4f679..3670fcd 100644 --- a/arch/arm/boot/dts/amlogic/axg_a113d_skt.dts +++ b/arch/arm/boot/dts/amlogic/axg_a113d_skt.dts @@ -160,7 +160,9 @@ compatible = "amlogic, gxbb-eth-dwmac"; status = "disable"; reg = <0xff3f0000 0x10000 - 0xff634540 0x8>; + 0xff634540 0x8 + 0xff634558 0xc + 0xffd01008 0x4>; interrupts = <0 8 1>; pinctrl-names = "external_eth_pins"; pinctrl-0 = <&external_eth_pins>; diff --git a/arch/arm/boot/dts/amlogic/axg_s400.dts b/arch/arm/boot/dts/amlogic/axg_s400.dts index 0b304c1..895c378 100644 --- a/arch/arm/boot/dts/amlogic/axg_s400.dts +++ b/arch/arm/boot/dts/amlogic/axg_s400.dts @@ -170,7 +170,9 @@ ethmac: ethernet@0xff3f0000 { compatible = "amlogic, gxbb-eth-dwmac"; reg = <0xff3f0000 0x10000 - 0xff634540 0x8>; + 0xff634540 0x8 + 0xff634558 0xc + 0xffd01008 0x4>; interrupts = <0 8 1>; pinctrl-names = "external_eth_pins"; pinctrl-0 = <&external_eth_pins>; diff --git a/arch/arm/boot/dts/amlogic/axg_s400_v03.dts b/arch/arm/boot/dts/amlogic/axg_s400_v03.dts index 3ac9b55..0395be7 100644 --- a/arch/arm/boot/dts/amlogic/axg_s400_v03.dts +++ b/arch/arm/boot/dts/amlogic/axg_s400_v03.dts @@ -170,7 +170,9 @@ ethmac: ethernet@0xff3f0000 { compatible = "amlogic, gxbb-eth-dwmac"; reg = <0xff3f0000 0x10000 - 0xff634540 0x8>; + 0xff634540 0x8 + 0xff634558 0xc + 0xffd01008 0x4>; interrupts = <0 8 1>; pinctrl-names = "external_eth_pins"; pinctrl-0 = <&external_eth_pins>; diff --git a/arch/arm/boot/dts/amlogic/axg_s400_v03gva.dts b/arch/arm/boot/dts/amlogic/axg_s400_v03gva.dts index 40b0c41..b710d87 100644 --- a/arch/arm/boot/dts/amlogic/axg_s400_v03gva.dts +++ b/arch/arm/boot/dts/amlogic/axg_s400_v03gva.dts @@ -166,7 +166,9 @@ ethmac: ethernet@0xff3f0000 { compatible = "amlogic, gxbb-eth-dwmac"; reg = <0xff3f0000 0x10000 - 0xff634540 0x8>; + 0xff634540 0x8 + 0xff634558 0xc + 0xffd01008 0x4>; interrupts = <0 8 1>; pinctrl-names = "external_eth_pins"; pinctrl-0 = <&external_eth_pins>; diff --git a/arch/arm/boot/dts/amlogic/axg_s400_v03gva_sbr.dts b/arch/arm/boot/dts/amlogic/axg_s400_v03gva_sbr.dts index 5f32dbb..6a75293 100644 --- a/arch/arm/boot/dts/amlogic/axg_s400_v03gva_sbr.dts +++ b/arch/arm/boot/dts/amlogic/axg_s400_v03gva_sbr.dts @@ -166,7 +166,9 @@ ethmac: ethernet@0xff3f0000 { compatible = "amlogic, gxbb-eth-dwmac"; reg = <0xff3f0000 0x10000 - 0xff634540 0x8>; + 0xff634540 0x8 + 0xff634558 0xc + 0xffd01008 0x4>; interrupts = <0 8 1>; pinctrl-names = "external_eth_pins"; pinctrl-0 = <&external_eth_pins>; diff --git a/arch/arm/boot/dts/amlogic/axg_s400_v03sbr.dts b/arch/arm/boot/dts/amlogic/axg_s400_v03sbr.dts index b6a7d48..34dc3d3 100644 --- a/arch/arm/boot/dts/amlogic/axg_s400_v03sbr.dts +++ b/arch/arm/boot/dts/amlogic/axg_s400_v03sbr.dts @@ -170,7 +170,9 @@ ethmac: ethernet@0xff3f0000 { compatible = "amlogic, gxbb-eth-dwmac"; reg = <0xff3f0000 0x10000 - 0xff634540 0x8>; + 0xff634540 0x8 + 0xff634558 0xc + 0xffd01008 0x4>; interrupts = <0 8 1>; pinctrl-names = "external_eth_pins"; pinctrl-0 = <&external_eth_pins>; diff --git a/arch/arm/boot/dts/amlogic/axg_s400emmc_512m.dts b/arch/arm/boot/dts/amlogic/axg_s400emmc_512m.dts index b5f4c1f..d701064 100644 --- a/arch/arm/boot/dts/amlogic/axg_s400emmc_512m.dts +++ b/arch/arm/boot/dts/amlogic/axg_s400emmc_512m.dts @@ -179,7 +179,9 @@ ethmac: ethernet@0xff3f0000 { compatible = "amlogic, gxbb-eth-dwmac"; reg = <0xff3f0000 0x10000 - 0xff634540 0x8>; + 0xff634540 0x8 + 0xff634558 0xc + 0xffd01008 0x4>; interrupts = <0 8 1>; pinctrl-names = "external_eth_pins"; pinctrl-0 = <&external_eth_pins>; diff --git a/arch/arm/boot/dts/amlogic/gxl_p212_1g.dts b/arch/arm/boot/dts/amlogic/gxl_p212_1g.dts index 30be3c8..20b6811 100644 --- a/arch/arm/boot/dts/amlogic/gxl_p212_1g.dts +++ b/arch/arm/boot/dts/amlogic/gxl_p212_1g.dts @@ -411,7 +411,8 @@ compatible = "amlogic, gxbb-eth-dwmac"; reg = <0xc9410000 0x10000 0xc8834540 0x8 - 0xc8834558 0xc>; + 0xc8834558 0xc + 0xc1104408 0x4>; interrupts = <0 8 1>; pinctrl-names = "external_eth_pins"; pinctrl-0 = <&external_eth_pins>; diff --git a/arch/arm/boot/dts/amlogic/gxl_p212_1g_buildroot.dts b/arch/arm/boot/dts/amlogic/gxl_p212_1g_buildroot.dts index 12f0013..693e28b 100644 --- a/arch/arm/boot/dts/amlogic/gxl_p212_1g_buildroot.dts +++ b/arch/arm/boot/dts/amlogic/gxl_p212_1g_buildroot.dts @@ -379,7 +379,8 @@ compatible = "amlogic, gxbb-eth-dwmac"; reg = <0xc9410000 0x10000 0xc8834540 0x8 - 0xc8834558 0xc>; + 0xc8834558 0xc + 0xc1104408 0x4>; interrupts = <0 8 1>; pinctrl-names = "external_eth_pins"; pinctrl-0 = <&external_eth_pins>; diff --git a/arch/arm/boot/dts/amlogic/gxl_p212_1g_hd.dts b/arch/arm/boot/dts/amlogic/gxl_p212_1g_hd.dts index 0ee49ed..5efed17 100644 --- a/arch/arm/boot/dts/amlogic/gxl_p212_1g_hd.dts +++ b/arch/arm/boot/dts/amlogic/gxl_p212_1g_hd.dts @@ -390,7 +390,8 @@ compatible = "amlogic, gxbb-eth-dwmac"; reg = <0xc9410000 0x10000 0xc8834540 0x8 - 0xc8834558 0xc>; + 0xc8834558 0xc + 0xc1104408 0x4>; interrupts = <0 8 1>; pinctrl-names = "external_eth_pins"; pinctrl-0 = <&external_eth_pins>; diff --git a/arch/arm/boot/dts/amlogic/gxl_p212_2g.dts b/arch/arm/boot/dts/amlogic/gxl_p212_2g.dts index 839ef9e..5d0e52d 100644 --- a/arch/arm/boot/dts/amlogic/gxl_p212_2g.dts +++ b/arch/arm/boot/dts/amlogic/gxl_p212_2g.dts @@ -410,7 +410,8 @@ compatible = "amlogic, gxbb-eth-dwmac"; reg = <0xc9410000 0x10000 0xc8834540 0x8 - 0xc8834558 0xc>; + 0xc8834558 0xc + 0xc1104408 0x4>; interrupts = <0 8 1>; pinctrl-names = "external_eth_pins"; pinctrl-0 = <&external_eth_pins>; diff --git a/arch/arm/boot/dts/amlogic/gxl_p212_2g_buildroot.dts b/arch/arm/boot/dts/amlogic/gxl_p212_2g_buildroot.dts index 74ac46c..ad58950 100644 --- a/arch/arm/boot/dts/amlogic/gxl_p212_2g_buildroot.dts +++ b/arch/arm/boot/dts/amlogic/gxl_p212_2g_buildroot.dts @@ -387,7 +387,8 @@ compatible = "amlogic, gxbb-eth-dwmac"; reg = <0xc9410000 0x10000 0xc8834540 0x8 - 0xc8834558 0xc>; + 0xc8834558 0xc + 0xc1104408 0x4>; interrupts = <0 8 1>; pinctrl-names = "external_eth_pins"; pinctrl-0 = <&external_eth_pins>; diff --git a/arch/arm/boot/dts/amlogic/gxl_p230_2g.dts b/arch/arm/boot/dts/amlogic/gxl_p230_2g.dts index fb75ada..8960aee 100644 --- a/arch/arm/boot/dts/amlogic/gxl_p230_2g.dts +++ b/arch/arm/boot/dts/amlogic/gxl_p230_2g.dts @@ -396,7 +396,8 @@ compatible = "amlogic, gxbb-eth-dwmac"; reg = <0xc9410000 0x10000 0xc8834540 0x8 - 0xc8834558 0xc>; + 0xc8834558 0xc + 0xc1104408 0x4>; interrupts = <0 8 1>; pinctrl-names = "external_eth_pins"; pinctrl-0 = <&external_eth_pins>; diff --git a/arch/arm/boot/dts/amlogic/gxl_p230_2g_buildroot.dts b/arch/arm/boot/dts/amlogic/gxl_p230_2g_buildroot.dts index 9418632..4f8d638 100644 --- a/arch/arm/boot/dts/amlogic/gxl_p230_2g_buildroot.dts +++ b/arch/arm/boot/dts/amlogic/gxl_p230_2g_buildroot.dts @@ -393,7 +393,8 @@ compatible = "amlogic, gxbb-eth-dwmac"; reg = <0xc9410000 0x10000 0xc8834540 0x8 - 0xc8834558 0xc>; + 0xc8834558 0xc + 0xc1104408 0x4>; interrupts = <0 8 1>; pinctrl-names = "external_eth_pins"; pinctrl-0 = <&external_eth_pins>; diff --git a/arch/arm/boot/dts/amlogic/gxl_p231_1g.dts b/arch/arm/boot/dts/amlogic/gxl_p231_1g.dts index 1da54da..dc9f070 100644 --- a/arch/arm/boot/dts/amlogic/gxl_p231_1g.dts +++ b/arch/arm/boot/dts/amlogic/gxl_p231_1g.dts @@ -338,7 +338,8 @@ compatible = "amlogic, gxbb-eth-dwmac"; reg = <0xc9410000 0x10000 0xc8834540 0x8 - 0xc8834558 0xc>; + 0xc8834558 0xc + 0xc1104408 0x4>; interrupts = <0 8 1>; pinctrl-names = "external_eth_pins"; pinctrl-0 = <&external_eth_pins>; diff --git a/arch/arm/boot/dts/amlogic/gxl_p231_2g.dts b/arch/arm/boot/dts/amlogic/gxl_p231_2g.dts index ab65fb6..25b0775 100644 --- a/arch/arm/boot/dts/amlogic/gxl_p231_2g.dts +++ b/arch/arm/boot/dts/amlogic/gxl_p231_2g.dts @@ -337,7 +337,8 @@ compatible = "amlogic, gxbb-eth-dwmac"; reg = <0xc9410000 0x10000 0xc8834540 0x8 - 0xc8834558 0xc>; + 0xc8834558 0xc + 0xc1104408 0x4>; interrupts = <0 8 1>; pinctrl-names = "external_eth_pins"; pinctrl-0 = <&external_eth_pins>; diff --git a/arch/arm/boot/dts/amlogic/gxl_p231_2g_buildroot.dts b/arch/arm/boot/dts/amlogic/gxl_p231_2g_buildroot.dts index bcbc10a..99776f3 100644 --- a/arch/arm/boot/dts/amlogic/gxl_p231_2g_buildroot.dts +++ b/arch/arm/boot/dts/amlogic/gxl_p231_2g_buildroot.dts @@ -327,7 +327,8 @@ compatible = "amlogic, gxbb-eth-dwmac"; reg = <0xc9410000 0x10000 0xc8834540 0x8 - 0xc8834558 0xc>; + 0xc8834558 0xc + 0xc1104408 0x4>; interrupts = <0 8 1>; pinctrl-names = "external_eth_pins"; pinctrl-0 = <&external_eth_pins>; diff --git a/arch/arm/boot/dts/amlogic/gxl_p241_1g.dts b/arch/arm/boot/dts/amlogic/gxl_p241_1g.dts index b2be483..7164209 100644 --- a/arch/arm/boot/dts/amlogic/gxl_p241_1g.dts +++ b/arch/arm/boot/dts/amlogic/gxl_p241_1g.dts @@ -474,7 +474,8 @@ compatible = "amlogic, gxbb-eth-dwmac"; reg = <0xc9410000 0x10000 0xc8834540 0x8 - 0xc8834558 0xc>; + 0xc8834558 0xc + 0xc1104408 0x4>; interrupts = <0 8 1>; pinctrl-names = "external_eth_pins"; pinctrl-0 = <&external_eth_pins>; diff --git a/arch/arm/boot/dts/amlogic/gxl_p241_1g_buildroot.dts b/arch/arm/boot/dts/amlogic/gxl_p241_1g_buildroot.dts index c217fe4..fd58d2ea 100644 --- a/arch/arm/boot/dts/amlogic/gxl_p241_1g_buildroot.dts +++ b/arch/arm/boot/dts/amlogic/gxl_p241_1g_buildroot.dts @@ -459,7 +459,8 @@ compatible = "amlogic, gxbb-eth-dwmac"; reg = <0xc9410000 0x10000 0xc8834540 0x8 - 0xc8834558 0xc>; + 0xc8834558 0xc + 0xc1104408 0x4>; interrupts = <0 8 1>; pinctrl-names = "external_eth_pins"; pinctrl-0 = <&external_eth_pins>; diff --git a/arch/arm/boot/dts/amlogic/gxl_p241_v2-1g.dts b/arch/arm/boot/dts/amlogic/gxl_p241_v2-1g.dts index 200bebe..245c1dc 100644 --- a/arch/arm/boot/dts/amlogic/gxl_p241_v2-1g.dts +++ b/arch/arm/boot/dts/amlogic/gxl_p241_v2-1g.dts @@ -474,7 +474,8 @@ compatible = "amlogic, gxbb-eth-dwmac"; reg = <0xc9410000 0x10000 0xc8834540 0x8 - 0xc8834558 0xc>; + 0xc8834558 0xc + 0xc1104408 0x4>; interrupts = <0 8 1>; pinctrl-names = "external_eth_pins"; pinctrl-0 = <&external_eth_pins>; diff --git a/arch/arm/boot/dts/amlogic/gxl_p241_v2_1g_buildroot.dts b/arch/arm/boot/dts/amlogic/gxl_p241_v2_1g_buildroot.dts index 5294a4b..69839698 100644 --- a/arch/arm/boot/dts/amlogic/gxl_p241_v2_1g_buildroot.dts +++ b/arch/arm/boot/dts/amlogic/gxl_p241_v2_1g_buildroot.dts @@ -458,7 +458,8 @@ compatible = "amlogic, gxbb-eth-dwmac"; reg = <0xc9410000 0x10000 0xc8834540 0x8 - 0xc8834558 0xc>; + 0xc8834558 0xc + 0xc1104408 0x4>; interrupts = <0 8 1>; pinctrl-names = "external_eth_pins"; pinctrl-0 = <&external_eth_pins>; diff --git a/arch/arm/boot/dts/amlogic/gxl_p281_1g.dts b/arch/arm/boot/dts/amlogic/gxl_p281_1g.dts index 57ace29..a53d507 100644 --- a/arch/arm/boot/dts/amlogic/gxl_p281_1g.dts +++ b/arch/arm/boot/dts/amlogic/gxl_p281_1g.dts @@ -404,7 +404,8 @@ compatible = "amlogic, gxbb-eth-dwmac"; reg = <0xc9410000 0x10000 0xc8834540 0x8 - 0xc8834558 0xc>; + 0xc8834558 0xc + 0xc1104408 0x4>; interrupts = <0 8 1>; pinctrl-names = "external_eth_pins"; pinctrl-0 = <&external_eth_pins>; diff --git a/arch/arm/boot/dts/amlogic/gxl_p281_2g.dts b/arch/arm/boot/dts/amlogic/gxl_p281_2g.dts index 062b3dd..8b6ed4c 100644 --- a/arch/arm/boot/dts/amlogic/gxl_p281_2g.dts +++ b/arch/arm/boot/dts/amlogic/gxl_p281_2g.dts @@ -410,7 +410,8 @@ compatible = "amlogic, gxbb-eth-dwmac"; reg = <0xc9410000 0x10000 0xc8834540 0x8 - 0xc8834558 0xc>; + 0xc8834558 0xc + 0xc1104408 0x4>; interrupts = <0 8 1>; pinctrl-names = "external_eth_pins"; pinctrl-0 = <&external_eth_pins>; diff --git a/arch/arm/boot/dts/amlogic/gxl_p400_2g.dts b/arch/arm/boot/dts/amlogic/gxl_p400_2g.dts index 7545166..4945d45 100644 --- a/arch/arm/boot/dts/amlogic/gxl_p400_2g.dts +++ b/arch/arm/boot/dts/amlogic/gxl_p400_2g.dts @@ -256,7 +256,8 @@ compatible = "amlogic, gxbb-eth-dwmac"; reg = <0xc9410000 0x10000 0xc8834540 0x8 - 0xc8834558 0xc>; + 0xc8834558 0xc + 0xc1104408 0x4>; interrupts = <0 8 1>; pinctrl-names = "external_eth_pins"; pinctrl-0 = <&external_eth_pins>; diff --git a/arch/arm/boot/dts/amlogic/gxl_p401_2g.dts b/arch/arm/boot/dts/amlogic/gxl_p401_2g.dts index cdb27c8..0e2a52a 100644 --- a/arch/arm/boot/dts/amlogic/gxl_p401_2g.dts +++ b/arch/arm/boot/dts/amlogic/gxl_p401_2g.dts @@ -344,7 +344,8 @@ compatible = "amlogic, gxbb-eth-dwmac"; reg = <0xc9410000 0x10000 0xc8834540 0x8 - 0xc8834558 0xc>; + 0xc8834558 0xc + 0xc1104408 0x4>; interrupts = <0 8 1>; pinctrl-names = "external_eth_pins"; pinctrl-0 = <&external_eth_pins>; diff --git a/arch/arm/boot/dts/amlogic/gxl_sei210_1g.dts b/arch/arm/boot/dts/amlogic/gxl_sei210_1g.dts index 2f447c3..7570280 100644 --- a/arch/arm/boot/dts/amlogic/gxl_sei210_1g.dts +++ b/arch/arm/boot/dts/amlogic/gxl_sei210_1g.dts @@ -390,7 +390,8 @@ compatible = "amlogic, gxbb-eth-dwmac"; reg = <0xc9410000 0x10000 0xc8834540 0x8 - 0xc8834558 0xc>; + 0xc8834558 0xc + 0xc1104408 0x4>; interrupts = <0 8 1>; pinctrl-names = "external_eth_pins"; pinctrl-0 = <&external_eth_pins>; diff --git a/arch/arm/boot/dts/amlogic/gxl_sei210_2g.dts b/arch/arm/boot/dts/amlogic/gxl_sei210_2g.dts index c8309f7..ed45ac7 100644 --- a/arch/arm/boot/dts/amlogic/gxl_sei210_2g.dts +++ b/arch/arm/boot/dts/amlogic/gxl_sei210_2g.dts @@ -398,7 +398,8 @@ compatible = "amlogic, gxbb-eth-dwmac"; reg = <0xc9410000 0x10000 0xc8834540 0x8 - 0xc8834558 0xc>; + 0xc8834558 0xc + 0xc1104408 0x4>; interrupts = <0 8 1>; pinctrl-names = "external_eth_pins"; pinctrl-0 = <&external_eth_pins>; diff --git a/arch/arm/boot/dts/amlogic/gxl_skt.dts b/arch/arm/boot/dts/amlogic/gxl_skt.dts index 5ace41a..ce15065 100644 --- a/arch/arm/boot/dts/amlogic/gxl_skt.dts +++ b/arch/arm/boot/dts/amlogic/gxl_skt.dts @@ -400,7 +400,8 @@ compatible = "amlogic, gxbb-eth-dwmac"; reg = <0xc9410000 0x10000 0xc8834540 0x8 - 0xc8834558 0xc>; + 0xc8834558 0xc + 0xc1104408 0x4>; interrupts = <0 8 1>; pinctrl-names = "external_eth_pins"; pinctrl-0 = <&external_eth_pins>; diff --git a/arch/arm/boot/dts/amlogic/gxm_q200_2g.dts b/arch/arm/boot/dts/amlogic/gxm_q200_2g.dts index 8b4bb51..6e30ad5 100644 --- a/arch/arm/boot/dts/amlogic/gxm_q200_2g.dts +++ b/arch/arm/boot/dts/amlogic/gxm_q200_2g.dts @@ -389,7 +389,8 @@ compatible = "amlogic, gxbb-eth-dwmac"; reg = <0xc9410000 0x10000 0xc8834540 0x8 - 0xc8834558 0xc>; + 0xc8834558 0xc + 0xc1104408 0x4>; interrupts = <0 8 1>; pinctrl-names = "external_eth_pins"; pinctrl-0 = <&external_eth_pins>; diff --git a/arch/arm/boot/dts/amlogic/gxm_q200_2g_buildroot.dts b/arch/arm/boot/dts/amlogic/gxm_q200_2g_buildroot.dts index b457dbe..97f5813 100644 --- a/arch/arm/boot/dts/amlogic/gxm_q200_2g_buildroot.dts +++ b/arch/arm/boot/dts/amlogic/gxm_q200_2g_buildroot.dts @@ -393,7 +393,8 @@ compatible = "amlogic, gxbb-eth-dwmac"; reg = <0xc9410000 0x10000 0xc8834540 0x8 - 0xc8834558 0xc>; + 0xc8834558 0xc + 0xc1104408 0x4>; interrupts = <0 8 1>; pinctrl-names = "external_eth_pins"; pinctrl-0 = <&external_eth_pins>; diff --git a/arch/arm/boot/dts/amlogic/gxm_q201_1g.dts b/arch/arm/boot/dts/amlogic/gxm_q201_1g.dts index 9b83e6f..3a5234e 100644 --- a/arch/arm/boot/dts/amlogic/gxm_q201_1g.dts +++ b/arch/arm/boot/dts/amlogic/gxm_q201_1g.dts @@ -395,7 +395,8 @@ compatible = "amlogic, gxbb-eth-dwmac"; reg = <0xc9410000 0x10000 0xc8834540 0x8 - 0xc8834558 0xc>; + 0xc8834558 0xc + 0xc1104408 0x4>; interrupts = <0 8 1>; pinctrl-names = "external_eth_pins"; pinctrl-0 = <&external_eth_pins>; diff --git a/arch/arm/boot/dts/amlogic/gxm_q201_2g.dts b/arch/arm/boot/dts/amlogic/gxm_q201_2g.dts index 6d73a6f..4402966 100644 --- a/arch/arm/boot/dts/amlogic/gxm_q201_2g.dts +++ b/arch/arm/boot/dts/amlogic/gxm_q201_2g.dts @@ -397,7 +397,8 @@ compatible = "amlogic, gxbb-eth-dwmac"; reg = <0xc9410000 0x10000 0xc8834540 0x8 - 0xc8834558 0xc>; + 0xc8834558 0xc + 0xc1104408 0x4>; interrupts = <0 8 1>; pinctrl-names = "external_eth_pins"; pinctrl-0 = <&external_eth_pins>; diff --git a/arch/arm/boot/dts/amlogic/mesonaxg.dtsi b/arch/arm/boot/dts/amlogic/mesonaxg.dtsi index 50f35d5..233df58 100644 --- a/arch/arm/boot/dts/amlogic/mesonaxg.dtsi +++ b/arch/arm/boot/dts/amlogic/mesonaxg.dtsi @@ -825,6 +825,12 @@ cpu_ver_name{ compatible = "amlogic, cpu-major-id-axg"; }; + + defendkey: defendkey { + compatible = "amlogic, defendkey"; + mem_size = <0x0 0x100000>; + status = "okay"; + }; };/* end of / */ &pinctrl_aobus { diff --git a/arch/arm/boot/dts/amlogic/mesonsm1.dtsi b/arch/arm/boot/dts/amlogic/mesonsm1.dtsi index 9dc514c..e683301 100644 --- a/arch/arm/boot/dts/amlogic/mesonsm1.dtsi +++ b/arch/arm/boot/dts/amlogic/mesonsm1.dtsi @@ -800,10 +800,10 @@ audiobus: audiobus@0xFF660000 { compatible = "amlogic, audio-controller", "simple-bus"; - reg = <0xFF660000 0x4000>; + reg = <0xFF660000 0x3000>; #address-cells = <1>; #size-cells = <1>; - ranges = <0x0 0xFF660000 0x4000>; + ranges = <0x0 0xFF660000 0x3000>; clkaudio: audio_clocks { compatible = "amlogic, sm1-audio-clocks"; #clock-cells = <1>; @@ -829,6 +829,76 @@ }; };/* end of audiobus*/ + /* eARC */ + audio_earc: bus@ff663000 { + compatible = "simple-bus"; + reg = <0xff663000 0x1000>; + #address-cells = <1>; + #size-cells = <1>; + ranges = <0x0 0xff663000 0x1000>; + + earc: earc@0 { + compatible = "amlogic, sm1-snd-earc"; + #sound-dai-cells = <0>; + + status = "disabled"; + + reg = + <0x800 0x400>, + <0xc00 0x200>, + <0xe00 0x200>; + reg-names = + "rx_cmdc", + "rx_dmac", + "rx_top"; + + clocks = < &clkaudio CLKID_EARCRX_CMDC + &clkaudio CLKID_EARCRX_DMAC + &clkc CLKID_FCLK_DIV4 + &clkc CLKID_FCLK_DIV4 + &clkaudio CLKID_EARCTX_CMDC + &clkaudio CLKID_EARCTX_DMAC + &clkc CLKID_FCLK_DIV4 + &clkc CLKID_MPLL1 + >; + clock-names = + "rx_cmdc", + "rx_dmac", + "rx_cmdc_srcpll", + "rx_dmac_srcpll"; + + interrupts = < + GIC_SPI 87 IRQ_TYPE_LEVEL_HIGH>; + interrupt-names = "earc_rx"; + }; + }; + + /* Sound iomap */ + aml_snd_iomap { + compatible = "amlogic, snd-iomap"; + status = "okay"; + #address-cells=<1>; + #size-cells=<1>; + ranges; + pdm_bus { + reg = <0xFF661000 0x400>; + }; + audiobus_base { + reg = <0xFF660000 0x1000>; + }; + audiolocker_base { + reg = <0xFF661400 0x400>; + }; + eqdrc_base { + reg = <0xFF662000 0x1000>; + }; + reset_base { + reg = <0xFFD01000 0x1000>; + }; + vad_base { + reg = <0xFF661800 0x400>; + }; + }; }; /* end of soc*/ remote:rc@0xff808040 { @@ -1541,42 +1611,6 @@ /*partions defined in dts */ }; - /* Sound iomap */ - aml_snd_iomap { - compatible = "amlogic, snd-iomap"; - status = "okay"; - #address-cells=<1>; - #size-cells=<1>; - ranges; - pdm_bus { - reg = <0xFF661000 0x400>; - }; - audiobus_base { - reg = <0xFF660000 0x1000>; - }; - audiolocker_base { - reg = <0xFF661400 0x400>; - }; - eqdrc_base { - reg = <0xFF662000 0x1000>; - }; - reset_base { - reg = <0xFFD01000 0x1000>; - }; - vad_base { - reg = <0xFF661800 0x400>; - }; - earcrx_cdmc_base { - reg = <0xFF663800 0x30>; - }; - earcrx_dmac_base { - reg = <0xFF663C00 0x20>; - }; - earcrx_top_base { - reg = <0xFF663E00 0x10>; - }; - }; - vddcpu0: pwmao_d-regulator { compatible = "pwm-regulator"; pwms = <&pwm_AO_cd MESON_PWM_1 1500 0>; diff --git a/arch/arm/boot/dts/amlogic/mesontl1.dtsi b/arch/arm/boot/dts/amlogic/mesontl1.dtsi index 87efd0a..ac996dd 100644 --- a/arch/arm/boot/dts/amlogic/mesontl1.dtsi +++ b/arch/arm/boot/dts/amlogic/mesontl1.dtsi @@ -52,6 +52,8 @@ "dsu_clk", "dsu_pre_parent"; operating-points-v2 = <&cpu_opp_table0>; + /*set dynamic gp1 clk to val * 1000 *1000*/ + dynamic_gp1_clk = <1000>; cpu-supply = <&vddcpu0>; cpu-idle-states = <&CPU_SLEEP_0 &SYSTEM_SLEEP_0>; //cpu-idle-states = <&SYSTEM_SLEEP_0>; @@ -76,6 +78,8 @@ "dsu_clk", "dsu_pre_parent"; operating-points-v2 = <&cpu_opp_table0>; + /*set dynamic gp1 clk to val * 1000 *1000*/ + dynamic_gp1_clk = <1000>; cpu-supply = <&vddcpu0>; cpu-idle-states = <&CPU_SLEEP_0 &SYSTEM_SLEEP_0>; //cpu-idle-states = <&SYSTEM_SLEEP_0>; @@ -100,6 +104,8 @@ "dsu_clk", "dsu_pre_parent"; operating-points-v2 = <&cpu_opp_table0>; + /*set dynamic gp1 clk to val * 1000 *1000*/ + dynamic_gp1_clk = <1000>; cpu-supply = <&vddcpu0>; cpu-idle-states = <&CPU_SLEEP_0 &SYSTEM_SLEEP_0>; //cpu-idle-states = <&SYSTEM_SLEEP_0>; @@ -124,6 +130,8 @@ "dsu_clk", "dsu_pre_parent"; operating-points-v2 = <&cpu_opp_table0>; + /*set dynamic gp1 clk to val * 1000 *1000*/ + dynamic_gp1_clk = <1000>; cpu-supply = <&vddcpu0>; cpu-idle-states = <&CPU_SLEEP_0 &SYSTEM_SLEEP_0>; //cpu-idle-states = <&SYSTEM_SLEEP_0>; @@ -281,6 +289,16 @@ device_name = "aml_pm"; debug_reg = <0xff8000a8>; exit_reg = <0xff80023c>; + dmc_asr = <0xff638634>; + cpu_reg = <0xff63c19c>; + clocks = <&clkc CLKID_SWITCH_CLK81>, + <&clkc CLKID_CLK81>, + <&clkc CLKID_FIXED_PLL>, + <&xtal>; + clock-names = "switch_clk81", + "clk81", + "fixed_pll", + "xtal"; }; cpuinfo { diff --git a/arch/arm/boot/dts/amlogic/mesontm2.dtsi b/arch/arm/boot/dts/amlogic/mesontm2.dtsi index b8bc9e2..a3872cb 100644 --- a/arch/arm/boot/dts/amlogic/mesontm2.dtsi +++ b/arch/arm/boot/dts/amlogic/mesontm2.dtsi @@ -663,8 +663,8 @@ compatible = "amlogic, audio-controller", "simple-bus"; #address-cells = <1>; #size-cells = <1>; - reg = <0xff600000 0x10000>; - ranges = <0x0 0xff600000 0x10000>; + reg = <0xff600000 0x3000>; + ranges = <0x0 0xff600000 0x3000>; clkaudio:audio_clocks { compatible = "amlogic, tm2-audio-clocks"; @@ -692,6 +692,58 @@ }; };/* end of audiobus*/ + audio_earc: bus@ff603000 { + compatible = "simple-bus"; + reg = <0xff603000 0xD000>; + #address-cells = <1>; + #size-cells = <1>; + ranges = <0x0 0xff603000 0xD000>; + + earc: earc@0 { + compatible = "amlogic, tm2-snd-earc"; + #sound-dai-cells = <0>; + + status = "disabled"; + + reg = <0x0 0x400>, + <0x400 0x200>, + <0x600 0x200>, + <0x800 0x400>, + <0xc00 0x200>, + <0xe00 0x200>; + reg-names = "tx_cmdc", + "tx_dmac", + "tx_top", + "rx_cmdc", + "rx_dmac", + "rx_top"; + + clocks = < &clkaudio CLKID_EARCRX_CMDC + &clkaudio CLKID_EARCRX_DMAC + &clkc CLKID_FCLK_DIV4 + &clkc CLKID_FCLK_DIV4 + &clkaudio CLKID_EARCTX_CMDC + &clkaudio CLKID_EARCTX_DMAC + &clkc CLKID_FCLK_DIV4 + &clkc CLKID_MPLL1 + >; + clock-names = + "rx_cmdc", + "rx_dmac", + "rx_cmdc_srcpll", + "rx_dmac_srcpll", + "tx_cmdc", + "tx_dmac", + "tx_cmdc_srcpll", + "tx_dmac_srcpll"; + + interrupts = < + GIC_SPI 232 IRQ_TYPE_LEVEL_HIGH + GIC_SPI 233 IRQ_TYPE_LEVEL_HIGH>; + interrupt-names = "earc_rx", "earc_tx"; + }; + }; + /* Sound iomap */ aml_snd_iomap { compatible = "amlogic, snd-iomap"; @@ -717,15 +769,6 @@ vad_base { reg = <0xFF601800 0x400>; }; - earcrx_cdmc_base { - reg = <0xFF603800 0x30>; - }; - earcrx_dmac_base { - reg = <0xFF603C00 0x20>; - }; - earcrx_top_base { - reg = <0xFF603E00 0x10>; - }; }; cbus: cbus@ffd00000 { diff --git a/arch/arm/boot/dts/amlogic/mesontxl.dtsi b/arch/arm/boot/dts/amlogic/mesontxl.dtsi index 1c876ec..e1e8565 100644 --- a/arch/arm/boot/dts/amlogic/mesontxl.dtsi +++ b/arch/arm/boot/dts/amlogic/mesontxl.dtsi @@ -345,7 +345,7 @@ reg = <0xc9410000 0x10000 0xc8834540 0x8 0xc8834558 0xc - 0xc1104484 0x4>; + 0xc1104408 0x4>; interrupts = <0 8 1 0 9 1>; phy-mode= "rmii"; diff --git a/arch/arm/boot/dts/amlogic/sm1_s905d3_ac200.dts b/arch/arm/boot/dts/amlogic/sm1_s905d3_ac200.dts index f0c911c..88ff230 100644 --- a/arch/arm/boot/dts/amlogic/sm1_s905d3_ac200.dts +++ b/arch/arm/boot/dts/amlogic/sm1_s905d3_ac200.dts @@ -1313,31 +1313,6 @@ status = "okay"; }; - earc:earc { - compatible = "amlogic, sm1-snd-earc"; - #sound-dai-cells = <0>; - - clocks = <&clkaudio CLKID_AUDIO_GATE_EARCRX - &clkaudio CLKID_EARCRX_CMDC - &clkaudio CLKID_EARCRX_DMAC - &clkc CLKID_FCLK_DIV5 - &clkc CLKID_FCLK_DIV3 - >; - clock-names = "rx_gate", - "rx_cmdc", - "rx_dmac", - "rx_cmdc_srcpll", - "rx_dmac_srcpll"; - - interrupts = < - GIC_SPI 88 IRQ_TYPE_EDGE_RISING - GIC_SPI 87 IRQ_TYPE_EDGE_RISING - >; - interrupt-names = "rx_cmdc", "rx_dmac"; - - status = "okay"; - }; - asrca: resample@0 { compatible = "amlogic, sm1-resample"; clocks = <&clkc CLKID_MPLL3 @@ -1503,11 +1478,9 @@ status = "disabled"; }; - aed:effect { compatible = "amlogic, snd-effect-v3"; #sound-dai-cells = <0>; - clocks = <&clkaudio CLKID_AUDIO_GATE_EQDRC &clkc CLKID_FCLK_DIV5 &clkaudio CLKID_AUDIO_EQDRC>; @@ -1530,6 +1503,10 @@ }; }; /* end of audiobus */ +&earc { + status = "okay"; +}; + &pinctrl_periphs { tdmout_a: tdmout_a { mux { /* GPIOX_11, GPIOX_10, GPIOX_9 */ diff --git a/arch/arm/boot/dts/amlogic/sm1_s905d3_ac200_buildroot.dts b/arch/arm/boot/dts/amlogic/sm1_s905d3_ac200_buildroot.dts index bfbe926..80c2355 100644 --- a/arch/arm/boot/dts/amlogic/sm1_s905d3_ac200_buildroot.dts +++ b/arch/arm/boot/dts/amlogic/sm1_s905d3_ac200_buildroot.dts @@ -1369,31 +1369,6 @@ status = "okay"; }; - earc:earc { - compatible = "amlogic, sm1-snd-earc"; - #sound-dai-cells = <0>; - - clocks = <&clkaudio CLKID_AUDIO_GATE_EARCRX - &clkaudio CLKID_EARCRX_CMDC - &clkaudio CLKID_EARCRX_DMAC - &clkc CLKID_FCLK_DIV5 - &clkc CLKID_FCLK_DIV3 - >; - clock-names = "rx_gate", - "rx_cmdc", - "rx_dmac", - "rx_cmdc_srcpll", - "rx_dmac_srcpll"; - - interrupts = < - GIC_SPI 88 IRQ_TYPE_EDGE_RISING - GIC_SPI 87 IRQ_TYPE_EDGE_RISING - >; - interrupt-names = "rx_cmdc", "rx_dmac"; - - status = "okay"; - }; - asrca: resample@0 { compatible = "amlogic, sm1-resample"; clocks = <&clkc CLKID_MPLL3 @@ -1566,6 +1541,7 @@ &clkc CLKID_FCLK_DIV5 &clkaudio CLKID_AUDIO_EQDRC>; clock-names = "gate", "srcpll", "eqdrc"; + /* * 0:tdmout_a * 1:tdmout_b @@ -1578,10 +1554,15 @@ lane_mask = <0x1>; /* max 0xff, each bit for one channel */ channel_mask = <0x3>; + status = "okay"; }; }; /* end of audiobus */ +&earc { + status = "okay"; +}; + &pinctrl_periphs { tdmout_a: tdmout_a { mux { /* GPIOX_11, GPIOX_10, GPIOX_9 */ diff --git a/arch/arm/boot/dts/amlogic/sm1_s905d3_ac200_drm_buildroot.dts b/arch/arm/boot/dts/amlogic/sm1_s905d3_ac200_drm_buildroot.dts index 64b01a4..92329ca 100644 --- a/arch/arm/boot/dts/amlogic/sm1_s905d3_ac200_drm_buildroot.dts +++ b/arch/arm/boot/dts/amlogic/sm1_s905d3_ac200_drm_buildroot.dts @@ -1385,31 +1385,6 @@ status = "okay"; }; - earc:earc { - compatible = "amlogic, sm1-snd-earc"; - #sound-dai-cells = <0>; - - clocks = <&clkaudio CLKID_AUDIO_GATE_EARCRX - &clkaudio CLKID_EARCRX_CMDC - &clkaudio CLKID_EARCRX_DMAC - &clkc CLKID_FCLK_DIV5 - &clkc CLKID_FCLK_DIV3 - >; - clock-names = "rx_gate", - "rx_cmdc", - "rx_dmac", - "rx_cmdc_srcpll", - "rx_dmac_srcpll"; - - interrupts = < - GIC_SPI 88 IRQ_TYPE_EDGE_RISING - GIC_SPI 87 IRQ_TYPE_EDGE_RISING - >; - interrupt-names = "rx_cmdc", "rx_dmac"; - - status = "okay"; - }; - asrca: resample@0 { compatible = "amlogic, sm1-resample"; clocks = <&clkc CLKID_MPLL3 @@ -1594,10 +1569,15 @@ lane_mask = <0x1>; /* max 0xff, each bit for one channel */ channel_mask = <0x3>; + status = "okay"; }; }; /* end of audiobus */ +&earc { + status = "okay"; +}; + &pinctrl_periphs { tdmout_a: tdmout_a { mux { /* GPIOX_11, GPIOX_10, GPIOX_9 */ diff --git a/arch/arm/boot/dts/amlogic/sm1_s905d3_ac202.dts b/arch/arm/boot/dts/amlogic/sm1_s905d3_ac202.dts index 7dc18a1..6ab9506 100644 --- a/arch/arm/boot/dts/amlogic/sm1_s905d3_ac202.dts +++ b/arch/arm/boot/dts/amlogic/sm1_s905d3_ac202.dts @@ -1317,31 +1317,6 @@ status = "okay"; }; - earc:earc { - compatible = "amlogic, sm1-snd-earc"; - #sound-dai-cells = <0>; - - clocks = <&clkaudio CLKID_AUDIO_GATE_EARCRX - &clkaudio CLKID_EARCRX_CMDC - &clkaudio CLKID_EARCRX_DMAC - &clkc CLKID_FCLK_DIV5 - &clkc CLKID_FCLK_DIV3 - >; - clock-names = "rx_gate", - "rx_cmdc", - "rx_dmac", - "rx_cmdc_srcpll", - "rx_dmac_srcpll"; - - interrupts = < - GIC_SPI 88 IRQ_TYPE_EDGE_RISING - GIC_SPI 87 IRQ_TYPE_EDGE_RISING - >; - interrupt-names = "rx_cmdc", "rx_dmac"; - - status = "okay"; - }; - asrca: resample@0 { compatible = "amlogic, sm1-resample"; clocks = <&clkc CLKID_MPLL3 @@ -1507,13 +1482,16 @@ status = "disabled"; }; + aed:effect { compatible = "amlogic, snd-effect-v3"; #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 @@ -1526,10 +1504,15 @@ lane_mask = <0x1>; /* max 0xff, each bit for one channel */ channel_mask = <0x3>; + status = "disabled"; }; }; /* end of audiobus */ +&earc { + status = "okay"; +}; + &pinctrl_periphs { tdmout_a: tdmout_a { mux { /* GPIOX_11, GPIOX_10, GPIOX_9 */ diff --git a/arch/arm/boot/dts/amlogic/sm1_s905d3_ac202_1g.dts b/arch/arm/boot/dts/amlogic/sm1_s905d3_ac202_1g.dts index ff59afd..0af6b97 100644 --- a/arch/arm/boot/dts/amlogic/sm1_s905d3_ac202_1g.dts +++ b/arch/arm/boot/dts/amlogic/sm1_s905d3_ac202_1g.dts @@ -1317,31 +1317,6 @@ status = "okay"; }; - earc:earc { - compatible = "amlogic, sm1-snd-earc"; - #sound-dai-cells = <0>; - - clocks = <&clkaudio CLKID_AUDIO_GATE_EARCRX - &clkaudio CLKID_EARCRX_CMDC - &clkaudio CLKID_EARCRX_DMAC - &clkc CLKID_FCLK_DIV5 - &clkc CLKID_FCLK_DIV3 - >; - clock-names = "rx_gate", - "rx_cmdc", - "rx_dmac", - "rx_cmdc_srcpll", - "rx_dmac_srcpll"; - - interrupts = < - GIC_SPI 88 IRQ_TYPE_EDGE_RISING - GIC_SPI 87 IRQ_TYPE_EDGE_RISING - >; - interrupt-names = "rx_cmdc", "rx_dmac"; - - status = "okay"; - }; - asrca: resample@0 { compatible = "amlogic, sm1-resample"; clocks = <&clkc CLKID_MPLL3 @@ -1507,13 +1482,16 @@ status = "disabled"; }; + aed:effect { compatible = "amlogic, snd-effect-v3"; #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 @@ -1526,10 +1504,15 @@ lane_mask = <0x1>; /* max 0xff, each bit for one channel */ channel_mask = <0x3>; + status = "disabled"; }; }; /* end of audiobus */ +&earc { + status = "okay"; +}; + &pinctrl_periphs { tdmout_a: tdmout_a { mux { /* GPIOX_11, GPIOX_10, GPIOX_9 */ diff --git a/arch/arm/boot/dts/amlogic/sm1_s905d3_skt.dts b/arch/arm/boot/dts/amlogic/sm1_s905d3_skt.dts index 1c42f7b..7d9bb08 100644 --- a/arch/arm/boot/dts/amlogic/sm1_s905d3_skt.dts +++ b/arch/arm/boot/dts/amlogic/sm1_s905d3_skt.dts @@ -1312,31 +1312,6 @@ status = "okay"; }; - earc:earc { - compatible = "amlogic, sm1-snd-earc"; - #sound-dai-cells = <0>; - - clocks = <&clkaudio CLKID_AUDIO_GATE_EARCRX - &clkaudio CLKID_EARCRX_CMDC - &clkaudio CLKID_EARCRX_DMAC - &clkc CLKID_FCLK_DIV5 - &clkc CLKID_FCLK_DIV3 - >; - clock-names = "rx_gate", - "rx_cmdc", - "rx_dmac", - "rx_cmdc_srcpll", - "rx_dmac_srcpll"; - - interrupts = < - GIC_SPI 88 IRQ_TYPE_EDGE_RISING - GIC_SPI 87 IRQ_TYPE_EDGE_RISING - >; - interrupt-names = "rx_cmdc", "rx_dmac"; - - status = "okay"; - }; - asrca: resample@0 { compatible = "amlogic, sm1-resample"; clocks = <&clkc CLKID_MPLL3 @@ -1502,13 +1477,16 @@ status = "disabled"; }; + aed:effect { compatible = "amlogic, snd-effect-v3"; #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 @@ -1521,10 +1499,15 @@ lane_mask = <0x1>; /* max 0xff, each bit for one channel */ channel_mask = <0x3>; + status = "okay"; }; }; /* end of audiobus */ +&earc { + status = "okay"; +}; + &pinctrl_periphs { tdmout_a: tdmout_a { mux { /* GPIOX_11, GPIOX_10, GPIOX_9 */ diff --git a/arch/arm/boot/dts/amlogic/sm1_s905x3_ac213.dts b/arch/arm/boot/dts/amlogic/sm1_s905x3_ac213.dts index be8496f..d525011 100644 --- a/arch/arm/boot/dts/amlogic/sm1_s905x3_ac213.dts +++ b/arch/arm/boot/dts/amlogic/sm1_s905x3_ac213.dts @@ -1288,30 +1288,6 @@ /* mode 0~4, defalut:1 */ filter_mode = <1>; - status = "okay"; - }; - - earc:earc { - compatible = "amlogic, sm1-snd-earc"; - #sound-dai-cells = <0>; - - clocks = <&clkaudio CLKID_AUDIO_GATE_EARCRX - &clkaudio CLKID_EARCRX_CMDC - &clkaudio CLKID_EARCRX_DMAC - &clkc CLKID_FCLK_DIV5 - &clkc CLKID_FCLK_DIV3 - >; - clock-names = "rx_gate", - "rx_cmdc", - "rx_dmac", - "rx_cmdc_srcpll", - "rx_dmac_srcpll"; - - interrupts = < - GIC_SPI 88 IRQ_TYPE_EDGE_RISING - GIC_SPI 87 IRQ_TYPE_EDGE_RISING - >; - interrupt-names = "rx_cmdc", "rx_dmac"; status = "okay"; }; @@ -1481,13 +1457,16 @@ status = "disabled"; }; + aed:effect { compatible = "amlogic, snd-effect-v3"; #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 @@ -1504,6 +1483,10 @@ }; }; /* end of audiobus */ +&earc { + status = "okay"; +}; + &pinctrl_periphs { tdmout_a: tdmout_a { mux { /* GPIOX_11, GPIOX_10, GPIOX_9 */ diff --git a/arch/arm/boot/dts/amlogic/sm1_s905x3_ac213_buildroot.dts b/arch/arm/boot/dts/amlogic/sm1_s905x3_ac213_buildroot.dts index a7e4029..60edc07 100644 --- a/arch/arm/boot/dts/amlogic/sm1_s905x3_ac213_buildroot.dts +++ b/arch/arm/boot/dts/amlogic/sm1_s905x3_ac213_buildroot.dts @@ -1339,30 +1339,6 @@ /* mode 0~4, defalut:1 */ filter_mode = <1>; - status = "okay"; - }; - - earc:earc { - compatible = "amlogic, sm1-snd-earc"; - #sound-dai-cells = <0>; - - clocks = <&clkaudio CLKID_AUDIO_GATE_EARCRX - &clkaudio CLKID_EARCRX_CMDC - &clkaudio CLKID_EARCRX_DMAC - &clkc CLKID_FCLK_DIV5 - &clkc CLKID_FCLK_DIV3 - >; - clock-names = "rx_gate", - "rx_cmdc", - "rx_dmac", - "rx_cmdc_srcpll", - "rx_dmac_srcpll"; - - interrupts = < - GIC_SPI 88 IRQ_TYPE_EDGE_RISING - GIC_SPI 87 IRQ_TYPE_EDGE_RISING - >; - interrupt-names = "rx_cmdc", "rx_dmac"; status = "okay"; }; @@ -1532,13 +1508,16 @@ status = "disabled"; }; + aed:effect { compatible = "amlogic, snd-effect-v3"; #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 @@ -1555,6 +1534,10 @@ }; }; /* end of audiobus */ +&earc { + status = "okay"; +}; + &pinctrl_periphs { tdmout_a: tdmout_a { mux { /* GPIOX_11, GPIOX_10, GPIOX_9 */ diff --git a/arch/arm/boot/dts/amlogic/sm1_s905x3_ac214.dts b/arch/arm/boot/dts/amlogic/sm1_s905x3_ac214.dts index c86161c..ed4c461 100644 --- a/arch/arm/boot/dts/amlogic/sm1_s905x3_ac214.dts +++ b/arch/arm/boot/dts/amlogic/sm1_s905x3_ac214.dts @@ -1264,30 +1264,6 @@ /* mode 0~4, defalut:1 */ filter_mode = <1>; - status = "okay"; - }; - - earc:earc { - compatible = "amlogic, sm1-snd-earc"; - #sound-dai-cells = <0>; - - clocks = <&clkaudio CLKID_AUDIO_GATE_EARCRX - &clkaudio CLKID_EARCRX_CMDC - &clkaudio CLKID_EARCRX_DMAC - &clkc CLKID_FCLK_DIV5 - &clkc CLKID_FCLK_DIV3 - >; - clock-names = "rx_gate", - "rx_cmdc", - "rx_dmac", - "rx_cmdc_srcpll", - "rx_dmac_srcpll"; - - interrupts = < - GIC_SPI 88 IRQ_TYPE_EDGE_RISING - GIC_SPI 87 IRQ_TYPE_EDGE_RISING - >; - interrupt-names = "rx_cmdc", "rx_dmac"; status = "okay"; }; @@ -1457,13 +1433,16 @@ status = "disabled"; }; + aed:effect { compatible = "amlogic, snd-effect-v3"; #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 @@ -1480,6 +1459,10 @@ }; }; /* end of audiobus */ +&earc { + status = "okay"; +}; + &pinctrl_periphs { tdmout_a: tdmout_a { mux { /* GPIOX_11, GPIOX_10, GPIOX_9 */ diff --git a/arch/arm/boot/dts/amlogic/sm1_s905x3_ac214_buildroot.dts b/arch/arm/boot/dts/amlogic/sm1_s905x3_ac214_buildroot.dts index 7eef34e..2fa591b 100644 --- a/arch/arm/boot/dts/amlogic/sm1_s905x3_ac214_buildroot.dts +++ b/arch/arm/boot/dts/amlogic/sm1_s905x3_ac214_buildroot.dts @@ -1339,30 +1339,6 @@ /* mode 0~4, defalut:1 */ filter_mode = <1>; - status = "okay"; - }; - - earc:earc { - compatible = "amlogic, sm1-snd-earc"; - #sound-dai-cells = <0>; - - clocks = <&clkaudio CLKID_AUDIO_GATE_EARCRX - &clkaudio CLKID_EARCRX_CMDC - &clkaudio CLKID_EARCRX_DMAC - &clkc CLKID_FCLK_DIV5 - &clkc CLKID_FCLK_DIV3 - >; - clock-names = "rx_gate", - "rx_cmdc", - "rx_dmac", - "rx_cmdc_srcpll", - "rx_dmac_srcpll"; - - interrupts = < - GIC_SPI 88 IRQ_TYPE_EDGE_RISING - GIC_SPI 87 IRQ_TYPE_EDGE_RISING - >; - interrupt-names = "rx_cmdc", "rx_dmac"; status = "okay"; }; @@ -1532,13 +1508,16 @@ status = "disabled"; }; + aed:effect { compatible = "amlogic, snd-effect-v3"; #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 @@ -1555,6 +1534,10 @@ }; }; /* end of audiobus */ +&earc { + status = "okay"; +}; + &pinctrl_periphs { tdmout_a: tdmout_a { mux { /* GPIOX_11, GPIOX_10, GPIOX_9 */ diff --git a/arch/arm/boot/dts/amlogic/sm1_s905y3_ac223.dts b/arch/arm/boot/dts/amlogic/sm1_s905y3_ac223.dts index a977322..ee4bed1 100644 --- a/arch/arm/boot/dts/amlogic/sm1_s905y3_ac223.dts +++ b/arch/arm/boot/dts/amlogic/sm1_s905y3_ac223.dts @@ -1223,30 +1223,6 @@ /* mode 0~4, defalut:1 */ filter_mode = <1>; - status = "okay"; - }; - - earc:earc { - compatible = "amlogic, sm1-snd-earc"; - #sound-dai-cells = <0>; - - clocks = <&clkaudio CLKID_AUDIO_GATE_EARCRX - &clkaudio CLKID_EARCRX_CMDC - &clkaudio CLKID_EARCRX_DMAC - &clkc CLKID_FCLK_DIV5 - &clkc CLKID_FCLK_DIV3 - >; - clock-names = "rx_gate", - "rx_cmdc", - "rx_dmac", - "rx_cmdc_srcpll", - "rx_dmac_srcpll"; - - interrupts = < - GIC_SPI 88 IRQ_TYPE_EDGE_RISING - GIC_SPI 87 IRQ_TYPE_EDGE_RISING - >; - interrupt-names = "rx_cmdc", "rx_dmac"; status = "okay"; }; @@ -1416,13 +1392,16 @@ status = "disabled"; }; + aed:effect { compatible = "amlogic, snd-effect-v3"; #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 @@ -1439,6 +1418,10 @@ }; }; /* end of audiobus */ +&earc { + status = "okay"; +}; + &pinctrl_periphs { tdmout_a: tdmout_a { mux { /* GPIOX_11, GPIOX_10, GPIOX_9 */ diff --git a/arch/arm/boot/dts/amlogic/tl1_pxp.dts b/arch/arm/boot/dts/amlogic/tl1_pxp.dts index 2c0a311..2bc492c 100644 --- a/arch/arm/boot/dts/amlogic/tl1_pxp.dts +++ b/arch/arm/boot/dts/amlogic/tl1_pxp.dts @@ -940,7 +940,7 @@ }; extn:extn { - compatible = "amlogic, snd-extn"; + compatible = "amlogic, tl1-snd-extn"; #sound-dai-cells = <0>; interrupts = diff --git a/arch/arm/boot/dts/amlogic/tl1_t962x2_skt.dts b/arch/arm/boot/dts/amlogic/tl1_t962x2_skt.dts index 94b27a2..ac7d102 100644 --- a/arch/arm/boot/dts/amlogic/tl1_t962x2_skt.dts +++ b/arch/arm/boot/dts/amlogic/tl1_t962x2_skt.dts @@ -1468,7 +1468,7 @@ }; extn:extn { - compatible = "amlogic, snd-extn"; + compatible = "amlogic, tl1-snd-extn"; #sound-dai-cells = <0>; interrupts = diff --git a/arch/arm/boot/dts/amlogic/tl1_t962x2_t309.dts b/arch/arm/boot/dts/amlogic/tl1_t962x2_t309.dts index 5d03e01..79c90aa 100644 --- a/arch/arm/boot/dts/amlogic/tl1_t962x2_t309.dts +++ b/arch/arm/boot/dts/amlogic/tl1_t962x2_t309.dts @@ -1229,6 +1229,11 @@ }; }; + aml_pm { + vad_wakeup_disable = <0x0>; + vddio3v3_en = <&gpio_ao GPIOAO_2 0>; + }; + sd_emmc_b: sdio@ffe05000 { status = "okay"; compatible = "amlogic, meson-mmc-tl1"; @@ -1496,7 +1501,7 @@ }; extn:extn { - compatible = "amlogic, snd-extn"; + compatible = "amlogic, tl1-snd-extn"; #sound-dai-cells = <0>; interrupts = diff --git a/arch/arm/boot/dts/amlogic/tl1_t962x2_x301_1g.dts b/arch/arm/boot/dts/amlogic/tl1_t962x2_x301_1g.dts index 08626d6..a917c3a 100644 --- a/arch/arm/boot/dts/amlogic/tl1_t962x2_x301_1g.dts +++ b/arch/arm/boot/dts/amlogic/tl1_t962x2_x301_1g.dts @@ -1330,6 +1330,11 @@ }; }; + aml_pm { + vad_wakeup_disable = <0x0>; + vddio3v3_en = <&gpio_ao GPIOAO_2 0>; + }; + /* sd_emmc_b: sd@ffe05000 { * status = "okay"; * compatible = "amlogic, meson-mmc-tl1"; @@ -1575,8 +1580,8 @@ #sound-dai-cells = <0>; clocks = <&clkaudio CLKID_AUDIO_GATE_PDM - &clkc CLKID_FCLK_DIV3 - &clkc CLKID_MPLL3 + &clkc CLKID_HIFI_PLL + &clkc CLKID_HIFI_PLL &clkaudio CLKID_AUDIO_PDMIN0 &clkaudio CLKID_AUDIO_PDMIN1>; clock-names = "gate", @@ -1595,7 +1600,7 @@ }; extn:extn { - compatible = "amlogic, snd-extn"; + compatible = "amlogic, tl1-snd-extn"; #sound-dai-cells = <0>; interrupts = @@ -1680,7 +1685,7 @@ #sound-dai-cells = <0>; clocks = <&clkaudio CLKID_AUDIO_GATE_TOVAD - &clkc CLKID_FCLK_DIV5 + &clkc CLKID_HIFI_PLL &clkaudio CLKID_AUDIO_VAD>; clock-names = "gate", "pll", "clk"; @@ -1716,8 +1721,8 @@ #sound-dai-cells = <0>; clocks = <&clkaudio CLKID_AUDIO_GATE_PDM - &clkc CLKID_FCLK_DIV3 - &clkc CLKID_MPLL3 + &clkc CLKID_HIFI_PLL + &clkc CLKID_HIFI_PLL &clkaudio CLKID_AUDIO_PDMIN0 &clkaudio CLKID_AUDIO_PDMIN1 &clkc CLKID_MPLL0 @@ -1771,8 +1776,8 @@ #sound-dai-cells = <0>; clocks = <&clkaudio CLKID_AUDIO_GATE_PDM - &clkc CLKID_FCLK_DIV3 - &clkc CLKID_MPLL3 + &clkc CLKID_HIFI_PLL + &clkc CLKID_HIFI_PLL &clkaudio CLKID_AUDIO_PDMIN0 &clkaudio CLKID_AUDIO_PDMIN1 &clkc CLKID_MPLL0 diff --git a/arch/arm/boot/dts/amlogic/tl1_t962x2_x301_1g_drm.dts b/arch/arm/boot/dts/amlogic/tl1_t962x2_x301_1g_drm.dts index bd4b205..9fa4aea 100644 --- a/arch/arm/boot/dts/amlogic/tl1_t962x2_x301_1g_drm.dts +++ b/arch/arm/boot/dts/amlogic/tl1_t962x2_x301_1g_drm.dts @@ -1569,8 +1569,8 @@ #sound-dai-cells = <0>; clocks = <&clkaudio CLKID_AUDIO_GATE_PDM - &clkc CLKID_FCLK_DIV3 - &clkc CLKID_MPLL3 + &clkc CLKID_HIFI_PLL + &clkc CLKID_HIFI_PLL &clkaudio CLKID_AUDIO_PDMIN0 &clkaudio CLKID_AUDIO_PDMIN1>; clock-names = "gate", @@ -1674,7 +1674,7 @@ #sound-dai-cells = <0>; clocks = <&clkaudio CLKID_AUDIO_GATE_TOVAD - &clkc CLKID_FCLK_DIV5 + &clkc CLKID_HIFI_PLL &clkaudio CLKID_AUDIO_VAD>; clock-names = "gate", "pll", "clk"; @@ -1710,8 +1710,8 @@ #sound-dai-cells = <0>; clocks = <&clkaudio CLKID_AUDIO_GATE_PDM - &clkc CLKID_FCLK_DIV3 - &clkc CLKID_MPLL3 + &clkc CLKID_HIFI_PLL + &clkc CLKID_HIFI_PLL &clkaudio CLKID_AUDIO_PDMIN0 &clkaudio CLKID_AUDIO_PDMIN1 &clkc CLKID_MPLL0 @@ -1765,8 +1765,8 @@ #sound-dai-cells = <0>; clocks = <&clkaudio CLKID_AUDIO_GATE_PDM - &clkc CLKID_FCLK_DIV3 - &clkc CLKID_MPLL3 + &clkc CLKID_HIFI_PLL + &clkc CLKID_HIFI_PLL &clkaudio CLKID_AUDIO_PDMIN0 &clkaudio CLKID_AUDIO_PDMIN1 &clkc CLKID_MPLL0 diff --git a/arch/arm/boot/dts/amlogic/tl1_t962x2_x301_2g.dts b/arch/arm/boot/dts/amlogic/tl1_t962x2_x301_2g.dts index bea8adc..090af19 100644 --- a/arch/arm/boot/dts/amlogic/tl1_t962x2_x301_2g.dts +++ b/arch/arm/boot/dts/amlogic/tl1_t962x2_x301_2g.dts @@ -1323,6 +1323,11 @@ }; }; + aml_pm { + vad_wakeup_disable = <0x0>; + vddio3v3_en = <&gpio_ao GPIOAO_2 0>; + }; + /* sd_emmc_b: sd@ffe05000 { * status = "okay"; * compatible = "amlogic, meson-mmc-tl1"; @@ -1570,8 +1575,8 @@ #sound-dai-cells = <0>; clocks = <&clkaudio CLKID_AUDIO_GATE_PDM - &clkc CLKID_FCLK_DIV3 - &clkc CLKID_MPLL3 + &clkc CLKID_HIFI_PLL + &clkc CLKID_HIFI_PLL &clkaudio CLKID_AUDIO_PDMIN0 &clkaudio CLKID_AUDIO_PDMIN1>; clock-names = "gate", @@ -1590,7 +1595,7 @@ }; extn:extn { - compatible = "amlogic, snd-extn"; + compatible = "amlogic, tl1-snd-extn"; #sound-dai-cells = <0>; interrupts = @@ -1675,7 +1680,7 @@ #sound-dai-cells = <0>; clocks = <&clkaudio CLKID_AUDIO_GATE_TOVAD - &clkc CLKID_FCLK_DIV5 + &clkc CLKID_HIFI_PLL &clkaudio CLKID_AUDIO_VAD>; clock-names = "gate", "pll", "clk"; @@ -1711,8 +1716,8 @@ #sound-dai-cells = <0>; clocks = <&clkaudio CLKID_AUDIO_GATE_PDM - &clkc CLKID_FCLK_DIV3 - &clkc CLKID_MPLL3 + &clkc CLKID_HIFI_PLL + &clkc CLKID_HIFI_PLL &clkaudio CLKID_AUDIO_PDMIN0 &clkaudio CLKID_AUDIO_PDMIN1 &clkc CLKID_MPLL0 @@ -1766,8 +1771,8 @@ #sound-dai-cells = <0>; clocks = <&clkaudio CLKID_AUDIO_GATE_PDM - &clkc CLKID_FCLK_DIV3 - &clkc CLKID_MPLL3 + &clkc CLKID_HIFI_PLL + &clkc CLKID_HIFI_PLL &clkaudio CLKID_AUDIO_PDMIN0 &clkaudio CLKID_AUDIO_PDMIN1 &clkc CLKID_MPLL0 diff --git a/arch/arm/boot/dts/amlogic/tl1_t962x2_x301_2g_drm.dts b/arch/arm/boot/dts/amlogic/tl1_t962x2_x301_2g_drm.dts index fdaa500..3a9a387 100644 --- a/arch/arm/boot/dts/amlogic/tl1_t962x2_x301_2g_drm.dts +++ b/arch/arm/boot/dts/amlogic/tl1_t962x2_x301_2g_drm.dts @@ -1564,8 +1564,8 @@ #sound-dai-cells = <0>; clocks = <&clkaudio CLKID_AUDIO_GATE_PDM - &clkc CLKID_FCLK_DIV3 - &clkc CLKID_MPLL3 + &clkc CLKID_HIFI_PLL + &clkc CLKID_HIFI_PLL &clkaudio CLKID_AUDIO_PDMIN0 &clkaudio CLKID_AUDIO_PDMIN1>; clock-names = "gate", @@ -1669,7 +1669,7 @@ #sound-dai-cells = <0>; clocks = <&clkaudio CLKID_AUDIO_GATE_TOVAD - &clkc CLKID_FCLK_DIV5 + &clkc CLKID_HIFI_PLL &clkaudio CLKID_AUDIO_VAD>; clock-names = "gate", "pll", "clk"; @@ -1705,8 +1705,8 @@ #sound-dai-cells = <0>; clocks = <&clkaudio CLKID_AUDIO_GATE_PDM - &clkc CLKID_FCLK_DIV3 - &clkc CLKID_MPLL3 + &clkc CLKID_HIFI_PLL + &clkc CLKID_HIFI_PLL &clkaudio CLKID_AUDIO_PDMIN0 &clkaudio CLKID_AUDIO_PDMIN1 &clkc CLKID_MPLL0 @@ -1760,8 +1760,8 @@ #sound-dai-cells = <0>; clocks = <&clkaudio CLKID_AUDIO_GATE_PDM - &clkc CLKID_FCLK_DIV3 - &clkc CLKID_MPLL3 + &clkc CLKID_HIFI_PLL + &clkc CLKID_HIFI_PLL &clkaudio CLKID_AUDIO_PDMIN0 &clkaudio CLKID_AUDIO_PDMIN1 &clkc CLKID_MPLL0 diff --git a/arch/arm/boot/dts/amlogic/tm2_t962e2_ab311.dts b/arch/arm/boot/dts/amlogic/tm2_t962e2_ab311.dts index 1f77e42..2d57803 100644 --- a/arch/arm/boot/dts/amlogic/tm2_t962e2_ab311.dts +++ b/arch/arm/boot/dts/amlogic/tm2_t962e2_ab311.dts @@ -1597,38 +1597,6 @@ status = "okay"; }; - earc:earc { - compatible = "amlogic, tm2-snd-earc"; - #sound-dai-cells = <0>; - - clocks = < &clkaudio CLKID_EARCRX_CMDC - &clkaudio CLKID_EARCRX_DMAC - &clkc CLKID_FCLK_DIV5 - &clkc CLKID_FCLK_DIV3 - &clkaudio CLKID_EARCTX_CMDC - &clkaudio CLKID_EARCTX_DMAC - &clkc CLKID_FCLK_DIV5 - &clkc CLKID_FCLK_DIV3 - >; - clock-names = - "rx_cmdc", - "rx_dmac", - "rx_cmdc_srcpll", - "rx_dmac_srcpll", - "tx_cmdc", - "tx_dmac", - "tx_cmdc_srcpll", - "tx_dmac_srcpll"; - - interrupts = < - GIC_SPI 88 IRQ_TYPE_EDGE_RISING - GIC_SPI 87 IRQ_TYPE_EDGE_RISING - >; - interrupt-names = "rx_cmdc", "rx_dmac"; - - status = "okay"; - }; - aed:effect { compatible = "amlogic, snd-effect-v3"; #sound-dai-cells = <0>; @@ -1845,6 +1813,10 @@ }; }; /* end of audiobus */ +&earc { + status = "okay"; +}; + &pinctrl_periphs { /* audio pin mux */ diff --git a/arch/arm/boot/dts/amlogic/tm2_t962e2_ab319.dts b/arch/arm/boot/dts/amlogic/tm2_t962e2_ab319.dts index 6aa6d09..d728aa6 100644 --- a/arch/arm/boot/dts/amlogic/tm2_t962e2_ab319.dts +++ b/arch/arm/boot/dts/amlogic/tm2_t962e2_ab319.dts @@ -1520,7 +1520,6 @@ compatible = "amlogic, snd-extn"; #sound-dai-cells = <0>; - interrupts = <GIC_SPI 158 IRQ_TYPE_EDGE_RISING>; interrupt-names = "irq_frhdmirx"; @@ -1528,37 +1527,6 @@ status = "okay"; }; - earc:earc { - compatible = "amlogic, tm2-snd-earc"; - #sound-dai-cells = <0>; - - clocks = < &clkaudio CLKID_EARCRX_CMDC - &clkaudio CLKID_EARCRX_DMAC - &clkc CLKID_FCLK_DIV5 - &clkc CLKID_FCLK_DIV3 - &clkaudio CLKID_EARCTX_CMDC - &clkaudio CLKID_EARCTX_DMAC - &clkc CLKID_FCLK_DIV5 - &clkc CLKID_FCLK_DIV3 - >; - clock-names = - "rx_cmdc", - "rx_dmac", - "rx_cmdc_srcpll", - "rx_dmac_srcpll", - "tx_cmdc", - "tx_dmac", - "tx_cmdc_srcpll", - "tx_dmac_srcpll"; - interrupts = < - GIC_SPI 88 IRQ_TYPE_EDGE_RISING - GIC_SPI 87 IRQ_TYPE_EDGE_RISING - >; - interrupt-names = "rx_cmdc", "rx_dmac"; - - status = "okay"; - }; - aed:effect { compatible = "amlogic, snd-effect-v3"; #sound-dai-cells = <0>; @@ -1775,6 +1743,10 @@ }; }; /* end of audiobus */ +&earc { + status = "okay"; +}; + &pinctrl_periphs { /* audio pin mux */ diff --git a/arch/arm/boot/dts/amlogic/tm2_t962x3_ab301.dts b/arch/arm/boot/dts/amlogic/tm2_t962x3_ab301.dts index 9a4e656..628cb1c 100644 --- a/arch/arm/boot/dts/amlogic/tm2_t962x3_ab301.dts +++ b/arch/arm/boot/dts/amlogic/tm2_t962x3_ab301.dts @@ -1601,38 +1601,6 @@ status = "okay"; }; - earc:earc { - compatible = "amlogic, tm2-snd-earc"; - #sound-dai-cells = <0>; - - clocks = < &clkaudio CLKID_EARCRX_CMDC - &clkaudio CLKID_EARCRX_DMAC - &clkc CLKID_FCLK_DIV5 - &clkc CLKID_FCLK_DIV3 - &clkaudio CLKID_EARCTX_CMDC - &clkaudio CLKID_EARCTX_DMAC - &clkc CLKID_FCLK_DIV5 - &clkc CLKID_FCLK_DIV3 - >; - clock-names = - "rx_cmdc", - "rx_dmac", - "rx_cmdc_srcpll", - "rx_dmac_srcpll", - "tx_cmdc", - "tx_dmac", - "tx_cmdc_srcpll", - "tx_dmac_srcpll"; - - interrupts = < - GIC_SPI 88 IRQ_TYPE_EDGE_RISING - GIC_SPI 87 IRQ_TYPE_EDGE_RISING - >; - interrupt-names = "rx_cmdc", "rx_dmac"; - - status = "okay"; - }; - aed:effect { compatible = "amlogic, snd-effect-v3"; #sound-dai-cells = <0>; @@ -1849,6 +1817,10 @@ }; }; /* end of audiobus */ +&earc { + status = "okay"; +}; + &pinctrl_periphs { /* audio pin mux */ diff --git a/arch/arm/boot/dts/amlogic/tm2_t962x3_ab309.dts b/arch/arm/boot/dts/amlogic/tm2_t962x3_ab309.dts index f147250..03a2c91 100644 --- a/arch/arm/boot/dts/amlogic/tm2_t962x3_ab309.dts +++ b/arch/arm/boot/dts/amlogic/tm2_t962x3_ab309.dts @@ -1521,7 +1521,6 @@ compatible = "amlogic, snd-extn"; #sound-dai-cells = <0>; - interrupts = <GIC_SPI 158 IRQ_TYPE_EDGE_RISING>; interrupt-names = "irq_frhdmirx"; @@ -1529,37 +1528,6 @@ status = "okay"; }; - earc:earc { - compatible = "amlogic, tm2-snd-earc"; - #sound-dai-cells = <0>; - - clocks = < &clkaudio CLKID_EARCRX_CMDC - &clkaudio CLKID_EARCRX_DMAC - &clkc CLKID_FCLK_DIV5 - &clkc CLKID_FCLK_DIV3 - &clkaudio CLKID_EARCTX_CMDC - &clkaudio CLKID_EARCTX_DMAC - &clkc CLKID_FCLK_DIV5 - &clkc CLKID_FCLK_DIV3 - >; - clock-names = - "rx_cmdc", - "rx_dmac", - "rx_cmdc_srcpll", - "rx_dmac_srcpll", - "tx_cmdc", - "tx_dmac", - "tx_cmdc_srcpll", - "tx_dmac_srcpll"; - interrupts = < - GIC_SPI 88 IRQ_TYPE_EDGE_RISING - GIC_SPI 87 IRQ_TYPE_EDGE_RISING - >; - interrupt-names = "rx_cmdc", "rx_dmac"; - - status = "okay"; - }; - aed:effect { compatible = "amlogic, snd-effect-v3"; #sound-dai-cells = <0>; @@ -1776,6 +1744,10 @@ }; }; /* end of audiobus */ +&earc { + status = "okay"; +}; + &pinctrl_periphs { /* audio pin mux */ diff --git a/arch/arm/boot/dts/amlogic/tm2_t962x3_t312.dts b/arch/arm/boot/dts/amlogic/tm2_t962x3_t312.dts index 156201e..488b12b 100644 --- a/arch/arm/boot/dts/amlogic/tm2_t962x3_t312.dts +++ b/arch/arm/boot/dts/amlogic/tm2_t962x3_t312.dts @@ -1582,38 +1582,6 @@ status = "okay"; }; - earc:earc { - compatible = "amlogic, tm2-snd-earc"; - #sound-dai-cells = <0>; - - clocks = < &clkaudio CLKID_EARCRX_CMDC - &clkaudio CLKID_EARCRX_DMAC - &clkc CLKID_FCLK_DIV5 - &clkc CLKID_FCLK_DIV3 - &clkaudio CLKID_EARCTX_CMDC - &clkaudio CLKID_EARCTX_DMAC - &clkc CLKID_FCLK_DIV5 - &clkc CLKID_FCLK_DIV3 - >; - clock-names = - "rx_cmdc", - "rx_dmac", - "rx_cmdc_srcpll", - "rx_dmac_srcpll", - "tx_cmdc", - "tx_dmac", - "tx_cmdc_srcpll", - "tx_dmac_srcpll"; - - interrupts = < - GIC_SPI 88 IRQ_TYPE_EDGE_RISING - GIC_SPI 87 IRQ_TYPE_EDGE_RISING - >; - interrupt-names = "rx_cmdc", "rx_dmac"; - - status = "okay"; - }; - aed:effect { compatible = "amlogic, snd-effect-v3"; #sound-dai-cells = <0>; @@ -1830,6 +1798,10 @@ }; }; /* end of audiobus */ +&earc { + status = "okay"; +}; + &pinctrl_periphs { /* audio pin mux */ diff --git a/arch/arm/boot/dts/amlogic/txlx_t962e_r321.dts b/arch/arm/boot/dts/amlogic/txlx_t962e_r321.dts index 9595a70..d89771a 100644 --- a/arch/arm/boot/dts/amlogic/txlx_t962e_r321.dts +++ b/arch/arm/boot/dts/amlogic/txlx_t962e_r321.dts @@ -221,7 +221,7 @@ reg = <0xff3f0000 0x10000 0xff634540 0x8 0xff634558 0xc - 0xffd01084 0x4>; + 0xffd01008 0x4>; interrupts = <0 8 1 0 9 1>; diff --git a/arch/arm/boot/dts/amlogic/txlx_t962e_r321_buildroot.dts b/arch/arm/boot/dts/amlogic/txlx_t962e_r321_buildroot.dts index b233a7c..c08f69d 100644 --- a/arch/arm/boot/dts/amlogic/txlx_t962e_r321_buildroot.dts +++ b/arch/arm/boot/dts/amlogic/txlx_t962e_r321_buildroot.dts @@ -190,7 +190,7 @@ reg = <0xff3f0000 0x10000 0xff634540 0x8 0xff634558 0xc - 0xffd01084 0x4>; + 0xffd01008 0x4>; interrupts = <0 8 1 0 9 1>; diff --git a/arch/arm/boot/dts/amlogic/txlx_t962x_r311_1g.dts b/arch/arm/boot/dts/amlogic/txlx_t962x_r311_1g.dts index 854ff2b..7f904db 100644 --- a/arch/arm/boot/dts/amlogic/txlx_t962x_r311_1g.dts +++ b/arch/arm/boot/dts/amlogic/txlx_t962x_r311_1g.dts @@ -229,7 +229,7 @@ reg = <0xff3f0000 0x10000 0xff634540 0x8 0xff634558 0xc - 0xffd01084 0x4>; + 0xffd01008 0x4>; interrupts = <0 8 1 0 9 1>; diff --git a/arch/arm/boot/dts/amlogic/txlx_t962x_r311_2g.dts b/arch/arm/boot/dts/amlogic/txlx_t962x_r311_2g.dts index 8dbc397..ea73ed9 100644 --- a/arch/arm/boot/dts/amlogic/txlx_t962x_r311_2g.dts +++ b/arch/arm/boot/dts/amlogic/txlx_t962x_r311_2g.dts @@ -226,7 +226,7 @@ reg = <0xff3f0000 0x10000 0xff634540 0x8 0xff634558 0xc - 0xffd01084 0x4>; + 0xffd01008 0x4>; interrupts = <0 8 1 0 9 1>; diff --git a/arch/arm/boot/dts/amlogic/txlx_t962x_r311_720p.dts b/arch/arm/boot/dts/amlogic/txlx_t962x_r311_720p.dts index 25b4872..04ad8c9 100644 --- a/arch/arm/boot/dts/amlogic/txlx_t962x_r311_720p.dts +++ b/arch/arm/boot/dts/amlogic/txlx_t962x_r311_720p.dts @@ -223,7 +223,7 @@ reg = <0xff3f0000 0x10000 0xff634540 0x8 0xff634558 0xc - 0xffd01084 0x4>; + 0xffd01008 0x4>; interrupts = <0 8 1 0 9 1>; diff --git a/arch/arm/boot/dts/amlogic/txlx_t962x_r314.dts b/arch/arm/boot/dts/amlogic/txlx_t962x_r314.dts index 68165ac..f745e7f 100644 --- a/arch/arm/boot/dts/amlogic/txlx_t962x_r314.dts +++ b/arch/arm/boot/dts/amlogic/txlx_t962x_r314.dts @@ -229,7 +229,7 @@ reg = <0xff3f0000 0x10000 0xff634540 0x8 0xff634558 0xc - 0xffd01084 0x4>; + 0xffd01008 0x4>; interrupts = <0 8 1 0 9 1>; diff --git a/arch/arm/configs/meson64_a32_smarthome_defconfig b/arch/arm/configs/meson64_a32_smarthome_defconfig index 8705513..5731bc5 100644 --- a/arch/arm/configs/meson64_a32_smarthome_defconfig +++ b/arch/arm/configs/meson64_a32_smarthome_defconfig @@ -324,6 +324,7 @@ CONFIG_AMLOGIC_SARADC=y CONFIG_AMLOGIC_DDR_WINDOW_TOOL=m CONFIG_AMLOGIC_LEDRING=y CONFIG_AMLOGIC_GPIO_IRQ=y +CONFIG_AMLOGIC_DEFENDKEY=y CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" CONFIG_DEVTMPFS=y CONFIG_DEVTMPFS_MOUNT=y diff --git a/arch/arm/include/asm/hw_breakpoint.h b/arch/arm/include/asm/hw_breakpoint.h index afcaf8b..704f3ad 100644 --- a/arch/arm/include/asm/hw_breakpoint.h +++ b/arch/arm/include/asm/hw_breakpoint.h @@ -52,6 +52,10 @@ static inline void decode_ctrl_reg(u32 reg, #define ARM_DEBUG_ARCH_V7_MM 4 #define ARM_DEBUG_ARCH_V7_1 5 #define ARM_DEBUG_ARCH_V8 6 +#ifdef CONFIG_AMLOGIC_MODIFY +/* for cortex-a55 */ +#define ARM_DEBUG_ARCH_V8_1 8 +#endif /* Breakpoint */ #define ARM_BREAKPOINT_EXECUTE 0 diff --git a/arch/arm/kernel/hw_breakpoint.c b/arch/arm/kernel/hw_breakpoint.c index bc8f9b1..5026945 100644 --- a/arch/arm/kernel/hw_breakpoint.c +++ b/arch/arm/kernel/hw_breakpoint.c @@ -261,6 +261,9 @@ static int enable_monitor_mode(void) case ARM_DEBUG_ARCH_V7_ECP14: case ARM_DEBUG_ARCH_V7_1: case ARM_DEBUG_ARCH_V8: +#ifdef CONFIG_AMLOGIC_MODIFY + case ARM_DEBUG_ARCH_V8_1: +#endif ARM_DBG_WRITE(c0, c2, 2, (dscr | ARM_DSCR_MDBGEN)); isb(); break; @@ -1041,8 +1044,26 @@ static struct notifier_block dbg_reset_nb = { static int dbg_cpu_pm_notify(struct notifier_block *self, unsigned long action, void *v) { +#ifdef CONFIG_AMLOGIC_MODIFY + struct perf_event *wp, **slots; + int i; + + if (action == CPU_PM_EXIT) { + reset_ctrl_regs(NULL); + /* reinstall already installed wp after exit pm */ + slots = this_cpu_ptr(wp_on_reg); + for (i = 0; i < core_num_wrps; ++i) { + wp = slots[i]; + if (wp) { + slots[i] = NULL; + arch_install_hw_breakpoint(wp); + } + } + } +#else if (action == CPU_PM_EXIT) reset_ctrl_regs(NULL); +#endif return NOTIFY_OK; } diff --git a/arch/arm/kernel/perf_event_v7.c b/arch/arm/kernel/perf_event_v7.c index e3a3ebc..a35b803 100644 --- a/arch/arm/kernel/perf_event_v7.c +++ b/arch/arm/kernel/perf_event_v7.c @@ -612,6 +612,49 @@ ARMV7_EVENT_ATTR(inst_spec, ARMV7_PERFCTR_INSTR_SPEC); ARMV7_EVENT_ATTR(ttbr_write_retired, ARMV7_PERFCTR_TTBR_WRITE); ARMV7_EVENT_ATTR(bus_cycles, ARMV7_PERFCTR_BUS_CYCLES); +#ifdef CONFIG_AMLOGIC_MODIFY +/* a53/a55 common events */ +ARMV7_EVENT_ATTR(a5x_stall_frontend_cache, 0xe1); +ARMV7_EVENT_ATTR(a5x_stall_frontend_tlb, 0xe2); +ARMV7_EVENT_ATTR(a5x_stall_frontend_pderr, 0xe3); +ARMV7_EVENT_ATTR(a5x_stall_backend_ilock_agu, 0xe5); +ARMV7_EVENT_ATTR(a5x_stall_backend_ilock_fpu, 0xe6); +ARMV7_EVENT_ATTR(a5x_stall_backend_ld, 0xe7); +ARMV7_EVENT_ATTR(a5x_stall_backend_st, 0xe8); +ARMV7_EVENT_ATTR(a5x_l2d_cache, 0x16); +ARMV7_EVENT_ATTR(a5x_l2d_cache_refill, 0x17); + +/* a55 events */ +ARMV7_EVENT_ATTR(a55_stall_frontend, 0x23); +ARMV7_EVENT_ATTR(a55_stall_backend, 0x24); +ARMV7_EVENT_ATTR(a55_stall_backend_ilock, 0xe4); +ARMV7_EVENT_ATTR(a55_l1d_cache_refill_inner, 0x44); +ARMV7_EVENT_ATTR(a55_l1d_cache_refill_outer, 0x45); +ARMV7_EVENT_ATTR(a55_l1d_cache_refill_prefetch, 0xc2); +ARMV7_EVENT_ATTR(a55_l2d_cache_refill_prefetch, 0xc1); +ARMV7_EVENT_ATTR(a55_l3d_cache_refill_prefetch, 0xc0); +ARMV7_EVENT_ATTR(a55_stall_backend_ld_cache, 0xe9); +ARMV7_EVENT_ATTR(a55_stall_backend_ld_tlb, 0xea); +ARMV7_EVENT_ATTR(a55_stall_backend_st_stb, 0xeb); +ARMV7_EVENT_ATTR(a55_stall_backend_st_tlb, 0xec); +ARMV7_EVENT_ATTR(a55_l1d_cache_rd, 0x40); +ARMV7_EVENT_ATTR(a55_l1d_cache_wr, 0x41); +ARMV7_EVENT_ATTR(a55_l1d_cache_refill_rd, 0x42); +ARMV7_EVENT_ATTR(a55_l1d_cache_refill_wr, 0x43); +ARMV7_EVENT_ATTR(a55_l2d_cache_rd, 0x50); +ARMV7_EVENT_ATTR(a55_l2d_cache_wr, 0x51); +ARMV7_EVENT_ATTR(a55_l2d_cache_refill_rd, 0x52); +ARMV7_EVENT_ATTR(a55_l2d_cache_refill_wr, 0x53); +ARMV7_EVENT_ATTR(a55_l3d_cache_rd, 0xa0); +ARMV7_EVENT_ATTR(a55_l3d_cache_refill_rd, 0xa2); + +/* a53 events */ +ARMV7_EVENT_ATTR(a53_cache_refill_prefetch, 0xc2); +ARMV7_EVENT_ATTR(a53_scu_snooped, 0xc8); +ARMV7_EVENT_ATTR(a53_stall_backend_st_stb, 0xc7); +ARMV7_EVENT_ATTR(a53_stall_frontend_other, 0xe0); +#endif + static struct attribute *armv7_pmuv2_event_attrs[] = { &armv7_event_attr_sw_incr.attr.attr, &armv7_event_attr_l1i_cache_refill.attr.attr, @@ -643,6 +686,46 @@ static struct attribute *armv7_pmuv2_event_attrs[] = { &armv7_event_attr_inst_spec.attr.attr, &armv7_event_attr_ttbr_write_retired.attr.attr, &armv7_event_attr_bus_cycles.attr.attr, +#ifdef CONFIG_AMLOGIC_MODIFY + /* a55/a53 common events */ + &armv7_event_attr_a5x_stall_frontend_cache.attr.attr, //0xe1 + &armv7_event_attr_a5x_stall_frontend_tlb.attr.attr, //0xe2 + &armv7_event_attr_a5x_stall_frontend_pderr.attr.attr, //0xe3 + &armv7_event_attr_a5x_stall_backend_ilock_agu.attr.attr, //0xe5 + &armv7_event_attr_a5x_stall_backend_ilock_fpu.attr.attr, //0xe6 + &armv7_event_attr_a5x_stall_backend_ld.attr.attr, //0xe7 + &armv7_event_attr_a5x_stall_backend_st.attr.attr, //0xe8 + &armv7_event_attr_a5x_l2d_cache.attr.attr, //0x16 + &armv7_event_attr_a5x_l2d_cache_refill.attr.attr, //0x17 + /* a55 events */ + &armv7_event_attr_a55_stall_frontend.attr.attr, //0x23 + &armv7_event_attr_a55_stall_backend.attr.attr, //0x24 + &armv7_event_attr_a55_stall_backend_ilock.attr.attr, //0xe4 + &armv7_event_attr_a55_stall_backend_ld_cache.attr.attr, //0xe9 + &armv7_event_attr_a55_stall_backend_ld_tlb.attr.attr, //0xea + &armv7_event_attr_a55_stall_backend_st_stb.attr.attr, //0xeb + &armv7_event_attr_a55_stall_backend_st_tlb.attr.attr, //0xec + &armv7_event_attr_a55_l1d_cache_refill_inner.attr.attr, //0x44 + &armv7_event_attr_a55_l1d_cache_refill_outer.attr.attr, //0x45 + &armv7_event_attr_a55_l1d_cache_refill_prefetch.attr.attr, //0xc2 + &armv7_event_attr_a55_l2d_cache_refill_prefetch.attr.attr, //0xc1 + &armv7_event_attr_a55_l3d_cache_refill_prefetch.attr.attr, //0xc0 + &armv7_event_attr_a55_l1d_cache_rd.attr.attr, //0x40 + &armv7_event_attr_a55_l1d_cache_wr.attr.attr, //0x41 + &armv7_event_attr_a55_l1d_cache_refill_rd.attr.attr, //0x42 + &armv7_event_attr_a55_l1d_cache_refill_wr.attr.attr, //0x43 + &armv7_event_attr_a55_l2d_cache_rd.attr.attr, //0x50 + &armv7_event_attr_a55_l2d_cache_wr.attr.attr, //0x51 + &armv7_event_attr_a55_l2d_cache_refill_rd.attr.attr, //0x52 + &armv7_event_attr_a55_l2d_cache_refill_wr.attr.attr, //0x53 + &armv7_event_attr_a55_l3d_cache_rd.attr.attr, //0xa0 + &armv7_event_attr_a55_l3d_cache_refill_rd.attr.attr, //0xa2 + /* a53 events */ + &armv7_event_attr_a53_cache_refill_prefetch.attr.attr, //0xc2 + &armv7_event_attr_a53_scu_snooped.attr.attr, //0xc8 + &armv7_event_attr_a53_stall_backend_st_stb.attr.attr, //0xc7 + &armv7_event_attr_a53_stall_frontend_other.attr.attr, //0xe0 +#endif NULL, }; diff --git a/arch/arm64/boot/dts/amlogic/atom.dts b/arch/arm64/boot/dts/amlogic/atom.dts index 34ba9c2..363642f 100644 --- a/arch/arm64/boot/dts/amlogic/atom.dts +++ b/arch/arm64/boot/dts/amlogic/atom.dts @@ -244,7 +244,7 @@ reg = <0x0 0xff3f0000 0x0 0x10000 0x0 0xff634540 0x0 0x8 0x0 0xff634558 0x0 0xc - 0x0 0xffd01084 0x0 0x4>; + 0x0 0xffd01008 0x0 0x4>; interrupts = <0 8 1 0 9 1>; diff --git a/arch/arm64/boot/dts/amlogic/axg_a113d_skt.dts b/arch/arm64/boot/dts/amlogic/axg_a113d_skt.dts index b49cb62..3cbf2c4 100644 --- a/arch/arm64/boot/dts/amlogic/axg_a113d_skt.dts +++ b/arch/arm64/boot/dts/amlogic/axg_a113d_skt.dts @@ -160,7 +160,9 @@ compatible = "amlogic, gxbb-eth-dwmac"; status = "disable"; reg = <0x0 0xff3f0000 0x0 0x10000 - 0x0 0xff634540 0x0 0x8>; + 0x0 0xff634540 0x0 0x8 + 0x0 0xff634558 0x0 0xc + 0x0 0xffd01008 0x0 0x4>; interrupts = <0 8 1>; pinctrl-names = "external_eth_pins"; pinctrl-0 = <&external_eth_pins>; diff --git a/arch/arm64/boot/dts/amlogic/axg_s400.dts b/arch/arm64/boot/dts/amlogic/axg_s400.dts index bf6c537..203fcef 100644 --- a/arch/arm64/boot/dts/amlogic/axg_s400.dts +++ b/arch/arm64/boot/dts/amlogic/axg_s400.dts @@ -170,7 +170,9 @@ ethmac: ethernet@0xff3f0000 { compatible = "amlogic, gxbb-eth-dwmac"; reg = <0x0 0xff3f0000 0x0 0x10000 - 0x0 0xff634540 0x0 0x8>; + 0x0 0xff634540 0x0 0x8 + 0x0 0xff634558 0x0 0xc + 0x0 0xffd01008 0x0 0x4>; interrupts = <0 8 1>; pinctrl-names = "external_eth_pins"; pinctrl-0 = <&external_eth_pins>; diff --git a/arch/arm64/boot/dts/amlogic/axg_s400_v03.dts b/arch/arm64/boot/dts/amlogic/axg_s400_v03.dts index 6cf5026..d6d9a5f 100644 --- a/arch/arm64/boot/dts/amlogic/axg_s400_v03.dts +++ b/arch/arm64/boot/dts/amlogic/axg_s400_v03.dts @@ -170,7 +170,9 @@ ethmac: ethernet@0xff3f0000 { compatible = "amlogic, gxbb-eth-dwmac"; reg = <0x0 0xff3f0000 0x0 0x10000 - 0x0 0xff634540 0x0 0x8>; + 0x0 0xff634540 0x0 0x8 + 0x0 0xff634558 0x0 0xc + 0x0 0xffd01008 0x0 0x4>; interrupts = <0 8 1>; pinctrl-names = "external_eth_pins"; pinctrl-0 = <&external_eth_pins>; diff --git a/arch/arm64/boot/dts/amlogic/axg_s400_v03gva.dts b/arch/arm64/boot/dts/amlogic/axg_s400_v03gva.dts index 0dda975..8e0ea1c 100644 --- a/arch/arm64/boot/dts/amlogic/axg_s400_v03gva.dts +++ b/arch/arm64/boot/dts/amlogic/axg_s400_v03gva.dts @@ -166,7 +166,9 @@ ethmac: ethernet@0xff3f0000 { compatible = "amlogic, gxbb-eth-dwmac"; reg = <0x0 0xff3f0000 0x0 0x10000 - 0x0 0xff634540 0x0 0x8>; + 0x0 0xff634540 0x0 0x8 + 0x0 0xff634558 0x0 0xc + 0x0 0xffd01008 0x0 0x4>; interrupts = <0 8 1>; pinctrl-names = "external_eth_pins"; pinctrl-0 = <&external_eth_pins>; diff --git a/arch/arm64/boot/dts/amlogic/axg_s400_v03gva_sbr.dts b/arch/arm64/boot/dts/amlogic/axg_s400_v03gva_sbr.dts index fc764d8..1220281 100644 --- a/arch/arm64/boot/dts/amlogic/axg_s400_v03gva_sbr.dts +++ b/arch/arm64/boot/dts/amlogic/axg_s400_v03gva_sbr.dts @@ -166,7 +166,9 @@ ethmac: ethernet@0xff3f0000 { compatible = "amlogic, gxbb-eth-dwmac"; reg = <0x0 0xff3f0000 0x0 0x10000 - 0x0 0xff634540 0x0 0x8>; + 0x0 0xff634540 0x0 0x8 + 0x0 0xff634558 0x0 0xc + 0x0 0xffd01008 0x0 0x4>; interrupts = <0 8 1>; pinctrl-names = "external_eth_pins"; pinctrl-0 = <&external_eth_pins>; diff --git a/arch/arm64/boot/dts/amlogic/axg_s400_v03sbr.dts b/arch/arm64/boot/dts/amlogic/axg_s400_v03sbr.dts index ed16bf5..53612e4 100644 --- a/arch/arm64/boot/dts/amlogic/axg_s400_v03sbr.dts +++ b/arch/arm64/boot/dts/amlogic/axg_s400_v03sbr.dts @@ -170,7 +170,9 @@ ethmac: ethernet@0xff3f0000 { compatible = "amlogic, gxbb-eth-dwmac"; reg = <0x0 0xff3f0000 0x0 0x10000 - 0x0 0xff634540 0x0 0x8>; + 0x0 0xff634540 0x0 0x8 + 0x0 0xff634558 0x0 0xc + 0x0 0xffd01008 0x0 0x4>; interrupts = <0 8 1>; pinctrl-names = "external_eth_pins"; pinctrl-0 = <&external_eth_pins>; diff --git a/arch/arm64/boot/dts/amlogic/axg_s400emmc_512m.dts b/arch/arm64/boot/dts/amlogic/axg_s400emmc_512m.dts index c21e8ed..031618b 100644 --- a/arch/arm64/boot/dts/amlogic/axg_s400emmc_512m.dts +++ b/arch/arm64/boot/dts/amlogic/axg_s400emmc_512m.dts @@ -179,7 +179,9 @@ ethmac: ethernet@0xff3f0000 { compatible = "amlogic, gxbb-eth-dwmac"; reg = <0x0 0xff3f0000 0x0 0x10000 - 0x0 0xff634540 0x0 0x8>; + 0x0 0xff634540 0x0 0x8 + 0x0 0xff634558 0x0 0xc + 0x0 0xffd01008 0x0 0x4>; interrupts = <0 8 1>; pinctrl-names = "external_eth_pins"; pinctrl-0 = <&external_eth_pins>; diff --git a/arch/arm64/boot/dts/amlogic/axg_s410.dts b/arch/arm64/boot/dts/amlogic/axg_s410.dts index 00da043..517acb0 100644 --- a/arch/arm64/boot/dts/amlogic/axg_s410.dts +++ b/arch/arm64/boot/dts/amlogic/axg_s410.dts @@ -160,7 +160,9 @@ ethmac: ethernet@0xff3f0000 { compatible = "amlogic, gxbb-eth-dwmac"; reg = <0x0 0xff3f0000 0x0 0x10000 - 0x0 0xff634540 0x0 0x8>; + 0x0 0xff634540 0x0 0x8 + 0x0 0xff634558 0x0 0xc + 0x0 0xffd01008 0x0 0x4>; interrupts = <0 8 1>; pinctrl-names = "external_eth_pins"; pinctrl-0 = <&external_eth_pins>; diff --git a/arch/arm64/boot/dts/amlogic/axg_s410_v03.dts b/arch/arm64/boot/dts/amlogic/axg_s410_v03.dts index 4ddfb1a..4984cf6 100644 --- a/arch/arm64/boot/dts/amlogic/axg_s410_v03.dts +++ b/arch/arm64/boot/dts/amlogic/axg_s410_v03.dts @@ -162,7 +162,9 @@ ethmac: ethernet@0xff3f0000 { compatible = "amlogic, gxbb-eth-dwmac"; reg = <0x0 0xff3f0000 0x0 0x10000 - 0x0 0xff634540 0x0 0x8>; + 0x0 0xff634540 0x0 0x8 + 0x0 0xff634558 0x0 0xc + 0x0 0xffd01008 0x0 0x4>; interrupts = <0 8 1>; pinctrl-names = "external_eth_pins"; pinctrl-0 = <&external_eth_pins>; diff --git a/arch/arm64/boot/dts/amlogic/gxl_p212_1g.dts b/arch/arm64/boot/dts/amlogic/gxl_p212_1g.dts index bf30067..8cca125 100644 --- a/arch/arm64/boot/dts/amlogic/gxl_p212_1g.dts +++ b/arch/arm64/boot/dts/amlogic/gxl_p212_1g.dts @@ -406,7 +406,8 @@ compatible = "amlogic, gxbb-eth-dwmac"; reg = <0x0 0xc9410000 0x0 0x10000 0x0 0xc8834540 0x0 0x8 - 0x0 0xc8834558 0x0 0xc>; + 0x0 0xc8834558 0x0 0xc + 0x0 0xc1104408 0x0 0x4>; interrupts = <0 8 1>; pinctrl-names = "external_eth_pins"; pinctrl-0 = <&external_eth_pins>; diff --git a/arch/arm64/boot/dts/amlogic/gxl_p212_1g_buildroot.dts b/arch/arm64/boot/dts/amlogic/gxl_p212_1g_buildroot.dts index c55cb7f..1ecb305 100644 --- a/arch/arm64/boot/dts/amlogic/gxl_p212_1g_buildroot.dts +++ b/arch/arm64/boot/dts/amlogic/gxl_p212_1g_buildroot.dts @@ -378,7 +378,8 @@ compatible = "amlogic, gxbb-eth-dwmac"; reg = <0x0 0xc9410000 0x0 0x10000 0x0 0xc8834540 0x0 0x8 - 0x0 0xc8834558 0x0 0xc>; + 0x0 0xc8834558 0x0 0xc + 0x0 0xc1104408 0x0 0x4>; interrupts = <0 8 1>; pinctrl-names = "external_eth_pins"; pinctrl-0 = <&external_eth_pins>; diff --git a/arch/arm64/boot/dts/amlogic/gxl_p212_1g_hd.dts b/arch/arm64/boot/dts/amlogic/gxl_p212_1g_hd.dts index 0ae1001..27f6142 100644 --- a/arch/arm64/boot/dts/amlogic/gxl_p212_1g_hd.dts +++ b/arch/arm64/boot/dts/amlogic/gxl_p212_1g_hd.dts @@ -389,7 +389,8 @@ compatible = "amlogic, gxbb-eth-dwmac"; reg = <0x0 0xc9410000 0x0 0x10000 0x0 0xc8834540 0x0 0x8 - 0x0 0xc8834558 0x0 0xc>; + 0x0 0xc8834558 0x0 0xc + 0x0 0xc1104408 0x0 0x4>; interrupts = <0 8 1>; pinctrl-names = "external_eth_pins"; pinctrl-0 = <&external_eth_pins>; diff --git a/arch/arm64/boot/dts/amlogic/gxl_p212_2g.dts b/arch/arm64/boot/dts/amlogic/gxl_p212_2g.dts index f6f657c..e7354f7 100644 --- a/arch/arm64/boot/dts/amlogic/gxl_p212_2g.dts +++ b/arch/arm64/boot/dts/amlogic/gxl_p212_2g.dts @@ -407,7 +407,8 @@ compatible = "amlogic, gxbb-eth-dwmac"; reg = <0x0 0xc9410000 0x0 0x10000 0x0 0xc8834540 0x0 0x8 - 0x0 0xc8834558 0x0 0xc>; + 0x0 0xc8834558 0x0 0xc + 0x0 0xc1104408 0x0 0x4>; interrupts = <0 8 1>; pinctrl-names = "external_eth_pins"; pinctrl-0 = <&external_eth_pins>; diff --git a/arch/arm64/boot/dts/amlogic/gxl_p212_2g_buildroot.dts b/arch/arm64/boot/dts/amlogic/gxl_p212_2g_buildroot.dts index e36ed5e..0f76f4e 100644 --- a/arch/arm64/boot/dts/amlogic/gxl_p212_2g_buildroot.dts +++ b/arch/arm64/boot/dts/amlogic/gxl_p212_2g_buildroot.dts @@ -387,7 +387,8 @@ compatible = "amlogic, gxbb-eth-dwmac"; reg = <0x0 0xc9410000 0x0 0x10000 0x0 0xc8834540 0x0 0x8 - 0x0 0xc8834558 0x0 0xc>; + 0x0 0xc8834558 0x0 0xc + 0x0 0xc1104408 0x0 0x4>; interrupts = <0 8 1>; pinctrl-names = "external_eth_pins"; pinctrl-0 = <&external_eth_pins>; diff --git a/arch/arm64/boot/dts/amlogic/gxl_p212_2g_drm_buildroot.dts b/arch/arm64/boot/dts/amlogic/gxl_p212_2g_drm_buildroot.dts index d84762b..bebe846 100644 --- a/arch/arm64/boot/dts/amlogic/gxl_p212_2g_drm_buildroot.dts +++ b/arch/arm64/boot/dts/amlogic/gxl_p212_2g_drm_buildroot.dts @@ -387,7 +387,8 @@ compatible = "amlogic, gxbb-eth-dwmac"; reg = <0x0 0xc9410000 0x0 0x10000 0x0 0xc8834540 0x0 0x8 - 0x0 0xc8834558 0x0 0xc>; + 0x0 0xc8834558 0x0 0xc + 0x0 0xc1104408 0x0 0x4>; interrupts = <0 8 1>; pinctrl-names = "external_eth_pins"; pinctrl-0 = <&external_eth_pins>; diff --git a/arch/arm64/boot/dts/amlogic/gxl_p230_2g.dts b/arch/arm64/boot/dts/amlogic/gxl_p230_2g.dts index 1444c1a..65b9e44 100644 --- a/arch/arm64/boot/dts/amlogic/gxl_p230_2g.dts +++ b/arch/arm64/boot/dts/amlogic/gxl_p230_2g.dts @@ -394,7 +394,8 @@ compatible = "amlogic, gxbb-eth-dwmac"; reg = <0x0 0xc9410000 0x0 0x10000 0x0 0xc8834540 0x0 0x8 - 0x0 0xc8834558 0x0 0xc>; + 0x0 0xc8834558 0x0 0xc + 0x0 0xc1104408 0x0 0x4>; interrupts = <0 8 1>; pinctrl-names = "external_eth_pins"; pinctrl-0 = <&external_eth_pins>; diff --git a/arch/arm64/boot/dts/amlogic/gxl_p230_2g_buildroot.dts b/arch/arm64/boot/dts/amlogic/gxl_p230_2g_buildroot.dts index 264d6fe..d2e677a 100644 --- a/arch/arm64/boot/dts/amlogic/gxl_p230_2g_buildroot.dts +++ b/arch/arm64/boot/dts/amlogic/gxl_p230_2g_buildroot.dts @@ -394,7 +394,8 @@ compatible = "amlogic, gxbb-eth-dwmac"; reg = <0x0 0xc9410000 0x0 0x10000 0x0 0xc8834540 0x0 0x8 - 0x0 0xc8834558 0x0 0xc>; + 0x0 0xc8834558 0x0 0xc + 0x0 0xc1104408 0x0 0x4>; interrupts = <0 8 1>; pinctrl-names = "external_eth_pins"; pinctrl-0 = <&external_eth_pins>; diff --git a/arch/arm64/boot/dts/amlogic/gxl_p231_1g.dts b/arch/arm64/boot/dts/amlogic/gxl_p231_1g.dts index 482e418..d3ac6f0 100644 --- a/arch/arm64/boot/dts/amlogic/gxl_p231_1g.dts +++ b/arch/arm64/boot/dts/amlogic/gxl_p231_1g.dts @@ -337,7 +337,8 @@ compatible = "amlogic, gxbb-eth-dwmac"; reg = <0x0 0xc9410000 0x0 0x10000 0x0 0xc8834540 0x0 0x8 - 0x0 0xc8834558 0x0 0xc>; + 0x0 0xc8834558 0x0 0xc + 0x0 0xc1104408 0x0 0x4>; interrupts = <0 8 1>; pinctrl-names = "external_eth_pins"; pinctrl-0 = <&external_eth_pins>; diff --git a/arch/arm64/boot/dts/amlogic/gxl_p231_2g.dts b/arch/arm64/boot/dts/amlogic/gxl_p231_2g.dts index e08cbd8..282ea43 100644 --- a/arch/arm64/boot/dts/amlogic/gxl_p231_2g.dts +++ b/arch/arm64/boot/dts/amlogic/gxl_p231_2g.dts @@ -337,7 +337,8 @@ compatible = "amlogic, gxbb-eth-dwmac"; reg = <0x0 0xc9410000 0x0 0x10000 0x0 0xc8834540 0x0 0x8 - 0x0 0xc8834558 0x0 0xc>; + 0x0 0xc8834558 0x0 0xc + 0x0 0xc1104408 0x0 0x4>; interrupts = <0 8 1>; pinctrl-names = "external_eth_pins"; pinctrl-0 = <&external_eth_pins>; diff --git a/arch/arm64/boot/dts/amlogic/gxl_p231_2g_buildroot.dts b/arch/arm64/boot/dts/amlogic/gxl_p231_2g_buildroot.dts index c8e95a0..160e61e 100644 --- a/arch/arm64/boot/dts/amlogic/gxl_p231_2g_buildroot.dts +++ b/arch/arm64/boot/dts/amlogic/gxl_p231_2g_buildroot.dts @@ -327,7 +327,8 @@ compatible = "amlogic, gxbb-eth-dwmac"; reg = <0x0 0xc9410000 0x0 0x10000 0x0 0xc8834540 0x0 0x8 - 0x0 0xc8834558 0x0 0xc>; + 0x0 0xc8834558 0x0 0xc + 0x0 0xc1104408 0x0 0x4>; interrupts = <0 8 1>; pinctrl-names = "external_eth_pins"; pinctrl-0 = <&external_eth_pins>; diff --git a/arch/arm64/boot/dts/amlogic/gxl_p241_1g.dts b/arch/arm64/boot/dts/amlogic/gxl_p241_1g.dts index 4881fc3..f3737e9 100644 --- a/arch/arm64/boot/dts/amlogic/gxl_p241_1g.dts +++ b/arch/arm64/boot/dts/amlogic/gxl_p241_1g.dts @@ -470,7 +470,8 @@ compatible = "amlogic, gxbb-eth-dwmac"; reg = <0x0 0xc9410000 0x0 0x10000 0x0 0xc8834540 0x0 0x8 - 0x0 0xc8834558 0x0 0xc>; + 0x0 0xc8834558 0x0 0xc + 0x0 0xc1104408 0x0 0x4>; interrupts = <0 8 1>; pinctrl-names = "external_eth_pins"; pinctrl-0 = <&external_eth_pins>; diff --git a/arch/arm64/boot/dts/amlogic/gxl_p241_1g_buildroot.dts b/arch/arm64/boot/dts/amlogic/gxl_p241_1g_buildroot.dts index 808726c..4d28be7 100644 --- a/arch/arm64/boot/dts/amlogic/gxl_p241_1g_buildroot.dts +++ b/arch/arm64/boot/dts/amlogic/gxl_p241_1g_buildroot.dts @@ -458,7 +458,8 @@ compatible = "amlogic, gxbb-eth-dwmac"; reg = <0x0 0xc9410000 0x0 0x10000 0x0 0xc8834540 0x0 0x8 - 0x0 0xc8834558 0x0 0xc>; + 0x0 0xc8834558 0x0 0xc + 0x0 0xc1104408 0x0 0x4>; interrupts = <0 8 1>; pinctrl-names = "external_eth_pins"; pinctrl-0 = <&external_eth_pins>; diff --git a/arch/arm64/boot/dts/amlogic/gxl_p241_v2-1g.dts b/arch/arm64/boot/dts/amlogic/gxl_p241_v2-1g.dts index d566dc7..6715bbd 100644 --- a/arch/arm64/boot/dts/amlogic/gxl_p241_v2-1g.dts +++ b/arch/arm64/boot/dts/amlogic/gxl_p241_v2-1g.dts @@ -471,7 +471,8 @@ compatible = "amlogic, gxbb-eth-dwmac"; reg = <0x0 0xc9410000 0x0 0x10000 0x0 0xc8834540 0x0 0x8 - 0x0 0xc8834558 0x0 0xc>; + 0x0 0xc8834558 0x0 0xc + 0x0 0xc1104408 0x0 0x4>; interrupts = <0 8 1>; pinctrl-names = "external_eth_pins"; pinctrl-0 = <&external_eth_pins>; diff --git a/arch/arm64/boot/dts/amlogic/gxl_p241_v2_1g_buildroot.dts b/arch/arm64/boot/dts/amlogic/gxl_p241_v2_1g_buildroot.dts index 3c0c432..2af5de5 100644 --- a/arch/arm64/boot/dts/amlogic/gxl_p241_v2_1g_buildroot.dts +++ b/arch/arm64/boot/dts/amlogic/gxl_p241_v2_1g_buildroot.dts @@ -457,7 +457,8 @@ compatible = "amlogic, gxbb-eth-dwmac"; reg = <0x0 0xc9410000 0x0 0x10000 0x0 0xc8834540 0x0 0x8 - 0x0 0xc8834558 0x0 0xc>; + 0x0 0xc8834558 0x0 0xc + 0x0 0xc1104408 0x0 0x4>; interrupts = <0 8 1>; pinctrl-names = "external_eth_pins"; pinctrl-0 = <&external_eth_pins>; diff --git a/arch/arm64/boot/dts/amlogic/gxl_p281_1g.dts b/arch/arm64/boot/dts/amlogic/gxl_p281_1g.dts index f76a869..e17e8c3 100644 --- a/arch/arm64/boot/dts/amlogic/gxl_p281_1g.dts +++ b/arch/arm64/boot/dts/amlogic/gxl_p281_1g.dts @@ -399,7 +399,8 @@ compatible = "amlogic, gxbb-eth-dwmac"; reg = <0x0 0xc9410000 0x0 0x10000 0x0 0xc8834540 0x0 0x8 - 0x0 0xc8834558 0x0 0xc>; + 0x0 0xc8834558 0x0 0xc + 0x0 0xc1104408 0x0 0x4>; interrupts = <0 8 1>; pinctrl-names = "external_eth_pins"; pinctrl-0 = <&external_eth_pins>; diff --git a/arch/arm64/boot/dts/amlogic/gxl_p281_2g.dts b/arch/arm64/boot/dts/amlogic/gxl_p281_2g.dts index 60015a4..e587fa2 100644 --- a/arch/arm64/boot/dts/amlogic/gxl_p281_2g.dts +++ b/arch/arm64/boot/dts/amlogic/gxl_p281_2g.dts @@ -407,7 +407,8 @@ compatible = "amlogic, gxbb-eth-dwmac"; reg = <0x0 0xc9410000 0x0 0x10000 0x0 0xc8834540 0x0 0x8 - 0x0 0xc8834558 0x0 0xc>; + 0x0 0xc8834558 0x0 0xc + 0x0 0xc1104408 0x0 0x4>; interrupts = <0 8 1>; pinctrl-names = "external_eth_pins"; pinctrl-0 = <&external_eth_pins>; diff --git a/arch/arm64/boot/dts/amlogic/gxl_p400_2g.dts b/arch/arm64/boot/dts/amlogic/gxl_p400_2g.dts index 52e9826..a0d4fbf 100644 --- a/arch/arm64/boot/dts/amlogic/gxl_p400_2g.dts +++ b/arch/arm64/boot/dts/amlogic/gxl_p400_2g.dts @@ -256,7 +256,8 @@ compatible = "amlogic, gxbb-eth-dwmac"; reg = <0x0 0xc9410000 0x0 0x10000 0x0 0xc8834540 0x0 0x8 - 0x0 0xc8834558 0x0 0xc>; + 0x0 0xc8834558 0x0 0xc + 0x0 0xc1104408 0x0 0x4>; interrupts = <0 8 1>; pinctrl-names = "external_eth_pins"; pinctrl-0 = <&external_eth_pins>; diff --git a/arch/arm64/boot/dts/amlogic/gxl_p401_2g.dts b/arch/arm64/boot/dts/amlogic/gxl_p401_2g.dts index 1ecf233..5b002f8 100644 --- a/arch/arm64/boot/dts/amlogic/gxl_p401_2g.dts +++ b/arch/arm64/boot/dts/amlogic/gxl_p401_2g.dts @@ -344,7 +344,8 @@ compatible = "amlogic, gxbb-eth-dwmac"; reg = <0x0 0xc9410000 0x0 0x10000 0x0 0xc8834540 0x0 0x8 - 0x0 0xc8834558 0x0 0xc>; + 0x0 0xc8834558 0x0 0xc + 0x0 0xc1104408 0x0 0x4>; interrupts = <0 8 1>; pinctrl-names = "external_eth_pins"; pinctrl-0 = <&external_eth_pins>; diff --git a/arch/arm64/boot/dts/amlogic/gxl_sei210_1g.dts b/arch/arm64/boot/dts/amlogic/gxl_sei210_1g.dts index 916f139..7446f36 100644 --- a/arch/arm64/boot/dts/amlogic/gxl_sei210_1g.dts +++ b/arch/arm64/boot/dts/amlogic/gxl_sei210_1g.dts @@ -389,7 +389,8 @@ compatible = "amlogic, gxbb-eth-dwmac"; reg = <0x0 0xc9410000 0x0 0x10000 0x0 0xc8834540 0x0 0x8 - 0x0 0xc8834558 0x0 0xc>; + 0x0 0xc8834558 0x0 0xc + 0x0 0xc1104408 0x0 0x4>; interrupts = <0 8 1>; pinctrl-names = "external_eth_pins"; pinctrl-0 = <&external_eth_pins>; diff --git a/arch/arm64/boot/dts/amlogic/gxl_sei210_2g.dts b/arch/arm64/boot/dts/amlogic/gxl_sei210_2g.dts index 8508758..ddd45d5 100644 --- a/arch/arm64/boot/dts/amlogic/gxl_sei210_2g.dts +++ b/arch/arm64/boot/dts/amlogic/gxl_sei210_2g.dts @@ -398,7 +398,8 @@ compatible = "amlogic, gxbb-eth-dwmac"; reg = <0x0 0xc9410000 0x0 0x10000 0x0 0xc8834540 0x0 0x8 - 0x0 0xc8834558 0x0 0xc>; + 0x0 0xc8834558 0x0 0xc + 0x0 0xc1104408 0x0 0x4>; interrupts = <0 8 1>; pinctrl-names = "external_eth_pins"; pinctrl-0 = <&external_eth_pins>; diff --git a/arch/arm64/boot/dts/amlogic/gxl_skt.dts b/arch/arm64/boot/dts/amlogic/gxl_skt.dts index b781051..2976a90 100644 --- a/arch/arm64/boot/dts/amlogic/gxl_skt.dts +++ b/arch/arm64/boot/dts/amlogic/gxl_skt.dts @@ -399,7 +399,8 @@ compatible = "amlogic, gxbb-eth-dwmac"; reg = <0x0 0xc9410000 0x0 0x10000 0x0 0xc8834540 0x0 0x8 - 0x0 0xc8834558 0x0 0xc>; + 0x0 0xc8834558 0x0 0xc + 0x0 0xc1104408 0x0 0x4>; interrupts = <0 8 1>; pinctrl-names = "external_eth_pins"; pinctrl-0 = <&external_eth_pins>; diff --git a/arch/arm64/boot/dts/amlogic/gxm_q200_2g.dts b/arch/arm64/boot/dts/amlogic/gxm_q200_2g.dts index 1fe4844..9fc1602 100644 --- a/arch/arm64/boot/dts/amlogic/gxm_q200_2g.dts +++ b/arch/arm64/boot/dts/amlogic/gxm_q200_2g.dts @@ -389,7 +389,8 @@ compatible = "amlogic, gxbb-eth-dwmac"; reg = <0x0 0xc9410000 0x0 0x10000 0x0 0xc8834540 0x0 0x8 - 0x0 0xc8834558 0x0 0xc>; + 0x0 0xc8834558 0x0 0xc + 0x0 0xc1104408 0x0 0x4>; interrupts = <0 8 1>; pinctrl-names = "external_eth_pins"; pinctrl-0 = <&external_eth_pins>; diff --git a/arch/arm64/boot/dts/amlogic/gxm_q200_2g_buildroot.dts b/arch/arm64/boot/dts/amlogic/gxm_q200_2g_buildroot.dts index 4f1917b..aa0e867 100644 --- a/arch/arm64/boot/dts/amlogic/gxm_q200_2g_buildroot.dts +++ b/arch/arm64/boot/dts/amlogic/gxm_q200_2g_buildroot.dts @@ -393,7 +393,8 @@ compatible = "amlogic, gxbb-eth-dwmac"; reg = <0x0 0xc9410000 0x0 0x10000 0x0 0xc8834540 0x0 0x8 - 0x0 0xc8834558 0x0 0xc>; + 0x0 0xc8834558 0x0 0xc + 0x0 0xc1104408 0x0 0x4>; interrupts = <0 8 1>; pinctrl-names = "external_eth_pins"; pinctrl-0 = <&external_eth_pins>; diff --git a/arch/arm64/boot/dts/amlogic/gxm_q201_1g.dts b/arch/arm64/boot/dts/amlogic/gxm_q201_1g.dts index 894e4c7..f5ca9b1 100644 --- a/arch/arm64/boot/dts/amlogic/gxm_q201_1g.dts +++ b/arch/arm64/boot/dts/amlogic/gxm_q201_1g.dts @@ -395,7 +395,8 @@ compatible = "amlogic, gxbb-eth-dwmac"; reg = <0x0 0xc9410000 0x0 0x10000 0x0 0xc8834540 0x0 0x8 - 0x0 0xc8834558 0x0 0xc>; + 0x0 0xc8834558 0x0 0xc + 0x0 0xc1104408 0x0 0x4>; interrupts = <0 8 1>; pinctrl-names = "external_eth_pins"; pinctrl-0 = <&external_eth_pins>; diff --git a/arch/arm64/boot/dts/amlogic/gxm_q201_2g.dts b/arch/arm64/boot/dts/amlogic/gxm_q201_2g.dts index ce33181..f3e9654 100644 --- a/arch/arm64/boot/dts/amlogic/gxm_q201_2g.dts +++ b/arch/arm64/boot/dts/amlogic/gxm_q201_2g.dts @@ -397,7 +397,8 @@ compatible = "amlogic, gxbb-eth-dwmac"; reg = <0x0 0xc9410000 0x0 0x10000 0x0 0xc8834540 0x0 0x8 - 0x0 0xc8834558 0x0 0xc>; + 0x0 0xc8834558 0x0 0xc + 0x0 0xc1104408 0x0 0x4>; interrupts = <0 8 1>; pinctrl-names = "external_eth_pins"; pinctrl-0 = <&external_eth_pins>; diff --git a/arch/arm64/boot/dts/amlogic/mesonaxg.dtsi b/arch/arm64/boot/dts/amlogic/mesonaxg.dtsi index 96b7622..685af23 100644 --- a/arch/arm64/boot/dts/amlogic/mesonaxg.dtsi +++ b/arch/arm64/boot/dts/amlogic/mesonaxg.dtsi @@ -831,6 +831,12 @@ cpu_ver_name{ compatible = "amlogic, cpu-major-id-axg"; }; + + defendkey: defendkey { + compatible = "amlogic, defendkey"; + mem_size = <0x0 0x100000>; + status = "okay"; + }; };/* end of / */ &pinctrl_aobus { diff --git a/arch/arm64/boot/dts/amlogic/mesonsm1.dtsi b/arch/arm64/boot/dts/amlogic/mesonsm1.dtsi index 56b4b35..b765723 100644 --- a/arch/arm64/boot/dts/amlogic/mesonsm1.dtsi +++ b/arch/arm64/boot/dts/amlogic/mesonsm1.dtsi @@ -800,10 +800,10 @@ audiobus: audiobus@0xFF660000 { compatible = "amlogic, audio-controller", "simple-bus"; - reg = <0x0 0xFF660000 0x0 0x4000>; + reg = <0x0 0xFF660000 0x0 0x3000>; #address-cells = <2>; #size-cells = <2>; - ranges = <0x0 0x0 0x0 0xFF660000 0x0 0x4000>; + ranges = <0x0 0x0 0x0 0xFF660000 0x0 0x3000>; clkaudio: audio_clocks { compatible = "amlogic, sm1-audio-clocks"; #clock-cells = <1>; @@ -829,6 +829,76 @@ }; };/* end of audiobus*/ + /* eARC */ + audio_earc: bus@ff663000 { + compatible = "simple-bus"; + reg = <0x0 0xff663000 0x0 0x1000>; + #address-cells = <2>; + #size-cells = <2>; + ranges = <0x0 0x0 0x0 0xff663000 0x0 0x1000>; + + earc: earc@0 { + compatible = "amlogic, sm1-snd-earc"; + #sound-dai-cells = <0>; + + status = "disabled"; + + reg = + <0x0 0x800 0x0 0x400>, + <0x0 0xc00 0x0 0x200>, + <0x0 0xe00 0x0 0x200>; + reg-names = + "rx_cmdc", + "rx_dmac", + "rx_top"; + + clocks = < &clkaudio CLKID_EARCRX_CMDC + &clkaudio CLKID_EARCRX_DMAC + &clkc CLKID_FCLK_DIV4 + &clkc CLKID_FCLK_DIV4 + &clkaudio CLKID_EARCTX_CMDC + &clkaudio CLKID_EARCTX_DMAC + &clkc CLKID_FCLK_DIV4 + &clkc CLKID_MPLL1 + >; + clock-names = + "rx_cmdc", + "rx_dmac", + "rx_cmdc_srcpll", + "rx_dmac_srcpll"; + + interrupts = < + GIC_SPI 87 IRQ_TYPE_LEVEL_HIGH>; + interrupt-names = "earc_rx"; + }; + }; + + /* Sound iomap */ + aml_snd_iomap { + compatible = "amlogic, snd-iomap"; + status = "okay"; + #address-cells=<2>; + #size-cells=<2>; + ranges; + pdm_bus { + reg = <0x0 0xFF661000 0x0 0x400>; + }; + audiobus_base { + reg = <0x0 0xFF660000 0x0 0x1000>; + }; + audiolocker_base { + reg = <0x0 0xFF661400 0x0 0x400>; + }; + eqdrc_base { + reg = <0x0 0xFF662000 0x0 0x1000>; + }; + reset_base { + reg = <0x0 0xFFD01000 0x0 0x1000>; + }; + vad_base { + reg = <0x0 0xFF661800 0x0 0x400>; + }; + }; }; /* end of soc*/ remote:rc@0xff808040 { @@ -1540,42 +1610,6 @@ /*partions defined in dts */ }; - /* Sound iomap */ - aml_snd_iomap { - compatible = "amlogic, snd-iomap"; - status = "okay"; - #address-cells=<2>; - #size-cells=<2>; - ranges; - pdm_bus { - reg = <0x0 0xFF661000 0x0 0x400>; - }; - audiobus_base { - reg = <0x0 0xFF660000 0x0 0x1000>; - }; - audiolocker_base { - reg = <0x0 0xFF661400 0x0 0x400>; - }; - eqdrc_base { - reg = <0x0 0xFF662000 0x0 0x1000>; - }; - reset_base { - reg = <0x0 0xFFD01000 0x0 0x1000>; - }; - vad_base { - reg = <0x0 0xFF661800 0x0 0x400>; - }; - earcrx_cdmc_base { - reg = <0x0 0xFF663800 0x0 0x30>; - }; - earcrx_dmac_base { - reg = <0x0 0xFF663C00 0x0 0x20>; - }; - earcrx_top_base { - reg = <0x0 0xFF663E00 0x0 0x10>; - }; - }; - vddcpu0: pwmao_d-regulator { compatible = "pwm-regulator"; pwms = <&pwm_AO_cd MESON_PWM_1 1500 0>; diff --git a/arch/arm64/boot/dts/amlogic/mesontl1.dtsi b/arch/arm64/boot/dts/amlogic/mesontl1.dtsi index 2d02cdd..07d5952 100644 --- a/arch/arm64/boot/dts/amlogic/mesontl1.dtsi +++ b/arch/arm64/boot/dts/amlogic/mesontl1.dtsi @@ -52,6 +52,8 @@ "dsu_clk", "dsu_pre_parent"; operating-points-v2 = <&cpu_opp_table0>; + /*set dynamic gp1 clk to val * 1000 *1000*/ + dynamic_gp1_clk = <1000>; cpu-supply = <&vddcpu0>; cpu-idle-states = <&CPU_SLEEP_0 &SYSTEM_SLEEP_0>; //cpu-idle-states = <&SYSTEM_SLEEP_0>; @@ -76,6 +78,8 @@ "dsu_clk", "dsu_pre_parent"; operating-points-v2 = <&cpu_opp_table0>; + /*set dynamic gp1 clk to val * 1000 *1000*/ + dynamic_gp1_clk = <1000>; cpu-supply = <&vddcpu0>; cpu-idle-states = <&CPU_SLEEP_0 &SYSTEM_SLEEP_0>; //cpu-idle-states = <&SYSTEM_SLEEP_0>; @@ -100,6 +104,8 @@ "dsu_clk", "dsu_pre_parent"; operating-points-v2 = <&cpu_opp_table0>; + /*set dynamic gp1 clk to val * 1000 *1000*/ + dynamic_gp1_clk = <1000>; cpu-supply = <&vddcpu0>; cpu-idle-states = <&CPU_SLEEP_0 &SYSTEM_SLEEP_0>; //cpu-idle-states = <&SYSTEM_SLEEP_0>; @@ -124,6 +130,8 @@ "dsu_clk", "dsu_pre_parent"; operating-points-v2 = <&cpu_opp_table0>; + /*set dynamic gp1 clk to val * 1000 *1000*/ + dynamic_gp1_clk = <1000>; cpu-supply = <&vddcpu0>; cpu-idle-states = <&CPU_SLEEP_0 &SYSTEM_SLEEP_0>; //cpu-idle-states = <&SYSTEM_SLEEP_0>; @@ -281,6 +289,16 @@ device_name = "aml_pm"; debug_reg = <0xff8000a8>; exit_reg = <0xff80023c>; + dmc_asr = <0xff638634>; + cpu_reg = <0xff63c19c>; + clocks = <&clkc CLKID_SWITCH_CLK81>, + <&clkc CLKID_CLK81>, + <&clkc CLKID_FIXED_PLL>, + <&xtal>; + clock-names = "switch_clk81", + "clk81", + "fixed_pll", + "xtal"; }; cpuinfo { diff --git a/arch/arm64/boot/dts/amlogic/mesontm2.dtsi b/arch/arm64/boot/dts/amlogic/mesontm2.dtsi index 30a7eab..fcd5ab4 100644 --- a/arch/arm64/boot/dts/amlogic/mesontm2.dtsi +++ b/arch/arm64/boot/dts/amlogic/mesontm2.dtsi @@ -661,8 +661,8 @@ compatible = "amlogic, audio-controller", "simple-bus"; #address-cells = <2>; #size-cells = <2>; - reg = <0x0 0xff600000 0x0 0x10000>; - ranges = <0x0 0x0 0x0 0xff600000 0x0 0x10000>; + reg = <0x0 0xff600000 0x0 0x3000>; + ranges = <0x0 0x0 0x0 0xff600000 0x0 0x3000>; clkaudio:audio_clocks { compatible = "amlogic, tm2-audio-clocks"; @@ -690,6 +690,59 @@ }; };/* end of audiobus*/ + /* eARC */ + audio_earc: bus@ff603000 { + compatible = "simple-bus"; + reg = <0x0 0xff603000 0x0 0xD000>; + #address-cells = <2>; + #size-cells = <2>; + ranges = <0x0 0x0 0x0 0xff603000 0x0 0xD000>; + + earc: earc@0 { + compatible = "amlogic, tm2-snd-earc"; + #sound-dai-cells = <0>; + + status = "disabled"; + + reg = <0x0 0x0 0x0 0x400>, + <0x0 0x400 0x0 0x200>, + <0x0 0x600 0x0 0x200>, + <0x0 0x800 0x0 0x400>, + <0x0 0xc00 0x0 0x200>, + <0x0 0xe00 0x0 0x200>; + reg-names = "tx_cmdc", + "tx_dmac", + "tx_top", + "rx_cmdc", + "rx_dmac", + "rx_top"; + + clocks = < &clkaudio CLKID_EARCRX_CMDC + &clkaudio CLKID_EARCRX_DMAC + &clkc CLKID_FCLK_DIV4 + &clkc CLKID_FCLK_DIV4 + &clkaudio CLKID_EARCTX_CMDC + &clkaudio CLKID_EARCTX_DMAC + &clkc CLKID_FCLK_DIV4 + &clkc CLKID_MPLL1 + >; + clock-names = + "rx_cmdc", + "rx_dmac", + "rx_cmdc_srcpll", + "rx_dmac_srcpll", + "tx_cmdc", + "tx_dmac", + "tx_cmdc_srcpll", + "tx_dmac_srcpll"; + + interrupts = < + GIC_SPI 232 IRQ_TYPE_LEVEL_HIGH + GIC_SPI 233 IRQ_TYPE_LEVEL_HIGH>; + interrupt-names = "earc_rx", "earc_tx"; + }; + }; + /* Sound iomap */ aml_snd_iomap { compatible = "amlogic, snd-iomap"; @@ -715,15 +768,6 @@ vad_base { reg = <0x0 0xFF601800 0x0 0x400>; }; - earcrx_cdmc_base { - reg = <0x0 0xFF603800 0x0 0x30>; - }; - earcrx_dmac_base { - reg = <0x0 0xFF603C00 0x0 0x20>; - }; - earcrx_top_base { - reg = <0x0 0xFF603E00 0x0 0x10>; - }; }; cbus: cbus@ffd00000 { diff --git a/arch/arm64/boot/dts/amlogic/mesontxl.dtsi b/arch/arm64/boot/dts/amlogic/mesontxl.dtsi index 8d027c7..94a21ea 100644 --- a/arch/arm64/boot/dts/amlogic/mesontxl.dtsi +++ b/arch/arm64/boot/dts/amlogic/mesontxl.dtsi @@ -345,7 +345,7 @@ reg = <0x0 0xc9410000 0x0 0x10000 0x0 0xc8834540 0x0 0x8 0x0 0xc8834558 0x0 0xc - 0x0 0xc1104484 0x0 0x4>; + 0x0 0xc1104408 0x0 0x4>; interrupts = <0 8 1 0 9 1>; phy-mode= "rmii"; diff --git a/arch/arm64/boot/dts/amlogic/sm1_s905d3_ac200.dts b/arch/arm64/boot/dts/amlogic/sm1_s905d3_ac200.dts index 4c32bc6..d1d3134 100644 --- a/arch/arm64/boot/dts/amlogic/sm1_s905d3_ac200.dts +++ b/arch/arm64/boot/dts/amlogic/sm1_s905d3_ac200.dts @@ -1310,31 +1310,6 @@ status = "okay"; }; - earc:earc { - compatible = "amlogic, sm1-snd-earc"; - #sound-dai-cells = <0>; - - clocks = <&clkaudio CLKID_AUDIO_GATE_EARCRX - &clkaudio CLKID_EARCRX_CMDC - &clkaudio CLKID_EARCRX_DMAC - &clkc CLKID_FCLK_DIV5 - &clkc CLKID_FCLK_DIV3 - >; - clock-names = "rx_gate", - "rx_cmdc", - "rx_dmac", - "rx_cmdc_srcpll", - "rx_dmac_srcpll"; - - interrupts = < - GIC_SPI 88 IRQ_TYPE_EDGE_RISING - GIC_SPI 87 IRQ_TYPE_EDGE_RISING - >; - interrupt-names = "rx_cmdc", "rx_dmac"; - - status = "okay"; - }; - asrca: resample@0 { compatible = "amlogic, sm1-resample"; clocks = <&clkc CLKID_MPLL3 @@ -1523,6 +1498,10 @@ }; }; /* end of audiobus */ +&earc { + status = "okay"; +}; + &pinctrl_periphs { tdmout_a: tdmout_a { mux { /* GPIOX_11, GPIOX_10, GPIOX_9 */ diff --git a/arch/arm64/boot/dts/amlogic/sm1_s905d3_ac200_buildroot.dts b/arch/arm64/boot/dts/amlogic/sm1_s905d3_ac200_buildroot.dts index 458771b..1427d5d 100644 --- a/arch/arm64/boot/dts/amlogic/sm1_s905d3_ac200_buildroot.dts +++ b/arch/arm64/boot/dts/amlogic/sm1_s905d3_ac200_buildroot.dts @@ -1366,31 +1366,6 @@ status = "okay"; }; - earc:earc { - compatible = "amlogic, sm1-snd-earc"; - #sound-dai-cells = <0>; - - clocks = <&clkaudio CLKID_AUDIO_GATE_EARCRX - &clkaudio CLKID_EARCRX_CMDC - &clkaudio CLKID_EARCRX_DMAC - &clkc CLKID_FCLK_DIV5 - &clkc CLKID_FCLK_DIV3 - >; - clock-names = "rx_gate", - "rx_cmdc", - "rx_dmac", - "rx_cmdc_srcpll", - "rx_dmac_srcpll"; - - interrupts = < - GIC_SPI 88 IRQ_TYPE_EDGE_RISING - GIC_SPI 87 IRQ_TYPE_EDGE_RISING - >; - interrupt-names = "rx_cmdc", "rx_dmac"; - - status = "okay"; - }; - asrca: resample@0 { compatible = "amlogic, sm1-resample"; clocks = <&clkc CLKID_MPLL3 @@ -1579,6 +1554,10 @@ }; }; /* end of audiobus */ +&earc { + status = "okay"; +}; + &pinctrl_periphs { tdmout_a: tdmout_a { mux { /* GPIOX_11, GPIOX_10, GPIOX_9 */ diff --git a/arch/arm64/boot/dts/amlogic/sm1_s905d3_ac200_drm_buildroot.dts b/arch/arm64/boot/dts/amlogic/sm1_s905d3_ac200_drm_buildroot.dts index dbf3b93..c1b2936 100644 --- a/arch/arm64/boot/dts/amlogic/sm1_s905d3_ac200_drm_buildroot.dts +++ b/arch/arm64/boot/dts/amlogic/sm1_s905d3_ac200_drm_buildroot.dts @@ -1382,31 +1382,6 @@ status = "okay"; }; - earc:earc { - compatible = "amlogic, sm1-snd-earc"; - #sound-dai-cells = <0>; - - clocks = <&clkaudio CLKID_AUDIO_GATE_EARCRX - &clkaudio CLKID_EARCRX_CMDC - &clkaudio CLKID_EARCRX_DMAC - &clkc CLKID_FCLK_DIV5 - &clkc CLKID_FCLK_DIV3 - >; - clock-names = "rx_gate", - "rx_cmdc", - "rx_dmac", - "rx_cmdc_srcpll", - "rx_dmac_srcpll"; - - interrupts = < - GIC_SPI 88 IRQ_TYPE_EDGE_RISING - GIC_SPI 87 IRQ_TYPE_EDGE_RISING - >; - interrupt-names = "rx_cmdc", "rx_dmac"; - - status = "okay"; - }; - asrca: resample@0 { compatible = "amlogic, sm1-resample"; clocks = <&clkc CLKID_MPLL3 @@ -1595,6 +1570,10 @@ }; }; /* end of audiobus */ +&earc { + status = "okay"; +}; + &pinctrl_periphs { tdmout_a: tdmout_a { mux { /* GPIOX_11, GPIOX_10, GPIOX_9 */ diff --git a/arch/arm64/boot/dts/amlogic/sm1_s905d3_ac202.dts b/arch/arm64/boot/dts/amlogic/sm1_s905d3_ac202.dts index 06e7032..a0459c2 100644 --- a/arch/arm64/boot/dts/amlogic/sm1_s905d3_ac202.dts +++ b/arch/arm64/boot/dts/amlogic/sm1_s905d3_ac202.dts @@ -1315,31 +1315,6 @@ status = "okay"; }; - earc:earc { - compatible = "amlogic, sm1-snd-earc"; - #sound-dai-cells = <0>; - - clocks = <&clkaudio CLKID_AUDIO_GATE_EARCRX - &clkaudio CLKID_EARCRX_CMDC - &clkaudio CLKID_EARCRX_DMAC - &clkc CLKID_FCLK_DIV5 - &clkc CLKID_FCLK_DIV3 - >; - clock-names = "rx_gate", - "rx_cmdc", - "rx_dmac", - "rx_cmdc_srcpll", - "rx_dmac_srcpll"; - - interrupts = < - GIC_SPI 88 IRQ_TYPE_EDGE_RISING - GIC_SPI 87 IRQ_TYPE_EDGE_RISING - >; - interrupt-names = "rx_cmdc", "rx_dmac"; - - status = "okay"; - }; - asrca: resample@0 { compatible = "amlogic, sm1-resample"; clocks = <&clkc CLKID_MPLL3 @@ -1528,6 +1503,10 @@ }; }; /* end of audiobus */ +&earc { + status = "okay"; +}; + &pinctrl_periphs { tdmout_a: tdmout_a { mux { /* GPIOX_11, GPIOX_10, GPIOX_9 */ diff --git a/arch/arm64/boot/dts/amlogic/sm1_s905d3_ac202_1g.dts b/arch/arm64/boot/dts/amlogic/sm1_s905d3_ac202_1g.dts index 8466baf5..abfb082 100644 --- a/arch/arm64/boot/dts/amlogic/sm1_s905d3_ac202_1g.dts +++ b/arch/arm64/boot/dts/amlogic/sm1_s905d3_ac202_1g.dts @@ -1316,31 +1316,6 @@ status = "okay"; }; - earc:earc { - compatible = "amlogic, sm1-snd-earc"; - #sound-dai-cells = <0>; - - clocks = <&clkaudio CLKID_AUDIO_GATE_EARCRX - &clkaudio CLKID_EARCRX_CMDC - &clkaudio CLKID_EARCRX_DMAC - &clkc CLKID_FCLK_DIV5 - &clkc CLKID_FCLK_DIV3 - >; - clock-names = "rx_gate", - "rx_cmdc", - "rx_dmac", - "rx_cmdc_srcpll", - "rx_dmac_srcpll"; - - interrupts = < - GIC_SPI 88 IRQ_TYPE_EDGE_RISING - GIC_SPI 87 IRQ_TYPE_EDGE_RISING - >; - interrupt-names = "rx_cmdc", "rx_dmac"; - - status = "okay"; - }; - asrca: resample@0 { compatible = "amlogic, sm1-resample"; clocks = <&clkc CLKID_MPLL3 @@ -1529,6 +1504,10 @@ }; }; /* end of audiobus */ +&earc { + status = "okay"; +}; + &pinctrl_periphs { tdmout_a: tdmout_a { mux { /* GPIOX_11, GPIOX_10, GPIOX_9 */ diff --git a/arch/arm64/boot/dts/amlogic/sm1_s905d3_skt.dts b/arch/arm64/boot/dts/amlogic/sm1_s905d3_skt.dts index 8525f0a..cfbca03 100644 --- a/arch/arm64/boot/dts/amlogic/sm1_s905d3_skt.dts +++ b/arch/arm64/boot/dts/amlogic/sm1_s905d3_skt.dts @@ -1310,31 +1310,6 @@ status = "okay"; }; - earc:earc { - compatible = "amlogic, sm1-snd-earc"; - #sound-dai-cells = <0>; - - clocks = <&clkaudio CLKID_AUDIO_GATE_EARCRX - &clkaudio CLKID_EARCRX_CMDC - &clkaudio CLKID_EARCRX_DMAC - &clkc CLKID_FCLK_DIV5 - &clkc CLKID_FCLK_DIV3 - >; - clock-names = "rx_gate", - "rx_cmdc", - "rx_dmac", - "rx_cmdc_srcpll", - "rx_dmac_srcpll"; - - interrupts = < - GIC_SPI 88 IRQ_TYPE_EDGE_RISING - GIC_SPI 87 IRQ_TYPE_EDGE_RISING - >; - interrupt-names = "rx_cmdc", "rx_dmac"; - - status = "okay"; - }; - asrca: resample@0 { compatible = "amlogic, sm1-resample"; clocks = <&clkc CLKID_MPLL3 @@ -1523,6 +1498,10 @@ }; }; /* end of audiobus */ +&earc { + status = "okay"; +}; + &pinctrl_periphs { tdmout_a: tdmout_a { mux { /* GPIOX_11, GPIOX_10, GPIOX_9 */ diff --git a/arch/arm64/boot/dts/amlogic/sm1_s905x3_ac213.dts b/arch/arm64/boot/dts/amlogic/sm1_s905x3_ac213.dts index 30004ec..13da80c 100644 --- a/arch/arm64/boot/dts/amlogic/sm1_s905x3_ac213.dts +++ b/arch/arm64/boot/dts/amlogic/sm1_s905x3_ac213.dts @@ -1356,31 +1356,6 @@ status = "okay"; }; - earc:earc { - compatible = "amlogic, sm1-snd-earc"; - #sound-dai-cells = <0>; - - clocks = <&clkaudio CLKID_AUDIO_GATE_EARCRX - &clkaudio CLKID_EARCRX_CMDC - &clkaudio CLKID_EARCRX_DMAC - &clkc CLKID_FCLK_DIV5 - &clkc CLKID_FCLK_DIV3 - >; - clock-names = "rx_gate", - "rx_cmdc", - "rx_dmac", - "rx_cmdc_srcpll", - "rx_dmac_srcpll"; - - interrupts = < - GIC_SPI 88 IRQ_TYPE_EDGE_RISING - GIC_SPI 87 IRQ_TYPE_EDGE_RISING - >; - interrupt-names = "rx_cmdc", "rx_dmac"; - - status = "okay"; - }; - asrca: resample@0 { compatible = "amlogic, sm1-resample"; clocks = <&clkc CLKID_MPLL3 @@ -1569,6 +1544,10 @@ }; }; /* end of audiobus */ +&earc { + status = "okay"; +}; + &pinctrl_periphs { tdmout_a: tdmout_a { mux { /* GPIOX_11, GPIOX_10, GPIOX_9 */ diff --git a/arch/arm64/boot/dts/amlogic/sm1_s905x3_ac213_buildroot.dts b/arch/arm64/boot/dts/amlogic/sm1_s905x3_ac213_buildroot.dts index d06841455..e6f8e1f 100644 --- a/arch/arm64/boot/dts/amlogic/sm1_s905x3_ac213_buildroot.dts +++ b/arch/arm64/boot/dts/amlogic/sm1_s905x3_ac213_buildroot.dts @@ -1419,31 +1419,6 @@ status = "okay"; }; - earc:earc { - compatible = "amlogic, sm1-snd-earc"; - #sound-dai-cells = <0>; - - clocks = <&clkaudio CLKID_AUDIO_GATE_EARCRX - &clkaudio CLKID_EARCRX_CMDC - &clkaudio CLKID_EARCRX_DMAC - &clkc CLKID_FCLK_DIV5 - &clkc CLKID_FCLK_DIV3 - >; - clock-names = "rx_gate", - "rx_cmdc", - "rx_dmac", - "rx_cmdc_srcpll", - "rx_dmac_srcpll"; - - interrupts = < - GIC_SPI 88 IRQ_TYPE_EDGE_RISING - GIC_SPI 87 IRQ_TYPE_EDGE_RISING - >; - interrupt-names = "rx_cmdc", "rx_dmac"; - - status = "okay"; - }; - asrca: resample@0 { compatible = "amlogic, sm1-resample"; clocks = <&clkc CLKID_MPLL3 @@ -1632,6 +1607,10 @@ }; }; /* end of audiobus */ +&earc { + status = "okay"; +}; + &pinctrl_periphs { tdmout_a: tdmout_a { mux { /* GPIOX_11, GPIOX_10, GPIOX_9 */ diff --git a/arch/arm64/boot/dts/amlogic/sm1_s905x3_ac214.dts b/arch/arm64/boot/dts/amlogic/sm1_s905x3_ac214.dts index 0a27970..e8a90ac 100644 --- a/arch/arm64/boot/dts/amlogic/sm1_s905x3_ac214.dts +++ b/arch/arm64/boot/dts/amlogic/sm1_s905x3_ac214.dts @@ -1332,31 +1332,6 @@ status = "okay"; }; - earc:earc { - compatible = "amlogic, sm1-snd-earc"; - #sound-dai-cells = <0>; - - clocks = <&clkaudio CLKID_AUDIO_GATE_EARCRX - &clkaudio CLKID_EARCRX_CMDC - &clkaudio CLKID_EARCRX_DMAC - &clkc CLKID_FCLK_DIV5 - &clkc CLKID_FCLK_DIV3 - >; - clock-names = "rx_gate", - "rx_cmdc", - "rx_dmac", - "rx_cmdc_srcpll", - "rx_dmac_srcpll"; - - interrupts = < - GIC_SPI 88 IRQ_TYPE_EDGE_RISING - GIC_SPI 87 IRQ_TYPE_EDGE_RISING - >; - interrupt-names = "rx_cmdc", "rx_dmac"; - - status = "okay"; - }; - asrca: resample@0 { compatible = "amlogic, sm1-resample"; clocks = <&clkc CLKID_MPLL3 @@ -1545,6 +1520,10 @@ }; }; /* end of audiobus */ +&earc { + status = "okay"; +}; + &pinctrl_periphs { tdmout_a: tdmout_a { mux { /* GPIOX_11, GPIOX_10, GPIOX_9 */ diff --git a/arch/arm64/boot/dts/amlogic/sm1_s905x3_ac214_buildroot.dts b/arch/arm64/boot/dts/amlogic/sm1_s905x3_ac214_buildroot.dts index 6cc423f..7992c46 100644 --- a/arch/arm64/boot/dts/amlogic/sm1_s905x3_ac214_buildroot.dts +++ b/arch/arm64/boot/dts/amlogic/sm1_s905x3_ac214_buildroot.dts @@ -1419,31 +1419,6 @@ status = "okay"; }; - earc:earc { - compatible = "amlogic, sm1-snd-earc"; - #sound-dai-cells = <0>; - - clocks = <&clkaudio CLKID_AUDIO_GATE_EARCRX - &clkaudio CLKID_EARCRX_CMDC - &clkaudio CLKID_EARCRX_DMAC - &clkc CLKID_FCLK_DIV5 - &clkc CLKID_FCLK_DIV3 - >; - clock-names = "rx_gate", - "rx_cmdc", - "rx_dmac", - "rx_cmdc_srcpll", - "rx_dmac_srcpll"; - - interrupts = < - GIC_SPI 88 IRQ_TYPE_EDGE_RISING - GIC_SPI 87 IRQ_TYPE_EDGE_RISING - >; - interrupt-names = "rx_cmdc", "rx_dmac"; - - status = "okay"; - }; - asrca: resample@0 { compatible = "amlogic, sm1-resample"; clocks = <&clkc CLKID_MPLL3 @@ -1632,6 +1607,10 @@ }; }; /* end of audiobus */ +&earc { + status = "okay"; +}; + &pinctrl_periphs { tdmout_a: tdmout_a { mux { /* GPIOX_11, GPIOX_10, GPIOX_9 */ diff --git a/arch/arm64/boot/dts/amlogic/sm1_s905y3_ac223.dts b/arch/arm64/boot/dts/amlogic/sm1_s905y3_ac223.dts index 08843ba..a344d5a 100644 --- a/arch/arm64/boot/dts/amlogic/sm1_s905y3_ac223.dts +++ b/arch/arm64/boot/dts/amlogic/sm1_s905y3_ac223.dts @@ -1290,31 +1290,6 @@ status = "okay"; }; - earc:earc { - compatible = "amlogic, sm1-snd-earc"; - #sound-dai-cells = <0>; - - clocks = <&clkaudio CLKID_AUDIO_GATE_EARCRX - &clkaudio CLKID_EARCRX_CMDC - &clkaudio CLKID_EARCRX_DMAC - &clkc CLKID_FCLK_DIV5 - &clkc CLKID_FCLK_DIV3 - >; - clock-names = "rx_gate", - "rx_cmdc", - "rx_dmac", - "rx_cmdc_srcpll", - "rx_dmac_srcpll"; - - interrupts = < - GIC_SPI 88 IRQ_TYPE_EDGE_RISING - GIC_SPI 87 IRQ_TYPE_EDGE_RISING - >; - interrupt-names = "rx_cmdc", "rx_dmac"; - - status = "okay"; - }; - asrca: resample@0 { compatible = "amlogic, sm1-resample"; clocks = <&clkc CLKID_MPLL3 @@ -1503,6 +1478,10 @@ }; }; /* end of audiobus */ +&earc { + status = "okay"; +}; + &pinctrl_periphs { tdmout_a: tdmout_a { mux { /* GPIOX_11, GPIOX_10, GPIOX_9 */ diff --git a/arch/arm64/boot/dts/amlogic/tl1_t962x2_t309.dts b/arch/arm64/boot/dts/amlogic/tl1_t962x2_t309.dts index 8d62ed6..2349a9e 100644 --- a/arch/arm64/boot/dts/amlogic/tl1_t962x2_t309.dts +++ b/arch/arm64/boot/dts/amlogic/tl1_t962x2_t309.dts @@ -1227,6 +1227,11 @@ }; }; + aml_pm { + vad_wakeup_disable = <0x0>; + vddio3v3_en = <&gpio_ao GPIOAO_2 0>; + }; + sd_emmc_b: sdio@ffe05000 { status = "okay"; compatible = "amlogic, meson-mmc-tl1"; @@ -1494,7 +1499,7 @@ }; extn:extn { - compatible = "amlogic, snd-extn"; + compatible = "amlogic, tl1-snd-extn"; #sound-dai-cells = <0>; interrupts = diff --git a/arch/arm64/boot/dts/amlogic/tl1_t962x2_x301_1g.dts b/arch/arm64/boot/dts/amlogic/tl1_t962x2_x301_1g.dts index 40bd862..beb85bd 100644 --- a/arch/arm64/boot/dts/amlogic/tl1_t962x2_x301_1g.dts +++ b/arch/arm64/boot/dts/amlogic/tl1_t962x2_x301_1g.dts @@ -1326,6 +1326,12 @@ */ }; }; + + aml_pm { + vad_wakeup_disable = <0x0>; + vddio3v3_en = <&gpio_ao GPIOAO_2 0>; + }; + /* sd_emmc_b: sd@ffe05000 { * status = "okay"; * compatible = "amlogic, meson-mmc-tl1"; @@ -1571,8 +1577,8 @@ #sound-dai-cells = <0>; clocks = <&clkaudio CLKID_AUDIO_GATE_PDM - &clkc CLKID_FCLK_DIV3 - &clkc CLKID_MPLL3 + &clkc CLKID_HIFI_PLL + &clkc CLKID_HIFI_PLL &clkaudio CLKID_AUDIO_PDMIN0 &clkaudio CLKID_AUDIO_PDMIN1>; clock-names = "gate", @@ -1591,7 +1597,7 @@ }; extn:extn { - compatible = "amlogic, snd-extn"; + compatible = "amlogic, tl1-snd-extn"; #sound-dai-cells = <0>; interrupts = @@ -1676,7 +1682,7 @@ #sound-dai-cells = <0>; clocks = <&clkaudio CLKID_AUDIO_GATE_TOVAD - &clkc CLKID_FCLK_DIV5 + &clkc CLKID_HIFI_PLL &clkaudio CLKID_AUDIO_VAD>; clock-names = "gate", "pll", "clk"; @@ -1712,8 +1718,8 @@ #sound-dai-cells = <0>; clocks = <&clkaudio CLKID_AUDIO_GATE_PDM - &clkc CLKID_FCLK_DIV3 - &clkc CLKID_MPLL3 + &clkc CLKID_HIFI_PLL + &clkc CLKID_HIFI_PLL &clkaudio CLKID_AUDIO_PDMIN0 &clkaudio CLKID_AUDIO_PDMIN1 &clkc CLKID_MPLL0 @@ -1767,8 +1773,8 @@ #sound-dai-cells = <0>; clocks = <&clkaudio CLKID_AUDIO_GATE_PDM - &clkc CLKID_FCLK_DIV3 - &clkc CLKID_MPLL3 + &clkc CLKID_HIFI_PLL + &clkc CLKID_HIFI_PLL &clkaudio CLKID_AUDIO_PDMIN0 &clkaudio CLKID_AUDIO_PDMIN1 &clkc CLKID_MPLL0 diff --git a/arch/arm64/boot/dts/amlogic/tl1_t962x2_x301_1g_drm.dts b/arch/arm64/boot/dts/amlogic/tl1_t962x2_x301_1g_drm.dts index 3f4b4e7d..bc8be40 100644 --- a/arch/arm64/boot/dts/amlogic/tl1_t962x2_x301_1g_drm.dts +++ b/arch/arm64/boot/dts/amlogic/tl1_t962x2_x301_1g_drm.dts @@ -1564,8 +1564,8 @@ #sound-dai-cells = <0>; clocks = <&clkaudio CLKID_AUDIO_GATE_PDM - &clkc CLKID_FCLK_DIV3 - &clkc CLKID_MPLL3 + &clkc CLKID_HIFI_PLL + &clkc CLKID_HIFI_PLL &clkaudio CLKID_AUDIO_PDMIN0 &clkaudio CLKID_AUDIO_PDMIN1>; clock-names = "gate", @@ -1669,7 +1669,7 @@ #sound-dai-cells = <0>; clocks = <&clkaudio CLKID_AUDIO_GATE_TOVAD - &clkc CLKID_FCLK_DIV5 + &clkc CLKID_HIFI_PLL &clkaudio CLKID_AUDIO_VAD>; clock-names = "gate", "pll", "clk"; @@ -1705,8 +1705,8 @@ #sound-dai-cells = <0>; clocks = <&clkaudio CLKID_AUDIO_GATE_PDM - &clkc CLKID_FCLK_DIV3 - &clkc CLKID_MPLL3 + &clkc CLKID_HIFI_PLL + &clkc CLKID_HIFI_PLL &clkaudio CLKID_AUDIO_PDMIN0 &clkaudio CLKID_AUDIO_PDMIN1 &clkc CLKID_MPLL0 @@ -1760,8 +1760,8 @@ #sound-dai-cells = <0>; clocks = <&clkaudio CLKID_AUDIO_GATE_PDM - &clkc CLKID_FCLK_DIV3 - &clkc CLKID_MPLL3 + &clkc CLKID_HIFI_PLL + &clkc CLKID_HIFI_PLL &clkaudio CLKID_AUDIO_PDMIN0 &clkaudio CLKID_AUDIO_PDMIN1 &clkc CLKID_MPLL0 diff --git a/arch/arm64/boot/dts/amlogic/tl1_t962x2_x301_2g.dts b/arch/arm64/boot/dts/amlogic/tl1_t962x2_x301_2g.dts index 2de9b76..97303f8 100644 --- a/arch/arm64/boot/dts/amlogic/tl1_t962x2_x301_2g.dts +++ b/arch/arm64/boot/dts/amlogic/tl1_t962x2_x301_2g.dts @@ -1318,6 +1318,12 @@ */ }; }; + + aml_pm { + vad_wakeup_disable = <0x0>; + vddio3v3_en = <&gpio_ao GPIOAO_2 0>; + }; + /* sd_emmc_b: sd@ffe05000 { * status = "okay"; * compatible = "amlogic, meson-mmc-tl1"; @@ -1563,8 +1569,8 @@ #sound-dai-cells = <0>; clocks = <&clkaudio CLKID_AUDIO_GATE_PDM - &clkc CLKID_FCLK_DIV3 - &clkc CLKID_MPLL3 + &clkc CLKID_HIFI_PLL + &clkc CLKID_HIFI_PLL &clkaudio CLKID_AUDIO_PDMIN0 &clkaudio CLKID_AUDIO_PDMIN1>; clock-names = "gate", @@ -1583,7 +1589,7 @@ }; extn:extn { - compatible = "amlogic, snd-extn"; + compatible = "amlogic, tl1-snd-extn"; #sound-dai-cells = <0>; interrupts = @@ -1668,7 +1674,7 @@ #sound-dai-cells = <0>; clocks = <&clkaudio CLKID_AUDIO_GATE_TOVAD - &clkc CLKID_FCLK_DIV5 + &clkc CLKID_HIFI_PLL &clkaudio CLKID_AUDIO_VAD>; clock-names = "gate", "pll", "clk"; @@ -1704,8 +1710,8 @@ #sound-dai-cells = <0>; clocks = <&clkaudio CLKID_AUDIO_GATE_PDM - &clkc CLKID_FCLK_DIV3 - &clkc CLKID_MPLL3 + &clkc CLKID_HIFI_PLL + &clkc CLKID_HIFI_PLL &clkaudio CLKID_AUDIO_PDMIN0 &clkaudio CLKID_AUDIO_PDMIN1 &clkc CLKID_MPLL0 @@ -1759,8 +1765,8 @@ #sound-dai-cells = <0>; clocks = <&clkaudio CLKID_AUDIO_GATE_PDM - &clkc CLKID_FCLK_DIV3 - &clkc CLKID_MPLL3 + &clkc CLKID_HIFI_PLL + &clkc CLKID_HIFI_PLL &clkaudio CLKID_AUDIO_PDMIN0 &clkaudio CLKID_AUDIO_PDMIN1 &clkc CLKID_MPLL0 diff --git a/arch/arm64/boot/dts/amlogic/tl1_t962x2_x301_2g_drm.dts b/arch/arm64/boot/dts/amlogic/tl1_t962x2_x301_2g_drm.dts index 4990aa0..023f91e 100644 --- a/arch/arm64/boot/dts/amlogic/tl1_t962x2_x301_2g_drm.dts +++ b/arch/arm64/boot/dts/amlogic/tl1_t962x2_x301_2g_drm.dts @@ -1556,8 +1556,8 @@ #sound-dai-cells = <0>; clocks = <&clkaudio CLKID_AUDIO_GATE_PDM - &clkc CLKID_FCLK_DIV3 - &clkc CLKID_MPLL3 + &clkc CLKID_HIFI_PLL + &clkc CLKID_HIFI_PLL &clkaudio CLKID_AUDIO_PDMIN0 &clkaudio CLKID_AUDIO_PDMIN1>; clock-names = "gate", @@ -1661,7 +1661,7 @@ #sound-dai-cells = <0>; clocks = <&clkaudio CLKID_AUDIO_GATE_TOVAD - &clkc CLKID_FCLK_DIV5 + &clkc CLKID_HIFI_PLL &clkaudio CLKID_AUDIO_VAD>; clock-names = "gate", "pll", "clk"; @@ -1697,8 +1697,8 @@ #sound-dai-cells = <0>; clocks = <&clkaudio CLKID_AUDIO_GATE_PDM - &clkc CLKID_FCLK_DIV3 - &clkc CLKID_MPLL3 + &clkc CLKID_HIFI_PLL + &clkc CLKID_HIFI_PLL &clkaudio CLKID_AUDIO_PDMIN0 &clkaudio CLKID_AUDIO_PDMIN1 &clkc CLKID_MPLL0 @@ -1752,8 +1752,8 @@ #sound-dai-cells = <0>; clocks = <&clkaudio CLKID_AUDIO_GATE_PDM - &clkc CLKID_FCLK_DIV3 - &clkc CLKID_MPLL3 + &clkc CLKID_HIFI_PLL + &clkc CLKID_HIFI_PLL &clkaudio CLKID_AUDIO_PDMIN0 &clkaudio CLKID_AUDIO_PDMIN1 &clkc CLKID_MPLL0 diff --git a/arch/arm64/boot/dts/amlogic/tm2_t962e2_ab311.dts b/arch/arm64/boot/dts/amlogic/tm2_t962e2_ab311.dts index ab1a9a0..2056226 100644 --- a/arch/arm64/boot/dts/amlogic/tm2_t962e2_ab311.dts +++ b/arch/arm64/boot/dts/amlogic/tm2_t962e2_ab311.dts @@ -1425,7 +1425,7 @@ #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-lane-slot-mask-out = <0 1 0 0>; dai-tdm-clk-sel = <1>; clocks = <&clkaudio CLKID_AUDIO_MCLK_B @@ -1592,38 +1592,6 @@ status = "okay"; }; - earc:earc { - compatible = "amlogic, tm2-snd-earc"; - #sound-dai-cells = <0>; - - clocks = < &clkaudio CLKID_EARCRX_CMDC - &clkaudio CLKID_EARCRX_DMAC - &clkc CLKID_FCLK_DIV5 - &clkc CLKID_FCLK_DIV3 - &clkaudio CLKID_EARCTX_CMDC - &clkaudio CLKID_EARCTX_DMAC - &clkc CLKID_FCLK_DIV5 - &clkc CLKID_FCLK_DIV3 - >; - clock-names = - "rx_cmdc", - "rx_dmac", - "rx_cmdc_srcpll", - "rx_dmac_srcpll", - "tx_cmdc", - "tx_dmac", - "tx_cmdc_srcpll", - "tx_dmac_srcpll"; - - interrupts = < - GIC_SPI 88 IRQ_TYPE_EDGE_RISING - GIC_SPI 87 IRQ_TYPE_EDGE_RISING - >; - interrupt-names = "rx_cmdc", "rx_dmac"; - - status = "okay"; - }; - aed:effect { compatible = "amlogic, snd-effect-v3"; #sound-dai-cells = <0>; @@ -1840,6 +1808,10 @@ }; }; /* end of audiobus */ +&earc { + status = "okay"; +}; + &pinctrl_periphs { /* audio pin mux */ diff --git a/arch/arm64/boot/dts/amlogic/tm2_t962e2_ab319.dts b/arch/arm64/boot/dts/amlogic/tm2_t962e2_ab319.dts index 66049b1..4561ec5 100644 --- a/arch/arm64/boot/dts/amlogic/tm2_t962e2_ab319.dts +++ b/arch/arm64/boot/dts/amlogic/tm2_t962e2_ab319.dts @@ -1528,37 +1528,6 @@ status = "okay"; }; - earc:earc { - compatible = "amlogic, tm2-snd-earc"; - #sound-dai-cells = <0>; - - clocks = < &clkaudio CLKID_EARCRX_CMDC - &clkaudio CLKID_EARCRX_DMAC - &clkc CLKID_FCLK_DIV5 - &clkc CLKID_FCLK_DIV3 - &clkaudio CLKID_EARCTX_CMDC - &clkaudio CLKID_EARCTX_DMAC - &clkc CLKID_FCLK_DIV5 - &clkc CLKID_FCLK_DIV3 - >; - clock-names = - "rx_cmdc", - "rx_dmac", - "rx_cmdc_srcpll", - "rx_dmac_srcpll", - "tx_cmdc", - "tx_dmac", - "tx_cmdc_srcpll", - "tx_dmac_srcpll"; - interrupts = < - GIC_SPI 88 IRQ_TYPE_EDGE_RISING - GIC_SPI 87 IRQ_TYPE_EDGE_RISING - >; - interrupt-names = "rx_cmdc", "rx_dmac"; - - status = "okay"; - }; - aed:effect { compatible = "amlogic, snd-effect-v3"; #sound-dai-cells = <0>; @@ -1775,6 +1744,10 @@ }; }; /* end of audiobus */ +&earc { + status = "okay"; +}; + &pinctrl_periphs { /* audio pin mux */ diff --git a/arch/arm64/boot/dts/amlogic/tm2_t962x3_ab301.dts b/arch/arm64/boot/dts/amlogic/tm2_t962x3_ab301.dts index 5c90b3e..6b5ca87 100644 --- a/arch/arm64/boot/dts/amlogic/tm2_t962x3_ab301.dts +++ b/arch/arm64/boot/dts/amlogic/tm2_t962x3_ab301.dts @@ -1598,38 +1598,6 @@ status = "okay"; }; - earc:earc { - compatible = "amlogic, tm2-snd-earc"; - #sound-dai-cells = <0>; - - clocks = < &clkaudio CLKID_EARCRX_CMDC - &clkaudio CLKID_EARCRX_DMAC - &clkc CLKID_FCLK_DIV5 - &clkc CLKID_FCLK_DIV3 - &clkaudio CLKID_EARCTX_CMDC - &clkaudio CLKID_EARCTX_DMAC - &clkc CLKID_FCLK_DIV5 - &clkc CLKID_FCLK_DIV3 - >; - clock-names = - "rx_cmdc", - "rx_dmac", - "rx_cmdc_srcpll", - "rx_dmac_srcpll", - "tx_cmdc", - "tx_dmac", - "tx_cmdc_srcpll", - "tx_dmac_srcpll"; - - interrupts = < - GIC_SPI 88 IRQ_TYPE_EDGE_RISING - GIC_SPI 87 IRQ_TYPE_EDGE_RISING - >; - interrupt-names = "rx_cmdc", "rx_dmac"; - - status = "okay"; - }; - aed:effect { compatible = "amlogic, snd-effect-v3"; #sound-dai-cells = <0>; @@ -1846,6 +1814,10 @@ }; }; /* end of audiobus */ +&earc { + status = "okay"; +}; + &pinctrl_periphs { /* audio pin mux */ diff --git a/arch/arm64/boot/dts/amlogic/tm2_t962x3_ab309.dts b/arch/arm64/boot/dts/amlogic/tm2_t962x3_ab309.dts index e7c6d3a..00aae2e 100644 --- a/arch/arm64/boot/dts/amlogic/tm2_t962x3_ab309.dts +++ b/arch/arm64/boot/dts/amlogic/tm2_t962x3_ab309.dts @@ -1521,7 +1521,6 @@ compatible = "amlogic, snd-extn"; #sound-dai-cells = <0>; - interrupts = <GIC_SPI 158 IRQ_TYPE_EDGE_RISING>; interrupt-names = "irq_frhdmirx"; @@ -1529,37 +1528,6 @@ status = "okay"; }; - earc:earc { - compatible = "amlogic, tm2-snd-earc"; - #sound-dai-cells = <0>; - - clocks = < &clkaudio CLKID_EARCRX_CMDC - &clkaudio CLKID_EARCRX_DMAC - &clkc CLKID_FCLK_DIV5 - &clkc CLKID_FCLK_DIV3 - &clkaudio CLKID_EARCTX_CMDC - &clkaudio CLKID_EARCTX_DMAC - &clkc CLKID_FCLK_DIV5 - &clkc CLKID_FCLK_DIV3 - >; - clock-names = - "rx_cmdc", - "rx_dmac", - "rx_cmdc_srcpll", - "rx_dmac_srcpll", - "tx_cmdc", - "tx_dmac", - "tx_cmdc_srcpll", - "tx_dmac_srcpll"; - interrupts = < - GIC_SPI 88 IRQ_TYPE_EDGE_RISING - GIC_SPI 87 IRQ_TYPE_EDGE_RISING - >; - interrupt-names = "rx_cmdc", "rx_dmac"; - - status = "okay"; - }; - aed:effect { compatible = "amlogic, snd-effect-v3"; #sound-dai-cells = <0>; @@ -1776,6 +1744,10 @@ }; }; /* end of audiobus */ +&earc { + status = "okay"; +}; + &pinctrl_periphs { /* audio pin mux */ diff --git a/arch/arm64/boot/dts/amlogic/tm2_t962x3_t312.dts b/arch/arm64/boot/dts/amlogic/tm2_t962x3_t312.dts index 2fe848c..f449c2b 100644 --- a/arch/arm64/boot/dts/amlogic/tm2_t962x3_t312.dts +++ b/arch/arm64/boot/dts/amlogic/tm2_t962x3_t312.dts @@ -1584,38 +1584,6 @@ status = "okay"; }; - earc:earc { - compatible = "amlogic, tm2-snd-earc"; - #sound-dai-cells = <0>; - - clocks = < &clkaudio CLKID_EARCRX_CMDC - &clkaudio CLKID_EARCRX_DMAC - &clkc CLKID_FCLK_DIV5 - &clkc CLKID_FCLK_DIV3 - &clkaudio CLKID_EARCTX_CMDC - &clkaudio CLKID_EARCTX_DMAC - &clkc CLKID_FCLK_DIV5 - &clkc CLKID_FCLK_DIV3 - >; - clock-names = - "rx_cmdc", - "rx_dmac", - "rx_cmdc_srcpll", - "rx_dmac_srcpll", - "tx_cmdc", - "tx_dmac", - "tx_cmdc_srcpll", - "tx_dmac_srcpll"; - - interrupts = < - GIC_SPI 88 IRQ_TYPE_EDGE_RISING - GIC_SPI 87 IRQ_TYPE_EDGE_RISING - >; - interrupt-names = "rx_cmdc", "rx_dmac"; - - status = "okay"; - }; - aed:effect { compatible = "amlogic, snd-effect-v3"; #sound-dai-cells = <0>; @@ -1832,6 +1800,10 @@ }; }; /* end of audiobus */ +&earc { + status = "okay"; +}; + &pinctrl_periphs { /* audio pin mux */ diff --git a/arch/arm64/boot/dts/amlogic/txlx_t962e_r321.dts b/arch/arm64/boot/dts/amlogic/txlx_t962e_r321.dts index 5fc8c04..4601d8b 100644 --- a/arch/arm64/boot/dts/amlogic/txlx_t962e_r321.dts +++ b/arch/arm64/boot/dts/amlogic/txlx_t962e_r321.dts @@ -220,7 +220,7 @@ reg = <0x0 0xff3f0000 0x0 0x10000 0x0 0xff634540 0x0 0x8 0x0 0xff634558 0x0 0xc - 0x0 0xffd01084 0x0 0x4>; + 0x0 0xffd01008 0x0 0x4>; interrupts = <0 8 1 0 9 1>; diff --git a/arch/arm64/boot/dts/amlogic/txlx_t962e_r321_buildroot.dts b/arch/arm64/boot/dts/amlogic/txlx_t962e_r321_buildroot.dts index 12a8100..07f49d4 100644 --- a/arch/arm64/boot/dts/amlogic/txlx_t962e_r321_buildroot.dts +++ b/arch/arm64/boot/dts/amlogic/txlx_t962e_r321_buildroot.dts @@ -189,7 +189,7 @@ reg = <0x0 0xff3f0000 0x0 0x10000 0x0 0xff634540 0x0 0x8 0x0 0xff634558 0x0 0xc - 0x0 0xffd01084 0x0 0x4>; + 0x0 0xffd01008 0x0 0x4>; interrupts = <0 8 1 0 9 1>; diff --git a/arch/arm64/boot/dts/amlogic/txlx_t962x_r311_1g.dts b/arch/arm64/boot/dts/amlogic/txlx_t962x_r311_1g.dts index 5690a3c..2908212 100644 --- a/arch/arm64/boot/dts/amlogic/txlx_t962x_r311_1g.dts +++ b/arch/arm64/boot/dts/amlogic/txlx_t962x_r311_1g.dts @@ -224,7 +224,7 @@ reg = <0x0 0xff3f0000 0x0 0x10000 0x0 0xff634540 0x0 0x8 0x0 0xff634558 0x0 0xc - 0x0 0xffd01084 0x0 0x4>; + 0x0 0xffd01008 0x0 0x4>; interrupts = <0 8 1 0 9 1>; diff --git a/arch/arm64/boot/dts/amlogic/txlx_t962x_r311_2g.dts b/arch/arm64/boot/dts/amlogic/txlx_t962x_r311_2g.dts index 6137141..cef7436 100644 --- a/arch/arm64/boot/dts/amlogic/txlx_t962x_r311_2g.dts +++ b/arch/arm64/boot/dts/amlogic/txlx_t962x_r311_2g.dts @@ -224,7 +224,7 @@ reg = <0x0 0xff3f0000 0x0 0x10000 0x0 0xff634540 0x0 0x8 0x0 0xff634558 0x0 0xc - 0x0 0xffd01084 0x0 0x4>; + 0x0 0xffd01008 0x0 0x4>; interrupts = <0 8 1 0 9 1>; diff --git a/arch/arm64/boot/dts/amlogic/txlx_t962x_r311_720p.dts b/arch/arm64/boot/dts/amlogic/txlx_t962x_r311_720p.dts index 3be2a11..4a39b65 100644 --- a/arch/arm64/boot/dts/amlogic/txlx_t962x_r311_720p.dts +++ b/arch/arm64/boot/dts/amlogic/txlx_t962x_r311_720p.dts @@ -224,7 +224,7 @@ reg = <0x0 0xff3f0000 0x0 0x10000 0x0 0xff634540 0x0 0x8 0x0 0xff634558 0x0 0xc - 0x0 0xffd01084 0x0 0x4>; + 0x0 0xffd01008 0x0 0x4>; interrupts = <0 8 1 0 9 1>; diff --git a/arch/arm64/boot/dts/amlogic/txlx_t962x_r314.dts b/arch/arm64/boot/dts/amlogic/txlx_t962x_r314.dts index e70112c..c9f1149 100644 --- a/arch/arm64/boot/dts/amlogic/txlx_t962x_r314.dts +++ b/arch/arm64/boot/dts/amlogic/txlx_t962x_r314.dts @@ -225,7 +225,7 @@ reg = <0x0 0xff3f0000 0x0 0x10000 0x0 0xff634540 0x0 0x8 0x0 0xff634558 0x0 0xc - 0x0 0xffd01084 0x0 0x4>; + 0x0 0xffd01008 0x0 0x4>; interrupts = <0 8 1 0 9 1>; diff --git a/arch/arm64/configs/meson64_smarthome_defconfig b/arch/arm64/configs/meson64_smarthome_defconfig index b88827d..ecde9c5 100644 --- a/arch/arm64/configs/meson64_smarthome_defconfig +++ b/arch/arm64/configs/meson64_smarthome_defconfig @@ -318,6 +318,7 @@ CONFIG_AMLOGIC_PCA9557_KEYPAD=y CONFIG_AMLOGIC_SENSOR=y CONFIG_AMLOGIC_SENSOR_CY8C4014=y CONFIG_AMLOGIC_GPIO_IRQ=y +CONFIG_AMLOGIC_DEFENDKEY=y CONFIG_DOLBY_FW=y CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" CONFIG_DEVTMPFS=y diff --git a/arch/arm64/kernel/perf_event.c b/arch/arm64/kernel/perf_event.c index 0d63784..a1aa93f 100644 --- a/arch/arm64/kernel/perf_event.c +++ b/arch/arm64/kernel/perf_event.c @@ -449,6 +449,49 @@ ARMV8_EVENT_ATTR(l2i_tlb_refill, ARMV8_PMUV3_PERFCTR_L2I_TLB_REFILL); ARMV8_EVENT_ATTR(l2d_tlb, ARMV8_PMUV3_PERFCTR_L2D_TLB); ARMV8_EVENT_ATTR(l2i_tlb, ARMV8_PMUV3_PERFCTR_L2I_TLB); +#ifdef CONFIG_AMLOGIC_MODIFY +/* a53/a55 common */ +ARMV8_EVENT_ATTR(a5x_stall_frontend_cache, 0xe1); +ARMV8_EVENT_ATTR(a5x_stall_frontend_tlb, 0xe2); +ARMV8_EVENT_ATTR(a5x_stall_frontend_pderr, 0xe3); +ARMV8_EVENT_ATTR(a5x_stall_backend_ilock_agu, 0xe5); +ARMV8_EVENT_ATTR(a5x_stall_backend_ilock_fpu, 0xe6); +ARMV8_EVENT_ATTR(a5x_stall_backend_ld, 0xe7); +ARMV8_EVENT_ATTR(a5x_stall_backend_st, 0xe8); +ARMV8_EVENT_ATTR(a5x_l2d_cache, 0x16); +ARMV8_EVENT_ATTR(a5x_l2d_cache_refill, 0x17); + +/* a55 events */ +ARMV8_EVENT_ATTR(a55_stall_frontend, 0x23); +ARMV8_EVENT_ATTR(a55_stall_backend, 0x24); +ARMV8_EVENT_ATTR(a55_stall_backend_ilock, 0xe4); +ARMV8_EVENT_ATTR(a55_l1d_cache_refill_inner, 0x44); +ARMV8_EVENT_ATTR(a55_l1d_cache_refill_outer, 0x45); +ARMV8_EVENT_ATTR(a55_l1d_cache_refill_prefetch, 0xc2); +ARMV8_EVENT_ATTR(a55_l2d_cache_refill_prefetch, 0xc1); +ARMV8_EVENT_ATTR(a55_l3d_cache_refill_prefetch, 0xc0); +ARMV8_EVENT_ATTR(a55_stall_backend_ld_cache, 0xe9); +ARMV8_EVENT_ATTR(a55_stall_backend_ld_tlb, 0xea); +ARMV8_EVENT_ATTR(a55_stall_backend_st_stb, 0xeb); +ARMV8_EVENT_ATTR(a55_stall_backend_st_tlb, 0xec); +ARMV8_EVENT_ATTR(a55_l1d_cache_rd, 0x40); +ARMV8_EVENT_ATTR(a55_l1d_cache_wr, 0x41); +ARMV8_EVENT_ATTR(a55_l1d_cache_refill_rd, 0x42); +ARMV8_EVENT_ATTR(a55_l1d_cache_refill_wr, 0x43); +ARMV8_EVENT_ATTR(a55_l2d_cache_rd, 0x50); +ARMV8_EVENT_ATTR(a55_l2d_cache_wr, 0x51); +ARMV8_EVENT_ATTR(a55_l2d_cache_refill_rd, 0x52); +ARMV8_EVENT_ATTR(a55_l2d_cache_refill_wr, 0x53); +ARMV8_EVENT_ATTR(a55_l3d_cache_rd, 0xa0); +ARMV8_EVENT_ATTR(a55_l3d_cache_refill_rd, 0xa2); + +/* a53 events */ +ARMV8_EVENT_ATTR(a53_cache_refill_prefetch, 0xc2); +ARMV8_EVENT_ATTR(a53_scu_snooped, 0xc8); +ARMV8_EVENT_ATTR(a53_stall_backend_st_stb, 0xc7); +ARMV8_EVENT_ATTR(a53_stall_frontend_other, 0xe0); +#endif + static struct attribute *armv8_pmuv3_event_attrs[] = { &armv8_event_attr_sw_incr.attr.attr, &armv8_event_attr_l1i_cache_refill.attr.attr, @@ -498,6 +541,46 @@ static struct attribute *armv8_pmuv3_event_attrs[] = { &armv8_event_attr_l2i_tlb_refill.attr.attr, &armv8_event_attr_l2d_tlb.attr.attr, &armv8_event_attr_l2i_tlb.attr.attr, +#ifdef CONFIG_AMLOGIC_MODIFY + /* a55/a53 common events */ + &armv8_event_attr_a5x_stall_frontend_cache.attr.attr, //0xe1 + &armv8_event_attr_a5x_stall_frontend_tlb.attr.attr, //0xe2 + &armv8_event_attr_a5x_stall_frontend_pderr.attr.attr, //0xe3 + &armv8_event_attr_a5x_stall_backend_ilock_agu.attr.attr, //0xe5 + &armv8_event_attr_a5x_stall_backend_ilock_fpu.attr.attr, //0xe6 + &armv8_event_attr_a5x_stall_backend_ld.attr.attr, //0xe7 + &armv8_event_attr_a5x_stall_backend_st.attr.attr, //0xe8 + &armv8_event_attr_a5x_l2d_cache.attr.attr, //0x16 + &armv8_event_attr_a5x_l2d_cache_refill.attr.attr, //0x17 + /* a55 events */ + &armv8_event_attr_a55_stall_frontend.attr.attr, //0x23 + &armv8_event_attr_a55_stall_backend.attr.attr, //0x24 + &armv8_event_attr_a55_stall_backend_ilock.attr.attr, //0xe4 + &armv8_event_attr_a55_stall_backend_ld_cache.attr.attr, //0xe9 + &armv8_event_attr_a55_stall_backend_ld_tlb.attr.attr, //0xea + &armv8_event_attr_a55_stall_backend_st_stb.attr.attr, //0xeb + &armv8_event_attr_a55_stall_backend_st_tlb.attr.attr, //0xec + &armv8_event_attr_a55_l1d_cache_refill_inner.attr.attr, //0x44 + &armv8_event_attr_a55_l1d_cache_refill_outer.attr.attr, //0x45 + &armv8_event_attr_a55_l1d_cache_refill_prefetch.attr.attr, //0xc2 + &armv8_event_attr_a55_l2d_cache_refill_prefetch.attr.attr, //0xc1 + &armv8_event_attr_a55_l3d_cache_refill_prefetch.attr.attr, //0xc0 + &armv8_event_attr_a55_l1d_cache_rd.attr.attr, //0x40 + &armv8_event_attr_a55_l1d_cache_wr.attr.attr, //0x41 + &armv8_event_attr_a55_l1d_cache_refill_rd.attr.attr, //0x42 + &armv8_event_attr_a55_l1d_cache_refill_wr.attr.attr, //0x43 + &armv8_event_attr_a55_l2d_cache_rd.attr.attr, //0x50 + &armv8_event_attr_a55_l2d_cache_wr.attr.attr, //0x51 + &armv8_event_attr_a55_l2d_cache_refill_rd.attr.attr, //0x52 + &armv8_event_attr_a55_l2d_cache_refill_wr.attr.attr, //0x53 + &armv8_event_attr_a55_l3d_cache_rd.attr.attr, //0xa0 + &armv8_event_attr_a55_l3d_cache_refill_rd.attr.attr, //0xa2 + /* a53 events */ + &armv8_event_attr_a53_cache_refill_prefetch.attr.attr, //0xc2 + &armv8_event_attr_a53_scu_snooped.attr.attr, //0xc8 + &armv8_event_attr_a53_stall_backend_st_stb.attr.attr, //0xc7 + &armv8_event_attr_a53_stall_frontend_other.attr.attr, //0xe0 +#endif NULL, }; @@ -505,6 +588,9 @@ static umode_t armv8pmu_event_attr_is_visible(struct kobject *kobj, struct attribute *attr, int unused) { +#ifdef CONFIG_AMLOGIC_MODIFY + return 0444; +#else struct device *dev = kobj_to_dev(kobj); struct pmu *pmu = dev_get_drvdata(dev); struct arm_pmu *cpu_pmu = container_of(pmu, struct arm_pmu, pmu); @@ -516,6 +602,7 @@ armv8pmu_event_attr_is_visible(struct kobject *kobj, return attr->mode; return 0; +#endif } static struct attribute_group armv8_pmuv3_events_attr_group = { diff --git a/drivers/amlogic/atv_demod/atv_demod_ops.c b/drivers/amlogic/atv_demod/atv_demod_ops.c index 88affa4..daed418 100644 --- a/drivers/amlogic/atv_demod/atv_demod_ops.c +++ b/drivers/amlogic/atv_demod/atv_demod_ops.c @@ -1117,7 +1117,7 @@ static enum v4l2_search atvdemod_fe_search(struct v4l2_frontend *v4l2_fe) v4l2_std_id std_bk = 0; unsigned int audio = 0; unsigned int soundsys = 0; - int double_check_cnt = 1; + /* int double_check_cnt = 1; */ int auto_search_std = 0; int search_count = 0; /* bool try_secam = false; */ @@ -1266,7 +1266,7 @@ static enum v4l2_search atvdemod_fe_search(struct v4l2_frontend *v4l2_fe) /* when manual search, just search current freq */ if (p->flag == ANALOG_FLAG_MANUL_SCAN) break; - +#ifdef DOUBLE_CHECK_44_25MHZ if (p->frequency >= 44200000 && p->frequency <= 44300000 && double_check_cnt) { @@ -1277,6 +1277,11 @@ static enum v4l2_search atvdemod_fe_search(struct v4l2_frontend *v4l2_fe) p->frequency += afc_step * ((search_count % 2) ? -search_count : search_count); } +#else + ++search_count; + p->frequency += afc_step * ((search_count % 2) ? + -search_count : search_count); +#endif } pr_dbg("[%s] [%d] over of range [min=%d, max=%d], search failed.\n", diff --git a/drivers/amlogic/atv_demod/atvauddemod_func.c b/drivers/amlogic/atv_demod/atvauddemod_func.c index 76c02cf..2b4516d7 100644 --- a/drivers/amlogic/atv_demod/atvauddemod_func.c +++ b/drivers/amlogic/atv_demod/atvauddemod_func.c @@ -872,7 +872,7 @@ void set_mono_dk(void) { int aa; - adec_wr_reg(ADDR_ADEC_CTRL, AUDIO_STANDARD_NICAM_DK); + adec_wr_reg(ADDR_ADEC_CTRL, AUDIO_STANDARD_NICAM_DK | (3 << 4)); set_filter(filter_100k, ADDR_DDC_FIR0_COEF, 65); set_filter(filter_100k, ADDR_DDC_FIR1_COEF, 65); @@ -889,7 +889,7 @@ void set_mono_i(void) { int aa; - adec_wr_reg(ADDR_ADEC_CTRL, AUDIO_STANDARD_NICAM_I); + adec_wr_reg(ADDR_ADEC_CTRL, AUDIO_STANDARD_NICAM_I | (3 << 4)); set_filter(filter_100k, ADDR_DDC_FIR0_COEF, 65); set_filter(filter_100k, ADDR_DDC_FIR1_COEF, 65); @@ -906,7 +906,7 @@ void set_mono_bg(void) { int aa; - adec_wr_reg(ADDR_ADEC_CTRL, AUDIO_STANDARD_NICAM_BG); + adec_wr_reg(ADDR_ADEC_CTRL, AUDIO_STANDARD_NICAM_BG | (3 << 4)); set_filter(filter_100k, ADDR_DDC_FIR0_COEF, 65); set_filter(filter_100k, ADDR_DDC_FIR1_COEF, 65); @@ -923,7 +923,7 @@ void set_mono_l(void) { int aa; - adec_wr_reg(ADDR_ADEC_CTRL, AUDIO_STANDARD_NICAM_L); + adec_wr_reg(ADDR_ADEC_CTRL, AUDIO_STANDARD_NICAM_L | (3 << 4)); set_filter(filter_100k, ADDR_DDC_FIR0_COEF, 65); set_filter(filter_100k, ADDR_DDC_FIR1_COEF, 65); @@ -1586,7 +1586,7 @@ void set_outputmode(uint32_t standard, uint32_t outmode) case AUDIO_STANDARD_MONO_I: case AUDIO_STANDARD_MONO_L: /* for FM MONO system to detection nicam status */ - if (!aud_reinit && get_nicam_lock_status()) { + if (!aud_mono_only && !aud_reinit && get_nicam_lock_status()) { if (standard == AUDIO_STANDARD_MONO_I) aud_std = AUDIO_STANDARD_NICAM_I; else if (standard == AUDIO_STANDARD_MONO_L) diff --git a/drivers/amlogic/atv_demod/atvdemod_func.c b/drivers/amlogic/atv_demod/atvdemod_func.c index 6e9a361..980bf7c 100644 --- a/drivers/amlogic/atv_demod/atvdemod_func.c +++ b/drivers/amlogic/atv_demod/atvdemod_func.c @@ -338,45 +338,67 @@ void atv_dmd_misc(void) pr_dbg("%s done.\n", __func__); } -void atv_dmd_ring_filter(bool on) +void atv_dmd_ring_filter(bool on, int std) { - unsigned long filter_status = 0; + int i = 0; + int filter = 0; + unsigned long status = 0; + unsigned long data = 0; + const unsigned int reg_addr[10] = { + 0x10, 0x14, 0x18, 0x1c, 0x20, 0x24, 0x28, 0x2c, 0x30, 0x34, + }; + const unsigned int peak_filter[][10] = { + /* default */ + { 0x8423F6, 0xFF86A967, 0x37FE45, 0xFF86A967, 0x3C223B, + 0x8423F6, 0xFF86A967, 0x37FE45, 0xFF86A967, 0x3C223B }, + /* ntsc-m */ + { 0x8274bf, 0x1d175c, 0x2aa526, 0x1d175c, 0x2d19e4, + 0x8274bf, 0x1d175c, 0x2aa526, 0x1d175c, 0x2d19e4 }, + /* pal-i */ + { 0x94d888, 0x5a39fb, 0xd8ebb, 0x5a39fb, 0x226744, + 0x94d888, 0x5a39fb, 0xd8ebb, 0x5a39fb, 0x226744 } + }; + if (!is_meson_tl1_cpu() && !is_meson_tm2_cpu()) return; - filter_status = atv_dmd_rd_long(APB_BLOCK_ADDR_GDE_EQUAL, 0x4c); - if (((filter_status & 0x01) && on) || (!(filter_status & 0x01) && !on)) + if (on) { + if (std == AML_ATV_DEMOD_VIDEO_MODE_PROP_PAL_BG) { + filter = 2; + } else if (std == AML_ATV_DEMOD_VIDEO_MODE_PROP_PAL_DK) { + filter = 2; + } else if (std == AML_ATV_DEMOD_VIDEO_MODE_PROP_PAL_I) { + filter = 2; + } else if (std == AML_ATV_DEMOD_VIDEO_MODE_PROP_NTSC_M || + std == AML_ATV_DEMOD_VIDEO_MODE_PROP_NTSC) { + filter = 1; + } else { + filter = 0; + on = false; + } + } else { + filter = 0; + } + + status = atv_dmd_rd_long(APB_BLOCK_ADDR_GDE_EQUAL, 0x4c); + data = atv_dmd_rd_long(APB_BLOCK_ADDR_GDE_EQUAL, reg_addr[0]); + if ((data == peak_filter[filter][0]) && on && (status & 0x01)) + return; + + if (!on && !(status & 0x01)) return; - if (on) { - atv_dmd_wr_long(APB_BLOCK_ADDR_GDE_EQUAL, 0x10, 0x8274bf); - atv_dmd_wr_long(APB_BLOCK_ADDR_GDE_EQUAL, 0x14, 0x1d175c); - atv_dmd_wr_long(APB_BLOCK_ADDR_GDE_EQUAL, 0x18, 0x2aa526); - atv_dmd_wr_long(APB_BLOCK_ADDR_GDE_EQUAL, 0x1c, 0x1d175c); - atv_dmd_wr_long(APB_BLOCK_ADDR_GDE_EQUAL, 0x20, 0x2d19e4); - atv_dmd_wr_long(APB_BLOCK_ADDR_GDE_EQUAL, 0x24, 0x8274bf); - atv_dmd_wr_long(APB_BLOCK_ADDR_GDE_EQUAL, 0x28, 0x1d175c); - atv_dmd_wr_long(APB_BLOCK_ADDR_GDE_EQUAL, 0x2c, 0x2aa526); - atv_dmd_wr_long(APB_BLOCK_ADDR_GDE_EQUAL, 0x30, 0x1d175c); - atv_dmd_wr_long(APB_BLOCK_ADDR_GDE_EQUAL, 0x34, 0x2d19e4); + /* disable filter */ + atv_dmd_wr_long(APB_BLOCK_ADDR_GDE_EQUAL, 0x4c, 0x0); + for (i = 0; i < 10; ++i) { + atv_dmd_wr_long(APB_BLOCK_ADDR_GDE_EQUAL, + reg_addr[i], peak_filter[filter][i]); + } + + if (on) { /* enable filter */ atv_dmd_wr_long(APB_BLOCK_ADDR_GDE_EQUAL, 0x4c, 0x1); - } else { - /* default value */ - atv_dmd_wr_long(APB_BLOCK_ADDR_GDE_EQUAL, 0x10, 0x8423F6); - atv_dmd_wr_long(APB_BLOCK_ADDR_GDE_EQUAL, 0x14, 0xFF86A967); - atv_dmd_wr_long(APB_BLOCK_ADDR_GDE_EQUAL, 0x18, 0x37FE45); - atv_dmd_wr_long(APB_BLOCK_ADDR_GDE_EQUAL, 0x1c, 0xFF86A967); - atv_dmd_wr_long(APB_BLOCK_ADDR_GDE_EQUAL, 0x20, 0x3C223B); - atv_dmd_wr_long(APB_BLOCK_ADDR_GDE_EQUAL, 0x24, 0x8423F6); - atv_dmd_wr_long(APB_BLOCK_ADDR_GDE_EQUAL, 0x28, 0xFF86A967); - atv_dmd_wr_long(APB_BLOCK_ADDR_GDE_EQUAL, 0x2c, 0x37FE45); - atv_dmd_wr_long(APB_BLOCK_ADDR_GDE_EQUAL, 0x30, 0xFF86A967); - atv_dmd_wr_long(APB_BLOCK_ADDR_GDE_EQUAL, 0x34, 0x3C223B); - - /* disable filter */ - atv_dmd_wr_long(APB_BLOCK_ADDR_GDE_EQUAL, 0x4c, 0x0); } pr_dbg("%s do atv_dmd_ring_filter %d ...\n", __func__, on); @@ -2021,12 +2043,10 @@ int atvdemod_init(struct atv_demod_priv *priv) if (!priv->scanning || non_std_en) atv_dmd_misc(); - if (!priv->scanning && - (broad_std == AML_ATV_DEMOD_VIDEO_MODE_PROP_NTSC_M || - broad_std == AML_ATV_DEMOD_VIDEO_MODE_PROP_NTSC)) - atv_dmd_ring_filter(true); + if (!priv->scanning) + atv_dmd_ring_filter(true, broad_std); else - atv_dmd_ring_filter(false); + atv_dmd_ring_filter(false, broad_std); atv_dmd_soft_reset(); diff --git a/drivers/amlogic/atv_demod/atvdemod_func.h b/drivers/amlogic/atv_demod/atvdemod_func.h index f7e09d3..87e73f3 100644 --- a/drivers/amlogic/atv_demod/atvdemod_func.h +++ b/drivers/amlogic/atv_demod/atvdemod_func.h @@ -31,6 +31,7 @@ extern unsigned int aud_std; extern unsigned int aud_mode; extern bool audio_thd_en; extern bool aud_reinit; +extern bool aud_mono_only; extern bool atv_audio_overmodulated_en; extern unsigned int non_std_en; @@ -70,7 +71,7 @@ extern void read_version_register(void); extern void check_communication_interface(void); extern void power_on_receiver(void); extern void atv_dmd_misc(void); -extern void atv_dmd_ring_filter(bool on); +void atv_dmd_ring_filter(bool on, int std); extern void configure_receiver(int Broadcast_Standard, unsigned int Tuner_IF_Frequency, int Tuner_Input_IF_inverted, int GDE_Curve, diff --git a/drivers/amlogic/clk/axg/axg_clk-pll.c b/drivers/amlogic/clk/axg/axg_clk-pll.c index 27cc75a..c3e094a 100644 --- a/drivers/amlogic/clk/axg/axg_clk-pll.c +++ b/drivers/amlogic/clk/axg/axg_clk-pll.c @@ -176,7 +176,7 @@ static int meson_axg_pll_set_rate(struct clk_hw *hw, unsigned long rate, const struct pll_rate_table *rate_set; unsigned long old_rate; unsigned int tmp; - int ret = 0; + int ret = 0, j = 10; u32 reg; unsigned long flags = 0; @@ -206,54 +206,62 @@ static int meson_axg_pll_set_rate(struct clk_hw *hw, unsigned long rate, } } - if (!strcmp(clk_hw_get_name(hw), "gp0_pll") - || !strcmp(clk_hw_get_name(hw), "hifi_pll") - || !strcmp(clk_hw_get_name(hw), "pcie_pll")) { + do { void *cntlbase = pll->base + p->reg_off; - - if (!strcmp(clk_hw_get_name(hw), "pcie_pll")) { - writel(AXG_PCIE_PLL_CNTL, - cntlbase + (unsigned long)(0*4)); - writel(AXG_PCIE_PLL_CNTL1, - cntlbase + (unsigned long)(1*4)); - writel(AXG_PCIE_PLL_CNTL2, - cntlbase + (unsigned long)(2*4)); - writel(AXG_PCIE_PLL_CNTL3, - cntlbase + (unsigned long)(3*4)); - writel(AXG_PCIE_PLL_CNTL4, - cntlbase + (unsigned long)(4*4)); - writel(AXG_PCIE_PLL_CNTL5, - cntlbase + (unsigned long)(5*4)); - writel(AXG_PCIE_PLL_CNTL6, - cntlbase + (unsigned long)(6*4)); - } else if (!strcmp(clk_hw_get_name(hw), "hifi_pll")) { - writel(AXG_HIFI_PLL_CNTL1, - cntlbase + (unsigned long)(6*4)); - writel(AXG_HIFI_PLL_CNTL2, - cntlbase + (unsigned long)(1*4)); - writel(AXG_HIFI_PLL_CNTL3, - cntlbase + (unsigned long)(2*4)); - writel(AXG_HIFI_PLL_CNTL4, - cntlbase + (unsigned long)(3*4)); - writel(AXG_HIFI_PLL_CNTL5, - cntlbase + (unsigned long)(4*4)); - } else { - writel(GXL_GP0_CNTL1, - cntlbase + (unsigned long)(6*4)); - writel(GXL_GP0_CNTL2, - cntlbase + (unsigned long)(1*4)); - writel(GXL_GP0_CNTL3, - cntlbase + (unsigned long)(2*4)); - writel(GXL_GP0_CNTL4, - cntlbase + (unsigned long)(3*4)); - writel(GXL_GP0_CNTL5, - cntlbase + (unsigned long)(4*4)); + if (!strcmp(clk_hw_get_name(hw), "gp0_pll") || + !strcmp(clk_hw_get_name(hw), "hifi_pll") || + !strcmp(clk_hw_get_name(hw), "pcie_pll")) { + if (!strcmp(clk_hw_get_name(hw), "pcie_pll")) { + writel(AXG_PCIE_PLL_CNTL, + cntlbase + (unsigned long)(0 * 4)); + writel(AXG_PCIE_PLL_CNTL1, + cntlbase + (unsigned long)(1 * 4)); + writel(AXG_PCIE_PLL_CNTL2, + cntlbase + (unsigned long)(2 * 4)); + writel(AXG_PCIE_PLL_CNTL3, + cntlbase + (unsigned long)(3 * 4)); + writel(AXG_PCIE_PLL_CNTL4, + cntlbase + (unsigned long)(4 * 4)); + writel(AXG_PCIE_PLL_CNTL5, + cntlbase + (unsigned long)(5 * 4)); + writel(AXG_PCIE_PLL_CNTL6, + cntlbase + (unsigned long)(6 * 4)); + } else if (!strcmp(clk_hw_get_name(hw), "hifi_pll")) { + writel(AXG_HIFI_PLL_CNTL1, + cntlbase + (unsigned long)(6 * 4)); + writel(AXG_HIFI_PLL_CNTL2, + cntlbase + (unsigned long)(1 * 4)); + writel(AXG_HIFI_PLL_CNTL3, + cntlbase + (unsigned long)(2 * 4)); + writel(AXG_HIFI_PLL_CNTL4, + cntlbase + (unsigned long)(3 * 4)); + writel(AXG_HIFI_PLL_CNTL5, + cntlbase + (unsigned long)(4 * 4)); + } else { + writel(GXL_GP0_CNTL1, + cntlbase + (unsigned long)(6 * 4)); + writel(GXL_GP0_CNTL2, + cntlbase + (unsigned long)(1 * 4)); + writel(GXL_GP0_CNTL3, + cntlbase + (unsigned long)(2 * 4)); + writel(GXL_GP0_CNTL4, + cntlbase + (unsigned long)(3 * 4)); + writel(GXL_GP0_CNTL5, + cntlbase + (unsigned long)(4 * 4)); + } + + reg = readl(pll->base + p->reg_off); + writel(((reg | (MESON_PLL_ENABLE)) & + (~MESON_PLL_RESET)), pll->base + p->reg_off); } - - reg = readl(pll->base + p->reg_off); - writel(((reg | (MESON_PLL_ENABLE)) & - (~MESON_PLL_RESET)), pll->base + p->reg_off); - } + /* waiting for 50us to check is locked or not */ + udelay(50); + /* lock bit is in the cntlbase */ + if (readl(cntlbase + (unsigned long)(0 * 4)) + & MESON_PLL_LOCK) + break; + j--; + } while (j); reg = readl(pll->base + p->reg_off); diff --git a/drivers/amlogic/clk/clk-pll.c b/drivers/amlogic/clk/clk-pll.c index ced3ae4..f18cbc8 100644 --- a/drivers/amlogic/clk/clk-pll.c +++ b/drivers/amlogic/clk/clk-pll.c @@ -164,7 +164,7 @@ static int meson_clk_pll_set_rate(struct clk_hw *hw, unsigned long rate, const struct pll_rate_table *rate_set; unsigned long old_rate; unsigned int tmp; - int ret = 0; + int ret = 0, j = 10; u32 reg; if (parent_rate == 0 || rate == 0) @@ -178,50 +178,57 @@ static int meson_clk_pll_set_rate(struct clk_hw *hw, unsigned long rate, p = &pll->n; - if (!strcmp(clk_hw_get_name(hw), "gp0_pll")) { + do { void *cntlbase = pll->base + p->reg_off; - - if ((get_cpu_type() == MESON_CPU_MAJOR_ID_GXBB) || - (get_cpu_type() == MESON_CPU_MAJOR_ID_GXTVBB)) { - writel(GXBB_GP0_CNTL2, - cntlbase + (unsigned long)(1*4)); - writel(GXBB_GP0_CNTL3, - cntlbase + (unsigned long)(2*4)); - writel(GXBB_GP0_CNTL4, - cntlbase + (unsigned long)(3*4)); - } else if (get_cpu_type() >= MESON_CPU_MAJOR_ID_GXL) { - writel(GXL_GP0_CNTL1, - cntlbase + (unsigned long)(6*4)); - writel(GXL_GP0_CNTL2, - cntlbase + (unsigned long)(1*4)); - writel(GXL_GP0_CNTL3, - cntlbase + (unsigned long)(2*4)); - writel(GXL_GP0_CNTL4, - cntlbase + (unsigned long)(3*4)); - writel(GXL_GP0_CNTL5, - cntlbase + (unsigned long)(4*4)); - - reg = readl(pll->base + p->reg_off); - writel(((reg | (MESON_PLL_ENABLE)) & + if (!strcmp(clk_hw_get_name(hw), "gp0_pll")) { + if ((get_cpu_type() == MESON_CPU_MAJOR_ID_GXBB) || + (get_cpu_type() == MESON_CPU_MAJOR_ID_GXTVBB)) { + writel(GXBB_GP0_CNTL2, + cntlbase + (unsigned long)(1 * 4)); + writel(GXBB_GP0_CNTL3, + cntlbase + (unsigned long)(2 * 4)); + writel(GXBB_GP0_CNTL4, + cntlbase + (unsigned long)(3 * 4)); + } else if (get_cpu_type() >= MESON_CPU_MAJOR_ID_GXL) { + writel(GXL_GP0_CNTL1, + cntlbase + (unsigned long)(6 * 4)); + writel(GXL_GP0_CNTL2, + cntlbase + (unsigned long)(1 * 4)); + writel(GXL_GP0_CNTL3, + cntlbase + (unsigned long)(2 * 4)); + writel(GXL_GP0_CNTL4, + cntlbase + (unsigned long)(3 * 4)); + writel(GXL_GP0_CNTL5, + cntlbase + (unsigned long)(4 * 4)); + + reg = readl(pll->base + p->reg_off); + writel(((reg | (MESON_PLL_ENABLE)) & (~MESON_PLL_RESET)), pll->base + p->reg_off); - } else if (get_cpu_type() >= MESON_CPU_MAJOR_ID_TXLX) { - writel(GXL_GP0_CNTL1, - cntlbase + (unsigned long)(6*4)); - writel(GXL_GP0_CNTL2, - cntlbase + (unsigned long)(1*4)); - writel(GXL_GP0_CNTL3, - cntlbase + (unsigned long)(2*4)); - writel(GXL_GP0_CNTL4, - cntlbase + (unsigned long)(3*4)); - writel(TXLL_GP0_CNTL5, - cntlbase + (unsigned long)(4*4)); - - reg = readl(pll->base + p->reg_off); - writel(((reg | (MESON_PLL_ENABLE)) & + } else if (get_cpu_type() >= MESON_CPU_MAJOR_ID_TXLX) { + writel(GXL_GP0_CNTL1, + cntlbase + (unsigned long)(6 * 4)); + writel(GXL_GP0_CNTL2, + cntlbase + (unsigned long)(1 * 4)); + writel(GXL_GP0_CNTL3, + cntlbase + (unsigned long)(2 * 4)); + writel(GXL_GP0_CNTL4, + cntlbase + (unsigned long)(3 * 4)); + writel(TXLL_GP0_CNTL5, + cntlbase + (unsigned long)(4 * 4)); + + reg = readl(pll->base + p->reg_off); + writel(((reg | (MESON_PLL_ENABLE)) & (~MESON_PLL_RESET)), pll->base + p->reg_off); + } } - - } + /* waiting for 50us to check is locked or not */ + udelay(50); + /* lock bit is in the cntlbase */ + if (readl(cntlbase + (unsigned long)(0 * 4)) + & MESON_PLL_LOCK) + break; + j--; + } while (j); reg = readl(pll->base + p->reg_off); diff --git a/drivers/amlogic/clk/g12a/g12a_clk-pll.c b/drivers/amlogic/clk/g12a/g12a_clk-pll.c index f82d593..e466bfc 100644 --- a/drivers/amlogic/clk/g12a/g12a_clk-pll.c +++ b/drivers/amlogic/clk/g12a/g12a_clk-pll.c @@ -222,7 +222,7 @@ static int meson_g12a_pll_set_rate(struct clk_hw *hw, unsigned long rate, const struct pll_rate_table *rate_set; unsigned long old_rate; unsigned long tmp; - int ret = 0; + int ret = 0, j = 10; u32 reg; unsigned long flags = 0; void *cntlbase; @@ -257,106 +257,115 @@ static int meson_g12a_pll_set_rate(struct clk_hw *hw, unsigned long rate, cntlbase = pll->base + p->reg_off; - if (!strcmp(clk_hw_get_name(hw), "pcie_pll")) { - writel(G12A_PCIE_PLL_CNTL0_0, - cntlbase + (unsigned long)(0*4)); - writel(G12A_PCIE_PLL_CNTL0_1, - cntlbase + (unsigned long)(0*4)); - writel(G12A_PCIE_PLL_CNTL1, - cntlbase + (unsigned long)(1*4)); - writel(G12A_PCIE_PLL_CNTL2, - cntlbase + (unsigned long)(2*4)); - writel(G12A_PCIE_PLL_CNTL3, - cntlbase + (unsigned long)(3*4)); - writel(G12A_PCIE_PLL_CNTL4, - cntlbase + (unsigned long)(4*4)); - writel(G12A_PCIE_PLL_CNTL5, - cntlbase + (unsigned long)(5*4)); - writel(G12A_PCIE_PLL_CNTL5_, - cntlbase + (unsigned long)(5*4)); - udelay(20); - writel(G12A_PCIE_PLL_CNTL4_, - cntlbase + (unsigned long)(4*4)); - udelay(10); - /*set pcie_apll_afc_start bit*/ - writel(G12A_PCIE_PLL_CNTL0_2, - cntlbase + (unsigned long)(0*4)); - writel(G12A_PCIE_PLL_CNTL0_3, - cntlbase + (unsigned long)(0*4)); - udelay(10); - writel(G12A_PCIE_PLL_CNTL2_, - cntlbase + (unsigned long)(2*4)); - goto OUT; - } else if (!strcmp(clk_hw_get_name(hw), "sys_pll")) { - writel((readl(cntlbase) | MESON_PLL_RESET) - & (~MESON_PLL_ENABLE), cntlbase); - writel(G12A_SYS_PLL_CNTL1, - cntlbase + (unsigned long)(1*4)); - writel(G12A_SYS_PLL_CNTL2, - cntlbase + (unsigned long)(2*4)); - writel(G12A_SYS_PLL_CNTL3, - cntlbase + (unsigned long)(3*4)); - writel(G12A_SYS_PLL_CNTL4, - cntlbase + (unsigned long)(4*4)); - writel(G12A_SYS_PLL_CNTL5, - cntlbase + (unsigned long)(5*4)); - writel(G12A_PLL_CNTL6, - cntlbase + (unsigned long)(6*4)); - udelay(10); - } else if (!strcmp(clk_hw_get_name(hw), "sys1_pll")) { - writel((readl(cntlbase) | MESON_PLL_RESET) - & (~MESON_PLL_ENABLE), cntlbase); - writel(G12A_SYS1_PLL_CNTL1, - cntlbase + (unsigned long)(1*4)); - writel(G12A_SYS1_PLL_CNTL2, - cntlbase + (unsigned long)(2*4)); - writel(G12A_SYS1_PLL_CNTL3, - cntlbase + (unsigned long)(3*4)); - writel(G12A_SYS1_PLL_CNTL4, - cntlbase + (unsigned long)(4*4)); - writel(G12A_SYS1_PLL_CNTL5, - cntlbase + (unsigned long)(5*4)); - writel(G12A_PLL_CNTL6, - cntlbase + (unsigned long)(6*4)); - udelay(10); - } else if (!strcmp(clk_hw_get_name(hw), "gp0_pll") - || !strcmp(clk_hw_get_name(hw), "gp1_pll")) { - writel((readl(cntlbase) | MESON_PLL_RESET) - & (~MESON_PLL_ENABLE), cntlbase); - writel(G12A_GP0_PLL_CNTL1, - cntlbase + (unsigned long)(1*4)); - writel(G12A_GP0_PLL_CNTL2, - cntlbase + (unsigned long)(2*4)); - writel(G12A_GP0_PLL_CNTL3, - cntlbase + (unsigned long)(3*4)); - writel(G12A_GP0_PLL_CNTL4, - cntlbase + (unsigned long)(4*4)); - writel(G12A_GP0_PLL_CNTL5, - cntlbase + (unsigned long)(5*4)); - writel(G12A_PLL_CNTL6, - cntlbase + (unsigned long)(6*4)); - udelay(10); - } else if (!strcmp(clk_hw_get_name(hw), "hifi_pll")) { - writel((readl(cntlbase) | MESON_PLL_RESET) - & (~MESON_PLL_ENABLE), cntlbase); - writel(G12A_HIFI_PLL_CNTL1, - cntlbase + (unsigned long)(1*4)); - writel(G12A_HIFI_PLL_CNTL2, - cntlbase + (unsigned long)(2*4)); - writel(G12A_HIFI_PLL_CNTL3, - cntlbase + (unsigned long)(3*4)); - writel(G12A_HIFI_PLL_CNTL4, - cntlbase + (unsigned long)(4*4)); - writel(G12A_HIFI_PLL_CNTL5, - cntlbase + (unsigned long)(5*4)); - writel(G12A_PLL_CNTL6, - cntlbase + (unsigned long)(6*4)); - udelay(10); - } else { - pr_err("%s: %s pll not found!!!\n", - __func__, clk_hw_get_name(hw)); - return -EINVAL; - } + do { + if (!strcmp(clk_hw_get_name(hw), "pcie_pll")) { + writel(G12A_PCIE_PLL_CNTL0_0, + cntlbase + (unsigned long)(0 * 4)); + writel(G12A_PCIE_PLL_CNTL0_1, + cntlbase + (unsigned long)(0 * 4)); + writel(G12A_PCIE_PLL_CNTL1, + cntlbase + (unsigned long)(1 * 4)); + writel(G12A_PCIE_PLL_CNTL2, + cntlbase + (unsigned long)(2 * 4)); + writel(G12A_PCIE_PLL_CNTL3, + cntlbase + (unsigned long)(3 * 4)); + writel(G12A_PCIE_PLL_CNTL4, + cntlbase + (unsigned long)(4 * 4)); + writel(G12A_PCIE_PLL_CNTL5, + cntlbase + (unsigned long)(5 * 4)); + writel(G12A_PCIE_PLL_CNTL5_, + cntlbase + (unsigned long)(5 * 4)); + udelay(20); + writel(G12A_PCIE_PLL_CNTL4_, + cntlbase + (unsigned long)(4 * 4)); + udelay(10); + /*set pcie_apll_afc_start bit*/ + writel(G12A_PCIE_PLL_CNTL0_2, + cntlbase + (unsigned long)(0 * 4)); + writel(G12A_PCIE_PLL_CNTL0_3, + cntlbase + (unsigned long)(0 * 4)); + udelay(10); + writel(G12A_PCIE_PLL_CNTL2_, + cntlbase + (unsigned long)(2 * 4)); + goto OUT; + } else if (!strcmp(clk_hw_get_name(hw), "sys_pll")) { + writel((readl(cntlbase) | MESON_PLL_RESET) + & (~MESON_PLL_ENABLE), cntlbase); + writel(G12A_SYS_PLL_CNTL1, + cntlbase + (unsigned long)(1 * 4)); + writel(G12A_SYS_PLL_CNTL2, + cntlbase + (unsigned long)(2 * 4)); + writel(G12A_SYS_PLL_CNTL3, + cntlbase + (unsigned long)(3 * 4)); + writel(G12A_SYS_PLL_CNTL4, + cntlbase + (unsigned long)(4 * 4)); + writel(G12A_SYS_PLL_CNTL5, + cntlbase + (unsigned long)(5 * 4)); + writel(G12A_PLL_CNTL6, + cntlbase + (unsigned long)(6 * 4)); + udelay(10); + } else if (!strcmp(clk_hw_get_name(hw), "sys1_pll")) { + writel((readl(cntlbase) | MESON_PLL_RESET) + & (~MESON_PLL_ENABLE), cntlbase); + writel(G12A_SYS1_PLL_CNTL1, + cntlbase + (unsigned long)(1 * 4)); + writel(G12A_SYS1_PLL_CNTL2, + cntlbase + (unsigned long)(2 * 4)); + writel(G12A_SYS1_PLL_CNTL3, + cntlbase + (unsigned long)(3 * 4)); + writel(G12A_SYS1_PLL_CNTL4, + cntlbase + (unsigned long)(4 * 4)); + writel(G12A_SYS1_PLL_CNTL5, + cntlbase + (unsigned long)(5 * 4)); + writel(G12A_PLL_CNTL6, + cntlbase + (unsigned long)(6 * 4)); + udelay(10); + } else if (!strcmp(clk_hw_get_name(hw), "gp0_pll") || + !strcmp(clk_hw_get_name(hw), "gp1_pll")) { + writel((readl(cntlbase) | MESON_PLL_RESET) + & (~MESON_PLL_ENABLE), cntlbase); + writel(G12A_GP0_PLL_CNTL1, + cntlbase + (unsigned long)(1 * 4)); + writel(G12A_GP0_PLL_CNTL2, + cntlbase + (unsigned long)(2 * 4)); + writel(G12A_GP0_PLL_CNTL3, + cntlbase + (unsigned long)(3 * 4)); + writel(G12A_GP0_PLL_CNTL4, + cntlbase + (unsigned long)(4 * 4)); + writel(G12A_GP0_PLL_CNTL5, + cntlbase + (unsigned long)(5 * 4)); + writel(G12A_PLL_CNTL6, + cntlbase + (unsigned long)(6 * 4)); + udelay(10); + } else if (!strcmp(clk_hw_get_name(hw), "hifi_pll")) { + writel((readl(cntlbase) | MESON_PLL_RESET) + & (~MESON_PLL_ENABLE), cntlbase); + writel(G12A_HIFI_PLL_CNTL1, + cntlbase + (unsigned long)(1 * 4)); + writel(G12A_HIFI_PLL_CNTL2, + cntlbase + (unsigned long)(2 * 4)); + writel(G12A_HIFI_PLL_CNTL3, + cntlbase + (unsigned long)(3 * 4)); + writel(G12A_HIFI_PLL_CNTL4, + cntlbase + (unsigned long)(4 * 4)); + writel(G12A_HIFI_PLL_CNTL5, + cntlbase + (unsigned long)(5 * 4)); + writel(G12A_PLL_CNTL6, + cntlbase + (unsigned long)(6 * 4)); + udelay(10); + } else { + pr_err("%s: %s pll not found!!!\n", + __func__, clk_hw_get_name(hw)); + return -EINVAL; + } + /* waiting for 50us to check is locked or not */ + udelay(50); + /* lock bit is in the cntlbase */ + if (readl(cntlbase + (unsigned long)(0 * 4)) + & MESON_PLL_LOCK) + break; + j--; + } while (j); reg = readl(pll->base + p->reg_off); diff --git a/drivers/amlogic/clk/tl1/tl1.c b/drivers/amlogic/clk/tl1/tl1.c index ee90068..5d63053 100644 --- a/drivers/amlogic/clk/tl1/tl1.c +++ b/drivers/amlogic/clk/tl1/tl1.c @@ -1188,6 +1188,11 @@ static void __init tl1_clkc_init(struct device_node *np) goto iounmap; } + /* fixed pll init */ + ret = clk_prepare_enable(tl1_fixed_pll.hw.clk); + if (ret) + pr_err("%s, failed to init fixed pll\n", __func__); + ret = of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data); if (ret < 0) { diff --git a/drivers/amlogic/clk/tl1/tl1_clk-pll.c b/drivers/amlogic/clk/tl1/tl1_clk-pll.c index b08c29f..637f4bc 100644 --- a/drivers/amlogic/clk/tl1/tl1_clk-pll.c +++ b/drivers/amlogic/clk/tl1/tl1_clk-pll.c @@ -499,6 +499,9 @@ static void meson_tl1_pll_disable(struct clk_hw *hw) if (pll->lock) spin_lock_irqsave(pll->lock, flags); + if (!strcmp(clk_hw_get_name(hw), "fixed_pll")) + pr_warn("Pay Attention, fixed pll will be disabled\n"); + writel(readl(pll->base + p->reg_off) | (MESON_PLL_RESET), pll->base + p->reg_off); writel(readl(pll->base + p->reg_off) & (~MESON_PLL_ENABLE), diff --git a/drivers/amlogic/cpufreq/meson-cpufreq.c b/drivers/amlogic/cpufreq/meson-cpufreq.c index 26ebcd0..039272e 100644 --- a/drivers/amlogic/cpufreq/meson-cpufreq.c +++ b/drivers/amlogic/cpufreq/meson-cpufreq.c @@ -37,7 +37,7 @@ #include <linux/delay.h> #include <linux/regulator/driver.h> #include <linux/regulator/driver.h> - +#include <linux/amlogic/pm.h> #include "../../regulator/internal.h" #include <linux/amlogic/scpi_protocol.h> #include "../../base/power/opp/opp.h" @@ -122,7 +122,6 @@ static unsigned int meson_cpufreq_set_rate(struct cpufreq_policy *policy, if (__clk_get_enable_count(high_freq_clk_p) >= 1) clk_disable_unprepare(high_freq_clk_p); } - if (!ret) { /* * FIXME: clk_set_rate hasn't returned an error here however it @@ -548,6 +547,14 @@ static int meson_cpufreq_init(struct cpufreq_policy *policy) volt_tol = DEF_VOLT_TOL; pr_info("value of voltage_tolerance %u\n", volt_tol); + if (of_property_read_u32(np, "dynamic_gp1_clk", + &gp1_clk_target)) { + pr_err("%s:don't find the node <dynamic_gp1_clk>\n", + __func__); + gp1_clk_target = 0; + } + pr_info("value of gp1_clk_target %u\n", gp1_clk_target); + if (cur_cluster < MAX_CLUSTERS) cpumask_copy(policy->cpus, topology_core_cpumask(policy->cpu)); @@ -673,8 +680,31 @@ static int meson_cpufreq_exit(struct cpufreq_policy *policy) static int meson_cpufreq_suspend(struct cpufreq_policy *policy) { + struct clk *dsu_pre_parent; + struct meson_cpufreq_driver_data *cpufreq_data; + int ret = 0; - return cpufreq_generic_suspend(policy); + cpufreq_data = policy->driver_data; + dsu_pre_parent = cpufreq_data->clk_dsu_pre; + + if (is_pm_freeze_mode() && gp1_clk_target) { + ret = __cpufreq_driver_target(policy, gp1_clk_target + * 1000, CPUFREQ_RELATION_H); + if (__clk_get_enable_count(dsu_pre_parent) == 0) { + ret = clk_prepare_enable(dsu_pre_parent); + if (ret) { + pr_err("%s: CPU%d gp1 pll enable failed,ret = %d\n", + __func__, policy->cpu, ret); + return ret; + } + } + /*set gp1 pll to 1.2G*/ + clk_set_rate(dsu_pre_parent, 1200 * 1000 * 1000); + pr_info("gp1 pll =%lu!\n", clk_get_rate(dsu_pre_parent)); + return ret; + } else + return cpufreq_generic_suspend(policy); + return 0; } static int meson_cpufreq_resume(struct cpufreq_policy *policy) diff --git a/drivers/amlogic/cpufreq/meson-cpufreq.h b/drivers/amlogic/cpufreq/meson-cpufreq.h index 09d6b2e..d7b16a0 100644 --- a/drivers/amlogic/cpufreq/meson-cpufreq.h +++ b/drivers/amlogic/cpufreq/meson-cpufreq.h @@ -57,6 +57,7 @@ static struct cpufreq_freqs freqs; #define DSU_HIGH_RATE (1500 * 1000) #define CPU_CMP_RATE (1800 * 1000) +unsigned int gp1_clk_target; /*whether use different tables or not*/ bool cpufreq_tables_supply; static unsigned int hispeed_cpufreq_max; diff --git a/drivers/amlogic/input/remote/sysfs.c b/drivers/amlogic/input/remote/sysfs.c index a6adb4f..03e8b88 100644 --- a/drivers/amlogic/input/remote/sysfs.c +++ b/drivers/amlogic/input/remote/sysfs.c @@ -523,8 +523,11 @@ static struct class remote_class = { int ir_sys_device_attribute_init(struct remote_chip *chip) { struct device *dev; + int err; - class_register(&remote_class); + err = class_register(&remote_class); + if (unlikely(err)) + return err; dev = device_create(&remote_class, NULL, chip->chr_devno, chip, chip->dev_name); diff --git a/drivers/amlogic/iomap/iomap.c b/drivers/amlogic/iomap/iomap.c index 2998450..c6c0041 100644 --- a/drivers/amlogic/iomap/iomap.c +++ b/drivers/amlogic/iomap/iomap.c @@ -38,10 +38,14 @@ static const struct of_device_id iomap_dt_match[] = { }; static void __iomem *meson_reg_map[IO_BUS_MAX] = { NULL }; +static uint meson_reg_max[IO_BUS_MAX] = { 0 }; inline int aml_reg_read(u32 bus_type, unsigned int reg, unsigned int *val) { - if (bus_type < IO_BUS_MAX && (meson_reg_map[bus_type] != NULL)) { + if ( + bus_type < IO_BUS_MAX && + (meson_reg_map[bus_type]) && + (meson_reg_max[bus_type] >= reg)) { *val = readl((meson_reg_map[bus_type]+reg)); return 0; } else @@ -51,7 +55,10 @@ EXPORT_SYMBOL(aml_reg_read); inline int aml_reg_write(u32 bus_type, unsigned int reg, unsigned int val) { - if (bus_type < IO_BUS_MAX && (meson_reg_map[bus_type] != NULL)) { + if ( + bus_type < IO_BUS_MAX && + (meson_reg_map[bus_type]) && + (meson_reg_max[bus_type] >= reg)) { writel(val, (meson_reg_map[bus_type]+reg)); return 0; } else @@ -281,6 +288,7 @@ static int iomap_probe(struct platform_device *pdev) if (of_address_to_resource(child, 0, &res)) return -1; meson_reg_map[i] = ioremap(res.start, resource_size(&res)); + meson_reg_max[i] = res.end - res.start; i++; } pr_info("amlogic iomap probe done\n"); diff --git a/drivers/amlogic/media/common/arch/registers/register_map.c b/drivers/amlogic/media/common/arch/registers/register_map.c index 390d0db..62d968e 100644 --- a/drivers/amlogic/media/common/arch/registers/register_map.c +++ b/drivers/amlogic/media/common/arch/registers/register_map.c @@ -50,12 +50,18 @@ enum { }; static void __iomem *codecio_reg_map[CODECIO_BUS_MAX]; +static u32 codecio_reg_max[CODECIO_BUS_MAX]; static inline int codecio_reg_read(u32 bus_type, u32 reg, u32 *val) { if (bus_type < CODECIO_BUS_MAX) { - if (codecio_reg_map[bus_type] == NULL) { - pr_err("No support bus type %d to read.\n", bus_type); + if ( + (!codecio_reg_map[bus_type]) || + (codecio_reg_max[bus_type] < reg)) { + pr_err( + "Not supported bus type %d or addr %x to read.\n", + bus_type, + reg); return -1; } @@ -68,8 +74,13 @@ static inline int codecio_reg_read(u32 bus_type, u32 reg, u32 *val) static inline int codecio_reg_write(u32 bus_type, u32 reg, u32 val) { if (bus_type < CODECIO_BUS_MAX) { - if (codecio_reg_map[bus_type] == NULL) { - pr_err("No support bus type %d to write.\n", bus_type); + if ( + (!codecio_reg_map[bus_type]) || + (codecio_reg_max[bus_type] < reg)) { + pr_err( + "Not supported bus type %d or addr %x to write.\n", + bus_type, + reg); return -1; } @@ -380,6 +391,7 @@ static int codec_io_probe(struct platform_device *pdev) pr_debug("ignore io source start %p,size=%d\n", (void *)res.start, (int)resource_size(&res)); } + codecio_reg_max[i] = res.end - res.start; i++; } /*pr_info("amlogic codec_io probe done\n"); */ diff --git a/drivers/amlogic/media/deinterlace/deinterlace.c b/drivers/amlogic/media/deinterlace/deinterlace.c index 2189602..e5bb5bf 100644 --- a/drivers/amlogic/media/deinterlace/deinterlace.c +++ b/drivers/amlogic/media/deinterlace/deinterlace.c @@ -462,6 +462,7 @@ static int lDI_POST_WR_REG_BITS(u32 adr, u32 val, u32 start, u32 len) static const struct di_ext_ops di_ext = { .di_post_reg_rd = lDI_POST_REG_RD, .di_post_wr_reg_bits = lDI_POST_WR_REG_BITS, + .post_update_mc = di_patch_post_update_mc, }; #endif @@ -4633,10 +4634,16 @@ static int check_recycle_buf(void) struct di_buf_s *di_buf = NULL;/* , *ptmp; */ int itmp; int ret = 0; + bool blk_flg = 0; +#ifdef DI_KEEP_HIS if (di_blocking) return ret; +#endif queue_for_each_entry(di_buf, ptmp, QUEUE_RECYCLE, list) { + if (di_blocking) + blk_flg = 1; + if ((di_buf->pre_ref_count == 0) && (di_buf->post_ref_count == 0)) { if (di_buf->type == VFRAME_TYPE_IN) { @@ -4688,6 +4695,10 @@ static int check_recycle_buf(void) #endif } } + + if (blk_flg) + pr_info("di:blk:recycle\n"); + return ret; } @@ -6994,7 +7005,7 @@ static void di_reg_process_irq(void) di_pre_stru.retry_index = 0; init_flag = 1; - di_pre_stru.reg_req_flag_irq = 1; + /*di_pre_stru.reg_req_flag_irq = 1;*/ } di_pre_stru.reg_irq_busy = false; } @@ -7209,11 +7220,11 @@ static int di_task_handle(void *data) } #endif } - if (di_pre_stru.reg_req_flag_irq || + if (/*di_pre_stru.reg_req_flag_irq ||*/ di_pre_stru.reg_req_flag) { di_reg_process(); di_pre_stru.reg_req_flag = 0; - di_pre_stru.reg_req_flag_irq = 0; + /*di_pre_stru.reg_req_flag_irq = 0;*/ } #ifdef CONFIG_CMA /* mutex_lock(&de_devp->cma_mutex);*/ @@ -7282,7 +7293,7 @@ static void di_pre_process_irq(struct di_pre_stru_s *pre_stru_p) if (pre_stru_p->unreg_req_flag_irq && (di_pre_stru.pre_de_busy == 0)) di_unreg_process_irq(); - if (init_flag == 0 && pre_stru_p->reg_req_flag_irq == 0 + if (init_flag == 0 /*&& pre_stru_p->reg_req_flag_irq == 0*/ && (!atomic_read(&di_flag_unreg))) di_reg_process_irq(); } @@ -7310,9 +7321,38 @@ static enum hrtimer_restart di_pre_hrtimer_func(struct hrtimer *timer) if (!di_pre_stru.bypass_flag) di_pre_trigger_work(&di_pre_stru); hrtimer_forward_now(&di_pre_hrtimer, ms_to_ktime(10)); - di_patch_post_update_mc(); + /*di_patch_post_update_mc();*/ return HRTIMER_RESTART; } + +static void post_display_buf_clear(void) +{ + struct di_buf_s *p = NULL; + int itmp; + + pr_info("%s:\n", __func__); + queue_for_each_entry(p, ptmp, QUEUE_DISPLAY, list) { + pr_info("\t%s,%d\n", vframe_type_name[p->type], p->index); + if (p->type == VFRAME_TYPE_POST) { + if (!atomic_dec_and_test(&p->di_cnt)) + di_print("%s,di_cnt > 0\n", __func__); + recycle_vframe_type_post(p); + } else { + queue_in(p, QUEUE_RECYCLE); + di_print("%s: %s[%d] =>recycle_list\n", __func__, + vframe_type_name[p->type], p->index); + } + } +} + +static void dbg_check_list(void) +{ + unsigned int post_display; + + post_display = list_count(QUEUE_DISPLAY); + di_pr_info("display:%d\n", post_display); +} + /* * provider/receiver interface */ @@ -7382,40 +7422,64 @@ static int di_receiver_event_fun(int type, void *data, void *arg) mutex_unlock(&di_event_mutex); pr_info("DI: unreg f\n"); } else if (type == VFRAME_EVENT_PROVIDER_RESET) { - di_blocking = 1; - + /*di_blocking = 1;*/ + mutex_lock(&di_event_mutex); pr_info("%s: VFRAME_EVENT_PROVIDER_RESET\n", __func__); if (is_bypass(NULL) || bypass_state || di_pre_stru.bypass_flag) { + /* only if di is bypassed, then we send the message of + * VFRAME_EVENT_PROVIDER_RESET to video and notify + * it to keep the last canvas buffer which was + * alloced by codec not by di. + */ vf_notify_receiver(VFM_NAME, VFRAME_EVENT_PROVIDER_RESET, NULL); + di_blocking = 1; + spin_lock_irqsave(&plist_lock, flags); + post_display_buf_clear(); + spin_unlock_irqrestore(&plist_lock, flags); } + di_blocking = 1; + /*-----------------------------------*/ + spin_lock_irqsave(&plist_lock, flags); + for (i = 0; i < MAX_IN_BUF_NUM; i++) { + if (vframe_in[i]) + pr_info("DI:clear vframe_in[%d]\n", i); - goto light_unreg; + vframe_in[i] = NULL; + } + spin_unlock_irqrestore(&plist_lock, flags); + di_blocking = 0; + mutex_unlock(&di_event_mutex); + pr_info("\treset:end\n"); + /*goto light_unreg;*/ } else if (type == VFRAME_EVENT_PROVIDER_LIGHT_UNREG) { + mutex_lock(&di_event_mutex); di_blocking = 1; - pr_info("%s: vf_notify_receiver ligth unreg\n", __func__); + pr_info("%s: LIGHT_UNREG\n", __func__); -light_unreg: +/*light_unreg:*/ +#if 1 spin_lock_irqsave(&plist_lock, flags); for (i = 0; i < MAX_IN_BUF_NUM; i++) { if (vframe_in[i]) - pr_dbg("DI:clear vframe_in[%d]\n", i); + pr_info("DI:clear vframe_in[%d]\n", i); vframe_in[i] = NULL; } spin_unlock_irqrestore(&plist_lock, flags); +#endif di_blocking = 0; + mutex_unlock(&di_event_mutex); + pr_info("\tlight unreg:end\n"); } else if (type == VFRAME_EVENT_PROVIDER_LIGHT_UNREG_RETURN_VFRAME) { unsigned char vf_put_flag = 0; - pr_dbg( - "%s:VFRAME_EVENT_PROVIDER_LIGHT_UNREG_RETURN_VFRAME\n", - __func__); + pr_info("%s:LIGHT_UNREG_RETURN_VFRAME\n", __func__); /* * do not display garbage when 2d->3d or 3d->2d */ @@ -7552,6 +7616,7 @@ light_unreg: if (reg_flag) { pr_err("[DI] no muti instance.\n"); mutex_unlock(&di_event_mutex); + dbg_check_list(); return -1; } pr_info("%s: vframe provider reg %s\n", __func__, @@ -7873,8 +7938,10 @@ static void di_vf_put(vframe_t *vf, void *arg) di_print("%s: 0x%p\n", __func__, vf); return; } + #ifdef DI_KEEP_HIS if (di_blocking) return; + #endif log_buffer_state("pu_"); di_buf = (struct di_buf_s *)vf->private_data; if (IS_ERR_OR_NULL(di_buf)) { diff --git a/drivers/amlogic/media/deinterlace/deinterlace.h b/drivers/amlogic/media/deinterlace/deinterlace.h index 996170d..c562e95 100644 --- a/drivers/amlogic/media/deinterlace/deinterlace.h +++ b/drivers/amlogic/media/deinterlace/deinterlace.h @@ -299,7 +299,7 @@ struct di_pre_stru_s { int unreg_req_flag_irq; int unreg_req_flag_cnt; int reg_req_flag; - int reg_req_flag_irq; + /*int reg_req_flag_irq;*/ int reg_req_flag_cnt; int reg_irq_busy; int force_unreg_req_flag; @@ -473,4 +473,6 @@ struct di_buf_s *get_di_buf(int queue_idx, int *start_pos); #define pr_error(fmt, args ...) pr_err("DI: " fmt, ## args) +/******************************************/ +/*#define DI_KEEP_HIS 0*/ #endif diff --git a/drivers/amlogic/media/deinterlace/deinterlace_dbg.c b/drivers/amlogic/media/deinterlace/deinterlace_dbg.c index 5d9d3af..0f9079c 100644 --- a/drivers/amlogic/media/deinterlace/deinterlace_dbg.c +++ b/drivers/amlogic/media/deinterlace/deinterlace_dbg.c @@ -475,8 +475,10 @@ void dump_di_pre_stru(struct di_pre_stru_s *di_pre_stru_p) di_pre_stru_p->unreg_req_flag_irq); pr_info("reg_req_flag = %d\n", di_pre_stru_p->reg_req_flag); + #ifdef DI_KEEP_HIS pr_info("reg_req_flag_irq = %d\n", di_pre_stru_p->reg_req_flag_irq); + #endif pr_info("cur_width = %d\n", di_pre_stru_p->cur_width); pr_info("cur_height = %d\n", @@ -547,8 +549,10 @@ static int dump_di_pre_stru_seq(struct seq_file *seq, void *v) di_pre_stru_p->unreg_req_flag_irq); seq_printf(seq, "%-25s = %d\n", "reg_req_flag", di_pre_stru_p->reg_req_flag); + #ifdef DI_KEEP_HIS seq_printf(seq, "%-25s = %d\n", "reg_req_flag_irq", di_pre_stru_p->reg_req_flag_irq); + #endif seq_printf(seq, "%-25s = %d\n", "cur_width", di_pre_stru_p->cur_width); seq_printf(seq, "%-25s = %d\n", "cur_height", diff --git a/drivers/amlogic/media/deinterlace/deinterlace_hw.c b/drivers/amlogic/media/deinterlace/deinterlace_hw.c index 6cda21b..26d0b6c 100644 --- a/drivers/amlogic/media/deinterlace/deinterlace_hw.c +++ b/drivers/amlogic/media/deinterlace/deinterlace_hw.c @@ -3837,30 +3837,34 @@ void pulldown_vof_win_config(struct pulldown_detected_s *wins) wins->regs[3].win_vs, 17, 12); DI_VSYNC_WR_MPEG_REG_BITS(DI_BLEND_REG3_Y, wins->regs[3].win_ve, 1, 12); - + /* revert the setting of top two lines do weave for */ + /* interlace video, suggest by vlsi-feijun */ DI_VSYNC_WR_MPEG_REG_BITS(DI_BLEND_CTRL, - (wins->regs[0].win_ve > wins->regs[0].win_vs) - ? 1 : 0, 16, 1); + 0, 16, 1); DI_VSYNC_WR_MPEG_REG_BITS(DI_BLEND_CTRL, - wins->regs[0].blend_mode, 8, 2); + /*wins->regs[0].blend_mode*/ + 0x03, 8, 2); DI_VSYNC_WR_MPEG_REG_BITS(DI_BLEND_CTRL, (wins->regs[1].win_ve > wins->regs[1].win_vs) ? 1 : 0, 17, 1); DI_VSYNC_WR_MPEG_REG_BITS(DI_BLEND_CTRL, - wins->regs[1].blend_mode, 10, 2); + /*wins->regs[1].blend_mode*/ + 0x03, 10, 2); DI_VSYNC_WR_MPEG_REG_BITS(DI_BLEND_CTRL, (wins->regs[2].win_ve > wins->regs[2].win_vs) ? 1 : 0, 18, 1); DI_VSYNC_WR_MPEG_REG_BITS(DI_BLEND_CTRL, - wins->regs[2].blend_mode, 12, 2); + /*wins->regs[2].blend_mode*/ + 0x03, 12, 2); DI_VSYNC_WR_MPEG_REG_BITS(DI_BLEND_CTRL, (wins->regs[3].win_ve > wins->regs[3].win_vs) ? 1 : 0, 19, 1); DI_VSYNC_WR_MPEG_REG_BITS(DI_BLEND_CTRL, - wins->regs[3].blend_mode, 14, 2); + /*wins->regs[3].blend_mode*/ + 0x03, 14, 2); } diff --git a/drivers/amlogic/media/di_local/di_local.c b/drivers/amlogic/media/di_local/di_local.c index 18fb0e5..3d86532 100644 --- a/drivers/amlogic/media/di_local/di_local.c +++ b/drivers/amlogic/media/di_local/di_local.c @@ -127,6 +127,13 @@ int DI_POST_WR_REG_BITS(u32 adr, u32 val, u32 start, u32 len) } EXPORT_SYMBOL(DI_POST_WR_REG_BITS); +void DI_POST_UPDATE_MC(void) +{ + if (dil_api && dil_api->post_update_mc) + dil_api->post_update_mc(); +} +EXPORT_SYMBOL(DI_POST_UPDATE_MC); + /*************************************** * reserved mem for di * **************************************/ diff --git a/drivers/amlogic/media/di_local/di_local.h b/drivers/amlogic/media/di_local/di_local.h index b956011..7f4b548 100644 --- a/drivers/amlogic/media/di_local/di_local.h +++ b/drivers/amlogic/media/di_local/di_local.h @@ -21,6 +21,7 @@ struct di_ext_ops { unsigned int (*di_post_reg_rd)(unsigned int addr); int (*di_post_wr_reg_bits)(u32 adr, u32 val, u32 start, u32 len); + void (*post_update_mc)(void); }; #endif /*__DI_LOCAL_H__*/ diff --git a/drivers/amlogic/media/di_multi/di_api.c b/drivers/amlogic/media/di_multi/di_api.c index 554bdf1..33e9154 100644 --- a/drivers/amlogic/media/di_multi/di_api.c +++ b/drivers/amlogic/media/di_multi/di_api.c @@ -26,6 +26,7 @@ static const struct di_ext_ops di_ext = { .di_post_reg_rd = l_DI_POST_REG_RD, .di_post_wr_reg_bits = l_DI_POST_WR_REG_BITS, + .post_update_mc = NULL, }; void dim_attach_to_local(void) diff --git a/drivers/amlogic/media/enhancement/amdolby_vision/amdolby_vision.c b/drivers/amlogic/media/enhancement/amdolby_vision/amdolby_vision.c index 1bf9a1b..8487ce3 100644 --- a/drivers/amlogic/media/enhancement/amdolby_vision/amdolby_vision.c +++ b/drivers/amlogic/media/enhancement/amdolby_vision/amdolby_vision.c @@ -3466,6 +3466,7 @@ void enable_dolby_vision(int enable) 0, 16, 1); /* core1 */ dolby_vision_core1_on = true; + pr_dolby_dbg("dolby_vision_core1_on\n"); } else if (dolby_vision_core1_on && (!(dolby_vision_mask & 1) || !dovi_setting_video_flag)) { @@ -3581,7 +3582,7 @@ void enable_dolby_vision(int enable) stb_core_setting_update_flag = FLAG_CHANGE_ALL; stb_core2_const_flag = false; memset(&dovi_setting, 0, sizeof(dovi_setting)); - pr_dolby_dbg("Dolby Vision G12a turn off\n"); + pr_info("Dolby Vision G12a turn off\n"); } else { VSYNC_WR_DV_REG_BITS( VIU_MISC_CTRL1, @@ -7199,9 +7200,9 @@ int register_dv_functions(const struct dolby_vision_func_s *func) if (dolby_vision_on_in_uboot) { if (is_vinfo_available(vinfo)) { is_sink_cap_changed(vinfo); - dolby_vision_on = true; } else pr_info("sink not available\n"); + dolby_vision_on = true; dolby_vision_wait_on = false; dolby_vision_wait_init = false; dolby_vision_on_in_uboot = 0; @@ -7615,6 +7616,7 @@ unsigned int dolby_vision_check_enable(void) dv_mode = dv_mode_table[1]; /*set_dolby_vision_mode(dv_mode);*/ dolby_vision_mode = dv_mode; + dolby_vision_status = DV_PROCESS; dolby_vision_ll_policy = DOLBY_VISION_LL_YUV422; pr_info("dovi enable in uboot and mode is LL 422\n"); } else if ((READ_VPP_DV_REG(DOLBY_CORE3_DIAG_CTRL) @@ -7623,6 +7625,7 @@ unsigned int dolby_vision_check_enable(void) dv_mode = dv_mode_table[1]; /*set_dolby_vision_mode(dv_mode);*/ dolby_vision_mode = dv_mode; + dolby_vision_status = DV_PROCESS; dolby_vision_ll_policy = DOLBY_VISION_LL_RGB444; pr_info("dovi enable in uboot and mode is LL RGB\n"); } else { @@ -7633,19 +7636,22 @@ unsigned int dolby_vision_check_enable(void) dv_mode = dv_mode_table[3]; /*set_dolby_vision_mode(dv_mmde);*/ dolby_vision_mode = dv_mode; + dolby_vision_status = HDR_PROCESS; pr_info("dovi enable in uboot and mode is HDR10\n"); } else if (READ_VPP_DV_REG(DOLBY_CORE3_REG_START + 1) == 4) { /*SDR mode*/ - dv_mode = dv_mode_table[4]; + dv_mode = dv_mode_table[5]; /*set_dolby_vision_mode(dv_mode);*/ dolby_vision_mode = dv_mode; + dolby_vision_status = SDR_PROCESS; pr_info("dovi enable in uboot and mode is SDR\n"); } else { /*STANDARD RGB444 mode*/ dv_mode = dv_mode_table[2]; /*set_dolby_vision_mode(dv_mode);*/ dolby_vision_mode = dv_mode; + dolby_vision_status = DV_PROCESS; dolby_vision_ll_policy = DOLBY_VISION_LL_DISABLE; pr_info("dovi enable in uboot and mode is DV ST\n"); diff --git a/drivers/amlogic/media/enhancement/amvecm/amvecm.c b/drivers/amlogic/media/enhancement/amvecm/amvecm.c index 5d1b530..2086acc 100644 --- a/drivers/amlogic/media/enhancement/amvecm/amvecm.c +++ b/drivers/amlogic/media/enhancement/amvecm/amvecm.c @@ -6626,9 +6626,11 @@ tvchip_pq_setting: } /*probe close sr0 peaking for switch on video*/ WRITE_VPP_REG_BITS(VPP_SRSHARP0_CTRL, 1, 0, 1); - if (cpu_after_eq(MESON_CPU_MAJOR_ID_TL1)) + if (cpu_after_eq(MESON_CPU_MAJOR_ID_TL1)) { WRITE_VPP_REG_BITS(VPP_SRSHARP1_CTRL, 0, 0, 1); - else + /*VPP_VADJ1_MISC bit1: minus black level enable for vadj1*/ + WRITE_VPP_REG_BITS(VPP_VADJ1_MISC, 1, 1, 1); + } else WRITE_VPP_REG_BITS(VPP_SRSHARP1_CTRL, 1, 0, 1); /*default dnlp off*/ WRITE_VPP_REG_BITS(SRSHARP0_PK_NR_ENABLE + sr_offset[0], diff --git a/drivers/amlogic/media/enhancement/amvecm/vlock.c b/drivers/amlogic/media/enhancement/amvecm/vlock.c index 7d973d4..f030206 100644 --- a/drivers/amlogic/media/enhancement/amvecm/vlock.c +++ b/drivers/amlogic/media/enhancement/amvecm/vlock.c @@ -81,7 +81,7 @@ static unsigned int pre_input_freq; static unsigned int pre_output_freq; static unsigned int vlock_dis_cnt; static bool vlock_vmode_changed; -static unsigned int vlock_notify_event; +static unsigned int vlock_notify_event = VOUT_EVENT_MODE_CHANGE; static unsigned int pre_hiu_reg_m; static unsigned int pre_hiu_reg_frac; static signed int pre_enc_max_line; @@ -511,6 +511,8 @@ static void vlock_setting(struct vframe_s *vf, WRITE_VPP_REG_BITS(VPU_VLOCK_MISC_CTRL, input_hz, 16, 8); temp_value = READ_VPP_REG(enc_max_line_addr); + if (!temp_value) + pr_info("vlock err: enc_max_line %d\n", temp_value); WRITE_VPP_REG_BITS(VPU_VLOCK_OROW_OCOL_MAX, temp_value + 1, 0, 14); @@ -686,8 +688,8 @@ void vlock_vmode_check(void) const struct vinfo_s *vinfo; /*unsigned int t0, t1;*/ - if (vlock_en == 0) - return; + /*if (vlock_en == 0)*/ + /* return;*/ vinfo = get_current_vinfo(); vlock_vmode_changed = 0; @@ -760,6 +762,9 @@ void vlock_vmode_check(void) #endif pre_enc_max_line = READ_VPP_REG(enc_max_line_addr); pre_enc_max_pixel = READ_VPP_REG(enc_max_pixel_addr); + if (!pre_enc_max_line || !pre_enc_max_pixel) + pr_info("vlock chk err: maxLine %d,maxPixel %d\n", + pre_enc_max_line, pre_enc_max_pixel); vlock_capture_limit = ((1024*1024*16)*vlock_line_limit) / (vinfo->vtotal + 1); @@ -1022,6 +1027,13 @@ static void vlock_enable_step3_enc(void) { unsigned int line_num = 0, enc_max_line = 0, polity_line_num = 0; unsigned int pixel_num = 0, enc_max_pixel = 0, polity_pixel_num = 0; + unsigned int val; + + if (!pre_enc_max_pixel || !pre_enc_max_line) { + pr_info("vlock enc max val err P:%d L:%d\n", + pre_enc_max_pixel, pre_enc_max_line); + return; + } /*vlock pixel num adjust*/ if (!(vlock_debug & VLOCK_DEBUG_ENC_PIXEL_ADJ_DIS)) { @@ -1034,12 +1046,21 @@ static void vlock_enable_step3_enc(void) } else { enc_max_pixel = pre_enc_max_pixel + pixel_num; } - if (enc_max_pixel > 0x1fff) + if (enc_max_pixel > 0x1fff) { WRITE_VPP_REG_BITS(enc_max_line_switch_addr, pixel_num, 0, 13); - else + val = pixel_num; + } else { WRITE_VPP_REG_BITS(enc_max_line_switch_addr, enc_max_pixel, 0, 13); + val = enc_max_pixel; + } + if (vlock_debug & VLOCK_DEBUG_INFO) { + pr_info("pixel:polity_pixel_num=%d, pixel_num=%d, maxP=%d\n", + polity_pixel_num, pixel_num, pre_enc_max_pixel); + pr_info("pixel:wr addr:0x%x, 0x%x\n", + enc_max_line_switch_addr, val); + } } /*vlock line num adjust*/ if (!(vlock_debug & VLOCK_DEBUG_ENC_LINE_ADJ_DIS)) { @@ -1055,6 +1076,12 @@ static void vlock_enable_step3_enc(void) if (enc_max_pixel > 0x1fff) enc_max_line += 1; WRITE_VPP_REG(enc_max_line_addr, enc_max_line); + if (vlock_debug & VLOCK_DEBUG_INFO) { + pr_info("line:polity_line_num=%d line_num=%d, maxL=%d\n", + polity_pixel_num, line_num, pre_enc_max_line); + pr_info("line:wr addr:0x%x, 0x%x\n", + enc_max_line_addr, enc_max_line); + } } if (vlock_log_en && (vlock_log_cnt < vlock_log_size)) { @@ -1065,8 +1092,8 @@ static void vlock_enable_step3_enc(void) vlock_reg_get(); vlock_log_cnt++; } - if (vlock_debug & VLOCK_DEBUG_INFO) - pr_info(">>>[%s]\n", __func__); + /*if (vlock_debug & VLOCK_DEBUG_INFO)*/ + /* pr_info(">>>[%s]\n", __func__);*/ } static void vlock_enable_step3_soft_enc(void) @@ -1730,7 +1757,11 @@ void vlock_status_init(void) /*back up orignal pll value*/ vlock.val_m = vlock_get_panel_pll_m(); vlock.val_frac = vlock_get_panel_pll_frac(); - + /*enc mode initial val*/ + pre_enc_max_line = READ_VPP_REG(enc_max_line_addr); + pre_enc_max_pixel = READ_VPP_REG(enc_max_pixel_addr); + pr_info("vlock: maxLine %d,maxPixel %d\n", + pre_enc_max_line, pre_enc_max_pixel); vlock.fsm_sts = VLOCK_STATE_NULL; vlock.fsm_prests = VLOCK_STATE_NULL; vlock.vf_sts = false; @@ -2445,13 +2476,13 @@ void vlock_status(void) pr_info("vlock_sync_limit_flag:%d\n", vlock_sync_limit_flag); pr_info("pre_hiu_reg_m:0x%x\n", pre_hiu_reg_m); pr_info("pre_hiu_reg_frac:0x%x\n", pre_hiu_reg_frac); - pr_info("pre_enc_max_line:0x%x\n", pre_enc_max_line); - pr_info("pre_enc_max_pixel:0x%x\n", pre_enc_max_pixel); + pr_info("enc_max_line_addr:0x%x 0x%x\n", + enc_max_line_addr, pre_enc_max_line); + pr_info("enc_max_pixel_addr:0x%x 0x%x\n", + enc_max_pixel_addr, pre_enc_max_pixel); pr_info("vlock_dis_cnt:%d\n", vlock_dis_cnt); pr_info("vlock_dis_cnt_no_vf:%d\n", vlock_dis_cnt_no_vf); pr_info("vlock_dis_cnt_no_vf_limit:%d\n", vlock_dis_cnt_no_vf_limit); - pr_info("enc_max_line_addr:0x%x\n", enc_max_line_addr); - pr_info("enc_max_pixel_addr:0x%x\n", enc_max_pixel_addr); pr_info("enc_video_mode_addr:0x%x\n", enc_video_mode_addr); pr_info("enc_max_line_switch_addr:0x%x\n", enc_max_line_switch_addr); pr_info("vlock_capture_limit:0x%x\n", vlock_capture_limit); @@ -2509,6 +2540,10 @@ void vlock_reg_dump(void) pr_info("[0x1cb3]=0x%08x\n", READ_VPP_REG(0x1cb3)); pr_info("[0x1cb4]=0x%08x\n", READ_VPP_REG(0x1cb4)); pr_info("[0x1cc8]=0x%08x\n", READ_VPP_REG(0x1cc8)); + pr_info("[0x%x]=0x%08x\n", enc_max_line_addr, + READ_VPP_REG(enc_max_line_addr)); + pr_info("[0x%x]=0x%08x\n", enc_max_pixel_addr, + READ_VPP_REG(enc_max_pixel_addr)); /*amvecm_hiu_reg_read(hhi_pll_reg_m, &val);*/ val = vlock_get_panel_pll_m(); @@ -2525,6 +2560,7 @@ void vlock_reg_dump(void) pr_info("HIU HDMI_PLL_CNTL2 0x%x=0x%x\n", HHI_HDMI_PLL_CNTL2, val); } + /*back up orignal pll value*/ /*pr_info("HIU pll m[0x%x]=0x%x\n", hhi_pll_reg_m, vlock.val_m);*/ /*pr_info("HIU pll f[0x%x]=0x%x\n", hhi_pll_reg_frac, vlock.val_frac);*/ @@ -2652,7 +2688,7 @@ int vlock_notify_callback(struct notifier_block *block, unsigned long cmd, return -1; } if (vlock_debug & VLOCK_DEBUG_INFO) - pr_info("current vmode=%s, vinfo w=%d,h=%d, cmd: 0x%lx\n", + pr_info("vlock notify vmode=%s, vinfo w=%d,h=%d, cmd: 0x%lx\n", vinfo->name, vinfo->width, vinfo->height, cmd); switch (cmd) { diff --git a/drivers/amlogic/media/enhancement/amvecm/vlock.h b/drivers/amlogic/media/enhancement/amvecm/vlock.h index 7eb6a7d..0750fe2 100644 --- a/drivers/amlogic/media/enhancement/amvecm/vlock.h +++ b/drivers/amlogic/media/enhancement/amvecm/vlock.h @@ -23,7 +23,7 @@ #include <linux/amlogic/media/vfm/vframe.h> #include "linux/amlogic/media/amvecm/ve.h" -#define VLOCK_VER "Ref.2019/8/18:vlock for double frq out" +#define VLOCK_VER "Ref.2019/9/17:log level 3 enc mode not work properly" #define VLOCK_REG_NUM 33 diff --git a/drivers/amlogic/media/osd/osd_hw.c b/drivers/amlogic/media/osd/osd_hw.c index 40541f1..05f7278 100644 --- a/drivers/amlogic/media/osd/osd_hw.c +++ b/drivers/amlogic/media/osd/osd_hw.c @@ -3039,7 +3039,8 @@ void osd_set_free_scale_enable_hw(u32 index, u32 enable) height_src = osd_hw.free_src_data[index].y_end - osd_hw.free_src_data[index].y_start + 1; if (height_dst != height_src && - osd_hw.free_dst_data[index].y_end < 2159) + osd_hw.free_dst_data[index].y_end < + osd_hw.vinfo_height[index] - 1) osd_set_dummy_data(index, 0); else osd_set_dummy_data(index, 0xff); @@ -3216,7 +3217,7 @@ void osd_set_window_axis_hw(u32 index, s32 x0, s32 y0, s32 x1, s32 y1) osd_hw.dst_data[index].w = x1 - x0 + 1; osd_hw.dst_data[index].h = y1 - y0 + 1; - if (osd_hw.free_dst_data[index].y_end >= 2159) + if (osd_hw.free_dst_data[index].y_end >= osd_hw.vinfo_height[index] - 1) osd_set_dummy_data(index, 0xff); osd_update_window_axis = true; if (osd_hw.hwc_enable[output_index] && @@ -4438,7 +4439,8 @@ static bool osd_direct_compose_pan_display(struct osd_fence_map_s *fence_map) if (((height_dst != height_src) || (width_dst != width_src)) && - osd_hw.free_dst_data[index].y_end < 2159) + osd_hw.free_dst_data[index].y_end < + osd_hw.vinfo_height[index] - 1) osd_set_dummy_data(index, 0); else osd_set_dummy_data(index, 0xff); @@ -7079,7 +7081,8 @@ static void osd_set_freescale(u32 index, if ((osd_hw.osd_meson_dev.cpu_id == __MESON_CPU_MAJOR_ID_G12A) && (height != src_height) && - osd_hw.free_dst_data[index].y_end < 2159) + osd_hw.free_dst_data[index].y_end < + osd_hw.vinfo_height[index] - 1) osd_set_dummy_data(index, 0); else osd_set_dummy_data(index, 0xff); @@ -8737,7 +8740,8 @@ static bool set_old_hwc_freescale(u32 index) height_src = osd_hw.free_src_data[index].y_end - osd_hw.free_src_data[index].y_start + 1; if (height_dst != height_src && - osd_hw.free_dst_data[index].y_end < 2159) + osd_hw.free_dst_data[index].y_end < + osd_hw.vinfo_height[index] - 1) osd_set_dummy_data(index, 0); else osd_set_dummy_data(index, 0xff); @@ -10788,7 +10792,8 @@ static bool osd_direct_render(struct osd_plane_map_s *plane_map) if (((height_dst != height_src) || (width_dst != width_src)) && - osd_hw.free_dst_data[index].y_end < 2159) + osd_hw.free_dst_data[index].y_end < + osd_hw.vinfo_height[index] - 1) osd_set_dummy_data(index, 0); else osd_set_dummy_data(index, 0xff); diff --git a/drivers/amlogic/media/video_sink/video.c b/drivers/amlogic/media/video_sink/video.c index a31bd02..7186590 100644 --- a/drivers/amlogic/media/video_sink/video.c +++ b/drivers/amlogic/media/video_sink/video.c @@ -6681,6 +6681,7 @@ static irqreturn_t vsync_isr_in(int irq, void *dev_id) struct vframe_s *cur_dispbuf_back = cur_dispbuf; static struct vframe_s *pause_vf; int force_flush = 0; + bool di_post_process_done = false; static u32 interrupt_count; int ret = 0; u32 next_afbc_request = atomic_read(&gAfbc_request); @@ -7225,7 +7226,7 @@ static irqreturn_t vsync_isr_in(int irq, void *dev_id) vf->pts, vf->omx_index, timestamp_pcrscr_get(), timestamp_vpts_get()); } - if (omx_continuous_drop_flag + if ((omx_continuous_drop_flag && omx_run) && !(debug_flag & DEBUG_FLAG_OMX_DISABLE_DROP_FRAME)) { if (is_dolby_vision_enable() && vf && @@ -8290,9 +8291,15 @@ SET_FILTER: 24) | (frame_par_di_set << 16), zoom_end_x_lines, zoom_start_y_lines, zoom_end_y_lines, cur_dispbuf); + di_post_process_done = true; } exit: + if (legacy_vpp && + !di_post_process_done && + (DI_POST_REG_RD(DI_POST_CTRL) & 0x100)) + DI_POST_UPDATE_MC(); + #if defined(PTS_LOGGING) || defined(PTS_TRACE_DEBUG) pts_trace++; #endif diff --git a/drivers/amlogic/memory_ext/vmap_stack.c b/drivers/amlogic/memory_ext/vmap_stack.c index 4d567ae..2d25772 100644 --- a/drivers/amlogic/memory_ext/vmap_stack.c +++ b/drivers/amlogic/memory_ext/vmap_stack.c @@ -52,6 +52,8 @@ static unsigned long stack_shrink_jiffies; static unsigned char vmap_shrink_enable; static atomic_t vmap_stack_size; +static atomic_t vmap_fault_count; +static atomic_t vmap_pre_handle_count; static struct aml_vmap *avmap; #ifdef CONFIG_ARM64 @@ -454,6 +456,18 @@ static void check_sp_fault_again(struct pt_regs *regs) #endif addr = sp - sizeof(*regs); + /* + * When we handle vmap stack fault, we are in pre-allcated + * per-cpu vmap stack. But if sp is near bottom of a page and we + * return to normal handler, sp may down grow to another page + * to cause a vmap fault again. So we need map next page for + * stack before page-fault happen. + * + * But we need check sp is realy in vmap stack range. + */ + if (!is_vmap_addr(addr)) /* addr may in linear mapping */ + return; + if (sp && ((addr & PAGE_MASK) != (sp & PAGE_MASK))) { /* * will fault when we copy back context, so handle @@ -477,6 +491,7 @@ static void check_sp_fault_again(struct pt_regs *regs) mod_delayed_work(system_highpri_wq, &avmap->mwork, 0); D("map page:%5lx for addr:%lx\n", page_to_pfn(page), addr); + atomic_inc(&vmap_pre_handle_count); #if DEBUG show_fault_stack(addr, regs); #endif @@ -557,6 +572,7 @@ int handle_vmap_fault(unsigned long addr, unsigned int esr, if (cache <= (VMAP_CACHE_PAGE / 2)) mod_delayed_work(system_highpri_wq, &avmap->mwork, 0); + atomic_inc(&vmap_fault_count); D("map page:%5lx for addr:%lx\n", page_to_pfn(page), addr); #if DEBUG show_fault_stack(addr, regs); @@ -586,6 +602,20 @@ static int shrink_vm_stack(unsigned long low, unsigned long high) return pages; } +void arch_report_meminfo(struct seq_file *m) +{ + unsigned long kb = 1 << (PAGE_SHIFT - 10); + unsigned long tmp1, tmp2, tmp3; + + tmp1 = kb * atomic_read(&vmap_stack_size); + tmp2 = kb * atomic_read(&vmap_fault_count); + tmp3 = kb * atomic_read(&vmap_pre_handle_count); + + seq_printf(m, "VmapStack: %8ld kB\n", tmp1); + seq_printf(m, "VmapFault: %8ld kB\n", tmp2); + seq_printf(m, "VmapPfault: %8ld kB\n", tmp3); +} + static unsigned long get_task_stack_floor(unsigned long sp) { unsigned long end; diff --git a/drivers/amlogic/mtd/rsv_manage.c b/drivers/amlogic/mtd/rsv_manage.c index 7b6d2d8..d49a7ce 100644 --- a/drivers/amlogic/mtd/rsv_manage.c +++ b/drivers/amlogic/mtd/rsv_manage.c @@ -44,7 +44,7 @@ static struct free_node_t *get_free_node(struct mtd_info *mtd) index = find_first_zero_bit((void *)&aml_chip->freeNodeBitmask, RESERVED_BLOCK_NUM); - if (index > RESERVED_BLOCK_NUM) { + if (index >= RESERVED_BLOCK_NUM) { pr_info("%s %d: index is greater than max! error", __func__, __LINE__); return NULL; diff --git a/drivers/amlogic/pm/Makefile b/drivers/amlogic/pm/Makefile index 49582c2..87b8709 100644 --- a/drivers/amlogic/pm/Makefile +++ b/drivers/amlogic/pm/Makefile @@ -1,3 +1,4 @@ obj-$(CONFIG_AMLOGIC_LEGACY_EARLY_SUSPEND) += lgcy_early_suspend.o obj-$(CONFIG_AMLOGIC_GX_SUSPEND) += gx_pm.o +obj-$(CONFIG_AMLOGIC_GX_SUSPEND) += vad_power.o obj-$(CONFIG_AMLOGIC_M8B_SUSPEND) += m8b_pm.o diff --git a/drivers/amlogic/pm/gx_pm.c b/drivers/amlogic/pm/gx_pm.c index 951a3dc..0ea41c5 100644 --- a/drivers/amlogic/pm/gx_pm.c +++ b/drivers/amlogic/pm/gx_pm.c @@ -42,6 +42,7 @@ #include <linux/kobject.h> #include <../kernel/power/power.h> #include <linux/amlogic/scpi_protocol.h> +#include "vad_power.h" typedef unsigned long (psci_fn)(unsigned long, unsigned long, unsigned long, unsigned long); @@ -218,6 +219,8 @@ static int __init meson_pm_probe(struct platform_device *pdev) { struct device_node *cpu_node; struct device_node *state_node; + struct pm_data *p_data; + struct device *dev = &pdev->dev; int count = 0, ret; u32 ver = psci_get_version(); u32 paddr = 0; @@ -246,6 +249,14 @@ static int __init meson_pm_probe(struct platform_device *pdev) suspend_set_ops(&meson_gx_ops); } + p_data = devm_kzalloc(&pdev->dev, sizeof(struct pm_data), GFP_KERNEL); + if (!p_data) + return -ENOMEM; + p_data->dev = dev; + dev_set_drvdata(dev, p_data); + + vad_wakeup_power_init(pdev, p_data); + ret = of_property_read_u32(pdev->dev.of_node, "debug_reg", &paddr); if (!ret) { @@ -280,6 +291,23 @@ uniomap: return -ENXIO; } +int pm_suspend_noirq(struct device *dev) +{ + vad_wakeup_power_suspend(dev); + return 0; +} + +int pm_resume_noirq(struct device *dev) +{ + vad_wakeup_power_resume(dev); + return 0; +} + +static const struct dev_pm_ops meson_pm_noirq_ops = { + .suspend_noirq = pm_suspend_noirq, + .resume_noirq = pm_resume_noirq, +}; + static int meson_pm_remove(struct platform_device *pdev) { return 0; @@ -296,6 +324,7 @@ static struct platform_driver meson_pm_driver = { .name = "pm-meson", .owner = THIS_MODULE, .of_match_table = amlogic_pm_dt_match, + .pm = &meson_pm_noirq_ops, }, .probe = meson_pm_probe, .remove = meson_pm_remove, diff --git a/drivers/amlogic/pm/vad_power.c b/drivers/amlogic/pm/vad_power.c new file mode 100644 index 0000000..77cadc9 --- a/dev/null +++ b/drivers/amlogic/pm/vad_power.c @@ -0,0 +1,217 @@ +/* + * drivers/amlogic/pm/vad_power.c + * + * 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. + * + */ + +#include <linux/pm.h> +#include <linux/platform_device.h> +#include <linux/io.h> +#include <linux/of.h> +#include <linux/errno.h> +#include <linux/of_address.h> +#include <linux/amlogic/pm.h> +#include <linux/kobject.h> +#include <linux/gpio.h> +#include <linux/clk.h> +#include <linux/clk-provider.h> +#include "../../gpio/gpiolib.h" +#include "vad_power.h" + +#define IO3V3_EN "vddio3v3_en" + +static int fixed_pll_cnt; + +int vad_wakeup_power_init(struct platform_device *pdev, struct pm_data *p_data) +{ + int ret; + const char *value; + struct gpio_desc *desc; + u32 paddr = 0; + + ret = of_property_read_string(pdev->dev.of_node, "vddio3v3_en", &value); + if (ret) { + pr_info("no vddio3v3_en pin"); + p_data->vddio3v3_en = 0; + } else { + desc = of_get_named_gpiod_flags(pdev->dev.of_node, + "vddio3v3_en", 0, NULL); + p_data->vddio3v3_en = desc_to_gpio(desc); + } + if (p_data->vddio3v3_en > 0) + gpio_request(p_data->vddio3v3_en, IO3V3_EN); + + ret = of_property_read_u32(pdev->dev.of_node, + "vad_wakeup_disable", &paddr); + if (!ret) { + p_data->vad_wakeup_disable = paddr; + pr_info("vad_wakeup_disable: 0x%x\n", paddr); + } else { + p_data->vad_wakeup_disable = 1; + } + + ret = of_property_read_u32(pdev->dev.of_node, + "dmc_asr", &paddr); + if (!ret) { + pr_info("dmc_asr: 0x%x\n", paddr); + p_data->dmc_asr = ioremap(paddr, 0x4); + } else { + p_data->dmc_asr = 0; + } + + ret = of_property_read_u32(pdev->dev.of_node, + "cpu_reg", &paddr); + if (!ret) { + pr_info("cpu_reg: 0x%x\n", paddr); + p_data->cpu_reg = ioremap(paddr, 0x4); + } else { + p_data->cpu_reg = 0; + } + + p_data->switch_clk81 = devm_clk_get(&pdev->dev, "switch_clk81"); + if (IS_ERR(p_data->switch_clk81)) { + dev_err(&pdev->dev, + "Can't get switch_clk81\n"); + return PTR_ERR(p_data->switch_clk81); + } + p_data->clk81 = devm_clk_get(&pdev->dev, "clk81"); + if (IS_ERR(p_data->clk81)) { + dev_err(&pdev->dev, + "Can't get clk81\n"); + return PTR_ERR(p_data->clk81); + } + p_data->xtal = devm_clk_get(&pdev->dev, "xtal"); + if (IS_ERR(p_data->xtal)) { + dev_err(&pdev->dev, + "Can't get xtal\n"); + return PTR_ERR(p_data->xtal); + } + p_data->fixed_pll = devm_clk_get(&pdev->dev, "fixed_pll"); + if (IS_ERR(p_data->fixed_pll)) { + dev_err(&pdev->dev, + "Can't get fixed_pll\n"); + return PTR_ERR(p_data->fixed_pll); + } + + return 0; +} + +void cpu_clk_switch_to_gp1(unsigned int flag, void __iomem *paddr) +{ + u32 control; + u32 dyn_pre_mux = 0; + u32 dyn_post_mux = 1; + u32 dyn_div = 1; + + control = readl(paddr); + /*check cpu busy or not*/ + do { + control = readl(paddr); + } while (control & (1 << 28)); + + if (!flag) { + dyn_pre_mux = 3; + dyn_post_mux = 1; + dyn_div = 1; + /*cpu clk sel channel a*/ + if (control & (1 << 10)) { + control = (control & ~((1 << 10) | (0x3f << 4) + | (1 << 2) | (0x3 << 0))) + | ((0 << 10) + | (dyn_div << 4) + | (dyn_post_mux << 2) + | (dyn_pre_mux << 0)); + } else { + /*cpu clk sel channel b*/ + control = (control & ~((1 << 10) | (0x3f << 20) + | (1 << 18) | (0x3 << 16))) + | ((1 << 10) + | (dyn_div << 20) + | (dyn_post_mux << 18) + | (dyn_pre_mux << 16)); + } + } else { + if (control & (1 << 10)) + control = control & ~(1 << 10); + else + control = control | (1 << 10); + } + writel(control, paddr); +} + +int vad_wakeup_power_suspend(struct device *dev) +{ + struct pm_data *p_data = dev_get_drvdata(dev); + int i; + + if (!is_pm_freeze_mode() || p_data->vad_wakeup_disable) + return 0; + + clk_set_parent(p_data->switch_clk81, p_data->xtal); + pr_info("switch clk81 to 24M.\n"); + + /*cpu clk switch to gp1*/ + cpu_clk_switch_to_gp1(0, p_data->cpu_reg); + pr_info("cpu clk switch to gp1.\n"); + + fixed_pll_cnt = __clk_get_enable_count(p_data->fixed_pll); + if (fixed_pll_cnt > 1) + dev_warn(dev, + "Now fixed pll enable count = %d\n", + fixed_pll_cnt); + + for (i = 0; i < fixed_pll_cnt; i++) + clk_disable_unprepare(p_data->fixed_pll); + + gpio_direction_output(p_data->vddio3v3_en, 0); + pr_info("power off vddio_3v3.\n"); + + if (p_data->dmc_asr) { + writel(0x3fe00, p_data->dmc_asr); + pr_info("enable dmc asr\n"); + } + + return 0; +} + +int vad_wakeup_power_resume(struct device *dev) +{ + struct pm_data *p_data = dev_get_drvdata(dev); + int i; + + if (!is_pm_freeze_mode() || p_data->vad_wakeup_disable) + return 0; + + gpio_direction_output(p_data->vddio3v3_en, 1); + pr_info("power on vddio_3v3.\n"); + + if (p_data->dmc_asr) { + writel(0x0, p_data->dmc_asr); + pr_info("disable dmc asr\n"); + } + + /* enable fixed pll */ + for (i = 0; i < fixed_pll_cnt; i++) { + if (clk_prepare_enable(p_data->fixed_pll)) + dev_err(dev, "failed to enable fixed pll\n"); + } + + /*restore cpu clk*/ + cpu_clk_switch_to_gp1(1, p_data->cpu_reg); + pr_info("cpu clk restore.\n"); + clk_set_parent(p_data->switch_clk81, p_data->clk81); + pr_info("switch clk81 to 166M.\n"); + + return 0; +} diff --git a/drivers/amlogic/pm/vad_power.h b/drivers/amlogic/pm/vad_power.h new file mode 100644 index 0000000..ed651c2 --- a/dev/null +++ b/drivers/amlogic/pm/vad_power.h @@ -0,0 +1,33 @@ +/* + * drivers/amlogic/pm/vad_power.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. + * + */ + +struct pm_data { + struct device *dev; + int vddio3v3_en; + bool vad_wakeup_disable; + void __iomem *dmc_asr; + void __iomem *cpu_reg; + struct clk *switch_clk81; + struct clk *clk81; + struct clk *fixed_pll; + struct clk *xtal; +}; + +int vad_wakeup_power_init(struct platform_device *pdev, struct pm_data *p_data); +int vad_wakeup_power_suspend(struct device *dev); +int vad_wakeup_power_resume(struct device *dev); + diff --git a/drivers/amlogic/usb/dwc_otg/310/dwc_otg_cil.c b/drivers/amlogic/usb/dwc_otg/310/dwc_otg_cil.c index f0e4e5c..c01c78c 100644 --- a/drivers/amlogic/usb/dwc_otg/310/dwc_otg_cil.c +++ b/drivers/amlogic/usb/dwc_otg/310/dwc_otg_cil.c @@ -789,7 +789,7 @@ int dwc_otg_save_global_regs(dwc_otg_core_if_t *core_if) gr->pcgcctl_local = DWC_READ_REG32(core_if->pcgcctl); gr->gdfifocfg_local = DWC_READ_REG32(&core_if->core_global_regs->gdfifocfg); - for (i = 0; i < MAX_EPS_CHANNELS; i++) { + for (i = 0; i < MAX_EPS_CHANNELS - 1; i++) { gr->dtxfsiz_local[i] = DWC_READ_REG32(&(core_if->core_global_regs->dtxfsiz[i])); } @@ -948,7 +948,7 @@ int dwc_otg_restore_global_regs(dwc_otg_core_if_t *core_if) gr->hptxfsiz_local); DWC_WRITE_REG32(&core_if->core_global_regs->gdfifocfg, gr->gdfifocfg_local); - for (i = 0; i < MAX_EPS_CHANNELS; i++) + for (i = 0; i < MAX_EPS_CHANNELS - 1; i++) DWC_WRITE_REG32(&core_if->core_global_regs->dtxfsiz[i], gr->dtxfsiz_local[i]); @@ -1070,7 +1070,7 @@ int restore_essential_regs(dwc_otg_core_if_t *core_if, int rmode, int is_host) dwc_udelay(10); /* Load restore values for [31:14] bits and set EssRegRestored bit */ - pcgcctl.d32 = ((gr->pcgcctl_local | 0xffffc000) & 0xffffc000); + pcgcctl.d32 = 0xffffc000; pcgcctl.b.ess_reg_restored = 1; if (rmode) pcgcctl.b.restoremode = 1; diff --git a/drivers/amlogic/usb/dwc_otg/310/dwc_otg_cil_intr.c b/drivers/amlogic/usb/dwc_otg/310/dwc_otg_cil_intr.c index 760c793..68f55ef 100644 --- a/drivers/amlogic/usb/dwc_otg/310/dwc_otg_cil_intr.c +++ b/drivers/amlogic/usb/dwc_otg/310/dwc_otg_cil_intr.c @@ -397,7 +397,8 @@ void w_conn_id_status_change(void *p) if (++count > 10000) break; } - DWC_ASSERT(++count < 10000, + ++count; + DWC_ASSERT(count < 10000, "Connection id status change timed out"); core_if->op_state = B_PERIPHERAL; DWC_PRINTF("DEVICE mode\n"); @@ -418,7 +419,8 @@ host: if (++count > 10000) break; } - DWC_ASSERT(++count < 10000, + ++count; + DWC_ASSERT(count < 10000, "Connection id status change timed out"); core_if->op_state = A_HOST; DWC_PRINTF("HOST mode\n"); diff --git a/drivers/amlogic/usb/dwc_otg/310/dwc_otg_hcd_ddma.c b/drivers/amlogic/usb/dwc_otg/310/dwc_otg_hcd_ddma.c index 75269e4..378fdbbbf 100644 --- a/drivers/amlogic/usb/dwc_otg/310/dwc_otg_hcd_ddma.c +++ b/drivers/amlogic/usb/dwc_otg/310/dwc_otg_hcd_ddma.c @@ -1012,10 +1012,8 @@ stop_scan: */ if (halt_status == DWC_OTG_HC_XFER_STALL) qh->data_toggle = DWC_OTG_HC_PID_DATA0; - else { - if (qtd) - dwc_otg_hcd_save_data_toggle(hc, hc_regs, qtd); - } + else + dwc_otg_hcd_save_data_toggle(hc, hc_regs, qtd); } if (halt_status == DWC_OTG_HC_XFER_COMPLETE) { diff --git a/drivers/amlogic/usb/phy/phy-aml-new-usb-v2.h b/drivers/amlogic/usb/phy/phy-aml-new-usb-v2.h index a9c3ed1..dd07843 100644 --- a/drivers/amlogic/usb/phy/phy-aml-new-usb-v2.h +++ b/drivers/amlogic/usb/phy/phy-aml-new-usb-v2.h @@ -23,4 +23,4 @@ extern int amlogic_new_usbphy_reset_v2(struct amlogic_usb_v2 *phy); extern int amlogic_new_usbphy_reset_phycfg_v2 (struct amlogic_usb_v2 *phy, int cnt); - +void set_usb_phy_host_tuning(int port, int default_val); diff --git a/drivers/android/binder.c b/drivers/android/binder.c index 0983606..00192c5 100644 --- a/drivers/android/binder.c +++ b/drivers/android/binder.c @@ -3232,6 +3232,7 @@ static void binder_transaction(struct binder_proc *proc, if (target_node && target_node->txn_security_ctx) { u32 secid; + size_t added_size; security_task_getsecid(proc->tsk, &secid); ret = security_secid_to_secctx(secid, &secctx, &secctx_sz); @@ -3241,7 +3242,15 @@ static void binder_transaction(struct binder_proc *proc, return_error_line = __LINE__; goto err_get_secctx_failed; } - extra_buffers_size += ALIGN(secctx_sz, sizeof(u64)); + added_size = ALIGN(secctx_sz, sizeof(u64)); + extra_buffers_size += added_size; + if (extra_buffers_size < added_size) { + /* integer overflow of extra_buffers_size */ + return_error = BR_FAILED_REPLY; + return_error_param = EINVAL; + return_error_line = __LINE__; + goto err_bad_extra_size; + } } trace_binder_transaction(reply, t, target_node); @@ -3598,6 +3607,7 @@ err_copy_data_failed: t->buffer->transaction = NULL; binder_alloc_free_buf(&target_proc->alloc, t->buffer); err_binder_alloc_buf_failed: +err_bad_extra_size: if (secctx) security_release_secctx(secctx, secctx_sz); err_get_secctx_failed: diff --git a/drivers/extcon/extcon.c b/drivers/extcon/extcon.c index b886a60..c7ad282 100644 --- a/drivers/extcon/extcon.c +++ b/drivers/extcon/extcon.c @@ -151,6 +151,26 @@ struct __extcon_info { .id = EXTCON_SPDIFIN_AUDIOTYPE, .name = "SPDIFIN-AUDIOTYPE", }, + [EXTCON_EARCRX_ATNDTYP_ARC] = { + .type = EXTCON_TYPE_MISC, + .id = EXTCON_EARCRX_ATNDTYP_ARC, + .name = "EARCRX-ARC", + }, + [EXTCON_EARCRX_ATNDTYP_EARC] = { + .type = EXTCON_TYPE_MISC, + .id = EXTCON_EARCRX_ATNDTYP_EARC, + .name = "EARCRX-EARC", + }, + [EXTCON_EARCTX_ATNDTYP_ARC] = { + .type = EXTCON_TYPE_MISC, + .id = EXTCON_EARCTX_ATNDTYP_ARC, + .name = "EARCTX-ARC", + }, + [EXTCON_EARCTX_ATNDTYP_EARC] = { + .type = EXTCON_TYPE_MISC, + .id = EXTCON_EARCTX_ATNDTYP_EARC, + .name = "EARCTX-EARC", + }, #endif /* Display external connector */ [EXTCON_DISP_HDMI] = { diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-meson.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-meson.c index a4cdb8e..68999cb 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-meson.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-meson.c @@ -34,6 +34,7 @@ /*if not g12a use genphy driver*/ /* if it's internal phy we will shutdown analog*/ static unsigned int is_internal_phy; +static unsigned int external_invert_flag; /* Ethernet register for G12A PHY */ #define REG_ETH_REG1_OFFSET 0x4 #define ETH_PLL_CTL0 0x44 @@ -71,7 +72,26 @@ struct meson_dwmac { static void meson6_dwmac_fix_mac_speed(void *priv, unsigned int speed) { #ifdef CONFIG_AMLOGIC_ETH_PRIVE + struct meson_dwmac *dwmac = priv; + unsigned int val; + + if ((dwmac->data->g12a_phy) && (!is_internal_phy)) { + if (!external_invert_flag) + return; + val = readl(dwmac->reg); + + switch (speed) { + case SPEED_10: + case SPEED_100: + val &= ~(1 << 3); + break; + case SPEED_1000: + val |= (1 << 3); + break; + } + writel(val, dwmac->reg); + } #else struct meson_dwmac *dwmac = priv; unsigned int val; @@ -228,6 +248,21 @@ static void __iomem *network_interface_setup(struct platform_device *pdev) } else { pin_ctl = devm_pinctrl_get_select(&pdev->dev, "eth_pins"); } + + res = platform_get_resource(pdev, IORESOURCE_MEM, 3); + if (res) { + addr = devm_ioremap_resource(dev, res); + if (IS_ERR(addr)) { + dev_err(&pdev->dev, "Unable to map %d\n", __LINE__); + return NULL; + } + + ee_reset_base = addr; + pr_info(" ee eth reset:Addr = %p\n", ee_reset_base); + } else { + ee_reset_base = NULL; + dev_err(&pdev->dev, "Unable to get resource(%d)\n", __LINE__); + } pr_debug("Ethernet: pinmux setup ok\n"); return PREG_ETH_REG0; } @@ -315,6 +350,7 @@ static void __iomem *g12a_network_interface_setup(struct platform_device *pdev) u32 internal_phy = 0; int auto_cali_idx = -1; is_internal_phy = 0; + external_invert_flag = 0; ppdev = pdev; pr_debug("g12a_network_interface_setup\n"); @@ -420,6 +456,9 @@ static void __iomem *g12a_network_interface_setup(struct platform_device *pdev) if (of_property_read_u32(np, "rx_delay", &external_rx_delay)) pr_debug("set exphy rx delay\n"); } + + if (mc_val & (1 << 3)) + external_invert_flag = 1; /* only exphy support wol since g12a*/ /*we enable/disable wol with item in dts with "wol=<1>"*/ if (of_property_read_u32(np, "wol", @@ -512,11 +551,11 @@ static int meson6_dwmac_resume(struct device *dev) struct pinctrl *pin_ctrl; struct pinctrl_state *turnon_tes = NULL; pr_info("resuem inter = %d\n", is_internal_phy); - if ((is_internal_phy) && (support_mac_wol == 0)) { - if (ee_reset_base) - writel((1 << 11), (void __iomem *) - (unsigned long)ee_reset_base); + if (ee_reset_base) + writel((1 << 11), (void __iomem *) + (unsigned long)ee_reset_base); + if ((is_internal_phy) && (support_mac_wol == 0)) { pin_ctrl = devm_pinctrl_get(dev); if (IS_ERR_OR_NULL(pin_ctrl)) { pr_info("pinctrl is null\n"); diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 7eae498..6ddca80e 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -3685,12 +3685,6 @@ int stmmac_resume(struct device *dev) if (priv->phydev) phy_start(priv->phydev); -#ifdef TX_MONITOR - if (!ee_reset_base) { - stmmac_release(priv_monitor->dev); - stmmac_open(priv_monitor->dev); - } -#endif return 0; } EXPORT_SYMBOL_GPL(stmmac_resume); diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index aa79881..e63c8c7 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c @@ -4999,6 +4999,9 @@ loop: done: hub_port_disable(hub, port1, 1); +#ifdef CONFIG_AMLOGIC_USB2PHY + set_usb_phy_host_tuning(port1 - 1, 1); +#endif if (hcd->driver->relinquish_port && !hub->hdev->parent) { if (status != -ENOTCONN && status != -ENODEV) hcd->driver->relinquish_port(hcd, port1); diff --git a/drivers/usb/core/hub.h b/drivers/usb/core/hub.h index 34c1a7e..d82a20b 100644 --- a/drivers/usb/core/hub.h +++ b/drivers/usb/core/hub.h @@ -124,6 +124,9 @@ extern int hub_port_debounce(struct usb_hub *hub, int port1, bool must_be_connected); extern int usb_clear_port_feature(struct usb_device *hdev, int port1, int feature); +#ifdef CONFIG_AMLOGIC_USB2PHY +void set_usb_phy_host_tuning(int port, int default_val); +#endif static inline bool hub_is_port_power_switchable(struct usb_hub *hub) { diff --git a/fs/proc/meminfo.c b/fs/proc/meminfo.c index 58bd174..8a42849 100644 --- a/fs/proc/meminfo.c +++ b/fs/proc/meminfo.c @@ -15,9 +15,6 @@ #ifdef CONFIG_CMA #include <linux/cma.h> #endif -#ifdef CONFIG_AMLOGIC_VMAP -#include <linux/amlogic/vmap_stack.h> -#endif #include <asm/page.h> #include <asm/pgtable.h> #include "internal.h" @@ -156,9 +153,6 @@ static int meminfo_proc_show(struct seq_file *m, void *v) show_val_kb(m, "CmaFree: ", global_page_state(NR_FREE_CMA_PAGES)); #endif -#ifdef CONFIG_AMLOGIC_VMAP - show_val_kb(m, "VmapStack: ", get_vmap_stack_size()); -#endif hugetlb_report_meminfo(m); diff --git a/include/linux/amlogic/media/sound/iomapres.h b/include/linux/amlogic/media/sound/iomapres.h new file mode 100644 index 0000000..b3b2fbd --- a/dev/null +++ b/include/linux/amlogic/media/sound/iomapres.h @@ -0,0 +1,34 @@ +/* + * include/linux/amlogic/media/sound/iomapres.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 __IOMAPRES_H__ +#define __IOMAPRES_H__ + +#include <linux/regmap.h> + +struct regmap *regmap_resource(struct device *dev, char *name); + +unsigned int mmio_read(struct regmap *map, unsigned int reg_ofs); + +int mmio_write(struct regmap *map, unsigned int reg_ofs, unsigned int value); + +int mmio_update_bits(struct regmap *map, + unsigned int reg_ofs, + unsigned int mask, + unsigned int value); + +#endif diff --git a/include/linux/amlogic/media/sound/spdif_info.h b/include/linux/amlogic/media/sound/spdif_info.h index 36df67a..9f40149 100644 --- a/include/linux/amlogic/media/sound/spdif_info.h +++ b/include/linux/amlogic/media/sound/spdif_info.h @@ -29,6 +29,8 @@ struct iec958_chsts { unsigned short chstat1_r; }; +bool spdifout_is_raw(void); + extern bool spdif_is_4x_clk(void); extern void spdif_get_channel_status_info(struct iec958_chsts *chsts, diff --git a/include/linux/amlogic/media/video_sink/video.h b/include/linux/amlogic/media/video_sink/video.h index 6004ec2..640271b 100644 --- a/include/linux/amlogic/media/video_sink/video.h +++ b/include/linux/amlogic/media/video_sink/video.h @@ -247,5 +247,7 @@ void set_video_angle(u32 s_value); u32 get_video_angle(void); extern unsigned int DI_POST_REG_RD(unsigned int addr); extern int DI_POST_WR_REG_BITS(u32 adr, u32 val, u32 start, u32 len); +void DI_POST_UPDATE_MC(void); + extern void videosync_pcrscr_update(s32 inc, u32 base); #endif /* VIDEO_H */ diff --git a/include/linux/extcon.h b/include/linux/extcon.h index 190a878..6ac7d0a 100644 --- a/include/linux/extcon.h +++ b/include/linux/extcon.h @@ -67,6 +67,10 @@ #ifdef CONFIG_AMLOGIC_SND_SOC_AUGE #define EXTCON_SPDIFIN_SAMPLERATE 28 /* spdif in sample rate changed */ #define EXTCON_SPDIFIN_AUDIOTYPE 29 /* spdif in PcPd detect */ +#define EXTCON_EARCRX_ATNDTYP_ARC 30 /* attended type, RX ARC */ +#define EXTCON_EARCRX_ATNDTYP_EARC 31 /* attended type, RX eARC */ +#define EXTCON_EARCTX_ATNDTYP_ARC 32 /* attended type, TX ARC */ +#define EXTCON_EARCTX_ATNDTYP_EARC 33 /* attended type, TX eARC */ #endif /* Display external connector */ #define EXTCON_DISP_HDMI 40 /* High-Definition Multimedia Interface */ diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index 199e20e..555a3e7 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c @@ -4372,9 +4372,9 @@ static bool tcp_try_coalesce(struct sock *sk, } static bool tcp_ooo_try_coalesce(struct sock *sk, - struct sk_buff *to, - struct sk_buff *from, - bool *fragstolen) + struct sk_buff *to, + struct sk_buff *from, + bool *fragstolen) { bool res = tcp_try_coalesce(sk, to, from, fragstolen); @@ -4511,8 +4511,7 @@ static void tcp_data_queue_ofo(struct sock *sk, struct sk_buff *skb) /* In the typical case, we are adding an skb to the end of the list. * Use of ooo_last_skb avoids the O(Log(N)) rbtree lookup. */ - if (tcp_ooo_try_coalesce(sk, tp->ooo_last_skb, - skb, &fragstolen)) { + if (tcp_ooo_try_coalesce(sk, tp->ooo_last_skb, skb, &fragstolen)) { coalesce_done: tcp_grow_window(sk, skb); kfree_skb_partial(skb, fragstolen); @@ -4562,8 +4561,7 @@ coalesce_done: tcp_drop(sk, skb1); goto merge_right; } - } else if (tcp_ooo_try_coalesce(sk, skb1, - skb, &fragstolen)) { + } else if (tcp_ooo_try_coalesce(sk, skb1, skb, &fragstolen)) { goto coalesce_done; } p = &parent->rb_right; @@ -5054,6 +5052,9 @@ static int tcp_prune_queue(struct sock *sk) if (atomic_read(&sk->sk_rmem_alloc) <= sk->sk_rcvbuf) return 0; + if (atomic_read(&sk->sk_rmem_alloc) <= sk->sk_rcvbuf) + return 0; + tcp_collapse_ofo_queue(sk); if (!skb_queue_empty(&sk->sk_receive_queue)) tcp_collapse(sk, &sk->sk_receive_queue, NULL, diff --git a/net/l2tp/l2tp_core.h b/net/l2tp/l2tp_core.h index e26aa43..52007bb 100644 --- a/net/l2tp/l2tp_core.h +++ b/net/l2tp/l2tp_core.h @@ -205,7 +205,9 @@ struct l2tp_tunnel { }; struct l2tp_nl_cmd_ops { - int (*session_create)(struct net *net, u32 tunnel_id, u32 session_id, u32 peer_session_id, struct l2tp_session_cfg *cfg); + int (*session_create)(struct net *net, struct l2tp_tunnel *tunnel, + u32 session_id, u32 peer_session_id, + struct l2tp_session_cfg *cfg); int (*session_delete)(struct l2tp_session *session); }; diff --git a/net/l2tp/l2tp_eth.c b/net/l2tp/l2tp_eth.c index eecc64e..e30855d 100644 --- a/net/l2tp/l2tp_eth.c +++ b/net/l2tp/l2tp_eth.c @@ -206,23 +206,18 @@ static void l2tp_eth_show(struct seq_file *m, void *arg) } #endif -static int l2tp_eth_create(struct net *net, u32 tunnel_id, u32 session_id, u32 peer_session_id, struct l2tp_session_cfg *cfg) +static int l2tp_eth_create(struct net *net, struct l2tp_tunnel *tunnel, + u32 session_id, u32 peer_session_id, + struct l2tp_session_cfg *cfg) { struct net_device *dev; char name[IFNAMSIZ]; - struct l2tp_tunnel *tunnel; struct l2tp_session *session; struct l2tp_eth *priv; struct l2tp_eth_sess *spriv; int rc; struct l2tp_eth_net *pn; - tunnel = l2tp_tunnel_find(net, tunnel_id); - if (!tunnel) { - rc = -ENODEV; - goto out; - } - if (cfg->ifname) { dev = dev_get_by_name(net, cfg->ifname); if (dev) { diff --git a/net/l2tp/l2tp_netlink.c b/net/l2tp/l2tp_netlink.c index d6fccfd..4a98838 100644 --- a/net/l2tp/l2tp_netlink.c +++ b/net/l2tp/l2tp_netlink.c @@ -627,10 +627,10 @@ static int l2tp_nl_cmd_session_create(struct sk_buff *skb, struct genl_info *inf break; } - ret = -EPROTONOSUPPORT; - if (l2tp_nl_cmd_ops[cfg.pw_type]->session_create) - ret = (*l2tp_nl_cmd_ops[cfg.pw_type]->session_create)(net, tunnel_id, - session_id, peer_session_id, &cfg); + ret = l2tp_nl_cmd_ops[cfg.pw_type]->session_create(net, tunnel, + session_id, + peer_session_id, + &cfg); if (ret >= 0) { session = l2tp_session_get(net, tunnel, session_id, false); diff --git a/net/l2tp/l2tp_ppp.c b/net/l2tp/l2tp_ppp.c index cc52b98..84a673d 100644 --- a/net/l2tp/l2tp_ppp.c +++ b/net/l2tp/l2tp_ppp.c @@ -784,25 +784,20 @@ end: #ifdef CONFIG_L2TP_V3 -/* Called when creating sessions via the netlink interface. - */ -static int pppol2tp_session_create(struct net *net, u32 tunnel_id, u32 session_id, u32 peer_session_id, struct l2tp_session_cfg *cfg) +/* Called when creating sessions via the netlink interface. */ +static int pppol2tp_session_create(struct net *net, struct l2tp_tunnel *tunnel, + u32 session_id, u32 peer_session_id, + struct l2tp_session_cfg *cfg) { int error; - struct l2tp_tunnel *tunnel; struct l2tp_session *session; struct pppol2tp_session *ps; - tunnel = l2tp_tunnel_find(net, tunnel_id); - - /* Error if we can't find the tunnel */ - error = -ENOENT; - if (tunnel == NULL) - goto out; - /* Error if tunnel socket is not prepped */ - if (tunnel->sock == NULL) + if (!tunnel->sock) { + error = -ENOENT; goto out; + } /* Default MTU values. */ if (cfg->mtu == 0) diff --git a/sound/soc/amlogic/auge/audio_clks.c b/sound/soc/amlogic/auge/audio_clks.c index 045706b..387edd1 100644 --- a/sound/soc/amlogic/auge/audio_clks.c +++ b/sound/soc/amlogic/auge/audio_clks.c @@ -101,6 +101,8 @@ static int audio_clocks_probe(struct platform_device *pdev) return ret; } + pr_info("%s done\n", __func__); + return 0; } @@ -111,7 +113,16 @@ static struct platform_driver audio_clocks_driver = { }, .probe = audio_clocks_probe, }; -module_platform_driver(audio_clocks_driver); + +int __init audio_clocks_init(void) +{ + int ret; + + ret = platform_driver_register(&audio_clocks_driver); + + return ret; +} +core_initcall(audio_clocks_init); MODULE_AUTHOR("Amlogic, Inc."); MODULE_DESCRIPTION("Amlogic audio clocks ASoc driver"); diff --git a/sound/soc/amlogic/auge/audio_controller.c b/sound/soc/amlogic/auge/audio_controller.c index 9a175aa..edf6474 100644 --- a/sound/soc/amlogic/auge/audio_controller.c +++ b/sound/soc/amlogic/auge/audio_controller.c @@ -29,6 +29,8 @@ #include <linux/regmap.h> #include <linux/clk-provider.h> +#include <linux/amlogic/media/sound/iomapres.h> + #include "audio_io.h" #include "regs.h" #include "audio_aed_reg_list.h" @@ -40,33 +42,34 @@ static unsigned int aml_audio_mmio_read(struct aml_audio_controller *actrlr, unsigned int reg) { struct regmap *regmap = actrlr->regmap; - unsigned int val; - - regmap_read(regmap, (reg << 2), &val); - return val; + return mmio_read(regmap, reg); } 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); + + return mmio_write(regmap, reg, value); } 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); + + return mmio_update_bits(regmap, reg, mask, value); } struct aml_audio_ctrl_ops aml_actrl_mmio_ops = { diff --git a/sound/soc/amlogic/auge/card.c b/sound/soc/amlogic/auge/card.c index 23b0ef5..dfd714d 100644 --- a/sound/soc/amlogic/auge/card.c +++ b/sound/soc/amlogic/auge/card.c @@ -556,29 +556,48 @@ static int aml_card_dai_link_of(struct device_node *node, goto dai_link_of_err; } + dai_link->cpu_of_node = of_parse_phandle(cpu, DAI, 0); + if (!dai_link->cpu_of_node) { + dev_err(dev, "error getting cpu phandle\n"); + return -EINVAL; + } + ret = aml_card_parse_daifmt(dev, node, codec, prefix, &dai_link->dai_fmt); - if (ret < 0) + if (ret < 0) { + dev_err(dev, "%s, dai fmt not found\n", + __func__); goto dai_link_of_err; - + } of_property_read_u32(node, "mclk-fs", &dai_props->mclk_fs); ret = aml_card_parse_cpu(cpu, dai_link, DAI, CELL, &single_cpu); - if (ret < 0) + if (ret < 0) { + dev_err(dev, "%s, dai-link idx:%d, error getting cpu dai name:%s\n", + __func__, + idx, + dai_link->cpu_dai_name); goto dai_link_of_err; + } -#if 0 - ret = aml_card_parse_codec(codec, dai_link, DAI, CELL); -#else ret = snd_soc_of_get_dai_link_codecs(dev, codec, dai_link); -#endif - if (ret < 0) + + if (ret < 0) { + dev_err(dev, "%s, dai-link idx:%d, error getting codec dai name:%s\n", + __func__, + idx, + dai_link->codec_dai_name); goto dai_link_of_err; + } ret = aml_card_parse_platform(plat, dai_link, DAI, CELL); - if (ret < 0) + if (ret < 0) { + dev_err(dev, "%s, platform not found\n", + __func__); + goto dai_link_of_err; + } ret = snd_soc_of_parse_tdm_slot(cpu, &cpu_dai->tx_slot_mask, &cpu_dai->rx_slot_mask, @@ -602,12 +621,6 @@ static int aml_card_dai_link_of(struct device_node *node, if (ret < 0) goto dai_link_of_err; -#if 0 - ret = aml_card_parse_clk_codec(codec, dai_link, codec_dai); - if (ret < 0) - goto dai_link_of_err; -#endif - ret = aml_card_canonicalize_dailink(dai_link); if (ret < 0) goto dai_link_of_err; @@ -949,8 +962,10 @@ static int aml_card_probe(struct platform_device *pdev) ret = aml_card_parse_of(np, priv); if (ret < 0) { - dev_err(dev, "%s, parse error %d\n", - __func__, ret); + dev_err(dev, "%s, aml_card_parse_of error %d %s\n", + __func__, + ret, + (ret == -EPROBE_DEFER) ? "PROBE RETRY" : ""); goto err; } @@ -988,6 +1003,7 @@ static int aml_card_probe(struct platform_device *pdev) sizeof(priv->dai_props->codec_dai)); } + platform_set_drvdata(pdev, priv); snd_soc_card_set_drvdata(&priv->snd_card, priv); ret = devm_snd_soc_register_card(&pdev->dev, &priv->snd_card); diff --git a/sound/soc/amlogic/auge/ddr_mngr.c b/sound/soc/amlogic/auge/ddr_mngr.c index 109dc2e..3c9946b 100644 --- a/sound/soc/amlogic/auge/ddr_mngr.c +++ b/sound/soc/amlogic/auge/ddr_mngr.c @@ -104,7 +104,6 @@ static struct toddr *register_toddr_l(struct device *dev, /* (1 << 31)|(1 << mask_bit));*/ to->dev = dev; - to->actrl = actrl; to->in_use = true; pr_debug("toddrs[%d] registered by device %s\n", i, dev_name(dev)); return to; @@ -145,7 +144,6 @@ static int unregister_toddr_l(struct device *dev, void *data) free_irq(to->irq, data); to->dev = NULL; - to->actrl = NULL; to->in_use = false; pr_debug("toddrs[%d] released by device %s\n", i, dev_name(dev)); @@ -970,7 +968,6 @@ static struct frddr *register_frddr_l(struct device *dev, return NULL; } from->dev = dev; - from->actrl = actrl; from->in_use = true; pr_debug("frddrs[%d] registered by device %s\n", i, dev_name(dev)); return from; @@ -1011,7 +1008,6 @@ static int unregister_frddr_l(struct device *dev, void *data) free_irq(from->irq, data); from->dev = NULL; - from->actrl = NULL; from->in_use = false; pr_debug("frddrs[%d] released by device %s\n", i, dev_name(dev)); return 0; @@ -1593,7 +1589,8 @@ static int toddr_src_enum_set(struct snd_kcontrol *kcontrol, static int frddr_src_idx = -1; static const char *const frddr_src_sel_texts[] = { - "TDMOUT_A", "TDMOUT_B", "TDMOUT_C", "SPDIFOUT_A", "SPDIFOUT_B" + "TDMOUT_A", "TDMOUT_B", "TDMOUT_C", + "SPDIFOUT_A", "SPDIFOUT_B", "EARCTX_DMAC" }; static const struct soc_enum frddr_output_source_enum = @@ -1607,7 +1604,7 @@ int frddr_src_get(void) const char *frddr_src_get_str(int idx) { - if (idx < 0 || idx > 4) + if (idx < 0 || idx >= FRDDR_MAX) return NULL; return frddr_src_sel_texts[idx]; @@ -1741,77 +1738,93 @@ static struct notifier_block ddr_pm_notifier_block = { .notifier_call = ddr_pm_event, }; +/* table Must in order */ +static struct ddr_info ddr_info[] = { + {EE_AUDIO_TODDR_A_CTRL0, EE_AUDIO_FRDDR_A_CTRL0, "toddr_a", "frddr_a"}, + {EE_AUDIO_TODDR_B_CTRL0, EE_AUDIO_FRDDR_B_CTRL0, "toddr_b", "frddr_b"}, + {EE_AUDIO_TODDR_C_CTRL0, EE_AUDIO_FRDDR_C_CTRL0, "toddr_c", "frddr_c"}, + {EE_AUDIO_TODDR_D_CTRL0, EE_AUDIO_FRDDR_D_CTRL0, "toddr_d", "frddr_d"}, +}; + +static int ddr_get_toddr_base_addr_by_idx(int idx) +{ + return ddr_info[idx].toddr_addr; +} + +static int ddr_get_frddr_base_addr_by_idx(int idx) +{ + return ddr_info[idx].frddr_addr; +} + +static char *ddr_get_toddr_name_by_idx(int idx) +{ + return ddr_info[idx].toddr_name; +} + +static char *ddr_get_frddr_name_by_idx(int idx) +{ + return ddr_info[idx].frddr_name; +} + static int aml_ddr_mngr_platform_probe(struct platform_device *pdev) { + struct device_node *node = pdev->dev.of_node; + struct device_node *node_prt = NULL; + struct platform_device *pdev_parent; + struct aml_audio_controller *actrl = NULL; struct ddr_chipinfo *p_ddr_chipinfo; int ddr_num = 3; /* early chipset support max 3 ddr num */ int i, ret; + /* get audio controller */ + node_prt = of_get_parent(node); + if (!node_prt) + 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_ddr_chipinfo = (struct ddr_chipinfo *) of_device_get_match_data(&pdev->dev); - if (!p_ddr_chipinfo) - dev_warn_once(&pdev->dev, - "check whether to update ddr_mngr chipinfo\n"); - - /* irqs */ - toddrs[DDR_A].irq = platform_get_irq_byname(pdev, "toddr_a"); - toddrs[DDR_B].irq = platform_get_irq_byname(pdev, "toddr_b"); - toddrs[DDR_C].irq = platform_get_irq_byname(pdev, "toddr_c"); - - frddrs[DDR_A].irq = platform_get_irq_byname(pdev, "frddr_a"); - frddrs[DDR_B].irq = platform_get_irq_byname(pdev, "frddr_b"); - frddrs[DDR_C].irq = platform_get_irq_byname(pdev, "frddr_c"); - - if (p_ddr_chipinfo - && (p_ddr_chipinfo->fifo_num == 4)) { - toddrs[DDR_D].irq = platform_get_irq_byname(pdev, "toddr_d"); - frddrs[DDR_D].irq = platform_get_irq_byname(pdev, "frddr_d"); - if (toddrs[DDR_D].irq < 0 || frddrs[DDR_D].irq < 0) - dev_err(&pdev->dev, "check irq for DDR_D\n"); - ddr_num = p_ddr_chipinfo->fifo_num; + if (!p_ddr_chipinfo) { + dev_err(&pdev->dev, + "check to update ddr_mngr chipinfo\n"); + return -EINVAL; } + if (p_ddr_chipinfo->fifo_num == 2) + ddr_num = p_ddr_chipinfo->fifo_num; + else if (p_ddr_chipinfo->fifo_num == 4) + ddr_num = p_ddr_chipinfo->fifo_num; + for (i = 0; i < ddr_num; i++) { - pr_info("%d, irqs toddr %d, frddr %d\n", - i, toddrs[i].irq, frddrs[i].irq); + toddrs[i].irq = + platform_get_irq_byname(pdev, + ddr_get_toddr_name_by_idx(i)); + toddrs[i].reg_base = ddr_get_toddr_base_addr_by_idx(i); + toddrs[i].fifo_id = i; + toddrs[i].chipinfo = p_ddr_chipinfo; + toddrs[i].actrl = actrl; + + frddrs[i].irq = + platform_get_irq_byname(pdev, + ddr_get_frddr_name_by_idx(i)); + frddrs[i].reg_base = ddr_get_frddr_base_addr_by_idx(i); + frddrs[i].fifo_id = i; + frddrs[i].chipinfo = p_ddr_chipinfo; + frddrs[i].actrl = actrl; + + dev_info(&pdev->dev, "%d, irqs toddr %d, frddr %d\n", + i, toddrs[i].irq, frddrs[i].irq); + if (toddrs[i].irq <= 0 || frddrs[i].irq <= 0) { - dev_err(&pdev->dev, "platform_get_irq_byname failed\n"); + dev_err(&pdev->dev, "%s, get irq failed\n", __func__); return -ENXIO; } } - /* inits */ - toddrs[DDR_A].reg_base = EE_AUDIO_TODDR_A_CTRL0; - toddrs[DDR_B].reg_base = EE_AUDIO_TODDR_B_CTRL0; - toddrs[DDR_C].reg_base = EE_AUDIO_TODDR_C_CTRL0; - toddrs[DDR_A].fifo_id = DDR_A; - toddrs[DDR_B].fifo_id = DDR_B; - toddrs[DDR_C].fifo_id = DDR_C; - - frddrs[DDR_A].reg_base = EE_AUDIO_FRDDR_A_CTRL0; - frddrs[DDR_B].reg_base = EE_AUDIO_FRDDR_B_CTRL0; - frddrs[DDR_C].reg_base = EE_AUDIO_FRDDR_C_CTRL0; - frddrs[DDR_A].fifo_id = DDR_A; - frddrs[DDR_B].fifo_id = DDR_B; - frddrs[DDR_C].fifo_id = DDR_C; - - if (p_ddr_chipinfo) { - toddrs[DDR_A].chipinfo = p_ddr_chipinfo; - toddrs[DDR_B].chipinfo = p_ddr_chipinfo; - toddrs[DDR_C].chipinfo = p_ddr_chipinfo; - frddrs[DDR_A].chipinfo = p_ddr_chipinfo; - frddrs[DDR_B].chipinfo = p_ddr_chipinfo; - frddrs[DDR_C].chipinfo = p_ddr_chipinfo; - - if (p_ddr_chipinfo->fifo_num == 4) { - toddrs[DDR_D].reg_base = EE_AUDIO_TODDR_D_CTRL0; - toddrs[DDR_D].fifo_id = DDR_D; - - frddrs[DDR_D].reg_base = EE_AUDIO_FRDDR_D_CTRL0; - frddrs[DDR_D].fifo_id = DDR_D; - } - } - ret = register_pm_notifier(&ddr_pm_notifier_block); if (ret) pr_warn("[%s] failed to register PM notifier %d\n", diff --git a/sound/soc/amlogic/auge/ddr_mngr.h b/sound/soc/amlogic/auge/ddr_mngr.h index 5e0ddf5..84dc7be 100644 --- a/sound/soc/amlogic/auge/ddr_mngr.h +++ b/sound/soc/amlogic/auge/ddr_mngr.h @@ -93,6 +93,8 @@ enum frddr_dest { TDMOUT_C, SPDIFOUT_A, SPDIFOUT_B, + EARCTX_DMAC, + FRDDR_MAX }; enum status_sel { @@ -233,6 +235,13 @@ struct frddr { bool reserved; }; +struct ddr_info { + unsigned int toddr_addr; + unsigned int frddr_addr; + char *toddr_name; + char *frddr_name; +}; + /* to ddrs */ struct toddr *fetch_toddr_by_src(int toddr_src); struct toddr *aml_audio_register_toddr(struct device *dev, diff --git a/sound/soc/amlogic/auge/earc.c b/sound/soc/amlogic/auge/earc.c index 9197b97..015e090 100644 --- a/sound/soc/amlogic/auge/earc.c +++ b/sound/soc/amlogic/auge/earc.c @@ -16,6 +16,7 @@ * Audio External Input/Out drirver * such as fratv, frhdmirx */ +#define DEBUG #include <linux/module.h> #include <linux/moduleparam.h> @@ -27,6 +28,7 @@ #include <linux/of_device.h> #include <linux/of_platform.h> #include <linux/clk.h> +#include <linux/extcon.h> #include <sound/core.h> #include <sound/pcm.h> #include <sound/initval.h> @@ -34,6 +36,7 @@ #include <sound/soc.h> #include <sound/pcm_params.h> +#include <linux/amlogic/media/sound/hdmi_earc.h> #include "ddr_mngr.h" #include "earc_hw.h" @@ -54,26 +57,28 @@ struct earc { struct clk *clk_tx_cmdc_srcpll; struct clk *clk_tx_dmac_srcpll; + struct regmap *tx_cmdc_map; + struct regmap *tx_dmac_map; + struct regmap *tx_top_map; + struct regmap *rx_cmdc_map; + struct regmap *rx_dmac_map; + struct regmap *rx_top_map; + struct toddr *tddr; struct frddr *fddr; - int irq_rx_cmdc; - int irq_rx_dmac; - int irq_tx_cmdc; - int irq_tx_dmac; + int irq_earc_rx; + int irq_earc_tx; - int sysclk_freq; -}; - -#include <linux/amlogic/media/sound/hdmi_earc.h> + /* external connect */ + struct extcon_dev *rx_edev; + struct extcon_dev *tx_edev; -void earc_hdmirx_hpdst(int earc_port, bool st) -{ + bool tx_dmac_clk_on; + bool rx_dmac_clk_on; }; -void earc_hdmitx_hpdst(bool st) -{ -}; +static struct earc *s_earc; #define PREALLOC_BUFFER_MAX (256 * 1024) @@ -104,10 +109,10 @@ static const struct snd_pcm_hardware earc_hardware = { .channels_max = 32, }; -static irqreturn_t earc_ddr_isr(int irq, void *devid) +static irqreturn_t earc_ddr_isr(int irq, void *data) { struct snd_pcm_substream *substream = - (struct snd_pcm_substream *)devid; + (struct snd_pcm_substream *)data; if (!snd_pcm_running(substream)) return IRQ_HANDLED; @@ -117,23 +122,193 @@ static irqreturn_t earc_ddr_isr(int irq, void *devid) return IRQ_HANDLED; } -static irqreturn_t earc_rx_cmdc_isr(int irq, void *devid) +static void earcrx_update_attend_event(struct earc *p_earc, + bool is_earc, bool state) { - return IRQ_HANDLED; + if (state) { + if (is_earc) { + extcon_set_state_sync(p_earc->rx_edev, + EXTCON_EARCRX_ATNDTYP_ARC, false); + extcon_set_state_sync(p_earc->rx_edev, + EXTCON_EARCRX_ATNDTYP_EARC, state); + } else { + extcon_set_state_sync(p_earc->rx_edev, + EXTCON_EARCRX_ATNDTYP_ARC, state); + extcon_set_state_sync(p_earc->rx_edev, + EXTCON_EARCRX_ATNDTYP_EARC, false); + } + } else { + extcon_set_state_sync(p_earc->rx_edev, + EXTCON_EARCRX_ATNDTYP_ARC, state); + extcon_set_state_sync(p_earc->rx_edev, + EXTCON_EARCRX_ATNDTYP_EARC, state); + } } -static irqreturn_t earc_rx_dmac_isr(int irq, void *devid) +static irqreturn_t earc_rx_isr(int irq, void *data) { + struct earc *p_earc = (struct earc *)data; + unsigned int status0 = earcrx_cdmc_get_irqs(p_earc->rx_top_map); + + if (status0 & INT_EARCRX_CMDC_IDLE2) { + earcrx_update_attend_event(p_earc, + false, true); + + pr_debug("%s EARCRX_CMDC_IDLE2\n", __func__); + } + if (status0 & INT_EARCRX_CMDC_IDLE1) { + earcrx_update_attend_event(p_earc, + false, false); + + pr_debug("%s EARCRX_CMDC_IDLE1\n", __func__); + } + if (status0 & INT_EARCRX_CMDC_DISC2) + pr_debug("%s EARCRX_CMDC_DISC2\n", __func__); + if (status0 & INT_EARCRX_CMDC_DISC1) + pr_debug("%s EARCRX_CMDC_DISC1\n", __func__); + if (status0 & INT_EARCRX_CMDC_EARC) { + earcrx_update_attend_event(p_earc, + true, true); + + pr_info("%s EARCRX_CMDC_EARC\n", __func__); + } + if (status0 & INT_EARCRX_CMDC_HB_STATUS) + pr_debug("%s EARCRX_CMDC_HB_STATUS\n", __func__); + if (status0 & INT_EARCRX_CMDC_LOSTHB) + pr_debug("%s EARCRX_CMDC_LOSTHB\n", __func__); + if (status0 & INT_EARCRX_CMDC_TIMEOUT) { + earcrx_update_attend_event(p_earc, + false, false); + + pr_debug("%s EARCRX_CMDC_TIMEOUT\n", __func__); + } + + if (status0) + earcrx_cdmc_clr_irqs(p_earc->rx_top_map, status0); + + if (p_earc->rx_dmac_clk_on) { + unsigned int status1 = earcrx_dmac_get_irqs(p_earc->rx_top_map); + + if (status1 & INT_ARCRX_BIPHASE_DECODE_C_FIND_PAPB) + pr_debug("%s ARCRX_C_FIND_PAPB\n", __func__); + if (status1 & INT_ARCRX_BIPHASE_DECODE_C_VALID_CHANGE) + pr_debug("%s ARCRX_C_VALID_CHANGE\n", __func__); + if (status1 & INT_ARCRX_BIPHASE_DECODE_C_FIND_NONPCM2PCM) + pr_debug("%s ARCRX_C_FIND_NONPCM2PCM\n", __func__); + if (status1 & INT_ARCRX_BIPHASE_DECODE_C_PCPD_CHANGE) + pr_debug("%s ARCRX_C_PCPD_CHANGE\n", __func__); + if (status1 & INT_ARCRX_BIPHASE_DECODE_C_CH_STATUS_CHANGE) + pr_debug("%s ARCRX_C_CH_STATUS_CHANGE\n", __func__); + if (status1 & INT_ARCRX_BIPHASE_DECODE_I_SAMPLE_MODE_CHANGE) + pr_debug("%s ARCRX_I_SAMPLE_MODE_CHANGE\n", __func__); + if (status1 & INT_ARCRX_BIPHASE_DECODE_R_PARITY_ERR) + pr_debug("%s ARCRX_R_PARITY_ERR\n", __func__); + + if (status1) + earcrx_dmac_clr_irqs(p_earc->rx_top_map, status1); + } + return IRQ_HANDLED; } -static irqreturn_t earc_tx_cmdc_isr(int irq, void *devid) +static void earctx_update_attend_event(struct earc *p_earc, + bool is_earc, bool state) { - return IRQ_HANDLED; + if (state) { + if (is_earc) { + extcon_set_state_sync(p_earc->rx_edev, + EXTCON_EARCTX_ATNDTYP_ARC, + false); + extcon_set_state_sync(p_earc->rx_edev, + EXTCON_EARCTX_ATNDTYP_EARC, + state); + } else { + extcon_set_state_sync(p_earc->rx_edev, + EXTCON_EARCTX_ATNDTYP_ARC, + state); + extcon_set_state_sync(p_earc->rx_edev, + EXTCON_EARCTX_ATNDTYP_EARC, + false); + } + } else { + extcon_set_state_sync(p_earc->rx_edev, + EXTCON_EARCTX_ATNDTYP_ARC, + state); + extcon_set_state_sync(p_earc->rx_edev, + EXTCON_EARCTX_ATNDTYP_EARC, + state); + } } -static irqreturn_t earc_tx_dmac_isr(int irq, void *devid) +static irqreturn_t earc_tx_isr(int irq, void *data) { + struct earc *p_earc = (struct earc *)data; + unsigned int status0 = earctx_cdmc_get_irqs(p_earc->tx_top_map); + + if (status0 & INT_EARCTX_CMDC_IDLE2) { + earctx_update_attend_event(p_earc, + false, true); + + pr_debug("%s EARCTX_CMDC_IDLE2\n", __func__); + } + if (status0 & INT_EARCTX_CMDC_IDLE1) { + earctx_update_attend_event(p_earc, + false, false); + + pr_debug("%s EARCTX_CMDC_IDLE1\n", __func__); + } + if (status0 & INT_EARCTX_CMDC_DISC2) + pr_debug("%s EARCTX_CMDC_DISC2\n", __func__); + if (status0 & INT_EARCTX_CMDC_DISC1) + pr_debug("%s EARCTX_CMDC_DISC1\n", __func__); + if (status0 & INT_EARCTX_CMDC_EARC) { + earctx_update_attend_event(p_earc, + true, true); + + pr_info("%s EARCTX_CMDC_EARC\n", __func__); + } + if (status0 & INT_EARCTX_CMDC_HB_STATUS) + pr_debug("%s EARCTX_CMDC_HB_STATUS\n", __func__); + if (status0 & INT_EARCTX_CMDC_LOSTHB) + pr_debug("%s EARCTX_CMDC_LOSTHB\n", __func__); + if (status0 & INT_EARCTX_CMDC_TIMEOUT) { + earctx_update_attend_event(p_earc, + false, false); + + pr_debug("%s EARCTX_CMDC_TIMEOUT\n", __func__); + } + if (status0 & INT_EARCTX_CMDC_STATUS_CH) + pr_debug("%s EARCTX_CMDC_STATUS_CH\n", __func__); + if (status0 & INT_EARCTX_CMDC_RECV_NACK) + pr_debug("%s EARCTX_CMDC_RECV_NACK\n", __func__); + if (status0 & INT_EARCTX_CMDC_RECV_NORSP) + pr_debug("%s EARCTX_CMDC_RECV_NORSP\n", __func__); + if (status0 & INT_EARCTX_CMDC_RECV_UNEXP) + pr_debug("%s EARCTX_CMDC_RECV_UNEXP\n", __func__); + + if (status0) + earctx_cdmc_clr_irqs(p_earc->tx_top_map, status0); + + if (p_earc->tx_dmac_clk_on) { + unsigned int status1 = earctx_dmac_get_irqs(p_earc->tx_top_map); + + if (status1 & INT_EARCTX_FEM_C_HOLD_CLR) + pr_debug("%s EARCTX_FEM_C_HOLD_CLR\n", __func__); + if (status1 & INT_EARCTX_FEM_C_HOLD_START) + pr_debug("%s EARCTX_FEM_C_HOLD_START\n", __func__); + if (status1 & INT_EARCTX_ERRCORR_C_FIFO_THD_LESS_PASS) + pr_debug("%s EARCTX_ERRCORR_C_FIFO_THD_LESS_PASS\n", + __func__); + if (status1 & INT_EARCTX_ERRCORR_C_FIFO_OVERFLOW) + pr_debug("%s EARCTX_ERRCORR_C_FIFO_OVERFLOW\n", + __func__); + if (status1 & INT_EARCTX_ERRCORR_C_FIFO_EMPTY) + pr_debug("%s EARCTX_ERRCORR_C_FIFO_EMPTY\n", __func__); + + if (status1) + earctx_dmac_clr_irqs(p_earc->tx_top_map, status1); + } + return IRQ_HANDLED; } @@ -143,9 +318,8 @@ static int earc_open(struct snd_pcm_substream *substream) struct snd_soc_pcm_runtime *rtd = substream->private_data; struct device *dev = rtd->platform->dev; struct earc *p_earc; - int ret = 0; - pr_info("asoc debug: %s-%d\n", __func__, __LINE__); + pr_info("asoc debug: %s\n", __func__); p_earc = (struct earc *)dev_get_drvdata(dev); @@ -159,26 +333,6 @@ static int earc_open(struct snd_pcm_substream *substream) dev_err(dev, "failed to claim from ddr\n"); return -ENXIO; } - if (p_earc->irq_tx_cmdc > 0) { - ret = request_irq(p_earc->irq_tx_cmdc, - earc_tx_cmdc_isr, 0, "tx_cmdc", - p_earc); - if (ret) { - dev_err(p_earc->dev, "failed to claim irq_tx_cmdc %u\n", - p_earc->irq_tx_cmdc); - return ret; - } - } - if (p_earc->irq_tx_dmac > 0) { - ret = request_irq(p_earc->irq_tx_dmac, - earc_tx_dmac_isr, 0, "tx_dmac", - p_earc); - if (ret) { - dev_err(p_earc->dev, "failed to claim irq_tx_dmac %u\n", - p_earc->irq_tx_dmac); - return ret; - } - } } else { p_earc->tddr = aml_audio_register_toddr(dev, p_earc->actrl, @@ -187,23 +341,6 @@ static int earc_open(struct snd_pcm_substream *substream) dev_err(dev, "failed to claim to ddr\n"); return -ENXIO; } - - ret = request_irq(p_earc->irq_rx_cmdc, - earc_rx_cmdc_isr, 0, "rx_cmdc", - p_earc); - if (ret) { - dev_err(p_earc->dev, "failed to claim irq_rx_cmdc %u\n", - p_earc->irq_rx_cmdc); - return ret; - } - ret = request_irq(p_earc->irq_rx_dmac, - earc_rx_dmac_isr, 0, "rx_dmac", - p_earc); - if (ret) { - dev_err(p_earc->dev, "failed to claim rx_dmac %u\n", - p_earc->irq_rx_dmac); - return ret; - } } runtime->private_data = p_earc; @@ -216,21 +353,13 @@ static int earc_close(struct snd_pcm_substream *substream) struct snd_pcm_runtime *runtime = substream->runtime; struct earc *p_earc = runtime->private_data; - pr_info("asoc debug: %s-%d\n", __func__, __LINE__); + pr_info("asoc debug: %s\n", __func__); - if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { + if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) aml_audio_unregister_frddr(p_earc->dev, substream); - - if (p_earc->irq_tx_cmdc > 0) - free_irq(p_earc->irq_tx_cmdc, p_earc); - - if (p_earc->irq_tx_dmac > 0) - free_irq(p_earc->irq_tx_dmac, p_earc); - } else { + else aml_audio_unregister_toddr(p_earc->dev, substream); - free_irq(p_earc->irq_rx_cmdc, p_earc); - free_irq(p_earc->irq_rx_dmac, p_earc); - } + runtime->private_data = NULL; return 0; @@ -349,7 +478,7 @@ struct snd_soc_platform_driver earc_platform = { static int earc_dai_probe(struct snd_soc_dai *cpu_dai) { - pr_info("asoc debug: %s-%d\n", __func__, __LINE__); + pr_info("asoc debug: %s\n", __func__); return 0; } @@ -369,19 +498,66 @@ static int earc_dai_prepare( if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { struct frddr *fr = p_earc->fddr; - enum frddr_dest dst = frddr_src_get(); + enum frddr_dest dst = EARCTX_DMAC; + unsigned int fifo_id, frddr_type = 0; + struct iec958_chsts chsts; pr_info("%s Expected frddr dst:%s\n", __func__, frddr_src_get_str(dst)); + switch (bit_depth) { + case 8: + frddr_type = 0; + break; + case 16: + frddr_type = 1; + break; + case 24: + frddr_type = 4; + break; + case 32: + frddr_type = 3; + break; + default: + pr_err("runtime format invalid bitwidth: %d\n", + bit_depth); + break; + } + fifo_id = aml_frddr_get_fifo_id(fr); + + pr_info("%s, frddr_index:%d, bit_depth:%d, frddr_type:%d\n", + __func__, + fr->fifo_id, bit_depth, frddr_type); + + aml_frddr_set_format(fr, + runtime->channels, + bit_depth - 1, + frddr_type); aml_frddr_select_dst(fr, dst); aml_frddr_set_fifos(fr, 0x40, 0x20); + + earctx_dmac_init(p_earc->tx_top_map, p_earc->tx_dmac_map); + earctx_dmac_set_format(p_earc->tx_dmac_map, + fr->fifo_id, + bit_depth - 1, + frddr_type); + + /* check and set channel status info */ + spdif_get_channel_status_info(&chsts, runtime->rate); + earctx_set_channel_status_info(p_earc->tx_dmac_map, &chsts); } else { struct toddr *to = p_earc->tddr; unsigned int msb = 0, lsb = 0, toddr_type = 0; unsigned int src = EARCRX_DMAC; struct toddr_fmt fmt; + enum attend_type type = + earcrx_cmdc_get_attended_type(p_earc->rx_cmdc_map); + + if (type == ATNDTYP_DISCNCT) { + dev_err(p_earc->dev, "Neither eARC or ARC is attended!\n"); + return -ENOTCONN; + } if (bit_depth == 32) toddr_type = 3; @@ -412,10 +588,8 @@ static int earc_dai_prepare( aml_toddr_set_format(to, &fmt); aml_toddr_set_fifos(to, 0x40); - earcrx_cmdc_init(); - earcrx_dmac_init(); - earc_arc_init(); - + earcrx_dmac_init(p_earc->rx_top_map, p_earc->rx_dmac_map); + earcrx_arc_init(p_earc->rx_dmac_map); } return 0; @@ -434,12 +608,17 @@ static int earc_dai_trigger(struct snd_pcm_substream *substream, int cmd, dev_info(substream->pcm->card->dev, "eARC/ARC TX enable\n"); aml_frddr_enable(p_earc->fddr, true); + earctx_enable(p_earc->tx_top_map, + p_earc->tx_cmdc_map, + p_earc->tx_dmac_map, + true); } else { dev_info(substream->pcm->card->dev, "eARC/ARC RX enable\n"); aml_toddr_enable(p_earc->tddr, true); - - earc_rx_enable(true); + earcrx_enable(p_earc->rx_cmdc_map, + p_earc->rx_dmac_map, + true); } break; case SNDRV_PCM_TRIGGER_STOP: @@ -448,12 +627,17 @@ static int earc_dai_trigger(struct snd_pcm_substream *substream, int cmd, if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { dev_info(substream->pcm->card->dev, "eARC/ARC TX disable\n"); + earctx_enable(p_earc->tx_top_map, + p_earc->tx_cmdc_map, + p_earc->tx_dmac_map, + false); aml_frddr_enable(p_earc->fddr, false); } else { dev_info(substream->pcm->card->dev, "eARC/ARC RX disable\n"); - earc_rx_enable(false); - + earcrx_enable(p_earc->rx_cmdc_map, + p_earc->rx_dmac_map, + false); aml_toddr_enable(p_earc->tddr, false); } break; @@ -473,10 +657,24 @@ static int earc_dai_hw_params( unsigned int rate = params_rate(params); int ret = 0; - pr_info("%s:rate:%d, sysclk:%d\n", - __func__, - rate, - p_earc->sysclk_freq); + if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { + int freq = rate * 128 * 5; + + if (spdif_is_4x_clk()) { + pr_debug("set 4x audio clk for 958\n"); + freq *= 4; + } else { + pr_debug("set normal 512 fs /4 fs\n"); + } + + clk_set_rate(p_earc->clk_tx_dmac_srcpll, freq * 4); + clk_set_rate(p_earc->clk_tx_dmac, freq); + + pr_info("%s, tx dmac clk, set freq: %d, get freq:%lu\n", + __func__, + freq, + clk_get_rate(p_earc->clk_tx_dmac)); + } return ret; } @@ -495,16 +693,16 @@ static int earc_dai_set_sysclk(struct snd_soc_dai *cpu_dai, { struct earc *p_earc = snd_soc_dai_get_drvdata(cpu_dai); - p_earc->sysclk_freq = freq; - pr_info("earc_dai_set_sysclk, %d, %d, %d\n", - clk_id, freq, dir); + pr_info("%s, %d, %d, %d\n", + __func__, clk_id, freq, dir); - clk_set_rate(p_earc->clk_rx_cmdc, 10000000); - clk_set_rate(p_earc->clk_rx_dmac, 250000000); + if (clk_id == 1) { + clk_set_rate(p_earc->clk_rx_dmac, 500000000); - pr_info("earc rx cmdc clk:%lu rx dmac clk:%lu\n", - clk_get_rate(p_earc->clk_rx_cmdc), - clk_get_rate(p_earc->clk_rx_dmac)); + pr_info("earc rx cmdc clk:%lu rx dmac clk:%lu\n", + clk_get_rate(p_earc->clk_rx_cmdc), + clk_get_rate(p_earc->clk_rx_dmac)); + } return 0; } @@ -516,44 +714,50 @@ static int earc_dai_startup( struct earc *p_earc = snd_soc_dai_get_drvdata(cpu_dai); int ret; - /* enable clock gate */ - if (!IS_ERR(p_earc->clk_rx_gate)) { - ret = clk_prepare_enable(p_earc->clk_rx_gate); - if (ret) { - pr_err("Can't enable earc rx_gate: %d\n", ret); - goto err; - } - } - - audiobus_update_bits(EE_AUDIO_CLK_GATE_EN1, 0x1 << 6, 0x1 << 6); + pr_info("%s\n", __func__); - /* enable clock */ - if (!IS_ERR(p_earc->clk_rx_cmdc)) { - ret = clk_prepare_enable(p_earc->clk_rx_cmdc); - if (ret) { - pr_err("Can't enable earc clk_rx_cmdc: %d\n", ret); - goto err; + if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { + /* tx dmac clk */ + if (!IS_ERR(p_earc->clk_tx_dmac)) { + ret = clk_prepare_enable(p_earc->clk_tx_dmac); + if (ret) { + dev_err(p_earc->dev, + "Can't enable earc clk_tx_dmac: %d\n", + ret); + goto err; + } + p_earc->tx_dmac_clk_on = true; } - } - if (!IS_ERR(p_earc->clk_rx_dmac)) { - ret = clk_prepare_enable(p_earc->clk_rx_dmac); - if (ret) { - pr_err("Can't enable earc clk_rx_dmac: %d\n", ret); - goto err; + if (!IS_ERR(p_earc->clk_tx_dmac_srcpll)) { + ret = clk_prepare_enable(p_earc->clk_tx_dmac_srcpll); + if (ret) { + dev_err(p_earc->dev, + "Can't enable earc clk_tx_dmac_srcpll:%d\n", + ret); + goto err; + } } - } - if (!IS_ERR(p_earc->clk_tx_cmdc)) { - ret = clk_prepare_enable(p_earc->clk_tx_cmdc); - if (ret) { - pr_err("Can't enable earc clk_tx_cmdc: %d\n", ret); - goto err; + } else { + /* rx dmac clk */ + if (!IS_ERR(p_earc->clk_rx_dmac)) { + ret = clk_prepare_enable(p_earc->clk_rx_dmac); + if (ret) { + dev_err(p_earc->dev, + "Can't enable earc clk_rx_dmac: %d\n", + ret); + goto err; + } + p_earc->rx_dmac_clk_on = true; } - } - if (!IS_ERR(p_earc->clk_tx_dmac)) { - ret = clk_prepare_enable(p_earc->clk_tx_dmac); - if (ret) { - pr_err("Can't enable earc clk_tx_dmac: %d\n", ret); - goto err; + + if (!IS_ERR(p_earc->clk_rx_dmac_srcpll)) { + ret = clk_prepare_enable(p_earc->clk_rx_dmac_srcpll); + if (ret) { + dev_err(p_earc->dev, + "Can't enable earc clk_rx_dmac_srcpll: %d\n", + ret); + goto err; + } } } @@ -570,19 +774,23 @@ static void earc_dai_shutdown( { struct earc *p_earc = snd_soc_dai_get_drvdata(cpu_dai); - /* disable clock and gate */ - if (!IS_ERR(p_earc->clk_rx_cmdc)) - clk_disable_unprepare(p_earc->clk_rx_cmdc); - if (!IS_ERR(p_earc->clk_rx_dmac)) - clk_disable_unprepare(p_earc->clk_rx_dmac); - if (!IS_ERR(p_earc->clk_tx_cmdc)) - clk_disable_unprepare(p_earc->clk_tx_cmdc); - if (!IS_ERR(p_earc->clk_tx_dmac)) - clk_disable_unprepare(p_earc->clk_tx_dmac); - if (!IS_ERR(p_earc->clk_rx_gate)) - clk_disable_unprepare(p_earc->clk_rx_gate); + pr_info("%s\n", __func__); - audiobus_update_bits(EE_AUDIO_CLK_GATE_EN1, 0x1 << 6, 0x0 << 6); + if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { + if (!IS_ERR(p_earc->clk_tx_dmac)) { + clk_disable_unprepare(p_earc->clk_tx_dmac); + p_earc->tx_dmac_clk_on = false; + } + if (!IS_ERR(p_earc->clk_tx_dmac_srcpll)) + clk_disable_unprepare(p_earc->clk_tx_dmac_srcpll); + } else { + if (!IS_ERR(p_earc->clk_rx_dmac)) { + clk_disable_unprepare(p_earc->clk_rx_dmac); + p_earc->rx_dmac_clk_on = false; + } + if (!IS_ERR(p_earc->clk_rx_dmac_srcpll)) + clk_disable_unprepare(p_earc->clk_rx_dmac_srcpll); + } } static struct snd_soc_dai_ops earc_dai_ops = { @@ -617,9 +825,83 @@ static struct snd_soc_dai_driver earc_dai[] = { }, }; -static const struct snd_kcontrol_new earc_controls[] = { +static const char *const attended_type[] = { + "DISCONNECT", + "ARC", + "eARC" +}; + +const struct soc_enum attended_type_enum = + SOC_ENUM_SINGLE(SND_SOC_NOPM, 0, ARRAY_SIZE(attended_type), + attended_type); + +int earcrx_get_attend_type(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) +{ + struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); + struct earc *p_earc = dev_get_drvdata(component->dev); + enum attend_type type = + earcrx_cmdc_get_attended_type(p_earc->rx_cmdc_map); + + ucontrol->value.integer.value[0] = type; + + return 0; +} + +int earcrx_set_attend_type(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) +{ + struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); + struct earc *p_earc = dev_get_drvdata(component->dev); + enum cmdc_st state = earcrx_cmdc_get_state(p_earc->rx_cmdc_map); + + if (state != CMDC_ST_IDLE2) + return 0; + + /* only support set cmdc from idle to ARC */ + return 0; +} + +static int earcrx_arc_get_enable( + struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) +{ + struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); + struct earc *p_earc = dev_get_drvdata(component->dev); + enum attend_type type = + earcrx_cmdc_get_attended_type(p_earc->rx_cmdc_map); + + ucontrol->value.integer.value[0] = (bool)(type == ATNDTYP_ARC); + + return 0; +} + +static int earcrx_arc_set_enable( + struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) +{ + struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); + struct earc *p_earc = dev_get_drvdata(component->dev); + + earcrx_cmdc_arc_connect( + p_earc->rx_cmdc_map, + (bool)ucontrol->value.integer.value[0]); + + return 0; +} + +static const struct snd_kcontrol_new earc_controls[] = { + SOC_ENUM_EXT("eARC_RX attended type", + attended_type_enum, + earcrx_get_attend_type, + earcrx_set_attend_type), + + SOC_SINGLE_BOOL_EXT("HDMI ARC Switch", + 0, + earcrx_arc_get_enable, + earcrx_arc_set_enable), }; static const struct snd_soc_component_driver earc_component = { @@ -640,6 +922,178 @@ static const struct of_device_id earc_device_id[] = { MODULE_DEVICE_TABLE(of, earc_device_id); +static const unsigned int earcrx_extcon[] = { + EXTCON_EARCRX_ATNDTYP_ARC, + EXTCON_EARCRX_ATNDTYP_EARC, + EXTCON_NONE, +}; + +static int earcrx_extcon_register(struct earc *p_earc) +{ + int ret = 0; + + /* earc or arc connect */ + p_earc->rx_edev = devm_extcon_dev_allocate(p_earc->dev, earcrx_extcon); + if (IS_ERR(p_earc->rx_edev)) { + pr_err("failed to allocate earc extcon!!!\n"); + ret = -ENOMEM; + return ret; + } + p_earc->rx_edev->dev.parent = p_earc->dev; + p_earc->rx_edev->name = "earcrx"; + + dev_set_name(&p_earc->rx_edev->dev, "earcrx"); + ret = extcon_dev_register(p_earc->rx_edev); + if (ret < 0) { + pr_err("earc extcon failed to register!!\n"); + return ret; + } + + return ret; +} + +void earc_hdmitx_hpdst(bool st) +{ + struct earc *p_earc = s_earc; + + if (!p_earc) + return; + + pr_info("%s, %s\n", + __func__, + st ? "plugin" : "plugout"); + + /* ensure clock gate */ + audiobus_update_bits(EE_AUDIO_CLK_GATE_EN1, 0x1 << 6, 0x1 << 6); + + earcrx_cmdc_hpd_detect(p_earc->rx_cmdc_map, st); +} + +static int earcrx_cmdc_setup(struct earc *p_earc) +{ + int ret = 0; + + /* set cmdc clk */ + audiobus_update_bits(EE_AUDIO_CLK_GATE_EN1, 0x1 << 6, 0x1 << 6); + if (!IS_ERR(p_earc->clk_rx_cmdc)) { + clk_set_rate(p_earc->clk_rx_cmdc, 10000000); + + ret = clk_prepare_enable(p_earc->clk_rx_cmdc); + if (ret) { + pr_err("Can't enable earc clk_rx_cmdc: %d\n", ret); + return ret; + } + } + + /* rx cmdc init */ + earcrx_cmdc_init(p_earc->rx_top_map); + /* Default: arc arc_initiated */ + earcrx_cmdc_arc_connect(p_earc->rx_cmdc_map, true); + + ret = devm_request_threaded_irq(p_earc->dev, + p_earc->irq_earc_rx, + NULL, + earc_rx_isr, + IRQF_TRIGGER_HIGH | + IRQF_ONESHOT, + "earc_rx", + p_earc); + if (ret) { + dev_err(p_earc->dev, "failed to claim earc_rx %u\n", + p_earc->irq_earc_rx); + return ret; + } + + return ret; +} + +static const unsigned int earctx_extcon[] = { + EXTCON_EARCTX_ATNDTYP_ARC, + EXTCON_EARCTX_ATNDTYP_EARC, + EXTCON_NONE, +}; + +static int earctx_extcon_register(struct earc *p_earc) +{ + int ret = 0; + + /* earc or arc connect */ + p_earc->tx_edev = devm_extcon_dev_allocate(p_earc->dev, earcrx_extcon); + if (IS_ERR(p_earc->tx_edev)) { + pr_err("failed to allocate earc extcon!!!\n"); + ret = -ENOMEM; + return ret; + } + p_earc->tx_edev->dev.parent = p_earc->dev; + p_earc->tx_edev->name = "earctx"; + + dev_set_name(&p_earc->tx_edev->dev, "earctx"); + ret = extcon_dev_register(p_earc->tx_edev); + if (ret < 0) { + pr_err("earc extcon failed to register!!\n"); + return ret; + } + + return ret; +} + +void earc_hdmirx_hpdst(int earc_port, bool st) +{ + struct earc *p_earc = s_earc; + + if (!p_earc) + return; + + pr_info("%s, earc_port:%d %s\n", + __func__, + earc_port, + st ? "plugin" : "plugout"); + + earctx_cmdc_int_mask(p_earc->tx_top_map); + earctx_cmdc_arc_connect(p_earc->tx_cmdc_map, st); + earctx_cmdc_hpd_detect(p_earc->tx_top_map, + p_earc->tx_cmdc_map, + earc_port, st); +} + +static int earctx_cmdc_setup(struct earc *p_earc) +{ + int ret = 0; + + /* set cmdc clk */ + audiobus_update_bits(EE_AUDIO_CLK_GATE_EN1, 0x1 << 5, 0x1 << 5); + if (!IS_ERR(p_earc->clk_tx_cmdc)) { + clk_set_rate(p_earc->clk_tx_cmdc, 10000000); + + ret = clk_prepare_enable(p_earc->clk_tx_cmdc); + if (ret) { + pr_err("Can't enable earc clk_tx_cmdc: %d\n", ret); + return ret; + } + } + + ret = devm_request_threaded_irq(p_earc->dev, + p_earc->irq_earc_tx, + NULL, + earc_tx_isr, + IRQF_TRIGGER_HIGH | + IRQF_ONESHOT, + "earc_tx", + p_earc); + if (ret) { + dev_err(p_earc->dev, "failed to claim earc_tx %u\n", + p_earc->irq_earc_tx); + return ret; + } + + /* tx cmdc init */ + earctx_cmdc_init(p_earc->tx_top_map); + /* Default: arc arc_initiated */ + earctx_cmdc_arc_connect(p_earc->tx_cmdc_map, true); + + return ret; +} + static int earc_platform_probe(struct platform_device *pdev) { struct device_node *node = pdev->dev.of_node; @@ -650,6 +1104,7 @@ static int earc_platform_probe(struct platform_device *pdev) struct earc *p_earc = NULL; int ret = 0; + pr_info("%s\n", __func__); p_earc = devm_kzalloc(dev, sizeof(struct earc), GFP_KERNEL); if (!p_earc) @@ -669,6 +1124,38 @@ static int earc_platform_probe(struct platform_device *pdev) platform_get_drvdata(pdev_parent); p_earc->actrl = actrl; + p_earc->tx_cmdc_map = regmap_resource(dev, "tx_cmdc"); + if (!p_earc->tx_cmdc_map) { + dev_err(dev, + "Can't get earctx_cmdc regmap!!\n"); + } + p_earc->tx_dmac_map = regmap_resource(dev, "tx_dmac"); + if (!p_earc->tx_dmac_map) { + dev_err(dev, + "Can't get earctx_dmac regmap!!\n"); + } + p_earc->tx_top_map = regmap_resource(dev, "tx_top"); + if (!p_earc->tx_top_map) { + dev_err(dev, + "Can't get earctx_top regmap!!\n"); + } + + p_earc->rx_cmdc_map = regmap_resource(dev, "rx_cmdc"); + if (!p_earc->rx_cmdc_map) { + dev_err(dev, + "Can't get earcrx_cdmc regmap!!\n"); + } + p_earc->rx_dmac_map = regmap_resource(dev, "rx_dmac"); + if (!p_earc->rx_dmac_map) { + dev_err(dev, + "Can't get earcrx_dmac regmap!!\n"); + } + p_earc->rx_top_map = regmap_resource(dev, "rx_top"); + if (!p_earc->rx_top_map) { + dev_err(dev, + "Can't get earcrx_top regmap!!\n"); + } + /* clock gate */ p_earc->clk_rx_gate = devm_clk_get(&pdev->dev, "rx_gate"); if (IS_ERR(p_earc->clk_rx_gate)) { @@ -761,26 +1248,19 @@ static int earc_platform_probe(struct platform_device *pdev) } /* irqs */ - p_earc->irq_rx_cmdc = - platform_get_irq_byname(pdev, "rx_cmdc"); - if (p_earc->irq_rx_cmdc < 0) { - dev_err(dev, "platform get irq rx_cmdc failed\n"); - return p_earc->irq_rx_cmdc; - } - p_earc->irq_rx_dmac = - platform_get_irq_byname(pdev, "rx_dmac"); - if (p_earc->irq_rx_dmac < 0) { - dev_err(dev, "platform get irq rx_dmac failed\n"); - return p_earc->irq_rx_dmac; - } - p_earc->irq_tx_cmdc = - platform_get_irq_byname(pdev, "tx_cmdc"); - if (p_earc->irq_tx_cmdc < 0) - dev_err(dev, "platform get irq tx_cmdc failed, Check whether support eARC TX\n"); - p_earc->irq_tx_dmac = - platform_get_irq_byname(pdev, "tx_dmac"); - if (p_earc->irq_tx_dmac < 0) - dev_err(dev, "platform get irq tx_dmac failed, Check whether support eARC TX\n"); + p_earc->irq_earc_rx = + platform_get_irq_byname(pdev, "earc_rx"); + if (p_earc->irq_earc_rx < 0) { + dev_err(dev, "platform get irq earc_rx failed\n"); + return p_earc->irq_earc_rx; + } + p_earc->irq_earc_tx = + platform_get_irq_byname(pdev, "earc_tx"); + if (p_earc->irq_earc_tx < 0) + dev_err(dev, "platform get irq earc_tx failed, Check whether support eARC TX\n"); + + pr_info("%s, irq_earc_rx:%d, irq_earc_tx:%d\n", + __func__, p_earc->irq_earc_rx, p_earc->irq_earc_tx); ret = snd_soc_register_component(&pdev->dev, &earc_component, @@ -792,6 +1272,20 @@ static int earc_platform_probe(struct platform_device *pdev) return ret; } + s_earc = p_earc; + + /* RX */ + if (p_earc->irq_earc_rx > 0) { + earcrx_extcon_register(p_earc); + earcrx_cmdc_setup(p_earc); + } + + /* TX */ + if (p_earc->irq_earc_tx > 0) { + earctx_extcon_register(p_earc); + earctx_cmdc_setup(p_earc); + } + pr_info("%s, register soc platform\n", __func__); return devm_snd_soc_register_platform(dev, &earc_platform); @@ -804,7 +1298,12 @@ struct platform_driver earc_driver = { }, .probe = earc_platform_probe, }; -module_platform_driver(earc_driver); + +static int __init earc_init(void) +{ + return platform_driver_register(&earc_driver); +} +arch_initcall_sync(earc_init); MODULE_AUTHOR("Amlogic, Inc."); MODULE_DESCRIPTION("Amlogic eARC/ARC TX/RX ASoc driver"); diff --git a/sound/soc/amlogic/auge/earc_hw.c b/sound/soc/amlogic/auge/earc_hw.c index 0b217bb..2a857e8 100644 --- a/sound/soc/amlogic/auge/earc_hw.c +++ b/sound/soc/amlogic/auge/earc_hw.c @@ -15,112 +15,583 @@ * */ #include <linux/types.h> +#include <linux/kernel.h> +#include <linux/amlogic/media/sound/spdif_info.h> #include "earc_hw.h" - -void earcrx_cmdc_init(void) +void earcrx_cmdc_init(struct regmap *top_map) { /* set irq mask */ - earcrx_top_write(EARCRX_CMDC_INT_MASK, - (0 << 15) | /* idle2_int */ - (0 << 14) | /* idle1_int */ - (0 << 13) | /* disc2_int */ - (0 << 12) | /* disc1_int */ - (0 << 11) | /* earc_int */ - (1 << 10) | /* hb_status_int */ - (0 << 9) | /* losthb_int */ - (0 << 8) | /* timeout_int */ - (0 << 7) | /* status_ch_int */ - (0 << 6) | /* int_rec_invalid_id */ - (0 << 5) | /* int_rec_invalid_offset */ - (0 << 4) | /* int_rec_unexp */ - (0 << 3) | /* int_rec_ecc_err */ - (0 << 2) | /* int_rec_parity_err */ - (0 << 1) | /* int_recv_packet */ - (0 << 0) /* int_rec_time_out */ - ); - - earcrx_top_write(EARCRX_ANA_CTRL0, 0x90884814); - earcrx_top_write(EARCRX_PLL_CTRL3, 0x242000); - earcrx_top_write(EARCRX_PLL_CTRL0, 0x10800400); -} - -void earcrx_dmac_init(void) -{ - earcrx_dmac_write(EARCRX_DMAC_SYNC_CTRL0, - (1 << 16) | /* reg_ana_buf_data_sel_en */ - (3 << 12) | /* reg_ana_buf_data_sel */ - (7 << 8) | /* reg_ana_clr_cnt */ - (7 << 4) /* reg_ana_set_cnt */ - ); - earcrx_dmac_write(EARCRX_DMAC_UBIT_CTRL0, - (47 << 16) | /* reg_fifo_thd */ - (1 << 12) | /* reg_user_lr */ - (29 << 0) /* reg_data_bit */ - ); - earcrx_dmac_write(EARCRX_ANA_RST_CTRL0, 1 << 31); -} - -void earc_arc_init(void) -{ - earcrx_dmac_write(EARCRX_SPDIFIN_CTRL0, - (1 << 31) | /* reg_work_en */ - (1 << 30) | /* reg_chnum_sel */ - (1 << 25) | /* reg_findpapb_en */ - (0xFFF<<12) /* reg_nonpcm2pcm_th */ - ); - earcrx_dmac_write(EARCRX_SPDIFIN_CTRL2, - (1 << 14) | /* reg_earc_auto */ - (1 << 13) /* reg_earcin_papb_lr */ - ); - earcrx_dmac_write(EARCRX_SPDIFIN_CTRL3, - (0xEC37<<16) | /* reg_earc_pa_value */ - (0x5A5A<<0) /* reg_earc_pb_value */ - ); -} - -void earc_rx_enable(bool enable) + mmio_write(top_map, EARCRX_CMDC_INT_MASK, + (1 << 15) | /* idle2_int */ + (1 << 14) | /* idle1_int */ + (1 << 13) | /* disc2_int */ + (1 << 12) | /* disc1_int */ + (1 << 11) | /* earc_int */ + (1 << 10) | /* hb_status_int */ + (1 << 9) | /* losthb_int */ + (1 << 8) | /* timeout_int */ + (0 << 7) | /* status_ch_int */ + (0 << 6) | /* int_rec_invalid_id */ + (0 << 5) | /* int_rec_invalid_offset */ + (0 << 4) | /* int_rec_unexp */ + (0 << 3) | /* int_rec_ecc_err */ + (0 << 2) | /* int_rec_parity_err */ + (0 << 1) | /* int_recv_packet */ + (0 << 0) /* int_rec_time_out */ + ); + + mmio_write(top_map, EARCRX_ANA_CTRL0, + 0x1 << 31 | /* earcrx_en_d2a */ + 0x10 << 24 | /* earcrx_cmdcrx_reftrim */ + 0x8 << 20 | /* earcrx_idr_trim */ + 0x10 << 15 | /* earcrx_rterm_trim */ + 0x4 << 12 | /* earcrx_cmdctx_ack_hystrim */ + 0x10 << 7 | /* earcrx_cmdctx_ack_reftrim */ + 0x1 << 4 | /* earcrx_cmdcrx_rcfilter_sel */ + 0x4 << 0 /* earcrx_cmdcrx_hystrim */ + ); + + mmio_write(top_map, EARCRX_PLL_CTRL3, + 0x2 << 20 | /* earcrx_pll_bias_adj */ + 0x4 << 16 | /* earcrx_pll_rou */ + 0x1 << 13 /* earcrx_pll_dco_sdm_e */ + ); + + mmio_write(top_map, EARCRX_PLL_CTRL0, + 0x1 << 28 | /* earcrx_pll_en */ + 0x1 << 23 | /* earcrx_pll_dmacrx_sqout_rstn_sel */ + 0x1 << 10 /* earcrx_pll_n */ + ); +} + +void earcrx_cmdc_arc_connect(struct regmap *cmdc_map, bool init) +{ + if (init) + mmio_update_bits(cmdc_map, + EARC_RX_CMDC_VSM_CTRL0, + 0x7 << 25, + 0x1 << 27 | /* arc_initiated */ + 0x0 << 26 | /* arc_terminated */ + 0x1 << 25 /* arc_enable */ + ); + else + mmio_update_bits(cmdc_map, + EARC_RX_CMDC_VSM_CTRL0, + 0x7 << 25, + 0x0 << 27 | /* arc_initiated */ + 0x1 << 26 | /* arc_terminated */ + 0x0 << 25 /* arc_enable */ + ); +} + +void earcrx_cmdc_hpd_detect(struct regmap *cmdc_map, bool st) +{ + if (st) { + mmio_update_bits(cmdc_map, + EARC_RX_CMDC_VSM_CTRL0, + 0x1 << 19, + 0x1 << 19 /* comma_cnt_rst */ + ); + + mmio_update_bits(cmdc_map, + EARC_RX_CMDC_VSM_CTRL0, + 0x1 << 19 | 0xff << 0, + 0x1 << 19 | /* comma_cnt_rst */ + 0xff << 0 + ); + } else { + /* soft reset */ + mmio_update_bits(cmdc_map, + EARC_RX_CMDC_TOP_CTRL1, + 0xf << 0, + 0xf << 0); + mmio_update_bits(cmdc_map, + EARC_RX_CMDC_TOP_CTRL1, + 0xf << 0, + 0x0 << 0); + } +} + +void earcrx_dmac_init(struct regmap *top_map, struct regmap *dmac_map) { + mmio_write(top_map, EARCRX_DMAC_INT_MASK, + (0x0 << 17) | /* earcrx_ana_rst c_new_format_set */ + (0x0 << 16) | /* earcrx_ana_rst c_earcrx_div2_hold_set */ + (0x0 << 15) | /* earcrx_err_correct c_bcherr_int_set */ + (0x0 << 14) | /* earcrx_err_correct r_afifo_overflow_set */ + (0x0 << 13) | /* earcrx_err_correct r_fifo_overflow_set */ + (0x0 << 12) | /* earcrx_user_bit_check r_fifo_overflow */ + (0x0 << 11) | /* earcrx_user_bit_check c_fifo_thd_pass */ + (0x0 << 10) | /* earcrx_user_bit_check c_u_pk_lost_int_set */ + (0x0 << 9) | /* arcrx_user_bit_check c_iu_pk_end */ + (0x0 << 8) | /* arcrx_biphase_decode c_chst_mute_clr */ + (0x1 << 7) | /* arcrx_biphase_decode c_find_papb */ + (0x1 << 6) | /* arcrx_biphase_decode c_valid_change */ + (0x1 << 5) | /* arcrx_biphase_decode c_find_nonpcm2pcm */ + (0x1 << 4) | /* arcrx_biphase_decode c_pcpd_change */ + (0x1 << 3) | /* arcrx_biphase_decode c_ch_status_change */ + (0x1 << 2) | /* arcrx_biphase_decode sample_mod_change */ + (0x1 << 1) | /* arcrx_biphase_decode r_parity_err */ + (0x0 << 0) /* arcrx_dmac_sync afifo_overflow */ + ); + + mmio_write(dmac_map, EARCRX_DMAC_SYNC_CTRL0, + (1 << 16) | /* reg_ana_buf_data_sel_en */ + (3 << 12) | /* reg_ana_buf_data_sel */ + (7 << 8) | /* reg_ana_clr_cnt */ + (7 << 4) /* reg_ana_set_cnt */ + ); + mmio_write(dmac_map, EARCRX_DMAC_UBIT_CTRL0, + (47 << 16) | /* reg_fifo_thd */ + (1 << 12) | /* reg_user_lr */ + (29 << 0) /* reg_data_bit */ + ); + mmio_write(dmac_map, EARCRX_ANA_RST_CTRL0, 1 << 31); +} + +void earcrx_arc_init(struct regmap *dmac_map) +{ + unsigned int spdifin_clk = 500000000; + + /* sysclk/rate/32(bit)/2(ch)/2(bmc) */ + unsigned int counter_32k = (spdifin_clk / (32000 * 64)); + unsigned int counter_44k = (spdifin_clk / (44100 * 64)); + unsigned int counter_48k = (spdifin_clk / (48000 * 64)); + unsigned int counter_88k = (spdifin_clk / (88200 * 64)); + unsigned int counter_96k = (spdifin_clk / (96000 * 64)); + unsigned int counter_176k = (spdifin_clk / (176400 * 64)); + unsigned int counter_192k = (spdifin_clk / (192000 * 64)); + unsigned int mode0_th = 3 * (counter_32k + counter_44k) >> 1; + unsigned int mode1_th = 3 * (counter_44k + counter_48k) >> 1; + unsigned int mode2_th = 3 * (counter_48k + counter_88k) >> 1; + unsigned int mode3_th = 3 * (counter_88k + counter_96k) >> 1; + unsigned int mode4_th = 3 * (counter_96k + counter_176k) >> 1; + unsigned int mode5_th = 3 * (counter_176k + counter_192k) >> 1; + unsigned int mode0_timer = counter_32k >> 1; + unsigned int mode1_timer = counter_44k >> 1; + unsigned int mode2_timer = counter_48k >> 1; + unsigned int mode3_timer = counter_88k >> 1; + unsigned int mode4_timer = counter_96k >> 1; + unsigned int mode5_timer = (counter_176k >> 1); + unsigned int mode6_timer = (counter_192k >> 1); + + mmio_write(dmac_map, + EARCRX_SPDIFIN_SAMPLE_CTRL0, + 0x0 << 28 | /* detect by max_width */ + (spdifin_clk / 10000) << 0 /* base timer */ + ); + + mmio_write(dmac_map, + EARCRX_SPDIFIN_SAMPLE_CTRL1, + mode0_th << 20 | + mode1_th << 10 | + mode2_th << 0); + + mmio_write(dmac_map, + EARCRX_SPDIFIN_SAMPLE_CTRL2, + mode3_th << 20 | + mode4_th << 10 | + mode5_th << 0); + + mmio_write(dmac_map, + EARCRX_SPDIFIN_SAMPLE_CTRL3, + (mode0_timer << 24) | + (mode1_timer << 16) | + (mode2_timer << 8) | + (mode3_timer << 0) + ); + + mmio_write(dmac_map, + EARCRX_SPDIFIN_SAMPLE_CTRL4, + (mode4_timer << 24) | + (mode5_timer << 16) | + (mode6_timer << 8) + ); + + mmio_write(dmac_map, + EARCRX_SPDIFIN_CTRL0, + 0x1 << 31 | /* reg_work_en */ + 0x1 << 30 | /* reg_chnum_sel */ + 0x1 << 25 | /* reg_findpapb_en */ + 0x1 << 24 | /* nonpcm2pcm_th enable */ + 0xFFF << 12 /* reg_nonpcm2pcm_th */ + ); + mmio_write(dmac_map, + EARCRX_SPDIFIN_CTRL2, + (1 << 14) | /* reg_earc_auto */ + (1 << 13) /* reg_earcin_papb_lr */ + ); + mmio_write(dmac_map, + EARCRX_SPDIFIN_CTRL3, + (0xEC37 << 16) | /* reg_earc_pa_value */ + (0x5A5A << 0) /* reg_earc_pb_value */ + ); +} + +enum cmdc_st earcrx_cmdc_get_state(struct regmap *cmdc_map) +{ + int val = mmio_read(cmdc_map, EARC_RX_CMDC_STATUS0); + enum cmdc_st state = (enum cmdc_st)(val & 0x7); + + return state; +} + +enum attend_type earcrx_cmdc_get_attended_type(struct regmap *cmdc_map) +{ + int val = mmio_read(cmdc_map, EARC_RX_CMDC_STATUS0); + enum cmdc_st state = (enum cmdc_st)(val & 0x7); + enum attend_type type = ATNDTYP_DISCNCT; + + if ((val & (1 << 0x3)) && (state == CMDC_ST_ARC)) + type = ATNDTYP_ARC; + else if ((val & (1 << 0x4)) && (state == CMDC_ST_EARC)) + type = ATNDTYP_EARC; + + return type; +} + +void earcrx_cdmc_clr_irqs(struct regmap *top_map, int clr) +{ + mmio_write(top_map, EARCRX_CMDC_INT_PENDING, clr); +} + +int earcrx_cdmc_get_irqs(struct regmap *top_map) +{ + return mmio_read(top_map, EARCRX_CMDC_INT_PENDING); +} + +void earcrx_dmac_clr_irqs(struct regmap *top_map, int clr) +{ + mmio_write(top_map, EARCRX_DMAC_INT_PENDING, clr); +} + +int earcrx_dmac_get_irqs(struct regmap *top_map) +{ + return mmio_read(top_map, EARCRX_DMAC_INT_PENDING); +} + +void earcrx_enable(struct regmap *cmdc_map, + struct regmap *dmac_map, bool enable) +{ + enum attend_type type = earcrx_cmdc_get_attended_type(cmdc_map); + if (enable) { - earcrx_dmac_update_bits(EARCRX_DMAC_SYNC_CTRL0, - 1 << 30, /* reg_rst_afifo_out_n */ - 1 << 30); + mmio_update_bits(dmac_map, EARCRX_DMAC_SYNC_CTRL0, + 1 << 30, /* reg_rst_afifo_out_n */ + 1 << 30); - earcrx_dmac_update_bits(EARCRX_DMAC_SYNC_CTRL0, - 1 << 29, /* reg_rst_afifo_in_n */ - 0x1 << 29); + mmio_update_bits(dmac_map, EARCRX_DMAC_SYNC_CTRL0, + 1 << 29, /* reg_rst_afifo_in_n */ + 0x1 << 29); - earcrx_dmac_update_bits(EARCRX_ERR_CORRECT_CTRL0, - 1 << 29, /* reg_rst_afifo_out_n */ - 1 << 29 - ); - earcrx_dmac_update_bits(EARCRX_ERR_CORRECT_CTRL0, - 1 << 28, /* reg_rst_afifo_in_n */ - 1 << 28 /* reg_rst_afifo_in_n */ - ); + mmio_update_bits(dmac_map, EARCRX_ERR_CORRECT_CTRL0, + 1 << 29, /* reg_rst_afifo_out_n */ + 1 << 29 + ); + mmio_update_bits(dmac_map, EARCRX_ERR_CORRECT_CTRL0, + 1 << 28, /* reg_rst_afifo_in_n */ + 1 << 28 /* reg_rst_afifo_in_n */ + ); } else { - earcrx_dmac_update_bits(EARCRX_DMAC_SYNC_CTRL0, - 0x3 << 29, - 0x0 << 29); + mmio_update_bits(dmac_map, EARCRX_DMAC_SYNC_CTRL0, + 0x3 << 29, + 0x0 << 29); + + mmio_update_bits(dmac_map, EARCRX_ERR_CORRECT_CTRL0, + 0x3 << 28, 0x0 << 28); + } + + if (type == ATNDTYP_EARC) + mmio_update_bits(dmac_map, EARCRX_DMAC_SYNC_CTRL0, + 1 << 31, /* reg_work_en */ + enable << 31); + else if (type == ATNDTYP_ARC) { + mmio_update_bits(dmac_map, + EARCRX_SPDIFIN_SAMPLE_CTRL0, + 0x1 << 31, /* reg_work_enable */ + enable << 31); + + mmio_write(dmac_map, EARCRX_DMAC_SYNC_CTRL0, 0x0); + } + + mmio_update_bits(dmac_map, EARCRX_DMAC_UBIT_CTRL0, + 1 << 31, /* reg_work_enable */ + enable << 31); - earcrx_dmac_update_bits(EARCRX_ERR_CORRECT_CTRL0, - 0x3 << 28, 0x0 << 28); + mmio_update_bits(dmac_map, EARCRX_ERR_CORRECT_CTRL0, + 1 << 31, + enable << 31); /* reg_work_en */ + + mmio_update_bits(dmac_map, EARCRX_DMAC_TOP_CTRL0, + 1 << 31, + enable << 31); /* reg_top_work_en */ +} + +void earctx_cmdc_int_mask(struct regmap *top_map) +{ + mmio_write(top_map, EARCTX_CMDC_INT_MASK, + (0x0 << 17) | /* hpd_high_int */ + (0x0 << 16) | /* hpd_low_int */ + (0x1 << 15) | /* idle2_int */ + (0x1 << 14) | /* idle1_int */ + (0x1 << 13) | /* disc2_int */ + (0x1 << 12) | /* disc1_int */ + (0x1 << 11) | /* earc_int */ + (0x0 << 10) | /* hb_status_int */ + (0x1 << 9) | /* losthb_int */ + (0x1 << 8) | /* timeout_int */ + (0x0 << 7) | /* status_ch_int */ + (0x0 << 6) | /* int_recv_finished */ + (0x0 << 5) | /* int_recv_nack */ + (0x0 << 4) | /* int_recv_norsp */ + (0x0 << 3) | /* int_recv_unexp */ + (0x0 << 2) | /* int_recv_data */ + (0x0 << 1) | /* int_recv_ack */ + (0x0 << 0) /* int_recv_ecc_err */ + ); +} + +void earctx_cmdc_init(struct regmap *top_map) +{ + /* ana */ + mmio_write(top_map, EARCTX_ANA_CTRL0, + 0x1 << 31 | /* earctx_en_d2a */ + 0x1 << 28 | /* earctx_cmdcrx_rcfilter_sel */ + 0x4 << 26 | /* earctx_cmdcrx_hystrim */ + 0x8 << 20 | /* earctx_idr_trim */ + 0x10 << 12 | /* earctx_rterm_trim */ + 0x4 << 8 | /* earctx_dmac_slew_con */ + 0x4 << 5 | /* earctx_cmdctx_ack_hystrim */ + 0x10 << 0 /* earctx_cmdctx_ack_reftrim */ + ); +} + +void earctx_cmdc_arc_connect(struct regmap *cmdc_map, bool init) +{ + if (init) + mmio_update_bits(cmdc_map, + EARC_TX_CMDC_VSM_CTRL0, + 0x7 << 25, + 0x1 << 27 | /* arc_initiated */ + 0x0 << 26 | /* arc_terminated */ + 0x1 << 25 /* arc_enable */ + ); + else + mmio_update_bits(cmdc_map, + EARC_TX_CMDC_VSM_CTRL0, + 0x7 << 25, + 0x0 << 27 | /* arc_initiated */ + 0x1 << 26 | /* arc_terminated */ + 0x0 << 25 /* arc_enable */ + ); +} + +void earctx_cmdc_hpd_detect(struct regmap *top_map, + struct regmap *cmdc_map, + int earc_port, bool st) +{ + /* select hdmirx_hpd */ + mmio_update_bits(cmdc_map, + EARC_TX_CMDC_VSM_CTRL1, + 0x1 << 8, /* cntl_hpd_sel */ + 0x1 << 8); + + /* select hdmi_hpd mux */ + mmio_update_bits(top_map, EARCTX_TOP_CTRL0, + 0xf << 8, + 0x1 << 11 | /* hdmi_hpd invent */ + earc_port << 8 /* hdmi_hpd mux, port 0/1/2 */ + ); + + if (st) { + mmio_update_bits(cmdc_map, + EARC_TX_CMDC_VSM_CTRL0, + 0x1 << 19, + 0x1 << 19 /* comma_cnt_rst */ + ); + + mmio_update_bits(cmdc_map, + EARC_TX_CMDC_VSM_CTRL0, + 0x1 << 19 | 0xf << 20, + 0x0 << 19 | /* comma_cnt_rst */ + 0x3 << 20 | 0x3 << 22 + ); + + /* no timeout */ + mmio_update_bits(cmdc_map, + EARC_TX_CMDC_VSM_CTRL5, + 0x3 << 0, + 0x1 << 1 + ); + + mmio_update_bits(cmdc_map, + EARC_TX_CMDC_VSM_CTRL1, + 0xff << 0, + 0xa << 0 /* comma_cnt_th */ + ); + } else { + /* soft reset */ + mmio_update_bits(cmdc_map, + EARC_TX_CMDC_TOP_CTRL1, + 0xf << 0, + 0xf << 0); + mmio_update_bits(cmdc_map, + EARC_TX_CMDC_TOP_CTRL1, + 0xf << 0, + 0x0 << 0); } +} - earcrx_dmac_update_bits(EARCRX_DMAC_SYNC_CTRL0, - 1 << 31, /* reg_work_en */ - enable << 31); +void earctx_dmac_init(struct regmap *top_map, struct regmap *dmac_map) +{ + mmio_update_bits(dmac_map, EARCTX_SPDIFOUT_CTRL0, + 0x3 << 28, + 0x0 << 28); + mmio_update_bits(dmac_map, EARCTX_SPDIFOUT_CTRL0, + 0x1 << 29, /* afifo out reset */ + 0x1 << 29); + mmio_update_bits(dmac_map, EARCTX_SPDIFOUT_CTRL0, + 0x1 << 28 | /* afifo in reset */ + 0x1 << 26 | /* user Bit select */ + 0x1 << 24 | /* chdata select*/ + 0x1 << 20 | /* reg_data_sel, 1: data from 27bit */ + 0x1 << 19 | /* 0: lsb first */ + 0x1 << 18 | /* biphase encode valid Bit value sel */ + 0xff << 4, /* lane mask */ + 0x1 << 28 | + 0x1 << 26 | + 0x1 << 24 | + 0x1 << 20 | + 0x0 << 19 | + 0x1 << 18 | + 0x3 << 4 // ODO: lane 0 now + ); - earcrx_dmac_update_bits(EARCRX_DMAC_UBIT_CTRL0, - 1 << 31, /* reg_work_enable */ - enable << 31); + mmio_update_bits(dmac_map, EARCTX_ERR_CORRT_CTRL0, + 0x1 << 16 | /* reg_ubit_fifo_init_n */ + 0x7 << 8 | /* r channel select */ + 0x7 << 4, /* l channel select */ + 0x1 << 16 | + 0x1 << 8 | + 0x0 << 4); - earcrx_dmac_update_bits(EARCRX_ERR_CORRECT_CTRL0, - 1 << 31, - enable << 31); /* reg_work_en */ + mmio_update_bits(dmac_map, EARCTX_ERR_CORRT_CTRL4, + 0xf << 17, + 0x1 << 19 | /* userBit sel, 1: reg_value */ + 0x1 << 18 | /* validBit sel, 1: reg_value */ + 0x1 << 17 /* reg_chst_sel, 1: reg_value */ + ); +} + +void earctx_dmac_set_format(struct regmap *dmac_map, + int frddr_idx, int msb, int frddr_type) +{ + mmio_update_bits(dmac_map, EARCTX_SPDIFOUT_CTRL1, + 0x7 << 24 | /* frddr src */ + 0xff << 16 | /* waiting count after enabled */ + 0x1f << 8 | /* msb position */ + 0x7 << 4, /* frddr type */ + frddr_idx << 24 | + 0x40 << 16 | + msb << 8 | + frddr_type << 4); - earcrx_dmac_update_bits(EARCRX_DMAC_TOP_CTRL0, - 1 << 31, - enable << 31); /* reg_top_work_en */ + mmio_update_bits(dmac_map, EARCTX_ERR_CORRT_CTRL4, + 0x1f << 25, + 0x1f << 25 /* msb */ + ); + + /* for raw data */ + mmio_update_bits(dmac_map, EARCTX_ERR_CORRT_CTRL3, + 0x1f << 24, + 0x17 << 24 + ); +} + +void earctx_set_channel_status_info(struct regmap *dmac_map, + struct iec958_chsts *chsts) +{ + /* ch status = reg_chsts0~B */ + + /* L Channel */ + mmio_write(dmac_map, EARCTX_SPDIFOUT_CHSTS0, + ((chsts->chstat1_l >> 8) & 0xf) << 24 | chsts->chstat0_l); + + /* R Channel */ + mmio_write(dmac_map, EARCTX_SPDIFOUT_CHSTS6, + ((chsts->chstat1_r >> 8) & 0xf) << 24 | chsts->chstat0_r); +} + +enum attend_type earctx_cmdc_get_attended_type(struct regmap *cmdc_map) +{ + int val = mmio_read(cmdc_map, EARC_TX_CMDC_STATUS0); + enum cmdc_st state = (enum cmdc_st)(val & 0x7); + enum attend_type tx_type = ATNDTYP_DISCNCT; + + if ((val & (1 << 0x3)) && (state == CMDC_ST_ARC)) + tx_type = ATNDTYP_ARC; + else if ((val & (1 << 0x4)) && (state == CMDC_ST_EARC)) + tx_type = ATNDTYP_EARC; + + return tx_type; +} + +void earctx_cdmc_clr_irqs(struct regmap *top_map, int clr) +{ + mmio_write(top_map, EARCTX_CMDC_INT_PENDING, clr); +} + +int earctx_cdmc_get_irqs(struct regmap *top_map) +{ + return mmio_read(top_map, EARCTX_CMDC_INT_PENDING); +} + +void earctx_dmac_clr_irqs(struct regmap *top_map, int clr) +{ + mmio_write(top_map, EARCTX_DMAC_INT_PENDING, clr); +} + +int earctx_dmac_get_irqs(struct regmap *top_map) +{ + return mmio_read(top_map, EARCTX_DMAC_INT_PENDING); +} + +void earctx_enable(struct regmap *top_map, + struct regmap *cmdc_map, + struct regmap *dmac_map, + bool enable) +{ + mmio_update_bits(dmac_map, EARCTX_SPDIFOUT_CTRL0, + 0x1 << 31, + enable << 31); + + mmio_update_bits(dmac_map, EARC_RX_CMDC_BIPHASE_CTRL1, + 0x1 << 30, + enable << 30); + + if (enable) + mmio_write(top_map, EARCTX_DMAC_INT_MASK, + (0x1 << 4) | /* fe_modulation c_hold_clr */ + (0x1 << 3) | /* fe_modulation c_hold_start */ + (0x1 << 2) | /* err_correct c_fifo_thd_less_pass */ + (0x1 << 1) | /* err_correct r_fifo_overflow_set */ + (0x1 << 0) /* err_correct c_fifo_empty_set */ + ); + else + mmio_write(top_map, EARCTX_DMAC_INT_MASK, + 0x0 + ); + + if (earctx_cmdc_get_attended_type(cmdc_map) == ATNDTYP_EARC) { + if (spdifout_is_raw()) { + mmio_update_bits(dmac_map, EARCTX_ERR_CORRT_CTRL3, + 0x1 << 29, + enable << 29); + } + mmio_update_bits(dmac_map, EARCTX_FE_CTRL0, + 0x1 << 30, + enable << 30); + } } diff --git a/sound/soc/amlogic/auge/earc_hw.h b/sound/soc/amlogic/auge/earc_hw.h index 1630733..6e26d32 100644 --- a/sound/soc/amlogic/auge/earc_hw.h +++ b/sound/soc/amlogic/auge/earc_hw.h @@ -19,9 +19,126 @@ #include "regs.h" #include "iomap.h" +#include <linux/amlogic/media/sound/iomapres.h> +#include <linux/amlogic/media/sound/spdif_info.h> + +#define INT_EARCRX_CMDC_IDLE2 (0x1 << 15) +#define INT_EARCRX_CMDC_IDLE1 (0x1 << 14) +#define INT_EARCRX_CMDC_DISC2 (0x1 << 13) +#define INT_EARCRX_CMDC_DISC1 (0x1 << 12) +#define INT_EARCRX_CMDC_EARC (0x1 << 11) +#define INT_EARCRX_CMDC_HB_STATUS (0x1 << 10) +#define INT_EARCRX_CMDC_LOSTHB (0x1 << 9) +#define INT_EARCRX_CMDC_TIMEOUT (0x1 << 8) +#define INT_EARCRX_CMDC_STATUS_CH (0x1 << 7) +#define INT_EARCRX_CMDC_REC_INVALID_ID (0x1 << 6) +#define INT_EARCRX_CMDC_REC_INVALID_OFFSET (0x1 << 5) +#define INT_EARCRX_CMDC_REC_UNEXP (0x1 << 4) +#define INT_EARCRX_CMDC_REC_ECC_ERR (0x1 << 3) +#define INT_EARCRX_CMDC_REC_PARITY_ERR (0x1 << 2) +#define INT_EARCRX_CMDC_RECV_PACKET (0x1 << 1) +#define INT_EARCRX_CMDC_REC_TIME_OUT (0x1 << 0) + +#define INT_EARCRX_ANA_RST_C_NEW_FORMAT_SET (0x1 << 17) +#define INT_EARCRX_ANA_RST_C_EARCRX_DIV2_HOLD_SET (0x1 << 16) +#define INT_EARCRX_ERR_CORRECT_C_BCHERR_INT_SET (0x1 << 15) +#define INT_EARCRX_ERR_CORRECT_R_AFIFO_OVERFLOW_SET (0x1 << 14) +#define INT_EARCRX_ERR_CORRECT_R_FIFO_OVERFLOW_SET (0x1 << 13) +#define INT_EARCRX_USER_BIT_CHECK_R_FIFO_OVERFLOW (0x1 << 12) +#define INT_EARCRX_USER_BIT_CHECK_C_FIFO_THD_PASS (0x1 << 11) +#define INT_EARCRX_USER_BIT_CHECK_C_U_PK_LOST_INT_SET (0x1 << 10) +#define INT_ARCRX_USER_BIT_CHECK_C_IU_PK_END (0x1 << 9) +#define INT_ARCRX_BIPHASE_DECODE_C_CHST_MUTE_CLR (0x1 << 8) +#define INT_ARCRX_BIPHASE_DECODE_C_FIND_PAPB (0x1 << 7) +#define INT_ARCRX_BIPHASE_DECODE_C_VALID_CHANGE (0x1 << 6) +#define INT_ARCRX_BIPHASE_DECODE_C_FIND_NONPCM2PCM (0x1 << 5) +#define INT_ARCRX_BIPHASE_DECODE_C_PCPD_CHANGE (0x1 << 4) +#define INT_ARCRX_BIPHASE_DECODE_C_CH_STATUS_CHANGE (0x1 << 3) +#define INT_ARCRX_BIPHASE_DECODE_I_SAMPLE_MODE_CHANGE (0x1 << 2) +#define INT_ARCRX_BIPHASE_DECODE_R_PARITY_ERR (0x1 << 1) +#define INT_ARCRX_DMAC_SYNC_AFIFO_OVERFLOW (0x1 << 0) + +#define INT_EARCTX_CMDC_HPD_H (0x1 << 17) +#define INT_EARCTX_CMDC_HPD_L (0x1 << 16) +#define INT_EARCTX_CMDC_IDLE2 (0x1 << 15) +#define INT_EARCTX_CMDC_IDLE1 (0x1 << 14) +#define INT_EARCTX_CMDC_DISC2 (0x1 << 13) +#define INT_EARCTX_CMDC_DISC1 (0x1 << 12) +#define INT_EARCTX_CMDC_EARC (0x1 << 11) +#define INT_EARCTX_CMDC_HB_STATUS (0x1 << 10) +#define INT_EARCTX_CMDC_LOSTHB (0x1 << 9) +#define INT_EARCTX_CMDC_TIMEOUT (0x1 << 8) +#define INT_EARCTX_CMDC_STATUS_CH (0x1 << 7) +#define INT_EARCTX_CMDC_RECV_FINISHED (0x1 << 6) +#define INT_EARCTX_CMDC_RECV_NACK (0x1 << 5) +#define INT_EARCTX_CMDC_RECV_NORSP (0x1 << 4) +#define INT_EARCTX_CMDC_RECV_UNEXP (0x1 << 3) +#define INT_EARCTX_CMDC_RECV_DATA (0x1 << 2) +#define INT_EARCTX_CMDC_RECV_ACK (0x1 << 1) +#define INT_EARCTX_CMDC_RECV_ECC_ERR (0x1 << 0) + +#define INT_EARCTX_FEM_C_HOLD_CLR (0x1 << 4) +#define INT_EARCTX_FEM_C_HOLD_START (0x1 << 3) +#define INT_EARCTX_ERRCORR_C_FIFO_THD_LESS_PASS (0x1 << 2) +#define INT_EARCTX_ERRCORR_C_FIFO_OVERFLOW (0x1 << 1) +#define INT_EARCTX_ERRCORR_C_FIFO_EMPTY (0x1 << 0) + +/* cmdc discovery and disconnect state */ +enum cmdc_st { + CMDC_ST_OFF, + CMDC_ST_IDLE1, + CMDC_ST_IDLE2, + CMDC_ST_DISC1, + CMDC_ST_DISC2, + CMDC_ST_EARC, + CMDC_ST_ARC +}; + +/* attended type: disconect, ARC, eARC */ +enum attend_type { + ATNDTYP_DISCNCT, + ATNDTYP_ARC, + ATNDTYP_EARC +}; + +enum tx_hd_hdp_mux { + GPIOW_1, + GPIOW_9, + GPIOW_5 +}; + +void earcrx_cmdc_init(struct regmap *top_map); +void earcrx_cmdc_arc_connect(struct regmap *cmdc_map, bool init); +void earcrx_cmdc_hpd_detect(struct regmap *cmdc_map, bool st); +void earcrx_dmac_init(struct regmap *top_map, struct regmap *dmac_map); +void earcrx_arc_init(struct regmap *dmac_map); +enum cmdc_st earcrx_cmdc_get_state(struct regmap *cmdc_map); +enum attend_type earcrx_cmdc_get_attended_type(struct regmap *cmdc_map); +void earcrx_cdmc_clr_irqs(struct regmap *top_map, int clr); +int earcrx_cdmc_get_irqs(struct regmap *top_map); +void earcrx_dmac_clr_irqs(struct regmap *top_map, int clr); +int earcrx_dmac_get_irqs(struct regmap *top_map); +void earcrx_enable(struct regmap *cmdc_map, + struct regmap *dmac_map, bool enable); +void earctx_cmdc_int_mask(struct regmap *top_map); + +void earctx_cmdc_init(struct regmap *top_map); +void earctx_cmdc_arc_connect(struct regmap *cmdc_map, bool init); +void earctx_cmdc_hpd_detect(struct regmap *top_map, + struct regmap *cmdc_map, + int earc_port, bool st); +void earctx_dmac_init(struct regmap *top_map, struct regmap *dmac_map); +void earctx_dmac_set_format(struct regmap *dmac_map, + int frddr_idx, int msb, int frddr_type); +void earctx_set_channel_status_info(struct regmap *dmac_map, + struct iec958_chsts *chsts); +void earctx_cdmc_clr_irqs(struct regmap *top_map, int clr); +int earctx_cdmc_get_irqs(struct regmap *top_map); +void earctx_dmac_clr_irqs(struct regmap *top_map, int clr); +int earctx_dmac_get_irqs(struct regmap *top_map); +void earctx_enable(struct regmap *top_map, + struct regmap *cmdc_map, + struct regmap *dmac_map, + bool enable); -extern void earcrx_cmdc_init(void); -extern void earcrx_dmac_init(void); -extern void earc_arc_init(void); -extern void earc_rx_enable(bool enable); #endif diff --git a/sound/soc/amlogic/auge/extn.c b/sound/soc/amlogic/auge/extn.c index 5589486..f95afa5 100644 --- a/sound/soc/amlogic/auge/extn.c +++ b/sound/soc/amlogic/auge/extn.c @@ -35,6 +35,7 @@ #include <sound/control.h> #include <sound/soc.h> #include <sound/pcm_params.h> +#include <sound/tlv.h> #include "ddr_mngr.h" #include "audio_utils.h" @@ -47,11 +48,19 @@ #define MAX_INT 0x7ffffff +#define DYNC_KCNTL_CNT 2 + struct extn_chipinfo { /* try to check papb before fetch pcpd * no nonpcm2pcm irq for tl1 */ bool no_nonpcm2pcm_clr; + + /* eARC-ARC or CEC-ARC + * CEC-ARC: tl1 + * eARC-ARC: sm1/tm2, etc + */ + bool cec_arc; }; struct extn { @@ -91,6 +100,8 @@ struct extn { bool nonpcm_flag; struct extn_chipinfo *chipinfo; + struct snd_kcontrol *controls[DYNC_KCNTL_CNT]; + }; #define PREALLOC_BUFFER (256 * 1024) @@ -402,10 +413,19 @@ struct snd_soc_platform_driver extn_platform = { .pcm_new = extn_new, }; +static int extn_create_controls(struct snd_card *card, + struct extn *p_extn); + static int extn_dai_probe(struct snd_soc_dai *cpu_dai) { + struct snd_card *card = cpu_dai->component->card->snd_card; + struct extn *p_extn = snd_soc_dai_get_drvdata(cpu_dai); + pr_info("asoc debug: %s-%d\n", __func__, __LINE__); + if (p_extn->chipinfo && p_extn->chipinfo->cec_arc) + extn_create_controls(card, p_extn); + return 0; } @@ -662,8 +682,10 @@ static int arc_get_src( struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { - struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); - struct extn *p_extn = dev_get_drvdata(component->dev); + struct extn *p_extn = snd_kcontrol_chip(kcontrol); + + if (!p_extn) + return 0; ucontrol->value.integer.value[0] = p_extn->arc_src; @@ -674,8 +696,10 @@ static int arc_set_src( struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { - struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); - struct extn *p_extn = dev_get_drvdata(component->dev); + struct extn *p_extn = snd_kcontrol_chip(kcontrol); + + if (!p_extn) + return 0; p_extn->arc_src = ucontrol->value.integer.value[0]; @@ -688,8 +712,10 @@ static int arc_get_enable( struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { - struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); - struct extn *p_extn = dev_get_drvdata(component->dev); + struct extn *p_extn = snd_kcontrol_chip(kcontrol); + + if (!p_extn) + return 0; ucontrol->value.integer.value[0] = p_extn->arc_en; @@ -700,8 +726,10 @@ static int arc_set_enable( struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { - struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); - struct extn *p_extn = dev_get_drvdata(component->dev); + struct extn *p_extn = snd_kcontrol_chip(kcontrol); + + if (!p_extn) + return 0; p_extn->arc_en = ucontrol->value.integer.value[0]; @@ -717,6 +745,9 @@ static int frhdmirx_get_mode( struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); struct extn *p_extn = dev_get_drvdata(component->dev); + if (!p_extn) + return 0; + ucontrol->value.integer.value[0] = p_extn->hdmirx_mode; return 0; @@ -729,6 +760,9 @@ static int frhdmirx_set_mode( struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); struct extn *p_extn = dev_get_drvdata(component->dev); + if (!p_extn) + return 0; + p_extn->hdmirx_mode = ucontrol->value.integer.value[0]; return 0; @@ -800,6 +834,9 @@ static int hdmirx_audio_type_get_enum( struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); struct extn *p_extn = dev_get_drvdata(component->dev); + if (!p_extn) + return 0; + ucontrol->value.enumerated.item[0] = hdmiin_check_audio_type(p_extn); @@ -807,8 +844,7 @@ static int hdmirx_audio_type_get_enum( } #endif -static const struct snd_kcontrol_new extn_controls[] = { - /* Out */ +static const struct snd_kcontrol_new extn_arc_controls[DYNC_KCNTL_CNT] = { SOC_ENUM_EXT("HDMI ARC Source", arc_src_enum, arc_get_src, @@ -818,6 +854,34 @@ static const struct snd_kcontrol_new extn_controls[] = { 0, arc_get_enable, arc_set_enable), +}; + +static int extn_create_controls(struct snd_card *card, + struct extn *p_extn) +{ + int i, err = 0; + + memset(p_extn->controls, 0, sizeof(p_extn->controls)); + + for (i = 0; i < DYNC_KCNTL_CNT; i++) { + p_extn->controls[i] = + snd_ctl_new1(&extn_arc_controls[i], p_extn); + err = snd_ctl_add(card, p_extn->controls[i]); + if (err < 0) + goto __error; + } + + return 0; + +__error: + for (i = 0; i < DYNC_KCNTL_CNT; i++) + if (p_extn->controls[i]) + snd_ctl_remove(card, p_extn->controls[i]); + + return err; +} + +static const struct snd_kcontrol_new extn_controls[] = { /* In */ SOC_SINGLE_BOOL_EXT("SPDIFIN PAO", @@ -886,12 +950,12 @@ static const struct snd_soc_component_driver extn_component = { struct extn_chipinfo tl1_extn_chipinfo = { .no_nonpcm2pcm_clr = true, + .cec_arc = true, }; static const struct of_device_id extn_device_id[] = { { .compatible = "amlogic, snd-extn", - .data = &tl1_extn_chipinfo, }, { .compatible = "amlogic, tl1-snd-extn", @@ -953,10 +1017,10 @@ static int extn_platform_probe(struct platform_device *pdev) /* Default: PAO mode */ p_extn->hdmirx_mode = 1; - ret = snd_soc_register_component(&pdev->dev, - &extn_component, - extn_dai, - ARRAY_SIZE(extn_dai)); + ret = devm_snd_soc_register_component(&pdev->dev, + &extn_component, + extn_dai, + ARRAY_SIZE(extn_dai)); if (ret) { dev_err(&pdev->dev, "snd_soc_register_component failed\n"); diff --git a/sound/soc/amlogic/auge/iomap.c b/sound/soc/amlogic/auge/iomap.c index 3ee30b7..efbf51d 100644 --- a/sound/soc/amlogic/auge/iomap.c +++ b/sound/soc/amlogic/auge/iomap.c @@ -251,87 +251,6 @@ void vad_update_bits(unsigned int reg, } EXPORT_SYMBOL(vad_update_bits); -int earcrx_cmdc_read(unsigned int reg) -{ - int ret, val = 0; - - ret = aml_snd_read(IO_EARCRX_CMDC, reg, &val); - - if (ret) { - pr_err("read audio reg %x error %d\n", reg, ret); - return -1; - } - return val; -} -EXPORT_SYMBOL(earcrx_cmdc_read); - -void earcrx_cmdc_write(unsigned int reg, unsigned int val) -{ - aml_snd_write(IO_EARCRX_CMDC, reg, val); -} -EXPORT_SYMBOL(earcrx_cmdc_write); - -void earcrx_cmdc_update_bits(unsigned int reg, - unsigned int mask, unsigned int val) -{ - aml_snd_update_bits(IO_EARCRX_CMDC, reg, mask, val); -} -EXPORT_SYMBOL(earcrx_cmdc_update_bits); - -int earcrx_dmac_read(unsigned int reg) -{ - int ret, val = 0; - - ret = aml_snd_read(IO_EARCRX_DMAC, reg, &val); - - if (ret) { - pr_err("read audio reg %x error %d\n", reg, ret); - return -1; - } - return val; -} -EXPORT_SYMBOL(earcrx_dmac_read); - -void earcrx_dmac_write(unsigned int reg, unsigned int val) -{ - aml_snd_write(IO_EARCRX_DMAC, reg, val); -} -EXPORT_SYMBOL(earcrx_dmac_write); - -void earcrx_dmac_update_bits(unsigned int reg, - unsigned int mask, unsigned int val) -{ - aml_snd_update_bits(IO_EARCRX_DMAC, reg, mask, val); -} -EXPORT_SYMBOL(earcrx_dmac_update_bits); - -int earcrx_top_read(unsigned int reg) -{ - int ret, val = 0; - - ret = aml_snd_read(IO_EARCRX_TOP, reg, &val); - - if (ret) { - pr_err("read audio reg %x error %d\n", reg, ret); - return -1; - } - return val; -} -EXPORT_SYMBOL(earcrx_top_read); - -void earcrx_top_write(unsigned int reg, unsigned int val) -{ - aml_snd_write(IO_EARCRX_TOP, reg, val); -} -EXPORT_SYMBOL(earcrx_top_write); - -void earcrx_top_update_bits(unsigned int reg, - unsigned int mask, unsigned int val) -{ - aml_snd_update_bits(IO_EARCRX_TOP, reg, mask, val); -} -EXPORT_SYMBOL(earcrx_top_update_bits); - static int snd_iomap_probe(struct platform_device *pdev) { struct resource res; diff --git a/sound/soc/amlogic/auge/iomap.h b/sound/soc/amlogic/auge/iomap.h index 07b8b54..ae3c928 100644 --- a/sound/soc/amlogic/auge/iomap.h +++ b/sound/soc/amlogic/auge/iomap.h @@ -25,9 +25,6 @@ enum{ IO_EQDRC_BUS, IO_RESET, IO_VAD, - IO_EARCRX_CMDC, - IO_EARCRX_DMAC, - IO_EARCRX_TOP, IO_MAX, }; @@ -61,17 +58,4 @@ extern int vad_read(unsigned int reg); extern void vad_write(unsigned int reg, unsigned int val); extern void vad_update_bits(unsigned int reg, unsigned int mask, unsigned int val); - -extern int earcrx_cmdc_read(unsigned int reg); -extern void earcrx_cmdc_write(unsigned int reg, unsigned int val); -extern void earcrx_cmdc_update_bits(unsigned int reg, - unsigned int mask, unsigned int val); -extern int earcrx_dmac_read(unsigned int reg); -extern void earcrx_dmac_write(unsigned int reg, unsigned int val); -extern void earcrx_dmac_update_bits(unsigned int reg, - unsigned int mask, unsigned int val); -extern int earcrx_top_read(unsigned int reg); -extern void earcrx_top_write(unsigned int reg, unsigned int val); -extern void earcrx_top_update_bits(unsigned int reg, - unsigned int mask, unsigned int val); #endif diff --git a/sound/soc/amlogic/auge/vad.c b/sound/soc/amlogic/auge/vad.c index be941b5..845281e 100644 --- a/sound/soc/amlogic/auge/vad.c +++ b/sound/soc/amlogic/auge/vad.c @@ -433,6 +433,7 @@ static int vad_set_clks(struct vad *p_vad, bool enable) /* enable clock gate */ ret = clk_prepare_enable(p_vad->gate); + clk_set_rate(p_vad->pll, 25000000); /* enable clock */ ret = clk_prepare_enable(p_vad->pll); if (ret) { diff --git a/sound/soc/amlogic/common/Makefile b/sound/soc/amlogic/common/Makefile index 41087df..cc8b7a9 100644 --- a/sound/soc/amlogic/common/Makefile +++ b/sound/soc/amlogic/common/Makefile @@ -1,3 +1,4 @@ obj-y += notify.o \ spdif_info.o \ - misc.o + misc.o \ + iomapres.o diff --git a/sound/soc/amlogic/common/iomapres.c b/sound/soc/amlogic/common/iomapres.c new file mode 100644 index 0000000..5d2d80e --- a/dev/null +++ b/sound/soc/amlogic/common/iomapres.c @@ -0,0 +1,75 @@ +/* + * sound/soc/amlogic/common/iomapres.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. + * + */ +#include <linux/of.h> +#include <linux/of_address.h> +#include <linux/device.h> + +#include <linux/amlogic/media/sound/iomapres.h> + +struct regmap *regmap_resource(struct device *dev, char *name) +{ + struct resource res; + void __iomem *base; + struct device_node *node = dev->of_node; + static struct regmap_config aud_regmap_config = { + .reg_bits = 32, + .val_bits = 32, + .reg_stride = 4, + }; + int i; + + i = of_property_match_string(node, "reg-names", name); + if (of_address_to_resource(node, i, &res)) + return ERR_PTR(-ENOENT); + + base = devm_ioremap_resource(dev, &res); + if (IS_ERR(base)) + return ERR_CAST(base); + + pr_info("%s, %s, start:%#x, size:%#x\n", + __func__, name, (u32)res.start, (u32)resource_size(&res)); + + aud_regmap_config.max_register = resource_size(&res) - 4; + aud_regmap_config.name = + devm_kasprintf(dev, GFP_KERNEL, "%s-%s", node->name, name); + if (!aud_regmap_config.name) + return ERR_PTR(-ENOMEM); + + return devm_regmap_init_mmio(dev, base, &aud_regmap_config); +} + +unsigned int mmio_read(struct regmap *map, unsigned int reg_ofs) +{ + unsigned int val; + + regmap_read(map, (reg_ofs << 2), &val); + + return val; +} + +int mmio_write(struct regmap *map, unsigned int reg_ofs, unsigned int value) +{ + return regmap_write(map, (reg_ofs << 2), value); +} + +int mmio_update_bits(struct regmap *map, + unsigned int reg_ofs, + unsigned int mask, + unsigned int value) +{ + return regmap_update_bits(map, (reg_ofs << 2), mask, value); +} diff --git a/sound/soc/amlogic/common/spdif_info.c b/sound/soc/amlogic/common/spdif_info.c index 87d8619..5b87891 100644 --- a/sound/soc/amlogic/common/spdif_info.c +++ b/sound/soc/amlogic/common/spdif_info.c @@ -34,6 +34,11 @@ unsigned int IEC958_mode_codec; EXPORT_SYMBOL(IEC958_mode_codec); +bool spdifout_is_raw(void) +{ + return (IEC958_mode_codec && IEC958_mode_codec != 9); +} + bool spdif_is_4x_clk(void) { bool is_4x = false; |