Support RK3588 Orange Pi 5 Plus

This commit is contained in:
orangepi-xunlong
2023-04-10 09:20:03 +08:00
parent 4b897b01ff
commit 9d1ca3ddaa
154 changed files with 627 additions and 5230 deletions

View File

@@ -97,8 +97,8 @@ prepare_board() {
rockpro64|renegade-elite|pinebook-pro|station-p1)
BOARDFAMILY=rk3399
;;
orangepi5|orangepi5b)
echo host > /sys/kernel/debug/usb/fc000000.usb/mode
orangepi5|orangepi5b|orangepi5plus|orangepitab)
[[ $BOARD =~ orangepi5|orangepi5b ]] && echo host > /sys/kernel/debug/usb/fc000000.usb/mode
if [[ -c /dev/mpp_service ]]; then
chmod 666 /dev/mpp_service
@@ -116,7 +116,8 @@ prepare_board() {
done
bt_status=$(cat /proc/device-tree/wireless-bluetooth/status)
if [[ ${bt_status} == "okay" ]]; then
wifi_chip=$(cat /proc/device-tree/wireless-wlan/wifi_chip_type)
if [[ ${wifi_chip} == "ap6275p" && ${bt_status} == "okay" ]]; then
rfkill unblock all
brcm_patchram_plus --bd_addr_rand --enable_hci --no2bytes --use_baudrate_for_download --tosleep 200000 \
--baudrate 1500000 --patchram /lib/firmware/ap6275p/BCM4362A2.hcd /dev/ttyS9 &

View File

@@ -0,0 +1,143 @@
#!/usr/bin/pulseaudio -nF
#
# This file is part of PulseAudio.
#
# PulseAudio is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# PulseAudio 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.
#
# You should have received a copy of the GNU Lesser General Public License
# along with PulseAudio; if not, see <http://www.gnu.org/licenses/>.
# This startup script is used only if PulseAudio is started per-user
# (i.e. not in system mode)
.fail
### Automatically restore the volume of streams and devices
load-module module-device-restore
load-module module-stream-restore
load-module module-card-restore
### Automatically augment property information from .desktop files
### stored in /usr/share/application
load-module module-augment-properties
load-module module-switch-on-connect blacklist=""
### Should be after module-*-restore but before module-*-detect
load-module module-switch-on-port-available
### Load audio drivers statically
### (it's probably better to not load these drivers manually, but instead
### use module-udev-detect -- see below -- for doing this automatically)
#load-module module-alsa-sink
#load-module module-alsa-source device=hw:1,0
#load-module module-oss device="/dev/dsp" sink_name=output source_name=input
#load-module module-oss-mmap device="/dev/dsp" sink_name=output source_name=input
#load-module module-null-sink
#load-module module-pipe-sink
### Automatically load driver modules depending on the hardware available
.ifexists module-udev-detect.so
load-module module-udev-detect
.else
### Use the static hardware detection module (for systems that lack udev support)
load-module module-detect
.endif
### Automatically connect sink and source if JACK server is present
.ifexists module-jackdbus-detect.so
.nofail
load-module module-jackdbus-detect channels=2
.fail
.endif
### Automatically load driver modules for Bluetooth hardware
.ifexists module-bluetooth-policy.so
load-module module-bluetooth-policy
.endif
.ifexists module-bluetooth-discover.so
load-module module-bluetooth-discover
.endif
### Load several protocols
.ifexists module-esound-protocol-unix.so
load-module module-esound-protocol-unix
.endif
load-module module-native-protocol-unix auth-anonymous=1 socket=/tmp/pulse-socket
### Network access (may be configured with paprefs, so leave this commented
### here if you plan to use paprefs)
#load-module module-esound-protocol-tcp
#load-module module-native-protocol-tcp
#load-module module-zeroconf-publish
### Load the RTP receiver module (also configured via paprefs, see above)
#load-module module-rtp-recv
### Load the RTP sender module (also configured via paprefs, see above)
#load-module module-null-sink sink_name=rtp format=s16be channels=2 rate=44100 sink_properties="device.description='RTP Multicast Sink'"
#load-module module-rtp-send source=rtp.monitor
### Load additional modules from GSettings. This can be configured with the paprefs tool.
### Please keep in mind that the modules configured by paprefs might conflict with manually
### loaded modules.
.ifexists module-gsettings.so
.nofail
load-module module-gsettings
.fail
.endif
### Automatically restore the default sink/source when changed by the user
### during runtime
### NOTE: This should be loaded as early as possible so that subsequent modules
### that look up the default sink/source get the right value
load-module module-default-device-restore
### Automatically move streams to the default sink if the sink they are
### connected to dies, similar for sources
load-module module-rescue-streams
### Make sure we always have a sink around, even if it is a null sink.
load-module module-always-sink
### Honour intended role device property
load-module module-intended-roles
### Automatically suspend sinks/sources that become idle for too long
load-module module-suspend-on-idle
### If autoexit on idle is enabled we want to make sure we only quit
### when no local session needs us anymore.
.ifexists module-console-kit.so
load-module module-console-kit
.endif
.ifexists module-systemd-login.so
load-module module-systemd-login
.endif
### Enable positioned event sounds
load-module module-position-event-sounds
### Cork music/video streams when a phone stream is active
load-module module-role-cork
### Modules to allow autoloading of filters (such as echo cancellation)
### on demand. module-filter-heuristics tries to determine what filters
### make sense, and module-filter-apply does the heavy-lifting of
### loading modules and rerouting streams.
load-module module-filter-heuristics
load-module module-filter-apply
### Make some devices default
#set-default-sink output
set-default-source alsa_input.platform-es8388-sound.HiFi__hw_rockchipes8388__source
set-default-sink alsa_output.platform-es8388-sound.HiFi__hw_rockchipes8388__sink

View File

@@ -0,0 +1,25 @@
#!/bin/bash
echo 0 > /sys/devices/platform/fd8b0030.pwm/pwm/pwmchip*/export
echo 10000 > /sys/devices/platform/fd8b0030.pwm/pwm/pwmchip*/pwm0/period
echo 8000 > /sys/devices/platform/fd8b0030.pwm/pwm/pwmchip*/pwm0/duty_cycle
echo normal > /sys/devices/platform/fd8b0030.pwm/pwm/pwmchip*/pwm0/polarity
echo 1 > /sys/devices/platform/fd8b0030.pwm/pwm/pwmchip*/pwm0/enable
sleep 3
while true
do
a=$(cat /sys/class/thermal/thermal_zone0/temp)
time=$(date)
pwm=$(echo ${a} | awk '{printf("%d",$1*0.15-800)}')
if (( $pwm > 8500 ))
then
pwm=8500
elif (( $pwm < 5000 ))
then
pwm=5000
fi
echo ${pwm} > /sys/devices/platform/fd8b0030.pwm/pwm/pwmchip*/pwm0/duty_cycle
echo [${time}] Thermal value: ${a}, write fan PWM cycle ${pwm}
sleep 5
done

View File

@@ -0,0 +1,33 @@
#!/bin/bash
trap 'onCtrlC' INT
function onCtrlC () {
echo 'Ctrl+C is captured'
killall gst-launch-1.0
exit 0
}
device_id=$(v4l2-ctl --list-devices | grep -A1 hdmirx | grep -v hdmirx | awk -F ' ' '{print $NF}')
v4l2-ctl -d $device_id --set-dv-bt-timings query 2>&1 > /dev/null
width=$(v4l2-ctl -d $device_id --get-dv-timings | grep "Active width" |awk -F ' ' '{print $NF}')
heigh=$(v4l2-ctl -d $device_id --get-dv-timings | grep "Active heigh" |awk -F ' ' '{print $NF}')
es8388_card=$(aplay -l | grep "es8388" | cut -d ':' -f 1 | cut -d ' ' -f 2)
hdmi0_card=$(aplay -l | grep "hdmi0" | cut -d ':' -f 1 | cut -d ' ' -f 2)
hdmi1_card=$(aplay -l | grep "hdmi1" | cut -d ':' -f 1 | cut -d ' ' -f 2)
hdmiin_card=$(arecord -l | grep "hdmiin" | cut -d ":" -f 1 | cut -d ' ' -f 2)
DISPLAY=:0.0 gst-launch-1.0 v4l2src device=${device_id} io-mode=4 ! videoconvert \
! video/x-raw,format=NV12,width=${width},height=${heigh} \
! videoscale ! video/x-raw,width=1280,height=720 \
! autovideosink 2>&1 > /dev/null &
gst-launch-1.0 alsasrc device=hw:${hdmiin_card},0 ! audioconvert ! audioresample ! queue \
! tee name=t ! queue ! alsasink device="hw:${hdmi0_card},0" \
t. ! queue ! alsasink device="hw:${hdmi1_card},0" \
t. ! queue ! alsasink device="hw:${es8388_card},0" &
while true
do
sleep 10
done

View File

@@ -0,0 +1,11 @@
[Unit]
Description=PWM-Fan-Simple-Control
After=network.target
[Service]
Type=simple
ExecStart=/usr/bin/pwm-fan
Restart=always
[Install]
WantedBy=multi-user.target

View File

@@ -0,0 +1,23 @@
# Usecase for device HDMI1/Display Port stereo playback on rockchip platforms
# For Audio in I2S mode
SectionDevice."HDMI1" {
Comment "HDMI"
Value {
PlaybackPriority 400
PlaybackPCM "hw:${CardId}"
If.1 {
Condition {
Type ControlExists
Control "iface=CARD,name='rockchip-hdmi1 Jack'"
}
True {
JackControl "rockchip-hdmi1 Jack"
}
False {
JackControl "rockchip-hdmi1 Jack"
}
}
}
}

View File

@@ -0,0 +1,8 @@
Syntax 2
Comment "Rockchip HDMI card"
SectionUseCase."HDMI" {
File "Hdmi.conf"
Comment "HDMI"
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 177 KiB

View File

@@ -1,80 +0,0 @@
person
bicycle
car
motorcycle
airplane
bus
train
truck
boat
traffic light
fire hydrant
stop sign
parking meter
bench
bird
cat
dog
horse
sheep
cow
elephant
bear
zebra
giraffe
backpack
umbrella
handbag
tie
suitcase
frisbee
skis
snowboard
sports ball
kite
baseball bat
baseball glove
skateboard
surfboard
tennis racket
bottle
wine glass
cup
fork
knife
spoon
bowl
banana
apple
sandwich
orange
broccoli
carrot
hot dog
pizza
donut
cake
chair
couch
potted plant
bed
dining table
toilet
tv
laptop
mouse
remote
keyboard
cell phone
microwave
oven
toaster
sink
refrigerator
book
clock
vase
scissors
teddy bear
hair drier
toothbrush

View File

@@ -1,3 +0,0 @@
#!/bin/bash
sudo ./rknn_yolov5_demo ./model/RK3588/yolov5s-640-640.rknn ./model/bus.jpg

View File

@@ -8,36 +8,35 @@ else
fi
card=$(aplay -l | grep "es8388" | cut -d ':' -f 1 | cut -d ' ' -f 2)
hdmi0_card=$(aplay -l | grep "hdmi0" | cut -d ':' -f 1 | cut -d ' ' -f 2)
if [[ $type == "main" ]]; then
tinymix -D 2 3 4
tinymix -D 2 4 2
tinymix -D 2 14 192
tinymix -D 2 16 0
tinymix -D 2 17 0
tinymix -D 2 31 1
tinymix -D 2 32 1
tinymix -D 2 33 1
tinymix -D $card 3 4
tinymix -D $card 4 2
tinymix -D $card 14 192
tinymix -D $card 16 0
tinymix -D $card 17 0
tinymix -D $card 31 1
tinymix -D $card 32 1
tinymix -D $card 33 1
else
tinymix -D 2 3 2
tinymix -D 2 4 1
tinymix -D 2 14 192
tinymix -D 2 16 0
tinymix -D 2 17 0
tinymix -D 2 31 0
tinymix -D 2 32 0
tinymix -D 2 33 0
tinymix -D $card 3 2
tinymix -D $card 4 1
tinymix -D $card 14 192
tinymix -D $card 16 0
tinymix -D $card 17 0
tinymix -D $card 31 0
tinymix -D $card 32 0
tinymix -D $card 33 0
fi
echo "Start recording: /tmp/test.wav"
arecord -D hw:${card},0 -d 5 -f cd -t wav /tmp/test.wav
echo "Start playing"
aplay /tmp/test.wav -D hw:1,0
aplay /tmp/test.wav -D hw:2,0
#aplay /tmp/test.wav -D hw:0,0
aplay /tmp/test.wav -D hw:${card},0
aplay /tmp/test.wav -D hw:${hdmi0_card},0