Lines Matching +full:capture +full:- +full:channels
1 // SPDX-License-Identifier: GPL-2.0+
3 * u_uac1.c -- ALSA audio utilities for Gadget stack
24 /*-------------------------------------------------------------------------*/
47 changed = -EINVAL; in _snd_pcm_hw_param_set()
53 val--; in _snd_pcm_hw_param_set()
60 changed = -EINVAL; in _snd_pcm_hw_param_set()
71 t.min = val - 1; in _snd_pcm_hw_param_set()
80 return -EINVAL; in _snd_pcm_hw_param_set()
82 params->cmask |= 1 << var; in _snd_pcm_hw_param_set()
83 params->rmask |= 1 << var; in _snd_pcm_hw_param_set()
87 /*-------------------------------------------------------------------------*/
94 struct snd_pcm_substream *substream = snd->substream; in playback_default_hw_params()
101 * CHANNELS: 2 in playback_default_hw_params()
104 snd->access = SNDRV_PCM_ACCESS_RW_INTERLEAVED; in playback_default_hw_params()
105 snd->format = SNDRV_PCM_FORMAT_S16_LE; in playback_default_hw_params()
106 snd->channels = 2; in playback_default_hw_params()
107 snd->rate = 48000; in playback_default_hw_params()
111 return -ENOMEM; in playback_default_hw_params()
115 snd->access, 0); in playback_default_hw_params()
117 snd->format, 0); in playback_default_hw_params()
119 snd->channels, 0); in playback_default_hw_params()
121 snd->rate, 0); in playback_default_hw_params()
128 ERROR(snd->card, in playback_default_hw_params()
135 snd->access = params_access(params); in playback_default_hw_params()
136 snd->format = params_format(params); in playback_default_hw_params()
137 snd->channels = params_channels(params); in playback_default_hw_params()
138 snd->rate = params_rate(params); in playback_default_hw_params()
142 INFO(snd->card, in playback_default_hw_params()
143 "Hardware params: access %x, format %x, channels %d, rate %d\n", in playback_default_hw_params()
144 snd->access, snd->format, snd->channels, snd->rate); in playback_default_hw_params()
154 struct gaudio_snd_dev *snd = &card->playback; in u_audio_playback()
155 struct snd_pcm_substream *substream = snd->substream; in u_audio_playback()
156 struct snd_pcm_runtime *runtime = substream->runtime; in u_audio_playback()
161 if (runtime->state == SNDRV_PCM_STATE_XRUN || in u_audio_playback()
162 runtime->state == SNDRV_PCM_STATE_SUSPENDED) { in u_audio_playback()
173 result = snd_pcm_kernel_write(snd->substream, buf, frames); in u_audio_playback()
184 return card->playback.channels; in u_audio_get_playback_channels()
189 return card->playback.rate; in u_audio_get_playback_rate()
203 opts = container_of(card->func.fi, struct f_uac1_legacy_opts, in gaudio_open_snd_dev()
205 fn_play = opts->fn_play; in gaudio_open_snd_dev()
206 fn_cap = opts->fn_cap; in gaudio_open_snd_dev()
207 fn_cntl = opts->fn_cntl; in gaudio_open_snd_dev()
210 snd = &card->control; in gaudio_open_snd_dev()
211 snd->filp = filp_open(fn_cntl, O_RDWR, 0); in gaudio_open_snd_dev()
212 if (IS_ERR(snd->filp)) { in gaudio_open_snd_dev()
213 int ret = PTR_ERR(snd->filp); in gaudio_open_snd_dev()
216 snd->filp = NULL; in gaudio_open_snd_dev()
219 snd->card = card; in gaudio_open_snd_dev()
222 snd = &card->playback; in gaudio_open_snd_dev()
223 snd->filp = filp_open(fn_play, O_WRONLY, 0); in gaudio_open_snd_dev()
224 if (IS_ERR(snd->filp)) { in gaudio_open_snd_dev()
225 int ret = PTR_ERR(snd->filp); in gaudio_open_snd_dev()
228 snd->filp = NULL; in gaudio_open_snd_dev()
231 pcm_file = snd->filp->private_data; in gaudio_open_snd_dev()
232 snd->substream = pcm_file->substream; in gaudio_open_snd_dev()
233 snd->card = card; in gaudio_open_snd_dev()
236 /* Open PCM capture device and setup substream */ in gaudio_open_snd_dev()
237 snd = &card->capture; in gaudio_open_snd_dev()
238 snd->filp = filp_open(fn_cap, O_RDONLY, 0); in gaudio_open_snd_dev()
239 if (IS_ERR(snd->filp)) { in gaudio_open_snd_dev()
240 ERROR(card, "No such PCM capture device: %s\n", fn_cap); in gaudio_open_snd_dev()
241 snd->substream = NULL; in gaudio_open_snd_dev()
242 snd->card = NULL; in gaudio_open_snd_dev()
243 snd->filp = NULL; in gaudio_open_snd_dev()
245 pcm_file = snd->filp->private_data; in gaudio_open_snd_dev()
246 snd->substream = pcm_file->substream; in gaudio_open_snd_dev()
247 snd->card = card; in gaudio_open_snd_dev()
261 snd = &gau->control; in gaudio_close_snd_dev()
262 if (snd->filp) in gaudio_close_snd_dev()
263 filp_close(snd->filp, NULL); in gaudio_close_snd_dev()
266 snd = &gau->playback; in gaudio_close_snd_dev()
267 if (snd->filp) in gaudio_close_snd_dev()
268 filp_close(snd->filp, NULL); in gaudio_close_snd_dev()
270 /* Close PCM capture device and setup substream */ in gaudio_close_snd_dev()
271 snd = &gau->capture; in gaudio_close_snd_dev()
272 if (snd->filp) in gaudio_close_snd_dev()
273 filp_close(snd->filp, NULL); in gaudio_close_snd_dev()
279 * gaudio_setup - setup ALSA interface and preparing for USB transfer
298 * gaudio_cleanup - remove ALSA device interface