Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp520597ybh; Wed, 15 Jul 2020 08:09:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxzArMDx1wu4fhYg93HqqTCEK83K1Ez068ZsZAK7+SVcQITj7NMzOTLAzCeOXFMOdTrHTGV X-Received: by 2002:a50:8143:: with SMTP id 61mr87136edc.202.1594825759329; Wed, 15 Jul 2020 08:09:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594825759; cv=none; d=google.com; s=arc-20160816; b=FeqH7XWhyxowyRSkHepkXp8Y2EgRPeXWELe102Hpvyo6zM7dgY7ODZ39Cv516DGVnZ O8PeUiehRVfEKuse1Ot38S4pV3Z2+TG3BHYvR70G4oc8k9k6QFdehsk08vDM6Hu/CYxh 020PFXZq69oOeXAx6iksdMZ3rW28yipWZubg0U57IAvafvz07EXWUohHan/CxibogDLm avQYkTIAN3xeANwtjxJGK3kDULrwPvxJAn5cDwybWR56AiZ3vZnTGPug4XaSr5ynlPlX 4o37cfvQQEJvpTndvV/1KrVySqZaXBTEQlZ8UaKyZ0cp0o6MgmVuj1MCbzvklRXxG7R3 CXYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=ewCYzhqS7tj8R2BgCJ+Cm0Ga76eDaM+0kn4tb2JxjQQ=; b=z1AQRCZ8A3HkxwLX4KQpbwkW2FnXkRXDwy0734AckW/+xzCkuwpllsGx3nodtFxetR VK/30MdCx5CLFqTSNWcGLcRUjc6pyq926h9+uCyYFZcBWj6/xYL8Twn20BQr1XU4ZZSI 32cl/lttpFI9TAekitQxK72nJg7erKGcl8VXpltP8JFn/Eufsf6oRPdQFxuTLI5P5yvR qZsaN5RTNQmrNvBpEP/oL8FLgTM7YwBvWXx2rwrYgiJNCZE7Q7DkCmNXLJKMrBFc4+TK qfazz9V6kG4Jl6o7I9CdhPA8Lmxl4Aaj8SUucoOda9MbBB9nFLaFoN+ekrlovWpg8FpI /edA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id oa24si1348556ejb.571.2020.07.15.08.08.47; Wed, 15 Jul 2020 08:09:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727782AbgGOONx (ORCPT + 99 others); Wed, 15 Jul 2020 10:13:53 -0400 Received: from inva020.nxp.com ([92.121.34.13]:49490 "EHLO inva020.nxp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726821AbgGOONw (ORCPT ); Wed, 15 Jul 2020 10:13:52 -0400 Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 3D21A1A01F3; Wed, 15 Jul 2020 16:13:50 +0200 (CEST) Received: from invc005.ap-rdc01.nxp.com (invc005.ap-rdc01.nxp.com [165.114.16.14]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id E43AF1A0461; Wed, 15 Jul 2020 16:13:44 +0200 (CEST) Received: from localhost.localdomain (shlinux2.ap.freescale.net [10.192.224.44]) by invc005.ap-rdc01.nxp.com (Postfix) with ESMTP id 31265402E4; Wed, 15 Jul 2020 22:13:38 +0800 (SGT) From: Shengjiu Wang To: perex@perex.cz, tiwai@suse.com, lgirdwood@gmail.com, broonie@kernel.org, alsa-devel@alsa-project.org, robh+dt@kernel.org, devicetree@vger.kernel.org, timur@kernel.org, nicoleotsuka@gmail.com, Xiubo.Lee@gmail.com, festevam@gmail.com Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Subject: [PATCH v2 1/3] ASoC: simple-card-utils: Support configure pin_name for asoc_simple_init_jack Date: Wed, 15 Jul 2020 22:09:37 +0800 Message-Id: <1594822179-1849-2-git-send-email-shengjiu.wang@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1594822179-1849-1-git-send-email-shengjiu.wang@nxp.com> References: <1594822179-1849-1-git-send-email-shengjiu.wang@nxp.com> X-Virus-Scanned: ClamAV using ClamSMTP Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Currently the pin_name is fixed in asoc_simple_init_jack, but some driver may use a different pin_name. So add a new parameter in asoc_simple_init_jack for configuring pin_name. If this parameter is NULL, then the default pin_name is used. Signed-off-by: Shengjiu Wang Acked-by: Nicolin Chen --- include/sound/simple_card_utils.h | 6 +++--- sound/soc/generic/simple-card-utils.c | 7 ++++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/include/sound/simple_card_utils.h b/include/sound/simple_card_utils.h index bbdd1542d6f1..86a1e956991e 100644 --- a/include/sound/simple_card_utils.h +++ b/include/sound/simple_card_utils.h @@ -12,9 +12,9 @@ #include #define asoc_simple_init_hp(card, sjack, prefix) \ - asoc_simple_init_jack(card, sjack, 1, prefix) + asoc_simple_init_jack(card, sjack, 1, prefix, NULL) #define asoc_simple_init_mic(card, sjack, prefix) \ - asoc_simple_init_jack(card, sjack, 0, prefix) + asoc_simple_init_jack(card, sjack, 0, prefix, NULL) struct asoc_simple_dai { const char *name; @@ -131,7 +131,7 @@ int asoc_simple_parse_pin_switches(struct snd_soc_card *card, int asoc_simple_init_jack(struct snd_soc_card *card, struct asoc_simple_jack *sjack, - int is_hp, char *prefix); + int is_hp, char *prefix, char *pin); int asoc_simple_init_priv(struct asoc_simple_priv *priv, struct link_info *li); diff --git a/sound/soc/generic/simple-card-utils.c b/sound/soc/generic/simple-card-utils.c index 8c54dc6710fe..b408cb5ed644 100644 --- a/sound/soc/generic/simple-card-utils.c +++ b/sound/soc/generic/simple-card-utils.c @@ -540,7 +540,8 @@ EXPORT_SYMBOL_GPL(asoc_simple_parse_pin_switches); int asoc_simple_init_jack(struct snd_soc_card *card, struct asoc_simple_jack *sjack, - int is_hp, char *prefix) + int is_hp, char *prefix, + char *pin) { struct device *dev = card->dev; enum of_gpio_flags flags; @@ -557,12 +558,12 @@ int asoc_simple_init_jack(struct snd_soc_card *card, if (is_hp) { snprintf(prop, sizeof(prop), "%shp-det-gpio", prefix); - pin_name = "Headphones"; + pin_name = pin ? pin : "Headphones"; gpio_name = "Headphone detection"; mask = SND_JACK_HEADPHONE; } else { snprintf(prop, sizeof(prop), "%smic-det-gpio", prefix); - pin_name = "Mic Jack"; + pin_name = pin ? pin : "Mic Jack"; gpio_name = "Mic detection"; mask = SND_JACK_MICROPHONE; } -- 2.27.0