Merge pull request #2468 from JustEnoughLinuxOS/dev

PR for release
This commit is contained in:
fewtarius 2023-11-30 22:05:52 -05:00 committed by GitHub
commit fa8ec7da9e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
73 changed files with 1069 additions and 4316 deletions

View file

@ -9,6 +9,5 @@ ryujinx-sa #broken on JELOS after build 1.1740.
melonds-sa #Broken OpenGL renderer upstream
mupen64plus-sa-ui-console #Causes segfaults
nanoboyadvance-sa #SDL version removed after this commit
freechaf-lr #build issue, revisit.
pcsx_rearmed-lr #pins version as new releases have artifacting issues.
kronos-sa #using the release version of kronos had better results.
retroarch #pinning to release versions for stability.

View file

@ -34,7 +34,7 @@ if [ ! -d "/storage/roms/ports/PortMaster" ]; then
fi
#We dont use tasksetter, delete it
if [ ! -f /storage/roms/ports/PortMaster/tasksetter ]; then
if [ -f /storage/roms/ports/PortMaster/tasksetter ]; then
rm -r /storage/roms/ports/PortMaster/tasksetter
fi
@ -65,6 +65,9 @@ else
xmlstarlet ed --inplace --subnode "/gameList/folder[last()]" --type elem -n hidden -v "true" /storage/roms/ports/gamelist.xml
fi
#Make sure permissions are correct in the PortMaster folder
chmod 755 /storage/roms/ports/PortMaster/* -R
#Start PortMaster
@LIBEGL@
cd /storage/roms/ports/PortMaster

View file

@ -17,6 +17,7 @@ if [ "${BLUETOOTH_SUPPORT}" = "yes" ]; then
-Dbluez5-backend-ofono=disabled \
-Dbluez5-backend-hsphfpd=disabled \
-Dbluez5-codec-aptx=enabled \
-Dbluez5-codec-lc3plus=disabled \
-Dbluez5-codec-ldac=enabled \
-Dbluez5-codec-aac=enabled"
else
@ -83,6 +84,8 @@ pre_configure_target() {
}
post_install() {
add_user pipewire x 982 980 "pipewire-daemon" "/var/run/pipewire" "/bin/sh"
add_group pipewire 980
mkdir -p ${INSTALL}/etc/alsa/conf.d
ln -sf /usr/share/alsa/alsa.conf.d/50-pipewire.conf ${INSTALL}/etc/alsa/conf.d/50-pipewire.conf
ln -sf /usr/share/alsa/alsa.conf.d/99-pipewire-default.conf ${INSTALL}/etc/alsa/conf.d/99-pipewire-default.conf

View file

@ -1,5 +1,5 @@
PKG_NAME="freechaf-lr"
PKG_VERSION="4d1d5cb83b93728a63f03454e472a23055d9bbfc"
PKG_VERSION="782739dd6988b0148f9c26ddc6ff414e76e54d7b"
PKG_REV="1"
PKG_ARCH="any"
PKG_LICENSE="GPLv2"

View file

@ -3,7 +3,7 @@
# Copyright (C) 2023 JELOS (https://github.com/JustEnoughLinuxOS)
PKG_NAME="pcsx_rearmed-lr"
PKG_VERSION="e34ef5a"
PKG_VERSION="ff3890db8ef473ee5eae6a7120ee39d761a86620"
PKG_ARCH="arm aarch64"
PKG_LICENSE="GPLv2"
PKG_SITE="https://github.com/libretro/pcsx_rearmed"

View file

@ -7,6 +7,7 @@ PKG_DEPENDS_TARGET="toolchain libevdev libdrm ffmpeg zlib libpng lzo libusb zstd
PKG_SITE="https://github.com/shiiion/dolphin"
PKG_URL="${PKG_SITE}.git"
PKG_VERSION="48dbd3a4a7249948d3e7e21b20842d493c3b00cb"
PKG_GIT_CLONE_BRANCH="master"
PKG_LONGDESC="PrimeHack A Dolphin Emulator fork for Metroid Prime Trilogy."
PKG_PATCH_DIRS+=" wayland"

View file

@ -3,7 +3,7 @@
# Copyright (C) 2023 JELOS (https://github.com/JustEnoughLinuxOS)
PKG_NAME="retroarch"
PKG_VERSION="f091b5a9e9475255e5efaded5f95c9750fdfe15e"
PKG_VERSION="6c2cc456284fcfa6fa5f94664950926c020d2f7b" # v1.16.0.3
PKG_SITE="https://github.com/libretro/RetroArch"
PKG_URL="${PKG_SITE}.git"
PKG_LICENSE="GPLv3"

View file

@ -3,7 +3,7 @@
# Copyright (C) 2022-present - The JELOS Project (https://github.com/JustEnoughLinuxOS)
PKG_NAME="rpcs3-sa"
PKG_VERSION="ed75bab7b284a9cb62b7308097108e4caef9a0b3"
PKG_VERSION="7081b89e976ad7f931c926022bd93ddd9778347c"
PKG_ARCH="x86_64"
PKG_LICENSE="GPL-2.0-or-later"
PKG_SITE="https://rpcs3.net"
@ -16,7 +16,9 @@ PKG_GIT_CLONE_BRANCH="master"
PKG_GIT_CLONE_SINGLE="yes"
pre_configure_host() {
PKG_CMAKE_SCRIPT="${PKG_BUILD}/3rdparty/llvm/llvm/llvm/CMakeLists.txt"
# path changes in future commits.
# PKG_CMAKE_SCRIPT="${PKG_BUILD}/3rdparty/llvm/llvm/llvm/CMakeLists.txt"
PKG_CMAKE_SCRIPT="${PKG_BUILD}/llvm/CMakeLists.txt"
PKG_CMAKE_OPTS_HOST="-DLLVM_TARGETS_TO_BUILD="X86" \
-DLLVM_BUILD_RUNTIME=OFF \
-DLLVM_BUILD_TOOLS=OFF \

View file

@ -22,7 +22,7 @@ case ${DEVICE} in
PKG_URL="https://mesa.freedesktop.org/archive/mesa-${PKG_VERSION}.tar.xz"
;;
*)
PKG_VERSION="23.2.1"
PKG_VERSION="23.3.0"
PKG_SITE="http://www.mesa3d.org/"
PKG_URL="https://mesa.freedesktop.org/archive/mesa-${PKG_VERSION}.tar.xz"
;;

View file

@ -1,22 +0,0 @@
--- a/src/gallium/drivers/crocus/crocus_bufmgr.c 2023-03-14 18:16:32.195276836 +0000
+++ b/src/gallium/drivers/crocus/crocus_bufmgr.c 2023-03-14 18:17:32.920657663 +0000
@@ -878,7 +878,7 @@ crocus_bo_map_cpu(struct util_debug_call
bo_wait_with_stall_warning(dbg, bo, "CPU mapping");
}
- if (!bo->cache_coherent && !bo->bufmgr->has_llc) {
+ //if (!bo->cache_coherent && !bo->bufmgr->has_llc) {
/* If we're reusing an existing CPU mapping, the CPU caches may
* contain stale data from the last time we read from that mapping.
* (With the BO cache, it might even be data from a previous buffer!)
@@ -895,8 +895,8 @@ crocus_bo_map_cpu(struct util_debug_call
* LLC entirely requiring us to keep dirty pixels for the scanout
* out of any cache.)
*/
- intel_invalidate_range(bo->map_cpu, bo->size);
- }
+ // intel_invalidate_range(bo->map_cpu, bo->size);
+ //}
return bo->map_cpu;
}

View file

@ -13,5 +13,5 @@ DEVICE_VOLUME="100"
DEVICE_BATTERY_LED_STATUS="true"
DEVICE_PWR_LED_GPIO="77"
DEVICE_TEMP_SENSOR="/sys/devices/virtual/thermal/thermal_zone0/temp"
DEVICE_MMC_EJECT="false"
EOF

View file

@ -7,3 +7,8 @@ CPU_FREQ=("/sys/devices/system/cpu/cpufreq/policy0" "/sys/devices/system/cpu/cpu
GPU_FREQ="/sys/devices/platform/ff9a0000.gpu/devfreq/ff9a0000.gpu"
DMC_FREQ="/sys/devices/platform/memory-controller/devfreq/memory-controller/"
EOF
### Lock in lowest freq we want to use
echo 1008000 > /sys/devices/system/cpu/cpufreq/policy0/scaling_min_freq
echo 1008000 > /sys/devices/system/cpu/cpufreq/policy4/scaling_min_freq
echo 600000000 > /sys/devices/platform/ff9a0000.gpu/devfreq/ff9a0000.gpu/min_freq

View file

@ -0,0 +1,32 @@
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0
# Copyright (C) 2023 JELOS (https://github.com/JustEnoughLinuxOS)
### Restore previous governors before going to sleep
. /etc/profile
### Set max/min freq to lowest available value
echo 1008000 > /sys/devices/system/cpu/cpufreq/policy0/scaling_min_freq
echo 1008000 > /sys/devices/system/cpu/cpufreq/policy4/scaling_min_freq
echo 600000000 > /sys/devices/platform/ff9a0000.gpu/devfreq/ff9a0000.gpu/min_freq
echo 1608000 > /sys/devices/system/cpu/cpufreq/policy0/scaling_max_freq
echo 2088000 > /sys/devices/system/cpu/cpufreq/policy4/scaling_max_freq
echo 900000000 > /sys/devices/platform/ff9a0000.gpu/devfreq/ff9a0000.gpu/max_freq
### Grab the old governors.
OLD_CPU_FREQ=$(get_setting "sleep.cpugovernor")
if [ ! -n "${OLD_CPU_FREQ}" ]; then
OLD_CPU_FREQ="schedutil"
fi
OLD_GPU_FREQ=$(get_setting "sleep.gpugovernor")
if [ ! -n "${OLD_GPU_FREQ}" ]; then
OLD_GPU_FREQ="simple_ondemand"
fi
# Restore old governors.
set_cpu_gov "${OLD_CPU_FREQ}"
set_dmc_gov "${OLD_CPU_FREQ}"
set_gpu_gov "${OLD_GPU_FREQ}"

View file

@ -0,0 +1,28 @@
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0
# Copyright (C) 2023 JELOS (https://github.com/JustEnoughLinuxOS)
# Store current freq governors and set governors to powersave.
. /etc/profile
### Get the current cpu and gpu governor, save for when the device wakes from sleep.
CUR_CPU_FREQ="$(cat /sys/devices/system/cpu/cpufreq/policy0/scaling_governor)"
CUR_GPU_FREQ="$(cat /sys/devices/platform/ff9a0000.gpu/devfreq/ff9a0000.gpu/governor)"
set_setting sleep.cpugovernor "${CUR_CPU_FREQ}"
set_setting sleep.gpugovernor "${CUR_GPU_FREQ}"
### Set all governors to powersave
set_cpu_gov powersave
set_dmc_gov powersave
set_gpu_gov powersave
### Set max/min freq to lowest available value
echo 600000 > /sys/devices/system/cpu/cpufreq/policy0/scaling_min_freq
echo 600000 > /sys/devices/system/cpu/cpufreq/policy4/scaling_min_freq
echo 200000000 > /sys/devices/platform/ff9a0000.gpu/devfreq/ff9a0000.gpu/min_freq
echo 600000 > /sys/devices/system/cpu/cpufreq/policy0/scaling_max_freq
echo 600000 > /sys/devices/system/cpu/cpufreq/policy4/scaling_max_freq
echo 200000000 > /sys/devices/platform/ff9a0000.gpu/devfreq/ff9a0000.gpu/max_freq

View file

@ -10,4 +10,5 @@ DEVICE_SW_HP_SWITCH="true"
DEVICE_PLAYBACK_PATH_SPK="SPK"
DEVICE_PLAYBACK_PATH_HP="HP"
DEVICE_BRIGHTNESS="128"
DEVICE_MMC_EJECT="false"
EOF

View file

@ -14,5 +14,5 @@ DEVICE_VOLUME="100"
DEVICE_BATTERY_LED_STATUS="true"
DEVICE_PWR_LED_GPIO="77"
DEVICE_TEMP_SENSOR="/sys/devices/virtual/thermal/thermal_zone0/temp"
DEVICE_MMC_EJECT="false"
EOF

View file

@ -9,4 +9,5 @@ DEVICE_POWER_LED="false"
DEVICE_PLAYBACK_PATH_SPK="SPK"
DEVICE_PLAYBACK_PATH_HP="HP"
DEVICE_BRIGHTNESS="128"
DEVICE_MMC_EJECT="false"
EOF

View file

@ -0,0 +1,23 @@
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0
# Copyright (C) 2023 JELOS (https://github.com/JustEnoughLinuxOS)
### Restore previous governors before going to sleep
. /etc/profile
### Grab the old governors.
OLD_CPU_FREQ=$(get_setting "sleep.cpugovernor")
if [ ! -n "${OLD_CPU_FREQ}" ]; then
OLD_CPU_FREQ="schedutil"
fi
OLD_GPU_FREQ=$(get_setting "sleep.gpugovernor")
if [ ! -n "${OLD_GPU_FREQ}" ]; then
OLD_GPU_FREQ="simple_ondemand"
fi
# Restore old governors.
set_cpu_gov "${OLD_CPU_FREQ}"
set_dmc_gov "${OLD_CPU_FREQ}"
set_gpu_gov "${OLD_GPU_FREQ}"

View file

@ -0,0 +1,19 @@
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0
# Copyright (C) 2023 JELOS (https://github.com/JustEnoughLinuxOS)
# Store current freq governors and set governors to powersave.
. /etc/profile
### Get the current cpu and gpu governor, save for when the device wakes from sleep.
CUR_CPU_FREQ="$(cat /sys/devices/system/cpu/cpufreq/policy0/scaling_governor)"
CUR_GPU_FREQ="$(cat /sys/devices/platform/ff400000.gpu/devfreq/ff400000.gpu/governor)"
set_setting sleep.cpugovernor "${CUR_CPU_FREQ}"
set_setting sleep.gpugovernor "${CUR_GPU_FREQ}"
### Set all governors to powersave
set_cpu_gov powersave
set_dmc_gov powersave
set_gpu_gov powersave

View file

@ -26,6 +26,7 @@ export SLOW_CORES \
DEVICE_KEY_VOLUMEUP \
DEVICE_LED_BRIGHTNESS \
DEVICE_LED_CONTROL \
DEVICE_MMC_EJECT \
DEVICE_PIPEWIRE_PROFILE \
DEVICE_PWR_LED_CONTROL \
DEVICE_PWR_LED_GPIO \

View file

@ -25,42 +25,9 @@ fi
### to last known good state if corrupt.
/usr/bin/chksysconfig verify
### Clean up settings
sort_settings
### We do not want to mount the cloud drive on startup
### so we'll reset the mount option to 0.
set_setting clouddrive.mounted 0
### Enable the desired number of threads.
tocon "Restoring cpu threads..."
NUMTHREADS=$(get_setting "system.threads")
if [ -n "${NUMTHREADS}" ]
then
onlinethreads ${NUMTHREADS} 0
else
onlinethreads all 1
fi
### If we don't have a default governor set, set it
### to schedutil.
if [ -z "$(get_setting system.cpugovernor)" ]
then
set_setting system.cpugovernor schedutil
fi
### Set the default GPU performance mode
GPUPERF=$(get_setting system.gpuperf)
if [ -n "${GPUPERF}" ]
then
gpu_performance_level ${GPUPERF}
fi
### Configure suspend mode.
MYSLEEPMODE=$(get_setting system.suspendmode)
if [ -n "${MYSLEEPMODE}" ]
then
/usr/bin/suspendmode ${MYSLEEPMODE}
else
/usr/bin/suspendmode mem
fi
### Clean up settings
sort_settings

View file

@ -0,0 +1,33 @@
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0
# Copyright (C) 2023 JELOS (https://github.com/JustEnoughLinuxOS)
# Minimal OS variable loading for performance
. /etc/profile.d/001-functions
. /etc/profile.d/099-freqfunctions
tocon "Setting performance mode..."
### Enable the desired number of threads.
tocon "Restoring cpu threads..."
NUMTHREADS=$(get_setting "system.threads")
if [ -n "${NUMTHREADS}" ]
then
onlinethreads ${NUMTHREADS} 0
else
onlinethreads all 1
fi
### If we don't have a default governor set, set it
### to schedutil but don't enable it.
if [ -z "$(get_setting system.cpugovernor)" ]
then
set_setting system.cpugovernor schedutil
fi
### Set the default GPU performance mode
GPUPERF=$(get_setting system.gpuperf)
if [ -n "${GPUPERF}" ]
then
gpu_performance_level ${GPUPERF}
fi

View file

@ -0,0 +1,17 @@
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0
# Copyright (C) 2023 JELOS (https://github.com/JustEnoughLinuxOS)
# Minimal OS variable loading for performance
. /etc/profile.d/001-functions
tocon "Configure suspend mode..."
### Configure suspend mode.
MYSLEEPMODE=$(get_setting system.suspendmode)
if [ -n "${MYSLEEPMODE}" ]
then
/usr/bin/suspendmode ${MYSLEEPMODE}
else
/usr/bin/suspendmode mem
fi

View file

@ -73,6 +73,38 @@ sed -i 's~"pulse"~"alsathread"~g' /storage/.config/retroarch/retroarch.cfg
### 20231114 - Update hosts.conf
grep "127.0.0.1" /storage/.config/hosts.conf >/dev/null 2>&1 || cp /usr/config/hosts.conf /storage/.config/
### 20231127 - Migrate games to overlayfs
systemctl stop storage-roms.mount
GAMECOUNT=$(find /storage/roms -type f | wc -l)
if [ "${GAMECOUNT}" -gt 20 ] && \
[ ! -e "/storage/.migrated_games" ]
then
echo "Migrating games to overlayfs" >>${LOG}
if [ -d "/storage/games-internal" ]
then
echo "Backing up games-internal" >>${LOG}
mv /storage/games-internal /storage/games-internal.backup
fi
mv /storage/roms /storage/games-internal
mkdir /storage/roms
touch /storage/.migrated_games
else
echo "Game weight too low (${GAMECOUNT}) or content already migrated." >>${LOG}
fi
systemctl start storage-roms.mount
### 20231129 - Don't default to performance.
EPP=$(get_setting system.power.epp)
if [ -z "${EPP}" ] || \
[ "${EPP}" = "performance" ]
then
EPP="balance_performance"
set_setting system.power.epp ${EPP}
fi
### 20231130 - Replace smb.conf for new overlay mechanism.
cp -f /usr/config/smb.conf /storage/.config
### Items below this line should not be removed.
tocon "Update complete, rebooting..."
reboot

View file

@ -8,49 +8,95 @@
UPDATE_ROOT="/storage/.update"
MOUNT_GAMES=$(get_setting system.automount)
GAMES_DEVICE=$(get_setting system.gamesdevice)
MOUNT_PATH="/storage/games-external"
OVERLAY_PATH="/storage/roms"
start_overlay() {
if [ -e "/storage/.overlay_unsupported" ]
then
# If we're not using the overlay, bind mount the external storage path
# so we don't need to change any configs.
grep ${MOUNT_PATH} /proc/mounts >/dev/null 2>&1
if [ ! $? = 0 ]
then
MOUNT_PATH="/storage/games-internal"
fi
log $0 "Executing bind mount of ${MOUNT_PATH} to ${OVERLAY_PATH}"
mount --bind ${MOUNT_PATH} ${OVERLAY_PATH}
exit 0
else
log $0 "Enabling overlay."
systemctl enable storage-roms.mount >/dev/null 2>&1
systemctl start storage-roms.mount >/dev/null 2>&1
fi
}
if [[ ! "${MOUNT_GAMES}" =~ [0-9] ]]
then
set_setting system.automount 1
elif [[ "${MOUNT_GAMES}" == "0" ]]
then
start_overlay
exit 0
fi
load_modules() {
function load_modules() {
for MODULE in exfat vfat
do
lsmod | grep ${MODULE} 2>/dev/null
if [ ! $? = 0 ]
then
log $0 "Loading ${MODULE}."
modprobe ${MODULE} 2>/dev/null
fi
done
}
mount_games() {
function mount_games() {
FSTYPE=$(blkid -o export ${1} | awk 'BEGIN {FS="="} /TYPE/ {print $2}')
case ${FSTYPE} in
ext4)
log $0 "Found supported partition for overlayfs."
if [ -e "/storage/.overlay_unsupported" ]
then
rm -f /storage/.overlay_unsupported
fi
touch /storage/.overlay_supported
set_setting system.merged.storage 1
;;
*)
log $0 "Partition does not support overlayfs, disabling."
if [ -e "/storage/.overlay_supported" ]
then
rm -f /storage/.overlay_supported
fi
touch /storage/.overlay_unsupported
;;
esac
if [ ! -d "${MOUNT_PATH}" ]
then
log $0 "Create directory ${MOUNT_PATH}"
/usr/bin/busybox mkdir -p ${MOUNT_PATH} >/dev/null 2>&1
fi
NULL=$(cat /proc/mounts | grep -v -e "/var/media" 2>/dev/null | grep ${1})
if [ ! "$?" = "0" ] && \
[ -e "${1}" ] && \
[ ! -e "/storage/.please_resize_me" ]
then
### Udevil shouldn't mount it this early, but just in-case.
umount /var/media/*
log $0 "FSCK ${1}"
fsck -Mly ${1}
log $0 "Mounting ${1} on /storage/roms"
/usr/bin/busybox mount ${1} /storage/roms >/dev/null 2>&1
/usr/bin/systemd-tmpfiles --create /usr/lib/tmpfiles.d/JELOS-system-dirs.conf >/dev/null 2>&1
umount /var/media/* 2>/dev/null
log $0 "Checking filesystem ${1}."
fsck -Mly ${1} >/dev/null 2>&1
log $0 "Mounting ${1} on ${MOUNT_PATH}"
/usr/bin/busybox mount ${1} ${MOUNT_PATH} >/dev/null 2>&1
fi
start_overlay
}
find_games() {
if /usr/bin/busybox mountpoint -q /storage ; then
if [ ! -d "/storage/roms" ]
then
/usr/bin/busybox mkdir -p /storage/roms >/dev/null 2>&1
fi
for DEV in $(for dev in mmcblk[0-9] sd[a-z] nvme[0-9]; do blkid | grep ${dev} | awk 'BEGIN {FS=":"}; /ext4/ || /fat/ {print $1}' | sort -r; done)
do
ROOTDEV=$(echo ${DEV} | sed -e "s#^/.*/##g" -e "s#p[0-9].*\$##g")
@ -74,10 +120,13 @@ find_games() {
[ ! -e "/storage/.please_resize_me" ]
then
GAMES_DEVICE=${DEV}
log $0 "Found ${DEV} available to mount."
mount_games "${DEV}"
break
fi
done
# If we're here there is no external storage to use, but we want to start the overlay anyway.
start_overlay
fi
}

View file

@ -0,0 +1,112 @@
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0
# Copyright (C) 2023 JELOS (https://github.com/JustEnoughLinuxOS)
. /etc/profile
if [ ! "${HW_ARCH}" = "x86_64" ]
then
echo "This platform is not currently supported."
exit 1
fi
HOSTNAME=$(hostname)
if [ -z "${1}" ]
then
BENCHLOG="${1}"
else
BENCHLOG="benchmark.log"
fi
LOG="${HOME}/${BENCHLOG}.log"
SYSTEM_TDP=$(get_setting system.overclock)
SYSTEM_GOV=$(get_setting system.cpugovernor)
SYSTEM_EPP=$(get_setting system.power.epp)
SYSTEM_GPU=$(get_setting system.gpuperf)
SYSTEM_THREADS=$(get_setting system.threads)
SYSTEM_POWERSAVE=$(get_setting system.powersave)
SYSTEM_COOLING=$(get_setting cooling.profile)
case ${1} in
performance)
onlinethreads all
performance
gpu_performance_level profile_peak
cpu_perftune performance
set_setting system.powersave 0
systemctl restart powerstate
set_setting cooling.profile auto
systemctl restart fancontrol
;;
balanced_performance)
onlinethreads all
schedutil
gpu_performance_level auto
cpu_perftune balance_performance
set_setting system.powersave 0
systemctl restart powerstate
set_setting cooling.profile auto
systemctl restart fancontrol
;;
balanced_powersave)
onlinethreads 4
powersave
gpu_performance_level low
cpu_perftune balance_power
set_setting system.powersave 1
systemctl restart powerstate
set_setting cooling.profile quiet
systemctl restart fancontrol
;;
powersave)
onlinethreads 4
powersave
gpu_performance_level low
cpu_perftune power
set_setting system.powersave 1
systemctl restart powerstate
set_setting cooling.profile quiet
systemctl restart fancontrol
;;
*)
# Default Settings
onlinethreads all
schedutil
gpu_performance_level auto
cpu_perftune balance_performance
set_setting system.powersave 0
systemctl restart powerstate
set_setting cooling.profile auto
systemctl restart fancontrol
;;
esac
if [ -e "${LOG}" ]
then
rm -f ${LOG}
fi
echo "${HOSTNAME} - ${1}"
for TDP in 4.5w 6w 9w 15w 18w 24w 28w
do
overclock ${TDP} >/dev/null 2>&1
echo "Testing @ ${TDP}" 2>&1 | tee -a ${LOG}
echo "----" 2>&1 | tee -a ${LOG}
glmark2-es2-wayland --fullscreen --annotate 2>&1 | awk '/glmark2 Score:/ {print "GLMark: "$3}' | tee -a ${LOG}
cd /usr/bin
./7z b 2>&1 | awk '/^Tot:/ {print "7z: "$4}' | tee -a ${LOG}
echo "----" 2>&1 | tee -a ${LOG}
done
overclock ${SYSTEM_TDP}
onlinethreads ${SYSTEM_THREADS}
${SYSTEM_GOV}
gpu_performance_level ${SYSTEM_GPU}
cpu_perftune ${SYSTEM_EPP}
set_setting system.powersave ${SYSTEM_POWERSAVE}
systemctl restart powerstate
set_setting cooling.profile ${SYSTEM_COOLING}
systemctl restart fancontrol

View file

@ -1,76 +0,0 @@
#!/bin/bash
# rom_system_split: split your roms across your local and external storage
# prerequesites:
# - local roms must be stored in "/storage/roms_local"
# - external roms must be stored in "/storage/roms"
# - you cannot spread the same system files across multiple locations
# NOTE: if duplicate systems are found, local folders will take preference
LOCAL_FOLDER_NAME="roms_local"
EXT_FOLDER_NAME="roms"
LOCAL_ROM_FOLDERS=$(
ls -d ${LOCAL_FOLDER_NAME}/*/ |
sed -e "s/${LOCAL_FOLDER_NAME}//g"
)
EXT_ROM_FOLDERS=$(
ls -d ${EXT_FOLDER_NAME}/*/ |
sed -e "s/${EXT_FOLDER_NAME}//g"
)
ES_SYSTEMS="/storage/.emulationstation/es_systems.cfg"
ES_LIST=$(
cat ${ES_SYSTEMS} |
grep "<path>" |
sed -e "s/<path>//g" -e "s/<\/path>//g" -e "s/\/storage\///g"
)
echo "LOCAL_FOLDER_NAME: ${LOCAL_FOLDER_NAME}"
echo "EXT_FOLDER_NAME: ${EXT_FOLDER_NAME}"
echo "EXT_STORAGE: ${EXT_STORAGE}"
echo "EXTERNAL: ${EXTERNAL}"
echo "LOCAL_ROM_FOLDERS: $LOCAL_ROM_FOLDERS{}"
echo "EXT_ROM_FOLDERS: ${EXT_ROM_FOLDERS}"
echo "ES_SYSTEMS: ${ES_SYSTEMS}"
echo "ES_LIST: ${ES_LIST}"
# required paramaters: local/external, rom folder list, es folder list
update_es_folders() {
folder_name=${LOCAL_FOLDER_NAME}
orig_folder_name=${EXT_FOLDER_NAME}
if [[ $1 == "external" ]]
then
folder_name=${EXT_FOLDER_NAME}
orig_folder_name=${LOCAL_FOLDER_NAME}
fi
folder_array=( $2 )
for folder in ${folder_array[@]}
do
system=${folder%?}
# check that the system exists in ES
if [[ $3 == *"${system}"* ]]
then
# skip if there are no files in the folder
if [ -z "$(ls -A /storage/${folder_name}${system})" ]
then
continue
fi
# if the folder doesn't exist in ES, update the original
if [[ $3 != *"${folder_name}${system}"* ]]
then
sed -i -e "s|<path>/storage/${orig_folder_name}${system}</path>|<path>/storage/${folder_name}${system}</path>|g" ${ES_SYSTEMS}
fi
fi
done
}
# check the external folders first
update_es_folders "external" "${EXT_ROM_FOLDERS}" "${ES_LIST}"
# next check the local folders
# if there are duplicate folders in EXTERNAL, LOCAL ones will take preference
update_es_folders "local" "${LOCAL_ROM_FOLDERS}" "${ES_LIST}"

View file

@ -52,6 +52,9 @@ declare -a HAS_CHEEVOS=( arcade
atari7800
atarilynx
colecovision
cps1
cps2
cps3
dreamcast
famicom
fbn
@ -921,10 +924,14 @@ function set_gambatte() {
sed -i "/gambatte_gb_colorization =/d" ${GAMBATTECONF}
sed -i "/gambatte_gb_internal_palette =/d" ${GAMBATTECONF}
fi
local RENDERER=$(game_setting renderer.colorization)
if [ -n "${RENDERER}" ]
local COLORIZATION=$(game_setting renderer.colorization)
local TWB1_COLORIZATION=$(game_setting renderer.twb1_colorization)
local TWB2_COLORIZATION=$(game_setting renderer.twb2_colorization)
local PIXELSHIFT1_COLORIZATION=$(game_setting renderer.pixelshift1_colorization)
if [ -n "${COLORIZATION}" ]
then
case ${RENDERER} in
case ${COLORIZATION} in
0|false|none)
echo 'gambatte_gb_colorization = "disabled"' >> ${GAMBATTECONF}
;;
@ -932,11 +939,14 @@ function set_gambatte() {
echo 'gambatte_gb_colorization = "auto"' >> ${GAMBATTECONF}
;;
GBC|SGB)
echo 'gambatte_gb_colorization = "'${RENDERER}'"' >> ${GAMBATTECONF}
echo 'gambatte_gb_colorization = "'${COLORIZATION}'"' >> ${GAMBATTECONF}
;;
*)
echo 'gambatte_gb_colorization = "internal"' >> ${GAMBATTECONF}
echo 'gambatte_gb_internal_palette = "'${RENDERER}'"' >> ${GAMBATTECONF}
echo 'gambatte_gb_internal_palette = "'${COLORIZATION}'"' >> ${GAMBATTECONF}
echo 'gambatte_gb_palette_twb64_1 = "'${TWB1_COLORIZATION}'"' >> ${GAMBATTECONF}
echo 'gambatte_gb_palette_twb64_2 = "'${TWB2_COLORIZATION}'"' >> ${GAMBATTECONF}
echo 'gambatte_gb_palette_pixelshift_1 = "'${PIXELSHIFT1_COLORIZATION}'"' >> ${GAMBATTECONF}
;;
esac
fi

View file

@ -20,4 +20,4 @@ ath9k_htc/*
brcm/*
rtl_bt/*
rtlwifi/*
rtw89/*
rtw*/*

View file

@ -4,7 +4,7 @@
PKG_NAME="linux"
PKG_LICENSE="GPL"
PKG_VERSION="6.6.2"
PKG_VERSION="6.6.3"
PKG_URL="https://www.kernel.org/pub/linux/kernel/v6.x/${PKG_NAME}-${PKG_VERSION}.tar.xz"
PKG_SITE="http://www.kernel.org"
PKG_DEPENDS_HOST="ccache:host rsync:host openssl:host"

View file

@ -0,0 +1,17 @@
diff -rupN linux.orig/drivers/gpu/drm/drm_panel_orientation_quirks.c linux/drivers/gpu/drm/drm_panel_orientation_quirks.c
--- linux.orig/drivers/gpu/drm/drm_panel_orientation_quirks.c 2023-11-28 17:20:18.000000000 +0000
+++ linux/drivers/gpu/drm/drm_panel_orientation_quirks.c 2023-11-30 15:33:54.949480402 +0000
@@ -336,6 +336,13 @@ static const struct dmi_system_id orient
DMI_EXACT_MATCH(DMI_PRODUCT_VERSION, "IdeaPad Duet 3 10IGL5"),
},
.driver_data = (void *)&lcd1200x1920_rightside_up,
+ }, { /* Lenovo Legion Go */
+ .matches = {
+ DMI_EXACT_MATCH(DMI_SYS_VENDOR, "LENOVO"),
+ DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "83E1"),
+ DMI_EXACT_MATCH(DMI_PRODUCT_VERSION, "Legion Go 8APU1"),
+ },
+ .driver_data = (void *)&lcd1600x2560_leftside_up,
}, { /* Lenovo Yoga Book X90F / X90L */
.matches = {
DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Intel Corporation"),

View file

@ -0,0 +1,46 @@
diff --git a/Makefile b/Makefile
--- a/Makefile
+++ b/Makefile
@@ -442,7 +442,7 @@ endif
HOSTPKG_CONFIG = pkg-config
KBUILD_USERHOSTCFLAGS := -Wall -Wmissing-prototypes -Wstrict-prototypes \
- -O2 -fomit-frame-pointer -std=gnu11
+ -O3 -fomit-frame-pointer -std=gnu11
KBUILD_USERCFLAGS := $(KBUILD_USERHOSTCFLAGS) $(USERCFLAGS)
KBUILD_USERLDFLAGS := $(USERLDFLAGS)
@@ -474,7 +474,7 @@ endif
-Wclippy::dbg_macro
KBUILD_HOSTCFLAGS := $(KBUILD_USERHOSTCFLAGS) $(HOST_LFS_CFLAGS) $(HOSTCFLAGS)
-KBUILD_HOSTCXXFLAGS := -Wall -O2 $(HOST_LFS_CFLAGS) $(HOSTCXXFLAGS)
+KBUILD_HOSTCXXFLAGS := -Wall -O3 $(HOST_LFS_CFLAGS) $(HOSTCXXFLAGS)
KBUILD_HOSTRUSTFLAGS := $(rust_common_flags) -O -Cstrip=debuginfo \
-Zallow-features= $(HOSTRUSTFLAGS)
KBUILD_HOSTLDFLAGS := $(HOST_LFS_LDFLAGS) $(HOSTLDFLAGS)
@@ -757,7 +757,7 @@ KBUILD_CFLAGS += $(call cc-disable-warning, format-overflow)
KBUILD_CFLAGS += $(call cc-disable-warning, address-of-packed-member)
ifdef CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE
-KBUILD_CFLAGS += -O2
+KBUILD_CFLAGS += -O3
KBUILD_RUSTFLAGS += -Copt-level=2
else ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
KBUILD_CFLAGS += -Os
diff --git a/init/Kconfig b/init/Kconfig
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -1401,10 +1401,10 @@ choice
default CC_OPTIMIZE_FOR_PERFORMANCE
config CC_OPTIMIZE_FOR_PERFORMANCE
- bool "Optimize for performance (-O2)"
+ bool "Optimize for performance (-O3)"
help
This is the default optimization level for the kernel, building
- with the "-O2" compiler flag for best performance and most
+ with the "-O3" compiler flag for best performance and most
helpful compile-time warnings.
config CC_OPTIMIZE_FOR_SIZE

View file

@ -0,0 +1 @@
options btusb reset=1

View file

@ -3,11 +3,11 @@
# Copyright (C) 2019-present Team LibreELEC (https://libreelec.tv)
PKG_NAME="bluez"
PKG_VERSION="5.68"
PKG_VERSION="5.70"
PKG_LICENSE="GPL"
PKG_SITE="http://www.bluez.org/"
PKG_URL="https://www.kernel.org/pub/linux/bluetooth/${PKG_NAME}-${PKG_VERSION}.tar.xz"
PKG_DEPENDS_TARGET="toolchain dbus glib readline systemd"
PKG_DEPENDS_TARGET="toolchain dbus glib readline systemd json-c alsa-lib"
PKG_LONGDESC="Bluetooth Tools and System Daemons for Linux."
PKG_TOOLCHAIN="autotools"
PKG_BUILD_FLAGS="+lto"
@ -37,6 +37,11 @@ PKG_CONFIGURE_OPTS_TARGET="--disable-dependency-tracking \
--enable-sap \
--enable-a2dp \
--enable-avrcp \
--enable-btpclient \
--enable-midi \
--enable-mesh \
--enable-hid2hci \
--enable-experimental \
--enable-hid \
--with-gnu-ld \
${BLUEZ_CONFIG} \
@ -60,6 +65,9 @@ post_makeinstall_target() {
safe_remove ${INSTALL}/usr/bin/ciptool
safe_remove ${INSTALL}/usr/share/dbus-1
mkdir -p ${INSTALL}/etc/dbus-1/system.d
cp src/bluetooth.conf ${INSTALL}/etc/dbus-1/system.d
mkdir -p ${INSTALL}/etc/bluetooth
cp src/main.conf ${INSTALL}/etc/bluetooth

View file

@ -0,0 +1,24 @@
diff --git a/src/main.conf b/src/main.conf
index 2796f155e..f7b032b9f 100644
--- a/src/main.conf
+++ b/src/main.conf
@@ -60,7 +60,7 @@
# or both Multiple Profiles Single Device (MPSD) and Multiple Profiles Multiple
# Devices (MPMD) configurations.
# Possible values: "off", "single", "multiple"
-#MultiProfile = off
+MultiProfile = multiple
# Permanently enables the Fast Connectable setting for adapters that
# support it. When enabled other devices can connect faster to us,
@@ -182,8 +182,8 @@
# LE scanning parameters used for passive scanning supporting wake from suspend
# scenarios
-#ScanIntervalSuspend=
-#ScanWindowSuspend=
+ScanIntervalSuspend=2240
+ScanWindowSuspend=224
# LE scanning parameters used for active scanning supporting discovery
# proceedure

View file

@ -1,40 +0,0 @@
diff --git a/src/main.conf b/src/main.conf
index d108934a8..f90820314 100644
--- a/src/main.conf
+++ b/src/main.conf
@@ -60,7 +60,7 @@
# or both Multiple Profiles Single Device (MPSD) and Multiple Profiles Multiple
# Devices (MPMD) configurations.
# Possible values: "off", "single", "multiple"
-#MultiProfile = off
+MultiProfile = multiple
# Permanently enables the Fast Connectable setting for adapters that
# support it. When enabled other devices can connect faster to us,
@@ -100,7 +100,7 @@
# Specify the policy to the JUST-WORKS repairing initiated by peer
# Possible values: "never", "confirm", "always"
# Defaults to "never"
-#JustWorksRepairing = never
+JustWorksRepairing = always
# How long to keep temporary devices around
# The value is in seconds. Default is 30.
@@ -109,7 +109,7 @@
# Enables the device to issue an SDP request to update known services when
# profile is connected. Defaults to true.
-#RefreshDiscovery = true
+RefreshDiscovery = true
# Default Secure Connections setting.
# Enables the Secure Connections setting for adapters that support it. It
@@ -318,7 +318,7 @@
# AutoEnable defines option to enable all controllers when they are found.
# This includes adapters present on start as well as adapters that are plugged
# in later on. Defaults to 'true'.
-#AutoEnable=true
+AutoEnable=true
# Audio devices that were disconnected due to suspend will be reconnected on
# resume. ResumeDelay determines the delay between when the controller

View file

@ -1,29 +0,0 @@
From aa73bf5039dfd2cf0a52dd6fd22501d955cc1a00 Mon Sep 17 00:00:00 2001
From: Tommy <mesilliac@gmail.com>
Date: Thu, 10 Jan 2013 09:18:43 +0100
Subject: [PATCH] work around Logitech diNovo Edge keyboard firmware issue
https://bugs.launchpad.net/ubuntu/+source/bluez/+bug/269851
---
tools/hid2hci.rules | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/tools/hid2hci.rules b/tools/hid2hci.rules
index db6bb03..7db4572 100644
--- a/tools/hid2hci.rules
+++ b/tools/hid2hci.rules
@@ -11,7 +11,10 @@ ATTR{bInterfaceClass}=="03", ATTR{bInterfaceSubClass}=="01", ATTR{bInterfaceProt
RUN+="hid2hci --method=dell --devpath=%p", ENV{HID2HCI_SWITCH}="1"
# Logitech devices
-KERNEL=="hiddev*", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c70[345abce]|c71[34bc]", \
+KERNEL=="hiddev*", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c70[345abce]|c71[3bc]", \
+ RUN+="hid2hci --method=logitech-hid --devpath=%p"
+# Logitech, Inc. diNovo Edge Keyboard
+KERNEL=="hidraw*", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c714", \
RUN+="hid2hci --method=logitech-hid --devpath=%p"
ENV{DEVTYPE}!="usb_device", GOTO="hid2hci_end"
--
1.8.0.1

View file

@ -1,26 +0,0 @@
From 50f34d1b65c2fb6c557e2b802e908986e8ec0b74 Mon Sep 17 00:00:00 2001
From: Stefan Saraev <stefan@saraev.ca>
Date: Fri, 7 Feb 2014 12:50:29 +0200
Subject: [PATCH] 046d:c52b Logitech, Inc. Unifying Receiver
---
tools/hid2hci.rules | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/tools/hid2hci.rules b/tools/hid2hci.rules
index 7db4572..1feca6e 100644
--- a/tools/hid2hci.rules
+++ b/tools/hid2hci.rules
@@ -16,6 +16,9 @@ KERNEL=="hiddev*", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c70[345abce]|c71[
# Logitech, Inc. diNovo Edge Keyboard
KERNEL=="hidraw*", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c714", \
RUN+="hid2hci --method=logitech-hid --devpath=%p"
+# Logitech, Inc. Unifying Receiver
+KERNEL=="hidraw*", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c52b", \
+ RUN+="hid2hci --method=logitech-hid --devpath=%p"
ENV{DEVTYPE}!="usb_device", GOTO="hid2hci_end"
--
1.7.2.5

View file

@ -0,0 +1,246 @@
From d1ef0be0d84b909a88dccf28af52d5a1c0e49992 Mon Sep 17 00:00:00 2001
From: Vicki Pfau <vi@endrift.com>
Date: Fri, 8 Sep 2023 16:53:02 -0700
Subject: [PATCH 2/2] Experimental patch to enable alternate Bluetooth
connection modes
This should improve Bluetooth connectivity, especially with multiple controllers and while docked.
Testing:
sudo btmgmt
[mgmt]# phy
Verify that LE2MRX, LE2MTX, LECODEDRX, LECODEDTX are in the selected phys list.
Verify that multiple controllers can connect and work well.
Co-Authored-By: Rachel Blackman <rachel.blackman@synapse.com>
---
src/adapter.c | 46 ++++++++++++++++++++++++++++
src/btd.h | 2 ++
src/main.c | 85 +++++++++++++++++++++++++++++++++++++++++++++++++++
src/main.conf | 5 +++
4 files changed, 138 insertions(+)
diff --git a/src/adapter.c b/src/adapter.c
index 5ebfc4752..bc1e1d418 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -86,6 +86,18 @@
#define DISTANCE_VAL_INVALID 0x7FFF
#define PATHLOSS_MAX 137
+#define LE_PHY_1M 0x01
+#define LE_PHY_2M 0x02
+#define LE_PHY_CODED 0x04
+
+#define PHYVAL_REQUIRED 0x07ff
+#define PHYVAL_1M_TX (1<<9)
+#define PHYVAL_1M_RX (1<<10)
+#define PHYVAL_2M_TX (1<<11)
+#define PHYVAL_2M_RX (1<<12)
+#define PHYVAL_CODED_TX (1<<13)
+#define PHYVAL_CODED_RX (1<<14)
+
/*
* These are known security keys that have been compromised.
* If this grows or there are needs to be platform specific, it is
@@ -844,6 +856,36 @@ static bool set_discoverable(struct btd_adapter *adapter, uint8_t mode,
return false;
}
+static void set_phy_support_complete(uint8_t status, uint16_t length,
+ const void *param, void *user_data)
+{
+ if (status != 0) {
+ struct btd_adapter *adapter = (struct btd_adapter *)user_data;
+
+ btd_error(adapter->dev_id, "PHY setting rejected for %u: %s",
+ adapter->dev_id, mgmt_errstr(status));
+ }
+}
+
+static bool set_phy_support(struct btd_adapter *adapter, uint32_t phy_mask)
+{
+ struct mgmt_cp_set_phy_confguration cp;
+
+ memset(&cp, 0, sizeof(cp));
+ cp.selected_phys = cpu_to_le32(phy_mask | PHYVAL_REQUIRED);
+
+ if (mgmt_send(adapter->mgmt, MGMT_OP_SET_PHY_CONFIGURATION,
+ adapter->dev_id, sizeof(cp), &cp,
+ set_phy_support_complete, (void*)adapter, NULL) > 0)
+ return true;
+
+ btd_error(adapter->dev_id, "Failed to set PHY for index %u",
+ adapter->dev_id);
+
+ return false;
+
+}
+
static bool pairable_timeout_handler(gpointer user_data)
{
struct btd_adapter *adapter = user_data;
@@ -10387,6 +10429,10 @@ static void read_info_complete(uint8_t status, uint16_t length,
if (btd_adapter_get_powered(adapter))
adapter_start(adapter);
+ // Some adapters do not want to accept this before being started/powered.
+ if (btd_opts.phys > 0)
+ set_phy_support(adapter, btd_opts.phys);
+
return;
failed:
diff --git a/src/btd.h b/src/btd.h
index b7e7ebd61..2b84f7a51 100644
--- a/src/btd.h
+++ b/src/btd.h
@@ -151,6 +151,8 @@ struct btd_opts {
struct btd_advmon_opts advmon;
struct btd_csis csis;
+
+ uint32_t phys;
};
extern struct btd_opts btd_opts;
diff --git a/src/main.c b/src/main.c
index 2134fcf75..700c83c78 100644
--- a/src/main.c
+++ b/src/main.c
@@ -127,6 +127,7 @@ static const char *le_options[] = {
"AdvMonAllowlistScanDuration",
"AdvMonNoFilterScanDuration",
"EnableAdvMonInterleaveScan",
+ "SupportedPHYs",
NULL
};
@@ -180,10 +181,32 @@ static const struct group_table {
{ }
};
+static const char *conf_phys_str[] = {
+ "BR1M1SLOT",
+ "BR1M3SLOT",
+ "BR1M5SLOT",
+ "EDR2M1SLOT",
+ "EDR2M3SLOT",
+ "EDR2M5SLOT",
+ "EDR3M1SLOT",
+ "EDR3M3SLOT",
+ "EDR3M5SLOT",
+ "LE1MTX",
+ "LE1MRX",
+ "LE2MTX",
+ "LE2MRX",
+ "LECODEDTX",
+ "LECODEDRX",
+};
+
#ifndef MIN
#define MIN(x, y) ((x) < (y) ? (x) : (y))
#endif
+#ifndef NELEM
+#define NELEM(x) (sizeof(x) / sizeof((x)[0]))
+#endif
+
static int8_t check_sirk_alpha_numeric(char *str)
{
int8_t val = 0;
@@ -224,6 +247,54 @@ static size_t hex2bin(const char *hexstr, uint8_t *buf, size_t buflen)
return len;
}
+static const char *conf_phys2str(uint32_t phys)
+{
+ static char str[256];
+ unsigned int i;
+ int off;
+
+ off = 0;
+ str[0] = '\0';
+
+ for (i = 0; i < NELEM(conf_phys_str); i++) {
+ if ((phys & (1 << i)) != 0)
+ off += snprintf(str + off, sizeof(str) - off, "%s ",
+ conf_phys_str[i]);
+ }
+
+ return str;
+}
+
+static bool str2phy(const char *phy_str, uint32_t *phy_val)
+{
+ unsigned int i;
+
+ for (i = 0; i < NELEM(conf_phys_str); i++) {
+ if (strcasecmp(conf_phys_str[i], phy_str) == 0) {
+ *phy_val = (1 << i);
+ return true;
+ }
+ }
+
+ return false;
+}
+
+static void btd_parse_phy_list(char **list)
+{
+ uint32_t phys = 0;
+
+ for (int i = 0; list[i]; i++) {
+ uint32_t phy_val;
+
+ info("Enabling PHY option: %s", list[i]);
+
+ if (str2phy(list[i], &phy_val))
+ phys |= phy_val;
+ }
+
+ btd_opts.phys = phys;
+}
+
GKeyFile *btd_get_main_conf(void)
{
return main_conf;
@@ -674,6 +745,20 @@ static void parse_le_config(GKeyFile *config)
return;
parse_mode_config(config, "LE", params, ARRAY_SIZE(params));
+
+ char **strlist;
+ GError *err = NULL;
+ strlist = g_key_file_get_string_list(config, "LE",
+ "SupportedPHYs",
+ NULL, &err);
+ if (err) {
+ DBG("%s", err->message);
+ g_clear_error(&err);
+ }
+ else {
+ btd_parse_phy_list(strlist);
+ g_strfreev(strlist);
+ }
}
static bool match_experimental(const void *data, const void *match_data)
diff --git a/src/main.conf b/src/main.conf
index cb9b241df..c086a17d0 100644
--- a/src/main.conf
+++ b/src/main.conf
@@ -231,6 +231,11 @@ MultiProfile = multiple
# Defaults to 1
#EnableAdvMonInterleaveScan=
+# Which Bluetooth LE PHYs should be enabled/supported?
+# Options are LE1MTX LE1MRX LE2MTX LE2MRX LECODEDTX LECODEDRX
+# Defaults to LE1MTX,LE1MRX
+SupportedPHYs=LE1MTX,LE1MRX,LE2MTX,LE2MRX,LECODEDTX,LECODEDRX
+
[GATT]
# GATT attribute cache.
# Possible values:
--
2.41.0

View file

@ -0,0 +1,15 @@
diff -ru bluez-5.66.orig/profiles/audio/avrcp.c bluez-5.66/profiles/audio/avrcp.c
--- bluez-5.66.orig/profiles/audio/avrcp.c 2022-03-16 08:06:20.000000000 -0700
+++ bluez-5.66/profiles/audio/avrcp.c 2023-07-30 08:03:17.414213611 -0700
@@ -1210,6 +1210,10 @@
GUINT_TO_POINTER(str_to_metadata(key)));
}
+ if (attrs == NULL)
+ return g_list_prepend(NULL,
+ GUINT_TO_POINTER(AVRCP_MEDIA_ATTRIBUTE_TITLE));
+
return attrs;
}
Only in bluez-5.66/profiles/audio: avrcp.c.orig

View file

@ -1,156 +0,0 @@
Description: Patches for compatibility with on-board Bluetooth on RPi 3
Author: Simon Long <simon@raspberrypi.org>
Last-Update: 2017-04-05
--- a/tools/hciattach.c
+++ b/tools/hciattach.c
@@ -1091,6 +1091,9 @@
{ "bcm43xx", 0x0000, 0x0000, HCI_UART_H4, 115200, 3000000,
FLOW_CTL, DISABLE_PM, NULL, bcm43xx, NULL },
+ { "bcm43xx-3wire", 0x0000, 0x0000, HCI_UART_3WIRE, 115200, 3000000,
+ 0, DISABLE_PM, NULL, bcm43xx, NULL },
+
{ "ath3k", 0x0000, 0x0000, HCI_UART_ATH3K, 115200, 115200,
FLOW_CTL, DISABLE_PM, NULL, ath3k_ps, ath3k_pm },
@@ -1237,7 +1240,7 @@
{
struct uart_t *u = NULL;
int detach, printpid, raw, opt, i, n, ld, err;
- int to = 10;
+ int to = 30;
int init_speed = 0;
int send_break = 0;
pid_t pid;
--- a/tools/hciattach.h
+++ b/tools/hciattach.h
@@ -44,7 +45,7 @@
#define HCI_UART_VND_DETECT 5
#ifndef FIRMWARE_DIR
-#define FIRMWARE_DIR "/etc/firmware"
+#define FIRMWARE_DIR "/lib/firmware"
#endif
int read_hci_event(int fd, unsigned char *buf, int size);
--- a/tools/hciattach_bcm43xx.c
+++ b/tools/hciattach_bcm43xx.c
@@ -36,6 +36,7 @@
#include <dirent.h>
#include <time.h>
#include <limits.h>
+#include <sys/stat.h>
#include "lib/bluetooth.h"
#include "lib/hci.h"
@@ -303,9 +304,23 @@
static int bcm43xx_locate_patch(const char *dir_name,
const char *chip_name, char *location)
{
+ struct stat statbuf;
+ char path[PATH_MAX];
DIR *dir;
int ret = -1;
+ /* Try an exact match before scanning, otherwise a board without a specific
+ * firmware/link may end up loading a specific firmware for another board
+ * just because it is encountered first.
+ */
+ if (snprintf(path, PATH_MAX, "%s/%s%s", dir_name, chip_name, FW_EXT) < 0)
+ return -1;
+ if ((stat(path, &statbuf) == 0) && S_ISREG(statbuf.st_mode)) {
+ strcpy(location, path);
+ return 0;
+ }
+
+ /* Now search subdirectories and files with suffixes */
dir = opendir(dir_name);
if (!dir) {
fprintf(stderr, "Cannot open directory '%s': %s\n",
@@ -320,8 +335,6 @@
break;
if (entry->d_type & DT_DIR) {
- char path[PATH_MAX];
-
if (!strcmp(entry->d_name, "..") || !strcmp(entry->d_name, "."))
continue;
@@ -341,8 +354,10 @@
break;
/* found */
- snprintf(location, PATH_MAX, "%s/%s", dir_name, entry->d_name);
- ret = 0;
+ if (snprintf(location, PATH_MAX, "%s/%s", dir_name, entry->d_name) < 0)
+ ret = -1;
+ else
+ ret = 0;
break;
}
}
@@ -352,11 +367,32 @@
return ret;
}
+static int get_board_type(char *buf, int buf_size)
+{
+ int bytes_read;
+ int len;
+ int fd;
+
+ fd = open("/sys/firmware/devicetree/base/compatible", O_RDONLY);
+ if (fd < 0)
+ return -1;
+
+ bytes_read = read(fd, buf, buf_size);
+ close(fd);
+ if (bytes_read < 0)
+ return -1;
+
+ len = strnlen(buf, buf_size);
+ return (len < buf_size) ? len : -1;
+}
+
int bcm43xx_init(int fd, int def_speed, int speed, struct termios *ti,
const char *bdaddr)
{
char chip_name[20];
+ char board_specific_name[sizeof(chip_name) + 64];
char fw_path[PATH_MAX];
+ int chip_name_len;
printf("bcm43xx_init\n");
@@ -366,12 +402,17 @@
if (bcm43xx_read_local_name(fd, chip_name, sizeof(chip_name)))
return -1;
- if (bcm43xx_locate_patch(FIRMWARE_DIR, chip_name, fw_path)) {
- fprintf(stderr, "Patch not found, continue anyway\n");
+ /* Grab the board compatible string from Device Tree */
+ chip_name_len = strlen(chip_name);
+ memcpy(board_specific_name, chip_name, chip_name_len);
+ board_specific_name[chip_name_len++] = '.';
+
+ if (((get_board_type(board_specific_name + chip_name_len,
+ sizeof(board_specific_name) - chip_name_len) < 0) ||
+ bcm43xx_locate_patch(FIRMWARE_DIR, board_specific_name, fw_path)) &&
+ bcm43xx_locate_patch(FIRMWARE_DIR, chip_name, fw_path)) {
+ fprintf(stderr, "Patch not found for %s, continue anyway\n", chip_name);
} else {
- if (bcm43xx_set_speed(fd, ti, speed))
- return -1;
-
if (bcm43xx_load_firmware(fd, fw_path))
return -1;
@@ -381,6 +422,7 @@
return -1;
}
+ sleep(1);
if (bcm43xx_reset(fd))
return -1;
}

View file

@ -1,61 +0,0 @@
From 57f7aead147b138109709bbef9d4c674a3a6dc9b Mon Sep 17 00:00:00 2001
From: meijjaa <jjmeijer88@gmail.com>
Date: Mon, 23 Jan 2017 22:35:33 +0100
Subject: [PATCH] hciattach: retry device reset when no response
Some bcm chips need a couple of retries to reset. Currently init will just
timeout after a failed reset.
Signed-off-by: meijjaa <jjmeijer88@gmail.com>
---
tools/hciattach_bcm43xx.c | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/tools/hciattach_bcm43xx.c b/tools/hciattach_bcm43xx.c
index bb24483..ad89161 100644
--- a/tools/hciattach_bcm43xx.c
+++ b/tools/hciattach_bcm43xx.c
@@ -24,6 +24,7 @@
#include <time.h>
#include <limits.h>
#include <sys/stat.h>
+#include <signal.h>
#include "lib/bluetooth.h"
#include "lib/hci.h"
@@ -82,21 +83,31 @@ fail:
return -1;
}
+int _fd;
+void expired(int sig)
+{
+ unsigned char cmd[] = { HCI_COMMAND_PKT, 0x03, 0x0C, 0x00 };
+ write(_fd, cmd, sizeof(cmd)) != sizeof(cmd);
+ alarm(4);
+}
+
static int bcm43xx_reset(int fd)
{
unsigned char cmd[] = { HCI_COMMAND_PKT, 0x03, 0x0C, 0x00 };
unsigned char resp[CC_MIN_SIZE];
+ _fd = fd;
+ signal(SIGALRM, expired);
if (write(fd, cmd, sizeof(cmd)) != sizeof(cmd)) {
fprintf(stderr, "Failed to write reset command\n");
return -1;
}
-
+ alarm(4);
if (read_hci_event(fd, resp, sizeof(resp)) < CC_MIN_SIZE) {
fprintf(stderr, "Failed to reset chip, invalid HCI event\n");
return -1;
}
-
+ alarm(0);
if (resp[4] != cmd[1] || resp[5] != cmd[2] || resp[6] != CMD_SUCCESS) {
fprintf(stderr, "Failed to reset chip, command failure\n");
return -1;
--
2.38.1

View file

@ -1,57 +0,0 @@
From ccc0a0cba8a2fdb8cfb148276e7c9413a3e22dc8 Mon Sep 17 00:00:00 2001
From: MilhouseVH <milhouseVH.github@nmacleod.com>
Date: Thu, 19 Sep 2019 22:48:19 +0100
Subject: [PATCH] sixaxis: Fix PID for Navigation Controller
Newsgroups: gmane.linux.bluez.kernel
Date: 2015-06-15 18:28:26 GMT (36 weeks, 4 days, 21 hours and 32 minutes ago)
Navigation Controller is using PID 0x042f over USB but PID 0x0268
(same as Dualshock 3) over BT.
---
plugins/sixaxis.c | 8 +++++++-
profiles/input/sixaxis.h | 2 ++
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/plugins/sixaxis.c b/plugins/sixaxis.c
index 939fed7..f6baea7 100644
--- a/plugins/sixaxis.c
+++ b/plugins/sixaxis.c
@@ -364,7 +364,13 @@ static bool setup_device(int fd, const char *sysfs_path,
info("sixaxis: setting up new device");
btd_device_device_set_name(device, cp->name);
- btd_device_set_pnpid(device, cp->source, cp->vid, cp->pid, cp->version);
+
+ /* if device reports different pid/vid on BT prefer those over USB */
+ if (cp->bt_pid)
+ btd_device_set_pnpid(device, cp->source, cp->vid, cp->bt_pid, cp->version);
+ else
+ btd_device_set_pnpid(device, cp->source, cp->vid, cp->pid, cp->version);
+
btd_device_set_temporary(device, true);
closure = g_new0(struct authentication_closure, 1);
diff --git a/profiles/input/sixaxis.h b/profiles/input/sixaxis.h
index 8e6f3cc..321a918 100644
--- a/profiles/input/sixaxis.h
+++ b/profiles/input/sixaxis.h
@@ -38,6 +38,7 @@ struct cable_pairing {
uint16_t vid;
uint16_t pid;
uint16_t version;
+ uint16_t bt_pid;
CablePairingType type;
};
@@ -59,6 +60,7 @@ get_pairing(uint16_t vid, uint16_t pid)
.vid = 0x054c,
.pid = 0x042f,
.version = 0x0000,
+ .bt_pid = 0x0268,
.type = CABLE_PAIRING_SIXAXIS,
},
{
--
2.7.4

View file

@ -1,34 +0,0 @@
From 124187ef9abed60a7c40f751153e9c4516cd1f91 Mon Sep 17 00:00:00 2001
From: Rudi Heitbaum <rudi@heitbaum.com>
Date: Sat, 1 Jul 2023 01:31:20 +0000
Subject: [PATCH] configure: Check ell path
Use of AC_CHECK_FILE prevents cross compilation.
Instead use test to support cross compiling.
Signed-off-by: Rudi Heitbaum <rudi@heitbaum.com>
---
configure.ac | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/configure.ac b/configure.ac
index eff297960..bc7edfcd3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -298,9 +298,10 @@ if (test "${enable_external_ell}" = "yes"); then
AC_SUBST(ELL_LIBS)
fi
if (test "${enable_external_ell}" != "yes"); then
- AC_CHECK_FILE(${srcdir}/ell/ell.h, dummy=yes,
- AC_CHECK_FILE(${srcdir}/../ell/ell/ell.h, dummy=yes,
- AC_MSG_ERROR(ELL source is required or use --enable-external-ell)))
+ if (test ! -f ${srcdir}/ell/ell.h) &&
+ (test ! -f ${srcdir}/../ell/ell/ell.h); then
+ AC_MSG_ERROR(ELL source is required or use --enable-external-ell)
+ fi
fi
AM_CONDITIONAL(EXTERNAL_ELL, test "${enable_external_ell}" = "yes" ||
(test "${enable_btpclient}" != "yes" &&
--
2.34.1

View file

@ -1,962 +0,0 @@
From 8db209b20b58ce1915b1366d29ae85c79dc1c4ea Mon Sep 17 00:00:00 2001
From: Peter Vicman <peter.vicman@gmail.com>
Date: Tue, 28 Jun 2022 10:10:12 +0200
Subject: [PATCH] Add support for sprd type in hciattach
/usr/bin/hciattach -s 1500000 /dev/ttyBT0 sprd
hciattach_sprd.c file come from
https://github.com/orangepi-xunlong/orangepi-build/commit/cbface3801e14c3f99cdabb53f57a0baff4319a1
https://github.com/orangepi-xunlong/orangepi-build/blob/main/external/cache/sources/hcitools/hciattach_sprd.c
BT_CONFIG_PATH changed to "/lib/firmware/unisoc"
---
Makefile.tools | 3 +-
tools/hciattach.c | 30 +-
tools/hciattach.h | 18 +
tools/hciattach_sprd.c | 832 +++++++++++++++++++++++++++++++++++++++++
4 files changed, 868 insertions(+), 15 deletions(-)
create mode 100644 tools/hciattach_sprd.c
diff --git a/Makefile.tools b/Makefile.tools
index 4b513366f..1842e6285 100644
--- a/Makefile.tools
+++ b/Makefile.tools
@@ -378,7 +378,8 @@ tools_hciattach_SOURCES = tools/hciattach.c tools/hciattach.h \
tools/hciattach_ath3k.c \
tools/hciattach_qualcomm.c \
tools/hciattach_intel.c \
- tools/hciattach_bcm43xx.c
+ tools/hciattach_bcm43xx.c \
+ tools/hciattach_sprd.c
tools_hciattach_LDADD = lib/libbluetooth-internal.la
tools_hciconfig_SOURCES = tools/hciconfig.c
diff --git a/tools/hciattach.c b/tools/hciattach.c
index 276a4e56e..a3267a962 100644
--- a/tools/hciattach.c
+++ b/tools/hciattach.c
@@ -38,20 +38,6 @@
#include "hciattach.h"
-struct uart_t {
- char *type;
- int m_id;
- int p_id;
- int proto;
- int init_speed;
- int speed;
- int flags;
- int pm;
- char *bdaddr;
- int (*init) (int fd, struct uart_t *u, struct termios *ti);
- int (*post) (int fd, struct uart_t *u, struct termios *ti);
-};
-
#define FLOW_CTL 0x0001
#define AMP_DEV 0x0002
#define ENABLE_PM 1
@@ -266,6 +252,19 @@ static int bcm43xx(int fd, struct uart_t *u, struct termios *ti)
return bcm43xx_init(fd, u->init_speed, u->speed, ti, u->bdaddr);
}
+/* add sprd init and post function */
+static int sprd_init(int fd, struct uart_t *u, struct termios *ti)
+{
+ fprintf(stderr, "SPRD Bluetooth init uart with init speed:%d, final_speed:%d, type:HCI UART %s\n", u->init_speed, u->speed, (u->proto == HCI_UART_H4)? "H4":"H5" );
+ return sprd_config_init(fd, u, ti);
+}
+
+static int sprd_post(int fd, struct uart_t *u, struct termios *ti)
+{
+ fprintf(stderr, "SPRD Bluetooth post process\n");
+ return sprd_config_post(fd, u, ti);
+}
+
static int read_check(int fd, void *buf, int count)
{
int res;
@@ -1097,6 +1096,9 @@ struct uart_t uart[] = {
{ "amp", 0x0000, 0x0000, HCI_UART_H4, 115200, 115200,
AMP_DEV, DISABLE_PM, NULL, NULL, NULL },
+ /* Bluetooth chip (UWE5622)*/
+ { "sprd", 0x0000, 0x0000, NULL, 115200, 1500000,
+ FLOW_CTL, DISABLE_PM, NULL, sprd_init, sprd_post},
{ NULL, 0 }
};
diff --git a/tools/hciattach.h b/tools/hciattach.h
index 26c0d5424..69bc0ccef 100644
--- a/tools/hciattach.h
+++ b/tools/hciattach.h
@@ -40,6 +40,20 @@
#define HCI_UART_EXT_CONFIG 4
#define HCI_UART_VND_DETECT 5
+struct uart_t {
+ char *type;
+ int m_id;
+ int p_id;
+ int proto;
+ int init_speed;
+ int speed;
+ int flags;
+ int pm;
+ char *bdaddr;
+ int (*init) (int fd, struct uart_t *u, struct termios *ti);
+ int (*post) (int fd, struct uart_t *u, struct termios *ti);
+};
+
int read_hci_event(int fd, unsigned char *buf, int size);
int set_speed(int fd, struct termios *ti, int speed);
int uart_speed(int speed);
@@ -56,3 +70,7 @@ int qualcomm_init(int fd, int speed, struct termios *ti, const char *bdaddr);
int intel_init(int fd, int init_speed, int *speed, struct termios *ti);
int bcm43xx_init(int fd, int def_speed, int speed, struct termios *ti,
const char *bdaddr);
+
+/* add sprd init and post process for sprd Bluetooth chip (UWE5622) */
+int sprd_config_init(int fd, struct uart_t *u, struct termios *ti);
+int sprd_config_post(int fd, struct uart_t *u, struct termios *ti);
diff --git a/tools/hciattach_sprd.c b/tools/hciattach_sprd.c
new file mode 100644
index 000000000..12b4795de
--- /dev/null
+++ b/tools/hciattach_sprd.c
@@ -0,0 +1,832 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <string.h>
+#include <signal.h>
+#include <time.h>
+#include <stdint.h>
+#include <sys/termios.h>
+#include <sys/ioctl.h>
+#include <limits.h>
+#include "lib/bluetooth.h"
+#include "hciattach.h"
+
+/******************************************************************************
+** Constants & Macros
+******************************************************************************/
+#define LOG_STR "SPRD Bluetooth"
+#define DBG_ON 1
+
+#define SPRD_DBG(fmt, arg...) \
+ do { \
+ if (DBG_ON) \
+ fprintf(stderr, "%s: " fmt "\n" , LOG_STR, ##arg); \
+ } while(0)
+
+#define SPRD_ERR(fmt, arg...) \
+ do { \
+ fprintf(stderr, "%s ERROR: " fmt "\n", LOG_STR, ##arg);\
+ perror(LOG_STR" ERROR reason"); \
+ } while(0)
+
+#define SPRD_DUMP(buffer, len) \
+ fprintf(stderr, "%s: ", LOG_STR); \
+ do { \
+ int i = 0; \
+ for (i = 0; i < len; i++) { \
+ if (i && !(i % 16)) { \
+ fprintf(stderr, "\n"); \
+ fprintf(stderr, "%s: ", LOG_STR); \
+ } \
+ fprintf(stderr, "%02x ", buffer[i]); \
+ } \
+ fprintf(stderr, "\n"); \
+ } while (0)
+
+#define CONF_ITEM_TABLE(ITEM, ACTION, BUF, LEN) \
+ { #ITEM, ACTION, &(BUF.ITEM), LEN, (sizeof(BUF.ITEM) / LEN) }
+
+#define UINT8_TO_STREAM(p, u8) \
+ { *(p)++ = (uint8_t)(u8); }
+
+#define STREAM_TO_UINT8(u8, p) \
+ { \
+ (u8) = (uint8_t)(*(p)); \
+ (p) += 1; \
+ }
+
+#define UINT16_TO_STREAM(p, u16) \
+ { \
+ *(p)++ = (uint8_t)(u16); \
+ *(p)++ = (uint8_t)((u16) >> 8); \
+ }
+
+#define STREAM_TO_UINT16(u16, p) \
+ { \
+ (u16) = ((uint16_t)(*(p)) + (((uint16_t)(*((p) + 1))) << 8)); \
+ (p) += 2; \
+ }
+
+#define UINT32_TO_STREAM(p, u32) \
+ { \
+ *(p)++ = (uint8_t)(u32); \
+ *(p)++ = (uint8_t)((u32) >> 8); \
+ *(p)++ = (uint8_t)((u32) >> 16); \
+ *(p)++ = (uint8_t)((u32) >> 24); \
+ }
+
+#define CONF_COMMENT '#'
+#define CONF_DELIMITERS " =\n\r\t"
+#define CONF_VALUES_DELIMITERS "=\n\r\t#"
+#define CONF_VALUES_PARTITION " ,=\n\r\t#"
+#define CONF_MAX_LINE_LEN 255
+
+#define HCI_PSKEY 0xFCA0
+#define HCI_VSC_ENABLE_COMMMAND 0xFCA1
+#define HCI_RF_PARA 0xFCA2
+
+#define RESPONSE_LENGTH 100
+#define HCI_CMD_MAX_LEN 258
+#define HCI_EVT_CMD_CMPL_OPCODE 3
+#define HCI_PACKET_TYPE_COMMAND 1
+#define HCI_CMD_PREAMBLE_SIZE 3
+
+#define FW_NODE_BYTE 6
+#define FW_DATE_D_BYTE 8
+#define FW_DATE_M_BYTE 9
+#define FW_DATE_Y_BYTE 10
+
+//#define BT_CONFIG_PATH "/lib/firmware"
+#define BT_CONFIG_PATH "/lib/firmware/unisoc"
+#define BT_HC_HDR_SIZE (sizeof(HC_BT_HDR))
+#define BT_VND_OP_RESULT_SUCCESS 0
+#define BT_VND_OP_RESULT_FAIL 1
+#define MSG_STACK_TO_HC_HCI_CMD 0x2000
+#define START_STOP_CMD_SIZE 3
+#define DUAL_MODE 0
+#define DISABLE_BT 0
+#define ENABLE_BT 1
+
+typedef void (*hci_cback)(void *);
+typedef int (conf_action_t)(char *p_conf_name, char *p_conf_value, void *buf, int len, int size);
+
+typedef struct {
+ uint16_t event;
+ uint16_t len;
+ uint16_t offset;
+ uint16_t layer_specific;
+ uint8_t data[];
+} HC_BT_HDR;
+
+typedef struct {
+ uint32_t device_class;
+ uint8_t feature_set[16];
+ uint8_t device_addr[6];
+ uint16_t comp_id;
+ uint8_t g_sys_uart0_communication_supported;
+ uint8_t cp2_log_mode;
+ uint8_t LogLevel;
+ uint8_t g_central_or_perpheral;
+ uint16_t Log_BitMask;
+ uint8_t super_ssp_enable;
+ uint8_t common_rfu_b3;
+ uint32_t common_rfu_w[2];
+ uint32_t le_rfu_w[2];
+ uint32_t lmp_rfu_w[2];
+ uint32_t lc_rfu_w[2];
+ uint16_t g_wbs_nv_117;
+ uint16_t g_wbs_nv_118;
+ uint16_t g_nbv_nv_117;
+ uint16_t g_nbv_nv_118;
+ uint8_t g_sys_sco_transmit_mode;
+ uint8_t audio_rfu_b1;
+ uint8_t audio_rfu_b2;
+ uint8_t audio_rfu_b3;
+ uint32_t audio_rfu_w[2];
+ uint8_t g_sys_sleep_in_standby_supported;
+ uint8_t g_sys_sleep_master_supported;
+ uint8_t g_sys_sleep_slave_supported;
+ uint8_t power_rfu_b1;
+ uint32_t power_rfu_w[2];
+ uint32_t win_ext;
+ uint8_t edr_tx_edr_delay;
+ uint8_t edr_rx_edr_delay;
+ uint8_t tx_delay;
+ uint8_t rx_delay;
+ uint32_t bb_rfu_w[2];
+ uint8_t agc_mode;
+ uint8_t diff_or_eq;
+ uint8_t ramp_mode;
+ uint8_t modem_rfu_b1;
+ uint32_t modem_rfu_w[2];
+ uint32_t BQB_BitMask_1;
+ uint32_t BQB_BitMask_2;
+ uint16_t bt_coex_threshold[8];
+ uint32_t other_rfu_w[6];
+} pskey_config_t;
+
+typedef struct {
+ uint16_t g_GainValue_A[6];
+ uint16_t g_ClassicPowerValue_A[10];
+ uint16_t g_LEPowerValue_A[16];
+ uint16_t g_BRChannelpwrvalue_A[8];
+ uint16_t g_EDRChannelpwrvalue_A[8];
+ uint16_t g_LEChannelpwrvalue_A[8];
+ uint16_t g_GainValue_B[6];
+ uint16_t g_ClassicPowerValue_B[10];
+ uint16_t g_LEPowerValue_B[16];
+ uint16_t g_BRChannelpwrvalue_B[8];
+ uint16_t g_EDRChannelpwrvalue_B[8];
+ uint16_t g_LEChannelpwrvalue_B[8];
+ uint16_t LE_fix_powerword;
+ uint8_t Classic_pc_by_channel;
+ uint8_t LE_pc_by_channel;
+ uint8_t RF_switch_mode;
+ uint8_t Data_Capture_Mode;
+ uint8_t Analog_IQ_Debug_Mode;
+ uint8_t RF_common_rfu_b3;
+ uint32_t RF_common_rfu_w[5];
+} rf_config_t;
+
+typedef struct {
+ const char *conf_entry;
+ conf_action_t *p_action;
+ void *buf;
+ int len;
+ int size;
+} conf_entry_t;
+
+static uint8_t local_bdaddr[6]={0x10, 0x11, 0x12, 0x13, 0x14, 0x15};
+static pskey_config_t marlin3_pskey;
+static rf_config_t marlin3_rf_config;
+static int s_bt_fd = -1;
+
+static const conf_entry_t marlin3_pksey_table[] = {
+ CONF_ITEM_TABLE(device_class, 0, marlin3_pskey, 1),
+ CONF_ITEM_TABLE(feature_set, 0, marlin3_pskey, 16),
+ CONF_ITEM_TABLE(device_addr, 0, marlin3_pskey, 6),
+ CONF_ITEM_TABLE(comp_id, 0, marlin3_pskey, 1),
+ CONF_ITEM_TABLE(g_sys_uart0_communication_supported, 0, marlin3_pskey, 1),
+ CONF_ITEM_TABLE(cp2_log_mode, 0, marlin3_pskey, 1),
+ CONF_ITEM_TABLE(LogLevel, 0, marlin3_pskey, 1),
+ CONF_ITEM_TABLE(g_central_or_perpheral, 0, marlin3_pskey, 1),
+ CONF_ITEM_TABLE(Log_BitMask, 0, marlin3_pskey, 1),
+ CONF_ITEM_TABLE(super_ssp_enable, 0, marlin3_pskey, 1),
+ CONF_ITEM_TABLE(common_rfu_b3, 0, marlin3_pskey, 1),
+ CONF_ITEM_TABLE(common_rfu_w, 0, marlin3_pskey, 2),
+ CONF_ITEM_TABLE(le_rfu_w, 0, marlin3_pskey, 2),
+ CONF_ITEM_TABLE(lmp_rfu_w, 0, marlin3_pskey, 2),
+ CONF_ITEM_TABLE(lc_rfu_w, 0, marlin3_pskey, 2),
+ CONF_ITEM_TABLE(g_wbs_nv_117, 0, marlin3_pskey, 1),
+ CONF_ITEM_TABLE(g_wbs_nv_118, 0, marlin3_pskey, 1),
+ CONF_ITEM_TABLE(g_nbv_nv_117, 0, marlin3_pskey, 1),
+ CONF_ITEM_TABLE(g_nbv_nv_118, 0, marlin3_pskey, 1),
+ CONF_ITEM_TABLE(g_sys_sco_transmit_mode, 0, marlin3_pskey, 1),
+ CONF_ITEM_TABLE(audio_rfu_b1, 0, marlin3_pskey, 1),
+ CONF_ITEM_TABLE(audio_rfu_b2, 0, marlin3_pskey, 1),
+ CONF_ITEM_TABLE(audio_rfu_b3, 0, marlin3_pskey, 1),
+ CONF_ITEM_TABLE(audio_rfu_w, 0, marlin3_pskey, 2),
+ CONF_ITEM_TABLE(g_sys_sleep_in_standby_supported, 0, marlin3_pskey, 1),
+ CONF_ITEM_TABLE(g_sys_sleep_master_supported, 0, marlin3_pskey, 1),
+ CONF_ITEM_TABLE(g_sys_sleep_slave_supported, 0, marlin3_pskey, 1),
+ CONF_ITEM_TABLE(power_rfu_b1, 0, marlin3_pskey, 1),
+ CONF_ITEM_TABLE(power_rfu_w, 0, marlin3_pskey, 2),
+ CONF_ITEM_TABLE(win_ext, 0, marlin3_pskey, 1),
+ CONF_ITEM_TABLE(edr_tx_edr_delay, 0, marlin3_pskey, 1),
+ CONF_ITEM_TABLE(edr_rx_edr_delay, 0, marlin3_pskey, 1),
+ CONF_ITEM_TABLE(tx_delay, 0, marlin3_pskey, 1),
+ CONF_ITEM_TABLE(rx_delay, 0, marlin3_pskey, 1),
+ CONF_ITEM_TABLE(bb_rfu_w, 0, marlin3_pskey, 2),
+ CONF_ITEM_TABLE(agc_mode, 0, marlin3_pskey, 1),
+ CONF_ITEM_TABLE(diff_or_eq, 0, marlin3_pskey, 1),
+ CONF_ITEM_TABLE(ramp_mode, 0, marlin3_pskey, 1),
+ CONF_ITEM_TABLE(modem_rfu_b1, 0, marlin3_pskey, 1),
+ CONF_ITEM_TABLE(modem_rfu_w, 0, marlin3_pskey, 2),
+ CONF_ITEM_TABLE(BQB_BitMask_1, 0, marlin3_pskey, 1),
+ CONF_ITEM_TABLE(BQB_BitMask_2, 0, marlin3_pskey, 1),
+ CONF_ITEM_TABLE(bt_coex_threshold, 0, marlin3_pskey, 8),
+ CONF_ITEM_TABLE(other_rfu_w, 0, marlin3_pskey, 6),
+ {0, 0, 0, 0, 0}
+};
+
+static const conf_entry_t marlin3_rf_table[] = {
+ CONF_ITEM_TABLE(g_GainValue_A, 0, marlin3_rf_config, 6),
+ CONF_ITEM_TABLE(g_ClassicPowerValue_A, 0, marlin3_rf_config, 10),
+ CONF_ITEM_TABLE(g_LEPowerValue_A, 0, marlin3_rf_config, 16),
+ CONF_ITEM_TABLE(g_BRChannelpwrvalue_A, 0, marlin3_rf_config, 8),
+ CONF_ITEM_TABLE(g_EDRChannelpwrvalue_A, 0, marlin3_rf_config, 8),
+ CONF_ITEM_TABLE(g_LEChannelpwrvalue_A, 0, marlin3_rf_config, 8),
+ CONF_ITEM_TABLE(g_GainValue_B, 0, marlin3_rf_config, 6),
+ CONF_ITEM_TABLE(g_ClassicPowerValue_B, 0, marlin3_rf_config, 10),
+ CONF_ITEM_TABLE(g_LEPowerValue_B, 0, marlin3_rf_config, 16),
+ CONF_ITEM_TABLE(g_BRChannelpwrvalue_B, 0, marlin3_rf_config, 8),
+ CONF_ITEM_TABLE(g_EDRChannelpwrvalue_B, 0, marlin3_rf_config, 8),
+ CONF_ITEM_TABLE(g_LEChannelpwrvalue_B, 0, marlin3_rf_config, 8),
+ CONF_ITEM_TABLE(LE_fix_powerword, 0, marlin3_rf_config, 1),
+ CONF_ITEM_TABLE(Classic_pc_by_channel, 0, marlin3_rf_config, 1),
+ CONF_ITEM_TABLE(LE_pc_by_channel, 0, marlin3_rf_config, 1),
+ CONF_ITEM_TABLE(RF_switch_mode, 0, marlin3_rf_config, 1),
+ CONF_ITEM_TABLE(Data_Capture_Mode, 0, marlin3_rf_config, 1),
+ CONF_ITEM_TABLE(Analog_IQ_Debug_Mode, 0, marlin3_rf_config, 1),
+ CONF_ITEM_TABLE(RF_common_rfu_b3, 0, marlin3_rf_config, 1),
+ CONF_ITEM_TABLE(RF_common_rfu_w, 0, marlin3_rf_config, 5),
+ {0, 0, 0, 0, 0}
+};
+
+static void log_bin_to_hexstr(uint8_t *bin, uint8_t binsz, const char *log_tag)
+{
+ SPRD_DBG("%s", log_tag);
+ SPRD_DUMP(bin, binsz);
+}
+
+static void parse_number(char *p_conf_name, char *p_conf_value, void *buf, int len, int size)
+{
+ uint8_t *dest = (uint8_t *)buf;
+ char *sub_value, *p;
+ uint32_t value;
+ (void)p_conf_name;
+ sub_value = strtok_r(p_conf_value, CONF_VALUES_PARTITION, &p);
+ do {
+ if (sub_value == NULL)
+ break;
+
+ if (sub_value[0] == '0' && (sub_value[1] == 'x' || sub_value[1] == 'X'))
+ value = strtoul(sub_value, 0, 16) & 0xFFFFFFFF;
+ else
+ value = strtoul(sub_value, 0, 10) & 0xFFFFFFFF;
+
+ switch (size) {
+ case sizeof(uint8_t):
+ *dest = value & 0xFF;
+ dest += size;
+ break;
+
+ case sizeof(uint16_t):
+ *((uint16_t *)dest) = value & 0xFFFF;
+ dest += size;
+ break;
+
+ case sizeof(uint32_t):
+ *((uint32_t *)dest) = value & 0xFFFFFFFF;
+ dest += size;
+ break;
+
+ default:
+ break;
+ }
+ sub_value = strtok_r(NULL, CONF_VALUES_PARTITION, &p);
+ } while (--len);
+}
+
+static unsigned char compare_char(unsigned char ch)
+{
+ unsigned char data = 0x0;
+
+ switch(ch)
+ {
+ case 0:
+ case '0':
+ data = 0x0;
+ break;
+ case 1:
+ case '1':
+ data = 0x1;
+ break;
+ case 2:
+ case '2':
+ data = 0x2;
+ break;
+ case 3:
+ case '3':
+ data = 0x3;
+ break;
+ case 4:
+ case '4':
+ data = 0x4;
+ break;
+ case 5:
+ case '5':
+ data = 0x5;
+ break;
+ case 6:
+ case '6':
+ data = 0x6;
+ break;
+ case 7:
+ case '7':
+ data = 0x7;
+ break;
+ case 8:
+ case '8':
+ data = 0x8;
+ break;
+ case 9:
+ case '9':
+ data = 0x9;
+ break;
+ case 10:
+ case 'a':
+ case 'A':
+ data = 0xA;
+ break;
+ case 11:
+ case 'b':
+ case 'B':
+ data = 0xB;
+ break;
+ case 12:
+ case 'c':
+ case 'C':
+ data = 0xC;
+ break;
+ case 13:
+ case 'd':
+ case 'D':
+ data = 0xD;
+ break;
+ case 14:
+ case 'e':
+ case 'E':
+ data = 0xE;
+ break;
+ case 15:
+ case 'f':
+ case 'F':
+ data = 0xF;
+ break;
+ }
+ return data;
+}
+
+static void set_mac_address(uint8_t *addr)
+{
+ int i = 0;
+ SPRD_DBG("%s", __func__);
+ //for (i = 0; i < 6; i++)
+ // addr[5-i] = (unsigned char)local_bdaddr[i];
+
+ FILE *fp = fopen("/sys/class/addr_mgt/addr_bt", "r+");
+ unsigned char buff[255];
+ fscanf(fp, "%s", buff);
+ fclose(fp);
+ int k = 0;
+
+ unsigned char tmp[5];
+ sprintf(tmp, "%c%c", buff[0], buff[1]);
+ unsigned char str = compare_char(tmp[0]);
+ unsigned char str2 = compare_char(tmp[1]);
+ local_bdaddr[0] = (str << 4) | str2;
+
+ sprintf(tmp, "%c%c", buff[3], buff[4]);
+ str = compare_char(tmp[0]);
+ str2 = compare_char(tmp[1]);
+ local_bdaddr[1] = (str << 4) | str2;
+
+ sprintf(tmp, "%c%c", buff[6], buff[7]);
+ str = compare_char(tmp[0]);
+ str2 = compare_char(tmp[1]);
+ local_bdaddr[2] = (str << 4) | str2;
+
+ sprintf(tmp, "%c%c", buff[9], buff[10]);
+ str = compare_char(tmp[0]);
+ str2 = compare_char(tmp[1]);
+ local_bdaddr[3] = (str << 4) | str2;
+
+ sprintf(tmp, "%c%c", buff[12], buff[13]);
+ str = compare_char(tmp[0]);
+ str2 = compare_char(tmp[1]);
+ local_bdaddr[4] = (str << 4) | str2;
+
+ sprintf(tmp, "%c%c", buff[15], buff[16]);
+ str = compare_char(tmp[0]);
+ str2 = compare_char(tmp[1]);
+ local_bdaddr[5] = (str << 4) | str2;
+
+ {
+ for (i = 0; i < 6; i++)
+ addr[5-i] = (unsigned char)local_bdaddr[i];
+ }
+
+}
+
+static void vnd_load_configure(const char *p_path, const conf_entry_t *entry)
+{
+ FILE *p_file;
+ char *p_name, *p_value, *p;
+ conf_entry_t *p_entry;
+ char line[CONF_MAX_LINE_LEN + 1]; /* add 1 for \0 char */
+
+ SPRD_DBG("Attempt to load conf from %s", p_path);
+
+ if ((p_file = fopen(p_path, "r")) != NULL) {
+ /* read line by line */
+ while (fgets(line, CONF_MAX_LINE_LEN + 1, p_file) != NULL) {
+ if (line[0] == CONF_COMMENT) continue;
+
+ p_name = strtok_r(line, CONF_DELIMITERS, &p);
+
+ if (NULL == p_name) {
+ continue;
+ }
+
+ p_value = strtok_r(NULL, CONF_VALUES_DELIMITERS, &p);
+
+ if (NULL == p_value) {
+ SPRD_DBG("vnd_load_conf: missing value for name: %s", p_name);
+ continue;
+ }
+
+ p_entry = (conf_entry_t*)entry;
+
+ while (p_entry->conf_entry != NULL) {
+ if (strcmp(p_entry->conf_entry, (const char *)p_name) == 0) {
+ if (p_entry->p_action) {
+ p_entry->p_action(p_name, p_value, p_entry->buf, p_entry->len,
+ p_entry->size);
+ } else {
+ SPRD_DBG("%s -> %s", p_name, p_value);
+ parse_number(p_name, p_value, p_entry->buf, p_entry->len,
+ p_entry->size);
+ }
+ break;
+ }
+
+ p_entry++;
+ }
+ }
+
+ fclose(p_file);
+ } else {
+ SPRD_DBG("vnd_load_conf file >%s< not found", p_path);
+ }
+}
+
+static size_t H4Protocol_Send(uint8_t type, const uint8_t* data, size_t length)
+{
+ struct iovec iov[] = {
+ {&type, sizeof(type)},
+ {(uint8_t *)data, length}};
+
+ ssize_t ret = 0;
+ do {
+ ret = writev(s_bt_fd, iov, sizeof(iov) / sizeof(iov[0]));
+ } while (-1 == ret && EAGAIN == errno);
+
+ if (ret == -1) {
+ SPRD_ERR("%s error writing to UART (%s)", __func__, strerror(errno));
+ } else if (ret < length + 1) {
+ SPRD_ERR("%s: %d / %d bytes written - something went wrong...", __func__, ret, length + 1);
+ }
+
+ return ret;
+}
+
+static void *bt_vendor_alloc(int size)
+{
+ void *p = (uint8_t *)malloc(size);
+ return p;
+}
+
+static void bt_vendor_free(void *buffer)
+{
+ free(buffer);
+}
+
+static uint8_t bt_vendor_xmit(uint16_t opcode, void* buffer, hci_cback callback)
+{
+ uint8_t type = HCI_PACKET_TYPE_COMMAND;
+ (void)opcode;
+ HC_BT_HDR* bt_hdr = (HC_BT_HDR *)buffer;
+ H4Protocol_Send(type, bt_hdr->data, bt_hdr->len);
+ return BT_VND_OP_RESULT_SUCCESS;
+}
+
+static uint8_t sprd_vnd_send_hci_vsc(uint16_t cmd, uint8_t *payload, uint8_t len, hci_cback cback)
+{
+ HC_BT_HDR *p_buf;
+ uint8_t *p, ret;
+
+ p_buf = (HC_BT_HDR *)bt_vendor_alloc(
+ BT_HC_HDR_SIZE + HCI_CMD_PREAMBLE_SIZE + len);
+ if (p_buf) {
+ p_buf->event = MSG_STACK_TO_HC_HCI_CMD;
+ p_buf->offset = 0;
+ p_buf->layer_specific = 0;
+ p_buf->len = HCI_CMD_PREAMBLE_SIZE + len;
+ p = (uint8_t *)(p_buf + 1);
+
+ UINT16_TO_STREAM(p, cmd);
+ *p++ = len;
+ memcpy(p, payload, len);
+ log_bin_to_hexstr((uint8_t *)(p_buf + 1), HCI_CMD_PREAMBLE_SIZE + len, __FUNCTION__);
+ ret = bt_vendor_xmit(cmd, p_buf, cback);
+ bt_vendor_free(p_buf);
+ return ret;
+ }
+ return BT_VND_OP_RESULT_FAIL;
+}
+
+static void hw_core_cback(void *p_mem)
+{
+ uint8_t *p_evt_buf = (uint8_t *)p_mem;
+ uint8_t *p, status;
+ uint16_t opcode, mode;
+
+ p = (uint8_t *)(p_evt_buf + 1) + HCI_EVT_CMD_CMPL_OPCODE;
+ STREAM_TO_UINT16(opcode,p);
+ STREAM_TO_UINT16(mode,p);
+ STREAM_TO_UINT8(status,p);
+ SPRD_DBG("%s hw_core_cback response: [0x%04X, 0x%04X, 0x%02X]", __func__, opcode, mode, status);
+ bt_vendor_free(p_evt_buf);
+}
+
+static void hw_core_enable(unsigned char enable)
+{
+ uint8_t *p, msg_req[HCI_CMD_MAX_LEN];
+ p = msg_req;
+ UINT16_TO_STREAM(p, DUAL_MODE);
+ UINT8_TO_STREAM(p, enable ? ENABLE_BT : DISABLE_BT);
+ sprd_vnd_send_hci_vsc(HCI_VSC_ENABLE_COMMMAND, msg_req, (uint8_t)(p - msg_req), NULL);
+}
+
+static void hw_rf_cback(void *p_mem)
+{
+ uint8_t *p_evt_buf = (uint8_t *)p_mem, len;
+ uint8_t *p, status;
+ uint16_t opcode, mode = 0;
+
+ p = (uint8_t *)(p_evt_buf + 1) + 1;
+ STREAM_TO_UINT8(len, p);
+
+ p = (uint8_t *)(p_evt_buf + 1) + HCI_EVT_CMD_CMPL_OPCODE;
+ STREAM_TO_UINT16(opcode, p);
+ if (len == 6)
+ STREAM_TO_UINT16(mode, p);
+
+ STREAM_TO_UINT8(status, p);
+
+ SPRD_DBG("%s hw_rf_cback response: [0x%04X, 0x%04X, 0x%02X]", __func__, opcode, mode, status);
+ /* Must free the RX event buffer */
+ bt_vendor_free(p_evt_buf);
+}
+
+static int marlin3_rf_preload()
+{
+ uint8_t *p, msg_req[HCI_CMD_MAX_LEN];
+ int i;
+
+ SPRD_DBG("yujian.qin %s", __FUNCTION__);
+ p = msg_req;
+
+ for (i = 0; i < 6; i++)
+ UINT16_TO_STREAM(p, marlin3_rf_config.g_GainValue_A[i]);
+
+ for (i = 0; i < 10; i++)
+ UINT16_TO_STREAM(p, marlin3_rf_config.g_ClassicPowerValue_A[i]);
+
+ for (i = 0; i < 16; i++)
+ UINT16_TO_STREAM(p, marlin3_rf_config.g_LEPowerValue_A[i]);
+
+ for (i = 0; i < 8; i++)
+ UINT16_TO_STREAM(p, marlin3_rf_config.g_BRChannelpwrvalue_A[i]);
+
+ for (i = 0; i < 8; i++)
+ UINT16_TO_STREAM(p, marlin3_rf_config.g_EDRChannelpwrvalue_A[i]);
+
+ for (i = 0; i < 8; i++)
+ UINT16_TO_STREAM(p, marlin3_rf_config.g_LEChannelpwrvalue_A[i]);
+
+ for (i = 0; i < 6; i++)
+ UINT16_TO_STREAM(p, marlin3_rf_config.g_GainValue_B[i]);
+
+ for (i = 0; i < 10; i++)
+ UINT16_TO_STREAM(p, marlin3_rf_config.g_ClassicPowerValue_B[i]);
+
+ for (i = 0; i < 16; i++)
+ UINT16_TO_STREAM(p, marlin3_rf_config.g_LEPowerValue_B[i]);
+
+ for (i = 0; i < 8; i++)
+ UINT16_TO_STREAM(p, marlin3_rf_config.g_BRChannelpwrvalue_B[i]);
+
+ for (i = 0; i < 8; i++)
+ UINT16_TO_STREAM(p, marlin3_rf_config.g_EDRChannelpwrvalue_B[i]);
+
+ for (i = 0; i < 8; i++)
+ UINT16_TO_STREAM(p, marlin3_rf_config.g_LEChannelpwrvalue_B[i]);
+
+ UINT16_TO_STREAM(p, marlin3_rf_config.LE_fix_powerword);
+
+ UINT8_TO_STREAM(p, marlin3_rf_config.Classic_pc_by_channel);
+ UINT8_TO_STREAM(p, marlin3_rf_config.LE_pc_by_channel);
+ UINT8_TO_STREAM(p, marlin3_rf_config.RF_switch_mode);
+ UINT8_TO_STREAM(p, marlin3_rf_config.Data_Capture_Mode);
+ UINT8_TO_STREAM(p, marlin3_rf_config.Analog_IQ_Debug_Mode);
+ UINT8_TO_STREAM(p, marlin3_rf_config.RF_common_rfu_b3);
+
+ for (i = 0; i < 5; i++)
+ UINT32_TO_STREAM(p, marlin3_rf_config.RF_common_rfu_w[i]);
+
+ sprd_vnd_send_hci_vsc(HCI_RF_PARA, msg_req, (uint8_t)(p - msg_req), NULL);
+ return 0;
+}
+
+static void marlin3_pskey_cback(void *p_mem)
+{
+ uint8_t *p_evt_buf = (uint8_t *)p_mem;
+
+ uint16_t opcode, node, year;
+ uint8_t *p, month, day;
+ (void)opcode;
+
+ p = (uint8_t *)(p_evt_buf + 1) + HCI_EVT_CMD_CMPL_OPCODE;
+ STREAM_TO_UINT16(opcode, p);
+
+ p = (uint8_t *)(p_evt_buf + 1) + FW_NODE_BYTE;
+ STREAM_TO_UINT16(node, p);
+ p = (uint8_t *)(p_evt_buf + 1) + FW_DATE_Y_BYTE;
+ STREAM_TO_UINT16(year, p);
+ p = (uint8_t *)(p_evt_buf + 1) + FW_DATE_M_BYTE;
+ STREAM_TO_UINT8(month, p);
+ p = (uint8_t *)(p_evt_buf + 1) + FW_DATE_D_BYTE;
+ STREAM_TO_UINT8(day, p);
+
+ SPRD_DBG("Bluetooth Firmware Node: %04X Date: %04x-%02x-%02x", node, year, month, day);
+
+ /* Must free the RX event buffer */
+ bt_vendor_free(p_evt_buf);
+}
+
+static int marlin3_pskey_preload(void *arg)
+{
+ uint8_t *p, msg_req[HCI_CMD_MAX_LEN];
+ int i;
+ (void)arg;
+
+ SPRD_DBG("%s", __FUNCTION__);
+ p = msg_req;
+ UINT32_TO_STREAM(p, marlin3_pskey.device_class);
+
+ for (i = 0; i < 16; i++)
+ UINT8_TO_STREAM(p, marlin3_pskey.feature_set[i]);
+
+ for (i = 0; i < 6; i++)
+ UINT8_TO_STREAM(p, marlin3_pskey.device_addr[i]);
+
+ UINT16_TO_STREAM(p, marlin3_pskey.comp_id);
+ UINT8_TO_STREAM(p, marlin3_pskey.g_sys_uart0_communication_supported);
+ UINT8_TO_STREAM(p, marlin3_pskey.cp2_log_mode);
+ UINT8_TO_STREAM(p, marlin3_pskey.LogLevel);
+ UINT8_TO_STREAM(p, marlin3_pskey.g_central_or_perpheral);
+
+ UINT16_TO_STREAM(p, marlin3_pskey.Log_BitMask);
+ UINT8_TO_STREAM(p, marlin3_pskey.super_ssp_enable);
+ UINT8_TO_STREAM(p, marlin3_pskey.common_rfu_b3);
+
+ for (i = 0; i < 2; i++)
+ UINT32_TO_STREAM(p, marlin3_pskey.common_rfu_w[i]);
+
+ for (i = 0; i < 2; i++)
+ UINT32_TO_STREAM(p, marlin3_pskey.le_rfu_w[i]);
+
+ for (i = 0; i < 2; i++)
+ UINT32_TO_STREAM(p, marlin3_pskey.lmp_rfu_w[i]);
+
+ for (i = 0; i < 2; i++)
+ UINT32_TO_STREAM(p, marlin3_pskey.lc_rfu_w[i]);
+
+ UINT16_TO_STREAM(p, marlin3_pskey.g_wbs_nv_117);
+ UINT16_TO_STREAM(p, marlin3_pskey.g_wbs_nv_118);
+ UINT16_TO_STREAM(p, marlin3_pskey.g_nbv_nv_117);
+ UINT16_TO_STREAM(p, marlin3_pskey.g_nbv_nv_118);
+
+ UINT8_TO_STREAM(p, marlin3_pskey.g_sys_sco_transmit_mode);
+ UINT8_TO_STREAM(p, marlin3_pskey.audio_rfu_b1);
+ UINT8_TO_STREAM(p, marlin3_pskey.audio_rfu_b2);
+ UINT8_TO_STREAM(p, marlin3_pskey.audio_rfu_b3);
+
+ for (i = 0; i < 2; i++)
+ UINT32_TO_STREAM(p, marlin3_pskey.audio_rfu_w[i]);
+
+ UINT8_TO_STREAM(p, marlin3_pskey.g_sys_sleep_in_standby_supported);
+ UINT8_TO_STREAM(p, marlin3_pskey.g_sys_sleep_master_supported);
+ UINT8_TO_STREAM(p, marlin3_pskey.g_sys_sleep_slave_supported);
+ UINT8_TO_STREAM(p, marlin3_pskey.power_rfu_b1);
+
+ for (i = 0; i < 2; i++)
+ UINT32_TO_STREAM(p, marlin3_pskey.power_rfu_w[i]);
+
+ UINT32_TO_STREAM(p, marlin3_pskey.win_ext);
+
+ UINT8_TO_STREAM(p, marlin3_pskey.edr_tx_edr_delay);
+ UINT8_TO_STREAM(p, marlin3_pskey.edr_rx_edr_delay);
+ UINT8_TO_STREAM(p, marlin3_pskey.tx_delay);
+ UINT8_TO_STREAM(p, marlin3_pskey.rx_delay);
+
+ for (i = 0; i < 2; i++)
+ UINT32_TO_STREAM(p, marlin3_pskey.bb_rfu_w[i]);
+
+ UINT8_TO_STREAM(p, marlin3_pskey.agc_mode);
+ UINT8_TO_STREAM(p, marlin3_pskey.diff_or_eq);
+ UINT8_TO_STREAM(p, marlin3_pskey.ramp_mode);
+ UINT8_TO_STREAM(p, marlin3_pskey.modem_rfu_b1);
+
+ for (i = 0; i < 2; i++)
+ UINT32_TO_STREAM(p, marlin3_pskey.modem_rfu_w[i]);
+
+ UINT32_TO_STREAM(p, marlin3_pskey.BQB_BitMask_1);
+ UINT32_TO_STREAM(p, marlin3_pskey.BQB_BitMask_2);
+ for (i = 0; i < 8; i++)
+ UINT16_TO_STREAM(p, marlin3_pskey.bt_coex_threshold[i]);
+
+ for (i = 0; i < 6; i++)
+ UINT32_TO_STREAM(p, marlin3_pskey.other_rfu_w[i]);
+
+ sprd_vnd_send_hci_vsc(HCI_PSKEY, msg_req, (uint8_t)(p - msg_req), NULL);
+ return 0;
+}
+
+
+int sprd_config_init(int fd, struct uart_t *u, struct termios *ti)
+{
+ uint8_t *recv = NULL;
+ int len = 0;
+
+ s_bt_fd = fd;
+
+ memset(&marlin3_pskey, 0, sizeof(marlin3_pskey));
+ memset(&marlin3_rf_config, 0, sizeof(marlin3_rf_config));
+ vnd_load_configure(BT_CONFIG_PATH "/bt_configure_pskey.ini", &marlin3_pksey_table[0]);
+ vnd_load_configure(BT_CONFIG_PATH "/bt_configure_rf.ini", &marlin3_rf_table[0]);
+ //set_mac_address(marlin3_pskey.device_addr);
+
+ marlin3_pskey_preload(NULL);
+ recv = bt_vendor_alloc(RESPONSE_LENGTH);
+ len = read_hci_event(s_bt_fd, recv, RESPONSE_LENGTH);
+ SPRD_DBG("Received event, len: %d", len);
+ SPRD_DUMP(recv, len);
+ marlin3_pskey_cback(recv);
+
+ marlin3_rf_preload();
+ recv = bt_vendor_alloc(RESPONSE_LENGTH);
+ len = read_hci_event(s_bt_fd, recv, RESPONSE_LENGTH);
+ SPRD_DBG("Received event, len: %d", len);
+ SPRD_DUMP(recv, len);
+ hw_rf_cback(recv);
+
+ hw_core_enable(1);
+ recv = bt_vendor_alloc(RESPONSE_LENGTH);
+ len = read_hci_event(s_bt_fd, recv, RESPONSE_LENGTH);
+ SPRD_DBG("Received event, len: %d", len);
+ SPRD_DUMP(recv, len);
+ hw_core_cback(recv);
+
+ return 0;
+}
+
+int sprd_config_post(int fd, struct uart_t *u, struct termios *ti)
+{
+ SPRD_DBG("Done setting line discpline");
+ return 0;
+}
--
2.30.2

View file

@ -1,307 +0,0 @@
From 3a9c637010f8dc1ba3e8382abe01065761d4f5bb Mon Sep 17 00:00:00 2001
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Date: Tue, 10 Oct 2023 12:38:29 -0700
Subject: [PATCH] input: Fix .device_probe failing if SDP record is not found
Due to changes introduced by 67a26abe53bf
("profile: Add probe_on_discover flag") profiles may get probed when
their profile UUID are discovered, rather than resolved, which means
the SDP record may not be available.
Fixes: https://github.com/bluez/bluez/issues/614
---
profiles/input/device.c | 182 +++++++++++++++++++---------------------
1 file changed, 84 insertions(+), 98 deletions(-)
diff --git a/profiles/input/device.c b/profiles/input/device.c
index e2ac6ea603..4a50ea9921 100644
--- a/profiles/input/device.c
+++ b/profiles/input/device.c
@@ -60,7 +60,7 @@ struct input_device {
char *path;
bdaddr_t src;
bdaddr_t dst;
- uint32_t handle;
+ const sdp_record_t *rec;
GIOChannel *ctrl_io;
GIOChannel *intr_io;
guint ctrl_watch;
@@ -754,7 +754,8 @@ static void epox_endian_quirk(unsigned char *data, int size)
}
}
-static int create_hid_dev_name(sdp_record_t *rec, struct hidp_connadd_req *req)
+static int create_hid_dev_name(const sdp_record_t *rec,
+ struct hidp_connadd_req *req)
{
char sdesc[sizeof(req->name) / 2];
@@ -776,7 +777,7 @@ static int create_hid_dev_name(sdp_record_t *rec, struct hidp_connadd_req *req)
/* See HID profile specification v1.0, "7.11.6 HIDDescriptorList" for details
* on the attribute format. */
-static int extract_hid_desc_data(sdp_record_t *rec,
+static int extract_hid_desc_data(const sdp_record_t *rec,
struct hidp_connadd_req *req)
{
sdp_data_t *d;
@@ -817,36 +818,40 @@ static int extract_hid_desc_data(sdp_record_t *rec,
return -EINVAL;
}
-static int extract_hid_record(sdp_record_t *rec, struct hidp_connadd_req *req)
+static int extract_hid_record(struct input_device *idev,
+ struct hidp_connadd_req *req)
{
sdp_data_t *pdlist;
uint8_t attr_val;
int err;
- err = create_hid_dev_name(rec, req);
+ if (!idev->rec)
+ return -ENOENT;
+
+ err = create_hid_dev_name(idev->rec, req);
if (err < 0)
DBG("No valid Service Name or Service Description found");
- pdlist = sdp_data_get(rec, SDP_ATTR_HID_PARSER_VERSION);
+ pdlist = sdp_data_get(idev->rec, SDP_ATTR_HID_PARSER_VERSION);
req->parser = pdlist ? pdlist->val.uint16 : 0x0100;
- pdlist = sdp_data_get(rec, SDP_ATTR_HID_DEVICE_SUBCLASS);
+ pdlist = sdp_data_get(idev->rec, SDP_ATTR_HID_DEVICE_SUBCLASS);
req->subclass = pdlist ? pdlist->val.uint8 : 0;
- pdlist = sdp_data_get(rec, SDP_ATTR_HID_COUNTRY_CODE);
+ pdlist = sdp_data_get(idev->rec, SDP_ATTR_HID_COUNTRY_CODE);
req->country = pdlist ? pdlist->val.uint8 : 0;
- pdlist = sdp_data_get(rec, SDP_ATTR_HID_VIRTUAL_CABLE);
+ pdlist = sdp_data_get(idev->rec, SDP_ATTR_HID_VIRTUAL_CABLE);
attr_val = pdlist ? pdlist->val.uint8 : 0;
if (attr_val)
req->flags |= (1 << HIDP_VIRTUAL_CABLE_UNPLUG);
- pdlist = sdp_data_get(rec, SDP_ATTR_HID_BOOT_DEVICE);
+ pdlist = sdp_data_get(idev->rec, SDP_ATTR_HID_BOOT_DEVICE);
attr_val = pdlist ? pdlist->val.uint8 : 0;
if (attr_val)
req->flags |= (1 << HIDP_BOOT_PROTOCOL_MODE);
- err = extract_hid_desc_data(rec, req);
+ err = extract_hid_desc_data(idev->rec, req);
if (err < 0)
return err;
@@ -1035,11 +1040,6 @@ static gboolean encrypt_notify(GIOChannel *io, GIOCondition condition,
static int hidp_add_connection(struct input_device *idev)
{
struct hidp_connadd_req *req;
- sdp_record_t *rec;
- char src_addr[18], dst_addr[18];
- char filename[PATH_MAX];
- GKeyFile *key_file;
- char handle[11], *str;
GError *gerr = NULL;
int err;
@@ -1049,33 +1049,7 @@ static int hidp_add_connection(struct input_device *idev)
req->flags = 0;
req->idle_to = idle_timeout;
- ba2str(&idev->src, src_addr);
- ba2str(&idev->dst, dst_addr);
-
- snprintf(filename, PATH_MAX, STORAGEDIR "/%s/cache/%s", src_addr,
- dst_addr);
- sprintf(handle, "0x%8.8X", idev->handle);
-
- key_file = g_key_file_new();
- if (!g_key_file_load_from_file(key_file, filename, 0, &gerr)) {
- error("Unable to load key file from %s: (%s)", filename,
- gerr->message);
- g_clear_error(&gerr);
- }
- str = g_key_file_get_string(key_file, "ServiceRecords", handle, NULL);
- g_key_file_free(key_file);
-
- if (!str) {
- error("Rejected connection from unknown device %s", dst_addr);
- err = -EPERM;
- goto cleanup;
- }
-
- rec = record_from_string(str);
- g_free(str);
-
- err = extract_hid_record(rec, req);
- sdp_record_free(rec);
+ err = extract_hid_record(idev, req);
if (err < 0) {
error("Could not parse HID SDP record: %s (%d)", strerror(-err),
-err);
@@ -1091,7 +1065,7 @@ static int hidp_add_connection(struct input_device *idev)
/* Make sure the device is bonded if required */
if (classic_bonded_only && !input_device_bonded(idev)) {
- error("Rejected connection from !bonded device %s", dst_addr);
+ error("Rejected connection from !bonded device %s", idev->path);
goto cleanup;
}
@@ -1161,6 +1135,68 @@ static int connection_disconnect(struct input_device *idev, uint32_t flags)
return ioctl_disconnect(idev, flags);
}
+static bool is_device_sdp_disable(const sdp_record_t *rec)
+{
+ sdp_data_t *data;
+
+ data = sdp_data_get(rec, SDP_ATTR_HID_SDP_DISABLE);
+
+ return data && data->val.uint8;
+}
+
+static enum reconnect_mode_t hid_reconnection_mode(bool reconnect_initiate,
+ bool normally_connectable)
+{
+ if (!reconnect_initiate && !normally_connectable)
+ return RECONNECT_NONE;
+ else if (!reconnect_initiate && normally_connectable)
+ return RECONNECT_HOST;
+ else if (reconnect_initiate && !normally_connectable)
+ return RECONNECT_DEVICE;
+ else /* (reconnect_initiate && normally_connectable) */
+ return RECONNECT_ANY;
+}
+
+static void extract_hid_props(struct input_device *idev,
+ const sdp_record_t *rec)
+{
+ /* Extract HID connectability */
+ bool reconnect_initiate, normally_connectable;
+ sdp_data_t *pdlist;
+
+ /* HIDNormallyConnectable is optional and assumed FALSE if not
+ * present.
+ */
+ pdlist = sdp_data_get(rec, SDP_ATTR_HID_RECONNECT_INITIATE);
+ reconnect_initiate = pdlist ? pdlist->val.uint8 : TRUE;
+
+ pdlist = sdp_data_get(rec, SDP_ATTR_HID_NORMALLY_CONNECTABLE);
+ normally_connectable = pdlist ? pdlist->val.uint8 : FALSE;
+
+ /* Update local values */
+ idev->reconnect_mode =
+ hid_reconnection_mode(reconnect_initiate, normally_connectable);
+}
+
+static void input_device_update_rec(struct input_device *idev)
+{
+ struct btd_profile *p = btd_service_get_profile(idev->service);
+ const sdp_record_t *rec;
+
+ rec = btd_device_get_record(idev->device, p->remote_uuid);
+ if (!rec || idev->rec == rec)
+ return;
+
+ idev->rec = rec;
+ idev->disable_sdp = is_device_sdp_disable(rec);
+
+ /* Initialize device properties */
+ extract_hid_props(idev, rec);
+
+ if (idev->disable_sdp)
+ device_set_refresh_discovery(idev->device, false);
+}
+
static int input_device_connected(struct input_device *idev)
{
int err;
@@ -1168,6 +1204,9 @@ static int input_device_connected(struct input_device *idev)
if (idev->intr_io == NULL || idev->ctrl_io == NULL)
return -ENOTCONN;
+ /* Attempt to update SDP record if it had changed */
+ input_device_update_rec(idev);
+
err = hidp_add_connection(idev);
if (err < 0)
return err;
@@ -1411,74 +1450,21 @@ int input_device_disconnect(struct btd_service *service)
return 0;
}
-static bool is_device_sdp_disable(const sdp_record_t *rec)
-{
- sdp_data_t *data;
-
- data = sdp_data_get(rec, SDP_ATTR_HID_SDP_DISABLE);
-
- return data && data->val.uint8;
-}
-
-static enum reconnect_mode_t hid_reconnection_mode(bool reconnect_initiate,
- bool normally_connectable)
-{
- if (!reconnect_initiate && !normally_connectable)
- return RECONNECT_NONE;
- else if (!reconnect_initiate && normally_connectable)
- return RECONNECT_HOST;
- else if (reconnect_initiate && !normally_connectable)
- return RECONNECT_DEVICE;
- else /* (reconnect_initiate && normally_connectable) */
- return RECONNECT_ANY;
-}
-
-static void extract_hid_props(struct input_device *idev,
- const sdp_record_t *rec)
-{
- /* Extract HID connectability */
- bool reconnect_initiate, normally_connectable;
- sdp_data_t *pdlist;
-
- /* HIDNormallyConnectable is optional and assumed FALSE
- * if not present. */
- pdlist = sdp_data_get(rec, SDP_ATTR_HID_RECONNECT_INITIATE);
- reconnect_initiate = pdlist ? pdlist->val.uint8 : TRUE;
-
- pdlist = sdp_data_get(rec, SDP_ATTR_HID_NORMALLY_CONNECTABLE);
- normally_connectable = pdlist ? pdlist->val.uint8 : FALSE;
-
- /* Update local values */
- idev->reconnect_mode =
- hid_reconnection_mode(reconnect_initiate, normally_connectable);
-}
-
static struct input_device *input_device_new(struct btd_service *service)
{
struct btd_device *device = btd_service_get_device(service);
- struct btd_profile *p = btd_service_get_profile(service);
const char *path = device_get_path(device);
- const sdp_record_t *rec = btd_device_get_record(device, p->remote_uuid);
struct btd_adapter *adapter = device_get_adapter(device);
struct input_device *idev;
- if (!rec)
- return NULL;
-
idev = g_new0(struct input_device, 1);
bacpy(&idev->src, btd_adapter_get_address(adapter));
bacpy(&idev->dst, device_get_address(device));
idev->service = btd_service_ref(service);
idev->device = btd_device_ref(device);
idev->path = g_strdup(path);
- idev->handle = rec->handle;
- idev->disable_sdp = is_device_sdp_disable(rec);
-
- /* Initialize device properties */
- extract_hid_props(idev, rec);
- if (idev->disable_sdp)
- device_set_refresh_discovery(device, false);
+ input_device_update_rec(idev);
return idev;
}

View file

@ -12,7 +12,7 @@ NotifyAccess=main
EnvironmentFile=/storage/.cache/services/bluez.conf
EnvironmentFile=-/run/libreelec/debug/bluez.conf
ExecStart=/usr/lib/bluetooth/bluetoothd $BLUEZ_ARGS $BLUEZ_DEBUG
CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_BIND_SERVICE CAP_NET_RAW
CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_BIND_SERVICE CAP_NET_RAW CAP_FOWNER
LimitNPROC=1
TimeoutStopSec=1s
Restart=on-failure

View file

@ -55,8 +55,14 @@
browseable = yes
writeable = yes
[roms]
path = /storage/roms
[games-internal]
path = /storage/games-internal
available = yes
browseable = yes
writeable = yes
[games-external]
path = /storage/games-external
available = yes
browseable = yes
writeable = yes

View file

@ -11,14 +11,16 @@ PKG_TOOLCHAIN="manual"
case ${TARGET_ARCH} in
aarch64)
TS_ARCH="arm64"
TS_ARCH="_arm64"
PKG_SHA256="a7c9e801f43c04290481c2f6b0baad6fcaa82db3149fac232b2601115dd65db7"
;;
x86_64)
TS_ARCH="amd64"
TS_ARCH="_amd64"
PKG_SHA256="e9375a321faaba03c93e006f40318eb986937658e09287cdf0117b9e28ab8fbe"
;;
esac
PKG_URL="https://pkgs.tailscale.com/stable/tailscale_${PKG_VERSION}_${TS_ARCH}.tgz"
PKG_URL="https://pkgs.tailscale.com/stable/tailscale_${PKG_VERSION}${TS_ARCH}.tgz"
# Don't wildcard (X55)
case ${DEVICE} in
@ -29,7 +31,7 @@ esac
pre_unpack() {
mkdir -p ${PKG_BUILD}
tar --strip-components=1 -xf ${SOURCES}/${PKG_NAME}/${PKG_NAME}-${PKG_VERSION}.tgz -C ${PKG_BUILD}
tar --strip-components=1 -xf $SOURCES/${PKG_NAME}/${PKG_NAME}-${PKG_VERSION}.tgz -C ${PKG_BUILD} tailscale_${PKG_VERSION}${TS_ARCH}
}
makeinstall_target() {

View file

@ -27,4 +27,5 @@ makeinstall_target() {
cp ${PKG_DIR}/scripts/wg-genconfig ${INSTALL}/usr/bin
cp ${PKG_BUILD}/src/wg ${INSTALL}/usr/bin
cp ${PKG_BUILD}/src/wg-quick/linux.bash ${INSTALL}/usr/bin/wg-quick
chmod 755 ${INSTALL}/usr/bin/*
}

View file

@ -181,10 +181,10 @@ post_install() {
fi
ROOT_PWD="`${TOOLCHAIN}/bin/cryptpw -m sha512 ${ROOT_PASSWORD}`"
echo "chmod 4755 ${INSTALL}/usr/bin/busybox" >> $FAKEROOT_SCRIPT
echo "chmod 000 ${INSTALL}/usr/cache/shadow" >> $FAKEROOT_SCRIPT
echo "chmod 4755 ${INSTALL}/usr/bin/busybox" >> ${FAKEROOT_SCRIPT}
echo "chmod 000 ${INSTALL}/usr/cache/shadow" >> ${FAKEROOT_SCRIPT}
add_user root "${ROOT}_PWD" 0 0 "Root User" "/storage" "/bin/sh"
add_user root "${ROOT_PWD}" 0 0 "Root User" "/storage" "/bin/sh"
add_group root 0
add_group users 100

View file

@ -68,6 +68,10 @@ pcie_aspm_policy() {
}
cpu_perftune() {
if [ -n "${1}" ]
then
DESIRED_EPP=${1}
fi
CPUPOWERSAVE=$(get_setting system.power.cpu)
POWERSAVEENABLED=$(get_setting system.powersave)
CPU="$(awk '/vendor_id/ {print $3;exit}' /proc/cpuinfo)"
@ -91,15 +95,22 @@ cpu_perftune() {
AuthenticAMD)
PSTATE="amd_pstate"
STATUS="active"
WARM="passive"
;;
GenuineIntel)
PSTATE="intel_pstate"
STATUS="passive"
WARM="active"
;;
esac
if [ -f "/sys/devices/system/cpu/${PSTATE}/status" ]
then
if [ -n "${WARM}" ]
then
# Some devices need to switch before the handles are writeable (AYANEO).
echo ${WARM} >/sys/devices/system/cpu/${PSTATE}/status
fi
echo ${STATUS} >/sys/devices/system/cpu/${PSTATE}/status
while [ ! -f /sys/devices/system/cpu/cpufreq/policy0/energy_performance_preference ]
do
@ -110,9 +121,13 @@ cpu_perftune() {
EPP=$(get_setting system.power.epp)
if [ -z "${EPP}" ]
then
EPP="performance"
EPP="balance_performance"
set_setting system.power.epp ${EPP}
fi
if [ -n "${DESIRED_EPP}" ]
then
EPP="${DESIRED_EPP}"
fi
echo ${EPP} >${policy} 2>/dev/null
done
fi

View file

@ -11,14 +11,16 @@
. /etc/profile
BATCNT=0
unset CURRENT_MODE
unset AC_STATUS
while true
do
if [ "$(get_setting system.powersave)" = 1 ]
then
STATUS="$(cat /sys/class/power_supply/{BAT*,bat*}/status 2>/dev/null)"
if [ ! "${STATUS}" = "${CURRENT_MODE}" ]
AC_STATUS="$(cat /sys/class/power_supply/[bB][aA][tT]*/status 2>/dev/null)"
if [[ ! "${CURRENT_MODE}" =~ ${AC_STATUS} ]]
then
case ${STATUS} in
case ${AC_STATUS} in
Disch*)
log $0 "Switching to battery mode."
if [ -e "/tmp/.gpu_performance_level" ]
@ -56,7 +58,7 @@ do
;;
esac
fi
CURRENT_MODE="${STATUS}"
CURRENT_MODE="${AC_STATUS}"
fi
### Until we have an overlay. :rofl:
if (( "${BATCNT}" >= "90" )) &&

View file

@ -15,7 +15,7 @@ then
PROFILE=$(get_setting system.power.epp)
if [ -z "${PROFILE}" ]
then
PROFILE="performance"
PROFILE="balance_performance"
set_setting system.power.epp ${PROFILE}
fi
else

View file

@ -119,7 +119,7 @@ allowed_media_dirs = /var/media, /media, /run/media/$USER
# allowed_devices = /dev/*
# WARNING: ALLOWING USERS TO MOUNT DEVICES OUTSIDE OF /dev CAN CAUSE SERIOUS
# SECURITY PROBLEMS. DO NOT ALLOW DEVICES IN /dev/shm
allowed_devices = /dev/*
allowed_devices = /dev/sd* /dev/nvme*
# allowed_internal_devices causes udevil to treat any listed block devices as

View file

@ -2,15 +2,15 @@
IMPORT{cmdline}="installer"
ENV{installer}=="1", GOTO="exit"
# check for blockdevices, /dev/sd*, /dev/sr* and /dev/mmc*
SUBSYSTEM!="block", KERNEL!="sd*|sr*|mmc*", GOTO="exit"
# check for blockdevices, /dev/sd*, /dev/sr*
SUBSYSTEM!="block", KERNEL!="sd*|sr*", GOTO="exit"
# check for special partitions we dont want mount
IMPORT{builtin}="blkid"
ENV{ID_FS_LABEL}=="EFI|BOOT|Recovery|RECOVERY|SETTINGS|boot|root0|share0", GOTO="exit"
# /dev/sd* and /dev/mmc* ith partitions/disk and filesystems only and /dev/sr* disks only
KERNEL=="sd*|mmc*", ENV{DEVTYPE}=="partition|disk", ENV{ID_FS_USAGE}=="filesystem", GOTO="harddisk"
# /dev/sd* with partitions/disk and filesystems only and /dev/sr* disks only
KERNEL=="sd*", ENV{DEVTYPE}=="partition|disk", ENV{ID_FS_USAGE}=="filesystem", GOTO="harddisk"
KERNEL=="sr*", ENV{DEVTYPE}=="disk", GOTO="optical"
GOTO="exit"

View file

@ -3,7 +3,7 @@
# Copyright (C) 2023 JELOS (https://github.com/JustEnoughLinuxOS)
PKG_NAME="emulationstation"
PKG_VERSION="6c712ff"
PKG_VERSION="ac666f2"
PKG_GIT_CLONE_BRANCH="main"
PKG_REV="1"
PKG_ARCH="any"

View file

@ -1235,3 +1235,4 @@ makeinstall_target() {
cp ${PKG_DIR}/autostart/* ${INSTALL}/usr/lib/autostart/common
chmod 0755 ${INSTALL}/usr/lib/autostart/common/*
}

View file

@ -0,0 +1,13 @@
[Unit]
Description=Overlays directory
After=systemd-tmpfiles-setup.service
DefaultDependencies=no
[Mount]
What=none
Where=/storage/roms
Type=overlay
Options=lowerdir=/storage/games-external,upperdir=/storage/games-internal,workdir=/storage/.tmp/games-workdir
[Install]
WantedBy=jelos.target

View file

@ -2,5 +2,8 @@
# Copyright (C) 2021-present 351ELEC (https://github.com/351ELEC)
# Copyright (C) 2023 JELOS (https://github.com/JustEnoughLinuxOS)
d /storage/.tmp/games-workdir 0777 root root - -
d /storage/games-internal 0777 root root - -
d /storage/games-external 0777 root root - -
d /storage/roms 0777 root root - -
d /tmp/cache 0777 root root - -

View file

@ -0,0 +1,21 @@
# dont run in "installer" mode
IMPORT{cmdline}="installer"
ENV{installer}=="1", GOTO="exit"
SUBSYSTEM!="block", KERNEL!="mmc*", GOTO="exit"
# check for special partitions we dont want mount
IMPORT{builtin}="blkid"
ENV{ID_FS_LABEL}=="EFI|BOOT|Recovery|RECOVERY|SETTINGS|boot|root0|share0", GOTO="exit"
# /dev/mmc* partitions/disk and filesystems only
KERNEL=="mmc*", ENV{DEVTYPE}=="partition|disk", ENV{ID_FS_USAGE}=="filesystem", GOTO="harddisk"
GOTO="exit"
# mount or umount for hdds
LABEL="harddisk"
ACTION=="add", PROGRAM="/usr/bin/sh -c '/usr/bin/grep -E ^/dev/%k\ /proc/mounts || true'", RESULT=="", RUN+="/usr/bin/systemctl stop storage-roms.mount", RUN+="/usr/bin/systemctl restart jelos-automount.service"
GOTO="exit"
# Exit
LABEL="exit"

View file

@ -6502,7 +6502,7 @@ CONFIG_FUSE_FS=m
# CONFIG_CUSE is not set
# CONFIG_VIRTIO_FS is not set
CONFIG_OVERLAY_FS=m
# CONFIG_OVERLAY_FS_REDIRECT_DIR is not set
CONFIG_OVERLAY_FS_REDIRECT_DIR=y
CONFIG_OVERLAY_FS_REDIRECT_ALWAYS_FOLLOW=y
# CONFIG_OVERLAY_FS_INDEX is not set
# CONFIG_OVERLAY_FS_XINO_AUTO is not set

View file

@ -18,7 +18,7 @@ PKG_PATCH_DIRS+="${DEVICE}"
case ${DEVICE} in
S922X*)
PKG_VERSION="6.1.63"
PKG_VERSION="6.1.64"
PKG_URL="https://www.kernel.org/pub/linux/kernel/v6.x/${PKG_NAME}-${PKG_VERSION}.tar.xz"
;;
esac

View file

@ -1,9 +1,9 @@
diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-go-ultra.dts b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-go-ultra.dts
new file mode 100644
index 000000000000..d0a7ba2c2bd4
index 000000000000..f42ebb59a59c
--- /dev/null
+++ b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-go-ultra.dts
@@ -0,0 +1,935 @@
@@ -0,0 +1,1001 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (c) 2022 Neil Armstrong <narmstrong@kernel.org>
@ -11,7 +11,7 @@ index 000000000000..d0a7ba2c2bd4
+
+/dts-v1/;
+
+#include "meson-g12b-s922x.dtsi"
+#include "meson-g12b-a311d.dtsi"
+#include <dt-bindings/input/input.h>
+#include <dt-bindings/leds/common.h>
+#include <dt-bindings/gpio/meson-g12a-gpio.h>
@ -361,6 +361,72 @@ index 000000000000..d0a7ba2c2bd4
+ clock-latency = <50000>;
+};
+
+/* RK817 only supports 12.5mV steps, round up the values */
+&cpu_opp_table_0 {
+ opp-1000000000 {
+ opp-microvolt = <737500>;
+ };
+ opp-1200000000 {
+ opp-microvolt = <737500>;
+ };
+ opp-1398000000 {
+ opp-microvolt = <762500>;
+ };
+ opp-1512000000 {
+ opp-microvolt = <800000>;
+ };
+ opp-1608000000 {
+ opp-microvolt = <837500>;
+ };
+ opp-1704000000 {
+ opp-microvolt = <862500>;
+ };
+ opp-1800000000 {
+ opp-microvolt = <987500>;
+ };
+ opp-1908000000 {
+ opp-hz = /bits/ 64 <1908000000>;
+ opp-microvolt = <1050000>;
+ };
+};
+
+/* RK818 only supports 12.5mV steps, round up the values */
+&cpub_opp_table_1 {
+ opp-1000000000 {
+ opp-microvolt = <775000>;
+ };
+ opp-1200000000 {
+ opp-microvolt = <775000>;
+ };
+ opp-1398000000 {
+ opp-microvolt = <800000>;
+ };
+ opp-1512000000 {
+ opp-microvolt = <825000>;
+ };
+ opp-1608000000 {
+ opp-microvolt = <862500>;
+ };
+ opp-1704000000 {
+ opp-microvolt = <900000>;
+ };
+ opp-1800000000 {
+ opp-microvolt = <987500>;
+ };
+ opp-1908000000 {
+ opp-microvolt = <1025000>;
+ };
+ opp-2016000000 {
+ opp-microvolt = <1025000>;
+ };
+ opp-2108000000 {
+ opp-microvolt = <1025000>;
+ };
+ opp-2208000000 {
+ opp-microvolt = <1050000>;
+ };
+};
+
+&i2c_AO {
+ status = "okay";
+ pinctrl-0 = <&i2c_ao_sck_pins>, <&i2c_ao_sda_pins>;

View file

@ -1,9 +1,9 @@
diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b-powkiddy-rgb10-max-3.dts b/arch/arm64/boot/dts/amlogic/meson-g12b-powkiddy-rgb10-max-3.dts
new file mode 100644
index 000000000000..fd4f97b5ccd3
index 000000000000..877663f6fb7c
--- /dev/null
+++ b/arch/arm64/boot/dts/amlogic/meson-g12b-powkiddy-rgb10-max-3.dts
@@ -0,0 +1,924 @@
@@ -0,0 +1,986 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (c) 2022 Neil Armstrong <narmstrong@kernel.org>
@ -350,6 +350,68 @@ index 000000000000..fd4f97b5ccd3
+ clock-latency = <50000>;
+};
+
+/* RK817 only supports 12.5mV steps, round up the values */
+&cpu_opp_table_0 {
+ opp-1000000000 {
+ opp-microvolt = <760000>;
+ };
+ opp-1200000000 {
+ opp-microvolt = <780000>;
+ };
+ opp-1398000000 {
+ opp-microvolt = <800000>;
+ };
+ opp-1512000000 {
+ opp-microvolt = <860000>;
+ };
+ opp-1608000000 {
+ opp-microvolt = <900000>;
+ };
+ opp-1704000000 {
+ opp-microvolt = <950000>;
+ };
+ opp-1800000000 {
+ opp-microvolt = <1000000>;
+ };
+};
+
+/* RK818 only supports 12.5mV steps, round up the values */
+&cpub_opp_table_1 {
+ opp-1000000000 {
+ opp-microvolt = <775000>;
+ };
+ opp-1200000000 {
+ opp-microvolt = <775000>;
+ };
+ opp-1398000000 {
+ opp-microvolt = <800000>;
+ };
+ opp-1512000000 {
+ opp-microvolt = <825000>;
+ };
+ opp-1608000000 {
+ opp-microvolt = <862500>;
+ };
+ opp-1704000000 {
+ opp-microvolt = <900000>;
+ };
+ opp-1800000000 {
+ opp-microvolt = <987500>;
+ };
+ opp-1908000000 {
+ opp-microvolt = <1025000>;
+ };
+ opp-2016000000 {
+ opp-microvolt = <1025000>;
+ };
+ opp-2108000000 {
+ opp-microvolt = <1025000>;
+ };
+ opp-2208000000 {
+ opp-microvolt = <1050000>;
+ };
+};
+
+&i2c_AO {
+ status = "okay";
+ pinctrl-0 = <&i2c_ao_sck_pins>, <&i2c_ao_sda_pins>;

View file

@ -1,15 +1,15 @@
#
# Automatically generated file; DO NOT EDIT.
# Linux/arm64 6.1.28 Kernel Configuration
# Linux/arm64 6.1.64 Kernel Configuration
#
CONFIG_CC_VERSION_TEXT="aarch64-libreelec-linux-gnueabi-gcc-12.3.0 (GCC) 12.3.0"
CONFIG_CC_IS_GCC=y
CONFIG_GCC_VERSION=120300
CONFIG_CLANG_VERSION=0
CONFIG_AS_IS_GNU=y
CONFIG_AS_VERSION=24000
CONFIG_AS_VERSION=24100
CONFIG_LD_IS_BFD=y
CONFIG_LD_VERSION=24000
CONFIG_LD_VERSION=24100
CONFIG_LLD_VERSION=0
CONFIG_CC_CAN_LINK=y
CONFIG_CC_CAN_LINK_STATIC=y
@ -196,7 +196,7 @@ CONFIG_SCHED_AUTOGROUP=y
# CONFIG_SYSFS_DEPRECATED is not set
CONFIG_RELAY=y
CONFIG_BLK_DEV_INITRD=y
CONFIG_INITRAMFS_SOURCE=""
CONFIG_INITRAMFS_SOURCE="@INITRAMFS_SOURCE@"
CONFIG_INITRAMFS_ROOT_UID=0
CONFIG_INITRAMFS_ROOT_GID=0
CONFIG_RD_GZIP=y
@ -340,6 +340,7 @@ CONFIG_ARCH_ROCKCHIP=y
#
# ARM errata workarounds via the alternatives framework
#
CONFIG_AMPERE_ERRATUM_AC03_CPU_38=y
CONFIG_ARM64_WORKAROUND_CLEAN_CACHE=y
CONFIG_ARM64_ERRATUM_826319=y
CONFIG_ARM64_ERRATUM_827319=y
@ -370,6 +371,7 @@ CONFIG_ARM64_ERRATUM_2054223=y
CONFIG_ARM64_ERRATUM_2067961=y
CONFIG_ARM64_ERRATUM_2441009=y
CONFIG_ARM64_ERRATUM_2457168=y
CONFIG_ARM64_ERRATUM_2966298=y
CONFIG_CAVIUM_ERRATUM_22375=y
CONFIG_CAVIUM_ERRATUM_23154=y
CONFIG_CAVIUM_ERRATUM_27456=y
@ -569,14 +571,14 @@ CONFIG_CPU_FREQ_STAT=y
# CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE is not set
# CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE is not set
# CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE is not set
CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y
# CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND is not set
# CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE is not set
# CONFIG_CPU_FREQ_DEFAULT_GOV_SCHEDUTIL is not set
CONFIG_CPU_FREQ_DEFAULT_GOV_SCHEDUTIL=y
CONFIG_CPU_FREQ_GOV_PERFORMANCE=y
CONFIG_CPU_FREQ_GOV_POWERSAVE=y
CONFIG_CPU_FREQ_GOV_USERSPACE=y
# CONFIG_CPU_FREQ_GOV_USERSPACE is not set
CONFIG_CPU_FREQ_GOV_ONDEMAND=y
CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y
# CONFIG_CPU_FREQ_GOV_CONSERVATIVE is not set
CONFIG_CPU_FREQ_GOV_SCHEDUTIL=y
#
@ -930,6 +932,7 @@ CONFIG_ARCH_HAS_PTE_SPECIAL=y
# CONFIG_ANON_VMA_NAME is not set
# CONFIG_USERFAULTFD is not set
# CONFIG_LRU_GEN is not set
CONFIG_LOCK_MM_AND_FIND_VMA=y
#
# Data Access Monitoring
@ -1999,12 +2002,13 @@ CONFIG_WLCORE=m
# CONFIG_WLCORE_SDIO is not set
# CONFIG_WLAN_VENDOR_ZYDAS is not set
CONFIG_WLAN_VENDOR_QUANTENNA=y
CONFIG_ESP8089=m
CONFIG_ESP8089_DEBUG_FS=y
# CONFIG_MAC80211_HWSIM is not set
CONFIG_USB_NET_RNDIS_WLAN=m
# CONFIG_VIRT_WIFI is not set
# CONFIG_WAN is not set
CONFIG_ESP8089=m
CONFIG_ESP8089_DEBUG_FS=y
#
# Wireless WAN
#
@ -3282,7 +3286,7 @@ CONFIG_VIDEO_CX25840=m
# Graphics support
#
CONFIG_DRM=y
CONFIG_DRM_MIPI_DBI=y
CONFIG_DRM_MIPI_DBI=m
CONFIG_DRM_MIPI_DSI=y
# CONFIG_DRM_DEBUG_MM is not set
CONFIG_DRM_KMS_HELPER=y
@ -4815,8 +4819,8 @@ CONFIG_DEVFREQ_GOV_PASSIVE=y
#
# DEVFREQ Drivers
#
CONFIG_ARM_ROCKCHIP_BUS_DEVFREQ=y
CONFIG_ARM_RK3399_DMC_DEVFREQ=y
CONFIG_ARM_ROCKCHIP_BUS_DEVFREQ=y
CONFIG_PM_DEVFREQ_EVENT=y
CONFIG_DEVFREQ_EVENT_ROCKCHIP_DFI=y
CONFIG_EXTCON=y
@ -5555,7 +5559,7 @@ CONFIG_FUSE_FS=m
CONFIG_CUSE=m
# CONFIG_VIRTIO_FS is not set
CONFIG_OVERLAY_FS=y
# CONFIG_OVERLAY_FS_REDIRECT_DIR is not set
CONFIG_OVERLAY_FS_REDIRECT_DIR=y
CONFIG_OVERLAY_FS_REDIRECT_ALWAYS_FOLLOW=y
# CONFIG_OVERLAY_FS_INDEX is not set
# CONFIG_OVERLAY_FS_XINO_AUTO is not set

View file

@ -5156,7 +5156,7 @@ CONFIG_FUSE_FS=y
# CONFIG_CUSE is not set
# CONFIG_VIRTIO_FS is not set
CONFIG_OVERLAY_FS=y
# CONFIG_OVERLAY_FS_REDIRECT_DIR is not set
CONFIG_OVERLAY_FS_REDIRECT_DIR=y
CONFIG_OVERLAY_FS_REDIRECT_ALWAYS_FOLLOW=y
# CONFIG_OVERLAY_FS_INDEX is not set
# CONFIG_OVERLAY_FS_XINO_AUTO is not set

View file

@ -5341,7 +5341,7 @@ CONFIG_INOTIFY_USER=y
CONFIG_FUSE_FS=y
# CONFIG_CUSE is not set
CONFIG_OVERLAY_FS=y
# CONFIG_OVERLAY_FS_REDIRECT_DIR is not set
CONFIG_OVERLAY_FS_REDIRECT_DIR=y
CONFIG_OVERLAY_FS_REDIRECT_ALWAYS_FOLLOW=y
# CONFIG_OVERLAY_FS_INDEX is not set
# CONFIG_OVERLAY_FS_XINO_AUTO is not set

View file

@ -5507,7 +5507,7 @@ CONFIG_INOTIFY_USER=y
CONFIG_FUSE_FS=y
# CONFIG_CUSE is not set
CONFIG_OVERLAY_FS=y
# CONFIG_OVERLAY_FS_REDIRECT_DIR is not set
CONFIG_OVERLAY_FS_REDIRECT_DIR=y
CONFIG_OVERLAY_FS_REDIRECT_ALWAYS_FOLLOW=y
# CONFIG_OVERLAY_FS_INDEX is not set
# CONFIG_OVERLAY_FS_XINO_AUTO is not set

View file

@ -7295,7 +7295,7 @@ CONFIG_FUSE_FS=m
CONFIG_CUSE=m
# CONFIG_VIRTIO_FS is not set
CONFIG_OVERLAY_FS=m
# CONFIG_OVERLAY_FS_REDIRECT_DIR is not set
CONFIG_OVERLAY_FS_REDIRECT_DIR=y
CONFIG_OVERLAY_FS_REDIRECT_ALWAYS_FOLLOW=y
# CONFIG_OVERLAY_FS_INDEX is not set
# CONFIG_OVERLAY_FS_XINO_AUTO is not set

View file

@ -36,7 +36,7 @@ case ${DEVICE} in
PKG_GIT_CLONE_BRANCH="main"
;;
RK33*)
PKG_VERSION="6.1.63"
PKG_VERSION="6.1.64"
PKG_URL="https://www.kernel.org/pub/linux/kernel/v6.x/${PKG_NAME}-${PKG_VERSION}.tar.xz"
;;
esac

View file

@ -1,6 +1,6 @@
diff -rupN linux.orig/Makefile linux/Makefile
--- linux.orig/Makefile 2023-11-14 03:58:03.064741025 +0000
+++ linux/Makefile 2023-11-15 14:10:46.134863088 +0000
--- linux.orig/Makefile 2023-11-28 13:54:58.570108474 +0000
+++ linux/Makefile 2023-11-28 19:50:16.215638386 +0000
@@ -826,6 +826,8 @@ KBUILD_CFLAGS += $(call cc-disable-warni
KBUILD_CFLAGS += $(call cc-disable-warning, format-truncation)
KBUILD_CFLAGS += $(call cc-disable-warning, format-overflow)
@ -20,8 +20,8 @@ diff -rupN linux.orig/Makefile linux/Makefile
# Require designated initializers for all marked structures
KBUILD_CFLAGS += $(call cc-option,-Werror=designated-init)
diff -rupN linux.orig/arch/arm64/boot/dts/rockchip/Makefile linux/arch/arm64/boot/dts/rockchip/Makefile
--- linux.orig/arch/arm64/boot/dts/rockchip/Makefile 2023-11-14 03:58:03.288746149 +0000
+++ linux/arch/arm64/boot/dts/rockchip/Makefile 2023-11-15 14:10:46.134863088 +0000
--- linux.orig/arch/arm64/boot/dts/rockchip/Makefile 2023-11-28 13:54:59.138120459 +0000
+++ linux/arch/arm64/boot/dts/rockchip/Makefile 2023-11-28 19:50:16.215638386 +0000
@@ -21,6 +21,7 @@ dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3368-li
dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3368-orion-r68-meta.dtb
dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3368-px5-evb.dtb
@ -32,8 +32,8 @@ diff -rupN linux.orig/arch/arm64/boot/dts/rockchip/Makefile linux/arch/arm64/boo
dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-ficus.dtb
diff -rupN linux.orig/arch/arm64/boot/dts/rockchip/rk3399-anbernic-rg552-opp.dtsi linux/arch/arm64/boot/dts/rockchip/rk3399-anbernic-rg552-opp.dtsi
--- linux.orig/arch/arm64/boot/dts/rockchip/rk3399-anbernic-rg552-opp.dtsi 1970-01-01 00:00:00.000000000 +0000
+++ linux/arch/arm64/boot/dts/rockchip/rk3399-anbernic-rg552-opp.dtsi 2023-11-15 14:15:47.804831632 +0000
@@ -0,0 +1,133 @@
+++ linux/arch/arm64/boot/dts/rockchip/rk3399-anbernic-rg552-opp.dtsi 2023-11-28 23:23:39.023319423 +0000
@@ -0,0 +1,141 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (c) 2016-2017 Fuzhou Rockchip Electronics Co., Ltd
@ -46,24 +46,28 @@ diff -rupN linux.orig/arch/arm64/boot/dts/rockchip/rk3399-anbernic-rg552-opp.dts
+ opp-shared;
+
+ opp00 {
+ opp-hz = /bits/ 64 <1008000000>;
+ opp-microvolt = <925000>;
+ opp-hz = /bits/ 64 <600000000>;
+ opp-microvolt = <825000>;
+ };
+ opp01 {
+ opp-hz = /bits/ 64 <1200000000>;
+ opp-microvolt = <1000000>;
+ opp-hz = /bits/ 64 <1008000000>;
+ opp-microvolt = <900000>;
+ };
+ opp02 {
+ opp-hz = /bits/ 64 <1416000000>;
+ opp-microvolt = <1125000>;
+ opp-hz = /bits/ 64 <1200000000>;
+ opp-microvolt = <975000>;
+ };
+ opp03 {
+ opp-hz = /bits/ 64 <1512000000>;
+ opp-microvolt = <1200000>;
+ opp-hz = /bits/ 64 <1416000000>;
+ opp-microvolt = <1100000>;
+ };
+ opp04 {
+ opp-hz = /bits/ 64 <1512000000>;
+ opp-microvolt = <1150000>;
+ };
+ opp05 {
+ opp-hz = /bits/ 64 <1608000000>;
+ opp-microvolt = <1225000>;
+ opp-microvolt = <1200000>;
+ };
+ };
+
@ -72,30 +76,34 @@ diff -rupN linux.orig/arch/arm64/boot/dts/rockchip/rk3399-anbernic-rg552-opp.dts
+ opp-shared;
+
+ opp00 {
+ opp-hz = /bits/ 64 <1008000000>;
+ opp-microvolt = <875000>;
+ opp-hz = /bits/ 64 <600000000>;
+ opp-microvolt = <825000>;
+ };
+ opp01 {
+ opp-hz = /bits/ 64 <1200000000>;
+ opp-microvolt = <950000>;
+ opp-hz = /bits/ 64 <1008000000>;
+ opp-microvolt = <850000>;
+ };
+ opp02 {
+ opp-hz = /bits/ 64 <1416000000>;
+ opp-microvolt = <1025000>;
+ opp-hz = /bits/ 64 <1200000000>;
+ opp-microvolt = <900000>;
+ };
+ opp03 {
+ opp-hz = /bits/ 64 <1608000000>;
+ opp-microvolt = <1100000>;
+ opp-hz = /bits/ 64 <1416000000>;
+ opp-microvolt = <975000>;
+ };
+ opp04 {
+ opp-hz = /bits/ 64 <1800000000>;
+ opp-microvolt = <1200000>;
+ opp-hz = /bits/ 64 <1608000000>;
+ opp-microvolt = <1050000>;
+ };
+ opp05 {
+ opp-hz = /bits/ 64 <1800000000>;
+ opp-microvolt = <1150000>;
+ };
+ opp06 {
+ opp-hz = /bits/ 64 <1992000000>;
+ opp-microvolt = <1250000>;
+ };
+ opp06 {
+ opp07 {
+ opp-hz = /bits/ 64 <2088000000>;
+ opp-microvolt = <1250000>;
+ };
@ -105,8 +113,8 @@ diff -rupN linux.orig/arch/arm64/boot/dts/rockchip/rk3399-anbernic-rg552-opp.dts
+ compatible = "operating-points-v2";
+
+ opp00 {
+ opp-hz = /bits/ 64 <500000000>;
+ opp-microvolt = <875000>;
+ opp-hz = /bits/ 64 <200000000>;
+ opp-microvolt = <800000>;
+ };
+ opp01 {
+ opp-hz = /bits/ 64 <600000000>;
@ -114,7 +122,7 @@ diff -rupN linux.orig/arch/arm64/boot/dts/rockchip/rk3399-anbernic-rg552-opp.dts
+ };
+ opp02 {
+ opp-hz = /bits/ 64 <800000000>;
+ opp-microvolt = <1100000>;
+ opp-microvolt = <1075000>;
+ };
+ opp03 {
+ opp-hz = /bits/ 64 <900000000>;
@ -169,7 +177,7 @@ diff -rupN linux.orig/arch/arm64/boot/dts/rockchip/rk3399-anbernic-rg552-opp.dts
+};
diff -rupN linux.orig/arch/arm64/boot/dts/rockchip/rk3399-anbernic-rg552.dts linux/arch/arm64/boot/dts/rockchip/rk3399-anbernic-rg552.dts
--- linux.orig/arch/arm64/boot/dts/rockchip/rk3399-anbernic-rg552.dts 1970-01-01 00:00:00.000000000 +0000
+++ linux/arch/arm64/boot/dts/rockchip/rk3399-anbernic-rg552.dts 2023-11-15 14:10:46.134863088 +0000
+++ linux/arch/arm64/boot/dts/rockchip/rk3399-anbernic-rg552.dts 2023-11-28 19:50:16.215638386 +0000
@@ -0,0 +1,1329 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
@ -1501,8 +1509,8 @@ diff -rupN linux.orig/arch/arm64/boot/dts/rockchip/rk3399-anbernic-rg552.dts lin
+ status = "okay";
+};
diff -rupN linux.orig/arch/arm64/boot/dts/rockchip/rk3399.dtsi linux/arch/arm64/boot/dts/rockchip/rk3399.dtsi
--- linux.orig/arch/arm64/boot/dts/rockchip/rk3399.dtsi 2023-11-14 03:58:03.288746149 +0000
+++ linux/arch/arm64/boot/dts/rockchip/rk3399.dtsi 2023-11-15 14:10:46.134863088 +0000
--- linux.orig/arch/arm64/boot/dts/rockchip/rk3399.dtsi 2023-11-28 13:54:59.142120544 +0000
+++ linux/arch/arm64/boot/dts/rockchip/rk3399.dtsi 2023-11-28 19:50:16.215638386 +0000
@@ -1469,7 +1469,7 @@
<1000000000>,
<150000000>, <75000000>,
@ -1513,8 +1521,8 @@ diff -rupN linux.orig/arch/arm64/boot/dts/rockchip/rk3399.dtsi linux/arch/arm64/
<100000000>, <50000000>,
<400000000>, <400000000>,
diff -rupN linux.orig/drivers/gpio/gpio-rockchip.c linux/drivers/gpio/gpio-rockchip.c
--- linux.orig/drivers/gpio/gpio-rockchip.c 2023-11-14 03:58:03.820758323 +0000
+++ linux/drivers/gpio/gpio-rockchip.c 2023-11-15 14:10:46.134863088 +0000
--- linux.orig/drivers/gpio/gpio-rockchip.c 2023-11-28 13:55:00.750154472 +0000
+++ linux/drivers/gpio/gpio-rockchip.c 2023-11-28 19:50:16.215638386 +0000
@@ -335,13 +335,13 @@ static void rockchip_irq_demux(struct ir
unsigned long pending;
unsigned int irq;
@ -1532,8 +1540,8 @@ diff -rupN linux.orig/drivers/gpio/gpio-rockchip.c linux/drivers/gpio/gpio-rockc
/*
* Triggering IRQ on both rising and falling edge
diff -rupN linux.orig/drivers/gpu/drm/panel/Kconfig linux/drivers/gpu/drm/panel/Kconfig
--- linux.orig/drivers/gpu/drm/panel/Kconfig 2023-11-14 03:58:04.344770314 +0000
+++ linux/drivers/gpu/drm/panel/Kconfig 2023-11-15 14:10:46.134863088 +0000
--- linux.orig/drivers/gpu/drm/panel/Kconfig 2023-11-28 13:55:02.030181481 +0000
+++ linux/drivers/gpu/drm/panel/Kconfig 2023-11-28 19:50:16.215638386 +0000
@@ -588,6 +588,15 @@ config DRM_PANEL_SHARP_LS043T1LE01
Say Y here if you want to enable support for Sharp LS043T1LE01 qHD
(540x960) DSI panel as found on the Qualcomm APQ8074 Dragonboard
@ -1551,8 +1559,8 @@ diff -rupN linux.orig/drivers/gpu/drm/panel/Kconfig linux/drivers/gpu/drm/panel/
tristate "Sharp LS060T1SX01 FullHD video mode panel"
depends on OF
diff -rupN linux.orig/drivers/gpu/drm/panel/Makefile linux/drivers/gpu/drm/panel/Makefile
--- linux.orig/drivers/gpu/drm/panel/Makefile 2023-11-14 03:58:04.344770314 +0000
+++ linux/drivers/gpu/drm/panel/Makefile 2023-11-15 14:10:46.134863088 +0000
--- linux.orig/drivers/gpu/drm/panel/Makefile 2023-11-28 13:55:02.030181481 +0000
+++ linux/drivers/gpu/drm/panel/Makefile 2023-11-28 19:50:16.215638386 +0000
@@ -59,6 +59,7 @@ obj-$(CONFIG_DRM_PANEL_SEIKO_43WVF1G) +=
obj-$(CONFIG_DRM_PANEL_SHARP_LQ101R1SX01) += panel-sharp-lq101r1sx01.o
obj-$(CONFIG_DRM_PANEL_SHARP_LS037V7DW01) += panel-sharp-ls037v7dw01.o
@ -1563,7 +1571,7 @@ diff -rupN linux.orig/drivers/gpu/drm/panel/Makefile linux/drivers/gpu/drm/panel
obj-$(CONFIG_DRM_PANEL_SITRONIX_ST7703) += panel-sitronix-st7703.o
diff -rupN linux.orig/drivers/gpu/drm/panel/panel-sharp-ls054b3sx01.c linux/drivers/gpu/drm/panel/panel-sharp-ls054b3sx01.c
--- linux.orig/drivers/gpu/drm/panel/panel-sharp-ls054b3sx01.c 1970-01-01 00:00:00.000000000 +0000
+++ linux/drivers/gpu/drm/panel/panel-sharp-ls054b3sx01.c 2023-11-15 14:10:46.134863088 +0000
+++ linux/drivers/gpu/drm/panel/panel-sharp-ls054b3sx01.c 2023-11-28 19:50:16.215638386 +0000
@@ -0,0 +1,360 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
@ -1926,8 +1934,8 @@ diff -rupN linux.orig/drivers/gpu/drm/panel/panel-sharp-ls054b3sx01.c linux/driv
+MODULE_DESCRIPTION("Panel driver for Sharp LS054B3SX01 1152x1920 Video Mode DSI Panel");
+MODULE_LICENSE("GPL v2");
diff -rupN linux.orig/drivers/input/Kconfig linux/drivers/input/Kconfig
--- linux.orig/drivers/input/Kconfig 2023-11-14 03:58:04.472773245 +0000
+++ linux/drivers/input/Kconfig 2023-11-15 14:10:46.134863088 +0000
--- linux.orig/drivers/input/Kconfig 2023-11-28 13:55:02.446190257 +0000
+++ linux/drivers/input/Kconfig 2023-11-28 19:50:16.215638386 +0000
@@ -51,6 +51,19 @@ config INPUT_FF_MEMLESS
To compile this driver as a module, choose M here: the
module will be called ff-memless.
@ -1949,8 +1957,8 @@ diff -rupN linux.orig/drivers/input/Kconfig linux/drivers/input/Kconfig
tristate "Sparse keymap support library"
help
diff -rupN linux.orig/drivers/input/Makefile linux/drivers/input/Makefile
--- linux.orig/drivers/input/Makefile 2023-11-14 03:58:04.472773245 +0000
+++ linux/drivers/input/Makefile 2023-11-15 14:10:46.134863088 +0000
--- linux.orig/drivers/input/Makefile 2023-11-28 13:55:02.446190257 +0000
+++ linux/drivers/input/Makefile 2023-11-28 19:50:16.215638386 +0000
@@ -10,6 +10,7 @@ input-core-y := input.o input-compat.o i
input-core-y += touchscreen.o
@ -1961,7 +1969,7 @@ diff -rupN linux.orig/drivers/input/Makefile linux/drivers/input/Makefile
obj-$(CONFIG_INPUT_VIVALDIFMAP) += vivaldi-fmap.o
diff -rupN linux.orig/drivers/input/input-polldev.c linux/drivers/input/input-polldev.c
--- linux.orig/drivers/input/input-polldev.c 1970-01-01 00:00:00.000000000 +0000
+++ linux/drivers/input/input-polldev.c 2023-11-15 14:10:46.134863088 +0000
+++ linux/drivers/input/input-polldev.c 2023-11-28 19:50:16.215638386 +0000
@@ -0,0 +1,362 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
@ -2326,8 +2334,8 @@ diff -rupN linux.orig/drivers/input/input-polldev.c linux/drivers/input/input-po
+}
+EXPORT_SYMBOL(input_unregister_polled_device);
diff -rupN linux.orig/drivers/input/joystick/Kconfig linux/drivers/input/joystick/Kconfig
--- linux.orig/drivers/input/joystick/Kconfig 2023-11-14 03:58:04.472773245 +0000
+++ linux/drivers/input/joystick/Kconfig 2023-11-15 14:10:46.134863088 +0000
--- linux.orig/drivers/input/joystick/Kconfig 2023-11-28 13:55:02.446190257 +0000
+++ linux/drivers/input/joystick/Kconfig 2023-11-28 19:50:16.215638386 +0000
@@ -393,6 +393,12 @@ config JOYSTICK_FSIA6B
To compile this driver as a module, choose M here: the
module will be called fsia6b.
@ -2342,8 +2350,8 @@ diff -rupN linux.orig/drivers/input/joystick/Kconfig linux/drivers/input/joystic
bool "N64 controller"
depends on MACH_NINTENDO64
diff -rupN linux.orig/drivers/input/joystick/Makefile linux/drivers/input/joystick/Makefile
--- linux.orig/drivers/input/joystick/Makefile 2023-11-14 03:58:04.472773245 +0000
+++ linux/drivers/input/joystick/Makefile 2023-11-15 14:10:46.134863088 +0000
--- linux.orig/drivers/input/joystick/Makefile 2023-11-28 13:55:02.446190257 +0000
+++ linux/drivers/input/joystick/Makefile 2023-11-28 19:50:16.215638386 +0000
@@ -30,6 +30,7 @@ obj-$(CONFIG_JOYSTICK_PXRC) += pxrc.o
obj-$(CONFIG_JOYSTICK_QWIIC) += qwiic-joystick.o
obj-$(CONFIG_JOYSTICK_SENSEHAT) += sensehat-joystick.o
@ -2354,7 +2362,7 @@ diff -rupN linux.orig/drivers/input/joystick/Makefile linux/drivers/input/joysti
obj-$(CONFIG_JOYSTICK_STINGER) += stinger.o
diff -rupN linux.orig/drivers/input/joystick/singleadcjoy.c linux/drivers/input/joystick/singleadcjoy.c
--- linux.orig/drivers/input/joystick/singleadcjoy.c 1970-01-01 00:00:00.000000000 +0000
+++ linux/drivers/input/joystick/singleadcjoy.c 2023-11-15 14:10:46.134863088 +0000
+++ linux/drivers/input/joystick/singleadcjoy.c 2023-11-28 19:50:16.215638386 +0000
@@ -0,0 +1,1416 @@
+/*----------------------------------------------------------------------------*/
+
@ -3773,8 +3781,8 @@ diff -rupN linux.orig/drivers/input/joystick/singleadcjoy.c linux/drivers/input/
+late_initcall(joypad_init);
+module_exit(joypad_exit);
diff -rupN linux.orig/drivers/input/touchscreen/goodix.c linux/drivers/input/touchscreen/goodix.c
--- linux.orig/drivers/input/touchscreen/goodix.c 2023-11-14 03:58:04.488773611 +0000
+++ linux/drivers/input/touchscreen/goodix.c 2023-11-15 14:10:46.134863088 +0000
--- linux.orig/drivers/input/touchscreen/goodix.c 2023-11-28 13:55:02.482191017 +0000
+++ linux/drivers/input/touchscreen/goodix.c 2023-11-28 19:50:16.215638386 +0000
@@ -1037,7 +1037,7 @@ retry_get_irq_gpio:
default:
if (ts->gpiod_int && ts->gpiod_rst) {
@ -3785,8 +3793,8 @@ diff -rupN linux.orig/drivers/input/touchscreen/goodix.c linux/drivers/input/tou
}
}
diff -rupN linux.orig/drivers/power/supply/cw2015_battery.c linux/drivers/power/supply/cw2015_battery.c
--- linux.orig/drivers/power/supply/cw2015_battery.c 2023-11-14 03:58:05.048786424 +0000
+++ linux/drivers/power/supply/cw2015_battery.c 2023-11-15 14:10:46.134863088 +0000
--- linux.orig/drivers/power/supply/cw2015_battery.c 2023-11-28 13:55:04.226227817 +0000
+++ linux/drivers/power/supply/cw2015_battery.c 2023-11-28 19:50:16.215638386 +0000
@@ -553,7 +553,7 @@ static enum power_supply_property cw_bat
};
@ -3798,7 +3806,7 @@ diff -rupN linux.orig/drivers/power/supply/cw2015_battery.c linux/drivers/power/
.num_properties = ARRAY_SIZE(cw_battery_properties),
diff -rupN linux.orig/include/linux/input-polldev.h linux/include/linux/input-polldev.h
--- linux.orig/include/linux/input-polldev.h 1970-01-01 00:00:00.000000000 +0000
+++ linux/include/linux/input-polldev.h 2023-11-15 14:10:46.134863088 +0000
+++ linux/include/linux/input-polldev.h 2023-11-28 19:50:16.215638386 +0000
@@ -0,0 +1,58 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+#ifndef _INPUT_POLLDEV_H