From 0d22968acd2e0321afd768099bdc03064ec2a517 Mon Sep 17 00:00:00 2001 From: John Sullivan Date: Fri, 25 Sep 2020 00:44:17 -0700 Subject: [PATCH 1/3] New package: atinout-0.9.1 --- srcpkgs/atinout/template | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 srcpkgs/atinout/template diff --git a/srcpkgs/atinout/template b/srcpkgs/atinout/template new file mode 100644 index 00000000000..e292bf9c9c7 --- /dev/null +++ b/srcpkgs/atinout/template @@ -0,0 +1,14 @@ +# Template file for 'atinout' +pkgname=atinout +version=0.9.1 +revision=1 +build_style=gnu-makefile +short_desc="Send AT commands to modem and print responses" +maintainer="John Sullivan " +license="GPL-3.0-or-later" +homepage="http://atinout.sourceforge.net" +distfiles="${SOURCEFORGE_SITE}/project/${pkgname}/v${version}/${pkgname}-${version}.tar.gz" +checksum=4d15c8288aca414e11cd304686b172696104c5e42bf776300311c005634854a2 + +# Disable -Werror (GCC9+ turns switch fallthrough into error) +CFLAGS="-W -Wall -Wextra -DVERSION=\\\"${version}\\\" -g" From 19191da06664dbc5b56c8cfb41c174764b72b7b0 Mon Sep 17 00:00:00 2001 From: John Sullivan Date: Fri, 5 Feb 2021 21:31:03 -0800 Subject: [PATCH 2/3] New package: pinephone-utils-0.1 --- .../files/00-alsa-pinephone-dshare.conf | 14 ++ .../pinephone-utils/files/90-modem-eg25.rules | 5 + srcpkgs/pinephone-utils/files/COPYING | 15 ++ .../files/pinephone-modem-setup | 26 ++++ srcpkgs/pinephone-utils/files/ucm/HiFi.conf | 140 +++++++++++++++++ .../pinephone-utils/files/ucm/PinePhone.conf | 11 ++ .../pinephone-utils/files/ucm/VoiceCall.conf | 145 ++++++++++++++++++ srcpkgs/pinephone-utils/template | 21 +++ 8 files changed, 377 insertions(+) create mode 100644 srcpkgs/pinephone-utils/files/00-alsa-pinephone-dshare.conf create mode 100644 srcpkgs/pinephone-utils/files/90-modem-eg25.rules create mode 100644 srcpkgs/pinephone-utils/files/COPYING create mode 100755 srcpkgs/pinephone-utils/files/pinephone-modem-setup create mode 100644 srcpkgs/pinephone-utils/files/ucm/HiFi.conf create mode 100644 srcpkgs/pinephone-utils/files/ucm/PinePhone.conf create mode 100644 srcpkgs/pinephone-utils/files/ucm/VoiceCall.conf create mode 100644 srcpkgs/pinephone-utils/template diff --git a/srcpkgs/pinephone-utils/files/00-alsa-pinephone-dshare.conf b/srcpkgs/pinephone-utils/files/00-alsa-pinephone-dshare.conf new file mode 100644 index 00000000000..0bb107be419 --- /dev/null +++ b/srcpkgs/pinephone-utils/files/00-alsa-pinephone-dshare.conf @@ -0,0 +1,14 @@ +pcm_slave.sl2 { + pcm "hw:0,0" + rate 88200 +} + +pcm.!default { + type plug + slave.pcm { + type dshare + ipc_key 1023984 + slave sl2 + bindings [ 0 1 ] + } +} diff --git a/srcpkgs/pinephone-utils/files/90-modem-eg25.rules b/srcpkgs/pinephone-utils/files/90-modem-eg25.rules new file mode 100644 index 00000000000..cd0031422cb --- /dev/null +++ b/srcpkgs/pinephone-utils/files/90-modem-eg25.rules @@ -0,0 +1,5 @@ +SUBSYSTEMS=="usb", ENV{.LOCAL_ifNum}="$attr{bInterfaceNumber}" + +SUBSYSTEMS=="usb", KERNEL=="ttyUSB[0-9]*", ATTRS{idVendor}=="2c7c", ATTRS{idProduct}=="0125", ENV{.LOCAL_ifNum}=="01", SYMLINK+="EG25.NMEA", MODE="0660" +SUBSYSTEMS=="usb", KERNEL=="ttyUSB[0-9]*", ATTRS{idVendor}=="2c7c", ATTRS{idProduct}=="0125", ENV{.LOCAL_ifNum}=="02", SYMLINK+="EG25.AT", MODE="0660" +SUBSYSTEMS=="usb", KERNEL=="ttyUSB[0-9]*", ATTRS{idVendor}=="2c7c", ATTRS{idProduct}=="0125", ENV{.LOCAL_ifNum}=="03", SYMLINK+="EG25.MODEM", MODE="0660" diff --git a/srcpkgs/pinephone-utils/files/COPYING b/srcpkgs/pinephone-utils/files/COPYING new file mode 100644 index 00000000000..1bf3fc55f9b --- /dev/null +++ b/srcpkgs/pinephone-utils/files/COPYING @@ -0,0 +1,15 @@ +The following list of files are copyright of postmarketOS, and are used with +some modifications under the terms of the MIT license +https://opensource.org/licenses/MIT + +90-modem-eg25.rules +pinephone-modem-setup +00-alsa-pinephone-dshare.conf +ucm/PinePhone.conf +ucm/HiFi.conf +ucm/VoiceCall.conf + +--- + +see for sources: +https://gitlab.com/postmarketOS/pmaports/-/tree/master/device/main/device-pine64-pinephone \ No newline at end of file diff --git a/srcpkgs/pinephone-utils/files/pinephone-modem-setup b/srcpkgs/pinephone-utils/files/pinephone-modem-setup new file mode 100755 index 00000000000..a734cb17069 --- /dev/null +++ b/srcpkgs/pinephone-utils/files/pinephone-modem-setup @@ -0,0 +1,26 @@ +#!/bin/sh + +DEV=${DEV:-$1} + +log() { + echo "$@" | logger -t "void:modem-setup" +} + +QMBNCFG_CONFIG="1" + +# Read current config +QMBNCFG_ACTUAL_CONFIG=$(echo 'AT+QMBNCFG="AutoSel"' | atinout - $DEV -) + +if echo $QMBNCFG_ACTUAL_CONFIG | grep -q $QMBNCFG_CONFIG +then + log "Modem already configured" + exit 0 +fi + +# Configure VoLTE auto selecting profile +RET=$(echo "AT+QMBNCFG=\"AutoSel\",$QMBNCFG_CONFIG" | atinout - $DEV -) +if ! echo $RET | grep -q OK +then + log "Failed to enable VoLTE profile auto selecting: $RET" + exit 1 +fi diff --git a/srcpkgs/pinephone-utils/files/ucm/HiFi.conf b/srcpkgs/pinephone-utils/files/ucm/HiFi.conf new file mode 100644 index 00000000000..e50942ce284 --- /dev/null +++ b/srcpkgs/pinephone-utils/files/ucm/HiFi.conf @@ -0,0 +1,140 @@ +SectionVerb { + EnableSequence [ + cset "name='Headphone Playback Switch' off" + cset "name='Headphone Source Playback Route' DAC" + cset "name='Line In Playback Switch' off" + cset "name='Line Out Playback Switch' off" + cset "name='Line Out Source Playback Route' Mono Differential" + cset "name='Mic1 Playback Switch' off" + cset "name='Mic2 Playback Switch' off" + cset "name='AIF1 DA0 Playback Volume' 160" + cset "name='AIF3 ADC Source Capture Route' None" + cset "name='AIF2 DAC Source Playback Route' None" + cset "name='DAC Playback Switch' on" + cset "name='DAC Playback Volume' 160" + cset "name='ADC Digital DAC Playback Switch' off" + cset "name='AIF1 Slot 0 Digital DAC Playback Switch' on" + cset "name='AIF2 Digital DAC Playback Switch' off" + cset "name='DAC Reversed Playback Switch' off" + cset "name='Earpiece Playback Switch' off" + cset "name='Earpiece Source Playback Route' DACL" + + cset "name='Line In Capture Switch' off" + cset "name='Mic1 Capture Switch' off" + cset "name='Mic1 Boost Volume' 7" + cset "name='Mic2 Capture Switch' off" + cset "name='Mic2 Boost Volume' 7" + cset "name='Mixer Capture Switch' off" + cset "name='Mixer Reversed Capture Switch' off" + cset "name='ADC Capture Volume' 160" + cset "name='ADC Gain Capture Volume' 7" + cset "name='AIF1 AD0 Capture Volume' 160" + cset "name='AIF1 Data Digital ADC Capture Switch' on" + cset "name='AIF2 ADC Mixer ADC Capture Switch' off" + cset "name='AIF2 ADC Mixer AIF1 DA0 Capture Switch' off" + cset "name='AIF2 ADC Mixer AIF2 DAC Rev Capture Switch' off" + cset "name='AIF2 ADC Mixer AIF1 DA0 Capture Switch' off" + cset "name='AIF2 ADC Mixer AIF1 DA0 Capture Switch' off" + ] + + DisableSequence [ + ] + + Value { + } +} + +SectionDevice."Speaker" { + Comment "Internal speaker" + EnableSequence [ + cset "name='AIF1 DA0 Stereo Playback Route' Mix Mono" + cset "name='Line Out Playback Switch' on" + cset "name='Line Out Playback Volume' 100%" + ] + + DisableSequence [ + cset "name='Line Out Playback Switch' off" + ] + + Value { + PlaybackVolume "Line Out Playback Volume" + PlaybackSwitch "Line Out Playback Switch" + PlaybackChannels 2 + PlaybackPriority 300 + PlaybackPCM "hw:${CardId},0" + } +} +SectionDevice."Earpiece" { + Comment "Internal Earpiece" + EnableSequence [ + cset "name='AIF1 DA0 Stereo Playback Route' Mix Mono" + cset "name='Earpiece Playback Switch' on" + cset "name='Earpiece Playback Volume' 100%" + ] + + DisableSequence [ + cset "name='Earpiece Playback Switch' off" + ] + + Value { + PlaybackVolume "Earpiece Playback Volume" + PlaybackSwitch "Earpiece Playback Switch" + PlaybackChannels 2 + PlaybackPriority 200 + PlaybackPCM "hw:${CardId},0" + } +} +SectionDevice."Mic" { + Comment "Internal Microphone" + ConflictingDevice [ + "Headset" + ] + EnableSequence [ + cset "name='Mic1 Capture Switch' on" + ] + DisableSequence [ + cset "name='Mic1 Capture Switch' off" + ] + Value { + CapturePriority 500 + CapturePCM "hw:${CardId},0" + CaptureChannels 2 + } +} +SectionDevice."Headset" { + Comment "Headset Microphone" + ConflictingDevice [ + "Mic" + ] + EnableSequence [ + cset "name='Mic2 Capture Switch' on" + ] + DisableSequence [ + cset "name='Mic2 Capture Switch' off" + ] + Value { + CapturePriority 100 + CapturePCM "hw:${CardId},0" + CaptureChannels 2 + } +} +SectionDevice."Headphones" { + Comment "Headset" + EnableSequence [ + cset "name='AIF1 DA0 Stereo Playback Route' Stereo" + cset "name='Headphone Playback Switch' on" + cset "name='Headphone Playback Volume' 40%" + ] + + DisableSequence [ + cset "name='Headphone Playback Switch' off" + ] + + Value { + PlaybackVolume "Headphone Playback Volume" + PlaybackSwitch "Headphone Playback Switch" + PlaybackChannels 2 + PlaybackPriority 100 + PlaybackPCM "hw:${CardId},0" + } +} diff --git a/srcpkgs/pinephone-utils/files/ucm/PinePhone.conf b/srcpkgs/pinephone-utils/files/ucm/PinePhone.conf new file mode 100644 index 00000000000..9a8ea12b28a --- /dev/null +++ b/srcpkgs/pinephone-utils/files/ucm/PinePhone.conf @@ -0,0 +1,11 @@ +Syntax 2 + +SectionUseCase."HiFi" { + File "HiFi.conf" + Comment "Play HiFi quality music" +} + +SectionUseCase."Voice Call" { + File "VoiceCall.conf" + Comment "Make a phone call" +} diff --git a/srcpkgs/pinephone-utils/files/ucm/VoiceCall.conf b/srcpkgs/pinephone-utils/files/ucm/VoiceCall.conf new file mode 100644 index 00000000000..dedbcaaabfd --- /dev/null +++ b/srcpkgs/pinephone-utils/files/ucm/VoiceCall.conf @@ -0,0 +1,145 @@ +SectionVerb { + EnableSequence [ + cset "name='Headphone Playback Switch' off" + cset "name='Headphone Source Playback Route' DAC" + cset "name='Line In Playback Switch' off" + cset "name='Line Out Playback Switch' off" + cset "name='Line Out Source Playback Route' Mono Differential" + cset "name='Mic1 Playback Switch' off" + cset "name='Mic2 Playback Switch' off" + cset "name='AIF1 DA0 Playback Volume' 160" + cset "name='AIF2 DAC Playback Volume' 160" + cset "name='AIF3 ADC Source Capture Route' None" + cset "name='AIF2 DAC Source Playback Route' None" + cset "name='DAC Playback Switch' on" + cset "name='DAC Playback Volume' 160" + cset "name='ADC Digital DAC Playback Switch' off" + cset "name='AIF1 Slot 0 Digital DAC Playback Switch' on" + cset "name='AIF2 Digital DAC Playback Switch' on" + cset "name='DAC Reversed Playback Switch' off" + cset "name='Earpiece Playback Switch' off" + cset "name='Earpiece Source Playback Route' DACL" + + cset "name='Line In Capture Switch' off" + cset "name='Mic1 Capture Switch' off" + cset "name='Mic1 Boost Volume' 0" + cset "name='Mic1 Playback Volume' 7" + cset "name='Mic2 Capture Switch' off" + cset "name='Mic2 Boost Volume' 0" + cset "name='Mic2 Playback Volume' 7" + cset "name='Mixer Capture Switch' off" + cset "name='Mixer Reversed Capture Switch' off" + cset "name='ADC Capture Volume' 160" + cset "name='ADC Gain Capture Volume' 7" + cset "name='AIF1 AD0 Capture Volume' 160" + cset "name='AIF1 Data Digital ADC Capture Switch' on" + cset "name='AIF2 ADC Capture Volume' 160" + cset "name='AIF2 ADC Mixer ADC Capture Switch' on" + cset "name='AIF2 ADC Mixer AIF1 DA0 Capture Switch' off" + cset "name='AIF2 ADC Mixer AIF2 DAC Rev Capture Switch' off" + cset "name='AIF2 ADC Mixer AIF1 DA0 Capture Switch' off" + cset "name='AIF2 ADC Mixer AIF1 DA0 Capture Switch' off" + ] + + DisableSequence [ + ] + + Value { + PlaybackRate 8000 + } +} + +SectionDevice."Speaker" { + Comment "Internal speaker" + EnableSequence [ + cset "name='AIF1 DA0 Stereo Playback Route' Mix Mono" + cset "name='Line Out Playback Switch' on" + cset "name='Line Out Playback Volume' 100%" + ] + + DisableSequence [ + cset "name='Line Out Playback Switch' off" + ] + + Value { + PlaybackVolume "Line Out Playback Volume" + PlaybackSwitch "Line Out Playback Switch" + PlaybackChannels 2 + PlaybackPriority 300 + PlaybackPCM "hw:${CardId},0" + } +} +SectionDevice."Earpiece" { + Comment "Internal Earpiece" + EnableSequence [ + cset "name='AIF1 DA0 Stereo Playback Route' Mix Mono" + cset "name='Earpiece Playback Switch' on" + cset "name='Earpiece Playback Volume' 100%" + ] + + DisableSequence [ + cset "name='Earpiece Playback Switch' off" + ] + + Value { + PlaybackVolume "Earpiece Playback Volume" + PlaybackSwitch "Earpiece Playback Switch" + PlaybackChannels 2 + PlaybackPriority 500 + PlaybackPCM "hw:${CardId},0" + } +} +SectionDevice."Mic" { + Comment "Internal Microphone" + ConflictingDevice [ + "Headset" + ] + EnableSequence [ + cset "name='Mic1 Capture Switch' on" + ] + DisableSequence [ + cset "name='Mic1 Capture Switch' off" + ] + Value { + CapturePriority 200 + CapturePCM "hw:${CardId},0" + CaptureChannels 2 + } +} +SectionDevice."Headset" { + Comment "Headset Microphone" + ConflictingDevice [ + "Mic" + ] + EnableSequence [ + cset "name='Mic2 Capture Switch' on" + ] + DisableSequence [ + cset "name='Mic2 Capture Switch' off" + ] + Value { + CapturePriority 100 + CapturePCM "hw:${CardId},0" + CaptureChannels 2 + } +} +SectionDevice."Headphones" { + Comment "Headset" + EnableSequence [ + cset "name='AIF1 DA0 Stereo Playback Route' Stereo" + cset "name='Headphone Playback Switch' on" + cset "name='Headphone Playback Volume' 40%" + ] + + DisableSequence [ + cset "name='Headphone Playback Switch' off" + ] + + Value { + PlaybackVolume "Headphone Playback Volume" + PlaybackSwitch "Headphone Playback Switch" + PlaybackChannels 2 + PlaybackPriority 100 + PlaybackPCM "hw:${CardId},0" + } +} diff --git a/srcpkgs/pinephone-utils/template b/srcpkgs/pinephone-utils/template new file mode 100644 index 00000000000..fd456eca6b2 --- /dev/null +++ b/srcpkgs/pinephone-utils/template @@ -0,0 +1,21 @@ +# Template file for 'pinephone-utils' +pkgname=pinephone-utils +version=0.1 +revision=1 +archs="aarch64*" +depends="alsa-ucm-conf" +short_desc="Scripts/configs for managing pinephone hardware" +maintainer="John Sullivan " +license="MIT" +homepage="https://www.voidlinux.org" + +do_install() { + vinstall "${FILESDIR}/90-modem-eg25.rules" 644 usr/lib/udev/rules.d + vinstall "${FILESDIR}/00-alsa-pinephone-dshare.conf" 644 etc/alsa/conf.d + vbin "${FILESDIR}/pinephone-modem-setup" + + vmkdir usr/share/alsa/ucm2 + vcopy "${FILESDIR}/ucm" usr/share/alsa/ucm2/PinePhone + + vlicense "${FILESDIR}/COPYING" +} From 98d9792cce769e62aac07d2bc67feed8ef17a919 Mon Sep 17 00:00:00 2001 From: John Sullivan Date: Fri, 5 Feb 2021 21:32:10 -0800 Subject: [PATCH 3/3] pinephone-base: move udev rules to pinephone-utils --- srcpkgs/pinephone-base/files/90-modem-eg25.rules | 5 ----- srcpkgs/pinephone-base/template | 8 ++------ 2 files changed, 2 insertions(+), 11 deletions(-) delete mode 100644 srcpkgs/pinephone-base/files/90-modem-eg25.rules diff --git a/srcpkgs/pinephone-base/files/90-modem-eg25.rules b/srcpkgs/pinephone-base/files/90-modem-eg25.rules deleted file mode 100644 index cd0031422cb..00000000000 --- a/srcpkgs/pinephone-base/files/90-modem-eg25.rules +++ /dev/null @@ -1,5 +0,0 @@ -SUBSYSTEMS=="usb", ENV{.LOCAL_ifNum}="$attr{bInterfaceNumber}" - -SUBSYSTEMS=="usb", KERNEL=="ttyUSB[0-9]*", ATTRS{idVendor}=="2c7c", ATTRS{idProduct}=="0125", ENV{.LOCAL_ifNum}=="01", SYMLINK+="EG25.NMEA", MODE="0660" -SUBSYSTEMS=="usb", KERNEL=="ttyUSB[0-9]*", ATTRS{idVendor}=="2c7c", ATTRS{idProduct}=="0125", ENV{.LOCAL_ifNum}=="02", SYMLINK+="EG25.AT", MODE="0660" -SUBSYSTEMS=="usb", KERNEL=="ttyUSB[0-9]*", ATTRS{idVendor}=="2c7c", ATTRS{idProduct}=="0125", ENV{.LOCAL_ifNum}=="03", SYMLINK+="EG25.MODEM", MODE="0660" diff --git a/srcpkgs/pinephone-base/template b/srcpkgs/pinephone-base/template index 6c750a92bd5..a4741e24cb7 100644 --- a/srcpkgs/pinephone-base/template +++ b/srcpkgs/pinephone-base/template @@ -1,15 +1,11 @@ # Template file for 'pinephone-base' pkgname=pinephone-base -version=0.1 +version=0.2 revision=1 archs="aarch64*" build_style=meta -depends="pinephone-kernel pinephone-uboot" +depends="pinephone-kernel pinephone-uboot pinephone-utils" short_desc="Void Linux PinePhone platform package" maintainer="John Sullivan " license="Public Domain" homepage="https://www.voidlinux.org" - -do_install() { - vinstall "${FILESDIR}/90-modem-eg25.rules" 644 usr/lib/udev/rules.d -}