diff options
author | Trevor Wu <trevor.wu@mediatek.com> | 2021-08-19 16:41:43 +0800 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2021-08-24 19:14:00 +0100 |
commit | ef46cd42ecf00f0468df3ad1bf0f30db9634a04a (patch) | |
tree | c0fee5f83b717606aff9bf50a47c5be6a1466675 /sound/soc/mediatek | |
parent | e581e3014cc4acee9025aa5704cf85a36a572b95 (diff) | |
download | linux-stable-ef46cd42ecf00f0468df3ad1bf0f30db9634a04a.tar.gz linux-stable-ef46cd42ecf00f0468df3ad1bf0f30db9634a04a.tar.bz2 linux-stable-ef46cd42ecf00f0468df3ad1bf0f30db9634a04a.zip |
ASoC: mediatek: mt8195: add HDMITX audio support
This patch adds HDMITX audio support on mt8195-mt6359-rt1019-rt5682 board.
Signed-off-by: Trevor Wu <trevor.wu@mediatek.com>
Link: https://lore.kernel.org/r/20210819084144.18483-11-trevor.wu@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/mediatek')
-rw-r--r-- | sound/soc/mediatek/mt8195/mt8195-mt6359-rt1019-rt5682.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/sound/soc/mediatek/mt8195/mt8195-mt6359-rt1019-rt5682.c b/sound/soc/mediatek/mt8195/mt8195-mt6359-rt1019-rt5682.c index d853bc445753..5dc217f59bd6 100644 --- a/sound/soc/mediatek/mt8195/mt8195-mt6359-rt1019-rt5682.c +++ b/sound/soc/mediatek/mt8195/mt8195-mt6359-rt1019-rt5682.c @@ -28,6 +28,7 @@ struct mt8195_mt6359_rt1019_rt5682_priv { struct snd_soc_jack headset_jack; struct snd_soc_jack dp_jack; + struct snd_soc_jack hdmi_jack; }; static const struct snd_soc_dapm_widget @@ -407,6 +408,22 @@ static int mt8195_dptx_codec_init(struct snd_soc_pcm_runtime *rtd) return snd_soc_component_set_jack(cmpnt_codec, &priv->dp_jack, NULL); } +static int mt8195_hdmi_codec_init(struct snd_soc_pcm_runtime *rtd) +{ + struct mt8195_mt6359_rt1019_rt5682_priv *priv = + snd_soc_card_get_drvdata(rtd->card); + struct snd_soc_component *cmpnt_codec = + asoc_rtd_to_codec(rtd, 0)->component; + int ret = 0; + + ret = snd_soc_card_jack_new(rtd->card, "HDMI Jack", SND_JACK_LINEOUT, + &priv->hdmi_jack, NULL, 0); + if (ret) + return ret; + + return snd_soc_component_set_jack(cmpnt_codec, &priv->hdmi_jack, NULL); +} + static int mt8195_hdmitx_dptx_hw_params_fixup(struct snd_soc_pcm_runtime *rtd, struct snd_pcm_hw_params *params) @@ -936,6 +953,7 @@ static struct snd_soc_dai_link mt8195_mt6359_rt1019_rt5682_dai_links[] = { SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBS_CFS, .dpcm_playback = 1, + .be_hw_params_fixup = mt8195_hdmitx_dptx_hw_params_fixup, SND_SOC_DAILINK_REG(ETDM3_OUT_BE), }, [DAI_LINK_PCM1_BE] = { @@ -1008,6 +1026,20 @@ static int mt8195_mt6359_rt1019_rt5682_dev_probe(struct platform_device *pdev) dai_link->codecs->dai_name = "i2s-hifi"; dai_link->init = mt8195_dptx_codec_init; } + + if (strcmp(dai_link->name, "ETDM3_OUT_BE") == 0) { + dai_link->codecs->of_node = + of_parse_phandle(pdev->dev.of_node, + "mediatek,hdmi-codec", 0); + if (!dai_link->codecs->of_node) { + dev_err(&pdev->dev, "Property 'hdmi-codec' missing or invalid\n"); + return -EINVAL; + } + + dai_link->codecs->name = NULL; + dai_link->codecs->dai_name = "i2s-hifi"; + dai_link->init = mt8195_hdmi_codec_init; + } } priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); |