All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH alsa-lib 1/5] Fix invalid "Regex" Type in various Condition blocks
@ 2020-06-28 17:44 Hans de Goede
  2020-06-28 17:44 ` [PATCH alsa-lib 2/5] cht-bsw-rt5672: Add Lenovo Miix 2 10 specific configuration Hans de Goede
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Hans de Goede @ 2020-06-28 17:44 UTC (permalink / raw)
  To: Jaroslav Kysela, alsa-devel; +Cc: Hans de Goede

Regex is not a valid Condition type, using it leads to errors like these:

ALSA lib ucm_cond.c:300:(if_eval) unknown If.Condition.Type
ALSA lib main.c:983:(snd_use_case_mgr_open) error: failed to import cht-bsw-rt5672 use case configuration -22
alsaucm: error failed to open sound card cht-bsw-rt5672: Invalid argument

Replacing it with "RegexMatch" fixes this.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 ucm2/cht-bsw-rt5672/HiFi.conf         | 4 ++--
 ucm2/chtnau8824/HiFi.conf             | 2 +-
 ucm2/chtrt5645/HiFi.conf              | 6 +++---
 ucm2/sof-soundwire/sof-soundwire.conf | 4 ++--
 4 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/ucm2/cht-bsw-rt5672/HiFi.conf b/ucm2/cht-bsw-rt5672/HiFi.conf
index 394e45d..dc8ddd5 100644
--- a/ucm2/cht-bsw-rt5672/HiFi.conf
+++ b/ucm2/cht-bsw-rt5672/HiFi.conf
@@ -9,7 +9,7 @@ Define.HeadsetMic "yes"
 
 If.cfg-dmic1 {
 	Condition {
-		Type Regex
+		Type RegexMatch
 		String "${CardLongName}"
 		Regex "(SoMeThInK1)" # fixme!
 	}
@@ -21,7 +21,7 @@ If.cfg-dmic1 {
 
 If.cfg-dmic2 {
 	Condition {
-		Type Regex
+		Type RegexMatch
 		String "${CardLongName}"
 		Regex "(LENOVO.*ThinkPad8)"
 	}
diff --git a/ucm2/chtnau8824/HiFi.conf b/ucm2/chtnau8824/HiFi.conf
index 6b7624d..3ccd6b1 100644
--- a/ucm2/chtnau8824/HiFi.conf
+++ b/ucm2/chtnau8824/HiFi.conf
@@ -2,7 +2,7 @@ Define.Speaker "Speaker"
 
 If.cfg-mspk {
 	Condition {
-		Type Regex
+		Type RegexMatch
 		String "${CardLongName}"
 		Regex "(cube-i1_TF|PIPO-W2S)"
 	}
diff --git a/ucm2/chtrt5645/HiFi.conf b/ucm2/chtrt5645/HiFi.conf
index fb8636d..5d0e3bf 100644
--- a/ucm2/chtrt5645/HiFi.conf
+++ b/ucm2/chtrt5645/HiFi.conf
@@ -4,7 +4,7 @@ Define.DigitalMic ""
 
 If.cfg-dmic1 {
 	Condition {
-		Type Regex
+		Type RegexMatch
 		String "${CardLongName}"
 		Regex "(ASUSTeK.*T100HAN|ASUSTeK.*T101HA)"
 	}
@@ -16,7 +16,7 @@ If.cfg-dmic1 {
 
 If.cfg-dmic2 {
 	Condition {
-		Type Regex
+		Type RegexMatch
 		String "${CardLongName}"
 		Regex "(LENOVO.*LenovoMIIX320|MEDION.*Wingman)"
 	}
@@ -28,7 +28,7 @@ If.cfg-dmic2 {
 
 If.cfg-mspk {
 	Condition {
-		Type Regex
+		Type RegexMatch
 		String "${CardLongName}"
 		Regex "(gpd-win-pocket-rt5645|TECLAST-X80Pro)"
 	}
diff --git a/ucm2/sof-soundwire/sof-soundwire.conf b/ucm2/sof-soundwire/sof-soundwire.conf
index fe43d5f..2ba44be 100644
--- a/ucm2/sof-soundwire/sof-soundwire.conf
+++ b/ucm2/sof-soundwire/sof-soundwire.conf
@@ -38,7 +38,7 @@ DefineRegex {
 
 If.hs_init {
 	Condition {
-		Type Regex
+		Type RegexMatch
 		Regex "(rt5682|rt700|rt711)"
 		String "${var:HeadsetCodec1}"
 	}
@@ -47,7 +47,7 @@ If.hs_init {
 
 If.mic_init {
 	Condition {
-		Type Regex
+		Type RegexMatch
 		Regex "(rt715)"
 		String "${var:MicCodec1}"
 	}
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH alsa-lib 2/5] cht-bsw-rt5672: Add Lenovo Miix 2 10 specific configuration
  2020-06-28 17:44 [PATCH alsa-lib 1/5] Fix invalid "Regex" Type in various Condition blocks Hans de Goede
@ 2020-06-28 17:44 ` Hans de Goede
  2020-06-28 17:44 ` [PATCH alsa-lib 3/5] cht-bsw-rt5672: Add Lenovo ThinkPad " Hans de Goede
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Hans de Goede @ 2020-06-28 17:44 UTC (permalink / raw)
  To: Jaroslav Kysela, alsa-devel; +Cc: Hans de Goede

By default the cht-bsw-rt5672 config lets the user figure out if a device
has a Mono spaker or Stereo speakers and which DMIC input is used.

Since this is not very user-friendly we do regex matches on the DMI derived
longname to automaticaly select the right options (and to only advertise
those options).

This commit adds support for automatically selecting the right options
on the Lenovo Miix 2 10 tablet. Since this is the first device for which
we do longname matching using a DMIC on DMIC1, this also fixes a fixme :)

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 ucm2/cht-bsw-rt5672/HiFi.conf | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ucm2/cht-bsw-rt5672/HiFi.conf b/ucm2/cht-bsw-rt5672/HiFi.conf
index dc8ddd5..94de7db 100644
--- a/ucm2/cht-bsw-rt5672/HiFi.conf
+++ b/ucm2/cht-bsw-rt5672/HiFi.conf
@@ -11,7 +11,7 @@ If.cfg-dmic1 {
 	Condition {
 		Type RegexMatch
 		String "${CardLongName}"
-		Regex "(SoMeThInK1)" # fixme!
+		Regex "(LENOVO.*LenovoMiix210)"
 	}
 	True {
 		Define.MonoSpeaker ""
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH alsa-lib 3/5] cht-bsw-rt5672: Add Lenovo ThinkPad 10 specific configuration
  2020-06-28 17:44 [PATCH alsa-lib 1/5] Fix invalid "Regex" Type in various Condition blocks Hans de Goede
  2020-06-28 17:44 ` [PATCH alsa-lib 2/5] cht-bsw-rt5672: Add Lenovo Miix 2 10 specific configuration Hans de Goede
@ 2020-06-28 17:44 ` Hans de Goede
  2020-06-28 17:44 ` [PATCH alsa-lib 4/5] cht-bsw-rt5672: Boost ADC volume a bit Hans de Goede
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Hans de Goede @ 2020-06-28 17:44 UTC (permalink / raw)
  To: Jaroslav Kysela, alsa-devel; +Cc: Hans de Goede

The Lenovo ThinkPad 10 (first gen) has stereo speakers and the stereo
DMICs in the top-edge of the tablet are connected to DMIC1.

Add a RegexMatch for this, so that users do not have to select the right
settings manually.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 ucm2/cht-bsw-rt5672/HiFi.conf | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ucm2/cht-bsw-rt5672/HiFi.conf b/ucm2/cht-bsw-rt5672/HiFi.conf
index 94de7db..5e5f78f 100644
--- a/ucm2/cht-bsw-rt5672/HiFi.conf
+++ b/ucm2/cht-bsw-rt5672/HiFi.conf
@@ -11,7 +11,7 @@ If.cfg-dmic1 {
 	Condition {
 		Type RegexMatch
 		String "${CardLongName}"
-		Regex "(LENOVO.*LenovoMiix210)"
+		Regex "(LENOVO.*LenovoMiix210)|(LENOVO.*ThinkPad10)"
 	}
 	True {
 		Define.MonoSpeaker ""
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH alsa-lib 4/5] cht-bsw-rt5672: Boost ADC volume a bit
  2020-06-28 17:44 [PATCH alsa-lib 1/5] Fix invalid "Regex" Type in various Condition blocks Hans de Goede
  2020-06-28 17:44 ` [PATCH alsa-lib 2/5] cht-bsw-rt5672: Add Lenovo Miix 2 10 specific configuration Hans de Goede
  2020-06-28 17:44 ` [PATCH alsa-lib 3/5] cht-bsw-rt5672: Add Lenovo ThinkPad " Hans de Goede
@ 2020-06-28 17:44 ` Hans de Goede
  2020-06-28 17:44 ` [PATCH alsa-lib 5/5] chtrt5645: Restore stereo sound output when switching from MonoSpeaker to Headphones Hans de Goede
  2020-06-28 20:05 ` [PATCH alsa-lib 1/5] Fix invalid "Regex" Type in various Condition blocks Jaroslav Kysela
  4 siblings, 0 replies; 6+ messages in thread
From: Hans de Goede @ 2020-06-28 17:44 UTC (permalink / raw)
  To: Jaroslav Kysela, alsa-devel; +Cc: Hans de Goede

Both the DMICs and the headset mic are quite soft, even with the 20 dB
IN1 boost we already congfigure for the headset.

This commit sets the ADC Boost gain (range 0-3) to 1 = 12 dB, which makes
the volume a lot better. The next step of the ADC Boost gain setting is
24 dB which is a bit too much.

This has been tested with both the builtin DMIC and with a headset mic
on the following devices:

Lenovo Miix 2 10
Lenovo Thinkpad 8
Lenovo Thinkpad 10 (gen 1)

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 ucm2/codecs/rt5672/EnableSeq.conf | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/ucm2/codecs/rt5672/EnableSeq.conf b/ucm2/codecs/rt5672/EnableSeq.conf
index a19a982..ddfb1c7 100644
--- a/ucm2/codecs/rt5672/EnableSeq.conf
+++ b/ucm2/codecs/rt5672/EnableSeq.conf
@@ -30,6 +30,11 @@ EnableSequence [
 	cset "name='ADC Capture Volume' 47"
 	cset "name='ADC Capture Switch' on"
 
+	# Both the DMICs and the headset mic (even with the 20 dB boost below)
+	# are quite soft, set the ADC Boost gain (range 0-3) to 1 = 12 dB the
+	# next step is 24 dB which is a bit too much
+	cset "name='STO1 ADC Boost Gain Volume' 1"
+
 	# Headset mic is quite soft, boost it a bit, 1 = 20dB which is the first
 	# available boost step
 	cset "name='IN1 Boost Volume' 1"
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH alsa-lib 5/5] chtrt5645: Restore stereo sound output when switching from MonoSpeaker to Headphones
  2020-06-28 17:44 [PATCH alsa-lib 1/5] Fix invalid "Regex" Type in various Condition blocks Hans de Goede
                   ` (2 preceding siblings ...)
  2020-06-28 17:44 ` [PATCH alsa-lib 4/5] cht-bsw-rt5672: Boost ADC volume a bit Hans de Goede
@ 2020-06-28 17:44 ` Hans de Goede
  2020-06-28 20:05 ` [PATCH alsa-lib 1/5] Fix invalid "Regex" Type in various Condition blocks Jaroslav Kysela
  4 siblings, 0 replies; 6+ messages in thread
From: Hans de Goede @ 2020-06-28 17:44 UTC (permalink / raw)
  To: Jaroslav Kysela, alsa-devel; +Cc: Hans de Goede

Commit fe3b0bdc2f43 ("chtrt5645: merge all possible configurations to
HiFi.conf") missed the part of the removed HiFi-mono-speaker-analog-mic.conf
file which restores stereo mixing (instead of mixing left + right to the
left DAC mixer output) when switching from the mono speaker setup to the
headphones output.

This was causing both left and right channels to only be played on the
left ear of the headphones. This commit fixes this.

Fixes: fe3b0bdc2f43 ("chtrt5645: merge all possible configurations to HiFi.conf")
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 ucm2/chtrt5645/HiFi.conf | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/ucm2/chtrt5645/HiFi.conf b/ucm2/chtrt5645/HiFi.conf
index 5d0e3bf..10b0a1c 100644
--- a/ucm2/chtrt5645/HiFi.conf
+++ b/ucm2/chtrt5645/HiFi.conf
@@ -93,6 +93,11 @@ SectionDevice."Speaker" {
 				cset "name='Stereo DAC MIXL DAC R1 Switch' 1"
 				cset "name='Stereo DAC MIXR DAC R1 Switch' 0"
 			]
+			DisableSequence [
+				# Undo monospeaker mixing
+				cset "name='Stereo DAC MIXL DAC R1 Switch' 0"
+				cset "name='Stereo DAC MIXR DAC R1 Switch' 1"
+			]
 		}
 	}
 
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH alsa-lib 1/5] Fix invalid "Regex" Type in various Condition blocks
  2020-06-28 17:44 [PATCH alsa-lib 1/5] Fix invalid "Regex" Type in various Condition blocks Hans de Goede
                   ` (3 preceding siblings ...)
  2020-06-28 17:44 ` [PATCH alsa-lib 5/5] chtrt5645: Restore stereo sound output when switching from MonoSpeaker to Headphones Hans de Goede
@ 2020-06-28 20:05 ` Jaroslav Kysela
  4 siblings, 0 replies; 6+ messages in thread
From: Jaroslav Kysela @ 2020-06-28 20:05 UTC (permalink / raw)
  To: Hans de Goede, alsa-devel

Dne 28. 06. 20 v 19:44 Hans de Goede napsal(a):
> Regex is not a valid Condition type, using it leads to errors like these:
> 
> ALSA lib ucm_cond.c:300:(if_eval) unknown If.Condition.Type
> ALSA lib main.c:983:(snd_use_case_mgr_open) error: failed to import cht-bsw-rt5672 use case configuration -22
> alsaucm: error failed to open sound card cht-bsw-rt5672: Invalid argument
> 
> Replacing it with "RegexMatch" fixes this.

Thanks. All five patches were applied to the alsa-ucm repo and the 
ucm-validator was fixed, too.

				Jaroslav

-- 
Jaroslav Kysela <perex@perex.cz>
Linux Sound Maintainer; ALSA Project; Red Hat, Inc.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-06-28 20:06 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-28 17:44 [PATCH alsa-lib 1/5] Fix invalid "Regex" Type in various Condition blocks Hans de Goede
2020-06-28 17:44 ` [PATCH alsa-lib 2/5] cht-bsw-rt5672: Add Lenovo Miix 2 10 specific configuration Hans de Goede
2020-06-28 17:44 ` [PATCH alsa-lib 3/5] cht-bsw-rt5672: Add Lenovo ThinkPad " Hans de Goede
2020-06-28 17:44 ` [PATCH alsa-lib 4/5] cht-bsw-rt5672: Boost ADC volume a bit Hans de Goede
2020-06-28 17:44 ` [PATCH alsa-lib 5/5] chtrt5645: Restore stereo sound output when switching from MonoSpeaker to Headphones Hans de Goede
2020-06-28 20:05 ` [PATCH alsa-lib 1/5] Fix invalid "Regex" Type in various Condition blocks Jaroslav Kysela

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.