summaryrefslogtreecommitdiff
path: root/sound/soc/mediatek
diff options
context:
space:
mode:
authorTzung-Bi Shih <tzungbi@google.com>2020-07-10 13:25:05 +0800
committerMark Brown <broonie@kernel.org>2020-07-10 15:57:55 +0100
commite25f8afd8869bd97a4d0baea5d8da730913c8541 (patch)
treeca38acf5aec43e87973a98602f8d1340dc0594b4 /sound/soc/mediatek
parent5bdbe977117741a6bf4958c8dfdcb6b9263e9f1c (diff)
ASoC: mediatek: mt8183-da7219: support HDMI jack reporting
Supports HDMI jack reporting. Signed-off-by: Tzung-Bi Shih <tzungbi@google.com> Link: https://lore.kernel.org/r/20200710052505.3664118-7-tzungbi@google.com Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/mediatek')
-rw-r--r--sound/soc/mediatek/Kconfig1
-rw-r--r--sound/soc/mediatek/mt8183/mt8183-da7219-max98357.c19
2 files changed, 19 insertions, 1 deletions
diff --git a/sound/soc/mediatek/Kconfig b/sound/soc/mediatek/Kconfig
index ba120e9441d0..f7bc007bbdec 100644
--- a/sound/soc/mediatek/Kconfig
+++ b/sound/soc/mediatek/Kconfig
@@ -142,6 +142,7 @@ config SND_SOC_MT8183_DA7219_MAX98357A
select SND_SOC_RT1015
select SND_SOC_DA7219
select SND_SOC_BT_SCO
+ select SND_SOC_HDMI_CODEC
help
This adds ASoC driver for Mediatek MT8183 boards
with the DA7219 MAX98357A RT1015 audio codec.
diff --git a/sound/soc/mediatek/mt8183/mt8183-da7219-max98357.c b/sound/soc/mediatek/mt8183/mt8183-da7219-max98357.c
index cbef4a538224..edfbf34a2f45 100644
--- a/sound/soc/mediatek/mt8183/mt8183-da7219-max98357.c
+++ b/sound/soc/mediatek/mt8183/mt8183-da7219-max98357.c
@@ -10,6 +10,7 @@
#include <linux/module.h>
#include <linux/of_device.h>
#include <linux/pinctrl/consumer.h>
+#include <sound/hdmi-codec.h>
#include <sound/jack.h>
#include <sound/pcm_params.h>
#include <sound/soc.h>
@@ -26,7 +27,7 @@
#define RT1015_DEV1_NAME "rt1015.6-0029"
struct mt8183_da7219_max98357_priv {
- struct snd_soc_jack headset_jack;
+ struct snd_soc_jack headset_jack, hdmi_jack;
};
static int mt8183_mt6358_i2s_hw_params(struct snd_pcm_substream *substream,
@@ -357,6 +358,21 @@ SND_SOC_DAILINK_DEFS(tdm,
DAILINK_COMP_ARRAY(COMP_CODEC(NULL, "i2s-hifi")),
DAILINK_COMP_ARRAY(COMP_EMPTY()));
+static int mt8183_da7219_max98357_hdmi_init(struct snd_soc_pcm_runtime *rtd)
+{
+ struct mt8183_da7219_max98357_priv *priv =
+ snd_soc_card_get_drvdata(rtd->card);
+ int ret;
+
+ ret = snd_soc_card_jack_new(rtd->card, "HDMI Jack", SND_JACK_LINEOUT,
+ &priv->hdmi_jack, NULL, 0);
+ if (ret)
+ return ret;
+
+ return hdmi_codec_set_jack_detect(asoc_rtd_to_codec(rtd, 0)->component,
+ &priv->hdmi_jack);
+}
+
static struct snd_soc_dai_link mt8183_da7219_dai_links[] = {
/* FE */
{
@@ -511,6 +527,7 @@ static struct snd_soc_dai_link mt8183_da7219_dai_links[] = {
.dpcm_playback = 1,
.ignore_suspend = 1,
.be_hw_params_fixup = mt8183_i2s_hw_params_fixup,
+ .init = mt8183_da7219_max98357_hdmi_init,
SND_SOC_DAILINK_REG(tdm),
},
};