Add Rockchip ES8316 support (from upstreama)

This commit is contained in:
Peter Robinson 2021-11-13 12:20:58 +00:00
parent e42bd8613d
commit 4f7869e825
2 changed files with 151 additions and 1 deletions

View File

@ -9,7 +9,7 @@
Summary: The Advanced Linux Sound Architecture (ALSA) library
Name: alsa-lib
Version: %{version_alsa_lib}
Release: 3%{?prever_dot}%{?dist}
Release: 4%{?prever_dot}%{?dist}
License: LGPLv2+
URL: http://www.alsa-project.org/
@ -167,6 +167,9 @@ rm %{buildroot}/%{_includedir}/asoundlib.h
%{_datadir}/alsa/topology
%changelog
* Sat Nov 13 2021 Peter Robinson <pbrobinson@fedoraproject.org> - 1.2.5.1-4
- Add Rockchip ES8316 support
* Tue Aug 31 2021 Jaroslav Kysela <perex@perex.cz> - 1.2.5.1-3
- add UCM related fixes

View File

@ -0,0 +1,147 @@
From 85eea19783cfccaccd859e303fda62adb63c219d Mon Sep 17 00:00:00 2001
From: Jian-Hong Pan <jhp@endlessos.org>
Date: Tue, 7 Sep 2021 11:38:14 +0800
Subject: [PATCH] ucm2: Add UCM support for rockchip_es8316 on Pinebook Pro
Add UCM config files for Pinebook Pro's audio. The config files are
transformed and tuned from Manjaro ARM's packages:
* pinebookpro-post-install's asound.state [1]
* pinebookpro-audio's audio_jack_plugged_in.sh [2]
By the way, with these config files, the Speaker and Headphones will be
switched according to the (un)plugged state automatically.
[1] https://gitlab.manjaro.org/manjaro-arm/packages/community/pinebookpro-post-install/-/blob/4b4206c57b21044bf9c00848bd1f8b6f710d19eb/asound.state
[2] https://gitlab.manjaro.org/manjaro-arm/packages/community/pinebookpro-audio/-/blob/1f567db09495acc3beb5405c9ef85c3c07b86785/audio_jack_plugged_in.sh
Fixes: https://github.com/alsa-project/alsa-ucm-conf/issues/110
Fixes: https://github.com/alsa-project/alsa-ucm-conf/pull/112
Signed-off-by: Jian-Hong Pan <jhp@endlessos.org>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
---
ucm2/Rockchip/es8316/HiFi.conf | 66 +++++++++++++++++++
ucm2/Rockchip/es8316/es8316.conf | 29 ++++++++
.../rockchip_es8316/rockchip_es8316.conf | 1 +
3 files changed, 96 insertions(+)
create mode 100644 ucm2/Rockchip/es8316/HiFi.conf
create mode 100644 ucm2/Rockchip/es8316/es8316.conf
create mode 120000 ucm2/conf.d/rockchip_es8316/rockchip_es8316.conf
diff --git a/ucm2/Rockchip/es8316/HiFi.conf b/ucm2/Rockchip/es8316/HiFi.conf
new file mode 100644
index 0000000..2124ded
--- /dev/null
+++ b/ucm2/Rockchip/es8316/HiFi.conf
@@ -0,0 +1,66 @@
+# Reference:
+# https://gitlab.manjaro.org/manjaro-arm/packages/community/pinebookpro-post-install/-/blob/4b4206c57b21044bf9c00848bd1f8b6f710d19eb/asound.state
+# https://gitlab.manjaro.org/manjaro-arm/packages/community/pinebookpro-audio/-/blob/1f567db09495acc3beb5405c9ef85c3c07b86785/audio_jack_plugged_in.sh
+
+SectionDevice."Speaker" {
+ Comment "Speaker"
+
+ ConflictingDevice [
+ "Headphones"
+ ]
+
+ EnableSequence [
+ cset "name='Playback Polarity' 'R Invert'"
+ cset "name='Speaker Switch' on"
+ ]
+
+ DisableSequence [
+ cset "name='Speaker Switch' off"
+ ]
+
+ Value {
+ PlaybackPriority 100
+ PlaybackPCM "hw:${CardId}"
+ PlaybackMixerElem "Headphone Mixer"
+ PlaybackMasterElem "DAC"
+ }
+}
+
+SectionDevice."Mic" {
+ Comment "Internal Microphone"
+
+ EnableSequence [
+ cset "name='Differential Mux' lin1-rin1"
+ ]
+
+ Value {
+ CapturePriority 100
+ CapturePCM "hw:${CardId}"
+ CaptureMixerElem "ADC PGA Gain"
+ CaptureMasterElem "ADC"
+ }
+}
+
+SectionDevice."Headphones" {
+ Comment "Headphones"
+
+ ConflictingDevice [
+ "Speaker"
+ ]
+
+ EnableSequence [
+ cset "name='Playback Polarity' 'Normal'"
+ ]
+ DisableSequence [
+ cset "name='Playback Polarity' 'R Invert'"
+ ]
+
+ Value {
+ PlaybackPriority 200
+ PlaybackPCM "hw:${CardId}"
+ PlaybackMixerElem "Headphone Mixer"
+ PlaybackMasterElem "DAC"
+ JackControl "Headphones Jack"
+ JackHWMute "Speaker"
+ }
+}
diff --git a/ucm2/Rockchip/es8316/es8316.conf b/ucm2/Rockchip/es8316/es8316.conf
new file mode 100644
index 0000000..62044e6
--- /dev/null
+++ b/ucm2/Rockchip/es8316/es8316.conf
@@ -0,0 +1,29 @@
+Syntax 3
+
+SectionUseCase."HiFi" {
+ File "/Rockchip/es8316/HiFi.conf"
+ Comment "Play HiFi quality Music"
+}
+
+BootSequence [
+ # Disable all outputs
+ cset "name='Speaker Switch' off"
+
+ # Set HP vol to 0 dB (3/3)
+ cset "name='Headphone Playback Volume' 3"
+ # Set HP mixer vol to 0 dB
+ cset "name='Headphone Mixer Volume' 11"
+ # Set DAC vol to 0 dB (192/192)
+ cset "name='DAC Playback Volume' 192"
+
+ # Disable Auto Level Control
+ cset "name='ALC Capture Switch' off"
+ # Set ADC vol to 0 dB (192/192)
+ cset "name='ADC Capture Volume' 192"
+ # Set Mic amplifier to +16 dB
+ cset "name='ADC PGA Gain Volume' 7"
+
+ # Setup muxes / switches
+ cset "name='Left Headphone Mixer Left DAC Switch' on"
+ cset "name='Right Headphone Mixer Right DAC Switch' on"
+]
diff --git a/ucm2/conf.d/rockchip_es8316/rockchip_es8316.conf b/ucm2/conf.d/rockchip_es8316/rockchip_es8316.conf
new file mode 120000
index 0000000..6d1864f
--- /dev/null
+++ b/ucm2/conf.d/rockchip_es8316/rockchip_es8316.conf
@@ -0,0 +1 @@
+../../Rockchip/es8316/es8316.conf
\ No newline at end of file
--
2.33.1