summaryrefslogtreecommitdiff
path: root/sound/soc/mediatek/mt8183
diff options
context:
space:
mode:
authorTzung-Bi Shih <tzungbi@google.com>2020-07-10 13:25:02 +0800
committerMark Brown <broonie@kernel.org>2020-07-10 15:57:52 +0100
commit88abbf627a56efcd7f24aa119f07069d3d10bd0b (patch)
tree9d1b4db1bc7e5b11610038698021980c6be9535e /sound/soc/mediatek/mt8183
parentf2024dc55fcb743469238aa11f9967e0752ac600 (diff)
ASoC: mediatek: mt8183: 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-4-tzungbi@google.com Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/mediatek/mt8183')
-rw-r--r--sound/soc/mediatek/mt8183/mt8183-mt6358-ts3a227-max98357.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/sound/soc/mediatek/mt8183/mt8183-mt6358-ts3a227-max98357.c b/sound/soc/mediatek/mt8183/mt8183-mt6358-ts3a227-max98357.c
index c375e9f91a34..bd04c4bd309b 100644
--- a/sound/soc/mediatek/mt8183/mt8183-mt6358-ts3a227-max98357.c
+++ b/sound/soc/mediatek/mt8183/mt8183-mt6358-ts3a227-max98357.c
@@ -9,6 +9,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>
@@ -36,7 +37,7 @@ static const char * const mt8183_pin_str[PIN_STATE_MAX] = {
struct mt8183_mt6358_ts3a227_max98357_priv {
struct pinctrl *pinctrl;
struct pinctrl_state *pin_states[PIN_STATE_MAX];
- 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,
@@ -337,6 +338,22 @@ static const struct snd_soc_ops mt8183_mt6358_ts3a227_max98357_wov_ops = {
.shutdown = mt8183_mt6358_ts3a227_max98357_wov_shutdown,
};
+static int
+mt8183_mt6358_ts3a227_max98357_hdmi_init(struct snd_soc_pcm_runtime *rtd)
+{
+ struct mt8183_mt6358_ts3a227_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_mt6358_ts3a227_dai_links[] = {
/* FE */
{
@@ -499,6 +516,7 @@ static struct snd_soc_dai_link mt8183_mt6358_ts3a227_dai_links[] = {
.ignore_suspend = 1,
.be_hw_params_fixup = mt8183_i2s_hw_params_fixup,
.ops = &mt8183_mt6358_tdm_ops,
+ .init = mt8183_mt6358_ts3a227_max98357_hdmi_init,
SND_SOC_DAILINK_REG(tdm),
},
};