Commit 673c4f89 authored by Fang, Yang A's avatar Fang, Yang A Committed by Mark Brown

ASoC: Intel: Enabled button jack for BSW platform with rt5650 codec

rt5650 codec supports 4 buttons detections so enabled it
Signed-off-by: default avatarFang, Yang A <yang.a.fang@intel.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 292d2497
...@@ -41,8 +41,7 @@ struct cht_acpi_card { ...@@ -41,8 +41,7 @@ struct cht_acpi_card {
}; };
struct cht_mc_private { struct cht_mc_private {
struct snd_soc_jack hp_jack; struct snd_soc_jack jack;
struct snd_soc_jack mic_jack;
struct cht_acpi_card *acpi_card; struct cht_acpi_card *acpi_card;
}; };
...@@ -179,6 +178,7 @@ static int cht_aif1_hw_params(struct snd_pcm_substream *substream, ...@@ -179,6 +178,7 @@ static int cht_aif1_hw_params(struct snd_pcm_substream *substream,
static int cht_codec_init(struct snd_soc_pcm_runtime *runtime) static int cht_codec_init(struct snd_soc_pcm_runtime *runtime)
{ {
int ret; int ret;
int jack_type;
struct snd_soc_codec *codec = runtime->codec; struct snd_soc_codec *codec = runtime->codec;
struct snd_soc_dai *codec_dai = runtime->codec_dai; struct snd_soc_dai *codec_dai = runtime->codec_dai;
struct cht_mc_private *ctx = snd_soc_card_get_drvdata(runtime->card); struct cht_mc_private *ctx = snd_soc_card_get_drvdata(runtime->card);
...@@ -198,23 +198,22 @@ static int cht_codec_init(struct snd_soc_pcm_runtime *runtime) ...@@ -198,23 +198,22 @@ static int cht_codec_init(struct snd_soc_pcm_runtime *runtime)
return ret; return ret;
} }
ret = snd_soc_card_jack_new(runtime->card, "Headphone Jack", if (ctx->acpi_card->codec_type == CODEC_TYPE_RT5650)
SND_JACK_HEADPHONE, &ctx->hp_jack, jack_type = SND_JACK_HEADPHONE | SND_JACK_MICROPHONE |
NULL, 0); SND_JACK_BTN_0 | SND_JACK_BTN_1 |
if (ret) { SND_JACK_BTN_2 | SND_JACK_BTN_3;
dev_err(runtime->dev, "HP jack creation failed %d\n", ret); else
return ret; jack_type = SND_JACK_HEADPHONE | SND_JACK_MICROPHONE;
}
ret = snd_soc_card_jack_new(runtime->card, "Mic Jack", ret = snd_soc_card_jack_new(runtime->card, "Headset Jack",
SND_JACK_MICROPHONE, &ctx->mic_jack, jack_type, &ctx->jack,
NULL, 0); NULL, 0);
if (ret) { if (ret) {
dev_err(runtime->dev, "Mic jack creation failed %d\n", ret); dev_err(runtime->dev, "Headset jack creation failed %d\n", ret);
return ret; return ret;
} }
rt5645_set_jack_detect(codec, &ctx->hp_jack, &ctx->mic_jack, NULL); rt5645_set_jack_detect(codec, &ctx->jack, &ctx->jack, &ctx->jack);
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment