From patchwork Mon Jun 10 02:12:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AS50 KCHSU0 X-Patchwork-Id: 10983941 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5258F6C5 for ; Mon, 10 Jun 2019 02:16:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 40860283B2 for ; Mon, 10 Jun 2019 02:16:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 34870287A6; Mon, 10 Jun 2019 02:16: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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 2AC46287DA for ; Mon, 10 Jun 2019 02:16:36 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 46E4D857; Mon, 10 Jun 2019 04:15:44 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 46E4D857 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1560132994; bh=UqGz3S5SA2cdlnQH0CjmtVLKpTWixVVd9HZAn+Kex6g=; h=From:To:Date:Cc:Subject:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From; b=SSMrXnxL0ZRixCHprZUrJKv2virk9/uG3N1TlfPLqZz0vU5Rwk3yTRbiD0/Dl5lKb L5YdY5vsxc5Wf1zpa+MEQDx0hwr3TzXiaPP9iJjGe6jU5BefCfPloJrq1A+GYOHBGG fReF7Ts4kuJAebUIV1iErHWVdeyYUR5E0cfM+H3s= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id F2217F896CE; Mon, 10 Jun 2019 04:15:42 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa1.perex.cz (Postfix, from userid 50401) id 6D9FBF896E0; Mon, 10 Jun 2019 04:13:28 +0200 (CEST) Received: from maillog.nuvoton.com (maillog.nuvoton.com [202.39.227.15]) by alsa1.perex.cz (Postfix) with ESMTP id C119BF80791 for ; Mon, 10 Jun 2019 04:13:17 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz C119BF80791 Received: from NTHCCAS02.nuvoton.com (nthccas02.nuvoton.com [10.1.8.29]) by maillog.nuvoton.com (Postfix) with ESMTP id 73B381C80C84; Mon, 10 Jun 2019 10:13:05 +0800 (CST) Received: from NTHCML01B.nuvoton.com (10.1.8.178) by NTHCCAS02.nuvoton.com (10.1.8.29) with Microsoft SMTP Server (TLS) id 15.0.1130.7; Mon, 10 Jun 2019 10:13:05 +0800 Received: from NTHCCAS01.nuvoton.com (10.1.8.28) by NTHCML01B.nuvoton.com (10.1.8.178) with Microsoft SMTP Server (TLS) id 15.0.1130.7; Mon, 10 Jun 2019 10:13:04 +0800 Received: from localhost.localdomain (10.4.36.27) by NTHCCAS01.nuvoton.com (10.1.12.25) with Microsoft SMTP Server id 15.0.1130.7 via Frontend Transport; Mon, 10 Jun 2019 10:13:04 +0800 From: John Hsu To: Date: Mon, 10 Jun 2019 10:12:29 +0800 Message-ID: <20190610021229.12005-1-KCHSU0@nuvoton.com> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 Cc: anatol@chromium.org, cychiang@google.com, alsa-devel@alsa-project.org, WTLI@nuvoton.com, John Hsu , lgirdwood@gmail.com, yuhsuan@google.com, YHCHuang@nuvoton.com, CTLIN0@nuvoton.com, mhkuo@nuvoton.com Subject: [alsa-devel] [PATCH] ASoC: nau8825: fix fake interruption when booting X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 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" X-Virus-Scanned: ClamAV using ClamSMTP There is no pull-up resistor at IRQ line where it connects from the codec to SoC. When booting, the signal of IRQ pin will keep low which makes the SoC invoke the ISR repeatedly because the IRQ is registered trigger low. It will not stop until the codec sets up the interruption and pulls the signal high. In the patch, nau8825 will internally pull the signal to high at booting in case the fake interrupts happen. The patch help to fix the issue as follows: Google issue 133904101: Cave: excessive number of interrupts before Nau8825 codec is initialized Reported Issue Chrome OS Version : ChromeOS R76-12217.0.0 Type of hardware : What steps will reproduce the problem? Boot device What is the expected output? A lot of interrupts without any events What do you see instead? The fake interrupts are gone How frequently does this problem reproduce? Always What is the impact to the user, and is there a workaround? If so, what is it? BUG=b:133904101 TEST=Boot device, and then check the interrupts are real. Signed-off-by: John Hsu Tested-by: Cheng-Yi Chiang --- sound/soc/codecs/nau8825.c | 4 ++++ sound/soc/codecs/nau8825.h | 2 ++ 2 files changed, 6 insertions(+) diff --git a/sound/soc/codecs/nau8825.c b/sound/soc/codecs/nau8825.c index 47e65cf99879..83ec841f7865 100644 --- a/sound/soc/codecs/nau8825.c +++ b/sound/soc/codecs/nau8825.c @@ -1881,6 +1881,10 @@ static void nau8825_init_regs(struct nau8825 *nau8825) NAU8825_JACK_EJECT_DEBOUNCE_MASK, nau8825->jack_eject_debounce << NAU8825_JACK_EJECT_DEBOUNCE_SFT); + /* Pull up IRQ pin */ + regmap_update_bits(regmap, NAU8825_REG_INTERRUPT_MASK, + NAU8825_IRQ_PIN_PULLUP | NAU8825_IRQ_PIN_PULL_EN, + NAU8825_IRQ_PIN_PULLUP | NAU8825_IRQ_PIN_PULL_EN); /* Mask unneeded IRQs: 1 - disable, 0 - enable */ regmap_update_bits(regmap, NAU8825_REG_INTERRUPT_MASK, 0x7ff, 0x7ff); diff --git a/sound/soc/codecs/nau8825.h b/sound/soc/codecs/nau8825.h index f6074c618569..3f41897ed3f6 100644 --- a/sound/soc/codecs/nau8825.h +++ b/sound/soc/codecs/nau8825.h @@ -171,6 +171,8 @@ #define NAU8825_JACK_POLARITY (1 << 1) /* 0 - active low, 1 - active high */ /* INTERRUPT_MASK (0xf) */ +#define NAU8825_IRQ_PIN_PULLUP (1 << 14) +#define NAU8825_IRQ_PIN_PULL_EN (1 << 13) #define NAU8825_IRQ_OUTPUT_EN (1 << 11) #define NAU8825_IRQ_HEADSET_COMPLETE_EN (1 << 10) #define NAU8825_IRQ_RMS_EN (1 << 8)