From patchwork Mon Jun 11 08:32:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Katsuhiro Suzuki X-Patchwork-Id: 138206 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp3777338lji; Mon, 11 Jun 2018 01:32:28 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJynrhQo88Zxpmf8K5S2sFN+I3wQscB6b8yPVnBIY8b7DbHBFy4p6eb0uxVjBsuRyUBNM60 X-Received: by 2002:adf:c907:: with SMTP id m7-v6mr13011286wrh.6.1528705948388; Mon, 11 Jun 2018 01:32:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528705948; cv=none; d=google.com; s=arc-20160816; b=OKYZ6fhw6aOy1H9YhsChg1MEa+gSFJzRNv1zyIRwPXOoCsSCCd7JSsbRRs7Qr2IAm5 aqCwRf5xQ1EI+Ds3xCG5BCpu7GBt/pFTnM8ZTYntyMSk6jYK9Q5aZchzxYKv+DaQ4T7N oNCk9Vji/27PHzlYlEfdLVlzGgTQiX/cCfMnDIeOBbyiIu0ksuPxarni+4bdDiH//+4B uY2Ld0y4S1b3oULhZALJhUAP3ZsdnRmdzFPAjN3NqsDmqG0K7Teb1q0xl+826EMeVTfD 1dii95/kmW2frm3Oo4qBTQ7kcM4htSdLKG2AwCnl/5/4EwlKZwAvfS11j2mTdn75fIL3 ZfnQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:references:in-reply-to:message-id :date:to:from:delivered-to:arc-authentication-results; bh=cmlgYhJ9SpoKvf+uolWIqXKDg7ap5NlUzLUM4/2CRVI=; b=rGlmRceYJXLEbQpAu+4R4Tm7FZc0Ik+nUaYDvN3exsz9F5fn2TM0jGS6trvNuzp4mh xQDmKFGhXhB9+Lx2pa591yn7q08jeUGG8MW96CHFGhev4d4L144sVhIY4maY+SILbSk9 vADp0DANt4/zhx57gAik1YNsBoeoKQHyXM6Zh+/9XSSR+vKiwZwRK8vrjujBPxqtoehP MfOGmK2o1I34dI+Rm3IUR/8H7tbE1aDHSjfKc3y2VTFDA+Rt2rsbFbqaDCsqDvtL+LaT ++uMyGtyaaVRkndVepqnNEChkriqgcnouNyVH4ei1BwGSGKUgEGMJa2U2YIbf9lDEpsH 5f5Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of alsa-devel-bounces@alsa-project.org designates 77.48.224.243 as permitted sender) smtp.mailfrom=alsa-devel-bounces@alsa-project.org Return-Path: Received: from alsa0.perex.cz (alsa0.perex.cz. [77.48.224.243]) by mx.google.com with ESMTP id p8-v6si16039324wrd.67.2018.06.11.01.32.28; Mon, 11 Jun 2018 01:32:28 -0700 (PDT) Received-SPF: pass (google.com: domain of alsa-devel-bounces@alsa-project.org designates 77.48.224.243 as permitted sender) client-ip=77.48.224.243; Authentication-Results: mx.google.com; spf=pass (google.com: domain of alsa-devel-bounces@alsa-project.org designates 77.48.224.243 as permitted sender) smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 1BDBE2676B9; Mon, 11 Jun 2018 10:32:26 +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 1EE272676BF; Mon, 11 Jun 2018 10:32:24 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail1.perex.cz X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=disabled version=3.4.0 Received: from mx.socionext.com (mx.socionext.com [202.248.49.38]) by alsa0.perex.cz (Postfix) with ESMTP id 23F112676B9 for ; Mon, 11 Jun 2018 10:32:20 +0200 (CEST) Received: from unknown (HELO iyokan-ex.css.socionext.com) ([172.31.9.54]) by mx.socionext.com with ESMTP; 11 Jun 2018 17:32:16 +0900 Received: from mail.mfilter.local (m-filter-2 [10.213.24.62]) by iyokan-ex.css.socionext.com (Postfix) with ESMTP id 213C36006F; Mon, 11 Jun 2018 17:32:17 +0900 (JST) Received: from 172.31.9.53 (172.31.9.53) by m-FILTER with ESMTP; Mon, 11 Jun 2018 17:32:17 +0900 Received: from yuzu.css.socionext.com (yuzu [172.31.8.45]) by iyokan.css.socionext.com (Postfix) with ESMTP id CB4AA40386; Mon, 11 Jun 2018 17:32:16 +0900 (JST) Received: from aegis.e01.socionext.com (unknown [10.213.134.210]) by yuzu.css.socionext.com (Postfix) with ESMTP id A0CC212013B; Mon, 11 Jun 2018 17:32:16 +0900 (JST) From: Katsuhiro Suzuki To: Kuninori Morimoto , Mark Brown , alsa-devel@alsa-project.org Date: Mon, 11 Jun 2018 17:32:13 +0900 Message-Id: <20180611083214.16858-2-suzuki.katsuhiro@socionext.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180611083214.16858-1-suzuki.katsuhiro@socionext.com> References: <20180611083214.16858-1-suzuki.katsuhiro@socionext.com> Cc: Katsuhiro Suzuki , Jassi Brar , linux-arm-kernel@lists.infradead.org, Masami Hiramatsu , linux-kernel@vger.kernel.org Subject: [alsa-devel] [PATCH v3 2/3] ASoC: simple-card: move hp and mic detection to soc_card probe 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 This patch moves headphone and microphone detection to probe() of snd_soc_card from init() of snd_soc_dai_link. This is because init() is called (and an input device /dev/input/eventX is created too) twice or above if simple card has two or more DAI links. Signed-off-by: Katsuhiro Suzuki --- Changes from v2: - Keep PREFIX of hp/mic detection properties Changes from v1: - Newly added --- sound/soc/generic/simple-card.c | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) -- 2.17.1 _______________________________________________ Alsa-devel mailing list Alsa-devel@alsa-project.org http://mailman.alsa-project.org/mailman/listinfo/alsa-devel diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c index 1bbd9e46bf2a..da34016652c9 100644 --- a/sound/soc/generic/simple-card.c +++ b/sound/soc/generic/simple-card.c @@ -149,14 +149,6 @@ static int asoc_simple_card_dai_init(struct snd_soc_pcm_runtime *rtd) if (ret < 0) return ret; - ret = asoc_simple_card_init_hp(rtd->card, &priv->hp_jack, PREFIX); - if (ret < 0) - return ret; - - ret = asoc_simple_card_init_mic(rtd->card, &priv->mic_jack, PREFIX); - if (ret < 0) - return ret; - return 0; } @@ -350,6 +342,22 @@ static int asoc_simple_card_parse_of(struct simple_card_data *priv) return ret; } +static int asoc_simple_soc_card_probe(struct snd_soc_card *card) +{ + struct simple_card_data *priv = snd_soc_card_get_drvdata(card); + int ret; + + ret = asoc_simple_card_init_hp(card, &priv->hp_jack, PREFIX); + if (ret < 0) + return ret; + + ret = asoc_simple_card_init_mic(card, &priv->mic_jack, PREFIX); + if (ret < 0) + return ret; + + return 0; +} + static int asoc_simple_card_probe(struct platform_device *pdev) { struct simple_card_data *priv; @@ -385,6 +393,7 @@ static int asoc_simple_card_probe(struct platform_device *pdev) card->dev = dev; card->dai_link = priv->dai_link; card->num_links = num; + card->probe = asoc_simple_soc_card_probe; if (np && of_device_is_available(np)) { From patchwork Mon Jun 11 08:32:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Katsuhiro Suzuki X-Patchwork-Id: 138207 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp3777539lji; Mon, 11 Jun 2018 01:32:44 -0700 (PDT) X-Google-Smtp-Source: ADUXVKK2tcpsCvLQoGCohHvy9Ao32S7tipPMiuzbYdlRNXwC1T/G/UxZ27IJySgV3JkUe23HyT7d X-Received: by 2002:adf:c4d0:: with SMTP id o16-v6mr12164435wrf.173.1528705964018; Mon, 11 Jun 2018 01:32:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528705964; cv=none; d=google.com; s=arc-20160816; b=aSmWQi8+n0WB4ynTqzB0ETUYjwGjo1HuwkuTWJGbC3eoS9EqRvfdsvoD6v0/f7YMVw LVvfMc3N3nyED8Ul+Ckyn+oKQ3God92h/MGcwi6bdnqBtTPdy98DqFbAKwm0HyyRIBCX bKIqXK9erGaFuGf+rE3wemohRKHjYL5BYiWRGqDUk87p6u057EVvqJgRlHbGOD6mZD/n hRx9Cnjh5XQxAWXxbXXwBpzYfFuD0y4Z3xQzgObZUGS+0DO5lFv/CSFpqdYcTLF7BS3h naJupq9LWaWSwkUBFh4EBvii2awR/gVyG2idK6kDD7nVuTvffVI0UCJTOPhxNKQgWdme 9d/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:references:in-reply-to:message-id :date:to:from:delivered-to:arc-authentication-results; bh=aF7iyPY7bHQYApqtYdH9EbfANbRiBEH5ALmGWVWNtHs=; b=DJNkYbOphaBdfmfTwzLjDuODDh+cFz751OujUBFjiZgMKXe2tqSqh2zSywd6mQ8n8o sGmQW3D6FIdjW8ebvo/0Ao7zK9znh1/p/rg0cO5EWm+nb+Y2+3wP50gPL44NWy4bbDiB qHaF29Y1M9dvHe5Ak9u4HXnI3MUlWv0J6YGu3ISNow14F9k3ayNZxDwngNIJu+XDO74J cQAjQ29nukVc3EHcmEUO0FNdsTMJpLZbwRAsd2FbrHDQNoNf0q8MUUJlzVQ6uUtce0yn o6KZjjBL4SmVryLWYM9mzEsvzdNEH1DyxP9KEn8gGMQ2uTIAtVEGwHdge+Mw5iBInhcw b5Mg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of alsa-devel-bounces@alsa-project.org designates 77.48.224.243 as permitted sender) smtp.mailfrom=alsa-devel-bounces@alsa-project.org Return-Path: Received: from alsa0.perex.cz (alsa0.perex.cz. [77.48.224.243]) by mx.google.com with ESMTP id b74-v6si18194595wrd.455.2018.06.11.01.32.43; Mon, 11 Jun 2018 01:32:44 -0700 (PDT) Received-SPF: pass (google.com: domain of alsa-devel-bounces@alsa-project.org designates 77.48.224.243 as permitted sender) client-ip=77.48.224.243; Authentication-Results: mx.google.com; spf=pass (google.com: domain of alsa-devel-bounces@alsa-project.org designates 77.48.224.243 as permitted sender) smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 4AC6B2676CA; Mon, 11 Jun 2018 10:32:33 +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 82BA22676BA; Mon, 11 Jun 2018 10:32:25 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail1.perex.cz X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=disabled version=3.4.0 Received: from mx.socionext.com (mx.socionext.com [202.248.49.38]) by alsa0.perex.cz (Postfix) with ESMTP id 71929266D4C for ; Mon, 11 Jun 2018 10:32:23 +0200 (CEST) Received: from unknown (HELO kinkan-ex.css.socionext.com) ([172.31.9.52]) by mx.socionext.com with ESMTP; 11 Jun 2018 17:32:17 +0900 Received: from mail.mfilter.local (m-filter-2 [10.213.24.62]) by kinkan-ex.css.socionext.com (Postfix) with ESMTP id 9C0DC1800E5; Mon, 11 Jun 2018 17:32:17 +0900 (JST) Received: from 172.31.9.53 (172.31.9.53) by m-FILTER with ESMTP; Mon, 11 Jun 2018 17:32:17 +0900 Received: from yuzu.css.socionext.com (yuzu [172.31.8.45]) by iyokan.css.socionext.com (Postfix) with ESMTP id 07F14403FD; Mon, 11 Jun 2018 17:32:17 +0900 (JST) Received: from aegis.e01.socionext.com (unknown [10.213.134.210]) by yuzu.css.socionext.com (Postfix) with ESMTP id D0B5D12013B; Mon, 11 Jun 2018 17:32:16 +0900 (JST) From: Katsuhiro Suzuki To: Kuninori Morimoto , Mark Brown , alsa-devel@alsa-project.org Date: Mon, 11 Jun 2018 17:32:14 +0900 Message-Id: <20180611083214.16858-3-suzuki.katsuhiro@socionext.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180611083214.16858-1-suzuki.katsuhiro@socionext.com> References: <20180611083214.16858-1-suzuki.katsuhiro@socionext.com> Cc: Katsuhiro Suzuki , Jassi Brar , linux-arm-kernel@lists.infradead.org, Masami Hiramatsu , linux-kernel@vger.kernel.org Subject: [alsa-devel] [PATCH v3 3/3] ASoC: audio-graph-card: add hp and mic detect gpios same as simple-card 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 This patch adds headphone and microphone jack detection gpios as same as simple-card driver. Signed-off-by: Katsuhiro Suzuki --- Changes from v2: - Nothing Changes from v1: - Move changes of audio-graph-card to other patch --- sound/soc/generic/audio-graph-card.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) -- 2.17.1 _______________________________________________ Alsa-devel mailing list Alsa-devel@alsa-project.org http://mailman.alsa-project.org/mailman/listinfo/alsa-devel diff --git a/sound/soc/generic/audio-graph-card.c b/sound/soc/generic/audio-graph-card.c index 1b6164249341..2baa60d3b3cc 100644 --- a/sound/soc/generic/audio-graph-card.c +++ b/sound/soc/generic/audio-graph-card.c @@ -21,7 +21,6 @@ #include #include #include -#include #include struct graph_card_data { @@ -32,6 +31,8 @@ struct graph_card_data { unsigned int mclk_fs; } *dai_props; unsigned int mclk_fs; + struct asoc_simple_jack hp_jack; + struct asoc_simple_jack mic_jack; struct snd_soc_dai_link *dai_link; struct gpio_desc *pa_gpio; }; @@ -278,6 +279,22 @@ static int asoc_graph_get_dais_count(struct device *dev) return count; } +static int asoc_graph_soc_card_probe(struct snd_soc_card *card) +{ + struct graph_card_data *priv = snd_soc_card_get_drvdata(card); + int ret; + + ret = asoc_simple_card_init_hp(card, &priv->hp_jack, NULL); + if (ret < 0) + return ret; + + ret = asoc_simple_card_init_mic(card, &priv->mic_jack, NULL); + if (ret < 0) + return ret; + + return 0; +} + static int asoc_graph_card_probe(struct platform_device *pdev) { struct graph_card_data *priv; @@ -319,6 +336,7 @@ static int asoc_graph_card_probe(struct platform_device *pdev) card->num_links = num; card->dapm_widgets = asoc_graph_card_dapm_widgets; card->num_dapm_widgets = ARRAY_SIZE(asoc_graph_card_dapm_widgets); + card->probe = asoc_graph_soc_card_probe; ret = asoc_graph_card_parse_of(priv); if (ret < 0) {