Lines Matching refs:channel

44 struct channel {  struct
161 static struct channel *get_channel(struct most_interface *iface, in get_channel()
165 struct channel *channel; in get_channel() local
167 list_for_each_entry(channel, &adpt->dev_list, list) { in get_channel()
168 if ((channel->iface == iface) && (channel->id == channel_id)) in get_channel()
169 return channel; in get_channel()
181 static bool copy_data(struct channel *channel, struct mbo *mbo) in copy_data() argument
183 struct snd_pcm_runtime *const runtime = channel->substream->runtime; in copy_data()
184 unsigned int const frame_bytes = channel->cfg->subbuffer_size; in copy_data()
189 if (channel->cfg->direction & MOST_CH_RX) in copy_data()
193 fr0 = min(buffer_size - channel->buffer_pos, frames); in copy_data()
195 channel->copy_fn(runtime->dma_area + channel->buffer_pos * frame_bytes, in copy_data()
201 channel->copy_fn(runtime->dma_area, in copy_data()
206 channel->buffer_pos += frames; in copy_data()
207 if (channel->buffer_pos >= buffer_size) in copy_data()
208 channel->buffer_pos -= buffer_size; in copy_data()
209 channel->period_pos += frames; in copy_data()
210 if (channel->period_pos >= runtime->period_size) { in copy_data()
211 channel->period_pos -= runtime->period_size; in copy_data()
229 struct channel *const channel = data; in playback_thread() local
236 channel->playback_waitq, in playback_thread()
238 (channel->is_stream_running && in playback_thread()
239 (mbo = most_get_mbo(channel->iface, channel->id, in playback_thread()
244 if (channel->is_stream_running) in playback_thread()
245 period_elapsed = copy_data(channel, mbo); in playback_thread()
251 snd_pcm_period_elapsed(channel->substream); in playback_thread()
267 struct channel *channel = substream->private_data; in pcm_open() local
269 struct most_channel_config *cfg = channel->cfg; in pcm_open()
272 channel->substream = substream; in pcm_open()
275 channel->playback_task = kthread_run(playback_thread, channel, in pcm_open()
277 if (IS_ERR(channel->playback_task)) { in pcm_open()
279 return PTR_ERR(channel->playback_task); in pcm_open()
283 ret = most_start_channel(channel->iface, channel->id, &comp); in pcm_open()
287 kthread_stop(channel->playback_task); in pcm_open()
291 runtime->hw = channel->pcm_hardware; in pcm_open()
307 struct channel *channel = substream->private_data; in pcm_close() local
309 if (channel->cfg->direction == MOST_CH_TX) in pcm_close()
310 kthread_stop(channel->playback_task); in pcm_close()
311 most_stop_channel(channel->iface, channel->id, &comp); in pcm_close()
326 struct channel *channel = substream->private_data; in pcm_prepare() local
328 struct most_channel_config *cfg = channel->cfg; in pcm_prepare()
331 channel->copy_fn = NULL; in pcm_prepare()
335 channel->copy_fn = alsa_to_most_memcpy; in pcm_prepare()
337 channel->copy_fn = alsa_to_most_copy16; in pcm_prepare()
339 channel->copy_fn = alsa_to_most_copy24; in pcm_prepare()
341 channel->copy_fn = alsa_to_most_copy32; in pcm_prepare()
344 channel->copy_fn = most_to_alsa_memcpy; in pcm_prepare()
346 channel->copy_fn = most_to_alsa_copy16; in pcm_prepare()
348 channel->copy_fn = most_to_alsa_copy24; in pcm_prepare()
350 channel->copy_fn = most_to_alsa_copy32; in pcm_prepare()
353 if (!channel->copy_fn) in pcm_prepare()
355 channel->period_pos = 0; in pcm_prepare()
356 channel->buffer_pos = 0; in pcm_prepare()
372 struct channel *channel = substream->private_data; in pcm_trigger() local
376 channel->is_stream_running = true; in pcm_trigger()
377 wake_up_interruptible(&channel->playback_waitq); in pcm_trigger()
381 channel->is_stream_running = false; in pcm_trigger()
400 struct channel *channel = substream->private_data; in pcm_pointer() local
402 return channel->buffer_pos; in pcm_pointer()
489 struct channel *channel, *tmp; in release_adapter() local
491 list_for_each_entry_safe(channel, tmp, &adpt->dev_list, list) { in release_adapter()
492 list_del(&channel->list); in release_adapter()
493 kfree(channel); in release_adapter()
517 struct channel *channel; in audio_probe_channel() local
554 sizeof(*channel), &adpt->card); in audio_probe_channel()
577 channel = kzalloc(sizeof(*channel), GFP_KERNEL); in audio_probe_channel()
578 if (!channel) { in audio_probe_channel()
582 channel->card = adpt->card; in audio_probe_channel()
583 channel->cfg = cfg; in audio_probe_channel()
584 channel->iface = iface; in audio_probe_channel()
585 channel->id = channel_id; in audio_probe_channel()
586 init_waitqueue_head(&channel->playback_waitq); in audio_probe_channel()
587 list_add_tail(&channel->list, &adpt->dev_list); in audio_probe_channel()
589 ret = audio_set_hw_params(&channel->pcm_hardware, ch_num, sample_res, in audio_probe_channel()
600 pcm->private_data = channel; in audio_probe_channel()
643 struct channel *channel; in audio_disconnect_channel() local
646 channel = get_channel(iface, channel_id); in audio_disconnect_channel()
647 if (!channel) in audio_disconnect_channel()
650 list_del(&channel->list); in audio_disconnect_channel()
652 kfree(channel); in audio_disconnect_channel()
669 struct channel *channel = get_channel(mbo->ifp, mbo->hdm_channel_id); in audio_rx_completion() local
672 if (!channel) in audio_rx_completion()
674 if (channel->is_stream_running) in audio_rx_completion()
675 period_elapsed = copy_data(channel, mbo); in audio_rx_completion()
678 snd_pcm_period_elapsed(channel->substream); in audio_rx_completion()
695 struct channel *channel = get_channel(iface, channel_id); in audio_tx_completion() local
697 if (!channel) in audio_tx_completion()
700 wake_up_interruptible(&channel->playback_waitq); in audio_tx_completion()