diff mbox

[v4] ASoC: Intel: fixed TI button detection

Message ID 1433369261-98343-1-git-send-email-yang.a.fang@intel.com (mailing list archive)
State Accepted
Commit e8ed6702746650d09a6cb3fc89d979a92f1ed49b
Headers show

Commit Message

yang.a.fang@intel.com June 3, 2015, 10:07 p.m. UTC
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 |   30 ++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

Comments

Mark Brown June 15, 2015, 9:51 a.m. UTC | #1
On Wed, Jun 03, 2015 at 03:07:41PM -0700, yang.a.fang@intel.com wrote:
> 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

Applied, thanks.
diff mbox

Patch

diff --git a/sound/soc/intel/boards/cht_bsw_max98090_ti.c b/sound/soc/intel/boards/cht_bsw_max98090_ti.c
index 1be0794..d604ee8 100644
--- a/sound/soc/intel/boards/cht_bsw_max98090_ti.c
+++ b/sound/soc/intel/boards/cht_bsw_max98090_ti.c
@@ -101,6 +101,33 @@  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;
+
+	if (event & SND_JACK_MICROPHONE) {
+
+		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_disable_pin(&codec->dapm, "SHDN");
+		snd_soc_dapm_sync(&codec->dapm);
+	}
+
+	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 +157,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;
 }