Lines Matching +full:q6apm +full:- +full:lpass +full:- +full:dais

1 // SPDX-License-Identifier: GPL-2.0
4 #include <dt-bindings/sound/qcom,q6dsp-lpass-ports.h>
14 #include "q6dsp-lpass-ports.h"
15 #include "q6dsp-common.h"
17 #include "q6apm.h"
34 struct q6apm_lpass_dai_data *dai_data = dev_get_drvdata(dai->dev); in q6dma_set_channel_map()
35 struct audioreach_module_config *cfg = &dai_data->module_config[dai->id]; in q6dma_set_channel_map()
38 switch (dai->id) { in q6dma_set_channel_map()
52 dev_err(dai->dev, "tx slot not found\n"); in q6dma_set_channel_map()
53 return -EINVAL; in q6dma_set_channel_map()
57 dev_err(dai->dev, "invalid tx num %d\n", in q6dma_set_channel_map()
59 return -EINVAL; in q6dma_set_channel_map()
62 cfg->channel_map[i] = tx_ch_mask[i]; in q6dma_set_channel_map()
77 dev_err(dai->dev, "rx slot not found\n"); in q6dma_set_channel_map()
78 return -EINVAL; in q6dma_set_channel_map()
81 dev_err(dai->dev, "invalid rx num %d\n", in q6dma_set_channel_map()
83 return -EINVAL; in q6dma_set_channel_map()
86 cfg->channel_map[i] = rx_ch_mask[i]; in q6dma_set_channel_map()
90 dev_err(dai->dev, "%s: invalid dai id 0x%x\n", in q6dma_set_channel_map()
91 __func__, dai->id); in q6dma_set_channel_map()
92 return -EINVAL; in q6dma_set_channel_map()
101 struct q6apm_lpass_dai_data *dai_data = dev_get_drvdata(dai->dev); in q6hdmi_hw_params()
102 struct audioreach_module_config *cfg = &dai_data->module_config[dai->id]; in q6hdmi_hw_params()
103 int channels = hw_param_interval_c(params, SNDRV_PCM_HW_PARAM_CHANNELS)->max; in q6hdmi_hw_params()
106 cfg->bit_width = params_width(params); in q6hdmi_hw_params()
107 cfg->sample_rate = params_rate(params); in q6hdmi_hw_params()
108 cfg->num_channels = channels; in q6hdmi_hw_params()
109 audioreach_set_default_channel_mapping(cfg->channel_map, channels); in q6hdmi_hw_params()
111 switch (dai->id) { in q6hdmi_hw_params()
113 cfg->dp_idx = 0; in q6hdmi_hw_params()
116 cfg->dp_idx = dai->id - DISPLAY_PORT_RX_1 + 1; in q6hdmi_hw_params()
124 cfg->channel_allocation = ret; in q6hdmi_hw_params()
132 struct q6apm_lpass_dai_data *dai_data = dev_get_drvdata(dai->dev); in q6dma_hw_params()
133 struct audioreach_module_config *cfg = &dai_data->module_config[dai->id]; in q6dma_hw_params()
134 int channels = hw_param_interval_c(params, SNDRV_PCM_HW_PARAM_CHANNELS)->max; in q6dma_hw_params()
136 cfg->bit_width = params_width(params); in q6dma_hw_params()
137 cfg->sample_rate = params_rate(params); in q6dma_hw_params()
138 cfg->num_channels = channels; in q6dma_hw_params()
139 audioreach_set_default_channel_mapping(cfg->channel_map, channels); in q6dma_hw_params()
146 struct q6apm_lpass_dai_data *dai_data = dev_get_drvdata(dai->dev); in q6apm_lpass_dai_shutdown()
149 if (dai_data->is_port_started[dai->id]) { in q6apm_lpass_dai_shutdown()
150 rc = q6apm_graph_stop(dai_data->graph[dai->id]); in q6apm_lpass_dai_shutdown()
151 dai_data->is_port_started[dai->id] = false; in q6apm_lpass_dai_shutdown()
153 dev_err(dai->dev, "fail to close APM port (%d)\n", rc); in q6apm_lpass_dai_shutdown()
156 if (dai_data->graph[dai->id]) { in q6apm_lpass_dai_shutdown()
157 q6apm_graph_close(dai_data->graph[dai->id]); in q6apm_lpass_dai_shutdown()
158 dai_data->graph[dai->id] = NULL; in q6apm_lpass_dai_shutdown()
164 struct q6apm_lpass_dai_data *dai_data = dev_get_drvdata(dai->dev); in q6apm_lpass_dai_prepare()
165 struct audioreach_module_config *cfg = &dai_data->module_config[dai->id]; in q6apm_lpass_dai_prepare()
167 int graph_id = dai->id; in q6apm_lpass_dai_prepare()
170 if (dai_data->is_port_started[dai->id]) { in q6apm_lpass_dai_prepare()
171 q6apm_graph_stop(dai_data->graph[dai->id]); in q6apm_lpass_dai_prepare()
172 dai_data->is_port_started[dai->id] = false; in q6apm_lpass_dai_prepare()
174 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { in q6apm_lpass_dai_prepare()
175 q6apm_graph_close(dai_data->graph[dai->id]); in q6apm_lpass_dai_prepare()
176 dai_data->graph[dai->id] = NULL; in q6apm_lpass_dai_prepare()
184 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { in q6apm_lpass_dai_prepare()
185 graph = q6apm_graph_open(dai->dev, NULL, dai->dev, graph_id); in q6apm_lpass_dai_prepare()
187 dev_err(dai->dev, "Failed to open graph (%d)\n", graph_id); in q6apm_lpass_dai_prepare()
191 dai_data->graph[graph_id] = graph; in q6apm_lpass_dai_prepare()
194 cfg->direction = substream->stream; in q6apm_lpass_dai_prepare()
195 rc = q6apm_graph_media_format_pcm(dai_data->graph[dai->id], cfg); in q6apm_lpass_dai_prepare()
197 dev_err(dai->dev, "Failed to set media format %d\n", rc); in q6apm_lpass_dai_prepare()
201 rc = q6apm_graph_prepare(dai_data->graph[dai->id]); in q6apm_lpass_dai_prepare()
203 dev_err(dai->dev, "Failed to prepare Graph %d\n", rc); in q6apm_lpass_dai_prepare()
207 rc = q6apm_graph_start(dai_data->graph[dai->id]); in q6apm_lpass_dai_prepare()
209 dev_err(dai->dev, "fail to start APM port %x\n", dai->id); in q6apm_lpass_dai_prepare()
212 dai_data->is_port_started[dai->id] = true; in q6apm_lpass_dai_prepare()
216 q6apm_graph_close(dai_data->graph[dai->id]); in q6apm_lpass_dai_prepare()
217 dai_data->graph[dai->id] = NULL; in q6apm_lpass_dai_prepare()
223 struct q6apm_lpass_dai_data *dai_data = dev_get_drvdata(dai->dev); in q6apm_lpass_dai_startup()
225 int graph_id = dai->id; in q6apm_lpass_dai_startup()
227 if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) { in q6apm_lpass_dai_startup()
228 graph = q6apm_graph_open(dai->dev, NULL, dai->dev, graph_id); in q6apm_lpass_dai_startup()
230 dev_err(dai->dev, "Failed to open graph (%d)\n", graph_id); in q6apm_lpass_dai_startup()
233 dai_data->graph[graph_id] = graph; in q6apm_lpass_dai_startup()
241 struct q6apm_lpass_dai_data *dai_data = dev_get_drvdata(dai->dev); in q6i2s_set_fmt()
242 struct audioreach_module_config *cfg = &dai_data->module_config[dai->id]; in q6i2s_set_fmt()
244 cfg->fmt = fmt; in q6i2s_set_fmt()
274 .name = "q6apm-be-dai-component",
284 struct snd_soc_dai_driver *dais; in q6apm_lpass_dai_dev_probe() local
285 struct device *dev = &pdev->dev; in q6apm_lpass_dai_dev_probe()
290 return -ENOMEM; in q6apm_lpass_dai_dev_probe()
298 dais = q6dsp_audio_ports_set_config(dev, &cfg, &num_dais); in q6apm_lpass_dai_dev_probe()
300 return devm_snd_soc_register_component(dev, &q6apm_lpass_dai_component, dais, num_dais); in q6apm_lpass_dai_dev_probe()
305 { .compatible = "qcom,q6apm-lpass-dais" },
313 .name = "q6apm-lpass-dais",
320 MODULE_DESCRIPTION("AUDIOREACH APM LPASS dai driver");