From patchwork Mon Mar 19 10:07:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bard Liao X-Patchwork-Id: 10292055 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 990DE602C2 for ; Mon, 19 Mar 2018 10:07:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8158E28A74 for ; Mon, 19 Mar 2018 10:07:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7621E28C40; Mon, 19 Mar 2018 10:07:58 +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 8D8C328A74 for ; Mon, 19 Mar 2018 10:07:57 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 38CBD2674DF; Mon, 19 Mar 2018 11:07:56 +0100 (CET) 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 2D03C2674DF; Mon, 19 Mar 2018 11:07:53 +0100 (CET) Received: from rtits2.realtek.com.tw (rtits2.realtek.com [211.75.126.72]) by alsa0.perex.cz (Postfix) with ESMTP id 052DB266F2E for ; Mon, 19 Mar 2018 11:07:48 +0100 (CET) Authenticated-By: X-SpamFilter-By: BOX Solutions SpamTrap 5.62 with qID w2JA7lRT028496, This message is accepted by code: ctloc85258 Received: from mail.realtek.com (rtitcasv01.realtek.com.tw [172.21.6.18]) by rtits2.realtek.com.tw (8.15.2/2.57/5.78) with ESMTP id w2JA7lRT028496; Mon, 19 Mar 2018 18:07:47 +0800 Received: from localhost.localdomain (172.22.102.1) by RTITCASV01.realtek.com.tw (172.21.6.18) with Microsoft SMTP Server id 14.3.294.0; Mon, 19 Mar 2018 18:07:46 +0800 From: Bard Liao To: , Date: Mon, 19 Mar 2018 18:07:29 +0800 Message-ID: <1521454049-32435-1-git-send-email-bardliao@realtek.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 X-Originating-IP: [172.22.102.1] Cc: oder_chiou@realtek.com, jack.yu@realtek.com, alsa-devel@alsa-project.org, lars@metafoo.de, puneethx.prabhu@intel.com, shumingf@realtek.com, Bard Liao , flove@realtek.com Subject: [alsa-devel] [PATCH] ASoC: rt298: don't turn off HV and VREF if headset is detected 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 "HV" and "VREF" will be powered up when jack type detection process is started and will be powered off when jack type detection process is finished. It will generate an unexpected interrupt signal when they are powered up during the capture process. Codec driver will do the jack type detection process and we can't capture properly before the jack detection process is finished. This patch will not power off the "HV" and "VREF" widgets if headset is detected and it will solve the unexpected interrupt issue. As a result, it will also solve the silence data captured at the beginning in headset mic recording issue. Signed-off-by: Bard Liao --- sound/soc/codecs/rt298.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/sound/soc/codecs/rt298.c b/sound/soc/codecs/rt298.c index 7bf4b31..06cdba4 100644 --- a/sound/soc/codecs/rt298.c +++ b/sound/soc/codecs/rt298.c @@ -290,9 +290,10 @@ static int rt298_jack_detect(struct rt298_priv *rt298, bool *hp, bool *mic) regmap_read(rt298->regmap, RT298_GET_MIC1_SENSE, &buf); *mic = buf & 0x80000000; } - - snd_soc_dapm_disable_pin(dapm, "HV"); - snd_soc_dapm_disable_pin(dapm, "VREF"); + if (!*mic) { + snd_soc_dapm_disable_pin(dapm, "HV"); + snd_soc_dapm_disable_pin(dapm, "VREF"); + } if (!*hp) snd_soc_dapm_disable_pin(dapm, "LDO1"); snd_soc_dapm_sync(dapm);