diff --git a/device/community/device-purism-librem5/70-gnss.rules b/device/community/device-purism-librem5/70-gnss.rules deleted file mode 100644 index c5f2a5b5f..000000000 --- a/device/community/device-purism-librem5/70-gnss.rules +++ /dev/null @@ -1 +0,0 @@ -KERNEL=="gnss[0-9]*", GROUP="dialout" diff --git a/device/community/device-purism-librem5/APKBUILD b/device/community/device-purism-librem5/APKBUILD index b134b606c..562900962 100644 --- a/device/community/device-purism-librem5/APKBUILD +++ b/device/community/device-purism-librem5/APKBUILD @@ -2,7 +2,7 @@ # Maintainer: Clayton Craft pkgname=device-purism-librem5 pkgdesc="Purism Librem 5 Phone" -pkgver=1.10 +pkgver=1.11 pkgrel=0 url="https://postmarketos.org" license="MIT" @@ -20,17 +20,18 @@ depends=" uboot-tools " makedepends="devicepkg-dev" -_confver=27 -_confdir=$srcdir/librem5-base-v$_confver +_confver=33 +builddir=$srcdir/librem5-base-pureos-$_confver source=" - https://source.puri.sm/Librem5/librem5-base/-/archive/v$_confver/librem5-base-v$_confver.tar.gz + https://source.puri.sm/Librem5/librem5-base/-/archive/pureos/$_confver/librem5-base-pureos-$_confver.tar.gz 00-kwin.sh 00-mesa.sh - 70-gnss.rules 70-wifi-pm.rules 77-mm-broadmobi-port-types.rules deviceinfo flash_script.lst + librem5-base-ucm2.patch + librem5-shipmode.initd modprobe.d_rsi.conf modules-load.d_librem5.conf uboot-script.cmd @@ -60,7 +61,7 @@ phosh() { depends=" wys " - install -D -m644 "$_confdir"/default/org.freedesktop.ModemManager1.pkla \ + install -D -m644 "$builddir"/default/org.freedesktop.ModemManager1.pkla \ "$subpkgdir"/var/lib/polkit-1/localauthority/10-vendor.d/org.freedesktop.ModemManager1.pkla } @@ -69,10 +70,10 @@ pulseaudio() { install_if="$pkgname pulseaudio" # install config files from upstream Purism mkdir -p "$subpkgdir"/etc/pulse/ - cp -r "$_confdir"/default/audio/pulse/daemon.conf.d "$subpkgdir"/etc/pulse/ - install -D -m644 "$_confdir"/default/audio/pulse/librem5.pa "$subpkgdir"/etc/pulse/librem5.pa + cp -r "$builddir"/default/audio/pulse/daemon.conf.d "$subpkgdir"/etc/pulse/ + install -D -m644 "$builddir"/default/audio/pulse/librem5.pa "$subpkgdir"/etc/pulse/librem5.pa mkdir -p "$subpkgdir"/usr/share/pulseaudio/alsa-mixer - cp -r "$_confdir"/default/audio/profile-sets "$subpkgdir"/usr/share/pulseaudio/alsa-mixer/ + cp -r "$builddir"/default/audio/profile-sets "$subpkgdir"/usr/share/pulseaudio/alsa-mixer/ } package() { @@ -86,27 +87,37 @@ package() { "$pkgdir"/etc/X11/xorg.conf.d/10-video.conf # udev - install -D -m644 "$_confdir"/debian/librem5-base-defaults.librem5-pm.udev \ + install -D -m644 "$builddir"/debian/librem5-base-defaults.librem5-pm.udev \ "$pkgdir"/usr/lib/udev/rules.d/librem5-pm.rules - install -D -m644 "$srcdir"/70-gnss.rules "$pkgdir"/usr/lib/udev/rules.d/70-gnss.rules + install -D -m644 "$builddir"/debian/librem5-base-defaults.librem5-modem.udev \ + "$pkgdir"/usr/lib/udev/rules.d/librem5-modem.rules + install -D -m644 "$builddir"/default/gpsd/99-gnss.rules \ + "$pkgdir"/usr/lib/udev/rules.d/librem5-gnss.rules # Wifi / PM install -Dm644 "$srcdir"/70-wifi-pm.rules -t "$pkgdir"/usr/lib/udev/rules.d/ # install audio config files from upstream Purism - mkdir -p "$pkgdir"/usr/share/alsa/ucm - cp -r "$_confdir"/default/audio/ucm "$pkgdir"/usr/share/alsa/ + mkdir -p "$pkgdir"/usr/share/alsa/ucm2 + cp -r "$builddir"/default/audio/ucm2 "$pkgdir"/usr/share/alsa/ + + # device-specific services + install -Dm755 "$builddir"/default/shipmode/l5-poweroff-shipmode \ + "$pkgdir"/usr/bin/librem5-shipmode + install -Dm755 "$srcdir"/librem5-shipmode.initd \ + "$pkgdir"/etc/init.d/librem5-shipmode devicepkg_package $startdir $pkgname } -sha512sums="d23e23a48bdea8df65b7df2475caa5b85c8e999c7dff1e48e359a8fb9166019c4c609b5855876f603d60a422e43a0378d4dbdd89c71b8f6ec054bb7f1dc59ca5 librem5-base-v27.tar.gz +sha512sums="e89e75480bda1150e11579faba78058b15824adaaa67e199909583c67d3e519916fed783743f0e510abe3fd571610c7a3f26a9bd2008e85f1eafb114e9ffe652 librem5-base-pureos-33.tar.gz 685ec71484a932c59f83f1039d4d18a010a5849342e96d9e15ae8ce64374aac15073f9c51d7d9f270c60e70d2ea15c685b8f528cdc40f991b093b9227cba6a48 00-kwin.sh 9b4ecf6692db6d291799b2ebcdd7f3ceba52d657c01b40a15f4d819f1f9d2f0576bfcf94b1889da767d1757f3af86f4056160b9b31b1ecab0517acfb958f22a9 00-mesa.sh -be0cf9f9e37c33d526fdf5fb61de1b42b3bb9309faf1feb0db51fa9639c3c0b35608977c898130ff60ebf2e8081ac36799b96c748b7efa9dcef7501753bc4890 70-gnss.rules 8b6fa7b12c15f439c561901f3ffe24a1ef2a0c343401c0a79281060854ab29e08a1fb5e7adae8684b12aa9f535ed99e2dad993dce9724822cb0fbf2497dd86e5 70-wifi-pm.rules 00355d9ad085a77e157f3c62eb4f1bcac2823d3b341e34d1128edbfb1444fba83e8eacd263ea61da9f6d853f1328ab7fbe5ea63bd08c8a1bc9b8eaf44ae1f1c6 77-mm-broadmobi-port-types.rules -aefd60a66454529fe80852ed9fffc89babda10937ba1c805379bfbe0e4ea6cf3276409cbb5570975e0ff14d813adcf3e9664a904f93c3e7ac8c408bc5473065e deviceinfo +db7708ea7d34fc877aacdd249403ea5468d652bdf65ffa41f2f0471f3c4dcc9db9af743dfd792f3a21db721ecc040152f7ea8b76912556088a22a99e2bfd370f deviceinfo d033df2b9125622c946af67dad83070473c86937b5825f57ad272c9145b594071dd6913949127803c45af4ea3226526551718d40739f9f1ee4bfe6446e62c856 flash_script.lst +35e7a1ca1e1924878fcb377d22508d8fbd5fc81398c117259e40c0ba4b86d76b019f352d73e7d201dfb9ceb304fe1e2e3d2f7fc4a3cd06ddd6cd6e2c3f848057 librem5-base-ucm2.patch +76b06cc1ac82c3fc0e298c9d7d5c9139624b1269bf846fe3bc07b9af877d882362b60ba90028ad3182cb1d6426aacdb560fe060b026778a56e7f038d495eadd4 librem5-shipmode.initd 9dc018f0de523cbfe5a49cbe831aa30e975a8dd34635197bb52582f072ac356ef2c02223fc794d970380091a69a83a74c3fbe34520190c8536e77f9ea98c7659 modprobe.d_rsi.conf a0740e405781ec6ef765fdc9f5700c95adbb241c45c97b9384ba68cdece662cb216ca5918640042f6e65a5d1b1a9099936382c99b49a44303f7b6d77a075a471 modules-load.d_librem5.conf -ed4f8caa061e51ffb123261c89454554e6773feea733de4b78be929a36dc5ac0ff448ac1ed69a0a97e7fa54f9d711076e8965465b180ba6a05237dab4fb45924 uboot-script.cmd +3b1782aafdc2e14c4b85b5eca52c31083c2058147a12cedb288903a34a3f49693d8d479048e30e0605fcc49cd00dda6f9e1c671618c5dcb878d7a3d01dcb1a90 uboot-script.cmd 1cbc65cf2cb8fad4b0332d012a0256a266205b9b64371f5c0dae09dbb7f1e45b254e8c43993b896097e9d7035a72d547d9bce1ab2133addc56a5abdb80b44616 xorg.conf" diff --git a/device/community/device-purism-librem5/device-purism-librem5.post-install b/device/community/device-purism-librem5/device-purism-librem5.post-install index eee658e59..321cb8f17 100644 --- a/device/community/device-purism-librem5/device-purism-librem5.post-install +++ b/device/community/device-purism-librem5/device-purism-librem5.post-install @@ -4,3 +4,5 @@ rc-update add gpsd default sed -i 's/DEVICES=\"/DEVICES=\"\/dev\/gnss0/' /etc/conf.d/gpsd sed -i 's/GPSD_OPTIONS=\"/GPSD_OPTIONS=\"-s 9600/' /etc/conf.d/gpsd + +rc-update add librem5-shipmode shutdown diff --git a/device/community/device-purism-librem5/deviceinfo b/device/community/device-purism-librem5/deviceinfo index 61334cda4..95b0863f6 100644 --- a/device/community/device-purism-librem5/deviceinfo +++ b/device/community/device-purism-librem5/deviceinfo @@ -6,9 +6,9 @@ deviceinfo_name="Purism Librem 5 Phone" deviceinfo_manufacturer="Purism" deviceinfo_codename="purism-librem5" deviceinfo_year="2019" -deviceinfo_dtb="freescale/imx8mq-librem5 freescale/imx8mq-librem5-r2 freescale/imx8mq-librem5-r3" +deviceinfo_dtb="freescale/imx8mq-librem5 freescale/imx8mq-librem5-r2 freescale/imx8mq-librem5-r3 freescale/imx8mq-librem5-r4" deviceinfo_append_dtb="false" -deviceinfo_modules_initfs="phy_fsl_imx8mq_usb dwc3 udc_core xhci_hcd xhci_plat_hcd tps6598x libcomposite goodix edt-ft5x06 led_bl" +deviceinfo_modules_initfs="phy_fsl_imx8mq_usb dwc3 udc_core xhci_hcd xhci_plat_hcd tps6598x libcomposite goodix edt-ft5x06 led_bl pwm_vibra gpio_vibra" deviceinfo_arch="aarch64" deviceinfo_mesa_driver="mxsfb-drm" diff --git a/device/community/device-purism-librem5/librem5-base-ucm2.patch b/device/community/device-purism-librem5/librem5-base-ucm2.patch new file mode 100644 index 000000000..78b96b39d --- /dev/null +++ b/device/community/device-purism-librem5/librem5-base-ucm2.patch @@ -0,0 +1,219 @@ +diff --git a/debian/librem5-base-defaults.install b/debian/librem5-base-defaults.install +index 067ba03..ce68610 100644 +--- a/debian/librem5-base-defaults.install ++++ b/debian/librem5-base-defaults.install +@@ -5,7 +5,7 @@ default/adwaita-phone.jpg usr/share/librem5/default-theme/ + # Audio configuration + default/audio/pulse etc/ + default/audio/profile-sets usr/share/pulseaudio/alsa-mixer/ +-default/audio/ucm usr/share/alsa/ ++default/audio/ucm2 usr/share/alsa/ + + + default/sm.puri.OSK0.desktop usr/share/applications/ +diff --git a/default/audio/pulse/librem5.pa b/default/audio/pulse/librem5.pa +index e96de9a..f87d8f5 100644 +--- a/default/audio/pulse/librem5.pa ++++ b/default/audio/pulse/librem5.pa +@@ -14,9 +14,9 @@ load-module module-alsa-card device_id="MODEM" name="platform-sound-wwan" card_p + + .ifexists /sys/devices/platform/sound/308b0000.sai-wm8962 + set-card-profile alsa_card.platform-sound HiFi +-set-default-sink alsa_output.platform-sound.HiFi__hw_CARD_wm8962__sink +-set-default-source alsa_input.platform-sound.HiFi__hw_CARD_wm8962__source +-update-source-proplist alsa_input.platform-sound.HiFi__hw_CARD_wm8962__source filter.apply.echo-cancel.parameters="aec_args=\"analog_gain_control=0\" use_master_format=yes channels=1" ++set-default-sink alsa_output.platform-sound.HiFi__hw_wm8962_0__sink ++set-default-source alsa_output.platform-sound.HiFi__hw_wm8962_0__source ++update-source-proplist alsa_input.platform-sound.HiFi__hw_wm8962_0__source filter.apply.echo-cancel.parameters="aec_args=\"analog_gain_control=0\" use_master_format=yes channels=1" + .endif + + # cork/mute audio streams when on a phone call +diff --git a/default/audio/ucm/wm8962/HiFi.conf b/default/audio/ucm2/wm8962/HiFi.conf +similarity index 81% +rename from default/audio/ucm/wm8962/HiFi.conf +rename to default/audio/ucm2/wm8962/HiFi.conf +index 122484b..d88fa99 100644 +--- a/default/audio/ucm/wm8962/HiFi.conf ++++ b/default/audio/ucm2/wm8962/HiFi.conf +@@ -1,6 +1,5 @@ + SectionVerb { + EnableSequence [ +- cdev "hw:wm8962" + cset "name='Digital Playback Volume' 100,100" + cset "name='MIXINL IN2L Switch' off" + cset "name='MIXINL IN3L Switch' off" +@@ -16,11 +15,13 @@ SectionVerb { + cset "name='INPGAL IN4L Switch' off" + cset "name='Input Mixer Switch' off,on" + cset "name='SPKOUTL PGA' Mixer" ++ cset "name='Speaker Volume', on" ++ cset "name='Headphone Volume', off" ++ cset "name='Digital Capture Volume', off" + cset "name='SPKOUTR PGA' Mixer" + ] + + DisableSequence [ +- cdev "hw:wm8962" + cset "name='Digital Playback Volume' 0,0" + ] + +@@ -29,7 +30,7 @@ SectionVerb { + } + } + +-SectionDevice."Handset".0 { ++SectionDevice."Handset" { + Comment "Handset" + + ConflictingDevice [ +@@ -38,7 +39,6 @@ SectionDevice."Handset".0 { + ] + + EnableSequence [ +- cdev "hw:wm8962" + cset "name='Speaker Switch' off,on" + cset "name='DAC L/R Swap Switch' on" + cset "name='DAC Monomix Switch' on" +@@ -48,7 +48,6 @@ SectionDevice."Handset".0 { + ] + + DisableSequence [ +- cdev "hw:wm8962" + cset "name='Speaker Switch' off,off" + cset "name='DAC L/R Swap Switch' off" + cset "name='DAC Monomix Switch' off" +@@ -58,13 +57,12 @@ SectionDevice."Handset".0 { + Value { + PlaybackChannels "2" + PlaybackPriority "100" +- PlaybackVolume "name='Speaker Volume'" + PlaybackSwitch "name='Speaker Switch'" +- PlaybackPCM "hw:CARD=wm8962" ++ PlaybackPCM "hw:${CardId},0" + } + } + +-SectionDevice."Speaker".0 { ++SectionDevice."Speaker" { + Comment "Speaker" + + ConflictingDevice [ +@@ -73,7 +71,6 @@ SectionDevice."Speaker".0 { + ] + + EnableSequence [ +- cdev "hw:wm8962" + cset "name='Speaker Switch' on,off" + cset "name='DAC Monomix Switch' on" + cset "name='SPKOUTL PGA' DAC" +@@ -82,7 +79,6 @@ SectionDevice."Speaker".0 { + ] + + DisableSequence [ +- cdev "hw:wm8962" + cset "name='Speaker Switch' off,off" + cset "name='DAC Monomix Switch' off" + cset "name='SPKOUTL PGA' Mixer" +@@ -91,13 +87,32 @@ SectionDevice."Speaker".0 { + Value { + PlaybackChannels "2" + PlaybackPriority "500" +- PlaybackVolume "name='Speaker Volume'" + PlaybackSwitch "name='Speaker Switch'" +- PlaybackPCM "hw:CARD=wm8962" ++ PlaybackPCM "hw:${CardId},0" + } + } + +-SectionDevice."Headphones".0 { ++SectionDevice."Mic" { ++ Comment "Internal Microphone" ++ ++ EnableSequence [ ++ cset "name='Digital Capture Volume' 116,116" ++ cset "name='ADC L/R Swap Switch' on" ++ ] ++ ++ DisableSequence [ ++ cset "name='Digital Capture Volume' 0,0" ++ cset "name='ADC L/R Swap Switch' off" ++ ] ++ ++ Value { ++ CapturePriority "500" ++ CaptureChannels "2" ++ CapturePCM "hw:${CardId},0" ++ } ++} ++ ++SectionDevice."Headphones" { + Comment "Headphones" + + ConflictingDevice [ +@@ -106,7 +121,6 @@ SectionDevice."Headphones".0 { + ] + + EnableSequence [ +- cdev "hw:wm8962" + cset "name='Headphone Switch' on,on" + cset "name='HPOUTL PGA' 0 unmute" + cset "name='HPOUTR PGA' 0 unmute" +@@ -115,7 +129,6 @@ SectionDevice."Headphones".0 { + ] + + DisableSequence [ +- cdev "hw:wm8962" + cset "name='Headphone Switch' off off" + cset "name='HPOUTL PGA' 0 mute" + cset "name='HPOUTR PGA' 0 mute" +@@ -124,36 +137,8 @@ SectionDevice."Headphones".0 { + Value { + PlaybackPriority "1000" + PlaybackChannels "2" +- PlaybackVolume "name='Headphone Volume'" + PlaybackSwitch "name='Headphone Switch'" +- PlaybackPCM "hw:CARD=wm8962" ++ PlaybackPCM "hw:${CardId},0" + JackControl "Headphones Jack" + } + } +- +-SectionDevice."Mic".0 { +- Comment "Internal Microphone" +- +- ConflictingDevice [ +- "Headset" +- ] +- +- EnableSequence [ +- cdev "hw:wm8962" +- cset "name='Digital Capture Volume' 116,116" +- cset "name='ADC L/R Swap Switch' on" +- ] +- +- DisableSequence [ +- cdev "hw:wm8962" +- cset "name='Digital Capture Volume' 0,0" +- cset "name='ADC L/R Swap Switch' off" +- ] +- +- Value { +- CapturePriority "500" +- CaptureChannels "2" +- CaptureVolume "name='Digital Capture Volume'" +- CapturePCM "hw:CARD=wm8962" +- } +-} +diff --git a/default/audio/ucm/wm8962/wm8962.conf b/default/audio/ucm2/wm8962/wm8962.conf +similarity index 91% +rename from default/audio/ucm/wm8962/wm8962.conf +rename to default/audio/ucm2/wm8962/wm8962.conf +index ebdc11f..d4b95d8 100644 +--- a/default/audio/ucm/wm8962/wm8962.conf ++++ b/default/audio/ucm2/wm8962/wm8962.conf +@@ -1,3 +1,5 @@ ++Syntax 2 ++ + Comment "WM8962 Codec for Librem 5 Phone" + + SectionUseCase."HiFi" { diff --git a/device/community/device-purism-librem5/librem5-shipmode.initd b/device/community/device-purism-librem5/librem5-shipmode.initd new file mode 100644 index 000000000..9cfa19ffa --- /dev/null +++ b/device/community/device-purism-librem5/librem5-shipmode.initd @@ -0,0 +1,3 @@ +#!/sbin/openrc-run +description="Put the Librem 5 into 'ship mode' so that the battery does not drain when off." +command="/usr/bin/librem5-shipmode" diff --git a/device/community/device-purism-librem5/uboot-script.cmd b/device/community/device-purism-librem5/uboot-script.cmd index 7ed59867a..ac36240ee 100644 --- a/device/community/device-purism-librem5/uboot-script.cmd +++ b/device/community/device-purism-librem5/uboot-script.cmd @@ -10,6 +10,8 @@ if itest.s "x2" == "x$board_rev" ; then dtb_file=imx8mq-librem5-r2.dtb elif itest.s "x3" == "x$board_rev" ; then dtb_file=imx8mq-librem5-r3.dtb +elif itest.s "x4" == "x$board_rev" ; then + dtb_file=imx8mq-librem5-r4.dtb fi echo Loading DTB