Skip to content

Commit ef46cd4

Browse files
wenliangwubroonie
authored andcommitted
ASoC: mediatek: mt8195: add HDMITX audio support
This patch adds HDMITX audio support on mt8195-mt6359-rt1019-rt5682 board. Signed-off-by: Trevor Wu <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent e581e30 commit ef46cd4

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

sound/soc/mediatek/mt8195/mt8195-mt6359-rt1019-rt5682.c

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
struct mt8195_mt6359_rt1019_rt5682_priv {
2929
struct snd_soc_jack headset_jack;
3030
struct snd_soc_jack dp_jack;
31+
struct snd_soc_jack hdmi_jack;
3132
};
3233

3334
static const struct snd_soc_dapm_widget
@@ -407,6 +408,22 @@ static int mt8195_dptx_codec_init(struct snd_soc_pcm_runtime *rtd)
407408
return snd_soc_component_set_jack(cmpnt_codec, &priv->dp_jack, NULL);
408409
}
409410

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+
410427
static int mt8195_hdmitx_dptx_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
411428
struct snd_pcm_hw_params *params)
412429

@@ -936,6 +953,7 @@ static struct snd_soc_dai_link mt8195_mt6359_rt1019_rt5682_dai_links[] = {
936953
SND_SOC_DAIFMT_NB_NF |
937954
SND_SOC_DAIFMT_CBS_CFS,
938955
.dpcm_playback = 1,
956+
.be_hw_params_fixup = mt8195_hdmitx_dptx_hw_params_fixup,
939957
SND_SOC_DAILINK_REG(ETDM3_OUT_BE),
940958
},
941959
[DAI_LINK_PCM1_BE] = {
@@ -1008,6 +1026,20 @@ static int mt8195_mt6359_rt1019_rt5682_dev_probe(struct platform_device *pdev)
10081026
dai_link->codecs->dai_name = "i2s-hifi";
10091027
dai_link->init = mt8195_dptx_codec_init;
10101028
}
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+
}
10111043
}
10121044

10131045
priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);

0 commit comments

Comments
 (0)