jsorocil

  • Posts

    8
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. I was using Linux 5.11 vanilla dts (from Torvalds' github) for NanoPi M4V2 and using that as base for my custom dts without overlays. Also u-boot was built (and patched) by me - learning new things and so on My idea was to share my experience in hope if someone decided to do something similar, but this is Armbian forum where people are using Armbian stuff without compiling their own so... Now I have reinstalled fresh Armbian for NanoPC T4 (u-boot, kernel and ramdisk are on SD card, rootfs is on NVMe but it shouldn't matter). Image I dd-ed to SD card (from 12.06.2021.): https://mirrors.netix.net/armbian/dl/nanopct4/archive/Armbian_21.05.1_Nanopct4_focal_current_5.10.35_xfce_desktop.img.xz NVMe doesn't work in u-boot (works in Linux) for my board but that's another topic I am using Armbian u-boot with /boot/dtb/rockchip/rk3399-nanopc-t4.dtb. After dts overlay I have sound on my SoM-RK3399v2 (which should be pretty similar to T4). # dmesg | grep rt5651 [ 5.727048] rt5651 1-001a: Failed to reguest IRQ 0: -22 # uname -a Linux miki 5.10.35-rockchip64 #21.05.1 SMP PREEMPT Fri May 7 13:53:11 UTC 2021 aarch64 aarch64 aarch64 GNU/Linux # grep -E "SND_SOC_ROCKCHIP_I2S|SND_SOC_RT5651" /boot/config-5* CONFIG_SND_SOC_ROCKCHIP_I2S=m CONFIG_SND_SOC_ROCKCHIP_I2S_TDM=m CONFIG_SND_SOC_RT5651=m # i2cdetect -y 1 0 1 2 3 4 5 6 7 8 9 a b c d e f 00: -- -- -- -- -- -- -- -- -- -- -- -- -- 10: -- -- -- -- -- -- -- -- -- -- UU -- -- -- -- -- 20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 70: -- -- -- -- -- -- -- -- # cat /etc/modules <empty> # lsmod | grep snd snd_soc_hdmi_codec 20480 1 snd_soc_simple_card 24576 3 snd_soc_simple_card_utils 28672 1 snd_soc_simple_card snd_soc_rt5651 98304 1 snd_soc_rl6231 20480 1 snd_soc_rt5651 snd_soc_rockchip_spdif 16384 0 snd_soc_rockchip_i2s 24576 4 snd_soc_core 237568 6 snd_soc_rt5651,snd_soc_hdmi_codec,snd_soc_rockchip_spdif,snd_soc_simple_card_utils,snd_soc_rockchip_i2s,snd_soc_simple_card snd_pcm_dmaengine 20480 1 snd_soc_core snd_pcm 118784 4 snd_soc_rt5651,snd_soc_hdmi_codec,snd_soc_core,snd_pcm_dmaengine snd_timer 40960 1 snd_pcm snd 90112 10 snd_soc_hdmi_codec,snd_timer,snd_soc_core,snd_pcm soundcore 16384 1 snd # aplay -l **** List of PLAYBACK Hardware Devices **** Invalid MIT-MAGIC-COOKIE-1 keyxcb_connection_has_error() returned true card 0: realtekrt5651co [realtek,rt5651-codec], device 0: ff890000.i2s-rt5651-aif1 rt5651-aif1-0 [ff890000.i2s-rt5651-aif1 rt5651-aif1-0] Subdevices: 1/1 Subdevice #0: subdevice #0 card 1: hdmisound [hdmi-sound], device 0: ff8a0000.i2s-i2s-hifi i2s-hifi-0 [ff8a0000.i2s-i2s-hifi i2s-hifi-0] Subdevices: 1/1 Subdevice #0: subdevice #0 # cat /etc/asound.conf <empty> # cat /proc/asound/pcm 00-00: ff890000.i2s-rt5651-aif1 rt5651-aif1-0 : ff890000.i2s-rt5651-aif1 rt5651-aif1-0 : playback 1 : capture 1 01-00: ff8a0000.i2s-i2s-hifi i2s-hifi-0 : ff8a0000.i2s-i2s-hifi i2s-hifi-0 : playback 1 # cat /sys/kernel/debug/clk/clk_i2sout_src/clk_parent clk_i2s1 # dpkg -l | grep -v ^rc | grep -E "linux-dtb-|linux-image-" ii linux-dtb-current-rockchip64 21.05.1 arm64 Linux DTB, version 5.10.35-rockchip64 ii linux-image-current-rockchip64 21.05.1 arm64 Linux kernel, version 5.10.35-rockchip64 # grep -iE "name|linux|version" /etc/armbian-release BOARD_NAME="NanoPC T4" DISTRIBUTION_CODENAME=focal VERSION=21.05.2 LINUXFAMILY=rockchip64 I still have these messages in syslog but sound works nonetheless: Jun 13 21:28:31 miki kernel: [ 28.822975] rockchip-i2s ff8a0000.i2s: Fail to set mclk -22 Jun 13 21:28:31 miki kernel: [ 28.823485] rockchip-i2s ff8a0000.i2s: ASoC: error at snd_soc_dai_set_sysclk on ff8a0000.i2s: -22 Jun 13 21:39:50 miki kernel: [ 708.376058] rockchip-i2s ff890000.i2s: Fail to set mclk -22 Jun 13 21:39:50 miki kernel: [ 708.376576] rockchip-i2s ff890000.i2s: ASoC: error at snd_soc_dai_set_sysclk on ff890000.i2s: -22 This is overlay which I have used: #include <dt-bindings/pinctrl/rockchip.h> #include <dt-bindings/gpio/gpio.h> #include <dt-bindings/clock/rk3399-cru.h> /dts-v1/; /plugin/; / { compatible = "rockchip,rk3399"; fragment@0 { target = <&rt5651>; __overlay__ { status = "okay"; }; }; fragment@1 { target = <&i2s1>; __overlay__ { assigned-clocks = <&cru SCLK_I2SOUT_SRC>; assigned-clock-parents = <&cru SCLK_I2S1_8CH>; pinctrl-0 = <&i2s_8ch_mclk>,<&i2s1_2ch_bus>; status = "okay"; }; }; fragment@2 { target = <&pinctrl>; __overlay__ { i2s1 { i2s_8ch_mclk: i2s-8ch-mclk { // GPIO4_A0 - RK3399 I2S_CLK rockchip,pins = <4 RK_PA0 1 &pcfg_pull_none>; }; }; headphone { hp_det: hp-det { // GPIO4_D4 - HP_DET_H pin on SoM-RK3399v2 rockchip,pins = <4 RK_PD4 RK_FUNC_GPIO &pcfg_pull_up>; }; }; }; }; };
  2. Success! % uname -a Linux miki 5.10.21-rockchip64 #21.02.3 SMP PREEMPT Mon Mar 8 01:05:08 UTC 2021 aarch64 aarch64 aarch64 GNU/Linux % dpkg -l | grep -v ^rc | grep -E "linux-dtb-current|linux-image-current" ii linux-dtb-current-rockchip64 21.02.3 arm64 Linux DTB, version 5.10.21-rockchip64 ii linux-image-current-rockchip64 21.02.3 arm64 Linux kernel, version 5.10.21-rockchip64 % aplay -l **** List of PLAYBACK Hardware Devices **** xcb_connection_has_error() returned true card 0: realtekrt5651co [realtek,rt5651-codec], device 0: ff890000.i2s-rt5651-aif1 rt5651-aif1-0 [ff890000.i2s-rt5651-aif1 rt5651-aif1-0] Subdevices: 0/1 Subdevice #0: subdevice #0 card 1: hdmisound [hdmi-sound], device 0: ff8a0000.i2s-i2s-hifi i2s-hifi-0 [ff8a0000.i2s-i2s-hifi i2s-hifi-0] Subdevices: 1/1 Subdevice #0: subdevice #0 % grep -iE "name|linux|version" /etc/armbian-release BOARD_NAME="NanoPi M4V2" DISTRIBUTION_CODENAME=focal VERSION=21.02.3 LINUXFAMILY=rockchip64 Patched .dts: --- a/dt-bindings/clock/rk3399-cru.h +++ b/dt-bindings/clock/rk3399-cru.h @@ -19,6 +19,7 @@ #define ARMCLKB 9 /* sclk gates (special clocks) */ +#define SCLK_I2SOUT_SRC 64 #define SCLK_I2C1 65 #define SCLK_I2C2 66 #define SCLK_I2C3 67 diff --git a/rk3399-som-rk3399v2.dts b/rk3399-som-rk3399v2.dts index 2626e27..6c708f8 100644 --- a/rk3399-som-rk3399v2.dts +++ b/rk3399-som-rk3399v2.dts @@ -75,6 +75,35 @@ }; }; }; + + rt5651_card: rt5651-sound { + status = "okay"; + compatible = "simple-audio-card"; + pinctrl-names = "default"; + pinctrl-0 = <&hp_det>; + + simple-audio-card,name = "realtek,rt5651-codec"; + simple-audio-card,format = "i2s"; + simple-audio-card,mclk-fs = <256>; + simple-audio-card,hp-det-gpio = <&gpio4 28 GPIO_ACTIVE_HIGH>; + + simple-audio-card,widgets = + "Microphone", "Mic Jack", + "Headphone", "Headphone Jack"; + simple-audio-card,routing = + "Mic Jack", "micbias1", + "IN2P", "Mic Jack", + "IN3P", "Mic Jack", + "Headphone Jack", "HPOL", + "Headphone Jack", "HPOR"; + + simple-audio-card,cpu { + sound-dai = <&i2s1>; + }; + simple-audio-card,codec { + sound-dai = <&rt5651>; + }; + }; }; // root/ node &vcc3v3_sys { @@ -114,3 +143,44 @@ }; }; }; + +&i2c1 { + status = "okay"; + i2c-scl-rising-time-ns = <300>; + i2c-scl-falling-time-ns = <15>; + clock-frequency = <200000>; + + rt5651: rt5651@1a { + #sound-dai-cells = <0>; + compatible = "realtek,rt5651"; + reg = <0x1a>; + clocks = <&cru SCLK_I2S_8CH_OUT>; + clock-names = "mclk"; + status = "okay"; + }; +}; + +&i2s1 { + assigned-clocks = <&cru SCLK_I2SOUT_SRC>; + assigned-clock-parents = <&cru SCLK_I2S1_8CH>; + pinctrl-names = "default"; + pinctrl-0 = <&i2s_8ch_mclk>,<&i2s1_2ch_bus>; + rockchip,playback-channels = <2>; + rockchip,capture-channels = <2>; + #sound-dai-cells = <0>; + status = "okay"; +}; + +&pinctrl { + i2s1 { + i2s_8ch_mclk: i2s-8ch-mclk { + rockchip,pins = <4 RK_PA0 1 &pcfg_pull_none>; + }; + }; + + headphone { + hp_det: hp-det { + rockchip,pins = <4 28 RK_FUNC_GPIO &pcfg_pull_up>; + }; + }; +}; Funny thing is that clk_parent will change after audio player is started: % cat /sys/kernel/debug/clk/clk_i2sout_src/clk_parent clk_i2s1 % mpv <audiofile> % cat /sys/kernel/debug/clk/clk_i2sout_src/clk_parent clk_i2s0 But in both cases sound works on my SoM-RK3399v2 SBC :)
  3. Managed to get sound working on 4.4 Armbian legacy kernel with stock rk3399-nanopi-m4v2.dtb from linux-dtb-legacy package. % uname -a Linux miki 4.4.213-rk3399 #1 SMP Tue Apr 6 02:35:05 CDT 2021 aarch64 aarch64 aarch64 GNU/Linux % dpkg -l | grep -v ^rc | grep -E "linux-dtb-legacy|linux-image-legacy" ii linux-dtb-legacy-rk3399 21.05.0-trunk arm64 Linux DTB, version 4.4.213-rk3399 ii linux-image-legacy-rk3399 21.05.0-trunk arm64 Linux kernel, version 4.4.213-rk3399 % aplay -l **** List of PLAYBACK Hardware Devices **** xcb_connection_has_error() returned true card 0: Dummy [Dummy], device 0: Dummy PCM [Dummy PCM] Subdevices: 8/8 Subdevice #0: subdevice #0 Subdevice #1: subdevice #1 Subdevice #2: subdevice #2 Subdevice #3: subdevice #3 Subdevice #4: subdevice #4 Subdevice #5: subdevice #5 Subdevice #6: subdevice #6 Subdevice #7: subdevice #7 card 1: Loopback [Loopback], device 0: Loopback PCM [Loopback PCM] Subdevices: 8/8 Subdevice #0: subdevice #0 Subdevice #1: subdevice #1 Subdevice #2: subdevice #2 Subdevice #3: subdevice #3 Subdevice #4: subdevice #4 Subdevice #5: subdevice #5 Subdevice #6: subdevice #6 Subdevice #7: subdevice #7 card 1: Loopback [Loopback], device 1: Loopback PCM [Loopback PCM] Subdevices: 8/8 Subdevice #0: subdevice #0 Subdevice #1: subdevice #1 Subdevice #2: subdevice #2 Subdevice #3: subdevice #3 Subdevice #4: subdevice #4 Subdevice #5: subdevice #5 Subdevice #6: subdevice #6 Subdevice #7: subdevice #7 card 2: realtekrt5651co [realtek,rt5651-codec], device 0: ff890000.i2s-rt5651-aif1 rt5651-aif1-0 [ff890000.i2s-rt5651-aif1 rt5651-aif1-0] Subdevices: 1/1 Subdevice #0: subdevice #0 card 3: rockchiphdmi [rockchip,hdmi], device 0: ff8a0000.i2s-i2s-hifi i2s-hifi-0 [ff8a0000.i2s-i2s-hifi i2s-hifi-0] Subdevices: 1/1 Subdevice #0: subdevice #0 % cat /etc/asound.conf pcm.!default { type hw card 2 device 0 } ctl.!default { type hw card 2 } % cat /sys/kernel/debug/clk/clk_i2sout_src/clk_parent clk_i2s1
  4. Armbianmonitor uploaded Booted into FriendlyElec distribution and gather some logs: Linux SOM-RK3399v2 4.4.179 #2 SMP Tue Sep 15 15:59:49 CST 2020 aarch64 aarch64 aarch64 GNU/Linux root@SOM-RK3399v2:~# aplay -l **** List of PLAYBACK Hardware Devices **** card 0: realtekrt5651co [realtek,rt5651-codec], device 0: ff890000.i2s-rt5651-aif1 rt5651-aif1-0 [] Subdevices: 1/1 Subdevice #0: subdevice #0 card 1: rockchiphdmi [rockchip,hdmi], device 0: ff8a0000.i2s-i2s-hifi i2s-hifi-0 [] Subdevices: 1/1 Subdevice #0: subdevice #0 root@SOM-RK3399v2:~# dmesg | grep -i i2s [ 1.858450] asoc-simple-card rt5651-sound: rt5651-aif1 <-> ff890000.i2s mapping ok [ 1.875441] asoc-simple-card hdmi-sound: i2s-hifi <-> ff8a0000.i2s mapping ok root@SOM-RK3399v2:~# dmesg | grep rt5651 [ 1.838498] of_get_named_gpiod_flags: parsed 'simple-audio-card,hp-det-gpio' property of node '/rt5651-sound[0]' - status (0) [ 1.838522] of_get_named_gpiod_flags: can't parse 'simple-audio-card,mic-det-gpio' property of node '/rt5651-sound[0]' [ 1.856077] asoc-simple-card rt5651-sound: ASoC: DAPM unknown pin Headphones [ 1.858450] asoc-simple-card rt5651-sound: rt5651-aif1 <-> ff890000.i2s mapping ok [ 1.859230] asoc-simple-card rt5651-sound: ASoC: no source widget found for MICBIAS1 [ 1.859959] asoc-simple-card rt5651-sound: ASoC: Failed to add route MICBIAS1 -> direct -> Mic Jack [ 1.861239] rt5651 1-001a: ASoC: mux INL1 Mux has no paths [ 1.861783] rt5651 1-001a: ASoC: mux INR1 Mux has no paths [ 1.862294] rt5651 1-001a: ASoC: mux INL2 Mux has no paths [ 1.862830] rt5651 1-001a: ASoC: mux INR2 Mux has no paths [ 1.870625] input: realtek,rt5651-codec Headphones as /devices/platform/rt5651-sound/sound/card0/input3 [ 2.006432] asoc-simple-card rt5651-sound: ASoC: DAPM unknown pin Headphones [ 2.023786] #0: realtek,rt5651-codec root@SOM-RK3399v2:~# cat /etc/modules <nothing specified> root@SOM-RK3399v2:~# lsmod | grep snd <nothing> root@SOM-RK3399v2:~# cat /etc/asound.conf cat: /etc/asound.conf: No such file or directory root@SOM-RK3399v2:~# amixer Simple mixer control 'Mono ADC',0 Capabilities: cvolume Capture channels: Front Left - Front Right Limits: Capture 0 - 127 Front Left: Capture 47 [37%] [0.00dB] Front Right: Capture 47 [37%] [0.00dB] Simple mixer control 'Mono DAC',0 Capabilities: pvolume Playback channels: Front Left - Front Right Limits: Playback 0 - 175 Mono: Front Left: Playback 170 [97%] [-18.75dB] Front Right: Playback 170 [97%] [-18.75dB] Simple mixer control 'ADC',0 Capabilities: cvolume cswitch Capture channels: Front Left - Front Right Limits: Capture 0 - 127 Front Left: Capture 47 [37%] [0.00dB] [on] Front Right: Capture 47 [37%] [0.00dB] [on] Simple mixer control 'ADC Boost Gain',0 Capabilities: volume Playback channels: Front Left - Front Right Capture channels: Front Left - Front Right Limits: 0 - 3 Front Left: 0 [0%] Front Right: 0 [0%] Simple mixer control 'ADC IF2 Data',0 Capabilities: enum Items: 'Normal' 'Swap' 'left copy to right' 'right copy to left' Item0: 'Normal' Simple mixer control 'DAC IF2 Data',0 Capabilities: enum Items: 'Normal' 'Swap' 'left copy to right' 'right copy to left' Item0: 'Normal' Simple mixer control 'DAC L2 Mux',0 Capabilities: enum Items: 'IF1' 'IF2' Item0: 'IF2' Simple mixer control 'DAC MIXL INF1',0 Capabilities: pswitch pswitch-joined Playback channels: Mono Mono: Playback [on] Simple mixer control 'DAC MIXL Stereo ADC',0 Capabilities: pswitch pswitch-joined Playback channels: Mono Mono: Playback [off] Simple mixer control 'DAC MIXR INF1',0 Capabilities: pswitch pswitch-joined Playback channels: Mono Mono: Playback [on] Simple mixer control 'DAC MIXR Stereo ADC',0 Capabilities: pswitch pswitch-joined Playback channels: Mono Mono: Playback [off] Simple mixer control 'DAC R2 Mux',0 Capabilities: enum Items: 'IF1' 'IF2' Item0: 'IF2' Simple mixer control 'DAC1',0 Capabilities: pvolume Playback channels: Front Left - Front Right Limits: Playback 0 - 175 Mono: Front Left: Playback 169 [97%] [-22.50dB] Front Right: Playback 169 [97%] [-22.50dB] Simple mixer control 'DAC2',0 Capabilities: pswitch Playback channels: Front Left - Front Right Mono: Front Left: Playback [on] Front Right: Playback [on] Simple mixer control 'DD MIXL DAC L1',0 Capabilities: pswitch pswitch-joined Playback channels: Mono Mono: Playback [off] Simple mixer control 'DD MIXL DAC L2',0 Capabilities: pswitch pswitch-joined Playback channels: Mono Mono: Playback [off] Simple mixer control 'DD MIXL DAC R2',0 Capabilities: pswitch pswitch-joined Playback channels: Mono Mono: Playback [off] Simple mixer control 'DD MIXR DAC L2',0 Capabilities: pswitch pswitch-joined Playback channels: Mono Mono: Playback [off] Simple mixer control 'DD MIXR DAC R1',0 Capabilities: pswitch pswitch-joined Playback channels: Mono Mono: Playback [off] Simple mixer control 'DD MIXR DAC R2',0 Capabilities: pswitch pswitch-joined Playback channels: Mono Mono: Playback [off] Simple mixer control 'DMIC ASRC',0 Capabilities: pswitch pswitch-joined Playback channels: Mono Mono: Playback [off] Simple mixer control 'HP',0 Capabilities: pvolume Playback channels: Front Left - Front Right Limits: Playback 0 - 39 Mono: Front Left: Playback 16 [41%] [-22.50dB] Front Right: Playback 16 [41%] [-22.50dB] Simple mixer control 'HPO L',0 Capabilities: pswitch pswitch-joined Playback channels: Mono Mono: Playback [on] Simple mixer control 'HPO MIX DAC1',0 Capabilities: pswitch pswitch-joined Playback channels: Mono Mono: Playback [off] Simple mixer control 'HPO MIX HPVOL',0 Capabilities: pswitch pswitch-joined Playback channels: Mono Mono: Playback [on] Simple mixer control 'HPO R',0 Capabilities: pswitch pswitch-joined Playback channels: Mono Mono: Playback [on] Simple mixer control 'HPOVOL L',0 Capabilities: pswitch pswitch-joined Playback channels: Mono Mono: Playback [on] Simple mixer control 'HPOVOL R',0 Capabilities: pswitch pswitch-joined Playback channels: Mono Mono: Playback [on] Simple mixer control 'IF1 ASRC',0 Capabilities: pswitch pswitch-joined Playback channels: Mono Mono: Playback [off] Simple mixer control 'IF2 ADC',0 Capabilities: enum Items: 'IF1 ADC1' 'IF1 ADC2' Item0: 'IF1 ADC1' Simple mixer control 'IF2 ASRC',0 Capabilities: pswitch pswitch-joined Playback channels: Mono Mono: Playback [off] Simple mixer control 'IN',0 Capabilities: cvolume Capture channels: Front Left - Front Right Limits: Capture 0 - 31 Front Left: Capture 23 [74%] [0.00dB] Front Right: Capture 23 [74%] [0.00dB] Simple mixer control 'IN1 Boost',0 Capabilities: volume volume-joined Playback channels: Mono Capture channels: Mono Limits: 0 - 8 Mono: 0 [0%] Simple mixer control 'IN2 Boost',0 Capabilities: volume volume-joined Playback channels: Mono Capture channels: Mono Limits: 0 - 8 Mono: 2 [25%] Simple mixer control 'LOUT L',0 Capabilities: pswitch pswitch-joined Playback channels: Mono Mono: Playback [off] Simple mixer control 'LOUT MIX DAC L1',0 Capabilities: pswitch pswitch-joined Playback channels: Mono Mono: Playback [off] Simple mixer control 'LOUT MIX DAC R1',0 Capabilities: pswitch pswitch-joined Playback channels: Mono Mono: Playback [off] Simple mixer control 'LOUT MIX OUTVOL L',0 Capabilities: pswitch pswitch-joined Playback channels: Mono Mono: Playback [off] Simple mixer control 'LOUT MIX OUTVOL R',0 Capabilities: pswitch pswitch-joined Playback channels: Mono Mono: Playback [off] Simple mixer control 'LOUT R',0 Capabilities: pswitch pswitch-joined Playback channels: Mono Mono: Playback [off] Simple mixer control 'OUT',0 Capabilities: pvolume Playback channels: Front Left - Front Right Limits: Playback 0 - 39 Mono: Front Left: Playback 31 [79%] [0.00dB] Front Right: Playback 31 [79%] [0.00dB] Simple mixer control 'OUT MIXL BST1',0 Capabilities: pswitch pswitch-joined Playback channels: Mono Mono: Playback [off] Simple mixer control 'OUT MIXL BST2',0 Capabilities: pswitch pswitch-joined Playback channels: Mono Mono: Playback [off] Simple mixer control 'OUT MIXL DAC L1',0 Capabilities: pswitch pswitch-joined Playback channels: Mono Mono: Playback [on] Simple mixer control 'OUT MIXL INL1',0 Capabilities: pswitch pswitch-joined Playback channels: Mono Mono: Playback [off] Simple mixer control 'OUT MIXL REC MIXL',0 Capabilities: pswitch pswitch-joined Playback channels: Mono Mono: Playback [off] Simple mixer control 'OUT MIXR BST1',0 Capabilities: pswitch pswitch-joined Playback channels: Mono Mono: Playback [off] Simple mixer control 'OUT MIXR BST2',0 Capabilities: pswitch pswitch-joined Playback channels: Mono Mono: Playback [off] Simple mixer control 'OUT MIXR DAC R1',0 Capabilities: pswitch pswitch-joined Playback channels: Mono Mono: Playback [on] Simple mixer control 'OUT MIXR INR1',0 Capabilities: pswitch pswitch-joined Playback channels: Mono Mono: Playback [off] Simple mixer control 'OUT MIXR REC MIXR',0 Capabilities: pswitch pswitch-joined Playback channels: Mono Mono: Playback [off] Simple mixer control 'OUTVOL L',0 Capabilities: pswitch pswitch-joined Playback channels: Mono Mono: Playback [off] Simple mixer control 'OUTVOL R',0 Capabilities: pswitch pswitch-joined Playback channels: Mono Mono: Playback [off] Simple mixer control 'PDM L Mux',0 Capabilities: enum Items: 'DD MIX' 'Stereo DAC MIX' Item0: 'DD MIX' Simple mixer control 'PDM R Mux',0 Capabilities: enum Items: 'DD MIX' 'Stereo DAC MIX' Item0: 'DD MIX' Simple mixer control 'RECMIXL BST1',0 Capabilities: pswitch pswitch-joined Playback channels: Mono Mono: Playback [off] Simple mixer control 'RECMIXL BST2',0 Capabilities: pswitch pswitch-joined Playback channels: Mono Mono: Playback [on] Simple mixer control 'RECMIXL BST3',0 Capabilities: pswitch pswitch-joined Playback channels: Mono Mono: Playback [off] Simple mixer control 'RECMIXL INL1',0 Capabilities: pswitch pswitch-joined Playback channels: Mono Mono: Playback [off] Simple mixer control 'RECMIXR BST1',0 Capabilities: pswitch pswitch-joined Playback channels: Mono Mono: Playback [off] Simple mixer control 'RECMIXR BST2',0 Capabilities: pswitch pswitch-joined Playback channels: Mono Mono: Playback [on] Simple mixer control 'RECMIXR BST3',0 Capabilities: pswitch pswitch-joined Playback channels: Mono Mono: Playback [off] Simple mixer control 'RECMIXR INR1',0 Capabilities: pswitch pswitch-joined Playback channels: Mono Mono: Playback [off] Simple mixer control 'RT5651 ASRC',0 Capabilities: enum Items: 'Disable' 'Enable' Item0: 'Disable' Simple mixer control 'Stereo DAC MIXL DAC L1',0 Capabilities: pswitch pswitch-joined Playback channels: Mono Mono: Playback [on] Simple mixer control 'Stereo DAC MIXL DAC L2',0 Capabilities: pswitch pswitch-joined Playback channels: Mono Mono: Playback [off] Simple mixer control 'Stereo DAC MIXL DAC R1',0 Capabilities: pswitch pswitch-joined Playback channels: Mono Mono: Playback [off] Simple mixer control 'Stereo DAC MIXR DAC L1',0 Capabilities: pswitch pswitch-joined Playback channels: Mono Mono: Playback [off] Simple mixer control 'Stereo DAC MIXR DAC R1',0 Capabilities: pswitch pswitch-joined Playback channels: Mono Mono: Playback [on] Simple mixer control 'Stereo DAC MIXR DAC R2',0 Capabilities: pswitch pswitch-joined Playback channels: Mono Mono: Playback [off] Simple mixer control 'Stereo1 ADC L1 Mux',0 Capabilities: enum Items: 'DD MIX' 'ADC' Item0: 'ADC' Simple mixer control 'Stereo1 ADC L2 Mux',0 Capabilities: enum Items: 'DMIC' 'DD MIX' Item0: 'DD MIX' Simple mixer control 'Stereo1 ADC MIXL ADC1',0 Capabilities: pswitch pswitch-joined Playback channels: Mono Mono: Playback [on] Simple mixer control 'Stereo1 ADC MIXL ADC2',0 Capabilities: pswitch pswitch-joined Playback channels: Mono Mono: Playback [off] Simple mixer control 'Stereo1 ADC MIXR ADC1',0 Capabilities: pswitch pswitch-joined Playback channels: Mono Mono: Playback [on] Simple mixer control 'Stereo1 ADC MIXR ADC2',0 Capabilities: pswitch pswitch-joined Playback channels: Mono Mono: Playback [off] Simple mixer control 'Stereo1 ADC R1 Mux',0 Capabilities: enum Items: 'DD MIX' 'ADC' Item0: 'ADC' Simple mixer control 'Stereo1 ADC R2 Mux',0 Capabilities: enum Items: 'DMIC' 'DD MIX' Item0: 'DD MIX' Simple mixer control 'Stereo2 ADC L1 Mux',0 Capabilities: enum Items: 'DD MIXL' 'ADCL' Item0: 'ADCL' Simple mixer control 'Stereo2 ADC L2 Mux',0 Capabilities: enum Items: 'DMIC L' 'DD MIXL' Item0: 'DD MIXL' Simple mixer control 'Stereo2 ADC MIXL ADC1',0 Capabilities: pswitch pswitch-joined Playback channels: Mono Mono: Playback [off] Simple mixer control 'Stereo2 ADC MIXL ADC2',0 Capabilities: pswitch pswitch-joined Playback channels: Mono Mono: Playback [off] Simple mixer control 'Stereo2 ADC MIXR ADC1',0 Capabilities: pswitch pswitch-joined Playback channels: Mono Mono: Playback [off] Simple mixer control 'Stereo2 ADC MIXR ADC2',0 Capabilities: pswitch pswitch-joined Playback channels: Mono Mono: Playback [off] Simple mixer control 'Stereo2 ADC R1 Mux',0 Capabilities: enum Items: 'DD MIXR' 'ADCR' Item0: 'DD MIXR' Simple mixer control 'Stereo2 ADC R2 Mux',0 Capabilities: enum Items: 'DMIC R' 'DD MIXR' Item0: 'DMIC R' root@SOM-RK3399v2:~# cat /sys/kernel/debug/clk/clk_i2sout_src/clk_parent clk_i2s1 I2S clock is indeed I2S1 (mine under Armbian is I2S0). Tried various alsamixer commands (from your link and from others on the forum) without success.
  5. I was in similar situation but on other board similar to T4. After some experiments this is what is needed in devicetree to enable eDP: + backlight: backlight { + compatible = "pwm-backlight"; + brightness-levels = < + 0 1 2 3 4 5 6 7 + 8 9 10 11 12 13 14 15 + 16 17 18 19 20 21 22 23 + 24 25 26 27 28 29 30 31 + 32 33 34 35 36 37 38 39 + 40 41 42 43 44 45 46 47 + 48 49 50 51 52 53 54 55 + 56 57 58 59 60 61 62 63 + 64 65 66 67 68 69 70 71 + 72 73 74 75 76 77 78 79 + 80 81 82 83 84 85 86 87 + 88 89 90 91 92 93 94 95 + 96 97 98 99 100 101 102 103 + 104 105 106 107 108 109 110 111 + 112 113 114 115 116 117 118 119 + 120 121 122 123 124 125 126 127 + 128 129 130 131 132 133 134 135 + 136 137 138 139 140 141 142 143 + 144 145 146 147 148 149 150 151 + 152 153 154 155 156 157 158 159 + 160 161 162 163 164 165 166 167 + 168 169 170 171 172 173 174 175 + 176 177 178 179 180 181 182 183 + 184 185 186 187 188 189 190 191 + 192 193 194 195 196 197 198 199 + 200 201 202 203 204 205 206 207 + 208 209 210 211 212 213 214 215 + 216 217 218 219 220 221 222 223 + 224 225 226 227 228 229 230 231 + 232 233 234 235 236 237 238 239 + 240 241 242 243 244 245 246 247 + 248 249 250 251 252 253 254 255>; + default-brightness-level = <200>; + pwms = <&pwm0 0 25000 0>; + power-supply = <&vcc3v3_sys>; + }; + + edp_panel: edp-panel { + compatible = "lg,lp079qx1-sp0v"; + backlight = <&backlight>; + enable-gpios = <&gpio4 RK_PD5 GPIO_ACTIVE_HIGH>; // SOM BL_EN GPIO4_D5 + power-supply = <&vcc3v3_s0>; + + port { + panel_in_edp: endpoint { + remote-endpoint = <&edp_out_panel>; + }; + }; + }; +&edp { + status = "okay"; + force-hpd; + + ports { + edp_out: port@1 { + reg = <1>; + #address-cells = <1>; + #size-cells = <0>; + + edp_out_panel: endpoint@0 { + reg = <0>; + remote-endpoint = <&panel_in_edp>; + }; + }; + }; +}; + +&vopb { + status = "okay"; +}; + +&vopb_mmu { + status = "okay"; +}; You maybe need to change "enable-gpios = <&gpio4 RK_PD5 GPIO_ACTIVE_HIGH>;" to pin which is dedicated to backlight on you board. To Linux kernel boot argument add "video=eDP-1:1920x1080@60" and remove other "video=HDMI..." parts. I changed mine bootargs in GRUB but similar can be achieved in uboot. Didn't try X11 with it and I didn't manage to get early boot messages on eDP panel (yet). But after booting I get login prompt and I can login on it. Linux 5.10.12 (linux-image-current-rockchip64 on Armbian 21.02).
  6. I am trying to enable sound with RT5651 audio codec on SoM-RK3399v2. Hardware is integrated on the board (on i2c1 bus, address 0x1a), worked with official FriendlyElec Linux (4.4 kernel IIRC) and tests were run with powered speakers (which work when connected to PC). I used this patch to patch my current device tree: https://github.com/armbian/build/blob/master/patch/kernel/rockchip64-dev/board-nanopi-m4v2-dts-add-sound-card.patch I did not use Kconfig file from the patch as it seems that my kernel have has built that modules. page 19 of NanoPI M4V2 and page 7 of SoM-RK3399 schematic shows that same audio codec (rt5651 on the same busses (I2S1 and I2C1) is used on both boards): https://wiki.friendlyarm.com/wiki/images/c/cc/NanoPi-M4V2_1908_Schematic.pdf https://wiki.friendlyarm.com/wiki/images/d/de/SOM-RK3399_Dev_Kit_1904_Schematic.pdf After reboot I can see card but it didn't play any sound on the speakers (except random quite noises - which also occures in u-boot) # dmesg | grep rt5651 [ 3.535527] rt5651 1-001a: Failed to reguest IRQ 0: -22 # uname -a Linux miki 5.10.12-rockchip64 #21.02.1 SMP PREEMPT Wed Feb 3 20:55:02 CET 2021 aarch64 aarch64 aarch64 GNU/Linux # grep -E "SND_SOC_ROCKCHIP_I2S|SND_SOC_RT5651" /boot/config-5.10.12-rockchip64 CONFIG_SND_SOC_ROCKCHIP_I2S=m CONFIG_SND_SOC_ROCKCHIP_I2S_TDM=m CONFIG_SND_SOC_RT5651=m # i2cdetect -y 1 0 1 2 3 4 5 6 7 8 9 a b c d e f 00: -- -- -- -- -- -- -- -- -- -- -- -- -- 10: -- -- -- -- -- -- -- -- -- -- UU -- -- -- -- -- 20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 70: -- -- -- -- -- -- -- -- # cat /etc/modules snd_soc_simple_card snd_soc_rt5651 # lsmod | grep snd snd_soc_hdmi_codec 20480 1 snd_soc_rockchip_spdif 16384 0 snd_soc_rockchip_i2s 24576 4 snd_soc_rt5651 98304 1 snd_soc_rl6231 20480 1 snd_soc_rt5651 snd_soc_simple_card 24576 0 snd_soc_simple_card_utils 28672 1 snd_soc_simple_card snd_soc_core 237568 6 snd_soc_rt5651,snd_soc_hdmi_codec,snd_soc_rockchip_spdif,snd_soc_simple_card_utils,snd_soc_rockchip_i2s,snd_soc_simple_card snd_pcm_dmaengine 20480 1 snd_soc_core snd_pcm 118784 4 snd_soc_rt5651,snd_soc_hdmi_codec,snd_soc_core,snd_pcm_dmaengine snd_seq_midi 20480 0 snd_seq_midi_event 16384 1 snd_seq_midi snd_rawmidi 40960 1 snd_seq_midi snd_seq 81920 2 snd_seq_midi,snd_seq_midi_event snd_seq_device 20480 3 snd_seq,snd_seq_midi,snd_rawmidi snd_timer 40960 2 snd_seq,snd_pcm snd 90112 7 snd_seq,snd_seq_device,snd_soc_hdmi_codec,snd_timer,snd_soc_core,snd_pcm,snd_rawmidi soundcore 16384 1 snd # aplay -l **** List of PLAYBACK Hardware Devices **** xcb_connection_has_error() returned true card 0: realtekrt5651co [realtek,rt5651-codec], device 0: ff890000.i2s-rt5651-aif1 rt5651-aif1-0 [ff890000.i2s-rt5651-aif1 rt5651-aif1-0] Subdevices: 1/1 Subdevice #0: subdevice #0 card 1: hdmisound [hdmi-sound], device 0: ff8a0000.i2s-i2s-hifi i2s-hifi-0 [ff8a0000.i2s-i2s-hifi i2s-hifi-0] Subdevices: 1/1 Subdevice #0: subdevice #0 # cat /etc/asound.conf pcm.!default { type hw card 0 device 0 } ctl.!default { type hw card 0 } # cat /proc/asound/pcm 00-00: ff890000.i2s-rt5651-aif1 rt5651-aif1-0 : ff890000.i2s-rt5651-aif1 rt5651-aif1-0 : playback 1 : capture 1 01-00: ff8a0000.i2s-i2s-hifi i2s-hifi-0 : ff8a0000.i2s-i2s-hifi i2s-hifi-0 : playback 1 mpv reports no errors, but there is no sound. There is a slight pop when mpv starts playing and around 5 seconds after mpv stops playing. Same as with speakers-test # mpv sound.wav (+) Audio --aid=1 (pcm_s16le 2ch 44100Hz) xcb_connection_has_error() returned true xcb_connection_has_error() returned true AO: [alsa] 44100Hz stereo 2ch s16 A: 00:00:41 / 00:10:07 (6%) Exiting... (Quit) # speaker-test -c2 speaker-test 1.2.2 Playback device is default Stream parameters are 48000Hz, S16_LE, 2 channels Using 16 octaves of pink noise xcb_connection_has_error() returned true Rate set to 48000Hz (requested 48000Hz) Buffer size range from 128 to 131072 Period size range from 64 to 65536 Using max buffer size 131072 Periods = 4 was set period_size = 32768 was set buffer_size = 131072 0 - Front Left 1 - Front Right Time per period = 2.740121 0 - Front Left ^C 1 - Front Right Time per period = 1.390964 # dmesg | tail -2 [ 326.479986] rockchip-i2s ff890000.i2s: Fail to set mclk -22 [ 326.480598] rockchip-i2s ff890000.i2s: ASoC: error at snd_soc_dai_set_sysclk on ff890000.i2s: -22 Maybe I have invalid I2S clock? # cat /sys/kernel/debug/clk/clk_i2sout_src/clk_parent clk_i2s0 # echo clk_i2s1 >> /sys/kernel/debug/clk/clk_i2sout_src/clk_parent echo: write error: invalid argument zsh: exit 1 Tried various amixer set commands and alsactl files from other threads but still no sound. Any ideas what might be the problem?
  7. Finally found the problem - HW "issue". My SPI flash is not soldered (no place on motherboard) - it is connected with wires which are (presumably) too long. Workaround is to reduce SPI speed in u-boot and Linux. U-boot: diff --git a/arch/arm/dts/rk3399-rockpro64.dtsi b/arch/arm/dts/rk3399-rockpro64.dtsi index 9bca258012..797dd80d38 100644 --- a/arch/arm/dts/rk3399-rockpro64.dtsi +++ b/arch/arm/dts/rk3399-rockpro64.dtsi @@ -677,7 +677,7 @@ flash@0 { compatible = "jedec,spi-nor"; reg = <0>; - spi-max-frequency = <10000000>; + spi-max-frequency = <1000000>; }; }; Linux: Recompile your device tree with reduced SPI speed: flash@0 { compatible = "jedec,spi-nor"; reg = <0>; - spi-max-frequency = <10000000>; + spi-max-frequency = <1000000>; };
  8. According to this, to run u-boot from flash I just need latest u-boot, apply patch from the link (CONFIG_SF_DEFAULT_BUS=1), copy config to .config, build it, flash it to SPI and it should work? I did that and for my SOM-RK3399v2 (I have added SPI flash 16 MB chip to it), it starts to boot and it got stuck on line: Trying to boot from SPI I am trying for weeks, tried various .configs/OFFSets/various config options/printf debugging/... , various binary files (for RockPro64, PineBook Pro, Roc-PC, etc) and same error. U-boot flashed to SD/eMMC works. SPI flash works in Linux: