diff options
author | Jaroslav Kysela <perex@perex.cz> | 2019-11-20 18:59:00 +0100 |
---|---|---|
committer | Jaroslav Kysela <perex@perex.cz> | 2019-11-21 14:57:59 +0100 |
commit | faf69ec816a412da2e62d1bda00bb14ffb321495 (patch) | |
tree | dab208e10612139d5100aec06857df945734f392 /ucm2 | |
parent | 62ae6affd9f8cd415dbeca2d5ca70fce8ad197fd (diff) |
bytcr-rt5651: adapt to ucm2
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Diffstat (limited to 'ucm2')
-rw-r--r-- | ucm2/bytcr-rt5651/HiFi-Components.conf | 81 | ||||
-rw-r--r-- | ucm2/bytcr-rt5651/HiFi-LongName.conf | 81 | ||||
-rw-r--r-- | ucm2/bytcr-rt5651/HiFi.conf | 32 | ||||
-rw-r--r-- | ucm2/bytcr-rt5651/bytcr-rt5651.conf | 8 | ||||
-rw-r--r-- | ucm2/codecs/rt5651/DigitalMic.conf | 27 | ||||
-rw-r--r-- | ucm2/codecs/rt5651/EnableSeq.conf | 56 | ||||
-rw-r--r-- | ucm2/codecs/rt5651/HeadPhones-swapped.conf | 39 | ||||
-rw-r--r-- | ucm2/codecs/rt5651/HeadPhones.conf | 30 | ||||
-rw-r--r-- | ucm2/codecs/rt5651/IN1-InternalMic.conf | 31 | ||||
-rw-r--r-- | ucm2/codecs/rt5651/IN12-InternalMic.conf | 35 | ||||
-rw-r--r-- | ucm2/codecs/rt5651/IN2-HeadsetMic.conf | 32 | ||||
-rw-r--r-- | ucm2/codecs/rt5651/IN2-InternalMic.conf | 31 | ||||
-rw-r--r-- | ucm2/codecs/rt5651/IN3-HeadsetMic.conf | 32 | ||||
-rw-r--r-- | ucm2/codecs/rt5651/MonoSpeaker.conf | 47 | ||||
-rw-r--r-- | ucm2/codecs/rt5651/Speaker.conf | 29 |
15 files changed, 591 insertions, 0 deletions
diff --git a/ucm2/bytcr-rt5651/HiFi-Components.conf b/ucm2/bytcr-rt5651/HiFi-Components.conf new file mode 100644 index 0000000..235838e --- /dev/null +++ b/ucm2/bytcr-rt5651/HiFi-Components.conf @@ -0,0 +1,81 @@ +If.spk { + Condition { + Type String + Haystack "${CardComponents}" + Needle "cfg-spk:2" + } + True { + <codecs/rt5651/Speaker.conf> + } +} + +If.mono { + Condition { + Type String + Haystack "${CardComponents}" + Needle "cfg-spk:1" + } + True { + <codecs/rt5651/MonoSpeaker.conf> + } +} + +If.headphones { + Condition { + Type String + Haystack "${CardComponents}" + Needle "cfg-hp:lrswap" + } + True { + <codecs/rt5651/HeadPhones-swapped.conf> + } + False { + <codecs/rt5651/HeadPhones.conf> + } +} + +If.dmic1 { + Condition { + Type String + Haystack "${CardComponents}" + Needle "cfg-mic:dmic1" + } + True { + <codecs/rt5651/DigitalMic.conf> + } +} + +If.in1 { + Condition { + Type String + Haystack "${CardComponents}" + Needle "cfg-mic:in1" + } + True { + <codecs/rt5651/IN1-InternalMic.conf> + } +} + +If.in2 { + Condition { + Type String + Haystack "${CardComponents}" + Needle "cfg-mic:in2" + } + True { + <codecs/rt5651/IN2-InternalMic.conf> + } +} + +If.in12 { + Condition { + Type String + Haystack "${CardComponents}" + Needle "cfg-mic:in12" + } + True { + <codecs/rt5651/IN12-InternalMic.conf> + } +} + +<codecs/rt5651/IN3-HeadsetMic.conf> diff --git a/ucm2/bytcr-rt5651/HiFi-LongName.conf b/ucm2/bytcr-rt5651/HiFi-LongName.conf new file mode 100644 index 0000000..58eb722 --- /dev/null +++ b/ucm2/bytcr-rt5651/HiFi-LongName.conf @@ -0,0 +1,81 @@ +If.spk { + Condition { + Type String + Haystack "${CardLongName}" + Needle "-stereo-spk" + } + True { + <codecs/rt5651/Speaker.conf> + } +} + +If.mono { + Condition { + Type String + Haystack "${CardLongName}" + Needle "-mono-spk" + } + True { + <codecs/rt5651/MonoSpeaker.conf> + } +} + +If.headphones { + Condition { + Type String + Haystack "${CardLongName}" + Needle "-mic-hp-swapped" + } + True { + <codecs/rt5651/HeadPhones-swapped.conf> + } + False { + <codecs/rt5651/HeadPhones.conf> + } +} + +If.dmic1 { + Condition { + Type String + Haystack "${CardLongName}" + Needle "-dmic1-mic" + } + True { + <codecs/rt5651/DigitalMic.conf> + } +} + +If.in1 { + Condition { + Type String + Haystack "${CardLongName}" + Needle "-in1-mic" + } + True { + <codecs/rt5651/IN1-InternalMic.conf> + } +} + +If.in2 { + Condition { + Type String + Haystack "${CardLongName}" + Needle "-in2-mic" + } + True { + <codecs/rt5651/IN2-InternalMic.conf> + } +} + +If.in12 { + Condition { + Type String + Haystack "${CardLongName}" + Needle "-in12-mic" + } + True { + <codecs/rt5651/IN12-InternalMic.conf> + } +} + +<codecs/rt5651/IN3-HeadsetMic.conf> diff --git a/ucm2/bytcr-rt5651/HiFi.conf b/ucm2/bytcr-rt5651/HiFi.conf new file mode 100644 index 0000000..1f031f2 --- /dev/null +++ b/ucm2/bytcr-rt5651/HiFi.conf @@ -0,0 +1,32 @@ +# Adapted from https://github.com/plbossart/UCM/tree/master/bytcr-rt5651 + + +SectionVerb { + EnableSequence [ + <platforms/bytcr/PlatformEnableSeq.conf> + <codecs/rt5651/EnableSeq.conf> + ] + + DisableSequence [ + <platforms/bytcr/PlatformDisableSeq.conf> + ] + + Value { + PlaybackPCM "hw:${CardId}" + CapturePCM "hw:${CardId}" + } +} + +If.0 { + Condition { + Type String + Haystack "${CardComponents}" + Needle "cfg-spk:" + } + True { + <bytcr-rt5651/HiFi-Components.conf> + } + False { + <bytcr-rt5651/HiFi-LongName.conf> + } +} diff --git a/ucm2/bytcr-rt5651/bytcr-rt5651.conf b/ucm2/bytcr-rt5651/bytcr-rt5651.conf new file mode 100644 index 0000000..64888ba --- /dev/null +++ b/ucm2/bytcr-rt5651/bytcr-rt5651.conf @@ -0,0 +1,8 @@ +# Adapted from https://github.com/plbossart/UCM/tree/master/bytcr-rt5651 + +Syntax 2 + +SectionUseCase."HiFi" { + File "HiFi.conf" + Comment "Play HiFi quality Music" +} diff --git a/ucm2/codecs/rt5651/DigitalMic.conf b/ucm2/codecs/rt5651/DigitalMic.conf new file mode 100644 index 0000000..7a0c4d4 --- /dev/null +++ b/ucm2/codecs/rt5651/DigitalMic.conf @@ -0,0 +1,27 @@ +SectionDevice."DigitalMic" { + Comment "Internal Digital Microphone" + + ConflictingDevice [ + "InternalMic-IN1" + "InternalMic-IN2" + "InternalMic-IN12" + "HeadsetMic-IN2" + "HeadsetMic-IN3" + ] + + EnableSequence [ + cset "name='Stereo1 ADC MIXL ADC2 Switch' on" + cset "name='Stereo1 ADC MIXR ADC2 Switch' on" + cset "name='Internal Mic Switch' on" + ] + + DisableSequence [ + cset "name='Stereo1 ADC MIXL ADC2 Switch' off" + cset "name='Stereo1 ADC MIXR ADC2 Switch' off" + cset "name='Internal Mic Switch' off" + ] + + Value { + CaptureChannels 2 + } +} diff --git a/ucm2/codecs/rt5651/EnableSeq.conf b/ucm2/codecs/rt5651/EnableSeq.conf new file mode 100644 index 0000000..9c1386f --- /dev/null +++ b/ucm2/codecs/rt5651/EnableSeq.conf @@ -0,0 +1,56 @@ +# default state +cset "name='HPO MIX DAC1 Switch' on" +cset "name='HPO MIX HPVOL Switch' off" +cset "name='HPO L Playback Switch' off" +cset "name='HPO R Playback Switch' off" +cset "name='HPOVOL L Switch' on" +cset "name='HPOVOL R Switch' on" +cset "name='LOUT MIX DAC L1 Switch' on" +cset "name='LOUT MIX DAC R1 Switch' on" +cset "name='IF1 ASRC Switch' on" +cset "name='LOUT L Playback Switch' off" +cset "name='LOUT R Playback Switch' off" +cset "name='Stereo DAC MIXL DAC L1 Switch' on" +cset "name='Stereo DAC MIXL DAC R1 Switch' off" +cset "name='Stereo DAC MIXR DAC L1 Switch' off" +cset "name='Stereo DAC MIXR DAC R1 Switch' on" +cset "name='Stereo1 ADC MIXL ADC1 Switch' off" +cset "name='Stereo1 ADC MIXR ADC1 Switch' off" +cset "name='Stereo1 ADC MIXL ADC2 Switch' off" +cset "name='Stereo1 ADC MIXR ADC2 Switch' off" +cset "name='Stereo2 ADC MIXL ADC1 Switch' off" +cset "name='Stereo2 ADC MIXR ADC1 Switch' off" +cset "name='Stereo2 ADC MIXL ADC2 Switch' off" +cset "name='Stereo2 ADC MIXR ADC2 Switch' off" +cset "name='Headphone Switch' off" +cset "name='Speaker Switch' off" + +# volumes +cset "name='OUT Playback Volume' 31" +cset "name='HP Playback Volume' 31" +cset "name='DAC1 Playback Volume' 175" +cset "name='IN Capture Volume' 23" +# 47=0dB, 0.375 dB/step, set it to 6 dB to help with soft mics +cset "name='ADC Capture Volume' 63" +cset "name='ADC Capture Switch' on" +# Set ADC Boost Gain to 3dB higher vals result in too much noise +cset "name='ADC Boost Gain' 1" +# Set IN1, IN2 and IN3 internal mic boost to 1 +cset "name='IN1 Boost' 1" +cset "name='IN2 Boost' 1" +cset "name='IN3 Boost' 1" + +# input +cset "name='Stereo1 ADC L1 Mux' ADC" +cset "name='Stereo1 ADC R1 Mux' ADC" +cset "name='Stereo1 ADC L2 Mux' DMIC" +cset "name='Stereo1 ADC R2 Mux' DMIC" +cset "name='RECMIXL BST1 Switch' off" +cset "name='RECMIXR BST1 Switch' off" +cset "name='RECMIXL BST3 Switch' off" +cset "name='RECMIXR BST3 Switch' off" +cset "name='RECMIXL BST2 Switch' off" +cset "name='RECMIXR BST2 Switch' off" +cset "name='Headset Mic Switch' off" +cset "name='Internal Mic Switch' off" +cset "name='Line In Switch' off" diff --git a/ucm2/codecs/rt5651/HeadPhones-swapped.conf b/ucm2/codecs/rt5651/HeadPhones-swapped.conf new file mode 100644 index 0000000..f5260a3 --- /dev/null +++ b/ucm2/codecs/rt5651/HeadPhones-swapped.conf @@ -0,0 +1,39 @@ +SectionDevice."Headphones" { + Comment "Headphones" + + ConflictingDevice [ + "Speaker" + "MonoSpeaker" + ] + + EnableSequence [ + # Swap left and right + cset "name='Stereo DAC MIXL DAC R1 Switch' on" + cset "name='Stereo DAC MIXL DAC L1 Switch' off" + cset "name='Stereo DAC MIXR DAC L1 Switch' on" + cset "name='Stereo DAC MIXR DAC R1 Switch' off" + + cset "name='Headphone Switch' on" + cset "name='HPO L Playback Switch' on" + cset "name='HPO R Playback Switch' on" + # Done after turning the HP on to keep the bias and clk on + cset "name='Speaker Switch' off" + cset "name='LOUT L Playback Switch' off" + cset "name='LOUT R Playback Switch' off" + ] + + DisableSequence [ + # Disabling the HP switches is done by the Speaker EnableSeq + + # Unswap left and right + cset "name='Stereo DAC MIXL DAC L1 Switch' on" + cset "name='Stereo DAC MIXL DAC R1 Switch' off" + cset "name='Stereo DAC MIXR DAC R1 Switch' on" + cset "name='Stereo DAC MIXR DAC L1 Switch' off" + ] + + Value { + PlaybackChannels "2" + JackControl "Headphone Jack" + } +} diff --git a/ucm2/codecs/rt5651/HeadPhones.conf b/ucm2/codecs/rt5651/HeadPhones.conf new file mode 100644 index 0000000..0a87b32 --- /dev/null +++ b/ucm2/codecs/rt5651/HeadPhones.conf @@ -0,0 +1,30 @@ +SectionDevice."Headphones" { + Comment "Headphones" + + ConflictingDevice [ + "Speaker" + "MonoSpeaker" + ] + + EnableSequence [ + cset "name='Headphone Switch' on" + cset "name='HPO L Playback Switch' on" + cset "name='HPO R Playback Switch' on" + # Done after turning the HP on to keep the bias and clk on + cset "name='Speaker Switch' off" + cset "name='LOUT L Playback Switch' off" + cset "name='LOUT R Playback Switch' off" + ] + + DisableSequence [ + # This is done by the Speaker EnableSequence, so that the + # Platform Clock and BIAS do not temporarily get turned off + # as that breaks audio-streams which are playing when + # switching between Speaker/Headphone + ] + + Value { + PlaybackChannels "2" + JackControl "Headphone Jack" + } +} diff --git a/ucm2/codecs/rt5651/IN1-InternalMic.conf b/ucm2/codecs/rt5651/IN1-InternalMic.conf new file mode 100644 index 0000000..01b786e --- /dev/null +++ b/ucm2/codecs/rt5651/IN1-InternalMic.conf @@ -0,0 +1,31 @@ +SectionDevice."InternalMic-IN1" { + Comment "Internal Microphone on IN1" + + ConflictingDevice [ + "DigitalMic" + "InternalMic-IN2" + "InternalMic-IN12" + "HeadsetMic-IN2" + "HeadsetMic-IN3" + ] + + EnableSequence [ + cset "name='Internal Mic Switch' on" + cset "name='RECMIXL BST1 Switch' on" + cset "name='RECMIXR BST1 Switch' on" + cset "name='Stereo1 ADC MIXL ADC1 Switch' on" + cset "name='Stereo1 ADC MIXR ADC1 Switch' on" + ] + + DisableSequence [ + cset "name='Stereo1 ADC MIXL ADC1 Switch' off" + cset "name='Stereo1 ADC MIXR ADC1 Switch' off" + cset "name='Internal Mic Switch' off" + cset "name='RECMIXL BST1 Switch' off" + cset "name='RECMIXR BST1 Switch' off" + ] + + Value { + CaptureChannels "2" + } +} diff --git a/ucm2/codecs/rt5651/IN12-InternalMic.conf b/ucm2/codecs/rt5651/IN12-InternalMic.conf new file mode 100644 index 0000000..44cc53a --- /dev/null +++ b/ucm2/codecs/rt5651/IN12-InternalMic.conf @@ -0,0 +1,35 @@ +SectionDevice."InternalMic-IN12" { + Comment "Internal Microphones on IN1 and IN2" + + ConflictingDevice [ + "DigitalMic" + "InternalMic-IN1" + "InternalMic-IN2" + "HeadsetMic-IN2" + "HeadsetMic-IN3" + ] + + EnableSequence [ + cset "name='Internal Mic Switch' on" + cset "name='RECMIXL BST1 Switch' on" + cset "name='RECMIXR BST1 Switch' on" + cset "name='RECMIXL BST2 Switch' on" + cset "name='RECMIXR BST2 Switch' on" + cset "name='Stereo1 ADC MIXL ADC1 Switch' on" + cset "name='Stereo1 ADC MIXR ADC1 Switch' on" + ] + + DisableSequence [ + cset "name='Stereo1 ADC MIXL ADC1 Switch' off" + cset "name='Stereo1 ADC MIXR ADC1 Switch' off" + cset "name='Internal Mic Switch' off" + cset "name='RECMIXL BST1 Switch' off" + cset "name='RECMIXR BST1 Switch' off" + cset "name='RECMIXL BST2 Switch' off" + cset "name='RECMIXR BST2 Switch' off" + ] + + Value { + CaptureChannels "2" + } +} diff --git a/ucm2/codecs/rt5651/IN2-HeadsetMic.conf b/ucm2/codecs/rt5651/IN2-HeadsetMic.conf new file mode 100644 index 0000000..177f70b --- /dev/null +++ b/ucm2/codecs/rt5651/IN2-HeadsetMic.conf @@ -0,0 +1,32 @@ +SectionDevice."HeadsetMic-IN2" { + Comment "Headset Microphone on IN2" + + ConflictingDevice [ + "DigitalMic" + "InternalMic-IN1" + "InternalMic-IN2" + "InternalMic-IN12" + "HeadsetMic-IN3" + ] + + EnableSequence [ + cset "name='Headset Mic Switch' on" + cset "name='RECMIXL BST2 Switch' on" + cset "name='RECMIXR BST2 Switch' on" + cset "name='Stereo1 ADC MIXL ADC1 Switch' on" + cset "name='Stereo1 ADC MIXR ADC1 Switch' on" + ] + + DisableSequence [ + cset "name='Stereo1 ADC MIXL ADC1 Switch' off" + cset "name='Stereo1 ADC MIXR ADC1 Switch' off" + cset "name='Headset Mic Switch' off" + cset "name='RECMIXL BST2 Switch' off" + cset "name='RECMIXR BST2 Switch' off" + ] + + Value { + CaptureChannels "2" + JackControl "Headset Mic Jack" + } +} diff --git a/ucm2/codecs/rt5651/IN2-InternalMic.conf b/ucm2/codecs/rt5651/IN2-InternalMic.conf new file mode 100644 index 0000000..611ca6c --- /dev/null +++ b/ucm2/codecs/rt5651/IN2-InternalMic.conf @@ -0,0 +1,31 @@ +SectionDevice."InternalMic-IN2" { + Comment "Internal Microphone on IN2" + + ConflictingDevice [ + "DigitalMic" + "InternalMic-IN1" + "InternalMic-IN12" + "HeadsetMic-IN2" + "HeadsetMic-IN3" + ] + + EnableSequence [ + cset "name='Internal Mic Switch' on" + cset "name='RECMIXL BST2 Switch' on" + cset "name='RECMIXR BST2 Switch' on" + cset "name='Stereo1 ADC MIXL ADC1 Switch' on" + cset "name='Stereo1 ADC MIXR ADC1 Switch' on" + ] + + DisableSequence [ + cset "name='Stereo1 ADC MIXL ADC1 Switch' off" + cset "name='Stereo1 ADC MIXR ADC1 Switch' off" + cset "name='Internal Mic Switch' off" + cset "name='RECMIXL BST2 Switch' off" + cset "name='RECMIXR BST2 Switch' off" + ] + + Value { + CaptureChannels "2" + } +} diff --git a/ucm2/codecs/rt5651/IN3-HeadsetMic.conf b/ucm2/codecs/rt5651/IN3-HeadsetMic.conf new file mode 100644 index 0000000..3231e78 --- /dev/null +++ b/ucm2/codecs/rt5651/IN3-HeadsetMic.conf @@ -0,0 +1,32 @@ +SectionDevice."HeadsetMic-IN3" { + Comment "Headset Microphone on IN3" + + ConflictingDevice [ + "DigitalMic" + "InternalMic-IN1" + "InternalMic-IN2" + "InternalMic-IN12" + "HeadsetMic-IN2" + ] + + EnableSequence [ + cset "name='Headset Mic Switch' on" + cset "name='RECMIXL BST3 Switch' on" + cset "name='RECMIXR BST3 Switch' on" + cset "name='Stereo1 ADC MIXL ADC1 Switch' on" + cset "name='Stereo1 ADC MIXR ADC1 Switch' on" + ] + + DisableSequence [ + cset "name='Stereo1 ADC MIXL ADC1 Switch' off" + cset "name='Stereo1 ADC MIXR ADC1 Switch' off" + cset "name='Headset Mic Switch' off" + cset "name='RECMIXL BST3 Switch' off" + cset "name='RECMIXR BST3 Switch' off" + ] + + Value { + CaptureChannels "2" + JackControl "Headset Mic Jack" + } +} diff --git a/ucm2/codecs/rt5651/MonoSpeaker.conf b/ucm2/codecs/rt5651/MonoSpeaker.conf new file mode 100644 index 0000000..c2276c6 --- /dev/null +++ b/ucm2/codecs/rt5651/MonoSpeaker.conf @@ -0,0 +1,47 @@ +SectionDevice."MonoSpeaker" { + Comment "Mono Speaker" + + ConflictingDevice [ + "Speaker" + "Headphones" + ] + + EnableSequence [ + # On most (all?) devices with a single / mono speaker an + # amplifier with a differential input connected between LOUT + # right and left is used. We deal with this by silencing the + # right output and mixing left + right to the left output. + # + # An alternative approach for devices using the differential + # setup would be to set bit 15 of register 5 in the codec, + # which turns the stereo unbalanced line out into a mono + # balanced line out. + # + # This possibility was discovered after we already shipped the + # current solution and the current solution has the advantage + # of also working on devices which only use LOUT left in + # unbalanced mode. The net result is the same for devices using + # the differential setup, so we just stick with what we have. + cset "name='Stereo DAC MIXR DAC R1 Switch' off" + cset "name='Stereo DAC MIXL DAC R1 Switch' on" + + cset "name='Speaker Switch' on" + cset "name='LOUT L Playback Switch' on" + # Done after turning the speaker on to keep the bias and clk on + cset "name='Headphone Switch' off" + cset "name='HPO L Playback Switch' off" + cset "name='HPO R Playback Switch' off" + ] + + DisableSequence [ + # Disabling the switches is done by the Speaker EnableSeq + + # Undo mono mapping + cset "name='Stereo DAC MIXL DAC R1 Switch' off" + cset "name='Stereo DAC MIXR DAC R1 Switch' on" + ] + + Value { + PlaybackChannels "2" + } +} diff --git a/ucm2/codecs/rt5651/Speaker.conf b/ucm2/codecs/rt5651/Speaker.conf new file mode 100644 index 0000000..463d13b --- /dev/null +++ b/ucm2/codecs/rt5651/Speaker.conf @@ -0,0 +1,29 @@ +SectionDevice."Speaker" { + Comment "Speakers" + + ConflictingDevice [ + "MonoSpeaker" + "Headphones" + ] + + EnableSequence [ + cset "name='Speaker Switch' on" + cset "name='LOUT L Playback Switch' on" + cset "name='LOUT R Playback Switch' on" + # Done after turning the speaker on to keep the bias and clk on + cset "name='Headphone Switch' off" + cset "name='HPO L Playback Switch' off" + cset "name='HPO R Playback Switch' off" + ] + + DisableSequence [ + # This is done by the Headphones EnableSequence, so that the + # Platform Clock and BIAS do not temporarily get turned off + # as that breaks audio-streams which are playing when + # switching between Speaker/Headphone + ] + + Value { + PlaybackChannels "2" + } +} |