From 3e57646691d4cb60e2b6295a9bda64ff8d0605c5 Mon Sep 17 00:00:00 2001
From: Anish Kumar <yesanishhere@gmail.com>
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 <anish.kumar@maximintegrated.com>
---
 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

