soc-qcom: new aport (MR 6189)

This is basically a copy of soc-qcom-sdm845, which many things (even
non-sdm845 stuff) were depending on.
This commit is contained in:
Clayton Craft 2025-02-08 08:55:21 -08:00
parent d41a2282b0
commit bd4c139c4d
No known key found for this signature in database
GPG key ID: 4A4CED6D7EDF950A
20 changed files with 369 additions and 1 deletions

View file

@ -24,7 +24,7 @@ sh_files="
./main/postmarketos-mkinitfs-hook-netboot/netboot.sh
./main/ttyescape/*.post-install
./main/unl0kr/unlock.sh
./device/community/soc-qcom-sdm845/call_audio_idle_suspend_workaround.sh
./device/community/soc-qcom/call_audio_idle_suspend_workaround.sh
$(find . -path './main/postmarketos-ui-*/*.sh')
$(find . -path './main/postmarketos-ui-*/*.pre-install')

View file

@ -36,6 +36,7 @@ device/*/*-qcom-sdm670/ @flamingradian
device/*/*-qcom-sdm845/ @sdm845-mainline
device/*/*-qcom-sm6350/ @z3ntu
device/*/*-qcom-sm8250/ @jianhua
device/*/*-qcom/ @calebccff
device/*/*-samsung-a3/ @Mis012 @TravMurav @Minecrell
device/*/*-samsung-a5/ @Minecrell @minlexx
device/*/*-samsung-a51/ @manoedinata

View file

@ -0,0 +1,26 @@
monitor.alsa.rules = [
{
matches = [
{
# Matches all sources
node.name = "~alsa_input.*"
},
{
# Matches all sinks
node.name = "~alsa_output.*"
}
]
actions = {
update-props = {
audio.format = "S16LE"
audio.rate = 48000
api.alsa.period-size = 4096
api.alsa.period-num = 6
api.alsa.headroom = 512,
# session.suspend-timeout-seconds = 0
# dither.method = "wannamaker3", # add dither of desired shape
# dither.noise = 2, # add additional bits of noise
}
}
}
]

View file

@ -0,0 +1 @@
SUBSYSTEM=="input", KERNEL=="event*", ENV{ID_INPUT}=="1", SUBSYSTEMS=="input", ATTRS{name}=="spmi_haptics", TAG+="uaccess", ENV{FEEDBACKD_TYPE}="vibra"

View file

@ -0,0 +1,161 @@
# Maintainer: Caleb Connolly <caleb@connolly.tech>
pkgname=soc-qcom
pkgdesc="Common package for Qualcomm devices"
pkgver=1
pkgrel=0
url="https://postmarketos.org"
license="BSD-3-Clause"
arch="aarch64"
options="!check !archcheck !tracedeps"
depends="
bootmac
msm-modem
pd-mapper
swclock-offset
tqftpserv
"
replaces="
soc-qcom-sdm845
soc-qcom-sdm845-nonfree-firmware
upower
"
subpackages="
$pkgname-gstreamer-openrc:gstreamer_openrc
$pkgname-gstreamer-systemd:gstreamer_systemd
$pkgname-modem
$pkgname-modem-openrc:modem_openrc
$pkgname-openrc
$pkgname-pulseaudio
$pkgname-pulseaudio-openrc:pulseaudio_openrc
$pkgname-qbootctl
$pkgname-qbootctl-openrc:qbootctl_openrc
$pkgname-vulkan
"
source="
51-qcom.conf
90-feedbackd-pmi8998.rules
UPower.conf
call_audio_idle_suspend_workaround.confd
call_audio_idle_suspend_workaround.initd
call_audio_idle_suspend_workaround.sh
gstreamer.conf
gstreamer.sh
modemmanager.conf
"
package() {
mkdir -p "$pkgdir"
install -Dm644 "$srcdir"/90-feedbackd-pmi8998.rules \
"$pkgdir"/usr/lib/udev/rules.d/90-feedbackd-pmi8998.rules
# Shutdown when battery is critical instead of sleep
install -Dm644 "$srcdir"/UPower.conf \
"$pkgdir"/etc/UPower/UPower.conf
install -Dm644 "$srcdir"/51-qcom.conf \
-t "$pkgdir"/usr/share/wireplumber/wireplumber.conf.d
}
gstreamer_openrc() {
install_if="$pkgname=$pkgver-r$pkgrel openrc"
replaces="soc-qcom-sdm845-gstreamer-openrc"
install -Dm755 "$srcdir"/gstreamer.sh \
"$subpkgdir"/etc/profile.d/50-soc-qcom-gstreamer.sh
}
gstreamer_systemd() {
install_if="$pkgname=$pkgver-r$pkgrel systemd"
replaces="soc-qcom-sdm845-gstreamer-systemd"
install -Dm644 "$srcdir"/gstreamer.conf \
"$subpkgdir"/etc/environment.d/50-soc-qcom-gstreamer.conf
}
modem() {
pkgdesc="Modem services and configuration"
depends="
q6voiced
msm-modem-uim-selection
81voltd
"
mkdir -p "$subpkgdir"
}
modem_openrc() {
install_if="$pkgname-modem=$pkgver-r$pkgrel openrc"
depends="q6voiced-openrc"
replaces="soc-qcom-sdm845-modem-openrc"
install="$subpkgname.post-install $subpkgname.post-upgrade"
install -Dm644 "$srcdir"/modemmanager.conf \
"$subpkgdir"/etc/conf.d/modemmanager
}
openrc() {
install_if="$pkgname=$pkgver-r$pkgrel openrc"
depends="
pd-mapper-openrc
tqftpserv-openrc
"
install="$subpkgname.post-install $subpkgname.post-upgrade"
mkdir "$subpkgdir"
}
qbootctl() {
pkgdesc="Enable qbootctl mark-boot-successful service"
depends="qbootctl"
mkdir "$subpkgdir"
}
qbootctl_openrc() {
install_if="$pkgname-qbootctl=$pkgver-r$pkgrel openrc"
install="$subpkgname.post-install $subpkgname.post-upgrade"
mkdir "$subpkgdir"
}
vulkan() {
pkgdesc="Vulkan support for freedreno"
install_if="$pkgname vulkan-loader"
depends="mesa-vulkan-freedreno"
mkdir "$subpkgdir"
}
pulseaudio() {
install_if="$pkgname=$pkgver-r$pkgrel pulseaudio"
replaces="soc-qcom-sdm845-pulseaudio"
# Call Audio idle suspend workaround code
install -Dm755 "$srcdir"/call_audio_idle_suspend_workaround.sh \
"$subpkgdir"/usr/sbin/call_audio_idle_suspend_workaround
}
pulseaudio_openrc() {
install_if="$pkgname-pulseaudio=$pkgver-r$pkgrel openrc"
install="$subpkgname.post-install $subpkgname.post-upgrade"
replaces="soc-qcom-sdm845-pulseaudio-openrc"
# Call Audio idle suspend workaround init script
install -Dm755 "$srcdir"/call_audio_idle_suspend_workaround.initd \
"$subpkgdir"/etc/init.d/call_audio_idle_suspend_workaround
install -Dm644 "$srcdir"/call_audio_idle_suspend_workaround.confd \
"$subpkgdir"/etc/conf.d/call_audio_idle_suspend_workaround
}
sha512sums="
28c14f47eaedec577d152001c51753537c98f267ac4a0acf78a304efebe5f6a1b4dc6d501497da9a0a925806a1d9c80b25e001cf9b1eb21efa22cd6a41ff753b 51-qcom.conf
4f2c22a3a3fc7d380e200ad977578107d81f0e7ade7918e03bdb15b60a564e8db5f47e13cce22f636d38fd3722696bb46076b8872dae0ca2d8a3838522a1f025 90-feedbackd-pmi8998.rules
9d455b56558d453d501a1ad869ffa79f9952ed43485a9847d506db6a78bfcd9f9c9d855660ee1d368eb74f4429385ec166addc30d802261c75562e785fe84c52 UPower.conf
6fb4c0bd8b7ed534d855a6732ccff783960e3cfa0e0cc7effcbb93afa00798dec15361a37a3200081bc114c8d266b7a0851cc4e819ad36eabdb47a50c72620d9 call_audio_idle_suspend_workaround.confd
5a58475b6e2ee1d655f3f23d8dc19e1cb2f32f1dfff3b9a9337d9c5baad1ec24bfaec0fb9cc03f00e5a291bee27c6b8bffbc65157e2bee5d65ef6d1adcb0910b call_audio_idle_suspend_workaround.initd
6da0a9209f114354aa2aa1185ec3896a8e0bb1bfce0dc3fc4c0de339cf1389feaa2d724e733c251ff032a5e86d37d9549e94f8f7c7a5accfedbd8a4d6316bbfd call_audio_idle_suspend_workaround.sh
f86ebf68bb7e41b531e5cd8fc3e54d8fafad314fb80950277e41004303b3bf75b2ae96f0228bdf4ed67645aee8ceaf247140b4843c66365259d2908b8991b877 gstreamer.conf
471583b91bc35608cb75d0b3ceb88fa793a4e763ea228703c50ffb1b45c0e9054646c46f710164ec3ef65a882a204fd59546f3a0ebb94b8d6c6f08c4043bcfd3 gstreamer.sh
e33f41360ccc4900bb76a26cc7b46bde1fb90facdf45c4fbcebc80499386939948401cacd6df9f779eafab10f4ee77ee1fef3e7bd06f483f8c2a4a644c84f327 modemmanager.conf
"

View file

@ -0,0 +1,94 @@
# Only the system vendor should modify this file, ordinary users
# should not have to change anything.
[UPower]
# Enable the Watts Up Pro device.
#
# The Watts Up Pro contains a generic FTDI USB device without a specific
# vendor and product ID. When we probe for WUP devices, we can cause
# the user to get a perplexing "Device or resource busy" error when
# attempting to use their non-WUP device.
#
# The generic FTDI device is known to also be used on:
#
# - Sparkfun FT232 breakout board
# - Parallax Propeller
#
# default=false
EnableWattsUpPro=false
# Don't poll the kernel for battery level changes.
#
# Some hardware will send us battery level changes through
# events, rather than us having to poll for it. This option
# allows disabling polling for hardware that sends out events.
#
# default=false
NoPollBatteries=false
# Do we ignore the lid state
#
# Some laptops are broken. The lid state is either inverted, or stuck
# on or off. We can't do much to fix these problems, but this is a way
# for users to make the laptop panel vanish, a state that might be used
# by a couple of user-space daemons. On Linux systems, see also
# logind.conf(5).
#
# default=false
IgnoreLid=false
# Policy for warnings and action based on battery levels
#
# Whether battery percentage based policy should be used. The default
# is to use the time left, change to true to use the percentage, which
# should work around broken firmwares. It is also more reliable than
# the time left (frantically saving all your files is going to use more
# battery than letting it rest for example).
# default=true
UsePercentageForPolicy=true
# When UsePercentageForPolicy is true, the levels at which UPower will
# consider the battery low, critical, or take action for the critical
# battery level.
#
# This will also be used for batteries which don't have time information
# such as that of peripherals.
#
# If any value is invalid, or not in descending order, the defaults
# will be used.
#
# Defaults:
# PercentageLow=20
# PercentageCritical=5
# PercentageAction=2
PercentageLow=10
PercentageCritical=5
PercentageAction=3
# When UsePercentageForPolicy is false, the time remaining in seconds at
# which UPower will consider the battery low, critical, or take action for
# the critical battery level.
#
# If any value is invalid, or not in descending order, the defaults
# will be used.
#
# Defaults:
# TimeLow=1200
# TimeCritical=300
# TimeAction=120
TimeLow=1200
TimeCritical=300
TimeAction=120
# The action to take when "TimeAction" or "PercentageAction" above has been
# reached for the batteries (UPS or laptop batteries) supplying the computer
#
# Possible values are:
# PowerOff
# Hibernate
# HybridSleep
#
# If HybridSleep isn't available, Hibernate will be used
# If Hibernate isn't available, PowerOff will be used
CriticalPowerAction=PowerOff

View file

@ -0,0 +1,10 @@
userid=10000 # Default User ID in pmOS
command_user=$(getent passwd $userid | cut -d: -f1)
# Sxmo's XDG_RUNTIME_DIR is different than what is used in phosh
[ -f "/etc/profile.d/sxmo_init.sh" ] && XDG_RUNTIME_DIR="/dev/shm/user/$userid"
# If the XDG_RUNTIME_DIR env variable is not set for a specific ui, set it to default for phosh
[ -z "$XDG_RUNTIME_DIR" ] && XDG_RUNTIME_DIR="/run/user/$userid"
env_var="XDG_RUNTIME_DIR=$XDG_RUNTIME_DIR"

View file

@ -0,0 +1,14 @@
#!/sbin/openrc-run
name="call_audio_idle_suspend_workaround"
description="Disable pulseaudio suspend-on-idle module during call"
pid="/run/call_audio_idle_suspend_workaround.pid"
command="/usr/sbin/call_audio_idle_suspend_workaround"
supervisor=supervise-daemon
respawn_delay=1
respawn_max=10
start_stop_daemon_args="--env $env_var"
depend() {
need dbus
}

View file

@ -0,0 +1,39 @@
#!/bin/sh
# dbus-monitor is run as a child process to this script. Kill child process too when the script terminates.
trap 'pkill -9 -P $$ && exit 0' INT TERM
interface=org.freedesktop.ModemManager1.Call
member=StateChanged
dbus-monitor --system "type='signal',interface='$interface',member='$member'" |
while read -r line; do
state=$(echo "$line" | awk '/\<int32\>/ {print $2}')
if [ -n "$state" ]; then
# Call State is based on https://www.freedesktop.org/software/ModemManager/doc/latest/ModemManager/ModemManager-Flags-and-Enumerations.html#MMCallState
if [ "$state" -eq '0' ] || [ "$state" -eq '3' ]; then
echo "Call Started"
# Unload module-suspend-on-idle when call begins
pidof pulseaudio && pactl unload-module module-suspend-on-idle
# With Wireplumber audio, the Pulseaudio
# compatibility layer doesn't support
# loading/unloading the suspend module. Add
# loopback sinks and sources instead.
sleep 1
pw-loopback -m '[FL FR]' --capture-props='media.class=Audio/Sink' &
pw-loopback -m '[FL FR]' --playback-props='media.class=Audio/Source' &
fi
if [ "$state" -eq '7' ]; then
echo "Call Ended"
killall -9 pw-loopback &
# Reload module-suspend-on-idle after call ends
pidof pulseaudio && pactl load-module module-suspend-on-idle
fi
fi
done &
wait

View file

@ -0,0 +1 @@
GST_PLUGIN_FEATURE_RANK=v4l2vp8dec:SECONDARY,v4l2vp8enc:NONE,v4l2vp9dec:SECONDARY,v4l2h264dec:SECONDARY,v4l2h264enc:NONE,v4l2h265dec:SECONDARY,v4l2h265enc:NONE,v4l2mpeg2dec:SECONDARY

View file

@ -0,0 +1 @@
export GST_PLUGIN_FEATURE_RANK=v4l2vp8dec:SECONDARY,v4l2vp8enc:NONE,v4l2vp9dec:SECONDARY,v4l2h264dec:SECONDARY,v4l2h264enc:NONE,v4l2h265dec:SECONDARY,v4l2h265enc:NONE,v4l2mpeg2dec:SECONDARY

View file

@ -0,0 +1,6 @@
# /etc/conf.d/modemmanager: config file for modemmanager
# Add extra command line options to modemmanager, use with care
# ModemManager --help for possible values
# Use quick suspend/resume hooks
modemmanager_opts="--test-quick-suspend-resume"

View file

@ -0,0 +1,2 @@
#!/bin/sh
rc-update add q6voiced default

View file

@ -0,0 +1 @@
soc-qcom-modem-openrc.post-install

View file

@ -0,0 +1,3 @@
#!/bin/sh
rc-update add tqftpserv boot
rc-update add pd-mapper boot

View file

@ -0,0 +1 @@
soc-qcom-openrc.post-install

View file

@ -0,0 +1,3 @@
#!/bin/sh
rc-update add call_audio_idle_suspend_workaround default

View file

@ -0,0 +1 @@
soc-qcom-pulseaudio-openrc.post-install

View file

@ -0,0 +1,2 @@
#!/bin/sh
rc-update add qbootctl default

View file

@ -0,0 +1 @@
soc-qcom-qbootctl-openrc.post-install