alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ASoC: Intel: Enabled button jack for BSW platform with rt5650 codec
@ 2015-05-05  0:19 yang.a.fang
  2015-05-05 21:49 ` Mark Brown
  2015-05-05 23:55 ` [PATCH v2] " yang.a.fang
  0 siblings, 2 replies; 13+ messages in thread
From: yang.a.fang @ 2015-05-05  0:19 UTC (permalink / raw)
  To: broonie, lgirdwood
  Cc: alsa-devel, srinivas.sripathi, vinod.koul, praveen.k.jain,
	denny.iriawan, Fang, Yang A, sathyanarayana.nujella,
	kevin.strasser

From: "Fang, Yang A" <yang.a.fang@intel.com>

rt5650 codec supports 4 buttons detections so enabled it

Signed-off-by: Fang, Yang A <yang.a.fang@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

^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2015-05-06 10:58 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-05  0:19 [PATCH] ASoC: Intel: Enabled button jack for BSW platform with rt5650 codec yang.a.fang
2015-05-05 21:49 ` Mark Brown
2015-05-05 22:02   ` Dylan Reid
2015-05-05 22:14     ` Yang Fang
2015-05-05 22:27       ` Dylan Reid
2015-05-05 22:30       ` Mark Brown
2015-05-05 22:39         ` Fang, Yang A
2015-05-05 22:42           ` Dylan Reid
2015-05-05 22:59             ` Fang, Yang A
2015-05-05 23:00             ` Mark Brown
2015-05-05 22:27     ` Mark Brown
2015-05-05 23:55 ` [PATCH v2] " yang.a.fang
2015-05-06 10:58   ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).