Skip to content

Commit

Permalink
ALSA: usb-audio: Apply 48kHz fixed rate playback for Jabra Evolve 65 …
Browse files Browse the repository at this point in the history
…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]>
  • Loading branch information
tiwai committed Feb 11, 2020
1 parent bb6d3fb commit 74f7347
Showing 1 changed file with 22 additions and 11 deletions.
33 changes: 22 additions & 11 deletions sound/usb/format.c
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,19 @@ static u64 parse_audio_format_i_type(struct snd_usb_audio *chip,
return pcm_formats;
}

static int set_fixed_rate(struct audioformat *fp, int rate, int rate_bits)
{
kfree(fp->rate_table);
fp->rate_table = kmalloc(sizeof(int), GFP_KERNEL);
if (!fp->rate_table)
return -ENOMEM;
fp->nr_rates = 1;
fp->rate_min = rate;
fp->rate_max = rate;
fp->rates = rate_bits;
fp->rate_table[0] = rate;
return 0;
}

/*
* parse the format descriptor and stores the possible sample rates
Expand Down Expand Up @@ -223,6 +236,14 @@ static int parse_audio_format_rates_v1(struct snd_usb_audio *chip, struct audiof
fp->rate_min = combine_triple(&fmt[offset + 1]);
fp->rate_max = combine_triple(&fmt[offset + 4]);
}

/* Jabra Evolve 65 headset */
if (chip->usb_id == USB_ID(0x0b0e, 0x030b)) {
/* only 48kHz for playback while keeping 16kHz for capture */
if (fp->nr_rates != 1)
return set_fixed_rate(fp, 48000, SNDRV_PCM_RATE_48000);
}

return 0;
}

Expand Down Expand Up @@ -299,17 +320,7 @@ static int line6_parse_audio_format_rates_quirk(struct snd_usb_audio *chip,
case USB_ID(0x0e41, 0x4248): /* Line6 Helix >= fw 2.82 */
case USB_ID(0x0e41, 0x4249): /* Line6 Helix Rack >= fw 2.82 */
case USB_ID(0x0e41, 0x424a): /* Line6 Helix LT >= fw 2.82 */
/* supported rates: 48Khz */
kfree(fp->rate_table);
fp->rate_table = kmalloc(sizeof(int), GFP_KERNEL);
if (!fp->rate_table)
return -ENOMEM;
fp->nr_rates = 1;
fp->rate_min = 48000;
fp->rate_max = 48000;
fp->rates = SNDRV_PCM_RATE_48000;
fp->rate_table[0] = 48000;
return 0;
return set_fixed_rate(fp, 48000, SNDRV_PCM_RATE_48000);
}

return -ENODEV;
Expand Down

0 comments on commit 74f7347

Please sign in to comment.