From dc50eab76b709d68175a358d6e23a5a3890764d3 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 18 May 2024 19:39:57 +0200 Subject: Merging upstream version 6.7.7. Signed-off-by: Daniel Baumann --- .../mediatek/mt8186/mt8186-mt6366-rt1019-rt5682s.c | 59 ++++++++++++++++++---- 1 file changed, 50 insertions(+), 9 deletions(-) (limited to 'sound/soc/mediatek/mt8186/mt8186-mt6366-rt1019-rt5682s.c') diff --git a/sound/soc/mediatek/mt8186/mt8186-mt6366-rt1019-rt5682s.c b/sound/soc/mediatek/mt8186/mt8186-mt6366-rt1019-rt5682s.c index 9777ba89e9..f78197c8e5 100644 --- a/sound/soc/mediatek/mt8186/mt8186-mt6366-rt1019-rt5682s.c +++ b/sound/soc/mediatek/mt8186/mt8186-mt6366-rt1019-rt5682s.c @@ -7,11 +7,10 @@ // Author: Jiaxin Yu // -#include #include #include #include -#include +#include #include #include #include @@ -169,8 +168,9 @@ static int mt8186_rt5682s_init(struct snd_soc_pcm_runtime *rtd) struct mt8186_mt6366_rt1019_rt5682s_priv *priv = soc_card_data->mach_priv; struct snd_soc_jack *jack = &priv->headset_jack; struct snd_soc_component *cmpnt_codec = - asoc_rtd_to_codec(rtd, 0)->component; + snd_soc_rtd_to_codec(rtd, 0)->component; int ret; + int type; ret = mt8186_dai_i2s_set_share(afe, "I2S1", "I2S0"); if (ret) { @@ -194,7 +194,8 @@ static int mt8186_rt5682s_init(struct snd_soc_pcm_runtime *rtd) snd_jack_set_key(jack->jack, SND_JACK_BTN_2, KEY_VOLUMEUP); snd_jack_set_key(jack->jack, SND_JACK_BTN_3, KEY_VOLUMEDOWN); - return snd_soc_component_set_jack(cmpnt_codec, jack, NULL); + type = SND_JACK_HEADSET | SND_JACK_BTN_0 | SND_JACK_BTN_1 | SND_JACK_BTN_2 | SND_JACK_BTN_3; + return snd_soc_component_set_jack(cmpnt_codec, jack, (void *)&type); } static int mt8186_rt5682s_i2s_hw_params(struct snd_pcm_substream *substream, @@ -202,8 +203,8 @@ static int mt8186_rt5682s_i2s_hw_params(struct snd_pcm_substream *substream, { struct snd_soc_pcm_runtime *rtd = substream->private_data; struct snd_soc_card *card = rtd->card; - struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(rtd, 0); - struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0); + struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0); + struct snd_soc_dai *codec_dai = snd_soc_rtd_to_codec(rtd, 0); unsigned int rate = params_rate(params); unsigned int mclk_fs_ratio = 128; unsigned int mclk_fs = rate * mclk_fs_ratio; @@ -253,7 +254,7 @@ static int mt8186_mt6366_rt1019_rt5682s_hdmi_init(struct snd_soc_pcm_runtime *rt snd_soc_rtdcom_lookup(rtd, AFE_PCM_NAME); struct mtk_base_afe *afe = snd_soc_component_get_drvdata(cmpnt_afe); struct snd_soc_component *cmpnt_codec = - asoc_rtd_to_codec(rtd, 0)->component; + snd_soc_rtd_to_codec(rtd, 0)->component; struct mtk_soc_card_data *soc_card_data = snd_soc_card_get_drvdata(rtd->card); struct mt8186_mt6366_rt1019_rt5682s_priv *priv = soc_card_data->mach_priv; @@ -345,7 +346,7 @@ static int mt8186_mt6366_rt1019_rt5682s_playback_startup(struct snd_pcm_substrea .mask = 0, }; - struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream); + struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream); struct snd_pcm_runtime *runtime = substream->runtime; int ret; @@ -391,7 +392,7 @@ static int mt8186_mt6366_rt1019_rt5682s_capture_startup(struct snd_pcm_substream .mask = 0, }; - struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream); + struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream); struct snd_pcm_runtime *runtime = substream->runtime; int ret; @@ -1059,6 +1060,27 @@ mt8186_mt6366_rt1019_rt5682s_routes[] = { {"DSP_DL2_VIRT", NULL, SOF_DMA_DL2}, }; +static const struct snd_soc_dapm_route mt8186_mt6366_rt5650_routes[] = { + /* SPK */ + {"Speakers", NULL, "SPOL"}, + {"Speakers", NULL, "SPOR"}, + /* Headset */ + { "Headphone", NULL, "HPOL" }, + { "Headphone", NULL, "HPOR" }, + { "IN1P", NULL, "Headset Mic" }, + { "IN1N", NULL, "Headset Mic"}, + /* HDMI */ + { "HDMI1", NULL, "TX" }, + /* SOF Uplink */ + {SOF_DMA_UL1, NULL, "UL1_CH1"}, + {SOF_DMA_UL1, NULL, "UL1_CH2"}, + {SOF_DMA_UL2, NULL, "UL2_CH1"}, + {SOF_DMA_UL2, NULL, "UL2_CH2"}, + /* SOF Downlink */ + {"DSP_DL1_VIRT", NULL, SOF_DMA_DL1}, + {"DSP_DL2_VIRT", NULL, SOF_DMA_DL2}, +}; + static const struct snd_kcontrol_new mt8186_mt6366_rt1019_rt5682s_controls[] = { SOC_DAPM_PIN_SWITCH("Speakers"), @@ -1097,6 +1119,21 @@ static struct snd_soc_card mt8186_mt6366_rt5682s_max98360_soc_card = { .num_configs = ARRAY_SIZE(mt8186_mt6366_rt1019_rt5682s_codec_conf), }; +static struct snd_soc_card mt8186_mt6366_rt5650_soc_card = { + .name = "mt8186_rt5650", + .owner = THIS_MODULE, + .dai_link = mt8186_mt6366_rt1019_rt5682s_dai_links, + .num_links = ARRAY_SIZE(mt8186_mt6366_rt1019_rt5682s_dai_links), + .controls = mt8186_mt6366_rt1019_rt5682s_controls, + .num_controls = ARRAY_SIZE(mt8186_mt6366_rt1019_rt5682s_controls), + .dapm_widgets = mt8186_mt6366_rt1019_rt5682s_widgets, + .num_dapm_widgets = ARRAY_SIZE(mt8186_mt6366_rt1019_rt5682s_widgets), + .dapm_routes = mt8186_mt6366_rt5650_routes, + .num_dapm_routes = ARRAY_SIZE(mt8186_mt6366_rt5650_routes), + .codec_conf = mt8186_mt6366_rt1019_rt5682s_codec_conf, + .num_configs = ARRAY_SIZE(mt8186_mt6366_rt1019_rt5682s_codec_conf), +}; + static int mt8186_mt6366_rt1019_rt5682s_dev_probe(struct platform_device *pdev) { struct snd_soc_card *card; @@ -1254,6 +1291,10 @@ static const struct of_device_id mt8186_mt6366_rt1019_rt5682s_dt_match[] = { .compatible = "mediatek,mt8186-mt6366-rt5682s-max98360-sound", .data = &mt8186_mt6366_rt5682s_max98360_soc_card, }, + { + .compatible = "mediatek,mt8186-mt6366-rt5650-sound", + .data = &mt8186_mt6366_rt5650_soc_card, + }, {} }; MODULE_DEVICE_TABLE(of, mt8186_mt6366_rt1019_rt5682s_dt_match); -- cgit v1.2.3