Lines Matching +full:q6adm +full:- +full:routing
1 // SPDX-License-Identifier: GPL-2.0
2 // Copyright (c) 2011-2017, The Linux Foundation. All rights reserved.
16 #include <sound/soc-dapm.h>
23 #include "q6adm.h"
26 #define DRV_NAME "q6routing-component"
351 * q6routing_stream_open() - Register a new stream for route setup
370 pr_err("Routing driver not yet ready\n"); in q6routing_stream_open()
371 return -EINVAL; in q6routing_stream_open()
374 session = &routing_data->sessions[stream_id - 1]; in q6routing_stream_open()
375 if (session->port_id < 0) { in q6routing_stream_open()
376 dev_err(routing_data->dev, "Routing not setup for MultiMedia%d Session\n", in q6routing_stream_open()
377 session->fedai_id); in q6routing_stream_open()
378 return -EINVAL; in q6routing_stream_open()
381 pdata = &routing_data->port_data[session->port_id]; in q6routing_stream_open()
383 mutex_lock(&routing_data->lock); in q6routing_stream_open()
384 session->fedai_id = fedai_id; in q6routing_stream_open()
386 session->path_type = pdata->path_type; in q6routing_stream_open()
387 session->sample_rate = pdata->sample_rate; in q6routing_stream_open()
388 session->channels = pdata->channels; in q6routing_stream_open()
389 session->bits_per_sample = pdata->bits_per_sample; in q6routing_stream_open()
393 copp = q6adm_open(routing_data->dev, session->port_id, in q6routing_stream_open()
394 session->path_type, session->sample_rate, in q6routing_stream_open()
395 session->channels, topology, perf_mode, in q6routing_stream_open()
396 session->bits_per_sample, 0, 0); in q6routing_stream_open()
399 mutex_unlock(&routing_data->lock); in q6routing_stream_open()
400 return -EINVAL; in q6routing_stream_open()
404 set_bit(copp_idx, &session->copp_map); in q6routing_stream_open()
405 session->copps[copp_idx] = copp; in q6routing_stream_open()
407 for_each_set_bit(j, &session->copp_map, MAX_COPPS_PER_PORT) { in q6routing_stream_open()
408 payload.port_id[num_copps] = session->port_id; in q6routing_stream_open()
416 q6adm_matrix_map(routing_data->dev, session->path_type, in q6routing_stream_open()
419 mutex_unlock(&routing_data->lock); in q6routing_stream_open()
431 if (fedai_id == data->sessions[i].fedai_id) in get_session_from_id()
432 return &data->sessions[i]; in get_session_from_id()
438 * q6routing_stream_close() - Deregister a stream
454 for_each_set_bit(idx, &session->copp_map, MAX_COPPS_PER_PORT) { in q6routing_stream_close()
455 if (session->copps[idx]) { in q6routing_stream_close()
456 q6adm_close(routing_data->dev, session->copps[idx]); in q6routing_stream_close()
457 session->copps[idx] = NULL; in q6routing_stream_close()
461 session->fedai_id = -1; in q6routing_stream_close()
462 session->copp_map = 0; in q6routing_stream_close()
472 (struct soc_mixer_control *)kcontrol->private_value; in msm_routing_get_audio_mixer()
473 int session_id = mc->shift; in msm_routing_get_audio_mixer()
475 struct msm_routing_data *priv = dev_get_drvdata(c->dev); in msm_routing_get_audio_mixer()
476 struct session_data *session = &priv->sessions[session_id]; in msm_routing_get_audio_mixer()
478 if (session->port_id == mc->reg) in msm_routing_get_audio_mixer()
479 ucontrol->value.integer.value[0] = 1; in msm_routing_get_audio_mixer()
481 ucontrol->value.integer.value[0] = 0; in msm_routing_get_audio_mixer()
492 struct msm_routing_data *data = dev_get_drvdata(c->dev); in msm_routing_put_audio_mixer()
494 (struct soc_mixer_control *)kcontrol->private_value; in msm_routing_put_audio_mixer()
496 int be_id = mc->reg; in msm_routing_put_audio_mixer()
497 int session_id = mc->shift; in msm_routing_put_audio_mixer()
498 struct session_data *session = &data->sessions[session_id]; in msm_routing_put_audio_mixer()
500 if (ucontrol->value.integer.value[0]) { in msm_routing_put_audio_mixer()
501 if (session->port_id == be_id) in msm_routing_put_audio_mixer()
504 session->port_id = be_id; in msm_routing_put_audio_mixer()
507 if (session->port_id == -1 || session->port_id != be_id) in msm_routing_put_audio_mixer()
510 session->port_id = -1; in msm_routing_put_audio_mixer()
1052 struct msm_routing_data *data = dev_get_drvdata(component->dev); in routing_hw_params()
1053 unsigned int be_id = snd_soc_rtd_to_cpu(rtd, 0)->id; in routing_hw_params()
1057 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) in routing_hw_params()
1063 return -EINVAL; in routing_hw_params()
1065 session = &data->port_data[be_id]; in routing_hw_params()
1067 mutex_lock(&data->lock); in routing_hw_params()
1069 session->path_type = path_type; in routing_hw_params()
1070 session->sample_rate = params_rate(params); in routing_hw_params()
1071 session->channels = params_channels(params); in routing_hw_params()
1075 session->bits_per_sample = 16; in routing_hw_params()
1078 session->bits_per_sample = 24; in routing_hw_params()
1084 mutex_unlock(&data->lock); in routing_hw_params()
1093 routing_data->sessions[i].port_id = -1; in msm_routing_probe()
1094 routing_data->sessions[i].fedai_id = -1; in msm_routing_probe()
1128 struct device *dev = &pdev->dev; in q6pcm_routing_probe()
1132 return -ENOMEM; in q6pcm_routing_probe()
1134 routing_data->dev = dev; in q6pcm_routing_probe()
1136 mutex_init(&routing_data->lock); in q6pcm_routing_probe()
1151 { .compatible = "qcom,q6adm-routing" },
1167 MODULE_DESCRIPTION("Q6 Routing platform");