From 29f5c67ea625f59f59dc304c6c18f2d2f5cd856b Mon Sep 17 00:00:00 2001 From: Carl Kittelberger Date: Sun, 24 Sep 2023 19:46:01 +0200 Subject: [PATCH] Add az01-specific scripts. --- .../rootfs_overlay/usr/local/bin/run-mixxx.sh | 36 ++++++++++++++++ .../usr/local/bin/set-irq-affinity.sh | 6 +++ .../usr/local/bin/setup-prerequisites.sh | 41 +++++++++++++++++++ .../usr/local/bin/setup-screenrotation.sh | 29 +++++++++++++ 4 files changed, 112 insertions(+) create mode 100755 buildroot-customizations/board/akai/az01/rootfs_overlay/usr/local/bin/run-mixxx.sh create mode 100755 buildroot-customizations/board/akai/az01/rootfs_overlay/usr/local/bin/set-irq-affinity.sh create mode 100755 buildroot-customizations/board/akai/az01/rootfs_overlay/usr/local/bin/setup-prerequisites.sh create mode 100755 buildroot-customizations/board/akai/az01/rootfs_overlay/usr/local/bin/setup-screenrotation.sh diff --git a/buildroot-customizations/board/akai/az01/rootfs_overlay/usr/local/bin/run-mixxx.sh b/buildroot-customizations/board/akai/az01/rootfs_overlay/usr/local/bin/run-mixxx.sh new file mode 100755 index 0000000..3d1067d --- /dev/null +++ b/buildroot-customizations/board/akai/az01/rootfs_overlay/usr/local/bin/run-mixxx.sh @@ -0,0 +1,36 @@ +#!/bin/sh + +# which product are we running on? +APPNAME=`cat /sys/firmware/devicetree/base/inmusic,product-code` + +# detect installation path of our custom scripts +scriptspath="$(command -v setup-prerequisites.sh)" +if [ -z "$scriptspath" ]; then + scriptspath="$(pwd)" +else + scriptspath="$(dirname "$scriptspath")" +fi + +# set up cpu assignment and other device stuff +"$scriptspath"/setup-prerequisites.sh $APPNAME + +# test for an existing bus daemon, just to be safe +if test -z "$DBUS_SESSION_BUS_ADDRESS" ; then + # if not found, launch a new one + eval `dbus-launch --sh-syntax` +fi + +# set up screen/input rotation +source "$scriptspath"/setup-screenrotation.sh $APPNAME + +# run upower if it is available +if command -v upower; then + "$(dirname $(readlink -f $(command -v upower)))/../libexec/upowerd" & +fi + +# run command in gdbserver if wanted +if [ -n "${GDBSERVER:-}" ]; then + exec gdbserver :2345 mixxx "$@" +fi + +exec mixxx "$@" diff --git a/buildroot-customizations/board/akai/az01/rootfs_overlay/usr/local/bin/set-irq-affinity.sh b/buildroot-customizations/board/akai/az01/rootfs_overlay/usr/local/bin/set-irq-affinity.sh new file mode 100755 index 0000000..b64301c --- /dev/null +++ b/buildroot-customizations/board/akai/az01/rootfs_overlay/usr/local/bin/set-irq-affinity.sh @@ -0,0 +1,6 @@ +#!/bin/sh + +IRQ=$1 +CPU=$2 +echo "Setting" $IRQ "to CPU: "$CPU +grep $IRQ /proc/interrupts | cut -d':' -f1 | tr -d " \t" | xargs -t -i sh -c 'echo $1 > /proc/irq/$2/smp_affinity_list' -- $CPU {} diff --git a/buildroot-customizations/board/akai/az01/rootfs_overlay/usr/local/bin/setup-prerequisites.sh b/buildroot-customizations/board/akai/az01/rootfs_overlay/usr/local/bin/setup-prerequisites.sh new file mode 100755 index 0000000..aea8668 --- /dev/null +++ b/buildroot-customizations/board/akai/az01/rootfs_overlay/usr/local/bin/setup-prerequisites.sh @@ -0,0 +1,41 @@ +#!/bin/sh + +APPNAME=$1 + +# Increase priority to max for audio IRQ +grep -h irq/.*ffb20000 /proc/*/stat 2>/dev/null | cut -d' ' -f1 | xargs -i chrt -f -p 99 {} +# Setting GPU to CPU 1 +set-irq-affinity.sh ffa30000 1 +# Setting Audio to CPU 3 +set-irq-affinity.sh ffb20000 3 +# Setting Network to CPU 1 +set-irq-affinity.sh eth0 1 + +if [ ! -e /sys/firmware/devicetree/base/serial@ff190000/control-surface ]; +then + # Control surface is on USB (not UART) so setting USB to CPU 1: + set-irq-affinity.sh ehci_hcd 1 + set-irq-affinity.sh ff540000 1 +fi + +# Enable external SD Card interface +echo external > /sys/bus/platform/devices/sd-mux/state + +# Set GPU governor to performance mode +if [ $APPNAME == "JP21" ]; +then + echo simple_ondemand > /sys/devices/platform/ffa30000.gpu/devfreq/ffa30000.gpu/governor +else + echo performance > /sys/devices/platform/ffa30000.gpu/devfreq/ffa30000.gpu/governor +fi + +# Set midi output buffer size to max +echo 524287 > /sys/module/snd_seq_midi/parameters/output_buffer_size + +# Disable vsync_on_pan, with the new Linux kernel vsync is on by default, +# and this line would add a double vsync, thereby halving the framerate. +# vsync_on_pan is a mechanism introduced by John Keeping +echo 0 >/sys/class/graphics/fb0/vsync_on_pan + +# supressing debug output to avoid audio dropouts on USB/SD device plugging +dmesg -n crit diff --git a/buildroot-customizations/board/akai/az01/rootfs_overlay/usr/local/bin/setup-screenrotation.sh b/buildroot-customizations/board/akai/az01/rootfs_overlay/usr/local/bin/setup-screenrotation.sh new file mode 100755 index 0000000..b213751 --- /dev/null +++ b/buildroot-customizations/board/akai/az01/rootfs_overlay/usr/local/bin/setup-screenrotation.sh @@ -0,0 +1,29 @@ +#!/bin/sh + +APPNAME=$1 + +panelRotationFile=/sys/firmware/devicetree/base/inmusic,panel-rotation +touchRotationFile=/sys/firmware/devicetree/base/inmusic,touch-rotation + +[ -f $panelRotationFile ] && panelHex=`xxd -p -s2 -c2 $panelRotationFile` && panelDec=$((0x$panelHex)) +[ -f $touchRotationFile ] && touchHex=`xxd -p -s2 -c2 $touchRotationFile` && touchDec=$((0x$touchHex)) + +if [ -n "$panelHex" ] && [ $(($panelDec % 90)) -eq 0 ] +then + [ $panelDec -gt 180 ] && let panelDec=panelDec-360 + + export AIR_SCREEN_ROTATION=$panelDec + echo Screen rotation is set to $panelDec + + if [ -n "$touchHex" ] && [ $(($touchDec % 90)) -eq 0 ] + then + [ $touchDec -gt 180 ] && let touchDec=touchDec-360 + + let rotation=panelDec-touchDec + export QT_QPA_EVDEV_TOUCHSCREEN_PARAMETERS=rotate=$rotation + echo Touch rotation is set to $rotation + fi +else + echo Screen rotation has not been set +fi +