Lines Matching +full:sc7280 +full:- +full:herobrine

1 // SPDX-License-Identifier: GPL-2.0-only
3 // Copyright (c) 2020-2021, The Linux Foundation. All rights reserved.
5 // ALSA SoC Machine driver for sc7280
7 #include <dt-bindings/sound/qcom,lpass.h>
8 #include <dt-bindings/sound/qcom,q6afe.h>
44 struct snd_soc_component *component = jack->private_data; in sc7280_jack_free()
62 struct snd_soc_card *card = rtd->card; in sc7280_headset_init()
66 struct snd_soc_component *component = codec_dai->component; in sc7280_headset_init()
70 if (!pdata->jack_setup) { in sc7280_headset_init()
77 &pdata->hs_jack, in sc7280_headset_init()
82 dev_err(card->dev, "Unable to add Headset Jack\n"); in sc7280_headset_init()
86 jack = pdata->hs_jack.jack; in sc7280_headset_init()
93 jack->private_data = component; in sc7280_headset_init()
94 jack->private_free = sc7280_jack_free; in sc7280_headset_init()
95 pdata->jack_setup = true; in sc7280_headset_init()
97 switch (cpu_dai->id) { in sc7280_headset_init()
103 rval = snd_soc_component_set_jack(component, &pdata->hs_jack, NULL); in sc7280_headset_init()
104 if (rval != 0 && rval != -ENOTSUPP) { in sc7280_headset_init()
105 dev_err(card->dev, "Failed to set jack: %d\n", rval); in sc7280_headset_init()
119 struct snd_soc_card *card = rtd->card; in sc7280_hdmi_init()
122 struct snd_soc_component *component = codec_dai->component; in sc7280_hdmi_init()
127 &pdata->hdmi_jack); in sc7280_hdmi_init()
130 dev_err(card->dev, "Unable to add HDMI Jack\n"); in sc7280_hdmi_init()
134 jack = pdata->hdmi_jack.jack; in sc7280_hdmi_init()
135 jack->private_data = component; in sc7280_hdmi_init()
136 jack->private_free = sc7280_jack_free; in sc7280_hdmi_init()
138 return snd_soc_component_set_jack(component, &pdata->hdmi_jack, NULL); in sc7280_hdmi_init()
145 struct snd_soc_card *card = rtd->card; in sc7280_rt5682_init()
149 if (++data->pri_mi2s_clk_count == 1) { in sc7280_rt5682_init()
163 dev_err(rtd->dev, "can't set codec pll: %d\n", ret); in sc7280_rt5682_init()
172 dev_err(rtd->dev, "snd_soc_dai_set_sysclk err = %d\n", in sc7280_rt5682_init()
184 switch (cpu_dai->id) { in sc7280_init()
199 dev_err(rtd->dev, "%s: invalid dai id 0x%x\n", __func__, cpu_dai->id); in sc7280_init()
202 return -EINVAL; in sc7280_init()
208 struct snd_pcm_runtime *runtime = substream->runtime; in sc7280_snd_hw_params()
212 struct sc7280_snd_data *pdata = snd_soc_card_get_drvdata(rtd->card); in sc7280_snd_hw_params()
216 if (!rtd->dai_link->no_pcm) { in sc7280_snd_hw_params()
221 switch (cpu_dai->id) { in sc7280_snd_hw_params()
229 sruntime = snd_soc_dai_get_stream(codec_dai, substream->stream); in sc7280_snd_hw_params()
230 if (sruntime != ERR_PTR(-ENOTSUPP)) in sc7280_snd_hw_params()
231 pdata->sruntime[cpu_dai->id] = sruntime; in sc7280_snd_hw_params()
243 struct sc7280_snd_data *data = snd_soc_card_get_drvdata(rtd->card); in sc7280_snd_swr_prepare()
244 struct sdw_stream_runtime *sruntime = data->sruntime[cpu_dai->id]; in sc7280_snd_swr_prepare()
250 if (data->stream_prepared[cpu_dai->id]) { in sc7280_snd_swr_prepare()
253 data->stream_prepared[cpu_dai->id] = false; in sc7280_snd_swr_prepare()
265 data->stream_prepared[cpu_dai->id] = true; in sc7280_snd_swr_prepare()
275 switch (cpu_dai->id) { in sc7280_snd_prepare()
292 struct sc7280_snd_data *data = snd_soc_card_get_drvdata(rtd->card); in sc7280_snd_hw_free()
294 struct sdw_stream_runtime *sruntime = data->sruntime[cpu_dai->id]; in sc7280_snd_hw_free()
296 switch (cpu_dai->id) { in sc7280_snd_hw_free()
302 if (sruntime && data->stream_prepared[cpu_dai->id]) { in sc7280_snd_hw_free()
305 data->stream_prepared[cpu_dai->id] = false; in sc7280_snd_hw_free()
317 struct snd_soc_card *card = rtd->card; in sc7280_snd_shutdown()
320 struct sdw_stream_runtime *sruntime = data->sruntime[cpu_dai->id]; in sc7280_snd_shutdown()
322 switch (cpu_dai->id) { in sc7280_snd_shutdown()
324 if (--data->pri_mi2s_clk_count == 0) { in sc7280_snd_shutdown()
339 data->sruntime[cpu_dai->id] = NULL; in sc7280_snd_shutdown()
352 switch (cpu_dai->id) { in sc7280_snd_startup()
399 rate->min = rate->max = 48000; in sc7280_snd_be_hw_params_fixup()
400 channels->min = channels->max = 2; in sc7280_snd_be_hw_params_fixup()
410 struct device *dev = &pdev->dev; in sc7280_snd_platform_probe()
416 return -ENOMEM; in sc7280_snd_platform_probe()
418 card = &data->card; in sc7280_snd_platform_probe()
421 card->owner = THIS_MODULE; in sc7280_snd_platform_probe()
422 card->driver_name = "SC7280"; in sc7280_snd_platform_probe()
423 card->dev = dev; in sc7280_snd_platform_probe()
425 card->dapm_widgets = sc7280_snd_widgets; in sc7280_snd_platform_probe()
426 card->num_dapm_widgets = ARRAY_SIZE(sc7280_snd_widgets); in sc7280_snd_platform_probe()
427 card->controls = sc7280_snd_controls; in sc7280_snd_platform_probe()
428 card->num_controls = ARRAY_SIZE(sc7280_snd_controls); in sc7280_snd_platform_probe()
435 link->init = sc7280_init; in sc7280_snd_platform_probe()
436 link->ops = &sc7280_ops; in sc7280_snd_platform_probe()
437 if (link->no_pcm == 1) in sc7280_snd_platform_probe()
438 link->be_hw_params_fixup = sc7280_snd_be_hw_params_fixup; in sc7280_snd_platform_probe()
445 { .compatible = "google,sc7280-herobrine" },
453 .name = "msm-snd-sc7280",
460 MODULE_DESCRIPTION("sc7280 ASoC Machine Driver");