bytcr-rt5651: Fix dmic check in HiFi-Components.conf
PATCH 1/5 bytcr-rt5651: Fix dmic check in HiFi-Components.conf
The kernel sets cfg-mic:dmic not cfg-mic:dmic1 when a digital mic is used. The wrong check for cfg-mic:dmic1 causes there to be no "Mic" device at all, which causes the check for the ConflictingDevices section of the HeadSet (mic) device to fail like e.g. so:
[hans@localhost ~]$ alsaucm -c bytcr-rt5651 set _verb HiFi set _enadev Speaker
ALSA lib parser.c:1138:(verb_dev_list_add) error: unable to find device 'Mic'
ALSA lib parser.c:1433:(parse_verb_file) error: device management error in verb 'HiFi' ALSA lib main.c:962:(snd_use_case_mgr_open) error: failed to import bytcr-rt5651 use case configuration -2
alsaucm: error failed to open sound card bytcr-rt5651: No such file or directory
This commit fixes this.
--- ucm2/bytcr-rt5651/HiFi-Components.conf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
ucm2/bytcr-rt5651/HiFi-Components.conf +2 -2
@@ -34,11 +34,11 @@ If.headphones { } } -If.dmic1 { +If.dmic { Condition { Type String Haystack "${CardComponents}" - Needle "cfg-mic:dmic1" + Needle "cfg-mic:dmic" } True { <codecs/rt5651/DigitalMic.conf>
Signature · 1 line
2.26.0
PATCH 2/5 chtrt5645: Add ASUSTeKCOMPUTERINC.-T100HAN-1.0 symlink to chtrt5645-dmic1.conf
We already have a ASUSTeKCOMPUTERINC.-T100HAN-1.0-T100HAN symlink to chtrt5645-dmic1.conf, but since kernel commit 39870b0dec68 ("ASoC: DMI long name - avoid to add board name if matches with product name"), the kernel omits the (second) -T100HAN. So with newer kernels that no longer works.
Arguably this is a kernel regressions, but chances are we already have some configs depending on the new behavior, so lets fix this on the UCM2 side by adding a second symlink using the new long name.
--- ucm2/chtrt5645/ASUSTeKCOMPUTERINC.-T100HAN-1.0.conf | 1 + 1 file changed, 1 insertion(+) create mode 120000 ucm2/chtrt5645/ASUSTeKCOMPUTERINC.-T100HAN-1.0.conf
ucm2/chtrt5645/ASUSTeKCOMPUTERINC.-T100HAN-1.0.conf new file +1 -0
@@ -0,0 +1 @@ +chtrt5645-dmic1.conf
Signature · 1 line
2.26.0
Jaroslav Kysela
AppliedRe: [PATCH 2/5] chtrt5645: Add ASUSTeKCOMPUTERINC.-T100HAN-1.0 symlink to chtrt5645-dmic1.conf
Dne 05. 04. 20 v 20:34 Hans de Goede napsal(a):
Quoted 22 lines
We already have a ASUSTeKCOMPUTERINC.-T100HAN-1.0-T100HAN symlink to chtrt5645-dmic1.conf, but since kernel commit
39870b0dec68("ASoC: DMI long name - avoid to add board name if matches with product name"), the kernel omits the (second) -T100HAN. So with newer kernels that no longer works.Arguably this is a kernel regressions, but chances are we already have some configs depending on the new behavior, so lets fix this on the UCM2 side by adding a second symlink using the new long name.
Signed-off-by Hans de Goede <[email protected]>--- ucm2/chtrt5645/ASUSTeKCOMPUTERINC.-T100HAN-1.0.conf | 1 + 1 file changed, 1 insertion(+)create mode 120000
ucm2/chtrt5645/ASUSTeKCOMPUTERINC.-T100HAN-1.0.confucm2/chtrt5645/ASUSTeKCOMPUTERINC.-T100HAN-1.0.conf new file +0
-0
ucm2/chtrt5645/ASUSTeKCOMPUTERINC.-T100HAN-1.0.conf line 1
Quoted 2 lines
ucm2/chtrt5645/ASUSTeKCOMPUTERINC.-T100HAN-1.0.conf new file +1
-0@@ -0,0 +1 @@ +chtrt5645-dmic1.conf
Applied. Thanks.
Jaroslav
Signature · 2 lines
Jaroslav Kysela <[email protected]> Linux Sound Maintainer; ALSA Project; Red Hat, Inc.
PATCH 3/5 chtrt5645: Add MEDION-E1239TMD60568-0.1-Wingman.conf symlink to chtrt5645-dmic2.conf
In reply to Hans de GoedeThe Medion Akoya E1239T 2-in-1 uses a digital mic connected to the dmic2 pin, rather then the default analog mic on in2.
Add a long name symlink to chtrt5645-dmic2.conf for this, so that the right config is used.
--- ucm2/chtrt5645/MEDION-E1239TMD60568-0.1-Wingman.conf | 1 + 1 file changed, 1 insertion(+) create mode 120000 ucm2/chtrt5645/MEDION-E1239TMD60568-0.1-Wingman.conf
ucm2/chtrt5645/MEDION-E1239TMD60568-0.1-Wingman.conf new file +1 -0
@@ -0,0 +1 @@ +chtrt5645-dmic2.conf
Signature · 1 line
2.26.0
Jaroslav Kysela
AppliedRe: [PATCH 3/5] chtrt5645: Add MEDION-E1239TMD60568-0.1-Wingman.conf symlink to chtrt5645-dmic2.conf
Dne 05. 04. 20 v 20:34 Hans de Goede napsal(a):
Quoted 19 lines
The Medion Akoya E1239T 2-in-1 uses a digital mic connected to the dmic2 pin, rather then the default analog mic on in2.
Add a long name symlink to chtrt5645-dmic2.conf for this, so that the right config is used.
Signed-off-by Hans de Goede <[email protected]>--- ucm2/chtrt5645/MEDION-E1239TMD60568-0.1-Wingman.conf | 1 + 1 file changed, 1 insertion(+)create mode 120000
ucm2/chtrt5645/MEDION-E1239TMD60568-0.1-Wingman.confucm2/chtrt5645/MEDION-E1239TMD60568-0.1-Wingman.conf new file +0
-0
ucm2/chtrt5645/MEDION-E1239TMD60568-0.1-Wingman.conf line 1
Quoted 2 lines
ucm2/chtrt5645/MEDION-E1239TMD60568-0.1-Wingman.conf new file +1
-0@@ -0,0 +1 @@ +chtrt5645-dmic2.conf
Applied. Thanks.
Jaroslav
Signature · 2 lines
Jaroslav Kysela <[email protected]> Linux Sound Maintainer; ALSA Project; Red Hat, Inc.
PATCH 4/5 chtrt5645: Remove bogus JackHWMute settings
In reply to Hans de GoedeThere is no reason why the internal microphone or speakers cannot be used when a headset is plugged in.
The jack does not physically disconnect these, so the JackHWMute settings are wrong, remove them.
--- ucm2/chtrt5645/HiFi-dmic1.conf | 2 -- ucm2/chtrt5645/HiFi-dmic2.conf | 2 -- ucm2/chtrt5645/HiFi-mono-speaker-analog-mic.conf | 2 -- ucm2/chtrt5645/HiFi.conf | 2 -- 4 files changed, 8 deletions(-)
ucm2/chtrt5645/HiFi-dmic1.conf +0 -2
@@ -50,7 +50,6 @@ SectionDevice."Headphones" { PlaybackPriority 200 PlaybackPCM "hw:${CardId}" JackControl "Headphone Jack" - JackHWMute "Speaker" } ConflictingDevice [
@@ -96,7 +95,6 @@ SectionDevice."Headset" { CapturePriority 200 CapturePCM "hw:${CardId}" JackControl "Headset Mic Jack" - JackHWMute "Mic" } EnableSequence [
ucm2/chtrt5645/HiFi-dmic2.conf +0 -2
@@ -50,7 +50,6 @@ SectionDevice."Headphones" { PlaybackPriority 200 PlaybackPCM "hw:${CardId}" JackControl "Headphone Jack" - JackHWMute "Speaker" } ConflictingDevice [
@@ -98,7 +97,6 @@ SectionDevice."Headset" { CapturePriority 200 CapturePCM "hw:${CardId}" JackControl "Headset Mic Jack" - JackHWMute "Mic" } EnableSequence [
ucm2/chtrt5645/HiFi-mono-speaker-analog-mic.conf +0 -2
@@ -54,7 +54,6 @@ SectionDevice."Headphones" { PlaybackPriority 200 PlaybackPCM "hw:${CardId}" JackControl "Headphone Jack" - JackHWMute "Speaker" } ConflictingDevice [
@@ -84,7 +83,6 @@ SectionDevice."Headset" { CapturePriority 200 CapturePCM "hw:${CardId}" JackControl "Headset Mic Jack" - JackHWMute "Mic" } EnableSequence [
ucm2/chtrt5645/HiFi.conf +0 -2
@@ -50,7 +50,6 @@ SectionDevice."Headphones" { PlaybackPriority 200 PlaybackPCM "hw:${CardId}" JackControl "Headphone Jack" - JackHWMute "Speaker" } ConflictingDevice [
@@ -76,7 +75,6 @@ SectionDevice."Headset" { CapturePriority 200 CapturePCM "hw:${CardId}" JackControl "Headset Mic Jack" - JackHWMute "Mic" } EnableSequence [
Signature · 1 line
2.26.0
Re: [PATCH 4/5] chtrt5645: Remove bogus JackHWMute settings
Quoted 5 lines · Hans de Goede
There is no reason why the internal microphone or speakers cannot be used when a headset is plugged in.
The jack does not physically disconnect these, so the JackHWMute settings are wrong, remove them.
Are you sure about the internal mic and headset input not conflicting? IIRC they use the same path after the initial routing selector. I may be wrong but I'd be surprised if you can use both.
Now that I think of it further, in case the SSP0 is used an I2S link is configured, so you cannot have both streams in parallel. It may be possible to use headset and dmic in parallel with the 4 slot version but we also have 1 PCM capture only.
So overall it seems rather unlikely that we can support dmic + headset mic in parallel?
Quoted 89 lines
Signed-off-by Hans de Goede <[email protected]>--- ucm2/chtrt5645/HiFi-dmic1.conf | 2 -- ucm2/chtrt5645/HiFi-dmic2.conf | 2 -- ucm2/chtrt5645/HiFi-mono-speaker-analog-mic.conf | 2 -- ucm2/chtrt5645/HiFi.conf | 2 -- 4 files changed, 8 deletions(-)ucm2/chtrt5645/HiFi-dmic1.conf +0
-2@@ -50,7 +50,6 @@ SectionDevice."Headphones" { PlaybackPriority 200 PlaybackPCM "hw:${CardId}" JackControl "Headphone Jack" - JackHWMute "Speaker" } ConflictingDevice [@@ -96,7 +95,6 @@ SectionDevice."Headset" { CapturePriority 200 CapturePCM "hw:${CardId}" JackControl "Headset Mic Jack" - JackHWMute "Mic" } EnableSequence [ucm2/chtrt5645/HiFi-dmic2.conf +0
-2@@ -50,7 +50,6 @@ SectionDevice."Headphones" { PlaybackPriority 200 PlaybackPCM "hw:${CardId}" JackControl "Headphone Jack" - JackHWMute "Speaker" } ConflictingDevice [@@ -98,7 +97,6 @@ SectionDevice."Headset" { CapturePriority 200 CapturePCM "hw:${CardId}" JackControl "Headset Mic Jack" - JackHWMute "Mic" } EnableSequence [ucm2/chtrt5645/HiFi-mono-speaker-analog-mic.conf +0
-2@@ -54,7 +54,6 @@ SectionDevice."Headphones" { PlaybackPriority 200 PlaybackPCM "hw:${CardId}" JackControl "Headphone Jack" - JackHWMute "Speaker" } ConflictingDevice [@@ -84,7 +83,6 @@ SectionDevice."Headset" { CapturePriority 200 CapturePCM "hw:${CardId}" JackControl "Headset Mic Jack" - JackHWMute "Mic" } EnableSequence [ucm2/chtrt5645/HiFi.conf +0
-2@@ -50,7 +50,6 @@ SectionDevice."Headphones" { PlaybackPriority 200 PlaybackPCM "hw:${CardId}" JackControl "Headphone Jack" - JackHWMute "Speaker" } ConflictingDevice [@@ -76,7 +75,6 @@ SectionDevice."Headset" { CapturePriority 200 CapturePCM "hw:${CardId}" JackControl "Headset Mic Jack" - JackHWMute "Mic" } EnableSequence [
Re: [PATCH 4/5] chtrt5645: Remove bogus JackHWMute settings
Hi,
Quoted 6 lines · Pierre-Louis Bossart
Quoted 3 lines · Hans de Goede
There is no reason why the internal microphone or speakers cannot be used when a headset is plugged in.
Quoted 8 lines
Quoted 2 lines
The jack does not physically disconnect these, so the JackHWMute settings are wrong, remove them.
Are you sure about the internal mic and headset input not conflicting? IIRC they use the same path after the initial routing selector. I may be wrong but I'd be surprised if you can use both.
Now that I think of it further, in case the SSP0 is used an I2S link is configured, so you cannot have both streams in parallel. It may be possible to use headset and dmic in parallel with the 4 slot version but we also have 1 PCM capture only.
So overall it seems rather unlikely that we can support dmic + headset mic in parallel?
Right that is what the ConflictingDevices sections are for.
Removing the JackHWMute does not allow using both add the same time, it merely allows overriding which of the 2 to use (if the headset mic is detected by the jack, the JackControl setting is kept).
So lets say the internal mic is crappy, but the user prefers to have their ears free, then they can use a headset around there neck, using just the headset-mic and select speakers as output even though a jack is inserted.
Note pulseaudio will still automatically switch to the headphones / headsetmic when plugged in, this merely allows overriding that choice manually.
Jacks which actually physically disable (or re-route) signals are quite rare now a days so having a JackHWMute in the UCM conf is often wrong. After this patch only a few cases are left:
[hans@x1 alsa-ucm-conf]$ ack -l JackHWMute ucm2ucm2/HDA-Intel/HiFi-dual.confucm2/chtrt5650/HiFi.confucm2/hda-dsp/HiFi.confucm2/codecs/es8316/HeadPhones.confucm2/sof-bdw-rt5677/HiFi.confucm2/broxton-rt298/HiFi.confucm2/skylake-rt286/HiFi.conf
The es8316 case is actually correct, the es8316 has only 1 output (which is amplified for e.g. a speaker) and at least the reference design suggests routing the speaker signal through the jack and using a jack which will interrupt the signal when headphones are plugged in.
Note most actual designs implement this with an analog switch and a GPIO to control that switch, since 3.5 mm jacks which actually can disconnect a signal are rare (if they exist at all, but I guess they do). For the designs using the GPIO controlled analog switch, the JackHWMute technically also is wrong, but I put it there (IIRC it was me) because it matches the reference design.
I'm not familiar enough with any of the others to say anything about them, but most of them are for HDA setups, where this is somewhat more normal I guess.
Regards,
Hans
Quoted 83 lines
Quoted 82 lines
Signed-off-by Hans de Goede <[email protected]>---
ucm2/chtrt5645/HiFi-dmic1.conf | 2 -- ucm2/chtrt5645/HiFi-dmic2.conf | 2 --ucm2/chtrt5645/HiFi-mono-speaker-analog-mic.conf| 2 -- ucm2/chtrt5645/HiFi.conf | 2 --4 files changed, 8 deletions(-)ucm2/chtrt5645/HiFi-dmic1.conf +0
-0@@ -50,7 +50,6 @@ SectionDevice."Headphones" {PlaybackPriority 200
PlaybackPCM "hw:${CardId}"
JackControl "Headphone Jack"
- JackHWMute "Speaker"
}
ConflictingDevice [ucm2/chtrt5645/HiFi-dmic1.conf +0
-0@@ -96,7 +95,6 @@ SectionDevice."Headset" {CapturePriority 200
CapturePCM "hw:${CardId}"
JackControl "Headset Mic Jack"
- JackHWMute "Mic"
}
EnableSequence [ucm2/chtrt5645/HiFi-dmic2.conf +0
-0@@ -50,7 +50,6 @@ SectionDevice."Headphones" {PlaybackPriority 200
PlaybackPCM "hw:${CardId}"
JackControl "Headphone Jack"
- JackHWMute "Speaker"
}
ConflictingDevice [ucm2/chtrt5645/HiFi-dmic2.conf +0
-0@@ -98,7 +97,6 @@ SectionDevice."Headset" {CapturePriority 200
CapturePCM "hw:${CardId}"
JackControl "Headset Mic Jack"
- JackHWMute "Mic"
}
EnableSequence [ucm2/chtrt5645/HiFi-mono-speaker-analog-mic.conf +0
-0@@ -54,7 +54,6 @@ SectionDevice."Headphones" {PlaybackPriority 200
PlaybackPCM "hw:${CardId}"
JackControl "Headphone Jack"
- JackHWMute "Speaker"
}
ConflictingDevice [ucm2/chtrt5645/HiFi-mono-speaker-analog-mic.conf +0
-0@@ -84,7 +83,6 @@ SectionDevice."Headset" {CapturePriority 200
CapturePCM "hw:${CardId}"
JackControl "Headset Mic Jack"
- JackHWMute "Mic"
}
EnableSequence [ucm2/chtrt5645/HiFi.conf +0
-0@@ -50,7 +50,6 @@ SectionDevice."Headphones" {PlaybackPriority 200
PlaybackPCM "hw:${CardId}"
JackControl "Headphone Jack"
- JackHWMute "Speaker"
}
ConflictingDevice [ucm2/chtrt5645/HiFi.conf +0
-0@@ -76,7 +75,6 @@ SectionDevice."Headset" {CapturePriority 200
CapturePCM "hw:${CardId}"
JackControl "Headset Mic Jack"
- JackHWMute "Mic"
}
EnableSequence [
Re: [PATCH 4/5] chtrt5645: Remove bogus JackHWMute settings
Quoted 46 lines
Quoted 2 lines
So overall it seems rather unlikely that we can support dmic + headset mic in parallel?
Right that is what the ConflictingDevices sections are for.
Removing the JackHWMute does not allow using both add the same time, it merely allows overriding which of the 2 to use (if the headset mic is detected by the jack, the JackControl setting is kept).
So lets say the internal mic is crappy, but the user prefers to have their ears free, then they can use a headset around there neck, using just the headset-mic and select speakers as output even though a jack is inserted.
Note pulseaudio will still automatically switch to the headphones / headsetmic when plugged in, this merely allows overriding that choice manually.
Jacks which actually physically disable (or re-route) signals are quite rare now a days so having a JackHWMute in the UCM conf is often wrong. After this patch only a few cases are left:
[hans@x1 alsa-ucm-conf]$ ack -l JackHWMute ucm2
ucm2/HDA-Intel/HiFi-dual.confucm2/chtrt5650/HiFi.confucm2/hda-dsp/HiFi.confucm2/codecs/es8316/HeadPhones.confucm2/sof-bdw-rt5677/HiFi.confucm2/broxton-rt298/HiFi.confucm2/skylake-rt286/HiFi.confThe es8316 case is actually correct, the es8316 has only 1 output (which is amplified for e.g. a speaker) and at least the reference design suggests routing the speaker signal through the jack and using a jack which will interrupt the signal when headphones are plugged in.
Note most actual designs implement this with an analog switch and a GPIO to control that switch, since 3.5 mm jacks which actually can disconnect a signal are rare (if they exist at all, but I guess they do). For the designs using the GPIO controlled analog switch, the JackHWMute technically also is wrong, but I put it there (IIRC it was me) because it matches the reference design.
Quoted 3 lines
I'm not familiar enough with any of the others to say anything about them, but most of them are for HDA setups, where this is somewhat more normal I guess.
If I follow the logic, I guess we should also remove the JackHWMute for sof-bdw-rt5677, hda-dsp and HDA-Intel. I can't think of a hardware limitation preventing the headset mic from being used while the speakers are used for playback. Likewise the rt5650 is a cheaper version of rt5645 so the same applies.
Re: [PATCH 4/5] chtrt5645: Remove bogus JackHWMute settings
Hi,
Quoted 46 lines · Pierre-Louis Bossart
Quoted 46 lines
Quoted 2 lines
So overall it seems rather unlikely that we can support dmic + headset mic in parallel?
Right that is what the ConflictingDevices sections are for.
Removing the JackHWMute does not allow using both add the same time, it merely allows overriding which of the 2 to use (if the headset mic is detected by the jack, the JackControl setting is kept).
So lets say the internal mic is crappy, but the user prefers to have their ears free, then they can use a headset around there neck, using just the headset-mic and select speakers as output even though a jack is inserted.
Note pulseaudio will still automatically switch to the headphones / headsetmic when plugged in, this merely allows overriding that choice manually.
Jacks which actually physically disable (or re-route) signals are quite rare now a days so having a JackHWMute in the UCM conf is often wrong. After this patch only a few cases are left:
[hans@x1 alsa-ucm-conf]$ ack -l JackHWMute ucm2
ucm2/HDA-Intel/HiFi-dual.confucm2/chtrt5650/HiFi.confucm2/hda-dsp/HiFi.confucm2/codecs/es8316/HeadPhones.confucm2/sof-bdw-rt5677/HiFi.confucm2/broxton-rt298/HiFi.confucm2/skylake-rt286/HiFi.confThe es8316 case is actually correct, the es8316 has only 1 output (which is amplified for e.g. a speaker) and at least the reference design suggests routing the speaker signal through the jack and using a jack which will interrupt the signal when headphones are plugged in.
Note most actual designs implement this with an analog switch and a GPIO to control that switch, since 3.5 mm jacks which actually can disconnect a signal are rare (if they exist at all, but I guess they do). For the designs using the GPIO controlled analog switch, the JackHWMute technically also is wrong, but I put it there (IIRC it was me) because it matches the reference design.
Quoted 5 lines
Quoted 3 lines
I'm not familiar enough with any of the others to say anything about them, but most of them are for HDA setups, where this is somewhat more normal I guess.
If I follow the logic, I guess we should also remove the JackHWMute for sof-bdw-rt5677, hda-dsp and HDA-Intel. I can't think of a hardware limitation preventing the headset mic from being used while the speakers are used for playback. Likewise the rt5650 is a cheaper version of rt5645 so the same applies.
Right AFAIK:
JackHWMute "foo"
Means that the JackControl listed in the same section does something at the hardware level which makes it impossible for the "foo" input / output to function until the jack is removed. Typically this would be something like actually disconnecting the speakers at the electrical level.
So almost always using it is wrong.
Regards,
Hans
Re: [PATCH 4/5] chtrt5645: Remove bogus JackHWMute settings
Dne 06. 04. 20 v 18:58 Hans de Goede napsal(a):
Quoted 59 lines
Hi,
Quoted 46 lines · Pierre-Louis Bossart
Quoted 46 lines
Quoted 2 lines
So overall it seems rather unlikely that we can support dmic + headset mic in parallel?
Right that is what the ConflictingDevices sections are for.
Removing the JackHWMute does not allow using both add the same time, it merely allows overriding which of the 2 to use (if the headset mic is detected by the jack, the JackControl setting is kept).
So lets say the internal mic is crappy, but the user prefers to have their ears free, then they can use a headset around there neck, using just the headset-mic and select speakers as output even though a jack is inserted.
Note pulseaudio will still automatically switch to the headphones / headsetmic when plugged in, this merely allows overriding that choice manually.
Jacks which actually physically disable (or re-route) signals are quite rare now a days so having a JackHWMute in the UCM conf is often wrong. After this patch only a few cases are left:
[hans@x1 alsa-ucm-conf]$ ack -l JackHWMute ucm2
ucm2/HDA-Intel/HiFi-dual.confucm2/chtrt5650/HiFi.confucm2/hda-dsp/HiFi.confucm2/codecs/es8316/HeadPhones.confucm2/sof-bdw-rt5677/HiFi.confucm2/broxton-rt298/HiFi.confucm2/skylake-rt286/HiFi.confThe es8316 case is actually correct, the es8316 has only 1 output (which is amplified for e.g. a speaker) and at least the reference design suggests routing the speaker signal through the jack and using a jack which will interrupt the signal when headphones are plugged in.
Note most actual designs implement this with an analog switch and a GPIO to control that switch, since 3.5 mm jacks which actually can disconnect a signal are rare (if they exist at all, but I guess they do). For the designs using the GPIO controlled analog switch, the JackHWMute technically also is wrong, but I put it there (IIRC it was me) because it matches the reference design.
Quoted 5 lines
Quoted 3 lines
I'm not familiar enough with any of the others to say anything about them, but most of them are for HDA setups, where this is somewhat more normal I guess.
If I follow the logic, I guess we should also remove the JackHWMute for sof-bdw-rt5677, hda-dsp and HDA-Intel. I can't think of a hardware limitation preventing the headset mic from being used while the speakers are used for playback. Likewise the rt5650 is a cheaper version of rt5645 so the same applies.
Right AFAIK:
JackHWMute "foo"
Quoted 7 lines
Means that the JackControl listed in the same section does something at the hardware level which makes it impossible for the "foo" input / output to function until the jack is removed. Typically this would be something like actually disconnecting the speakers at the electrical level.
So almost always using it is wrong.
I agree. The description is really straight (use-case.h):
"Note that JackHWMute should be used only when the hardware enforces the automatic muting."
Pierre, it seems that hds-dsp uses JackHWMute for Speaker and Headphones, I think that it should be removed. Otherwise PA thinks that those devices cannot be used simultaneously when user wants to..
Jaroslav
Quoted 6 lines
Regards,
Hans
Signature · 2 lines
Jaroslav Kysela <[email protected]> Linux Sound Maintainer; ALSA Project; Red Hat, Inc.
Re: [PATCH 4/5] chtrt5645: Remove bogus JackHWMute settings
Quoted 13 lines
Quoted 13 lines
Quoted 2 lines
If I follow the logic, I guess we should also remove the JackHWMute for sof-bdw-rt5677, hda-dsp and HDA-Intel. I can't think of a hardware limitation preventing the headset mic from being used while the speakers are used for playback. Likewise the rt5650 is a cheaper version of rt5645 so the same applies.
Right AFAIK:
JackHWMute "foo"
Means that the JackControl listed in the same section does something at the hardware level which makes it impossible for the "foo" input / output to function until the jack is removed. Typically this would be something like actually disconnecting the speakers at the electrical level.
Quoted 7 lines
Quoted 1 line
So almost always using it is wrong.
I agree. The description is really straight (
use-case.h):"Note that JackHWMute should be used only when the hardware enforces the automatic muting."
Pierre, it seems that hds-dsp uses JackHWMute for Speaker and Headphones, I think that it should be removed. Otherwise PA thinks that those devices cannot be used simultaneously when user wants to..
Right, that hda-dsp UCM config probably needs more work between the JackHWMute and only supporting 2 HDMI paths, but that's not maintained by me or anyone on the SOF team. Adding Mateusz Gorski in Cc:
Jaroslav Kysela
AppliedRe: [PATCH 4/5] chtrt5645: Remove bogus JackHWMute settings
In reply to Hans de GoedeDne 05. 04. 20 v 20:34 Hans de Goede napsal(a):
Quoted 88 lines
There is no reason why the internal microphone or speakers cannot be used when a headset is plugged in.
The jack does not physically disconnect these, so the JackHWMute settings are wrong, remove them.
Signed-off-by Hans de Goede <[email protected]>--- ucm2/chtrt5645/HiFi-dmic1.conf | 2 -- ucm2/chtrt5645/HiFi-dmic2.conf | 2 -- ucm2/chtrt5645/HiFi-mono-speaker-analog-mic.conf | 2 -- ucm2/chtrt5645/HiFi.conf | 2 -- 4 files changed, 8 deletions(-)ucm2/chtrt5645/HiFi-dmic1.conf +0
-2@@ -50,7 +50,6 @@ SectionDevice."Headphones" { PlaybackPriority 200 PlaybackPCM "hw:${CardId}" JackControl "Headphone Jack" - JackHWMute "Speaker" } ConflictingDevice [@@ -96,7 +95,6 @@ SectionDevice."Headset" { CapturePriority 200 CapturePCM "hw:${CardId}" JackControl "Headset Mic Jack" - JackHWMute "Mic" } EnableSequence [ucm2/chtrt5645/HiFi-dmic2.conf +0
-2@@ -50,7 +50,6 @@ SectionDevice."Headphones" { PlaybackPriority 200 PlaybackPCM "hw:${CardId}" JackControl "Headphone Jack" - JackHWMute "Speaker" } ConflictingDevice [@@ -98,7 +97,6 @@ SectionDevice."Headset" { CapturePriority 200 CapturePCM "hw:${CardId}" JackControl "Headset Mic Jack" - JackHWMute "Mic" } EnableSequence [ucm2/chtrt5645/HiFi-mono-speaker-analog-mic.conf +0
-2@@ -54,7 +54,6 @@ SectionDevice."Headphones" { PlaybackPriority 200 PlaybackPCM "hw:${CardId}" JackControl "Headphone Jack" - JackHWMute "Speaker" } ConflictingDevice [@@ -84,7 +83,6 @@ SectionDevice."Headset" { CapturePriority 200 CapturePCM "hw:${CardId}" JackControl "Headset Mic Jack" - JackHWMute "Mic" } EnableSequence [ucm2/chtrt5645/HiFi.conf +0
-1@@ -50,7 +50,6 @@ SectionDevice."Headphones" { PlaybackPriority 200 PlaybackPCM "hw:${CardId}" JackControl "Headphone Jack" - JackHWMute "Speaker" } ConflictingDevice [
ucm2/chtrt5645/HiFi.conf SectionDevice."Headset" { · line 80
Quoted 7 lines
ucm2/chtrt5645/HiFi.conf +0
-1@@ -76,7 +75,6 @@ SectionDevice."Headset" { CapturePriority 200 CapturePCM "hw:${CardId}" JackControl "Headset Mic Jack" - JackHWMute "Mic" } EnableSequence [
Applied. Thanks.
Jaroslav
Signature · 2 lines
Jaroslav Kysela <[email protected]> Linux Sound Maintainer; ALSA Project; Red Hat, Inc.
Re: [4/5] chtrt5645: Remove bogus JackHWMute settings
In reply to Hans de Goedeplease also remove es8316 HeadPhones.conf JackHWMute "Speaker"
Re: [4/5] chtrt5645: Remove bogus JackHWMute settings
Hi,
Quoted 1 line · On 4/13/20 3:19 PM, youling257 wrote:
please also remove es8316 HeadPhones.conf JackHWMute "Speaker"
Erm, no that is not right. The ES8316 actually needs this.
The es8316 actually only has 1 amplified output (and no un-amplified outputs IIRC). In the reference designs (appnote) for the es8316 the output is actually switched in hardware based on jack-detect.
In practice this is implemented by connecting the L/R speaker output signals *directly* to the jack and through a analog switch which is controlled through a GPIO to the speakers.
So when headphones are plugged in we can (and must) disable the analog-switch so that the speakers are disconnected from the outputs and the outputs only drive the headphones.
If we remove the JackHWMute "Speaker" and then switch the sound to the speakers, the sound will be send to both the speakers and the headphones at the same time; there is no way to turn off the headphones.
So we need the JackHWMute "Speaker" here.
Regards,
Hans
Re: [4/5] chtrt5645: Remove bogus JackHWMute settings
Yes, you are right.
remove the EnableSeq.conf stupid Disable all output, i can get speaker and headphone work on ubuntu focal with pulseaudio.
if remove JackHWMute "Speaker", speaker and headphone both has sound.
2020-04-13 22:39 GMT+08:00, Hans de Goede <[email protected]>:
Quoted 31 lines
Hi,
Quoted 1 line · On 4/13/20 3:19 PM, youling257 wrote:
please also remove es8316 HeadPhones.conf JackHWMute "Speaker"
Erm, no that is not right. The ES8316 actually needs this.
The es8316 actually only has 1 amplified output (and no un-amplified outputs IIRC). In the reference designs (appnote) for the es8316 the output is actually switched in hardware based on jack-detect.
In practice this is implemented by connecting the L/R speaker output signals *directly* to the jack and through a analog switch which is controlled through a GPIO to the speakers.
So when headphones are plugged in we can (and must) disable the analog-switch so that the speakers are disconnected from the outputs and the outputs only drive the headphones.
If we remove the JackHWMute "Speaker" and then switch the sound to the speakers, the sound will be send to both the speakers and the headphones at the same time; there is no way to turn off the headphones.
So we need the JackHWMute "Speaker" here.
Regards,
Hans
PATCH 5/5 cht-bsw-rt5672: Fix HiFi-stereo-dmic2 conf not loading / working
In reply to Hans de GoedeFix HiFi-stereo-dmic2 conf not loading because of references to non existing devices in the ConflictingDevices sections.
Stop playing Rename + Remove tricks with the output (Speaker2) and input (DMIC1) devices which we do not want to be part of this config, this does not work now that we only allow devices which are actually part of our config in the ConflictingDevices sections.
Instead start with only having devices which all configs have in the ConflictingDevices sections (Headphones / Headset) and add the other ones from our HiFi*.conf files after including the shared basic configs.
---
I have tested that both HiFi.conf and HiFi-stereo-dmic2.conf work properly after these changes.
--- ucm2/cht-bsw-rt5672/HiFi-stereo-dmic2.conf | 6 ++---- ucm2/cht-bsw-rt5672/HiFi.conf | 8 ++++++++ ucm2/codecs/rt5672/DMIC1.conf | 1 - ucm2/codecs/rt5672/DMIC2.conf | 1 - ucm2/codecs/rt5672/HeadPhones.conf | 2 -- ucm2/codecs/rt5672/HeadsetMic.conf | 2 -- ucm2/codecs/rt5672/MonoSpeaker.conf | 1 - ucm2/codecs/rt5672/Speaker.conf | 1 - 8 files changed, 10 insertions(+), 12 deletions(-)
ucm2/cht-bsw-rt5672/HiFi-stereo-dmic2.conf +2 -4
@@ -12,11 +12,9 @@ SectionVerb { } <codecs/rt5672/Speaker.conf> -RenameDevice."Speaker1" "Speaker" -RemoveDevice."Speaker2" "Speaker2" <codecs/rt5672/HeadPhones.conf> +SectionDevice."Headphones".ConflictingDevice.0 "Speaker1" <codecs/rt5672/DMIC2.conf> -RenameDevice."Mic2" "Mic" -RemoveDevice."Mic1" "Mic1" <codecs/rt5672/HeadsetMic.conf> +SectionDevice."Headset".ConflictingDevice.0 "Mic2"
ucm2/cht-bsw-rt5672/HiFi.conf +8 -0
@@ -14,7 +14,15 @@ SectionVerb { <codecs/rt5672/Speaker.conf> <codecs/rt5672/MonoSpeaker.conf> <codecs/rt5672/HeadPhones.conf> +SectionDevice."Speaker1".ConflictingDevice.1 "Speaker2" +SectionDevice."Speaker2".ConflictingDevice.1 "Speaker1" +SectionDevice."Headphones".ConflictingDevice.0 "Speaker1" +SectionDevice."Headphones".ConflictingDevice.1 "Speaker2" <codecs/rt5672/DMIC1.conf> <codecs/rt5672/DMIC2.conf> <codecs/rt5672/HeadsetMic.conf> +SectionDevice."Mic1".ConflictingDevice.1 "Mic2" +SectionDevice."Mic2".ConflictingDevice.1 "Mic1" +SectionDevice."Headset".ConflictingDevice.0 "Mic1" +SectionDevice."Headset".ConflictingDevice.1 "Mic2"
ucm2/codecs/rt5672/DMIC1.conf +0 -1
@@ -2,7 +2,6 @@ SectionDevice."Mic1" { Comment "Internal Digital Microphone on DMIC1" ConflictingDevice [ - "Mic2" "Headset" ]
ucm2/codecs/rt5672/DMIC2.conf +0 -1
@@ -2,7 +2,6 @@ SectionDevice."Mic2" { Comment "Internal Digital Microphone on DMIC2" ConflictingDevice [ - "Mic1" "Headset" ]
ucm2/codecs/rt5672/HeadPhones.conf +0 -2
@@ -2,8 +2,6 @@ SectionDevice."Headphones" { Comment "Headphones" ConflictingDevice [ - "Speaker1" - "Speaker2" ] EnableSequence [
ucm2/codecs/rt5672/HeadsetMic.conf +0 -2
@@ -2,8 +2,6 @@ SectionDevice."Headset" { Comment "Headset Microphone" ConflictingDevice [ - "Mic1" - "Mic2" ] EnableSequence [
ucm2/codecs/rt5672/MonoSpeaker.conf +0 -1
@@ -2,7 +2,6 @@ SectionDevice."Speaker2" { Comment "Mono Speaker" ConflictingDevice [ - "Speaker1" "Headphones" ]
ucm2/codecs/rt5672/Speaker.conf +0 -1
@@ -2,7 +2,6 @@ SectionDevice."Speaker1" { Comment "Stereo Speakers" ConflictingDevice [ - "Speaker2" "Headphones" ]
Signature · 1 line
2.26.0
Re: [PATCH 5/5] cht-bsw-rt5672: Fix HiFi-stereo-dmic2 conf not loading / working
Dne 05. 04. 20 v 20:34 Hans de Goede napsal(a):
Quoted 7 lines
Fix HiFi-stereo-dmic2 conf not loading because of references to non existing devices in the ConflictingDevices sections.
Stop playing Rename + Remove tricks with the output (Speaker2) and input (DMIC1) devices which we do not want to be part of this config, this does not work now that we only allow devices which are actually part of our config in the ConflictingDevices sections.
The Remove and Rename operations should also manage (remove and rename) devices in ConflictingDevices/SupportedDevices sections. What's the exact error you hit?
If I simulate this via ucm-validator I get this device structure:
Verb: "HiFi"
File: HiFi-stereo-dmic2.conf
Device: "Headphones"
ConflictingDevices.0 = Speaker
Value.PlaybackPriority = 300
Value.PlaybackPCM = 'hw:${CardId}'
Value.JackControl = 'Headphone Jack'
Device: "Headset"
ConflictingDevices.0 = Mic
Value.CapturePriority = 300
Value.CapturePCM = 'hw:${CardId}'
Value.JackControl = 'Headset Mic Jack'
Device: "Speaker"
ConflictingDevices.0 = Headphones
Value.PlaybackPriority = 200
Value.PlaybackPCM = 'hw:${CardId}'
Device: "Mic"
ConflictingDevices.0 = Headset
Value.CapturePriority = 200
Value.CapturePCM = 'hw:${CardId}'
It appears like an issue in alsa-lib.
Jaroslav
Signature · 2 lines
Jaroslav Kysela <[email protected]> Linux Sound Maintainer; ALSA Project; Red Hat, Inc.
Re: [PATCH 5/5] cht-bsw-rt5672: Fix HiFi-stereo-dmic2 conf not loading / working
Hi,
Quoted 34 lines · Jaroslav Kysela
Dne 05. 04. 20 v 20:34 Hans de Goede napsal(a):
Quoted 7 lines
Fix HiFi-stereo-dmic2 conf not loading because of references to non existing devices in the ConflictingDevices sections.
Stop playing Rename + Remove tricks with the output (Speaker2) and input (DMIC1) devices which we do not want to be part of this config, this does not work now that we only allow devices which are actually part of our config in the ConflictingDevices sections.
The Remove and Rename operations should also manage (remove and rename) devices in ConflictingDevices/SupportedDevices sections. What's the exact error you hit?
If I simulate this via ucm-validator I get this device structure:
Verb: "HiFi"
File: HiFi-stereo-dmic2.conf
Device: "Headphones"
ConflictingDevices.0 = Speaker
Value.PlaybackPriority = 300
Value.PlaybackPCM = 'hw:${CardId}'
Value.JackControl = 'Headphone Jack'
Device: "Headset"
ConflictingDevices.0 = Mic
Value.CapturePriority = 300
Value.CapturePCM = 'hw:${CardId}'
Value.JackControl = 'Headset Mic Jack'
Device: "Speaker"
ConflictingDevices.0 = Headphones
Value.PlaybackPriority = 200
Value.PlaybackPCM = 'hw:${CardId}'
Device: "Mic"
ConflictingDevices.0 = Headset
Value.CapturePriority = 200
Value.CapturePCM = 'hw:${CardId}'
Quoted 1 line
It appears like an issue in alsa-lib.
With an unmodified UCM2 profile I get the following:
[hans@localhost ~]$ alsaucm -c cht-bsw-rt5672 set _verb HiFi set _enadev Speaker
ALSA lib parser.c:1138:(verb_dev_list_add) error: unable to find device 'Speaker2'
ALSA lib parser.c:1433:(parse_verb_file) error: device management error in verb 'HiFi' ALSA lib main.c:962:(snd_use_case_mgr_open) error: failed to import cht-bsw-rt5672 use case configuration -2
alsaucm: error failed to open sound card cht-bsw-rt5672: No such file or directory
Note the _enadev does not matter, things break before it gets parsed, if I replace Speaker with XXX I get the exact same errors.
I'm happy to try any alsa-lib patches on this (Thinkpad8) hw for you.
Regards,
Hans
Re: [PATCH 5/5] cht-bsw-rt5672: Fix HiFi-stereo-dmic2 conf not loading / working
Dne 06. 04. 20 v 11:50 Hans de Goede napsal(a):
Quoted 47 lines
Hi,
Quoted 34 lines · Jaroslav Kysela
Dne 05. 04. 20 v 20:34 Hans de Goede napsal(a):
Quoted 7 lines
Fix HiFi-stereo-dmic2 conf not loading because of references to non existing devices in the ConflictingDevices sections.
Stop playing Rename + Remove tricks with the output (Speaker2) and input (DMIC1) devices which we do not want to be part of this config, this does not work now that we only allow devices which are actually part of our config in the ConflictingDevices sections.
The Remove and Rename operations should also manage (remove and rename) devices in ConflictingDevices/SupportedDevices sections. What's the exact error you hit?
If I simulate this via ucm-validator I get this device structure:
Verb: "HiFi" File: HiFi-stereo-dmic2.conf Device: "Headphones" ConflictingDevices.0 = Speaker Value.PlaybackPriority = 300 Value.PlaybackPCM = 'hw:${CardId}' Value.JackControl = 'Headphone Jack' Device: "Headset" ConflictingDevices.0 = Mic Value.CapturePriority = 300 Value.CapturePCM = 'hw:${CardId}' Value.JackControl = 'Headset Mic Jack' Device: "Speaker" ConflictingDevices.0 = Headphones Value.PlaybackPriority = 200 Value.PlaybackPCM = 'hw:${CardId}' Device: "Mic" ConflictingDevices.0 = Headset Value.CapturePriority = 200 Value.CapturePCM = 'hw:${CardId}'Quoted 1 line
It appears like an issue in alsa-lib.
With an unmodified UCM2 profile I get the following:
[hans@localhost ~]$ alsaucm -c cht-bsw-rt5672 set
_verbHiFi set_enadevSpeaker
ALSA lib parser.c:1138:(verb_dev_list_add) error: unable to find device 'Speaker2'
ALSA lib parser.c:1433:(parse_verb_file) error: device management error in verb 'HiFi' ALSA lib main.c:962:(snd_use_case_mgr_open) error: failed to import cht-bsw-rt5672 use case configuration -2
alsaucm: error failed to open sound card cht-bsw-rt5672: No such file or directory
Quoted 4 lines
Note the
_enadevdoes not matter, things break before it gets parsed, if I replace Speaker with XXX I get the exact same errors.I'm happy to try any alsa-lib patches on this (Thinkpad8) hw for you.
I think that I found the culprit. Could you test this, please?
https://github.com/alsa-project/alsa-lib/commit/c9605484d165d2b707f78eef14a224b0b47ba322
Thank you,
Jaroslav
Signature · 2 lines
Jaroslav Kysela <[email protected]> Linux Sound Maintainer; ALSA Project; Red Hat, Inc.
Re: [PATCH 5/5] cht-bsw-rt5672: Fix HiFi-stereo-dmic2 conf not loading / working
Hi,
Quoted 48 lines · Jaroslav Kysela
Dne 06. 04. 20 v 11:50 Hans de Goede napsal(a):
Quoted 47 lines
Hi,
Quoted 34 lines · Jaroslav Kysela
Dne 05. 04. 20 v 20:34 Hans de Goede napsal(a):
Quoted 7 lines
Fix HiFi-stereo-dmic2 conf not loading because of references to non existing devices in the ConflictingDevices sections.
Stop playing Rename + Remove tricks with the output (Speaker2) and input (DMIC1) devices which we do not want to be part of this config, this does not work now that we only allow devices which are actually part of our config in the ConflictingDevices sections.
The Remove and Rename operations should also manage (remove and rename) devices in ConflictingDevices/SupportedDevices sections. What's the exact error you hit?
If I simulate this via ucm-validator I get this device structure:
Verb: "HiFi" File: HiFi-stereo-dmic2.conf Device: "Headphones" ConflictingDevices.0 = Speaker Value.PlaybackPriority = 300 Value.PlaybackPCM = 'hw:${CardId}' Value.JackControl = 'Headphone Jack' Device: "Headset" ConflictingDevices.0 = Mic Value.CapturePriority = 300 Value.CapturePCM = 'hw:${CardId}' Value.JackControl = 'Headset Mic Jack' Device: "Speaker" ConflictingDevices.0 = Headphones Value.PlaybackPriority = 200 Value.PlaybackPCM = 'hw:${CardId}' Device: "Mic" ConflictingDevices.0 = Headset Value.CapturePriority = 200 Value.CapturePCM = 'hw:${CardId}'Quoted 1 line
It appears like an issue in alsa-lib.
With an unmodified UCM2 profile I get the following:
[hans@localhost ~]$ alsaucm -c cht-bsw-rt5672 set
_verbHiFi set_enadevSpeaker
ALSA lib parser.c:1138:(verb_dev_list_add) error: unable to find device 'Speaker2'
ALSA lib parser.c:1433:(parse_verb_file) error: device management error in verb 'HiFi' ALSA lib main.c:962:(snd_use_case_mgr_open) error: failed to import cht-bsw-rt5672 use case configuration -2
alsaucm: error failed to open sound card cht-bsw-rt5672: No such file or directory
Quoted 8 lines
Quoted 4 lines
Note the
_enadevdoes not matter, things break before it gets parsed, if I replace Speaker with XXX I get the exact same errors.I'm happy to try any alsa-lib patches on this (Thinkpad8) hw for you.
I think that I found the culprit. Could you test this, please?
https://github.com/alsa-project/alsa-lib/commit/c9605484d165d2b707f78eef14a224b0b47ba322
I added that patch to the alsa-lib-1.2.2 package, did a build and installed it, unfortunately it does not help:
[hans@localhost ~]$ rpm -q alsa-lib
alsa-lib-1.2.2-1.hdg1.fc33.x86_64
[hans@localhost ~]$ alsaucm -c cht-bsw-rt5672 set _verb HiFi set _enadev Speaker ALSA lib parser.c:1138:(verb_dev_list_add) error: unable to find device 'Speaker2'
...
Regards,
Hans
Re: [PATCH 5/5] cht-bsw-rt5672: Fix HiFi-stereo-dmic2 conf not loading / working
Dne 06. 04. 20 v 14:13 Hans de Goede napsal(a):
Quoted 60 lines
Hi,
Quoted 48 lines · Jaroslav Kysela
Dne 06. 04. 20 v 11:50 Hans de Goede napsal(a):
Quoted 47 lines
Hi,
Quoted 34 lines · Jaroslav Kysela
Dne 05. 04. 20 v 20:34 Hans de Goede napsal(a):
Quoted 7 lines
Fix HiFi-stereo-dmic2 conf not loading because of references to non existing devices in the ConflictingDevices sections.
Stop playing Rename + Remove tricks with the output (Speaker2) and input (DMIC1) devices which we do not want to be part of this config, this does not work now that we only allow devices which are actually part of our config in the ConflictingDevices sections.
The Remove and Rename operations should also manage (remove and rename) devices in ConflictingDevices/SupportedDevices sections. What's the exact error you hit?
If I simulate this via ucm-validator I get this device structure:
Verb: "HiFi"
File: HiFi-stereo-dmic2.conf
Device: "Headphones"
ConflictingDevices.0 = Speaker
Value.PlaybackPriority = 300
Value.PlaybackPCM = 'hw:${CardId}'
Value.JackControl = 'Headphone Jack'
Device: "Headset"
ConflictingDevices.0 = Mic
Value.CapturePriority = 300
Value.CapturePCM = 'hw:${CardId}'
Value.JackControl = 'Headset Mic Jack'
Device: "Speaker"
ConflictingDevices.0 = Headphones
Value.PlaybackPriority = 200
Value.PlaybackPCM = 'hw:${CardId}'
Device: "Mic"
ConflictingDevices.0 = Headset
Value.CapturePriority = 200
Value.CapturePCM = 'hw:${CardId}'Quoted 1 line
It appears like an issue in alsa-lib.
With an unmodified UCM2 profile I get the following:
[hans@localhost ~]$ alsaucm -c cht-bsw-rt5672 set
_verbHiFi set_enadevSpeaker
ALSA lib parser.c:1138:(verb_dev_list_add) error: unable to find device 'Speaker2'
ALSA lib parser.c:1433:(parse_verb_file) error: device management error in verb 'HiFi' ALSA lib main.c:962:(snd_use_case_mgr_open) error: failed to import cht-bsw-rt5672 use case configuration -2
alsaucm: error failed to open sound card cht-bsw-rt5672: No such file or directoryQuoted 8 lines
Quoted 4 lines
Note the
_enadevdoes not matter, things break before it gets parsed, if I replace Speaker with XXX I get the exact same errors.I'm happy to try any alsa-lib patches on this (Thinkpad8) hw for you.
I think that I found the culprit. Could you test this, please?
https://github.com/alsa-project/alsa-lib/commit/c9605484d165d2b707f78eef14a224b0b47ba322
Quoted 8 lines
I added that patch to the alsa-lib-1.2.2 package, did a build and installed it, unfortunately it does not help:
[hans@localhost ~]$ rpm -q alsa-lib
alsa-lib-1.2.2-1.hdg1.fc33.x86_64
[hans@localhost ~]$ alsaucm -c cht-bsw-rt5672 set_verbHiFi set_enadevSpeaker ALSA lib parser.c:1138:(verb_dev_list_add) error: unable to find device 'Speaker2'
...
Another one line fix:
https://github.com/alsa-project/alsa-lib/commit/fb48ad9e4f6b84fd4ade689bd79e3a3c37d3e034
Jaroslav
Quoted 5 lines
Regards,
Hans
Signature · 2 lines
Jaroslav Kysela <[email protected]> Linux Sound Maintainer; ALSA Project; Red Hat, Inc.
Re: [PATCH 5/5] cht-bsw-rt5672: Fix HiFi-stereo-dmic2 conf not loading / working
In reply to Jaroslav KyselaHi,
Quoted 34 lines · Jaroslav Kysela
Dne 05. 04. 20 v 20:34 Hans de Goede napsal(a):
Quoted 7 lines
Fix HiFi-stereo-dmic2 conf not loading because of references to non existing devices in the ConflictingDevices sections.
Stop playing Rename + Remove tricks with the output (Speaker2) and input (DMIC1) devices which we do not want to be part of this config, this does not work now that we only allow devices which are actually part of our config in the ConflictingDevices sections.
The Remove and Rename operations should also manage (remove and rename) devices in ConflictingDevices/SupportedDevices sections. What's the exact error you hit?
If I simulate this via ucm-validator I get this device structure:
Verb: "HiFi"
File: HiFi-stereo-dmic2.conf
Device: "Headphones"
ConflictingDevices.0 = Speaker
Value.PlaybackPriority = 300
Value.PlaybackPCM = 'hw:${CardId}'
Value.JackControl = 'Headphone Jack'
Device: "Headset"
ConflictingDevices.0 = Mic
Value.CapturePriority = 300
Value.CapturePCM = 'hw:${CardId}'
Value.JackControl = 'Headset Mic Jack'
Device: "Speaker"
ConflictingDevices.0 = Headphones
Value.PlaybackPriority = 200
Value.PlaybackPCM = 'hw:${CardId}'
Device: "Mic"
ConflictingDevices.0 = Headset
Value.CapturePriority = 200
Value.CapturePCM = 'hw:${CardId}'
Quoted 1 line
It appears like an issue in alsa-lib.
Ok so I found the following weird:
RemoveDevice."Speaker2" "Speaker2"
At a hunch I removed the extra "Speaker2", now I get:
[hans@localhost ~]$ alsaucm -c cht-bsw-rt5672 set _verb HiFi set _enadev Speaker ALSA lib parser.c:1138:(verb_dev_list_add) error: unable to find device 'Mic1'
...
Notice the error changed from being about Speaker2 to Mic1, so this looks good, but then I did the same with the:
RemoveDevice."Mic1" "Mic1"
Line, dropping the extra "Mic1" I get:
[hans@localhost ~]$ alsaucm -c cht-bsw-rt5672 set _verb HiFi set _enadev Speaker ALSA lib parser.c:1183:(verb_device_management) error: cannot remove device 'Mic'
...
Which is weird...
Even weirder I was thinking that the Rename + Remove lines should be after the last include, so that they also get applied to the Conflicting devices of e.g . the Headphones Section Device, but if I move the Rename + Remove lines for the Mic to the end of the HiFi-stereo-dmic2.conf file I get:
[hans@localhost ~]$ alsaucm -c cht-bsw-rt5672 set _verb HiFi set _enadev Speaker
ALSA lib conf.c:1928:(_snd_config_load_with_include) _toplevel_:23:0:Unexpected end of file
ALSA lib utils.c:285:(uc_mgr_config_load) could not load configuration file /usr/share/alsa/ucm2/cht-bsw-rt5672/HiFi-stereo-dmic2.conf ALSA lib parser.c:1349:(parse_verb_file) error: failed to open verb file /usr/share/alsa/ucm2/cht-bsw-rt5672/HiFi-stereo-dmic2.conf : 0 ALSA lib main.c:962:(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
Regards,
Hans
Re: [PATCH 5/5] cht-bsw-rt5672: Fix HiFi-stereo-dmic2 conf not loading / working
Hi,
Quoted 67 lines · Hans de Goede
Hi,
Quoted 34 lines · Jaroslav Kysela
Dne 05. 04. 20 v 20:34 Hans de Goede napsal(a):
Quoted 7 lines
Fix HiFi-stereo-dmic2 conf not loading because of references to non existing devices in the ConflictingDevices sections.
Stop playing Rename + Remove tricks with the output (Speaker2) and input (DMIC1) devices which we do not want to be part of this config, this does not work now that we only allow devices which are actually part of our config in the ConflictingDevices sections.
The Remove and Rename operations should also manage (remove and rename) devices in ConflictingDevices/SupportedDevices sections. What's the exact error you hit?
If I simulate this via ucm-validator I get this device structure:
Verb: "HiFi"
File: HiFi-stereo-dmic2.conf
Device: "Headphones"
ConflictingDevices.0 = Speaker
Value.PlaybackPriority = 300
Value.PlaybackPCM = 'hw:${CardId}'
Value.JackControl = 'Headphone Jack'
Device: "Headset"
ConflictingDevices.0 = Mic
Value.CapturePriority = 300
Value.CapturePCM = 'hw:${CardId}'
Value.JackControl = 'Headset Mic Jack'
Device: "Speaker"
ConflictingDevices.0 = Headphones
Value.PlaybackPriority = 200
Value.PlaybackPCM = 'hw:${CardId}'
Device: "Mic"
ConflictingDevices.0 = Headset
Value.CapturePriority = 200
Value.CapturePCM = 'hw:${CardId}'Quoted 1 line
It appears like an issue in alsa-lib.
Ok so I found the following weird:
RemoveDevice."Speaker2" "Speaker2"
At a hunch I removed the extra "Speaker2", now I get:
[hans@localhost ~]$ alsaucm -c cht-bsw-rt5672 set
_verbHiFi set_enadevSpeaker ALSA lib parser.c:1138:(verb_dev_list_add) error: unable to find device 'Mic1'
...Notice the error changed from being about Speaker2 to Mic1, so this looks good, but then I did the same with the:
RemoveDevice."Mic1" "Mic1"
Line, dropping the extra "Mic1" I get:
[hans@localhost ~]$ alsaucm -c cht-bsw-rt5672 set
_verbHiFi set_enadevSpeaker ALSA lib parser.c:1183:(verb_device_management) error: cannot remove device 'Mic'
...Which is weird...
Even weirder I was thinking that the Rename + Remove lines should be after the last include, so that they also get applied to the Conflicting devices of e.g . the Headphones Section Device, but if I move the Rename + Remove lines for the Mic to the end of the HiFi-stereo-dmic2.conf file I get:
Quoted 6 lines
[hans@localhost ~]$ alsaucm -c cht-bsw-rt5672 set
_verbHiFi set_enadevSpeaker
ALSA lib conf.c:1928:(_snd_config_load_with_include) _toplevel_:23:0:Unexpected end of file
ALSA lib utils.c:285:(uc_mgr_config_load) could not load configuration file/usr/share/alsa/ucm2/cht-bsw-rt5672/HiFi-stereo-dmic2.confALSA lib parser.c:1349:(parse_verb_file) error: failed to open verb file/usr/share/alsa/ucm2/cht-bsw-rt5672/HiFi-stereo-dmic2.conf: 0 ALSA lib main.c:962:(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
Last mail, sorry about the spam.
Ok, this is caused by me removing the extra "Mic1" at the end of the RemoveDevice line.
Things still do not work with the in my mind more logical order of having these at the end though.
Regards,
Hans
Jaroslav Kysela
AppliedDne 05. 04. 20 v 20:34 Hans de Goede napsal(a):
Quoted 27 lines
The kernel sets cfg-mic:dmic not cfg-mic:dmic1 when a digital mic is used. The wrong check for cfg-mic:dmic1 causes there to be no "Mic" device at all, which causes the check for the ConflictingDevices section of the HeadSet (mic) device to fail like e.g. so:
[hans@localhost ~]$ alsaucm -c bytcr-rt5651 set
_verbHiFi set_enadevSpeaker
ALSA lib parser.c:1138:(verb_dev_list_add) error: unable to find device 'Mic'
ALSA lib parser.c:1433:(parse_verb_file) error: device management error in verb 'HiFi' ALSA lib main.c:962:(snd_use_case_mgr_open) error: failed to import bytcr-rt5651 use case configuration -2
alsaucm: error failed to open sound card bytcr-rt5651: No such file or directoryThis commit fixes this.
Signed-off-by Hans de Goede <[email protected]>--- ucm2/bytcr-rt5651/HiFi-Components.conf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)ucm2/bytcr-rt5651/HiFi-Components.conf +0
-0@@ -34,11 +34,11 @@ If.headphones { } }
ucm2/bytcr-rt5651/HiFi-Components.conf If.headphones { · line 44
Quoted 10 lines
ucm2/bytcr-rt5651/HiFi-Components.conf +2
-2-If.dmic1 { +If.dmic { Condition { Type String Haystack "${CardComponents}" - Needle "cfg-mic:dmic1" + Needle "cfg-mic:dmic" } True { <codecs/rt5651/DigitalMic.conf>
Applied. Thanks.
Jaroslav
Signature · 2 lines
Jaroslav Kysela <[email protected]> Linux Sound Maintainer; ALSA Project; Red Hat, Inc.