[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210818103215.9186-11-trevor.wu@mediatek.com>
Date: Wed, 18 Aug 2021 18:32:14 +0800
From: Trevor Wu <trevor.wu@...iatek.com>
To: <broonie@...nel.org>, <lgirdwood@...il.com>, <tiwai@...e.com>,
<robh+dt@...nel.org>, <matthias.bgg@...il.com>
CC: <trevor.wu@...iatek.com>, <alsa-devel@...a-project.org>,
<linux-mediatek@...ts.infradead.org>,
<linux-arm-kernel@...ts.infradead.org>,
<linux-kernel@...r.kernel.org>, <devicetree@...r.kernel.org>,
<bicycle.tsai@...iatek.com>, <jiaxin.yu@...iatek.com>,
<cychiang@...gle.com>, <aaronyu@...gle.com>, <wenst@...omium.org>
Subject: [PATCH v4 10/11] 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@...iatek.com>
---
.../mt8195/mt8195-mt6359-rt1019-rt5682.c | 38 +++++++++++++++++++
1 file changed, 38 insertions(+)
diff --git a/sound/soc/mediatek/mt8195/mt8195-mt6359-rt1019-rt5682.c b/sound/soc/mediatek/mt8195/mt8195-mt6359-rt1019-rt5682.c
index d853bc445753..e4472bbc9f01 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,26 @@ 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) {
+#if IS_ENABLED(CONFIG_SND_SOC_SOF_MT8195)
+ dai_link->codecs->of_node =
+ of_parse_phandle(machine_node,
+ "mediatek,hdmi-codec", 0);
+#else
+ dai_link->codecs->of_node =
+ of_parse_phandle(pdev->dev.of_node,
+ "mediatek,hdmi-codec", 0);
+#endif
+ 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);
--
2.18.0
Powered by blists - more mailing lists