From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by yocto-www.yoctoproject.org (Postfix, from userid 118) id DA7D9E00A1E; Wed, 24 Jun 2015 11:12:43 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on yocto-www.yoctoproject.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 X-Spam-HAM-Report: * 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider * (picmaster[at]mail.bg) * -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low * trust * [193.201.172.118 listed in list.dnswl.org] * -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% * [score: 0.0000] * -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's * domain * 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily * valid * -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature Received: from mx2.mail.bg (mx2.mail.bg [193.201.172.118]) by yocto-www.yoctoproject.org (Postfix) with ESMTP id 4BCE5E009AE for ; Wed, 24 Jun 2015 11:12:39 -0700 (PDT) Received: from [192.168.0.62] (unknown [93.152.143.60]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx2.mail.bg (Postfix) with ESMTPSA id 80FAE6001175; Wed, 24 Jun 2015 21:12:38 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=mail.bg; s=default; t=1435169558; bh=0CdmHjyzL5cHdHMryw86MYiZ+AIEkIPrpqkK28H+LLo=; h=Message-ID:Date:From:MIME-Version:To:CC:Subject:References: In-Reply-To:Content-Type; b=vcJ1anxhLTS92IbGqUfuF8EhFbiPkG33vvJp5NxDapYns+EAMp4ftpJpIhikxVr4P CZT5dknywWX/phpVf4/Z+JUxEQa6fdMw3leSwIc/nf5RIiYV+aeJUvKU39pAAcvpUu SviGsR+u6qj7oZM0jwFJKt1BxYwI/bJLENbeMSl8= Message-ID: <558AF316.6020707@mail.bg> Date: Wed, 24 Jun 2015 21:12:38 +0300 From: Nikolay Dimitrov User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.7.0 MIME-Version: 1.0 To: Gary Thomas , Eric Nelson , Fabio Estevam References: <54BED2E8.70901@mail.bg> <54BEF411.9080503@mail.bg> <54BF0F40.6030407@mail.bg> <54C03C72.3050502@mail.bg> <54C0F9FE.6020208@mlbassoc.com> <54C14241.4090805@mail.bg> <54C1430A.6050303@mlbassoc.com> <54C149E5.6040303@boundarydevices.com> <54C14D7A.6070206@mail.bg> <54C15453.8050100@mail.bg> <54F20E97.1060205@boundarydevices.com> <54F32B7D.1040707@mlbassoc.com> In-Reply-To: <54F32B7D.1040707@mlbassoc.com> Cc: "meta-freescale@yoctoproject.org" , Otavio Salvador Subject: Re: Audio glitch with SGTL5000 X-BeenThere: meta-freescale@yoctoproject.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Usage and development list for the meta-fsl-* layers List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Jun 2015 18:12:43 -0000 X-Groupsio-MsgNum: 14420 Content-Type: multipart/mixed; boundary="------------010001070509000406070906" --------------010001070509000406070906 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Hi guys, Finally the circumstances (e.g. customer priorities :D) allowed me to port the audio glitch work-around to 3.10.53. Feel welcome to take a look at it and give it a try, and I'll be more than happy if it fixes the issue for you. Note: the patch is just RFC to illustrate the issue and one possible solution. Kind regards, Nikolay --------------010001070509000406070906 Content-Type: text/x-patch; name="sound-sgtl5000-Fix-audio-glitch-after-audio-stream-i.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename*0="sound-sgtl5000-Fix-audio-glitch-after-audio-stream-i.patch" >From f3f5259c959b561e53feef72524d587fccac1edd Mon Sep 17 00:00:00 2001 From: Nikolay Dimitrov Date: Wed, 24 Jun 2015 20:11:28 +0300 Subject: [PATCH] sound: sgtl5000: Fix audio glitch after audio stream is stopped When an audio stream is stopped, ALSA DAPM subsystem shutdowns the audio codec after several seconds of inactivity to conserve power. This shutdown sequence causes an audible glitch on SGTL5000 codec's line-out. This patch disables the DAPM for SGTL5000 and keeps the codec's internal modules powered-on all the time to prevent the audio glitch. Upstream-status: Inappropriate [design] - ALSA DAPM is mandatory by design, and the patch violates this requirement Signed-off-by: Nikolay Dimitrov --- sound/soc/codecs/sgtl5000.c | 68 +++++++------------------------------------ 1 file changed, 10 insertions(+), 58 deletions(-) diff --git a/sound/soc/codecs/sgtl5000.c b/sound/soc/codecs/sgtl5000.c index ddf66d9..3750ec8 100644 --- a/sound/soc/codecs/sgtl5000.c +++ b/sound/soc/codecs/sgtl5000.c @@ -142,32 +142,6 @@ static int mic_bias_event(struct snd_soc_dapm_widget *w, return 0; } -/* - * As manual described, ADC/DAC only works when VAG powerup, - * So enabled VAG before ADC/DAC up. - * In power down case, we need wait 400ms when vag fully ramped down. - */ -static int power_vag_event(struct snd_soc_dapm_widget *w, - struct snd_kcontrol *kcontrol, int event) -{ - switch (event) { - case SND_SOC_DAPM_POST_PMU: - snd_soc_update_bits(w->codec, SGTL5000_CHIP_ANA_POWER, - SGTL5000_VAG_POWERUP, SGTL5000_VAG_POWERUP); - break; - - case SND_SOC_DAPM_PRE_PMD: - snd_soc_update_bits(w->codec, SGTL5000_CHIP_ANA_POWER, - SGTL5000_VAG_POWERUP, 0); - msleep(400); - break; - default: - break; - } - - return 0; -} - /* input sources for ADC */ static const char *adc_mux_text[] = { "MIC_IN", "LINE_IN" @@ -201,27 +175,8 @@ static const struct snd_soc_dapm_widget sgtl5000_dapm_widgets[] = { mic_bias_event, SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD), - SND_SOC_DAPM_PGA("HP", SGTL5000_CHIP_ANA_POWER, 4, 0, NULL, 0), - SND_SOC_DAPM_PGA("LO", SGTL5000_CHIP_ANA_POWER, 0, 0, NULL, 0), - SND_SOC_DAPM_MUX("Capture Mux", SND_SOC_NOPM, 0, 0, &adc_mux), SND_SOC_DAPM_MUX("Headphone Mux", SND_SOC_NOPM, 0, 0, &dac_mux), - - /* aif for i2s input */ - SND_SOC_DAPM_AIF_IN("AIFIN", "Playback", - 0, SGTL5000_CHIP_DIG_POWER, - 0, 0), - - /* aif for i2s output */ - SND_SOC_DAPM_AIF_OUT("AIFOUT", "Capture", - 0, SGTL5000_CHIP_DIG_POWER, - 1, 0), - - SND_SOC_DAPM_ADC("ADC", "Capture", SGTL5000_CHIP_ANA_POWER, 1, 0), - SND_SOC_DAPM_DAC("DAC", "Playback", SGTL5000_CHIP_ANA_POWER, 3, 0), - - SND_SOC_DAPM_PRE("VAG_POWER_PRE", power_vag_event), - SND_SOC_DAPM_POST("VAG_POWER_POST", power_vag_event), }; /* routes for sgtl5000 */ @@ -229,18 +184,7 @@ static const struct snd_soc_dapm_route sgtl5000_dapm_routes[] = { {"Capture Mux", "LINE_IN", "LINE_IN"}, /* line_in --> adc_mux */ {"Capture Mux", "MIC_IN", "MIC_IN"}, /* mic_in --> adc_mux */ - {"ADC", NULL, "Capture Mux"}, /* adc_mux --> adc */ - {"AIFOUT", NULL, "ADC"}, /* adc --> i2s_out */ - - {"DAC", NULL, "AIFIN"}, /* i2s-->dac,skip audio mux */ - {"Headphone Mux", "DAC", "DAC"}, /* dac --> hp_mux */ - {"LO", NULL, "DAC"}, /* dac --> line_out */ - {"Headphone Mux", "LINE_IN", "LINE_IN"},/* line_in --> hp_mux */ - {"HP", NULL, "Headphone Mux"}, /* hp_mux --> hp */ - - {"LINE_OUT", NULL, "LO"}, - {"HP_OUT", NULL, "HP"}, }; /* custom function to fetch info of PCM playback volume */ @@ -1096,7 +1040,12 @@ static int sgtl5000_set_power_regs(struct snd_soc_codec *codec) ana_pwr = snd_soc_read(codec, SGTL5000_CHIP_ANA_POWER); ana_pwr |= SGTL5000_DAC_STEREO | SGTL5000_ADC_STEREO | - SGTL5000_REFTOP_POWERUP; + SGTL5000_VAG_POWERUP | + SGTL5000_REFTOP_POWERUP | + SGTL5000_DAC_POWERUP | + SGTL5000_CAPLESS_HP_POWERUP | + SGTL5000_ADC_POWERUP | + SGTL5000_LINE_OUT_POWERUP; lreg_ctrl = snd_soc_read(codec, SGTL5000_CHIP_LINREG_CTRL); if (vddio < 3100 && vdda < 3100) { @@ -1326,7 +1275,10 @@ static int sgtl5000_probe(struct snd_soc_codec *codec) snd_soc_write(codec, SGTL5000_CHIP_SSS_CTRL, SGTL5000_DAC_SEL_I2S_IN << SGTL5000_DAC_SEL_SHIFT); snd_soc_write(codec, SGTL5000_CHIP_DIG_POWER, - SGTL5000_ADC_EN | SGTL5000_DAC_EN); + SGTL5000_ADC_EN | + SGTL5000_DAC_EN | + SGTL5000_I2S_OUT_POWERUP | + SGTL5000_I2S_IN_POWERUP); /* enable dac volume ramp by default */ snd_soc_write(codec, SGTL5000_CHIP_ADCDAC_CTRL, -- 1.7.10.4 --------------010001070509000406070906--