From patchwork Wed Aug 2 17:57:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alper Nebi Yasak X-Patchwork-Id: 13338690 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 1DF74C001DF for ; Wed, 2 Aug 2023 17:59:55 +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 37006820; Wed, 2 Aug 2023 19:59:04 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 37006820 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1690999194; bh=5u1Ny99g6NHLLGYkq00QMh64p+nGQH1ZFYlntEYOsTI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=t5QEqhci4T9HS0SkSMz2+pq4vzNmzu6GpBWfGVqJPauxbw/3weyst72U15MOvIuaZ RE3TlDBUygRls8oGg3Lr7yoiKYydHe0AMwnbIlrcpfospSGXL7iUr1Cq5RJXLuwfn8 I9zPoaYCx9N92QrdGc3ryVLO//ivmeELX0LvJHSo= Received: by alsa1.perex.cz (Postfix, from userid 50401) id CEAFAF80564; Wed, 2 Aug 2023 19:58:14 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 33269F80553; Wed, 2 Aug 2023 19:58:14 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 3E157F80535; Wed, 2 Aug 2023 19:58:08 +0200 (CEST) Received: from mail-wr1-x430.google.com (mail-wr1-x430.google.com [IPv6:2a00:1450:4864:20::430]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 1AB9CF8016D for ; Wed, 2 Aug 2023 19:57:58 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 1AB9CF8016D Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20221208 header.b=kZWYUQ2z Received: by mail-wr1-x430.google.com with SMTP id ffacd0b85a97d-317c11517a0so3447f8f.0 for ; Wed, 02 Aug 2023 10:57:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690999076; x=1691603876; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=brF3soBTEQ7lATGtnS3zYxb7mTThtaUthI8D9XqkA8U=; b=kZWYUQ2zZqRsD5oZlb5Tp99pT8j2KFnXx/x0wYpcz3Ah+nAL+XycehI0yWOotAftmg Zq1+7eTn8w4mVc3czxO7dqDi9+Idxh/kp+08TSOmFudi+6m/GU/xgGcR8ZNoo6f4zYqJ TBXShkSvrwbDN9hr3vP9r3P/Hc7RBRyeHCz5nrPiLF76GrjqwW8YQeM5ynJr5fSA/KSJ pXBKvI9BVt7GpJl6NxZBndooXEhrO9TsuC3YRKAhl0S37bi/w2tGttNvBeQsJ6Vhu+3y mOfG4sTPucFQdCX+SQQddJE6b5ewcSmuJFQaZxsP8/EJB1IqAyKhOeRgxA4IqODXHj+f VMrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690999076; x=1691603876; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=brF3soBTEQ7lATGtnS3zYxb7mTThtaUthI8D9XqkA8U=; b=INORoGqNeLxFVGG6oG9/80q8bBAeyZ0U10d2ql9ISCwdxh/Q9izXMjKmleMXn76xbG 90DMH1/Jz/Nih22ogSh0pJdUel5ENMvCMdGI5p7ud826tlhVBaKslh4ggRHSl3DAX8IC p1GITUCPvVstf1sBkMn4pcys8oH5njCPaMSp0rkW1KFBQ97/ULOfRyae+4ym78tGAhpQ njUgDSFrJxlNrRaobCIrevinWjRpZoMRB0ifDy1Jk74PTcwSLo+puoP/en9Dd4in1kRN coWCrAKjJhkkgBpqB1fuoJ1Es/z1hARcQ4nKkzCTE0NeBzPGqXHJEHhBnQ+ftM6ePM9w Endw== X-Gm-Message-State: ABy/qLasPStZ7t1Fm5Lm8X3gpMm6rbzdv3zQG0+zfiLOL54kq8j/tOee jk/kLvBUbbBYU/LIKmzpEojP8oUmqbY= X-Google-Smtp-Source: APBJJlGS3n72jelR+5CW5X/s/y1sftl/stCBASnlJP6scTtObuQyQ2mFLQUolQRV7m0Ede6z6aQhzw== X-Received: by 2002:adf:e546:0:b0:317:6570:afec with SMTP id z6-20020adfe546000000b003176570afecmr5701405wrm.3.1690999076398; Wed, 02 Aug 2023 10:57:56 -0700 (PDT) Received: from ALPER-PC.. ([178.233.24.1]) by smtp.gmail.com with ESMTPSA id l23-20020a7bc457000000b003fe20db88ebsm2192439wmi.31.2023.08.02.10.57.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Aug 2023 10:57:56 -0700 (PDT) From: Alper Nebi Yasak To: alsa-devel@alsa-project.org Cc: Cezary Rojewski , Alper Nebi Yasak , Mark Brown , Liam Girdwood , Takashi Iwai , AngeloGioacchino Del Regno , Jaroslav Kysela , linux-kernel@vger.kernel.org, Akihiko Odaki , Pierre-Louis Bossart , Matthias Brugger , =?utf-8?q?N=C3=ADcolas_F_=2E_R_?= =?utf-8?q?=2E_A_=2E_Prado?= Subject: [PATCH 01/27] ASoC: amd: acp-da7219-max98357a: Map missing jack kcontrols Date: Wed, 2 Aug 2023 20:57:11 +0300 Message-Id: <20230802175737.263412-2-alpernebiyasak@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230802175737.263412-1-alpernebiyasak@gmail.com> References: <20230802175737.263412-1-alpernebiyasak@gmail.com> MIME-Version: 1.0 Message-ID-Hash: IDW322FA326OTL4PRYP6HPIY2EK5DVBJ X-Message-ID-Hash: IDW322FA326OTL4PRYP6HPIY2EK5DVBJ X-MailFrom: alpernebiyasak@gmail.com 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: This driver does not properly map jack pins to kcontrols that PulseAudio and PipeWire need to handle jack detection events. The DA7219 codec used here can detect Headphones, Headset Mic and Line Out connections. Expose each to userspace as kcontrols and add the necessary widgets. Signed-off-by: Alper Nebi Yasak --- sound/soc/amd/acp-da7219-max98357a.c | 41 +++++++++++++++++++++------- 1 file changed, 31 insertions(+), 10 deletions(-) diff --git a/sound/soc/amd/acp-da7219-max98357a.c b/sound/soc/amd/acp-da7219-max98357a.c index 7464ca2b596c..9e3133bec2b1 100644 --- a/sound/soc/amd/acp-da7219-max98357a.c +++ b/sound/soc/amd/acp-da7219-max98357a.c @@ -28,6 +28,21 @@ #define RT5682_PLL_FREQ (48000 * 512) static struct snd_soc_jack cz_jack; +static struct snd_soc_jack_pin cz_jack_pins[] = { + { + .pin = "Headphone Jack", + .mask = SND_JACK_HEADPHONE, + }, + { + .pin = "Headset Mic", + .mask = SND_JACK_MICROPHONE, + }, + { + .pin = "Line Out", + .mask = SND_JACK_LINEOUT, + }, +}; + static struct clk *da7219_dai_wclk; static struct clk *da7219_dai_bclk; static struct clk *rt5682_dai_wclk; @@ -66,11 +81,13 @@ static int cz_da7219_init(struct snd_soc_pcm_runtime *rtd) if (IS_ERR(da7219_dai_bclk)) return PTR_ERR(da7219_dai_bclk); - ret = snd_soc_card_jack_new(card, "Headset Jack", - SND_JACK_HEADSET | SND_JACK_LINEOUT | - SND_JACK_BTN_0 | SND_JACK_BTN_1 | - SND_JACK_BTN_2 | SND_JACK_BTN_3, - &cz_jack); + ret = snd_soc_card_jack_new_pins(card, "Headset Jack", + SND_JACK_HEADSET | SND_JACK_LINEOUT | + SND_JACK_BTN_0 | SND_JACK_BTN_1 | + SND_JACK_BTN_2 | SND_JACK_BTN_3, + &cz_jack, + cz_jack_pins, + ARRAY_SIZE(cz_jack_pins)); if (ret) { dev_err(card->dev, "HP jack creation failed %d\n", ret); return ret; @@ -146,11 +163,13 @@ static int cz_rt5682_init(struct snd_soc_pcm_runtime *rtd) if (IS_ERR(rt5682_dai_bclk)) return PTR_ERR(rt5682_dai_bclk); - ret = snd_soc_card_jack_new(card, "Headset Jack", - SND_JACK_HEADSET | SND_JACK_LINEOUT | - SND_JACK_BTN_0 | SND_JACK_BTN_1 | - SND_JACK_BTN_2 | SND_JACK_BTN_3, - &cz_jack); + ret = snd_soc_card_jack_new_pins(card, "Headset Jack", + SND_JACK_HEADSET | SND_JACK_LINEOUT | + SND_JACK_BTN_0 | SND_JACK_BTN_1 | + SND_JACK_BTN_2 | SND_JACK_BTN_3, + &cz_jack, + cz_jack_pins, + ARRAY_SIZE(cz_jack_pins)); if (ret) { dev_err(card->dev, "HP jack creation failed %d\n", ret); return ret; @@ -631,6 +650,7 @@ static struct snd_soc_dai_link cz_dai_5682_98357[] = { static const struct snd_soc_dapm_widget cz_widgets[] = { SND_SOC_DAPM_HP("Headphones", NULL), SND_SOC_DAPM_SPK("Speakers", NULL), + SND_SOC_DAPM_LINE("Line Out", NULL), SND_SOC_DAPM_MIC("Headset Mic", NULL), SND_SOC_DAPM_MIC("Int Mic", NULL), }; @@ -654,6 +674,7 @@ static const struct snd_soc_dapm_route cz_rt5682_audio_route[] = { static const struct snd_kcontrol_new cz_mc_controls[] = { SOC_DAPM_PIN_SWITCH("Headphones"), SOC_DAPM_PIN_SWITCH("Speakers"), + SOC_DAPM_PIN_SWITCH("Line Out"), SOC_DAPM_PIN_SWITCH("Headset Mic"), SOC_DAPM_PIN_SWITCH("Int Mic"), }; From patchwork Wed Aug 2 17:57:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alper Nebi Yasak X-Patchwork-Id: 13338691 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 CFEF7C001DF for ; Wed, 2 Aug 2023 18:00: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 215D9847; Wed, 2 Aug 2023 19:59:12 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 215D9847 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1690999202; bh=qRiSsKMkQKXsuRAidp00HWU9hPfdt4q3IhNuTBL8Ilk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=q6epVmnNk1PRIunet4dWRxGDUP0N1kZouiySujIKwzzTW2fnKzGq4obx5Ri4H4KQX Ptt3O1qxo46lxeQgLhwlWSudzGE88KIs65B8XAZ1Xz97Mh2upybFZMARCEYqwK5g+F osilMj59u7uqKAt5DpFvAynG/s1cTTfRvoBtq614= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 1AC20F8057E; Wed, 2 Aug 2023 19:58:18 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 0999EF8057E; Wed, 2 Aug 2023 19:58:18 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 22687F80520; Wed, 2 Aug 2023 19:58:09 +0200 (CEST) Received: from mail-lj1-x22e.google.com (mail-lj1-x22e.google.com [IPv6:2a00:1450:4864:20::22e]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id CA240F801D5 for ; Wed, 2 Aug 2023 19:58:00 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz CA240F801D5 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20221208 header.b=mzEQx3XK Received: by mail-lj1-x22e.google.com with SMTP id 38308e7fff4ca-2b9c55e0fbeso683841fa.2 for ; Wed, 02 Aug 2023 10:58:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690999079; x=1691603879; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ci67Td9oMJsLWbpviA9NcbMT0ChoVa0sXVbZDuba2eI=; b=mzEQx3XK3X+y5S6AkjDT4iX/ITs0YrzNj1ep4Yo+ghza6vJhgwrxFYPNIaWuna9+zk hjr35fZEIIj4OOMJRBhNKCWwInDeO+Mt61eTr226d5m/hfS+FC6ApSLoInZbn/4Vl591 VX+neJj2OtSvBnic97wVGQTJLOcE6CUL/kfPribacVzgWGJUb0K2Vug577NVz2A8zU9j fNYFE7i8Pp3P//3Qtjpo++eP8/JBYO2c6YyzkygvLcgJrx68Fj5aBQ4lYpO/LWnc9umK hyB+xbwRspqMBXYDQO3tbO3tNa6CSTjpKhTwpR7eCDDV7tPPPa9IwPs+mvrynyPllz9N Je+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690999079; x=1691603879; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ci67Td9oMJsLWbpviA9NcbMT0ChoVa0sXVbZDuba2eI=; b=kNkJwx+PV0qnwfKXwCl/9Gtbw/NgCmzCW9o9gROj8PK/IdubOsGFM+7HjOvG6aCzFP bzhvQZpxcN3ZXG/A10Ag6/QjVq2D9I3H2IAF0unve8bkybDr27NgKPQjAsUbWyIXfqvG 8ijmMEbrwcMFBwZPpA9AM7pfYe+RgpczQXKfY3KH2LZpx69GHI6DinwN3FH68Z3KRlDI HOOrybjBiSGLSGgow2nOrM5qKNSwBj2HK717A4Pi8OLdL+sMEM8k3H8wkw4PKYqB5FqW iQt07WeP9BpiRSI7rLv5+43PaPV2Ob356u4N+pS9Cw1uHwWzTGn3P3jIW/Ibdo1aT3g0 qI9Q== X-Gm-Message-State: ABy/qLbbDVJtF6BuI/0toPekWLxhgovWP7RbuV+g99KphlfTvD8qySXL 9nJPZogwBtuAzpYY3syj8frTgY0e6fo= X-Google-Smtp-Source: APBJJlEzrYBdkRnwRPJ4NN3iObXeOWT2+1vk/p4PnAN6HWDNRkwLIBV6+U3Nxn7N1ETTwqwFIcZb4A== X-Received: by 2002:a2e:3001:0:b0:2b9:ef0a:7d4b with SMTP id w1-20020a2e3001000000b002b9ef0a7d4bmr5792077ljw.31.1690999078378; Wed, 02 Aug 2023 10:57:58 -0700 (PDT) Received: from ALPER-PC.. ([178.233.24.1]) by smtp.gmail.com with ESMTPSA id l23-20020a7bc457000000b003fe20db88ebsm2192439wmi.31.2023.08.02.10.57.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Aug 2023 10:57:57 -0700 (PDT) From: Alper Nebi Yasak To: alsa-devel@alsa-project.org Cc: Cezary Rojewski , Alper Nebi Yasak , Mark Brown , Liam Girdwood , Takashi Iwai , AngeloGioacchino Del Regno , Jaroslav Kysela , linux-kernel@vger.kernel.org, Akihiko Odaki , Pierre-Louis Bossart , Matthias Brugger , =?utf-8?q?N=C3=ADcolas_F_=2E_R_?= =?utf-8?q?=2E_A_=2E_Prado?= Subject: [PATCH 02/27] ASoC: amd: acp-rt5645: Map missing jack kcontrols Date: Wed, 2 Aug 2023 20:57:12 +0300 Message-Id: <20230802175737.263412-3-alpernebiyasak@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230802175737.263412-1-alpernebiyasak@gmail.com> References: <20230802175737.263412-1-alpernebiyasak@gmail.com> MIME-Version: 1.0 Message-ID-Hash: MU3SS5YT6DLFDZXSGC7OCBV7DFRLSCL5 X-Message-ID-Hash: MU3SS5YT6DLFDZXSGC7OCBV7DFRLSCL5 X-MailFrom: alpernebiyasak@gmail.com 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: This driver does not properly map jack pins to kcontrols that PulseAudio and PipeWire need to handle jack detection events. The RT5645 codec used here can detect Headphone and Headset Mic connections. Expose both to userspace as kcontrols. Signed-off-by: Alper Nebi Yasak --- sound/soc/amd/acp-rt5645.c | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/sound/soc/amd/acp-rt5645.c b/sound/soc/amd/acp-rt5645.c index 532aa98a2241..c8ed1e0b1ccd 100644 --- a/sound/soc/amd/acp-rt5645.c +++ b/sound/soc/amd/acp-rt5645.c @@ -42,6 +42,16 @@ #define CZ_PLAT_CLK 24000000 static struct snd_soc_jack cz_jack; +static struct snd_soc_jack_pin cz_jack_pins[] = { + { + .pin = "Headphones", + .mask = SND_JACK_HEADPHONE, + }, + { + .pin = "Headset Mic", + .mask = SND_JACK_MICROPHONE, + }, +}; static int cz_aif1_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params) @@ -76,11 +86,13 @@ static int cz_init(struct snd_soc_pcm_runtime *rtd) codec = asoc_rtd_to_codec(rtd, 0)->component; card = rtd->card; - ret = snd_soc_card_jack_new(card, "Headset Jack", - SND_JACK_HEADPHONE | SND_JACK_MICROPHONE | - SND_JACK_BTN_0 | SND_JACK_BTN_1 | - SND_JACK_BTN_2 | SND_JACK_BTN_3, - &cz_jack); + ret = snd_soc_card_jack_new_pins(card, "Headset Jack", + SND_JACK_HEADPHONE | SND_JACK_MICROPHONE | + SND_JACK_BTN_0 | SND_JACK_BTN_1 | + SND_JACK_BTN_2 | SND_JACK_BTN_3, + &cz_jack, + cz_jack_pins, + ARRAY_SIZE(cz_jack_pins)); if (ret) { dev_err(card->dev, "HP jack creation failed %d\n", ret); return ret; From patchwork Wed Aug 2 17:57:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alper Nebi Yasak X-Patchwork-Id: 13338716 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 DAE86C001DF for ; Wed, 2 Aug 2023 18:06:32 +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 64DF9DF4; Wed, 2 Aug 2023 20:05:40 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 64DF9DF4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1690999590; bh=v25E65+35t5pP0V64D3Qgxwl4xwU6AWXEASyntTLjSg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=cgfHXdgCHMjgQpabNgZ0AKDxhcmVQm2oN3ZCOg4smXOt9rzgqWS9rC247EljlOb0P vyhuRArsvq+ji+fSGxh2W/BhuU2haCgIZA7lUMO+NwS4UXkXIISNG2i2mS7gMIAaLw eL1p3E1vgZWvJ+izzznmANTV5BAxY/2cUqquFa78= Received: by alsa1.perex.cz (Postfix, from userid 50401) id C49C6F8059F; Wed, 2 Aug 2023 19:59:38 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id D9448F806A8; Wed, 2 Aug 2023 19:59:37 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 9C91AF80687; Wed, 2 Aug 2023 19:59:24 +0200 (CEST) Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com [IPv6:2a00:1450:4864:20::330]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 4FE54F8025A for ; Wed, 2 Aug 2023 19:58:02 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 4FE54F8025A Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20221208 header.b=hvqAAqCj Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-3fbc5d5742bso1289765e9.2 for ; Wed, 02 Aug 2023 10:58:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690999080; x=1691603880; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=E8q6oeJAXCtu9hv15ODqXQ4DGTBLuJ63S8PbYuJF85k=; b=hvqAAqCj6zLmA/e0ULUUNBKF+kdiqCvNGh4AfBHwGFDJ7Rbwbps4cpWNjeCUwQi1Fy O+lf+6UUgcFb8NSipYOOu1CQCXQOdWGEe6JYUM6xwdGZMm/Ce9m/KBAN5k0lvEUUH0uk yxcd4hlJOJvCRPXZU7lNwuM7JW0oYDgbB1/tHAIXhTJf0OSkLPza5GHCY+idS2GbTR5e zzJQkTO9jGj8gy5+GHCHrkLFs+tcOfCvnBKkwhAVCy5LyNLTU0QT/LVbvaKA5w0/uruD ndTFEMw+SsH2n9nEWRm9ZLkXoby/GshpBmXmQTkaeBH0XJjzVr5XKlHIQKGymR8/cCHv 30/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690999080; x=1691603880; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=E8q6oeJAXCtu9hv15ODqXQ4DGTBLuJ63S8PbYuJF85k=; b=W2mwkT04lv2VqaAR0yOZaIzHB3f9TkUGkBIv5O4XVT6tVRxbjIO6Yrsx9pG+r7gK// FbOBe1YKne3vUzclyNV+KQGaxq+i8wG7qxnVH28Ea6rLsUNTQTV8Ky1u69qiogGT9Z8E qsI3+kF4DOVeEjFKGnW1E6QWVqGs8+6HJyOKgfO9G9qNsYwTb70JencXS5QyEmvTJPxC IXR7JKUGWb8nchR45SbIT6/zZqU8XUG9vkaQUs/HsHNEZu0bQ8RePlxtT+fwPrNtNS95 DT3r59vZZBqTfCMpZJBqEOpcXeNJLf1tl4V4C3ZUjwCyJ9wf7n9zviKdL3IseLqU6Uzk sXVQ== X-Gm-Message-State: ABy/qLaGQDYPDkqwsuUptixiNwkjwGP+vFE718HsgWPN+1XhzUwl6iCG 8yK14DC2cYQRzD6l3rPbo25oj6lsubU= X-Google-Smtp-Source: APBJJlGUrfqpF/yOLbHFeZQc7xwlzqX/qHeUy+3Q3sxp65BzfkvHzfmYba5BF+W7DC9EZ6VUK/bQsw== X-Received: by 2002:a5d:428f:0:b0:314:2f5b:2ce with SMTP id k15-20020a5d428f000000b003142f5b02cemr5303270wrq.12.1690999080395; Wed, 02 Aug 2023 10:58:00 -0700 (PDT) Received: from ALPER-PC.. ([178.233.24.1]) by smtp.gmail.com with ESMTPSA id l23-20020a7bc457000000b003fe20db88ebsm2192439wmi.31.2023.08.02.10.57.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Aug 2023 10:57:59 -0700 (PDT) From: Alper Nebi Yasak To: alsa-devel@alsa-project.org Cc: Cezary Rojewski , Alper Nebi Yasak , Mark Brown , Liam Girdwood , Takashi Iwai , AngeloGioacchino Del Regno , Jaroslav Kysela , linux-kernel@vger.kernel.org, Akihiko Odaki , Pierre-Louis Bossart , Matthias Brugger , =?utf-8?q?N=C3=ADcolas_F_=2E_R_?= =?utf-8?q?=2E_A_=2E_Prado?= Subject: [PATCH 03/27] ASoC: amd: acp: Map missing jack kcontrols Date: Wed, 2 Aug 2023 20:57:13 +0300 Message-Id: <20230802175737.263412-4-alpernebiyasak@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230802175737.263412-1-alpernebiyasak@gmail.com> References: <20230802175737.263412-1-alpernebiyasak@gmail.com> MIME-Version: 1.0 Message-ID-Hash: OPLSN4PL2VEVLNCB44Z4JCVMM6O3MYAJ X-Message-ID-Hash: OPLSN4PL2VEVLNCB44Z4JCVMM6O3MYAJ X-MailFrom: alpernebiyasak@gmail.com 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: This driver does not properly map jack pins to kcontrols that PulseAudio and PipeWire need to handle jack detection events. The RT5682, RT5682s, NAU8825 and NAU8821 codecs used here can detect Headphone and Headset Mic connections. Expose both to userspace as kcontrols and add the necessary widgets. Split the jack and pin structs per-codec to accommodate for per-codec differences. Signed-off-by: Alper Nebi Yasak --- Do I have to keep the lowercase "jack" in the last one instead? Should the SND_JACK_LINEOUT be removed from the jack_new_pins calls? I don't know why it was split as vg_headset / pco_jack, maybe everything could be merged instead? sound/soc/amd/acp/acp-mach-common.c | 226 ++++++++++++++++++++++------ 1 file changed, 182 insertions(+), 44 deletions(-) diff --git a/sound/soc/amd/acp/acp-mach-common.c b/sound/soc/amd/acp/acp-mach-common.c index ff5cbc4a6427..f3abaa182fbb 100644 --- a/sound/soc/amd/acp/acp-mach-common.c +++ b/sound/soc/amd/acp/acp-mach-common.c @@ -28,7 +28,6 @@ #include "../../codecs/nau8821.h" #include "acp-mach.h" -static struct snd_soc_jack vg_headset; #define PCO_PLAT_CLK 48000000 #define RT5682_PLL_FREQ (48000 * 512) #define DUAL_CHANNEL 2 @@ -52,8 +51,6 @@ const struct dmi_system_id acp_quirk_table[] = { }; EXPORT_SYMBOL_GPL(acp_quirk_table); -static struct snd_soc_jack pco_jack; - static const unsigned int channels[] = { DUAL_CHANNEL, }; @@ -87,6 +84,28 @@ static int acp_clk_enable(struct acp_card_drvdata *drvdata, SND_SOC_DAILINK_DEF(rt5682, DAILINK_COMP_ARRAY(COMP_CODEC("i2c-10EC5682:00", "rt5682-aif1"))); +static struct snd_soc_jack rt5682_jack; +static struct snd_soc_jack_pin rt5682_jack_pins[] = { + { + .pin = "Headphone Jack", + .mask = SND_JACK_HEADPHONE, + }, + { + .pin = "Headset Mic", + .mask = SND_JACK_MICROPHONE, + }, +}; + +static const struct snd_kcontrol_new rt5682_controls[] = { + SOC_DAPM_PIN_SWITCH("Headphone Jack"), + SOC_DAPM_PIN_SWITCH("Headset Mic"), +}; + +static const struct snd_soc_dapm_widget rt5682_widgets[] = { + SND_SOC_DAPM_HP("Headphone Jack", NULL), + SND_SOC_DAPM_MIC("Headset Mic", NULL), +}; + static const struct snd_soc_dapm_route rt5682_map[] = { { "Headphone Jack", NULL, "HPOL" }, { "Headphone Jack", NULL, "HPOR" }, @@ -110,22 +129,38 @@ static int acp_card_rt5682_init(struct snd_soc_pcm_runtime *rtd) drvdata->wclk = clk_get(component->dev, "rt5682-dai-wclk"); drvdata->bclk = clk_get(component->dev, "rt5682-dai-bclk"); - ret = snd_soc_card_jack_new(card, "Headset Jack", - SND_JACK_HEADSET | SND_JACK_LINEOUT | - SND_JACK_BTN_0 | SND_JACK_BTN_1 | - SND_JACK_BTN_2 | SND_JACK_BTN_3, - &pco_jack); + ret = snd_soc_dapm_new_controls(&card->dapm, rt5682_widgets, + ARRAY_SIZE(rt5682_widgets)); + if (ret) { + dev_err(rtd->dev, "unable to add widget dapm controls, ret %d\n", ret); + return ret; + } + + ret = snd_soc_add_card_controls(card, rt5682_controls, + ARRAY_SIZE(rt5682_controls)); + if (ret) { + dev_err(rtd->dev, "unable to add card controls, ret %d\n", ret); + return ret; + } + + ret = snd_soc_card_jack_new_pins(card, "Headset Jack", + SND_JACK_HEADSET | SND_JACK_LINEOUT | + SND_JACK_BTN_0 | SND_JACK_BTN_1 | + SND_JACK_BTN_2 | SND_JACK_BTN_3, + &rt5682_jack, + rt5682_jack_pins, + ARRAY_SIZE(rt5682_jack_pins)); if (ret) { dev_err(card->dev, "HP jack creation failed %d\n", ret); return ret; } - snd_jack_set_key(pco_jack.jack, SND_JACK_BTN_0, KEY_PLAYPAUSE); - snd_jack_set_key(pco_jack.jack, SND_JACK_BTN_1, KEY_VOICECOMMAND); - snd_jack_set_key(pco_jack.jack, SND_JACK_BTN_2, KEY_VOLUMEUP); - snd_jack_set_key(pco_jack.jack, SND_JACK_BTN_3, KEY_VOLUMEDOWN); + snd_jack_set_key(rt5682_jack.jack, SND_JACK_BTN_0, KEY_PLAYPAUSE); + snd_jack_set_key(rt5682_jack.jack, SND_JACK_BTN_1, KEY_VOICECOMMAND); + snd_jack_set_key(rt5682_jack.jack, SND_JACK_BTN_2, KEY_VOLUMEUP); + snd_jack_set_key(rt5682_jack.jack, SND_JACK_BTN_3, KEY_VOLUMEDOWN); - ret = snd_soc_component_set_jack(component, &pco_jack, NULL); + ret = snd_soc_component_set_jack(component, &rt5682_jack, NULL); if (ret) { dev_err(rtd->dev, "Headset Jack call-back failed: %d\n", ret); return ret; @@ -275,6 +310,28 @@ static const struct snd_soc_ops acp_card_rt5682_ops = { SND_SOC_DAILINK_DEF(rt5682s, DAILINK_COMP_ARRAY(COMP_CODEC("i2c-RTL5682:00", "rt5682s-aif1"))); +static struct snd_soc_jack rt5682s_jack; +static struct snd_soc_jack_pin rt5682s_jack_pins[] = { + { + .pin = "Headphone Jack", + .mask = SND_JACK_HEADPHONE, + }, + { + .pin = "Headset Mic", + .mask = SND_JACK_MICROPHONE, + }, +}; + +static const struct snd_kcontrol_new rt5682s_controls[] = { + SOC_DAPM_PIN_SWITCH("Headphone Jack"), + SOC_DAPM_PIN_SWITCH("Headset Mic"), +}; + +static const struct snd_soc_dapm_widget rt5682s_widgets[] = { + SND_SOC_DAPM_HP("Headphone Jack", NULL), + SND_SOC_DAPM_MIC("Headset Mic", NULL), +}; + static const struct snd_soc_dapm_route rt5682s_map[] = { { "Headphone Jack", NULL, "HPOL" }, { "Headphone Jack", NULL, "HPOR" }, @@ -299,22 +356,38 @@ static int acp_card_rt5682s_init(struct snd_soc_pcm_runtime *rtd) drvdata->bclk = clk_get(component->dev, "rt5682-dai-bclk"); } - ret = snd_soc_card_jack_new(card, "Headset Jack", - SND_JACK_HEADSET | SND_JACK_LINEOUT | - SND_JACK_BTN_0 | SND_JACK_BTN_1 | - SND_JACK_BTN_2 | SND_JACK_BTN_3, - &pco_jack); + ret = snd_soc_dapm_new_controls(&card->dapm, rt5682s_widgets, + ARRAY_SIZE(rt5682s_widgets)); + if (ret) { + dev_err(rtd->dev, "unable to add widget dapm controls, ret %d\n", ret); + return ret; + } + + ret = snd_soc_add_card_controls(card, rt5682s_controls, + ARRAY_SIZE(rt5682s_controls)); + if (ret) { + dev_err(rtd->dev, "unable to add card controls, ret %d\n", ret); + return ret; + } + + ret = snd_soc_card_jack_new_pins(card, "Headset Jack", + SND_JACK_HEADSET | SND_JACK_LINEOUT | + SND_JACK_BTN_0 | SND_JACK_BTN_1 | + SND_JACK_BTN_2 | SND_JACK_BTN_3, + &rt5682s_jack, + rt5682s_jack_pins, + ARRAY_SIZE(rt5682s_jack_pins)); if (ret) { dev_err(card->dev, "HP jack creation failed %d\n", ret); return ret; } - snd_jack_set_key(pco_jack.jack, SND_JACK_BTN_0, KEY_PLAYPAUSE); - snd_jack_set_key(pco_jack.jack, SND_JACK_BTN_1, KEY_VOICECOMMAND); - snd_jack_set_key(pco_jack.jack, SND_JACK_BTN_2, KEY_VOLUMEUP); - snd_jack_set_key(pco_jack.jack, SND_JACK_BTN_3, KEY_VOLUMEDOWN); + snd_jack_set_key(rt5682s_jack.jack, SND_JACK_BTN_0, KEY_PLAYPAUSE); + snd_jack_set_key(rt5682s_jack.jack, SND_JACK_BTN_1, KEY_VOICECOMMAND); + snd_jack_set_key(rt5682s_jack.jack, SND_JACK_BTN_2, KEY_VOLUMEUP); + snd_jack_set_key(rt5682s_jack.jack, SND_JACK_BTN_3, KEY_VOLUMEDOWN); - ret = snd_soc_component_set_jack(component, &pco_jack, NULL); + ret = snd_soc_component_set_jack(component, &rt5682s_jack, NULL); if (ret) { dev_err(rtd->dev, "Headset Jack call-back failed: %d\n", ret); return ret; @@ -762,6 +835,28 @@ static const struct snd_soc_ops acp_max98388_ops = { SND_SOC_DAILINK_DEF(nau8825, DAILINK_COMP_ARRAY(COMP_CODEC("i2c-10508825:00", "nau8825-hifi"))); +static struct snd_soc_jack nau8825_jack; +static struct snd_soc_jack_pin nau8825_jack_pins[] = { + { + .pin = "Headphone Jack", + .mask = SND_JACK_HEADPHONE, + }, + { + .pin = "Headset Mic", + .mask = SND_JACK_MICROPHONE, + }, +}; + +static const struct snd_kcontrol_new nau8825_controls[] = { + SOC_DAPM_PIN_SWITCH("Headphone Jack"), + SOC_DAPM_PIN_SWITCH("Headset Mic"), +}; + +static const struct snd_soc_dapm_widget nau8825_widgets[] = { + SND_SOC_DAPM_HP("Headphone Jack", NULL), + SND_SOC_DAPM_MIC("Headset Mic", NULL), +}; + static const struct snd_soc_dapm_route nau8825_map[] = { { "Headphone Jack", NULL, "HPOL" }, { "Headphone Jack", NULL, "HPOR" }, @@ -780,22 +875,38 @@ static int acp_card_nau8825_init(struct snd_soc_pcm_runtime *rtd) if (drvdata->hs_codec_id != NAU8825) return -EINVAL; - ret = snd_soc_card_jack_new(card, "Headset Jack", + ret = snd_soc_dapm_new_controls(&card->dapm, nau8825_widgets, + ARRAY_SIZE(nau8825_widgets)); + if (ret) { + dev_err(rtd->dev, "unable to add widget dapm controls, ret %d\n", ret); + return ret; + } + + ret = snd_soc_add_card_controls(card, nau8825_controls, + ARRAY_SIZE(nau8825_controls)); + if (ret) { + dev_err(rtd->dev, "unable to add card controls, ret %d\n", ret); + return ret; + } + + ret = snd_soc_card_jack_new_pins(card, "Headset Jack", SND_JACK_HEADSET | SND_JACK_LINEOUT | SND_JACK_BTN_0 | SND_JACK_BTN_1 | SND_JACK_BTN_2 | SND_JACK_BTN_3, - &pco_jack); + &nau8825_jack, + nau8825_jack_pins, + ARRAY_SIZE(nau8825_jack_pins)); if (ret) { dev_err(card->dev, "HP jack creation failed %d\n", ret); return ret; } - snd_jack_set_key(pco_jack.jack, SND_JACK_BTN_0, KEY_PLAYPAUSE); - snd_jack_set_key(pco_jack.jack, SND_JACK_BTN_1, KEY_VOICECOMMAND); - snd_jack_set_key(pco_jack.jack, SND_JACK_BTN_2, KEY_VOLUMEUP); - snd_jack_set_key(pco_jack.jack, SND_JACK_BTN_3, KEY_VOLUMEDOWN); + snd_jack_set_key(nau8825_jack.jack, SND_JACK_BTN_0, KEY_PLAYPAUSE); + snd_jack_set_key(nau8825_jack.jack, SND_JACK_BTN_1, KEY_VOICECOMMAND); + snd_jack_set_key(nau8825_jack.jack, SND_JACK_BTN_2, KEY_VOLUMEUP); + snd_jack_set_key(nau8825_jack.jack, SND_JACK_BTN_3, KEY_VOLUMEDOWN); - ret = snd_soc_component_set_jack(component, &pco_jack, NULL); + ret = snd_soc_component_set_jack(component, &nau8825_jack, NULL); if (ret) { dev_err(rtd->dev, "Headset Jack call-back failed: %d\n", ret); return ret; @@ -921,8 +1032,25 @@ static int platform_clock_control(struct snd_soc_dapm_widget *w, return ret; } +static struct snd_soc_jack nau8821_jack; +static struct snd_soc_jack_pin nau8821_jack_pins[] = { + { + .pin = "Headphone Jack", + .mask = SND_JACK_HEADPHONE, + }, + { + .pin = "Headset Mic", + .mask = SND_JACK_MICROPHONE, + }, +}; + +static const struct snd_kcontrol_new nau8821_controls[] = { + SOC_DAPM_PIN_SWITCH("Headphone Jack"), + SOC_DAPM_PIN_SWITCH("Headset Mic"), +}; + static const struct snd_soc_dapm_widget nau8821_widgets[] = { - SND_SOC_DAPM_HP("Headphone jack", NULL), + SND_SOC_DAPM_HP("Headphone Jack", NULL), SND_SOC_DAPM_MIC("Headset Mic", NULL), SND_SOC_DAPM_MIC("Int Mic", NULL), SND_SOC_DAPM_SUPPLY("Platform Clock", SND_SOC_NOPM, 0, 0, @@ -932,12 +1060,12 @@ static const struct snd_soc_dapm_widget nau8821_widgets[] = { static const struct snd_soc_dapm_route nau8821_audio_route[] = { /* HP jack connectors - unknown if we have jack detection */ - { "Headphone jack", NULL, "HPOL" }, - { "Headphone jack", NULL, "HPOR" }, + { "Headphone Jack", NULL, "HPOL" }, + { "Headphone Jack", NULL, "HPOR" }, { "MICL", NULL, "Headset Mic" }, { "MICR", NULL, "Headset Mic" }, { "DMIC", NULL, "Int Mic" }, - { "Headphone jack", NULL, "Platform Clock" }, + { "Headphone Jack", NULL, "Platform Clock" }, { "Headset Mic", NULL, "Platform Clock" }, { "Int Mic", NULL, "Platform Clock" }, }; @@ -966,21 +1094,31 @@ static int acp_8821_init(struct snd_soc_pcm_runtime *rtd) return ret; } - ret = snd_soc_card_jack_new(card, "Headset Jack", - SND_JACK_HEADSET | SND_JACK_LINEOUT | - SND_JACK_BTN_0 | SND_JACK_BTN_1 | - SND_JACK_BTN_2 | SND_JACK_BTN_3, - &vg_headset); + ret = snd_soc_add_card_controls(card, nau8821_controls, + ARRAY_SIZE(nau8821_controls)); + if (ret) { + dev_err(rtd->dev, "unable to add card controls, ret %d\n", ret); + return ret; + } + + ret = snd_soc_card_jack_new_pins(card, "Headset Jack", + SND_JACK_HEADSET | SND_JACK_LINEOUT | + SND_JACK_BTN_0 | SND_JACK_BTN_1 | + SND_JACK_BTN_2 | SND_JACK_BTN_3, + &nau8821_jack, + nau8821_jack_pins, + ARRAY_SIZE(nau8821_jack_pins)); if (ret) { dev_err(rtd->dev, "Headset Jack creation failed %d\n", ret); return ret; } - snd_jack_set_key(vg_headset.jack, SND_JACK_BTN_0, KEY_PLAYPAUSE); - snd_jack_set_key(vg_headset.jack, SND_JACK_BTN_1, KEY_VOICECOMMAND); - snd_jack_set_key(vg_headset.jack, SND_JACK_BTN_2, KEY_VOLUMEUP); - snd_jack_set_key(vg_headset.jack, SND_JACK_BTN_3, KEY_VOLUMEDOWN); - nau8821_enable_jack_detect(component, &vg_headset); + snd_jack_set_key(nau8821_jack.jack, SND_JACK_BTN_0, KEY_PLAYPAUSE); + snd_jack_set_key(nau8821_jack.jack, SND_JACK_BTN_1, KEY_VOICECOMMAND); + snd_jack_set_key(nau8821_jack.jack, SND_JACK_BTN_2, KEY_VOLUMEUP); + snd_jack_set_key(nau8821_jack.jack, SND_JACK_BTN_3, KEY_VOLUMEDOWN); + + nau8821_enable_jack_detect(component, &nau8821_jack); return snd_soc_dapm_add_routes(&rtd->card->dapm, nau8821_audio_route, ARRAY_SIZE(nau8821_audio_route)); From patchwork Wed Aug 2 17:57:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alper Nebi Yasak X-Patchwork-Id: 13338717 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 27059C04A94 for ; Wed, 2 Aug 2023 18:06:53 +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 7DE73DF9; Wed, 2 Aug 2023 20:06:01 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 7DE73DF9 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1690999611; bh=LB3ABtDUGjhlh0ba/i8Tv8u5FiRcmzgz7YERD/XEgas=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=OtBcGuy3EAbLb+nfpwx2azOsXx00OtUh44WkTf6b/gREMyHnVhBpZDxqT1siTCXxl /K5TA4e4NZkc/g8BInw36RfJ9lo4xBjaSpfxbZYufhkenYMBe741wMX4AwGJAhPnRl cQmiNgw3X5GLeXhS5uxefo96JRv007NwZI+I+bks= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 2E549F806B9; Wed, 2 Aug 2023 19:59:41 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 4A8F4F806B7; Wed, 2 Aug 2023 19:59:41 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 8C29EF80692; Wed, 2 Aug 2023 19:59:26 +0200 (CEST) Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [IPv6:2a00:1450:4864:20::334]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 10E47F802BE for ; Wed, 2 Aug 2023 19:58:03 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 10E47F802BE Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20221208 header.b=dcwAI3ZO Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-3fe1d9a8ec6so7983855e9.1 for ; Wed, 02 Aug 2023 10:58:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690999082; x=1691603882; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=giLlDxuohbavL/Eh+3qVG6gVGzv5UIQjKSZ5ky1GgcY=; b=dcwAI3ZOa09tYBw11uCkrcP1OCcx4OyU/Z2uu9sLT5AszyF0lL7xMJbuSicjUawgVQ vlq+yryK2kPnMHPGqA5rcrihs4+1jXfiYJqkcQJhcdhlmTdFA9QrA8uIJ9qEcdDjvvwi gSen/5PdQG2pvGa0ablMsZbEGUlO9cl3Q4hvS/WeCKdeTkOi81yTmdc2Gd/mH+EdZOnw YFeNflvIxZHVme6PqVUEaION84HAS6+Q7qydRmDPcdFWKNA95ES/zGOlztxFs2x+n/Ub 4pTXJtsw3z+RinV7DbimCQmbIKC2n6RdBY6FICujmbL94WxJ/9++gOhbx9bY9svVsoH3 t4kw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690999082; x=1691603882; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=giLlDxuohbavL/Eh+3qVG6gVGzv5UIQjKSZ5ky1GgcY=; b=KDmENEmNEWjK/cLxPWYeM/rmbwdTxFhX4pX5oNI1qlDMHPxlbYWB9X5SkyslwGyAVC /3QvDmXkW4U/+MDX3i7Ixyy/GVXh0Eu35ulPSrskH6a8f+I11ykaGbf7p77d0rlM1co0 HmarRXP4pIi60phLO1FsxyVzJKZp7iEpN5RIXRKzgxD6GaI04CV7BzWtptxZSPepR0MU iCC3JQn4F2+dEgEwrVq/blhIKYtYAZ1DEBDzSrw5+MXldkzyTzyrZ4m1XUDTmr0OhhOo jqMJqwZsLbJ5GDjXskAcjWMIQH0KmwikXjhbLH5c29IBz+73jeTnrlyHlqqQxcOsOLAI ioaw== X-Gm-Message-State: ABy/qLZRQ4N5BNl7IOF9UABQY/zr25taMPQ6lUmnAEWk1++qrPtOFlF5 R/JGQvhb/AWyH4cIOG828IEL5tdk10A= X-Google-Smtp-Source: APBJJlHsDaCjAi4zBTU9xrF27hqoMFD5e0yhCUCynaZ/vT7KHt4B0IwuLDdQmQ7FEXmHdswWOSfPSw== X-Received: by 2002:a05:6000:1152:b0:317:58a4:916f with SMTP id d18-20020a056000115200b0031758a4916fmr6105223wrx.33.1690999082349; Wed, 02 Aug 2023 10:58:02 -0700 (PDT) Received: from ALPER-PC.. ([178.233.24.1]) by smtp.gmail.com with ESMTPSA id l23-20020a7bc457000000b003fe20db88ebsm2192439wmi.31.2023.08.02.10.58.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Aug 2023 10:58:01 -0700 (PDT) From: Alper Nebi Yasak To: alsa-devel@alsa-project.org Cc: Cezary Rojewski , Alper Nebi Yasak , Mark Brown , Liam Girdwood , Takashi Iwai , AngeloGioacchino Del Regno , Jaroslav Kysela , linux-kernel@vger.kernel.org, Akihiko Odaki , Pierre-Louis Bossart , Matthias Brugger , =?utf-8?q?N=C3=ADcolas_F_=2E_R_?= =?utf-8?q?=2E_A_=2E_Prado?= Subject: [PATCH 04/27] ASoC: amd: acp3x-rt5682-max9836: Map missing jack kcontrols Date: Wed, 2 Aug 2023 20:57:14 +0300 Message-Id: <20230802175737.263412-5-alpernebiyasak@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230802175737.263412-1-alpernebiyasak@gmail.com> References: <20230802175737.263412-1-alpernebiyasak@gmail.com> MIME-Version: 1.0 Message-ID-Hash: CL4KXITDOM75FRAZ2D3OQOLE2TJDYB7X X-Message-ID-Hash: CL4KXITDOM75FRAZ2D3OQOLE2TJDYB7X X-MailFrom: alpernebiyasak@gmail.com 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: This driver does not properly map jack pins to kcontrols that PulseAudio and PipeWire need to handle jack detection events. The RT5682, RT1015 and RT1015p codecs used here can detect Headphone and Headset Mic connections. Expose the former two to userspace as kcontrols. Signed-off-by: Alper Nebi Yasak Reviewed-by: Akihiko Odaki Tested-by: Akihiko Odaki --- Should the SND_JACK_LINEOUT be removed from the jack_new_pins calls? sound/soc/amd/acp3x-rt5682-max9836.c | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/sound/soc/amd/acp3x-rt5682-max9836.c b/sound/soc/amd/acp3x-rt5682-max9836.c index 0543dda75b99..3bf7e1e83c36 100644 --- a/sound/soc/amd/acp3x-rt5682-max9836.c +++ b/sound/soc/amd/acp3x-rt5682-max9836.c @@ -28,6 +28,17 @@ #define DUAL_CHANNEL 2 static struct snd_soc_jack pco_jack; +static struct snd_soc_jack_pin pco_jack_pins[] = { + { + .pin = "Headphone Jack", + .mask = SND_JACK_HEADPHONE, + }, + { + .pin = "Headset Mic", + .mask = SND_JACK_MICROPHONE, + }, +}; + static struct clk *rt5682_dai_wclk; static struct clk *rt5682_dai_bclk; static struct gpio_desc *dmic_sel; @@ -86,11 +97,13 @@ static int acp3x_5682_init(struct snd_soc_pcm_runtime *rtd) rt5682_dai_wclk = clk_get(component->dev, "rt5682-dai-wclk"); rt5682_dai_bclk = clk_get(component->dev, "rt5682-dai-bclk"); - ret = snd_soc_card_jack_new(card, "Headset Jack", - SND_JACK_HEADSET | SND_JACK_LINEOUT | - SND_JACK_BTN_0 | SND_JACK_BTN_1 | - SND_JACK_BTN_2 | SND_JACK_BTN_3, - &pco_jack); + ret = snd_soc_card_jack_new_pins(card, "Headset Jack", + SND_JACK_HEADSET | SND_JACK_LINEOUT | + SND_JACK_BTN_0 | SND_JACK_BTN_1 | + SND_JACK_BTN_2 | SND_JACK_BTN_3, + &pco_jack, + pco_jack_pins, + ARRAY_SIZE(pco_jack_pins)); if (ret) { dev_err(card->dev, "HP jack creation failed %d\n", ret); return ret; From patchwork Wed Aug 2 17:57:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alper Nebi Yasak X-Patchwork-Id: 13338715 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 E7AC6C04A94 for ; Wed, 2 Aug 2023 18:06:19 +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 D21987F4; Wed, 2 Aug 2023 20:05:27 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz D21987F4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1690999577; bh=VT99jrrLdJXWXH5hJGp/KoCfBgX+DjAciXo1+sY7kvs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=AAn424E0sPoGGYysLecvPmzXWo+59iAEa/ZtYFAeILFMUUKjTyw+HYt3P4P2sxvwD 3xWnJf/eOHu/ILSDXSGB8msfxx6Co3kq8TDCQB1pgpY5IUOqkwBBn8toJpW9Yb6trq vzQRJDE5tGHbSDKN0TpJ0HPx3nhtRaTCFuOwF36Q= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 46FA9F8069E; Wed, 2 Aug 2023 19:59:35 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 96186F806A3; Wed, 2 Aug 2023 19:59:34 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 2A794F8067F; Wed, 2 Aug 2023 19:59:20 +0200 (CEST) Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 20632F80149 for ; Wed, 2 Aug 2023 19:58:05 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 20632F80149 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20221208 header.b=RJ4Ld/iv Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-3fe24dd8898so1324385e9.2 for ; Wed, 02 Aug 2023 10:58:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690999084; x=1691603884; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Z5e55/3niGxnTXERcmKYSB94dQwx71jJXMxMhyp26po=; b=RJ4Ld/ivmitOHIy6lTXMkEVG49CIs5bqeUEU0wDNDAPlLud4dF2xxgEXUSBvixy2mf UslIRyJGR5uGBgM3lFWPetavx6dTJZSYep4mSfril2gJvVWWCzK31xYK+sKaUnCxdgCj jwvspYMiCmFB96tmFahpDx9lBdpckAWCEBDmDpYTOea6N3KAiaa5CPg/iHqQOCQ3OpkQ WW5VI3oDYHeNjvv2XgkkY6FG7tqkphk7HvUQfMofDp+tiC5ZilzPifOY20Xp8oGrTXCv 2InKyYQ0LsfPa0vOisXg+/5DA+xQUIzSRtjW1IYmHgsCPDangDcbHMVHhVVpAgzJDV9Z q3tw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690999084; x=1691603884; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Z5e55/3niGxnTXERcmKYSB94dQwx71jJXMxMhyp26po=; b=eY59+u3FMWa3GNTYDwGckLtpPVxb+GEqzr9LD1HpEPzH9FUjsz2mB3gQNNwzGyl7Tn xzVg9v8SuM8XpKlDXpm/pNDxvkdqIsS5VXuFrUV+jBtHxiXTLMV/n04oT4xkQAOU5+Al wMGGRbxy1AGRl4xbWBXW2jsiNnZfvKibr0euW4jzc0FJkhCYW6orKvYpbY60/zF836el gW16GdzliTKiXegG/pY8K9+mKUy6yjXCvh22TcZE1WAYQOK6GRUjB15YSmp/ChB5WkjL TLrbl0KF8FBjsGpGuLs7sdkt9+oNwF8x+sv+LqzbCaKx1CwXx/Y2bXxyyZnqoHBya6sO txeA== X-Gm-Message-State: ABy/qLbr1VspOeI0L2yZYZV2fGRXtks0SlJXRks0pRd00r7VmPs7UVtS nqGhKEUhxAdhliKaPmBG20s9QeVmF1I= X-Google-Smtp-Source: APBJJlHe5rsnsWTWy8R/4Vk0CgbZNnBGdJd50hzwNNAsvA3gYagQGA3Vz0KZ61Sahpqg0dwkZEaM9w== X-Received: by 2002:a05:600c:2210:b0:3fe:ad4:27b1 with SMTP id z16-20020a05600c221000b003fe0ad427b1mr5437497wml.28.1690999084261; Wed, 02 Aug 2023 10:58:04 -0700 (PDT) Received: from ALPER-PC.. ([178.233.24.1]) by smtp.gmail.com with ESMTPSA id l23-20020a7bc457000000b003fe20db88ebsm2192439wmi.31.2023.08.02.10.58.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Aug 2023 10:58:03 -0700 (PDT) From: Alper Nebi Yasak To: alsa-devel@alsa-project.org Cc: Cezary Rojewski , Alper Nebi Yasak , Mark Brown , Liam Girdwood , Takashi Iwai , AngeloGioacchino Del Regno , Jaroslav Kysela , linux-kernel@vger.kernel.org, Akihiko Odaki , Pierre-Louis Bossart , Matthias Brugger , =?utf-8?q?N=C3=ADcolas_F_=2E_R_?= =?utf-8?q?=2E_A_=2E_Prado?= Subject: [PATCH 05/27] ASoC: Intel: avs: da7219: Map missing jack kcontrols Date: Wed, 2 Aug 2023 20:57:15 +0300 Message-Id: <20230802175737.263412-6-alpernebiyasak@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230802175737.263412-1-alpernebiyasak@gmail.com> References: <20230802175737.263412-1-alpernebiyasak@gmail.com> MIME-Version: 1.0 Message-ID-Hash: 3NAK676IDGTTCBGOMOSL5KEGSJ5T3PVQ X-Message-ID-Hash: 3NAK676IDGTTCBGOMOSL5KEGSJ5T3PVQ X-MailFrom: alpernebiyasak@gmail.com 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: This driver does not properly map jack pins to kcontrols that PulseAudio and PipeWire need to handle jack detection events. The DA7219 codec used here can detect Headphones, Headset Mic and Line Out connections. Expose each to userspace as kcontrols and add the necessary widgets. Signed-off-by: Alper Nebi Yasak --- I'm not sure the use of devm_kmemdup is necessary here, but it's what avs/boards/nau8825.c does, I copied from that. Is it just to sidestep the "const" modifier on snd_soc_jack_pin? Also see a similar construct in nt8625.c (already in linux-next): https://lore.kernel.org/all/20230629112449.1755928-8-cezary.rojewski@intel.com/ sound/soc/intel/avs/boards/da7219.c | 34 +++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/sound/soc/intel/avs/boards/da7219.c b/sound/soc/intel/avs/boards/da7219.c index 964a763732ab..85014d98f7e8 100644 --- a/sound/soc/intel/avs/boards/da7219.c +++ b/sound/soc/intel/avs/boards/da7219.c @@ -22,6 +22,7 @@ static const struct snd_kcontrol_new card_controls[] = { SOC_DAPM_PIN_SWITCH("Headphone Jack"), SOC_DAPM_PIN_SWITCH("Headset Mic"), + SOC_DAPM_PIN_SWITCH("Line Out"), }; static int platform_clock_control(struct snd_soc_dapm_widget *w, @@ -55,6 +56,7 @@ static int platform_clock_control(struct snd_soc_dapm_widget *w, static const struct snd_soc_dapm_widget card_widgets[] = { SND_SOC_DAPM_HP("Headphone Jack", NULL), SND_SOC_DAPM_MIC("Headset Mic", NULL), + SND_SOC_DAPM_LINE("Line Out", NULL), SND_SOC_DAPM_SUPPLY("Platform Clock", SND_SOC_NOPM, 0, 0, platform_clock_control, SND_SOC_DAPM_POST_PMD | SND_SOC_DAPM_PRE_PMU), }; @@ -68,6 +70,22 @@ static const struct snd_soc_dapm_route card_base_routes[] = { { "Headphone Jack", NULL, "Platform Clock" }, { "Headset Mic", NULL, "Platform Clock" }, + { "Line Out", NULL, "Platform Clock" }, +}; + +static const struct snd_soc_jack_pin card_headset_pins[] = { + { + .pin = "Headphone Jack", + .mask = SND_JACK_HEADPHONE, + }, + { + .pin = "Headset Mic", + .mask = SND_JACK_MICROPHONE, + }, + { + .pin = "Line Out", + .mask = SND_JACK_LINEOUT, + }, }; static int avs_da7219_codec_init(struct snd_soc_pcm_runtime *runtime) @@ -75,7 +93,9 @@ static int avs_da7219_codec_init(struct snd_soc_pcm_runtime *runtime) struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(runtime, 0); struct snd_soc_component *component = codec_dai->component; struct snd_soc_card *card = runtime->card; + struct snd_soc_jack_pin *pins; struct snd_soc_jack *jack; + int num_pins; int clk_freq; int ret; @@ -91,14 +111,20 @@ static int avs_da7219_codec_init(struct snd_soc_pcm_runtime *runtime) return ret; } + num_pins = ARRAY_SIZE(card_headset_pins); + pins = devm_kmemdup(card->dev, card_headset_pins, sizeof(*pins) * num_pins, GFP_KERNEL); + if (!pins) + return -ENOMEM; + /* * Headset buttons map to the google Reference headset. * These can be configured by userspace. */ - ret = snd_soc_card_jack_new(card, "Headset Jack", - SND_JACK_HEADSET | SND_JACK_BTN_0 | - SND_JACK_BTN_1 | SND_JACK_BTN_2 | - SND_JACK_BTN_3 | SND_JACK_LINEOUT, jack); + ret = snd_soc_card_jack_new_pins(card, "Headset Jack", + SND_JACK_HEADSET | SND_JACK_BTN_0 | + SND_JACK_BTN_1 | SND_JACK_BTN_2 | + SND_JACK_BTN_3 | SND_JACK_LINEOUT, + jack, pins, num_pins); if (ret) { dev_err(card->dev, "Headset Jack creation failed: %d\n", ret); return ret; From patchwork Wed Aug 2 17:57:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alper Nebi Yasak X-Patchwork-Id: 13338692 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 AF37EC04E69 for ; Wed, 2 Aug 2023 18:00:23 +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 E8AD683E; Wed, 2 Aug 2023 19:59:31 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz E8AD683E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1690999222; bh=lzbsGZgSIm7e0VRyBGvkH4S24Dkujacy6Kwc5qo+fRI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=jdwZZZnt/Il4VW+WS+Zad2t88rzOmkmH2SNRllcxBiKpHSYsey12rNMvwGOFi8s96 kjXknlqceO31KlffXQAf4LUsQaxQXf5vS0h75c6k+9dIeLHuOxBstEBAWnr84DH/6A QM7Zw6RLiupMT91yOT36DjZYrvDRVmLAjJQbIKR8= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 064D0F805AB; Wed, 2 Aug 2023 19:58:21 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 010EFF8057D; Wed, 2 Aug 2023 19:58:20 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id BA80AF80552; Wed, 2 Aug 2023 19:58:12 +0200 (CEST) Received: from mail-wm1-x32f.google.com (mail-wm1-x32f.google.com [IPv6:2a00:1450:4864:20::32f]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id DA9A9F801D5 for ; Wed, 2 Aug 2023 19:58:08 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz DA9A9F801D5 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20221208 header.b=bnCWrvBW Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-3fe2bc2702cso1511365e9.1 for ; Wed, 02 Aug 2023 10:58:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690999086; x=1691603886; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=l9P3TP3wzncRhOXgecZRN30Iatpmdu19th61qwxb3TI=; b=bnCWrvBW33Hc3lH7E3ojnUXu9Ro8w0Y5gsvpJtoeUNAkcrDtks3psfwf5mrnHNwCyT 3deFDBbk+9b8/B2aEH7EyMbouK0typo/n9x3MJ998k97nDuFHx2dcxRPVaHPQyvb4nN9 0TUe+jsmNGDMxGiNEoqWQ9YBTaFZe5aDkOwmBKuQuB5WJ/r1GGlG3mi/JZfbYNYJc4gz aTczta8+OM12jgy7iZ8C8/xvbhiMXRAeDuLwC44bv82QfsukQS8UcpvgkYK7GYZRSr7M gcB7pFpv2kCTwlPyicYgRdMsnu6pGZ0ZNouy0H0z0Jsfy68v5Q6uzHsE6ARmN85VSsO2 blIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690999086; x=1691603886; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=l9P3TP3wzncRhOXgecZRN30Iatpmdu19th61qwxb3TI=; b=RXahauet4Tw/tWyDgy1fhdeuE09q6hRLNPnZ9rCEA5YZChflhyu+eLTBr6JQ9ZTA3u LZ1taLwMxzSoh2vrOkDpOnrDBJI85CXumbXc2T+Bw8yoL7Whh1eWd9mvy26Afa4ABwwO EUuinaMss0IxADwp+0zK2S1w2wTuF99nmLnQZdT7gvYvtqhEjjD5LVft4SrQpiLFG3x6 BnK60Qr4iileqQUqhJhTE1+EFnF5nwMrsxlDlcVRs+4BFLb5R1SByLhFjVfPiDkPMTkQ 1u8PasTIt528fNr7xH0qNHvYggr5j0C5qI+ghu+SNuC5k87DWz7PffVrn3ueCEv/EKeY 2GRw== X-Gm-Message-State: ABy/qLaLP3zdLB6jH8JAu+FZWMY4l4ukW0ndH5kD+DwUbxo0DA0p0Ee2 FshhKCX4tp9anEL3o1+qzt1jyaoiZP8= X-Google-Smtp-Source: APBJJlEwjdDlcnSWCJ6DvL86bdak4jW/RJj56mLBJrICwRStZ4ojrxzFQe31Kb6pdeyPp60om6IkRQ== X-Received: by 2002:a05:600c:2198:b0:3fe:e1e:5041 with SMTP id e24-20020a05600c219800b003fe0e1e5041mr5573612wme.32.1690999086221; Wed, 02 Aug 2023 10:58:06 -0700 (PDT) Received: from ALPER-PC.. ([178.233.24.1]) by smtp.gmail.com with ESMTPSA id l23-20020a7bc457000000b003fe20db88ebsm2192439wmi.31.2023.08.02.10.58.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Aug 2023 10:58:05 -0700 (PDT) From: Alper Nebi Yasak To: alsa-devel@alsa-project.org Cc: Cezary Rojewski , Alper Nebi Yasak , Mark Brown , Liam Girdwood , Takashi Iwai , AngeloGioacchino Del Regno , Jaroslav Kysela , linux-kernel@vger.kernel.org, Akihiko Odaki , Pierre-Louis Bossart , Matthias Brugger , =?utf-8?q?N=C3=ADcolas_F_=2E_R_?= =?utf-8?q?=2E_A_=2E_Prado?= Subject: [PATCH 06/27] ASoC: Intel: bxt_da7219_max98357a: Map missing Line Out jack kcontrol Date: Wed, 2 Aug 2023 20:57:16 +0300 Message-Id: <20230802175737.263412-7-alpernebiyasak@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230802175737.263412-1-alpernebiyasak@gmail.com> References: <20230802175737.263412-1-alpernebiyasak@gmail.com> MIME-Version: 1.0 Message-ID-Hash: 5CFAHUZM7SCPF7OWKIGKVLOV5E6IUQRI X-Message-ID-Hash: 5CFAHUZM7SCPF7OWKIGKVLOV5E6IUQRI X-MailFrom: alpernebiyasak@gmail.com 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: Commit bbdd4ea2190b4 ("ASoC: Intel: bxt_da7219_max98357a: remap jack pins") maps kcontrols for Headphone and Headset Mic jacks for this driver so that PulseAudio and PipeWire can handle detection events for these peripherals. The DA7219 codec used here can also distinguish between Headphone and Line Out connections that go into the same physical port. Expose the latter to userspace as a kcontrol as well and add the necessary widgets. Signed-off-by: Alper Nebi Yasak --- Tested on a "Lick" Chromebook. sound/soc/intel/boards/bxt_da7219_max98357a.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sound/soc/intel/boards/bxt_da7219_max98357a.c b/sound/soc/intel/boards/bxt_da7219_max98357a.c index c593995facaa..cbfff466c5c8 100644 --- a/sound/soc/intel/boards/bxt_da7219_max98357a.c +++ b/sound/soc/intel/boards/bxt_da7219_max98357a.c @@ -90,6 +90,7 @@ static int platform_clock_control(struct snd_soc_dapm_widget *w, static const struct snd_kcontrol_new broxton_controls[] = { SOC_DAPM_PIN_SWITCH("Headphone Jack"), SOC_DAPM_PIN_SWITCH("Headset Mic"), + SOC_DAPM_PIN_SWITCH("Line Out"), }; static const struct snd_kcontrol_new max98357a_controls[] = { @@ -104,6 +105,7 @@ static const struct snd_kcontrol_new max98390_controls[] = { static const struct snd_soc_dapm_widget broxton_widgets[] = { SND_SOC_DAPM_HP("Headphone Jack", NULL), SND_SOC_DAPM_MIC("Headset Mic", NULL), + SND_SOC_DAPM_LINE("Line Out", NULL), SND_SOC_DAPM_MIC("SoC DMIC", NULL), SND_SOC_DAPM_SPK("HDMI1", NULL), SND_SOC_DAPM_SPK("HDMI2", NULL), @@ -150,6 +152,7 @@ static const struct snd_soc_dapm_route audio_map[] = { { "Headphone Jack", NULL, "Platform Clock" }, { "Headset Mic", NULL, "Platform Clock" }, + { "Line Out", NULL, "Platform Clock" }, }; static const struct snd_soc_dapm_route max98357a_routes[] = { @@ -194,6 +197,10 @@ static struct snd_soc_jack_pin jack_pins[] = { .pin = "Headset Mic", .mask = SND_JACK_MICROPHONE, }, + { + .pin = "Line Out", + .mask = SND_JACK_LINEOUT, + }, }; static int broxton_ssp_fixup(struct snd_soc_pcm_runtime *rtd, From patchwork Wed Aug 2 17:57:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alper Nebi Yasak X-Patchwork-Id: 13338693 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 C8F5DC001DF for ; Wed, 2 Aug 2023 18:00:43 +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 4F26B1DD; Wed, 2 Aug 2023 19:59:51 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 4F26B1DD DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1690999241; bh=GtB3OPZEAVDhJRYf+CtUXHRjjxCOHYXQcqjZniKErT0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=jwNCz3MzNE6wOdITQNCCOEqmQL7A/Z5NdmuMnv9c3xAcmgbTOh3zTmFZRSRpYyO1H e7GThHWSjsUGGoLyZerJVaFAknRchMpRDhbd2ZUvB3bZJ3qcoM/rG6VXJG8mWesPbu admrQ3cEO65kQl8KY1wjKZymtJDsoXGhmQLZHoXY= Received: by alsa1.perex.cz (Postfix, from userid 50401) id B05A6F805B1; Wed, 2 Aug 2023 19:58:25 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id C8295F805B1; Wed, 2 Aug 2023 19:58:24 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 1A205F80568; Wed, 2 Aug 2023 19:58:15 +0200 (CEST) Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com [IPv6:2a00:1450:4864:20::330]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id E000FF80520 for ; Wed, 2 Aug 2023 19:58:09 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz E000FF80520 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20221208 header.b=QmAr5gO5 Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-3fe2bc2702cso1511635e9.1 for ; Wed, 02 Aug 2023 10:58:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690999088; x=1691603888; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ln5Wo7yMvulq8m4RXX5h43LD0FJm5RWbml3d8jCXUmU=; b=QmAr5gO5OJHe2+KrJTzPsNSLD5fPvr8qGS0MTNj11WsaZ15vvacM8igaJSLKO2+rx/ s2bIZ4URxkPfkRThv9kbjVm1PQ84GbyVSVwDitcqqAHobVs98Gq8tPKKGj5oq6yjrYBq M3AT+OVH2j81fUJVXnISuA7S3XPq6o4zIt1cJvWZAGtsVxp68dTMZDoEWhEwLHeZjALz NDkdS5RgI+MUDvbjFraVu4LaArsUgkCI0K6Idp0Gxr0/TqK0Aknxqb0eTcfsW6p2/8Q1 dJFtoCYdHIR15I9fzdLeXTyj+dIizXMBNxmaR/4BBAuXzD2xS6lK7MMOZTY+o8qripOK hg3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690999088; x=1691603888; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ln5Wo7yMvulq8m4RXX5h43LD0FJm5RWbml3d8jCXUmU=; b=VZ+Qy9SWNhqja5yYgrnUV14f4LPxztDYqH7oZyz1619hCMEANs8lORNO5GhG53AWuZ V5pvMZmV/zH5Wl4FzDeWnrT6rkoHg7bLjmIFluf1EftpZwBxs9xHez9yMV2/skWgANna 2qinm8b6A/q4RXSEg/4YQgIX4BHb2RtdvWyp2mFzH5ngXp9VXw8KnDAfBt8Q+ndhRUUI i8W/Kw51qw4LZi1t9d2vobYUVa5tUm22eiyd9o9Rds7OhOnv5GjHJH21MMgRC4DRVeoI cwK4cUHO8lMyA7Qz4gwGd8e5ZuKqFRWPOd4an1r2sbTzWw/vnbioCckHkJvTglI2/h3T lzDA== X-Gm-Message-State: ABy/qLb7zbTQx/bMRfyWeXPyOWOU7a8+rE77uBm0fKvMGFInbgd2+rNP r1y3t4HIjljsy4ZwECrd6HGnegPk9Pk= X-Google-Smtp-Source: APBJJlF+GHDkkxI4yAurYVIyjrAJMP1jkpuyyPKJGc0fIuSZm0v3MllDtBGvGXHm8voz6pfDIhYP7w== X-Received: by 2002:a05:600c:21d5:b0:3fd:2e1d:eca1 with SMTP id x21-20020a05600c21d500b003fd2e1deca1mr5313451wmj.4.1690999088263; Wed, 02 Aug 2023 10:58:08 -0700 (PDT) Received: from ALPER-PC.. ([178.233.24.1]) by smtp.gmail.com with ESMTPSA id l23-20020a7bc457000000b003fe20db88ebsm2192439wmi.31.2023.08.02.10.58.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Aug 2023 10:58:07 -0700 (PDT) From: Alper Nebi Yasak To: alsa-devel@alsa-project.org Cc: Cezary Rojewski , Alper Nebi Yasak , Mark Brown , Liam Girdwood , Takashi Iwai , AngeloGioacchino Del Regno , Jaroslav Kysela , linux-kernel@vger.kernel.org, Akihiko Odaki , Pierre-Louis Bossart , Matthias Brugger , =?utf-8?q?N=C3=ADcolas_F_=2E_R_?= =?utf-8?q?=2E_A_=2E_Prado?= Subject: [PATCH 07/27] ASoC: Intel: bytcr_wm5102: Map missing Line Out jack kcontrol Date: Wed, 2 Aug 2023 20:57:17 +0300 Message-Id: <20230802175737.263412-8-alpernebiyasak@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230802175737.263412-1-alpernebiyasak@gmail.com> References: <20230802175737.263412-1-alpernebiyasak@gmail.com> MIME-Version: 1.0 Message-ID-Hash: NGS2LKJWBVAKYUIONTCRY4GJGH2MGYWA X-Message-ID-Hash: NGS2LKJWBVAKYUIONTCRY4GJGH2MGYWA X-MailFrom: alpernebiyasak@gmail.com 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: Commit ecd77d494ec9 ("ASoC: Intel: bytcr_wm5102: Add jack detect support") maps kcontrols for Headphone and Headset Mic jacks for this driver so that PulseAudio and PipeWire can handle jack detection events for these peripherals. The WM5102 codec used here can also distinguish between Headphone and Line Out connections that go into the same physical port. Expose the latter to userspace as a kcontrol as well and add the necessary widgets. Signed-off-by: Alper Nebi Yasak --- sound/soc/intel/boards/bytcr_wm5102.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sound/soc/intel/boards/bytcr_wm5102.c b/sound/soc/intel/boards/bytcr_wm5102.c index f2382d4cb76f..5c9e06ed1a53 100644 --- a/sound/soc/intel/boards/bytcr_wm5102.c +++ b/sound/soc/intel/boards/bytcr_wm5102.c @@ -131,6 +131,7 @@ static const struct snd_soc_dapm_widget byt_wm5102_widgets[] = { SND_SOC_DAPM_MIC("Headset Mic", NULL), SND_SOC_DAPM_MIC("Internal Mic", NULL), SND_SOC_DAPM_SPK("Speaker", NULL), + SND_SOC_DAPM_LINE("Line Out", NULL), SND_SOC_DAPM_SUPPLY("Platform Clock", SND_SOC_NOPM, 0, 0, platform_clock_control, SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD), @@ -144,6 +145,7 @@ static const struct snd_soc_dapm_route byt_wm5102_audio_map[] = { {"Headset Mic", NULL, "Platform Clock"}, {"Internal Mic", NULL, "Platform Clock"}, {"Speaker", NULL, "Platform Clock"}, + {"Line Out", NULL, "Platform Clock"}, {"Speaker", NULL, "SPKOUTLP"}, {"Speaker", NULL, "SPKOUTLN"}, @@ -177,6 +179,7 @@ static const struct snd_kcontrol_new byt_wm5102_controls[] = { SOC_DAPM_PIN_SWITCH("Headset Mic"), SOC_DAPM_PIN_SWITCH("Internal Mic"), SOC_DAPM_PIN_SWITCH("Speaker"), + SOC_DAPM_PIN_SWITCH("Line Out"), }; static struct snd_soc_jack_pin byt_wm5102_pins[] = { @@ -188,6 +191,10 @@ static struct snd_soc_jack_pin byt_wm5102_pins[] = { .pin = "Headset Mic", .mask = SND_JACK_MICROPHONE, }, + { + .pin = "Line Out", + .mask = SND_JACK_LINEOUT, + }, }; static int byt_wm5102_init(struct snd_soc_pcm_runtime *runtime) From patchwork Wed Aug 2 17:57:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alper Nebi Yasak X-Patchwork-Id: 13338694 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 D1B1AC001DF for ; Wed, 2 Aug 2023 18:00:53 +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 EE76886F; Wed, 2 Aug 2023 20:00:01 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz EE76886F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1690999252; bh=YBG5VsjTUOyJ4LHepKLqH8f4Aq/iaCkrf/F6JskqY10=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=aSTEqujwgmgFhV3hvnzgQvowBPJYbqZT9OsWCiz8vg4MhMIflLNAHx6CGb3bbdY14 ok0cehGuWXNXvbpoTmlsjPAbUtPu/wiOtFoEezkALZQUe6Y33DVo/nZj15kHsB0oST 4k3gNYo1/ByoLFarGCLFTDTeyS0x0Aq/tYVMAVtg= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 59DA1F805C0; Wed, 2 Aug 2023 19:58:30 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 7A53AF805B6; Wed, 2 Aug 2023 19:58:29 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id D208CF80571; Wed, 2 Aug 2023 19:58:16 +0200 (CEST) Received: from mail-wm1-x336.google.com (mail-wm1-x336.google.com [IPv6:2a00:1450:4864:20::336]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 59474F80551 for ; Wed, 2 Aug 2023 19:58:11 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 59474F80551 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20221208 header.b=cH9DcH1D Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-3fbea147034so1550105e9.0 for ; Wed, 02 Aug 2023 10:58:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690999090; x=1691603890; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=L5Agk2IhTlueKpAaOVZPmPiVBKk+AEjM8QiFyo+WrKQ=; b=cH9DcH1DxY4Yz9Q9s2/zqrXiaeWRqIgZsmXk5aOM5TA9zaAmZZtz4Ue5dckgnO/7PR LcDuoemcupnv+vTeCNJJqkCm8yylKBrOc40IT40+P6L8HWbHIzKll9CqbUlXScxvxEqK YBUi0vnpPisZkI8DvtYQsrZXm7eArwxev7rnIKr+BU6Aa1F8RDAyEdz5rqDYN7GmB1pY /zFPekPj6pIE04Pz5oCvTUYWillfyfKmFqAEA92JtC5znNz73IljhlYowHalEOkDIcQj bzr4b4xQLJDSuuEIYhHEJhe8I2WL9FetkV1cmP37LVhXf23zYFf3Jc/USF8Nqu5muPyn rUyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690999090; x=1691603890; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=L5Agk2IhTlueKpAaOVZPmPiVBKk+AEjM8QiFyo+WrKQ=; b=j3acUtcSvaa7UnmqGvx7iUAzmsq9KjagfCv8EQ/iLhrBt4l3eELZScMIgy9OmwV6Ml SAYtDhfJIJ78nEErFluzQ7N560PK5lK7zlmVJK/vatjD2vU/SGASVniTM6By7knin/Ez 93968S1rAaHUzy5L9mfkx6HZAZQ6wV5uthIiB1b5OFrQUg/rPvHnoyD3wH6vaUHivdJR Hj1Pjmttlfeqn0PId3NA4E64PIU1uflQWnmDltA46CDT+pniNUzUkfa7G//P4yVRY96h 4SK2KGyT1GOIpoYzqVJRj9Wgp2G4Tn/45MStDWKTfpMFlc+h6jTzGIgnXxigie24URPt ARXQ== X-Gm-Message-State: ABy/qLb3IbcDioVVQXsqVxTLQquXBgPHeq+++2XiU52QtGo62O5zW84P z36ff4tI1b9++xrdZbd2u27DcBNN3V0= X-Google-Smtp-Source: APBJJlHfdaDchRiKCzzj9hZwgTbQzwyxtzeuizDH16V+TqsJiCmpv7CuVvnxrhr/G1gG/9TOMuyrvA== X-Received: by 2002:a05:600c:2253:b0:3fd:3049:9496 with SMTP id a19-20020a05600c225300b003fd30499496mr5605696wmm.33.1690999090199; Wed, 02 Aug 2023 10:58:10 -0700 (PDT) Received: from ALPER-PC.. ([178.233.24.1]) by smtp.gmail.com with ESMTPSA id l23-20020a7bc457000000b003fe20db88ebsm2192439wmi.31.2023.08.02.10.58.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Aug 2023 10:58:09 -0700 (PDT) From: Alper Nebi Yasak To: alsa-devel@alsa-project.org Cc: Cezary Rojewski , Alper Nebi Yasak , Mark Brown , Liam Girdwood , Takashi Iwai , AngeloGioacchino Del Regno , Jaroslav Kysela , linux-kernel@vger.kernel.org, Akihiko Odaki , Pierre-Louis Bossart , Matthias Brugger , =?utf-8?q?N=C3=ADcolas_F_=2E_R_?= =?utf-8?q?=2E_A_=2E_Prado?= Subject: [PATCH 08/27] ASoC: Intel: kbl_da7219_max98357a: Map missing Line Out jack kcontrol Date: Wed, 2 Aug 2023 20:57:18 +0300 Message-Id: <20230802175737.263412-9-alpernebiyasak@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230802175737.263412-1-alpernebiyasak@gmail.com> References: <20230802175737.263412-1-alpernebiyasak@gmail.com> MIME-Version: 1.0 Message-ID-Hash: CPUYUDNJWX2CD6JTIWNR2HCJ4POAGIN6 X-Message-ID-Hash: CPUYUDNJWX2CD6JTIWNR2HCJ4POAGIN6 X-MailFrom: alpernebiyasak@gmail.com 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: Commit c2065d43ae85 ("ASoC: Intel: kbl_da7219_max98357a: remap jack pins") maps kcontrols for Headphone and Headset Mic jacks for this driver so that PulseAudio and PipeWire can handle jack detection events for these peripherals. The DA7219 codec used here can also distinguish between Headphone and Line Out connections that go into the same physical port. Expose the latter to userspace as a kcontrol as well and add the necessary widgets. Signed-off-by: Alper Nebi Yasak --- sound/soc/intel/boards/kbl_da7219_max98357a.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sound/soc/intel/boards/kbl_da7219_max98357a.c b/sound/soc/intel/boards/kbl_da7219_max98357a.c index 18365ce6bcba..97149513076f 100644 --- a/sound/soc/intel/boards/kbl_da7219_max98357a.c +++ b/sound/soc/intel/boards/kbl_da7219_max98357a.c @@ -83,12 +83,14 @@ static const struct snd_kcontrol_new kabylake_controls[] = { SOC_DAPM_PIN_SWITCH("Headphone Jack"), SOC_DAPM_PIN_SWITCH("Headset Mic"), SOC_DAPM_PIN_SWITCH("Spk"), + SOC_DAPM_PIN_SWITCH("Line Out"), }; static const struct snd_soc_dapm_widget kabylake_widgets[] = { SND_SOC_DAPM_HP("Headphone Jack", NULL), SND_SOC_DAPM_MIC("Headset Mic", NULL), SND_SOC_DAPM_SPK("Spk", NULL), + SND_SOC_DAPM_LINE("Line Out", NULL), SND_SOC_DAPM_MIC("SoC DMIC", NULL), SND_SOC_DAPM_SPK("HDMI1", NULL), SND_SOC_DAPM_SPK("HDMI2", NULL), @@ -107,6 +109,10 @@ static struct snd_soc_jack_pin jack_pins[] = { .pin = "Headset Mic", .mask = SND_JACK_MICROPHONE, }, + { + .pin = "Line Out", + .mask = SND_JACK_LINEOUT, + }, }; static const struct snd_soc_dapm_route kabylake_map[] = { @@ -147,6 +153,7 @@ static const struct snd_soc_dapm_route kabylake_map[] = { { "Headphone Jack", NULL, "Platform Clock" }, { "Headset Mic", NULL, "Platform Clock" }, + { "Line Out", NULL, "Platform Clock" }, }; static int kabylake_ssp_fixup(struct snd_soc_pcm_runtime *rtd, From patchwork Wed Aug 2 17:57:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alper Nebi Yasak X-Patchwork-Id: 13338695 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 74863C001DF for ; Wed, 2 Aug 2023 18:01:13 +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 C59224E; Wed, 2 Aug 2023 20:00:21 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz C59224E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1690999271; bh=EV6sokUEFPBNAyyEgdkgFd6IVbLFp4RbjuU08yI99gw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=Sv0WZlfLWcOQNpb/VuX7D0ByI4nB9+Fw43zvD1hNK9LRbilFpRrYMiWOJXNqsQMEM KdDfiCSEtymGIBua+zUIkvmmnw/e/FDCo9aCy1s6VccZCFa4aTktEmWMbkcc/ArRif da8t1IPHAV51/QgCV3221NXNVfUqH6wrCot4QIOo= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 0CA6CF805C1; Wed, 2 Aug 2023 19:58:32 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 2AB81F805C1; Wed, 2 Aug 2023 19:58:32 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id B4475F8056F; Wed, 2 Aug 2023 19:58:18 +0200 (CEST) Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 8CA57F80520 for ; Wed, 2 Aug 2023 19:58:14 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 8CA57F80520 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20221208 header.b=eUPPgU27 Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-3fe2bc27029so1308615e9.3 for ; Wed, 02 Aug 2023 10:58:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690999092; x=1691603892; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=gA29wr7vIe71PHnjZ5O12+t0Upf2Tn7RCA7Ahjy5Xv0=; b=eUPPgU27Wo4JR9a2RIjYfG+xrznhiFt9Qe7qlU/+5xCKROjTMqCOKQuyxxbiACT0BO X8LR3/sOH47/yXSL31SYbZpkxpD6j8RFN5Y1DlDIttR7gbZ8S8X0i2JxnlvfH3o4wX+W m1TDvCHB9fKxLosYA3pbH4UypPxafLw4OU3trvvoM0Hvp1YcNe4GLPx/vz8V5o3FtyOW WQjqlzzzwgIrbNNeMoLJSv06ywQxuwD1+xee4JTf4rb58FpNp06uKNHrLDUUJrmMM1y2 ufjo7mouFAdTL9DHyh8I9dWWRW9H8LSd19mvgdvrWaZ/DgDbXYtIdWEuzTgVfQHQfsiK 0y+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690999092; x=1691603892; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=gA29wr7vIe71PHnjZ5O12+t0Upf2Tn7RCA7Ahjy5Xv0=; b=bfwhaVZXtKDxk17qw2tNti6YtNRgikN0Yc5LrKxiB9u3PMc6Mb5FPhuHHffWdUmYpg /gpE0jXvs34NPeKJR/qXywXBDWrHcEbDWPoEyPZFKPZtEnDSNeE6H62SdIZh9rOOxtzV o8hl06isebKMseeZMq9usNMhoNHuA3UhHi1VJzyWX47Fkkwha51vKnMci8WZeU7RTEZl MhC8aKL7kp2EFK1u0QtM9fkxwkfnj2/BdeQ2Yh3dqX1iqNPgxJu00nt+MvGrFwjoAsx2 vmsz1WxUKqRTvlZQHbd5+vXSWfOTnQQas62tO9uhiKP3LyslBGdxBSUMSNz6P6gHR1wO 1Ztg== X-Gm-Message-State: ABy/qLY8BLKIxgnZXzQeZDQCMsv4/kSySnAYeCFUEEcW6XLHfUVdtXRe ktxNLGntDulhDiltavCQ4CxATC2uios= X-Google-Smtp-Source: APBJJlHngmzNEWhBf6DHJujPjqwuCj4M3FeWgtuZSVvq23YZ3ZtMNId2qLjVXZPX9ou5I5sdGphd8A== X-Received: by 2002:a05:600c:2216:b0:3fe:16d3:7d60 with SMTP id z22-20020a05600c221600b003fe16d37d60mr5772777wml.9.1690999092232; Wed, 02 Aug 2023 10:58:12 -0700 (PDT) Received: from ALPER-PC.. ([178.233.24.1]) by smtp.gmail.com with ESMTPSA id l23-20020a7bc457000000b003fe20db88ebsm2192439wmi.31.2023.08.02.10.58.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Aug 2023 10:58:11 -0700 (PDT) From: Alper Nebi Yasak To: alsa-devel@alsa-project.org Cc: Cezary Rojewski , Alper Nebi Yasak , Mark Brown , Liam Girdwood , Takashi Iwai , AngeloGioacchino Del Regno , Jaroslav Kysela , linux-kernel@vger.kernel.org, Akihiko Odaki , Pierre-Louis Bossart , Matthias Brugger , =?utf-8?q?N=C3=ADcolas_F_=2E_R_?= =?utf-8?q?=2E_A_=2E_Prado?= Subject: [PATCH 09/27] ASoC: Intel: kbl_da7219_max98927: Map missing Line Out jack kcontrol Date: Wed, 2 Aug 2023 20:57:19 +0300 Message-Id: <20230802175737.263412-10-alpernebiyasak@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230802175737.263412-1-alpernebiyasak@gmail.com> References: <20230802175737.263412-1-alpernebiyasak@gmail.com> MIME-Version: 1.0 Message-ID-Hash: B7OKRGIC3I6WII4H4LRBCRSR7GUX2WOB X-Message-ID-Hash: B7OKRGIC3I6WII4H4LRBCRSR7GUX2WOB X-MailFrom: alpernebiyasak@gmail.com 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: Commit b9f53b9fc14e ("ASoC: Intel: kbl_da7219_max98927: remap jack pins") maps kcontrols for Headphone and Headset Mic jacks for this driver so that PulseAudio and PipeWire can handle jack detection events for these peripherals. The DA7219 codec used here can also distinguish between Headphone and Line Out connections that go into the same physical port. Expose the latter to userspace as a kcontrol as well and add the necessary widgets. Signed-off-by: Alper Nebi Yasak --- sound/soc/intel/boards/kbl_da7219_max98927.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sound/soc/intel/boards/kbl_da7219_max98927.c b/sound/soc/intel/boards/kbl_da7219_max98927.c index ad4223fee0c5..a1f8234c77bd 100644 --- a/sound/soc/intel/boards/kbl_da7219_max98927.c +++ b/sound/soc/intel/boards/kbl_da7219_max98927.c @@ -102,6 +102,7 @@ static const struct snd_kcontrol_new kabylake_controls[] = { SOC_DAPM_PIN_SWITCH("Headset Mic"), SOC_DAPM_PIN_SWITCH("Left Spk"), SOC_DAPM_PIN_SWITCH("Right Spk"), + SOC_DAPM_PIN_SWITCH("Line Out"), }; static const struct snd_soc_dapm_widget kabylake_widgets[] = { @@ -109,6 +110,7 @@ static const struct snd_soc_dapm_widget kabylake_widgets[] = { SND_SOC_DAPM_MIC("Headset Mic", NULL), SND_SOC_DAPM_SPK("Left Spk", NULL), SND_SOC_DAPM_SPK("Right Spk", NULL), + SND_SOC_DAPM_LINE("Line Out", NULL), SND_SOC_DAPM_MIC("SoC DMIC", NULL), SND_SOC_DAPM_SPK("HDMI1", NULL), SND_SOC_DAPM_SPK("HDMI2", NULL), @@ -127,6 +129,10 @@ static struct snd_soc_jack_pin jack_pins[] = { .pin = "Headset Mic", .mask = SND_JACK_MICROPHONE, }, + { + .pin = "Line Out", + .mask = SND_JACK_MICROPHONE, + }, }; static const struct snd_soc_dapm_route kabylake_map[] = { @@ -182,6 +188,7 @@ static const struct snd_soc_dapm_route kabylake_ssp1_map[] = { { "Headphone Jack", NULL, "Platform Clock" }, { "Headset Mic", NULL, "Platform Clock" }, + { "Line Out", NULL, "Platform Clock" }, }; static int kabylake_ssp0_hw_params(struct snd_pcm_substream *substream, From patchwork Wed Aug 2 17:57:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alper Nebi Yasak X-Patchwork-Id: 13338696 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 D93E6C04A94 for ; Wed, 2 Aug 2023 18:01:27 +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 C4205836; Wed, 2 Aug 2023 20:00:35 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz C4205836 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1690999285; bh=K0dHf+JdZsJuCVmkArPvEsizmy+n3+hktauwUSPu/Lo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=SK8VIHU9jwDmPOsBTd5LDJ6c26M+tYL9bF7BXWnFAAOTuUyQaPVLEFbGcACpH/Zgx 6uw+buLq25/10iTvSq9jkymAgI+CKdDVm3fpxG/DIvXttXiVUInIfEarIPOwkfdzCE slXhuCHEXRlAP7p4iDucE2ZP7tFBh+xE6pp73qAo= Received: by alsa1.perex.cz (Postfix, from userid 50401) id BD604F805D9; Wed, 2 Aug 2023 19:58:36 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id B160AF805D9; Wed, 2 Aug 2023 19:58:35 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 47AD7F8058C; Wed, 2 Aug 2023 19:58:20 +0200 (CEST) Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 0FDFAF80551 for ; Wed, 2 Aug 2023 19:58:15 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 0FDFAF80551 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20221208 header.b=lkUVB3Er Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-3fbea14700bso1316845e9.3 for ; Wed, 02 Aug 2023 10:58:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690999094; x=1691603894; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=kNnRUj13sGKYiaqiH+uUTgS+yS59+A+KbZaO7xd9beM=; b=lkUVB3Er6Tk4LtvOzzFy83WjQTHW44mVzjLLbvGWYul576VCJEMkF8DHZhFSneRvs4 FHhPDUsl0A/XDlnt9uJF8cDUfJNEZwP9vEysWWdghsgRnZ0/chZeN9CqgxVrYZNy+nGP S0gj35ahl4JEC+1+TbxKtDq8zKkgPo1MxPc0qEHuq5C9EVtS31K2lokeftsT7+X+Dcec o/H5LdipYetf+g0AosAO0r2fZqfh4QTLs5x3W+te7VnKDkF8Z6QBeFAZKA10HjFmsNhp Ai9VwROFVoKnv9wDuN6mEgRS4+oo23cxN3arsslC19XbJHKaTBjVl067/MvGkhnY9Qch VAfQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690999094; x=1691603894; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=kNnRUj13sGKYiaqiH+uUTgS+yS59+A+KbZaO7xd9beM=; b=FVw3pfn6Ig/ZiXnbNkMHMkLfdVnzDJ0D0/1pmF3p7Oe0gXxIWMG5EK9gjrinBVu6W4 gxQPuWNBnUaLBNxe4E8Rj32SLwrVshzz1BVve1AkG4XlZQatcN5BBFI7GyfPJNSPGJJm Ohdlo94ClGvNBquMjG9n39yKcgE4MbjiniDakD4XNqO7lCWP0Mx7iLjztEBIirpQba0v N2QGW/jZpRqwGgwm6b1KX7WPLnDWCvFi8cXx4ppzvgPPvN+o0mSXcz3G8SzycZRk842W we4m/kFZ6V3x2nV+HmxU7Wn8ckkh9QrsZwbozTxENRX0ZhuH283G5M3DItEYFQUOC9T2 x86A== X-Gm-Message-State: ABy/qLbQqcxWiUF+INSSa6a9+/nv2FR0/rjhwJOk0OC9ftXFS+cBGfRQ 6BfP6zyIRP13j7cGa1GWjMux/gNotgk= X-Google-Smtp-Source: APBJJlGBjIeCNfjfwIJCCvX2YxfjXB5idSZwIp2n/1KH4BsL9nfFvZi5dAIObjjgRpBFhDgrA0/aLw== X-Received: by 2002:a05:600c:281:b0:3fb:dff2:9f17 with SMTP id 1-20020a05600c028100b003fbdff29f17mr5479686wmk.15.1690999094138; Wed, 02 Aug 2023 10:58:14 -0700 (PDT) Received: from ALPER-PC.. ([178.233.24.1]) by smtp.gmail.com with ESMTPSA id l23-20020a7bc457000000b003fe20db88ebsm2192439wmi.31.2023.08.02.10.58.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Aug 2023 10:58:13 -0700 (PDT) From: Alper Nebi Yasak To: alsa-devel@alsa-project.org Cc: Cezary Rojewski , Alper Nebi Yasak , Mark Brown , Liam Girdwood , Takashi Iwai , AngeloGioacchino Del Regno , Jaroslav Kysela , linux-kernel@vger.kernel.org, Akihiko Odaki , Pierre-Louis Bossart , Matthias Brugger , =?utf-8?q?N=C3=ADcolas_F_=2E_R_?= =?utf-8?q?=2E_A_=2E_Prado?= Subject: [PATCH 10/27] ASoC: Intel: sof_da7219_max98373: Map missing Line Out jack kcontrol Date: Wed, 2 Aug 2023 20:57:20 +0300 Message-Id: <20230802175737.263412-11-alpernebiyasak@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230802175737.263412-1-alpernebiyasak@gmail.com> References: <20230802175737.263412-1-alpernebiyasak@gmail.com> MIME-Version: 1.0 Message-ID-Hash: 3CQ5CN6EW7PIG7KRGMODYGOE5XY4L5H7 X-Message-ID-Hash: 3CQ5CN6EW7PIG7KRGMODYGOE5XY4L5H7 X-MailFrom: alpernebiyasak@gmail.com 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: Commit 2913bb1f6830 ("ASoC: Intel: sof_da7219_max98373: remap jack pins") maps kcontrols for Headphone and Headset Mic jacks for this driver so that PulseAudio and PipeWire can handle jack detection events for these peripherals. The DA7219 codec used here can also distinguish between Headphone and Line Out connections that go into the same physical port. Expose the latter to userspace as a kcontrol as well and add the necessary widgets. Signed-off-by: Alper Nebi Yasak --- sound/soc/intel/boards/sof_da7219_max98373.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/sound/soc/intel/boards/sof_da7219_max98373.c b/sound/soc/intel/boards/sof_da7219_max98373.c index 740aa11cb019..bbd47e7e4343 100644 --- a/sound/soc/intel/boards/sof_da7219_max98373.c +++ b/sound/soc/intel/boards/sof_da7219_max98373.c @@ -65,6 +65,7 @@ static int platform_clock_control(struct snd_soc_dapm_widget *w, static const struct snd_kcontrol_new controls[] = { SOC_DAPM_PIN_SWITCH("Headphone Jack"), SOC_DAPM_PIN_SWITCH("Headset Mic"), + SOC_DAPM_PIN_SWITCH("Line Out"), SOC_DAPM_PIN_SWITCH("Left Spk"), SOC_DAPM_PIN_SWITCH("Right Spk"), }; @@ -72,6 +73,7 @@ static const struct snd_kcontrol_new controls[] = { static const struct snd_kcontrol_new m98360a_controls[] = { SOC_DAPM_PIN_SWITCH("Headphone Jack"), SOC_DAPM_PIN_SWITCH("Headset Mic"), + SOC_DAPM_PIN_SWITCH("Line Out"), SOC_DAPM_PIN_SWITCH("Spk"), }; @@ -79,6 +81,7 @@ static const struct snd_kcontrol_new m98360a_controls[] = { static const struct snd_soc_dapm_widget widgets[] = { SND_SOC_DAPM_HP("Headphone Jack", NULL), SND_SOC_DAPM_MIC("Headset Mic", NULL), + SND_SOC_DAPM_LINE("Line Out", NULL), SND_SOC_DAPM_SPK("Left Spk", NULL), SND_SOC_DAPM_SPK("Right Spk", NULL), @@ -98,6 +101,7 @@ static const struct snd_soc_dapm_route audio_map[] = { { "Headphone Jack", NULL, "Platform Clock" }, { "Headset Mic", NULL, "Platform Clock" }, + { "Line Out", NULL, "Platform Clock" }, { "Left Spk", NULL, "Left BE_OUT" }, { "Right Spk", NULL, "Right BE_OUT" }, @@ -110,6 +114,7 @@ static const struct snd_soc_dapm_route audio_map[] = { static const struct snd_soc_dapm_widget max98360a_widgets[] = { SND_SOC_DAPM_HP("Headphone Jack", NULL), SND_SOC_DAPM_MIC("Headset Mic", NULL), + SND_SOC_DAPM_LINE("Line Out", NULL), SND_SOC_DAPM_SPK("Spk", NULL), @@ -128,6 +133,7 @@ static const struct snd_soc_dapm_route max98360a_map[] = { { "Headphone Jack", NULL, "Platform Clock" }, { "Headset Mic", NULL, "Platform Clock" }, + { "Line Out", NULL, "Platform Clock" }, {"Spk", NULL, "Speaker"}, @@ -144,6 +150,10 @@ static struct snd_soc_jack_pin jack_pins[] = { .pin = "Headset Mic", .mask = SND_JACK_MICROPHONE, }, + { + .pin = "Line Out", + .mask = SND_JACK_LINEOUT, + }, }; static struct snd_soc_jack headset; From patchwork Wed Aug 2 17:57:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alper Nebi Yasak X-Patchwork-Id: 13338697 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 C952BC001DF for ; Wed, 2 Aug 2023 18:01:40 +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 37CCB84C; Wed, 2 Aug 2023 20:00:49 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 37CCB84C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1690999299; bh=oc5gk1XJjGYzCBoz6J7X4YrGf4tf2hoTQ0yGwVRmX5U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=Bsmh8n24eCmNgcT+yJAPuR48CsgSH8JKLNCUfbTrpU9Z27otUj38/WLzIt3Ghv4Di t0hmuiimwM/1z/gSARPoYxbYGKytVLdqXwlA0wXzdThp1oip5jwbBlNcqiZhl+znqi sluU9TcN6Sm8F1hV4+MXA2irDYKrwH5I87wYsdT8= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 2A6A1F805EA; Wed, 2 Aug 2023 19:58:40 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 9AE8AF805E7; Wed, 2 Aug 2023 19:58:39 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 7362AF805AE; Wed, 2 Aug 2023 19:58:23 +0200 (CEST) Received: from mail-wm1-x332.google.com (mail-wm1-x332.google.com [IPv6:2a00:1450:4864:20::332]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 2773AF80588 for ; Wed, 2 Aug 2023 19:58:17 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 2773AF80588 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20221208 header.b=Pq/1FGIB Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-3fe32016bc8so1307505e9.1 for ; Wed, 02 Aug 2023 10:58:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690999096; x=1691603896; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=N6nMyjPDcYHJiCu1T+2rryAVPMQB1lBdVoigClnfhE0=; b=Pq/1FGIBfPTM8xlFaIMjn1o5wOEU2kj7KT9xR0Ocy74eFT33CbYnmhRBhR6j9R5E17 JY+Ym9jIvVshplH76FYvLhFYDjAequ6p4yKAyd3p6zPGrYwKGxSUorDNyq0sEIxqk7V6 TDesnd7jp/JgGl2o6TMcfn8Z5DQzwD5vJ92w2OXss9yUzTbZvDRkzz98k0NPHU4lyIoK 5+o21smSqiKlegxyL6wmHLoh6Q/ga98Vws/YXX54PxTQOZaYt8JLCa8h2ZKC4B6Qiaew snYgYsWQok08PMvzc99N5232Ue9F0+AETxpai+w0wlrgq+1Va0fLhnWWgx3x3Jw95BIl qxSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690999096; x=1691603896; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=N6nMyjPDcYHJiCu1T+2rryAVPMQB1lBdVoigClnfhE0=; b=UzW9KJvF/KF1NEZi6IV2rZqidh/HrAUINn8MWDZ1fNT7WIkkwOmxWWaBz8XvP03nho +sOdjvP2sVIoIWYHGxpI9P3P//0NJsi9mxijYrhtN2ctzYH7EN+8E7hE4TCnF33abkyK U998ufx/hA3Kv4bCwlCtNXHT+5IzM7qrgsVkN0Zu5CfSbm5Uy/aUeipApAhYUEumBkJl MSiguMWANlByLfmOFd/4UsNIeQsdlQ3gRD2TOfBy4470pQGLEPD3PLgB/42V+5ry0f5H bZUvkSdXnAYgcpGtNKFVC8KNwPXrcZx0Y5QBus1kkjLjAolyByLvSBqB7SQpsKm9w3gs YRXA== X-Gm-Message-State: ABy/qLaDprQK5qq8cB5YpfxcWI2miXLrSMYXkjVxQ3fh8oyaLpyRadI1 Rsu5liPPTvXOSgLNHKaAUTO89uwq9K8= X-Google-Smtp-Source: APBJJlGPaCnmxQZeBSmFQkM3APRCZ94arRA5batOsSBNcMoomdpSEqWIssz4EhlEA3s+ieoFUM4XnQ== X-Received: by 2002:a1c:f202:0:b0:3fb:f926:4937 with SMTP id s2-20020a1cf202000000b003fbf9264937mr5004542wmc.31.1690999096274; Wed, 02 Aug 2023 10:58:16 -0700 (PDT) Received: from ALPER-PC.. ([178.233.24.1]) by smtp.gmail.com with ESMTPSA id l23-20020a7bc457000000b003fe20db88ebsm2192439wmi.31.2023.08.02.10.58.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Aug 2023 10:58:15 -0700 (PDT) From: Alper Nebi Yasak To: alsa-devel@alsa-project.org Cc: Cezary Rojewski , Alper Nebi Yasak , Mark Brown , Liam Girdwood , Takashi Iwai , AngeloGioacchino Del Regno , Jaroslav Kysela , linux-kernel@vger.kernel.org, Akihiko Odaki , Pierre-Louis Bossart , Matthias Brugger , =?utf-8?q?N=C3=ADcolas_F_=2E_R_?= =?utf-8?q?=2E_A_=2E_Prado?= Subject: [PATCH 11/27] ASoC: imx-es8328: Map missing jack kcontrols Date: Wed, 2 Aug 2023 20:57:21 +0300 Message-Id: <20230802175737.263412-12-alpernebiyasak@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230802175737.263412-1-alpernebiyasak@gmail.com> References: <20230802175737.263412-1-alpernebiyasak@gmail.com> MIME-Version: 1.0 Message-ID-Hash: RGY6GPS5C3UIYRIWEWV62LINDS2BTXEM X-Message-ID-Hash: RGY6GPS5C3UIYRIWEWV62LINDS2BTXEM X-MailFrom: alpernebiyasak@gmail.com 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: This driver does not properly map jack pins to kcontrols that PulseAudio and PipeWire need to handle jack detection events. It seems to have a single detection GPIO pin used to report everything as a Headset. But it has widgets for Headphone and Mic Jack, so expose both to userspace as kcontrols. Signed-off-by: Alper Nebi Yasak --- Also see https://github.com/xobs/pulseaudio-novena though I don't really understand PulseAudio configuration. sound/soc/fsl/imx-es8328.c | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/sound/soc/fsl/imx-es8328.c b/sound/soc/fsl/imx-es8328.c index 85bd36fb68a2..6f0d031c1d5f 100644 --- a/sound/soc/fsl/imx-es8328.c +++ b/sound/soc/fsl/imx-es8328.c @@ -37,6 +37,16 @@ static struct snd_soc_jack_gpio headset_jack_gpios[] = { }; static struct snd_soc_jack headset_jack; +static struct snd_soc_jack_pin headset_jack_pins[] = { + { + .pin = "Headphone", + .mask = SND_JACK_HEADPHONE, + }, + { + .pin = "Mic Jack", + .mask = SND_JACK_MICROPHONE, + }, +}; static int imx_es8328_dai_init(struct snd_soc_pcm_runtime *rtd) { @@ -46,9 +56,11 @@ static int imx_es8328_dai_init(struct snd_soc_pcm_runtime *rtd) /* Headphone jack detection */ if (gpio_is_valid(data->jack_gpio)) { - ret = snd_soc_card_jack_new(rtd->card, "Headphone", - SND_JACK_HEADPHONE | SND_JACK_BTN_0, - &headset_jack); + ret = snd_soc_card_jack_new_pins(rtd->card, "Headphone", + SND_JACK_HEADSET | SND_JACK_BTN_0, + &headset_jack, + headset_jack_pins, + ARRAY_SIZE(headset_jack_pins)); if (ret) return ret; @@ -68,6 +80,11 @@ static const struct snd_soc_dapm_widget imx_es8328_dapm_widgets[] = { SND_SOC_DAPM_REGULATOR_SUPPLY("audio-amp", 1, 0), }; +static const struct snd_kcontrol_new imx_es8328_controls[] = { + SOC_DAPM_PIN_SWITCH("Headphone"), + SOC_DAPM_PIN_SWITCH("Mic Jack"), +}; + static int imx_es8328_probe(struct platform_device *pdev) { struct device_node *np = pdev->dev.of_node; @@ -183,6 +200,8 @@ static int imx_es8328_probe(struct platform_device *pdev) data->card.dev = dev; data->card.dapm_widgets = imx_es8328_dapm_widgets; data->card.num_dapm_widgets = ARRAY_SIZE(imx_es8328_dapm_widgets); + data->card.controls = imx_es8328_controls; + data->card.num_controls = ARRAY_SIZE(imx_es8328_controls); ret = snd_soc_of_parse_card_name(&data->card, "model"); if (ret) { dev_err(dev, "Unable to parse card name\n"); From patchwork Wed Aug 2 17:57:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alper Nebi Yasak X-Patchwork-Id: 13338698 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 3A331C001DF for ; Wed, 2 Aug 2023 18:02:00 +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 CE4FA828; Wed, 2 Aug 2023 20:01:07 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz CE4FA828 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1690999317; bh=IdYjNgK/7UyowL2xFaOKmaMAHMO46QKM081Tp6/Vvsk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=TV64MxjYfjYdDtASeDdnQv/2fJqI+lHvTjY72NHtflP9XwhoJxm7PXx0ug5+6euT/ lvKGP5H8JEonZvZtaLIHK/TkBeTrrj7LT85GxGBm3iDwEgG3Qi9oI3xjs+3gi4PS7M ns3mOfG6cJUaFCE4tx4dhpVLSDhSZ0jaZFM4lvL0= Received: by alsa1.perex.cz (Postfix, from userid 50401) id D5569F805ED; Wed, 2 Aug 2023 19:58:45 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 3105CF80548; Wed, 2 Aug 2023 19:58:45 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 31EE5F805AE; Wed, 2 Aug 2023 19:58:24 +0200 (CEST) Received: from mail-wr1-x435.google.com (mail-wr1-x435.google.com [IPv6:2a00:1450:4864:20::435]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 116F9F805A9 for ; Wed, 2 Aug 2023 19:58:19 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 116F9F805A9 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20221208 header.b=dJ5Gi04e Received: by mail-wr1-x435.google.com with SMTP id ffacd0b85a97d-3175f17a7baso84821f8f.0 for ; Wed, 02 Aug 2023 10:58:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690999098; x=1691603898; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=dc2UgdWbHJ5viusggKKpR6m1qOzlwVd02m2G5RcJAR0=; b=dJ5Gi04eppj2dUkhfPz8D8RqWdOOT5hoWQ5OY2vAj+BLvpM77cvkoY5AMjs1eRUxYN 55GNINLHC25EzlSTILqK/pu2F2bjK7sc1Hakw3uwzR5d3xO0MBPcEODAikE20D9AEPZb B0njqovpopmV0Sqas/6H4RC/M5r53gD+VCF5JKy+cMwc1xp4tIBoJWyZYM5gzd8iE/pL PoClu/bk7kVPEBhR4OXvEDLzQ44bsnTqBv1UnwiAHfzh70NnXlRWL4gbmUrq20E2EN99 lu5XqsaB9QhfATElsum0yZhC/h7jSyBx4eW3/xieQPtWlTSwHjbitwz48CYmG3lHV6b+ 5VOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690999098; x=1691603898; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=dc2UgdWbHJ5viusggKKpR6m1qOzlwVd02m2G5RcJAR0=; b=VeWAsXI7cUf+TQrag+99gBCW1W742rlNqLHSMJBJS3LD/n7ONXMqOECeamQMVda8bz HwLCNvHQXriV3ODPOTIsYE9ES9TTZOD3pqySOAwkI540G9Fjfn38DzsWBST53N422LbF 3VuW68BMG87J4Cygt7Zd16azRQIQM3QxodCALRoffJ7Z8+zFCMjzJ2usqMogX8N+AP2d l86h6KMJySeRretdA2OUh4V3qvnknlkTrxKuedLToe00epSHTJ9VMe6stfvscJeX4892 YG7TynufHlkH3ayL/gtc2LMfxiBHEWAwwv6OACoDe2Az4fFv1yRzdU2Qab+weqHuGGnJ tweg== X-Gm-Message-State: ABy/qLY5LzE/VP1ll0SadUH3Niiyd8Kfyah+UG5oK9l36qGmGQitjgnl JZzS334j29852WNWdxcaENeRzqPxASM= X-Google-Smtp-Source: APBJJlHAdL8nWYIDgUatLGt39dyqvop2OVrN7cratpwvF9SdHkc4NtoZ/M6UlWguYo9yfvrFKJTZGA== X-Received: by 2002:a05:6000:1004:b0:317:5948:1fe0 with SMTP id a4-20020a056000100400b0031759481fe0mr5039599wrx.45.1690999098210; Wed, 02 Aug 2023 10:58:18 -0700 (PDT) Received: from ALPER-PC.. ([178.233.24.1]) by smtp.gmail.com with ESMTPSA id l23-20020a7bc457000000b003fe20db88ebsm2192439wmi.31.2023.08.02.10.58.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Aug 2023 10:58:17 -0700 (PDT) From: Alper Nebi Yasak To: alsa-devel@alsa-project.org Cc: Cezary Rojewski , Alper Nebi Yasak , Mark Brown , Liam Girdwood , Takashi Iwai , AngeloGioacchino Del Regno , Jaroslav Kysela , linux-kernel@vger.kernel.org, Akihiko Odaki , Pierre-Louis Bossart , Matthias Brugger , =?utf-8?q?N=C3=ADcolas_F_=2E_R_?= =?utf-8?q?=2E_A_=2E_Prado?= Subject: [PATCH 12/27] ASoC: mediatek: mt8173-max98090: Configure jack as a Headset jack Date: Wed, 2 Aug 2023 20:57:22 +0300 Message-Id: <20230802175737.263412-13-alpernebiyasak@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230802175737.263412-1-alpernebiyasak@gmail.com> References: <20230802175737.263412-1-alpernebiyasak@gmail.com> MIME-Version: 1.0 Message-ID-Hash: U7QA7ER6W57K5DPBEGDMW3SQMZC6R2HC X-Message-ID-Hash: U7QA7ER6W57K5DPBEGDMW3SQMZC6R2HC X-MailFrom: alpernebiyasak@gmail.com 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: This driver has correctly mapped jack kcontrols for Headphone and Headset Mic. However, it is configuring the jack to only care about Headphone events. The MAX98090 codec used here can detect both connections, so configure the jack as such. Signed-off-by: Alper Nebi Yasak --- It also appears to support SND_JACK_BTN_0. Not sure if that should be part of this patch. sound/soc/mediatek/mt8173/mt8173-max98090.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/mediatek/mt8173/mt8173-max98090.c b/sound/soc/mediatek/mt8173/mt8173-max98090.c index c2b0619b6158..bfb2094758ff 100644 --- a/sound/soc/mediatek/mt8173/mt8173-max98090.c +++ b/sound/soc/mediatek/mt8173/mt8173-max98090.c @@ -70,7 +70,7 @@ static int mt8173_max98090_init(struct snd_soc_pcm_runtime *runtime) struct snd_soc_component *component = asoc_rtd_to_codec(runtime, 0)->component; /* enable jack detection */ - ret = snd_soc_card_jack_new_pins(card, "Headphone", SND_JACK_HEADPHONE, + ret = snd_soc_card_jack_new_pins(card, "Headphone", SND_JACK_HEADSET, &mt8173_max98090_jack, mt8173_max98090_jack_pins, ARRAY_SIZE(mt8173_max98090_jack_pins)); From patchwork Wed Aug 2 17:57:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alper Nebi Yasak X-Patchwork-Id: 13338700 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 5C4FDC04A94 for ; Wed, 2 Aug 2023 18:02:14 +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 2419982A; Wed, 2 Aug 2023 20:01:22 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 2419982A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1690999332; bh=3APuaTCqjWAXUKvZWS9wSNgIOQvv/nDplfVsUZLzDQ4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=PS17FzKTAE/OBeG91aXrrV1lIAm3k25XYK75qMpfPNGd3+HUs06+tK9Om+gRqbJyP stKMoW4bPx2ZIhjc17gxqYTAeifPSQhGit77SrzU4/U0QMUIhsNhrzkWgMvtirEwXF VvOFqJGYUCbf1vx/PqfBxj2Yw8P9895///CfL67w= Received: by alsa1.perex.cz (Postfix, from userid 50401) id A336DF805FB; Wed, 2 Aug 2023 19:58:48 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id A3865F805F8; Wed, 2 Aug 2023 19:58:47 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 63357F805B4; Wed, 2 Aug 2023 19:58:25 +0200 (CEST) Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id CFC1CF805A1 for ; Wed, 2 Aug 2023 19:58:21 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz CFC1CF805A1 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20221208 header.b=pQwSTdpi Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-3fe2fb9b4d7so1392035e9.1 for ; Wed, 02 Aug 2023 10:58:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690999100; x=1691603900; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=TDgex51QiOVczO4DJKkVoIxdj5w2CMw4f9nt7sgUgwU=; b=pQwSTdpiBct1ZkFKH+H1jKQOM71C568ZgrH2pqMuH26wTckRnDL3N40AhORENumltE zjwoFb1I1dDovAIy1cjl2Dr+ZFGic9XThduhC22I5MFk2XPlqivwWueGL+cCxM+AzFzy Vyx1Ymj/T07BBpAX/+KRco3eqLZDfqtRdt4+ZSm9x0ZK/TddmAFKO9q+X12HDOx/t+K6 zAfhEJSzxqiynoCTVut8YPG/RVeB+upM18gUrWRunggDmtgcCHaw/vLyPclub5WyBd/e /T87a3L1YZ13oFytIh/urX2wIxLKRfTXzSuUpXb1yOILqJLYo9nBC++vfZxKCiQy9DC8 Bm7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690999100; x=1691603900; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=TDgex51QiOVczO4DJKkVoIxdj5w2CMw4f9nt7sgUgwU=; b=f/QdPjGEuBB+lOfbxSY3bLWm8LJAzmKBuwIj4Mi7ay9UJi20IJudFvq1yr+DDEktF9 2B/uoK11Kk/lvyps7V0vMeix/SLN0mRR0NTkxzRcoZwnc2HLbgoYafWHsHfrjygfc+fk N4nuseCjMjoR5A6SrYKXglttWzppH1nl0EjLbCTxfQZ+wiPfVeIRUg3aCGUeI5YKJWAL R5WLYaWk+rQMc0s1DD7+DX8lvgFKXsergkrdCdvOkysEziOQnYJ1GOvoANiG6RcEuGLE sUxY0sWgoYHteLWMxQEZ7Qch7R1DMwGVnxc4PcB6NtP1ppI2Go+dB/BflSZNQubnnU4t h+EA== X-Gm-Message-State: ABy/qLZ3z3NJQnlbjBEHe+CBsUao2jDfrkAKD0I9FzawoACYwWFtMmlc uXvxY4EhSJsz6TwP0i6qztfBgGPXFRI= X-Google-Smtp-Source: APBJJlH91r28l0IKr1hxqWGkEgaBxzgQ1myfYz6eME/NQQKzR9WlFFb9j5LckCL2VDUqkyoCxi0jpg== X-Received: by 2002:a05:600c:cf:b0:3fe:1f2c:df2b with SMTP id u15-20020a05600c00cf00b003fe1f2cdf2bmr5488486wmm.11.1690999100142; Wed, 02 Aug 2023 10:58:20 -0700 (PDT) Received: from ALPER-PC.. ([178.233.24.1]) by smtp.gmail.com with ESMTPSA id l23-20020a7bc457000000b003fe20db88ebsm2192439wmi.31.2023.08.02.10.58.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Aug 2023 10:58:19 -0700 (PDT) From: Alper Nebi Yasak To: alsa-devel@alsa-project.org Cc: Cezary Rojewski , Alper Nebi Yasak , Mark Brown , Liam Girdwood , Takashi Iwai , AngeloGioacchino Del Regno , Jaroslav Kysela , linux-kernel@vger.kernel.org, Akihiko Odaki , Pierre-Louis Bossart , Matthias Brugger , =?utf-8?q?N=C3=ADcolas_F_=2E_R_?= =?utf-8?q?=2E_A_=2E_Prado?= Subject: [PATCH 13/27] ASoC: mediatek: mt8173-rt5650-rt5514: Map missing jack kcontrols Date: Wed, 2 Aug 2023 20:57:23 +0300 Message-Id: <20230802175737.263412-14-alpernebiyasak@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230802175737.263412-1-alpernebiyasak@gmail.com> References: <20230802175737.263412-1-alpernebiyasak@gmail.com> MIME-Version: 1.0 Message-ID-Hash: JYLPVYCCCKGRWQVG637FTVGI4SFDSA3Z X-Message-ID-Hash: JYLPVYCCCKGRWQVG637FTVGI4SFDSA3Z X-MailFrom: alpernebiyasak@gmail.com 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: This driver does not properly map jack pins to kcontrols that PulseAudio and PipeWire need to handle jack detection events. The RT5645 codec used here can detect Headphone and Headset Mic connections. Expose each to userspace as kcontrols. Signed-off-by: Alper Nebi Yasak --- .../mediatek/mt8173/mt8173-rt5650-rt5514.c | 23 +++++++++++++++---- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/sound/soc/mediatek/mt8173/mt8173-rt5650-rt5514.c b/sound/soc/mediatek/mt8173/mt8173-rt5650-rt5514.c index f803f121659d..e502cd1670ba 100644 --- a/sound/soc/mediatek/mt8173/mt8173-rt5650-rt5514.c +++ b/sound/soc/mediatek/mt8173/mt8173-rt5650-rt5514.c @@ -40,6 +40,17 @@ static const struct snd_kcontrol_new mt8173_rt5650_rt5514_controls[] = { SOC_DAPM_PIN_SWITCH("Headset Mic"), }; +static struct snd_soc_jack_pin mt8173_rt5650_rt5514_jack_pins[] = { + { + .pin = "Headphone", + .mask = SND_JACK_HEADPHONE, + }, + { + .pin = "Headset Mic", + .mask = SND_JACK_MICROPHONE, + }, +}; + static int mt8173_rt5650_rt5514_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params) { @@ -82,11 +93,13 @@ static int mt8173_rt5650_rt5514_init(struct snd_soc_pcm_runtime *runtime) RT5645_CLK_SEL_I2S1_ASRC); /* enable jack detection */ - ret = snd_soc_card_jack_new(card, "Headset Jack", - SND_JACK_HEADPHONE | SND_JACK_MICROPHONE | - SND_JACK_BTN_0 | SND_JACK_BTN_1 | - SND_JACK_BTN_2 | SND_JACK_BTN_3, - &mt8173_rt5650_rt5514_jack); + ret = snd_soc_card_jack_new_pins(card, "Headset Jack", + SND_JACK_HEADPHONE | SND_JACK_MICROPHONE | + SND_JACK_BTN_0 | SND_JACK_BTN_1 | + SND_JACK_BTN_2 | SND_JACK_BTN_3, + &mt8173_rt5650_rt5514_jack, + mt8173_rt5650_rt5514_jack_pins, + ARRAY_SIZE(mt8173_rt5650_rt5514_jack_pins)); if (ret) { dev_err(card->dev, "Can't new Headset Jack %d\n", ret); return ret; From patchwork Wed Aug 2 17:57:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alper Nebi Yasak X-Patchwork-Id: 13338701 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 83ADDC001DF for ; Wed, 2 Aug 2023 18:02:31 +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 BEAA6843; Wed, 2 Aug 2023 20:01:39 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz BEAA6843 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1690999349; bh=GaO5nQByXKm7CHVG/RbTdDt5Gb53mwcJye5+lhsRbVk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=lTbs0fWEfbb6GF6iZed7zQwMA+netXHD8Fx2lRsPu+f3wBuwKBKa3nPCV9D3stWr4 nVZOJPXf0jEXvZ/JGzHj6Yjok+8i/VaLQoQAiTh9xbJmEpPObXmLIQO0aOKVMwyYx+ qsd422FR2jH9rAu5ss84VfXGC1iHmgb2tbIz4qNM= Received: by alsa1.perex.cz (Postfix, from userid 50401) id B0E98F80605; Wed, 2 Aug 2023 19:58:51 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id F12D0F80606; Wed, 2 Aug 2023 19:58:50 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 949EDF805B5; Wed, 2 Aug 2023 19:58:26 +0200 (CEST) Received: from mail-wm1-x32f.google.com (mail-wm1-x32f.google.com [IPv6:2a00:1450:4864:20::32f]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 05BD8F805AF for ; Wed, 2 Aug 2023 19:58:23 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 05BD8F805AF Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20221208 header.b=P7SbG6nL Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-3fe2bc2702cso1513855e9.1 for ; Wed, 02 Aug 2023 10:58:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690999102; x=1691603902; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=KlBC1H0XtO+vTlN099a54STTMxr//GhxYmUmPY9nGaY=; b=P7SbG6nLbP5uQyIVD5oRSxcoBdInRHrHOSv3pvN/jypg+ocEyrjRbQ4lqEKp1vJiIu 7mDOvNK00gS5ddxx1HL+aDnc287/Kef8HVateKq08UJ+ZxcQva9Q739eH7LKqylyQ/fz F66/1c6237DYGJ7C2P7le9/P9rNYRkgJB95gmL1ZDEfZ8wfaerwWkEUAWXGeiDjfxE+U TpYj3I1a81h68lFefEYaO6OOn0DJ39tBL5Yop8v3OTuu46N5a8rocO63RHcKojqrFgde z4Ip44DptNxtQ6sHAscXu8uNI+o+eo/aWuIYPBGLyoDeBYUCR+V7NCuCf4e7U1AfnM2Q RNxg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690999102; x=1691603902; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=KlBC1H0XtO+vTlN099a54STTMxr//GhxYmUmPY9nGaY=; b=LIM8ww8oRuhGgee0sAxX7P+bqvhU5uJDSuypXScEpRtOG/tVzK0qvA6hBU6gziJce7 cHnupx7rFSAbKFo7L1UMHREemBGnvJcoJr+oX85/xr/R5SUueFHo5ZjDSVkjbea8loOX SpK2dv50LY3D70OK2HcS+3AfAjRjLI6/2WC8d89Vd3rM0J6TCRSLGS0naaLTxkdteqpZ GgBZy+0aboGGSepIHZoFvgoeAECaGq8INoiOh8QnRzAyd1fPst6tbVJ0zAFD6UjRVBwS CQETSoumorubUFThIzAqOHIyg1pU+L+RXVOhWvADd02X625+3sq0iw6o/tH/z+F8+Ydd yViQ== X-Gm-Message-State: ABy/qLbdgBDfE7YUdY4uCE5DM0gKLlEWHwRS4FWtFK5u206qNqDo5vSe XC4uvzTTmcY/2tVEAF+rBbO2bc5MZrM= X-Google-Smtp-Source: APBJJlGfeKrU/n8gCLLShGwZi3d6BtH6N8GQz9cTtygM4kg1m56ye3zCalthG5m6h7ODrfn0m0jQhw== X-Received: by 2002:a7b:c8d2:0:b0:3fe:90f:8496 with SMTP id f18-20020a7bc8d2000000b003fe090f8496mr5507988wml.1.1690999102117; Wed, 02 Aug 2023 10:58:22 -0700 (PDT) Received: from ALPER-PC.. ([178.233.24.1]) by smtp.gmail.com with ESMTPSA id l23-20020a7bc457000000b003fe20db88ebsm2192439wmi.31.2023.08.02.10.58.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Aug 2023 10:58:21 -0700 (PDT) From: Alper Nebi Yasak To: alsa-devel@alsa-project.org Cc: Cezary Rojewski , Alper Nebi Yasak , Mark Brown , Liam Girdwood , Takashi Iwai , AngeloGioacchino Del Regno , Jaroslav Kysela , linux-kernel@vger.kernel.org, Akihiko Odaki , Pierre-Louis Bossart , Matthias Brugger , =?utf-8?q?N=C3=ADcolas_F_=2E_R_?= =?utf-8?q?=2E_A_=2E_Prado?= Subject: [PATCH 14/27] ASoC: mediatek: mt8173-rt5650-rt5676: Map missing jack kcontrols Date: Wed, 2 Aug 2023 20:57:24 +0300 Message-Id: <20230802175737.263412-15-alpernebiyasak@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230802175737.263412-1-alpernebiyasak@gmail.com> References: <20230802175737.263412-1-alpernebiyasak@gmail.com> MIME-Version: 1.0 Message-ID-Hash: CRP4RXDFLD7H4VCW3C5MM33KLHNNSEJT X-Message-ID-Hash: CRP4RXDFLD7H4VCW3C5MM33KLHNNSEJT X-MailFrom: alpernebiyasak@gmail.com 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: This driver does not properly map jack pins to kcontrols that PulseAudio and PipeWire need to handle jack detection events. The RT5645 codec used here can detect Headphone and Headset Mic connections. Expose both to userspace as kcontrols. Signed-off-by: Alper Nebi Yasak --- .../mediatek/mt8173/mt8173-rt5650-rt5676.c | 23 +++++++++++++++---- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/sound/soc/mediatek/mt8173/mt8173-rt5650-rt5676.c b/sound/soc/mediatek/mt8173/mt8173-rt5650-rt5676.c index 8794720cea3a..ffb094284bfb 100644 --- a/sound/soc/mediatek/mt8173/mt8173-rt5650-rt5676.c +++ b/sound/soc/mediatek/mt8173/mt8173-rt5650-rt5676.c @@ -44,6 +44,17 @@ static const struct snd_kcontrol_new mt8173_rt5650_rt5676_controls[] = { SOC_DAPM_PIN_SWITCH("Headset Mic"), }; +static struct snd_soc_jack_pin mt8173_rt5650_rt5676_jack_pins[] = { + { + .pin = "Headphone", + .mask = SND_JACK_HEADPHONE, + }, + { + .pin = "Headset Mic", + .mask = SND_JACK_MICROPHONE, + }, +}; + static int mt8173_rt5650_rt5676_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params) { @@ -95,11 +106,13 @@ static int mt8173_rt5650_rt5676_init(struct snd_soc_pcm_runtime *runtime) RT5677_CLK_SEL_I2S2_ASRC); /* enable jack detection */ - ret = snd_soc_card_jack_new(card, "Headset Jack", - SND_JACK_HEADPHONE | SND_JACK_MICROPHONE | - SND_JACK_BTN_0 | SND_JACK_BTN_1 | - SND_JACK_BTN_2 | SND_JACK_BTN_3, - &mt8173_rt5650_rt5676_jack); + ret = snd_soc_card_jack_new_pins(card, "Headset Jack", + SND_JACK_HEADPHONE | SND_JACK_MICROPHONE | + SND_JACK_BTN_0 | SND_JACK_BTN_1 | + SND_JACK_BTN_2 | SND_JACK_BTN_3, + &mt8173_rt5650_rt5676_jack, + mt8173_rt5650_rt5676_jack_pins, + ARRAY_SIZE(mt8173_rt5650_rt5676_jack_pins)); if (ret) { dev_err(card->dev, "Can't new Headset Jack %d\n", ret); return ret; From patchwork Wed Aug 2 17:57:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alper Nebi Yasak X-Patchwork-Id: 13338702 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 6F9A3C001DF for ; Wed, 2 Aug 2023 18:02:46 +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 45800829; Wed, 2 Aug 2023 20:01:54 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 45800829 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1690999364; bh=7CKbjMP/B9VMbvg1xRhi8emxsMts2BBCwJ3arzZc+0k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=P2KlaS6BPzHeoTO4N2AzniZ5szLQ0IKJxK5yzXlRdflIpyQJOmy9KKi//IhqS2BoP bck6/FMv4Yratyvw7QcdkMkxfc9Lj1AcBGt6w1E9YKVyz/AtbdYIVTBSHjssEpgXIW m7fKladGZWMFLdiya1vjjNP0K1kktfqv0EVp2I6s= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 8F8BCF80608; Wed, 2 Aug 2023 19:58:55 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 97B9AF80609; Wed, 2 Aug 2023 19:58:54 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 43FEDF805B5; Wed, 2 Aug 2023 19:58:28 +0200 (CEST) Received: from mail-wm1-x332.google.com (mail-wm1-x332.google.com [IPv6:2a00:1450:4864:20::332]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id E17D6F805AC for ; Wed, 2 Aug 2023 19:58:25 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz E17D6F805AC Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20221208 header.b=s3Ze57Wv Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-3fbc59de009so1194615e9.3 for ; Wed, 02 Aug 2023 10:58:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690999104; x=1691603904; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=e7Eujl9TONcNYsMANe/HBMPhXswxieLTEnBVw6VDaZs=; b=s3Ze57WvoBdJRWBk+oNorD4T96n4Clz5XVEh7ZN2O8aeoaDHpqSOR14ZBkCVUfP21q x18yJZRzpN3tpgvEZTXXAe7ooi3CK7xtbJurmgsoqtHblmM1G+nKmFSM4+2W0XwnxX0o 9K9y98/XSe2pUvNwpcncrUPAoxNd0UIxEyFSP1kIMMC8nPrwwXfsXVzm4u+jvaVcfkq4 vjXJ/0PTS5fQ3NJhljyw37VLDWvxZV1SSorsKJtNfUw7xwvqZybOvsNCcYTD0FRSV/WZ byX+kemK8LndSyfuYhDXNRJQSsnTfYCdNN8CXBy2A/9M5sEyv7+U4ceS/7PlGTBZZEWX HK3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690999104; x=1691603904; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=e7Eujl9TONcNYsMANe/HBMPhXswxieLTEnBVw6VDaZs=; b=a5sZby3ZZUf7gbeuNB8pnKnH7lCwezdpCnkaaNku/laqHfD0vk0zhdFDJJd5TqPt+M afhsD8/rXzZTldz0uYbheeJkRhVmff99eaEVVDKShmoQQbN/frogOD3Wne9d1t9ewRSD qnaftGkM9QahTLqfMVo5+8idXIq8EOSIfENCI2PRdsDh5YgCIcjXLKJeJDYTVfa/7vhQ KkaA4Wkdeks+X+lORUOzpsEe/GD0OF2Oc3PpAObF6AswFi7NUim1JRzptwYMFM2h210L GyfAd1sKf5ZlM8zNjLb/rArTE9yDF/ZqhOtA7gKES528xIUjRIjR1tI5iqJVUjQX9Fw6 IVsQ== X-Gm-Message-State: ABy/qLaBdWXO1674GuBir2SC8prAJe+wIqiz2lI1oTQib24q9HL87N9V aUclKT6n87FEYcHygBCpV9Yc/d8GxaY= X-Google-Smtp-Source: APBJJlE9v5IMSE84zbQhqQGnEpXNG4pSickpNyGMWVqiZVTFXLE89xOKSB3Mt6As+quUq+SxsRUTZQ== X-Received: by 2002:a1c:f309:0:b0:3fc:e7d:ca57 with SMTP id q9-20020a1cf309000000b003fc0e7dca57mr5432380wmq.2.1690999104110; Wed, 02 Aug 2023 10:58:24 -0700 (PDT) Received: from ALPER-PC.. ([178.233.24.1]) by smtp.gmail.com with ESMTPSA id l23-20020a7bc457000000b003fe20db88ebsm2192439wmi.31.2023.08.02.10.58.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Aug 2023 10:58:23 -0700 (PDT) From: Alper Nebi Yasak To: alsa-devel@alsa-project.org Cc: Cezary Rojewski , Alper Nebi Yasak , Mark Brown , Liam Girdwood , Takashi Iwai , AngeloGioacchino Del Regno , Jaroslav Kysela , linux-kernel@vger.kernel.org, Akihiko Odaki , Pierre-Louis Bossart , Matthias Brugger , =?utf-8?q?N=C3=ADcolas_F_=2E_R_?= =?utf-8?q?=2E_A_=2E_Prado?= Subject: [PATCH 15/27] ASoC: mediatek: mt8173-rt5650: Map missing jack kcontrols Date: Wed, 2 Aug 2023 20:57:25 +0300 Message-Id: <20230802175737.263412-16-alpernebiyasak@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230802175737.263412-1-alpernebiyasak@gmail.com> References: <20230802175737.263412-1-alpernebiyasak@gmail.com> MIME-Version: 1.0 Message-ID-Hash: I57TBE5SBJG4DCHPPERMS5VXKCUVTABV X-Message-ID-Hash: I57TBE5SBJG4DCHPPERMS5VXKCUVTABV X-MailFrom: alpernebiyasak@gmail.com 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: This driver does not properly map jack pins to kcontrols that PulseAudio and PipeWire need to handle jack detection events. The RT5645 codec used here can detect Headphone and Headset Mic connections. Expose both to userspace as kcontrols. Signed-off-by: Alper Nebi Yasak --- Tested on a "Hana" Chromebook. sound/soc/mediatek/mt8173/mt8173-rt5650.c | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/sound/soc/mediatek/mt8173/mt8173-rt5650.c b/sound/soc/mediatek/mt8173/mt8173-rt5650.c index 3ece4b5eaca2..18cf84bb25c7 100644 --- a/sound/soc/mediatek/mt8173/mt8173-rt5650.c +++ b/sound/soc/mediatek/mt8173/mt8173-rt5650.c @@ -54,6 +54,17 @@ static const struct snd_kcontrol_new mt8173_rt5650_controls[] = { SOC_DAPM_PIN_SWITCH("Headset Mic"), }; +static struct snd_soc_jack_pin mt8173_rt5650_jack_pins[] = { + { + .pin = "Headphone", + .mask = SND_JACK_HEADPHONE, + }, + { + .pin = "Headset Mic", + .mask = SND_JACK_MICROPHONE, + }, +}; + static int mt8173_rt5650_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params) { @@ -128,11 +139,13 @@ static int mt8173_rt5650_init(struct snd_soc_pcm_runtime *runtime) } /* enable jack detection */ - ret = snd_soc_card_jack_new(card, "Headset Jack", - SND_JACK_HEADPHONE | SND_JACK_MICROPHONE | - SND_JACK_BTN_0 | SND_JACK_BTN_1 | - SND_JACK_BTN_2 | SND_JACK_BTN_3, - &mt8173_rt5650_jack); + ret = snd_soc_card_jack_new_pins(card, "Headset Jack", + SND_JACK_HEADPHONE | SND_JACK_MICROPHONE | + SND_JACK_BTN_0 | SND_JACK_BTN_1 | + SND_JACK_BTN_2 | SND_JACK_BTN_3, + &mt8173_rt5650_jack, + mt8173_rt5650_jack_pins, + ARRAY_SIZE(mt8173_rt5650_jack_pins)); if (ret) { dev_err(card->dev, "Can't new Headset Jack %d\n", ret); return ret; From patchwork Wed Aug 2 17:57:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alper Nebi Yasak X-Patchwork-Id: 13338703 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 D8561C001DF for ; Wed, 2 Aug 2023 18:03:01 +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 07ABD7F8; Wed, 2 Aug 2023 20:02:10 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 07ABD7F8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1690999380; bh=PrSI7WQVnoqDe9IDUmJvNs1KkhAx16hNHXIFGdWiaBY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=le89CwvyEQrg2Yesyjwm3TzdP5P3PVt3f/A+y2kE5yOMb6JL7/a4VF0BVHZhYS8xL cyhILiMUbmuOBTJPPCh/rx02QeEfYkHDp21dhGwyHtpucsNrAAA7TCH3lfro4x8hm5 ErlyldI3MAwS8e+pIrCy+RfPPkncPcA056/v7BiM= Received: by alsa1.perex.cz (Postfix, from userid 50401) id CCCFAF805F2; Wed, 2 Aug 2023 19:58:58 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id E0744F80611; Wed, 2 Aug 2023 19:58:57 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 003CFF805C5; Wed, 2 Aug 2023 19:58:30 +0200 (CEST) Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [IPv6:2a00:1450:4864:20::334]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 9358BF805AF for ; Wed, 2 Aug 2023 19:58:27 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 9358BF805AF Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20221208 header.b=CaRzBES1 Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-3fe110de3b6so914485e9.1 for ; Wed, 02 Aug 2023 10:58:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690999106; x=1691603906; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=JOTz/u9h6P9leGyC09eMFHXEMo4zw2Mhp9Q7N9y8+Lo=; b=CaRzBES1FDktCZ6D1HQtMLP4jc3qk7AZELAeJc3JSrbBRbYT0tfEJLlNDso9DRXWOq XVa8E3R5/mgszPKPvlD9LObpE5K+AmZjjJZac2SCgTJlj/3djHobvaynwKLytSkxJclO gwFAo3t+7JdJSVqeu+Se0wFkPHJ/GP8VYslMCzNd3kCuz3qehCHDPI2dftcLcLPDZG4b Ro1XKGKxJRWs1GA73woOh33jfl+8dsm4GUV2WyKiLK6z671qh0cLSTriuuv8e9LjCEXb WAmrmaxWqWdev+LNA6O3tMS69WFQGt8jxVGZ3Wp7azGnHcHjZiuRl8bEhjX/yLiHQ/lm tRyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690999106; x=1691603906; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=JOTz/u9h6P9leGyC09eMFHXEMo4zw2Mhp9Q7N9y8+Lo=; b=YkUlAfIHBxUrQ/hi9vhBsMGYIi4Rdk01nzVljeWBMUBfMD6EiaNXyJkNk4qlLuy34b yMfvPozocIFJnfQsbbSsv7L7/2cT0wuXmMRGbcqqa/mMuepwu+LwZVrv9rZKZIOM7QrS NCA+9rLzKAVwDs6s3opgopSbK4ULZrKVyng96THJM6DDJDq12q89SGuyAAvhZ3oM7Tg+ 6euvRO8qhtALSkIxdKWXjDctsaimgQ2CBzkQoZaNqjFeZ7fAWjeEWKJ/FceleR5xFo2W MFoHEIcxYuEV5ibxhAx1NdAL07YmskatWSDw6Whw7TRm2SHzGoJXSkRkSJRYMbuwA9qD fpjQ== X-Gm-Message-State: ABy/qLYBNxxArs6uhzCsVPjrfme6J596GiGwyw8KA7wBH9sfHJfqM/8F OSjJj+ZkI+C8XyZUWvaeoIGgsWOY1C4= X-Google-Smtp-Source: APBJJlFQr90XtoOe1xMFjV23Olv3dL2133iR2JzhQ3pihRr/5UJoSbJrQ/JU2PzpS3DPbWt4BQ8fFw== X-Received: by 2002:a7b:ce94:0:b0:3fb:e1d0:6417 with SMTP id q20-20020a7bce94000000b003fbe1d06417mr5516087wmj.19.1690999106013; Wed, 02 Aug 2023 10:58:26 -0700 (PDT) Received: from ALPER-PC.. ([178.233.24.1]) by smtp.gmail.com with ESMTPSA id l23-20020a7bc457000000b003fe20db88ebsm2192439wmi.31.2023.08.02.10.58.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Aug 2023 10:58:25 -0700 (PDT) From: Alper Nebi Yasak To: alsa-devel@alsa-project.org Cc: Cezary Rojewski , Alper Nebi Yasak , Mark Brown , Liam Girdwood , Takashi Iwai , AngeloGioacchino Del Regno , Jaroslav Kysela , linux-kernel@vger.kernel.org, Akihiko Odaki , Pierre-Louis Bossart , Matthias Brugger , =?utf-8?q?N=C3=ADcolas_F_=2E_R_?= =?utf-8?q?=2E_A_=2E_Prado?= Subject: [PATCH 16/27] ASoC: mediatek: mt8183-da7219-max98357: Map missing jack kcontrols Date: Wed, 2 Aug 2023 20:57:26 +0300 Message-Id: <20230802175737.263412-17-alpernebiyasak@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230802175737.263412-1-alpernebiyasak@gmail.com> References: <20230802175737.263412-1-alpernebiyasak@gmail.com> MIME-Version: 1.0 Message-ID-Hash: SRRFDJZZEQ3NZ675PCCICITFZNYE6225 X-Message-ID-Hash: SRRFDJZZEQ3NZ675PCCICITFZNYE6225 X-MailFrom: alpernebiyasak@gmail.com 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: This driver does not properly map jack pins to kcontrols that PulseAudio and PipeWire need to handle jack detection events. The DA7219 codec used here can detect Headphones, Headset Mic and Line Out connections. Expose each to userspace as kcontrols and add the necessary widgets. Signed-off-by: Alper Nebi Yasak --- .../mediatek/mt8183/mt8183-da7219-max98357.c | 43 ++++++++++++++++--- 1 file changed, 36 insertions(+), 7 deletions(-) diff --git a/sound/soc/mediatek/mt8183/mt8183-da7219-max98357.c b/sound/soc/mediatek/mt8183/mt8183-da7219-max98357.c index 87bb04846991..701fbcc0f2c9 100644 --- a/sound/soc/mediatek/mt8183/mt8183-da7219-max98357.c +++ b/sound/soc/mediatek/mt8183/mt8183-da7219-max98357.c @@ -29,6 +29,21 @@ struct mt8183_da7219_max98357_priv { struct snd_soc_jack headset_jack, hdmi_jack; }; +static struct snd_soc_jack_pin mt8183_da7219_max98357_jack_pins[] = { + { + .pin = "Headphone", + .mask = SND_JACK_HEADPHONE, + }, + { + .pin = "Headset Mic", + .mask = SND_JACK_MICROPHONE, + }, + { + .pin = "Line Out", + .mask = SND_JACK_LINEOUT, + }, +}; + static int mt8183_mt6358_i2s_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params) { @@ -572,13 +587,15 @@ mt8183_da7219_max98357_headset_init(struct snd_soc_component *component) snd_soc_card_get_drvdata(component->card); /* Enable Headset and 4 Buttons Jack detection */ - ret = snd_soc_card_jack_new(component->card, - "Headset Jack", - SND_JACK_HEADSET | - SND_JACK_BTN_0 | SND_JACK_BTN_1 | - SND_JACK_BTN_2 | SND_JACK_BTN_3 | - SND_JACK_LINEOUT, - &priv->headset_jack); + ret = snd_soc_card_jack_new_pins(component->card, + "Headset Jack", + SND_JACK_HEADSET | + SND_JACK_BTN_0 | SND_JACK_BTN_1 | + SND_JACK_BTN_2 | SND_JACK_BTN_3 | + SND_JACK_LINEOUT, + &priv->headset_jack, + mt8183_da7219_max98357_jack_pins, + ARRAY_SIZE(mt8183_da7219_max98357_jack_pins)); if (ret) return ret; @@ -609,12 +626,18 @@ static struct snd_soc_codec_conf mt6358_codec_conf[] = { }; static const struct snd_kcontrol_new mt8183_da7219_max98357_snd_controls[] = { + SOC_DAPM_PIN_SWITCH("Headphone"), + SOC_DAPM_PIN_SWITCH("Headset Mic"), SOC_DAPM_PIN_SWITCH("Speakers"), + SOC_DAPM_PIN_SWITCH("Line Out"), }; static const struct snd_soc_dapm_widget mt8183_da7219_max98357_dapm_widgets[] = { + SND_SOC_DAPM_HP("Headphone", NULL), + SND_SOC_DAPM_MIC("Headset Mic", NULL), SND_SOC_DAPM_SPK("Speakers", NULL), + SND_SOC_DAPM_SPK("Line Out", NULL), SND_SOC_DAPM_PINCTRL("TDM_OUT_PINCTRL", "aud_tdm_out_on", "aud_tdm_out_off"), }; @@ -657,14 +680,20 @@ static struct snd_soc_codec_conf mt8183_da7219_rt1015_codec_conf[] = { }; static const struct snd_kcontrol_new mt8183_da7219_rt1015_snd_controls[] = { + SOC_DAPM_PIN_SWITCH("Headphone"), + SOC_DAPM_PIN_SWITCH("Headset Mic"), SOC_DAPM_PIN_SWITCH("Left Spk"), SOC_DAPM_PIN_SWITCH("Right Spk"), + SOC_DAPM_PIN_SWITCH("Line Out"), }; static const struct snd_soc_dapm_widget mt8183_da7219_rt1015_dapm_widgets[] = { + SND_SOC_DAPM_HP("Headphone", NULL), + SND_SOC_DAPM_MIC("Headset Mic", NULL), SND_SOC_DAPM_SPK("Left Spk", NULL), SND_SOC_DAPM_SPK("Right Spk", NULL), + SND_SOC_DAPM_LINE("Line Out", NULL), SND_SOC_DAPM_PINCTRL("TDM_OUT_PINCTRL", "aud_tdm_out_on", "aud_tdm_out_off"), }; From patchwork Wed Aug 2 17:57:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alper Nebi Yasak X-Patchwork-Id: 13338704 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 7BB02C04A94 for ; Wed, 2 Aug 2023 18:03:20 +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 C004D84D; Wed, 2 Aug 2023 20:02:28 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz C004D84D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1690999398; bh=Fl1bseDgCLGqKsTqJ/RsW3OTeCygOZy/m6F8rLHLTsI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=ALIlwqiWhX0o02Ny7ZaKkrXharm7qDP5NDiIot2/COpmMIaKhWBZfDCHXHPAnYUhA jLJWovgzbGHYFVrH5zlm2vTTIAHFWaUbLNjdRuR0pIHV0L3NYJvxeVX0DD1lNd4g/v UA7Drn4O9SkaL/wSPQBhEE1KZqjbgzkzTK/IGiJY= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 6CB9FF8062D; Wed, 2 Aug 2023 19:59:03 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 70D4AF8061A; Wed, 2 Aug 2023 19:59:02 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id CC055F805C1; Wed, 2 Aug 2023 19:58:32 +0200 (CEST) Received: from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com [IPv6:2a00:1450:4864:20::32e]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 06CF9F805AF for ; Wed, 2 Aug 2023 19:58:29 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 06CF9F805AF Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20221208 header.b=ckvh3W+O Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-3fe110de46dso1436895e9.1 for ; Wed, 02 Aug 2023 10:58:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690999108; x=1691603908; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=9tKsk9a4HVB+S55ZghOAU5wwthWw0fqP95yqfmB/mNM=; b=ckvh3W+OUeJ7+Uj1dkezwP69ylQ4jMSPMBJAdJM8Qlk7PWfAU/iOqdG1Rto7DD6h55 TqRRRZA6G96XtSZG/TvqpfP6S9xE34giI8AiFf/cvdIOe2WM2PzJbA2f8KMxQLeZA8NY MJEbnD9jaQlUV98eo+bRqc/UNiDvhIOVbwUZBwB7ZFOUwvos6y8dLPgXEIczMURVTOTx IKKPpCOBg+PaSefqX/zuPfeiKXa6OaEXDj9aus9LSPN8rybAFjnO0PZZB79gr66Zce9l qkjZZTH2ZzDQprQEK+4EjTVTp2lyz7Hh0Q8BjMu5YsnBEIMMahrRrKNXkZ+ZWRFduINF AvuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690999108; x=1691603908; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=9tKsk9a4HVB+S55ZghOAU5wwthWw0fqP95yqfmB/mNM=; b=Ew0Y9UiI5VQVD/ejNwfffkvEsIvWuzHitfN5bsjwdFFZSJpyu1jB7lvNzY404Ji0C5 KhaiFCVUWy0hTOTxseoDpeA+7Ktq2gmIh4kq1Oc2DTnkKAjvLV9CVEM/5ZlM2VcXqzmg 3M/3iWI429dk1uIehrDz7i7v2CyhjDU1Jz8uTkYX2DVj913LsygUvBWW54XXfsi6oyC4 n8dGqcedtidezUTJwayFhSyii8h9qHTcOZp4FRXm39LHfMR7eYQejwB04tVpEobJ+5Gp xuIyBRSGQ6gIlbiJryh96aCpK9ZI/R60F/xgj3X1yLh4MAAGa019NYqv7iuCSfbxw2SZ Ky5Q== X-Gm-Message-State: ABy/qLYH26d4FmWQ/mNIXxiVZFal7sXAFse15v+RmkDyuC5c5hAvj9kH cYEIr1CrpdCcC8ZREUYBqKvToRGP0zs= X-Google-Smtp-Source: APBJJlEF8cOYoAUKlqHUoCLkwAgJHMLQWtyJ153NH2rnGdVlOoGWexOb01jQilkY+8Ksa0H6pPGIwQ== X-Received: by 2002:a05:600c:2297:b0:3fe:6f7:60aa with SMTP id 23-20020a05600c229700b003fe06f760aamr5661333wmf.12.1690999107976; Wed, 02 Aug 2023 10:58:27 -0700 (PDT) Received: from ALPER-PC.. ([178.233.24.1]) by smtp.gmail.com with ESMTPSA id l23-20020a7bc457000000b003fe20db88ebsm2192439wmi.31.2023.08.02.10.58.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Aug 2023 10:58:27 -0700 (PDT) From: Alper Nebi Yasak To: alsa-devel@alsa-project.org Cc: Cezary Rojewski , Alper Nebi Yasak , Mark Brown , Liam Girdwood , Takashi Iwai , AngeloGioacchino Del Regno , Jaroslav Kysela , linux-kernel@vger.kernel.org, Akihiko Odaki , Pierre-Louis Bossart , Matthias Brugger , =?utf-8?q?N=C3=ADcolas_F_=2E_R_?= =?utf-8?q?=2E_A_=2E_Prado?= Subject: [PATCH 17/27] ASoC: mediatek: mt8183-mt6358-ts3a227-max98357: Map missing jack kcontrols Date: Wed, 2 Aug 2023 20:57:27 +0300 Message-Id: <20230802175737.263412-18-alpernebiyasak@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230802175737.263412-1-alpernebiyasak@gmail.com> References: <20230802175737.263412-1-alpernebiyasak@gmail.com> MIME-Version: 1.0 Message-ID-Hash: N6SBCNDHHCOIHUPHIEOBXLOHQXHYV3Z6 X-Message-ID-Hash: N6SBCNDHHCOIHUPHIEOBXLOHQXHYV3Z6 X-MailFrom: alpernebiyasak@gmail.com 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: This driver does not properly map jack pins to kcontrols that PulseAudio and PipeWire need to handle jack detection events. The TS3A227 component used here can detect Headphones and Headset Mic connections. Expose each to userspace as kcontrols and add the necessary widgets. Signed-off-by: Alper Nebi Yasak --- Tested on a "Cozmo" Chromebook. .../mt8183/mt8183-mt6358-ts3a227-max98357.c | 53 ++++++++++++++++--- 1 file changed, 47 insertions(+), 6 deletions(-) diff --git a/sound/soc/mediatek/mt8183/mt8183-mt6358-ts3a227-max98357.c b/sound/soc/mediatek/mt8183/mt8183-mt6358-ts3a227-max98357.c index ce9aedde7e1e..850f4d949d97 100644 --- a/sound/soc/mediatek/mt8183/mt8183-mt6358-ts3a227-max98357.c +++ b/sound/soc/mediatek/mt8183/mt8183-mt6358-ts3a227-max98357.c @@ -592,11 +592,38 @@ static struct snd_soc_dai_link mt8183_mt6358_ts3a227_dai_links[] = { }, }; +static const +struct snd_kcontrol_new mt8183_mt6358_ts3a227_max98357_snd_controls[] = { + SOC_DAPM_PIN_SWITCH("Headphone"), + SOC_DAPM_PIN_SWITCH("Headset Mic"), +}; + +static const +struct snd_soc_dapm_widget mt8183_mt6358_ts3a227_max98357_dapm_widgets[] = { + SND_SOC_DAPM_HP("Headphone", NULL), + SND_SOC_DAPM_MIC("Headset Mic", NULL), +}; + +static struct snd_soc_jack_pin mt8183_mt6358_ts3a227_max98357_jack_pins[] = { + { + .pin = "Headphone", + .mask = SND_JACK_HEADPHONE, + }, + { + .pin = "Headset Mic", + .mask = SND_JACK_MICROPHONE, + }, +}; + static struct snd_soc_card mt8183_mt6358_ts3a227_max98357_card = { .name = "mt8183_mt6358_ts3a227_max98357", .owner = THIS_MODULE, .dai_link = mt8183_mt6358_ts3a227_dai_links, .num_links = ARRAY_SIZE(mt8183_mt6358_ts3a227_dai_links), + .controls = mt8183_mt6358_ts3a227_max98357_snd_controls, + .num_controls = ARRAY_SIZE(mt8183_mt6358_ts3a227_max98357_snd_controls), + .dapm_widgets = mt8183_mt6358_ts3a227_max98357_dapm_widgets, + .num_dapm_widgets = ARRAY_SIZE(mt8183_mt6358_ts3a227_max98357_dapm_widgets), }; static struct snd_soc_card mt8183_mt6358_ts3a227_max98357b_card = { @@ -604,6 +631,10 @@ static struct snd_soc_card mt8183_mt6358_ts3a227_max98357b_card = { .owner = THIS_MODULE, .dai_link = mt8183_mt6358_ts3a227_dai_links, .num_links = ARRAY_SIZE(mt8183_mt6358_ts3a227_dai_links), + .controls = mt8183_mt6358_ts3a227_max98357_snd_controls, + .num_controls = ARRAY_SIZE(mt8183_mt6358_ts3a227_max98357_snd_controls), + .dapm_widgets = mt8183_mt6358_ts3a227_max98357_dapm_widgets, + .num_dapm_widgets = ARRAY_SIZE(mt8183_mt6358_ts3a227_max98357_dapm_widgets), }; static struct snd_soc_codec_conf mt8183_mt6358_ts3a227_rt1015_amp_conf[] = { @@ -624,6 +655,10 @@ static struct snd_soc_card mt8183_mt6358_ts3a227_rt1015_card = { .num_links = ARRAY_SIZE(mt8183_mt6358_ts3a227_dai_links), .codec_conf = mt8183_mt6358_ts3a227_rt1015_amp_conf, .num_configs = ARRAY_SIZE(mt8183_mt6358_ts3a227_rt1015_amp_conf), + .controls = mt8183_mt6358_ts3a227_max98357_snd_controls, + .num_controls = ARRAY_SIZE(mt8183_mt6358_ts3a227_max98357_snd_controls), + .dapm_widgets = mt8183_mt6358_ts3a227_max98357_dapm_widgets, + .num_dapm_widgets = ARRAY_SIZE(mt8183_mt6358_ts3a227_max98357_dapm_widgets), }; static struct snd_soc_card mt8183_mt6358_ts3a227_rt1015p_card = { @@ -631,6 +666,10 @@ static struct snd_soc_card mt8183_mt6358_ts3a227_rt1015p_card = { .owner = THIS_MODULE, .dai_link = mt8183_mt6358_ts3a227_dai_links, .num_links = ARRAY_SIZE(mt8183_mt6358_ts3a227_dai_links), + .controls = mt8183_mt6358_ts3a227_max98357_snd_controls, + .num_controls = ARRAY_SIZE(mt8183_mt6358_ts3a227_max98357_snd_controls), + .dapm_widgets = mt8183_mt6358_ts3a227_max98357_dapm_widgets, + .num_dapm_widgets = ARRAY_SIZE(mt8183_mt6358_ts3a227_max98357_dapm_widgets), }; static int @@ -641,12 +680,14 @@ mt8183_mt6358_ts3a227_max98357_headset_init(struct snd_soc_component *component) snd_soc_card_get_drvdata(component->card); /* Enable Headset and 4 Buttons Jack detection */ - ret = snd_soc_card_jack_new(component->card, - "Headset Jack", - SND_JACK_HEADSET | - SND_JACK_BTN_0 | SND_JACK_BTN_1 | - SND_JACK_BTN_2 | SND_JACK_BTN_3, - &priv->headset_jack); + ret = snd_soc_card_jack_new_pins(component->card, + "Headset Jack", + SND_JACK_HEADSET | + SND_JACK_BTN_0 | SND_JACK_BTN_1 | + SND_JACK_BTN_2 | SND_JACK_BTN_3, + &priv->headset_jack, + mt8183_mt6358_ts3a227_max98357_jack_pins, + ARRAY_SIZE(mt8183_mt6358_ts3a227_max98357_jack_pins)); if (ret) return ret; From patchwork Wed Aug 2 17:57:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alper Nebi Yasak X-Patchwork-Id: 13338705 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 E62A1C04A94 for ; Wed, 2 Aug 2023 18:03:36 +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 4CEF4DEE; Wed, 2 Aug 2023 20:02:45 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 4CEF4DEE DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1690999415; bh=ajLtkER/3IRp+AAbo1L5IpJLnnbMCls0fRNliYEQMSc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=Et4WrmYRo8+2KrnbBUSJr1qCYTHZ9IMpZ847lUfSSsomZrpHSuGgtPtxxr40qSMnA mqwLj2FDLkuwDKKn5JdzrEiZcEM8Dhj/7YXSfsAOX7mo6F7fyd8kvJ9jRLTnVgkoUi KcYsUmbcR3wr4DUsiftPP+T5tWIUvDW2nR8U+GdA= Received: by alsa1.perex.cz (Postfix, from userid 50401) id C6F2FF8062E; Wed, 2 Aug 2023 19:59:06 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id E2344F80632; Wed, 2 Aug 2023 19:59:05 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 4DC8BF805AF; Wed, 2 Aug 2023 19:58:34 +0200 (CEST) Received: from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com [IPv6:2a00:1450:4864:20::32a]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 979A6F805D5 for ; Wed, 2 Aug 2023 19:58:31 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 979A6F805D5 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20221208 header.b=o61PY30O Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-3fbc59de009so1195425e9.3 for ; Wed, 02 Aug 2023 10:58:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690999110; x=1691603910; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=XyXZmbrejVy6oU7P85KygnAFUmokjdS7T3od5TZzPV0=; b=o61PY30OWJEqIsIJbqjC2wEfrFt++nmLh2bc7nDkGL4MxB0bYYDOddvwOSTvGgO9/1 RHnKe82BAvOY83+5Xd7YOx6OdqDvUJ9VfsRQaxg410gY6M8Z1JzmF12gvrgEX+EXNG9i Bwn0OqH9bVANcCIpVEZci0Iki55/dZZrXWhvR3962AXTLoDu8IV6Cgx415uAlEIIhQxX P1ta1eLDdskcspu7cWdvn25AoQdd7Ot8Vb4AsPGUfqe40RI/3U7vpm2361KN1PXfCLP2 lKV9u/gO3uLo2KNITq31zmI+fiqfmVrYKpoaPaqovx35yulDGwhwI9Psm2w6ScUR+/1x Kk3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690999110; x=1691603910; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=XyXZmbrejVy6oU7P85KygnAFUmokjdS7T3od5TZzPV0=; b=YRTZxplrHiNGyUPgwel/KHagsaz9IwE0vHCWUUYZwyrau19ZcUHdTD6tkHoua/0jQy blVQYCkzzz5fy1vefceBZUMUvVU/gbwsqDxsZvEk3+9XkjEVXKwPC9bMXb+Son5nu7IU M6yxe9/t1FPnytUJOxXVsvj0qnlyOP8MxlNcNl5QmTWA5hRw0EiVptWtHetVo7ODKDLr zcvxTzDuxDmtehbiG7QSLvdgfGNZR4DbQl8IpxFsRCUY6sQs/HOYnNHwCQ0WtWSSOs2q 6O0QBRA3MesdYYpYwusvPIh4H3AeoUVrngazcLCEw798ncxNJMkqHtulBvjL9w+FM58e WttA== X-Gm-Message-State: ABy/qLZsIKGUkBd0ei2pin4KFjiyVs2qG47o55Lz/wFlKRUoHiHCm6v+ Q9iwTmxd6+bOobVRq3mYYn4qIg9IilQ= X-Google-Smtp-Source: APBJJlG6lh7xO8s7gdwcdPpW393CzJ8GrsGTZ/O8tPJvPn73H1VkhPTU437+89OuIPBLICk0Dx6pWw== X-Received: by 2002:a1c:7714:0:b0:3fb:be7c:d58a with SMTP id t20-20020a1c7714000000b003fbbe7cd58amr4909567wmi.26.1690999109889; Wed, 02 Aug 2023 10:58:29 -0700 (PDT) Received: from ALPER-PC.. ([178.233.24.1]) by smtp.gmail.com with ESMTPSA id l23-20020a7bc457000000b003fe20db88ebsm2192439wmi.31.2023.08.02.10.58.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Aug 2023 10:58:29 -0700 (PDT) From: Alper Nebi Yasak To: alsa-devel@alsa-project.org Cc: Cezary Rojewski , Alper Nebi Yasak , Mark Brown , Liam Girdwood , Takashi Iwai , AngeloGioacchino Del Regno , Jaroslav Kysela , linux-kernel@vger.kernel.org, Akihiko Odaki , Pierre-Louis Bossart , Matthias Brugger , =?utf-8?q?N=C3=ADcolas_F_=2E_R_?= =?utf-8?q?=2E_A_=2E_Prado?= Subject: [PATCH 18/27] ASoC: mediatek: mt8186-mt6366-da7219-max98357: Map missing jack kcontrols Date: Wed, 2 Aug 2023 20:57:28 +0300 Message-Id: <20230802175737.263412-19-alpernebiyasak@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230802175737.263412-1-alpernebiyasak@gmail.com> References: <20230802175737.263412-1-alpernebiyasak@gmail.com> MIME-Version: 1.0 Message-ID-Hash: RWU5BPK5NYD5FIHFMT6QHQROZ75BPTQE X-Message-ID-Hash: RWU5BPK5NYD5FIHFMT6QHQROZ75BPTQE X-MailFrom: alpernebiyasak@gmail.com 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: Commit 8e9867486806 ("ASoC: mediatek: mt8186-da7219: Expose individual headset jack pins") maps kcontrols for Headphone and Headset Mic jacks for this driver so that PulseAudio and PipeWire can handle jack detection events for these peripherals. The DA7219 codec used here can also distinguish between Headphone and Line Out connections that go into the same physical port. Expose the latter to userspace as a kcontrol as well and add the necessary widgets. Signed-off-by: Alper Nebi Yasak --- sound/soc/mediatek/mt8186/mt8186-mt6366-da7219-max98357.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sound/soc/mediatek/mt8186/mt8186-mt6366-da7219-max98357.c b/sound/soc/mediatek/mt8186/mt8186-mt6366-da7219-max98357.c index 0432f9d89020..aa8e00bba19b 100644 --- a/sound/soc/mediatek/mt8186/mt8186-mt6366-da7219-max98357.c +++ b/sound/soc/mediatek/mt8186/mt8186-mt6366-da7219-max98357.c @@ -46,6 +46,10 @@ static struct snd_soc_jack_pin mt8186_jack_pins[] = { .pin = "Headset Mic", .mask = SND_JACK_MICROPHONE, }, + { + .pin = "Line Out", + .mask = SND_JACK_LINEOUT, + }, }; static struct snd_soc_codec_conf mt8186_mt6366_da7219_max98357_codec_conf[] = { @@ -964,6 +968,7 @@ mt8186_mt6366_da7219_max98357_widgets[] = { SND_SOC_DAPM_SPK("Speakers", NULL), SND_SOC_DAPM_HP("Headphones", NULL), SND_SOC_DAPM_MIC("Headset Mic", NULL), + SND_SOC_DAPM_LINE("Line Out", NULL), SND_SOC_DAPM_OUTPUT("HDMI1"), SND_SOC_DAPM_MIXER(SOF_DMA_DL1, SND_SOC_NOPM, 0, 0, NULL, 0), SND_SOC_DAPM_MIXER(SOF_DMA_DL2, SND_SOC_NOPM, 0, 0, NULL, 0), @@ -996,6 +1001,7 @@ mt8186_mt6366_da7219_max98357_controls[] = { SOC_DAPM_PIN_SWITCH("Speakers"), SOC_DAPM_PIN_SWITCH("Headphones"), SOC_DAPM_PIN_SWITCH("Headset Mic"), + SOC_DAPM_PIN_SWITCH("Line Out"), SOC_DAPM_PIN_SWITCH("HDMI1"), }; From patchwork Wed Aug 2 17:57:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alper Nebi Yasak X-Patchwork-Id: 13338706 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 6DCFCC04E69 for ; Wed, 2 Aug 2023 18:03:48 +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 891AB85D; Wed, 2 Aug 2023 20:02:56 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 891AB85D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1690999426; bh=fdaWNroSz3paV7Ti/BUf8H74FpjKuhGjaT41yF1b7ck=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=Ou5dn/lTn/1ieiaVyHMd1Yr/9XYkYCn3npY1cxM7GyG0Nc6pZ+aesxGkDpzQ1V2SV gEwQQuhxj2jd6cdXyPeIdVCQvY0knL3fYARVLHNbtODw8hR1zr9YVE2J9Xecbp8XZp +62dGMP+AQoJyJZUfrn0I1l2MzEmA58QIC/GldVI= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 0B7DBF80632; Wed, 2 Aug 2023 19:59:09 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id E8CDEF80633; Wed, 2 Aug 2023 19:59:08 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 07A72F805E2; Wed, 2 Aug 2023 19:58:36 +0200 (CEST) Received: from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com [IPv6:2a00:1450:4864:20::32e]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id ABE88F805AF for ; Wed, 2 Aug 2023 19:58:33 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz ABE88F805AF Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20221208 header.b=oNo4Wjet Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-3fe2bc2701bso1288095e9.2 for ; Wed, 02 Aug 2023 10:58:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690999112; x=1691603912; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=oxOrpyuPOmymgtlpLpXF+pVhKHjkFdHFw3wiijDx7h4=; b=oNo4WjetICtChH1ktYq4b21m9aftBtQTSD6LlcebwyItLqzIhF7TAMisJPe7yIgXIz vg0KkchbM4hQ6e/v+haVCtbS1VbuHjGucUljM+pFrC2+o9iwaF0M0l6K2vMadQEaJ+tP Yz7e49XYRobQqI1Augs3Y1352cEwAY7rA69I7fO4UJGyqV+IvRUQapSiCTV6C37ALdYz Kz074OS1rFUpq61Pwc4GhaN6eb1UgKEeTR1IlzIfWNE96bhEN1MzeU8r2HBR8X5gqSup RdXrNniSwS37eV7RCPnUi5kgfVHGqcwaXhRrTx72nPBtD4T+A0aRyaXEMMew0n64o37M PV4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690999112; x=1691603912; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=oxOrpyuPOmymgtlpLpXF+pVhKHjkFdHFw3wiijDx7h4=; b=QLYuN2Diw+7GijhmYs75rzHHC3W++qFfAebjWdxnAQ/OBp35cy+y+Dc3FIrDaxXMlA cG8oYOPFNUtpTgMbIK0ehIUNsAb5rfcO0d1/VUSHTObADmIQ6xAzpsXqLeMG+fLO89xv +NhsWSqoCV9vOux3blR/vCJ692LEThlJGoWVM7IoQP3fTlnAxTRWahvugZCk/MK4VK2f 9rSN2kSe+jeGIunfMNfHUg/eSB5YuFcJbq9qTVUnm7OxrrAEZT3QkeoVKwA+mtaj9oRl 18R9xztaEoQOiS8qbQFEenDPeycMTv1oXhiCc4A+xNYz5KOa7Oiwo3z53w/B/xtAxKi7 ZaeQ== X-Gm-Message-State: ABy/qLaO1iTpLAVyHXMXJBRg6dhA7NcIQXyNyeULFC4HqSFO5AwesLAH 0q9DNB4EeY2qBKlO/otCujJ9AhMXDdo= X-Google-Smtp-Source: APBJJlE9K3tR2ClpMYZTwTaCYVhiIb9nZbiQ1C7lY7tlCoz1Rl6MrRaS9ngzVQ5fg3zuMCGQaROKgQ== X-Received: by 2002:a7b:cb88:0:b0:3fc:f9c:a3e6 with SMTP id m8-20020a7bcb88000000b003fc0f9ca3e6mr5561916wmi.9.1690999111841; Wed, 02 Aug 2023 10:58:31 -0700 (PDT) Received: from ALPER-PC.. ([178.233.24.1]) by smtp.gmail.com with ESMTPSA id l23-20020a7bc457000000b003fe20db88ebsm2192439wmi.31.2023.08.02.10.58.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Aug 2023 10:58:31 -0700 (PDT) From: Alper Nebi Yasak To: alsa-devel@alsa-project.org Cc: Cezary Rojewski , Alper Nebi Yasak , Mark Brown , Liam Girdwood , Takashi Iwai , AngeloGioacchino Del Regno , Jaroslav Kysela , linux-kernel@vger.kernel.org, Akihiko Odaki , Pierre-Louis Bossart , Matthias Brugger , =?utf-8?q?N=C3=ADcolas_F_=2E_R_?= =?utf-8?q?=2E_A_=2E_Prado?= Subject: [PATCH 19/27] ASoC: qcom: apq8016_sbc: Map missing jack kcontrols Date: Wed, 2 Aug 2023 20:57:29 +0300 Message-Id: <20230802175737.263412-20-alpernebiyasak@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230802175737.263412-1-alpernebiyasak@gmail.com> References: <20230802175737.263412-1-alpernebiyasak@gmail.com> MIME-Version: 1.0 Message-ID-Hash: WOI2SYEM6WYOZE4O6HGKDOQ4SFPEZSIG X-Message-ID-Hash: WOI2SYEM6WYOZE4O6HGKDOQ4SFPEZSIG X-MailFrom: alpernebiyasak@gmail.com 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: This driver does not properly map jack pins to kcontrols that PulseAudio and PipeWire need to handle jack detection events. It seems to support detecting Headphone and Headset Mic connections. Expose each to userspace as a kcontrol and add the necessary widgets. Signed-off-by: Alper Nebi Yasak --- Tried to match sound/soc/qcom/common.c a bit. But that seems to be selected by this, maybe it's jack setup code can be reused? sound/soc/qcom/apq8016_sbc.c | 37 ++++++++++++++++++++++++++++-------- 1 file changed, 29 insertions(+), 8 deletions(-) diff --git a/sound/soc/qcom/apq8016_sbc.c b/sound/soc/qcom/apq8016_sbc.c index e54b8961112f..6de533d45e7d 100644 --- a/sound/soc/qcom/apq8016_sbc.c +++ b/sound/soc/qcom/apq8016_sbc.c @@ -44,6 +44,17 @@ struct apq8016_sbc_data { #define DEFAULT_MCLK_RATE 9600000 #define MI2S_BCLK_RATE 1536000 +static struct snd_soc_jack_pin apq8016_sbc_jack_pins[] = { + { + .pin = "Mic Jack", + .mask = SND_JACK_MICROPHONE, + }, + { + .pin = "Headphone Jack", + .mask = SND_JACK_HEADPHONE, + }, +}; + static int apq8016_dai_init(struct snd_soc_pcm_runtime *rtd, int mi2s) { struct snd_soc_dai *codec_dai; @@ -90,13 +101,15 @@ static int apq8016_dai_init(struct snd_soc_pcm_runtime *rtd, int mi2s) if (!pdata->jack_setup) { struct snd_jack *jack; - rval = snd_soc_card_jack_new(card, "Headset Jack", - SND_JACK_HEADSET | - SND_JACK_HEADPHONE | - SND_JACK_BTN_0 | SND_JACK_BTN_1 | - SND_JACK_BTN_2 | SND_JACK_BTN_3 | - SND_JACK_BTN_4, - &pdata->jack); + rval = snd_soc_card_jack_new_pins(card, "Headset Jack", + SND_JACK_HEADSET | + SND_JACK_HEADPHONE | + SND_JACK_BTN_0 | SND_JACK_BTN_1 | + SND_JACK_BTN_2 | SND_JACK_BTN_3 | + SND_JACK_BTN_4, + &pdata->jack, + apq8016_sbc_jack_pins, + ARRAY_SIZE(apq8016_sbc_jack_pins)); if (rval < 0) { dev_err(card->dev, "Unable to add Headphone Jack\n"); @@ -255,8 +268,14 @@ static void msm8916_qdsp6_add_ops(struct snd_soc_card *card) } } -static const struct snd_soc_dapm_widget apq8016_sbc_dapm_widgets[] = { +static const struct snd_kcontrol_new apq8016_sbc_snd_controls[] = { + SOC_DAPM_PIN_SWITCH("Headphone Jack"), + SOC_DAPM_PIN_SWITCH("Mic Jack"), +}; +static const struct snd_soc_dapm_widget apq8016_sbc_dapm_widgets[] = { + SND_SOC_DAPM_HP("Headphone Jack", NULL), + SND_SOC_DAPM_MIC("Mic Jack", NULL), SND_SOC_DAPM_MIC("Handset Mic", NULL), SND_SOC_DAPM_MIC("Headset Mic", NULL), SND_SOC_DAPM_MIC("Secondary Mic", NULL), @@ -285,6 +304,8 @@ static int apq8016_sbc_platform_probe(struct platform_device *pdev) card->owner = THIS_MODULE; card->dapm_widgets = apq8016_sbc_dapm_widgets; card->num_dapm_widgets = ARRAY_SIZE(apq8016_sbc_dapm_widgets); + card->controls = apq8016_sbc_snd_controls; + card->num_controls = ARRAY_SIZE(apq8016_sbc_snd_controls); ret = qcom_snd_parse_of(card); if (ret) From patchwork Wed Aug 2 17:57:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alper Nebi Yasak X-Patchwork-Id: 13338707 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 6590FC04A94 for ; Wed, 2 Aug 2023 18:04:02 +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 5AA8986F; Wed, 2 Aug 2023 20:03:10 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 5AA8986F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1690999440; bh=ug6nzxRs9glhiVgb2Ea08/qmpNdzgRpg07YW3+i9oSU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=rWvhAJhxRSm0viYiiTPgz2nzkA9KriSHLH9tixFkudLaZReyPNL3kNFMrEukj4bia 3ZOmyLVm7Qn42Jdz5z8SCrDFunWUstzkRSPj+ORj6JLiC65XZFBA8QxvAHGJp/ysP6 mEwEhV3wbiiN6OWy0PWXM+XT020roR3mEuhjKtR0= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 062C9F80639; Wed, 2 Aug 2023 19:59:11 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 1DCC1F80639; Wed, 2 Aug 2023 19:59:11 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id D6AB7F805E4; Wed, 2 Aug 2023 19:58:38 +0200 (CEST) Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com [IPv6:2a00:1450:4864:20::330]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 753D4F805DF for ; Wed, 2 Aug 2023 19:58:35 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 753D4F805DF Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20221208 header.b=PgoxqIWg Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-3fbf1b82d9cso1211595e9.2 for ; Wed, 02 Aug 2023 10:58:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690999114; x=1691603914; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=a+3O1DghoKTsvX8XNtwYPlplZlPGOuzWPkOeAp7AhV4=; b=PgoxqIWgtjL86OEBXvSnfsDkFquIuj6IG9GHhXDef7BAFe669yJ8pdHyvfdrYYwBlD GJC2YPeLVB7RRDLPXxqeK7DpCf64n+Y0JfuX5QUFoCDLTA1cTLmqwK6MWJXNnoQn9lZ9 Fnm5eKJbAGoQRfBAAA6Vkn/yc7R5iHcMtX3E9pHKhDjSa85/yQQQfd0ZF1wY8dwEV2AL RoC+t9Qx2nm1lUj1c6k9px/zJAIAwTEAFH73/bvyf5o51OKy6gwrFhdABUXUOoaSHxP5 6UfFHPVJT8zl7mMVEEeo5atAu8JrfZkm8Ve/hqIvlWLmt78EyLV8gdlSoDrl+9IaOsBt k2Xw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690999114; x=1691603914; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=a+3O1DghoKTsvX8XNtwYPlplZlPGOuzWPkOeAp7AhV4=; b=QCNUa+0nWZshXt6mEqrdUOpcBcP0196BJANzX5YXnfEPgL8cSOsMolQreCadZm5Vjv hcXiy6Twc8xTbX7sOyrza0p1nb7xOb66GsYeVQYVO5X3yAAGVp4KzNEeYWJxY19Eo6Cw Cc1EjcnwJvvYEBgkeo+VNR/NuwTYeBAayyai2YtwQbvJ9LI6b0GufKyObvQ4rI07N3pD oofOBKhA4w/NC6K/NIELmtzZR8jUsU2dBsrDLor6q3RITa9WvZzNRIYHjRGgZO/wjvpp G6l0TuXLwH+egQruxEg1TOWbvLI2hwP31rUaegYs4nAgJhdQKbiDPdUj16xYuxvRAEhz cxBg== X-Gm-Message-State: ABy/qLYrJsqKE2Lj2gM+gVbtWWrtfPtCPBLMwVlQz7myVZ0zg/Rduwne kHvv3MzIHVXuFtgnGrJJVzSvo002Tv8= X-Google-Smtp-Source: APBJJlFXfxujtj6YpCKjtWZNCMBWWVwJcXqOlCDQOj6i8alThDmQeh9bj8gaybKQUMc6C5J1umD6GQ== X-Received: by 2002:a7b:c5d9:0:b0:3f7:678c:74b0 with SMTP id n25-20020a7bc5d9000000b003f7678c74b0mr5632761wmk.12.1690999113752; Wed, 02 Aug 2023 10:58:33 -0700 (PDT) Received: from ALPER-PC.. ([178.233.24.1]) by smtp.gmail.com with ESMTPSA id l23-20020a7bc457000000b003fe20db88ebsm2192439wmi.31.2023.08.02.10.58.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Aug 2023 10:58:33 -0700 (PDT) From: Alper Nebi Yasak To: alsa-devel@alsa-project.org Cc: Cezary Rojewski , Alper Nebi Yasak , Mark Brown , Liam Girdwood , Takashi Iwai , AngeloGioacchino Del Regno , Jaroslav Kysela , linux-kernel@vger.kernel.org, Akihiko Odaki , Pierre-Louis Bossart , Matthias Brugger , =?utf-8?q?N=C3=ADcolas_F_=2E_R_?= =?utf-8?q?=2E_A_=2E_Prado?= Subject: [PATCH 20/27] ASoC: qcom: sc7180: Map missing jack kcontrols Date: Wed, 2 Aug 2023 20:57:30 +0300 Message-Id: <20230802175737.263412-21-alpernebiyasak@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230802175737.263412-1-alpernebiyasak@gmail.com> References: <20230802175737.263412-1-alpernebiyasak@gmail.com> MIME-Version: 1.0 Message-ID-Hash: ZOEKKKFGJGR34H6SAATJL6BG33CY7IIZ X-Message-ID-Hash: ZOEKKKFGJGR34H6SAATJL6BG33CY7IIZ X-MailFrom: alpernebiyasak@gmail.com 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: This driver does not properly map jack pins to kcontrols that PulseAudio and PipeWire need to handle jack detection events. The RT5682 and RT5682s codecs used here can detect Headphone and Headset Mic connections. Expose each to userspace as a kcontrol. Signed-off-by: Alper Nebi Yasak --- sound/soc/qcom/sc7180.c | 40 +++++++++++++++++++++++++++++++++------- 1 file changed, 33 insertions(+), 7 deletions(-) diff --git a/sound/soc/qcom/sc7180.c b/sound/soc/qcom/sc7180.c index f5f7c64b23a2..57c5f35dfcc5 100644 --- a/sound/soc/qcom/sc7180.c +++ b/sound/soc/qcom/sc7180.c @@ -42,6 +42,17 @@ static void sc7180_jack_free(struct snd_jack *jack) snd_soc_component_set_jack(component, NULL, NULL); } +static struct snd_soc_jack_pin sc7180_jack_pins[] = { + { + .pin = "Headphone Jack", + .mask = SND_JACK_HEADPHONE, + }, + { + .pin = "Headset Mic", + .mask = SND_JACK_MICROPHONE, + }, +}; + static int sc7180_headset_init(struct snd_soc_pcm_runtime *rtd) { struct snd_soc_card *card = rtd->card; @@ -51,13 +62,14 @@ static int sc7180_headset_init(struct snd_soc_pcm_runtime *rtd) struct snd_jack *jack; int rval; - rval = snd_soc_card_jack_new( - card, "Headset Jack", - SND_JACK_HEADSET | - SND_JACK_HEADPHONE | - SND_JACK_BTN_0 | SND_JACK_BTN_1 | - SND_JACK_BTN_2 | SND_JACK_BTN_3, - &pdata->hs_jack); + rval = snd_soc_card_jack_new_pins(card, "Headset Jack", + SND_JACK_HEADSET | + SND_JACK_HEADPHONE | + SND_JACK_BTN_0 | SND_JACK_BTN_1 | + SND_JACK_BTN_2 | SND_JACK_BTN_3, + &pdata->hs_jack, + sc7180_jack_pins, + ARRAY_SIZE(sc7180_jack_pins)); if (rval < 0) { dev_err(card->dev, "Unable to add Headset Jack\n"); @@ -297,6 +309,11 @@ static const struct snd_soc_dapm_widget sc7180_snd_widgets[] = { SND_SOC_DAPM_MIC("Headset Mic", NULL), }; +static const struct snd_kcontrol_new sc7180_snd_controls[] = { + SOC_DAPM_PIN_SWITCH("Headphone Jack"), + SOC_DAPM_PIN_SWITCH("Headset Mic"), +}; + static const struct snd_soc_dapm_widget sc7180_adau7002_snd_widgets[] = { SND_SOC_DAPM_MIC("DMIC", NULL), }; @@ -320,6 +337,11 @@ static const struct snd_soc_dapm_widget sc7180_snd_dual_mic_widgets[] = { SND_SOC_DAPM_MUX("Dmic Mux", SND_SOC_NOPM, 0, 0, &sc7180_dmic_mux_control), }; +static const struct snd_kcontrol_new sc7180_snd_dual_mic_controls[] = { + SOC_DAPM_PIN_SWITCH("Headphone Jack"), + SOC_DAPM_PIN_SWITCH("Headset Mic"), +}; + static const struct snd_soc_dapm_route sc7180_snd_dual_mic_audio_route[] = { {"Dmic Mux", "Front Mic", "DMIC"}, {"Dmic Mux", "Rear Mic", "DMIC"}, @@ -348,10 +370,14 @@ static int sc7180_snd_platform_probe(struct platform_device *pdev) card->dev = dev; card->dapm_widgets = sc7180_snd_widgets; card->num_dapm_widgets = ARRAY_SIZE(sc7180_snd_widgets); + card->controls = sc7180_snd_controls; + card->num_controls = ARRAY_SIZE(sc7180_snd_controls); if (of_property_read_bool(dev->of_node, "dmic-gpios")) { card->dapm_widgets = sc7180_snd_dual_mic_widgets, card->num_dapm_widgets = ARRAY_SIZE(sc7180_snd_dual_mic_widgets), + card->controls = sc7180_snd_dual_mic_controls, + card->num_controls = ARRAY_SIZE(sc7180_snd_dual_mic_controls), card->dapm_routes = sc7180_snd_dual_mic_audio_route, card->num_dapm_routes = ARRAY_SIZE(sc7180_snd_dual_mic_audio_route), data->dmic_sel = devm_gpiod_get(&pdev->dev, "dmic", GPIOD_OUT_LOW); From patchwork Wed Aug 2 17:57:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alper Nebi Yasak X-Patchwork-Id: 13338708 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 34400C001DF for ; Wed, 2 Aug 2023 18:04:14 +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 67E11DF5; Wed, 2 Aug 2023 20:03:22 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 67E11DF5 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1690999452; bh=lTDp1mQh6vg+tzNpPy7F9URVPhvq+UFfEK0gFqu6edI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=jEgQwyn3y0TN7jDFPax2kD1/B8+qzw8x46BBds2dcLnYz5EEYTM4DV44P3sGYiXtw 5FJwCDhkXa8pdVEjJvNSzrjn3JlkLdDJlKEDadlIPX3VKIWu8kTck5GRahkJDqyPtX c9VgHR88NgvbgIFani7iigEoAsL+xsMRw58VzklM= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 90AB9F80520; Wed, 2 Aug 2023 19:59:14 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 08C1AF80641; Wed, 2 Aug 2023 19:59:14 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 9EB15F80558; Wed, 2 Aug 2023 19:58:40 +0200 (CEST) Received: from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com [IPv6:2a00:1450:4864:20::32e]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 9CA62F805E2 for ; Wed, 2 Aug 2023 19:58:37 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 9CA62F805E2 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20221208 header.b=FTZxpdE5 Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-3fe1d462762so1526365e9.0 for ; Wed, 02 Aug 2023 10:58:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690999116; x=1691603916; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=2zh/WX6wdJak4IhHc3jkL9iRoK+aXWh9O/IfQG1cm3A=; b=FTZxpdE5nx4Y6zQSk5bttaigS8VbRibjeKA3ZCREfPBwHaEibBv3iLD8k9qccZtT4e aZD09HP28KJsaWIUcrXrs3CEfvpd914hlqO0hNaxO+EcVsCXWA3vsRV4ehJWIiH1Wa0m 4wn57sn5rhYJtHRamKiJfDg/rbcpFgEruL5xAQ7YaHmSl9EWcj3T/Pi3Ruxn6R3agW0U m+zQSRysHJ6Kd21dByfuCnyzcfIkxTRth8K/1GH0i/4tP1L1mi7NreUMNxUpIAAYSQbp hIF7YEYJeeGSJu2iNQs7+/vSCrUJNyZEcw3URHIRTTdBEPpYg3W/+WNWflv31jJ54L80 39AA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690999116; x=1691603916; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=2zh/WX6wdJak4IhHc3jkL9iRoK+aXWh9O/IfQG1cm3A=; b=kMGrO2Mpn7nkFZq4KGZOnQy8a+w2mnN20yuWQTxPWHbgEUiuhXTTpHBUkR329LSvrl dSEpGSV5ma0W1QIda57ukf3pipl7CRv+c3QeiuXieayyAp2FKa2eifNp9eCfghSyDGBJ vVHRkRekiA93J5Gf3xE8xtOE+Ad+7W3fBGGUQQbFoDEhCinFslKT7PW07a2WpLhXPU8J 1BzDn4MjRDj+6U89opuSVRMLSaGm499fUdcim+3xGnDKIi6/XEximmckffcnUpqTif7K enCEWLOL4c9MwvZg2035LMGfHTwa2pLZWfZgaiRdlzLOuG8CHttWtiy8t/fW/q9HEqYH 5BZA== X-Gm-Message-State: ABy/qLZ1nwijPWhvnGKIAQrQURoseG4ZJM5YzzssmLMblYmmtDQr2aAB g8AlOwz9CXIJgMm9G8+eVi4zZwo9+FU= X-Google-Smtp-Source: APBJJlFfB53UV8DUxJrlC5VR+KxGVU5uRRmKWxImfq+r4JmICNTmBkIhF7ae8zlkVAqNbIoOqNS/zQ== X-Received: by 2002:a05:600c:20cb:b0:3f8:2777:15e with SMTP id y11-20020a05600c20cb00b003f82777015emr5232003wmm.31.1690999115687; Wed, 02 Aug 2023 10:58:35 -0700 (PDT) Received: from ALPER-PC.. ([178.233.24.1]) by smtp.gmail.com with ESMTPSA id l23-20020a7bc457000000b003fe20db88ebsm2192439wmi.31.2023.08.02.10.58.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Aug 2023 10:58:35 -0700 (PDT) From: Alper Nebi Yasak To: alsa-devel@alsa-project.org Cc: Cezary Rojewski , Alper Nebi Yasak , Mark Brown , Liam Girdwood , Takashi Iwai , AngeloGioacchino Del Regno , Jaroslav Kysela , linux-kernel@vger.kernel.org, Akihiko Odaki , Pierre-Louis Bossart , Matthias Brugger , =?utf-8?q?N=C3=ADcolas_F_=2E_R_?= =?utf-8?q?=2E_A_=2E_Prado?= Subject: [PATCH 21/27] ASoC: qcom: sc7280: Map missing jack kcontrols Date: Wed, 2 Aug 2023 20:57:31 +0300 Message-Id: <20230802175737.263412-22-alpernebiyasak@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230802175737.263412-1-alpernebiyasak@gmail.com> References: <20230802175737.263412-1-alpernebiyasak@gmail.com> MIME-Version: 1.0 Message-ID-Hash: L56MWMJ5ZETPNW4OCMJKAKVSDVIWYCWY X-Message-ID-Hash: L56MWMJ5ZETPNW4OCMJKAKVSDVIWYCWY X-MailFrom: alpernebiyasak@gmail.com 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: This driver does not properly map jack pins to kcontrols that PulseAudio and PipeWire need to handle jack detection events. The RT5682 and RT5682s codecs used here can detect Headphone and Headset Mic connections. Expose each to userspace as a kcontrol. Signed-off-by: Alper Nebi Yasak --- Should the SND_JACK_LINEOUT be removed from the jack_new_pins calls? Would SND_JACK_MECHANICAL be useful as a kcontrol as well? sound/soc/qcom/sc7280.c | 34 +++++++++++++++++++++++++++------- 1 file changed, 27 insertions(+), 7 deletions(-) diff --git a/sound/soc/qcom/sc7280.c b/sound/soc/qcom/sc7280.c index 787dd49e03f6..43010e4e2242 100644 --- a/sound/soc/qcom/sc7280.c +++ b/sound/soc/qcom/sc7280.c @@ -43,6 +43,17 @@ static void sc7280_jack_free(struct snd_jack *jack) snd_soc_component_set_jack(component, NULL, NULL); } +static struct snd_soc_jack_pin sc7280_jack_pins[] = { + { + .pin = "Headphone Jack", + .mask = SND_JACK_HEADPHONE, + }, + { + .pin = "Headset Mic", + .mask = SND_JACK_MICROPHONE, + }, +}; + static int sc7280_headset_init(struct snd_soc_pcm_runtime *rtd) { struct snd_soc_card *card = rtd->card; @@ -54,13 +65,15 @@ static int sc7280_headset_init(struct snd_soc_pcm_runtime *rtd) int rval, i; if (!pdata->jack_setup) { - rval = snd_soc_card_jack_new(card, "Headset Jack", - SND_JACK_HEADSET | SND_JACK_LINEOUT | - SND_JACK_MECHANICAL | - SND_JACK_BTN_0 | SND_JACK_BTN_1 | - SND_JACK_BTN_2 | SND_JACK_BTN_3 | - SND_JACK_BTN_4 | SND_JACK_BTN_5, - &pdata->hs_jack); + rval = snd_soc_card_jack_new_pins(card, "Headset Jack", + SND_JACK_HEADSET | SND_JACK_LINEOUT | + SND_JACK_MECHANICAL | + SND_JACK_BTN_0 | SND_JACK_BTN_1 | + SND_JACK_BTN_2 | SND_JACK_BTN_3 | + SND_JACK_BTN_4 | SND_JACK_BTN_5, + &pdata->hs_jack, + sc7280_jack_pins, + ARRAY_SIZE(sc7280_jack_pins)); if (rval < 0) { dev_err(card->dev, "Unable to add Headset Jack\n"); @@ -361,6 +374,11 @@ static const struct snd_soc_dapm_widget sc7280_snd_widgets[] = { SND_SOC_DAPM_MIC("Headset Mic", NULL), }; +static const struct snd_kcontrol_new sc7280_snd_controls[] = { + SOC_DAPM_PIN_SWITCH("Headphone Jack"), + SOC_DAPM_PIN_SWITCH("Headset Mic"), +}; + static int sc7280_snd_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd, struct snd_pcm_hw_params *params) { @@ -396,6 +414,8 @@ static int sc7280_snd_platform_probe(struct platform_device *pdev) card->dapm_widgets = sc7280_snd_widgets; card->num_dapm_widgets = ARRAY_SIZE(sc7280_snd_widgets); + card->controls = sc7280_snd_controls; + card->num_controls = ARRAY_SIZE(sc7280_snd_controls); ret = qcom_snd_parse_of(card); if (ret) From patchwork Wed Aug 2 17:57:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alper Nebi Yasak X-Patchwork-Id: 13338709 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 A2774C04A94 for ; Wed, 2 Aug 2023 18:04:33 +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 94250E0F; Wed, 2 Aug 2023 20:03:41 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 94250E0F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1690999471; bh=ow6fDWt0WObDBYahHVnM6QbjxhM0w9c6lGP7g/cwpr4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=GUBcn+Hi8uY7oj3u81vu6+hFgSnItGCQtGI1vFVUu7ln+GqCUFg62eUkZlWdoHvRO AVyaJIfjcCYZtHcNL2i6yYapvKxjKSW36X+qPDUct2MXwNH2OIRnrYuY47JSAh72OH llNlCpaHSs0uooKKoWWk8YmEIVyksgiHLleo9//Q= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 1EBE7F80671; Wed, 2 Aug 2023 19:59:16 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 2E62EF8065C; Wed, 2 Aug 2023 19:59:16 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 29580F80558; Wed, 2 Aug 2023 19:58:42 +0200 (CEST) Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 3E880F805E6 for ; Wed, 2 Aug 2023 19:58:39 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 3E880F805E6 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20221208 header.b=MqN6xWER Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-3fbef8ad9bbso1523135e9.0 for ; Wed, 02 Aug 2023 10:58:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690999118; x=1691603918; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ivMSWY5W5vVdPZxQIPJMmrp6wGH4fY48CYl1yy0Ej0E=; b=MqN6xWERzMdTN+8tcVQSYKf9fLJTD2JZeiFLCObyl03B60/xzXmwB02zYmsL/6x5bh OypDvc0pipYf79vcMZBq/krvgrlOWmGzv8CDKGkHLLK7TgJU4MVfnrvrDh2thBvBT1dd QkoovvMpj5cgJVQfpsnAXhS6tMxnLU+wwEHTjMLCX3OtsGSbWfFbxjftEWlabVbs5EUY aXBMEU+9yTyyFnJ/4at2Acvmhpbn5B/B0LUutW3a7+HLu8sBqpNyPmx1mb4Zg4z+wi6+ 1LcEYnMoL85zbG7A/QuYxq6WKO5Hj0q4Bbg+zKZFayu/C06IqhWqdqwCKyAN/n6clMZC myAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690999118; x=1691603918; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ivMSWY5W5vVdPZxQIPJMmrp6wGH4fY48CYl1yy0Ej0E=; b=cMQbIJBIG5oP2w7WLZxJgGSbGuWRcBdzuIaaef1RDHN36ytcLstxYUuS0N2zX+NNqr Fvqi66Vz1Xk4TY+4B+dI295X1N5V0GJw0eJ4NU9as6ZKeDC4s1JiZ8ArihDxJgKpScJP BkZmhku9B8NxI7WqJ2o5hx5d1t8CbC/sGXUGlwgBtNec9PYElrtJwRF7oU66FHeuZDRq NI57xAt8q2kR0S1gwb+UjQp3BiwTMih+pN2TizS1NjHuO17WLslndQuuyGTZdzNLQ0Gz dc5P31CZWUTwkMk1ctVKM6N/1itu5xX0HVCr+qybqaGrIzpWYzHIW7OU7lfn2BxNKDyR aN+g== X-Gm-Message-State: ABy/qLZCcPJD0Et1vcwUgR6Oofy2uzCj1PHc35fRfuuJdBuWmBVrIthq NIabuE7HI8LzHti+oQoBfsyi0S7z6lk= X-Google-Smtp-Source: APBJJlGB+L4H3MvyOOJOR2XlHFtV3VEIC2qwY2/AoQPP1pkVYrM+PTm/KjqODvQdydcUzgWfP3aCAA== X-Received: by 2002:a7b:cc12:0:b0:3fb:dd9c:72d2 with SMTP id f18-20020a7bcc12000000b003fbdd9c72d2mr5153102wmh.31.1690999117652; Wed, 02 Aug 2023 10:58:37 -0700 (PDT) Received: from ALPER-PC.. ([178.233.24.1]) by smtp.gmail.com with ESMTPSA id l23-20020a7bc457000000b003fe20db88ebsm2192439wmi.31.2023.08.02.10.58.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Aug 2023 10:58:37 -0700 (PDT) From: Alper Nebi Yasak To: alsa-devel@alsa-project.org Cc: Cezary Rojewski , Alper Nebi Yasak , Mark Brown , Liam Girdwood , Takashi Iwai , AngeloGioacchino Del Regno , Jaroslav Kysela , linux-kernel@vger.kernel.org, Akihiko Odaki , Pierre-Louis Bossart , Matthias Brugger , =?utf-8?q?N=C3=ADcolas_F_=2E_R_?= =?utf-8?q?=2E_A_=2E_Prado?= Subject: [PATCH 22/27] ASoC: qcom: sdm845: Map missing jack kcontrols Date: Wed, 2 Aug 2023 20:57:32 +0300 Message-Id: <20230802175737.263412-23-alpernebiyasak@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230802175737.263412-1-alpernebiyasak@gmail.com> References: <20230802175737.263412-1-alpernebiyasak@gmail.com> MIME-Version: 1.0 Message-ID-Hash: Q5YINVGX7GJIBOXD7JBEORTED3IZMBJS X-Message-ID-Hash: Q5YINVGX7GJIBOXD7JBEORTED3IZMBJS X-MailFrom: alpernebiyasak@gmail.com 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: This driver does not properly map jack pins to kcontrols that PulseAudio and PipeWire need to handle jack detection events. The RT5663 codec used here can detect Headphone and Headset Mic connections. Expose each to userspace as a kcontrol. Signed-off-by: Alper Nebi Yasak --- sound/soc/qcom/sdm845.c | 32 ++++++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/sound/soc/qcom/sdm845.c b/sound/soc/qcom/sdm845.c index 02612af714a8..29d23fe5dfa2 100644 --- a/sound/soc/qcom/sdm845.c +++ b/sound/soc/qcom/sdm845.c @@ -42,6 +42,17 @@ struct sdm845_snd_data { struct sdw_stream_runtime *sruntime[AFE_PORT_MAX]; }; +static struct snd_soc_jack_pin sdm845_jack_pins[] = { + { + .pin = "Headphone Jack", + .mask = SND_JACK_HEADPHONE, + }, + { + .pin = "Headset Mic", + .mask = SND_JACK_MICROPHONE, + }, +}; + static unsigned int tdm_slot_offset[8] = {0, 4, 8, 12, 16, 20, 24, 28}; static int sdm845_slim_snd_hw_params(struct snd_pcm_substream *substream, @@ -242,12 +253,14 @@ static int sdm845_dai_init(struct snd_soc_pcm_runtime *rtd) if (!pdata->jack_setup) { - rval = snd_soc_card_jack_new(card, "Headset Jack", - SND_JACK_HEADSET | - SND_JACK_HEADPHONE | - SND_JACK_BTN_0 | SND_JACK_BTN_1 | - SND_JACK_BTN_2 | SND_JACK_BTN_3, - &pdata->jack); + rval = snd_soc_card_jack_new_pins(card, "Headset Jack", + SND_JACK_HEADSET | + SND_JACK_HEADPHONE | + SND_JACK_BTN_0 | SND_JACK_BTN_1 | + SND_JACK_BTN_2 | SND_JACK_BTN_3, + &pdata->jack, + sdm845_jack_pins, + ARRAY_SIZE(sdm845_jack_pins)); if (rval < 0) { dev_err(card->dev, "Unable to add Headphone Jack\n"); @@ -539,6 +552,11 @@ static const struct snd_soc_dapm_widget sdm845_snd_widgets[] = { SND_SOC_DAPM_MIC("Int Mic", NULL), }; +static const struct snd_kcontrol_new sdm845_snd_controls[] = { + SOC_DAPM_PIN_SWITCH("Headphone Jack"), + SOC_DAPM_PIN_SWITCH("Headset Mic"), +}; + static void sdm845_add_ops(struct snd_soc_card *card) { struct snd_soc_dai_link *link; @@ -572,6 +590,8 @@ static int sdm845_snd_platform_probe(struct platform_device *pdev) card->driver_name = DRIVER_NAME; card->dapm_widgets = sdm845_snd_widgets; card->num_dapm_widgets = ARRAY_SIZE(sdm845_snd_widgets); + card->controls = sdm845_snd_controls; + card->num_controls = ARRAY_SIZE(sdm845_snd_controls); card->dev = dev; card->owner = THIS_MODULE; dev_set_drvdata(dev, card); From patchwork Wed Aug 2 17:57:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alper Nebi Yasak X-Patchwork-Id: 13338710 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 767BDC001DF for ; Wed, 2 Aug 2023 18:04:59 +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 A805A852; Wed, 2 Aug 2023 20:04:07 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz A805A852 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1690999497; bh=sKCAbXhkPXWk9hJyr0CaXjVrUCN9I69EpYbUl9JyaFg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=uM32d09/OZSptELtl9hEuW8VkZVFJ4a9ktdFTgzrwr1HTFAboX8G6NO1JUmUDgu8N fVITh5H1+5lQfgQoN54AnPe45mGbGUYMmeskCuwQlWvdyQ+bOlFVl+0dYrU3dYiMIX g2GajW/WY24hiibx2n7VfvXWvvkmc04M1+u2uAH8= Received: by alsa1.perex.cz (Postfix, from userid 50401) id C7A0EF8067E; Wed, 2 Aug 2023 19:59:19 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 0E35DF80677; Wed, 2 Aug 2023 19:59:19 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 7E488F805E0; Wed, 2 Aug 2023 19:58:43 +0200 (CEST) Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 72C1FF80557 for ; Wed, 2 Aug 2023 19:58:41 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 72C1FF80557 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20221208 header.b=nHvmRKQk Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-3fe2ba3e260so1400045e9.2 for ; Wed, 02 Aug 2023 10:58:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690999119; x=1691603919; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=r84U5vKKrOG5iP+/wELvgXipD3A/eO08Kh4+Yu4iiLQ=; b=nHvmRKQk5b0vvll7cRuFQ7yoULx2W60YBSzafVOipAk+XPMA8mPPGqUgJV5xCmYOU0 gUtYmyflcfvJXSSR2WUKfg85Tp5fSaAtVixDhdKxpaHWJc3KEc6mMuIy1Tv2J8XGm3iB bPNo6aUDpnWdTtNkPHDxcTcSCxej+8+wlyPHrbiK8DMpgI8n8ocrxuzsVmXYZAqY/1fN pH4stOJyWoP8mIDGSUwiznE8EV8K4oRD4+GbYUkPs03oGIZwVVJ+Luv3Es7Kq3TwFLwV 7s4p5wlBgIL/FOB4fj8pQnSegH0AwAS5XW9+b4b1qLDAs8Z25gjf63SBb813WGwEgGhu TxWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690999119; x=1691603919; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=r84U5vKKrOG5iP+/wELvgXipD3A/eO08Kh4+Yu4iiLQ=; b=ke2v4mAutMNwlbc9NASpjoQHC61oaE+KpaSOw8EkvrsQ74G5gSI3L5boTVA2UKIpV/ jruFfAhPtSBQjIkybIgFrqY/uJp6AIigHWf3F1qorjy3OmE9JOH1nE8I+NzjXJGp8hRa dNMGxlJJreWAkg45MbKbDlJjOLoAi8qtCCHZa20RGZ+8AApcDeZEL4ZJBULlB78MWIhq X4b7LDYovp6zNqBwltt1LWac3w6Wj+UdOokeZ3BHK8GK9tPvwOM6E/tKyLDh9BK5kC9Z 3k6SRdE+VBl2VvMEZUJd128coyQggd5TOW5yJ3HW8rgKk/9g5CtfBR+512OMJfSpO4An XkoQ== X-Gm-Message-State: ABy/qLYq/f+X6HAtwN5WKxgQhLWtYoJuEneQgNU+Xy1FkSRo421HC86g kowa2NdyYy7MlCX0JHYwDfDbfMfoUOc= X-Google-Smtp-Source: APBJJlHTdTr6GABuL8o6Z9U1QvO2dPaRIzK5YY/L5EMLjePFSuhtQUmUrLD+p8BRkDSBML7H+lgVcQ== X-Received: by 2002:a05:600c:215:b0:3fe:173e:4a54 with SMTP id 21-20020a05600c021500b003fe173e4a54mr5247511wmi.17.1690999119701; Wed, 02 Aug 2023 10:58:39 -0700 (PDT) Received: from ALPER-PC.. ([178.233.24.1]) by smtp.gmail.com with ESMTPSA id l23-20020a7bc457000000b003fe20db88ebsm2192439wmi.31.2023.08.02.10.58.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Aug 2023 10:58:39 -0700 (PDT) From: Alper Nebi Yasak To: alsa-devel@alsa-project.org Cc: Cezary Rojewski , Alper Nebi Yasak , Mark Brown , Liam Girdwood , Takashi Iwai , AngeloGioacchino Del Regno , Jaroslav Kysela , linux-kernel@vger.kernel.org, Akihiko Odaki , Pierre-Louis Bossart , Matthias Brugger , =?utf-8?q?N=C3=ADcolas_F_=2E_R_?= =?utf-8?q?=2E_A_=2E_Prado?= Subject: [PATCH 23/27] ASoC: rk3399-gru-sound: Map missing Line Out jack kcontrol Date: Wed, 2 Aug 2023 20:57:33 +0300 Message-Id: <20230802175737.263412-24-alpernebiyasak@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230802175737.263412-1-alpernebiyasak@gmail.com> References: <20230802175737.263412-1-alpernebiyasak@gmail.com> MIME-Version: 1.0 Message-ID-Hash: VYBCFHQKYZ4MVIAOPT5XMEQIJOQD6LAO X-Message-ID-Hash: VYBCFHQKYZ4MVIAOPT5XMEQIJOQD6LAO X-MailFrom: alpernebiyasak@gmail.com 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: Commit d0508b4f1604 ("ASoC: rk3399_gru_sound: Add DAPM pins, kcontrols for jack detection") maps kcontrols for Headphones and Headset Mic jacks for this driver so that PulseAudio and PipeWire can handle insertion events for these peripherals. The DA7219 codec used here can also distinguish between Headphone and Line Out connections that go into the same physical port. Expose the latter to userspace as a kcontrol as well and add the necessary widget. Signed-off-by: Alper Nebi Yasak --- Tested on a "Kevin" Chromebook. sound/soc/rockchip/rk3399_gru_sound.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/sound/soc/rockchip/rk3399_gru_sound.c b/sound/soc/rockchip/rk3399_gru_sound.c index 5e52e9d60d44..0f704d22d21b 100644 --- a/sound/soc/rockchip/rk3399_gru_sound.c +++ b/sound/soc/rockchip/rk3399_gru_sound.c @@ -41,13 +41,17 @@ static struct snd_soc_jack_pin rockchip_sound_jack_pins[] = { .pin = "Headset Mic", .mask = SND_JACK_MICROPHONE, }, - + { + .pin = "Line Out", + .mask = SND_JACK_LINEOUT, + }, }; static const struct snd_soc_dapm_widget rockchip_dapm_widgets[] = { SND_SOC_DAPM_HP("Headphones", NULL), SND_SOC_DAPM_SPK("Speakers", NULL), SND_SOC_DAPM_MIC("Headset Mic", NULL), + SND_SOC_DAPM_LINE("Line Out", NULL), SND_SOC_DAPM_MIC("Int Mic", NULL), SND_SOC_DAPM_LINE("HDMI", NULL), }; @@ -56,6 +60,7 @@ static const struct snd_kcontrol_new rockchip_controls[] = { SOC_DAPM_PIN_SWITCH("Headphones"), SOC_DAPM_PIN_SWITCH("Speakers"), SOC_DAPM_PIN_SWITCH("Headset Mic"), + SOC_DAPM_PIN_SWITCH("Line Out"), SOC_DAPM_PIN_SWITCH("Int Mic"), SOC_DAPM_PIN_SWITCH("HDMI"), }; From patchwork Wed Aug 2 17:57:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alper Nebi Yasak X-Patchwork-Id: 13338711 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 E3CF5C04A94 for ; Wed, 2 Aug 2023 18:05:07 +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 D99B584C; Wed, 2 Aug 2023 20:04:15 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz D99B584C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1690999505; bh=Y9xdDN32VmPivBRnE+XlL6TfPEHRPuWhrBBu81Gi7W4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=Pdu07VIC04jQkShB+MwkQjUIF+BIcDRCoAptxos7h0JYOxXbopb0DXZSD21RJbSvP 5Yru2I+t66VzuBQu4rlBRbbwZWQGuQMjSlYKWSUYfJT+Vze/DNkiHcnKYylY/19q1s R638ZFXvRfo6pX9Pk2qtnhlIR1HMAWKExL/51+GY= Received: by alsa1.perex.cz (Postfix, from userid 50401) id BB7DAF80149; Wed, 2 Aug 2023 19:59:22 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 93714F8067F; Wed, 2 Aug 2023 19:59:21 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id DB297F805FB; Wed, 2 Aug 2023 19:58:47 +0200 (CEST) Received: from mail-wm1-x332.google.com (mail-wm1-x332.google.com [IPv6:2a00:1450:4864:20::332]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 4A2FCF80558 for ; Wed, 2 Aug 2023 19:58:43 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 4A2FCF80558 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20221208 header.b=ST/5jqkz Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-3fe2fb9b4d7so1394645e9.1 for ; Wed, 02 Aug 2023 10:58:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690999122; x=1691603922; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=7E+xhja+1jrCpHxegbBsk22hE7b38rXeL+uTtQJDC68=; b=ST/5jqkzflkWDXQ7+gy1tnzteCKA9DH+Zn3Z1bd3QWdweQMyxUoz3JNZy29M0TXkAk D8Luxt8lV3Y6OPtuKagLAhF2wyOk8n9x48E3AzWvSZF99I6hnGP1kmm1K3LcXvP0aXA1 W3EteyHyGFO4Itb0ymixr81ge2PuwGmULbcmzj/bDKqrleD2wQ6oSxxU8ouxFJz9ZdJe yNKtdhiQMAZfAOd/XgA+XFcCCoTWHkS+Rq1z5zVEz0y9WVg5YchGPUbYYzaIoQw8NImi iT69PeQ3SA08IBAn3r/oTCgQvMW9VbqXZZHwWY/goiqG7BNWaoPDJutDmCETgB9ZwgGm 4nqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690999122; x=1691603922; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=7E+xhja+1jrCpHxegbBsk22hE7b38rXeL+uTtQJDC68=; b=CBRwf22S2hjsWEEcKaRCQyFeSTmYVoqLfi9pN9Y+KotS0YEvWAylAsfCxaRYq6Iy6d EtFhpgxZmNjknjPqF+Gnet9hdeMPTOKGzONLunVDGC3ykZ1SXbh5DBIPY6A+8RG1fVs+ m/rPTTp6xaONE1jZZFatL1aTdb8tLAQBmPGN0TsBB5ftoA33jPOJlYSBQ+jtmts9YO+f +1MSABuvE0kr6SpwOOIFby53nP/wTMi0BUNNSd4u1k/q+lH9n/1pPTMX3vMnDThohgbV I6gsXCMxyynEy8D5yQwcA27H+ug5qUteeGRvCMFVl+w/d6Wt9vf2cOjYAr/Auhs2Ft3Q 3A8g== X-Gm-Message-State: ABy/qLb4ufk3M8DnlCejG8xmvWii5LmlF6tf4D20KnWagzsiHlT1QPxu cNnwecJGdobYVbtQGVugo3t/uPiIEBE= X-Google-Smtp-Source: APBJJlGzX3CO1LF4O7+6d9YH3/jJclKl+auO3bb9ktPlErNofRTvqIfFV9fV871SszD/KIJLlcRuKQ== X-Received: by 2002:a05:600c:20f:b0:3fb:fa9f:5292 with SMTP id 15-20020a05600c020f00b003fbfa9f5292mr5339041wmi.25.1690999121618; Wed, 02 Aug 2023 10:58:41 -0700 (PDT) Received: from ALPER-PC.. ([178.233.24.1]) by smtp.gmail.com with ESMTPSA id l23-20020a7bc457000000b003fe20db88ebsm2192439wmi.31.2023.08.02.10.58.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Aug 2023 10:58:41 -0700 (PDT) From: Alper Nebi Yasak To: alsa-devel@alsa-project.org Cc: Cezary Rojewski , Alper Nebi Yasak , Mark Brown , Liam Girdwood , Takashi Iwai , AngeloGioacchino Del Regno , Jaroslav Kysela , linux-kernel@vger.kernel.org, Akihiko Odaki , Pierre-Louis Bossart , Matthias Brugger , =?utf-8?q?N=C3=ADcolas_F_=2E_R_?= =?utf-8?q?=2E_A_=2E_Prado?= Subject: [PATCH 24/27] ASoC: rockchip: rockchip_rt5645: Map missing jack kcontrols Date: Wed, 2 Aug 2023 20:57:34 +0300 Message-Id: <20230802175737.263412-25-alpernebiyasak@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230802175737.263412-1-alpernebiyasak@gmail.com> References: <20230802175737.263412-1-alpernebiyasak@gmail.com> MIME-Version: 1.0 Message-ID-Hash: LQ5E5D5ES44PEMW4IPGBLSXEX2X4XKEM X-Message-ID-Hash: LQ5E5D5ES44PEMW4IPGBLSXEX2X4XKEM X-MailFrom: alpernebiyasak@gmail.com 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: This driver does not properly map jack pins to kcontrols that PulseAudio and PipeWire need to handle jack detection events. The RT5645 codec used here supports detecting Headphone and Headset Mic connections. Expose both to userspace as kcontrols. Signed-off-by: Alper Nebi Yasak --- sound/soc/rockchip/rockchip_rt5645.c | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/sound/soc/rockchip/rockchip_rt5645.c b/sound/soc/rockchip/rockchip_rt5645.c index e73a342b7953..ef9fdf0386cb 100644 --- a/sound/soc/rockchip/rockchip_rt5645.c +++ b/sound/soc/rockchip/rockchip_rt5645.c @@ -22,6 +22,16 @@ #define DRV_NAME "rockchip-snd-rt5645" static struct snd_soc_jack headset_jack; +static struct snd_soc_jack_pin headset_jack_pins[] = { + { + .pin = "Headphones", + .mask = SND_JACK_HEADPHONE, + }, + { + .pin = "Headset Mic", + .mask = SND_JACK_MICROPHONE, + }, +}; static const struct snd_soc_dapm_widget rk_dapm_widgets[] = { SND_SOC_DAPM_HP("Headphones", NULL), @@ -103,11 +113,13 @@ static int rk_init(struct snd_soc_pcm_runtime *runtime) int ret; /* Enable Headset and 4 Buttons Jack detection */ - ret = snd_soc_card_jack_new(card, "Headset Jack", - SND_JACK_HEADPHONE | SND_JACK_MICROPHONE | - SND_JACK_BTN_0 | SND_JACK_BTN_1 | - SND_JACK_BTN_2 | SND_JACK_BTN_3, - &headset_jack); + ret = snd_soc_card_jack_new_pins(card, "Headset Jack", + SND_JACK_HEADPHONE | SND_JACK_MICROPHONE | + SND_JACK_BTN_0 | SND_JACK_BTN_1 | + SND_JACK_BTN_2 | SND_JACK_BTN_3, + &headset_jack, + headset_jack_pins, + ARRAY_SIZE(headset_jack_pins)); if (ret) { dev_err(card->dev, "New Headset Jack failed! (%d)\n", ret); return ret; From patchwork Wed Aug 2 17:57:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alper Nebi Yasak X-Patchwork-Id: 13338712 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 2F22DC001DF for ; Wed, 2 Aug 2023 18:05:34 +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 96EE0E81; Wed, 2 Aug 2023 20:04:42 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 96EE0E81 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1690999532; bh=VIIRnkDnYUzpm8Rls44qmTYiqEqceh58gUUMgF3oL8w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=IYDJwp96DHsF4bnMPSKNETz6mHCD1GAw77B1Z5AJb6PnYJO4y38pq80F181C1yfw6 shJ2UW1r6v8iqJ1ydIIv1Rq5HxX3FD1MqwCz2WSa3siA/LbTalSYn1IvcaT6dtSHgg v2y0PhSbiE+FW3ay3XV3us/62TaTmxvSVA8QRKF4= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 5875AF8068D; Wed, 2 Aug 2023 19:59:26 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id CE88EF80680; Wed, 2 Aug 2023 19:59:25 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 3A66CF80601; Wed, 2 Aug 2023 19:58:50 +0200 (CEST) Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com [IPv6:2a00:1450:4864:20::330]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 76210F805F2 for ; Wed, 2 Aug 2023 19:58:45 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 76210F805F2 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20221208 header.b=HRCj7K9d Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-3fe110de3b6so917565e9.1 for ; Wed, 02 Aug 2023 10:58:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690999123; x=1691603923; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=oXqXYAcukJg9NxGMzxMn5REWqtvtEi1jTOlYbMmEIwQ=; b=HRCj7K9dtm+flY3nG52NdwdzhU/m9cYvvltc4+JcXjr+3hBjxAxlfu3xEC9Q5wS26x GVg9y1suh7fhuXt/GPxc6N3xoTv7DjEMN8pea6sgapzjpU9bmXqLPLe4OcDsNp63ZK9D uN5GPpv2bxxNeMdFRvcWse/YNZT3VXtGukhFwDaDJ8STEXZQSCO8g7cx2l+egd/QdNA3 eVLKc38vAtsMAOIUezHhXjX+UTl3DLLR/K6IxXYusihdWdlQoW/AYcvZlVlUrU0Si5+b pktAYGsgyBnrQyJJ/GZA7cz2/ZdoBeh3V7xo9afYhauPw/+KPkbnEmbRq9njiaAvRXEx py+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690999123; x=1691603923; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=oXqXYAcukJg9NxGMzxMn5REWqtvtEi1jTOlYbMmEIwQ=; b=CLYOiHDULo11ec593xY2+dVvQwVtoohE7IB51NqanVajQP0PEMXpmTi58dt5sL8pwj AdEA+tlihTbvvRSsY0pk3X519KBixY/R4qUc6Z8Xy8sQk5vagN7RVrn8Dm2ZtL7zseBh sLaPiSULAC5KCOccXevkuOfCvfSY038w5ar1IOYwbD3mwPU6nmfY4E26Q1Ozby51Dn+d X2MVYKxu3LOIg6USaqAn94zzecnEFL7j9m1++UZ7VwSRX1Pz0XnrtoA/KSj/Vk7iT7ke l8PLuAGBp58PcoZpngQYdigf7DieQWf34AQqDTQDVAihS0Vny21w625s18+rjsO4g8MW 5mAw== X-Gm-Message-State: ABy/qLbzskkmiRFyfXcteQBRC2WPfhgooPVHynHk5Nfwp4qIqf2P6NaE lOx2pSJDUAt8dpUBRPq5JjxfX51SVv4= X-Google-Smtp-Source: APBJJlF4WH4ztE6sP96Ip/0+rlET/v5cd61TY/xgM05U+urjF/YhBfw4WfbX+mrQ1mjsRh1wiH6llQ== X-Received: by 2002:a05:600c:3d85:b0:3f7:e78e:8a41 with SMTP id bi5-20020a05600c3d8500b003f7e78e8a41mr5585448wmb.18.1690999123631; Wed, 02 Aug 2023 10:58:43 -0700 (PDT) Received: from ALPER-PC.. ([178.233.24.1]) by smtp.gmail.com with ESMTPSA id l23-20020a7bc457000000b003fe20db88ebsm2192439wmi.31.2023.08.02.10.58.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Aug 2023 10:58:43 -0700 (PDT) From: Alper Nebi Yasak To: alsa-devel@alsa-project.org Cc: Cezary Rojewski , Alper Nebi Yasak , Mark Brown , Liam Girdwood , Takashi Iwai , AngeloGioacchino Del Regno , Jaroslav Kysela , linux-kernel@vger.kernel.org, Akihiko Odaki , Pierre-Louis Bossart , Matthias Brugger , =?utf-8?q?N=C3=ADcolas_F_=2E_R_?= =?utf-8?q?=2E_A_=2E_Prado?= Subject: [PATCH 25/27] ASoC: samsung: littlemill: Map missing jack kcontrols Date: Wed, 2 Aug 2023 20:57:35 +0300 Message-Id: <20230802175737.263412-26-alpernebiyasak@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230802175737.263412-1-alpernebiyasak@gmail.com> References: <20230802175737.263412-1-alpernebiyasak@gmail.com> MIME-Version: 1.0 Message-ID-Hash: DF6BVMV7TU6S5RZG7IDMSRJFPFESV4MX X-Message-ID-Hash: DF6BVMV7TU6S5RZG7IDMSRJFPFESV4MX X-MailFrom: alpernebiyasak@gmail.com 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: This driver does not properly map jack pins to kcontrols that PulseAudio and PipeWire need to handle jack detection events. The WM8958 codec used here can detect Headphone and Headset Mic connections. Expose each to userspace as a kcontrol and add the necessary widgets. Signed-off-by: Alper Nebi Yasak --- Would SND_JACK_MECHANICAL be useful as a kcontrol as well? sound/soc/samsung/littlemill.c | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/sound/soc/samsung/littlemill.c b/sound/soc/samsung/littlemill.c index 5d8118e69359..fafadcef234e 100644 --- a/sound/soc/samsung/littlemill.c +++ b/sound/soc/samsung/littlemill.c @@ -225,12 +225,15 @@ static int bbclk_ev(struct snd_soc_dapm_widget *w, } static const struct snd_kcontrol_new controls[] = { + SOC_DAPM_PIN_SWITCH("Headphone"), + SOC_DAPM_PIN_SWITCH("Headset Mic"), SOC_DAPM_PIN_SWITCH("WM1250 Input"), SOC_DAPM_PIN_SWITCH("WM1250 Output"), }; static const struct snd_soc_dapm_widget widgets[] = { SND_SOC_DAPM_HP("Headphone", NULL), + SND_SOC_DAPM_HP("Headset Mic", NULL), SND_SOC_DAPM_MIC("AMIC", NULL), SND_SOC_DAPM_MIC("DMIC", NULL), @@ -255,6 +258,16 @@ static const struct snd_soc_dapm_route audio_paths[] = { }; static struct snd_soc_jack littlemill_headset; +static struct snd_soc_jack_pin littlemill_headset_pins[] = { + { + .pin = "Headphone", + .mask = SND_JACK_HEADPHONE, + }, + { + .pin = "Headset Mic", + .mask = SND_JACK_MICROPHONE, + }, +}; static int littlemill_late_probe(struct snd_soc_card *card) { @@ -281,12 +294,14 @@ static int littlemill_late_probe(struct snd_soc_card *card) if (ret < 0) return ret; - ret = snd_soc_card_jack_new(card, "Headset", - SND_JACK_HEADSET | SND_JACK_MECHANICAL | - SND_JACK_BTN_0 | SND_JACK_BTN_1 | - SND_JACK_BTN_2 | SND_JACK_BTN_3 | - SND_JACK_BTN_4 | SND_JACK_BTN_5, - &littlemill_headset); + ret = snd_soc_card_jack_new_pins(card, "Headset", + SND_JACK_HEADSET | SND_JACK_MECHANICAL | + SND_JACK_BTN_0 | SND_JACK_BTN_1 | + SND_JACK_BTN_2 | SND_JACK_BTN_3 | + SND_JACK_BTN_4 | SND_JACK_BTN_5, + &littlemill_headset, + littlemill_headset_pins, + ARRAY_SIZE(littlemill_headset_pins)); if (ret) return ret; From patchwork Wed Aug 2 17:57:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alper Nebi Yasak X-Patchwork-Id: 13338713 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 28861C04FDF for ; Wed, 2 Aug 2023 18:05:37 +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 4716BE88; Wed, 2 Aug 2023 20:04:45 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 4716BE88 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1690999535; bh=iQFS0AaAK0w8IhJixhmdKxgTU2gJt7xbAmAP4xFQGM8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=Tj4qdlJN/DWPM16g6fL8MPrxmPkjZ2YzShFh6w8Kc1KBC6iwCkfQoy29V0CApAd5Q EVuLArZQln64T/Ty9mEdomW4VMOl12BGKhnXToX7TqUoW7CNtwj8FcK0vlC7n3uh9f 7o6j1U/COl5tY8+4g+fKx8sZrQZeIVnv+8d9NlFk= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 54593F80692; Wed, 2 Aug 2023 19:59:28 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id A93EEF80690; Wed, 2 Aug 2023 19:59:28 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 8DCD6F80609; Wed, 2 Aug 2023 19:58:53 +0200 (CEST) Received: from mail-wm1-x331.google.com (mail-wm1-x331.google.com [IPv6:2a00:1450:4864:20::331]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 537AEF805FF for ; Wed, 2 Aug 2023 19:58:47 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 537AEF805FF Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20221208 header.b=jG029gDz Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-3fe110de3b6so917715e9.1 for ; Wed, 02 Aug 2023 10:58:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690999125; x=1691603925; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=0QAIWP4M6rBKtTpn/rRinZikOOxcMUXJXPcYbOcWh7A=; b=jG029gDzx1VlaSJ6xc7aVKpj0Yef+5LN2PYEenXcXD3VNalatBnZxvLwaxFCBLAjwI pCU5V57NMxEkbzjVj7F28GLT9ocP47sWxQkPY+L7VYTFULVtn4pHf9a5Tihq1TE076Ho gRUFUZ7hQflSR1jA0q8oBDeJn96GDbIoCE8e5iKcEAb9D1qMkOu+S6PPk43/1HG8lGJV Y4hObvXevJX5xCJrPb7FVXhkZJCJmgvYmgSku5qWRfrNjtspBZcIe/HmUwqQVwOjUkOO tAeRA1MRPXTPmr8YW2KSiqix3l1nC7oPSZdEB1hmbcPePoeOax5Uysacrx6N2ELLkZkS G2Ug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690999125; x=1691603925; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=0QAIWP4M6rBKtTpn/rRinZikOOxcMUXJXPcYbOcWh7A=; b=Y5dl52Gf1EpFIOZSVBaD7kmM3rpwwzDYUvXJRqYLdKocLlFJkiI2Jg2IMVeF3paJQb YsnWULnjFG2PuHq2UrDtQJGGgi1SfwD74rPQhr5uixbXFVAuCY9Xv1IQUHsUghxXQ+Yi mPU2fHweLIrO8FZ40HievC93lQfGjruDoVJjqjFE3IY4RxnP1fuhmvpEsRjR219IuxdE bBANNuXFBYIhvwb8UaBxAlPli9WfjLSLq179eOCHqIYfQ+QXZYn2e3AH8alni+SsAWoY c/9NivAYI0p/N0JAWa+jMmj0LvwNNPop/Sjg8AgQ7UbLQfW3b7Y2Pvx476g0W/sN83ZJ TyPQ== X-Gm-Message-State: ABy/qLbSZQX1uUkgLL4OcDH/OTQGvLm7JiPkZhs7DtYEs/lnqrRKs8hR rqZRNY/BpeGheG7zbtmB7sZkNjX8BoE= X-Google-Smtp-Source: APBJJlEJ2EggviBFizXfzV+h7ot9Z1XD8RFiIvdOE3MYyO8E+jcUIKdnaY6u9B81DSwbVXGUTI3kOA== X-Received: by 2002:a05:600c:4f06:b0:3fa:88b4:bff3 with SMTP id l6-20020a05600c4f0600b003fa88b4bff3mr5859273wmq.11.1690999125540; Wed, 02 Aug 2023 10:58:45 -0700 (PDT) Received: from ALPER-PC.. ([178.233.24.1]) by smtp.gmail.com with ESMTPSA id l23-20020a7bc457000000b003fe20db88ebsm2192439wmi.31.2023.08.02.10.58.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Aug 2023 10:58:45 -0700 (PDT) From: Alper Nebi Yasak To: alsa-devel@alsa-project.org Cc: Cezary Rojewski , Alper Nebi Yasak , Mark Brown , Liam Girdwood , Takashi Iwai , AngeloGioacchino Del Regno , Jaroslav Kysela , linux-kernel@vger.kernel.org, Akihiko Odaki , Pierre-Louis Bossart , Matthias Brugger , =?utf-8?q?N=C3=ADcolas_F_=2E_R_?= =?utf-8?q?=2E_A_=2E_Prado?= Subject: [PATCH 26/27] ASoC: samsung: lowland: Split Line Out jack kcontrol from Headphone Date: Wed, 2 Aug 2023 20:57:36 +0300 Message-Id: <20230802175737.263412-27-alpernebiyasak@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230802175737.263412-1-alpernebiyasak@gmail.com> References: <20230802175737.263412-1-alpernebiyasak@gmail.com> MIME-Version: 1.0 Message-ID-Hash: X5KLGBDS3T2U5RK4R7TXIDYVK6QQX6C3 X-Message-ID-Hash: X5KLGBDS3T2U5RK4R7TXIDYVK6QQX6C3 X-MailFrom: alpernebiyasak@gmail.com 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: This driver has correctly mapped jack kcontrols for Headphone and Headset Mic. However, it is also mapping Line Out jack detection events to the Headphone kcontrol. The WM5100 codec used here can distinguish Line Out connections from Headphone connections. Decouple the two, expose Line Out to userspace as an independent kcontrol and add the necessary widget. Signed-off-by: Alper Nebi Yasak --- I'm not sure this is a good idea, but still... sound/soc/samsung/lowland.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/sound/soc/samsung/lowland.c b/sound/soc/samsung/lowland.c index 106770be6fc5..a79df871ea13 100644 --- a/sound/soc/samsung/lowland.c +++ b/sound/soc/samsung/lowland.c @@ -22,12 +22,16 @@ static struct snd_soc_jack lowland_headset; static struct snd_soc_jack_pin lowland_headset_pins[] = { { .pin = "Headphone", - .mask = SND_JACK_HEADPHONE | SND_JACK_LINEOUT, + .mask = SND_JACK_HEADPHONE, }, { .pin = "Headset Mic", .mask = SND_JACK_MICROPHONE, }, + { + .pin = "Line Out", + .mask = SND_JACK_LINEOUT, + }, }; static int lowland_wm5100_init(struct snd_soc_pcm_runtime *rtd) @@ -140,11 +144,13 @@ static const struct snd_kcontrol_new controls[] = { SOC_DAPM_PIN_SWITCH("WM1250 Input"), SOC_DAPM_PIN_SWITCH("WM1250 Output"), SOC_DAPM_PIN_SWITCH("Headphone"), + SOC_DAPM_PIN_SWITCH("Line Out"), }; static const struct snd_soc_dapm_widget widgets[] = { SND_SOC_DAPM_HP("Headphone", NULL), SND_SOC_DAPM_MIC("Headset Mic", NULL), + SND_SOC_DAPM_LINE("Line Out", NULL), SND_SOC_DAPM_SPK("Main Speaker", NULL), From patchwork Wed Aug 2 17:57:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alper Nebi Yasak X-Patchwork-Id: 13338714 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 CF1C1C001DF for ; Wed, 2 Aug 2023 18:05:58 +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 C5607E7D; Wed, 2 Aug 2023 20:05:06 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz C5607E7D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1690999556; bh=7yxCq8SfvooL1gtNw23fM6/VI3lMDkq615cFtm+a1WA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=Ns0t31A2unA0pZO88e/rnbN8w07PB1rClb7qsGgUbk6gjOejtvFk73aSqhCbGlge7 Lhi1ZSu/pv2r/UiI9VpitarTvm3XoJIhI0QMbmyFhQwpTw74c7YWnQtPrAMfvnf/W8 2D7Zhb9RQCPAZAqFaB8G4XnZLrmZWRKDihTjE43o= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 6D02AF80549; Wed, 2 Aug 2023 19:59:32 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id C9110F8016D; Wed, 2 Aug 2023 19:59:31 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 2E514F80611; Wed, 2 Aug 2023 19:58:56 +0200 (CEST) Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 561F3F805F2 for ; Wed, 2 Aug 2023 19:58:49 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 561F3F805F2 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20221208 header.b=g1wME0Sd Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-3fbc5d5742eso1255785e9.3 for ; Wed, 02 Aug 2023 10:58:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690999128; x=1691603928; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=tNMbLNyqZ+emJZ68zpth6DtJLmrhI+8LXvJVEDQYQ2I=; b=g1wME0SdXRtw9CPo/8HDfKuL4GNNtrvZAGMlwVbhYRcNlUlBDfWZX5k7hH6BkQGS35 ZpHZJG1yusAGfd6t6AdsltXnnV/D6tMnxJCimEBMEdw8ZJ4zPkBqhrrxj6xn0APWDblT K2Miia2BQgJIu01mRQFaeB46Mphnc2dXcOUJn5jQeKteVa8vgMlH9aazo29kqhOq9KWz hWsF2Czn+GsI9Bgb6Xfbqba9D/2PlNHj4/bB2aFEspi6lQ3Ts1Fi25gX1+Jq1IwP3477 00t2m8tO0TpVASZqUf8CpwJSpbiK2idu0SCkqn+Y1KXtOukmnEAZ6lFnzJQzqoXBrJhr dWbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690999128; x=1691603928; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=tNMbLNyqZ+emJZ68zpth6DtJLmrhI+8LXvJVEDQYQ2I=; b=VfWKTw5asXEj9eBJ9nkgkzMg8WzjsbUvVQwfuPcE2gYzNtuFmQIbu8E1Q6ztapLfXh p6NkIlYuzTCpZ5cyCjWDjKP2jrVEvVnclP1iq4xnXqvp351RfKVSslYTl32HokGYs8uA duQ5lxDGyG7TuJOSdKdMEI+cfrCj0P4CEFlLcxfREiJ3JDJR1KjCzgcVf7eLBEIBJ7EH 0FL1yjIj2rvX/vW4a6rJxGEeesZ6af5pId4ohUolCMq3cNkBh9V4nbTRD3zSVCdbauAe kGPebOc9jdIupBYuLGA0reaMFS5XzSurV5ihsMDNlHvzDulrcxJaHUw871sgA9LGJ+hc d9WA== X-Gm-Message-State: ABy/qLbn8VujrwImqz1ja+mfDF3+HLd180ISlUZMezF+kiyxD4SakHDx K6WtSjd9ga+wz3f9sMOgC0qZsUFq8GA= X-Google-Smtp-Source: APBJJlF+5skmhEb8aNeWM8Qh6e6Wepa+pivxHF2VJRgf2lqm5GL21Nod6FXyIloCW2/y+9tAYg2k3w== X-Received: by 2002:a1c:7419:0:b0:3fb:e2af:49f6 with SMTP id p25-20020a1c7419000000b003fbe2af49f6mr5114900wmc.39.1690999127599; Wed, 02 Aug 2023 10:58:47 -0700 (PDT) Received: from ALPER-PC.. ([178.233.24.1]) by smtp.gmail.com with ESMTPSA id l23-20020a7bc457000000b003fe20db88ebsm2192439wmi.31.2023.08.02.10.58.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Aug 2023 10:58:47 -0700 (PDT) From: Alper Nebi Yasak To: alsa-devel@alsa-project.org Cc: Cezary Rojewski , Alper Nebi Yasak , Mark Brown , Liam Girdwood , Takashi Iwai , AngeloGioacchino Del Regno , Jaroslav Kysela , linux-kernel@vger.kernel.org, Akihiko Odaki , Pierre-Louis Bossart , Matthias Brugger , =?utf-8?q?N=C3=ADcolas_F_=2E_R_?= =?utf-8?q?=2E_A_=2E_Prado?= Subject: [PATCH 27/27] ASoC: samsung: midas_wm1811: Map missing jack kcontrols Date: Wed, 2 Aug 2023 20:57:37 +0300 Message-Id: <20230802175737.263412-28-alpernebiyasak@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230802175737.263412-1-alpernebiyasak@gmail.com> References: <20230802175737.263412-1-alpernebiyasak@gmail.com> MIME-Version: 1.0 Message-ID-Hash: SF2OE2VICHLEE2QT7COEGE55POQY63VF X-Message-ID-Hash: SF2OE2VICHLEE2QT7COEGE55POQY63VF X-MailFrom: alpernebiyasak@gmail.com 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: This driver does not map jack pins to kcontrols that PulseAudio/PipeWire need to handle jack detection events. The WM1811 codec used here seems to support detecting Headphone and Headset Mic connections. Expose each to userspace as a kcontrol and add the necessary widgets. Signed-off-by: Alper Nebi Yasak --- There's a "HP" widget as well, should the jack kcontrol use that? Would SND_JACK_MECHANICAL be useful as a kcontrol as well? sound/soc/samsung/midas_wm1811.c | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/sound/soc/samsung/midas_wm1811.c b/sound/soc/samsung/midas_wm1811.c index 6931b9a45b3e..44b32f5cddca 100644 --- a/sound/soc/samsung/midas_wm1811.c +++ b/sound/soc/samsung/midas_wm1811.c @@ -38,6 +38,17 @@ struct midas_priv { struct snd_soc_jack headset_jack; }; +static struct snd_soc_jack_pin headset_jack_pins[] = { + { + .pin = "Headphone", + .mask = SND_JACK_HEADPHONE, + }, + { + .pin = "Headset Mic", + .mask = SND_JACK_MICROPHONE, + }, +}; + static int midas_start_fll1(struct snd_soc_pcm_runtime *rtd, unsigned int rate) { struct snd_soc_card *card = rtd->card; @@ -246,6 +257,7 @@ static const struct snd_kcontrol_new midas_controls[] = { SOC_DAPM_PIN_SWITCH("Main Mic"), SOC_DAPM_PIN_SWITCH("Sub Mic"), SOC_DAPM_PIN_SWITCH("Headset Mic"), + SOC_DAPM_PIN_SWITCH("Headphone"), SOC_DAPM_PIN_SWITCH("FM In"), }; @@ -261,6 +273,7 @@ static const struct snd_soc_dapm_widget midas_dapm_widgets[] = { SND_SOC_DAPM_LINE("HDMI", NULL), SND_SOC_DAPM_LINE("FM In", midas_fm_set), + SND_SOC_DAPM_HP("Headphone", NULL), SND_SOC_DAPM_MIC("Headset Mic", NULL), SND_SOC_DAPM_MIC("Main Mic", midas_mic_bias), SND_SOC_DAPM_MIC("Sub Mic", midas_submic_bias), @@ -305,11 +318,13 @@ static int midas_late_probe(struct snd_soc_card *card) return ret; } - ret = snd_soc_card_jack_new(card, "Headset", - SND_JACK_HEADSET | SND_JACK_MECHANICAL | - SND_JACK_BTN_0 | SND_JACK_BTN_1 | SND_JACK_BTN_2 | - SND_JACK_BTN_3 | SND_JACK_BTN_4 | SND_JACK_BTN_5, - &priv->headset_jack); + ret = snd_soc_card_jack_new_pins(card, "Headset", + SND_JACK_HEADSET | SND_JACK_MECHANICAL | + SND_JACK_BTN_0 | SND_JACK_BTN_1 | SND_JACK_BTN_2 | + SND_JACK_BTN_3 | SND_JACK_BTN_4 | SND_JACK_BTN_5, + &priv->headset_jack, + headset_jack_pins, + ARRAY_SIZE(headset_jack_pins)); if (ret) return ret;