Skip to content

Commit a45cf0a

Browse files
geoffreybennetttiwai
authored andcommitted
ALSA: scarlett2: Fix Scarlett 4th Gen input gain range
The input gain range TLV was declared as -70dB to 0dB, but the preamp gain range is actually 0dB to +70dB. Rename SCARLETT2_GAIN_BIAS to SCARLETT2_MAX_GAIN and update the TLV to fix. Signed-off-by: Geoffrey D. Bennett <g@b4.vu> Fixes: 0a995e3 ("ALSA: scarlett2: Add support for software-controllable input gain") Signed-off-by: Takashi Iwai <tiwai@suse.de> Message-ID: <9168317b5ac5335943d3f14dbcd1cc2d9b2299d0.1710047969.git.g@b4.vu>
1 parent be157c4 commit a45cf0a

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

sound/usb/mixer_scarlett2.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,9 @@
173173

174174
/* some gui mixers can't handle negative ctl values */
175175
#define SCARLETT2_VOLUME_BIAS 127
176-
#define SCARLETT2_GAIN_BIAS 70
176+
177+
/* maximum preamp input gain */
178+
#define SCARLETT2_MAX_GAIN 70
177179

178180
/* mixer range from -80dB to +6dB in 0.5dB steps */
179181
#define SCARLETT2_MIXER_MIN_DB -80
@@ -3464,7 +3466,7 @@ static int scarlett2_input_gain_ctl_info(struct snd_kcontrol *kctl,
34643466
uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
34653467
uinfo->count = elem->channels;
34663468
uinfo->value.integer.min = 0;
3467-
uinfo->value.integer.max = SCARLETT2_GAIN_BIAS;
3469+
uinfo->value.integer.max = SCARLETT2_MAX_GAIN;
34683470
uinfo->value.integer.step = 1;
34693471

34703472
unlock:
@@ -3541,7 +3543,7 @@ static int scarlett2_input_gain_ctl_put(struct snd_kcontrol *kctl,
35413543
}
35423544

35433545
static const DECLARE_TLV_DB_MINMAX(
3544-
db_scale_scarlett2_gain, -SCARLETT2_GAIN_BIAS * 100, 0
3546+
db_scale_scarlett2_gain, 0, SCARLETT2_MAX_GAIN * 100
35453547
);
35463548

35473549
static const struct snd_kcontrol_new scarlett2_input_gain_ctl = {

0 commit comments

Comments
 (0)