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)) {