All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anish Kumar <Anish.Kumar@maximintegrated.com>
To: "yang.a.fang@intel.com" <yang.a.fang@intel.com>,
	"broonie@kernel.org" <broonie@kernel.org>,
	"lgirdwood@gmail.com" <lgirdwood@gmail.com>
Cc: "alsa-devel@alsa-project.org" <alsa-devel@alsa-project.org>,
	"srinivas.sripathi@intel.com" <srinivas.sripathi@intel.com>,
	"praveen.k.jain@intel.com" <praveen.k.jain@intel.com>,
	"denny.iriawan@intel.com" <denny.iriawan@intel.com>,
	"sathyanarayana.nujella@intel.com"
	<sathyanarayana.nujella@intel.com>,
	"ullysses.a.eoff@intel.com" <ullysses.a.eoff@intel.com>,
	"kevin.strasser@linux.intel.com" <kevin.strasser@linux.intel.com>,
	"dgreid@chromium.org" <dgreid@chromium.org>
Subject: Re: [PATCH v2] ASoC: max98090: Enforce correct device sequencing when configuring a new
Date: Fri, 7 Aug 2015 14:41:49 -0700	[thread overview]
Message-ID: <B03A893ADFE80748942D13AFAF28451924E6F1461B@ITSVLEX06.it.maxim-ic.internal> (raw)
In-Reply-To: <1438981695-25531-1-git-send-email-yang.a.fang@intel.com>

Acked-by: anish kumar <anish.kumar@maximintegrated.com>
________________________________________
From: yang.a.fang@intel.com [yang.a.fang@intel.com]
Sent: Friday, August 07, 2015 2:08 PM
To: broonie@kernel.org; lgirdwood@gmail.com
Cc: alsa-devel@alsa-project.org; dgreid@chromium.org; sathyanarayana.nujella@intel.com; kevin.strasser@linux.intel.com; srinivas.sripathi@intel.com; denny.iriawan@intel.com; praveen.k.jain@intel.com; Anish Kumar; ullysses.a.eoff@intel.com; Fang, Yang A
Subject: [PATCH v2] ASoC: max98090: Enforce correct device sequencing when configuring a new

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

audio route when there is an existing active audio route(s).

This patch fixed recording noise issue while playback is active.

We have some registers which require the device to be in full shutdown
or to enter full shutdown before the register settings will take effect.
Currently the driver is not shutting down the device when a new audio
route is created. If a new audio route is made active while there is
already an active audio route, then the required register sequencing is
violated. A hardware shutdown toggle when creating a new audio route
corrects the sequencing error. The device must remain in hardware
shutdown for 40ms to allow the internal hardware core to fully shutdown.

Signed-off-by: Fang, Yang A <yang.a.fang@intel.com>
Signed-off-by: Sathyanarayana Nujella <sathyanarayana.nujella@intel.com>
---
 sound/soc/codecs/max98090.c |   46 +++++++++++++++++++++++++++++++++++++------
 sound/soc/codecs/max98090.h |    1 +
 2 files changed, 41 insertions(+), 6 deletions(-)

diff --git a/sound/soc/codecs/max98090.c b/sound/soc/codecs/max98090.c
index 2d69fca..584aab8 100644
--- a/sound/soc/codecs/max98090.c
+++ b/sound/soc/codecs/max98090.c
@@ -777,6 +777,19 @@ static int max98090_micinput_event(struct snd_soc_dapm_widget *w,
        return 0;
 }

+static int max98090_shdn_event(struct snd_soc_dapm_widget *w,
+                                struct snd_kcontrol *kcontrol, int event)
+{
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
+       struct max98090_priv *max98090 = snd_soc_codec_get_drvdata(codec);
+
+       if (event & SND_SOC_DAPM_POST_PMU)
+               max98090->shdn_pending = true;
+
+       return 0;
+
+}
+
 static const char *mic1_mux_text[] = { "IN12", "IN56" };

 static SOC_ENUM_SINGLE_DECL(mic1_mux_enum,
@@ -1085,9 +1098,11 @@ static const struct snd_soc_dapm_widget max98090_dapm_widgets[] = {
        SND_SOC_DAPM_SUPPLY("SDOEN", M98090_REG_IO_CONFIGURATION,
                M98090_SDOEN_SHIFT, 0, NULL, 0),
        SND_SOC_DAPM_SUPPLY("DMICL_ENA", M98090_REG_DIGITAL_MIC_ENABLE,
-                M98090_DIGMICL_SHIFT, 0, NULL, 0),
+                M98090_DIGMICL_SHIFT, 0, max98090_shdn_event,
+                       SND_SOC_DAPM_POST_PMU),
        SND_SOC_DAPM_SUPPLY("DMICR_ENA", M98090_REG_DIGITAL_MIC_ENABLE,
-                M98090_DIGMICR_SHIFT, 0, NULL, 0),
+                M98090_DIGMICR_SHIFT, 0, max98090_shdn_event,
+                        SND_SOC_DAPM_POST_PMU),
        SND_SOC_DAPM_SUPPLY("AHPF", M98090_REG_FILTER_CONFIG,
                M98090_AHPF_SHIFT, 0, NULL, 0),

@@ -1132,10 +1147,12 @@ static const struct snd_soc_dapm_widget max98090_dapm_widgets[] = {
                &max98090_right_adc_mixer_controls[0],
                ARRAY_SIZE(max98090_right_adc_mixer_controls)),

-       SND_SOC_DAPM_ADC("ADCL", NULL, M98090_REG_INPUT_ENABLE,
-               M98090_ADLEN_SHIFT, 0),
-       SND_SOC_DAPM_ADC("ADCR", NULL, M98090_REG_INPUT_ENABLE,
-               M98090_ADREN_SHIFT, 0),
+       SND_SOC_DAPM_ADC_E("ADCL", NULL, M98090_REG_INPUT_ENABLE,
+               M98090_ADLEN_SHIFT, 0, max98090_shdn_event,
+               SND_SOC_DAPM_POST_PMU),
+       SND_SOC_DAPM_ADC_E("ADCR", NULL, M98090_REG_INPUT_ENABLE,
+               M98090_ADREN_SHIFT, 0, max98090_shdn_event,
+               SND_SOC_DAPM_POST_PMU),

        SND_SOC_DAPM_AIF_OUT("AIFOUTL", "HiFi Capture", 0,
                SND_SOC_NOPM, 0, 0),
@@ -2466,9 +2483,26 @@ static int max98090_remove(struct snd_soc_codec *codec)
        return 0;
 }

+static void max98090_seq_notifier(struct snd_soc_dapm_context *dapm,
+       enum snd_soc_dapm_type event, int subseq)
+{
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(dapm);
+       struct max98090_priv *max98090 = snd_soc_codec_get_drvdata(codec);
+
+       if (max98090->shdn_pending) {
+               snd_soc_update_bits(codec, M98090_REG_DEVICE_SHUTDOWN,
+                               M98090_SHDNN_MASK, 0);
+               msleep(40);
+               snd_soc_update_bits(codec, M98090_REG_DEVICE_SHUTDOWN,
+                               M98090_SHDNN_MASK, M98090_SHDNN_MASK);
+               max98090->shdn_pending = false;
+       }
+}
+
 static struct snd_soc_codec_driver soc_codec_dev_max98090 = {
        .probe   = max98090_probe,
        .remove  = max98090_remove,
+       .seq_notifier = max98090_seq_notifier,
        .set_bias_level = max98090_set_bias_level,
 };

diff --git a/sound/soc/codecs/max98090.h b/sound/soc/codecs/max98090.h
index 21ff743..bc610d9 100644
--- a/sound/soc/codecs/max98090.h
+++ b/sound/soc/codecs/max98090.h
@@ -1543,6 +1543,7 @@ struct max98090_priv {
        unsigned int pa2en;
        unsigned int sidetone;
        bool master;
+       bool shdn_pending;
 };

 int max98090_mic_detect(struct snd_soc_codec *codec,
--
1.7.9.5

  reply	other threads:[~2015-08-07 21:44 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-06 23:15 [PATCH 1/2] ASoC: extend seq_notifier callback interface yang.a.fang
2015-08-06 23:15 ` [PATCH 2/2] ASoC: max98090: Enforce correct device sequencing when configuring a new yang.a.fang
2015-08-07 10:43   ` Mark Brown
2015-08-07 20:50     ` Fang, Yang A
2015-08-07 21:08   ` [PATCH v2] " yang.a.fang
2015-08-07 21:41     ` Anish Kumar [this message]
2015-08-10 12:00     ` Applied "ASoC: max98090: Fix sequencing when starting additional routes" to the asoc tree Mark Brown
2015-08-07 10:44 ` [PATCH 1/2] ASoC: extend seq_notifier callback interface 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=B03A893ADFE80748942D13AFAF28451924E6F1461B@ITSVLEX06.it.maxim-ic.internal \
    --to=anish.kumar@maximintegrated.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 \
    --cc=ullysses.a.eoff@intel.com \
    --cc=yang.a.fang@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.