From patchwork Wed Mar 11 03:42:45 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bard Liao X-Patchwork-Id: 5982101 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 286299F318 for ; Wed, 11 Mar 2015 03:44:05 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3037020218 for ; Wed, 11 Mar 2015 03:44:04 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id C07C320115 for ; Wed, 11 Mar 2015 03:44:02 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id DF7DD2651AD; Wed, 11 Mar 2015 04:44:01 +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,NO_DNS_FOR_FROM, UNPARSEABLE_RELAY autolearn=no version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id 142F42650C2; Wed, 11 Mar 2015 04:43:11 +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 45E2826516E; Wed, 11 Mar 2015 04:43:10 +0100 (CET) Received: from rtits2.realtek.com.tw (rtits2.realtek.com [60.250.210.242]) by alsa0.perex.cz (Postfix) with ESMTP id 72AD92650C2 for ; Wed, 11 Mar 2015 04:42:55 +0100 (CET) Authenticated-By: X-SpamFilter-By: BOX Solutions SpamTrap 5.52 with qID t2B3gp6w029992, This message is accepted by code: ctloc85258 Received: from mail.realtek.com (rtitcas11.realtek.com.tw[172.21.6.12]) by rtits2.realtek.com.tw (8.14.9/2.40/5.64) with ESMTP id t2B3gp6w029992 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NOT); Wed, 11 Mar 2015 11:42:51 +0800 Received: from sw-server.rtdomain (172.21.81.164) by RTITCAS11.realtek.com.tw (172.21.6.12) with Microsoft SMTP Server id 14.3.210.2; Wed, 11 Mar 2015 11:42:52 +0800 From: Bard Liao To: , Date: Wed, 11 Mar 2015 11:42:45 +0800 Message-ID: <1426045365-15975-2-git-send-email-bardliao@realtek.com> X-Mailer: git-send-email 1.8.1.1.439.g50a6b54 In-Reply-To: <1426045365-15975-1-git-send-email-bardliao@realtek.com> References: <1426045365-15975-1-git-send-email-bardliao@realtek.com> MIME-Version: 1.0 X-Originating-IP: [172.21.81.164] Cc: oder_chiou@realtek.com, alsa-devel@alsa-project.org, lars@metafoo.de, mengdong.lin@intel.com, john.lin@realtek.com, Jin Yao , Bard Liao , yao.jin@intel.com, flove@realtek.com Subject: [alsa-devel] [PATCH v2 2/2] ASoC: rt5670: export jack suspend/resume APIs 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 We force enable "Mic Det Power" when a jack is inserted. Also, we set codec idle_bias_off = true. As a result, codec driver will not suspend as we expect. On Braswell, we don't need the jack detection when suspend but need it after resume, so export the jack suspend/resume APIs which are provided for machine driver to control during suspend/resume. Signed-off-by: Jie Yang Signed-off-by: Jin Yao Signed-off-by: Bard Liao --- sound/soc/codecs/rt5670.c | 18 ++++++++++++++++++ sound/soc/codecs/rt5670.h | 3 +++ 2 files changed, 21 insertions(+) diff --git a/sound/soc/codecs/rt5670.c b/sound/soc/codecs/rt5670.c index 23ca049..5999512 100644 --- a/sound/soc/codecs/rt5670.c +++ b/sound/soc/codecs/rt5670.c @@ -461,6 +461,24 @@ static int rt5670_headset_detect(struct snd_soc_codec *codec, int jack_insert) return rt5670->jack_type; } +void rt5670_jack_suspend(struct snd_soc_codec *codec) +{ + struct rt5670_priv *rt5670 = snd_soc_codec_get_drvdata(codec); + + rt5670->jack_type_saved = rt5670->jack_type; + rt5670_headset_detect(codec, 0); +} +EXPORT_SYMBOL_GPL(rt5670_jack_suspend); + +void rt5670_jack_resume(struct snd_soc_codec *codec) +{ + struct rt5670_priv *rt5670 = snd_soc_codec_get_drvdata(codec); + + if (rt5670->jack_type_saved) + rt5670_headset_detect(codec, 1); +} +EXPORT_SYMBOL_GPL(rt5670_jack_resume); + static int rt5670_button_detect(struct snd_soc_codec *codec) { int btn_type, val; diff --git a/sound/soc/codecs/rt5670.h b/sound/soc/codecs/rt5670.h index 0f3255a..dc2b462 100644 --- a/sound/soc/codecs/rt5670.h +++ b/sound/soc/codecs/rt5670.h @@ -2004,8 +2004,11 @@ struct rt5670_priv { int dsp_sw; /* expected parameter setting */ int dsp_rate; int jack_type; + int jack_type_saved; }; +void rt5670_jack_suspend(struct snd_soc_codec *codec); +void rt5670_jack_resume(struct snd_soc_codec *codec); int rt5670_set_jack_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack); #endif /* __RT5670_H__ */