ASoC: mediatek: Allow separate handling of headphone and headset mic jack
Merge series from Nícolas F. R. A. Prado <nfraprado@collabora.com>: This series allows the headphone and headset mic jack status to be handled separately by userspace on MT8192, MT8195 and MT8186. Changes based on commit d0508b4f1604 ("ASoC: rk3399_gru_sound: Add DAPM pins, kcontrols for jack detection"). Found while searching for an alternative for JackSwitch [1]. [1] https://lore.kernel.org/all/b98a8a77-7652-1995-27ba-eb7b6d30202a@gmail.com/ Nícolas F. R. A. Prado (6): ASoC: mediatek: mt8192-mt6359: Expose individual headset jack pins ASoC: mediatek: mt8195: Expose individual headset jack pins ASoC: mediatek: mt8186-da7219: Add headset widgets with switches ASoC: mediatek: mt8186-da7219: Expose individual headset jack pins ASoC: mediatek: mt8186-rt5682: Add headset widgets with switches ASoC: mediatek: mt8186-rt5682: Expose individual headset jack pins .../mt8186/mt8186-mt6366-da7219-max98357.c | 25 +++++++++++++++++-- .../mt8186/mt8186-mt6366-rt1019-rt5682s.c | 25 +++++++++++++++++-- .../mt8192/mt8192-mt6359-rt1015-rt5682.c | 17 +++++++++++-- sound/soc/mediatek/mt8195/mt8195-mt6359.c | 17 +++++++++++-- 4 files changed, 76 insertions(+), 8 deletions(-) -- 2.37.3
This commit is contained in:
commit
583ccffca5
@ -37,6 +37,18 @@ struct mt8186_mt6366_da7219_max98357_priv {
|
||||
struct snd_soc_jack headset_jack, hdmi_jack;
|
||||
};
|
||||
|
||||
/* Headset jack detection DAPM pins */
|
||||
static struct snd_soc_jack_pin mt8186_jack_pins[] = {
|
||||
{
|
||||
.pin = "Headphones",
|
||||
.mask = SND_JACK_HEADPHONE,
|
||||
},
|
||||
{
|
||||
.pin = "Headset Mic",
|
||||
.mask = SND_JACK_MICROPHONE,
|
||||
},
|
||||
};
|
||||
|
||||
static struct snd_soc_codec_conf mt8186_mt6366_da7219_max98357_codec_conf[] = {
|
||||
{
|
||||
.dlc = COMP_CODEC_CONF("mt6358-sound"),
|
||||
@ -72,11 +84,12 @@ static int mt8186_da7219_init(struct snd_soc_pcm_runtime *rtd)
|
||||
}
|
||||
|
||||
/* Enable Headset and 4 Buttons Jack detection */
|
||||
ret = snd_soc_card_jack_new(rtd->card, "Headset Jack",
|
||||
ret = snd_soc_card_jack_new_pins(rtd->card, "Headset Jack",
|
||||
SND_JACK_HEADSET | SND_JACK_BTN_0 |
|
||||
SND_JACK_BTN_1 | SND_JACK_BTN_2 |
|
||||
SND_JACK_BTN_3 | SND_JACK_LINEOUT,
|
||||
jack);
|
||||
jack, mt8186_jack_pins,
|
||||
ARRAY_SIZE(mt8186_jack_pins));
|
||||
if (ret) {
|
||||
dev_err(rtd->dev, "Headset Jack creation failed: %d\n", ret);
|
||||
return ret;
|
||||
@ -950,6 +963,8 @@ static struct snd_soc_dai_link mt8186_mt6366_da7219_max98357_dai_links[] = {
|
||||
static const struct snd_soc_dapm_widget
|
||||
mt8186_mt6366_da7219_max98357_widgets[] = {
|
||||
SND_SOC_DAPM_SPK("Speakers", NULL),
|
||||
SND_SOC_DAPM_HP("Headphones", NULL),
|
||||
SND_SOC_DAPM_MIC("Headset Mic", NULL),
|
||||
SND_SOC_DAPM_OUTPUT("HDMI1"),
|
||||
SND_SOC_DAPM_MIXER(SOF_DMA_DL1, SND_SOC_NOPM, 0, 0, NULL, 0),
|
||||
SND_SOC_DAPM_MIXER(SOF_DMA_DL2, SND_SOC_NOPM, 0, 0, NULL, 0),
|
||||
@ -961,6 +976,10 @@ static const struct snd_soc_dapm_route
|
||||
mt8186_mt6366_da7219_max98357_routes[] = {
|
||||
/* SPK */
|
||||
{ "Speakers", NULL, "Speaker"},
|
||||
/* Headset */
|
||||
{ "Headphones", NULL, "HPL" },
|
||||
{ "Headphones", NULL, "HPR" },
|
||||
{ "MIC", NULL, "Headset Mic" },
|
||||
/* HDMI */
|
||||
{ "HDMI1", NULL, "TX"},
|
||||
/* SOF Uplink */
|
||||
@ -976,6 +995,8 @@ mt8186_mt6366_da7219_max98357_routes[] = {
|
||||
static const struct snd_kcontrol_new
|
||||
mt8186_mt6366_da7219_max98357_controls[] = {
|
||||
SOC_DAPM_PIN_SWITCH("Speakers"),
|
||||
SOC_DAPM_PIN_SWITCH("Headphones"),
|
||||
SOC_DAPM_PIN_SWITCH("Headset Mic"),
|
||||
SOC_DAPM_PIN_SWITCH("HDMI1"),
|
||||
};
|
||||
|
||||
|
@ -41,6 +41,18 @@ struct mt8186_mt6366_rt1019_rt5682s_priv {
|
||||
struct snd_soc_jack headset_jack, hdmi_jack;
|
||||
};
|
||||
|
||||
/* Headset jack detection DAPM pins */
|
||||
static struct snd_soc_jack_pin mt8186_jack_pins[] = {
|
||||
{
|
||||
.pin = "Headphone",
|
||||
.mask = SND_JACK_HEADPHONE,
|
||||
},
|
||||
{
|
||||
.pin = "Headset Mic",
|
||||
.mask = SND_JACK_MICROPHONE,
|
||||
},
|
||||
};
|
||||
|
||||
static struct snd_soc_codec_conf mt8186_mt6366_rt1019_rt5682s_codec_conf[] = {
|
||||
{
|
||||
.dlc = COMP_CODEC_CONF("mt6358-sound"),
|
||||
@ -75,11 +87,12 @@ static int mt8186_rt5682s_init(struct snd_soc_pcm_runtime *rtd)
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = snd_soc_card_jack_new(rtd->card, "Headset Jack",
|
||||
ret = snd_soc_card_jack_new_pins(rtd->card, "Headset Jack",
|
||||
SND_JACK_HEADSET | SND_JACK_BTN_0 |
|
||||
SND_JACK_BTN_1 | SND_JACK_BTN_2 |
|
||||
SND_JACK_BTN_3,
|
||||
jack);
|
||||
jack, mt8186_jack_pins,
|
||||
ARRAY_SIZE(mt8186_jack_pins));
|
||||
if (ret) {
|
||||
dev_err(rtd->dev, "Headset Jack creation failed: %d\n", ret);
|
||||
return ret;
|
||||
@ -926,6 +939,8 @@ static struct snd_soc_dai_link mt8186_mt6366_rt1019_rt5682s_dai_links[] = {
|
||||
static const struct snd_soc_dapm_widget
|
||||
mt8186_mt6366_rt1019_rt5682s_widgets[] = {
|
||||
SND_SOC_DAPM_SPK("Speakers", NULL),
|
||||
SND_SOC_DAPM_HP("Headphone", NULL),
|
||||
SND_SOC_DAPM_MIC("Headset Mic", NULL),
|
||||
SND_SOC_DAPM_OUTPUT("HDMI1"),
|
||||
SND_SOC_DAPM_MIXER(SOF_DMA_DL1, SND_SOC_NOPM, 0, 0, NULL, 0),
|
||||
SND_SOC_DAPM_MIXER(SOF_DMA_DL2, SND_SOC_NOPM, 0, 0, NULL, 0),
|
||||
@ -937,6 +952,10 @@ static const struct snd_soc_dapm_route
|
||||
mt8186_mt6366_rt1019_rt5682s_routes[] = {
|
||||
/* SPK */
|
||||
{ "Speakers", NULL, "Speaker" },
|
||||
/* Headset */
|
||||
{ "Headphone", NULL, "HPOL" },
|
||||
{ "Headphone", NULL, "HPOR" },
|
||||
{ "IN1P", NULL, "Headset Mic" },
|
||||
/* HDMI */
|
||||
{ "HDMI1", NULL, "TX" },
|
||||
/* SOF Uplink */
|
||||
@ -952,6 +971,8 @@ mt8186_mt6366_rt1019_rt5682s_routes[] = {
|
||||
static const struct snd_kcontrol_new
|
||||
mt8186_mt6366_rt1019_rt5682s_controls[] = {
|
||||
SOC_DAPM_PIN_SWITCH("Speakers"),
|
||||
SOC_DAPM_PIN_SWITCH("Headphone"),
|
||||
SOC_DAPM_PIN_SWITCH("Headset Mic"),
|
||||
SOC_DAPM_PIN_SWITCH("HDMI1"),
|
||||
};
|
||||
|
||||
|
@ -41,6 +41,18 @@ struct mt8192_mt6359_priv {
|
||||
struct snd_soc_jack hdmi_jack;
|
||||
};
|
||||
|
||||
/* Headset jack detection DAPM pins */
|
||||
static struct snd_soc_jack_pin mt8192_jack_pins[] = {
|
||||
{
|
||||
.pin = "Headphone Jack",
|
||||
.mask = SND_JACK_HEADPHONE,
|
||||
},
|
||||
{
|
||||
.pin = "Headset Mic",
|
||||
.mask = SND_JACK_MICROPHONE,
|
||||
},
|
||||
};
|
||||
|
||||
static int mt8192_rt1015_i2s_hw_params(struct snd_pcm_substream *substream,
|
||||
struct snd_pcm_hw_params *params)
|
||||
{
|
||||
@ -326,11 +338,12 @@ static int mt8192_rt5682_init(struct snd_soc_pcm_runtime *rtd)
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = snd_soc_card_jack_new(rtd->card, "Headset Jack",
|
||||
ret = snd_soc_card_jack_new_pins(rtd->card, "Headset Jack",
|
||||
SND_JACK_HEADSET | SND_JACK_BTN_0 |
|
||||
SND_JACK_BTN_1 | SND_JACK_BTN_2 |
|
||||
SND_JACK_BTN_3,
|
||||
jack);
|
||||
jack, mt8192_jack_pins,
|
||||
ARRAY_SIZE(mt8192_jack_pins));
|
||||
if (ret) {
|
||||
dev_err(rtd->dev, "Headset Jack creation failed: %d\n", ret);
|
||||
return ret;
|
||||
|
@ -63,6 +63,18 @@ struct mt8195_mt6359_priv {
|
||||
struct clk *i2so1_mclk;
|
||||
};
|
||||
|
||||
/* Headset jack detection DAPM pins */
|
||||
static struct snd_soc_jack_pin mt8195_jack_pins[] = {
|
||||
{
|
||||
.pin = "Headphone",
|
||||
.mask = SND_JACK_HEADPHONE,
|
||||
},
|
||||
{
|
||||
.pin = "Headset Mic",
|
||||
.mask = SND_JACK_MICROPHONE,
|
||||
},
|
||||
};
|
||||
|
||||
static const struct snd_soc_dapm_widget mt8195_mt6359_widgets[] = {
|
||||
SND_SOC_DAPM_HP("Headphone", NULL),
|
||||
SND_SOC_DAPM_MIC("Headset Mic", NULL),
|
||||
@ -563,11 +575,12 @@ static int mt8195_rt5682_init(struct snd_soc_pcm_runtime *rtd)
|
||||
|
||||
priv->i2so1_mclk = afe_priv->clk[MT8195_CLK_TOP_APLL12_DIV2];
|
||||
|
||||
ret = snd_soc_card_jack_new(rtd->card, "Headset Jack",
|
||||
ret = snd_soc_card_jack_new_pins(rtd->card, "Headset Jack",
|
||||
SND_JACK_HEADSET | SND_JACK_BTN_0 |
|
||||
SND_JACK_BTN_1 | SND_JACK_BTN_2 |
|
||||
SND_JACK_BTN_3,
|
||||
jack);
|
||||
jack, mt8195_jack_pins,
|
||||
ARRAY_SIZE(mt8195_jack_pins));
|
||||
if (ret) {
|
||||
dev_err(rtd->dev, "Headset Jack creation failed: %d\n", ret);
|
||||
return ret;
|
||||
|
Loading…
x
Reference in New Issue
Block a user