Jump to content

Orange Pi 4 Kernel 5.x.x rt5651 sound and bluetooth fixed


iamdrq

Recommended Posts

 

:DOh,I fixed this problem spend 2 weeks,I finally heard sound from 3.5 mm jack (this jack is OMTP otherwise need keep press headphone button)

 

I see this topic,and I compair https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/sound/soc/codecs/rt5640.c and https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/sound/soc/codecs/rt5651.c,this rt5651 not enable mclk and orangepi4"s rt5651 linked i2s1,the i2s1's SCLK_I2S_8CH parent not SCLK_I2S1_8CH defult and need set alsamixer in following(also use alsactl save this alsamixer state):

amixer set 'HPO L' on
amixer set 'HPO R' on
amixer set 'HPOVOL L' on
amixer set 'HPOVOL R' on
amixer set 'HPO MIX HPVOL' on
amixer set 'OUT MIXL DAC L1' on
amixer set 'OUT MIXR DAC R1' on
amixer set 'Stereo DAC MIXL DAC L1' on
amixer set 'Stereo DAC MIXR DAC R1' on

And I not familiar with electronics,I did some patch and hope this can help armbian fix 

fix-i2s1-clk.patch orangepi4-rt5651.patch orangepi4-i2s_8ch_mclk.dts

Armbian applied this patch to 'Armbian build system' and with minor tweaks,you can use it by 'Armbian build system' latest branch.:D

Link to comment
Share on other sites

  • Igor pinned this topic

Yes,the orange pi 4's bluetooth also fixed.

the main line kernel support bcm bt chip,so I use the kernel driver  and not use brcm_patchram_plus file do this.

the 'wireless-wlan' and 'wireless-bluetooth' in dts,it is from rockchip's net/rfkill/rfkill-bt.c and net/rfkill/rfkill-wlan.c and this not found in main line kernel,so  'wireless-wlan' and 'wireless-bluetooth' should remove or disable,and wifi be driver by sdio node in dts.

the bluetooth will  be driver by uart->bluetooth->compatible = "brcm,bcm4345c5"(serial@ff180000->bluetooth->compatible = "brcm,bcm4345c5")

and the kernel config should enable CONFIG_SERIAL_DEV_BUS=y CONFIG_SERIAL_DEV_CTRL_TTYPORT=y CONFIG_BT_HCIUART_BCM=y CONFIG_BT_RFCOMM=m CONFIG_BT_RFCOMM_TTY=y

 

but have a little problem,need  do 'btmgmt --index 0 public-addr 11:22:33:44:55:66' set bt mac after boot,otherwise hciconfig will show 'DOWN RAW',someone konw fix this?

 

I did some dts over and hope this can help armbian fix 

bluetooth-opi4.dts linux-rockchip64-current.config

Link to comment
Share on other sites

  • iamdrq changed the title to Orange Pi 4 Kernel 5.x.x rt5651 sound and bluetooth fixed

About the Orangepi 4 's bluetooth chip AP6256,I read hci how get bluetooth mac address from 'https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/bluetooth/btbcm.c',the origin firmware file /lib/firmware/brcm/BCM4345C5.hcd include default mac address '43:45:C5:00:1F:AC',it is cause driver mark it 'HCI_QUIRK_INVALID_BDADDR',so I use hex editer change the  default mac to '43:45:C5:00:1F:CA',you can use this firmware file replace /lib/firmware/brcm/BCM4345C5.hcd and not need do 'btmgmt --index 0 public-addr 11:22:33:44:55:66' set bluetooth mac after boot.

BCM4345C5.hcd

Link to comment
Share on other sites

Hmm, maybe do i something wrong. But copied the files to the corresponding folders and installed the 2 .deb files. But when i start bluetoothctl it hangs... When i remove and reinstall bluetooth support via armbian-config i can start bluetoothctl but says there are no controllers found. After reboot bluetoothctl hangs.

Link to comment
Share on other sites

bluetoothctl didn´t find any controllers. Bluetooth service gives this error but start:

 

● bluetooth.service - Bluetooth service
   Loaded: loaded (/lib/systemd/system/bluetooth.service; enabled; vendor preset: enabled)
   Active: active (running) since Mon 2020-04-13 17:33:55 CEST; 3min 45s ago
     Docs: man:bluetoothd(8)
 Main PID: 4218 (bluetoothd)
   Status: "Running"
    Tasks: 1 (limit: 4533)
   Memory: 1.0M
   CGroup: /system.slice/bluetooth.service
           └─4218 /usr/lib/bluetooth/bluetoothd

apr 13 17:33:55 4-OrangePi systemd[1]: Starting Bluetooth service...
apr 13 17:33:55 4-OrangePi bluetoothd[4218]: Bluetooth daemon 5.50
apr 13 17:33:55 4-OrangePi systemd[1]: Started Bluetooth service.
apr 13 17:33:55 4-OrangePi bluetoothd[4218]: Starting SDP server
apr 13 17:33:55 4-OrangePi bluetoothd[4218]: kernel lacks bnep-protocol support
apr 13 17:33:55 4-OrangePi bluetoothd[4218]: System does not support network plugin
apr 13 17:33:55 4-OrangePi bluetoothd[4218]: Bluetooth management interface 1.15 initialized

 

Link to comment
Share on other sites

12 hours ago, haajee said:

Hmm, maybe do i something wrong. But copied the files to the corresponding folders and installed the 2 .deb files. But when i start bluetoothctl it hangs... When i remove and reinstall bluetooth support via armbian-config i can start bluetoothctl but says there are no controllers found. After reboot bluetoothctl hangs.

Oh,my error,I add bluetooth by dts,bluetooth will auto finish on boot,so don't need install bluetooth by armbian-config(because armbian-config use brcm_patchram_plus,it conflicts with the dts way).

so you need use armbian-config remove bluetooth,then 'apt install bluz',and reboot

And can you show me 'sudo dmesg | grep Blue',I want to make sure that you have placed the file correctly

Link to comment
Share on other sites

Hmm, sadly does not work...

 

The result of your command:

 

$ sudo dmesg | grep Blue
[   25.829280] Bluetooth: Core ver 2.22
[   25.829368] Bluetooth: HCI device and connection manager initialized
[   25.829384] Bluetooth: HCI socket layer initialized
[   25.829392] Bluetooth: L2CAP socket layer initialized
[   25.829419] Bluetooth: SCO socket layer initialized

 

Link to comment
Share on other sites

4 hours ago, haajee said:

Hmm, sadly does not work...

 

The result of your command:

 


$ sudo dmesg | grep Blue
[   25.829280] Bluetooth: Core ver 2.22
[   25.829368] Bluetooth: HCI device and connection manager initialized
[   25.829384] Bluetooth: HCI socket layer initialized
[   25.829392] Bluetooth: L2CAP socket layer initialized
[   25.829419] Bluetooth: SCO socket layer initialized

 

Look like you install image and dtb correctly,but you edit armbianEnv.txt not correctly or put overlay-user files not correctly.(Oh,I see my previous post,I spell error,should 'sudo apt install bluez')

Yes,this is not easy for simple user.I edit dts include bluetooth and not need add 'overlay-user',so:

  1. restore your armbianEnv.txt
  2. install following dtb files
  3. reboot

And should see:

root@orangepi4:~# dmesg |grep Blue
[    3.982085] Bluetooth: Core ver 2.22
[    3.982126] Bluetooth: HCI device and connection manager initialized
[    3.982135] Bluetooth: HCI socket layer initialized
[    3.982140] Bluetooth: L2CAP socket layer initialized
[    3.982150] Bluetooth: SCO socket layer initialized
[    3.988355] Bluetooth: HCI UART driver ver 2.3
[    3.988359] Bluetooth: HCI UART protocol H4 registered
[    3.990827] Bluetooth: HCI UART protocol Broadcom registered
[    4.341819] Bluetooth: hci0: BCM: chip id 130
[    4.342164] Bluetooth: hci0: BCM: features 0x0f
[    4.344286] Bluetooth: hci0: BCM4345C5
[    4.344299] Bluetooth: hci0: BCM4345C5 (003.006.006) build 0000
[    5.045748] Bluetooth: hci0: BCM4345C5 (003.006.006) build 0038
root@orangepi4:~# hciconfig 
hci0:	Type: Primary  Bus: UART
	BD Address: 43:45:C5:00:1F:CA  ACL MTU: 1021:8  SCO MTU: 64:1
	UP RUNNING PSCAN 
	RX bytes:397051100 acl:654339 sco:0 events:741 errors:0
	TX bytes:42146 acl:432 sco:0 commands:258 errors:0

 

OrangePi4-Image-dtb-v2.zip

Link to comment
Share on other sites

ok, I've tried everything I could think of. even started with a fresh image. did all the updates, installed the images, etc. I get as far as getting the bt recognised but not activated:

 

@orangepi4:~$ hciconfig
hci0:    Type: Primary  Bus: UART
    BD Address: 43:45:C5:00:1F:AC  ACL MTU: 0:0  SCO MTU: 0:0
    DOWN RAW 
    RX bytes:1306 acl:0 sco:0 events:144 errors:0
    TX bytes:30126 acl:0 sco:0 commands:144 errors:0
 

and this:

@orangepi4:~$ sudo dmesg | grep Blue
[    6.764297] Bluetooth: Core ver 2.22
[    6.764342] Bluetooth: HCI device and connection manager initialized
[    6.764351] Bluetooth: HCI socket layer initialized
[    6.764357] Bluetooth: L2CAP socket layer initialized
[    6.764366] Bluetooth: SCO socket layer initialized
[    6.841227] Bluetooth: HCI UART driver ver 2.3
[    6.841234] Bluetooth: HCI UART protocol H4 registered
[    6.841559] Bluetooth: HCI UART protocol Broadcom registered
[    7.193915] Bluetooth: hci0: BCM: chip id 130
[    7.194377] Bluetooth: hci0: BCM: features 0x0f
[    7.196658] Bluetooth: hci0: BCM4345C5
[    7.196673] Bluetooth: hci0: BCM4345C5 (003.006.006) build 0000
[    7.889681] Bluetooth: hci0: BCM4345C5 (003.006.006) build 0038
[    7.890576] Bluetooth: hci0: BCM: Using default device address (43:45:c5:00:1f:ac)
 

Any suggestions?

 

Cheers

Link to comment
Share on other sites

On 4/19/2020 at 10:27 AM, OzMeister said:

ok, I've tried everything I could think of. even started with a fresh image. did all the updates, installed the images, etc. I get as far as getting the bt recognised but not activated:

 

@orangepi4:~$ hciconfig
hci0:    Type: Primary  Bus: UART
    BD Address: 43:45:C5:00:1F:AC  ACL MTU: 0:0  SCO MTU: 0:0
    DOWN RAW 
    RX bytes:1306 acl:0 sco:0 events:144 errors:0
    TX bytes:30126 acl:0 sco:0 commands:144 errors:0
 

and this:

@orangepi4:~$ sudo dmesg | grep Blue
[    6.764297] Bluetooth: Core ver 2.22
[    6.764342] Bluetooth: HCI device and connection manager initialized
[    6.764351] Bluetooth: HCI socket layer initialized
[    6.764357] Bluetooth: L2CAP socket layer initialized
[    6.764366] Bluetooth: SCO socket layer initialized
[    6.841227] Bluetooth: HCI UART driver ver 2.3
[    6.841234] Bluetooth: HCI UART protocol H4 registered
[    6.841559] Bluetooth: HCI UART protocol Broadcom registered
[    7.193915] Bluetooth: hci0: BCM: chip id 130
[    7.194377] Bluetooth: hci0: BCM: features 0x0f
[    7.196658] Bluetooth: hci0: BCM4345C5
[    7.196673] Bluetooth: hci0: BCM4345C5 (003.006.006) build 0000
[    7.889681] Bluetooth: hci0: BCM4345C5 (003.006.006) build 0038
[    7.890576] Bluetooth: hci0: BCM: Using default device address (43:45:c5:00:1f:ac)
 

Any suggestions?

 

Cheers

Because default firmware include default  mac, Please download the file and replace the default firmware file: /lib/firmware/brcm/BCM4345C5.hcd,then reboot

Link to comment
Share on other sites

On 4/3/2020 at 10:17 AM, iamdrq said:

amixer set 'HPO L' on

amixerset 'HPO R' on

amixerset 'HPOVOL L' on

amixer set 'HPOVOL R' on

amixer set 'HPO MIX HPVOL' on amixer set 'OUT MIXL DAC L1' on amixer set 'OUT MIXR DAC R1' on amixer set 'Stereo DAC MIXL DAC L1' on

amixer set 'Stereo DAC MIXR DAC R1' on

These mixer settings gave a crippled playback on my nanopc t4. The following gave a normal one.

amixer set 'HPO L' on

amixerset 'HPO R' on

amixerset 'HPOVOL L' off

amixer set 'HPOVOL R' off

amixer set 'HPO MIX HPVOL' off

amixer set 'OUT MIXL DAC L1' off

amixer set 'OUT MIXR DAC R1' off

amixer set 'Stereo DAC MIXL DAC L1' on

amixer set 'Stereo DAC MIXR DAC R1' on

amixer set 'HPO MIX DAC1' on

amixer set 'DD MIXL DAC L1' on

amixer set 'DD MIXR DAC R1' on

Link to comment
Share on other sites

I use the last kernel (dev) 5.4.39 on orange pi 4 board and I have no sound card detected.

I did the command aplat -l and the result is no devices found...

About bluetooth it seems it works but I did not enough tests.

I noticed also some panfrost errors in my dmesg log but this issue seems solved in next kernel version 5.5.x. I will investigate.

Link to comment
Share on other sites

Thanks for all the hard work on getting the BT fixed guys! I'm really keen to start using the OPI4 in anger and this helps a lot.

 

I managed to get the BT going, did a file transfer to prove it's working as well. My BT keyboard (Logitech K850) and BT mouse (Logitech M720) connects/pairs succesfully but then nothing. Can't use the mouse or keyboard. I've managed to get it working on an OPi PC using a BT dongle, thus confident that it connects and work on other systems. Also using the same KB and mouse for general use everyday on Win10 (in fact using it to type this post).

 

I should have some time over the weekend to play with the OPI4 again so would appreciate some suggestions on what I can look at to get the KB and mouse working.

 

Cheers!

OzMeister

Link to comment
Share on other sites

On 5/10/2020 at 7:50 PM, firedgje said:

I use the last kernel (dev) 5.4.39 on orange pi 4 board and I have no sound card detected.

I did the command aplat -l and the result is no devices found...

About bluetooth it seems it works but I did not enough tests.

I noticed also some panfrost errors in my dmesg log but this issue seems solved in next kernel version 5.5.x. I will investigate.

 

For information, here is my panfrost gpu issue:

 

[Sat May 16 15:28:37 2020] panfrost ff9a0000.gpu: js fault, js=0, status=INSTR_INVALID_ENC, head=0x139c1d00, tail=0x139c1d00
[Sat May 16 15:28:37 2020] panfrost ff9a0000.gpu: gpu sched timeout, js=0, config=0x3300, status=0x51, head=0x139c1d00, tail=0x139c1d00, sched_job=00000000b3e6ec90
[Sat May 16 15:28:37 2020] ------------[ cut here ]------------
[Sat May 16 15:28:37 2020] WARNING: CPU: 0 PID: 2590 at include/linux/dma-fence.h:533 drm_sched_resubmit_jobs+0x160/0x178 [gpu_sched]
[Sat May 16 15:28:37 2020] Modules linked in: governor_performance bnep zstd snd_soc_hdmi_codec dw_hdmi_i2s_audio dw_hdmi_cec hantro_vpu(C) videobuf2_dma_contig snd_soc_simple_card btsdio snd_soc_rockchip_i2s v4l2_mem2mem snd_soc_simple_card_utils snd_soc_rockchip_pcm brcmfmac snd_soc_core videobuf2_vmalloc brcmutil hci_uart videobuf2_memops rockchipdrm videobuf2_v4l2 snd_pcm_dmaengine sg cfg80211 snd_pcm videobuf2_common btqca analogix_dp snd_timer videodev btbcm dw_mipi_dsi snd panfrost dw_hdmi btintel mc drm_kms_helper bluetooth soundcore gpu_sched drm fusb30x(C) rfkill drm_panel_orientation_quirks cpufreq_dt pwm_bl zram ip_tables x_tables autofs4 hid_logitech_hidpp realtek dwmac_rk stmmac_platform stmmac phylink adc_keys input_polldev hid_logitech_dj uas
[Sat May 16 15:28:37 2020] CPU: 0 PID: 2590 Comm: kworker/0:0 Tainted: G         C        5.4.40-rockchip64 #trunk.133
[Sat May 16 15:28:37 2020] Hardware name: OrangePi 4 (DT)
[Sat May 16 15:28:37 2020] Workqueue: events drm_sched_job_timedout [gpu_sched]
[Sat May 16 15:28:37 2020] pstate: 40000005 (nZcv daif -PAN -UAO)
[Sat May 16 15:28:37 2020] pc : drm_sched_resubmit_jobs+0x160/0x178 [gpu_sched]
[Sat May 16 15:28:37 2020] lr : drm_sched_resubmit_jobs+0xa8/0x178 [gpu_sched]
[Sat May 16 15:28:37 2020] sp : ffff8000139abce0
[Sat May 16 15:28:37 2020] x29: ffff8000139abce0 x28: 0000000000000000 
[Sat May 16 15:28:37 2020] x27: ffff0000e80c0880 x26: ffff0000bb32d600 
[Sat May 16 15:28:37 2020] x25: ffff00008d35e5b8 x24: 00000000ffffff83 
[Sat May 16 15:28:37 2020] x23: 0000000000000024 x22: ffff0000e80c0a08 
[Sat May 16 15:28:37 2020] x21: 0000000000000001 x20: ffff0000e80c09d8 
[Sat May 16 15:28:37 2020] x19: ffff0000e6c91000 x18: ffff8000111f5000 
[Sat May 16 15:28:37 2020] x17: 0000000000000000 x16: 0000000000000000 
[Sat May 16 15:28:37 2020] x15: 00000000fffffff0 x14: 3030303030303030 
[Sat May 16 15:28:37 2020] x13: 3d626f6a5f646568 x12: 0000000000000001 
[Sat May 16 15:28:37 2020] x11: 0000000000000000 x10: 00000000000009f0 
[Sat May 16 15:28:37 2020] x9 : 0000000000000000 x8 : 0000000000000000 
[Sat May 16 15:28:37 2020] x7 : 0000000000000001 x6 : 0000000000000000 
[Sat May 16 15:28:37 2020] x5 : 0000000000000002 x4 : 0000000000000002 
[Sat May 16 15:28:37 2020] x3 : 0000000000000001 x2 : 0000000000000002 
[Sat May 16 15:28:37 2020] x1 : 0000000000000004 x0 : 0000000000000000 
[Sat May 16 15:28:37 2020] Call trace:
[Sat May 16 15:28:37 2020]  drm_sched_resubmit_jobs+0x160/0x178 [gpu_sched]
[Sat May 16 15:28:37 2020]  panfrost_job_timedout+0x1ec/0x2a8 [panfrost]
[Sat May 16 15:28:37 2020]  drm_sched_job_timedout+0x40/0x98 [gpu_sched]
[Sat May 16 15:28:37 2020]  process_one_work+0x1e0/0x338
[Sat May 16 15:28:37 2020]  worker_thread+0x40/0x440
[Sat May 16 15:28:37 2020]  kthread+0x120/0x128
[Sat May 16 15:28:37 2020]  ret_from_fork+0x10/0x18
[Sat May 16 15:28:37 2020] ---[ end trace 8f8839ee8c7b078b ]---
[Sat May 16 15:28:57 2020] broken atomic modeset userspace detected, disabling atomic
[Sat May 16 15:29:00 2020] broken atomic modeset userspace detected, disabling atomic

 

Link to comment
Share on other sites

The bluetooth of the OPI4 drives me a little bit crazy. Try for a week to connect a bluetooth speaker but can´t get it working. I know that directly after a reboot i could start a scan: sudo bluetoothctl scan on. But after a few minutes i got contineusly ..

 

@4-OrangePi:~ $ sudo bluetoothctl             
Agent registered
[bluetooth]# scan on
[bluetooth]# power on
Changing power on succeeded
[bluetooth]# scan on
Failed to start discovery: org.bluez.Error.InProgress
[bluetooth]# scan on
Failed to start discovery: org.bluez.Error.InProgress
Failed to start discovery: org.freedesktop.DBus.Error.NoReply
[bluetooth]# 

 

Link to comment
Share on other sites

On 5/21/2020 at 12:14 PM, firedgje said:

Hi, I checked the device tree about hdmi sound and it is disabled:

 

$cat /sys/firmware/devicetree/base/hdmi-sound/status 

disable

 

Is it normal ?

 

I finally checked kernel config and dts from orangepi-xunlong with armbian sources (4.4.x).

 

dts audio hdmi configurations are the same

 

        hdmi_dp_sound: hdmi-dp-sound {
                status = "okay";
                compatible = "rockchip,rk3399-hdmi-dp";
                rockchip,cpu = <&i2s2>;
                rockchip,codec = <&hdmi>, <&cdn_dp>;
        };

 

but there is something different 

 

# CONFIG_SND_SOC_ROCKCHIP_HDMI_DP is not set

 

I think this flag should be set to module (m) to be coherent with the others.

 

Could someone confirm ?

Link to comment
Share on other sites

8 hours ago, Werner said:

Interesting. This was activated upstream with some other stuff quite a while ago:https://github.com/ayufan-rock64/linux-kernel/pull/42/commits/4b09df95f536a6fecd244dbabd0c59b5aa4048b9

 

Thank you for the link !

 

I checked again all ROCKCHIP configuration differences between linux-rk3399-legacy.config and "ayufan-rock64" rockchip_linux_defconfig:

 

CONFIG_VIDEO_ROCKCHIP_VPU=y
CONFIG_VIDEO_ROCKCHIP_ISP1=y

 

CONFIG_SND_SOC_ROCKCHIP_HDMI_ANALOG=y
CONFIG_SND_SOC_ROCKCHIP_HDMI_DP=y

CONFIG_SND_SOC_ROCKCHIP_MULTICODECS=y

CONFIG_SND_SOC_ROCKCHIP_CDNDP=y

 

CONFIG_ROCKCHIP_SUSPEND_MODE=y

CONFIG_ROCKCHIP_OTP=m
CONFIG_ROCKCHIP_SIP=y

CONFIG_ROCKCHIP_SARADC=m

 

I am not sure that all is relevant but I hope it can be helpful...

 

I didn' t checked with rock64-dev and rock64-current but perhaps they also should be verified.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines