alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: yang.a.fang@intel.com
To: broonie@kernel.org, lgirdwood@gmail.com
Cc: alsa-devel@alsa-project.org, srinivas.sripathi@intel.com, "Fang,
	Yang A" <yang.a.fang@intel.com>,
	praveen.k.jain@intel.com, denny.iriawan@intel.com,
	sathyanarayana.nujella@intel.com, kevin.strasser@linux.intel.com,
	dgreid@chromium.org
Subject: [PATCH 3/3] ASoC: Intel: fixed TI button detection
Date: Tue, 26 May 2015 16:58:06 -0700	[thread overview]
Message-ID: <1432684686-14460-3-git-send-email-yang.a.fang@intel.com> (raw)
In-Reply-To: <1432684686-14460-1-git-send-email-yang.a.fang@intel.com>

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

In order to make TI button interrupt working max98090 codec
Need provide mic bias all the time as long as mic is present
so SHDN and micbias pin are forced on.we also need set max98090
codec bias close or lower than TI bias.We set them in bios/coreboot
kernel reads them from device property

Signed-off-by: Fang, Yang A <yang.a.fang@intel.com>
---
 sound/soc/intel/boards/cht_bsw_max98090_ti.c |   41 ++++++++++++++++++++++++++
 1 file changed, 41 insertions(+)

diff --git a/sound/soc/intel/boards/cht_bsw_max98090_ti.c b/sound/soc/intel/boards/cht_bsw_max98090_ti.c
index 1be0794..8ef947f 100644
--- a/sound/soc/intel/boards/cht_bsw_max98090_ti.c
+++ b/sound/soc/intel/boards/cht_bsw_max98090_ti.c
@@ -101,6 +101,44 @@ static int cht_aif1_hw_params(struct snd_pcm_substream *substream,
 	return 0;
 }
 
+static int cht_ti_jack_event(struct notifier_block *nb,
+		unsigned long event, void *data)
+{
+
+	struct snd_soc_jack *jack = (struct snd_soc_jack *)data;
+	struct snd_soc_dai *codec_dai = jack->card->rtd->codec_dai;
+	struct snd_soc_codec *codec = codec_dai->codec;
+	int pin_status;
+
+	if (event & SND_JACK_MICROPHONE) {
+
+		pin_status = snd_soc_dapm_get_pin_status(&codec->dapm, "SHDN");
+
+		if (!pin_status)
+			snd_soc_dapm_force_enable_pin(&codec->dapm, "SHDN");
+
+		snd_soc_dapm_force_enable_pin(&codec->dapm, "MICBIAS");
+		snd_soc_dapm_sync(&codec->dapm);
+	} else {
+
+		snd_soc_dapm_disable_pin(&codec->dapm, "MICBIAS");
+		snd_soc_dapm_sync(&codec->dapm);
+		/**
+		* SHDN is max980090 shutdown pin we can not disable
+		* it in case we are in the middle of playabck or record
+		* we mark it unlock only so dapm will take care of it
+		* next time
+		*/
+		snd_soc_dapm_disable_pin_unlocked(&codec->dapm, "SHDN");
+	}
+
+	return 0;
+}
+
+static struct notifier_block cht_jack_nb = {
+	.notifier_call = cht_ti_jack_event,
+};
+
 static int cht_codec_init(struct snd_soc_pcm_runtime *runtime)
 {
 	int ret;
@@ -130,6 +168,9 @@ static int cht_codec_init(struct snd_soc_pcm_runtime *runtime)
 		return ret;
 	}
 
+	if (ctx->ts3a227e_present)
+		snd_soc_jack_notifier_register(jack, &cht_jack_nb);
+
 	return ret;
 }
 
-- 
1.7.9.5

  parent reply	other threads:[~2015-05-26 23:58 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-26 23:58 [PATCH 1/3] ASoC: max98090: read micbias from device property yang.a.fang
2015-05-26 23:58 ` [PATCH 2/3] ASoC: ts3a227e: use device property api yang.a.fang
2015-05-28  9:29   ` Mark Brown
2015-05-26 23:58 ` yang.a.fang [this message]
2015-05-27  4:39 ` [PATCH 1/3] ASoC: max98090: read micbias from device property Dylan Reid
2015-05-27 17:26   ` Yang Fang
2015-05-28  9:28 ` Mark Brown
2015-05-28 18:00 ` [PATCH v2 " yang.a.fang
2015-05-28 18:00   ` [PATCH v2 2/3] ASoC: ts3a227e: use device property api yang.a.fang
2015-05-28 18:00   ` [PATCH v2 3/3] ASoC: Intel: fixed TI button detection yang.a.fang
2015-05-29  9:58   ` [PATCH v2 1/3] ASoC: max98090: read micbias from device property Mark Brown
2015-05-29 17:37     ` Fang, Yang A
2015-05-29 18:56   ` [PATCH v3 " yang.a.fang
2015-05-29 18:56     ` [PATCH v3 2/3] ASoC: ts3a227e: use device property api yang.a.fang
2015-06-02 17:17       ` Mark Brown
2015-05-29 18:56     ` [PATCH v3 3/3] ASoC: Intel: fixed TI button detection yang.a.fang
2015-06-03 18:15       ` Mark Brown
2015-06-03 20:54         ` Fang, Yang A
2015-06-03 22:07       ` [PATCH v4] " yang.a.fang
2015-06-15  9:51         ` Mark Brown
2015-06-02 17:11     ` [PATCH v3 1/3] ASoC: max98090: read micbias from device property Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1432684686-14460-3-git-send-email-yang.a.fang@intel.com \
    --to=yang.a.fang@intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=denny.iriawan@intel.com \
    --cc=dgreid@chromium.org \
    --cc=kevin.strasser@linux.intel.com \
    --cc=lgirdwood@gmail.com \
    --cc=praveen.k.jain@intel.com \
    --cc=sathyanarayana.nujella@intel.com \
    --cc=srinivas.sripathi@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).