From patchwork Fri Jan 20 10:25:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Astrid Rost X-Patchwork-Id: 13109597 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C784DC25B4E for ; Fri, 20 Jan 2023 10:27:28 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 0E85F3081; Fri, 20 Jan 2023 11:26:37 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 0E85F3081 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1674210447; bh=ZJdrDMWZHinBYd+RS22Hea5lmsp141B457M7qSe9N00=; h=From:To:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: Cc:From; b=UpThSkAnvgQ2b1r9BKFM2fgyBLXmRdjVozKUu8Qk0plIY7WNZPi4vZN4tHpn7RQPw Ej0HWcLi6jUpqiqaZYTRKDgnp7h8GZIF8naGXKCEFcKiYVKMxDYRXZPOoskoVWynX/ uW3F1nCRhHQOiq0emBna+NtO+bI1h4vkoBuo+7is= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id CE620F80495; Fri, 20 Jan 2023 11:26:12 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id AEC90F804A9; Fri, 20 Jan 2023 11:26:10 +0100 (CET) Received: from smtp1.axis.com (smtp1.axis.com [195.60.68.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id C3AA6F8024C for ; Fri, 20 Jan 2023 11:26:04 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz C3AA6F8024C Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=axis.com header.i=@axis.com header.a=rsa-sha256 header.s=axis-central1 header.b=nw4Gx7SS DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axis.com; q=dns/txt; s=axis-central1; t=1674210365; x=1705746365; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=/WXW21EG+pqy+W42CXni76Bfh0YGb++llEepThhlRRc=; b=nw4Gx7SSTramV+SvOoHfRrE7TQYOvJUGysadaAk/78qxyaXwOuiBC8sR ufAX5iGkg4c3ApCSTo4SceG/ISh/7BkDj0e8VvrfGYSqY28jPaP0lAj9o 2J8QHKxegOJHDRby2ZsRKee55i+Wjl7h3E8Ivah9elEC42vqB7dRgLSav rK2BWM6d7qo3sYFMTbyXngdxpy4Q43M+AfSbGg/voKa4MzDk5gPoNJOfK PIhKKBTxn2Nc6KJKLOa8cD9cODHY3jrpBLGREhlg+4urj424nzjr6iom0 Gx/e463xipJPA5NSVq38OvvTb/TGyKxqkesa5VuTtuRgi+rKyO7P7D5Lx g==; From: Astrid Rost To: Mark Brown , Liam Girdwood , Krzysztof Kozlowski , Jaroslav Kysela , Takashi Iwai Subject: [PATCH v2 1/4] ASoC: soc-component: add get_jack_type Date: Fri, 20 Jan 2023 11:25:51 +0100 Message-ID: <20230120102555.1523394-2-astrid.rost@axis.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230120102555.1523394-1-astrid.rost@axis.com> References: <20230120102555.1523394-1-astrid.rost@axis.com> MIME-Version: 1.0 X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.29 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: , Cc: alsa-devel@alsa-project.org, kernel@axis.com, linux-kernel@vger.kernel.org, Astrid Rost Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" Add function to return the jack type of snd_jack_types. This allows a generic card driver to add a jack with the specified type. Signed-off-by: Astrid Rost --- include/sound/soc-component.h | 2 ++ sound/soc/soc-component.c | 20 ++++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/include/sound/soc-component.h b/include/sound/soc-component.h index c26ffb033777..3203d35bc8c1 100644 --- a/include/sound/soc-component.h +++ b/include/sound/soc-component.h @@ -98,6 +98,7 @@ struct snd_soc_component_driver { int source, unsigned int freq_in, unsigned int freq_out); int (*set_jack)(struct snd_soc_component *component, struct snd_soc_jack *jack, void *data); + int (*get_jack_type)(struct snd_soc_component *component); /* DT */ int (*of_xlate_dai_name)(struct snd_soc_component *component, @@ -384,6 +385,7 @@ int snd_soc_component_set_pll(struct snd_soc_component *component, int pll_id, unsigned int freq_out); int snd_soc_component_set_jack(struct snd_soc_component *component, struct snd_soc_jack *jack, void *data); +int snd_soc_component_get_jack_type(struct snd_soc_component *component); void snd_soc_component_seq_notifier(struct snd_soc_component *component, enum snd_soc_dapm_type type, int subseq); diff --git a/sound/soc/soc-component.c b/sound/soc/soc-component.c index e12f8244242b..3cd6952212e1 100644 --- a/sound/soc/soc-component.c +++ b/sound/soc/soc-component.c @@ -256,6 +256,26 @@ int snd_soc_component_set_jack(struct snd_soc_component *component, } EXPORT_SYMBOL_GPL(snd_soc_component_set_jack); +/** + * snd_soc_component_get_jack_type + * @component: COMPONENTs + * + * Returns the jack type of the component + * This can either be the supported type or one read from + * devicetree with the property: jack-type. + */ +int snd_soc_component_get_jack_type( + struct snd_soc_component *component) +{ + int ret = -ENOTSUPP; + + if (component->driver->get_jack_type) + ret = component->driver->get_jack_type(component); + + return soc_component_ret(component, ret); +} +EXPORT_SYMBOL_GPL(snd_soc_component_get_jack_type); + int snd_soc_component_module_get(struct snd_soc_component *component, void *mark, int upon_open) {