From patchwork Tue Feb 10 09:01:56 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Jie, Yang" X-Patchwork-Id: 5805511 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 0B6399F37F for ; Tue, 10 Feb 2015 09:00:17 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3A93E20120 for ; Tue, 10 Feb 2015 09:00:16 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 63FC32010E for ; Tue, 10 Feb 2015 09:00:10 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 913902612C8; Tue, 10 Feb 2015 10:00:08 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id C20022608B1; Tue, 10 Feb 2015 10:00:00 +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 4A0392608B1; Tue, 10 Feb 2015 09:59:59 +0100 (CET) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by alsa0.perex.cz (Postfix) with ESMTP id 480802606BA for ; Tue, 10 Feb 2015 09:59:52 +0100 (CET) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga101.jf.intel.com with ESMTP; 10 Feb 2015 00:59:50 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.09,549,1418112000"; d="scan'208";a="452466059" Received: from keyon-u1310.sh.intel.com ([10.239.13.15]) by FMSMGA003.fm.intel.com with ESMTP; 10 Feb 2015 00:45:14 -0800 From: Jie Yang To: broonie@kernel.org Date: Tue, 10 Feb 2015 17:01:56 +0800 Message-Id: <1423558916-19084-1-git-send-email-yang.jie@intel.com> X-Mailer: git-send-email 1.9.1 Cc: bardliao@realtek.com, alsa-devel@alsa-project.org, liam.r.girdwood@intel.com Subject: [alsa-devel] [PATCH v4] ASoC: rt286: add jack detection disable with NULL jack passed 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 Some platforms, e.g. WSB, don't need jack detection when system is in Suspend, for power save reason. Here add headphone/mic jack detection disable feature with NULL jack passed in, when disabled, it will disable interrupt, and disable LDO1, which is used for jack detection when headphone is plugged in. Signed-off-by: Jie Yang Reviewed-by: Bard Liao --- sound/soc/codecs/rt286.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/sound/soc/codecs/rt286.c b/sound/soc/codecs/rt286.c index d5cc1bc..c778028 100644 --- a/sound/soc/codecs/rt286.c +++ b/sound/soc/codecs/rt286.c @@ -394,9 +394,20 @@ int rt286_mic_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack) rt286->jack = jack; - /* Send an initial empty report */ - snd_soc_jack_report(rt286->jack, 0, - SND_JACK_MICROPHONE | SND_JACK_HEADPHONE); + if (jack) { + /* enable IRQ */ + if (rt286->jack->status | SND_JACK_HEADPHONE) + snd_soc_dapm_force_enable_pin(&codec->dapm, "LDO1"); + regmap_update_bits(rt286->regmap, RT286_IRQ_CTRL, 0x2, 0x2); + /* Send an initial empty report */ + snd_soc_jack_report(rt286->jack, rt286->jack->status, + SND_JACK_MICROPHONE | SND_JACK_HEADPHONE); + } else { + /* disable IRQ */ + regmap_update_bits(rt286->regmap, RT286_IRQ_CTRL, 0x2, 0x0); + snd_soc_dapm_disable_pin(&codec->dapm, "LDO1"); + } + snd_soc_dapm_sync(&codec->dapm); return 0; }