From patchwork Fri Sep 9 14:01:35 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: zhengxing X-Patchwork-Id: 9323891 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 3E22660752 for ; Fri, 9 Sep 2016 15:49:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2FAB529F2F for ; Fri, 9 Sep 2016 15:49:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 23EBD29F59; Fri, 9 Sep 2016 15:49:37 +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=-1.9 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5753629F5A for ; Fri, 9 Sep 2016 15:49:33 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 570EB266CC0; Fri, 9 Sep 2016 17:49:32 +0200 (CEST) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 6B5AA266C80; Fri, 9 Sep 2016 17:47:10 +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 82017266C59; Fri, 9 Sep 2016 16:02:05 +0200 (CEST) Received: from regular1.263xmail.com (regular1.263xmail.com [211.150.99.133]) by alsa0.perex.cz (Postfix) with ESMTP id 500EA266C39 for ; Fri, 9 Sep 2016 16:02:00 +0200 (CEST) Received: from zhengxing?rock-chips.com (unknown [192.168.167.231]) by regular1.263xmail.com (Postfix) with ESMTP id 15CF08E1D; Fri, 9 Sep 2016 22:01:54 +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 1915D375; Fri, 9 Sep 2016 22:01:52 +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: <2138aa5a7a478c16272943ab444d01eb> 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 615680T2OQ; Fri, 09 Sep 2016 22:01:54 +0800 (CST) From: Xing Zheng To: linux-rockchip@lists.infradead.org, Adam.Thomson.Opensource@diasemi.com Date: Fri, 9 Sep 2016 22:01:35 +0800 Message-Id: <1473429695-12604-1-git-send-email-zhengxing@rock-chips.com> X-Mailer: git-send-email 1.9.1 Cc: alsa-devel@alsa-project.org, cychiang@google.com, hychao@google.com, Xing Zheng , linux-kernel@vger.kernel.org, Takashi Iwai , heiko@sntech.de, Liam Girdwood , Mark Brown , smbarber@google.com, Support Opensource Subject: [alsa-devel] [PATCH] ASoC: da7219: make sure the valid event when startup 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: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP We need to ensure the master bias and jack detection to be enabled before reporting event at the da7219_aad_irq_thread. Otherwise, we may acquire the incorrect the unplug event when the DUT startup with a plugged headphone. Signed-off-by: Xing Zheng --- sound/soc/codecs/da7219-aad.c | 7 +++++++ sound/soc/codecs/da7219-aad.h | 1 + 2 files changed, 8 insertions(+) diff --git a/sound/soc/codecs/da7219-aad.c b/sound/soc/codecs/da7219-aad.c index 4e369a1..cef17c0d 100644 --- a/sound/soc/codecs/da7219-aad.c +++ b/sound/soc/codecs/da7219-aad.c @@ -38,6 +38,7 @@ void da7219_aad_jack_det(struct snd_soc_codec *codec, struct snd_soc_jack *jack) da7219->aad->jack = jack; da7219->aad->jack_inserted = false; + da7219->aad->accdet_en = false; /* Send an initial empty report */ snd_soc_jack_report(jack, 0, DA7219_AAD_REPORT_ALL_MASK); @@ -46,6 +47,8 @@ void da7219_aad_jack_det(struct snd_soc_codec *codec, struct snd_soc_jack *jack) snd_soc_update_bits(codec, DA7219_ACCDET_CONFIG_1, DA7219_ACCDET_EN_MASK, (jack ? DA7219_ACCDET_EN_MASK : 0)); + + da7219->aad->accdet_en = true; } EXPORT_SYMBOL_GPL(da7219_aad_jack_det); @@ -293,6 +296,10 @@ static irqreturn_t da7219_aad_irq_thread(int irq, void *data) u8 statusa; int i, report = 0, mask = 0; + /* Ensure the master bias to be enabled */ + if (!da7219_aad->accdet_en) + return IRQ_NONE; + /* Read current IRQ events */ regmap_bulk_read(da7219->regmap, DA7219_ACCDET_IRQ_EVENT_A, events, DA7219_AAD_IRQ_REG_MAX); diff --git a/sound/soc/codecs/da7219-aad.h b/sound/soc/codecs/da7219-aad.h index 4fccf67..5641965 100644 --- a/sound/soc/codecs/da7219-aad.h +++ b/sound/soc/codecs/da7219-aad.h @@ -200,6 +200,7 @@ struct da7219_aad_priv { struct snd_soc_jack *jack; bool jack_inserted; + bool accdet_en; }; /* AAD control */