From a85ddd799167fe882462a90243c404066474a0ba Mon Sep 17 00:00:00 2001 From: ckkim Date: Fri, 5 Mar 2021 16:53:22 +0900 Subject: [PATCH] ODROID-N2:Added hifi-shield series dtbo. Support 7-pin I2S audio. Change-Id: Ifd997df30260393a10bf49616fd18ecb978769cc --- .../boot/dts/amlogic/meson64_odroidn2.dtsi | 61 ++++++++++++++- .../dts/amlogic/overlays/odroidn2/Makefile | 2 + .../amlogic/overlays/odroidn2/hifishield.dts | 64 +++++++++++++++ .../amlogic/overlays/odroidn2/hifishield2.dts | 77 +++++++++++++++++++ 4 files changed, 201 insertions(+), 3 deletions(-) create mode 100644 arch/arm64/boot/dts/amlogic/overlays/odroidn2/hifishield.dts create mode 100644 arch/arm64/boot/dts/amlogic/overlays/odroidn2/hifishield2.dts diff --git a/arch/arm64/boot/dts/amlogic/meson64_odroidn2.dtsi b/arch/arm64/boot/dts/amlogic/meson64_odroidn2.dtsi index 18be0a2e5bdd..a6d3e9ce4110 100644 --- a/arch/arm64/boot/dts/amlogic/meson64_odroidn2.dtsi +++ b/arch/arm64/boot/dts/amlogic/meson64_odroidn2.dtsi @@ -216,10 +216,20 @@ /* Audio Related start */ dummy_codec:dummy{ + #sound-dai-cells = <0>; + compatible = "amlogic, aml_dummy_codec"; + status = "okay"; + }; + spdif_dit:spdif{ #sound-dai-cells = <0>; compatible = "linux,spdif-dit"; status = "okay"; }; + pcm5102a: pcm5102a { + compatible = "ti,pcm5102a"; + #sound-dai-cells = <0>; + status = "disabled"; + }; amlogic_codec:t9015{ #sound-dai-cells = <0>; compatible = "amlogic, aml_codec_T9015"; @@ -261,7 +271,7 @@ system-clock-frequency = <6144000>; }; codec { - sound-dai = <&dummy_codec>; + sound-dai = <&spdif_dit>; }; }; @@ -293,10 +303,21 @@ system-clock-frequency = <6144000>; }; codec { - sound-dai = <&dummy_codec>; + sound-dai = <&spdif_dit>; }; }; }; + odroid_hifi: odroid_hifi { + compatible = "amlogic, g12a-sound-card"; + aml-audio-card,name = "ODROID-HIFI"; + status = "disabled"; + }; + odroid_hifi2: odroid_hifi2 { + compatible = "amlogic, g12a-sound-card"; + aml-audio-card,name = "ODROID-HIFI2"; + status = "disabled"; + }; + audiolocker: locker { compatible = "amlogic, audiolocker"; clocks = <&clkaudio CLKID_AUDIO_LOCKER_OUT @@ -398,6 +419,25 @@ &audiobus { /* tdmc to internal DAC output, no pinmux */ + aml_tdmb: tdmb { + compatible = "amlogic, g12a-snd-tdmb"; + #sound-dai-cells = <0>; + dai-tdm-lane-slot-mask-in = <0 1 0 0>; + dai-tdm-lane-slot-mask-out = <1 0 0 0>; + dai-tdm-clk-sel = <1>; + clocks = <&clkaudio CLKID_AUDIO_MCLK_B + &clkc CLKID_MPLL1>; + clock-names = "mclk", "clk_srcpll"; + pinctrl-names = "tdm_pins"; + pinctrl-0 = <&tdmb_mclk &tdmout_b /*&tdmin_b*/>; + mclk_pad = <0>; /* 0: mclk_0; 1: mclk_1 */ + i2s2hdmi = <0>; + /*enable default mclk(12.288M), before extern codec start*/ + start_clk_enable = <1>; + /*tdm clk tuning enable*/ + clk_tuning_enable = <1>; + status = "disabled"; + }; aml_tdmc: tdmc { compatible = "amlogic, g12a-snd-tdmc"; #sound-dai-cells = <0>; @@ -410,7 +450,6 @@ i2s2hdmi = <0>; status = "okay"; }; - aml_spdif: spdif { compatible = "amlogic, g12a-snd-spdif-a"; #sound-dai-cells = <0>; @@ -576,6 +615,22 @@ }; &pinctrl_periphs { + tdmb_mclk: tdmb_mclk { + mux { + groups = "mclk0_a"; + function = "mclk0"; + drive-strength = <2>; + }; + }; + tdmout_b: tdmout_b { + mux { /* GPIOA_1, GPIOA_2, GPIOA_3 */ + groups = "tdmb_sclk", + "tdmb_fs", + "tdmb_dout0"; + function = "tdmb_out"; + drive-strength = <2>; + }; + }; spdifout: spdifout { mux {/* GPIOA_11 */ groups = "spdif_out_a11"; diff --git a/arch/arm64/boot/dts/amlogic/overlays/odroidn2/Makefile b/arch/arm64/boot/dts/amlogic/overlays/odroidn2/Makefile index c3b9e5e34250..4ac56ebb2301 100644 --- a/arch/arm64/boot/dts/amlogic/overlays/odroidn2/Makefile +++ b/arch/arm64/boot/dts/amlogic/overlays/odroidn2/Makefile @@ -13,6 +13,8 @@ dtbo-$(CONFIG_ARCH_MESON64_ODROIDN2) += spi0.dtbo \ irblaster.dtbo \ onewire.dtbo \ can0.dtbo \ + hifishield.dtbo \ + hifishield2.dtbo \ fanspeed-full.dtbo \ gpio_spdif.dtbo \ pwm_cd.dtbo \ diff --git a/arch/arm64/boot/dts/amlogic/overlays/odroidn2/hifishield.dts b/arch/arm64/boot/dts/amlogic/overlays/odroidn2/hifishield.dts new file mode 100644 index 000000000000..aac0e558e439 --- /dev/null +++ b/arch/arm64/boot/dts/amlogic/overlays/odroidn2/hifishield.dts @@ -0,0 +1,64 @@ +/* + * arch/arm64/boot/dts/amlogic/overlays/odroidn2/hifishield.dts + * + * Copyright (C) 2021 Hardkernel, Inc. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + */ + +/dts-v1/; +/plugin/; + +/ { + fragment@0 { + target = <&aml_tdmb>; + __overlay__ { + status = "okay"; + }; + }; + fragment@1 { + target = <&pcm5102a>; + __overlay__ { + status = "okay"; + }; + }; + + fragment@2 { + target = <&odroid_hifi>; + + __overlay__ { + compatible = "amlogic, g12a-sound-card"; + aml-audio-card,name = "ODROID-HIFI"; + status = "okay"; + + /* ODROID-C4: I2S out(J7)*/ + aml-audio-card,dai-link@0 { + format = "i2s"; + mclk-fs = <256>; + continuous-clock; + bitclock-master = <&aml_tdmb>; + frame-master = <&aml_tdmb>; + cpu { + sound-dai = <&aml_tdmb>; + dai-tdm-slot-tx-mask = <1 1>; + dai-tdm-slot-rx-mask = <1 1>; + dai-tdm-slot-num = <2>; + dai-tdm-slot-width = <32>; + system-clock-frequency = <12288000>; + }; + codec { + sound-dai = <&pcm5102a>; + }; + }; + }; + }; +}; diff --git a/arch/arm64/boot/dts/amlogic/overlays/odroidn2/hifishield2.dts b/arch/arm64/boot/dts/amlogic/overlays/odroidn2/hifishield2.dts new file mode 100644 index 000000000000..475d2cd7183b --- /dev/null +++ b/arch/arm64/boot/dts/amlogic/overlays/odroidn2/hifishield2.dts @@ -0,0 +1,77 @@ +/* + * arch/arm64/boot/dts/amlogic/overlays/odroidn2/hifishield2.dts + * + * Copyright (C) 2021 Hardkernel, Inc. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + */ + +/dts-v1/; +/plugin/; + +/ { + fragment@0 { + target = <&aml_tdmb>; + __overlay__ { + status = "okay"; + }; + }; + + fragment@1 { + // i2c2 aliased with i2c0. + target = <&i2c2>; + + __overlay__ { + status = "okay"; + + #address-cells = <1>; + #size-cells = <0>; + + pcm5242: pcm5242@4c { + compatible = "ti,pcm5242"; + reg = <0x4c>; + #sound-dai-cells = <0>; + status = "okay"; + }; + }; + }; + + fragment@2 { + target = <&odroid_hifi2>; + + __overlay__ { + compatible = "amlogic, g12a-sound-card"; + aml-audio-card,name = "ODROID-HIFI2"; + status = "okay"; + + /* ODROID-C4: I2S out(J7)*/ + aml-audio-card,dai-link@0 { + format = "i2s"; + mclk-fs = <256>; + continuous-clock; + bitclock-master = <&aml_tdmb>; + frame-master = <&aml_tdmb>; + cpu { + sound-dai = <&aml_tdmb>; + dai-tdm-slot-tx-mask = <1 1>; + dai-tdm-slot-rx-mask = <1 1>; + dai-tdm-slot-num = <2>; + dai-tdm-slot-width = <32>; + system-clock-frequency = <12288000>; + }; + codec { + sound-dai = <&pcm5242>; + }; + }; + }; + }; +};