From patchwork Sat Mar 25 14:21:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dylan Van Assche X-Patchwork-Id: 666932 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 A6B1BC6FD1C for ; Sat, 25 Mar 2023 14:25:03 +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 25DC3E73; Sat, 25 Mar 2023 15:24:11 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 25DC3E73 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1679754301; bh=jiYyKGv1Gu17pWE8VnuAPHHtV3ro909OfE/D4PTJS6E=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Archive: List-Help:List-Owner:List-Post:List-Subscribe:List-Unsubscribe: From:Reply-To:Cc:From; b=PY8gL9K9tlTFkSV1qzJ/aBMyblUXmoaFiB2UYBlGhHp5JS92gKRTshOuZ+0Ti/e95 KVEoBFdt6NHsfx66kffcyRPL/sUkjd3y3oTzvbKSIxPXtOcO47Sj38HWGuBymflnXp iiEYyZNoV70BoMsLDgElzk5WpcVr9bGRh4GJ+kV8= Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 58E03F802E8; Sat, 25 Mar 2023 15:23:49 +0100 (CET) To: Banajit Goswami , Jaroslav Kysela , Takashi Iwai Subject: [PATCH v3 1/1] sound: soc: codecs: wcd-mbhc-v2: expose ALSA control for jack Date: Sat, 25 Mar 2023 15:21:42 +0100 In-Reply-To: <20230325142142.24337-1-me@dylanvanassche.be> References: <20230325142142.24337-1-me@dylanvanassche.be> X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <167975422905.26.343811493761575023@mailman-core.alsa-project.org> X-Patchwork-Original-From: Dylan Van Assche via Alsa-devel From: Dylan Van Assche Reply-To: Dylan Van Assche Cc: Srinivas Kandagatla , Liam Girdwood , Mark Brown , alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, ~postmarketos/upstreaming@lists.sr.ht, phone-devel@vger.kernel.org, Dylan Van Assche , Joel Selvaraj , Caleb Connolly Content-Disposition: inline Jack detection is currently fully functional via the input interface together with multimedia buttons, but is not exposed as an ALSA control. Therefore, ALSA clients such as PulseAudio do not pick up the jack detection events as they only support one of the possible interface (ALSA control or input interface, but not both). Expose the jack events as an ALSA control and input interface to provide ALSA clients both interfaces. Signed-off-by: Dylan Van Assche Tested-by: Joel Selvaraj Tested-by: Caleb Connolly --- sound/soc/codecs/wcd-mbhc-v2.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sound/soc/codecs/wcd-mbhc-v2.c b/sound/soc/codecs/wcd-mbhc-v2.c index 1911750f7445..1b75f49b2858 100644 --- a/sound/soc/codecs/wcd-mbhc-v2.c +++ b/sound/soc/codecs/wcd-mbhc-v2.c @@ -725,6 +725,10 @@ static int wcd_mbhc_initialise(struct wcd_mbhc *mbhc) mutex_lock(&mbhc->lock); + ret = snd_jack_add_new_kctl(mbhc->jack->jack, "Headset Jack", WCD_MBHC_JACK_MASK); + if (ret) + dev_warn(component->dev, "failed creating Headset Jack kctl with err: %d\n", ret); + /* enable HS detection */ if (mbhc->mbhc_cb->hph_pull_up_control_v2) mbhc->mbhc_cb->hph_pull_up_control_v2(component,