testing/soc-sprd-audio: new package (MR 1162)
This commit adds initial support for sprdphone sound card and sc8830-audio device. sc8830-audio is common audio device used in different Spreadtrum SoCs. This configuration was tested on Nobby 230 (SC7715GA), Finepower F1 (SC7731C), Samsung Galaxy J1 mini (SC8830). It should work for many other SoCs as well. Now, if someone wants to have somewhat working audio, they just have to add soc-sprd-audio-sc8830 package to depends of device- package and that's it. soc-sprd-audio is only for generic configuration (set sprdphone as default sound card and provide headphone jack detection). What works: - Speaker and headphones output; - Headphone jack detection (based on udev rules from device-xiaomi-santoni); - Microphone works on both headphones and device itself. Spotted issues: - Recording volume is low; - Recording is done only on right channel.
This commit is contained in:
parent
5ead73e86c
commit
9e923e0561
5 changed files with 211 additions and 0 deletions
6
device/testing/soc-sprd-audio/90-sprdphone.rules
Normal file
6
device/testing/soc-sprd-audio/90-sprdphone.rules
Normal file
|
@ -0,0 +1,6 @@
|
|||
# Init
|
||||
ATTRS{id}=="sprdphone", RUN+="/usr/bin/alsaucm -c sprdphone set _verb HiFi set _enadev Speaker"
|
||||
|
||||
# Jack detection
|
||||
SUBSYSTEM=="switch",ATTRS{state}=="[1-4]",RUN+="/usr/bin/alsaucm -c sprdphone set _verb HiFi set _disdev Speaker set _enadev Headphones"
|
||||
SUBSYSTEM=="switch",ATTRS{state}=="0",RUN+="/usr/bin/alsaucm -c sprdphone set _verb HiFi set _disdev Headphones set _enadev Speaker"
|
34
device/testing/soc-sprd-audio/APKBUILD
Normal file
34
device/testing/soc-sprd-audio/APKBUILD
Normal file
|
@ -0,0 +1,34 @@
|
|||
# Contributor: Anri Dellal <anridellal@gmail.com>
|
||||
# Maintainer: Anri Dellal <anridellal@gmail.com>
|
||||
pkgname=soc-sprd-audio
|
||||
pkgver=1
|
||||
pkgrel=0
|
||||
pkgdesc="Audio support for Spreadtrum devices (common files)"
|
||||
url="https://postmarketos.org"
|
||||
arch="noarch"
|
||||
license="BSD-3-Clause"
|
||||
options="!check"
|
||||
subpackages="$pkgname-sc8830"
|
||||
source="
|
||||
asound.conf
|
||||
90-sprdphone.rules
|
||||
sc8830/sprdphone.conf
|
||||
sc8830/HiFi
|
||||
"
|
||||
|
||||
package() {
|
||||
install -Dm644 "$srcdir"/asound.conf "$pkgdir"/etc/asound.conf
|
||||
install -Dm644 "$srcdir"/90-sprdphone.rules "$pkgdir"/etc/udev/rules.d/90-sprdphone.rules
|
||||
}
|
||||
|
||||
sc8830() {
|
||||
depends="soc-sprd-audio"
|
||||
install -Dm644 "$srcdir"/sprdphone.conf \
|
||||
"$subpkgdir"/usr/share/alsa/ucm2/sprdphone/sprdphone.conf
|
||||
install -Dm644 "$srcdir"/HiFi \
|
||||
"$subpkgdir"/usr/share/alsa/ucm2/sprdphone/HiFi
|
||||
}
|
||||
sha512sums="369df19f9bf7546236b81a33c00b6384e88e979c4711fead3749f8e60f4cd99f37b31baf1f00d05a821cb71ca2f440648e13083653f1a4ec0c178c7c1c415a58 asound.conf
|
||||
27479383bbbce14071bc66a3cb0abb61d62e4e044997a4a55e50de22cb27881edb27c46b5263f043ac6e03d34616b34b74127ee529636d0a570462483c378cb5 90-sprdphone.rules
|
||||
350a33eff0143793c63d61697632c8936740136c1bcd55f3493526d0a3301b6bbc2381df2b4704300786ba760a8a5371c06a6ee31895e9fbcdf835deba27c314 sprdphone.conf
|
||||
f6ea45936883c4b8f7a19b148cd9a3bdda02d5aba0729e93b7a190df67a3c06c64543a86f8ffca82394adca5f37f5f432307f178da67529b65be6fb2dfaf3325 HiFi"
|
9
device/testing/soc-sprd-audio/asound.conf
Normal file
9
device/testing/soc-sprd-audio/asound.conf
Normal file
|
@ -0,0 +1,9 @@
|
|||
pcm.!default {
|
||||
type hw
|
||||
card sprdphone
|
||||
}
|
||||
|
||||
ctl.!default {
|
||||
type hw
|
||||
card sprdphone
|
||||
}
|
156
device/testing/soc-sprd-audio/sc8830/HiFi
Normal file
156
device/testing/soc-sprd-audio/sc8830/HiFi
Normal file
|
@ -0,0 +1,156 @@
|
|||
SectionVerb {
|
||||
EnableSequence [
|
||||
cdev "hw:sprdphone"
|
||||
cset "name='Speaker Function' 0"
|
||||
cset "name='HeadPhone Function' 0"
|
||||
cset "name='HPL Playback Volume' 11"
|
||||
cset "name='HPR Playback Volume' 11"
|
||||
cset "name='SPKL Playback Volume' 11"
|
||||
cset "name='SPKR Playback Volume' 11"
|
||||
cset "name='ADCL Capture Volume' 12"
|
||||
cset "name='ADCR Capture Volume' 12"
|
||||
cset "name='DACL Playback Volume' 5"
|
||||
cset "name='DACR Playback Volume' 5"
|
||||
cset "name='EAR Playback Volume' 10"
|
||||
]
|
||||
|
||||
DisableSequence [
|
||||
cdev "hw:sprdphone"
|
||||
]
|
||||
|
||||
Value {
|
||||
CapturePCM "hw:sprdphone,0"
|
||||
PlaybackPCM "hw:sprdphone,0"
|
||||
}
|
||||
}
|
||||
|
||||
SectionDevice."Earpiece" {
|
||||
Comment "Earpiece speaker"
|
||||
|
||||
ConflictingDevice [
|
||||
"Headphones"
|
||||
"Speaker"
|
||||
]
|
||||
|
||||
EnableSequence [
|
||||
cdev "hw:sprdphone"
|
||||
cset "name='Earpiece Function' 1"
|
||||
]
|
||||
|
||||
DisableSequence [
|
||||
cdev "hw:sprdphone"
|
||||
cset "name='Earpiece Function' 0"
|
||||
]
|
||||
|
||||
Value {
|
||||
PlaybackChannels "2"
|
||||
}
|
||||
}
|
||||
|
||||
SectionDevice."Speaker" {
|
||||
Comment "Speaker"
|
||||
|
||||
ConflictingDevice [
|
||||
"Earpiece"
|
||||
"Headphones"
|
||||
]
|
||||
|
||||
EnableSequence [
|
||||
cdev "hw:sprdphone"
|
||||
cset "name='SPKL Mixer DACLSPKL Switch' 1"
|
||||
cset "name='Speaker Function' 1"
|
||||
]
|
||||
|
||||
DisableSequence [
|
||||
cdev "hw:sprdphone"
|
||||
cset "name='SPKL Mixer DACLSPKL Switch' 0"
|
||||
cset "name='Speaker Function' 0"
|
||||
]
|
||||
|
||||
Value {
|
||||
PlaybackChannels "2"
|
||||
}
|
||||
}
|
||||
|
||||
SectionDevice."Headphones" {
|
||||
Comment "Headphones"
|
||||
|
||||
ConflictingDevice [
|
||||
"Earpiece"
|
||||
"Speaker"
|
||||
]
|
||||
|
||||
EnableSequence [
|
||||
cdev "hw:sprdphone"
|
||||
cset "name='DACL Playback Volume' 7"
|
||||
cset "name='DACR Playback Volume' 7"
|
||||
cset "name='HPL Mixer DACLHPL Switch' 1"
|
||||
cset "name='HPR Mixer DACRHPR Switch' 1"
|
||||
cset "name='HeadPhone Function' 1"
|
||||
]
|
||||
|
||||
DisableSequence [
|
||||
cdev "hw:sprdphone"
|
||||
cset "name='HeadPhone Function' 0"
|
||||
cset "name='HPL Mixer DACLHPL Switch' 0"
|
||||
cset "name='HPR Mixer DACRHPR Switch' 0"
|
||||
cset "name='DACL Playback Volume' 5"
|
||||
cset "name='DACR Playback Volume' 5"
|
||||
]
|
||||
|
||||
Value {
|
||||
PlaybackChannels "2"
|
||||
}
|
||||
}
|
||||
|
||||
SectionDevice."Headset" {
|
||||
Comment "Headset Microphone"
|
||||
|
||||
ConflictingDevice [
|
||||
"Handset"
|
||||
]
|
||||
|
||||
EnableSequence [
|
||||
cdev "hw:sprdphone"
|
||||
cset "name='ADCL Mixer HPMICADCL Switch' 1"
|
||||
cset "name='ADCR Mixer HPMICADCR Switch' 1"
|
||||
cset "name='HP Mic Function' 1"
|
||||
]
|
||||
|
||||
DisableSequence [
|
||||
cdev "hw:sprdphone"
|
||||
cset "name='HP Mic Function' 0"
|
||||
cset "name='ADCL Mixer HPMICADCL Switch' 0"
|
||||
cset "name='ADCR Mixer HPMICADCR Switch' 0"
|
||||
]
|
||||
|
||||
Value {
|
||||
CaptureChannels "1"
|
||||
}
|
||||
}
|
||||
|
||||
SectionDevice."Handset" {
|
||||
Comment "Handset microphone"
|
||||
|
||||
ConflictingDevice [
|
||||
"Headset"
|
||||
]
|
||||
|
||||
EnableSequence [
|
||||
cdev "hw:sprdphone"
|
||||
cset "name='ADCL Mixer MainMICADCL Switch' 1"
|
||||
cset "name='ADCR Mixer MainMICADCR Switch' 1"
|
||||
cset "name='Mic Function' 1"
|
||||
]
|
||||
|
||||
DisableSequence [
|
||||
cdev "hw:sprdphone"
|
||||
cset "name='Mic Function' 0"
|
||||
cset "name='ADCL Mixer MainMICADCL Switch' 0"
|
||||
cset "name='ADCR Mixer MainMICADCR Switch' 0"
|
||||
]
|
||||
|
||||
Value {
|
||||
CaptureChannels "2"
|
||||
}
|
||||
}
|
6
device/testing/soc-sprd-audio/sc8830/sprdphone.conf
Normal file
6
device/testing/soc-sprd-audio/sc8830/sprdphone.conf
Normal file
|
@ -0,0 +1,6 @@
|
|||
Syntax 2
|
||||
|
||||
SectionUseCase."HiFi" {
|
||||
File "HiFi"
|
||||
Comment "Play HiFi quality Music."
|
||||
}
|
Loading…
Reference in a new issue