samsung-m3: add initial audio support (MR 2992)

I'm not deduplicating the UCM files between m3 and m0 as I may not
always be able to test changes to m3, and I'd rather have a an
outdated configuration for m3 than a broken one.
This commit is contained in:
Newbyte 2022-03-11 08:47:30 +01:00
parent a23582e15c
commit 0ce8404555
No known key found for this signature in database
GPG key ID: 5873C171C9429CFA
3 changed files with 262 additions and 3 deletions

View file

@ -1,13 +1,14 @@
# Reference: <https://postmarketos.org/devicepkg>
pkgname=device-samsung-m3
pkgdesc="Samsung Galaxy S III LTE"
pkgver=3
pkgrel=4
pkgver=4
pkgrel=0
url="https://postmarketos.org"
license="MIT"
arch="armv7"
options="!check !archcheck"
depends="
alsa-ucm-conf
linux-postmarketos-exynos4
mesa-dri-gallium
mkbootimg
@ -16,7 +17,11 @@ depends="
makedepends="devicepkg-dev"
install="$pkgname.post-install"
subpackages="$pkgname-nonfree-firmware:nonfree_firmware"
source="deviceinfo"
source="
deviceinfo
ucm/Midas.conf
ucm/HiFi.conf
"
build() {
devicepkg_build $startdir $pkgname
@ -24,6 +29,14 @@ build() {
package() {
devicepkg_package $startdir $pkgname
_midas_audio_dir="$pkgdir/usr/share/alsa/ucm2/conf.d/Midas"
# Alsa UCM configs
install -Dm644 "$srcdir"/Midas.conf \
-t "$_midas_audio_dir"
install -Dm644 "$srcdir"/HiFi.conf \
-t "$_midas_audio_dir"
}
nonfree_firmware() {
@ -37,4 +50,6 @@ nonfree_firmware() {
sha512sums="
d2ed2eedd223854766121058273a3a90b1672dbb95d0072b56100c01196cbe5ee96049c3b646b9b2f60af1254743ef4c4006e6275f407d582ec012e7bd383f71 deviceinfo
caa81e8ab6753c0ca24c22fb6742288765dfbf2469b8b8c35c5789edfcee546ef1c3b14ad6e540c417f434258399300f17d312b58157635eafab134587ef94cc Midas.conf
e6df5f3c4b8203447d9cbec1cf10588d9dc03d3be49e596393de5bd2afb9cc9fab669d1ade2c4ee7e0886fdbaa0e4266a3bddd55a866f3ea98dd82267bc9e856 HiFi.conf
"

View file

@ -0,0 +1,238 @@
# Based on https://github.com/Midas-Mainline/android_device_midas_common/blob/lineage-18.1/configs/audio.i9300.xml
SectionVerb {
EnableSequence [
cdev "hw:Midas"
# do not change the adc & dac source of AIF2
cset "name='AIF2DACL Source' 0"
cset "name='AIF2DACR Source' 0"
cset "name='AIF2ADCL Source' 0"
cset "name='AIF2ADCR Source' 1"
# AIF1->DAC1
cset "name='DAC1 Switch' 1"
# general
cset "name='IN1L ZC Switch' 0"
cset "name='IN1R ZC Switch' 0"
cset "name='IN2L ZC Switch' 0"
cset "name='IN2R ZC Switch' 0"
cset "name='Output ZC Switch' 0"
cset "name='Speaker ZC Switch' 0"
cset "name='Headphone ZC Switch' 0"
# AIF1->DAC1
cset "name='DAC1L Mixer AIF1.1 Switch' 1"
cset "name='DAC1R Mixer AIF1.1 Switch' 1"
cset "name='DAC1 Switch' 1"
# ADC->AIF2
cset "name='AIF2DAC2L Mixer Left Sidetone Switch' 1"
cset "name='AIF2DAC2L Mixer Right Sidetone Switch' 0"
cset "name='AIF2DAC2R Mixer Left Sidetone Switch' 0"
cset "name='AIF2DAC2R Mixer Right Sidetone Switch' 1"
cset "name='DAC2 Left Sidetone Volume' 12"
cset "name='DAC2 Right Sidetone Volume' 12"
cset "name='DAC2 Switch' 1"
# DAC1->HP
cset "name='Left Headphone Mux' Mixer"
cset "name='Right Headphone Mux' Mixer"
# DAC1->SPKL/R->SPKL/R Boost->SPK
cset "name='SPKL DAC1 Switch' 1"
cset "name='SPKR DAC1 Switch' 1"
cset "name='SPKL Boost SPKL Switch' 1"
cset "name='SPKL Boost SPKR Switch' 1"
cset "name='SPKR Boost SPKL Switch' 0"
cset "name='SPKR Boost SPKR Switch' 0"
cset "name='Speaker Mixer Volume' 3"
# DAC->Output mixer->Earpiece
cset "name='Left Output Mixer DAC Switch' 1"
cset "name='Right Output Mixer DAC Switch' 1"
cset "name='Earpiece Mixer Left Output Switch' 1"
cset "name='Earpiece Mixer Right Output Switch' 1"
cset "name='Earpiece Switch' 1"
# LINEOUT
cset "name='LINEOUT2N Mixer Left Output Switch' 1"
cset "name='LINEOUT2P Mixer Right Output Switch' 1"
cset "name='LINEOUT1N Mixer Right Output Switch' 1"
cset "name='LINEOUT1P Mixer Left Output Switch' 1"
# Input mixer->ADC->AIF1.1
cset "name='AIF1ADC1L Mixer ADC/DMIC Switch' 1"
cset "name='AIF1ADC1R Mixer ADC/DMIC Switch' 1"
# Main Mic->IN1LP/N->Input Mixer with +30dB at mixer
cset "name='IN1L PGA IN1LP Switch' 1"
cset "name='IN1L PGA IN1LN Switch' 1"
cset "name='MIXINL IN1L Volume' 1"
cset "name='IN1L Switch' 1"
# Sub Mic->IN1RP/N->Input Mixer with +30dB at mixer
cset "name='IN1R PGA IN1RP Switch' 1"
cset "name='IN1R PGA IN1RN Switch' 1"
cset "name='MIXINR IN1R Volume' 1"
cset "name='IN1R Switch' 1"
# FM Radio->IN2RP/N->Input Mixer with +30dB at mixer
cset "name='IN2R PGA IN2RP Switch' 1"
cset "name='IN2R PGA IN2RN Switch' 1"
cset "name='MIXINR IN2R Volume' 1"
cset "name='IN2R Switch' 1"
# Ear Mic->IN2LP/N->Input Mixer with +30dB at mixer
cset "name='IN2L PGA IN2LP Switch' 1"
cset "name='IN2L PGA IN2LN Switch' 1"
cset "name='MIXINL IN2L Volume' 1"
cset "name='IN2L Switch' 1"
# Input mixer->ADC->AIF1
cset "name='AIF1ADC1L Mixer ADC/DMIC Switch' 1"
cset "name='AIF1ADC1R Mixer ADC/DMIC Switch' 1"
cset "name='ADCL Mux' ADC"
# HPF on to take out some bounce
cset "name='Sidetone HPF Switch' 0"
# Work around core issue
cset "name='ADCL Mux' DMIC"
cset "name='ADCL Mux' ADC"
cset "name='ADCR Mux' DMIC"
cset "name='ADCR Mux' ADC"
# AIF2ADCDAT to AIF3ADC mux
cset "name='AIF3ADC Mux' 1"
# Default all outputs off
cset "name='HP Switch' 0"
cset "name='SPK Switch' 0"
cset "name='RCV Switch' 0"
cset "name='LINE Switch' 0"
cset "name='HDMI Switch' 0"
# Default all inputs off
cset "name='Main Mic Switch' 0"
cset "name='Sub Mic Switch' 0"
cset "name='Headset Mic Switch' 0"
cset "name='FM In Switch' 0"
# EQ Switches
cset "name='AIF1DAC1 EQ Switch' 1"
cset "name='AIF1DAC1 EQ1 Volume' 9"
cset "name='AIF1DAC1 EQ2 Volume' 7"
cset "name='AIF1DAC1 EQ3 Volume' 10"
cset "name='AIF1DAC1 EQ4 Volume' 13"
cset "name='AIF1DAC1 EQ5 Volume' 12"
cset "name='Headphone Volume' 50"
cset "name='AIF1DAC1 Volume' 96"
cset "name='AIF1 Boost Volume' 0"
cset "name='DAC1 Volume' 96"
cset "name='Left Output Mixer DAC Volume' 7"
cset "name='Right Output Mixer DAC Volume' 7"
]
DisableSequence [
]
}
SectionDevice."Speaker" {
Comment "Built-in speaker"
EnableSequence [
cset "name='SPK Switch' 1"
cset "name='AIF1DAC1 Volume' 96"
cset "name='AIF1 Boost Volume' 0"
cset "name='DAC1 Volume' 96"
cset "name='Left Output Mixer DAC Volume' 7"
cset "name='Right Output Mixer DAC Volume' 7"
cset "name='SPKL DAC1 Volume' 1"
cset "name='SPKR DAC1 Volume' 1"
cset "name='Speaker Mixer Volume' 3"
cset "name='Speaker Boost Volume' 4"
cset "name='Speaker Volume' 57"
]
DisableSequence [
cset "name='SPK Switch' 0"
cset "name='Speaker Mixer Volume' 1"
cset "name='Speaker Volume' 0"
]
Value {
PlaybackVolume "Speaker Volume"
PlaybackSwitch "SPK Switch"
PlaybackChannels 2
PlaybackPCM "hw:${CardId}"
}
}
SectionDevice."BackInternalMicrophone" {
Comment "Back Internal Microphone"
EnableSequence [
cset "name='Sub Mic Switch' 1"
cset "name='IN1R Volume' 22"
cset "name='MIXINR IN1R Switch' 1"
cset "name='MIXINR IN1R Volume' 1"
cset "name='AIF1ADCR Source' 1"
cset "name='AIF2ADCR Source' 1"
cset "name='AIF1ADC1 HPF Mode' 1"
cset "name='AIF1ADC1 HPF Switch' 1"
cset "name='AIF1ADC1 Volume' 96"
]
DisableSequence [
cset "name='Sub Mic Switch' 0"
cset "name='MIXINR IN1R Switch' 0"
cset "name='IN1R Volume' 10"
]
Value {
CapturePCM "hw:${CardId}"
CaptureChannels 2
CaptureVolume "IN1R Volume"
}
}
SectionDevice."HeadsetIn" {
Comment "Headset Input"
EnableSequence [
cset "name='MIXINL IN1L Switch' 0"
cset "name='MIXINR IN1R Switch' 0"
cset "name='Headset Mic Switch' 1"
cset "name='IN2L Volume' 22"
cset "name='MIXINL IN2L Switch' 1"
cset "name='MIXINL IN2L Volume' 1"
cset "name='AIF1ADC1 HPF Mode' 1"
cset "name='AIF1ADC1 HPF Switch' 1"
cset "name='AIF1ADC1 Volume' 96"
cset "name='AIF1ADCL Source' 0"
cset "name='AIF1ADCR Source' 0"
cset "name='AIF2ADCL Source' 0"
]
DisableSequence [
cset "name='Headset Mic Switch' 0"
cset "name='IN2L Volume' 10"
cset "name='MIXINL IN2L Switch' 0"
cset "name='MIXINL IN2L Volume' 0"
cset "name='AIF1ADC1 HPF Mode' 0"
cset "name='AIF1ADC1 HPF Switch' 0"
cset "name='AIF1ADC1 Volume' 96"
]
Value {
CapturePCM "hw:${CardId}"
CaptureChannels 2
CaptureVolume "IN2L Volume"
}
}

View file

@ -0,0 +1,6 @@
Syntax 2
SectionUseCase."HiFi" {
File "HiFi.conf"
Comment "Play high quality music"
}