ASoC: mediatek: mt8188-mt6359: register hdmi/dp jack pins

Some userspace applications need jack control events, so register hdmi
and dp jack pins to activate jack control events.

Signed-off-by: Trevor Wu <trevor.wu@mediatek.com>
Reviewed-by: Alexandre Mergnat <amergnat@baylibre.com>
Link: https://lore.kernel.org/r/20230526093150.22923-4-trevor.wu@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Trevor Wu 2023-05-26 17:31:46 +08:00 committed by Mark Brown
parent 9fba0d3ec0
commit 73cf2b3f2b
No known key found for this signature in database
GPG Key ID: 24D68B725D5487D0

View File

@ -151,6 +151,20 @@ struct mt8188_mt6359_priv {
struct snd_soc_jack hdmi_jack;
};
static struct snd_soc_jack_pin mt8188_hdmi_jack_pins[] = {
{
.pin = "HDMI",
.mask = SND_JACK_LINEOUT,
},
};
static struct snd_soc_jack_pin mt8188_dp_jack_pins[] = {
{
.pin = "DP",
.mask = SND_JACK_LINEOUT,
},
};
struct mt8188_card_data {
const char *name;
unsigned long quirk;
@ -159,6 +173,8 @@ struct mt8188_card_data {
static const struct snd_soc_dapm_widget mt8188_mt6359_widgets[] = {
SND_SOC_DAPM_HP("Headphone", NULL),
SND_SOC_DAPM_MIC("Headset Mic", NULL),
SND_SOC_DAPM_SINK("HDMI"),
SND_SOC_DAPM_SINK("DP"),
};
static const struct snd_kcontrol_new mt8188_mt6359_controls[] = {
@ -396,8 +412,10 @@ static int mt8188_hdmi_codec_init(struct snd_soc_pcm_runtime *rtd)
struct snd_soc_component *component = 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);
ret = snd_soc_card_jack_new_pins(rtd->card, "HDMI Jack",
SND_JACK_LINEOUT, &priv->hdmi_jack,
mt8188_hdmi_jack_pins,
ARRAY_SIZE(mt8188_hdmi_jack_pins));
if (ret) {
dev_info(rtd->dev, "%s, new jack failed: %d\n", __func__, ret);
return ret;
@ -417,8 +435,9 @@ static int mt8188_dptx_codec_init(struct snd_soc_pcm_runtime *rtd)
struct snd_soc_component *component = asoc_rtd_to_codec(rtd, 0)->component;
int ret = 0;
ret = snd_soc_card_jack_new(rtd->card, "DP Jack", SND_JACK_LINEOUT,
&priv->dp_jack);
ret = snd_soc_card_jack_new_pins(rtd->card, "DP Jack", SND_JACK_LINEOUT,
&priv->dp_jack, mt8188_dp_jack_pins,
ARRAY_SIZE(mt8188_dp_jack_pins));
if (ret) {
dev_info(rtd->dev, "%s, new jack failed: %d\n", __func__, ret);
return ret;