Lines Matching refs:fp
32 struct audioformat *fp, in parse_audio_format_i_type() argument
38 switch (fp->protocol) { in parse_audio_format_i_type()
45 fp->iface, fp->altsetting, format); in parse_audio_format_i_type()
62 fp->dsd_raw = true; in parse_audio_format_i_type()
87 fp->fmt_bits = sample_width; in parse_audio_format_i_type()
93 fp->iface, fp->altsetting); in parse_audio_format_i_type()
105 fp->iface, fp->altsetting, in parse_audio_format_i_type()
114 if (snd_usb_is_big_endian_format(chip, fp)) in parse_audio_format_i_type()
120 if (snd_usb_is_big_endian_format(chip, fp)) in parse_audio_format_i_type()
131 fp->iface, fp->altsetting, in parse_audio_format_i_type()
156 fp->iface, fp->altsetting, format); in parse_audio_format_i_type()
159 pcm_formats |= snd_usb_interface_dsd_format_quirks(chip, fp, sample_bytes); in parse_audio_format_i_type()
164 static int set_fixed_rate(struct audioformat *fp, int rate, int rate_bits) in set_fixed_rate() argument
166 kfree(fp->rate_table); in set_fixed_rate()
167 fp->rate_table = kmalloc(sizeof(int), GFP_KERNEL); in set_fixed_rate()
168 if (!fp->rate_table) in set_fixed_rate()
170 fp->nr_rates = 1; in set_fixed_rate()
171 fp->rate_min = rate; in set_fixed_rate()
172 fp->rate_max = rate; in set_fixed_rate()
173 fp->rates = rate_bits; in set_fixed_rate()
174 fp->rate_table[0] = rate; in set_fixed_rate()
179 static void set_rate_table_min_max(struct audioformat *fp) in set_rate_table_min_max() argument
184 fp->rate_min = INT_MAX; in set_rate_table_min_max()
185 fp->rate_max = 0; in set_rate_table_min_max()
186 fp->rates = 0; in set_rate_table_min_max()
187 for (i = 0; i < fp->nr_rates; i++) { in set_rate_table_min_max()
188 rate = fp->rate_table[i]; in set_rate_table_min_max()
189 fp->rate_min = min(fp->rate_min, rate); in set_rate_table_min_max()
190 fp->rate_max = max(fp->rate_max, rate); in set_rate_table_min_max()
191 fp->rates |= snd_pcm_rate_to_rate_bit(rate); in set_rate_table_min_max()
205 static int parse_audio_format_rates_v1(struct snd_usb_audio *chip, struct audioformat *fp, in parse_audio_format_rates_v1() argument
213 fp->iface, fp->altsetting); in parse_audio_format_rates_v1()
223 fp->rate_table = kmalloc_array(nr_rates, sizeof(int), in parse_audio_format_rates_v1()
225 if (fp->rate_table == NULL) in parse_audio_format_rates_v1()
228 fp->nr_rates = 0; in parse_audio_format_rates_v1()
241 fp->altsetting == 5 && fp->maxpacksize == 392) in parse_audio_format_rates_v1()
249 fp->rate_table[fp->nr_rates++] = rate; in parse_audio_format_rates_v1()
251 if (!fp->nr_rates) { in parse_audio_format_rates_v1()
254 fp->iface, fp->altsetting); in parse_audio_format_rates_v1()
257 set_rate_table_min_max(fp); in parse_audio_format_rates_v1()
260 fp->rates = SNDRV_PCM_RATE_CONTINUOUS; in parse_audio_format_rates_v1()
261 fp->rate_min = combine_triple(&fmt[offset + 1]); in parse_audio_format_rates_v1()
262 fp->rate_max = combine_triple(&fmt[offset + 4]); in parse_audio_format_rates_v1()
268 if (fp->nr_rates != 1) in parse_audio_format_rates_v1()
269 return set_fixed_rate(fp, 48000, SNDRV_PCM_RATE_48000); in parse_audio_format_rates_v1()
286 static bool s1810c_valid_sample_rate(struct audioformat *fp, in s1810c_valid_sample_rate() argument
289 switch (fp->altsetting) { in s1810c_valid_sample_rate()
311 struct audioformat *fp, in focusrite_valid_sample_rate() argument
319 iface = usb_ifnum_to_if(chip->dev, fp->iface); in focusrite_valid_sample_rate()
323 alts = &iface->altsetting[fp->altset_idx]; in focusrite_valid_sample_rate()
340 fp->iface, fp->altsetting, max_rate); in focusrite_valid_sample_rate()
358 struct audioformat *fp, int nr_triplets, in parse_uac2_sample_rate_range() argument
378 fp->rate_min = min; in parse_uac2_sample_rate_range()
379 fp->rate_max = max; in parse_uac2_sample_rate_range()
380 fp->rates = SNDRV_PCM_RATE_CONTINUOUS; in parse_uac2_sample_rate_range()
388 !s1810c_valid_sample_rate(fp, rate)) in parse_uac2_sample_rate_range()
393 !focusrite_valid_sample_rate(chip, fp, rate)) in parse_uac2_sample_rate_range()
396 if (fp->rate_table) in parse_uac2_sample_rate_range()
397 fp->rate_table[nr_rates] = rate; in parse_uac2_sample_rate_range()
419 struct audioformat *fp) in line6_parse_audio_format_rates_quirk() argument
433 return set_fixed_rate(fp, 48000, SNDRV_PCM_RATE_48000); in line6_parse_audio_format_rates_quirk()
474 struct audioformat *fp, in validate_sample_rate_table_v2v3() argument
491 alts = snd_usb_get_host_interface(chip, fp->iface, fp->altsetting); in validate_sample_rate_table_v2v3()
495 if (fp->protocol == UAC_VERSION_3) { in validate_sample_rate_table_v2v3()
509 table = kcalloc(fp->nr_rates, sizeof(*table), GFP_KERNEL); in validate_sample_rate_table_v2v3()
514 usb_set_interface(dev, fp->iface, 0); in validate_sample_rate_table_v2v3()
517 for (i = 0; i < fp->nr_rates; i++) { in validate_sample_rate_table_v2v3()
518 err = snd_usb_set_sample_rate_v2v3(chip, fp, clock, in validate_sample_rate_table_v2v3()
519 fp->rate_table[i]); in validate_sample_rate_table_v2v3()
523 if (check_valid_altsetting_v2v3(chip, fp->iface, fp->altsetting)) in validate_sample_rate_table_v2v3()
524 table[nr_rates++] = fp->rate_table[i]; in validate_sample_rate_table_v2v3()
530 fp->iface, fp->altsetting); in validate_sample_rate_table_v2v3()
531 nr_rates = fp->nr_rates; /* continue as is */ in validate_sample_rate_table_v2v3()
534 if (fp->nr_rates == nr_rates) { in validate_sample_rate_table_v2v3()
539 kfree(fp->rate_table); in validate_sample_rate_table_v2v3()
540 fp->rate_table = table; in validate_sample_rate_table_v2v3()
541 fp->nr_rates = nr_rates; in validate_sample_rate_table_v2v3()
550 struct audioformat *fp) in parse_audio_format_rates_v2v3() argument
555 int clock = snd_usb_clock_find_source(chip, fp, false); in parse_audio_format_rates_v2v3()
573 ret_l6 = line6_parse_audio_format_rates_quirk(chip, fp); in parse_audio_format_rates_v2v3()
617 kfree(fp->rate_table); in parse_audio_format_rates_v2v3()
618 fp->rate_table = NULL; in parse_audio_format_rates_v2v3()
619 fp->nr_rates = parse_uac2_sample_rate_range(chip, fp, nr_triplets, data); in parse_audio_format_rates_v2v3()
621 if (fp->nr_rates == 0) { in parse_audio_format_rates_v2v3()
627 fp->rate_table = kmalloc_array(fp->nr_rates, sizeof(int), GFP_KERNEL); in parse_audio_format_rates_v2v3()
628 if (!fp->rate_table) { in parse_audio_format_rates_v2v3()
635 parse_uac2_sample_rate_range(chip, fp, nr_triplets, data); in parse_audio_format_rates_v2v3()
637 ret = validate_sample_rate_table_v2v3(chip, fp, clock); in parse_audio_format_rates_v2v3()
641 set_rate_table_min_max(fp); in parse_audio_format_rates_v2v3()
653 struct audioformat *fp, u64 format, in parse_audio_format_i() argument
660 switch (fp->protocol) { in parse_audio_format_i()
671 fmt_type = fp->fmt_type; in parse_audio_format_i()
685 fp->altsetting == 6) in parse_audio_format_i()
693 fp->formats = pcm_format_to_bits(pcm_format); in parse_audio_format_i()
695 fp->formats = parse_audio_format_i_type(chip, fp, format, _fmt); in parse_audio_format_i()
696 if (!fp->formats) in parse_audio_format_i()
705 switch (fp->protocol) { in parse_audio_format_i()
710 fp->channels = fmt->bNrChannels; in parse_audio_format_i()
711 ret = parse_audio_format_rates_v1(chip, fp, (unsigned char *) fmt, 7); in parse_audio_format_i()
717 ret = parse_audio_format_rates_v2v3(chip, fp); in parse_audio_format_i()
722 if (fp->channels < 1) { in parse_audio_format_i()
725 fp->iface, fp->altsetting, fp->channels); in parse_audio_format_i()
736 struct audioformat *fp, in parse_audio_format_ii() argument
745 fp->formats = SNDRV_PCM_FMTBIT_U8; /* temporary hack to receive byte streams */ in parse_audio_format_ii()
748 fp->formats = SNDRV_PCM_FMTBIT_MPEG; in parse_audio_format_ii()
753 fp->iface, fp->altsetting, format); in parse_audio_format_ii()
754 fp->formats = SNDRV_PCM_FMTBIT_MPEG; in parse_audio_format_ii()
758 fp->channels = 1; in parse_audio_format_ii()
760 switch (fp->protocol) { in parse_audio_format_ii()
767 fp->frame_size = framesize; in parse_audio_format_ii()
768 ret = parse_audio_format_rates_v1(chip, fp, _fmt, 8); /* fmt[8..] sample rates */ in parse_audio_format_ii()
776 fp->frame_size = framesize; in parse_audio_format_ii()
777 ret = parse_audio_format_rates_v2v3(chip, fp); in parse_audio_format_ii()
786 struct audioformat *fp, u64 format, in snd_usb_parse_audio_format() argument
795 err = parse_audio_format_i(chip, fp, format, fmt); in snd_usb_parse_audio_format()
798 err = parse_audio_format_ii(chip, fp, format, fmt); in snd_usb_parse_audio_format()
803 fp->iface, fp->altsetting, in snd_usb_parse_audio_format()
807 fp->fmt_type = fmt->bFormatType; in snd_usb_parse_audio_format()
819 fp->rates != SNDRV_PCM_RATE_48000 && in snd_usb_parse_audio_format()
820 fp->rates != SNDRV_PCM_RATE_96000) in snd_usb_parse_audio_format()
828 struct audioformat *fp, in snd_usb_parse_audio_format_v3() argument
840 fp->fmt_type = UAC_FORMAT_TYPE_I; in snd_usb_parse_audio_format_v3()
842 fp->fmt_type = UAC_FORMAT_TYPE_III; in snd_usb_parse_audio_format_v3()
844 err = parse_audio_format_i(chip, fp, format, as); in snd_usb_parse_audio_format_v3()