Lines Matching defs:fp

27  * @fp: audioformat record
32 struct audioformat *fp,
38 switch (fp->protocol) {
45 fp->iface, fp->altsetting, format);
62 fp->dsd_raw = true;
87 fp->fmt_bits = sample_width;
93 fp->iface, fp->altsetting);
105 fp->iface, fp->altsetting,
114 if (snd_usb_is_big_endian_format(chip, fp))
120 if (snd_usb_is_big_endian_format(chip, fp))
131 fp->iface, fp->altsetting,
153 fp->iface, fp->altsetting, format);
156 pcm_formats |= snd_usb_interface_dsd_format_quirks(chip, fp, sample_bytes);
161 static int set_fixed_rate(struct audioformat *fp, int rate, int rate_bits)
163 kfree(fp->rate_table);
164 fp->rate_table = kmalloc(sizeof(int), GFP_KERNEL);
165 if (!fp->rate_table)
167 fp->nr_rates = 1;
168 fp->rate_min = rate;
169 fp->rate_max = rate;
170 fp->rates = rate_bits;
171 fp->rate_table[0] = rate;
176 static void set_rate_table_min_max(struct audioformat *fp)
181 fp->rate_min = INT_MAX;
182 fp->rate_max = 0;
183 fp->rates = 0;
184 for (i = 0; i < fp->nr_rates; i++) {
185 rate = fp->rate_table[i];
186 fp->rate_min = min(fp->rate_min, rate);
187 fp->rate_max = max(fp->rate_max, rate);
188 fp->rates |= snd_pcm_rate_to_rate_bit(rate);
197 * @fp: audioformat record
202 static int parse_audio_format_rates_v1(struct snd_usb_audio *chip, struct audioformat *fp,
210 fp->iface, fp->altsetting);
220 fp->rate_table = kmalloc_array(nr_rates, sizeof(int),
222 if (fp->rate_table == NULL)
225 fp->nr_rates = 0;
238 fp->altsetting == 5 && fp->maxpacksize == 392)
246 fp->rate_table[fp->nr_rates++] = rate;
248 if (!fp->nr_rates) {
251 fp->iface, fp->altsetting);
254 set_rate_table_min_max(fp);
257 fp->rates = SNDRV_PCM_RATE_CONTINUOUS;
258 fp->rate_min = combine_triple(&fmt[offset + 1]);
259 fp->rate_max = combine_triple(&fmt[offset + 4]);
265 if (fp->nr_rates != 1)
266 return set_fixed_rate(fp, 48000, SNDRV_PCM_RATE_48000);
283 static bool s1810c_valid_sample_rate(struct audioformat *fp,
286 switch (fp->altsetting) {
308 struct audioformat *fp,
316 iface = usb_ifnum_to_if(chip->dev, fp->iface);
320 alts = &iface->altsetting[fp->altset_idx];
337 fp->iface, fp->altsetting, max_rate);
352 * Then fp->rate_table can be allocated and filled.
355 struct audioformat *fp, int nr_triplets,
375 fp->rate_min = min;
376 fp->rate_max = max;
377 fp->rates = SNDRV_PCM_RATE_CONTINUOUS;
385 !s1810c_valid_sample_rate(fp, rate))
390 !focusrite_valid_sample_rate(chip, fp, rate))
393 if (fp->rate_table)
394 fp->rate_table[nr_rates] = rate;
416 struct audioformat *fp)
430 return set_fixed_rate(fp, 48000, SNDRV_PCM_RATE_48000);
471 struct audioformat *fp,
488 alts = snd_usb_get_host_interface(chip, fp->iface, fp->altsetting);
492 if (fp->protocol == UAC_VERSION_3) {
506 table = kcalloc(fp->nr_rates, sizeof(*table), GFP_KERNEL);
511 usb_set_interface(dev, fp->iface, 0);
514 for (i = 0; i < fp->nr_rates; i++) {
515 err = snd_usb_set_sample_rate_v2v3(chip, fp, clock,
516 fp->rate_table[i]);
520 if (check_valid_altsetting_v2v3(chip, fp->iface, fp->altsetting))
521 table[nr_rates++] = fp->rate_table[i];
527 fp->iface, fp->altsetting);
528 nr_rates = fp->nr_rates; /* continue as is */
531 if (fp->nr_rates == nr_rates) {
536 kfree(fp->rate_table);
537 fp->rate_table = table;
538 fp->nr_rates = nr_rates;
547 struct audioformat *fp)
552 int clock = snd_usb_clock_find_source(chip, fp, false);
555 ctrl_intf = snd_usb_find_ctrl_interface(chip, fp->iface);
572 ret_l6 = line6_parse_audio_format_rates_quirk(chip, fp);
613 /* Call the triplet parser, and make sure fp->rate_table is NULL.
616 kfree(fp->rate_table);
617 fp->rate_table = NULL;
618 fp->nr_rates = parse_uac2_sample_rate_range(chip, fp, nr_triplets, data);
620 if (fp->nr_rates == 0) {
626 fp->rate_table = kmalloc_array(fp->nr_rates, sizeof(int), GFP_KERNEL);
627 if (!fp->rate_table) {
632 /* Call the triplet parser again, but this time, fp->rate_table is
634 parse_uac2_sample_rate_range(chip, fp, nr_triplets, data);
636 ret = validate_sample_rate_table_v2v3(chip, fp, clock);
640 set_rate_table_min_max(fp);
652 struct audioformat *fp, u64 format,
659 switch (fp->protocol) {
669 /* fp->fmt_type is already set in this case */
670 fmt_type = fp->fmt_type;
684 fp->altsetting == 6)
692 fp->formats = pcm_format_to_bits(pcm_format);
694 fp->formats = parse_audio_format_i_type(chip, fp, format, _fmt);
695 if (!fp->formats)
704 switch (fp->protocol) {
709 fp->channels = fmt->bNrChannels;
710 ret = parse_audio_format_rates_v1(chip, fp, (unsigned char *) fmt, 7);
715 /* fp->channels is already set in this case */
716 ret = parse_audio_format_rates_v2v3(chip, fp);
721 if (fp->channels < 1) {
724 fp->iface, fp->altsetting, fp->channels);
735 struct audioformat *fp,
743 // fp->formats = SNDRV_PCM_FMTBIT_AC3;
744 fp->formats = SNDRV_PCM_FMTBIT_U8; /* temporary hack to receive byte streams */
747 fp->formats = SNDRV_PCM_FMTBIT_MPEG;
752 fp->iface, fp->altsetting, format);
753 fp->formats = SNDRV_PCM_FMTBIT_MPEG;
757 fp->channels = 1;
759 switch (fp->protocol) {
766 fp->frame_size = framesize;
767 ret = parse_audio_format_rates_v1(chip, fp, _fmt, 8); /* fmt[8..] sample rates */
775 fp->frame_size = framesize;
776 ret = parse_audio_format_rates_v2v3(chip, fp);
785 struct audioformat *fp, u64 format,
794 err = parse_audio_format_i(chip, fp, format, fmt);
797 err = parse_audio_format_ii(chip, fp, format, fmt);
802 fp->iface, fp->altsetting,
806 fp->fmt_type = fmt->bFormatType;
818 fp->rates != SNDRV_PCM_RATE_48000 &&
819 fp->rates != SNDRV_PCM_RATE_96000)
827 struct audioformat *fp,
839 fp->fmt_type = UAC_FORMAT_TYPE_I;
841 fp->fmt_type = UAC_FORMAT_TYPE_III;
843 err = parse_audio_format_i(chip, fp, format, as);