Accepting request 567472 from home:tiwai:branches:multimedia:libs

- Upstream fixes:
  * Add the new ucm for Cherrytrail devices (bsc#1068546):
    0005-conf-ucm-Add-chtrt5645-mono-speaker-analog-mic-confi.patch
  * Fix for error code from PCM API functions at unexpected states:
    0006-pcm-Return-the-consistent-error-code-for-unexpected-.patch

OBS-URL: https://build.opensuse.org/request/show/567472
OBS-URL: https://build.opensuse.org/package/show/multimedia:libs/alsa?expand=0&rev=226
This commit is contained in:
Tomáš Chvátal 2018-01-18 16:46:54 +00:00 committed by Git OBS Bridge
parent 5104a8c0f6
commit 6d73dea06e
4 changed files with 943 additions and 1 deletions

View File

@ -0,0 +1,512 @@
From 60ed28999a272e1a3d737a9eeee0719b98efd447 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Sat, 6 Jan 2018 23:03:20 +0100
Subject: [PATCH] conf/ucm: Add chtrt5645-mono-speaker-analog-mic configuration
Add a configuration for Cherry Trail boards which use a rt5645 codec
connected to a mono speaker and with an analog mic on IN2N + IN2P.
The chtrt5645-mono-speaker-analog-mic/HiFi.conf for this is based on the
latest version from https://github.com/plbossart/UCM/tree/master/chtrt5645
with all the unused input options removed and some changes made to make
the analog mic work.
This commit also adds 2 ucm dirs with the longname of 2 boards known to use
this setup, which simply contain a symlink to the generic
chtrt5645-mono-speaker-analog-mic entry.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
configure.ac | 3 +
src/conf/ucm/Makefile.am | 3 +
.../Makefile.am | 4 +
...TECLAST-X80Pro-Defaultstring-CherryTrailCR.conf | 1 +
.../chtrt5645-mono-speaker-analog-mic/HiFi.conf | 361 +++++++++++++++++++++
.../chtrt5645-mono-speaker-analog-mic/Makefile.am | 4 +
.../chtrt5645-mono-speaker-analog-mic.conf | 5 +
src/conf/ucm/gpd-win-pocket-rt5645/Makefile.am | 4 +
.../gpd-win-pocket-rt5645.conf | 1 +
9 files changed, 386 insertions(+)
create mode 100644 src/conf/ucm/TECLAST-X80Pro-Defaultstring-CherryTrailCR/Makefile.am
create mode 120000 src/conf/ucm/TECLAST-X80Pro-Defaultstring-CherryTrailCR/TECLAST-X80Pro-Defaultstring-CherryTrailCR.conf
create mode 100644 src/conf/ucm/chtrt5645-mono-speaker-analog-mic/HiFi.conf
create mode 100644 src/conf/ucm/chtrt5645-mono-speaker-analog-mic/Makefile.am
create mode 100644 src/conf/ucm/chtrt5645-mono-speaker-analog-mic/chtrt5645-mono-speaker-analog-mic.conf
create mode 100644 src/conf/ucm/gpd-win-pocket-rt5645/Makefile.am
create mode 120000 src/conf/ucm/gpd-win-pocket-rt5645/gpd-win-pocket-rt5645.conf
diff --git a/configure.ac b/configure.ac
index 47c50fcf89b4..2c51ce75555a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -713,9 +713,11 @@ AC_OUTPUT(Makefile doc/Makefile doc/pictures/Makefile doc/doxygen.cfg \
src/conf/ucm/broxton-rt298/Makefile \
src/conf/ucm/bytcr-rt5651/Makefile \
src/conf/ucm/chtrt5645/Makefile \
+ src/conf/ucm/chtrt5645-mono-speaker-analog-mic/Makefile \
src/conf/ucm/DAISY-I2S/Makefile \
src/conf/ucm/DB410c/Makefile \
src/conf/ucm/GoogleNyan/Makefile \
+ src/conf/ucm/gpd-win-pocket-rt5645/Makefile \
src/conf/ucm/HDAudio-Gigabyte-ALC1220DualCodecs/Makefile \
src/conf/ucm/HDAudio-Lenovo-DualCodecs/Makefile \
src/conf/ucm/PandaBoard/Makefile \
@@ -723,6 +725,7 @@ AC_OUTPUT(Makefile doc/Makefile doc/pictures/Makefile doc/doxygen.cfg \
src/conf/ucm/PAZ00/Makefile \
src/conf/ucm/SDP4430/Makefile \
src/conf/ucm/skylake-rt286/Makefile \
+ src/conf/ucm/TECLAST-X80Pro-Defaultstring-CherryTrailCR/Makefile \
src/conf/ucm/tegraalc5632/Makefile \
src/conf/ucm/VEYRON-I2S/Makefile \
src/conf/topology/Makefile \
diff --git a/src/conf/ucm/Makefile.am b/src/conf/ucm/Makefile.am
index 954e32b8f0c8..3b4f13a880e6 100644
--- a/src/conf/ucm/Makefile.am
+++ b/src/conf/ucm/Makefile.am
@@ -3,9 +3,11 @@ broadwell-rt286 \
broxton-rt298 \
bytcr-rt5651 \
chtrt5645 \
+chtrt5645-mono-speaker-analog-mic \
DAISY-I2S \
DB410c \
GoogleNyan \
+gpd-win-pocket-rt5645 \
HDAudio-Gigabyte-ALC1220DualCodecs \
HDAudio-Lenovo-DualCodecs \
PandaBoard \
@@ -13,5 +15,6 @@ PandaBoardES \
PAZ00 \
SDP4430 \
skylake-rt286 \
+TECLAST-X80Pro-Defaultstring-CherryTrailCR \
tegraalc5632 \
VEYRON-I2S
diff --git a/src/conf/ucm/TECLAST-X80Pro-Defaultstring-CherryTrailCR/Makefile.am b/src/conf/ucm/TECLAST-X80Pro-Defaultstring-CherryTrailCR/Makefile.am
new file mode 100644
index 000000000000..f56a817c73e0
--- /dev/null
+++ b/src/conf/ucm/TECLAST-X80Pro-Defaultstring-CherryTrailCR/Makefile.am
@@ -0,0 +1,4 @@
+alsaconfigdir = @ALSA_CONFIG_DIR@
+ucmdir = $(alsaconfigdir)/ucm/TECLAST-X80Pro-Defaultstring-CherryTrailCR
+ucm_DATA = TECLAST-X80Pro-Defaultstring-CherryTrailCR.conf
+EXTRA_DIST = $(ucm_DATA)
diff --git a/src/conf/ucm/TECLAST-X80Pro-Defaultstring-CherryTrailCR/TECLAST-X80Pro-Defaultstring-CherryTrailCR.conf b/src/conf/ucm/TECLAST-X80Pro-Defaultstring-CherryTrailCR/TECLAST-X80Pro-Defaultstring-CherryTrailCR.conf
new file mode 120000
index 000000000000..1b1d47540b73
--- /dev/null
+++ b/src/conf/ucm/TECLAST-X80Pro-Defaultstring-CherryTrailCR/TECLAST-X80Pro-Defaultstring-CherryTrailCR.conf
@@ -0,0 +1 @@
+../chtrt5645-mono-speaker-analog-mic/chtrt5645-mono-speaker-analog-mic.conf
\ No newline at end of file
diff --git a/src/conf/ucm/chtrt5645-mono-speaker-analog-mic/HiFi.conf b/src/conf/ucm/chtrt5645-mono-speaker-analog-mic/HiFi.conf
new file mode 100644
index 000000000000..7a0cd51c0790
--- /dev/null
+++ b/src/conf/ucm/chtrt5645-mono-speaker-analog-mic/HiFi.conf
@@ -0,0 +1,361 @@
+SectionVerb {
+ # ALSA PCM
+ Value {
+ TQ "HiFi"
+
+ # ALSA PCM device for HiFi
+ PlaybackPCM "hw:chtrt5645"
+ CapturePCM "hw:chtrt5645"
+ }
+
+ EnableSequence [
+ cdev "hw:chtrt5645"
+
+ # media mixer settings
+ # compress
+ cset "name='media0_in Gain 0 Switch' on"
+ cset "name='media0_in Gain 0 Volume' 0"
+
+ # normal
+ cset "name='media1_in Gain 0 Switch' on"
+ cset "name='media1_in Gain 0 Volume' 0"
+ # swm loopback
+ cset "name='media2_in Gain 0 Switch' off"
+ cset "name='media2_in Gain 0 Volume' 0%"
+ # deep buffer
+ cset "name='media3_in Gain 0 Switch' on"
+ cset "name='media3_in Gain 0 Volume' 0"
+
+ cset "name='media0_out mix 0 media0_in Switch' on"
+ cset "name='media0_out mix 0 media1_in Switch' on"
+ cset "name='media0_out mix 0 media2_in Switch' off"
+ cset "name='media0_out mix 0 media3_in Switch' on"
+
+ cset "name='media1_out mix 0 media0_in Switch' off"
+ cset "name='media1_out mix 0 media1_in Switch' off"
+ cset "name='media1_out mix 0 media2_in Switch' off"
+ cset "name='media1_out mix 0 media3_in Switch' off"
+
+ cset "name='pcm0_in Gain 0 Switch' on"
+ cset "name='pcm0_in Gain 0 Volume' 0"
+
+ cset "name='pcm1_in Gain 0 Switch' off"
+ cset "name='pcm1_in Gain 0 Volume' 0%"
+
+ # codec0_out settings (used if ssp2 is connected to aif1)
+ cset "name='codec_out0 mix 0 codec_in0 Switch' off"
+ cset "name='codec_out0 mix 0 codec_in1 Switch' off"
+ cset "name='codec_out0 mix 0 media_loop1_in Switch' off"
+ cset "name='codec_out0 mix 0 media_loop2_in Switch' off"
+ cset "name='codec_out0 mix 0 pcm0_in Switch' on"
+ cset "name='codec_out0 mix 0 pcm1_in Switch' off"
+ cset "name='codec_out0 mix 0 sprot_loop_in Switch' off"
+ cset "name='codec_out0 Gain 0 Switch' on"
+ cset "name='codec_out0 Gain 0 Volume' 0"
+
+ # modem_out settings (used if ssp0 is connected to aif2)
+ cset "name='modem_out mix 0 codec_in0 Switch' off"
+ cset "name='modem_out mix 0 codec_in1 Switch' off"
+ cset "name='modem_out mix 0 media_loop1_in Switch' off"
+ cset "name='modem_out mix 0 media_loop2_in Switch' off"
+ cset "name='modem_out mix 0 pcm0_in Switch' on"
+ cset "name='modem_out mix 0 pcm1_in Switch' off"
+ cset "name='modem_out mix 0 sprot_loop_in Switch' off"
+ cset "name='modem_out Gain 0 Switch' on"
+ cset "name='modem_out Gain 0 Volume' 0"
+
+ # input settings
+ # pcm1_out settings
+
+ # input used when SSP2 is connected
+ cset "name='codec_in0 Gain 0 Switch' on"
+ cset "name='codec_in0 Gain 0 Volume' 0"
+
+ # input used when SSP0 is connected
+ cset "name='modem_in Gain 0 Switch' on"
+ cset "name='modem_in Gain 0 Volume' 0"
+
+ cset "name='pcm1_out mix 0 codec_in0 Switch' on"
+ cset "name='pcm1_out mix 0 modem_in Switch' on"
+ cset "name='pcm1_out mix 0 codec_in1 Switch' off"
+ cset "name='pcm1_out mix 0 media_loop1_in Switch' off"
+ cset "name='pcm1_out mix 0 media_loop2_in Switch' off"
+ cset "name='pcm1_out mix 0 pcm0_in Switch' off"
+ cset "name='pcm1_out mix 0 pcm1_in Switch' off"
+ cset "name='pcm1_out mix 0 sprot_loop_in Switch' off"
+
+ cset "name='pcm1_out Gain 0 Switch' on"
+ cset "name='pcm1_out Gain 0 Volume' 0"
+
+ # disable codec_out1
+ cset "name='codec_out1 mix 0 codec_in0 Switch' off"
+ cset "name='codec_out1 mix 0 codec_in1 Switch' off"
+ cset "name='codec_out1 mix 0 media_loop1_in Switch' off"
+ cset "name='codec_out1 mix 0 media_loop2_in Switch' off"
+ cset "name='codec_out1 mix 0 pcm0_in Switch' off"
+ cset "name='codec_out1 mix 0 pcm1_in Switch' off"
+ cset "name='codec_out1 mix 0 sprot_loop_in Switch' off"
+ cset "name='codec_out1 Gain 0 Switch' off"
+ cset "name='codec_out1 Gain 0 Volume' 0%"
+
+ # disable codec_in1
+ cset "name='codec_in1 Gain 0 Switch' off"
+ cset "name='codec_in1 Gain 0 Volume' 0%"
+
+ # disable all loops
+ cset "name='media_loop1_out mix 0 codec_in0 Switch' off"
+ cset "name='media_loop1_out mix 0 codec_in1 Switch' off"
+ cset "name='media_loop1_out mix 0 media_loop1_in Switch' off"
+ cset "name='media_loop1_out mix 0 media_loop2_in Switch' off"
+ cset "name='media_loop1_out mix 0 pcm0_in Switch' off"
+ cset "name='media_loop1_out mix 0 pcm1_in Switch' off"
+ cset "name='media_loop1_out mix 0 sprot_loop_in Switch' off"
+
+ cset "name='media_loop2_out mix 0 codec_in0 Switch' off"
+ cset "name='media_loop2_out mix 0 codec_in1 Switch' off"
+ cset "name='media_loop2_out mix 0 media_loop1_in Switch' off"
+ cset "name='media_loop2_out mix 0 media_loop2_in Switch' off"
+ cset "name='media_loop2_out mix 0 pcm0_in Switch' off"
+ cset "name='media_loop2_out mix 0 pcm1_in Switch' off"
+ cset "name='media_loop2_out mix 0 sprot_loop_in Switch' off"
+
+ cset "name='sprot_loop_out mix 0 codec_in0 Switch' off"
+ cset "name='sprot_loop_out mix 0 codec_in1 Switch' off"
+ cset "name='sprot_loop_out mix 0 media_loop1_in Switch' off"
+ cset "name='sprot_loop_out mix 0 media_loop2_in Switch' off"
+ cset "name='sprot_loop_out mix 0 pcm0_in Switch' off"
+ cset "name='sprot_loop_out mix 0 pcm1_in Switch' off"
+ cset "name='sprot_loop_out mix 0 sprot_loop_in Switch' off"
+
+ # Output Configuration
+ cset "name='DAC1 L Mux' IF1 DAC"
+ cset "name='DAC1 R Mux' IF1 DAC"
+ cset "name='DAC1 MIXL DAC1 Switch' 1"
+ cset "name='DAC1 MIXR DAC1 Switch' 1"
+ cset "name='Stereo DAC MIXL DAC L1 Switch' 1"
+ cset "name='Stereo DAC MIXR DAC R1 Switch' 1"
+
+ cset "name='DAC L2 Mux' IF2 DAC"
+ cset "name='DAC R2 Mux' IF2 DAC"
+ cset "name='Mono DAC MIXL DAC L2 Switch' on"
+ cset "name='Mono DAC MIXR DAC R2 Switch' on"
+ cset "name='DAC2 Playback Switch' on"
+
+ cset "name='HPOVOL MIXL DAC1 Switch' on"
+ cset "name='HPOVOL MIXR DAC1 Switch' on"
+ cset "name='HPOVOL MIXL DAC2 Switch' on"
+ cset "name='HPOVOL MIXR DAC2 Switch' on"
+ cset "name='HPO MIX HPVOL Switch' on"
+ cset "name='HPOVOL L Switch' on"
+ cset "name='HPOVOL R Switch' on"
+
+ cset "name='SPK MIXL DAC L1 Switch' on"
+ cset "name='SPK MIXR DAC R1 Switch' on"
+ cset "name='SPK MIXL DAC L2 Switch' on"
+ cset "name='SPK MIXR DAC R2 Switch' on"
+ cset "name='SPOL MIX SPKVOL L Switch' on"
+ cset "name='SPOR MIX SPKVOL R Switch' on"
+ cset "name='SPKVOL L Switch' on"
+ cset "name='SPKVOL R Switch' on"
+
+ # Input Configuration
+ cset "name='Stereo1 DMIC Mux' 0"
+ cset "name='Stereo1 ADC1 Mux' 1"
+ cset "name='Stereo1 ADC2 Mux' 1"
+ cset "name='ADC Capture Switch' on"
+ # 55/63
+ cset "name='ADC Capture Volume' 55"
+ # set ADC Boost to 0/3, higher vals cause a lot of white noise
+ cset "name='ADC Boost Capture Volume' 0"
+ # 55/63
+ cset "name='Mono ADC Capture Volume' 55"
+ # 0/3
+ cset "name='Mono ADC Boost Capture Volume' 0"
+ # 27/31
+ cset "name='IN Capture Volume' 27"
+ cset "name='I2S2 Func Switch' on"
+ # 3/12 the headphone mic tends to be quite loud
+ cset "name='IN1 Boost' 3"
+ # 8/8 the internal analog mic tends to be quite soft
+ cset "name='IN2 Boost' 8"
+ ]
+
+ DisableSequence [
+ cdev "hw:chtrt5645"
+
+ # Disable audio output path
+ cset "name='codec_out1 mix 0 pcm0_in Switch' off"
+ cset "name='media0_out mix 0 media1_in Switch' off"
+
+ cset "name='media1_in Gain 0 Switch' off"
+ cset "name='pcm0_in Gain 0 Switch' off"
+ cset "name='codec_out1 Gain 0 Switch' off"
+
+ # Disable audio input path
+ cset "name='pcm1_out mix 0 media_loop2_in Switch' off"
+ cset "name='media_loop2_out mix 0 codec_in0 Switch' off"
+
+ cset "name='media_loop2_out Gain 0 Switch' off"
+ cset "name='pcm1_out Gain 0 Switch' off"
+ cset "name='codec_in0 Gain 0 Switch' off"
+ ]
+}
+
+SectionDevice."Speaker" {
+ Comment "Speaker"
+
+ Value {
+ PlaybackChannels "2"
+ }
+
+ ConflictingDevice [
+ "Headphones"
+ ]
+
+ EnableSequence [
+ cdev "hw:chtrt5645"
+
+ # Monospeaker: Mix right to left
+ cset "name='Stereo DAC MIXL DAC R1 Switch' 1"
+ cset "name='Stereo DAC MIXR DAC R1 Switch' 0"
+
+ cset "name='Headphone Switch' off"
+ cset "name='Headphone Channel Switch' off"
+
+ cset "name='Ext Spk Switch' on"
+ cset "name='Speaker Channel Switch' on"
+ cset "name='Speaker Playback Volume' 31"
+ ]
+
+ DisableSequence [
+ cdev "hw:chtrt5645"
+
+ cset "name='Ext Spk Switch' off"
+ cset "name='Speaker Channel Switch' off"
+ ]
+}
+
+SectionDevice."Headphones" {
+ Comment "Headphones"
+
+ Value {
+ PlaybackChannels "2"
+ JackControl "Headphone Jack"
+ JackHWMute "Speaker"
+ }
+
+ ConflictingDevice [
+ "Speaker"
+ ]
+
+ EnableSequence [
+ cdev "hw:chtrt5645"
+
+ # Undo monospeaker mixing
+ cset "name='Stereo DAC MIXL DAC R1 Switch' 0"
+ cset "name='Stereo DAC MIXR DAC R1 Switch' 1"
+
+ cset "name='Ext Spk Switch' off"
+ cset "name='Speaker Channel Switch' off"
+
+ cset "name='Headphone Switch' on"
+ cset "name='Headphone Channel Switch' on"
+ # 25/39 higher values cause crackling on some boards
+ cset "name='Headphone Playback Volume' 25"
+ ]
+
+ DisableSequence [
+ cdev "hw:chtrt5645"
+
+ cset "name='Headphone Switch' off"
+ cset "name='Headphone Channel Switch' off"
+ ]
+}
+
+SectionDevice."Mic".0 {
+ Comment "Internal Analog Microphone"
+
+ Value {
+ CaptureChannels "2"
+ CapturePriority "150"
+ }
+
+ EnableSequence [
+ cdev "hw:chtrt5645"
+
+ cset "name='Int Analog Mic Switch' on"
+
+ cset "name='Sto1 ADC MIXL ADC1 Switch' on"
+ cset "name='Sto1 ADC MIXR ADC1 Switch' on"
+ cset "name='Sto1 ADC MIXL ADC2 Switch' off"
+ cset "name='Sto1 ADC MIXR ADC2 Switch' off"
+
+ cset "name='Mono ADC MIXL ADC1 Switch' on"
+ cset "name='Mono ADC MIXR ADC1 Switch' on"
+ cset "name='Mono ADC MIXL ADC2 Switch' off"
+ cset "name='Mono ADC MIXR ADC2 Switch' off"
+
+ cset "name='RECMIXL BST2 Switch' on"
+ cset "name='RECMIXR BST2 Switch' on"
+
+ ]
+
+ DisableSequence [
+ cdev "hw:chtrt5645"
+
+ cset "name='Sto1 ADC MIXL ADC1 Switch' off"
+ cset "name='Sto1 ADC MIXR ADC1 Switch' off"
+ cset "name='Mono ADC MIXL ADC1 Switch' off"
+ cset "name='Mono ADC MIXR ADC1 Switch' off"
+
+ cset "name='RECMIXL BST2 Switch' off"
+ cset "name='RECMIXR BST2 Switch' off"
+
+ cset "name='Int Analog Mic Switch' off"
+ ]
+}
+
+
+SectionDevice."HSMic".0 {
+ Comment "Headset Microphone"
+
+ Value {
+ CaptureChannels "2"
+ JackControl "Headset Mic Jack"
+ JackHWMute "Mic"
+ }
+
+ EnableSequence [
+ cdev "hw:chtrt5645"
+
+ cset "name='Headset Mic Switch' on"
+
+ cset "name='Sto1 ADC MIXL ADC1 Switch' on"
+ cset "name='Sto1 ADC MIXR ADC1 Switch' on"
+ cset "name='Sto1 ADC MIXL ADC2 Switch' off"
+ cset "name='Sto1 ADC MIXR ADC2 Switch' off"
+
+ cset "name='Mono ADC MIXL ADC1 Switch' on"
+ cset "name='Mono ADC MIXR ADC1 Switch' on"
+ cset "name='Mono ADC MIXL ADC2 Switch' off"
+ cset "name='Mono ADC MIXR ADC2 Switch' off"
+
+ cset "name='RECMIXL BST1 Switch' on"
+ cset "name='RECMIXR BST1 Switch' on"
+
+ ]
+
+ DisableSequence [
+ cdev "hw:chtrt5645"
+
+ cset "name='Headset Mic Switch' off"
+
+ cset "name='RECMIXL BST1 Switch' off"
+ cset "name='RECMIXR BST1 Switch' off"
+ cset "name='Sto1 ADC MIXL ADC1 Switch' off"
+ cset "name='Sto1 ADC MIXR ADC1 Switch' off"
+ cset "name='Mono ADC MIXL ADC1 Switch' on"
+ cset "name='Mono ADC MIXR ADC1 Switch' on"
+
+ ]
+}
diff --git a/src/conf/ucm/chtrt5645-mono-speaker-analog-mic/Makefile.am b/src/conf/ucm/chtrt5645-mono-speaker-analog-mic/Makefile.am
new file mode 100644
index 000000000000..4c4d7cf4df85
--- /dev/null
+++ b/src/conf/ucm/chtrt5645-mono-speaker-analog-mic/Makefile.am
@@ -0,0 +1,4 @@
+alsaconfigdir = @ALSA_CONFIG_DIR@
+ucmdir = $(alsaconfigdir)/ucm/chtrt5645-mono-speaker-analog-mic
+ucm_DATA = chtrt5645-mono-speaker-analog-mic.conf HiFi.conf
+EXTRA_DIST = $(ucm_DATA)
diff --git a/src/conf/ucm/chtrt5645-mono-speaker-analog-mic/chtrt5645-mono-speaker-analog-mic.conf b/src/conf/ucm/chtrt5645-mono-speaker-analog-mic/chtrt5645-mono-speaker-analog-mic.conf
new file mode 100644
index 000000000000..b1a5206e24b1
--- /dev/null
+++ b/src/conf/ucm/chtrt5645-mono-speaker-analog-mic/chtrt5645-mono-speaker-analog-mic.conf
@@ -0,0 +1,5 @@
+Comment "Intel SoC Audio Device"
+SectionUseCase."HiFi" {
+ File "../chtrt5645-mono-speaker-analog-mic/HiFi.conf"
+ Comment "Default"
+}
diff --git a/src/conf/ucm/gpd-win-pocket-rt5645/Makefile.am b/src/conf/ucm/gpd-win-pocket-rt5645/Makefile.am
new file mode 100644
index 000000000000..62440926057b
--- /dev/null
+++ b/src/conf/ucm/gpd-win-pocket-rt5645/Makefile.am
@@ -0,0 +1,4 @@
+alsaconfigdir = @ALSA_CONFIG_DIR@
+ucmdir = $(alsaconfigdir)/ucm/gpd-win-pocket-rt5645
+ucm_DATA = gpd-win-pocket-rt5645.conf
+EXTRA_DIST = $(ucm_DATA)
diff --git a/src/conf/ucm/gpd-win-pocket-rt5645/gpd-win-pocket-rt5645.conf b/src/conf/ucm/gpd-win-pocket-rt5645/gpd-win-pocket-rt5645.conf
new file mode 120000
index 000000000000..1b1d47540b73
--- /dev/null
+++ b/src/conf/ucm/gpd-win-pocket-rt5645/gpd-win-pocket-rt5645.conf
@@ -0,0 +1 @@
+../chtrt5645-mono-speaker-analog-mic/chtrt5645-mono-speaker-analog-mic.conf
\ No newline at end of file
--
2.15.1

View File

@ -0,0 +1,417 @@
From 6e555781259281e31f8b5dc518a317511d67bbd8 Mon Sep 17 00:00:00 2001
From: Takashi Iwai <tiwai@suse.de>
Date: Wed, 17 Jan 2018 15:57:20 +0100
Subject: [PATCH] pcm: Return the consistent error code for unexpected PCM
states
Some PCM functions have the sanity check of the expected PCM states,
and most of them return -EBADFD if the current state doesn't match.
This is bad for some programs like aplay that expect the function
returning a proper code corresponding to the state, e.g. -ESTRPIPE for
the suspend.
This patch is an attempt to address such inconsistencies. The sanity
checker bad_pcm_state() now returns the error code instead of bool, so
that the caller can pass the returned code as is. And it calls a new
helper, pcm_state_to_error(), for obtaining the error code to certain
known PCM error state.
While we're at it, use the new pcm_state_to_error() for simplifying
the existing code to retrieve the error code, too.
Tested-by: Mirza Krak <mirza.krak@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
src/pcm/pcm.c | 170 +++++++++++++++++++++++++++++++++-------------------------
1 file changed, 98 insertions(+), 72 deletions(-)
diff --git a/src/pcm/pcm.c b/src/pcm/pcm.c
index e9ebf383c31b..69d7d66500ea 100644
--- a/src/pcm/pcm.c
+++ b/src/pcm/pcm.c
@@ -657,6 +657,21 @@ playback devices.
#include "pcm_local.h"
#ifndef DOC_HIDDEN
+/* return specific error codes for known bad PCM states */
+static int pcm_state_to_error(snd_pcm_state_t state)
+{
+ switch (state) {
+ case SND_PCM_STATE_XRUN:
+ return -EPIPE;
+ case SND_PCM_STATE_SUSPENDED:
+ return -ESTRPIPE;
+ case SND_PCM_STATE_DISCONNECTED:
+ return -ENODEV;
+ default:
+ return 0;
+ }
+}
+
#define P_STATE(x) (1U << SND_PCM_STATE_ ## x)
#define P_STATE_RUNNABLE (P_STATE(PREPARED) | \
P_STATE(RUNNING) | \
@@ -667,9 +682,18 @@ playback devices.
/* check whether the PCM is in the unexpected state */
static int bad_pcm_state(snd_pcm_t *pcm, unsigned int supported_states)
{
+ snd_pcm_state_t state;
+ int err;
+
if (pcm->own_state_check)
return 0; /* don't care, the plugin checks by itself */
- return !(supported_states & (1U << snd_pcm_state(pcm)));
+ state = snd_pcm_state(pcm);
+ if (supported_states & (1U << state))
+ return 0; /* OK */
+ err = pcm_state_to_error(state);
+ if (err < 0)
+ return err;
+ return -EBADFD;
}
#endif
@@ -1143,8 +1167,9 @@ int snd_pcm_prepare(snd_pcm_t *pcm)
SNDMSG("PCM not set up");
return -EIO;
}
- if (bad_pcm_state(pcm, ~P_STATE(DISCONNECTED)))
- return -EBADFD;
+ err = bad_pcm_state(pcm, ~P_STATE(DISCONNECTED));
+ if (err < 0)
+ return err;
snd_pcm_lock(pcm);
err = pcm->fast_ops->prepare(pcm->fast_op_arg);
snd_pcm_unlock(pcm);
@@ -1191,8 +1216,9 @@ int snd_pcm_start(snd_pcm_t *pcm)
SNDMSG("PCM not set up");
return -EIO;
}
- if (bad_pcm_state(pcm, P_STATE(PREPARED)))
- return -EBADFD;
+ err = bad_pcm_state(pcm, P_STATE(PREPARED));
+ if (err < 0)
+ return err;
snd_pcm_lock(pcm);
err = __snd_pcm_start(pcm);
snd_pcm_unlock(pcm);
@@ -1221,9 +1247,10 @@ int snd_pcm_drop(snd_pcm_t *pcm)
SNDMSG("PCM not set up");
return -EIO;
}
- if (bad_pcm_state(pcm, P_STATE_RUNNABLE | P_STATE(SETUP) |
- P_STATE(SUSPENDED)))
- return -EBADFD;
+ err = bad_pcm_state(pcm, P_STATE_RUNNABLE | P_STATE(SETUP) |
+ P_STATE(SUSPENDED));
+ if (err < 0)
+ return err;
snd_pcm_lock(pcm);
err = pcm->fast_ops->drop(pcm->fast_op_arg);
snd_pcm_unlock(pcm);
@@ -1247,13 +1274,16 @@ int snd_pcm_drop(snd_pcm_t *pcm)
*/
int snd_pcm_drain(snd_pcm_t *pcm)
{
+ int err;
+
assert(pcm);
if (CHECK_SANITY(! pcm->setup)) {
SNDMSG("PCM not set up");
return -EIO;
}
- if (bad_pcm_state(pcm, P_STATE_RUNNABLE))
- return -EBADFD;
+ err = bad_pcm_state(pcm, P_STATE_RUNNABLE);
+ if (err < 0)
+ return err;
/* lock handled in the callback */
return pcm->fast_ops->drain(pcm->fast_op_arg);
}
@@ -1279,8 +1309,9 @@ int snd_pcm_pause(snd_pcm_t *pcm, int enable)
SNDMSG("PCM not set up");
return -EIO;
}
- if (bad_pcm_state(pcm, P_STATE_RUNNABLE))
- return -EBADFD;
+ err = bad_pcm_state(pcm, P_STATE_RUNNABLE);
+ if (err < 0)
+ return err;
snd_pcm_lock(pcm);
err = pcm->fast_ops->pause(pcm->fast_op_arg, enable);
snd_pcm_unlock(pcm);
@@ -1301,14 +1332,16 @@ int snd_pcm_pause(snd_pcm_t *pcm, int enable)
snd_pcm_sframes_t snd_pcm_rewindable(snd_pcm_t *pcm)
{
snd_pcm_sframes_t result;
+ int err;
assert(pcm);
if (CHECK_SANITY(! pcm->setup)) {
SNDMSG("PCM not set up");
return -EIO;
}
- if (bad_pcm_state(pcm, P_STATE_RUNNABLE))
- return -EBADFD;
+ err = bad_pcm_state(pcm, P_STATE_RUNNABLE);
+ if (err < 0)
+ return err;
snd_pcm_lock(pcm);
result = pcm->fast_ops->rewindable(pcm->fast_op_arg);
snd_pcm_unlock(pcm);
@@ -1327,6 +1360,7 @@ snd_pcm_sframes_t snd_pcm_rewindable(snd_pcm_t *pcm)
snd_pcm_sframes_t snd_pcm_rewind(snd_pcm_t *pcm, snd_pcm_uframes_t frames)
{
snd_pcm_sframes_t result;
+ int err;
assert(pcm);
if (CHECK_SANITY(! pcm->setup)) {
@@ -1335,8 +1369,9 @@ snd_pcm_sframes_t snd_pcm_rewind(snd_pcm_t *pcm, snd_pcm_uframes_t frames)
}
if (frames == 0)
return 0;
- if (bad_pcm_state(pcm, P_STATE_RUNNABLE))
- return -EBADFD;
+ err = bad_pcm_state(pcm, P_STATE_RUNNABLE);
+ if (err < 0)
+ return err;
snd_pcm_lock(pcm);
result = pcm->fast_ops->rewind(pcm->fast_op_arg, frames);
snd_pcm_unlock(pcm);
@@ -1357,14 +1392,16 @@ snd_pcm_sframes_t snd_pcm_rewind(snd_pcm_t *pcm, snd_pcm_uframes_t frames)
snd_pcm_sframes_t snd_pcm_forwardable(snd_pcm_t *pcm)
{
snd_pcm_sframes_t result;
+ int err;
assert(pcm);
if (CHECK_SANITY(! pcm->setup)) {
SNDMSG("PCM not set up");
return -EIO;
}
- if (bad_pcm_state(pcm, P_STATE_RUNNABLE))
- return -EBADFD;
+ err = bad_pcm_state(pcm, P_STATE_RUNNABLE);
+ if (err < 0)
+ return err;
snd_pcm_lock(pcm);
result = pcm->fast_ops->forwardable(pcm->fast_op_arg);
snd_pcm_unlock(pcm);
@@ -1387,6 +1424,7 @@ snd_pcm_sframes_t snd_pcm_forward(snd_pcm_t *pcm, snd_pcm_uframes_t frames)
#endif
{
snd_pcm_sframes_t result;
+ int err;
assert(pcm);
if (CHECK_SANITY(! pcm->setup)) {
@@ -1395,8 +1433,9 @@ snd_pcm_sframes_t snd_pcm_forward(snd_pcm_t *pcm, snd_pcm_uframes_t frames)
}
if (frames == 0)
return 0;
- if (bad_pcm_state(pcm, P_STATE_RUNNABLE))
- return -EBADFD;
+ err = bad_pcm_state(pcm, P_STATE_RUNNABLE);
+ if (err < 0)
+ return err;
snd_pcm_lock(pcm);
result = pcm->fast_ops->forward(pcm->fast_op_arg, frames);
snd_pcm_unlock(pcm);
@@ -1425,6 +1464,8 @@ use_default_symbol_version(__snd_pcm_forward, snd_pcm_forward, ALSA_0.9.0rc8);
*/
snd_pcm_sframes_t snd_pcm_writei(snd_pcm_t *pcm, const void *buffer, snd_pcm_uframes_t size)
{
+ int err;
+
assert(pcm);
assert(size == 0 || buffer);
if (CHECK_SANITY(! pcm->setup)) {
@@ -1435,8 +1476,9 @@ snd_pcm_sframes_t snd_pcm_writei(snd_pcm_t *pcm, const void *buffer, snd_pcm_ufr
SNDMSG("invalid access type %s", snd_pcm_access_name(pcm->access));
return -EINVAL;
}
- if (bad_pcm_state(pcm, P_STATE_RUNNABLE))
- return -EBADFD;
+ err = bad_pcm_state(pcm, P_STATE_RUNNABLE);
+ if (err < 0)
+ return err;
return _snd_pcm_writei(pcm, buffer, size);
}
@@ -1461,6 +1503,8 @@ snd_pcm_sframes_t snd_pcm_writei(snd_pcm_t *pcm, const void *buffer, snd_pcm_ufr
*/
snd_pcm_sframes_t snd_pcm_writen(snd_pcm_t *pcm, void **bufs, snd_pcm_uframes_t size)
{
+ int err;
+
assert(pcm);
assert(size == 0 || bufs);
if (CHECK_SANITY(! pcm->setup)) {
@@ -1471,8 +1515,9 @@ snd_pcm_sframes_t snd_pcm_writen(snd_pcm_t *pcm, void **bufs, snd_pcm_uframes_t
SNDMSG("invalid access type %s", snd_pcm_access_name(pcm->access));
return -EINVAL;
}
- if (bad_pcm_state(pcm, P_STATE_RUNNABLE))
- return -EBADFD;
+ err = bad_pcm_state(pcm, P_STATE_RUNNABLE);
+ if (err < 0)
+ return err;
return _snd_pcm_writen(pcm, bufs, size);
}
@@ -1497,6 +1542,8 @@ snd_pcm_sframes_t snd_pcm_writen(snd_pcm_t *pcm, void **bufs, snd_pcm_uframes_t
*/
snd_pcm_sframes_t snd_pcm_readi(snd_pcm_t *pcm, void *buffer, snd_pcm_uframes_t size)
{
+ int err;
+
assert(pcm);
assert(size == 0 || buffer);
if (CHECK_SANITY(! pcm->setup)) {
@@ -1507,8 +1554,9 @@ snd_pcm_sframes_t snd_pcm_readi(snd_pcm_t *pcm, void *buffer, snd_pcm_uframes_t
SNDMSG("invalid access type %s", snd_pcm_access_name(pcm->access));
return -EINVAL;
}
- if (bad_pcm_state(pcm, P_STATE_RUNNABLE))
- return -EBADFD;
+ err = bad_pcm_state(pcm, P_STATE_RUNNABLE);
+ if (err < 0)
+ return err;
return _snd_pcm_readi(pcm, buffer, size);
}
@@ -1533,6 +1581,8 @@ snd_pcm_sframes_t snd_pcm_readi(snd_pcm_t *pcm, void *buffer, snd_pcm_uframes_t
*/
snd_pcm_sframes_t snd_pcm_readn(snd_pcm_t *pcm, void **bufs, snd_pcm_uframes_t size)
{
+ int err;
+
assert(pcm);
assert(size == 0 || bufs);
if (CHECK_SANITY(! pcm->setup)) {
@@ -1543,8 +1593,9 @@ snd_pcm_sframes_t snd_pcm_readn(snd_pcm_t *pcm, void **bufs, snd_pcm_uframes_t s
SNDMSG("invalid access type %s", snd_pcm_access_name(pcm->access));
return -EINVAL;
}
- if (bad_pcm_state(pcm, P_STATE_RUNNABLE))
- return -EBADFD;
+ err = bad_pcm_state(pcm, P_STATE_RUNNABLE);
+ if (err < 0)
+ return err;
return _snd_pcm_readn(pcm, bufs, size);
}
@@ -2695,18 +2746,12 @@ int snd_pcm_wait(snd_pcm_t *pcm, int timeout)
/* locked version */
int __snd_pcm_wait_in_lock(snd_pcm_t *pcm, int timeout)
{
+ int err;
+
if (!snd_pcm_may_wait_for_avail_min(pcm, snd_pcm_mmap_avail(pcm))) {
/* check more precisely */
- switch (__snd_pcm_state(pcm)) {
- case SND_PCM_STATE_XRUN:
- return -EPIPE;
- case SND_PCM_STATE_SUSPENDED:
- return -ESTRPIPE;
- case SND_PCM_STATE_DISCONNECTED:
- return -ENODEV;
- default:
- return 1;
- }
+ err = pcm_state_to_error(__snd_pcm_state(pcm));
+ return err < 0 ? err : 1;
}
return snd_pcm_wait_nocheck(pcm, timeout);
}
@@ -2753,16 +2798,8 @@ int snd_pcm_wait_nocheck(snd_pcm_t *pcm, int timeout)
return err;
if (revents & (POLLERR | POLLNVAL)) {
/* check more precisely */
- switch (__snd_pcm_state(pcm)) {
- case SND_PCM_STATE_XRUN:
- return -EPIPE;
- case SND_PCM_STATE_SUSPENDED:
- return -ESTRPIPE;
- case SND_PCM_STATE_DISCONNECTED:
- return -ENODEV;
- default:
- return -EIO;
- }
+ err = pcm_state_to_error(__snd_pcm_state(pcm));
+ return err < 0 ? err : -EIO;
}
} while (!(revents & (POLLIN | POLLOUT)));
#if 0 /* very useful code to test poll related problems */
@@ -7010,8 +7047,9 @@ int snd_pcm_mmap_begin(snd_pcm_t *pcm,
{
int err;
- if (bad_pcm_state(pcm, P_STATE_RUNNABLE))
- return -EBADFD;
+ err = bad_pcm_state(pcm, P_STATE_RUNNABLE);
+ if (err < 0)
+ return err;
snd_pcm_lock(pcm);
err = __snd_pcm_mmap_begin(pcm, areas, offset, frames);
snd_pcm_unlock(pcm);
@@ -7106,9 +7144,11 @@ snd_pcm_sframes_t snd_pcm_mmap_commit(snd_pcm_t *pcm,
snd_pcm_uframes_t frames)
{
snd_pcm_sframes_t result;
+ int err;
- if (bad_pcm_state(pcm, P_STATE_RUNNABLE))
- return -EBADFD;
+ err = bad_pcm_state(pcm, P_STATE_RUNNABLE);
+ if (err < 0)
+ return err;
snd_pcm_lock(pcm);
result = __snd_pcm_mmap_commit(pcm, offset, frames);
snd_pcm_unlock(pcm);
@@ -7204,17 +7244,10 @@ snd_pcm_sframes_t snd_pcm_read_areas(snd_pcm_t *pcm, const snd_pcm_channel_area_
case SND_PCM_STATE_DRAINING:
case SND_PCM_STATE_PAUSED:
break;
- case SND_PCM_STATE_XRUN:
- err = -EPIPE;
- goto _end;
- case SND_PCM_STATE_SUSPENDED:
- err = -ESTRPIPE;
- goto _end;
- case SND_PCM_STATE_DISCONNECTED:
- err = -ENODEV;
- goto _end;
default:
- err = -EBADFD;
+ err = pcm_state_to_error(state);
+ if (!err)
+ err = -EBADFD;
goto _end;
}
avail = __snd_pcm_avail_update(pcm);
@@ -7280,17 +7313,10 @@ snd_pcm_sframes_t snd_pcm_write_areas(snd_pcm_t *pcm, const snd_pcm_channel_area
if (err < 0)
goto _end;
break;
- case SND_PCM_STATE_XRUN:
- err = -EPIPE;
- goto _end;
- case SND_PCM_STATE_SUSPENDED:
- err = -ESTRPIPE;
- goto _end;
- case SND_PCM_STATE_DISCONNECTED:
- err = -ENODEV;
- goto _end;
default:
- err = -EBADFD;
+ err = pcm_state_to_error(state);
+ if (!err)
+ err = -EBADFD;
goto _end;
}
avail = __snd_pcm_avail_update(pcm);
--
2.15.1

View File

@ -1,3 +1,12 @@
-------------------------------------------------------------------
Thu Jan 18 12:26:08 CET 2018 - tiwai@suse.de
- Upstream fixes:
* Add the new ucm for Cherrytrail devices (bsc#1068546):
0005-conf-ucm-Add-chtrt5645-mono-speaker-analog-mic-confi.patch
* Fix for error code from PCM API functions at unexpected states:
0006-pcm-Return-the-consistent-error-code-for-unexpected-.patch
-------------------------------------------------------------------
Tue Dec 19 08:12:02 CET 2017 - tiwai@suse.de

View File

@ -1,7 +1,7 @@
#
# spec file for package alsa
#
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -54,6 +54,8 @@ Patch1: 0001-pcm-route-Fix-use_getput-flag-computation-for-3-byte.patch
Patch2: 0002-conf-ucm-Rearrange-Makefile.am.patch
Patch3: 0003-conf-ucm-Add-dual-HD-audio-codecs-config-for-Lenovo.patch
Patch4: 0004-conf-ucm-Add-Gigabyte-mobo-UCM-profile-with-dual-HD-.patch
Patch5: 0005-conf-ucm-Add-chtrt5645-mono-speaker-analog-mic-confi.patch
Patch6: 0006-pcm-Return-the-consistent-error-code-for-unexpected-.patch
# rest suse fixes
Source101: chtcx2072x.conf
Source102: chtcx2072x-HiFi.conf
@ -123,6 +125,8 @@ Architecture.
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
%build
export AUTOMAKE_JOBS="%{?_smp_mflags}"