jolla-sbj: various features (MR 2172)

This commit is contained in:
Stephan G 2021-05-15 10:05:30 +02:00 committed by Bart Ribbers
parent 97ca96ceb0
commit b626cc84b9
No known key found for this signature in database
GPG key ID: 699D16185DAFAE61
15 changed files with 497 additions and 8 deletions

View file

@ -0,0 +1,5 @@
SUBSYSTEM=="power_supply", ATTRS{type}=="Battery", ATTRS{status}=="Charging", \
RUN+="/usr/lib/device-jolla-sbj/led-charging-sbj.sh"
SUBSYSTEM=="power_supply", ATTRS{type}=="Battery", ATTRS{status}=="Discharging", \
RUN+="/usr/lib/device-jolla-sbj/led-discharging-sbj.sh"

View file

@ -1,16 +1,28 @@
# Reference: <https://postmarketos.org/devicepkg>
pkgname=device-jolla-sbj
pkgdesc="Jolla phone"
pkgver=0.2
pkgrel=1
pkgver=0.3
pkgrel=0
url="https://postmarketos.org"
license="MIT"
arch="armv7"
options="!check !archcheck"
depends="postmarketos-base linux-jolla-sbj mkbootimg mesa-dri-swrast msm-fb-refresher"
depends="postmarketos-base linux-jolla-sbj mkbootimg mesa-dri-gallium msm-fb-refresher wcnss-wlan alsa-ucm-conf"
makedepends="devicepkg-dev"
install="$pkgname.post-install $pkgname.post-upgrade"
subpackages="$pkgname-nonfree-firmware:nonfree_firmware"
source="deviceinfo"
source="deviceinfo
load-wlan-module
wcnss-wlan
100-charging.rules
led-charging-sbj.sh
led-discharging-sbj.sh
pointercal
asound.state
ucm/msm8930-sitar.conf
ucm/HiFi.conf
buttons.conf
"
build() {
devicepkg_build $startdir $pkgname
@ -18,14 +30,54 @@ build() {
package() {
devicepkg_package $startdir $pkgname
install -Dm744 "$srcdir"/led-charging-sbj.sh \
"$pkgdir"/usr/lib/device-jolla-sbj/led-charging-sbj.sh
install -Dm744 "$srcdir"/led-discharging-sbj.sh \
"$pkgdir"/usr/lib/device-jolla-sbj/led-discharging-sbj.sh
install -Dm644 "$srcdir"/100-charging.rules \
"$pkgdir"/etc/udev/rules.d/100-charging.rules
install -D -m644 "$srcdir"/pointercal \
"$pkgdir"/etc/pointercal
install -D -m644 "$srcdir"/asound.state \
"$pkgdir"/var/lib/alsa/asound.state
# Install triggerhappy evdev rules for sbj
install -Dm755 "$srcdir"/buttons.conf "$pkgdir"/etc/triggerhappy/triggers.d/buttons.conf
# Alsa usecase manager config
install -D -m644 "$srcdir"/msm8930-sitar.conf \
"$pkgdir"/usr/share/alsa/ucm2/msm8930-sitar/msm8930-sitar.conf
install -D -m644 "$srcdir"/HiFi.conf \
"$pkgdir"/usr/share/alsa/ucm2/msm8930-sitar/HiFi.conf
# Remove v4l rules due to crashes and hangs
ln -s /dev/null "$pkgdir"/etc/udev/rules.d/60-persistent-v4l.rules
}
nonfree_firmware() {
pkgdesc="Firmware for Modem and WiFi"
depends="firmware-jolla-sbj-modem firmware-jolla-sbj-wlan msm-modem-downstream"
mkdir "$subpkgdir"
install -Dm755 "$srcdir"/load-wlan-module \
"$pkgdir"/etc/init.d/load-wlan-module
install -Dm644 "$srcdir"/wcnss-wlan \
"$pkgdir"/etc/conf.d/wcnss-wlan
}
sha512sums="
1dcb1fdedb3d2410228f70f0dbbec005a30d644e508d9d809fcef2b16f86760df4a6781d06b3940fe82bf774ed9d96aa4b97b4bad4a2d1ab924f2c3e1affd009 deviceinfo
583ff7c598ae8636227bf5b28a396516a235d7f6da3817a525bfbc95b0964d7896ace4416bd3ddfdd0c5ee00a6fb569a7541d31847ee783d5b74f307ea6ad2ed deviceinfo
22339e8b1c854e740034fe305d8447a88f7be98f8f2ef86b7e9ea6e373a30643993d95865c820df6c3598605d3390eb93a859c7a423f04de54a3b06a69adcb55 load-wlan-module
a8cfde9dd3bc96d990038443e8d10a551f13536f017992ae23545d2f1e09b0f729e5cfd1f94f52a2a335335172f082925b91c980695a27f76f636343de795898 wcnss-wlan
829c8c8699188b6d0347a947abdb66f44096ac3a35094fb4d574b8debb6cb410f1f403321fed2cf82678fc7f52cb156959124aa6c15f3ef728b7237d62240e7e 100-charging.rules
e6241b7cebe2f970fb6d24ecd18edc55e92e73307594e6dda985fc9b0a2f5039313bb835b7969faf1d6aba9aed2cf97d4d7f24744e5d7528d3b7402b0dd72693 led-charging-sbj.sh
df54971314fde8e917e675b7813f208bc0e92748d177e9e07faf27c9e8d66e816de47da9a6760be0327842a9196ff563debc09a3a478485c814d7cbee3217095 led-discharging-sbj.sh
c6698c4992c0f88c90364107eb8e5d0120b70b380ecdcf32879615def782d8e64ab64c8a94ee69d13aaba2d9105044ffbf33f106170bcfd1eaf4447240ceef51 pointercal
4515ba1e449502e321f70de6bb69a771ccbe5d3f87777e9d91da80b9e0fb43f7198055555102e534043b0154dc8c30e942f09f3e753d0a8a5c91c6444f7d3497 asound.state
abbf130efc767c7062ac875e3a7c1a912c3f677abdc36ef4ed4c0a8d52a3b279680ecf1124ed5bf8f14321fee30b52b19d1ad4acebefb19880991a1e136735e2 msm8930-sitar.conf
0130ef966d66b284ad422a1d8333f7b308b9359c310db432047658906590713fea9103f422eab25c64d0d35684b4981879d08a6e64d44885c77284459683f8bd HiFi.conf
635565cb2caf4c17456590bf4db8903a8f8a0eeef7a643eceb3eea923908b19a0b2a0156cd62c0cd9ea4509e05e8bf08b9e0900ab1b622310f19947850dfc63d buttons.conf
"

View file

@ -0,0 +1,153 @@
state.msm8930sitarsnd {
control.21 {
iface MIXER
name 'HPHL Volume'
value 6
comment {
access 'read write'
type INTEGER
count 1
range '0 - 12'
dbmin -9999999
dbmax 84
dbvalue.0 42
}
}
control.22 {
iface MIXER
name 'HPHR Volume'
value 6
comment {
access 'read write'
type INTEGER
count 1
range '0 - 12'
dbmin -9999999
dbmax 84
dbvalue.0 42
}
}
control.23 {
iface MIXER
name 'RX1 Digital Volume'
value 60
comment {
access 'read write'
type INTEGER
count 1
range '0 - 124'
dbmin 0
dbmax 124
dbvalue.0 84
}
}
control.24 {
iface MIXER
name 'RX2 Digital Volume'
value 60
comment {
access 'read write'
type INTEGER
count 1
range '0 - 124'
dbmin 0
dbmax 124
dbvalue.0 84
}
}
control.25 {
iface MIXER
name 'RX3 Digital Volume'
value 60
comment {
access 'read write'
type INTEGER
count 1
range '0 - 124'
dbmin 0
dbmax 124
dbvalue.0 84
}
}
control.215 {
iface MIXER
name 'SLIMBUS_0_RX Audio Mixer MultiMedia1'
value true
comment {
access 'read write'
type BOOLEAN
count 1
}
}
control.260 {
iface MIXER
name 'RX1 MIX1 INP1'
value RX1
comment {
access 'read write'
type ENUMERATED
count 1
item.0 ZERO
item.1 SRC1
item.2 SRC2
item.3 IIR1
item.4 IIR2
item.5 RX1
item.6 RX2
item.7 RX3
item.8 RX4
item.9 RX5
}
}
control.262 {
iface MIXER
name 'DAC3 MUX'
value INV_RX1
comment {
access 'read write'
type ENUMERATED
count 1
item.0 ZERO
item.1 RX1
item.2 INV_RX1
item.3 RX2
}
}
control.263 {
iface MIXER
name 'DAC2 MUX'
value RX1
comment {
access 'read write'
type ENUMERATED
count 1
item.0 ZERO
item.1 RX1
}
}
control.264 {
iface MIXER
name 'DAC1 MUX'
value ZERO
comment {
access 'read write'
type ENUMERATED
count 1
item.0 ZERO
item.1 RX1
item.2 RX2
}
}
control.319 {
iface MIXER
name 'SLIM_0_RX Channels'
value One
comment {
access 'read write'
type ENUMERATED
count 1
item.0 One
item.1 Two
}
}
}

View file

@ -0,0 +1,2 @@
SW_HEADPHONE_INSERT 1 /usr/bin/alsaucm -c msm8930-sitar set _verb HiFi set _enadev Headphones
SW_HEADPHONE_INSERT 0 /usr/bin/alsaucm -c msm8930-sitar set _verb HiFi set _enadev Speaker

View file

@ -0,0 +1,4 @@
#!/bin/sh
# Enable openrc service to load wlan module for wifi functionality
rc-update add load-wlan-module default
exit 0

View file

@ -0,0 +1 @@
device-jolla-sbj.post-install

View file

@ -20,7 +20,7 @@ deviceinfo_dev_touchscreen="/dev/input/event0"
# Bootloader related
deviceinfo_flash_method="fastboot"
deviceinfo_kernel_cmdline="androidboot.hardware=qcom user_debug=31 ehci-hcd.park=3 maxcpus=2 zram.num_devices=2 root=/dev/mmcblk0p28"
deviceinfo_kernel_cmdline="androidboot.hardware=qcom user_debug=30 ehci-hcd.park=3 maxcpus=2 zram.num_devices=2 root=/dev/mmcblk0p28"
deviceinfo_generate_bootimg="true"
deviceinfo_bootimg_qcdt="false"
deviceinfo_flash_offset_base="0x80200000"

View file

@ -0,0 +1,3 @@
#!/bin/sh
logger "Battery is in charging state"
echo 100 > /sys/class/leds/led:rgb_red/brightness

View file

@ -0,0 +1,3 @@
#!/bin/sh
logger "Disconnected from charger"
echo 0 > /sys/class/leds/led:rgb_red/brightness

View file

@ -0,0 +1,22 @@
#!/sbin/openrc-run
description="Loading wlan module"
depend()
{
need wcnss-wlan
before wpa_supplicant
}
start()
{
ebegin "Loading wlan module"
modprobe wlan || return 1
}
stop()
{
ebegin "Unloading wlan module"
rmmod wlan || return 1
}

View file

@ -0,0 +1 @@
33368 274 -1771076 -268 33635 -873048 65536 540 960 0

View file

@ -0,0 +1,206 @@
SectionVerb {
EnableSequence [
cdev "hw:msm8930sitarsnd"
cset "name='RX1 Digital Volume' 60"
cset "name='RX2 Digital Volume' 60"
cset "name='RX3 Digital Volume' 60"
cset "name='HPHL Volume' 0"
cset "name='HPHR Volume' 0"
cset "name='ADC1 Volume' 3"
cset "name='ADC2 Volume' 3"
cset "name='ADC3 Volume' 3"
cset "name='SLIM_0_RX Channels' One"
cset "name='RX1 MIX1 INP1' ZERO"
cset "name='RX2 MIX1 INP1' ZERO"
cset "name='RX3 MIX1 INP1' ZERO"
cset "name='DAC1 MUX' ZERO"
cset "name='DAC2 MUX' ZERO"
cset "name='DAC3 MUX' ZERO"
cset "name='DAC4 MUX' ZERO"
cset "name='MICBIAS1 CAPLESS Switch' 0"
cset "name='TX1 HPF Switch' 1"
cset "name='Voice_Tx Mixer SLIM_0_TX_Voice' 0"
cset "name='SLIM_0_RX_Voice Mixer CSVoice' 0"
cset "name='SLIM TX1 MUX' ZERO"
cset "name='SLIM TX5 MUX' ZERO"
cset "name='DEC1 MUX' ZERO"
cset "name='DEC2 MUX' ZERO"
cset "name='DAC1 Switch' 1"
cset "name='SLIM_0_TX Channels' One"
]
Value {
TQ "HiFi"
PlaybackPCM "hw:msm8930sitarsnd,0"
CapturePCM "hw:msm8930sitarsnd,0"
}
}
SectionDevice."Speaker" {
Comment "Internal speaker"
ConflictingDevice [
"Headphones"
"Handset"
]
EnableSequence [
cdev "hw:msm8930sitarsnd"
cset "name='RX1 MIX1 INP1' RX1"
cset "name='DAC2 MUX' RX1"
cset "name='DAC3 MUX' INV_RX1"
cset "name='SLIMBUS_0_RX Audio Mixer MultiMedia1' on"
]
DisableSequence [
cdev "hw:msm8930sitarsnd"
cset "name='SLIMBUS_0_RX Audio Mixer MultiMedia1' off"
]
Value {
PlaybackChannels "2"
PlaybackPriority 300
PlaybackVolume "RX1 Digital Volume"
}
}
SectionDevice."Headphones" {
Comment "Headset"
ConflictingDevice [
"Speaker"
"Handset"
]
EnableSequence [
cdev "hw:msm8930sitarsnd"
cset "name='HPHL Volume' 6"
cset "name='HPHR Volume' 6"
cset "name='SLIM_0_RX Channels' Two"
cset "name='RX2 MIX1 INP1' RX1"
cset "name='RX3 MIX1 INP1' RX2"
cset "name='DAC4 MUX' ON"
cset "name='SLIMBUS_0_RX Audio Mixer MultiMedia1' on"
]
DisableSequence [
cdev "hw:msm8930sitarsnd"
cset "name='SLIMBUS_0_RX Audio Mixer MultiMedia1' off"
]
Value {
PlaybackChannels "2"
PlaybackPriority 100
PlaybackVolume "RX3 Digital Volume"
}
}
SectionDevice."Handset" {
Comment "Earpiece Speaker"
ConflictingDevice [
"Headphones"
"Speaker"
]
EnableSequence [
cdev "hw:msm8930sitarsnd"
cset "name='MICBIAS1 CAPLESS Switch' 1"
cset "name='TX1 HPF Switch' 0"
cset "name='Voice_Tx Mixer SLIM_0_TX_Voice' 1"
cset "name='SLIM_0_RX_Voice Mixer CSVoice' 1"
cset "name='SLIM TX1 MUX' DEC1"
cset "name='SLIM TX5 MUX' DEC2"
cset "name='DEC1 MUX' ADC1"
cset "name='DEC2 MUX' ADC3"
cset "name='DAC1 MUX' RX1"
cset "name='DAC1 Switch' 1"
cset "name='SLIM_0_TX Channels' Two"
cset "name='RX1 MIX1 INP1' RX1"
]
DisableSequence [
cdev "hw:msm8930sitarsnd"
]
Value {
PlaybackChannels "2"
PlaybackPriority 300
PlaybackVolume "RX1 Digital Volume"
}
}
SectionDevice."SpeakerMic" {
Comment "Internal Microphone"
ConflictingDevice [
"HeadsetMic"
]
EnableSequence [
cdev "hw:msm8930sitarsnd"
cset "name='DEC1 MUX' ADC3"
cset "name='SLIM TX1 MUX' DEC1"
cset "name='MICBIAS1 CAPLESS Switch' 1"
cset "name='TX1 HPF Switch' 0"
cset "name='EC_REF_RX' 0"
cset "name='SLIM_0_RX Channels' Two"
cset "name='MultiMedia1 Mixer SLIM_0_TX' 1"
]
DisableSequence [
cdev "hw:msm8930sitarsnd"
cset "name='MultiMedia1 Mixer SLIM_0_TX' 0"
]
Value {
CapturePriority 500
CaptureChannels "2"
}
}
SectionDevice."HeadsetMic" {
Comment "Headset Microphone"
ConflictingDevice [
"SpeakerMic"
]
EnableSequence [
cdev "hw:msm8930sitarsnd"
cset "name='ADC2 Volume' 3"
cset "name='DEC1 MUX' ADC2"
cset "name='SLIM TX1 MUX' DEC1"
cset "name='TX1 HPF Switch' 0"
cset "name='SLIM_0_RX Channels' Two"
cset "name='MultiMedia1 Mixer SLIM_0_TX' 1"
]
DisableSequence [
cdev "hw:msm8930sitarsnd"
cset "name='MultiMedia1 Mixer SLIM_0_TX' 01"
]
Value {
CapturePriority 100
CaptureChannels "2"
}
}

View file

@ -0,0 +1,10 @@
Syntax 2
SectionUseCase."HiFi" {
File "HiFi.conf"
Comment "Play HiFi quality music"
}
SectionDefaults [
cdev "hw:msm8930sitarsnd"
]

View file

@ -0,0 +1,2 @@
# configure sleep time before activating wifi as client
wcnssdelay=1

View file

@ -2,7 +2,7 @@
pkgname=linux-jolla-sbj
pkgver=3.4.108
pkgrel=0
pkgrel=1
pkgdesc="Jolla phone kernel fork"
arch="armv7"
_carch="arm"
@ -10,7 +10,14 @@ _flavor="jolla-sbj"
url="http://releases.sailfishos.org/sources/3.1.0.11/"
license="GPL2"
options="!strip !check !tracedeps pmb:cross-native"
makedepends="perl sed installkernel bash gmp-dev bc linux-headers elfutils-dev devicepkg-dev gcc6"
makedepends="perl sed installkernel bash gmp-dev bc linux-headers elfutils-dev devicepkg-dev gcc6 rpm2cpio"
_kbuildver="3.4.108.20200929.1"
_rpm_wlan_commit="2f37d840cc7f52eb38b0613a832a55b216d89bd5"
_rpm_adapt_commit="8472b1e422b50fb5aa1ea46231a64db8ab2573dd"
_rpm_wlan_version="0.2.7-1.3.6"
_rpm_adapt_version="1.11.2"
_rpm_wlan_file="sbj-wlan-$_rpm_wlan_version.jolla.armv7hl.rpm"
_rpm_adapt_file="kernel-adaptation-sbj-$_kbuildver-$_rpm_adapt_version.jolla.armv7hl.rpm"
# Compiler: this kernel was only tested with GCC6. Feel free to make a merge
# request if you find out that it is booting working with newer GCCs as
@ -30,10 +37,17 @@ source="
01_fix-video-argb-setting.patch
02_gpu-msm-fix-gcc5-compile.patch
duplicate-return-address-definition.patch
https://gitlab.com/postmarketeer/jolla-sbj-wlan/-/raw/$_rpm_wlan_commit/$_rpm_wlan_file
https://gitlab.com/postmarketeer/jolla-kernel-adaptation-sbj/-/raw/$_rpm_adapt_commit/$_rpm_adapt_file
"
_kver="kernel-adaptation-sbj-3.4.108.20190506.1"
_kernelarchive="$srcdir/sailfish-$_hash-oss-adaptation-sbj/kernel-adaptation-sbj/$_kver.tar.bz2"
builddir="$srcdir/$_kver"
_rpm_mod_path="./lib/modules/$_kbuildver"
_files="
kernel/net/wireless/wlan.ko
kernel/net/wireless/cfg80211.ko
"
prepare() {
cd "$srcdir"
@ -51,7 +65,16 @@ build() {
}
package() {
rpm2cpio "$srcdir/$_rpm_wlan_file" | cpio -id "$_rpm_mod_path/kernel/net/wireless/*.ko"
rpm2cpio "$srcdir/$_rpm_adapt_file" | cpio -id "$_rpm_mod_path/kernel/net/wireless/*.ko"
downstreamkernel_package "$builddir" "$pkgdir" "$_carch" "$_flavor"
_kernel_release=$(cat $builddir/include/config/kernel.release)
for _i in $_files; do
install -Dm644 "$_rpm_mod_path/$_i" \
"$pkgdir/lib/modules/$_kernel_release/$_i"
done
}
sha512sums="
@ -60,4 +83,6 @@ cd008aafd3ae04dbf3f010e893fa2d47169a2045d1706a2f28d5175011da96ca1280a2c73692bb14
e3083c260ed9c4fc0d83f43106700b6173876dbfae072f6e6696ac6785a4dc17771fbcb3e21601e04ed29a11bf0f7a2a09ad549375e0c34cea245c7f2e2bcbbd 01_fix-video-argb-setting.patch
7be03a9e78b7ac330a54b1f00509caa0621a95c0c55901878ad757f9dd69cc05ba2c8b5ea987063ae1224f92c4d090d515fa5d369e7755181a4871b0d0f82881 02_gpu-msm-fix-gcc5-compile.patch
9b15bf1f6cb66f54c785b0af6c9db8a7d63257e6fa3eeb0cbf47284334166aa6a7ff93e1b64ab69206c8047d64641199c0f5fcbc257bbe039263252fff45118e duplicate-return-address-definition.patch
4c582883b609b5cd312b48213ac633e8c65ac3ea310c6016c01da769440f694f42c22f06f13599ce12e9992afe150de364fcaf2f816d9d678d019d00019f007b sbj-wlan-0.2.7-1.3.6.jolla.armv7hl.rpm
96e152268ff4f25bd67aadbca9b6059f1dcd076306ca2b9567f439dd42146c1e1cffeea23a90a862e436467eb375c2295078ed6b01490d8baac318faea0d2e12 kernel-adaptation-sbj-3.4.108.20200929.1-1.11.2.jolla.armv7hl.rpm
"