Lines Matching refs:fp

27  * @fp: audioformat record
32 struct audioformat *fp,
38 switch (fp->protocol) {
45 fp->iface, fp->altsetting, format);
62 fp->dsd_raw = true;
82 fp->fmt_bits = sample_width;
88 fp->iface, fp->altsetting);
100 fp->iface, fp->altsetting,
109 if (snd_usb_is_big_endian_format(chip, fp))
115 if (snd_usb_is_big_endian_format(chip, fp))
126 fp->iface, fp->altsetting,
151 fp->iface, fp->altsetting, format);
154 pcm_formats |= snd_usb_interface_dsd_format_quirks(chip, fp, sample_bytes);
159 static int set_fixed_rate(struct audioformat *fp, int rate, int rate_bits)
161 kfree(fp->rate_table);
162 fp->rate_table = kmalloc(sizeof(int), GFP_KERNEL);
163 if (!fp->rate_table)
165 fp->nr_rates = 1;
166 fp->rate_min = rate;
167 fp->rate_max = rate;
168 fp->rates = rate_bits;
169 fp->rate_table[0] = rate;
174 static void set_rate_table_min_max(struct audioformat *fp)
179 fp->rate_min = INT_MAX;
180 fp->rate_max = 0;
181 fp->rates = 0;
182 for (i = 0; i < fp->nr_rates; i++) {
183 rate = fp->rate_table[i];
184 fp->rate_min = min(fp->rate_min, rate);
185 fp->rate_max = max(fp->rate_max, rate);
186 fp->rates |= snd_pcm_rate_to_rate_bit(rate);
195 * @fp: audioformat record
200 static int parse_audio_format_rates_v1(struct snd_usb_audio *chip, struct audioformat *fp,
208 fp->iface, fp->altsetting);
218 fp->rate_table = kmalloc_array(nr_rates, sizeof(int),
220 if (fp->rate_table == NULL)
223 fp->nr_rates = 0;
236 fp->altsetting == 5 && fp->maxpacksize == 392)
244 fp->rate_table[fp->nr_rates++] = rate;
246 if (!fp->nr_rates) {
249 fp->iface, fp->altsetting);
252 set_rate_table_min_max(fp);
255 fp->rates = SNDRV_PCM_RATE_CONTINUOUS;
256 fp->rate_min = combine_triple(&fmt[offset + 1]);
257 fp->rate_max = combine_triple(&fmt[offset + 4]);
263 if (fp->nr_rates != 1)
264 return set_fixed_rate(fp, 48000, SNDRV_PCM_RATE_48000);
281 static bool s1810c_valid_sample_rate(struct audioformat *fp,
284 switch (fp->altsetting) {
306 struct audioformat *fp,
314 iface = usb_ifnum_to_if(chip->dev, fp->iface);
318 alts = &iface->altsetting[fp->altset_idx];
335 fp->iface, fp->altsetting, max_rate);
350 * Then fp->rate_table can be allocated and filled.
353 struct audioformat *fp, int nr_triplets,
373 fp->rate_min = min;
374 fp->rate_max = max;
375 fp->rates = SNDRV_PCM_RATE_CONTINUOUS;
383 !s1810c_valid_sample_rate(fp, rate))
388 !focusrite_valid_sample_rate(chip, fp, rate))
391 if (fp->rate_table)
392 fp->rate_table[nr_rates] = rate;
414 struct audioformat *fp)
428 return set_fixed_rate(fp, 48000, SNDRV_PCM_RATE_48000);
469 struct audioformat *fp,
486 alts = snd_usb_get_host_interface(chip, fp->iface, fp->altsetting);
490 if (fp->protocol == UAC_VERSION_3) {
504 table = kcalloc(fp->nr_rates, sizeof(*table), GFP_KERNEL);
509 usb_set_interface(dev, fp->iface, 0);
512 for (i = 0; i < fp->nr_rates; i++) {
513 err = snd_usb_set_sample_rate_v2v3(chip, fp, clock,
514 fp->rate_table[i]);
518 if (check_valid_altsetting_v2v3(chip, fp->iface, fp->altsetting))
519 table[nr_rates++] = fp->rate_table[i];
525 fp->iface, fp->altsetting);
526 nr_rates = fp->nr_rates; /* continue as is */
529 if (fp->nr_rates == nr_rates) {
534 kfree(fp->rate_table);
535 fp->rate_table = table;
536 fp->nr_rates = nr_rates;
545 struct audioformat *fp)
550 int clock = snd_usb_clock_find_source(chip, fp, false);
568 ret_l6 = line6_parse_audio_format_rates_quirk(chip, fp);
609 /* Call the triplet parser, and make sure fp->rate_table is NULL.
612 kfree(fp->rate_table);
613 fp->rate_table = NULL;
614 fp->nr_rates = parse_uac2_sample_rate_range(chip, fp, nr_triplets, data);
616 if (fp->nr_rates == 0) {
622 fp->rate_table = kmalloc_array(fp->nr_rates, sizeof(int), GFP_KERNEL);
623 if (!fp->rate_table) {
628 /* Call the triplet parser again, but this time, fp->rate_table is
630 parse_uac2_sample_rate_range(chip, fp, nr_triplets, data);
632 ret = validate_sample_rate_table_v2v3(chip, fp, clock);
636 set_rate_table_min_max(fp);
648 struct audioformat *fp, u64 format,
655 switch (fp->protocol) {
665 /* fp->fmt_type is already set in this case */
666 fmt_type = fp->fmt_type;
680 fp->altsetting == 6)
688 fp->formats = pcm_format_to_bits(pcm_format);
690 fp->formats = parse_audio_format_i_type(chip, fp, format, _fmt);
691 if (!fp->formats)
700 switch (fp->protocol) {
705 fp->channels = fmt->bNrChannels;
706 ret = parse_audio_format_rates_v1(chip, fp, (unsigned char *) fmt, 7);
711 /* fp->channels is already set in this case */
712 ret = parse_audio_format_rates_v2v3(chip, fp);
717 if (fp->channels < 1) {
720 fp->iface, fp->altsetting, fp->channels);
731 struct audioformat *fp,
739 // fp->formats = SNDRV_PCM_FMTBIT_AC3;
740 fp->formats = SNDRV_PCM_FMTBIT_U8; /* temporary hack to receive byte streams */
743 fp->formats = SNDRV_PCM_FMTBIT_MPEG;
748 fp->iface, fp->altsetting, format);
749 fp->formats = SNDRV_PCM_FMTBIT_MPEG;
753 fp->channels = 1;
755 switch (fp->protocol) {
762 fp->frame_size = framesize;
763 ret = parse_audio_format_rates_v1(chip, fp, _fmt, 8); /* fmt[8..] sample rates */
771 fp->frame_size = framesize;
772 ret = parse_audio_format_rates_v2v3(chip, fp);
781 struct audioformat *fp, u64 format,
790 err = parse_audio_format_i(chip, fp, format, fmt);
793 err = parse_audio_format_ii(chip, fp, format, fmt);
798 fp->iface, fp->altsetting,
802 fp->fmt_type = fmt->bFormatType;
814 fp->rates != SNDRV_PCM_RATE_48000 &&
815 fp->rates != SNDRV_PCM_RATE_96000)
823 struct audioformat *fp,
835 fp->fmt_type = UAC_FORMAT_TYPE_I;
837 fp->fmt_type = UAC_FORMAT_TYPE_III;
839 err = parse_audio_format_i(chip, fp, format, as);