alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
* [PATCH alsa-ucm-conf 1/3] codecs/es8316: Fix capture settings
@ 2021-03-07 20:03 Hans de Goede
  2021-03-07 20:03 ` [PATCH alsa-ucm-conf 2/3] codecs/es8316: Fix 'HP Mixer Volume' setting Hans de Goede
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Hans de Goede @ 2021-03-07 20:03 UTC (permalink / raw)
  To: Jaroslav Kysela
  Cc: Hans de Goede, alsa-devel, Pierre-Louis Bossart, Bard Liao

Fix the following issues with the capture settings:

1. Disable ALC / Auto Level Control, it tries to always get an
   input signal even when the user is not talking into the mic
   leading to it cranking up the volume till there is noise at
   the same level as the user talking.

2. The 'ADC PGA Gain Volume' volume control is not the main
   'ADC vol' control, it is the mic amplifier control and
   setting it to 10 sets it to 24dB not 0dB.
   Adjust the comment and set it to 7 which is 16dB which
   gives a good microphone signal strength without introducing
   too much noise (with 'ADC Capture Volume' set to 0dB).

3. There actually is a main 'ADC vol' control which goes from -96 to 0dB
   which is simply called the 'ADC Capture Volume' and when disabling ALC
   it defaults to -96 dB. Add a line setting it to 0dB.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 ucm2/codecs/es8316/EnableSeq.conf | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/ucm2/codecs/es8316/EnableSeq.conf b/ucm2/codecs/es8316/EnableSeq.conf
index 97ccfc9..272ef1a 100644
--- a/ucm2/codecs/es8316/EnableSeq.conf
+++ b/ucm2/codecs/es8316/EnableSeq.conf
@@ -11,11 +11,15 @@ EnableSequence [
 	cset "name='Headphone Mixer Volume' 4"
 	# Set DAC vol to 0 dB (192/192)
 	cset "name='DAC Playback Volume' 192"
-	# Set ADC vold to 0 dB (10/10)
-	cset "name='ADC PGA Gain Volume' 10"
+
+	# Disable Auto Level Control
+	cset "name='ALC Capture Switch' off"
+	# Set ADC vol to 0 dB (192/192)
+	cset "name='ADC Capture Volume' 192"
+	# Set Mic amplifier to +16 dB
+	cset "name='ADC PGA Gain Volume' 7"
 
 	# Setup muxes / switches
 	cset "name='Left Headphone Mixer Left DAC Switch' on"
 	cset "name='Right Headphone Mixer Right DAC Switch' on"
-	cset "name='ALC Capture Switch' on"
 ]
-- 
2.30.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH alsa-ucm-conf 2/3] codecs/es8316: Fix 'HP Mixer Volume' setting
  2021-03-07 20:03 [PATCH alsa-ucm-conf 1/3] codecs/es8316: Fix capture settings Hans de Goede
@ 2021-03-07 20:03 ` Hans de Goede
  2021-03-07 20:03 ` [PATCH alsa-ucm-conf 3/3] codecs/es8316: Add hardware volume-control support Hans de Goede
  2021-03-10 10:00 ` [PATCH alsa-ucm-conf 1/3] codecs/es8316: Fix capture settings Jaroslav Kysela
  2 siblings, 0 replies; 4+ messages in thread
From: Hans de Goede @ 2021-03-07 20:03 UTC (permalink / raw)
  To: Jaroslav Kysela
  Cc: Hans de Goede, alsa-devel, Pierre-Louis Bossart, Bard Liao

The 'HP Mixer Volume' control is interesting in that it has a hole
in its range which should not be used (described in the tlv table),
valid values are 0-4 and 8-11

I assume that the "Set HP mixer vol to -6 dB (4/7) louder does not work"
comment which this patch changes comes from attempts to use values in
that hole in the range (also notice the wrong max value in the comment).

Setting the HP mixer to -6 dB causes the sound to be significantly
softer then under Windows. This commit fixes this by initializing the
HP mixer control to 11 / 0 dB.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 ucm2/codecs/es8316/EnableSeq.conf | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/ucm2/codecs/es8316/EnableSeq.conf b/ucm2/codecs/es8316/EnableSeq.conf
index 272ef1a..147ce53 100644
--- a/ucm2/codecs/es8316/EnableSeq.conf
+++ b/ucm2/codecs/es8316/EnableSeq.conf
@@ -7,8 +7,8 @@ EnableSequence [
 
 	# Set HP vol to 0 dB (3/3)
 	cset "name='Headphone Playback Volume' 3"
-	# Set HP mixer vol to -6 dB (4/7) louder does not work
-	cset "name='Headphone Mixer Volume' 4"
+	# Set HP mixer vol to 0 dB 
+	cset "name='Headphone Mixer Volume' 11"
 	# Set DAC vol to 0 dB (192/192)
 	cset "name='DAC Playback Volume' 192"
 
-- 
2.30.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH alsa-ucm-conf 3/3] codecs/es8316: Add hardware volume-control support
  2021-03-07 20:03 [PATCH alsa-ucm-conf 1/3] codecs/es8316: Fix capture settings Hans de Goede
  2021-03-07 20:03 ` [PATCH alsa-ucm-conf 2/3] codecs/es8316: Fix 'HP Mixer Volume' setting Hans de Goede
@ 2021-03-07 20:03 ` Hans de Goede
  2021-03-10 10:00 ` [PATCH alsa-ucm-conf 1/3] codecs/es8316: Fix capture settings Jaroslav Kysela
  2 siblings, 0 replies; 4+ messages in thread
From: Hans de Goede @ 2021-03-07 20:03 UTC (permalink / raw)
  To: Jaroslav Kysela
  Cc: Hans de Goede, alsa-devel, Pierre-Louis Bossart, Bard Liao

Add hardware volume-control support for the es8316 codec.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 ucm2/codecs/es8316/HeadPhones.conf      | 2 ++
 ucm2/codecs/es8316/IN1-HeadsetMic.conf  | 2 ++
 ucm2/codecs/es8316/IN1-InternalMic.conf | 2 ++
 ucm2/codecs/es8316/IN2-HeadsetMic.conf  | 2 ++
 ucm2/codecs/es8316/IN2-InternalMic.conf | 2 ++
 ucm2/codecs/es8316/MonoSpeaker.conf     | 4 ++++
 ucm2/codecs/es8316/Speaker.conf         | 4 ++++
 7 files changed, 18 insertions(+)

diff --git a/ucm2/codecs/es8316/HeadPhones.conf b/ucm2/codecs/es8316/HeadPhones.conf
index b68569a..57bd448 100644
--- a/ucm2/codecs/es8316/HeadPhones.conf
+++ b/ucm2/codecs/es8316/HeadPhones.conf
@@ -16,6 +16,8 @@ SectionDevice."Headphones" {
 	Value {
 		PlaybackPriority 200
 		PlaybackPCM "hw:${CardId}"
+		PlaybackMixerElem "Headphone Mixer"
+		PlaybackMasterElem "DAC"
 		JackControl "Headphone Jack"
 		JackHWMute "Speaker"
 	}
diff --git a/ucm2/codecs/es8316/IN1-HeadsetMic.conf b/ucm2/codecs/es8316/IN1-HeadsetMic.conf
index a76b275..53958ba 100644
--- a/ucm2/codecs/es8316/IN1-HeadsetMic.conf
+++ b/ucm2/codecs/es8316/IN1-HeadsetMic.conf
@@ -17,6 +17,8 @@ SectionDevice."Headset" {
 	Value {
 		CapturePriority 200
 		CapturePCM "hw:${CardId}"
+		CaptureMixerElem "ADC PGA Gain"
+		CaptureMasterElem "ADC"
 		JackControl "Headset Mic Jack"
 	}
 }
diff --git a/ucm2/codecs/es8316/IN1-InternalMic.conf b/ucm2/codecs/es8316/IN1-InternalMic.conf
index ede0a8c..7e7f75f 100644
--- a/ucm2/codecs/es8316/IN1-InternalMic.conf
+++ b/ucm2/codecs/es8316/IN1-InternalMic.conf
@@ -17,5 +17,7 @@ SectionDevice."Mic" {
 	Value {
 		CapturePriority 100
 		CapturePCM "hw:${CardId}"
+		CaptureMixerElem "ADC PGA Gain"
+		CaptureMasterElem "ADC"
 	}
 }
diff --git a/ucm2/codecs/es8316/IN2-HeadsetMic.conf b/ucm2/codecs/es8316/IN2-HeadsetMic.conf
index b114c86..9221b24 100644
--- a/ucm2/codecs/es8316/IN2-HeadsetMic.conf
+++ b/ucm2/codecs/es8316/IN2-HeadsetMic.conf
@@ -17,6 +17,8 @@ SectionDevice."Headset" {
 	Value {
 		CapturePriority 200
 		CapturePCM "hw:${CardId}"
+		CaptureMixerElem "ADC PGA Gain"
+		CaptureMasterElem "ADC"
 		JackControl "Headset Mic Jack"
 	}
 }
diff --git a/ucm2/codecs/es8316/IN2-InternalMic.conf b/ucm2/codecs/es8316/IN2-InternalMic.conf
index c8fce62..8b73da4 100644
--- a/ucm2/codecs/es8316/IN2-InternalMic.conf
+++ b/ucm2/codecs/es8316/IN2-InternalMic.conf
@@ -17,5 +17,7 @@ SectionDevice."Mic" {
 	Value {
 		CapturePriority 100
 		CapturePCM "hw:${CardId}"
+		CaptureMixerElem "ADC PGA Gain"
+		CaptureMasterElem "ADC"
 	}
 }
diff --git a/ucm2/codecs/es8316/MonoSpeaker.conf b/ucm2/codecs/es8316/MonoSpeaker.conf
index f5f4273..2d76413 100644
--- a/ucm2/codecs/es8316/MonoSpeaker.conf
+++ b/ucm2/codecs/es8316/MonoSpeaker.conf
@@ -33,5 +33,9 @@ SectionDevice."Speaker" {
 	Value {
 		PlaybackPriority 100
 		PlaybackPCM "hw:${CardId}"
+		# The es8316 only has a HP-amp which is muxed to the speaker
+		# or to the headpones output
+		PlaybackMixerElem "Headphone Mixer"
+		PlaybackMasterElem "DAC"
 	}
 }
diff --git a/ucm2/codecs/es8316/Speaker.conf b/ucm2/codecs/es8316/Speaker.conf
index 03c21b3..4e97772 100644
--- a/ucm2/codecs/es8316/Speaker.conf
+++ b/ucm2/codecs/es8316/Speaker.conf
@@ -16,5 +16,9 @@ SectionDevice."Speaker" {
 	Value {
 		PlaybackPriority 100
 		PlaybackPCM "hw:${CardId}"
+		# The es8316 only has a HP-amp which is muxed to the speaker
+		# or to the headpones output
+		PlaybackMixerElem "Headphone Mixer"
+		PlaybackMasterElem "DAC"
 	}
 }
-- 
2.30.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH alsa-ucm-conf 1/3] codecs/es8316: Fix capture settings
  2021-03-07 20:03 [PATCH alsa-ucm-conf 1/3] codecs/es8316: Fix capture settings Hans de Goede
  2021-03-07 20:03 ` [PATCH alsa-ucm-conf 2/3] codecs/es8316: Fix 'HP Mixer Volume' setting Hans de Goede
  2021-03-07 20:03 ` [PATCH alsa-ucm-conf 3/3] codecs/es8316: Add hardware volume-control support Hans de Goede
@ 2021-03-10 10:00 ` Jaroslav Kysela
  2 siblings, 0 replies; 4+ messages in thread
From: Jaroslav Kysela @ 2021-03-10 10:00 UTC (permalink / raw)
  To: Hans de Goede; +Cc: alsa-devel, Pierre-Louis Bossart, Bard Liao

Dne 07. 03. 21 v 21:03 Hans de Goede napsal(a):
> Fix the following issues with the capture settings:
> 
> 1. Disable ALC / Auto Level Control, it tries to always get an
>    input signal even when the user is not talking into the mic
>    leading to it cranking up the volume till there is noise at
>    the same level as the user talking.
> 
> 2. The 'ADC PGA Gain Volume' volume control is not the main
>    'ADC vol' control, it is the mic amplifier control and
>    setting it to 10 sets it to 24dB not 0dB.
>    Adjust the comment and set it to 7 which is 16dB which
>    gives a good microphone signal strength without introducing
>    too much noise (with 'ADC Capture Volume' set to 0dB).
> 
> 3. There actually is a main 'ADC vol' control which goes from -96 to 0dB
>    which is simply called the 'ADC Capture Volume' and when disabling ALC
>    it defaults to -96 dB. Add a line setting it to 0dB.
> 
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Thank you. I applied all three patches from the set.

Note that it may be better to move the static control presets to the
BootSequence, so the user can eventually fine tune them.

				Jaroslav

-- 
Jaroslav Kysela <perex@perex.cz>
Linux Sound Maintainer; ALSA Project; Red Hat, Inc.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-03-10 10:02 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-07 20:03 [PATCH alsa-ucm-conf 1/3] codecs/es8316: Fix capture settings Hans de Goede
2021-03-07 20:03 ` [PATCH alsa-ucm-conf 2/3] codecs/es8316: Fix 'HP Mixer Volume' setting Hans de Goede
2021-03-07 20:03 ` [PATCH alsa-ucm-conf 3/3] codecs/es8316: Add hardware volume-control support Hans de Goede
2021-03-10 10:00 ` [PATCH alsa-ucm-conf 1/3] codecs/es8316: Fix capture settings Jaroslav Kysela

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).