[PATCH alsa-ucm-conf 0/5] bytcr-rt5640: Fixes and improvements
Hi Jaroslav,
Here is a patch series with 2 bug-fixes for X86 devices with a rt5640 codec (these 2 are a resend) + 3 patches adding support for the second headset-jack (on the dock) found on the HP elitepad 1000 G2.
The new kernel-bits for the second headset-jack have already landed, so this is ready for merging.
Regards,
Hans
Commit 446d0a71b47f ("codecs/rt5640: Move out BayTrail-specific pin switches") moved the setting of the 'Headphone Switch' / 'Headset Mic Switch' into "If.hp" resp "If.hsmic" blocks. But instead of making them part of the True {} block inside that If, the statements where added add the top-level of the If {} block where they are no-ops.
Move them to inside the True blocks so that these Switches again get properly turned on/off. This fixes the Headphones and Headset-mic no longer working on bytcr-rt5640 devices.
Cc: Dmitry Osipenko digetx@gmail.com Fixes: 446d0a71b47f ("codecs/rt5640: Move out BayTrail-specific pin switches") Signed-off-by: Hans de Goede hdegoede@redhat.com --- ucm2/bytcr-rt5640/HiFi.conf | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-)
diff --git a/ucm2/bytcr-rt5640/HiFi.conf b/ucm2/bytcr-rt5640/HiFi.conf index a5b47df..08127e0 100644 --- a/ucm2/bytcr-rt5640/HiFi.conf +++ b/ucm2/bytcr-rt5640/HiFi.conf @@ -100,16 +100,18 @@ If.mono {
If.hp { Condition { Type String Empty "" } - True.Include.hs.File "/codecs/rt5640/HeadPhones.conf" + True { + Include.hs.File "/codecs/rt5640/HeadPhones.conf"
- SectionDevice."Headphones" { - EnableSequence [ - cset "name='Headphone Switch' on" - ] + SectionDevice."Headphones" { + EnableSequence [ + cset "name='Headphone Switch' on" + ]
- DisableSequence [ - cset "name='Headphone Switch' off" - ] + DisableSequence [ + cset "name='Headphone Switch' off" + ] + } } }
@@ -178,15 +180,17 @@ If.in3 {
If.hsmic { Condition { Type String Empty "" } - True.Include.hsmic.File "/codecs/rt5640/HeadsetMic.conf" + True { + Include.hsmic.File "/codecs/rt5640/HeadsetMic.conf"
- SectionDevice."Headset" { - EnableSequence [ - cset "name='Headset Mic Switch' on" - ] + SectionDevice."Headset" { + EnableSequence [ + cset "name='Headset Mic Switch' on" + ]
- DisableSequence [ - cset "name='Headset Mic Switch' off" - ] + DisableSequence [ + cset "name='Headset Mic Switch' off" + ] + } } }
Now that we rename the mutes from their weird 'Channel Switch' postfix to the standard 'Playback Switch' postfix we end up having 2 Switches for the 'Speaker' resp. 'Headphones' volume controls, with 1 of the two getting ignored by the alsa-lib mixer code because it is duplicate.
This is caused by the bytcr-rt5640 machine driver adding DAPM PIN Switches which are named 'Headphone Switch' resp. 'Speaker Switch', rename these to 'Headphone Output Switch' / 'Speaker Output Switch' so that they get seen as separate controls by the alsa-lib mixer code.
Signed-off-by: Hans de Goede hdegoede@redhat.com --- ucm2/codecs/rt5640/init.conf | 5 +++++ 1 file changed, 5 insertions(+)
diff --git a/ucm2/codecs/rt5640/init.conf b/ucm2/codecs/rt5640/init.conf index 38baee4..0756b4a 100644 --- a/ucm2/codecs/rt5640/init.conf +++ b/ucm2/codecs/rt5640/init.conf @@ -5,8 +5,13 @@ LibraryConfig.remap.Config { "name='IN1 Boost'" "name='IN1 Boost Capture Volume'" "name='IN2 Boost'" "name='IN2 Boost Capture Volume'" "name='IN3 Boost'" "name='IN3 Boost Capture Volume'" + # Rename the 'Headphone Switch' DAPM PIN switch to avoid it getting + # grouped with 'Headphone Playback Volume' + "name='Headphone Switch'" "name='Headphone Output Switch'" "name='HP Playback Volume'" "name='Headphone Playback Volume'" "name='HP Channel Switch'" "name='Headphone Playback Switch'" + # Idem for the 'Speaker Switch' + "name='Speaker Switch'" "name='Speaker Output Switch'" "name='Speaker Channel Switch'" "name='Speaker Playback Switch'" }
Add support for devices using the DMIC2 input for their internal mic(s), this has been tested on a HP Elitepad 1000 G2.
Cc: Dmitry Osipenko digetx@gmail.com Signed-off-by: Hans de Goede hdegoede@redhat.com --- ucm2/Tegra/rt5640/Google-Nexus-7-HiFi.conf | 3 ++- ucm2/bytcr-rt5640/HiFi-Components.conf | 17 ++++++++++++++++- ucm2/bytcr-rt5640/HiFi-LongName.conf | 5 ++++- ucm2/bytcr-rt5640/HiFi.conf | 5 +++-- ucm2/codecs/rt5640/DigitalMics.conf | 1 + ucm2/codecs/rt5640/EnableSeq.conf | 1 - 6 files changed, 26 insertions(+), 6 deletions(-)
diff --git a/ucm2/Tegra/rt5640/Google-Nexus-7-HiFi.conf b/ucm2/Tegra/rt5640/Google-Nexus-7-HiFi.conf index 8156006..0cc5f4c 100644 --- a/ucm2/Tegra/rt5640/Google-Nexus-7-HiFi.conf +++ b/ucm2/Tegra/rt5640/Google-Nexus-7-HiFi.conf @@ -3,7 +3,8 @@ Define.HaveAif "1" Define.HaveSpeaker "2" Define.HaveHeadsetMic "" -Define.HaveInternalMic "dmic1" +Define.HaveInternalMic "dmic" +Define.StereoADC2Mux "DMIC1"
Include.hp.File "/codecs/rt5640/HeadPhones.conf" Include.mspk.File "/codecs/rt5640/Speaker.conf" diff --git a/ucm2/bytcr-rt5640/HiFi-Components.conf b/ucm2/bytcr-rt5640/HiFi-Components.conf index 729b2b6..39c7f36 100644 --- a/ucm2/bytcr-rt5640/HiFi-Components.conf +++ b/ucm2/bytcr-rt5640/HiFi-Components.conf @@ -22,7 +22,22 @@ If.dmic1 { Haystack "${CardComponents}" Needle "cfg-mic:dmic1" } - True.Define.HaveInternalMic "dmic1" + True { + Define.HaveInternalMic "dmic" + Define.StereoADC2Mux "DMIC1" + } +} + +If.dmic2 { + Condition { + Type String + Haystack "${CardComponents}" + Needle "cfg-mic:dmic2" + } + True { + Define.HaveInternalMic "dmic" + Define.StereoADC2Mux "DMIC2" + } }
If.in1 { diff --git a/ucm2/bytcr-rt5640/HiFi-LongName.conf b/ucm2/bytcr-rt5640/HiFi-LongName.conf index 7af2d4a..b2fb471 100644 --- a/ucm2/bytcr-rt5640/HiFi-LongName.conf +++ b/ucm2/bytcr-rt5640/HiFi-LongName.conf @@ -22,7 +22,10 @@ If.dmic1 { Haystack "${CardLongName}" Needle "-dmic1-mic" } - True.Define.HaveInternalMic "dmic1" + True { + Define.HaveInternalMic "dmic" + Define.StereoADC2Mux "DMIC1" + } }
If.in1 { diff --git a/ucm2/bytcr-rt5640/HiFi.conf b/ucm2/bytcr-rt5640/HiFi.conf index 08127e0..604e7d9 100644 --- a/ucm2/bytcr-rt5640/HiFi.conf +++ b/ucm2/bytcr-rt5640/HiFi.conf @@ -4,6 +4,7 @@ Define.HaveAif "" Define.HaveSpeaker "" Define.HaveInternalMic "" Define.HaveHeadsetMic "yes" +Define.StereoADC2Mux "DMIC1"
If.DefineAif1 { Condition { @@ -115,11 +116,11 @@ If.hp { } }
-If.dmic1 { +If.dmic { Condition { Type String Haystack "${var:HaveInternalMic}" - Needle "dmic1" + Needle "dmic" } True { Include.dmic.File "/codecs/rt5640/DigitalMics.conf" diff --git a/ucm2/codecs/rt5640/DigitalMics.conf b/ucm2/codecs/rt5640/DigitalMics.conf index b4d01ae..188df0a 100644 --- a/ucm2/codecs/rt5640/DigitalMics.conf +++ b/ucm2/codecs/rt5640/DigitalMics.conf @@ -14,6 +14,7 @@ SectionDevice."Mic" { }
EnableSequence [ + cset "name='Stereo ADC2 Mux' ${var:StereoADC2Mux}" cset "name='Mono ADC MIXL ADC2 Switch' on" cset "name='Mono ADC MIXR ADC2 Switch' on" cset "name='Stereo ADC MIXL ADC2 Switch' on" diff --git a/ucm2/codecs/rt5640/EnableSeq.conf b/ucm2/codecs/rt5640/EnableSeq.conf index 4e9a6c0..d9d536c 100644 --- a/ucm2/codecs/rt5640/EnableSeq.conf +++ b/ucm2/codecs/rt5640/EnableSeq.conf @@ -30,7 +30,6 @@ EnableSequence [
# Input Configuration cset "name='Stereo ADC1 Mux' ADC" - cset "name='Stereo ADC2 Mux' DMIC1" cset "name='ADC Capture Switch' on"
cset "name='Mono ADC L1 Mux' ADCL"
Some devices (HP Elitepad 1000 G2) have a second headphones output (1 on the dock, 2nd on the tablet itself) which is implemented through the line-out output of the codec combined with an external hp-amp.
The kernel has recently gotten support for this setup and will advertise this to userspace by adding cfg-hp2:lineout to the components string, add support for this.
Signed-off-by: Hans de Goede hdegoede@redhat.com --- ucm2/bytcr-rt5640/HiFi-Components.conf | 9 +++++ ucm2/bytcr-rt5640/HiFi.conf | 18 ++++++++++ ucm2/codecs/rt5640/HeadPhones2.conf | 46 ++++++++++++++++++++++++++ 3 files changed, 73 insertions(+) create mode 100644 ucm2/codecs/rt5640/HeadPhones2.conf
diff --git a/ucm2/bytcr-rt5640/HiFi-Components.conf b/ucm2/bytcr-rt5640/HiFi-Components.conf index 39c7f36..3f941ac 100644 --- a/ucm2/bytcr-rt5640/HiFi-Components.conf +++ b/ucm2/bytcr-rt5640/HiFi-Components.conf @@ -16,6 +16,15 @@ If.mono { True.Define.HaveSpeaker "1" }
+If.hp2 { + Condition { + Type String + Haystack "${CardComponents}" + Needle "cfg-hp2:lineout" + } + True.Define.HaveHeadPhones2 "yes" +} + If.dmic1 { Condition { Type String diff --git a/ucm2/bytcr-rt5640/HiFi.conf b/ucm2/bytcr-rt5640/HiFi.conf index 604e7d9..2e099bd 100644 --- a/ucm2/bytcr-rt5640/HiFi.conf +++ b/ucm2/bytcr-rt5640/HiFi.conf @@ -2,6 +2,7 @@
Define.HaveAif "" Define.HaveSpeaker "" +Define.HaveHeadPhones2 "" Define.HaveInternalMic "" Define.HaveHeadsetMic "yes" Define.StereoADC2Mux "DMIC1" @@ -116,6 +117,23 @@ If.hp { } }
+If.hp2 { + Condition { Type String Empty "${var:HaveHeadPhones2}" } + False { + Include.hs.File "/codecs/rt5640/HeadPhones2.conf" + + SectionDevice."Headphones2" { + EnableSequence [ + cset "name='Line Out Switch' on" + ] + + DisableSequence [ + cset "name='Line Out Switch' off" + ] + } + } +} + If.dmic { Condition { Type String diff --git a/ucm2/codecs/rt5640/HeadPhones2.conf b/ucm2/codecs/rt5640/HeadPhones2.conf new file mode 100644 index 0000000..b75e420 --- /dev/null +++ b/ucm2/codecs/rt5640/HeadPhones2.conf @@ -0,0 +1,46 @@ +# The 2nd headset jack uses lineout with an external HP-amp + +SectionDevice."Headphones2" { + Comment "Headphones 2" + + ConflictingDevice [ + "Speaker" + "Headphones" + ] + + EnableSequence [ + cset "name='LOUT MIX OUTVOL L Switch' on" + cset "name='LOUT MIX OUTVOL R Switch' on" + cset "name='OUT Channel Switch' on" + ] + + DisableSequence [ + cset "name='LOUT MIX OUTVOL L Switch' off" + cset "name='LOUT MIX OUTVOL R Switch' off" + cset "name='OUT Channel Switch' off" + ] + + Value { + PlaybackPriority 400 + PlaybackPCM "hw:${CardId}" + JackControl "Line Out Jack" + PlaybackMixerElem "OUT" + PlaybackVolume "OUT Playback Volume" + If.HpAif1 { + Condition { + Type String + String1 "${var:HaveAif}" + String2 "1" + } + True.PlaybackMasterElem "DAC1" + } + If.HpAif2 { + Condition { + Type String + String1 "${var:HaveAif}" + String2 "2" + } + True.PlaybackMasterElem "DAC2" + } + } +}
Some devices (HP Elitepad 1000 G2) have a second headphones output (1 on the dock, 2nd on the tablet itself) the headset mic input of this second headset is connected to IN1, add support for this.
BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=213415 Signed-off-by: Hans de Goede hdegoede@redhat.com --- ucm2/bytcr-rt5640/HiFi-Components.conf | 9 +++++ ucm2/bytcr-rt5640/HiFi.conf | 22 +++++++++++ ucm2/codecs/rt5640/HeadsetMic2-IN1.conf | 52 +++++++++++++++++++++++++ 3 files changed, 83 insertions(+) create mode 100644 ucm2/codecs/rt5640/HeadsetMic2-IN1.conf
diff --git a/ucm2/bytcr-rt5640/HiFi-Components.conf b/ucm2/bytcr-rt5640/HiFi-Components.conf index 3f941ac..ae5fd05 100644 --- a/ucm2/bytcr-rt5640/HiFi-Components.conf +++ b/ucm2/bytcr-rt5640/HiFi-Components.conf @@ -66,3 +66,12 @@ If.in3 { } True.Define.HaveInternalMic "in3" } + +If.hs2 { + Condition { + Type String + Haystack "${CardComponents}" + Needle "cfg-hs2:in1" + } + True.Define.HaveHeadsetMic2 "in1" +} diff --git a/ucm2/bytcr-rt5640/HiFi.conf b/ucm2/bytcr-rt5640/HiFi.conf index 2e099bd..f758507 100644 --- a/ucm2/bytcr-rt5640/HiFi.conf +++ b/ucm2/bytcr-rt5640/HiFi.conf @@ -5,6 +5,7 @@ Define.HaveSpeaker "" Define.HaveHeadPhones2 "" Define.HaveInternalMic "" Define.HaveHeadsetMic "yes" +Define.HaveHeadsetMic2 "" Define.StereoADC2Mux "DMIC1"
If.DefineAif1 { @@ -213,3 +214,24 @@ If.hsmic { } } } + +If.hsmic2 { + Condition { + Type String + Haystack "${var:HaveHeadsetMic2}" + Needle "in1" + } + True { + Include.hsmic.File "/codecs/rt5640/HeadsetMic2-IN1.conf" + + SectionDevice."Headset2" { + EnableSequence [ + cset "name='Headset Mic 2 Switch' on" + ] + + DisableSequence [ + cset "name='Headset Mic 2 Switch' off" + ] + } + } +} diff --git a/ucm2/codecs/rt5640/HeadsetMic2-IN1.conf b/ucm2/codecs/rt5640/HeadsetMic2-IN1.conf new file mode 100644 index 0000000..ff05f82 --- /dev/null +++ b/ucm2/codecs/rt5640/HeadsetMic2-IN1.conf @@ -0,0 +1,52 @@ +SectionDevice."Headset2" { + Comment "Headset Microphone 2" + + ConflictingDevice [ + "Mic" + "Headset" + ] + + EnableSequence [ + cset "name='RECMIXL BST1 Switch' on" + cset "name='RECMIXR BST1 Switch' on" + + cset "name='Stereo ADC MIXL ADC1 Switch' on" + cset "name='Stereo ADC MIXR ADC1 Switch' on" + cset "name='Mono ADC MIXL ADC1 Switch' on" + cset "name='Mono ADC MIXR ADC1 Switch' on" + ] + + DisableSequence [ + cset "name='Stereo ADC MIXL ADC1 Switch' off" + cset "name='Stereo ADC MIXR ADC1 Switch' off" + cset "name='Mono ADC MIXL ADC1 Switch' off" + cset "name='Mono ADC MIXR ADC1 Switch' off" + + cset "name='RECMIXL BST1 Switch' off" + cset "name='RECMIXR BST1 Switch' off" + ] + + Value { + CapturePriority 300 + CapturePCM "hw:${CardId}" + JackControl "Headset Mic 2 Jack" + CaptureMixerElem "IN1 Boost" + CaptureVolume "IN1 Boost" + If.In1Aif1 { + Condition { + Type String + String1 "${var:HaveAif}" + String2 "1" + } + True.CaptureMasterElem "ADC" + } + If.In1Aif2 { + Condition { + Type String + String1 "${var:HaveAif}" + String2 "2" + } + True.CaptureMasterElem "Mono ADC" + } + } +}
On 29. 09. 21 11:11, Hans de Goede wrote:
Hi Jaroslav,
Here is a patch series with 2 bug-fixes for X86 devices with a rt5640 codec (these 2 are a resend) + 3 patches adding support for the second headset-jack (on the dock) found on the HP elitepad 1000 G2.
The new kernel-bits for the second headset-jack have already landed, so this is ready for merging.
Thank you for this update and your work. I applied all patches to the alsa-ucm-conf repo.
Jaroslav
participants (2)
-
Hans de Goede
-
Jaroslav Kysela