format.c (93db51d06b32227319dae2ac289029ccf1b33181) format.c (7ec827b9465c427511f05bab02dddbcfdd4ecc53)
1// SPDX-License-Identifier: GPL-2.0-or-later
2/*
3 */
4
5#include <linux/init.h>
6#include <linux/slab.h>
7#include <linux/usb.h>
8#include <linux/usb/audio.h>
9#include <linux/usb/audio-v2.h>
10#include <linux/usb/audio-v3.h>
11
12#include <sound/core.h>
13#include <sound/pcm.h>
14
15#include "usbaudio.h"
16#include "card.h"
17#include "quirks.h"
18#include "helper.h"
1// SPDX-License-Identifier: GPL-2.0-or-later
2/*
3 */
4
5#include <linux/init.h>
6#include <linux/slab.h>
7#include <linux/usb.h>
8#include <linux/usb/audio.h>
9#include <linux/usb/audio-v2.h>
10#include <linux/usb/audio-v3.h>
11
12#include <sound/core.h>
13#include <sound/pcm.h>
14
15#include "usbaudio.h"
16#include "card.h"
17#include "quirks.h"
18#include "helper.h"
19#include "debug.h"
20#include "clock.h"
21#include "format.h"
22
23/*
24 * parse the audio format type I descriptor
25 * and returns the corresponding pcm format
26 *
27 * @dev: usb device

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

222 if (!fp->rate_min || rate < fp->rate_min)
223 fp->rate_min = rate;
224 if (!fp->rate_max || rate > fp->rate_max)
225 fp->rate_max = rate;
226 fp->rates |= snd_pcm_rate_to_rate_bit(rate);
227 fp->nr_rates++;
228 }
229 if (!fp->nr_rates) {
19#include "clock.h"
20#include "format.h"
21
22/*
23 * parse the audio format type I descriptor
24 * and returns the corresponding pcm format
25 *
26 * @dev: usb device

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

221 if (!fp->rate_min || rate < fp->rate_min)
222 fp->rate_min = rate;
223 if (!fp->rate_max || rate > fp->rate_max)
224 fp->rate_max = rate;
225 fp->rates |= snd_pcm_rate_to_rate_bit(rate);
226 fp->nr_rates++;
227 }
228 if (!fp->nr_rates) {
230 hwc_debug("All rates were zero. Skipping format!\n");
229 usb_audio_info(chip,
230 "%u:%d: All rates were zero\n",
231 fp->iface, fp->altsetting);
231 return -EINVAL;
232 }
233 } else {
234 /* continuous rates */
235 fp->rates = SNDRV_PCM_RATE_CONTINUOUS;
236 fp->rate_min = combine_triple(&fmt[offset + 1]);
237 fp->rate_max = combine_triple(&fmt[offset + 4]);
238 }

--- 573 unchanged lines hidden ---
232 return -EINVAL;
233 }
234 } else {
235 /* continuous rates */
236 fp->rates = SNDRV_PCM_RATE_CONTINUOUS;
237 fp->rate_min = combine_triple(&fmt[offset + 1]);
238 fp->rate_max = combine_triple(&fmt[offset + 4]);
239 }

--- 573 unchanged lines hidden ---