From patchwork Wed Sep 14 14:06:00 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: zhengxing X-Patchwork-Id: 9331585 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C47166077A for ; Wed, 14 Sep 2016 14:06:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B649F29F46 for ; Wed, 14 Sep 2016 14:06:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AAA372A07F; Wed, 14 Sep 2016 14:06:54 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 1D12129F46 for ; Wed, 14 Sep 2016 14:06:50 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1bkApt-0006YN-QP; Wed, 14 Sep 2016 14:06:49 +0000 Received: from regular1.263xmail.com ([211.150.99.137]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1bkApn-0006M0-1k for linux-rockchip@lists.infradead.org; Wed, 14 Sep 2016 14:06:47 +0000 Received: from zhengxing?rock-chips.com (unknown [192.168.167.164]) by regular1.263xmail.com (Postfix) with ESMTP id 8E578DB38; Wed, 14 Sep 2016 22:06:11 +0800 (CST) X-263anti-spam: KSV:0; X-MAIL-GRAY: 0 X-MAIL-DELIVERY: 1 X-KSVirus-check: 0 X-ABS-CHECKED: 4 X-ADDR-CHECKED4: 1 Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.263.net (Postfix) with ESMTP id 1E4B5394; Wed, 14 Sep 2016 22:06:12 +0800 (CST) X-RL-SENDER: zhengxing@rock-chips.com X-FST-TO: linux-rockchip@lists.infradead.org X-SENDER-IP: 103.29.142.67 X-LOGIN-NAME: zhengxing@rock-chips.com X-UNIQUE-TAG: <5f6cab494545a05f1e74bb99757547db> X-ATTACHMENT-NUM: 0 X-SENDER: zhengxing@rock-chips.com X-DNS-TYPE: 0 Received: from localhost.localdomain (unknown [103.29.142.67]) by smtp.263.net (Postfix) whith ESMTP id 477899320F; Wed, 14 Sep 2016 22:06:13 +0800 (CST) From: Xing Zheng To: linux-rockchip@lists.infradead.org, Adam.Thomson.Opensource@diasemi.com Subject: [PATCH] ASoC: da7219: software reset codec at probe Date: Wed, 14 Sep 2016 22:06:00 +0800 Message-Id: <1473861960-7596-1-git-send-email-zhengxing@rock-chips.com> X-Mailer: git-send-email 1.9.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160914_070643_497941_0DA719CA X-CRM114-Status: UNSURE ( 5.36 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: alsa-devel@alsa-project.org, hychao@google.com, Xing Zheng , Support Opensource , linux-kernel@vger.kernel.org, Mark Brown , Takashi Iwai , heiko@sntech.de, Liam Girdwood , dianders@google.com, Hsin-Yu Chao , smbarber@google.com, Jaroslav Kysela , cychiang@google.com MIME-Version: 1.0 Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Hsin-Yu Chao On some platform da7219 codec has persistent power across reboot so it doesn't reset and cause abnormal jack detection. Workaround this issue by doing software reset at probe. Signed-off-by: Hsin-Yu Chao Signed-off-by: Xing Zheng --- sound/soc/codecs/da7219.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sound/soc/codecs/da7219.c b/sound/soc/codecs/da7219.c index 737e914..9d08c11 100644 --- a/sound/soc/codecs/da7219.c +++ b/sound/soc/codecs/da7219.c @@ -1941,6 +1941,14 @@ static int da7219_i2c_probe(struct i2c_client *i2c, return ret; } + /* Software reset codec. */ + regmap_write_bits(da7219->regmap, DA7219_ACCDET_CONFIG_1, + DA7219_ACCDET_EN_MASK, 0); + regmap_write_bits(da7219->regmap, DA7219_CIF_CTRL, + DA7219_CIF_REG_SOFT_RESET_MASK, 0); + regmap_write_bits(da7219->regmap, DA7219_SYSTEM_ACTIVE, + DA7219_SYSTEM_ACTIVE_MASK, 0); + ret = snd_soc_register_codec(&i2c->dev, &soc_codec_dev_da7219, &da7219_dai, 1); if (ret < 0) {