From patchwork Thu Jul 16 05:42:34 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Boichat X-Patchwork-Id: 6804081 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 0C97D9FC0D for ; Thu, 16 Jul 2015 05:43:28 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3D529207BF for ; Thu, 16 Jul 2015 05:43:27 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id A07FA2077D for ; Thu, 16 Jul 2015 05:43:25 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 8FD752663E1; Thu, 16 Jul 2015 07:43:21 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_NONE, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=no version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id CBE15266085; Thu, 16 Jul 2015 07:42:55 +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 3A9C8266198; Thu, 16 Jul 2015 07:42:52 +0200 (CEST) Received: from mail-pd0-f175.google.com (mail-pd0-f175.google.com [209.85.192.175]) by alsa0.perex.cz (Postfix) with ESMTP id 9DA84266085 for ; Thu, 16 Jul 2015 07:42:43 +0200 (CEST) Received: by pdjr16 with SMTP id r16so38165047pdj.3 for ; Wed, 15 Jul 2015 22:42:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=LT8V0/uAyJ74NPLOGTmYlg4lAWsT73cb4Tr5LU2PCWU=; b=hvZzxHuUEBFVkjWmgyrc4C1FVUCFNCnrmZcNT7T2fLQzHzdMK3INh/Bvba7LGiMKLX 2/TgsHhRmGxK6HKKy3vRXggCcs+9v7P/obVh53A2cSmVkdcqm3ameXBe45mx3KXrJM4u BVEJtW2uxWUJ0669j8WI7zZSPVLUprzNesxWI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=LT8V0/uAyJ74NPLOGTmYlg4lAWsT73cb4Tr5LU2PCWU=; b=FFVdvY5lknYt1lno+lNTC8a5crxW+YYaTlej6LBC6P50D3Yb9X8vWk+rUj8X99doSf cZwOLjJCex+FMRbY1nT3V4ekPq15ocg25N0AUfhVxvbzeztoDEjkdL42cMO00HaTH9ym sASCTE+wWq78Xwj+m2CpSTmx5WL8eK9sqfRs2Iw4Cd61KmIfrla8mETc0oOBaVmBGTGv 8T2VZEqfX5lWEh/QK0LuP4DMPNhT6vUE4a+tCF/4CK9P3JeOdMzlY2044q7bxMKQDvP2 4XwFn2iT5rayszVrD/Iv94OJ9ufpnZEua4bcoEkt7nmzDrl30CtHUDSk5cXHp3jNErUo a0iQ== X-Gm-Message-State: ALoCoQlgb8d6edkTF4WUyzbY9H50EZpoXvIX2ITGIW513/UYBh+D7ciQ54sr8YEo/il2Y7Jp+4ZZ X-Received: by 10.70.127.140 with SMTP id ng12mr15340493pdb.94.1437025362586; Wed, 15 Jul 2015 22:42:42 -0700 (PDT) Received: from drinkcat.tpe.corp.google.com ([172.30.210.53]) by smtp.gmail.com with ESMTPSA id mb4sm6478767pdb.63.2015.07.15.22.42.40 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 15 Jul 2015 22:42:41 -0700 (PDT) From: Nicolas Boichat To: Mark Brown Date: Thu, 16 Jul 2015 13:42:34 +0800 Message-Id: <1437025354-22678-2-git-send-email-drinkcat@chromium.org> X-Mailer: git-send-email 2.4.3.573.g4eafbef In-Reply-To: <1437025354-22678-1-git-send-email-drinkcat@chromium.org> References: <1437025354-22678-1-git-send-email-drinkcat@chromium.org> Cc: Oder Chiou , alsa-devel@alsa-project.org, Takashi Iwai , Liam Girdwood , Bard Liao Subject: [alsa-devel] [PATCH 2/2] ASoC: rt5645: Simplify rt5645_enable_push_button_irq 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 LDO2/Mic Det Power pins are already enabled/disabled in rt5645_jack_detect (the jack out code path previously did not disable those if button function is enabled: modify it to make it so). Signed-off-by: Nicolas Boichat --- sound/soc/codecs/rt5645.c | 33 ++++++++++++--------------------- 1 file changed, 12 insertions(+), 21 deletions(-) diff --git a/sound/soc/codecs/rt5645.c b/sound/soc/codecs/rt5645.c index a56bca6..ff2d4a4 100644 --- a/sound/soc/codecs/rt5645.c +++ b/sound/soc/codecs/rt5645.c @@ -2766,13 +2766,9 @@ static void rt5645_enable_push_button_irq(struct snd_soc_codec *codec, struct rt5645_priv *rt5645 = snd_soc_codec_get_drvdata(codec); if (enable) { - snd_soc_dapm_mutex_lock(dapm); - snd_soc_dapm_force_enable_pin_unlocked(dapm, "ADC L power"); - snd_soc_dapm_force_enable_pin_unlocked(dapm, "ADC R power"); - snd_soc_dapm_force_enable_pin_unlocked(dapm, "LDO2"); - snd_soc_dapm_force_enable_pin_unlocked(dapm, "Mic Det Power"); - snd_soc_dapm_sync_unlocked(dapm); - snd_soc_dapm_mutex_unlock(dapm); + snd_soc_dapm_force_enable_pin(dapm, "ADC L power"); + snd_soc_dapm_force_enable_pin(dapm, "ADC R power"); + snd_soc_dapm_sync(dapm); snd_soc_update_bits(codec, RT5645_INT_IRQ_ST, 0x8, 0x8); @@ -2785,14 +2781,9 @@ static void rt5645_enable_push_button_irq(struct snd_soc_codec *codec, snd_soc_update_bits(codec, RT5650_4BTN_IL_CMD2, 0x8000, 0x0); snd_soc_update_bits(codec, RT5645_INT_IRQ_ST, 0x8, 0x0); - snd_soc_dapm_mutex_lock(dapm); - snd_soc_dapm_disable_pin_unlocked(dapm, "ADC L power"); - snd_soc_dapm_disable_pin_unlocked(dapm, "ADC R power"); - if (rt5645->pdata.jd_mode == 0) - snd_soc_dapm_disable_pin_unlocked(dapm, "LDO2"); - snd_soc_dapm_disable_pin_unlocked(dapm, "Mic Det Power"); - snd_soc_dapm_sync_unlocked(dapm); - snd_soc_dapm_mutex_unlock(dapm); + snd_soc_dapm_disable_pin(dapm, "ADC L power"); + snd_soc_dapm_disable_pin(dapm, "ADC R power"); + snd_soc_dapm_sync(dapm); } } @@ -2847,14 +2838,14 @@ static int rt5645_jack_detect(struct snd_soc_codec *codec, int jack_insert) } else { /* jack out */ rt5645->jack_type = 0; + if (rt5645->en_button_func) rt5645_enable_push_button_irq(codec, false); - else { - if (rt5645->pdata.jd_mode == 0) - snd_soc_dapm_disable_pin(dapm, "LDO2"); - snd_soc_dapm_disable_pin(dapm, "Mic Det Power"); - snd_soc_dapm_sync(dapm); - } + + if (rt5645->pdata.jd_mode == 0) + snd_soc_dapm_disable_pin(dapm, "LDO2"); + snd_soc_dapm_disable_pin(dapm, "Mic Det Power"); + snd_soc_dapm_sync(dapm); } return rt5645->jack_type;