diff mbox series

[1/2] conf/ucm: Add UCM profile for cht-bsw-rt5672 boards

Message ID 20190831145842.32990-1-hdegoede@redhat.com (mailing list archive)
State New, archived
Headers show
Series [1/2] conf/ucm: Add UCM profile for cht-bsw-rt5672 boards | expand

Commit Message

Hans de Goede Aug. 31, 2019, 2:58 p.m. UTC
Add an UCM profile for Intel boards with a RT5672 codec.

Re-use the existing platform enable and disable sequences for BYT/CHT SST
support and add a codecs/rt5672 dir with codec specific enable / disable
sequences for the various inputs and outputs.

This is partly based on earlier work done here:
https://github.com/plbossart/UCM/tree/master/cht-bsw-rt5672

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 configure.ac                                  |  2 +
 src/conf/ucm/Makefile.am                      |  1 +
 src/conf/ucm/cht-bsw-rt5672/HiFi.conf         | 27 +++++++++++
 src/conf/ucm/cht-bsw-rt5672/Makefile.am       |  4 ++
 .../ucm/cht-bsw-rt5672/cht-bsw-rt5672.conf    |  6 +++
 src/conf/ucm/codecs/Makefile.am               |  1 +
 src/conf/ucm/codecs/rt5672/DMIC1.conf         | 28 +++++++++++
 src/conf/ucm/codecs/rt5672/DMIC2.conf         | 28 +++++++++++
 src/conf/ucm/codecs/rt5672/EnableSeq.conf     | 48 +++++++++++++++++++
 src/conf/ucm/codecs/rt5672/HeadPhones.conf    | 23 +++++++++
 src/conf/ucm/codecs/rt5672/HeadsetMic.conf    | 38 +++++++++++++++
 src/conf/ucm/codecs/rt5672/Makefile.am        |  5 ++
 src/conf/ucm/codecs/rt5672/MonoSpeaker.conf   | 26 ++++++++++
 src/conf/ucm/codecs/rt5672/Speaker.conf       | 22 +++++++++
 14 files changed, 259 insertions(+)
 create mode 100644 src/conf/ucm/cht-bsw-rt5672/HiFi.conf
 create mode 100644 src/conf/ucm/cht-bsw-rt5672/Makefile.am
 create mode 100644 src/conf/ucm/cht-bsw-rt5672/cht-bsw-rt5672.conf
 create mode 100644 src/conf/ucm/codecs/rt5672/DMIC1.conf
 create mode 100644 src/conf/ucm/codecs/rt5672/DMIC2.conf
 create mode 100644 src/conf/ucm/codecs/rt5672/EnableSeq.conf
 create mode 100644 src/conf/ucm/codecs/rt5672/HeadPhones.conf
 create mode 100644 src/conf/ucm/codecs/rt5672/HeadsetMic.conf
 create mode 100644 src/conf/ucm/codecs/rt5672/Makefile.am
 create mode 100644 src/conf/ucm/codecs/rt5672/MonoSpeaker.conf
 create mode 100644 src/conf/ucm/codecs/rt5672/Speaker.conf

Comments

Takashi Iwai Sept. 2, 2019, 7:07 a.m. UTC | #1
On Sat, 31 Aug 2019 16:58:41 +0200,
Hans de Goede wrote:
> 
> Add an UCM profile for Intel boards with a RT5672 codec.
> 
> Re-use the existing platform enable and disable sequences for BYT/CHT SST
> support and add a codecs/rt5672 dir with codec specific enable / disable
> sequences for the various inputs and outputs.
> 
> This is partly based on earlier work done here:
> https://github.com/plbossart/UCM/tree/master/cht-bsw-rt5672
> 
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>

We've recently set up a new alsa-ucm-conf repo for keeping UCM
profiles outside alsa-lib repo.  The new repo has a different license
(BSD3-Clause) for easily adapting to OSes with license restriction.

I guess we should put the stuff there from now on, as much as
possible?  The handling of UCM profile is currently pending, and we
need to decide the general policy, as well as how to transfer the
existing profiles to the new repo...


thanks,

Takashi


> ---
>  configure.ac                                  |  2 +
>  src/conf/ucm/Makefile.am                      |  1 +
>  src/conf/ucm/cht-bsw-rt5672/HiFi.conf         | 27 +++++++++++
>  src/conf/ucm/cht-bsw-rt5672/Makefile.am       |  4 ++
>  .../ucm/cht-bsw-rt5672/cht-bsw-rt5672.conf    |  6 +++
>  src/conf/ucm/codecs/Makefile.am               |  1 +
>  src/conf/ucm/codecs/rt5672/DMIC1.conf         | 28 +++++++++++
>  src/conf/ucm/codecs/rt5672/DMIC2.conf         | 28 +++++++++++
>  src/conf/ucm/codecs/rt5672/EnableSeq.conf     | 48 +++++++++++++++++++
>  src/conf/ucm/codecs/rt5672/HeadPhones.conf    | 23 +++++++++
>  src/conf/ucm/codecs/rt5672/HeadsetMic.conf    | 38 +++++++++++++++
>  src/conf/ucm/codecs/rt5672/Makefile.am        |  5 ++
>  src/conf/ucm/codecs/rt5672/MonoSpeaker.conf   | 26 ++++++++++
>  src/conf/ucm/codecs/rt5672/Speaker.conf       | 22 +++++++++
>  14 files changed, 259 insertions(+)
>  create mode 100644 src/conf/ucm/cht-bsw-rt5672/HiFi.conf
>  create mode 100644 src/conf/ucm/cht-bsw-rt5672/Makefile.am
>  create mode 100644 src/conf/ucm/cht-bsw-rt5672/cht-bsw-rt5672.conf
>  create mode 100644 src/conf/ucm/codecs/rt5672/DMIC1.conf
>  create mode 100644 src/conf/ucm/codecs/rt5672/DMIC2.conf
>  create mode 100644 src/conf/ucm/codecs/rt5672/EnableSeq.conf
>  create mode 100644 src/conf/ucm/codecs/rt5672/HeadPhones.conf
>  create mode 100644 src/conf/ucm/codecs/rt5672/HeadsetMic.conf
>  create mode 100644 src/conf/ucm/codecs/rt5672/Makefile.am
>  create mode 100644 src/conf/ucm/codecs/rt5672/MonoSpeaker.conf
>  create mode 100644 src/conf/ucm/codecs/rt5672/Speaker.conf
> 
> diff --git a/configure.ac b/configure.ac
> index 2e955760..9ccca7aa 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -741,6 +741,7 @@ AC_OUTPUT(Makefile doc/Makefile doc/pictures/Makefile doc/doxygen.cfg \
>  	  src/conf/ucm/bytcr-rt5651-stereo-spk-in1-mic/Makefile \
>  	  src/conf/ucm/bytcr-rt5651-stereo-spk-in2-mic/Makefile \
>  	  src/conf/ucm/bytcr-rt5651-stereo-spk-in12-mic/Makefile \
> +	  src/conf/ucm/cht-bsw-rt5672/Makefile \
>  	  src/conf/ucm/chtnau8824/Makefile \
>  	  src/conf/ucm/chtrt5645/Makefile \
>  	  src/conf/ucm/chtrt5645-mono-speaker-analog-mic/Makefile \
> @@ -772,6 +773,7 @@ AC_OUTPUT(Makefile doc/Makefile doc/pictures/Makefile doc/doxygen.cfg \
>  	  src/conf/ucm/codecs/rt5640/Makefile \
>  	  src/conf/ucm/codecs/rt5645/Makefile \
>  	  src/conf/ucm/codecs/rt5651/Makefile \
> +	  src/conf/ucm/codecs/rt5672/Makefile \
>  	  src/conf/ucm/platforms/Makefile \
>  	  src/conf/ucm/platforms/bytcr/Makefile \
>  	  src/conf/topology/Makefile \
> diff --git a/src/conf/ucm/Makefile.am b/src/conf/ucm/Makefile.am
> index 02257048..2ed4e1a3 100644
> --- a/src/conf/ucm/Makefile.am
> +++ b/src/conf/ucm/Makefile.am
> @@ -25,6 +25,7 @@ bytcr-rt5651-stereo-spk-dmic-mic \
>  bytcr-rt5651-stereo-spk-in1-mic \
>  bytcr-rt5651-stereo-spk-in2-mic \
>  bytcr-rt5651-stereo-spk-in12-mic \
> +cht-bsw-rt5672 \
>  chtnau8824 \
>  chtrt5645 \
>  chtrt5645-mono-speaker-analog-mic \
> diff --git a/src/conf/ucm/cht-bsw-rt5672/HiFi.conf b/src/conf/ucm/cht-bsw-rt5672/HiFi.conf
> new file mode 100644
> index 00000000..b83099d8
> --- /dev/null
> +++ b/src/conf/ucm/cht-bsw-rt5672/HiFi.conf
> @@ -0,0 +1,27 @@
> +# Adapted from https://github.com/plbossart/UCM/tree/master/cht-bsw-rt5672
> +
> +SectionVerb {
> +	EnableSequence [
> +		cdev "hw:chtbswrt5672"
> +		<platforms/bytcr/PlatformEnableSeq.conf>
> +		<codecs/rt5672/EnableSeq.conf>
> +	]
> +
> +	DisableSequence [
> +		cdev "hw:chtbswrt5672"
> +		<platforms/bytcr/PlatformDisableSeq.conf>
> +	]
> +
> +	Value {
> +		PlaybackPCM "hw:chtbswrt5672"
> +		CapturePCM "hw:chtbswrt5672"
> +	}
> +}
> +
> +<codecs/rt5672/Speaker.conf>
> +<codecs/rt5672/MonoSpeaker.conf>
> +<codecs/rt5672/HeadPhones.conf>
> +
> +<codecs/rt5672/DMIC1.conf>
> +<codecs/rt5672/DMIC2.conf>
> +<codecs/rt5672/HeadsetMic.conf>
> diff --git a/src/conf/ucm/cht-bsw-rt5672/Makefile.am b/src/conf/ucm/cht-bsw-rt5672/Makefile.am
> new file mode 100644
> index 00000000..c3d557fa
> --- /dev/null
> +++ b/src/conf/ucm/cht-bsw-rt5672/Makefile.am
> @@ -0,0 +1,4 @@
> +alsaconfigdir = @ALSA_CONFIG_DIR@
> +ucmdir = $(alsaconfigdir)/ucm/cht-bsw-rt5672
> +ucm_DATA = cht-bsw-rt5672.conf HiFi.conf
> +EXTRA_DIST = $(ucm_DATA)
> diff --git a/src/conf/ucm/cht-bsw-rt5672/cht-bsw-rt5672.conf b/src/conf/ucm/cht-bsw-rt5672/cht-bsw-rt5672.conf
> new file mode 100644
> index 00000000..c79024d9
> --- /dev/null
> +++ b/src/conf/ucm/cht-bsw-rt5672/cht-bsw-rt5672.conf
> @@ -0,0 +1,6 @@
> +# Adapted from https://github.com/plbossart/UCM/tree/master/cht-bsw-rt5672
> +
> +SectionUseCase."HiFi" {
> +	File "HiFi.conf"
> +	Comment "Play HiFi quality Music"
> +}
> diff --git a/src/conf/ucm/codecs/Makefile.am b/src/conf/ucm/codecs/Makefile.am
> index 5987b9cf..17c4ebf9 100644
> --- a/src/conf/ucm/codecs/Makefile.am
> +++ b/src/conf/ucm/codecs/Makefile.am
> @@ -4,4 +4,5 @@ es8316 \
>  rt5640 \
>  rt5645 \
>  rt5651 \
> +rt5672 \
>  nau8824
> diff --git a/src/conf/ucm/codecs/rt5672/DMIC1.conf b/src/conf/ucm/codecs/rt5672/DMIC1.conf
> new file mode 100644
> index 00000000..9a8db1a5
> --- /dev/null
> +++ b/src/conf/ucm/codecs/rt5672/DMIC1.conf
> @@ -0,0 +1,28 @@
> +SectionDevice."DigitalMic-DMIC1" {
> +	Comment "Internal Digital Microphone on DMIC1"
> +
> +	ConflictingDevice [
> +		"DigitalMic-DMIC2"
> +		"HeadsetMic"
> +	]
> +
> +	EnableSequence [
> +		cdev "hw:chtbswrt5672"
> +		cset "name='Int Mic Switch' on"
> +		cset "name='Stereo1 DMIC Mux' DMIC1"
> +		cset "name='Stereo1 ADC 2 Mux' DMIC"
> +		cset "name='Sto1 ADC MIXL ADC2 Switch' on"
> +		cset "name='Sto1 ADC MIXR ADC2 Switch' on"
> +	]
> +
> +	DisableSequence [
> +		cdev "hw:chtbswrt5672"
> +		cset "name='Int Mic Switch' off"
> +		cset "name='Sto1 ADC MIXL ADC2 Switch' off"
> +		cset "name='Sto1 ADC MIXR ADC2 Switch' off"
> +	]
> +
> +	Value {
> +		CaptureChannels 2
> +	}
> +}
> diff --git a/src/conf/ucm/codecs/rt5672/DMIC2.conf b/src/conf/ucm/codecs/rt5672/DMIC2.conf
> new file mode 100644
> index 00000000..b960436e
> --- /dev/null
> +++ b/src/conf/ucm/codecs/rt5672/DMIC2.conf
> @@ -0,0 +1,28 @@
> +SectionDevice."DigitalMic-DMIC2" {
> +	Comment "Internal Digital Microphone on DMIC2"
> +
> +	ConflictingDevice [
> +		"DigitalMic-DMIC1"
> +		"HeadsetMic"
> +	]
> +
> +	EnableSequence [
> +		cdev "hw:chtbswrt5672"
> +		cset "name='Int Mic Switch' on"
> +		cset "name='Stereo1 DMIC Mux' DMIC2"
> +		cset "name='Stereo1 ADC 2 Mux' DMIC"
> +		cset "name='Sto1 ADC MIXL ADC2 Switch' on"
> +		cset "name='Sto1 ADC MIXR ADC2 Switch' on"
> +	]
> +
> +	DisableSequence [
> +		cdev "hw:chtbswrt5672"
> +		cset "name='Int Mic Switch' off"
> +		cset "name='Sto1 ADC MIXL ADC2 Switch' off"
> +		cset "name='Sto1 ADC MIXR ADC2 Switch' off"
> +	]
> +
> +	Value {
> +		CaptureChannels 2
> +	}
> +}
> diff --git a/src/conf/ucm/codecs/rt5672/EnableSeq.conf b/src/conf/ucm/codecs/rt5672/EnableSeq.conf
> new file mode 100644
> index 00000000..bd4f357c
> --- /dev/null
> +++ b/src/conf/ucm/codecs/rt5672/EnableSeq.conf
> @@ -0,0 +1,48 @@
> +# Playback (I2S1)
> +
> +# common
> +cset "name='DAC1 L Mux' IF1 DAC"
> +cset "name='DAC1 R Mux' IF1 DAC"
> +cset "name='DAC1 MIXL DAC1 Switch' on"
> +cset "name='DAC1 MIXR DAC1 Switch' on"
> +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"
> +
> +# speaker
> +cset "name='PDM1 L Mux' Stereo DAC"
> +cset "name='PDM1 R Mux' Stereo DAC"
> +
> +# headphone
> +cset "name='HPOVOL MIXL DAC1 Switch' on"
> +cset "name='HPOVOL MIXR DAC1 Switch' on"
> +cset "name='HPO MIX HPVOL Switch' on"
> +
> +# line out
> +# cset "name='OUT MIXL DAC L1 Switch' on"
> +# cset "name='OUT MIXR DAC R1 Switch' on"
> +# cset "name='LOUT MIX OUTMIX L Switch' on"
> +# cset "name='LOUT MIX OUTMIX R Switch' on"
> +
> +# 47=0dB, 0.375 dB/step
> +cset "name='ADC Capture Volume' 47"
> +cset "name='ADC Capture Switch' on"
> +
> +# Headset mic is quite soft, boost it a bit, 1 = 20dB which is the first
> +# available boost step
> +cset "name='IN1 Boost Volume' 1"
> +
> +# Start with all outputs / inputs disabled
> +cset "name='Ext Spk Switch' off"
> +cset "name='Headphone Switch' off"
> +cset "name='Int Mic Switch' off"
> +cset "name='Headset Mic Switch' off"
> +cset "name='Sto1 ADC MIXL ADC1 Switch' off"
> +cset "name='Sto1 ADC MIXR ADC1 Switch' off"
> +cset "name='Sto1 ADC MIXL ADC2 Switch' off"
> +cset "name='Sto1 ADC MIXR ADC2 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"
> diff --git a/src/conf/ucm/codecs/rt5672/HeadPhones.conf b/src/conf/ucm/codecs/rt5672/HeadPhones.conf
> new file mode 100644
> index 00000000..cb8aad2d
> --- /dev/null
> +++ b/src/conf/ucm/codecs/rt5672/HeadPhones.conf
> @@ -0,0 +1,23 @@
> +SectionDevice."Headphones" {
> +	Comment "Headphones"
> +
> +	ConflictingDevice [
> +		"Speaker"
> +		"MonoSpeaker"
> +	]
> +
> +	EnableSequence [
> +		cdev "hw:chtbswrt5672"
> +		cset "name='Headphone Switch' on"
> +	]
> +
> +	DisableSequence [
> +		cdev "hw:chtbswrt5672"
> +		cset "name='Headphone Switch' off"
> +	]
> +
> +	Value {
> +		PlaybackChannels "2"
> +		JackControl "Headphone Jack"
> +	}
> +}
> diff --git a/src/conf/ucm/codecs/rt5672/HeadsetMic.conf b/src/conf/ucm/codecs/rt5672/HeadsetMic.conf
> new file mode 100644
> index 00000000..cc6d8d56
> --- /dev/null
> +++ b/src/conf/ucm/codecs/rt5672/HeadsetMic.conf
> @@ -0,0 +1,38 @@
> +SectionDevice."HeadsetMic" {
> +	Comment "Headset Microphone"
> +
> +	ConflictingDevice [
> +		"DigitalMic-DMIC1"
> +		"DigitalMic-DMIC2"
> +	]
> +
> +	EnableSequence [
> +		cdev "hw:chtbswrt5672"
> +		cset "name='Headset Mic Switch' on"
> +        	cset "name='RECMIXL BST1 Switch' on"
> +		cset "name='RECMIXR BST1 Switch' on"
> +		cset "name='Sto1 ADC MIXL ADC1 Switch' on"
> +		cset "name='Sto1 ADC MIXR ADC1 Switch' on"
> +		# For unknown reasons the headset mic sound is only recorded
> +		# on the left channel, we tweak the data-stream reception to
> +		# use the left samples for both slots, so that we get a stereo
> +		# stream with the mic sound on both channels
> +		cset "name='codec_in rx deinterleaver codec_in0_1' 1"
> +	]
> +
> +	DisableSequence [
> +		cdev "hw:chtbswrt5672"
> +		cset "name='Headset Mic Switch' off"
> +        	cset "name='RECMIXL BST1 Switch' off"
> +		cset "name='RECMIXR BST1 Switch' off"
> +		cset "name='Sto1 ADC MIXL ADC1 Switch' off"
> +		cset "name='Sto1 ADC MIXR ADC1 Switch' off"
> +		# Undo data-stream reception mono-mix workaround
> +		cset "name='codec_in rx deinterleaver codec_in0_1' 2"
> +	]
> +
> +	Value {
> +		CaptureChannels "2"
> +		JackControl "Headset Mic Jack"
> +	}
> +}
> diff --git a/src/conf/ucm/codecs/rt5672/Makefile.am b/src/conf/ucm/codecs/rt5672/Makefile.am
> new file mode 100644
> index 00000000..feba0b76
> --- /dev/null
> +++ b/src/conf/ucm/codecs/rt5672/Makefile.am
> @@ -0,0 +1,5 @@
> +alsaconfigdir = @ALSA_CONFIG_DIR@
> +ucmdir = $(alsaconfigdir)/ucm/codecs/rt5672
> +ucm_DATA = DMIC1.conf DMIC2.conf EnableSeq.conf HeadPhones.conf \
> +	   HeadsetMic.conf MonoSpeaker.conf Speaker.conf
> +EXTRA_DIST = $(ucm_DATA)
> diff --git a/src/conf/ucm/codecs/rt5672/MonoSpeaker.conf b/src/conf/ucm/codecs/rt5672/MonoSpeaker.conf
> new file mode 100644
> index 00000000..828a1154
> --- /dev/null
> +++ b/src/conf/ucm/codecs/rt5672/MonoSpeaker.conf
> @@ -0,0 +1,26 @@
> +SectionDevice."MonoSpeaker" {
> +	Comment "Mono Speaker"
> +
> +	ConflictingDevice [
> +		"Speaker"
> +		"Headphones"
> +	]
> +
> +	EnableSequence [
> +		cdev "hw:chtbswrt5672"
> +		cset "name='Stereo DAC MIXR DAC R1 Switch' off"
> +		cset "name='Stereo DAC MIXL DAC R1 Switch' on"
> +		cset "name='Ext Spk Switch' on"
> +	]
> +
> +	DisableSequence [
> +		cdev "hw:chtbswrt5672"
> +		cset "name='Ext Spk Switch' off"
> +		cset "name='Stereo DAC MIXL DAC R1 Switch' off"
> +		cset "name='Stereo DAC MIXR DAC R1 Switch' on"
> +	]
> +
> +	Value {
> +		PlaybackChannels "2"
> +	}
> +}
> diff --git a/src/conf/ucm/codecs/rt5672/Speaker.conf b/src/conf/ucm/codecs/rt5672/Speaker.conf
> new file mode 100644
> index 00000000..f9291e53
> --- /dev/null
> +++ b/src/conf/ucm/codecs/rt5672/Speaker.conf
> @@ -0,0 +1,22 @@
> +SectionDevice."Speaker" {
> +	Comment "Speakers"
> +
> +	ConflictingDevice [
> +		"MonoSpeaker"
> +		"Headphones"
> +	]
> +
> +	EnableSequence [
> +		cdev "hw:chtbswrt5672"
> +		cset "name='Ext Spk Switch' on"
> +	]
> +
> +	DisableSequence [
> +		cdev "hw:chtbswrt5672"
> +		cset "name='Ext Spk Switch' off"
> +	]
> +
> +	Value {
> +		PlaybackChannels "2"
> +	}
> +}
> -- 
> 2.23.0
> 
> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel@alsa-project.org
> https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
>
Hans de Goede Sept. 2, 2019, 8:31 a.m. UTC | #2
Hi Takashi,

On 02-09-19 09:07, Takashi Iwai wrote:
> On Sat, 31 Aug 2019 16:58:41 +0200,
> Hans de Goede wrote:
>>
>> Add an UCM profile for Intel boards with a RT5672 codec.
>>
>> Re-use the existing platform enable and disable sequences for BYT/CHT SST
>> support and add a codecs/rt5672 dir with codec specific enable / disable
>> sequences for the various inputs and outputs.
>>
>> This is partly based on earlier work done here:
>> https://github.com/plbossart/UCM/tree/master/cht-bsw-rt5672
>>
>> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> 
> We've recently set up a new alsa-ucm-conf repo for keeping UCM
> profiles outside alsa-lib repo.  The new repo has a different license
> (BSD3-Clause) for easily adapting to OSes with license restriction.
> 
> I guess we should put the stuff there from now on, as much as
> possible?  The handling of UCM profile is currently pending, and we
> need to decide the general policy, as well as how to transfer the
> existing profiles to the new repo...

I think it is good that we now have a separate repo and I'm fine
with re-licensing all my UCM profile work under a BSD3-Clause license.

But I believe that until we have actually figured out how this is
all going to work and we are actually doing releases from the
new alsa-ucm-conf repo, we should keep adding new profiles to
alsa-lib for now, because these profiles are necessary for things
to work OOTB for our end users.

Regards,

Hans


>> ---
>>   configure.ac                                  |  2 +
>>   src/conf/ucm/Makefile.am                      |  1 +
>>   src/conf/ucm/cht-bsw-rt5672/HiFi.conf         | 27 +++++++++++
>>   src/conf/ucm/cht-bsw-rt5672/Makefile.am       |  4 ++
>>   .../ucm/cht-bsw-rt5672/cht-bsw-rt5672.conf    |  6 +++
>>   src/conf/ucm/codecs/Makefile.am               |  1 +
>>   src/conf/ucm/codecs/rt5672/DMIC1.conf         | 28 +++++++++++
>>   src/conf/ucm/codecs/rt5672/DMIC2.conf         | 28 +++++++++++
>>   src/conf/ucm/codecs/rt5672/EnableSeq.conf     | 48 +++++++++++++++++++
>>   src/conf/ucm/codecs/rt5672/HeadPhones.conf    | 23 +++++++++
>>   src/conf/ucm/codecs/rt5672/HeadsetMic.conf    | 38 +++++++++++++++
>>   src/conf/ucm/codecs/rt5672/Makefile.am        |  5 ++
>>   src/conf/ucm/codecs/rt5672/MonoSpeaker.conf   | 26 ++++++++++
>>   src/conf/ucm/codecs/rt5672/Speaker.conf       | 22 +++++++++
>>   14 files changed, 259 insertions(+)
>>   create mode 100644 src/conf/ucm/cht-bsw-rt5672/HiFi.conf
>>   create mode 100644 src/conf/ucm/cht-bsw-rt5672/Makefile.am
>>   create mode 100644 src/conf/ucm/cht-bsw-rt5672/cht-bsw-rt5672.conf
>>   create mode 100644 src/conf/ucm/codecs/rt5672/DMIC1.conf
>>   create mode 100644 src/conf/ucm/codecs/rt5672/DMIC2.conf
>>   create mode 100644 src/conf/ucm/codecs/rt5672/EnableSeq.conf
>>   create mode 100644 src/conf/ucm/codecs/rt5672/HeadPhones.conf
>>   create mode 100644 src/conf/ucm/codecs/rt5672/HeadsetMic.conf
>>   create mode 100644 src/conf/ucm/codecs/rt5672/Makefile.am
>>   create mode 100644 src/conf/ucm/codecs/rt5672/MonoSpeaker.conf
>>   create mode 100644 src/conf/ucm/codecs/rt5672/Speaker.conf
>>
>> diff --git a/configure.ac b/configure.ac
>> index 2e955760..9ccca7aa 100644
>> --- a/configure.ac
>> +++ b/configure.ac
>> @@ -741,6 +741,7 @@ AC_OUTPUT(Makefile doc/Makefile doc/pictures/Makefile doc/doxygen.cfg \
>>   	  src/conf/ucm/bytcr-rt5651-stereo-spk-in1-mic/Makefile \
>>   	  src/conf/ucm/bytcr-rt5651-stereo-spk-in2-mic/Makefile \
>>   	  src/conf/ucm/bytcr-rt5651-stereo-spk-in12-mic/Makefile \
>> +	  src/conf/ucm/cht-bsw-rt5672/Makefile \
>>   	  src/conf/ucm/chtnau8824/Makefile \
>>   	  src/conf/ucm/chtrt5645/Makefile \
>>   	  src/conf/ucm/chtrt5645-mono-speaker-analog-mic/Makefile \
>> @@ -772,6 +773,7 @@ AC_OUTPUT(Makefile doc/Makefile doc/pictures/Makefile doc/doxygen.cfg \
>>   	  src/conf/ucm/codecs/rt5640/Makefile \
>>   	  src/conf/ucm/codecs/rt5645/Makefile \
>>   	  src/conf/ucm/codecs/rt5651/Makefile \
>> +	  src/conf/ucm/codecs/rt5672/Makefile \
>>   	  src/conf/ucm/platforms/Makefile \
>>   	  src/conf/ucm/platforms/bytcr/Makefile \
>>   	  src/conf/topology/Makefile \
>> diff --git a/src/conf/ucm/Makefile.am b/src/conf/ucm/Makefile.am
>> index 02257048..2ed4e1a3 100644
>> --- a/src/conf/ucm/Makefile.am
>> +++ b/src/conf/ucm/Makefile.am
>> @@ -25,6 +25,7 @@ bytcr-rt5651-stereo-spk-dmic-mic \
>>   bytcr-rt5651-stereo-spk-in1-mic \
>>   bytcr-rt5651-stereo-spk-in2-mic \
>>   bytcr-rt5651-stereo-spk-in12-mic \
>> +cht-bsw-rt5672 \
>>   chtnau8824 \
>>   chtrt5645 \
>>   chtrt5645-mono-speaker-analog-mic \
>> diff --git a/src/conf/ucm/cht-bsw-rt5672/HiFi.conf b/src/conf/ucm/cht-bsw-rt5672/HiFi.conf
>> new file mode 100644
>> index 00000000..b83099d8
>> --- /dev/null
>> +++ b/src/conf/ucm/cht-bsw-rt5672/HiFi.conf
>> @@ -0,0 +1,27 @@
>> +# Adapted from https://github.com/plbossart/UCM/tree/master/cht-bsw-rt5672
>> +
>> +SectionVerb {
>> +	EnableSequence [
>> +		cdev "hw:chtbswrt5672"
>> +		<platforms/bytcr/PlatformEnableSeq.conf>
>> +		<codecs/rt5672/EnableSeq.conf>
>> +	]
>> +
>> +	DisableSequence [
>> +		cdev "hw:chtbswrt5672"
>> +		<platforms/bytcr/PlatformDisableSeq.conf>
>> +	]
>> +
>> +	Value {
>> +		PlaybackPCM "hw:chtbswrt5672"
>> +		CapturePCM "hw:chtbswrt5672"
>> +	}
>> +}
>> +
>> +<codecs/rt5672/Speaker.conf>
>> +<codecs/rt5672/MonoSpeaker.conf>
>> +<codecs/rt5672/HeadPhones.conf>
>> +
>> +<codecs/rt5672/DMIC1.conf>
>> +<codecs/rt5672/DMIC2.conf>
>> +<codecs/rt5672/HeadsetMic.conf>
>> diff --git a/src/conf/ucm/cht-bsw-rt5672/Makefile.am b/src/conf/ucm/cht-bsw-rt5672/Makefile.am
>> new file mode 100644
>> index 00000000..c3d557fa
>> --- /dev/null
>> +++ b/src/conf/ucm/cht-bsw-rt5672/Makefile.am
>> @@ -0,0 +1,4 @@
>> +alsaconfigdir = @ALSA_CONFIG_DIR@
>> +ucmdir = $(alsaconfigdir)/ucm/cht-bsw-rt5672
>> +ucm_DATA = cht-bsw-rt5672.conf HiFi.conf
>> +EXTRA_DIST = $(ucm_DATA)
>> diff --git a/src/conf/ucm/cht-bsw-rt5672/cht-bsw-rt5672.conf b/src/conf/ucm/cht-bsw-rt5672/cht-bsw-rt5672.conf
>> new file mode 100644
>> index 00000000..c79024d9
>> --- /dev/null
>> +++ b/src/conf/ucm/cht-bsw-rt5672/cht-bsw-rt5672.conf
>> @@ -0,0 +1,6 @@
>> +# Adapted from https://github.com/plbossart/UCM/tree/master/cht-bsw-rt5672
>> +
>> +SectionUseCase."HiFi" {
>> +	File "HiFi.conf"
>> +	Comment "Play HiFi quality Music"
>> +}
>> diff --git a/src/conf/ucm/codecs/Makefile.am b/src/conf/ucm/codecs/Makefile.am
>> index 5987b9cf..17c4ebf9 100644
>> --- a/src/conf/ucm/codecs/Makefile.am
>> +++ b/src/conf/ucm/codecs/Makefile.am
>> @@ -4,4 +4,5 @@ es8316 \
>>   rt5640 \
>>   rt5645 \
>>   rt5651 \
>> +rt5672 \
>>   nau8824
>> diff --git a/src/conf/ucm/codecs/rt5672/DMIC1.conf b/src/conf/ucm/codecs/rt5672/DMIC1.conf
>> new file mode 100644
>> index 00000000..9a8db1a5
>> --- /dev/null
>> +++ b/src/conf/ucm/codecs/rt5672/DMIC1.conf
>> @@ -0,0 +1,28 @@
>> +SectionDevice."DigitalMic-DMIC1" {
>> +	Comment "Internal Digital Microphone on DMIC1"
>> +
>> +	ConflictingDevice [
>> +		"DigitalMic-DMIC2"
>> +		"HeadsetMic"
>> +	]
>> +
>> +	EnableSequence [
>> +		cdev "hw:chtbswrt5672"
>> +		cset "name='Int Mic Switch' on"
>> +		cset "name='Stereo1 DMIC Mux' DMIC1"
>> +		cset "name='Stereo1 ADC 2 Mux' DMIC"
>> +		cset "name='Sto1 ADC MIXL ADC2 Switch' on"
>> +		cset "name='Sto1 ADC MIXR ADC2 Switch' on"
>> +	]
>> +
>> +	DisableSequence [
>> +		cdev "hw:chtbswrt5672"
>> +		cset "name='Int Mic Switch' off"
>> +		cset "name='Sto1 ADC MIXL ADC2 Switch' off"
>> +		cset "name='Sto1 ADC MIXR ADC2 Switch' off"
>> +	]
>> +
>> +	Value {
>> +		CaptureChannels 2
>> +	}
>> +}
>> diff --git a/src/conf/ucm/codecs/rt5672/DMIC2.conf b/src/conf/ucm/codecs/rt5672/DMIC2.conf
>> new file mode 100644
>> index 00000000..b960436e
>> --- /dev/null
>> +++ b/src/conf/ucm/codecs/rt5672/DMIC2.conf
>> @@ -0,0 +1,28 @@
>> +SectionDevice."DigitalMic-DMIC2" {
>> +	Comment "Internal Digital Microphone on DMIC2"
>> +
>> +	ConflictingDevice [
>> +		"DigitalMic-DMIC1"
>> +		"HeadsetMic"
>> +	]
>> +
>> +	EnableSequence [
>> +		cdev "hw:chtbswrt5672"
>> +		cset "name='Int Mic Switch' on"
>> +		cset "name='Stereo1 DMIC Mux' DMIC2"
>> +		cset "name='Stereo1 ADC 2 Mux' DMIC"
>> +		cset "name='Sto1 ADC MIXL ADC2 Switch' on"
>> +		cset "name='Sto1 ADC MIXR ADC2 Switch' on"
>> +	]
>> +
>> +	DisableSequence [
>> +		cdev "hw:chtbswrt5672"
>> +		cset "name='Int Mic Switch' off"
>> +		cset "name='Sto1 ADC MIXL ADC2 Switch' off"
>> +		cset "name='Sto1 ADC MIXR ADC2 Switch' off"
>> +	]
>> +
>> +	Value {
>> +		CaptureChannels 2
>> +	}
>> +}
>> diff --git a/src/conf/ucm/codecs/rt5672/EnableSeq.conf b/src/conf/ucm/codecs/rt5672/EnableSeq.conf
>> new file mode 100644
>> index 00000000..bd4f357c
>> --- /dev/null
>> +++ b/src/conf/ucm/codecs/rt5672/EnableSeq.conf
>> @@ -0,0 +1,48 @@
>> +# Playback (I2S1)
>> +
>> +# common
>> +cset "name='DAC1 L Mux' IF1 DAC"
>> +cset "name='DAC1 R Mux' IF1 DAC"
>> +cset "name='DAC1 MIXL DAC1 Switch' on"
>> +cset "name='DAC1 MIXR DAC1 Switch' on"
>> +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"
>> +
>> +# speaker
>> +cset "name='PDM1 L Mux' Stereo DAC"
>> +cset "name='PDM1 R Mux' Stereo DAC"
>> +
>> +# headphone
>> +cset "name='HPOVOL MIXL DAC1 Switch' on"
>> +cset "name='HPOVOL MIXR DAC1 Switch' on"
>> +cset "name='HPO MIX HPVOL Switch' on"
>> +
>> +# line out
>> +# cset "name='OUT MIXL DAC L1 Switch' on"
>> +# cset "name='OUT MIXR DAC R1 Switch' on"
>> +# cset "name='LOUT MIX OUTMIX L Switch' on"
>> +# cset "name='LOUT MIX OUTMIX R Switch' on"
>> +
>> +# 47=0dB, 0.375 dB/step
>> +cset "name='ADC Capture Volume' 47"
>> +cset "name='ADC Capture Switch' on"
>> +
>> +# Headset mic is quite soft, boost it a bit, 1 = 20dB which is the first
>> +# available boost step
>> +cset "name='IN1 Boost Volume' 1"
>> +
>> +# Start with all outputs / inputs disabled
>> +cset "name='Ext Spk Switch' off"
>> +cset "name='Headphone Switch' off"
>> +cset "name='Int Mic Switch' off"
>> +cset "name='Headset Mic Switch' off"
>> +cset "name='Sto1 ADC MIXL ADC1 Switch' off"
>> +cset "name='Sto1 ADC MIXR ADC1 Switch' off"
>> +cset "name='Sto1 ADC MIXL ADC2 Switch' off"
>> +cset "name='Sto1 ADC MIXR ADC2 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"
>> diff --git a/src/conf/ucm/codecs/rt5672/HeadPhones.conf b/src/conf/ucm/codecs/rt5672/HeadPhones.conf
>> new file mode 100644
>> index 00000000..cb8aad2d
>> --- /dev/null
>> +++ b/src/conf/ucm/codecs/rt5672/HeadPhones.conf
>> @@ -0,0 +1,23 @@
>> +SectionDevice."Headphones" {
>> +	Comment "Headphones"
>> +
>> +	ConflictingDevice [
>> +		"Speaker"
>> +		"MonoSpeaker"
>> +	]
>> +
>> +	EnableSequence [
>> +		cdev "hw:chtbswrt5672"
>> +		cset "name='Headphone Switch' on"
>> +	]
>> +
>> +	DisableSequence [
>> +		cdev "hw:chtbswrt5672"
>> +		cset "name='Headphone Switch' off"
>> +	]
>> +
>> +	Value {
>> +		PlaybackChannels "2"
>> +		JackControl "Headphone Jack"
>> +	}
>> +}
>> diff --git a/src/conf/ucm/codecs/rt5672/HeadsetMic.conf b/src/conf/ucm/codecs/rt5672/HeadsetMic.conf
>> new file mode 100644
>> index 00000000..cc6d8d56
>> --- /dev/null
>> +++ b/src/conf/ucm/codecs/rt5672/HeadsetMic.conf
>> @@ -0,0 +1,38 @@
>> +SectionDevice."HeadsetMic" {
>> +	Comment "Headset Microphone"
>> +
>> +	ConflictingDevice [
>> +		"DigitalMic-DMIC1"
>> +		"DigitalMic-DMIC2"
>> +	]
>> +
>> +	EnableSequence [
>> +		cdev "hw:chtbswrt5672"
>> +		cset "name='Headset Mic Switch' on"
>> +        	cset "name='RECMIXL BST1 Switch' on"
>> +		cset "name='RECMIXR BST1 Switch' on"
>> +		cset "name='Sto1 ADC MIXL ADC1 Switch' on"
>> +		cset "name='Sto1 ADC MIXR ADC1 Switch' on"
>> +		# For unknown reasons the headset mic sound is only recorded
>> +		# on the left channel, we tweak the data-stream reception to
>> +		# use the left samples for both slots, so that we get a stereo
>> +		# stream with the mic sound on both channels
>> +		cset "name='codec_in rx deinterleaver codec_in0_1' 1"
>> +	]
>> +
>> +	DisableSequence [
>> +		cdev "hw:chtbswrt5672"
>> +		cset "name='Headset Mic Switch' off"
>> +        	cset "name='RECMIXL BST1 Switch' off"
>> +		cset "name='RECMIXR BST1 Switch' off"
>> +		cset "name='Sto1 ADC MIXL ADC1 Switch' off"
>> +		cset "name='Sto1 ADC MIXR ADC1 Switch' off"
>> +		# Undo data-stream reception mono-mix workaround
>> +		cset "name='codec_in rx deinterleaver codec_in0_1' 2"
>> +	]
>> +
>> +	Value {
>> +		CaptureChannels "2"
>> +		JackControl "Headset Mic Jack"
>> +	}
>> +}
>> diff --git a/src/conf/ucm/codecs/rt5672/Makefile.am b/src/conf/ucm/codecs/rt5672/Makefile.am
>> new file mode 100644
>> index 00000000..feba0b76
>> --- /dev/null
>> +++ b/src/conf/ucm/codecs/rt5672/Makefile.am
>> @@ -0,0 +1,5 @@
>> +alsaconfigdir = @ALSA_CONFIG_DIR@
>> +ucmdir = $(alsaconfigdir)/ucm/codecs/rt5672
>> +ucm_DATA = DMIC1.conf DMIC2.conf EnableSeq.conf HeadPhones.conf \
>> +	   HeadsetMic.conf MonoSpeaker.conf Speaker.conf
>> +EXTRA_DIST = $(ucm_DATA)
>> diff --git a/src/conf/ucm/codecs/rt5672/MonoSpeaker.conf b/src/conf/ucm/codecs/rt5672/MonoSpeaker.conf
>> new file mode 100644
>> index 00000000..828a1154
>> --- /dev/null
>> +++ b/src/conf/ucm/codecs/rt5672/MonoSpeaker.conf
>> @@ -0,0 +1,26 @@
>> +SectionDevice."MonoSpeaker" {
>> +	Comment "Mono Speaker"
>> +
>> +	ConflictingDevice [
>> +		"Speaker"
>> +		"Headphones"
>> +	]
>> +
>> +	EnableSequence [
>> +		cdev "hw:chtbswrt5672"
>> +		cset "name='Stereo DAC MIXR DAC R1 Switch' off"
>> +		cset "name='Stereo DAC MIXL DAC R1 Switch' on"
>> +		cset "name='Ext Spk Switch' on"
>> +	]
>> +
>> +	DisableSequence [
>> +		cdev "hw:chtbswrt5672"
>> +		cset "name='Ext Spk Switch' off"
>> +		cset "name='Stereo DAC MIXL DAC R1 Switch' off"
>> +		cset "name='Stereo DAC MIXR DAC R1 Switch' on"
>> +	]
>> +
>> +	Value {
>> +		PlaybackChannels "2"
>> +	}
>> +}
>> diff --git a/src/conf/ucm/codecs/rt5672/Speaker.conf b/src/conf/ucm/codecs/rt5672/Speaker.conf
>> new file mode 100644
>> index 00000000..f9291e53
>> --- /dev/null
>> +++ b/src/conf/ucm/codecs/rt5672/Speaker.conf
>> @@ -0,0 +1,22 @@
>> +SectionDevice."Speaker" {
>> +	Comment "Speakers"
>> +
>> +	ConflictingDevice [
>> +		"MonoSpeaker"
>> +		"Headphones"
>> +	]
>> +
>> +	EnableSequence [
>> +		cdev "hw:chtbswrt5672"
>> +		cset "name='Ext Spk Switch' on"
>> +	]
>> +
>> +	DisableSequence [
>> +		cdev "hw:chtbswrt5672"
>> +		cset "name='Ext Spk Switch' off"
>> +	]
>> +
>> +	Value {
>> +		PlaybackChannels "2"
>> +	}
>> +}
>> -- 
>> 2.23.0
>>
>> _______________________________________________
>> Alsa-devel mailing list
>> Alsa-devel@alsa-project.org
>> https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
>>
Takashi Iwai Sept. 2, 2019, 3:32 p.m. UTC | #3
On Mon, 02 Sep 2019 10:31:30 +0200,
Hans de Goede wrote:
> 
> Hi Takashi,
> 
> On 02-09-19 09:07, Takashi Iwai wrote:
> > On Sat, 31 Aug 2019 16:58:41 +0200,
> > Hans de Goede wrote:
> >>
> >> Add an UCM profile for Intel boards with a RT5672 codec.
> >>
> >> Re-use the existing platform enable and disable sequences for BYT/CHT SST
> >> support and add a codecs/rt5672 dir with codec specific enable / disable
> >> sequences for the various inputs and outputs.
> >>
> >> This is partly based on earlier work done here:
> >> https://github.com/plbossart/UCM/tree/master/cht-bsw-rt5672
> >>
> >> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> >
> > We've recently set up a new alsa-ucm-conf repo for keeping UCM
> > profiles outside alsa-lib repo.  The new repo has a different license
> > (BSD3-Clause) for easily adapting to OSes with license restriction.
> >
> > I guess we should put the stuff there from now on, as much as
> > possible?  The handling of UCM profile is currently pending, and we
> > need to decide the general policy, as well as how to transfer the
> > existing profiles to the new repo...
> 
> I think it is good that we now have a separate repo and I'm fine
> with re-licensing all my UCM profile work under a BSD3-Clause license.
> 
> But I believe that until we have actually figured out how this is
> all going to work and we are actually doing releases from the
> new alsa-ucm-conf repo, we should keep adding new profiles to
> alsa-lib for now, because these profiles are necessary for things
> to work OOTB for our end users.

Well, putting to both repos isn't a good idea from the packaging POV,
either.  If we're going to release the alsa-ucm-conf sooner or later
together with the next alsa-lib release, we can put into the new repo
from the beginning.

Other than that, I'm fine to put to alsa-lib at first.


thanks,

Takashi


> 
> Regards,
> 
> Hans
> 
> 
> >> ---
> >>   configure.ac                                  |  2 +
> >>   src/conf/ucm/Makefile.am                      |  1 +
> >>   src/conf/ucm/cht-bsw-rt5672/HiFi.conf         | 27 +++++++++++
> >>   src/conf/ucm/cht-bsw-rt5672/Makefile.am       |  4 ++
> >>   .../ucm/cht-bsw-rt5672/cht-bsw-rt5672.conf    |  6 +++
> >>   src/conf/ucm/codecs/Makefile.am               |  1 +
> >>   src/conf/ucm/codecs/rt5672/DMIC1.conf         | 28 +++++++++++
> >>   src/conf/ucm/codecs/rt5672/DMIC2.conf         | 28 +++++++++++
> >>   src/conf/ucm/codecs/rt5672/EnableSeq.conf     | 48 +++++++++++++++++++
> >>   src/conf/ucm/codecs/rt5672/HeadPhones.conf    | 23 +++++++++
> >>   src/conf/ucm/codecs/rt5672/HeadsetMic.conf    | 38 +++++++++++++++
> >>   src/conf/ucm/codecs/rt5672/Makefile.am        |  5 ++
> >>   src/conf/ucm/codecs/rt5672/MonoSpeaker.conf   | 26 ++++++++++
> >>   src/conf/ucm/codecs/rt5672/Speaker.conf       | 22 +++++++++
> >>   14 files changed, 259 insertions(+)
> >>   create mode 100644 src/conf/ucm/cht-bsw-rt5672/HiFi.conf
> >>   create mode 100644 src/conf/ucm/cht-bsw-rt5672/Makefile.am
> >>   create mode 100644 src/conf/ucm/cht-bsw-rt5672/cht-bsw-rt5672.conf
> >>   create mode 100644 src/conf/ucm/codecs/rt5672/DMIC1.conf
> >>   create mode 100644 src/conf/ucm/codecs/rt5672/DMIC2.conf
> >>   create mode 100644 src/conf/ucm/codecs/rt5672/EnableSeq.conf
> >>   create mode 100644 src/conf/ucm/codecs/rt5672/HeadPhones.conf
> >>   create mode 100644 src/conf/ucm/codecs/rt5672/HeadsetMic.conf
> >>   create mode 100644 src/conf/ucm/codecs/rt5672/Makefile.am
> >>   create mode 100644 src/conf/ucm/codecs/rt5672/MonoSpeaker.conf
> >>   create mode 100644 src/conf/ucm/codecs/rt5672/Speaker.conf
> >>
> >> diff --git a/configure.ac b/configure.ac
> >> index 2e955760..9ccca7aa 100644
> >> --- a/configure.ac
> >> +++ b/configure.ac
> >> @@ -741,6 +741,7 @@ AC_OUTPUT(Makefile doc/Makefile doc/pictures/Makefile doc/doxygen.cfg \
> >>   	  src/conf/ucm/bytcr-rt5651-stereo-spk-in1-mic/Makefile \
> >>   	  src/conf/ucm/bytcr-rt5651-stereo-spk-in2-mic/Makefile \
> >>   	  src/conf/ucm/bytcr-rt5651-stereo-spk-in12-mic/Makefile \
> >> +	  src/conf/ucm/cht-bsw-rt5672/Makefile \
> >>   	  src/conf/ucm/chtnau8824/Makefile \
> >>   	  src/conf/ucm/chtrt5645/Makefile \
> >>   	  src/conf/ucm/chtrt5645-mono-speaker-analog-mic/Makefile \
> >> @@ -772,6 +773,7 @@ AC_OUTPUT(Makefile doc/Makefile doc/pictures/Makefile doc/doxygen.cfg \
> >>   	  src/conf/ucm/codecs/rt5640/Makefile \
> >>   	  src/conf/ucm/codecs/rt5645/Makefile \
> >>   	  src/conf/ucm/codecs/rt5651/Makefile \
> >> +	  src/conf/ucm/codecs/rt5672/Makefile \
> >>   	  src/conf/ucm/platforms/Makefile \
> >>   	  src/conf/ucm/platforms/bytcr/Makefile \
> >>   	  src/conf/topology/Makefile \
> >> diff --git a/src/conf/ucm/Makefile.am b/src/conf/ucm/Makefile.am
> >> index 02257048..2ed4e1a3 100644
> >> --- a/src/conf/ucm/Makefile.am
> >> +++ b/src/conf/ucm/Makefile.am
> >> @@ -25,6 +25,7 @@ bytcr-rt5651-stereo-spk-dmic-mic \
> >>   bytcr-rt5651-stereo-spk-in1-mic \
> >>   bytcr-rt5651-stereo-spk-in2-mic \
> >>   bytcr-rt5651-stereo-spk-in12-mic \
> >> +cht-bsw-rt5672 \
> >>   chtnau8824 \
> >>   chtrt5645 \
> >>   chtrt5645-mono-speaker-analog-mic \
> >> diff --git a/src/conf/ucm/cht-bsw-rt5672/HiFi.conf b/src/conf/ucm/cht-bsw-rt5672/HiFi.conf
> >> new file mode 100644
> >> index 00000000..b83099d8
> >> --- /dev/null
> >> +++ b/src/conf/ucm/cht-bsw-rt5672/HiFi.conf
> >> @@ -0,0 +1,27 @@
> >> +# Adapted from https://github.com/plbossart/UCM/tree/master/cht-bsw-rt5672
> >> +
> >> +SectionVerb {
> >> +	EnableSequence [
> >> +		cdev "hw:chtbswrt5672"
> >> +		<platforms/bytcr/PlatformEnableSeq.conf>
> >> +		<codecs/rt5672/EnableSeq.conf>
> >> +	]
> >> +
> >> +	DisableSequence [
> >> +		cdev "hw:chtbswrt5672"
> >> +		<platforms/bytcr/PlatformDisableSeq.conf>
> >> +	]
> >> +
> >> +	Value {
> >> +		PlaybackPCM "hw:chtbswrt5672"
> >> +		CapturePCM "hw:chtbswrt5672"
> >> +	}
> >> +}
> >> +
> >> +<codecs/rt5672/Speaker.conf>
> >> +<codecs/rt5672/MonoSpeaker.conf>
> >> +<codecs/rt5672/HeadPhones.conf>
> >> +
> >> +<codecs/rt5672/DMIC1.conf>
> >> +<codecs/rt5672/DMIC2.conf>
> >> +<codecs/rt5672/HeadsetMic.conf>
> >> diff --git a/src/conf/ucm/cht-bsw-rt5672/Makefile.am b/src/conf/ucm/cht-bsw-rt5672/Makefile.am
> >> new file mode 100644
> >> index 00000000..c3d557fa
> >> --- /dev/null
> >> +++ b/src/conf/ucm/cht-bsw-rt5672/Makefile.am
> >> @@ -0,0 +1,4 @@
> >> +alsaconfigdir = @ALSA_CONFIG_DIR@
> >> +ucmdir = $(alsaconfigdir)/ucm/cht-bsw-rt5672
> >> +ucm_DATA = cht-bsw-rt5672.conf HiFi.conf
> >> +EXTRA_DIST = $(ucm_DATA)
> >> diff --git a/src/conf/ucm/cht-bsw-rt5672/cht-bsw-rt5672.conf b/src/conf/ucm/cht-bsw-rt5672/cht-bsw-rt5672.conf
> >> new file mode 100644
> >> index 00000000..c79024d9
> >> --- /dev/null
> >> +++ b/src/conf/ucm/cht-bsw-rt5672/cht-bsw-rt5672.conf
> >> @@ -0,0 +1,6 @@
> >> +# Adapted from https://github.com/plbossart/UCM/tree/master/cht-bsw-rt5672
> >> +
> >> +SectionUseCase."HiFi" {
> >> +	File "HiFi.conf"
> >> +	Comment "Play HiFi quality Music"
> >> +}
> >> diff --git a/src/conf/ucm/codecs/Makefile.am b/src/conf/ucm/codecs/Makefile.am
> >> index 5987b9cf..17c4ebf9 100644
> >> --- a/src/conf/ucm/codecs/Makefile.am
> >> +++ b/src/conf/ucm/codecs/Makefile.am
> >> @@ -4,4 +4,5 @@ es8316 \
> >>   rt5640 \
> >>   rt5645 \
> >>   rt5651 \
> >> +rt5672 \
> >>   nau8824
> >> diff --git a/src/conf/ucm/codecs/rt5672/DMIC1.conf b/src/conf/ucm/codecs/rt5672/DMIC1.conf
> >> new file mode 100644
> >> index 00000000..9a8db1a5
> >> --- /dev/null
> >> +++ b/src/conf/ucm/codecs/rt5672/DMIC1.conf
> >> @@ -0,0 +1,28 @@
> >> +SectionDevice."DigitalMic-DMIC1" {
> >> +	Comment "Internal Digital Microphone on DMIC1"
> >> +
> >> +	ConflictingDevice [
> >> +		"DigitalMic-DMIC2"
> >> +		"HeadsetMic"
> >> +	]
> >> +
> >> +	EnableSequence [
> >> +		cdev "hw:chtbswrt5672"
> >> +		cset "name='Int Mic Switch' on"
> >> +		cset "name='Stereo1 DMIC Mux' DMIC1"
> >> +		cset "name='Stereo1 ADC 2 Mux' DMIC"
> >> +		cset "name='Sto1 ADC MIXL ADC2 Switch' on"
> >> +		cset "name='Sto1 ADC MIXR ADC2 Switch' on"
> >> +	]
> >> +
> >> +	DisableSequence [
> >> +		cdev "hw:chtbswrt5672"
> >> +		cset "name='Int Mic Switch' off"
> >> +		cset "name='Sto1 ADC MIXL ADC2 Switch' off"
> >> +		cset "name='Sto1 ADC MIXR ADC2 Switch' off"
> >> +	]
> >> +
> >> +	Value {
> >> +		CaptureChannels 2
> >> +	}
> >> +}
> >> diff --git a/src/conf/ucm/codecs/rt5672/DMIC2.conf b/src/conf/ucm/codecs/rt5672/DMIC2.conf
> >> new file mode 100644
> >> index 00000000..b960436e
> >> --- /dev/null
> >> +++ b/src/conf/ucm/codecs/rt5672/DMIC2.conf
> >> @@ -0,0 +1,28 @@
> >> +SectionDevice."DigitalMic-DMIC2" {
> >> +	Comment "Internal Digital Microphone on DMIC2"
> >> +
> >> +	ConflictingDevice [
> >> +		"DigitalMic-DMIC1"
> >> +		"HeadsetMic"
> >> +	]
> >> +
> >> +	EnableSequence [
> >> +		cdev "hw:chtbswrt5672"
> >> +		cset "name='Int Mic Switch' on"
> >> +		cset "name='Stereo1 DMIC Mux' DMIC2"
> >> +		cset "name='Stereo1 ADC 2 Mux' DMIC"
> >> +		cset "name='Sto1 ADC MIXL ADC2 Switch' on"
> >> +		cset "name='Sto1 ADC MIXR ADC2 Switch' on"
> >> +	]
> >> +
> >> +	DisableSequence [
> >> +		cdev "hw:chtbswrt5672"
> >> +		cset "name='Int Mic Switch' off"
> >> +		cset "name='Sto1 ADC MIXL ADC2 Switch' off"
> >> +		cset "name='Sto1 ADC MIXR ADC2 Switch' off"
> >> +	]
> >> +
> >> +	Value {
> >> +		CaptureChannels 2
> >> +	}
> >> +}
> >> diff --git a/src/conf/ucm/codecs/rt5672/EnableSeq.conf b/src/conf/ucm/codecs/rt5672/EnableSeq.conf
> >> new file mode 100644
> >> index 00000000..bd4f357c
> >> --- /dev/null
> >> +++ b/src/conf/ucm/codecs/rt5672/EnableSeq.conf
> >> @@ -0,0 +1,48 @@
> >> +# Playback (I2S1)
> >> +
> >> +# common
> >> +cset "name='DAC1 L Mux' IF1 DAC"
> >> +cset "name='DAC1 R Mux' IF1 DAC"
> >> +cset "name='DAC1 MIXL DAC1 Switch' on"
> >> +cset "name='DAC1 MIXR DAC1 Switch' on"
> >> +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"
> >> +
> >> +# speaker
> >> +cset "name='PDM1 L Mux' Stereo DAC"
> >> +cset "name='PDM1 R Mux' Stereo DAC"
> >> +
> >> +# headphone
> >> +cset "name='HPOVOL MIXL DAC1 Switch' on"
> >> +cset "name='HPOVOL MIXR DAC1 Switch' on"
> >> +cset "name='HPO MIX HPVOL Switch' on"
> >> +
> >> +# line out
> >> +# cset "name='OUT MIXL DAC L1 Switch' on"
> >> +# cset "name='OUT MIXR DAC R1 Switch' on"
> >> +# cset "name='LOUT MIX OUTMIX L Switch' on"
> >> +# cset "name='LOUT MIX OUTMIX R Switch' on"
> >> +
> >> +# 47=0dB, 0.375 dB/step
> >> +cset "name='ADC Capture Volume' 47"
> >> +cset "name='ADC Capture Switch' on"
> >> +
> >> +# Headset mic is quite soft, boost it a bit, 1 = 20dB which is the first
> >> +# available boost step
> >> +cset "name='IN1 Boost Volume' 1"
> >> +
> >> +# Start with all outputs / inputs disabled
> >> +cset "name='Ext Spk Switch' off"
> >> +cset "name='Headphone Switch' off"
> >> +cset "name='Int Mic Switch' off"
> >> +cset "name='Headset Mic Switch' off"
> >> +cset "name='Sto1 ADC MIXL ADC1 Switch' off"
> >> +cset "name='Sto1 ADC MIXR ADC1 Switch' off"
> >> +cset "name='Sto1 ADC MIXL ADC2 Switch' off"
> >> +cset "name='Sto1 ADC MIXR ADC2 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"
> >> diff --git a/src/conf/ucm/codecs/rt5672/HeadPhones.conf b/src/conf/ucm/codecs/rt5672/HeadPhones.conf
> >> new file mode 100644
> >> index 00000000..cb8aad2d
> >> --- /dev/null
> >> +++ b/src/conf/ucm/codecs/rt5672/HeadPhones.conf
> >> @@ -0,0 +1,23 @@
> >> +SectionDevice."Headphones" {
> >> +	Comment "Headphones"
> >> +
> >> +	ConflictingDevice [
> >> +		"Speaker"
> >> +		"MonoSpeaker"
> >> +	]
> >> +
> >> +	EnableSequence [
> >> +		cdev "hw:chtbswrt5672"
> >> +		cset "name='Headphone Switch' on"
> >> +	]
> >> +
> >> +	DisableSequence [
> >> +		cdev "hw:chtbswrt5672"
> >> +		cset "name='Headphone Switch' off"
> >> +	]
> >> +
> >> +	Value {
> >> +		PlaybackChannels "2"
> >> +		JackControl "Headphone Jack"
> >> +	}
> >> +}
> >> diff --git a/src/conf/ucm/codecs/rt5672/HeadsetMic.conf b/src/conf/ucm/codecs/rt5672/HeadsetMic.conf
> >> new file mode 100644
> >> index 00000000..cc6d8d56
> >> --- /dev/null
> >> +++ b/src/conf/ucm/codecs/rt5672/HeadsetMic.conf
> >> @@ -0,0 +1,38 @@
> >> +SectionDevice."HeadsetMic" {
> >> +	Comment "Headset Microphone"
> >> +
> >> +	ConflictingDevice [
> >> +		"DigitalMic-DMIC1"
> >> +		"DigitalMic-DMIC2"
> >> +	]
> >> +
> >> +	EnableSequence [
> >> +		cdev "hw:chtbswrt5672"
> >> +		cset "name='Headset Mic Switch' on"
> >> +        	cset "name='RECMIXL BST1 Switch' on"
> >> +		cset "name='RECMIXR BST1 Switch' on"
> >> +		cset "name='Sto1 ADC MIXL ADC1 Switch' on"
> >> +		cset "name='Sto1 ADC MIXR ADC1 Switch' on"
> >> +		# For unknown reasons the headset mic sound is only recorded
> >> +		# on the left channel, we tweak the data-stream reception to
> >> +		# use the left samples for both slots, so that we get a stereo
> >> +		# stream with the mic sound on both channels
> >> +		cset "name='codec_in rx deinterleaver codec_in0_1' 1"
> >> +	]
> >> +
> >> +	DisableSequence [
> >> +		cdev "hw:chtbswrt5672"
> >> +		cset "name='Headset Mic Switch' off"
> >> +        	cset "name='RECMIXL BST1 Switch' off"
> >> +		cset "name='RECMIXR BST1 Switch' off"
> >> +		cset "name='Sto1 ADC MIXL ADC1 Switch' off"
> >> +		cset "name='Sto1 ADC MIXR ADC1 Switch' off"
> >> +		# Undo data-stream reception mono-mix workaround
> >> +		cset "name='codec_in rx deinterleaver codec_in0_1' 2"
> >> +	]
> >> +
> >> +	Value {
> >> +		CaptureChannels "2"
> >> +		JackControl "Headset Mic Jack"
> >> +	}
> >> +}
> >> diff --git a/src/conf/ucm/codecs/rt5672/Makefile.am b/src/conf/ucm/codecs/rt5672/Makefile.am
> >> new file mode 100644
> >> index 00000000..feba0b76
> >> --- /dev/null
> >> +++ b/src/conf/ucm/codecs/rt5672/Makefile.am
> >> @@ -0,0 +1,5 @@
> >> +alsaconfigdir = @ALSA_CONFIG_DIR@
> >> +ucmdir = $(alsaconfigdir)/ucm/codecs/rt5672
> >> +ucm_DATA = DMIC1.conf DMIC2.conf EnableSeq.conf HeadPhones.conf \
> >> +	   HeadsetMic.conf MonoSpeaker.conf Speaker.conf
> >> +EXTRA_DIST = $(ucm_DATA)
> >> diff --git a/src/conf/ucm/codecs/rt5672/MonoSpeaker.conf b/src/conf/ucm/codecs/rt5672/MonoSpeaker.conf
> >> new file mode 100644
> >> index 00000000..828a1154
> >> --- /dev/null
> >> +++ b/src/conf/ucm/codecs/rt5672/MonoSpeaker.conf
> >> @@ -0,0 +1,26 @@
> >> +SectionDevice."MonoSpeaker" {
> >> +	Comment "Mono Speaker"
> >> +
> >> +	ConflictingDevice [
> >> +		"Speaker"
> >> +		"Headphones"
> >> +	]
> >> +
> >> +	EnableSequence [
> >> +		cdev "hw:chtbswrt5672"
> >> +		cset "name='Stereo DAC MIXR DAC R1 Switch' off"
> >> +		cset "name='Stereo DAC MIXL DAC R1 Switch' on"
> >> +		cset "name='Ext Spk Switch' on"
> >> +	]
> >> +
> >> +	DisableSequence [
> >> +		cdev "hw:chtbswrt5672"
> >> +		cset "name='Ext Spk Switch' off"
> >> +		cset "name='Stereo DAC MIXL DAC R1 Switch' off"
> >> +		cset "name='Stereo DAC MIXR DAC R1 Switch' on"
> >> +	]
> >> +
> >> +	Value {
> >> +		PlaybackChannels "2"
> >> +	}
> >> +}
> >> diff --git a/src/conf/ucm/codecs/rt5672/Speaker.conf b/src/conf/ucm/codecs/rt5672/Speaker.conf
> >> new file mode 100644
> >> index 00000000..f9291e53
> >> --- /dev/null
> >> +++ b/src/conf/ucm/codecs/rt5672/Speaker.conf
> >> @@ -0,0 +1,22 @@
> >> +SectionDevice."Speaker" {
> >> +	Comment "Speakers"
> >> +
> >> +	ConflictingDevice [
> >> +		"MonoSpeaker"
> >> +		"Headphones"
> >> +	]
> >> +
> >> +	EnableSequence [
> >> +		cdev "hw:chtbswrt5672"
> >> +		cset "name='Ext Spk Switch' on"
> >> +	]
> >> +
> >> +	DisableSequence [
> >> +		cdev "hw:chtbswrt5672"
> >> +		cset "name='Ext Spk Switch' off"
> >> +	]
> >> +
> >> +	Value {
> >> +		PlaybackChannels "2"
> >> +	}
> >> +}
> >> -- 
> >> 2.23.0
> >>
> >> _______________________________________________
> >> Alsa-devel mailing list
> >> Alsa-devel@alsa-project.org
> >> https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
> >>
>
Hans de Goede Sept. 3, 2019, 7:47 a.m. UTC | #4
Hi,

On 02-09-19 17:32, Takashi Iwai wrote:
> On Mon, 02 Sep 2019 10:31:30 +0200,
> Hans de Goede wrote:
>>
>> Hi Takashi,
>>
>> On 02-09-19 09:07, Takashi Iwai wrote:
>>> On Sat, 31 Aug 2019 16:58:41 +0200,
>>> Hans de Goede wrote:
>>>>
>>>> Add an UCM profile for Intel boards with a RT5672 codec.
>>>>
>>>> Re-use the existing platform enable and disable sequences for BYT/CHT SST
>>>> support and add a codecs/rt5672 dir with codec specific enable / disable
>>>> sequences for the various inputs and outputs.
>>>>
>>>> This is partly based on earlier work done here:
>>>> https://github.com/plbossart/UCM/tree/master/cht-bsw-rt5672
>>>>
>>>> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
>>>
>>> We've recently set up a new alsa-ucm-conf repo for keeping UCM
>>> profiles outside alsa-lib repo.  The new repo has a different license
>>> (BSD3-Clause) for easily adapting to OSes with license restriction.
>>>
>>> I guess we should put the stuff there from now on, as much as
>>> possible?  The handling of UCM profile is currently pending, and we
>>> need to decide the general policy, as well as how to transfer the
>>> existing profiles to the new repo...
>>
>> I think it is good that we now have a separate repo and I'm fine
>> with re-licensing all my UCM profile work under a BSD3-Clause license.
>>
>> But I believe that until we have actually figured out how this is
>> all going to work and we are actually doing releases from the
>> new alsa-ucm-conf repo, we should keep adding new profiles to
>> alsa-lib for now, because these profiles are necessary for things
>> to work OOTB for our end users.
> 
> Well, putting to both repos isn't a good idea from the packaging POV,
> either.  If we're going to release the alsa-ucm-conf sooner or later
> together with the next alsa-lib release, we can put into the new repo
> from the beginning.

Well, we want to move some of the other UCM profiles over too, right?
(I guess eventually we want to move all of them over)

So we are going to have this duplicate profile problem anyways.

I was thinking of adding a --without-duplicate-ucm-profiles option
to alsa-lib's ./configure which when used disables installation of UCM
profiles which have a copy in the new alsa-ucm-conf.

This will give use a transition period, where distros can choose to either
use alsa-lib with --without-duplicate-ucm-profiles + the new alsa-ucm-conf,
or just use alsa-lib as they have before. Note the idea is for this to
be temporary, eventually the profiles which are "disabled" by
--without-duplicate-ucm-profiles can be dropped and the option removed.

OTOH if you plan to make sure that the next alsa-lib release is done
in sync with the first alsa-ucm-conf release and you plan to move the
UCM profiles which can be moved (licensing) before that, giving us a clean
break, then that is fine too.

Regards,

Hans
Jaroslav Kysela Sept. 3, 2019, 8:02 a.m. UTC | #5
Dne 03. 09. 19 v 9:47 Hans de Goede napsal(a):
> Hi,
> 
> On 02-09-19 17:32, Takashi Iwai wrote:
>> On Mon, 02 Sep 2019 10:31:30 +0200,
>> Hans de Goede wrote:
>>>
>>> Hi Takashi,
>>>
>>> On 02-09-19 09:07, Takashi Iwai wrote:
>>>> On Sat, 31 Aug 2019 16:58:41 +0200,
>>>> Hans de Goede wrote:
>>>>>
>>>>> Add an UCM profile for Intel boards with a RT5672 codec.
>>>>>
>>>>> Re-use the existing platform enable and disable sequences for BYT/CHT SST
>>>>> support and add a codecs/rt5672 dir with codec specific enable / disable
>>>>> sequences for the various inputs and outputs.
>>>>>
>>>>> This is partly based on earlier work done here:
>>>>> https://github.com/plbossart/UCM/tree/master/cht-bsw-rt5672
>>>>>
>>>>> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
>>>>
>>>> We've recently set up a new alsa-ucm-conf repo for keeping UCM
>>>> profiles outside alsa-lib repo.  The new repo has a different license
>>>> (BSD3-Clause) for easily adapting to OSes with license restriction.
>>>>
>>>> I guess we should put the stuff there from now on, as much as
>>>> possible?  The handling of UCM profile is currently pending, and we
>>>> need to decide the general policy, as well as how to transfer the
>>>> existing profiles to the new repo...
>>>
>>> I think it is good that we now have a separate repo and I'm fine
>>> with re-licensing all my UCM profile work under a BSD3-Clause license.
>>>
>>> But I believe that until we have actually figured out how this is
>>> all going to work and we are actually doing releases from the
>>> new alsa-ucm-conf repo, we should keep adding new profiles to
>>> alsa-lib for now, because these profiles are necessary for things
>>> to work OOTB for our end users.
>>
>> Well, putting to both repos isn't a good idea from the packaging POV,
>> either.  If we're going to release the alsa-ucm-conf sooner or later
>> together with the next alsa-lib release, we can put into the new repo
>> from the beginning.
> 
> Well, we want to move some of the other UCM profiles over too, right?
> (I guess eventually we want to move all of them over)
> 
> So we are going to have this duplicate profile problem anyways.
> 
> I was thinking of adding a --without-duplicate-ucm-profiles option
> to alsa-lib's ./configure which when used disables installation of UCM
> profiles which have a copy in the new alsa-ucm-conf.
> 
> This will give use a transition period, where distros can choose to either
> use alsa-lib with --without-duplicate-ucm-profiles + the new alsa-ucm-conf,
> or just use alsa-lib as they have before. Note the idea is for this to
> be temporary, eventually the profiles which are "disabled" by
> --without-duplicate-ucm-profiles can be dropped and the option removed.
> 
> OTOH if you plan to make sure that the next alsa-lib release is done
> in sync with the first alsa-ucm-conf release and you plan to move the
> UCM profiles which can be moved (licensing) before that, giving us a clean
> break, then that is fine too.

Yes, that sounds good. I will also try to send e-mail to all authors for the
permission to change the licence to BSD3-Clause license. Perhaps, we can get
all agreements before the next alsa-lib is released, so all UCM profiles will
be moved to the new repository and the configuration option
--without-duplicate-ucm-profiles will not be required.

					Jaroslav
Pierre-Louis Bossart Sept. 3, 2019, 2:09 p.m. UTC | #6
On 8/31/19 9:58 AM, Hans de Goede wrote:
> Add an UCM profile for Intel boards with a RT5672 codec.
> 
> Re-use the existing platform enable and disable sequences for BYT/CHT SST
> support and add a codecs/rt5672 dir with codec specific enable / disable
> sequences for the various inputs and outputs.
> 
> This is partly based on earlier work done here:
> https://github.com/plbossart/UCM/tree/master/cht-bsw-rt5672

Thanks for restarting this Hans.

I can't recall if I did any work here, took default settings from Bard 
Liao (when he was a Realtek) or if I just took examples from a 
Chromebook UCM file. I know there's a Dell tablet which uses this codec, 
but I just can't recall other devices.

Also how does the selection of the configs work, I don't see the same 
thing as in bytcr_rt5640/51 to play with the card long name and quirks. 
Do you expect the user to select the 'right' configs based on 
experimental trial-and-error.

> 
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> ---
>   configure.ac                                  |  2 +
>   src/conf/ucm/Makefile.am                      |  1 +
>   src/conf/ucm/cht-bsw-rt5672/HiFi.conf         | 27 +++++++++++
>   src/conf/ucm/cht-bsw-rt5672/Makefile.am       |  4 ++
>   .../ucm/cht-bsw-rt5672/cht-bsw-rt5672.conf    |  6 +++
>   src/conf/ucm/codecs/Makefile.am               |  1 +
>   src/conf/ucm/codecs/rt5672/DMIC1.conf         | 28 +++++++++++
>   src/conf/ucm/codecs/rt5672/DMIC2.conf         | 28 +++++++++++
>   src/conf/ucm/codecs/rt5672/EnableSeq.conf     | 48 +++++++++++++++++++
>   src/conf/ucm/codecs/rt5672/HeadPhones.conf    | 23 +++++++++
>   src/conf/ucm/codecs/rt5672/HeadsetMic.conf    | 38 +++++++++++++++
>   src/conf/ucm/codecs/rt5672/Makefile.am        |  5 ++
>   src/conf/ucm/codecs/rt5672/MonoSpeaker.conf   | 26 ++++++++++
>   src/conf/ucm/codecs/rt5672/Speaker.conf       | 22 +++++++++
>   14 files changed, 259 insertions(+)
>   create mode 100644 src/conf/ucm/cht-bsw-rt5672/HiFi.conf
>   create mode 100644 src/conf/ucm/cht-bsw-rt5672/Makefile.am
>   create mode 100644 src/conf/ucm/cht-bsw-rt5672/cht-bsw-rt5672.conf
>   create mode 100644 src/conf/ucm/codecs/rt5672/DMIC1.conf
>   create mode 100644 src/conf/ucm/codecs/rt5672/DMIC2.conf
>   create mode 100644 src/conf/ucm/codecs/rt5672/EnableSeq.conf
>   create mode 100644 src/conf/ucm/codecs/rt5672/HeadPhones.conf
>   create mode 100644 src/conf/ucm/codecs/rt5672/HeadsetMic.conf
>   create mode 100644 src/conf/ucm/codecs/rt5672/Makefile.am
>   create mode 100644 src/conf/ucm/codecs/rt5672/MonoSpeaker.conf
>   create mode 100644 src/conf/ucm/codecs/rt5672/Speaker.conf
> 
> diff --git a/configure.ac b/configure.ac
> index 2e955760..9ccca7aa 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -741,6 +741,7 @@ AC_OUTPUT(Makefile doc/Makefile doc/pictures/Makefile doc/doxygen.cfg \
>   	  src/conf/ucm/bytcr-rt5651-stereo-spk-in1-mic/Makefile \
>   	  src/conf/ucm/bytcr-rt5651-stereo-spk-in2-mic/Makefile \
>   	  src/conf/ucm/bytcr-rt5651-stereo-spk-in12-mic/Makefile \
> +	  src/conf/ucm/cht-bsw-rt5672/Makefile \
>   	  src/conf/ucm/chtnau8824/Makefile \
>   	  src/conf/ucm/chtrt5645/Makefile \
>   	  src/conf/ucm/chtrt5645-mono-speaker-analog-mic/Makefile \
> @@ -772,6 +773,7 @@ AC_OUTPUT(Makefile doc/Makefile doc/pictures/Makefile doc/doxygen.cfg \
>   	  src/conf/ucm/codecs/rt5640/Makefile \
>   	  src/conf/ucm/codecs/rt5645/Makefile \
>   	  src/conf/ucm/codecs/rt5651/Makefile \
> +	  src/conf/ucm/codecs/rt5672/Makefile \
>   	  src/conf/ucm/platforms/Makefile \
>   	  src/conf/ucm/platforms/bytcr/Makefile \
>   	  src/conf/topology/Makefile \
> diff --git a/src/conf/ucm/Makefile.am b/src/conf/ucm/Makefile.am
> index 02257048..2ed4e1a3 100644
> --- a/src/conf/ucm/Makefile.am
> +++ b/src/conf/ucm/Makefile.am
> @@ -25,6 +25,7 @@ bytcr-rt5651-stereo-spk-dmic-mic \
>   bytcr-rt5651-stereo-spk-in1-mic \
>   bytcr-rt5651-stereo-spk-in2-mic \
>   bytcr-rt5651-stereo-spk-in12-mic \
> +cht-bsw-rt5672 \
>   chtnau8824 \
>   chtrt5645 \
>   chtrt5645-mono-speaker-analog-mic \
> diff --git a/src/conf/ucm/cht-bsw-rt5672/HiFi.conf b/src/conf/ucm/cht-bsw-rt5672/HiFi.conf
> new file mode 100644
> index 00000000..b83099d8
> --- /dev/null
> +++ b/src/conf/ucm/cht-bsw-rt5672/HiFi.conf
> @@ -0,0 +1,27 @@
> +# Adapted from https://github.com/plbossart/UCM/tree/master/cht-bsw-rt5672
> +
> +SectionVerb {
> +	EnableSequence [
> +		cdev "hw:chtbswrt5672"
> +		<platforms/bytcr/PlatformEnableSeq.conf>
> +		<codecs/rt5672/EnableSeq.conf>
> +	]
> +
> +	DisableSequence [
> +		cdev "hw:chtbswrt5672"
> +		<platforms/bytcr/PlatformDisableSeq.conf>
> +	]
> +
> +	Value {
> +		PlaybackPCM "hw:chtbswrt5672"
> +		CapturePCM "hw:chtbswrt5672"
> +	}
> +}
> +
> +<codecs/rt5672/Speaker.conf>
> +<codecs/rt5672/MonoSpeaker.conf>
> +<codecs/rt5672/HeadPhones.conf>
> +
> +<codecs/rt5672/DMIC1.conf>
> +<codecs/rt5672/DMIC2.conf>
> +<codecs/rt5672/HeadsetMic.conf>
> diff --git a/src/conf/ucm/cht-bsw-rt5672/Makefile.am b/src/conf/ucm/cht-bsw-rt5672/Makefile.am
> new file mode 100644
> index 00000000..c3d557fa
> --- /dev/null
> +++ b/src/conf/ucm/cht-bsw-rt5672/Makefile.am
> @@ -0,0 +1,4 @@
> +alsaconfigdir = @ALSA_CONFIG_DIR@
> +ucmdir = $(alsaconfigdir)/ucm/cht-bsw-rt5672
> +ucm_DATA = cht-bsw-rt5672.conf HiFi.conf
> +EXTRA_DIST = $(ucm_DATA)
> diff --git a/src/conf/ucm/cht-bsw-rt5672/cht-bsw-rt5672.conf b/src/conf/ucm/cht-bsw-rt5672/cht-bsw-rt5672.conf
> new file mode 100644
> index 00000000..c79024d9
> --- /dev/null
> +++ b/src/conf/ucm/cht-bsw-rt5672/cht-bsw-rt5672.conf
> @@ -0,0 +1,6 @@
> +# Adapted from https://github.com/plbossart/UCM/tree/master/cht-bsw-rt5672
> +
> +SectionUseCase."HiFi" {
> +	File "HiFi.conf"
> +	Comment "Play HiFi quality Music"
> +}
> diff --git a/src/conf/ucm/codecs/Makefile.am b/src/conf/ucm/codecs/Makefile.am
> index 5987b9cf..17c4ebf9 100644
> --- a/src/conf/ucm/codecs/Makefile.am
> +++ b/src/conf/ucm/codecs/Makefile.am
> @@ -4,4 +4,5 @@ es8316 \
>   rt5640 \
>   rt5645 \
>   rt5651 \
> +rt5672 \
>   nau8824
> diff --git a/src/conf/ucm/codecs/rt5672/DMIC1.conf b/src/conf/ucm/codecs/rt5672/DMIC1.conf
> new file mode 100644
> index 00000000..9a8db1a5
> --- /dev/null
> +++ b/src/conf/ucm/codecs/rt5672/DMIC1.conf
> @@ -0,0 +1,28 @@
> +SectionDevice."DigitalMic-DMIC1" {
> +	Comment "Internal Digital Microphone on DMIC1"
> +
> +	ConflictingDevice [
> +		"DigitalMic-DMIC2"
> +		"HeadsetMic"
> +	]
> +
> +	EnableSequence [
> +		cdev "hw:chtbswrt5672"
> +		cset "name='Int Mic Switch' on"
> +		cset "name='Stereo1 DMIC Mux' DMIC1"
> +		cset "name='Stereo1 ADC 2 Mux' DMIC"
> +		cset "name='Sto1 ADC MIXL ADC2 Switch' on"
> +		cset "name='Sto1 ADC MIXR ADC2 Switch' on"
> +	]
> +
> +	DisableSequence [
> +		cdev "hw:chtbswrt5672"
> +		cset "name='Int Mic Switch' off"
> +		cset "name='Sto1 ADC MIXL ADC2 Switch' off"
> +		cset "name='Sto1 ADC MIXR ADC2 Switch' off"
> +	]
> +
> +	Value {
> +		CaptureChannels 2
> +	}
> +}
> diff --git a/src/conf/ucm/codecs/rt5672/DMIC2.conf b/src/conf/ucm/codecs/rt5672/DMIC2.conf
> new file mode 100644
> index 00000000..b960436e
> --- /dev/null
> +++ b/src/conf/ucm/codecs/rt5672/DMIC2.conf
> @@ -0,0 +1,28 @@
> +SectionDevice."DigitalMic-DMIC2" {
> +	Comment "Internal Digital Microphone on DMIC2"
> +
> +	ConflictingDevice [
> +		"DigitalMic-DMIC1"
> +		"HeadsetMic"
> +	]
> +
> +	EnableSequence [
> +		cdev "hw:chtbswrt5672"
> +		cset "name='Int Mic Switch' on"
> +		cset "name='Stereo1 DMIC Mux' DMIC2"
> +		cset "name='Stereo1 ADC 2 Mux' DMIC"
> +		cset "name='Sto1 ADC MIXL ADC2 Switch' on"
> +		cset "name='Sto1 ADC MIXR ADC2 Switch' on"
> +	]
> +
> +	DisableSequence [
> +		cdev "hw:chtbswrt5672"
> +		cset "name='Int Mic Switch' off"
> +		cset "name='Sto1 ADC MIXL ADC2 Switch' off"
> +		cset "name='Sto1 ADC MIXR ADC2 Switch' off"
> +	]
> +
> +	Value {
> +		CaptureChannels 2
> +	}
> +}
> diff --git a/src/conf/ucm/codecs/rt5672/EnableSeq.conf b/src/conf/ucm/codecs/rt5672/EnableSeq.conf
> new file mode 100644
> index 00000000..bd4f357c
> --- /dev/null
> +++ b/src/conf/ucm/codecs/rt5672/EnableSeq.conf
> @@ -0,0 +1,48 @@
> +# Playback (I2S1)
> +
> +# common
> +cset "name='DAC1 L Mux' IF1 DAC"
> +cset "name='DAC1 R Mux' IF1 DAC"
> +cset "name='DAC1 MIXL DAC1 Switch' on"
> +cset "name='DAC1 MIXR DAC1 Switch' on"
> +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"
> +
> +# speaker
> +cset "name='PDM1 L Mux' Stereo DAC"
> +cset "name='PDM1 R Mux' Stereo DAC"
> +
> +# headphone
> +cset "name='HPOVOL MIXL DAC1 Switch' on"
> +cset "name='HPOVOL MIXR DAC1 Switch' on"
> +cset "name='HPO MIX HPVOL Switch' on"
> +
> +# line out
> +# cset "name='OUT MIXL DAC L1 Switch' on"
> +# cset "name='OUT MIXR DAC R1 Switch' on"
> +# cset "name='LOUT MIX OUTMIX L Switch' on"
> +# cset "name='LOUT MIX OUTMIX R Switch' on"
> +
> +# 47=0dB, 0.375 dB/step
> +cset "name='ADC Capture Volume' 47"
> +cset "name='ADC Capture Switch' on"
> +
> +# Headset mic is quite soft, boost it a bit, 1 = 20dB which is the first
> +# available boost step
> +cset "name='IN1 Boost Volume' 1"
> +
> +# Start with all outputs / inputs disabled
> +cset "name='Ext Spk Switch' off"
> +cset "name='Headphone Switch' off"
> +cset "name='Int Mic Switch' off"
> +cset "name='Headset Mic Switch' off"
> +cset "name='Sto1 ADC MIXL ADC1 Switch' off"
> +cset "name='Sto1 ADC MIXR ADC1 Switch' off"
> +cset "name='Sto1 ADC MIXL ADC2 Switch' off"
> +cset "name='Sto1 ADC MIXR ADC2 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"
> diff --git a/src/conf/ucm/codecs/rt5672/HeadPhones.conf b/src/conf/ucm/codecs/rt5672/HeadPhones.conf
> new file mode 100644
> index 00000000..cb8aad2d
> --- /dev/null
> +++ b/src/conf/ucm/codecs/rt5672/HeadPhones.conf
> @@ -0,0 +1,23 @@
> +SectionDevice."Headphones" {
> +	Comment "Headphones"
> +
> +	ConflictingDevice [
> +		"Speaker"
> +		"MonoSpeaker"
> +	]
> +
> +	EnableSequence [
> +		cdev "hw:chtbswrt5672"
> +		cset "name='Headphone Switch' on"
> +	]
> +
> +	DisableSequence [
> +		cdev "hw:chtbswrt5672"
> +		cset "name='Headphone Switch' off"
> +	]
> +
> +	Value {
> +		PlaybackChannels "2"
> +		JackControl "Headphone Jack"
> +	}
> +}
> diff --git a/src/conf/ucm/codecs/rt5672/HeadsetMic.conf b/src/conf/ucm/codecs/rt5672/HeadsetMic.conf
> new file mode 100644
> index 00000000..cc6d8d56
> --- /dev/null
> +++ b/src/conf/ucm/codecs/rt5672/HeadsetMic.conf
> @@ -0,0 +1,38 @@
> +SectionDevice."HeadsetMic" {
> +	Comment "Headset Microphone"
> +
> +	ConflictingDevice [
> +		"DigitalMic-DMIC1"
> +		"DigitalMic-DMIC2"
> +	]
> +
> +	EnableSequence [
> +		cdev "hw:chtbswrt5672"
> +		cset "name='Headset Mic Switch' on"
> +        	cset "name='RECMIXL BST1 Switch' on"
> +		cset "name='RECMIXR BST1 Switch' on"
> +		cset "name='Sto1 ADC MIXL ADC1 Switch' on"
> +		cset "name='Sto1 ADC MIXR ADC1 Switch' on"
> +		# For unknown reasons the headset mic sound is only recorded
> +		# on the left channel, we tweak the data-stream reception to
> +		# use the left samples for both slots, so that we get a stereo
> +		# stream with the mic sound on both channels
> +		cset "name='codec_in rx deinterleaver codec_in0_1' 1"
> +	]
> +
> +	DisableSequence [
> +		cdev "hw:chtbswrt5672"
> +		cset "name='Headset Mic Switch' off"
> +        	cset "name='RECMIXL BST1 Switch' off"
> +		cset "name='RECMIXR BST1 Switch' off"
> +		cset "name='Sto1 ADC MIXL ADC1 Switch' off"
> +		cset "name='Sto1 ADC MIXR ADC1 Switch' off"
> +		# Undo data-stream reception mono-mix workaround
> +		cset "name='codec_in rx deinterleaver codec_in0_1' 2"
> +	]
> +
> +	Value {
> +		CaptureChannels "2"
> +		JackControl "Headset Mic Jack"
> +	}
> +}
> diff --git a/src/conf/ucm/codecs/rt5672/Makefile.am b/src/conf/ucm/codecs/rt5672/Makefile.am
> new file mode 100644
> index 00000000..feba0b76
> --- /dev/null
> +++ b/src/conf/ucm/codecs/rt5672/Makefile.am
> @@ -0,0 +1,5 @@
> +alsaconfigdir = @ALSA_CONFIG_DIR@
> +ucmdir = $(alsaconfigdir)/ucm/codecs/rt5672
> +ucm_DATA = DMIC1.conf DMIC2.conf EnableSeq.conf HeadPhones.conf \
> +	   HeadsetMic.conf MonoSpeaker.conf Speaker.conf
> +EXTRA_DIST = $(ucm_DATA)
> diff --git a/src/conf/ucm/codecs/rt5672/MonoSpeaker.conf b/src/conf/ucm/codecs/rt5672/MonoSpeaker.conf
> new file mode 100644
> index 00000000..828a1154
> --- /dev/null
> +++ b/src/conf/ucm/codecs/rt5672/MonoSpeaker.conf
> @@ -0,0 +1,26 @@
> +SectionDevice."MonoSpeaker" {
> +	Comment "Mono Speaker"
> +
> +	ConflictingDevice [
> +		"Speaker"
> +		"Headphones"
> +	]
> +
> +	EnableSequence [
> +		cdev "hw:chtbswrt5672"
> +		cset "name='Stereo DAC MIXR DAC R1 Switch' off"
> +		cset "name='Stereo DAC MIXL DAC R1 Switch' on"
> +		cset "name='Ext Spk Switch' on"
> +	]
> +
> +	DisableSequence [
> +		cdev "hw:chtbswrt5672"
> +		cset "name='Ext Spk Switch' off"
> +		cset "name='Stereo DAC MIXL DAC R1 Switch' off"
> +		cset "name='Stereo DAC MIXR DAC R1 Switch' on"
> +	]
> +
> +	Value {
> +		PlaybackChannels "2"
> +	}
> +}
> diff --git a/src/conf/ucm/codecs/rt5672/Speaker.conf b/src/conf/ucm/codecs/rt5672/Speaker.conf
> new file mode 100644
> index 00000000..f9291e53
> --- /dev/null
> +++ b/src/conf/ucm/codecs/rt5672/Speaker.conf
> @@ -0,0 +1,22 @@
> +SectionDevice."Speaker" {
> +	Comment "Speakers"
> +
> +	ConflictingDevice [
> +		"MonoSpeaker"
> +		"Headphones"
> +	]
> +
> +	EnableSequence [
> +		cdev "hw:chtbswrt5672"
> +		cset "name='Ext Spk Switch' on"
> +	]
> +
> +	DisableSequence [
> +		cdev "hw:chtbswrt5672"
> +		cset "name='Ext Spk Switch' off"
> +	]
> +
> +	Value {
> +		PlaybackChannels "2"
> +	}
> +}
>
Hans de Goede Sept. 3, 2019, 2:54 p.m. UTC | #7
Hi,

On 03-09-19 16:09, Pierre-Louis Bossart wrote:
> 
> 
> On 8/31/19 9:58 AM, Hans de Goede wrote:
>> Add an UCM profile for Intel boards with a RT5672 codec.
>>
>> Re-use the existing platform enable and disable sequences for BYT/CHT SST
>> support and add a codecs/rt5672 dir with codec specific enable / disable
>> sequences for the various inputs and outputs.
>>
>> This is partly based on earlier work done here:
>> https://github.com/plbossart/UCM/tree/master/cht-bsw-rt5672
> 
> Thanks for restarting this Hans.
> 
> I can't recall if I did any work here, took default settings from Bard Liao (when he was a Realtek) or if I just took examples from a Chromebook UCM file. I know there's a Dell tablet which uses this codec, but I just can't recall other devices.

I only have the Lenovo Thinkpad 8 with this codec.

> Also how does the selection of the configs work, I don't see the same thing as in bytcr_rt5640/51 to play with the card long name and quirks. Do you expect the user to select the 'right' configs based on experimental trial-and-error.

Like with the chtrt5645 and chtnau8824 there is no need for any
kernel side quirks depending on the input/output config.

So the plan is to have a default profile which
allows selecting all possible inputs / outputs (including
ones not present) and then have DMI name based profiles,
like the profile added for the Lenovo Thinkpad 8 in the
second patch in this series, which only include the
relevant inputs / outputs for that specific device
(as we are doing already for the chtrt5645 and chtnau8824
profiles)

Regards,

Hans

> 
>>
>> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
>> ---
>>   configure.ac                                  |  2 +
>>   src/conf/ucm/Makefile.am                      |  1 +
>>   src/conf/ucm/cht-bsw-rt5672/HiFi.conf         | 27 +++++++++++
>>   src/conf/ucm/cht-bsw-rt5672/Makefile.am       |  4 ++
>>   .../ucm/cht-bsw-rt5672/cht-bsw-rt5672.conf    |  6 +++
>>   src/conf/ucm/codecs/Makefile.am               |  1 +
>>   src/conf/ucm/codecs/rt5672/DMIC1.conf         | 28 +++++++++++
>>   src/conf/ucm/codecs/rt5672/DMIC2.conf         | 28 +++++++++++
>>   src/conf/ucm/codecs/rt5672/EnableSeq.conf     | 48 +++++++++++++++++++
>>   src/conf/ucm/codecs/rt5672/HeadPhones.conf    | 23 +++++++++
>>   src/conf/ucm/codecs/rt5672/HeadsetMic.conf    | 38 +++++++++++++++
>>   src/conf/ucm/codecs/rt5672/Makefile.am        |  5 ++
>>   src/conf/ucm/codecs/rt5672/MonoSpeaker.conf   | 26 ++++++++++
>>   src/conf/ucm/codecs/rt5672/Speaker.conf       | 22 +++++++++
>>   14 files changed, 259 insertions(+)
>>   create mode 100644 src/conf/ucm/cht-bsw-rt5672/HiFi.conf
>>   create mode 100644 src/conf/ucm/cht-bsw-rt5672/Makefile.am
>>   create mode 100644 src/conf/ucm/cht-bsw-rt5672/cht-bsw-rt5672.conf
>>   create mode 100644 src/conf/ucm/codecs/rt5672/DMIC1.conf
>>   create mode 100644 src/conf/ucm/codecs/rt5672/DMIC2.conf
>>   create mode 100644 src/conf/ucm/codecs/rt5672/EnableSeq.conf
>>   create mode 100644 src/conf/ucm/codecs/rt5672/HeadPhones.conf
>>   create mode 100644 src/conf/ucm/codecs/rt5672/HeadsetMic.conf
>>   create mode 100644 src/conf/ucm/codecs/rt5672/Makefile.am
>>   create mode 100644 src/conf/ucm/codecs/rt5672/MonoSpeaker.conf
>>   create mode 100644 src/conf/ucm/codecs/rt5672/Speaker.conf
>>
>> diff --git a/configure.ac b/configure.ac
>> index 2e955760..9ccca7aa 100644
>> --- a/configure.ac
>> +++ b/configure.ac
>> @@ -741,6 +741,7 @@ AC_OUTPUT(Makefile doc/Makefile doc/pictures/Makefile doc/doxygen.cfg \
>>         src/conf/ucm/bytcr-rt5651-stereo-spk-in1-mic/Makefile \
>>         src/conf/ucm/bytcr-rt5651-stereo-spk-in2-mic/Makefile \
>>         src/conf/ucm/bytcr-rt5651-stereo-spk-in12-mic/Makefile \
>> +      src/conf/ucm/cht-bsw-rt5672/Makefile \
>>         src/conf/ucm/chtnau8824/Makefile \
>>         src/conf/ucm/chtrt5645/Makefile \
>>         src/conf/ucm/chtrt5645-mono-speaker-analog-mic/Makefile \
>> @@ -772,6 +773,7 @@ AC_OUTPUT(Makefile doc/Makefile doc/pictures/Makefile doc/doxygen.cfg \
>>         src/conf/ucm/codecs/rt5640/Makefile \
>>         src/conf/ucm/codecs/rt5645/Makefile \
>>         src/conf/ucm/codecs/rt5651/Makefile \
>> +      src/conf/ucm/codecs/rt5672/Makefile \
>>         src/conf/ucm/platforms/Makefile \
>>         src/conf/ucm/platforms/bytcr/Makefile \
>>         src/conf/topology/Makefile \
>> diff --git a/src/conf/ucm/Makefile.am b/src/conf/ucm/Makefile.am
>> index 02257048..2ed4e1a3 100644
>> --- a/src/conf/ucm/Makefile.am
>> +++ b/src/conf/ucm/Makefile.am
>> @@ -25,6 +25,7 @@ bytcr-rt5651-stereo-spk-dmic-mic \
>>   bytcr-rt5651-stereo-spk-in1-mic \
>>   bytcr-rt5651-stereo-spk-in2-mic \
>>   bytcr-rt5651-stereo-spk-in12-mic \
>> +cht-bsw-rt5672 \
>>   chtnau8824 \
>>   chtrt5645 \
>>   chtrt5645-mono-speaker-analog-mic \
>> diff --git a/src/conf/ucm/cht-bsw-rt5672/HiFi.conf b/src/conf/ucm/cht-bsw-rt5672/HiFi.conf
>> new file mode 100644
>> index 00000000..b83099d8
>> --- /dev/null
>> +++ b/src/conf/ucm/cht-bsw-rt5672/HiFi.conf
>> @@ -0,0 +1,27 @@
>> +# Adapted from https://github.com/plbossart/UCM/tree/master/cht-bsw-rt5672
>> +
>> +SectionVerb {
>> +    EnableSequence [
>> +        cdev "hw:chtbswrt5672"
>> +        <platforms/bytcr/PlatformEnableSeq.conf>
>> +        <codecs/rt5672/EnableSeq.conf>
>> +    ]
>> +
>> +    DisableSequence [
>> +        cdev "hw:chtbswrt5672"
>> +        <platforms/bytcr/PlatformDisableSeq.conf>
>> +    ]
>> +
>> +    Value {
>> +        PlaybackPCM "hw:chtbswrt5672"
>> +        CapturePCM "hw:chtbswrt5672"
>> +    }
>> +}
>> +
>> +<codecs/rt5672/Speaker.conf>
>> +<codecs/rt5672/MonoSpeaker.conf>
>> +<codecs/rt5672/HeadPhones.conf>
>> +
>> +<codecs/rt5672/DMIC1.conf>
>> +<codecs/rt5672/DMIC2.conf>
>> +<codecs/rt5672/HeadsetMic.conf>
>> diff --git a/src/conf/ucm/cht-bsw-rt5672/Makefile.am b/src/conf/ucm/cht-bsw-rt5672/Makefile.am
>> new file mode 100644
>> index 00000000..c3d557fa
>> --- /dev/null
>> +++ b/src/conf/ucm/cht-bsw-rt5672/Makefile.am
>> @@ -0,0 +1,4 @@
>> +alsaconfigdir = @ALSA_CONFIG_DIR@
>> +ucmdir = $(alsaconfigdir)/ucm/cht-bsw-rt5672
>> +ucm_DATA = cht-bsw-rt5672.conf HiFi.conf
>> +EXTRA_DIST = $(ucm_DATA)
>> diff --git a/src/conf/ucm/cht-bsw-rt5672/cht-bsw-rt5672.conf b/src/conf/ucm/cht-bsw-rt5672/cht-bsw-rt5672.conf
>> new file mode 100644
>> index 00000000..c79024d9
>> --- /dev/null
>> +++ b/src/conf/ucm/cht-bsw-rt5672/cht-bsw-rt5672.conf
>> @@ -0,0 +1,6 @@
>> +# Adapted from https://github.com/plbossart/UCM/tree/master/cht-bsw-rt5672
>> +
>> +SectionUseCase."HiFi" {
>> +    File "HiFi.conf"
>> +    Comment "Play HiFi quality Music"
>> +}
>> diff --git a/src/conf/ucm/codecs/Makefile.am b/src/conf/ucm/codecs/Makefile.am
>> index 5987b9cf..17c4ebf9 100644
>> --- a/src/conf/ucm/codecs/Makefile.am
>> +++ b/src/conf/ucm/codecs/Makefile.am
>> @@ -4,4 +4,5 @@ es8316 \
>>   rt5640 \
>>   rt5645 \
>>   rt5651 \
>> +rt5672 \
>>   nau8824
>> diff --git a/src/conf/ucm/codecs/rt5672/DMIC1.conf b/src/conf/ucm/codecs/rt5672/DMIC1.conf
>> new file mode 100644
>> index 00000000..9a8db1a5
>> --- /dev/null
>> +++ b/src/conf/ucm/codecs/rt5672/DMIC1.conf
>> @@ -0,0 +1,28 @@
>> +SectionDevice."DigitalMic-DMIC1" {
>> +    Comment "Internal Digital Microphone on DMIC1"
>> +
>> +    ConflictingDevice [
>> +        "DigitalMic-DMIC2"
>> +        "HeadsetMic"
>> +    ]
>> +
>> +    EnableSequence [
>> +        cdev "hw:chtbswrt5672"
>> +        cset "name='Int Mic Switch' on"
>> +        cset "name='Stereo1 DMIC Mux' DMIC1"
>> +        cset "name='Stereo1 ADC 2 Mux' DMIC"
>> +        cset "name='Sto1 ADC MIXL ADC2 Switch' on"
>> +        cset "name='Sto1 ADC MIXR ADC2 Switch' on"
>> +    ]
>> +
>> +    DisableSequence [
>> +        cdev "hw:chtbswrt5672"
>> +        cset "name='Int Mic Switch' off"
>> +        cset "name='Sto1 ADC MIXL ADC2 Switch' off"
>> +        cset "name='Sto1 ADC MIXR ADC2 Switch' off"
>> +    ]
>> +
>> +    Value {
>> +        CaptureChannels 2
>> +    }
>> +}
>> diff --git a/src/conf/ucm/codecs/rt5672/DMIC2.conf b/src/conf/ucm/codecs/rt5672/DMIC2.conf
>> new file mode 100644
>> index 00000000..b960436e
>> --- /dev/null
>> +++ b/src/conf/ucm/codecs/rt5672/DMIC2.conf
>> @@ -0,0 +1,28 @@
>> +SectionDevice."DigitalMic-DMIC2" {
>> +    Comment "Internal Digital Microphone on DMIC2"
>> +
>> +    ConflictingDevice [
>> +        "DigitalMic-DMIC1"
>> +        "HeadsetMic"
>> +    ]
>> +
>> +    EnableSequence [
>> +        cdev "hw:chtbswrt5672"
>> +        cset "name='Int Mic Switch' on"
>> +        cset "name='Stereo1 DMIC Mux' DMIC2"
>> +        cset "name='Stereo1 ADC 2 Mux' DMIC"
>> +        cset "name='Sto1 ADC MIXL ADC2 Switch' on"
>> +        cset "name='Sto1 ADC MIXR ADC2 Switch' on"
>> +    ]
>> +
>> +    DisableSequence [
>> +        cdev "hw:chtbswrt5672"
>> +        cset "name='Int Mic Switch' off"
>> +        cset "name='Sto1 ADC MIXL ADC2 Switch' off"
>> +        cset "name='Sto1 ADC MIXR ADC2 Switch' off"
>> +    ]
>> +
>> +    Value {
>> +        CaptureChannels 2
>> +    }
>> +}
>> diff --git a/src/conf/ucm/codecs/rt5672/EnableSeq.conf b/src/conf/ucm/codecs/rt5672/EnableSeq.conf
>> new file mode 100644
>> index 00000000..bd4f357c
>> --- /dev/null
>> +++ b/src/conf/ucm/codecs/rt5672/EnableSeq.conf
>> @@ -0,0 +1,48 @@
>> +# Playback (I2S1)
>> +
>> +# common
>> +cset "name='DAC1 L Mux' IF1 DAC"
>> +cset "name='DAC1 R Mux' IF1 DAC"
>> +cset "name='DAC1 MIXL DAC1 Switch' on"
>> +cset "name='DAC1 MIXR DAC1 Switch' on"
>> +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"
>> +
>> +# speaker
>> +cset "name='PDM1 L Mux' Stereo DAC"
>> +cset "name='PDM1 R Mux' Stereo DAC"
>> +
>> +# headphone
>> +cset "name='HPOVOL MIXL DAC1 Switch' on"
>> +cset "name='HPOVOL MIXR DAC1 Switch' on"
>> +cset "name='HPO MIX HPVOL Switch' on"
>> +
>> +# line out
>> +# cset "name='OUT MIXL DAC L1 Switch' on"
>> +# cset "name='OUT MIXR DAC R1 Switch' on"
>> +# cset "name='LOUT MIX OUTMIX L Switch' on"
>> +# cset "name='LOUT MIX OUTMIX R Switch' on"
>> +
>> +# 47=0dB, 0.375 dB/step
>> +cset "name='ADC Capture Volume' 47"
>> +cset "name='ADC Capture Switch' on"
>> +
>> +# Headset mic is quite soft, boost it a bit, 1 = 20dB which is the first
>> +# available boost step
>> +cset "name='IN1 Boost Volume' 1"
>> +
>> +# Start with all outputs / inputs disabled
>> +cset "name='Ext Spk Switch' off"
>> +cset "name='Headphone Switch' off"
>> +cset "name='Int Mic Switch' off"
>> +cset "name='Headset Mic Switch' off"
>> +cset "name='Sto1 ADC MIXL ADC1 Switch' off"
>> +cset "name='Sto1 ADC MIXR ADC1 Switch' off"
>> +cset "name='Sto1 ADC MIXL ADC2 Switch' off"
>> +cset "name='Sto1 ADC MIXR ADC2 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"
>> diff --git a/src/conf/ucm/codecs/rt5672/HeadPhones.conf b/src/conf/ucm/codecs/rt5672/HeadPhones.conf
>> new file mode 100644
>> index 00000000..cb8aad2d
>> --- /dev/null
>> +++ b/src/conf/ucm/codecs/rt5672/HeadPhones.conf
>> @@ -0,0 +1,23 @@
>> +SectionDevice."Headphones" {
>> +    Comment "Headphones"
>> +
>> +    ConflictingDevice [
>> +        "Speaker"
>> +        "MonoSpeaker"
>> +    ]
>> +
>> +    EnableSequence [
>> +        cdev "hw:chtbswrt5672"
>> +        cset "name='Headphone Switch' on"
>> +    ]
>> +
>> +    DisableSequence [
>> +        cdev "hw:chtbswrt5672"
>> +        cset "name='Headphone Switch' off"
>> +    ]
>> +
>> +    Value {
>> +        PlaybackChannels "2"
>> +        JackControl "Headphone Jack"
>> +    }
>> +}
>> diff --git a/src/conf/ucm/codecs/rt5672/HeadsetMic.conf b/src/conf/ucm/codecs/rt5672/HeadsetMic.conf
>> new file mode 100644
>> index 00000000..cc6d8d56
>> --- /dev/null
>> +++ b/src/conf/ucm/codecs/rt5672/HeadsetMic.conf
>> @@ -0,0 +1,38 @@
>> +SectionDevice."HeadsetMic" {
>> +    Comment "Headset Microphone"
>> +
>> +    ConflictingDevice [
>> +        "DigitalMic-DMIC1"
>> +        "DigitalMic-DMIC2"
>> +    ]
>> +
>> +    EnableSequence [
>> +        cdev "hw:chtbswrt5672"
>> +        cset "name='Headset Mic Switch' on"
>> +            cset "name='RECMIXL BST1 Switch' on"
>> +        cset "name='RECMIXR BST1 Switch' on"
>> +        cset "name='Sto1 ADC MIXL ADC1 Switch' on"
>> +        cset "name='Sto1 ADC MIXR ADC1 Switch' on"
>> +        # For unknown reasons the headset mic sound is only recorded
>> +        # on the left channel, we tweak the data-stream reception to
>> +        # use the left samples for both slots, so that we get a stereo
>> +        # stream with the mic sound on both channels
>> +        cset "name='codec_in rx deinterleaver codec_in0_1' 1"
>> +    ]
>> +
>> +    DisableSequence [
>> +        cdev "hw:chtbswrt5672"
>> +        cset "name='Headset Mic Switch' off"
>> +            cset "name='RECMIXL BST1 Switch' off"
>> +        cset "name='RECMIXR BST1 Switch' off"
>> +        cset "name='Sto1 ADC MIXL ADC1 Switch' off"
>> +        cset "name='Sto1 ADC MIXR ADC1 Switch' off"
>> +        # Undo data-stream reception mono-mix workaround
>> +        cset "name='codec_in rx deinterleaver codec_in0_1' 2"
>> +    ]
>> +
>> +    Value {
>> +        CaptureChannels "2"
>> +        JackControl "Headset Mic Jack"
>> +    }
>> +}
>> diff --git a/src/conf/ucm/codecs/rt5672/Makefile.am b/src/conf/ucm/codecs/rt5672/Makefile.am
>> new file mode 100644
>> index 00000000..feba0b76
>> --- /dev/null
>> +++ b/src/conf/ucm/codecs/rt5672/Makefile.am
>> @@ -0,0 +1,5 @@
>> +alsaconfigdir = @ALSA_CONFIG_DIR@
>> +ucmdir = $(alsaconfigdir)/ucm/codecs/rt5672
>> +ucm_DATA = DMIC1.conf DMIC2.conf EnableSeq.conf HeadPhones.conf \
>> +       HeadsetMic.conf MonoSpeaker.conf Speaker.conf
>> +EXTRA_DIST = $(ucm_DATA)
>> diff --git a/src/conf/ucm/codecs/rt5672/MonoSpeaker.conf b/src/conf/ucm/codecs/rt5672/MonoSpeaker.conf
>> new file mode 100644
>> index 00000000..828a1154
>> --- /dev/null
>> +++ b/src/conf/ucm/codecs/rt5672/MonoSpeaker.conf
>> @@ -0,0 +1,26 @@
>> +SectionDevice."MonoSpeaker" {
>> +    Comment "Mono Speaker"
>> +
>> +    ConflictingDevice [
>> +        "Speaker"
>> +        "Headphones"
>> +    ]
>> +
>> +    EnableSequence [
>> +        cdev "hw:chtbswrt5672"
>> +        cset "name='Stereo DAC MIXR DAC R1 Switch' off"
>> +        cset "name='Stereo DAC MIXL DAC R1 Switch' on"
>> +        cset "name='Ext Spk Switch' on"
>> +    ]
>> +
>> +    DisableSequence [
>> +        cdev "hw:chtbswrt5672"
>> +        cset "name='Ext Spk Switch' off"
>> +        cset "name='Stereo DAC MIXL DAC R1 Switch' off"
>> +        cset "name='Stereo DAC MIXR DAC R1 Switch' on"
>> +    ]
>> +
>> +    Value {
>> +        PlaybackChannels "2"
>> +    }
>> +}
>> diff --git a/src/conf/ucm/codecs/rt5672/Speaker.conf b/src/conf/ucm/codecs/rt5672/Speaker.conf
>> new file mode 100644
>> index 00000000..f9291e53
>> --- /dev/null
>> +++ b/src/conf/ucm/codecs/rt5672/Speaker.conf
>> @@ -0,0 +1,22 @@
>> +SectionDevice."Speaker" {
>> +    Comment "Speakers"
>> +
>> +    ConflictingDevice [
>> +        "MonoSpeaker"
>> +        "Headphones"
>> +    ]
>> +
>> +    EnableSequence [
>> +        cdev "hw:chtbswrt5672"
>> +        cset "name='Ext Spk Switch' on"
>> +    ]
>> +
>> +    DisableSequence [
>> +        cdev "hw:chtbswrt5672"
>> +        cset "name='Ext Spk Switch' off"
>> +    ]
>> +
>> +    Value {
>> +        PlaybackChannels "2"
>> +    }
>> +}
>>
Pierre-Louis Bossart Sept. 3, 2019, 4:19 p.m. UTC | #8
>> I can't recall if I did any work here, took default settings from Bard 
>> Liao (when he was a Realtek) or if I just took examples from a 
>> Chromebook UCM file. I know there's a Dell tablet which uses this 
>> codec, but I just can't recall other devices.
> 
> I only have the Lenovo Thinkpad 8 with this codec.
> 
>> Also how does the selection of the configs work, I don't see the same 
>> thing as in bytcr_rt5640/51 to play with the card long name and 
>> quirks. Do you expect the user to select the 'right' configs based on 
>> experimental trial-and-error.
> 
> Like with the chtrt5645 and chtnau8824 there is no need for any
> kernel side quirks depending on the input/output config.
> 
> So the plan is to have a default profile which
> allows selecting all possible inputs / outputs (including
> ones not present) and then have DMI name based profiles,
> like the profile added for the Lenovo Thinkpad 8 in the
> second patch in this series, which only include the
> relevant inputs / outputs for that specific device
> (as we are doing already for the chtrt5645 and chtnau8824
> profiles)

Makes sense, I am not aware of too many devices so DMI would work. I 
have a Dell Venue Pro 5855 which is one of the quirks for this codec.
diff mbox series

Patch

diff --git a/configure.ac b/configure.ac
index 2e955760..9ccca7aa 100644
--- a/configure.ac
+++ b/configure.ac
@@ -741,6 +741,7 @@  AC_OUTPUT(Makefile doc/Makefile doc/pictures/Makefile doc/doxygen.cfg \
 	  src/conf/ucm/bytcr-rt5651-stereo-spk-in1-mic/Makefile \
 	  src/conf/ucm/bytcr-rt5651-stereo-spk-in2-mic/Makefile \
 	  src/conf/ucm/bytcr-rt5651-stereo-spk-in12-mic/Makefile \
+	  src/conf/ucm/cht-bsw-rt5672/Makefile \
 	  src/conf/ucm/chtnau8824/Makefile \
 	  src/conf/ucm/chtrt5645/Makefile \
 	  src/conf/ucm/chtrt5645-mono-speaker-analog-mic/Makefile \
@@ -772,6 +773,7 @@  AC_OUTPUT(Makefile doc/Makefile doc/pictures/Makefile doc/doxygen.cfg \
 	  src/conf/ucm/codecs/rt5640/Makefile \
 	  src/conf/ucm/codecs/rt5645/Makefile \
 	  src/conf/ucm/codecs/rt5651/Makefile \
+	  src/conf/ucm/codecs/rt5672/Makefile \
 	  src/conf/ucm/platforms/Makefile \
 	  src/conf/ucm/platforms/bytcr/Makefile \
 	  src/conf/topology/Makefile \
diff --git a/src/conf/ucm/Makefile.am b/src/conf/ucm/Makefile.am
index 02257048..2ed4e1a3 100644
--- a/src/conf/ucm/Makefile.am
+++ b/src/conf/ucm/Makefile.am
@@ -25,6 +25,7 @@  bytcr-rt5651-stereo-spk-dmic-mic \
 bytcr-rt5651-stereo-spk-in1-mic \
 bytcr-rt5651-stereo-spk-in2-mic \
 bytcr-rt5651-stereo-spk-in12-mic \
+cht-bsw-rt5672 \
 chtnau8824 \
 chtrt5645 \
 chtrt5645-mono-speaker-analog-mic \
diff --git a/src/conf/ucm/cht-bsw-rt5672/HiFi.conf b/src/conf/ucm/cht-bsw-rt5672/HiFi.conf
new file mode 100644
index 00000000..b83099d8
--- /dev/null
+++ b/src/conf/ucm/cht-bsw-rt5672/HiFi.conf
@@ -0,0 +1,27 @@ 
+# Adapted from https://github.com/plbossart/UCM/tree/master/cht-bsw-rt5672
+
+SectionVerb {
+	EnableSequence [
+		cdev "hw:chtbswrt5672"
+		<platforms/bytcr/PlatformEnableSeq.conf>
+		<codecs/rt5672/EnableSeq.conf>
+	]
+
+	DisableSequence [
+		cdev "hw:chtbswrt5672"
+		<platforms/bytcr/PlatformDisableSeq.conf>
+	]
+
+	Value {
+		PlaybackPCM "hw:chtbswrt5672"
+		CapturePCM "hw:chtbswrt5672"
+	}
+}
+
+<codecs/rt5672/Speaker.conf>
+<codecs/rt5672/MonoSpeaker.conf>
+<codecs/rt5672/HeadPhones.conf>
+
+<codecs/rt5672/DMIC1.conf>
+<codecs/rt5672/DMIC2.conf>
+<codecs/rt5672/HeadsetMic.conf>
diff --git a/src/conf/ucm/cht-bsw-rt5672/Makefile.am b/src/conf/ucm/cht-bsw-rt5672/Makefile.am
new file mode 100644
index 00000000..c3d557fa
--- /dev/null
+++ b/src/conf/ucm/cht-bsw-rt5672/Makefile.am
@@ -0,0 +1,4 @@ 
+alsaconfigdir = @ALSA_CONFIG_DIR@
+ucmdir = $(alsaconfigdir)/ucm/cht-bsw-rt5672
+ucm_DATA = cht-bsw-rt5672.conf HiFi.conf
+EXTRA_DIST = $(ucm_DATA)
diff --git a/src/conf/ucm/cht-bsw-rt5672/cht-bsw-rt5672.conf b/src/conf/ucm/cht-bsw-rt5672/cht-bsw-rt5672.conf
new file mode 100644
index 00000000..c79024d9
--- /dev/null
+++ b/src/conf/ucm/cht-bsw-rt5672/cht-bsw-rt5672.conf
@@ -0,0 +1,6 @@ 
+# Adapted from https://github.com/plbossart/UCM/tree/master/cht-bsw-rt5672
+
+SectionUseCase."HiFi" {
+	File "HiFi.conf"
+	Comment "Play HiFi quality Music"
+}
diff --git a/src/conf/ucm/codecs/Makefile.am b/src/conf/ucm/codecs/Makefile.am
index 5987b9cf..17c4ebf9 100644
--- a/src/conf/ucm/codecs/Makefile.am
+++ b/src/conf/ucm/codecs/Makefile.am
@@ -4,4 +4,5 @@  es8316 \
 rt5640 \
 rt5645 \
 rt5651 \
+rt5672 \
 nau8824
diff --git a/src/conf/ucm/codecs/rt5672/DMIC1.conf b/src/conf/ucm/codecs/rt5672/DMIC1.conf
new file mode 100644
index 00000000..9a8db1a5
--- /dev/null
+++ b/src/conf/ucm/codecs/rt5672/DMIC1.conf
@@ -0,0 +1,28 @@ 
+SectionDevice."DigitalMic-DMIC1" {
+	Comment "Internal Digital Microphone on DMIC1"
+
+	ConflictingDevice [
+		"DigitalMic-DMIC2"
+		"HeadsetMic"
+	]
+
+	EnableSequence [
+		cdev "hw:chtbswrt5672"
+		cset "name='Int Mic Switch' on"
+		cset "name='Stereo1 DMIC Mux' DMIC1"
+		cset "name='Stereo1 ADC 2 Mux' DMIC"
+		cset "name='Sto1 ADC MIXL ADC2 Switch' on"
+		cset "name='Sto1 ADC MIXR ADC2 Switch' on"
+	]
+
+	DisableSequence [
+		cdev "hw:chtbswrt5672"
+		cset "name='Int Mic Switch' off"
+		cset "name='Sto1 ADC MIXL ADC2 Switch' off"
+		cset "name='Sto1 ADC MIXR ADC2 Switch' off"
+	]
+
+	Value {
+		CaptureChannels 2
+	}
+}
diff --git a/src/conf/ucm/codecs/rt5672/DMIC2.conf b/src/conf/ucm/codecs/rt5672/DMIC2.conf
new file mode 100644
index 00000000..b960436e
--- /dev/null
+++ b/src/conf/ucm/codecs/rt5672/DMIC2.conf
@@ -0,0 +1,28 @@ 
+SectionDevice."DigitalMic-DMIC2" {
+	Comment "Internal Digital Microphone on DMIC2"
+
+	ConflictingDevice [
+		"DigitalMic-DMIC1"
+		"HeadsetMic"
+	]
+
+	EnableSequence [
+		cdev "hw:chtbswrt5672"
+		cset "name='Int Mic Switch' on"
+		cset "name='Stereo1 DMIC Mux' DMIC2"
+		cset "name='Stereo1 ADC 2 Mux' DMIC"
+		cset "name='Sto1 ADC MIXL ADC2 Switch' on"
+		cset "name='Sto1 ADC MIXR ADC2 Switch' on"
+	]
+
+	DisableSequence [
+		cdev "hw:chtbswrt5672"
+		cset "name='Int Mic Switch' off"
+		cset "name='Sto1 ADC MIXL ADC2 Switch' off"
+		cset "name='Sto1 ADC MIXR ADC2 Switch' off"
+	]
+
+	Value {
+		CaptureChannels 2
+	}
+}
diff --git a/src/conf/ucm/codecs/rt5672/EnableSeq.conf b/src/conf/ucm/codecs/rt5672/EnableSeq.conf
new file mode 100644
index 00000000..bd4f357c
--- /dev/null
+++ b/src/conf/ucm/codecs/rt5672/EnableSeq.conf
@@ -0,0 +1,48 @@ 
+# Playback (I2S1)
+
+# common
+cset "name='DAC1 L Mux' IF1 DAC"
+cset "name='DAC1 R Mux' IF1 DAC"
+cset "name='DAC1 MIXL DAC1 Switch' on"
+cset "name='DAC1 MIXR DAC1 Switch' on"
+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"
+
+# speaker
+cset "name='PDM1 L Mux' Stereo DAC"
+cset "name='PDM1 R Mux' Stereo DAC"
+
+# headphone
+cset "name='HPOVOL MIXL DAC1 Switch' on"
+cset "name='HPOVOL MIXR DAC1 Switch' on"
+cset "name='HPO MIX HPVOL Switch' on"
+
+# line out
+# cset "name='OUT MIXL DAC L1 Switch' on"
+# cset "name='OUT MIXR DAC R1 Switch' on"
+# cset "name='LOUT MIX OUTMIX L Switch' on"
+# cset "name='LOUT MIX OUTMIX R Switch' on"
+
+# 47=0dB, 0.375 dB/step
+cset "name='ADC Capture Volume' 47"
+cset "name='ADC Capture Switch' on"
+
+# Headset mic is quite soft, boost it a bit, 1 = 20dB which is the first
+# available boost step
+cset "name='IN1 Boost Volume' 1"
+
+# Start with all outputs / inputs disabled
+cset "name='Ext Spk Switch' off"
+cset "name='Headphone Switch' off"
+cset "name='Int Mic Switch' off"
+cset "name='Headset Mic Switch' off"
+cset "name='Sto1 ADC MIXL ADC1 Switch' off"
+cset "name='Sto1 ADC MIXR ADC1 Switch' off"
+cset "name='Sto1 ADC MIXL ADC2 Switch' off"
+cset "name='Sto1 ADC MIXR ADC2 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"
diff --git a/src/conf/ucm/codecs/rt5672/HeadPhones.conf b/src/conf/ucm/codecs/rt5672/HeadPhones.conf
new file mode 100644
index 00000000..cb8aad2d
--- /dev/null
+++ b/src/conf/ucm/codecs/rt5672/HeadPhones.conf
@@ -0,0 +1,23 @@ 
+SectionDevice."Headphones" {
+	Comment "Headphones"
+
+	ConflictingDevice [
+		"Speaker"
+		"MonoSpeaker"
+	]
+
+	EnableSequence [
+		cdev "hw:chtbswrt5672"
+		cset "name='Headphone Switch' on"
+	]
+
+	DisableSequence [
+		cdev "hw:chtbswrt5672"
+		cset "name='Headphone Switch' off"
+	]
+
+	Value {
+		PlaybackChannels "2"
+		JackControl "Headphone Jack"
+	}
+}
diff --git a/src/conf/ucm/codecs/rt5672/HeadsetMic.conf b/src/conf/ucm/codecs/rt5672/HeadsetMic.conf
new file mode 100644
index 00000000..cc6d8d56
--- /dev/null
+++ b/src/conf/ucm/codecs/rt5672/HeadsetMic.conf
@@ -0,0 +1,38 @@ 
+SectionDevice."HeadsetMic" {
+	Comment "Headset Microphone"
+
+	ConflictingDevice [
+		"DigitalMic-DMIC1"
+		"DigitalMic-DMIC2"
+	]
+
+	EnableSequence [
+		cdev "hw:chtbswrt5672"
+		cset "name='Headset Mic Switch' on"
+        	cset "name='RECMIXL BST1 Switch' on"
+		cset "name='RECMIXR BST1 Switch' on"
+		cset "name='Sto1 ADC MIXL ADC1 Switch' on"
+		cset "name='Sto1 ADC MIXR ADC1 Switch' on"
+		# For unknown reasons the headset mic sound is only recorded
+		# on the left channel, we tweak the data-stream reception to
+		# use the left samples for both slots, so that we get a stereo
+		# stream with the mic sound on both channels
+		cset "name='codec_in rx deinterleaver codec_in0_1' 1"
+	]
+
+	DisableSequence [
+		cdev "hw:chtbswrt5672"
+		cset "name='Headset Mic Switch' off"
+        	cset "name='RECMIXL BST1 Switch' off"
+		cset "name='RECMIXR BST1 Switch' off"
+		cset "name='Sto1 ADC MIXL ADC1 Switch' off"
+		cset "name='Sto1 ADC MIXR ADC1 Switch' off"
+		# Undo data-stream reception mono-mix workaround
+		cset "name='codec_in rx deinterleaver codec_in0_1' 2"
+	]
+
+	Value {
+		CaptureChannels "2"
+		JackControl "Headset Mic Jack"
+	}
+}
diff --git a/src/conf/ucm/codecs/rt5672/Makefile.am b/src/conf/ucm/codecs/rt5672/Makefile.am
new file mode 100644
index 00000000..feba0b76
--- /dev/null
+++ b/src/conf/ucm/codecs/rt5672/Makefile.am
@@ -0,0 +1,5 @@ 
+alsaconfigdir = @ALSA_CONFIG_DIR@
+ucmdir = $(alsaconfigdir)/ucm/codecs/rt5672
+ucm_DATA = DMIC1.conf DMIC2.conf EnableSeq.conf HeadPhones.conf \
+	   HeadsetMic.conf MonoSpeaker.conf Speaker.conf
+EXTRA_DIST = $(ucm_DATA)
diff --git a/src/conf/ucm/codecs/rt5672/MonoSpeaker.conf b/src/conf/ucm/codecs/rt5672/MonoSpeaker.conf
new file mode 100644
index 00000000..828a1154
--- /dev/null
+++ b/src/conf/ucm/codecs/rt5672/MonoSpeaker.conf
@@ -0,0 +1,26 @@ 
+SectionDevice."MonoSpeaker" {
+	Comment "Mono Speaker"
+
+	ConflictingDevice [
+		"Speaker"
+		"Headphones"
+	]
+
+	EnableSequence [
+		cdev "hw:chtbswrt5672"
+		cset "name='Stereo DAC MIXR DAC R1 Switch' off"
+		cset "name='Stereo DAC MIXL DAC R1 Switch' on"
+		cset "name='Ext Spk Switch' on"
+	]
+
+	DisableSequence [
+		cdev "hw:chtbswrt5672"
+		cset "name='Ext Spk Switch' off"
+		cset "name='Stereo DAC MIXL DAC R1 Switch' off"
+		cset "name='Stereo DAC MIXR DAC R1 Switch' on"
+	]
+
+	Value {
+		PlaybackChannels "2"
+	}
+}
diff --git a/src/conf/ucm/codecs/rt5672/Speaker.conf b/src/conf/ucm/codecs/rt5672/Speaker.conf
new file mode 100644
index 00000000..f9291e53
--- /dev/null
+++ b/src/conf/ucm/codecs/rt5672/Speaker.conf
@@ -0,0 +1,22 @@ 
+SectionDevice."Speaker" {
+	Comment "Speakers"
+
+	ConflictingDevice [
+		"MonoSpeaker"
+		"Headphones"
+	]
+
+	EnableSequence [
+		cdev "hw:chtbswrt5672"
+		cset "name='Ext Spk Switch' on"
+	]
+
+	DisableSequence [
+		cdev "hw:chtbswrt5672"
+		cset "name='Ext Spk Switch' off"
+	]
+
+	Value {
+		PlaybackChannels "2"
+	}
+}