[alsa-devel] [PATCH] ASoC: Intel: Enabled button jack for BSW platform with rt5650 codec
yang.a.fang at intel.com
yang.a.fang at intel.com
Tue May 5 02:19:20 CEST 2015
From: "Fang, Yang A" <yang.a.fang at intel.com>
rt5650 codec supports 4 buttons detections so enabled it
Signed-off-by: Fang, Yang A <yang.a.fang at intel.com>
---
sound/soc/intel/boards/cht_bsw_rt5645.c | 23 ++++++++++++++++++++++-
1 file changed, 22 insertions(+), 1 deletion(-)
diff --git a/sound/soc/intel/boards/cht_bsw_rt5645.c b/sound/soc/intel/boards/cht_bsw_rt5645.c
index 8f96c21..1468c3d 100644
--- a/sound/soc/intel/boards/cht_bsw_rt5645.c
+++ b/sound/soc/intel/boards/cht_bsw_rt5645.c
@@ -43,6 +43,7 @@ struct cht_acpi_card {
struct cht_mc_private {
struct snd_soc_jack hp_jack;
struct snd_soc_jack mic_jack;
+ struct snd_soc_jack btn_jack;
struct cht_acpi_card *acpi_card;
};
@@ -182,6 +183,7 @@ static int cht_codec_init(struct snd_soc_pcm_runtime *runtime)
struct snd_soc_codec *codec = runtime->codec;
struct snd_soc_dai *codec_dai = runtime->codec_dai;
struct cht_mc_private *ctx = snd_soc_card_get_drvdata(runtime->card);
+ struct snd_soc_jack *btn_jack;
/* Select clk_i2s1_asrc as ASRC clock source */
rt5645_sel_asrc_clk_src(codec,
@@ -214,7 +216,26 @@ static int cht_codec_init(struct snd_soc_pcm_runtime *runtime)
return ret;
}
- rt5645_set_jack_detect(codec, &ctx->hp_jack, &ctx->mic_jack, NULL);
+ if (ctx->acpi_card->codec_type == CODEC_TYPE_RT5650) {
+
+ ret = snd_soc_card_jack_new(runtime->card, "Button Jack",
+ SND_JACK_BTN_0 |
+ SND_JACK_BTN_1 |
+ SND_JACK_BTN_2 |
+ SND_JACK_BTN_3, &ctx->btn_jack,
+ NULL, 0);
+ if (ret) {
+ dev_err(runtime->dev,
+ "Btn jack creation failed %d\n", ret);
+ return ret;
+ }
+
+ btn_jack = &ctx->btn_jack;
+ } else {
+ btn_jack = NULL;
+ }
+
+ rt5645_set_jack_detect(codec, &ctx->hp_jack, &ctx->mic_jack, btn_jack);
return ret;
}
--
1.7.9.5
More information about the Alsa-devel
mailing list