mbox series

[alsa-ucm-conf,v2,0/7] codecs/rt5640: Cleanup + HW volume control support

Message ID 20210308220554.76111-1-hdegoede@redhat.com
Headers show
Series codecs/rt5640: Cleanup + HW volume control support | expand

Message

Hans de Goede March 8, 2021, 10:05 p.m. UTC
Hi All,

Here is v2 of my patch series consisting of some codecs/rt5640 cleanups
and addition of HW volume control support to the rt5640 .conf snippets.

This new version has been updated to deal with the
"[PATCH 3/5] ASoC: rt5640: Add emulated 'DAC1 Playback Switch' control"
kernel-patch being dropped.

Note patch 7 depends on a new "aif:%d" part being added to the
components string, the kernel patches for this are pending upstream
in the "[PATCH resend 0/2] AsoC: rt5640/rt5651: Volume control fixes"
patch-series.

As such patch 7 should probably not be merged until the kernel patches
have landed, because theoretically the new component string part could
change as part of the review of the kernel patches.

Patches 1-6 are ready to be merged now.

Regards,

Hans



Hans de Goede (7):
  codecs/rt5640: Cleanup: unify Stereo / Mono ADC handling
  codecs/rt5640: Cleanup: Initially disable all inputs and outputs
  codecs/rt5640: Cleanup: Move 'SPK MIX' setup to main EnableSequene
  codecs/rt5640: Drop bogus 'DIG MIXL DAC L2 Switch' setting
  codecs/rt5640: Unify capture volume for AIF1 and AIF2 recording paths
  codecs/rt5640: Add hardware volume-control support
  codecs/rt5640: Specify Playback/CaptureMasterElem for HW
    volume-control

 ucm2/bytcr-rt5640/HiFi.conf             | 21 +++++++++++
 ucm2/codecs/rt5640/DigitalMics.conf     | 18 ++++++++-
 ucm2/codecs/rt5640/EnableSeq.conf       | 50 ++++++++++++++++++++-----
 ucm2/codecs/rt5640/HeadPhones.conf      | 15 +++++++-
 ucm2/codecs/rt5640/HeadsetMic.conf      | 24 ++++++++----
 ucm2/codecs/rt5640/IN1-InternalMic.conf | 27 +++++++------
 ucm2/codecs/rt5640/IN3-InternalMic.conf | 27 +++++++------
 ucm2/codecs/rt5640/MonoSpeaker.conf     | 17 +++++++--
 ucm2/codecs/rt5640/Speaker.conf         | 17 +++++++--
 9 files changed, 167 insertions(+), 49 deletions(-)

Comments

Jaroslav Kysela March 10, 2021, 10:24 a.m. UTC | #1
Dne 08. 03. 21 v 23:05 Hans de Goede napsal(a):
> Hi All,
> 
> Here is v2 of my patch series consisting of some codecs/rt5640 cleanups
> and addition of HW volume control support to the rt5640 .conf snippets.
> 
> This new version has been updated to deal with the
> "[PATCH 3/5] ASoC: rt5640: Add emulated 'DAC1 Playback Switch' control"
> kernel-patch being dropped.
> 
> Note patch 7 depends on a new "aif:%d" part being added to the
> components string, the kernel patches for this are pending upstream
> in the "[PATCH resend 0/2] AsoC: rt5640/rt5651: Volume control fixes"
> patch-series.

Applied all except the 7th patch.

Thank you.

				Jaroslav
Hans de Goede March 13, 2021, 12:10 p.m. UTC | #2
Hi,

On 3/8/21 11:05 PM, Hans de Goede wrote:
> Newer kernels add "aif:1" or "aif:2" to the components string to let
> us know which AIF is being used.
> 
> Use this to specify the correct Playback/CaptureMasterElem for HW
> volume-control, based on which AIF is being used.
> 
> On older kernels, where there is no "aif:%d" string in the components
> string, no Playback/CaptureMasterElem is specified.
> 
> In DigitalMics.conf the master mixer is used as regular CaptureMixerElem
> instead of as CaptureMasterElem since the DMICs don't have any analog
> volume control.
> 
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>

The kernel side of this patch has landed now, so this patch can
be merged now.

Thanks & Regards,

Hans


> ---
>  ucm2/bytcr-rt5640/HiFi.conf             | 21 +++++++++++++++++++++
>  ucm2/codecs/rt5640/DigitalMics.conf     | 16 ++++++++++++++++
>  ucm2/codecs/rt5640/HeadPhones.conf      | 12 ++++++++++++
>  ucm2/codecs/rt5640/HeadsetMic.conf      | 12 ++++++++++++
>  ucm2/codecs/rt5640/IN1-InternalMic.conf | 12 ++++++++++++
>  ucm2/codecs/rt5640/IN3-InternalMic.conf | 12 ++++++++++++
>  ucm2/codecs/rt5640/MonoSpeaker.conf     | 12 ++++++++++++
>  ucm2/codecs/rt5640/Speaker.conf         | 12 ++++++++++++
>  8 files changed, 109 insertions(+)
> 
> diff --git a/ucm2/bytcr-rt5640/HiFi.conf b/ucm2/bytcr-rt5640/HiFi.conf
> index a5c05ba..7d504d1 100644
> --- a/ucm2/bytcr-rt5640/HiFi.conf
> +++ b/ucm2/bytcr-rt5640/HiFi.conf
> @@ -1,5 +1,26 @@
>  # Use case Configuration for bytcr-rt5640
>  
> +Define.HaveAif1 ""
> +Define.HaveAif2 ""
> +
> +If.DefineAif1 {
> +	Condition {
> +		Type String
> +		Haystack "${CardComponents}"
> +		Needle "aif:1"
> +	}
> +	True.Define.HaveAif1 "yes"
> +}
> +
> +If.DefineAif2 {
> +	Condition {
> +		Type String
> +		Haystack "${CardComponents}"
> +		Needle "aif:2"
> +	}
> +	True.Define.HaveAif2 "yes"
> +}
> +
>  SectionVerb {
>  	Include.e.File "/codecs/rt5640/EnableSeq.conf"
>  
> diff --git a/ucm2/codecs/rt5640/DigitalMics.conf b/ucm2/codecs/rt5640/DigitalMics.conf
> index 157c544..032d954 100644
> --- a/ucm2/codecs/rt5640/DigitalMics.conf
> +++ b/ucm2/codecs/rt5640/DigitalMics.conf
> @@ -26,5 +26,21 @@ SectionDevice."Mic" {
>  	Value {
>  		CapturePriority 100
>  		CapturePCM "hw:${CardId}"
> +		If.DmicAif1 {
> +			Condition { Type String Empty "${var:HaveAif1}" }
> +			False {
> +				CaptureMixerElem "ADC"
> +				CaptureVolume "ADC Capture Volume"
> +				CaptureSwitch "ADC Capture Switch"
> +			}
> +		}
> +		If.DmicAif2 {
> +			Condition { Type String Empty "${var:HaveAif2}" }
> +			False {
> +				CaptureMixerElem "Mono ADC"
> +				CaptureVolume "Mono ADC Capture Volume"
> +				CaptureSwitch "Mono ADC Capture Switch"
> +			}
> +		}
>  	}
>  }
> diff --git a/ucm2/codecs/rt5640/HeadPhones.conf b/ucm2/codecs/rt5640/HeadPhones.conf
> index 5535111..4fbe95d 100644
> --- a/ucm2/codecs/rt5640/HeadPhones.conf
> +++ b/ucm2/codecs/rt5640/HeadPhones.conf
> @@ -37,5 +37,17 @@ SectionDevice."Headphones" {
>  		JackControl "Headphone Jack"
>  		PlaybackMixerElem "HP"
>  		PlaybackVolume "HP Playback Volume"
> +		If.HpAif1 {
> +			Condition { Type String Empty "${var:HaveAif1}" }
> +			False {
> +				PlaybackMasterElem "DAC1"
> +			}
> +		}
> +		If.HpAif2 {
> +			Condition { Type String Empty "${var:HaveAif2}" }
> +			False {
> +				PlaybackMasterElem "DAC2"
> +			}
> +		}
>  	}
>  }
> diff --git a/ucm2/codecs/rt5640/HeadsetMic.conf b/ucm2/codecs/rt5640/HeadsetMic.conf
> index 8479672..b49dad4 100644
> --- a/ucm2/codecs/rt5640/HeadsetMic.conf
> +++ b/ucm2/codecs/rt5640/HeadsetMic.conf
> @@ -43,5 +43,17 @@ SectionDevice."Headset" {
>  		JackControl "Headset Mic Jack"
>  		CaptureMixerElem "IN2 Boost"
>  		CaptureVolume "IN2 Boost"
> +		If.HSmicAif1 {
> +			Condition { Type String Empty "${var:HaveAif1}" }
> +			False {
> +				CaptureMasterElem "ADC"
> +			}
> +		}
> +		If.HSmicAif2 {
> +			Condition { Type String Empty "${var:HaveAif2}" }
> +			False {
> +				CaptureMasterElem "Mono ADC"
> +			}
> +		}
>  	}
>  }
> diff --git a/ucm2/codecs/rt5640/IN1-InternalMic.conf b/ucm2/codecs/rt5640/IN1-InternalMic.conf
> index a317388..d670484 100644
> --- a/ucm2/codecs/rt5640/IN1-InternalMic.conf
> +++ b/ucm2/codecs/rt5640/IN1-InternalMic.conf
> @@ -34,5 +34,17 @@ SectionDevice."Mic" {
>  		CapturePCM "hw:${CardId}"
>  		CaptureMixerElem "IN1 Boost"
>  		CaptureVolume "IN1 Boost"
> +		If.In1Aif1 {
> +			Condition { Type String Empty "${var:HaveAif1}" }
> +			False {
> +				CaptureMasterElem "ADC"
> +			}
> +		}
> +		If.In1Aif2 {
> +			Condition { Type String Empty "${var:HaveAif2}" }
> +			False {
> +				CaptureMasterElem "Mono ADC"
> +			}
> +		}
>  	}
>  }
> diff --git a/ucm2/codecs/rt5640/IN3-InternalMic.conf b/ucm2/codecs/rt5640/IN3-InternalMic.conf
> index ef4eaba..345db1e 100644
> --- a/ucm2/codecs/rt5640/IN3-InternalMic.conf
> +++ b/ucm2/codecs/rt5640/IN3-InternalMic.conf
> @@ -34,5 +34,17 @@ SectionDevice."Mic" {
>  		CapturePCM "hw:${CardId}"
>  		CaptureMixerElem "IN3 Boost"
>  		CaptureVolume "IN3 Boost"
> +		If.In3Aif1 {
> +			Condition { Type String Empty "${var:HaveAif1}" }
> +			False {
> +				CaptureMasterElem "ADC"
> +			}
> +		}
> +		If.In3Aif2 {
> +			Condition { Type String Empty "${var:HaveAif2}" }
> +			False {
> +				CaptureMasterElem "Mono ADC"
> +			}
> +		}
>  	}
>  }
> diff --git a/ucm2/codecs/rt5640/MonoSpeaker.conf b/ucm2/codecs/rt5640/MonoSpeaker.conf
> index 3cbeafd..addaddd 100644
> --- a/ucm2/codecs/rt5640/MonoSpeaker.conf
> +++ b/ucm2/codecs/rt5640/MonoSpeaker.conf
> @@ -31,5 +31,17 @@ SectionDevice."Speaker" {
>  		PlaybackPCM "hw:${CardId}"
>  		PlaybackMixerElem "Speaker"
>  		PlaybackVolume "Speaker Playback Volume"
> +		If.MonoSpkAif1 {
> +			Condition { Type String Empty "${var:HaveAif1}" }
> +			False {
> +				PlaybackMasterElem "DAC1"
> +			}
> +		}
> +		If.MonoSpkAif2 {
> +			Condition { Type String Empty "${var:HaveAif2}" }
> +			False {
> +				PlaybackMasterElem "DAC2"
> +			}
> +		}
>  	}
>  }
> diff --git a/ucm2/codecs/rt5640/Speaker.conf b/ucm2/codecs/rt5640/Speaker.conf
> index 0924f9c..e7ff673 100644
> --- a/ucm2/codecs/rt5640/Speaker.conf
> +++ b/ucm2/codecs/rt5640/Speaker.conf
> @@ -31,5 +31,17 @@ SectionDevice."Speaker" {
>  		PlaybackPCM "hw:${CardId}"
>  		PlaybackMixerElem "Speaker"
>  		PlaybackVolume "Speaker Playback Volume"
> +		If.SpkAif1 {
> +			Condition { Type String Empty "${var:HaveAif1}" }
> +			False {
> +				PlaybackMasterElem "DAC1"
> +			}
> +		}
> +		If.SpkAif2 {
> +			Condition { Type String Empty "${var:HaveAif2}" }
> +			False {
> +				PlaybackMasterElem "DAC2"
> +			}
> +		}
>  	}
>  }
>
Jaroslav Kysela March 13, 2021, 4:05 p.m. UTC | #3
Dne 13. 03. 21 v 13:10 Hans de Goede napsal(a):
> Hi,
> 
> On 3/8/21 11:05 PM, Hans de Goede wrote:
>> Newer kernels add "aif:1" or "aif:2" to the components string to let
>> us know which AIF is being used.
>>
>> Use this to specify the correct Playback/CaptureMasterElem for HW
>> volume-control, based on which AIF is being used.
>>
>> On older kernels, where there is no "aif:%d" string in the components
>> string, no Playback/CaptureMasterElem is specified.
>>
>> In DigitalMics.conf the master mixer is used as regular CaptureMixerElem
>> instead of as CaptureMasterElem since the DMICs don't have any analog
>> volume control.
>>
>> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> 
> The kernel side of this patch has landed now, so this patch can
> be merged now.

Merged. Thank you.

				Jaroslav