[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.
Signed-off-by: Hans de Goede hdegoede@redhat.com --- ucm2/bytcr-rt5651/HiFi-Components.conf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/ucm2/bytcr-rt5651/HiFi-Components.conf b/ucm2/bytcr-rt5651/HiFi-Components.conf index 53ebcbe..d0a573e 100644 --- a/ucm2/bytcr-rt5651/HiFi-Components.conf +++ b/ucm2/bytcr-rt5651/HiFi-Components.conf @@ -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>
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 hdegoede@redhat.com --- ucm2/chtrt5645/ASUSTeKCOMPUTERINC.-T100HAN-1.0.conf | 1 + 1 file changed, 1 insertion(+) create mode 120000 ucm2/chtrt5645/ASUSTeKCOMPUTERINC.-T100HAN-1.0.conf
diff --git a/ucm2/chtrt5645/ASUSTeKCOMPUTERINC.-T100HAN-1.0.conf b/ucm2/chtrt5645/ASUSTeKCOMPUTERINC.-T100HAN-1.0.conf new file mode 120000 index 0000000..b4d2816 --- /dev/null +++ b/ucm2/chtrt5645/ASUSTeKCOMPUTERINC.-T100HAN-1.0.conf @@ -0,0 +1 @@ +chtrt5645-dmic1.conf \ No newline at end of file
Dne 05. 04. 20 v 20:34 Hans de Goede napsal(a):
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 hdegoede@redhat.com
ucm2/chtrt5645/ASUSTeKCOMPUTERINC.-T100HAN-1.0.conf | 1 + 1 file changed, 1 insertion(+) create mode 120000 ucm2/chtrt5645/ASUSTeKCOMPUTERINC.-T100HAN-1.0.conf
diff --git a/ucm2/chtrt5645/ASUSTeKCOMPUTERINC.-T100HAN-1.0.conf b/ucm2/chtrt5645/ASUSTeKCOMPUTERINC.-T100HAN-1.0.conf new file mode 120000 index 0000000..b4d2816 --- /dev/null +++ b/ucm2/chtrt5645/ASUSTeKCOMPUTERINC.-T100HAN-1.0.conf @@ -0,0 +1 @@ +chtrt5645-dmic1.conf \ No newline at end of file
Applied. Thanks.
Jaroslav
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 hdegoede@redhat.com --- 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
diff --git a/ucm2/chtrt5645/MEDION-E1239TMD60568-0.1-Wingman.conf b/ucm2/chtrt5645/MEDION-E1239TMD60568-0.1-Wingman.conf new file mode 120000 index 0000000..7823e31 --- /dev/null +++ b/ucm2/chtrt5645/MEDION-E1239TMD60568-0.1-Wingman.conf @@ -0,0 +1 @@ +chtrt5645-dmic2.conf \ No newline at end of file
Dne 05. 04. 20 v 20:34 Hans de Goede napsal(a):
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 hdegoede@redhat.com
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
diff --git a/ucm2/chtrt5645/MEDION-E1239TMD60568-0.1-Wingman.conf b/ucm2/chtrt5645/MEDION-E1239TMD60568-0.1-Wingman.conf new file mode 120000 index 0000000..7823e31 --- /dev/null +++ b/ucm2/chtrt5645/MEDION-E1239TMD60568-0.1-Wingman.conf @@ -0,0 +1 @@ +chtrt5645-dmic2.conf \ No newline at end of file
Applied. Thanks.
Jaroslav
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 hdegoede@redhat.com --- 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(-)
diff --git a/ucm2/chtrt5645/HiFi-dmic1.conf b/ucm2/chtrt5645/HiFi-dmic1.conf index 1a8ee0a..c7e12c9 100644 --- a/ucm2/chtrt5645/HiFi-dmic1.conf +++ b/ucm2/chtrt5645/HiFi-dmic1.conf @@ -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 [ diff --git a/ucm2/chtrt5645/HiFi-dmic2.conf b/ucm2/chtrt5645/HiFi-dmic2.conf index d3f880a..95fedb3 100644 --- a/ucm2/chtrt5645/HiFi-dmic2.conf +++ b/ucm2/chtrt5645/HiFi-dmic2.conf @@ -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 [ diff --git a/ucm2/chtrt5645/HiFi-mono-speaker-analog-mic.conf b/ucm2/chtrt5645/HiFi-mono-speaker-analog-mic.conf index db866cd..f6180a4 100644 --- a/ucm2/chtrt5645/HiFi-mono-speaker-analog-mic.conf +++ b/ucm2/chtrt5645/HiFi-mono-speaker-analog-mic.conf @@ -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 [ diff --git a/ucm2/chtrt5645/HiFi.conf b/ucm2/chtrt5645/HiFi.conf index 58468a8..116d456 100644 --- a/ucm2/chtrt5645/HiFi.conf +++ b/ucm2/chtrt5645/HiFi.conf @@ -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 [
On 4/5/20 1:34 PM, Hans de Goede wrote:
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?
Signed-off-by: Hans de Goede hdegoede@redhat.com
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(-)
diff --git a/ucm2/chtrt5645/HiFi-dmic1.conf b/ucm2/chtrt5645/HiFi-dmic1.conf index 1a8ee0a..c7e12c9 100644 --- a/ucm2/chtrt5645/HiFi-dmic1.conf +++ b/ucm2/chtrt5645/HiFi-dmic1.conf @@ -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 [
diff --git a/ucm2/chtrt5645/HiFi-dmic2.conf b/ucm2/chtrt5645/HiFi-dmic2.conf index d3f880a..95fedb3 100644 --- a/ucm2/chtrt5645/HiFi-dmic2.conf +++ b/ucm2/chtrt5645/HiFi-dmic2.conf @@ -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 [
diff --git a/ucm2/chtrt5645/HiFi-mono-speaker-analog-mic.conf b/ucm2/chtrt5645/HiFi-mono-speaker-analog-mic.conf index db866cd..f6180a4 100644 --- a/ucm2/chtrt5645/HiFi-mono-speaker-analog-mic.conf +++ b/ucm2/chtrt5645/HiFi-mono-speaker-analog-mic.conf @@ -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 [
diff --git a/ucm2/chtrt5645/HiFi.conf b/ucm2/chtrt5645/HiFi.conf index 58468a8..116d456 100644 --- a/ucm2/chtrt5645/HiFi.conf +++ b/ucm2/chtrt5645/HiFi.conf @@ -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 [
Hi,
On 4/6/20 1:22 AM, Pierre-Louis Bossart wrote:
On 4/5/20 1:34 PM, Hans de Goede wrote:
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?
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.conf ucm2/chtrt5650/HiFi.conf ucm2/hda-dsp/HiFi.conf ucm2/codecs/es8316/HeadPhones.conf ucm2/sof-bdw-rt5677/HiFi.conf ucm2/broxton-rt298/HiFi.conf ucm2/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
Signed-off-by: Hans de Goede hdegoede@redhat.com
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(-)
diff --git a/ucm2/chtrt5645/HiFi-dmic1.conf b/ucm2/chtrt5645/HiFi-dmic1.conf index 1a8ee0a..c7e12c9 100644 --- a/ucm2/chtrt5645/HiFi-dmic1.conf +++ b/ucm2/chtrt5645/HiFi-dmic1.conf @@ -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 [ diff --git a/ucm2/chtrt5645/HiFi-dmic2.conf b/ucm2/chtrt5645/HiFi-dmic2.conf index d3f880a..95fedb3 100644 --- a/ucm2/chtrt5645/HiFi-dmic2.conf +++ b/ucm2/chtrt5645/HiFi-dmic2.conf @@ -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 [ diff --git a/ucm2/chtrt5645/HiFi-mono-speaker-analog-mic.conf b/ucm2/chtrt5645/HiFi-mono-speaker-analog-mic.conf index db866cd..f6180a4 100644 --- a/ucm2/chtrt5645/HiFi-mono-speaker-analog-mic.conf +++ b/ucm2/chtrt5645/HiFi-mono-speaker-analog-mic.conf @@ -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 [ diff --git a/ucm2/chtrt5645/HiFi.conf b/ucm2/chtrt5645/HiFi.conf index 58468a8..116d456 100644 --- a/ucm2/chtrt5645/HiFi.conf +++ b/ucm2/chtrt5645/HiFi.conf @@ -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 [
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.conf ucm2/chtrt5650/HiFi.conf ucm2/hda-dsp/HiFi.conf ucm2/codecs/es8316/HeadPhones.conf ucm2/sof-bdw-rt5677/HiFi.conf ucm2/broxton-rt298/HiFi.conf ucm2/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.
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.
Hi,
On 4/6/20 5:17 PM, Pierre-Louis Bossart wrote:
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.conf ucm2/chtrt5650/HiFi.conf ucm2/hda-dsp/HiFi.conf ucm2/codecs/es8316/HeadPhones.conf ucm2/sof-bdw-rt5677/HiFi.conf ucm2/broxton-rt298/HiFi.conf ucm2/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.
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
Dne 06. 04. 20 v 18:58 Hans de Goede napsal(a):
Hi,
On 4/6/20 5:17 PM, Pierre-Louis Bossart wrote:
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.conf ucm2/chtrt5650/HiFi.conf ucm2/hda-dsp/HiFi.conf ucm2/codecs/es8316/HeadPhones.conf ucm2/sof-bdw-rt5677/HiFi.conf ucm2/broxton-rt298/HiFi.conf ucm2/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.
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.
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
Regards,
Hans
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.
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:
Dne 05. 04. 20 v 20:34 Hans de Goede napsal(a):
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 hdegoede@redhat.com
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(-)
diff --git a/ucm2/chtrt5645/HiFi-dmic1.conf b/ucm2/chtrt5645/HiFi-dmic1.conf index 1a8ee0a..c7e12c9 100644 --- a/ucm2/chtrt5645/HiFi-dmic1.conf +++ b/ucm2/chtrt5645/HiFi-dmic1.conf @@ -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 [
diff --git a/ucm2/chtrt5645/HiFi-dmic2.conf b/ucm2/chtrt5645/HiFi-dmic2.conf index d3f880a..95fedb3 100644 --- a/ucm2/chtrt5645/HiFi-dmic2.conf +++ b/ucm2/chtrt5645/HiFi-dmic2.conf @@ -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 [
diff --git a/ucm2/chtrt5645/HiFi-mono-speaker-analog-mic.conf b/ucm2/chtrt5645/HiFi-mono-speaker-analog-mic.conf index db866cd..f6180a4 100644 --- a/ucm2/chtrt5645/HiFi-mono-speaker-analog-mic.conf +++ b/ucm2/chtrt5645/HiFi-mono-speaker-analog-mic.conf @@ -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 [
diff --git a/ucm2/chtrt5645/HiFi.conf b/ucm2/chtrt5645/HiFi.conf index 58468a8..116d456 100644 --- a/ucm2/chtrt5645/HiFi.conf +++ b/ucm2/chtrt5645/HiFi.conf @@ -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 [
Applied. Thanks.
Jaroslav
please also remove es8316 HeadPhones.conf JackHWMute "Speaker"
Hi,
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
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 hdegoede@redhat.com:
Hi,
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
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.
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.
BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1786723 Signed-off-by: Hans de Goede hdegoede@redhat.com --- 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(-)
diff --git a/ucm2/cht-bsw-rt5672/HiFi-stereo-dmic2.conf b/ucm2/cht-bsw-rt5672/HiFi-stereo-dmic2.conf index 82c976b..5e06b42 100644 --- a/ucm2/cht-bsw-rt5672/HiFi-stereo-dmic2.conf +++ b/ucm2/cht-bsw-rt5672/HiFi-stereo-dmic2.conf @@ -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" diff --git a/ucm2/cht-bsw-rt5672/HiFi.conf b/ucm2/cht-bsw-rt5672/HiFi.conf index 9a64cc3..2dfa479 100644 --- a/ucm2/cht-bsw-rt5672/HiFi.conf +++ b/ucm2/cht-bsw-rt5672/HiFi.conf @@ -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" diff --git a/ucm2/codecs/rt5672/DMIC1.conf b/ucm2/codecs/rt5672/DMIC1.conf index 2018283..acc26f7 100644 --- a/ucm2/codecs/rt5672/DMIC1.conf +++ b/ucm2/codecs/rt5672/DMIC1.conf @@ -2,7 +2,6 @@ SectionDevice."Mic1" { Comment "Internal Digital Microphone on DMIC1"
ConflictingDevice [ - "Mic2" "Headset" ]
diff --git a/ucm2/codecs/rt5672/DMIC2.conf b/ucm2/codecs/rt5672/DMIC2.conf index 48e6170..abe139b 100644 --- a/ucm2/codecs/rt5672/DMIC2.conf +++ b/ucm2/codecs/rt5672/DMIC2.conf @@ -2,7 +2,6 @@ SectionDevice."Mic2" { Comment "Internal Digital Microphone on DMIC2"
ConflictingDevice [ - "Mic1" "Headset" ]
diff --git a/ucm2/codecs/rt5672/HeadPhones.conf b/ucm2/codecs/rt5672/HeadPhones.conf index 2c8d6e8..9178607 100644 --- a/ucm2/codecs/rt5672/HeadPhones.conf +++ b/ucm2/codecs/rt5672/HeadPhones.conf @@ -2,8 +2,6 @@ SectionDevice."Headphones" { Comment "Headphones"
ConflictingDevice [ - "Speaker1" - "Speaker2" ]
EnableSequence [ diff --git a/ucm2/codecs/rt5672/HeadsetMic.conf b/ucm2/codecs/rt5672/HeadsetMic.conf index a764d82..e04c3ce 100644 --- a/ucm2/codecs/rt5672/HeadsetMic.conf +++ b/ucm2/codecs/rt5672/HeadsetMic.conf @@ -2,8 +2,6 @@ SectionDevice."Headset" { Comment "Headset Microphone"
ConflictingDevice [ - "Mic1" - "Mic2" ]
EnableSequence [ diff --git a/ucm2/codecs/rt5672/MonoSpeaker.conf b/ucm2/codecs/rt5672/MonoSpeaker.conf index f08c9c6..88c39d2 100644 --- a/ucm2/codecs/rt5672/MonoSpeaker.conf +++ b/ucm2/codecs/rt5672/MonoSpeaker.conf @@ -2,7 +2,6 @@ SectionDevice."Speaker2" { Comment "Mono Speaker"
ConflictingDevice [ - "Speaker1" "Headphones" ]
diff --git a/ucm2/codecs/rt5672/Speaker.conf b/ucm2/codecs/rt5672/Speaker.conf index 8b7bcf8..c70ffae 100644 --- a/ucm2/codecs/rt5672/Speaker.conf +++ b/ucm2/codecs/rt5672/Speaker.conf @@ -2,7 +2,6 @@ SectionDevice."Speaker1" { Comment "Stereo Speakers"
ConflictingDevice [ - "Speaker2" "Headphones" ]
Dne 05. 04. 20 v 20:34 Hans de Goede napsal(a):
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
Hi,
On 4/6/20 11:34 AM, Jaroslav Kysela wrote:
Dne 05. 04. 20 v 20:34 Hans de Goede napsal(a):
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.
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
Dne 06. 04. 20 v 11:50 Hans de Goede napsal(a):
Hi,
On 4/6/20 11:34 AM, Jaroslav Kysela wrote:
Dne 05. 04. 20 v 20:34 Hans de Goede napsal(a):
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.
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.
I think that I found the culprit. Could you test this, please?
https://github.com/alsa-project/alsa-lib/commit/c9605484d165d2b707f78eef14a2...
Thank you, Jaroslav
Hi,
On 4/6/20 1:28 PM, Jaroslav Kysela wrote:
Dne 06. 04. 20 v 11:50 Hans de Goede napsal(a):
Hi,
On 4/6/20 11:34 AM, Jaroslav Kysela wrote:
Dne 05. 04. 20 v 20:34 Hans de Goede napsal(a):
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.
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.
I think that I found the culprit. Could you test this, please?
https://github.com/alsa-project/alsa-lib/commit/c9605484d165d2b707f78eef14a2...
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
Dne 06. 04. 20 v 14:13 Hans de Goede napsal(a):
Hi,
On 4/6/20 1:28 PM, Jaroslav Kysela wrote:
Dne 06. 04. 20 v 11:50 Hans de Goede napsal(a):
Hi,
On 4/6/20 11:34 AM, Jaroslav Kysela wrote:
Dne 05. 04. 20 v 20:34 Hans de Goede napsal(a):
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.
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.
I think that I found the culprit. Could you test this, please?
https://github.com/alsa-project/alsa-lib/commit/c9605484d165d2b707f78eef14a2...
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' ...
Another one line fix:
https://github.com/alsa-project/alsa-lib/commit/fb48ad9e4f6b84fd4ade689bd79e...
Jaroslav
Regards,
Hans
Hi,
On 4/6/20 11:34 AM, Jaroslav Kysela wrote:
Dne 05. 04. 20 v 20:34 Hans de Goede napsal(a):
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.
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
Hi,
On 4/6/20 12:02 PM, Hans de Goede wrote:
Hi,
On 4/6/20 11:34 AM, Jaroslav Kysela wrote:
Dne 05. 04. 20 v 20:34 Hans de Goede napsal(a):
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.
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
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
Dne 05. 04. 20 v 20:34 Hans de Goede napsal(a):
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.
Signed-off-by: Hans de Goede hdegoede@redhat.com
ucm2/bytcr-rt5651/HiFi-Components.conf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/ucm2/bytcr-rt5651/HiFi-Components.conf b/ucm2/bytcr-rt5651/HiFi-Components.conf index 53ebcbe..d0a573e 100644 --- a/ucm2/bytcr-rt5651/HiFi-Components.conf +++ b/ucm2/bytcr-rt5651/HiFi-Components.conf @@ -34,11 +34,11 @@ If.headphones { } }
-If.dmic1 { +If.dmic { Condition { Type String Haystack "${CardComponents}"
Needle "cfg-mic:dmic1"
} True { <codecs/rt5651/DigitalMic.conf>Needle "cfg-mic:dmic"
Applied. Thanks.
Jaroslav
participants (5)
-
Hans de Goede
-
Jaroslav Kysela
-
Pierre-Louis Bossart
-
youling 257
-
youling257