Lines Matching +full:bt +full:- +full:sco
1 // SPDX-License-Identifier: GPL-2.0
3 // mt8183-da7219-max98357.c
4 // -- MT8183-DA7219-MAX98357 ALSA SoC machine driver
19 #include "../common/mtk-afe-platform-driver.h"
20 #include "mt8183-afe-common.h"
22 #define DA7219_CODEC_DAI "da7219-hifi"
23 #define DA7219_DEV_NAME "da7219.5-001a"
24 #define RT1015_CODEC_DAI "rt1015-aif"
25 #define RT1015_DEV0_NAME "rt1015.6-0028"
26 #define RT1015_DEV1_NAME "rt1015.6-0029"
77 dev_err(rtd->dev, "failed to set cpu dai sysclk\n");
80 if (!strcmp(codec_dai->component->name, DA7219_DEV_NAME)) {
86 dev_err(rtd->dev, "failed to set sysclk\n");
97 dev_err(rtd->dev, "failed to start PLL: %d\n",
112 if (!strcmp(codec_dai->component->name, DA7219_DEV_NAME)) {
116 dev_err(rtd->dev, "failed to stop PLL: %d\n",
141 if (!strcmp(codec_dai->component->name, RT1015_DEV0_NAME) ||
142 !strcmp(codec_dai->component->name, RT1015_DEV1_NAME)) {
147 dev_err(rtd->dev, "failed to set pll\n");
156 dev_err(rtd->dev, "failed to set sysclk\n");
215 struct snd_pcm_runtime *runtime = substream->runtime;
219 runtime->hw.channels_max = 2;
224 runtime->hw.formats = SNDRV_PCM_FMTBIT_S16_LE;
255 struct snd_pcm_runtime *runtime = substream->runtime;
259 runtime->hw.channels_max = 1;
264 runtime->hw.formats = SNDRV_PCM_FMTBIT_S16_LE;
318 DAILINK_COMP_ARRAY(COMP_CODEC("mt6358-sound", "mt6358-snd-codec-aif1")),
333 DAILINK_COMP_ARRAY(COMP_CODEC("bt-sco", "bt-sco-pcm")),
367 DAILINK_COMP_ARRAY(COMP_CODEC("bt-sco", "bt-sco-pcm")),
372 DAILINK_COMP_ARRAY(COMP_CODEC(NULL, "i2s-hifi")),
378 snd_soc_card_get_drvdata(rtd->card);
381 ret = snd_soc_card_jack_new(rtd->card, "HDMI Jack", SND_JACK_LINEOUT,
382 &priv->hdmi_jack);
386 return snd_soc_component_set_jack(snd_soc_rtd_to_codec(rtd, 0)->component,
387 &priv->hdmi_jack, NULL);
399 dev_err(rtd->dev, "Failed to set up shared clocks\n");
414 dev_err(rtd->dev, "Failed to set up shared clocks\n");
587 snd_soc_card_get_drvdata(component->card);
590 ret = snd_soc_card_jack_new_pins(component->card,
596 &priv->headset_jack,
603 priv->headset_jack.jack, SND_JACK_BTN_0, KEY_PLAYPAUSE);
605 priv->headset_jack.jack, SND_JACK_BTN_1, KEY_VOLUMEUP);
607 priv->headset_jack.jack, SND_JACK_BTN_2, KEY_VOLUMEDOWN);
609 priv->headset_jack.jack, SND_JACK_BTN_3, KEY_VOICECOMMAND);
611 snd_soc_component_set_jack(component, &priv->headset_jack, NULL);
623 .dlc = COMP_CODEC_CONF("mt6358-sound"),
669 .dlc = COMP_CODEC_CONF("mt6358-sound"),
750 platform_node = of_parse_phandle(pdev->dev.of_node,
753 dev_err(&pdev->dev, "Property 'platform' missing or invalid\n");
754 return -EINVAL;
757 card = (struct snd_soc_card *)of_device_get_match_data(&pdev->dev);
759 ret = -EINVAL;
763 card->dev = &pdev->dev;
765 hdmi_codec = of_parse_phandle(pdev->dev.of_node,
766 "mediatek,hdmi-codec", 0);
769 if (strcmp(dai_link->name, "I2S3") == 0) {
771 dai_link->be_hw_params_fixup =
773 dai_link->ops = &mt8183_da7219_i2s_ops;
774 dai_link->cpus = i2s3_max98357a_cpus;
775 dai_link->num_cpus =
777 dai_link->codecs = i2s3_max98357a_codecs;
778 dai_link->num_codecs =
780 dai_link->platforms = i2s3_max98357a_platforms;
781 dai_link->num_platforms =
784 dai_link->be_hw_params_fixup =
786 dai_link->ops = &mt8183_da7219_rt1015_i2s_ops;
787 dai_link->cpus = i2s3_rt1015_cpus;
788 dai_link->num_cpus =
790 dai_link->codecs = i2s3_rt1015_codecs;
791 dai_link->num_codecs =
793 dai_link->platforms = i2s3_rt1015_platforms;
794 dai_link->num_platforms =
797 dai_link->be_hw_params_fixup =
799 dai_link->ops = &mt8183_da7219_i2s_ops;
800 dai_link->cpus = i2s3_rt1015p_cpus;
801 dai_link->num_cpus =
803 dai_link->codecs = i2s3_rt1015p_codecs;
804 dai_link->num_codecs =
806 dai_link->platforms = i2s3_rt1015p_platforms;
807 dai_link->num_platforms =
812 if (hdmi_codec && strcmp(dai_link->name, "TDM") == 0) {
813 dai_link->codecs->of_node = hdmi_codec;
814 dai_link->ignore = 0;
817 if (!dai_link->platforms->name)
818 dai_link->platforms->of_node = platform_node;
822 of_parse_phandle(pdev->dev.of_node,
823 "mediatek,headset-codec", 0);
825 dev_err(&pdev->dev,
826 "Property 'mediatek,headset-codec' missing/invalid\n");
827 ret = -EINVAL;
831 priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
833 ret = -ENOMEM;
839 pinctrl = devm_pinctrl_get_select(&pdev->dev, PINCTRL_STATE_DEFAULT);
842 dev_err(&pdev->dev, "%s failed to select default state %d\n",
847 ret = devm_snd_soc_register_card(&pdev->dev, card);
890 MODULE_DESCRIPTION("MT8183-DA7219-MAX98357 ALSA SoC machine driver");