format.c (b08fc5277aaa1d8ea15470d38bf36f19dfb0e125) format.c (3a572d94bcff98a14c94fe686881a169a26f3fca)
1/*
2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License as published by
4 * the Free Software Foundation; either version 2 of the License, or
5 * (at your option) any later version.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of

--- 50 unchanged lines hidden (view full) ---

59 break;
60 }
61
62 case UAC_VERSION_2: {
63 struct uac_format_type_i_ext_descriptor *fmt = _fmt;
64 sample_width = fmt->bBitResolution;
65 sample_bytes = fmt->bSubslotSize;
66
1/*
2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License as published by
4 * the Free Software Foundation; either version 2 of the License, or
5 * (at your option) any later version.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of

--- 50 unchanged lines hidden (view full) ---

59 break;
60 }
61
62 case UAC_VERSION_2: {
63 struct uac_format_type_i_ext_descriptor *fmt = _fmt;
64 sample_width = fmt->bBitResolution;
65 sample_bytes = fmt->bSubslotSize;
66
67 if (format & UAC2_FORMAT_TYPE_I_RAW_DATA)
67 if (format & UAC2_FORMAT_TYPE_I_RAW_DATA) {
68 pcm_formats |= SNDRV_PCM_FMTBIT_SPECIAL;
68 pcm_formats |= SNDRV_PCM_FMTBIT_SPECIAL;
69 /* flag potentially raw DSD capable altsettings */
70 fp->dsd_raw = true;
71 }
69
70 format <<= 1;
71 break;
72 }
73 case UAC_VERSION_3: {
74 struct uac3_as_header_descriptor *as = _fmt;
75
76 sample_width = as->bBitResolution;

--- 106 unchanged lines hidden (view full) ---

183 }
184
185 if (nr_rates) {
186 /*
187 * build the rate table and bitmap flags
188 */
189 int r, idx;
190
72
73 format <<= 1;
74 break;
75 }
76 case UAC_VERSION_3: {
77 struct uac3_as_header_descriptor *as = _fmt;
78
79 sample_width = as->bBitResolution;

--- 106 unchanged lines hidden (view full) ---

186 }
187
188 if (nr_rates) {
189 /*
190 * build the rate table and bitmap flags
191 */
192 int r, idx;
193
191 fp->rate_table = kmalloc_array(nr_rates, sizeof(int),
192 GFP_KERNEL);
194 fp->rate_table = kmalloc(sizeof(int) * nr_rates, GFP_KERNEL);
193 if (fp->rate_table == NULL)
194 return -ENOMEM;
195
196 fp->nr_rates = 0;
197 fp->rate_min = fp->rate_max = 0;
198 for (r = 0, idx = offset + 1; r < nr_rates; r++, idx += 3) {
199 unsigned int rate = combine_triple(&fmt[idx]);
200 if (!rate)

--- 157 unchanged lines hidden (view full) ---

358 fp->nr_rates = parse_uac2_sample_rate_range(chip, fp, nr_triplets, data);
359
360 if (fp->nr_rates == 0) {
361 /* SNDRV_PCM_RATE_CONTINUOUS */
362 ret = 0;
363 goto err_free;
364 }
365
195 if (fp->rate_table == NULL)
196 return -ENOMEM;
197
198 fp->nr_rates = 0;
199 fp->rate_min = fp->rate_max = 0;
200 for (r = 0, idx = offset + 1; r < nr_rates; r++, idx += 3) {
201 unsigned int rate = combine_triple(&fmt[idx]);
202 if (!rate)

--- 157 unchanged lines hidden (view full) ---

360 fp->nr_rates = parse_uac2_sample_rate_range(chip, fp, nr_triplets, data);
361
362 if (fp->nr_rates == 0) {
363 /* SNDRV_PCM_RATE_CONTINUOUS */
364 ret = 0;
365 goto err_free;
366 }
367
366 fp->rate_table = kmalloc_array(fp->nr_rates, sizeof(int), GFP_KERNEL);
368 fp->rate_table = kmalloc(sizeof(int) * fp->nr_rates, GFP_KERNEL);
367 if (!fp->rate_table) {
368 ret = -ENOMEM;
369 goto err_free;
370 }
371
372 /* Call the triplet parser again, but this time, fp->rate_table is
373 * allocated, so the rates will be stored */
374 parse_uac2_sample_rate_range(chip, fp, nr_triplets, data);

--- 208 unchanged lines hidden ---
369 if (!fp->rate_table) {
370 ret = -ENOMEM;
371 goto err_free;
372 }
373
374 /* Call the triplet parser again, but this time, fp->rate_table is
375 * allocated, so the rates will be stored */
376 parse_uac2_sample_rate_range(chip, fp, nr_triplets, data);

--- 208 unchanged lines hidden ---