Lines Matching +full:q6afe +full:- +full:clocks
1 // SPDX-License-Identifier: GPL-2.0
6 #include <dt-bindings/sound/qcom,q6afe.h>
15 #include <uapi/linux/input-event-codes.h>
17 #include "qdsp6/q6afe.h"
65 struct sdm845_snd_data *pdata = snd_soc_card_get_drvdata(rtd->card); in sdm845_slim_snd_hw_params()
73 substream->stream); in sdm845_slim_snd_hw_params()
74 if (sruntime != ERR_PTR(-ENOTSUPP)) in sdm845_slim_snd_hw_params()
75 pdata->sruntime[cpu_dai->id] = sruntime; in sdm845_slim_snd_hw_params()
80 if (ret != 0 && ret != -ENOTSUPP) { in sdm845_slim_snd_hw_params()
83 } else if (ret == -ENOTSUPP) { in sdm845_slim_snd_hw_params()
88 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) in sdm845_slim_snd_hw_params()
113 dev_err(rtd->dev, "%s: invalid param format 0x%x\n", in sdm845_tdm_snd_hw_params()
115 return -EINVAL; in sdm845_tdm_snd_hw_params()
119 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { in sdm845_tdm_snd_hw_params()
123 dev_err(rtd->dev, "%s: failed to set tdm slot, err:%d\n", in sdm845_tdm_snd_hw_params()
131 dev_err(rtd->dev, "%s: failed to set channel map, err:%d\n", in sdm845_tdm_snd_hw_params()
139 dev_err(rtd->dev, "%s: failed to set tdm slot, err:%d\n", in sdm845_tdm_snd_hw_params()
147 dev_err(rtd->dev, "%s: failed to set channel map, err:%d\n", in sdm845_tdm_snd_hw_params()
155 if (!strcmp(codec_dai->component->name_prefix, "Left")) { in sdm845_tdm_snd_hw_params()
161 dev_err(rtd->dev, in sdm845_tdm_snd_hw_params()
167 if (!strcmp(codec_dai->component->name_prefix, "Right")) { in sdm845_tdm_snd_hw_params()
173 dev_err(rtd->dev, in sdm845_tdm_snd_hw_params()
192 switch (cpu_dai->id) { in sdm845_snd_hw_params()
196 * Use ASRC for internal clocks, as PLL rate isn't multiple in sdm845_snd_hw_params()
200 codec_dai->component, in sdm845_snd_hw_params()
207 dev_err(rtd->dev, in sdm845_snd_hw_params()
220 pr_err("%s: invalid dai id 0x%x\n", __func__, cpu_dai->id); in sdm845_snd_hw_params()
228 struct snd_soc_component *component = jack->private_data; in sdm845_jack_free()
236 struct snd_soc_card *card = rtd->card; in sdm845_dai_init()
240 struct snd_soc_dai_link *link = rtd->dai_link; in sdm845_dai_init()
256 if (!pdata->jack_setup) { in sdm845_dai_init()
262 &pdata->jack, in sdm845_dai_init()
267 dev_err(card->dev, "Unable to add Headphone Jack\n"); in sdm845_dai_init()
271 jack = pdata->jack.jack; in sdm845_dai_init()
277 pdata->jack_setup = true; in sdm845_dai_init()
280 switch (cpu_dai->id) { in sdm845_dai_init()
282 jack = pdata->jack.jack; in sdm845_dai_init()
283 component = codec_dai->component; in sdm845_dai_init()
285 jack->private_data = component; in sdm845_dai_init()
286 jack->private_free = sdm845_jack_free; in sdm845_dai_init()
288 &pdata->jack, NULL); in sdm845_dai_init()
289 if (rval != 0 && rval != -ENOTSUPP) { in sdm845_dai_init()
290 dev_warn(card->dev, "Failed to set jack: %d\n", rval); in sdm845_dai_init()
296 if (pdata->slim_port_setup || !link->no_pcm) in sdm845_dai_init()
305 if (rval != 0 && rval != -ENOTSUPP) in sdm845_dai_init()
312 rval = snd_soc_component_set_jack(codec_dai->component, in sdm845_dai_init()
313 &pdata->jack, NULL); in sdm845_dai_init()
314 if (rval != 0 && rval != -ENOTSUPP) { in sdm845_dai_init()
315 dev_warn(card->dev, "Failed to set jack: %d\n", rval); in sdm845_dai_init()
320 pdata->slim_port_setup = true; in sdm845_dai_init()
336 struct snd_soc_card *card = rtd->card; in sdm845_snd_startup()
343 switch (cpu_dai->id) { in sdm845_snd_startup()
347 if (++(data->pri_mi2s_clk_count) == 1) { in sdm845_snd_startup()
361 if (++(data->sec_mi2s_clk_count) == 1) { in sdm845_snd_startup()
380 if (++(data->quat_tdm_clk_count) == 1) { in sdm845_snd_startup()
390 if (!strcmp(codec_dai->component->name_prefix, in sdm845_snd_startup()
395 dev_err(rtd->dev, in sdm845_snd_startup()
401 if (!strcmp(codec_dai->component->name_prefix, in sdm845_snd_startup()
406 dev_err(rtd->dev, in sdm845_snd_startup()
417 pr_err("%s: invalid dai id 0x%x\n", __func__, cpu_dai->id); in sdm845_snd_startup()
426 struct snd_soc_card *card = rtd->card; in sdm845_snd_shutdown()
429 struct sdw_stream_runtime *sruntime = data->sruntime[cpu_dai->id]; in sdm845_snd_shutdown()
431 switch (cpu_dai->id) { in sdm845_snd_shutdown()
434 if (--(data->pri_mi2s_clk_count) == 0) { in sdm845_snd_shutdown()
445 if (--(data->sec_mi2s_clk_count) == 0) { in sdm845_snd_shutdown()
454 if (--(data->quat_tdm_clk_count) == 0) { in sdm845_snd_shutdown()
465 pr_err("%s: invalid dai id 0x%x\n", __func__, cpu_dai->id); in sdm845_snd_shutdown()
469 data->sruntime[cpu_dai->id] = NULL; in sdm845_snd_shutdown()
476 struct sdm845_snd_data *data = snd_soc_card_get_drvdata(rtd->card); in sdm845_snd_prepare()
478 struct sdw_stream_runtime *sruntime = data->sruntime[cpu_dai->id]; in sdm845_snd_prepare()
484 if (data->stream_prepared[cpu_dai->id]) { in sdm845_snd_prepare()
487 data->stream_prepared[cpu_dai->id] = false; in sdm845_snd_prepare()
507 data->stream_prepared[cpu_dai->id] = true; in sdm845_snd_prepare()
515 struct sdm845_snd_data *data = snd_soc_card_get_drvdata(rtd->card); in sdm845_snd_hw_free()
517 struct sdw_stream_runtime *sruntime = data->sruntime[cpu_dai->id]; in sdm845_snd_hw_free()
519 if (sruntime && data->stream_prepared[cpu_dai->id]) { in sdm845_snd_hw_free()
522 data->stream_prepared[cpu_dai->id] = false; in sdm845_snd_hw_free()
545 rate->min = rate->max = DEFAULT_SAMPLE_RATE_48K; in sdm845_be_hw_params_fixup()
546 channels->min = channels->max = 2; in sdm845_be_hw_params_fixup()
571 if (link->no_pcm == 1) { in sdm845_add_ops()
572 link->ops = &sdm845_be_ops; in sdm845_add_ops()
573 link->be_hw_params_fixup = sdm845_be_hw_params_fixup; in sdm845_add_ops()
575 link->init = sdm845_dai_init; in sdm845_add_ops()
583 struct device *dev = &pdev->dev; in sdm845_snd_platform_probe()
588 return -ENOMEM; in sdm845_snd_platform_probe()
593 return -ENOMEM; in sdm845_snd_platform_probe()
595 card->driver_name = DRIVER_NAME; in sdm845_snd_platform_probe()
596 card->dapm_widgets = sdm845_snd_widgets; in sdm845_snd_platform_probe()
597 card->num_dapm_widgets = ARRAY_SIZE(sdm845_snd_widgets); in sdm845_snd_platform_probe()
598 card->controls = sdm845_snd_controls; in sdm845_snd_platform_probe()
599 card->num_controls = ARRAY_SIZE(sdm845_snd_controls); in sdm845_snd_platform_probe()
600 card->dev = dev; in sdm845_snd_platform_probe()
601 card->owner = THIS_MODULE; in sdm845_snd_platform_probe()
607 data->card = card; in sdm845_snd_platform_probe()
615 { .compatible = "qcom,sdm845-sndcard" },
617 { .compatible = "qcom,db845c-sndcard" },
618 { .compatible = "lenovo,yoga-c630-sndcard" },
626 .name = "msm-snd-sdm845",