[4/5] chtrt5645: Remove bogus JackHWMute settings
diff mbox series

Message ID 20200405183454.34515-4-hdegoede@redhat.com
State New
Headers show
Series
  • [1/5] bytcr-rt5651: Fix dmic check in HiFi-Components.conf
Related show

Commit Message

Hans de Goede April 5, 2020, 6:34 p.m. UTC
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(-)

Comments

Pierre-Louis Bossart April 5, 2020, 11:22 p.m. UTC | #1
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 [
>
Hans de Goede April 6, 2020, 7:32 a.m. UTC | #2
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 [
>>
>
Jaroslav Kysela April 6, 2020, 7:42 a.m. UTC | #3
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
Pierre-Louis Bossart April 6, 2020, 3:17 p.m. UTC | #4
>> 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.
Hans de Goede April 6, 2020, 4:58 p.m. UTC | #5
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
Jaroslav Kysela April 6, 2020, 5:10 p.m. UTC | #6
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
> 
>
Pierre-Louis Bossart April 6, 2020, 6:36 p.m. UTC | #7
>>> 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:
youling 257 April 13, 2020, 1:19 p.m. UTC | #8
please also remove es8316 HeadPhones.conf JackHWMute "Speaker"
Hans de Goede April 13, 2020, 2:39 p.m. UTC | #9
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
youling 257 April 13, 2020, 3:18 p.m. UTC | #10
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
>
>

Patch
diff mbox series

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 [