Unverified Commit c8b60c6d authored by Tzung-Bi Shih's avatar Tzung-Bi Shih Committed by Mark Brown
Browse files

ASoC: mediatek: mt8173-rt5650: support HDMI jack reporting

parent fb0c3c6e
Loading
Loading
Loading
Loading
+16 −1
Original line number Diff line number Diff line
@@ -11,6 +11,7 @@
#include <linux/of_gpio.h>
#include <sound/soc.h>
#include <sound/jack.h>
#include <sound/hdmi-codec.h>
#include "../../codecs/rt5645.h"

#define MCLK_FOR_CODECS		12288000
@@ -98,7 +99,7 @@ static const struct snd_soc_ops mt8173_rt5650_ops = {
	.hw_params = mt8173_rt5650_hw_params,
};

static struct snd_soc_jack mt8173_rt5650_jack;
static struct snd_soc_jack mt8173_rt5650_jack, mt8173_rt5650_hdmi_jack;

static int mt8173_rt5650_init(struct snd_soc_pcm_runtime *runtime)
{
@@ -144,6 +145,19 @@ static int mt8173_rt5650_init(struct snd_soc_pcm_runtime *runtime)
				      &mt8173_rt5650_jack);
}

static int mt8173_rt5650_hdmi_init(struct snd_soc_pcm_runtime *rtd)
{
	int ret;

	ret = snd_soc_card_jack_new(rtd->card, "HDMI Jack", SND_JACK_LINEOUT,
				    &mt8173_rt5650_hdmi_jack, NULL, 0);
	if (ret)
		return ret;

	return hdmi_codec_set_jack_detect(rtd->codec_dai->component,
					  &mt8173_rt5650_hdmi_jack);
}

enum {
	DAI_LINK_PLAYBACK,
	DAI_LINK_CAPTURE,
@@ -222,6 +236,7 @@ static struct snd_soc_dai_link mt8173_rt5650_dais[] = {
		.name = "HDMI BE",
		.no_pcm = 1,
		.dpcm_playback = 1,
		.init = mt8173_rt5650_hdmi_init,
		SND_SOC_DAILINK_REG(hdmi_be),
	},
};