Lines Matching +full:tdm +full:- +full:data +full:- +full:out
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"
42 .pin = "Line Out",
77 dev_err(rtd->dev, "failed to set cpu dai sysclk\n"); in mt8183_da7219_i2s_hw_params()
80 if (!strcmp(codec_dai->component->name, DA7219_DEV_NAME)) { in mt8183_da7219_i2s_hw_params()
86 dev_err(rtd->dev, "failed to set sysclk\n"); in mt8183_da7219_i2s_hw_params()
97 dev_err(rtd->dev, "failed to start PLL: %d\n", in mt8183_da7219_i2s_hw_params()
112 if (!strcmp(codec_dai->component->name, DA7219_DEV_NAME)) { in mt8183_da7219_hw_free()
116 dev_err(rtd->dev, "failed to stop PLL: %d\n", in mt8183_da7219_hw_free()
141 if (!strcmp(codec_dai->component->name, RT1015_DEV0_NAME) || in mt8183_da7219_rt1015_i2s_hw_params()
142 !strcmp(codec_dai->component->name, RT1015_DEV1_NAME)) { in mt8183_da7219_rt1015_i2s_hw_params()
147 dev_err(rtd->dev, "failed to set pll\n"); in mt8183_da7219_rt1015_i2s_hw_params()
156 dev_err(rtd->dev, "failed to set sysclk\n"); in mt8183_da7219_rt1015_i2s_hw_params()
215 struct snd_pcm_runtime *runtime = substream->runtime; in mt8183_da7219_max98357_startup()
219 runtime->hw.channels_max = 2; in mt8183_da7219_max98357_startup()
224 runtime->hw.formats = SNDRV_PCM_FMTBIT_S16_LE; in mt8183_da7219_max98357_startup()
255 struct snd_pcm_runtime *runtime = substream->runtime; in mt8183_da7219_max98357_bt_sco_startup()
259 runtime->hw.channels_max = 1; in mt8183_da7219_max98357_bt_sco_startup()
264 runtime->hw.formats = SNDRV_PCM_FMTBIT_S16_LE; in mt8183_da7219_max98357_bt_sco_startup()
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")),
370 SND_SOC_DAILINK_DEFS(tdm,
371 DAILINK_COMP_ARRAY(COMP_CPU("TDM")),
372 DAILINK_COMP_ARRAY(COMP_CODEC(NULL, "i2s-hifi")),
378 snd_soc_card_get_drvdata(rtd->card); in mt8183_da7219_max98357_hdmi_init()
381 ret = snd_soc_card_jack_new(rtd->card, "HDMI Jack", SND_JACK_LINEOUT, in mt8183_da7219_max98357_hdmi_init()
382 &priv->hdmi_jack); in mt8183_da7219_max98357_hdmi_init()
386 return snd_soc_component_set_jack(asoc_rtd_to_codec(rtd, 0)->component, in mt8183_da7219_max98357_hdmi_init()
387 &priv->hdmi_jack, NULL); in mt8183_da7219_max98357_hdmi_init()
399 dev_err(rtd->dev, "Failed to set up shared clocks\n"); in mt8183_bt_init()
414 dev_err(rtd->dev, "Failed to set up shared clocks\n"); in mt8183_da7219_init()
568 .name = "TDM",
578 SND_SOC_DAILINK_REG(tdm),
587 snd_soc_card_get_drvdata(component->card); in mt8183_da7219_max98357_headset_init()
590 ret = snd_soc_card_jack_new_pins(component->card, in mt8183_da7219_max98357_headset_init()
596 &priv->headset_jack, in mt8183_da7219_max98357_headset_init()
603 priv->headset_jack.jack, SND_JACK_BTN_0, KEY_PLAYPAUSE); in mt8183_da7219_max98357_headset_init()
605 priv->headset_jack.jack, SND_JACK_BTN_1, KEY_VOLUMEUP); in mt8183_da7219_max98357_headset_init()
607 priv->headset_jack.jack, SND_JACK_BTN_2, KEY_VOLUMEDOWN); in mt8183_da7219_max98357_headset_init()
609 priv->headset_jack.jack, SND_JACK_BTN_3, KEY_VOICECOMMAND); in mt8183_da7219_max98357_headset_init()
611 snd_soc_component_set_jack(component, &priv->headset_jack, NULL); in mt8183_da7219_max98357_headset_init()
623 .dlc = COMP_CODEC_CONF("mt6358-sound"),
632 SOC_DAPM_PIN_SWITCH("Line Out"),
640 SND_SOC_DAPM_SPK("Line Out", NULL),
669 .dlc = COMP_CODEC_CONF("mt6358-sound"),
687 SOC_DAPM_PIN_SWITCH("Line Out"),
696 SND_SOC_DAPM_LINE("Line Out", NULL),
750 platform_node = of_parse_phandle(pdev->dev.of_node, in mt8183_da7219_max98357_dev_probe()
753 dev_err(&pdev->dev, "Property 'platform' missing or invalid\n"); in mt8183_da7219_max98357_dev_probe()
754 return -EINVAL; in mt8183_da7219_max98357_dev_probe()
757 card = (struct snd_soc_card *)of_device_get_match_data(&pdev->dev); in mt8183_da7219_max98357_dev_probe()
759 ret = -EINVAL; in mt8183_da7219_max98357_dev_probe()
763 card->dev = &pdev->dev; in mt8183_da7219_max98357_dev_probe()
765 hdmi_codec = of_parse_phandle(pdev->dev.of_node, in mt8183_da7219_max98357_dev_probe()
766 "mediatek,hdmi-codec", 0); in mt8183_da7219_max98357_dev_probe()
769 if (strcmp(dai_link->name, "I2S3") == 0) { in mt8183_da7219_max98357_dev_probe()
771 dai_link->be_hw_params_fixup = in mt8183_da7219_max98357_dev_probe()
773 dai_link->ops = &mt8183_da7219_i2s_ops; in mt8183_da7219_max98357_dev_probe()
774 dai_link->cpus = i2s3_max98357a_cpus; in mt8183_da7219_max98357_dev_probe()
775 dai_link->num_cpus = in mt8183_da7219_max98357_dev_probe()
777 dai_link->codecs = i2s3_max98357a_codecs; in mt8183_da7219_max98357_dev_probe()
778 dai_link->num_codecs = in mt8183_da7219_max98357_dev_probe()
780 dai_link->platforms = i2s3_max98357a_platforms; in mt8183_da7219_max98357_dev_probe()
781 dai_link->num_platforms = in mt8183_da7219_max98357_dev_probe()
784 dai_link->be_hw_params_fixup = in mt8183_da7219_max98357_dev_probe()
786 dai_link->ops = &mt8183_da7219_rt1015_i2s_ops; in mt8183_da7219_max98357_dev_probe()
787 dai_link->cpus = i2s3_rt1015_cpus; in mt8183_da7219_max98357_dev_probe()
788 dai_link->num_cpus = in mt8183_da7219_max98357_dev_probe()
790 dai_link->codecs = i2s3_rt1015_codecs; in mt8183_da7219_max98357_dev_probe()
791 dai_link->num_codecs = in mt8183_da7219_max98357_dev_probe()
793 dai_link->platforms = i2s3_rt1015_platforms; in mt8183_da7219_max98357_dev_probe()
794 dai_link->num_platforms = in mt8183_da7219_max98357_dev_probe()
797 dai_link->be_hw_params_fixup = in mt8183_da7219_max98357_dev_probe()
799 dai_link->ops = &mt8183_da7219_i2s_ops; in mt8183_da7219_max98357_dev_probe()
800 dai_link->cpus = i2s3_rt1015p_cpus; in mt8183_da7219_max98357_dev_probe()
801 dai_link->num_cpus = in mt8183_da7219_max98357_dev_probe()
803 dai_link->codecs = i2s3_rt1015p_codecs; in mt8183_da7219_max98357_dev_probe()
804 dai_link->num_codecs = in mt8183_da7219_max98357_dev_probe()
806 dai_link->platforms = i2s3_rt1015p_platforms; in mt8183_da7219_max98357_dev_probe()
807 dai_link->num_platforms = in mt8183_da7219_max98357_dev_probe()
812 if (hdmi_codec && strcmp(dai_link->name, "TDM") == 0) { in mt8183_da7219_max98357_dev_probe()
813 dai_link->codecs->of_node = hdmi_codec; in mt8183_da7219_max98357_dev_probe()
814 dai_link->ignore = 0; in mt8183_da7219_max98357_dev_probe()
817 if (!dai_link->platforms->name) in mt8183_da7219_max98357_dev_probe()
818 dai_link->platforms->of_node = platform_node; in mt8183_da7219_max98357_dev_probe()
822 of_parse_phandle(pdev->dev.of_node, in mt8183_da7219_max98357_dev_probe()
823 "mediatek,headset-codec", 0); in mt8183_da7219_max98357_dev_probe()
825 dev_err(&pdev->dev, in mt8183_da7219_max98357_dev_probe()
826 "Property 'mediatek,headset-codec' missing/invalid\n"); in mt8183_da7219_max98357_dev_probe()
827 ret = -EINVAL; in mt8183_da7219_max98357_dev_probe()
831 priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); in mt8183_da7219_max98357_dev_probe()
833 ret = -ENOMEM; in mt8183_da7219_max98357_dev_probe()
839 pinctrl = devm_pinctrl_get_select(&pdev->dev, PINCTRL_STATE_DEFAULT); in mt8183_da7219_max98357_dev_probe()
842 dev_err(&pdev->dev, "%s failed to select default state %d\n", in mt8183_da7219_max98357_dev_probe()
847 ret = devm_snd_soc_register_card(&pdev->dev, card); in mt8183_da7219_max98357_dev_probe()
861 .data = &mt8183_da7219_max98357_card,
865 .data = &mt8183_da7219_rt1015_card,
869 .data = &mt8183_da7219_rt1015p_card,
890 MODULE_DESCRIPTION("MT8183-DA7219-MAX98357 ALSA SoC machine driver");