From patchwork Mon Apr 18 08:17:30 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: zhengxing X-Patchwork-Id: 8868661 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 323D2BF29F for ; Mon, 18 Apr 2016 08:18:39 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 69C4120204 for ; Mon, 18 Apr 2016 08:18:38 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 328F320148 for ; Mon, 18 Apr 2016 08:18:37 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id CB3F2265471; Mon, 18 Apr 2016 10:18:35 +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.9 required=5.0 tests=BAYES_00,NO_DNS_FOR_FROM, RCVD_IN_DNSWL_NONE,UNPARSEABLE_RELAY autolearn=no version=3.3.1 Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id BB44A265134; Mon, 18 Apr 2016 10:17:58 +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 1A7532625CF; Mon, 18 Apr 2016 10:17:57 +0200 (CEST) Received: from regular1.263xmail.com (regular1.263xmail.com [211.150.99.130]) by alsa0.perex.cz (Postfix) with ESMTP id BFC152625CF for ; Mon, 18 Apr 2016 10:17:49 +0200 (CEST) Received: from zhengxing?rock-chips.com (unknown [192.168.167.129]) by regular1.263xmail.com (Postfix) with SMTP id 507B4B5C7; Mon, 18 Apr 2016 16:17:46 +0800 (CST) X-263anti-spam: KSV:0; X-MAIL-GRAY: 0 X-MAIL-DELIVERY: 1 X-ABS-CHECKED: 4 X-ADDR-CHECKED: 0 X-KSVirus-check: 0 Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.263.net (Postfix) with ESMTP id 6A73616412; Mon, 18 Apr 2016 16:17:39 +0800 (CST) X-RL-SENDER: zhengxing@rock-chips.com X-SENDER-IP: 58.22.7.114 X-LOGIN-NAME: zhengxing@rock-chips.com X-UNIQUE-TAG: <56d30df731834573a6fcc594a90dfb49> X-ATTACHMENT-NUM: 0 X-SENDER: zhengxing@rock-chips.com X-DNS-TYPE: 0 Received: from unknown (unknown [58.22.7.114]) by smtp.263.net (Postfix) whith SMTP id 4143BI03R; Mon, 18 Apr 2016 16:17:44 +0800 (CST) From: Xing Zheng To: linux-rockchip@lists.infradead.org Date: Mon, 18 Apr 2016 16:17:30 +0800 Message-Id: <1460967452-24574-2-git-send-email-zhengxing@rock-chips.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1460967452-24574-1-git-send-email-zhengxing@rock-chips.com> References: <1460967452-24574-1-git-send-email-zhengxing@rock-chips.com> Cc: alsa-devel@alsa-project.org, heiko@sntech.de, Xing Zheng , linux-kernel@vger.kernel.org, Takashi Iwai , Liam Girdwood , sugar.zhang@rock-chips.com, Adam.Thomson@diasemi.com, broonie@kernel.org, jay.xu@rock-chips.com Subject: [alsa-devel] [PATCH 1/3] ASoC: jack: Add a jack detect callback via codec 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 This patch add a callback when a codec have the jack detect feature. Signed-off-by: Xing Zheng --- include/sound/soc.h | 6 ++++++ sound/soc/soc-jack.c | 8 ++++++++ 2 files changed, 14 insertions(+) diff --git a/include/sound/soc.h b/include/sound/soc.h index 02b4a21..ff105a4 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h @@ -547,6 +547,10 @@ static inline void snd_soc_jack_free_gpios(struct snd_soc_jack *jack, int count, } #endif +/* init jack detect via codec */ +void snd_soc_jack_codec_detect(struct snd_soc_codec *codec, + struct snd_soc_jack *jack); + /* codec register bit access */ int snd_soc_update_bits(struct snd_soc_codec *codec, unsigned int reg, unsigned int mask, unsigned int value); @@ -920,6 +924,8 @@ struct snd_soc_codec_driver { enum snd_soc_dapm_type, int); bool ignore_pmdown_time; /* Doesn't benefit from pmdown delay */ + + void (*detect_jack)(struct snd_soc_codec *codec, struct snd_soc_jack *jack); }; /* SoC platform interface */ diff --git a/sound/soc/soc-jack.c b/sound/soc/soc-jack.c index fbaa1bb..e292fb4 100644 --- a/sound/soc/soc-jack.c +++ b/sound/soc/soc-jack.c @@ -436,3 +436,11 @@ void snd_soc_jack_free_gpios(struct snd_soc_jack *jack, int count, } EXPORT_SYMBOL_GPL(snd_soc_jack_free_gpios); #endif /* CONFIG_GPIOLIB */ + +void snd_soc_jack_codec_detect(struct snd_soc_codec *codec, + struct snd_soc_jack *jack) +{ + if (codec && codec->driver && codec->driver->detect_jack) + codec->driver->detect_jack(codec, jack); +} +EXPORT_SYMBOL_GPL(snd_soc_jack_codec_detect);