* [PATCH v2] ALSA: scarlett2: Fix Scarlett 4th Gen input gain range
@ 2024-03-11 8:43 Geoffrey D. Bennett
0 siblings, 0 replies; only message in thread
From: Geoffrey D. Bennett @ 2024-03-11 8:43 UTC (permalink / raw)
To: Takashi Iwai; +Cc: Takashi Iwai, linux-sound
The input gain range TLV was previously declared as -70dB to 0dB, but
the preamp gain range is 0dB to +69dB, set with values ranging from 0 to
70. Replace SCARLETT2_GAIN_BIAS with SCARLETT2_MAX_GAIN_VALUE and
SCARLETT2_MAX_GAIN_DB, and update the TLV.
Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Fixes: 0a995e38dc44 ("ALSA: scarlett2: Add support for software-controllable input gain")
---
sound/usb/mixer_scarlett2.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/sound/usb/mixer_scarlett2.c b/sound/usb/mixer_scarlett2.c
index 3815ce1d216e..bd114be537d7 100644
--- a/sound/usb/mixer_scarlett2.c
+++ b/sound/usb/mixer_scarlett2.c
@@ -173,7 +173,12 @@
/* some gui mixers can't handle negative ctl values */
#define SCARLETT2_VOLUME_BIAS 127
-#define SCARLETT2_GAIN_BIAS 70
+
+/* maximum preamp input gain and value
+ * values are from 0 to 70, preamp gain is from 0 to 69dB
+ */
+#define SCARLETT2_MAX_GAIN_VALUE 70
+#define SCARLETT2_MAX_GAIN_DB 69
/* mixer range from -80dB to +6dB in 0.5dB steps */
#define SCARLETT2_MIXER_MIN_DB -80
@@ -3464,7 +3469,7 @@ static int scarlett2_input_gain_ctl_info(struct snd_kcontrol *kctl,
uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
uinfo->count = elem->channels;
uinfo->value.integer.min = 0;
- uinfo->value.integer.max = SCARLETT2_GAIN_BIAS;
+ uinfo->value.integer.max = SCARLETT2_MAX_GAIN_VALUE;
uinfo->value.integer.step = 1;
unlock:
@@ -3541,7 +3546,7 @@ static int scarlett2_input_gain_ctl_put(struct snd_kcontrol *kctl,
}
static const DECLARE_TLV_DB_MINMAX(
- db_scale_scarlett2_gain, -SCARLETT2_GAIN_BIAS * 100, 0
+ db_scale_scarlett2_gain, 0, SCARLETT2_MAX_GAIN_DB * 100
);
static const struct snd_kcontrol_new scarlett2_input_gain_ctl = {
--
2.43.0
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2024-03-11 8:43 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-11 8:43 [PATCH v2] ALSA: scarlett2: Fix Scarlett 4th Gen input gain range Geoffrey D. Bennett
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox