bytcr-rt5640: Fixes and improvements
cover 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
PATCH 1/5 bytcr-rt5640: Fix 'Headphone Switch' / 'Headset Mic Switch' no longer getting set
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.
--- ucm2/bytcr-rt5640/HiFi.conf | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-)
ucm2/bytcr-rt5640/HiFi.conf +20 -16
@@ -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" + ] + } } }
Signature · 1 line
2.31.1
PATCH 2/5 codecs/rt5640: Rename DAPM PIN switches to avoid having 2 Speaker and Headphones switches
In reply to Hans de GoedeNow 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.
--- ucm2/codecs/rt5640/init.conf | 5 +++++ 1 file changed, 5 insertions(+)
ucm2/codecs/rt5640/init.conf +5 -0
@@ -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'" }
Signature · 1 line
2.31.1
PATCH 3/5 bytcr-rt5640: Add support for devices using the DMIC2 input for their internal mic(s)
In reply to Hans de GoedeAdd support for devices using the DMIC2 input for their internal mic(s), this has been tested on a HP Elitepad 1000 G2.
--- 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(-)
ucm2/Tegra/rt5640/Google-Nexus-7-HiFi.conf +2 -1
@@ -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"
ucm2/bytcr-rt5640/HiFi-Components.conf +16 -1
@@ -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 {
ucm2/bytcr-rt5640/HiFi-LongName.conf +4 -1
@@ -22,7 +22,10 @@ If.dmic1 { Haystack "${CardLongName}" Needle "-dmic1-mic" } - True.Define.HaveInternalMic "dmic1" + True { + Define.HaveInternalMic "dmic" + Define.StereoADC2Mux "DMIC1" + } } If.in1 {
ucm2/bytcr-rt5640/HiFi.conf +3 -2
@@ -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"
ucm2/codecs/rt5640/DigitalMics.conf +1 -0
@@ -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"
ucm2/codecs/rt5640/EnableSeq.conf +0 -1
@@ -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"
Signature · 1 line
2.31.1
PATCH 4/5 bytcr-rt5640: Add support for a second headphones output
In reply to Hans de GoedeSome 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.
--- 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
ucm2/bytcr-rt5640/HiFi-Components.conf +9 -0
@@ -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
ucm2/bytcr-rt5640/HiFi.conf +18 -0
@@ -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
ucm2/codecs/rt5640/HeadPhones2.conf new file +46 -0
46 lines not on this page · raw message
Signature · 1 line
2.31.1
PATCH 5/5 bytcr-rt5640: Add support for a second headset input
In reply to Hans de GoedeSome 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.
--- 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
ucm2/bytcr-rt5640/HiFi-Components.conf +9 -0
@@ -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" +}
ucm2/bytcr-rt5640/HiFi.conf +22 -0
@@ -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" + ] + } + } +}
ucm2/codecs/rt5640/HeadsetMic2-IN1.conf new file +52 -0
52 lines not on this page · raw message
Signature · 1 line
2.31.1
Quoted 8 lines · Hans de Goede
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
Signature · 2 lines
Jaroslav Kysela <[email protected]> Linux Sound Maintainer; ALSA Project; Red Hat, Inc.