From 4f7869e8258c9827aeaa0bf064eda0b08c2e3ebe Mon Sep 17 00:00:00 2001 From: Peter Robinson Date: Sat, 13 Nov 2021 12:20:58 +0000 Subject: [PATCH] Add Rockchip ES8316 support (from upstreama) --- alsa-lib.spec | 5 +- alsa-ucm-conf.patch | 147 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 151 insertions(+), 1 deletion(-) diff --git a/alsa-lib.spec b/alsa-lib.spec index fe19b44..5493e3c 100644 --- a/alsa-lib.spec +++ b/alsa-lib.spec @@ -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 - 1.2.5.1-4 +- Add Rockchip ES8316 support + * Tue Aug 31 2021 Jaroslav Kysela - 1.2.5.1-3 - add UCM related fixes diff --git a/alsa-ucm-conf.patch b/alsa-ucm-conf.patch index e69de29..0ceffd8 100644 --- a/alsa-ucm-conf.patch +++ b/alsa-ucm-conf.patch @@ -0,0 +1,147 @@ +From 85eea19783cfccaccd859e303fda62adb63c219d Mon Sep 17 00:00:00 2001 +From: Jian-Hong Pan +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 +Signed-off-by: Jaroslav Kysela +--- + 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 +