Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp2425644rwb; Fri, 20 Jan 2023 02:50:54 -0800 (PST) X-Google-Smtp-Source: AMrXdXvfO2B9l0DHtdeR4lcTps2HVDrISzzU0F6KtZ3Ph2nt0AC3q6GAkZQMhJsTggE5Mn0RAWV5 X-Received: by 2002:a17:906:804e:b0:86b:6a54:36e0 with SMTP id x14-20020a170906804e00b0086b6a5436e0mr12710664ejw.36.1674211854565; Fri, 20 Jan 2023 02:50:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674211854; cv=none; d=google.com; s=arc-20160816; b=XYLa0quzugyKfIUJAADsSeWoidmUVrgz5M16fiRDtM8OvgqJhkZ8IZhSp28HSr9+vW y3n5rCy8HxXura75QYWxACn5hBJb3KzT8UZyByYuOf3kMIzBXfge3/1It3wbmwL/Oo3M WMoLzNYGGOLnl+IKCOBWwglTKN7KtaYraxc+R9diNuOet379XnNY58YBztv89vVmM2gz hkSiFUa77tOd9EBagLU7VODcBq+lkMkUB2bps2mPhVyGMfF9KCITMSKKuVa5NazUnaNQ z/Bpi4JLe7uUQpzSIJDxuyVbFHyI4NEe/LVXLRP8zQuRco1LsKyA2PIYR5Yjg6aDzc3Y t7UQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=/WXW21EG+pqy+W42CXni76Bfh0YGb++llEepThhlRRc=; b=VvbkoPWGkNKELh22zcYbnHEtbTYuocAeTJYJBZDK6TyowybF7MDz5zYV49YVtMSAjW c5dEy4+qZw3FtubuhVWUK+FeC9s4QZQ5C0fwhdhFyGvA3YkVL06QJAsYNylDpxnaBdSP x1Ug3t2KMY44JST2jsldVq4EoZQZIqgacCx5pM5j0vwC63BKN7sqHbotixso+2IRGNXv eD03e/7X2hlqvxmUTOMNF3UW8kOnJj0+wTVe62JMB0Op9G3GfnEsBKnBTIdZtKFXaDdN Pl1suRIvN10NsScTVwwoncuVnznThlKSSTXCl2Tz5bUHW80D0+nEKkNp3ixlseAVbxII 07aQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@axis.com header.s=axis-central1 header.b=IKW7nFv+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=axis.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id fj4-20020a1709069c8400b0086fd2ad2153si19353748ejc.945.2023.01.20.02.50.42; Fri, 20 Jan 2023 02:50:54 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@axis.com header.s=axis-central1 header.b=IKW7nFv+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=axis.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229893AbjATK0U (ORCPT + 48 others); Fri, 20 Jan 2023 05:26:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36760 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229675AbjATK0K (ORCPT ); Fri, 20 Jan 2023 05:26:10 -0500 Received: from smtp1.axis.com (smtp1.axis.com [195.60.68.17]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2558E9F3AA for ; Fri, 20 Jan 2023 02:26:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axis.com; q=dns/txt; s=axis-central1; t=1674210369; x=1705746369; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=/WXW21EG+pqy+W42CXni76Bfh0YGb++llEepThhlRRc=; b=IKW7nFv+LKDHnO2nGa+XolXARk8MsIrLWPKINcm5X9iW6Ha6IFy88gOg RNonyCEfi2zx4FgcpNF0EjJBLJ6JIvTiliIZQCVgbZy0nsMqAPZL8Q3Lg 1nH5wtQGGQC8zSNCoIFHWhuYfS63X4JVWT6QP/j9U/r/WmtSXNcMTMroV 5Aas294uor/+6iJldludXwqB2CuQy/5mYVXnpnFRiL2ZNQ3EBr+KZl9zr zzO22sTJJaQ2S1iiKgNKMkfoyq/kdQbAlSC3myqDyKRoy0QdJZHh+yQgQ Rf80EJ8LmNK06yr4OtnLgTRnhy9UfnpGQxY69vVQvpZnZhdmMAAaRhMFG g==; From: Astrid Rost To: Mark Brown , Liam Girdwood , Krzysztof Kozlowski , Jaroslav Kysela , Takashi Iwai CC: , , , Astrid Rost 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 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_PASS, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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) { -- 2.30.2