Message ID | 20230325142142.24337-2-me@dylanvanassche.be |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp449916vqo; Sat, 25 Mar 2023 07:47:22 -0700 (PDT) X-Google-Smtp-Source: AKy350aHdRpY8Af5P2OGIaXnpiOq1kEWOTm8V3ZiF1Tfz+0UNuG2+UYIpUkACxjO5VevCCyhRWF8 X-Received: by 2002:a17:902:c9d2:b0:1a1:a9a4:ba26 with SMTP id q18-20020a170902c9d200b001a1a9a4ba26mr4851838pld.8.1679755641553; Sat, 25 Mar 2023 07:47:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679755641; cv=none; d=google.com; s=arc-20160816; b=JcsMb11hg0SEmzR/E9kNgP1cqJIlk9Q8yA+bdCEUDoyMb3OjOmeWvk5GroBTw8iVtA HHdlEcUXnCrHln+MLmefCjVWIHfJnG/wIZNWz95x7lTRRfuzTJPg8tj0MjBzK6GH/PLS yFdF/COo8IocOatK95ECh70D1y5iQxZbm9a/7+pG3or2krbheGCjSPY552GPAiX1bgYu 63m2UsRRiCJDKDUxktutSvnrbe+3l7aaTPPwf7GjP2Qo/XUo6oMxWPNqBfhLY/H23Wfj /zcY4MrjnX5FxJbqPgZ7mhDem4N+yjc9JZfd9saMICrWEHvpx3oJAS/au5tECm3KVThJ CX8A== 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=uo56ilykXnyoQsO7PNYE1eo/ncujGlXqfqKWuFiXTd8=; b=Krr7u74J/YLTQ1sSaqfesz4EsFyLYjSlSszLJOfyxuraqvQL6d+GMXS4UcHCAmWHfR EFuRBdJYLXJHzBpxlJDsW7aPQi2MICDjuidnPH/oIx8dDOT7qhU4iT1zo8Q/8WjKRifk 527p/4RJ2M49jSWiu+yEZWHisLS3ypT2q98dG+myQ9qSGtWUe3S68fvsYmhrZUr08rOn L5I7nPkkVNUkwrmfib1CBBAjqSzgiDYNzKHHBO2wq1a00eseGwKmVk+QenjGDrFkyO54 iKs3M5g2zeXB4hCHuU+PK5VemXWdymruDYqReg7K+5MIOIJR9Jh79lDwKykx6kVUnnJf iMqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@dylanvanassche.be header.s=MBO0001 header.b=uc0SbByH; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=dylanvanassche.be Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id li16-20020a170903295000b001a1ad7123d0si20634834plb.555.2023.03.25.07.47.08; Sat, 25 Mar 2023 07:47:21 -0700 (PDT) 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 header.i=@dylanvanassche.be header.s=MBO0001 header.b=uc0SbByH; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=dylanvanassche.be Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231473AbjCYOWI (ORCPT <rfc822;makky5685@gmail.com> + 99 others); Sat, 25 Mar 2023 10:22:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41566 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230354AbjCYOWE (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Sat, 25 Mar 2023 10:22:04 -0400 Received: from mout-p-202.mailbox.org (mout-p-202.mailbox.org [IPv6:2001:67c:2050:0:465::202]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 97BFC12F3E; Sat, 25 Mar 2023 07:22:02 -0700 (PDT) Received: from smtp102.mailbox.org (unknown [10.196.197.102]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-202.mailbox.org (Postfix) with ESMTPS id 4PkLqp72BJz9slh; Sat, 25 Mar 2023 15:21:58 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dylanvanassche.be; s=MBO0001; t=1679754119; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=uo56ilykXnyoQsO7PNYE1eo/ncujGlXqfqKWuFiXTd8=; b=uc0SbByHFJBINZfPbjEbTckBFejSkmSJpqHGDy5jtIB4+pnm+eQ1Db7KlQA0eDxpslWxi8 NDYaqBHn85hmfm+L8idgkpbZdCSosAuMA73bdQAB/RHEzPpUZTgtnjkL0Fzrc4V24iLp2q SwczWaznyqpXwEFbZzjfY3LOxjOFQSoEpkOTQjjVIr/0WWxGOBy0H0LVZ7J3xM+PPTDOs9 vwMpLJzQzBeoR3OWreCifLCx+OqrC9VFVtdW773TpTOw2Z+dJsyVtcWLF7hFhJxxxvAd0l gx+4+G9uGu5qjdRGtxlbWVyXy+HZ+6Ra2NL6E6QxtmV+3is6LlEhRPSRl7jtLA== From: Dylan Van Assche <me@dylanvanassche.be> To: Banajit Goswami <bgoswami@quicinc.com>, Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com> Cc: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>, Liam Girdwood <lgirdwood@gmail.com>, Mark Brown <broonie@kernel.org>, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, ~postmarketos/upstreaming@lists.sr.ht, phone-devel@vger.kernel.org, Dylan Van Assche <me@dylanvanassche.be>, Joel Selvaraj <joelselvaraj.oss@gmail.com>, Caleb Connolly <caleb@connolly.tech> 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 Message-Id: <20230325142142.24337-2-me@dylanvanassche.be> In-Reply-To: <20230325142142.24337-1-me@dylanvanassche.be> References: <20230325142142.24337-1-me@dylanvanassche.be> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1761351451783112515?= X-GMAIL-MSGID: =?utf-8?q?1761351451783112515?= |
Series |
Expose ALSA control for jack
|
|
Commit Message
Dylan Van Assche
March 25, 2023, 2:21 p.m. UTC
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 <me@dylanvanassche.be> Tested-by: Joel Selvaraj <joelselvaraj.oss@gmail.com> Tested-by: Caleb Connolly <caleb@connolly.tech> --- sound/soc/codecs/wcd-mbhc-v2.c | 4 ++++ 1 file changed, 4 insertions(+)
Comments
On Sat, Mar 25, 2023 at 03:21:42PM +0100, Dylan Van Assche wrote: > > 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); > + No, drivers should not be open coding userspace reporting - there is no reason for this device to be special, or for this device to duplicate what machine drivers and the core are doing. Any configuration should be done by the machine driver, the ASoC core jack handling already creates userspace controls when asked.
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,