Skip to content

Commit 74f7347

Browse files
committed
ALSA: usb-audio: Apply 48kHz fixed rate playback for Jabra Evolve 65 headset
Jabra Evolve 65 headset appears as if supporting lower rates than 48kHz, but it actually doesn't work but with 48kHz for playback. This patch applies a workaround to enforce the 48kHz like LINE6 devices already did. The workaround is put in a unified helper function, set_fixed_rate(), to be called from both places now. BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=206149 Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Takashi Iwai <[email protected]>
1 parent bb6d3fb commit 74f7347

File tree

1 file changed

+22
-11
lines changed

1 file changed

+22
-11
lines changed

sound/usb/format.c

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,19 @@ static u64 parse_audio_format_i_type(struct snd_usb_audio *chip,
151151
return pcm_formats;
152152
}
153153

154+
static int set_fixed_rate(struct audioformat *fp, int rate, int rate_bits)
155+
{
156+
kfree(fp->rate_table);
157+
fp->rate_table = kmalloc(sizeof(int), GFP_KERNEL);
158+
if (!fp->rate_table)
159+
return -ENOMEM;
160+
fp->nr_rates = 1;
161+
fp->rate_min = rate;
162+
fp->rate_max = rate;
163+
fp->rates = rate_bits;
164+
fp->rate_table[0] = rate;
165+
return 0;
166+
}
154167

155168
/*
156169
* parse the format descriptor and stores the possible sample rates
@@ -223,6 +236,14 @@ static int parse_audio_format_rates_v1(struct snd_usb_audio *chip, struct audiof
223236
fp->rate_min = combine_triple(&fmt[offset + 1]);
224237
fp->rate_max = combine_triple(&fmt[offset + 4]);
225238
}
239+
240+
/* Jabra Evolve 65 headset */
241+
if (chip->usb_id == USB_ID(0x0b0e, 0x030b)) {
242+
/* only 48kHz for playback while keeping 16kHz for capture */
243+
if (fp->nr_rates != 1)
244+
return set_fixed_rate(fp, 48000, SNDRV_PCM_RATE_48000);
245+
}
246+
226247
return 0;
227248
}
228249

@@ -299,17 +320,7 @@ static int line6_parse_audio_format_rates_quirk(struct snd_usb_audio *chip,
299320
case USB_ID(0x0e41, 0x4248): /* Line6 Helix >= fw 2.82 */
300321
case USB_ID(0x0e41, 0x4249): /* Line6 Helix Rack >= fw 2.82 */
301322
case USB_ID(0x0e41, 0x424a): /* Line6 Helix LT >= fw 2.82 */
302-
/* supported rates: 48Khz */
303-
kfree(fp->rate_table);
304-
fp->rate_table = kmalloc(sizeof(int), GFP_KERNEL);
305-
if (!fp->rate_table)
306-
return -ENOMEM;
307-
fp->nr_rates = 1;
308-
fp->rate_min = 48000;
309-
fp->rate_max = 48000;
310-
fp->rates = SNDRV_PCM_RATE_48000;
311-
fp->rate_table[0] = 48000;
312-
return 0;
323+
return set_fixed_rate(fp, 48000, SNDRV_PCM_RATE_48000);
313324
}
314325

315326
return -ENODEV;

0 commit comments

Comments
 (0)