[PATCH] Add ALSA UCM profile for DevTerm A06 audio
Handles jack detection & speaker amp enablement, as well as removing pops on shutdown/restart.
Note: there still may be pops if device is not shutdown gracefully, as ALSA UCM won't have time to disable the speaker amp.0001-Add-ALSA-UCM-profile-for-DevTerm-A06-audio.patch
Click to expand
From acdcdd0c0df78c8ff2f8661f5a41f1d16f0fa901 Mon Sep 17 00:00:00 2001
From: Max Fierke <max@maxfierke.com>
Date: Sun, 16 Jan 2022 17:33:34 -0600
Subject: [PATCH] Add ALSA UCM profile for DevTerm A06 audio
Handles jack detection & speaker amp enablement, as well as removing pops on shutdown/restart.
Note: there still may be pops if device is not shutdown gracefully, as ALSA UCM won't have time to disable
the speaker amp.
---
HiFi.conf | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
PKGBUILD | 29 +++++++++++++++++++++++------
es8388.conf | 44 ++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 115 insertions(+), 6 deletions(-)
create mode 100644 HiFi.conf
create mode 100644 es8388.conf
diff --git a/HiFi.conf b/HiFi.conf
new file mode 100644
index 0000000..994317f
--- /dev/null
+++ b/HiFi.conf
@@ -0,0 +1,48 @@
+SectionDevice."Speaker" {
+ Comment "Speaker"
+
+ ConflictingDevice [
+ "Headphones"
+ ]
+
+ EnableSequence [
+ cset "name='Speaker Switch' on"
+ ]
+
+ DisableSequence [
+ cset "name='Speaker Switch' off"
+ ]
+
+ Value {
+ PlaybackPriority 100
+ PlaybackPCM "hw:${CardId},0"
+ }
+}
+
+SectionDevice."Mic" {
+ Comment "Headphone Mic"
+
+ EnableSequence [
+ cset "name='Differential Mux' 'Line 2'"
+ ]
+
+ Value {
+ CapturePriority 100
+ CapturePCM "hw:${CardId},0"
+ }
+}
+
+SectionDevice."Headphones" {
+ Comment "Headphones"
+
+ ConflictingDevice [
+ "Speaker"
+ ]
+
+ Value {
+ PlaybackPriority 200
+ PlaybackPCM "hw:${CardId},0"
+ JackControl "Headphones Jack"
+ JackHWMute "Speaker"
+ }
+}
diff --git a/PKGBUILD b/PKGBUILD
index c5e2f44..56ce499 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,19 +1,36 @@
# Maintainer: Dan Johansen <strit@manjaro.org>
-# Maintainer : Max Fierke <max@maxfierke.com>
+# Maintainer: Max Fierke <max@maxfierke.com>
pkgname=clockworkpi-a06-post-install
pkgver=20$(date +%y%m%d)
pkgrel=1
-pkgdesc="clockworkPI DevTerm A06 post install files"
+pkgdesc="ClockworkPi DevTerm A06 post install files"
arch=('any')
-url="https://github.com/maxfierke/clockworkpi-a06-alarm"
+url="https://manjaro.org"
license=('GPL')
install=${pkgname}.install
-source=('10-monitor.conf')
-md5sums=('0939a3e65eca3ca2e8bd8f4f843eed47')
+optdepends=('alsa-ucm-conf>=1.2.6.2')
+source=(
+ '10-monitor.conf'
+ 'es8388.conf'
+ 'HiFi.conf'
+)
+sha256sums=('11243c7f9746b7bb23740f50ef2df56a208795e19df2cda659b530c3fc3f9755'
+ 'bf65ae20d52bc035889c1c940ab939dc8b9d086d4d03d65a53415ed372acb287'
+ 'd4f87eec9a0f8c041f64e5825e065ba089a2ae1e2320948d0665d385e24d7558')
package() {
echo "Modifying clockworkpi-a06 specific files..."
- install -Dm644 "${srcdir}/10-monitor.conf" "${pkgdir}/etc/X11/xorg.conf.d/10-monitor.conf"
+ # Install X rotation fix as it does not read panel orientation from kernel
+ install -Dm644 "${srcdir}/10-monitor.conf" "${pkgdir}/etc/X11/xorg.conf.d/10-monitor.conf"
+
+ # Install alsa-ucm-conf profile for DevTerm A06
+ mkdir -p "${pkgdir}/usr/share/alsa/ucm2/Rockchip/es8388"
+ install -Dm644 "${srcdir}/es8388.conf" "${pkgdir}/usr/share/alsa/ucm2/Rockchip/es8388/es8388.conf"
+ install -Dm644 "${srcdir}/HiFi.conf" "${pkgdir}/usr/share/alsa/ucm2/Rockchip/es8388/HiFi.conf"
+
+ mkdir -p "${pkgdir}"/usr/share/alsa/ucm2/conf.d/simple-card
+ ln -sfv /usr/share/alsa/ucm2/Rockchip/es8388/es8388.conf \
+ "${pkgdir}"/usr/share/alsa/ucm2/conf.d/simple-card/rockchip,es8388-codec.conf
}
diff --git a/es8388.conf b/es8388.conf
new file mode 100644
index 0000000..303e38b
--- /dev/null
+++ b/es8388.conf
@@ -0,0 +1,44 @@
+Syntax 3
+
+SectionUseCase."HiFi" {
+ File "/Rockchip/es8388/HiFi.conf"
+ Comment "Play HiFi quality Music"
+}
+
+BootSequence [
+ # Disable all outputs
+ cset "name='Speaker Switch' off"
+
+ # Set Route to Stereo
+ cset "name='Route' Stereo"
+
+ # Set vol to 0 dB (28/32)
+ cset "name='Output 1 Playback Volume' 28"
+ cset "name='Output 2 Playback Volume' 28"
+ # Set mixer vol to 0 dB
+ cset "name='Left Mixer Left Bypass Volume' 6"
+ cset "name='Left Mixer Right Bypass Volume' 6"
+ cset "name='Right Mixer Left Bypass Volume' 6"
+ cset "name='Right Mixer Right Bypass Volume' 6"
+ # Set DAC vol to 0 dB (192/192)
+ cset "name='PCM Volume' 192"
+
+ cset "name='Capture ZC Switch' off"
+ cset "name='DAC Deemphasis Switch' off"
+ # Set ADC vol to 0 dB (192/192)
+ cset "name='Capture Digital Volume' 192"
+ # Set Mic amplifier to +15 dB
+ cset "name='Mic PGA Volume' 5"
+
+ # Set Line Muxes to PGA
+ cset "name='Left Line Mux' PGA"
+ cset "name='Right Line Mux' PGA"
+
+ # Set PGA Muxes to Differential
+ cset "name='Left PGA Mux' Differential"
+ cset "name='Right PGA Mux' Differential"
+
+ # Setup muxes / switches
+ cset "name='Left Mixer Playback Switch' on"
+ cset "name='Right Mixer Playback Switch' on"
+]
--
2.34.1