From patchwork Sat Apr 11 00:50:55 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anish Kumar X-Patchwork-Id: 6200651 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 29C7ABF4A6 for ; Sat, 11 Apr 2015 00:51:23 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 03CF62035D for ; Sat, 11 Apr 2015 00:51:19 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id CA49E20351 for ; Sat, 11 Apr 2015 00:51:13 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 4B4BC260786; Sat, 11 Apr 2015 02:51:12 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=no version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id 66C602606F6; Sat, 11 Apr 2015 02:51:04 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 69892260708; Sat, 11 Apr 2015 02:51:03 +0200 (CEST) Received: from mail-la0-f46.google.com (mail-la0-f46.google.com [209.85.215.46]) by alsa0.perex.cz (Postfix) with ESMTP id 7705D26069E for ; Sat, 11 Apr 2015 02:50:56 +0200 (CEST) Received: by lagv1 with SMTP id v1so24038875lag.3 for ; Fri, 10 Apr 2015 17:50:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:cc:content-type; bh=eAB+YjjtMqcYMsNUeQzHclyakjZRi/Q8dekHhypKtwo=; b=sU9O6NN2CXh5pwcHQ+MRxsCwXrOb4aUm2BZCM9IHx37Csig4bE1DPSYhuXGMjYc5Ng 4XYf94J2kBZ2ngzHw3/1MCGntcW3cxUs0rTU/3+Ei5H/UW9eHX6WK48TVxWldKO1fFUO jKFuvxsSnnRGmJy2dLIuTkNBKTr5pjN1RqZqLeKsClwgE9mj7PXjSgxBLXjYuRmMcP7f jA7lP8N3gz9yaFl+2/siGz2JNza+xyX6jjzEyVMQVFOWYV4yB319VyIVXdrMab5CShjh w4vN0zO8LQLH6kZPGdHrj+UcfQpWHKH1Kyu2XaUYzllO9yfYD3NmOV7M8vcHhMuXUSlu IIkA== MIME-Version: 1.0 X-Received: by 10.152.2.130 with SMTP id 2mr3541962lau.120.1428713455944; Fri, 10 Apr 2015 17:50:55 -0700 (PDT) Received: by 10.114.22.72 with HTTP; Fri, 10 Apr 2015 17:50:55 -0700 (PDT) Date: Fri, 10 Apr 2015 17:50:55 -0700 Message-ID: From: anish kumar To: xjq@rock-chips.com, zhengxing@rock-chips.com, wxt@rock-chips.com Cc: Maxwell McKinnon , Linux-ALSA , "broonie@kernel.org" , Nitin Mittal Subject: Re: [alsa-devel] [PATCH v3] ASoC: max98090: add shutdown callback for max98090 X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP On Fri, Apr 10, 2015 at 5:45 PM, anish singh wrote: > > ---------- Forwarded message ---------- > From: Caesar Wang > Date: Wed, Apr 8, 2015 at 4:05 AM > Subject: [PATCH v3] ASoC: max98090: add shutdown callback for max98090 > To: Sonny Rao , Cheng-Yi Chiang > , Heiko Stuebner , Mark Brown > , zhengxing , "jay.xu" > > Cc: devicetree@vger.kernel.org, dianders@chromium.org, > dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, > linux-rockchip@lists.infradead.org, linux-arm-kernel@lists.infradead.org, > Caesar Wang , Jaroslav Kysela , > alsa-devel@alsa-project.org, Takashi Iwai , Dylan Reid > , Liam Girdwood , Lars-Peter > Clausen , Jarkko Nikula , > Tushar Behera > > > To fix pop noise when shutdown,the pop noise during shutdown > is the pmic cutoff power of codec without any notice. > > Signed-off-by: jay.xu > Signed-off-by: zhengxing > Signed-off-by: Caesar Wang > > --- > > Changes in v3: > - modify the shutdown function before remove(..) > - fix the `Serien-cc` > > Changes in v2: > - remove the dev_info(..) > - fix the comment style > - add the max98090_i2c_shutdown() in remove() fuction > > sound/soc/codecs/max98090.c | 17 +++++++++++++++++ > 1 file changed, 17 insertions(+) > > diff --git a/sound/soc/codecs/max98090.c b/sound/soc/codecs/max98090.c > index b112b1c..3e33ef2 100644 > --- a/sound/soc/codecs/max98090.c > +++ b/sound/soc/codecs/max98090.c > @@ -2605,8 +2605,24 @@ err_enable: > return ret; > } > Please check attached patch and see if it solves your problem. We tested it here with zcd on. +static void max98090_i2c_shutdown(struct i2c_client *i2c) +{ + struct max98090_priv *max98090 = dev_get_drvdata(&i2c->dev); + + dev_info(&i2c->dev, "shut down device\n"); + + /* enable zero crossing */ + regmap_write(max98090->regmap, + M98090_REG_LEVEL_CONTROL, M98090_ZDENN_MASK-1); + + /* turn down volume levels for all the outputs */ + regmap_write(max98090->regmap, + M98090_REG_RCV_LOUTL_VOLUME, 0x00); + regmap_write(max98090->regmap, + M98090_REG_LOUTR_VOLUME, 0x00); + regmap_write(max98090->regmap, + M98090_REG_LEFT_SPK_VOLUME, 0x00); + regmap_write(max98090->regmap, + M98090_REG_RIGHT_SPK_VOLUME, 0x00); + regmap_write(max98090->regmap, + M98090_REG_LEFT_HP_VOLUME, 0x00); + regmap_write(max98090->regmap, + M98090_REG_RIGHT_HP_VOLUME, 0x00); + regmap_write(max98090->regmap, + M98090_REG_DEVICE_SHUTDOWN, 0x00); + msleep(40); +} + if it doesn't solve your problem then please dump your registers and send it to us to look further. I assume dapm is turning off the widgets before shutting down the codec. > +static void max98090_i2c_shutdown(struct i2c_client *i2c) > +{ > + struct max98090_priv *max98090 = dev_get_drvdata(&i2c->dev); > + > + /* > + * Enable volume smoothing, disable zero cross. This will cause > + * a quick 40ms ramp to mute on shutdown. > + */ > + regmap_write(max98090->regmap, > + M98090_REG_LEVEL_CONTROL, M98090_VSENN_MASK); > + regmap_write(max98090->regmap, > + M98090_REG_DEVICE_SHUTDOWN, 0x00); > + msleep(40); > +} > + > static int max98090_i2c_remove(struct i2c_client *client) > { > + max98090_i2c_shutdown(client); > snd_soc_unregister_codec(&client->dev); > return 0; > } > @@ -2696,6 +2712,7 @@ static struct i2c_driver max98090_i2c_driver = { > .acpi_match_table = ACPI_PTR(max98090_acpi_match), > }, > .probe = max98090_i2c_probe, > + .shutdown = max98090_i2c_shutdown, > .remove = max98090_i2c_remove, > .id_table = max98090_i2c_id, > }; > -- > 1.9.1 > > > -- > To unsubscribe from this list: send the line "unsubscribe linux-kernel" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > Please read the FAQ at http://www.tux.org/lkml/ > From 3e57646691d4cb60e2b6295a9bda64ff8d0605c5 Mon Sep 17 00:00:00 2001 From: Anish Kumar Date: Fri, 10 Apr 2015 17:41:36 -0700 Subject: [PATCH] To fix pop noise when shutdown,the pop noise during shutdown is the pmic cutoff power of codec without any notice. Signed-off-by: Anish Kumar --- sound/soc/codecs/max98090.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/sound/soc/codecs/max98090.c b/sound/soc/codecs/max98090.c index fc17604..65e28f4 100644 --- a/sound/soc/codecs/max98090.c +++ b/sound/soc/codecs/max98090.c @@ -2349,6 +2349,34 @@ static int max98090_i2c_remove(struct i2c_client *client) return 0; } +static void max98090_i2c_shutdown(struct i2c_client *i2c) +{ + struct max98090_priv *max98090 = dev_get_drvdata(&i2c->dev); + + dev_info(&i2c->dev, "shut down device\n"); + + /* enable zero crossing */ + regmap_write(max98090->regmap, + M98090_REG_LEVEL_CONTROL, M98090_ZDENN_MASK-1); + + /* turn down volume levels for all the outputs */ + regmap_write(max98090->regmap, + M98090_REG_RCV_LOUTL_VOLUME, 0x00); + regmap_write(max98090->regmap, + M98090_REG_LOUTR_VOLUME, 0x00); + regmap_write(max98090->regmap, + M98090_REG_LEFT_SPK_VOLUME, 0x00); + regmap_write(max98090->regmap, + M98090_REG_RIGHT_SPK_VOLUME, 0x00); + regmap_write(max98090->regmap, + M98090_REG_LEFT_HP_VOLUME, 0x00); + regmap_write(max98090->regmap, + M98090_REG_RIGHT_HP_VOLUME, 0x00); + regmap_write(max98090->regmap, + M98090_REG_DEVICE_SHUTDOWN, 0x00); + msleep(40); +} + static int max98090_runtime_resume(struct device *dev) { struct max98090_priv *max98090 = dev_get_drvdata(dev); -- 1.9.3