Lines Matching full:channel
28 * struct channel - private structure to keep channel specific data
30 * @iface: interface for which the channel belongs to
31 * @cfg: channel configuration
34 * @id: channel index
42 struct channel { struct
150 * get_channel - get pointer to channel
152 * @channel_id: channel ID
154 * This traverses the channel list and returns the channel matching the
157 * Returns pointer to channel on success or NULL otherwise.
159 static struct channel *get_channel(struct most_interface *iface, in get_channel()
163 struct channel *channel; in get_channel() local
165 list_for_each_entry(channel, &adpt->dev_list, list) { in get_channel()
166 if ((channel->iface == iface) && (channel->id == channel_id)) in get_channel()
167 return channel; in get_channel()
174 * @channel: channel
179 static bool copy_data(struct channel *channel, struct mbo *mbo) in copy_data() argument
181 struct snd_pcm_runtime *const runtime = channel->substream->runtime; in copy_data()
182 unsigned int const frame_bytes = channel->cfg->subbuffer_size; in copy_data()
187 if (channel->cfg->direction & MOST_CH_RX) in copy_data()
191 fr0 = min(buffer_size - channel->buffer_pos, frames); in copy_data()
193 channel->copy_fn(runtime->dma_area + channel->buffer_pos * frame_bytes, in copy_data()
199 channel->copy_fn(runtime->dma_area, in copy_data()
204 channel->buffer_pos += frames; in copy_data()
205 if (channel->buffer_pos >= buffer_size) in copy_data()
206 channel->buffer_pos -= buffer_size; in copy_data()
207 channel->period_pos += frames; in copy_data()
208 if (channel->period_pos >= runtime->period_size) { in copy_data()
209 channel->period_pos -= runtime->period_size; in copy_data()
220 * MBO from mostcore for a particular channel and copy the data from ring buffer
227 struct channel *const channel = data; in playback_thread() local
234 channel->playback_waitq, in playback_thread()
236 (channel->is_stream_running && in playback_thread()
237 (mbo = most_get_mbo(channel->iface, channel->id, in playback_thread()
242 if (channel->is_stream_running) in playback_thread()
243 period_elapsed = copy_data(channel, mbo); in playback_thread()
249 snd_pcm_period_elapsed(channel->substream); in playback_thread()
265 struct channel *channel = substream->private_data; in pcm_open() local
267 struct most_channel_config *cfg = channel->cfg; in pcm_open()
270 channel->substream = substream; in pcm_open()
273 channel->playback_task = kthread_run(playback_thread, channel, in pcm_open()
275 if (IS_ERR(channel->playback_task)) { in pcm_open()
277 return PTR_ERR(channel->playback_task); in pcm_open()
281 ret = most_start_channel(channel->iface, channel->id, &comp); in pcm_open()
285 kthread_stop(channel->playback_task); in pcm_open()
289 runtime->hw = channel->pcm_hardware; in pcm_open()
305 struct channel *channel = substream->private_data; in pcm_close() local
307 if (channel->cfg->direction == MOST_CH_TX) in pcm_close()
308 kthread_stop(channel->playback_task); in pcm_close()
309 most_stop_channel(channel->iface, channel->id, &comp); in pcm_close()
324 struct channel *channel = substream->private_data; in pcm_prepare() local
326 struct most_channel_config *cfg = channel->cfg; in pcm_prepare()
329 channel->copy_fn = NULL; in pcm_prepare()
333 channel->copy_fn = alsa_to_most_memcpy; in pcm_prepare()
335 channel->copy_fn = alsa_to_most_copy16; in pcm_prepare()
337 channel->copy_fn = alsa_to_most_copy24; in pcm_prepare()
339 channel->copy_fn = alsa_to_most_copy32; in pcm_prepare()
342 channel->copy_fn = most_to_alsa_memcpy; in pcm_prepare()
344 channel->copy_fn = most_to_alsa_copy16; in pcm_prepare()
346 channel->copy_fn = most_to_alsa_copy24; in pcm_prepare()
348 channel->copy_fn = most_to_alsa_copy32; in pcm_prepare()
351 if (!channel->copy_fn) in pcm_prepare()
353 channel->period_pos = 0; in pcm_prepare()
354 channel->buffer_pos = 0; in pcm_prepare()
370 struct channel *channel = substream->private_data; in pcm_trigger() local
374 channel->is_stream_running = true; in pcm_trigger()
375 wake_up_interruptible(&channel->playback_waitq); in pcm_trigger()
379 channel->is_stream_running = false; in pcm_trigger()
398 struct channel *channel = substream->private_data; in pcm_pointer() local
400 return channel->buffer_pos; in pcm_pointer()
487 struct channel *channel, *tmp; in release_adapter() local
489 list_for_each_entry_safe(channel, tmp, &adpt->dev_list, list) { in release_adapter()
490 list_del(&channel->list); in release_adapter()
491 kfree(channel); in release_adapter()
502 * @channel_id: channel index/ID
503 * @cfg: pointer to actual channel configuration
515 struct channel *channel; in audio_probe_channel() local
527 pr_err("Incompatible channel type\n"); in audio_probe_channel()
552 sizeof(*channel), &adpt->card); in audio_probe_channel()
563 pr_err("channel (%s:%d) is already linked\n", in audio_probe_channel()
575 channel = kzalloc(sizeof(*channel), GFP_KERNEL); in audio_probe_channel()
576 if (!channel) { in audio_probe_channel()
580 channel->card = adpt->card; in audio_probe_channel()
581 channel->cfg = cfg; in audio_probe_channel()
582 channel->iface = iface; in audio_probe_channel()
583 channel->id = channel_id; in audio_probe_channel()
584 init_waitqueue_head(&channel->playback_waitq); in audio_probe_channel()
585 list_add_tail(&channel->list, &adpt->dev_list); in audio_probe_channel()
587 ret = audio_set_hw_params(&channel->pcm_hardware, ch_num, sample_res, in audio_probe_channel()
598 pcm->private_data = channel; in audio_probe_channel()
630 * audio_disconnect_channel - function to disconnect a channel
632 * @channel_id: channel index
641 struct channel *channel; in audio_disconnect_channel() local
644 channel = get_channel(iface, channel_id); in audio_disconnect_channel()
645 if (!channel) in audio_disconnect_channel()
648 list_del(&channel->list); in audio_disconnect_channel()
650 kfree(channel); in audio_disconnect_channel()
660 * This searches for the channel this MBO belongs to and copy the data from MBO
667 struct channel *channel = get_channel(mbo->ifp, mbo->hdm_channel_id); in audio_rx_completion() local
670 if (!channel) in audio_rx_completion()
672 if (channel->is_stream_running) in audio_rx_completion()
673 period_elapsed = copy_data(channel, mbo); in audio_rx_completion()
676 snd_pcm_period_elapsed(channel->substream); in audio_rx_completion()
683 * @channel_id: channel index/ID
685 * This searches the channel that belongs to this combination of interface
686 * pointer and channel ID and wakes a process sitting in the wait queue of
687 * this channel.
693 struct channel *channel = get_channel(iface, channel_id); in audio_tx_completion() local
695 if (!channel) in audio_tx_completion()
698 wake_up_interruptible(&channel->playback_waitq); in audio_tx_completion()