Lines Matching refs:channel

28  * struct channel - private structure to keep channel specific data
31 * @iface: interface for which the channel belongs to
32 * @cfg: channel configuration
35 * @id: channel index
44 struct channel {
152 * get_channel - get pointer to channel
154 * @channel_id: channel ID
156 * This traverses the channel list and returns the channel matching the
159 * Returns pointer to channel on success or NULL otherwise.
161 static struct channel *get_channel(struct most_interface *iface,
165 struct channel *channel;
167 list_for_each_entry(channel, &adpt->dev_list, list) {
168 if ((channel->iface == iface) && (channel->id == channel_id))
169 return channel;
176 * @channel: channel
181 static bool copy_data(struct channel *channel, struct mbo *mbo)
183 struct snd_pcm_runtime *const runtime = channel->substream->runtime;
184 unsigned int const frame_bytes = channel->cfg->subbuffer_size;
189 if (channel->cfg->direction & MOST_CH_RX)
193 fr0 = min(buffer_size - channel->buffer_pos, frames);
195 channel->copy_fn(runtime->dma_area + channel->buffer_pos * frame_bytes,
201 channel->copy_fn(runtime->dma_area,
206 channel->buffer_pos += frames;
207 if (channel->buffer_pos >= buffer_size)
208 channel->buffer_pos -= buffer_size;
209 channel->period_pos += frames;
210 if (channel->period_pos >= runtime->period_size) {
211 channel->period_pos -= runtime->period_size;
222 * MBO from mostcore for a particular channel and copy the data from ring buffer
229 struct channel *const channel = data;
236 channel->playback_waitq,
238 (channel->is_stream_running &&
239 (mbo = most_get_mbo(channel->iface, channel->id,
244 if (channel->is_stream_running)
245 period_elapsed = copy_data(channel, mbo);
251 snd_pcm_period_elapsed(channel->substream);
267 struct channel *channel = substream->private_data;
269 struct most_channel_config *cfg = channel->cfg;
272 channel->substream = substream;
275 channel->playback_task = kthread_run(playback_thread, channel,
277 if (IS_ERR(channel->playback_task)) {
279 return PTR_ERR(channel->playback_task);
283 ret = most_start_channel(channel->iface, channel->id, &comp);
287 kthread_stop(channel->playback_task);
291 runtime->hw = channel->pcm_hardware;
307 struct channel *channel = substream->private_data;
309 if (channel->cfg->direction == MOST_CH_TX)
310 kthread_stop(channel->playback_task);
311 most_stop_channel(channel->iface, channel->id, &comp);
326 struct channel *channel = substream->private_data;
328 struct most_channel_config *cfg = channel->cfg;
331 channel->copy_fn = NULL;
335 channel->copy_fn = alsa_to_most_memcpy;
337 channel->copy_fn = alsa_to_most_copy16;
339 channel->copy_fn = alsa_to_most_copy24;
341 channel->copy_fn = alsa_to_most_copy32;
344 channel->copy_fn = most_to_alsa_memcpy;
346 channel->copy_fn = most_to_alsa_copy16;
348 channel->copy_fn = most_to_alsa_copy24;
350 channel->copy_fn = most_to_alsa_copy32;
353 if (!channel->copy_fn)
355 channel->period_pos = 0;
356 channel->buffer_pos = 0;
372 struct channel *channel = substream->private_data;
376 channel->is_stream_running = true;
377 wake_up_interruptible(&channel->playback_waitq);
381 channel->is_stream_running = false;
400 struct channel *channel = substream->private_data;
402 return channel->buffer_pos;
489 struct channel *channel, *tmp;
491 list_for_each_entry_safe(channel, tmp, &adpt->dev_list, list) {
492 list_del(&channel->list);
493 kfree(channel);
504 * @channel_id: channel index/ID
505 * @cfg: pointer to actual channel configuration
517 struct channel *channel;
529 pr_err("Incompatible channel type\n");
554 sizeof(*channel), &adpt->card);
565 pr_err("channel (%s:%d) is already linked\n",
577 channel = kzalloc(sizeof(*channel), GFP_KERNEL);
578 if (!channel) {
582 channel->card = adpt->card;
583 channel->cfg = cfg;
584 channel->iface = iface;
585 channel->id = channel_id;
586 init_waitqueue_head(&channel->playback_waitq);
587 list_add_tail(&channel->list, &adpt->dev_list);
589 ret = audio_set_hw_params(&channel->pcm_hardware, ch_num, sample_res,
600 pcm->private_data = channel;
632 * audio_disconnect_channel - function to disconnect a channel
634 * @channel_id: channel index
643 struct channel *channel;
646 channel = get_channel(iface, channel_id);
647 if (!channel)
650 list_del(&channel->list);
652 kfree(channel);
662 * This searches for the channel this MBO belongs to and copy the data from MBO
669 struct channel *channel = get_channel(mbo->ifp, mbo->hdm_channel_id);
672 if (!channel)
674 if (channel->is_stream_running)
675 period_elapsed = copy_data(channel, mbo);
678 snd_pcm_period_elapsed(channel->substream);
685 * @channel_id: channel index/ID
687 * This searches the channel that belongs to this combination of interface
688 * pointer and channel ID and wakes a process sitting in the wait queue of
689 * this channel.
695 struct channel *channel = get_channel(iface, channel_id);
697 if (!channel)
700 wake_up_interruptible(&channel->playback_waitq);