|
28 | 28 | struct mt8195_mt6359_rt1019_rt5682_priv {
|
29 | 29 | struct snd_soc_jack headset_jack;
|
30 | 30 | struct snd_soc_jack dp_jack;
|
| 31 | + struct snd_soc_jack hdmi_jack; |
31 | 32 | };
|
32 | 33 |
|
33 | 34 | static const struct snd_soc_dapm_widget
|
@@ -407,6 +408,22 @@ static int mt8195_dptx_codec_init(struct snd_soc_pcm_runtime *rtd)
|
407 | 408 | return snd_soc_component_set_jack(cmpnt_codec, &priv->dp_jack, NULL);
|
408 | 409 | }
|
409 | 410 |
|
| 411 | +static int mt8195_hdmi_codec_init(struct snd_soc_pcm_runtime *rtd) |
| 412 | +{ |
| 413 | + struct mt8195_mt6359_rt1019_rt5682_priv *priv = |
| 414 | + snd_soc_card_get_drvdata(rtd->card); |
| 415 | + struct snd_soc_component *cmpnt_codec = |
| 416 | + asoc_rtd_to_codec(rtd, 0)->component; |
| 417 | + int ret = 0; |
| 418 | + |
| 419 | + ret = snd_soc_card_jack_new(rtd->card, "HDMI Jack", SND_JACK_LINEOUT, |
| 420 | + &priv->hdmi_jack, NULL, 0); |
| 421 | + if (ret) |
| 422 | + return ret; |
| 423 | + |
| 424 | + return snd_soc_component_set_jack(cmpnt_codec, &priv->hdmi_jack, NULL); |
| 425 | +} |
| 426 | + |
410 | 427 | static int mt8195_hdmitx_dptx_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
|
411 | 428 | struct snd_pcm_hw_params *params)
|
412 | 429 |
|
@@ -936,6 +953,7 @@ static struct snd_soc_dai_link mt8195_mt6359_rt1019_rt5682_dai_links[] = {
|
936 | 953 | SND_SOC_DAIFMT_NB_NF |
|
937 | 954 | SND_SOC_DAIFMT_CBS_CFS,
|
938 | 955 | .dpcm_playback = 1,
|
| 956 | + .be_hw_params_fixup = mt8195_hdmitx_dptx_hw_params_fixup, |
939 | 957 | SND_SOC_DAILINK_REG(ETDM3_OUT_BE),
|
940 | 958 | },
|
941 | 959 | [DAI_LINK_PCM1_BE] = {
|
@@ -1008,6 +1026,20 @@ static int mt8195_mt6359_rt1019_rt5682_dev_probe(struct platform_device *pdev)
|
1008 | 1026 | dai_link->codecs->dai_name = "i2s-hifi";
|
1009 | 1027 | dai_link->init = mt8195_dptx_codec_init;
|
1010 | 1028 | }
|
| 1029 | + |
| 1030 | + if (strcmp(dai_link->name, "ETDM3_OUT_BE") == 0) { |
| 1031 | + dai_link->codecs->of_node = |
| 1032 | + of_parse_phandle(pdev->dev.of_node, |
| 1033 | + "mediatek,hdmi-codec", 0); |
| 1034 | + if (!dai_link->codecs->of_node) { |
| 1035 | + dev_err(&pdev->dev, "Property 'hdmi-codec' missing or invalid\n"); |
| 1036 | + return -EINVAL; |
| 1037 | + } |
| 1038 | + |
| 1039 | + dai_link->codecs->name = NULL; |
| 1040 | + dai_link->codecs->dai_name = "i2s-hifi"; |
| 1041 | + dai_link->init = mt8195_hdmi_codec_init; |
| 1042 | + } |
1011 | 1043 | }
|
1012 | 1044 |
|
1013 | 1045 | priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
|
|
0 commit comments