From patchwork Wed Feb 4 13:34:03 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Jie, Yang" X-Patchwork-Id: 5776551 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 0A6D59F269 for ; Wed, 4 Feb 2015 13:32:23 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4412F201E4 for ; Wed, 4 Feb 2015 13:32:22 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 11DA42015E for ; Wed, 4 Feb 2015 13:32:21 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id E280026167D; Wed, 4 Feb 2015 14:32:19 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: 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 EBB802604D0; Wed, 4 Feb 2015 14:32:10 +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 E43A026053D; Wed, 4 Feb 2015 14:32:09 +0100 (CET) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by alsa0.perex.cz (Postfix) with ESMTP id 90927260448 for ; Wed, 4 Feb 2015 14:32:04 +0100 (CET) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga103.fm.intel.com with ESMTP; 04 Feb 2015 05:25:25 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.09,518,1418112000"; d="scan'208";a="522404125" Received: from keyon-u1310.sh.intel.com ([10.239.13.15]) by orsmga003.jf.intel.com with ESMTP; 04 Feb 2015 05:24:22 -0800 From: Jie Yang To: broonie@kernel.org Date: Wed, 4 Feb 2015 21:34:03 +0800 Message-Id: <1423056843-26490-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 v2] ASoC: rt286: add jack detection enable/disable APIs and export 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 jack detection enable/disable APIs and export them, when disabled, it will ignore 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 | 24 ++++++++++++++++++++++++ sound/soc/codecs/rt286.h | 2 ++ 2 files changed, 26 insertions(+) diff --git a/sound/soc/codecs/rt286.c b/sound/soc/codecs/rt286.c index 8104d22..9ea01d0 100644 --- a/sound/soc/codecs/rt286.c +++ b/sound/soc/codecs/rt286.c @@ -400,6 +400,30 @@ int rt286_mic_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack) } EXPORT_SYMBOL_GPL(rt286_mic_detect); +int rt286_enable_jack_detection(struct snd_soc_codec *codec) +{ + struct rt286_priv *rt286 = snd_soc_codec_get_drvdata(codec); + + if (rt286->jack->status | SND_JACK_HEADPHONE) + snd_soc_dapm_force_enable_pin(&rt286->codec->dapm, "LDO1"); + snd_soc_dapm_sync(&rt286->codec->dapm); + enable_irq(rt286->i2c->irq); + return 0; +} +EXPORT_SYMBOL_GPL(rt286_enable_jack_detection); + +int rt286_disable_jack_detection(struct snd_soc_codec *codec) +{ + struct rt286_priv *rt286 = snd_soc_codec_get_drvdata(codec); + + disable_irq(rt286->i2c->irq); + + snd_soc_dapm_disable_pin(&rt286->codec->dapm, "LDO1"); + snd_soc_dapm_sync(&rt286->codec->dapm); + return 0; +} +EXPORT_SYMBOL_GPL(rt286_disable_jack_detection); + static int is_mclk_mode(struct snd_soc_dapm_widget *source, struct snd_soc_dapm_widget *sink) { diff --git a/sound/soc/codecs/rt286.h b/sound/soc/codecs/rt286.h index b539b73..c958182 100644 --- a/sound/soc/codecs/rt286.h +++ b/sound/soc/codecs/rt286.h @@ -193,6 +193,8 @@ enum { }; int rt286_mic_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack); +int rt286_enable_jack_detection(struct snd_soc_codec *codec); +int rt286_disable_jack_detection(struct snd_soc_codec *codec); #endif /* __RT286_H__ */