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: 130076 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f41:0:b0:3e4:2afc:c1 with SMTP id v1csp665100vqx; Wed, 2 Aug 2023 12:03:06 -0700 (PDT) X-Google-Smtp-Source: APBJJlE3F6vS+3gT58vQgV1K3VsNiGnlHFcokp7vyRgSK5AdYIKGhqnb105r3VOaD5PqQYWz35Hv X-Received: by 2002:a05:6a20:430b:b0:13a:52ce:13cc with SMTP id h11-20020a056a20430b00b0013a52ce13ccmr18555055pzk.51.1691002986158; Wed, 02 Aug 2023 12:03:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691002986; cv=none; d=google.com; s=arc-20160816; b=vbGHBy+pPM9aqOfjMQiD2nzC8NZloiBjfgo5TD3qHG3bKcb/KFRLVNFvjBUtOKVQOC XpkoLCJHJjqkZ9gn0fGLipXZV5usF7LFGFAH8aJvPBeNOpXVg0jnjLim+emmv0ipcWSm kt1Jt03WMmeaqFOL/JpzaNZDPrvk+PtnJXTeTovy2Gzb8xi3B0udyjEsUFOlCtgxF+Ry XfqbW0XXPei+9Gp7SwyI4r2CjOQ9YVkrubLtCT4FlTf7NnRtDEt6V1YrlBW+GeYXVYTg xQwlR6Oe6Zu1en0yNzkYYc0qEbTwuyHMdXAHiWiiN0ZMJlLaO1+7Uy6HwazGTUJYNP0w ZfmQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=brF3soBTEQ7lATGtnS3zYxb7mTThtaUthI8D9XqkA8U=; fh=GUNhzEJfka7aU6InG/mqeUgtNKAejFmk0vy+CY7S+VM=; b=pI58wLbLBLkXmKyoKnnLd7kY4dHfU8mrWozQlESvOEup0ujVwNsQUhpP9l+ZvQtLnp u0222gfsPTNxATUBQH7j8zvktqvOZ5MR9klaHfQFUTjKNERBGBO+/TPKUsENoZBecmcw A2HHC6ncnhk144NK1bhXBNyXIzeHs8Cqti7qiXEPGRpuJjPPmhWD9QGv4c3j4YOrHHjT xD/s7234A1u09xtjn5jGNUXyO3Ph++fnVcoCp2mDonA9+FRR2AhS+ha3aXQ51Sgcqal+ tdklGv1wHShs49Hif2sj3IND3vIbFFubZulDwwNZCKGCGtR0h13E86RfOwxvDP7ipENZ +sZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=kZWYUQ2z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x63-20020a638642000000b00563dfffe7b9si11020102pgd.810.2023.08.02.12.02.41; Wed, 02 Aug 2023 12:03:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=kZWYUQ2z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233760AbjHBR6v (ORCPT + 99 others); Wed, 2 Aug 2023 13:58:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46592 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233113AbjHBR56 (ORCPT ); Wed, 2 Aug 2023 13:57:58 -0400 Received: from mail-wr1-x42a.google.com (mail-wr1-x42a.google.com [IPv6:2a00:1450:4864:20::42a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DB0A51713 for ; Wed, 2 Aug 2023 10:57:57 -0700 (PDT) Received: by mail-wr1-x42a.google.com with SMTP id ffacd0b85a97d-313e742a787so84728f8f.1 for ; Wed, 02 Aug 2023 10:57:57 -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=HpzvEfn1RGkqGDB9mz/P57gLJBZ8fnb3Ilntj8Oueo14omFbNlIXRs5KTaZ2Pg+p0G jLEMf9wAElxwEtVZxgdYw1xfD0b6m7RLC7jt+pdzp01Da4xin05/Imuh0tpfguj/m7z8 b4FyVV0zsii0luHBcyJkWRBOEeFrPzEjXVLvlr8dFz7X3c3IC4GQM2wP70ljXH4FNV38 LXeFkYs8yHuTzytXgiive94H8rM+dGSxwtiN/uTNEAlH5rxcefZm4g5x9c3nRyCMhgJd wiyq1EfxOmalLIBdCSMlcsZ5me7xDV9nuia4aj378lhQijPTKaVbBQvybvYUlW4aC5L0 wndA== X-Gm-Message-State: ABy/qLbjYjh0PJyxRyCpNHq0Bw/rj8c1cbuMozDnSC21VQIwJwtvNjNv VkbrAvsRJ7giQmlfegS0ugOkBeJGT2E= 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 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1773145147073050973 X-GMAIL-MSGID: 1773145147073050973 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: 130069 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f41:0:b0:3e4:2afc:c1 with SMTP id v1csp660255vqx; Wed, 2 Aug 2023 11:54:02 -0700 (PDT) X-Google-Smtp-Source: APBJJlHh8SuDEoYczmdsrDAGE4GHkzvjbIani7+DFSTyP95fQZ2CCA9M9fgLnqyq+oOWKXEl4pO1 X-Received: by 2002:a05:6512:5cf:b0:4fb:61ea:95dc with SMTP id o15-20020a05651205cf00b004fb61ea95dcmr5117616lfo.7.1691002441921; Wed, 02 Aug 2023 11:54:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691002441; cv=none; d=google.com; s=arc-20160816; b=FV0bE00hNvxWIG6MSqmBQDrK57SOSjx4++HXA/xKihpUo9Pz39/TBNRFAwFu9vnBdB GDaVhYD6S9r/isof0psB7YQ+KBxWCAKuSGrdIohel6t6P4IBZURMOcqpc5hKD0gljB6o 9RCZzGO2p0Kj6NUjWHijLyYnlVcgGU7Mg012o84vw8d1nHEI7J9RvvkXcguY5r33FTGd rYiEIEvK2oX0GIOlt+oSYl07VGb532UTvxRLR3Qj8OE73v80uQCkslY5uVR0N8RCpzj4 qBaxMRkihonChoCSMQcjtgC9wPLsOFaXq+G9AhV18vIzkdpVlXqhDbztVDVrmbreb+Gp RXPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ci67Td9oMJsLWbpviA9NcbMT0ChoVa0sXVbZDuba2eI=; fh=GUNhzEJfka7aU6InG/mqeUgtNKAejFmk0vy+CY7S+VM=; b=jNFtHUvrG3x1+kIh4Q7h2U0FsfsM8znUvcqCnCLgqX+xiMeNnfhkK7Zpk/RWGWSzYt g0KkfH4Hqbsgy8u6HoQHnk6VP8wrm1NN6SxpImRr76Bw5PxmdeZInzf+6cVMqoZjeeGy ScIg3t4vGFkwcaIyQdv+5wgKwLgBFr5iev4TlWlgTZb7DFytMm45+p3p85V6YJMQmiAv 1rThu4m693I+uPutXb1XTv1pCjKRev+f5m9igtdibm8IVrMjb1zF+hw8K70RTJcefHih clBLo6Fct0d7qVl853IGCuX2aMsGnGejjVJ1edQv1pnTWLAdnPpp5g1hS6iaWWrq9/PM /VSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=mzEQx3XK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a8-20020aa7d908000000b0051de30de0c4si7203151edr.595.2023.08.02.11.53.38; Wed, 02 Aug 2023 11:54:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=mzEQx3XK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232615AbjHBR6U (ORCPT + 99 others); Wed, 2 Aug 2023 13:58:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46604 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233944AbjHBR6B (ORCPT ); Wed, 2 Aug 2023 13:58:01 -0400 Received: from mail-lj1-x22f.google.com (mail-lj1-x22f.google.com [IPv6:2a00:1450:4864:20::22f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 68F18A3 for ; Wed, 2 Aug 2023 10:58:00 -0700 (PDT) Received: by mail-lj1-x22f.google.com with SMTP id 38308e7fff4ca-2b9bee2d320so901681fa.1 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=I5iH6Zmwy2BwyTSsTKZoK2lsMwpg7++mgR2qs3GcXT9yHQphjTA93rgNRu4fsKxm5M hdjDPDaJ3SfRmB6FrUpV9kkbgzcX2qPv7Ulv3qDrVvuk8so6Pv2yz9vvD2c0eA3hOhY3 J0ONA81dK1UsptJcYqx518l3v8Bh+oI5k9ELxSyDsoGCv4FNc4hJrWVtq7XX4mSZSdKt WhOgMsDgDT31+z59YRspETawhMwdrDQNMDzJC366VvzOTh08GJBkek5BH9qjiv6hwxE+ x+QacP8tJh+OPWvLlYVE9aR0RT+iNW2MGEzI9eZvTcfieVHW02w0EWTU78dOVK80j5wG 4Htg== X-Gm-Message-State: ABy/qLYFyRQWlFIcttUS2Q1K35Fl2+x6ou/06ScaScpKGv1+DruRjPMe HD6az6cxqy0KJXykaNFrBnA= 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 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1773144576423273075 X-GMAIL-MSGID: 1773144576423273075 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: 130120 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f41:0:b0:3e4:2afc:c1 with SMTP id v1csp688449vqx; Wed, 2 Aug 2023 12:48:59 -0700 (PDT) X-Google-Smtp-Source: APBJJlFaEO02XRP8rv0BuRh7elqd528K4EgLs/g+chw3KYQJN7FPn101Ps1bU/GNDFqDa/7A8glF X-Received: by 2002:a17:906:108:b0:993:fe68:569d with SMTP id 8-20020a170906010800b00993fe68569dmr5800052eje.17.1691005738666; Wed, 02 Aug 2023 12:48:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691005738; cv=none; d=google.com; s=arc-20160816; b=vPw0tivczClzlAXR7G0qHBRHhiaRojwphSNefGejDhdBxyIY98cHIfTsB0a+mpq4oI wQ9QTqXs5xTsXC1Q0K5W9yN1G4ZuiXtzq6yaiQAg2NAoYNDLD2B+AUQZW3dB6XCYRTaL CmkJjOm+NJt0d5QLEwTSR78+Fh5cQKWGbtSMTJK7sre/KpfBZyXR9RPSRfLvFAVDEL2F OtzbWTEAy1RY63XbND1s02ycT9m8vQYhYoe8eRFdiD1cBzkGwznM7HfSvC/qoip0R8hy PVrzMW/jNEJYyy88kwFy0/all7nar+0aQM22fa4UtXZ7Sh3ZF/Yqdur+MU/abpSw0s0N /CPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=E8q6oeJAXCtu9hv15ODqXQ4DGTBLuJ63S8PbYuJF85k=; fh=GUNhzEJfka7aU6InG/mqeUgtNKAejFmk0vy+CY7S+VM=; b=jRg7Iz1cwoE/OXsPmP7k7T+j/Q+65XSRgNAR7cvI7HAxC/JZOCPwsrVKYXnLFiEEjo 8nRe+O7Ti09/66foMCw1EwsvzZ4HUMMgHPPCqScdIWyQBiThX+OhfP8BKmz7rvQwxIOR /h3ZjDRKgDAV5EP15Unwltrd3IGxjPnjs/YtGID6EJYuj/3zXMi8nzgLUPNL+LJR0+yC AY/Hcy8ypA8pRC+XhJoO3JclHiC6xf29H/yBcZ7fXMyZVGtETiqV4r2BBryEUzMsJYKu 0iZ9fdMzThGqVmEHasyy/FfIibJOtmppaeHwd0yADSub8BWBJBeyaFhIkbkmG++5mY1O 1qtg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=hvqAAqCj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q23-20020a170906a09700b00992550ccfa2si859859ejy.273.2023.08.02.12.48.33; Wed, 02 Aug 2023 12:48:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=hvqAAqCj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231773AbjHBR6Z (ORCPT + 99 others); Wed, 2 Aug 2023 13:58:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46618 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234051AbjHBR6E (ORCPT ); Wed, 2 Aug 2023 13:58:04 -0400 Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2B900170D for ; Wed, 2 Aug 2023 10:58:02 -0700 (PDT) Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-3fbc63c2e84so1268875e9.3 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=HFRiyCKW8C+p27U/wBWe1WkBxIKvqaY/V1YqXjozz5wh1nkv2qUOLo0gcBLD5f0Q17 LSdx/7AN9rUwNkudbltRbPplnnKYJzA6SPkgsFX2Ta1D9WOWwO6mn7O8vYJEQ53OSVF4 bhpciP2hA+AKQtReLA7MzW5oM/HYvrhnOjU1MAkT3cPMH0BpOXGjmPShhA26cxkpQnGF 8l+hEs8GNOAIzE39tov56cCIeo1H/hIzQXLJqelqXYfXLY0gka4ugcrtLWd17pIqYDK1 zrzoZfUYWvcMDAypJ/GHmnhqylVmbiMxwcdZB5hg5+JWSMxl5O0FRwSmo4UGaZxXK6sR frGw== X-Gm-Message-State: ABy/qLa58JSNttO+pS6G59tTz4FUVXzFN38sAPnRU53seeDWnJiXK/pg pkfg9Pp8s252jeb7IugKk5E= 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 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1773148033322845916 X-GMAIL-MSGID: 1773148033322845916 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: 130055 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f41:0:b0:3e4:2afc:c1 with SMTP id v1csp656406vqx; Wed, 2 Aug 2023 11:45:45 -0700 (PDT) X-Google-Smtp-Source: APBJJlHEevIRhbMbtpJ5qlolkZ6XErCFyTaESLqt9YfPKYb/opRL29Ptb+u7NLAA0DnjSWCcWRp2 X-Received: by 2002:a05:6a20:5485:b0:134:b28f:b58a with SMTP id i5-20020a056a20548500b00134b28fb58amr4445061pzk.7.1691001945303; Wed, 02 Aug 2023 11:45:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691001945; cv=none; d=google.com; s=arc-20160816; b=kfhPNt9mZDjEQT5nWuXYTzwfj+M46UjOOEek8IveKKg3axhIn6H+PkF8jxo+Scaqr0 8aXlfd6xCqKDkt+Yt4WOvHUVy1Kol3eT0IBczvGEsR4QFEp57S2qronDelAH/L1bJ9pW sd+mBs9iDVTR681hrPRblaHdzuhYlQeyYmPI1ffMfDPAapeMRnm+h/0Ej9H4jwOAxGBI czF+dnQXzLMFf5/7sF6HcLcVK658ClYDchKkKvvhhUI7E8u4LBzlb+T2m3MMTDcXmR84 NF1C1dVhfejtIWxmxUs+33ewEIuKctaq5WCUkAKbgXsTjhJZnlVlUVvWP6EDZXS6lipk N9VA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=giLlDxuohbavL/Eh+3qVG6gVGzv5UIQjKSZ5ky1GgcY=; fh=GUNhzEJfka7aU6InG/mqeUgtNKAejFmk0vy+CY7S+VM=; b=gjTSx++veyvDXSXH6G5NPEuzpj0z38e6xx0h2vJooxNE2CWTUIfEzZQ+9PRWQzS+xQ LeA/X55/aSo4dzJzV6BrZogsv8cLrzzYYLzXOZdSlnkW1j83O7P6uA2QKV8eup4eIfs1 Yen8luCnXfK+VRhXt2SsHZQm71XM0fsf/hfXrxr1+dqYvPTm9b8DN/gAtTNTltQOM9DJ kNdwmW8GgFY1JS6QsoAExKJYmSASiZxtej+LLCuuDOzrD445xZw8hYL7TmG6tyEscEL6 Y7yDE4kzTi5DbMqppootipV6X14LX31oPAYoKxleO9B3D34j6s0xPb2eqNTC/ZYVZslL B7pg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=dcwAI3ZO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cp24-20020a056a00349800b006875607bdd6si2593779pfb.18.2023.08.02.11.45.31; Wed, 02 Aug 2023 11:45:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=dcwAI3ZO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234264AbjHBR65 (ORCPT + 99 others); Wed, 2 Aug 2023 13:58:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46628 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234080AbjHBR6F (ORCPT ); Wed, 2 Aug 2023 13:58:05 -0400 Received: from mail-wm1-x331.google.com (mail-wm1-x331.google.com [IPv6:2a00:1450:4864:20::331]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E0BEA171B for ; Wed, 2 Aug 2023 10:58:03 -0700 (PDT) Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-3fbab0d0b88so8093125e9.0 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=WTxFvILYbOmuQylQEoJs7UrNAtDu0Qv81uMqe09a1yhD85k+dSSlBcvqCkdeY4a9Qw j8bkIiZPSBR0tTo5mAcJsB37/KLgEcjmT/n60t3Iu6nCo8J3SvxOZ02orfTYBTfofmKU O0NSbku2L/a57DqNgLfoHpLfLTEDb5nA6sqq3BdhLA4fG126cQZR+4uf9VSz+SdKn1hV /DpOQJWLrvBHVL531abb3LwcflbC5v/srs3+BVj9bBYTTYs/8/K8POqn3UPHllkUqGMv lEWtEGNjYa19I7yuq8fF0/in0/JiYEtZQLsXdIuyEDw+po0bPqFT5l3RyArX8JxNYK9o c0bQ== X-Gm-Message-State: ABy/qLYkfOGmp07kFoeeNy0WVqxxWa/M12uP/yH9hH6yA3/lcFIEXPuq qsetAtAw1Dq0lXwtVgLulXQ= 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 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1773144055636456372 X-GMAIL-MSGID: 1773144055636456372 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: 130121 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f41:0:b0:3e4:2afc:c1 with SMTP id v1csp690084vqx; Wed, 2 Aug 2023 12:52:43 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHS/6mYPO6Pe2SOc9ayopCPr2CUZ+qDxTSprOhjeRMbRc3/beAQZUV60gnsIlk8tmuilu8Q X-Received: by 2002:a17:907:75f6:b0:99c:6312:73ca with SMTP id jz22-20020a17090775f600b0099c631273camr99630ejc.71.1691005963204; Wed, 02 Aug 2023 12:52:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691005963; cv=none; d=google.com; s=arc-20160816; b=Lcn5gLEsfPHrZjfzBJgkC7wHUawQl7Qd3PNeTPOdDzqiAXvS6M9i+NTrUuSv6itsz7 JrxzYouS61t9aDNwuKohObcydPKt9H0vDCar8BJ/JwnKz6uwdF0guLjLOIxj7jOkUUB2 H4dFaAhtwCeOEc0zRjZ1URxB7C8Su3ZXwMUQpioHMWTF+A1UQOuI0cqfNKEn/CNYtF9m 5sug/OLtFPB+HVKnur6OzzMNgqtYXFHzxUUqX2S7L+Ars/vXireIfeKkwuiRht8P7Vgq 8io4fU+3Zei/IvZosb/Rd3GBRdRg3lXVVgNvcKDMxXXxNkf3R2tuchoWeSPu0RvyyWbv B4PQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Z5e55/3niGxnTXERcmKYSB94dQwx71jJXMxMhyp26po=; fh=GUNhzEJfka7aU6InG/mqeUgtNKAejFmk0vy+CY7S+VM=; b=wvu4Gugye9zgjJFPiyZmvhJ4qmh+aO6PP/b2NdS5Z6Fn+63dGLZlN/xsuC7mpFFmNK 3TQS7+sNlSyTrCupjglX4fHaSx+ziP891KX7t/LQgjEuREItB02+/NdFp6l+JMV4xTf8 LxJOi3TFPLtrJM175/OPT955m3fgQEAVAOfx9T8wCsi+w4UTB8i46VffeaENrkFbJn2t IIOq9O0zh3VwM/FXqz9J3iz0luJgdhdRbwEkbyyzAllg7wxkJpI17XHLMCHRoYQWjRSo Kx3SK+ADr83BjJDJP02egaVfhJ/GUsy0yhFXHbr+NTSLDkqlglFLo2M+cccx6cZvmGq9 oVIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b="RJ4Ld/iv"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l3-20020a170906078300b00992bbdebdbesi10145268ejc.785.2023.08.02.12.52.19; Wed, 02 Aug 2023 12:52:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b="RJ4Ld/iv"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234112AbjHBR6r (ORCPT + 99 others); Wed, 2 Aug 2023 13:58:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46642 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234129AbjHBR6H (ORCPT ); Wed, 2 Aug 2023 13:58:07 -0400 Received: from mail-wm1-x333.google.com (mail-wm1-x333.google.com [IPv6:2a00:1450:4864:20::333]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CDE49170D for ; Wed, 2 Aug 2023 10:58:05 -0700 (PDT) Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-3fe24dd8898so1324375e9.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=lR/NXcaySkS5f9UJTSDwQmPK5VMr7dUHRQT3IO9gS7s9nxHVUvIMMHAL8+SHT8zN2B delV/3QdcLabx+IAdi8+G1yHB5mBqwI3IswnyU5NpS+F9m+h8baDVStzbyEhxGjZFIRy 6TPDX+gBZZRRQhjmvXWjt7UGpWah/oDZFkTmahasa6iDVtNwUL4UVHloiRgxtU1hI2ri p5cv/wfWwFmKiR+IsxV1s9bT4tKWsmF8YBhbuQf1PNv9qFHK9fbubARejH1JDR369ScI kiG9GFdEmZmCYSRw79tJJWL7vFxX07+uLkf87ZscdsGiJ0fnsUAc9yQJFNSaP4aPcPvD qZiA== X-Gm-Message-State: ABy/qLZ4KEjNDu+fiaufr7zQEPlb2l6vaBIgv6UO34w4RPT4aAKmYEM4 YGJpY2EB6fAGkjt914DZEzs= 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 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1773148268744742457 X-GMAIL-MSGID: 1773148268744742457 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: 130044 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f41:0:b0:3e4:2afc:c1 with SMTP id v1csp641939vqx; Wed, 2 Aug 2023 11:17:23 -0700 (PDT) X-Google-Smtp-Source: APBJJlG+0tRack7LSHwC+bAlKe1MTbaLucX8CfeL2TaYCZMZMP+yjVrrVSfF3gPNF9eL76bApBxx X-Received: by 2002:a17:902:f54e:b0:1ba:fe6a:3845 with SMTP id h14-20020a170902f54e00b001bafe6a3845mr23573308plf.11.1691000243140; Wed, 02 Aug 2023 11:17:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691000243; cv=none; d=google.com; s=arc-20160816; b=gLcOb20eAPxaFG30GlXr9sWLyTH6e4oTAnUAAyq+tDz+4gDNV6WBUKtcWO8lXP31lH 3nftlNzlBaFac1dw5bO40rVgxfnkASC3BP32yN//MsAz+YRqcVQWv6Y3Vjhn2mJm/HwJ vam21+hOiHFIk/tRgjETs8OlgvLaTYH7sOMNkvKZ8Z4X6eo8UoyzzhgD+oxkBbpQR096 4JpqK0MFO8NLIREJgA/MC0Bw9qcSiRZOwvPzDx/6DZL0wlDY18sql+i61Op3AUS1U3sp KceHx0nS4XT0XGanf65+UTfNMXsq9lIw4q0tSM9L6bQd1u/H0x+aFgA/v/CJ/UHsIxE3 saCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=l9P3TP3wzncRhOXgecZRN30Iatpmdu19th61qwxb3TI=; fh=GUNhzEJfka7aU6InG/mqeUgtNKAejFmk0vy+CY7S+VM=; b=PVgRna7XN0dNzMe/9C0LFr9j+7inKVkfbBMLvHnTsHN5tkMsl3DCGyuTlPTc8H4JnN gPN6oAB816GadG1i60ZiXUrkEftQjIforPAyhg7g/AnK/oD9YffXm6bEOW9M4ETrUoOz N5jiNMoQ1g8J6vNB4vATidVV7NMJ9r0p8YKVrDIvKrA5vubn8umAixogndjNAfbn0CpW fDCT+hI5VTF74IR4dK0CzqDZT3AF9UcrEpogSzWFoFIn74BCmvPGTghnFnZU5UKTl1Q3 vF5k9APtF/nNdsENJG5BejFCJqX+tfSn+ozor6UEudGQnHtuxYhTLl0Kj/PN5CMPZHII wWyA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=bnCWrvBW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o4-20020a170903300400b001b8c4168e20si10998599pla.58.2023.08.02.11.17.07; Wed, 02 Aug 2023 11:17:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=bnCWrvBW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234160AbjHBR6f (ORCPT + 99 others); Wed, 2 Aug 2023 13:58:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46648 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234166AbjHBR6I (ORCPT ); Wed, 2 Aug 2023 13:58:08 -0400 Received: from mail-wm1-x331.google.com (mail-wm1-x331.google.com [IPv6:2a00:1450:4864:20::331]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DE59CA3 for ; Wed, 2 Aug 2023 10:58:07 -0700 (PDT) Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-3fe2ba3e260so1395665e9.2 for ; Wed, 02 Aug 2023 10:58:07 -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=PI8rMnZ/0PYaLvfCo4ukuvJL2tM0YEeCWsBvHd7jFvAF1kSN3mdPtFuJYIK9sXDAg0 HbDSoiUrS1ZEZb6DypfniznamNuf9tgAoPOj1pARFhwwYLQ6jqulvKNO/skXUtG5pXb5 JDhTj5RIqAwi0PYNxNisQiDgfE5N7ZhEvbC4KqCvV6f9CHtUeYRTKYX/kfTM895VADa/ 0Peoow0VnSFlGO+kjruDH3kT/HEO6Y9EIj2VqsdJ8m20vnKWTqQLXFtebGubYn6lmOhq noKgXWlm+BopaHujL6YZRfuU/TtVzGmbJqIPD1GlGeiZcHk4QB+wnXv1GOmt8ju8OJpf /E/w== X-Gm-Message-State: ABy/qLbuE5Z9czRwXuUS9koZ+wz99n95jevuiH+9apgJpKaB+MQZ03/G Mdp42tIZdekWb+wTB5Q5ifc= 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 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1773142270641938877 X-GMAIL-MSGID: 1773142270641938877 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: 130095 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f41:0:b0:3e4:2afc:c1 with SMTP id v1csp680842vqx; Wed, 2 Aug 2023 12:32:23 -0700 (PDT) X-Google-Smtp-Source: APBJJlECTZZLjwt12enhgpxhVprbvBBCOPYTVJuhqDmudQH/Kuld91NIHC+KxSspC/WjGYthTTbE X-Received: by 2002:adf:f4cb:0:b0:316:e04a:29e8 with SMTP id h11-20020adff4cb000000b00316e04a29e8mr5424122wrp.54.1691004743177; Wed, 02 Aug 2023 12:32:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691004743; cv=none; d=google.com; s=arc-20160816; b=YovzmuGWYjxjr1hVxB7MlIZJspdpD/VN1tq2/wDZL9lV2OTVkX/yu40lT2d+7XioRf GLVLek1UB4+wOFnzfKS2iOltr3mA4bhucrzoyPOQL3S9rD1kyP6eNAJHpo6DqIvuh7W5 3mWd5e45QouwyPeQY4oDS/fWQHcTTRv/8tDZyhRtazQS7ynxGNUTs38fsKg0dsCarEYb L9yUQNOb6SBl/8Rzk0rUrO2UiOrgIa2ZU8XfhFrOe7jpsMOdufu7wcLrVx9zi51x+VJL BZ26nrFHz2nXzdYPfH4enBsVxTKgoAPCdhUStZ3SEhRbvcnxWsbsOY7HLsTdfbC2iV75 kgSQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ln5Wo7yMvulq8m4RXX5h43LD0FJm5RWbml3d8jCXUmU=; fh=GUNhzEJfka7aU6InG/mqeUgtNKAejFmk0vy+CY7S+VM=; b=Fgl3oA77g2aFiptxmHRWe50PJw2CE5LKbeElecZXWP+oJk5w9dtize468z3TVaQCGL Nm8GuKIGa7+Utfc0dZ96/7fMcJrD4q5Ti/fkV5UED1Yj4Uca8LhZ3ev3mnGccQt0GLl2 azXgqTtDLsHd7DDLeUcF97AJINuO60/yPmFjaK8FpvtNyEBdx4vA0gDAcQYLO7SkrYZL emVwxkUTfd5zIOHhbn/LgY6gkyFdrh8VRKcFoAAzb0i3k8CxKWiULv5+4sHAqrcPhh7G hfd9wum9swuZx3su8m8XPT6DKAPAGtdAO7h+x+HV4ICFfpiozFyXkzNaalZ/A6rqbgzF EKeg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=QmAr5gO5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w8-20020a056402070800b0051df5f4e88csi11036389edx.48.2023.08.02.12.31.59; Wed, 02 Aug 2023 12:32:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=QmAr5gO5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231905AbjHBR6T (ORCPT + 99 others); Wed, 2 Aug 2023 13:58:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46654 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234212AbjHBR6L (ORCPT ); Wed, 2 Aug 2023 13:58:11 -0400 Received: from mail-wm1-x32f.google.com (mail-wm1-x32f.google.com [IPv6:2a00:1450:4864:20::32f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BF496A3 for ; Wed, 2 Aug 2023 10:58:09 -0700 (PDT) Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-3fe1e1142caso1615325e9.0 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=KtmecCQ3qLT4D2HOF/wyj5kOYPifU3wSqtJsBSxolI8cwjUd+Z66vYR7qbDUeQWjpU 6rOa4NcU+Z5Gk+JZlo/jm8FRn8Uv1PyiAovcBeWAqbvIRNUNkxJ4V7YDI/Prk0eo3cH4 pbHQlmZKiaVYjtQVKxi24vQr53D7/tLD8T93cJ1asSe+m5XU+0fn14/YQF1kkdoeyM5u hgW/DXEKEpU1hjB+Iyh9BDgLuvTLKlVs6LehuvfL5NXR5PGVqlhJjuwhOwBlI/002ugi F159R2TZt2cwe/jY3wQLhAVzNqu+1sChom1Efzx9usNgOC8G7rJO5MPJ9ETujM3RwjxB EVhA== X-Gm-Message-State: ABy/qLbtjtJY/EyFe0TBRXTdbz+m9Z90LVHwrZ5jWpnYmPpmPIeUoJsF Ko2hmEiF43oLUU7mzUumi8M= 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 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1773146989200175423 X-GMAIL-MSGID: 1773146989200175423 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: 130070 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f41:0:b0:3e4:2afc:c1 with SMTP id v1csp660802vqx; Wed, 2 Aug 2023 11:55:07 -0700 (PDT) X-Google-Smtp-Source: APBJJlGEUsNW2YnUDgHDg2kTPSChheUOeZZoCEFPB9noz34ThBTcpzNixSTuU1MhOpDx0QfooC+y X-Received: by 2002:aa7:d4d6:0:b0:522:c136:7422 with SMTP id t22-20020aa7d4d6000000b00522c1367422mr5382475edr.21.1691002507572; Wed, 02 Aug 2023 11:55:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691002507; cv=none; d=google.com; s=arc-20160816; b=poO6Gug8zzJL/xhRg0KGib+OTcqNBTT3t+LrXUIGkmgL3FFPn/gI8HueizaXwPRJWB 7gGwENLoRUonSnG2b1rYp8yJopP6UDTSoC9H3OCLv6vRLMnVygAz9xtTr/UzMd4NHWtM g+Bp2bBA8Wm+JwJDv/CyvBdVuMRfcG+BL2X8GnJuWt1s/YxoK7sgzPxBZcDMreSaZ4D/ NuNz3HKlOJrCao+3h5nyDZvdfrqnWNbuGDyc4cJIGfqWQYi68dVE48sSMe2CUZTofXXK 90w+GHCI+NTgzgHl8gDcLsMH2U22B0rgwVW06L0TXHrh5qmXUjYHrVqtxEVlgYdMAlS8 XkVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=L5Agk2IhTlueKpAaOVZPmPiVBKk+AEjM8QiFyo+WrKQ=; fh=GUNhzEJfka7aU6InG/mqeUgtNKAejFmk0vy+CY7S+VM=; b=WDQzA6AsOObBVwzfO0Cdu/+x5sxE2f+kTKq+JxS73n0lxdx//VpAn9aMEs++8ZA5WD JJpSCQhx2aqsVY+dD7n6Rf5Qn/zmnjcnyhLFakTVa8gWznW2c8HISvFf1qVqgBsn4Qxe Lup5nF8FPImyw4GU7w7Y2y1FOjIqSKl7PRDrh7i5XogCZX6qZ2wRqDk7NU+6phENIJQe u1ZDBWe1oE7Q+ImUOw5yeyJfJRo4y7L/0GRPKZj0mo7Baoxn9lLF4XKFeFL77Z0U8duN KI0waHogOL/ph0JWuSex1LbE3bwKu474h2/iCx4uV5Fu9j3krZW+lQOzyvrjlj+LDgQU ZEyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=cH9DcH1D; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e3-20020aa7d7c3000000b0052229ec3e0dsi10086815eds.79.2023.08.02.11.54.43; Wed, 02 Aug 2023 11:55:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=cH9DcH1D; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234022AbjHBR62 (ORCPT + 99 others); Wed, 2 Aug 2023 13:58:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46666 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234236AbjHBR6N (ORCPT ); Wed, 2 Aug 2023 13:58:13 -0400 Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 184C8A3 for ; Wed, 2 Aug 2023 10:58:12 -0700 (PDT) Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-3fbea147034so1550095e9.0 for ; Wed, 02 Aug 2023 10:58:12 -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=Vi+1liv7gDPRw8NFzP4BaCzlErKjZQMDBHfGSNbpX9FCk2e95+IxRwMRs2i0jX7ZGi NtHutpLrpzlqi1oJ2W5PvPKoeMk4XTsjiy6jalelq7m7OAk0QTRI7Tkh0ZZHgmGzm+5b e0ozE3+cJgAzmU55Qt8g/SrVemFE8Jk86tlXEO74tyKyoH6irr12Th7R7U5Qh34z7I74 fAwtQcb8G85XrSn+c2cNB/1QQMYDNW3wRU+NDDNpkT9f6Vf+tG9Q2OEnkuIdPLHx0bU0 0w8DBPTHz0VPNODKI/eiUj2dzuUcL9nPEFie3RN77tagC+xSscSz777bSORqlOPxl3p/ YAMg== X-Gm-Message-State: ABy/qLZrMzT6sRVNVfDJM0ittOWhRmMxkwJ05pN/ZaSYDr/Bu/zthiOJ fZJ7URUJP/Mh3bQ/P98UO8I= 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 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1773144645107694824 X-GMAIL-MSGID: 1773144645107694824 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: 130128 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f41:0:b0:3e4:2afc:c1 with SMTP id v1csp710484vqx; Wed, 2 Aug 2023 13:33:03 -0700 (PDT) X-Google-Smtp-Source: APBJJlHcvbHbLejXnW7+QuyRdMGi9CFoDSjVSezkRpp/pSnDuPhT8i/6tKee2Yie8YmvkPVly8sO X-Received: by 2002:a17:902:ab96:b0:1bb:a8f7:a4bb with SMTP id f22-20020a170902ab9600b001bba8f7a4bbmr14196316plr.5.1691008383224; Wed, 02 Aug 2023 13:33:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691008383; cv=none; d=google.com; s=arc-20160816; b=hdpL2su7rOJ0PSLjWWu8D0C4sg1EN+CWjzB8qzLZnAxYgZwSRuSzYSPcUpPVzu18AY VateeQ8zgfaKnpgd0sA0jzOtfV9wu1lOogiObr6V3Bn5RKNtWf5TVtfd22k4/S6to/8O XZhjh4xC+Qem4AQbvCvrZgO5WkrN1kLSeVD66XEEPqKv0Vl3O+OTfYKOFCq1G4l5QhdX CxtaVwPvUm0275QDqbiXqPHqFQ7MGRESoFfKyi4Gj8q4b5di1GkTasUA+7lUvsH8vSv9 pkIepG27b7Y1DLg7QP6GLHUqsbQpJRpjukC3jP5y6RvOHWjOlD5ldal64nO+yOVWRvmE PwuA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=gA29wr7vIe71PHnjZ5O12+t0Upf2Tn7RCA7Ahjy5Xv0=; fh=GUNhzEJfka7aU6InG/mqeUgtNKAejFmk0vy+CY7S+VM=; b=ITZsPq7/VIGULkpEcwCrkPx03NDBHDkzMUnwfsEsD5GA0iogjO6l5aw7TG4K6yvuuI sihxcM4iA6J9Y7cC1c/WAJapdwbOh+qSRQBqYqx/FmFt2Es4ZILrWX6ZzfuDTrbwRJPd i2xrI4jiHvLxwHT39T+rvTcgRrmqezeGqXPJuafj/D7z+JzqOfYczRaJYfWAVUJ20PsM JKuOnBby2ZBk7R+NiHbXFdIpdNNdeXZ9BwDIK6LsqqfePgvsJjxE2si3c0uMkxUMSIaD R4viyzAZZUfkLfL7XN5slapWF2ntD0m7EhSOokyLJdvSk6sL2UTI6+8G8CZYZnZTc3Cc QhQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=eUPPgU27; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z17-20020a17090acb1100b00262ffca5a31si1670225pjt.161.2023.08.02.13.32.48; Wed, 02 Aug 2023 13:33:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=eUPPgU27; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234066AbjHBR6c (ORCPT + 99 others); Wed, 2 Aug 2023 13:58:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46680 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234257AbjHBR6P (ORCPT ); Wed, 2 Aug 2023 13:58:15 -0400 Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 15822A3 for ; Wed, 2 Aug 2023 10:58:14 -0700 (PDT) Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-3fe1fc8768aso1458565e9.1 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=HpNHZxrchVAxlgm+2RdLgfhkJV6CsLdj06YVGxkrZz0GdyHkwin1KVemaIy2HWjzWV ks3Mc5//oX2+CSmiK0xrjmXQWIT+Yvos2Z4WHU1QlYLVIcuK0liYebKHYbXdDLowJyrs eIJhBH42zH6sqWzh2Fgyqnhb70a9SZmVo5w/Xv+2vEy1HJxmfa5WC3qbmx3L+jNQrDlc 6uf0FXSv0ykX7rpR18zyod0K2Vaqei65W+JOYpCpwmkH629lO7JUK3/SMKyuYv/Sr2nI gImKlzR7Sl/Y/uK5MqbeUMl4ZfZOPay7E4d3RFuc53wc9lKu3nodYDooggY+jbCOJaDs zUQQ== X-Gm-Message-State: ABy/qLYnMHnDMMYddWv8QMlekGpwZP5O/AQmACUsru7bmy255bgHMlyJ yey2ihu0ChYVgFOCiBM5VyY= 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 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1773150806683387559 X-GMAIL-MSGID: 1773150806683387559 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: 130112 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f41:0:b0:3e4:2afc:c1 with SMTP id v1csp684724vqx; Wed, 2 Aug 2023 12:40:13 -0700 (PDT) X-Google-Smtp-Source: APBJJlHn/+YLAduDo7ofEtJw++BOenvvxcwPsgDQsBnoovR4XUQ38jTEpZy80i1e1mtKQdE15o0P X-Received: by 2002:a17:90a:2ca2:b0:267:f9ab:15bb with SMTP id n31-20020a17090a2ca200b00267f9ab15bbmr13915711pjd.14.1691005212897; Wed, 02 Aug 2023 12:40:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691005212; cv=none; d=google.com; s=arc-20160816; b=oR9Ax7veIH3aEPRAHbbPDw8l52+7ktJjCFaJp3ited2JkqOVET4KKLm0FMRfvgzjZR n5qd9F1R4hVFQe7p38jJfh0PYhCicHjozwiDe1VwUTfHCW1tNoOvN8J0FTuS3BjgrtSd UjsUCKUHeNcKg33YYGr6ShrNpXcwJ2Cx/132erqrwRzfIXPQfsnM0jFSFR5NIYZFb0sN 7x3eGdA0j6vQYNm+YV/J52MxL6BfdNM+XTirASLBznlZsa8ezas034mqAALhPZsC7cip XSoDiohryfwYgrf8/XuPjajTS+ZKNR0VgiVbnOdd7XEndkdox0Y3LL3q0+2s/Pu3QmfM 0r6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=kNnRUj13sGKYiaqiH+uUTgS+yS59+A+KbZaO7xd9beM=; fh=GUNhzEJfka7aU6InG/mqeUgtNKAejFmk0vy+CY7S+VM=; b=K2Cvyr1BqrBZNA5Vm948lDAR6V+tXkigL7uq3WpcvvqNuho5t4RPjhj2nC8Wqpfv3A r216N4aLO9JuAyYGlP5LtM9JoYVNxV39m9f4C5nXlUWWnx0uXRzW314zAfR1HGolOQ7U Lno0B5ih1mygSP0/1navNgBVvG/8vDHCZLDW7/u3N+EtvcKe6W5Y4KugztJF4IN8Hw4P qju/Fv/YTb9immBQHS31Ff2l2HoCQAGTj6CMuq8OKrxKAujMDr/mlcnm0mycv893ws/d KIOri0mUJ/D2J9mf2KYPM6Pz/Wv0MKSCzBRs6mfIseyb7ioDefXqQOtLQgzzj6d3nkeB uUHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=lkUVB3Er; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d1-20020a17090ae28100b0026829a94587si1578904pjz.176.2023.08.02.12.39.58; Wed, 02 Aug 2023 12:40:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=lkUVB3Er; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230112AbjHBR6n (ORCPT + 99 others); Wed, 2 Aug 2023 13:58:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46688 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234278AbjHBR6Q (ORCPT ); Wed, 2 Aug 2023 13:58:16 -0400 Received: from mail-wm1-x332.google.com (mail-wm1-x332.google.com [IPv6:2a00:1450:4864:20::332]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A1A8EA3 for ; Wed, 2 Aug 2023 10:58:15 -0700 (PDT) Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-3fe2d218eedso1552915e9.0 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=ELuC3l4e30E9vddg2GYu0Rp4Fkt9weWJHapRu40rPjb+QJReex8lXmXS7YnnAuAfNw oTv8eWC9BHESJJhfZQoOHPUOplaPJ8gNtY65vjAAGr/pRh2IXArkLnll8i7xQUzH/s+Q 8hcWSpzPPosrhM+9jk9D4EhVOdfkwPEMGeIuufzlEIUQsdUhVa92uh9M8Y7HEKeXj4V/ FDnji92MGVrXozxNaQ0WEt7YFBpLYoSzD+E/m9QAnUmrmV8ylBXs3wMxjUbZjXQlNOPJ jZg+/3eowJ7k6NZmAfRKIS0WNv6q9HDdfAehRwfkdeKF2w5mxID5OuGKrISgNU9kSWbi RSsw== X-Gm-Message-State: ABy/qLa0ivMAY8EyXf+McC1jJqOEz3SEGkTyc0gka+TxbBXwkZzX3SBM tH8ZD0TqUj6QnABZ0GVIE8c= 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 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1773147482003432301 X-GMAIL-MSGID: 1773147482003432301 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: 130077 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f41:0:b0:3e4:2afc:c1 with SMTP id v1csp666098vqx; Wed, 2 Aug 2023 12:04:34 -0700 (PDT) X-Google-Smtp-Source: APBJJlGmApLAPd4VbY/kyfXDTfdjwaNUbsQlljOpe18LeVOYz1ApcAbA/q7+6MYzBdD1ZDRh9r+w X-Received: by 2002:a17:90a:6fa6:b0:262:e6c6:c2ec with SMTP id e35-20020a17090a6fa600b00262e6c6c2ecmr14548593pjk.33.1691003074592; Wed, 02 Aug 2023 12:04:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691003074; cv=none; d=google.com; s=arc-20160816; b=1Bw+E9HZYNue0GWdj5EIN8BHPV9HWQKVxA7D3GErBzszi4JTtCjsNXEuyCIQFfASwt xZYKHJmqefPRtYpbRjwqrqUMYOzFewhAtxfe6/O/aPB8/diikSgqZPu9Q2fb3NXvD6ZD bBJMtAgf4ddoW90RI/o7ShjgMK4TVu+yx3Yn/hXWqzPONZG+zepY+5zvo6MlSJ/xNtBI g+1qmVMaIn2Sn+FyrgQ9ZoZlMpFEGpp7ZzhHJI+znvbbdv950v0ef0QgaVbK5Czn7Cwp 662k1qGQDo/N6M5EWEw84mRo1C4lRW+qY+zEPRo57pQnugl0OYl5NBLhZB/9lUyq9xhL DYiQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=N6nMyjPDcYHJiCu1T+2rryAVPMQB1lBdVoigClnfhE0=; fh=GUNhzEJfka7aU6InG/mqeUgtNKAejFmk0vy+CY7S+VM=; b=zI5g569z+thU17w354+aTfrfCLPQ7tIQnIU88rtM3TSxzkMfCRh7JUJ0c2xbZs05nR 9osCob7Ss6nour7dOAdGWov7qmLdtnckW6KzGi/ydwPjsbQClvhj16IFd82QzyqeRTi8 3qLzbPqwt2vdqH4Yz8wlaVQmRCBjDeGq0ufOpJzSpITcMGv2D86AYP7/KeEn+L7qepaz 2EyEWyZgH8hMbgxp5laaeGbsCqMiQxfaRG/or7B5bjSpm2FYNrs3U87g2O0+yS26zmHv CgbZpPTor9ayTgcRZwOkZye0vpyV+zGUn9K4fj/o8V2mnBCBKh1j7jFnf0h0+z108Cfj a/Uw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b="Pq/1FGIB"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id oc1-20020a17090b1c0100b002533ea2ad58si1682209pjb.140.2023.08.02.12.04.20; Wed, 02 Aug 2023 12:04:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b="Pq/1FGIB"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229949AbjHBR7A (ORCPT + 99 others); Wed, 2 Aug 2023 13:59:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46698 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231741AbjHBR6T (ORCPT ); Wed, 2 Aug 2023 13:58:19 -0400 Received: from mail-wm1-x332.google.com (mail-wm1-x332.google.com [IPv6:2a00:1450:4864:20::332]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CA32EA3 for ; Wed, 2 Aug 2023 10:58:17 -0700 (PDT) Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-3fbc59de009so1193025e9.3 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=PvZXd5BG3zdvuNw+DyOPztR09H5GC+a/K6l9YpgxsTq18bKDISc00c56JQKV1cmXtt uihFucrNIuoeax8JqwCDhwSgUHs8w4FUBJaHbnyE1BnarQEHajZmOjaZOz5DatMNEYss 5Nqhy7jsxjjtF1j5WbmVZJcvZV74Oal5yMESr3skJol4umbnHbGulTckztA0EzP1AwY0 BHn+2Te3qm2Yf42GAuFXao47epcskPIUGxjDHW1U16tJ7qZj0t58vGds376woK7NjrjP hWbgWwCTGKLXsK5KUtZItFoXSG+g86d3EEHL2cjfjb8HHvQuqewe7h0QS8jLQSyg1aVr jVRg== X-Gm-Message-State: ABy/qLZ2Jltg+ZNmr/japd9j+vp19G5j01QXfWeMKda1qRWJY3u5MQje tuy44O2IxST9XPJDpEOYM6Y= 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 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1773145240392895988 X-GMAIL-MSGID: 1773145240392895988 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: 130083 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f41:0:b0:3e4:2afc:c1 with SMTP id v1csp668867vqx; Wed, 2 Aug 2023 12:09:14 -0700 (PDT) X-Google-Smtp-Source: APBJJlF5JDHtj9ZSHf+kyoxJZ0IVN7tsVGpmwa0OBmnfyCKaRbTNZVfcUGA3+wCa6iQKgs1/vZVT X-Received: by 2002:a17:902:eccf:b0:1b6:7f96:42ca with SMTP id a15-20020a170902eccf00b001b67f9642camr16858698plh.66.1691003353833; Wed, 02 Aug 2023 12:09:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691003353; cv=none; d=google.com; s=arc-20160816; b=LEYMgyt3vW6bdE/xfj0KwmAhCDU4Dm9kCxz1bqtT1DlsH8S7QdvYgyuDh9AVHxKPPe NZRKIA5DVdwNt+C6r7aAesJTLW6EDat3HpW+tHOuH2KrniKIyndkZ4Q+BccZzTVXzaU6 5Q1KMT4pqaI97XzMWUZJNOYJX56lnGZnBHbFEK2Xn/vCKZwhZ9M/eE0kxAv/Hf5MCGQq j4VXyWnPcml24DXAM9zJsRmZ5JAGaAdrH+xnkNeXjD7LYsTLWag8AS/SXUXdYOXn2SWj ykj13uRUJBBGqkVn1XFqp0cwheOUqbeSi9jh2l0nrPHa7bXPmOgeuTFwBzt42U/9nhzw xwsw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=dc2UgdWbHJ5viusggKKpR6m1qOzlwVd02m2G5RcJAR0=; fh=GUNhzEJfka7aU6InG/mqeUgtNKAejFmk0vy+CY7S+VM=; b=hfe2gB5Wqx77xU2iuOTx3/Z5EdGTaDB4sAAgAUhhOaxx2n+dw5Z49T9+/2mTGXyeXQ NNID29iiMZFfVP4WHATtqaCBIG8CHtpWPXAjbFNt9GugDQgprmuV09rq8sKNGXbOspCb x04rYUhA/EX/dWiRldPskBHPjaoDTYhUJI2LoZIhAXLqpGzlh66auiCRqYV9YXQhQEs6 yeYJ8NAYkU77agwEmBlnUhtT5qE8DEKs7Q2JrPP33ijH3WNJdWJvP59P/lpwAehaxxar 9111fhqG+vUj4vDrhJqt77SS0dWjXJmQeUL+P7DaoOjkj+VU+VAehqTSN7URJdS6/zJv MZIw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=dJ5Gi04e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n7-20020a170903110700b001b8b2865f38si11606316plh.170.2023.08.02.12.08.59; Wed, 02 Aug 2023 12:09:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=dJ5Gi04e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230512AbjHBR7D (ORCPT + 99 others); Wed, 2 Aug 2023 13:59:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46706 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232543AbjHBR6U (ORCPT ); Wed, 2 Aug 2023 13:58:20 -0400 Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B3BE5A3 for ; Wed, 2 Aug 2023 10:58:19 -0700 (PDT) Received: by mail-wr1-x436.google.com with SMTP id ffacd0b85a97d-31759e6a4a1so62757f8f.3 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=f8+aFPL8mPGh6g5A/jMAgNhjYjnEhOZhIivqEQ6lfR+FN41eeF4HfEnNtXlo1yfS7O DYu+TR/USwhu9mLYCW/CbVIwXr5zN6VUHOl76FushoRFLBKUgPAnCZBWlTV1Q+iCE04m fFFxPiYuwDlirx5AfLlj5efqkZIFlHGjU8lYz5dDFddMpycrTVEHKirAtN8YRS/nEv4w X6Dinr9vczGFBSQya+3eMGZtN19Sx3GPGTe91dFGMkz5BcifZuwV4Aem0+WGN9Ii5MGx 3UFlORt4wtLG9dCOde4JZm2aH7cTLvRnFbIh9cbBnQ14WOKXqERKnqm0zHumuw5FQtYG Gixg== X-Gm-Message-State: ABy/qLb0F2GK47qUz/Ng7S9iLI9oIeulpFvpMXzKtsEPJ7etQ4q4nQVe 9ehMIGE896Q5FId0evg6Xdc= 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 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1773145532884931918 X-GMAIL-MSGID: 1773145532884931918 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: 130066 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f41:0:b0:3e4:2afc:c1 with SMTP id v1csp658951vqx; Wed, 2 Aug 2023 11:51:08 -0700 (PDT) X-Google-Smtp-Source: APBJJlH765xEZNcwz4cYFiSvr2SJ1i3VOkfA5pGdebHseu3xlFGEcmxG51AF16d6JlqRzMz4eyVW X-Received: by 2002:a19:3819:0:b0:4fe:df2:b82d with SMTP id f25-20020a193819000000b004fe0df2b82dmr4885702lfa.37.1691002267685; Wed, 02 Aug 2023 11:51:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691002267; cv=none; d=google.com; s=arc-20160816; b=BA0U1Do+dxbNq+Y8o9qy13WE3utql2jZrZ8dIW2rhC/WXdhKsTbO491PkzTdKzxndV AC/xvTnPwCVepD0yuP+EJr+8E5e/q25laa549kwtYUlX1RL3QvM2Qz2EhejHo61CNmnW SzYiqGEafyScmFsBbk8a1n1dVH44L4khmQT6y+j+lYrqamdX2sIeePFboqu61ZSw8Wrf 4aPyABKKefUO+fAuN+O8tvkmWpLoDPNUat9rVxF9/2m96YZBnBnZZuB6oF5wHOhhcRjn EZqtzO3QI8oIcOEf0vuusEIqg/b7W06DYnBypZfizc6X1ZndUL9o8H0TwVWCIneaIxM8 jmdQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=TDgex51QiOVczO4DJKkVoIxdj5w2CMw4f9nt7sgUgwU=; fh=GUNhzEJfka7aU6InG/mqeUgtNKAejFmk0vy+CY7S+VM=; b=L6hIv1bmLjuX+P7j60b8jECOhphcDZxPQmJ4H/T3nDPJT6zivClAPknykkduOIs5iK uNc5o9PN6RBkBYTy75E5CArxTdYSZPDJmiWMFAf7b31pX9cEFI8wi8rp6r2Ols0jVzhC +1lg+K9wc1SM0Xi/Rtz45jMPwo+hcHeNlSeJqlJPj3s1CoUhazy/8nmJdKrHdE+jaRog oNVQbR7/hb+gSCY4H+xm+WDnwo7iuMN9FiSrkgBuOQnQ9mViFf+qhgJhTlgRg7b/lXoN pV2CaneqHfensaMgBWziP25x1mnbZ0LaKnu9RMcEQOors5kTLj8eMLdQKjjYT/NQlnTY Ebhw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=pQwSTdpi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f15-20020aa7d84f000000b005222818bdecsi10126446eds.602.2023.08.02.11.50.43; Wed, 02 Aug 2023 11:51:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=pQwSTdpi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234291AbjHBR7H (ORCPT + 99 others); Wed, 2 Aug 2023 13:59:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46728 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233351AbjHBR6W (ORCPT ); Wed, 2 Aug 2023 13:58:22 -0400 Received: from mail-wm1-x336.google.com (mail-wm1-x336.google.com [IPv6:2a00:1450:4864:20::336]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9A6EF171B for ; Wed, 2 Aug 2023 10:58:21 -0700 (PDT) Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-3fe1a17f983so1285895e9.3 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=YDqhB/+e1ibblxW71sw5WZjBh5enH/6rOsGVHwEim9hs2PkT/xnHxjLhbU7EByOZ+7 b5e0G6rYNojaOBLulIX/0aSv2RHfEBWquN+gy1kz1+d/B23shH7UO8SYq3BDXX1U7EW6 0AtndQFxvbpmRQh3GHdkSjstnq0dNY4CPvf+fe8b6ampNj25pHS0NkgQe0pHbI86z/fQ jSVvOIJE3BjK6uXAzVeuyIIvIzJT5tjjG2PUT2YDbcwOKS/6VLVC0MBf/g0W26Sw0jaF 4x20zFGQlEXBC/V8+2IBZ1f7oThS+BD98YFM1S7f+R5w/YXweCxVXqjUZ3uWvaWE0Zh0 /niQ== X-Gm-Message-State: ABy/qLapwz/Atvnzp13o0pHk9wAbEpi/VEs0tmRGNlX+Nx/LtRhyr0wd DUZC/EhwksCdaFzHIereuwQ= 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 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1773144393949585160 X-GMAIL-MSGID: 1773144393949585160 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: 130130 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f41:0:b0:3e4:2afc:c1 with SMTP id v1csp712027vqx; Wed, 2 Aug 2023 13:36:27 -0700 (PDT) X-Google-Smtp-Source: APBJJlFxK9cxE2NkXH9r6Z2twh3+noJoNnhjsYdfLV31DmMkfKgtCPh/kTqWwTTPG4A7+ZKdogC6 X-Received: by 2002:aca:1109:0:b0:3a7:3792:5b9f with SMTP id 9-20020aca1109000000b003a737925b9fmr10087585oir.30.1691008586808; Wed, 02 Aug 2023 13:36:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691008586; cv=none; d=google.com; s=arc-20160816; b=hgf5ORhiEKsfJoF0y3/2dQRS8Xizr6XtKVsqehhQc+OagQ5f/0EwaLQNSKyKziuGjU 4Hx8U4I9H38Q1SqkKTdfO3Jcqs4erKRaxUh18UK1oXkc3VmBvWaVnWyrYph+P/CfRUbQ SG/rBAsX3B07qREV5YaYsPngVbwYRt1OvF7iMhb4ZxZX0j5v1hLURblrl9x6mMWYmrxd 0AkXrRQpFwLHAHqQozo+om9fqG3cmBpCzmPkQ6JxZAGRZ9I4a+apO+a3CZ2CraGyz+Yn XfJx3Ea20MmjxLY+vuU6wQpxNV5teVpFS6K1PAdTNYTe8vaJe8ZBTqNvYJt/P8yF7kdo dyGA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=KlBC1H0XtO+vTlN099a54STTMxr//GhxYmUmPY9nGaY=; fh=GUNhzEJfka7aU6InG/mqeUgtNKAejFmk0vy+CY7S+VM=; b=OxYxsfc8S6vcuNw1vz0+4LNXnlaF6HNOQiLbvk9Eh7VOFLxxndU1noBicNrxk5Zi6b qc/n3kzODDINFeP90nCGBtNJ9XIPOa1eCOcO03G/5+SEFU0zjuiIkB0jfIN1LX+L/cKB lLUGgLe4BnOsIPMZ67vp8YnhLFulhQt1oQXYoKNVejsv1ziTLtN13rfEQYiF4Ncogmzu IJP3Ok+PugH961e1OWEO7WX6P2dxU15J1rqLusPu+SccuDRTDQB/8vTB/m/B8QqATlFK TyGnVqPjSHIs5bmj8joiFwH6hHpn0Uwphg/aYo68bC8IOj3zG0Dlk3YtmR2ImMSi+GxM i7CQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=P7SbG6nL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m8-20020a635808000000b005404f8dd0easi10737811pgb.292.2023.08.02.13.36.12; Wed, 02 Aug 2023 13:36:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=P7SbG6nL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234301AbjHBR7L (ORCPT + 99 others); Wed, 2 Aug 2023 13:59:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46788 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233837AbjHBR6Z (ORCPT ); Wed, 2 Aug 2023 13:58:25 -0400 Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F048E19AD for ; Wed, 2 Aug 2023 10:58:23 -0700 (PDT) Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-3fe1e1142caso1617375e9.0 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=UhiZIYqS5vWN0MLEJEhUpTFrKp7+y2MSiFSLRsf2f0hgvCLkxWx+XxVKk9plnKKjcP 0m6Nhh9vV0sVKcCqb/KFRNhK8zbIS0M8EGBIiKMLxHRkmeUmQRz58aYebORwaB5OI5vz ufz0N6F4R5DE3MNbb0uYGH3m3+/UJmdMwV+gvZVNe4Ve0Kp5hNzOY8ahtZ81pHIyQO/E /wm1+uTqDqKwNUwqpEyYMIh581wv7hf8Ik9HDZCsCvkMwFJZoccaOrUT/fCEMrDrvqio TMX4b8Q/cAf2Ym3UntLkKIPR8hMtnl5qu5ImfYIO3Fuv+y/n56/fgTCmijalV5ePUyEC qQwQ== X-Gm-Message-State: ABy/qLYpXS0QpqBnq1V5SDx8soGFiR8G8ZD8OIBV1KtNhmyTX6a0KsoO l9MYqYWpW24/Ued+VX4VVYg= 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 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1773151019942142141 X-GMAIL-MSGID: 1773151019942142141 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: 130053 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f41:0:b0:3e4:2afc:c1 with SMTP id v1csp655390vqx; Wed, 2 Aug 2023 11:43:46 -0700 (PDT) X-Google-Smtp-Source: APBJJlHPrCcn5nCt66m+LEotUL8yzkZEh4A59vQo61M3tEQsoXJpY34XYnZFKngxs4LG+JfDvN26 X-Received: by 2002:a05:6808:4044:b0:3a5:cc7d:3d66 with SMTP id cz4-20020a056808404400b003a5cc7d3d66mr15341828oib.49.1691001826299; Wed, 02 Aug 2023 11:43:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691001826; cv=none; d=google.com; s=arc-20160816; b=d4SZTdG+/V/8s8LBmBVP38icht12vDGpT0wFiL1E0xfdXpI9/mXk+rtXAiUwzySdeD 11CXmYCDlQNDw4oj386guEkuoW+/QGSVN+1+F5DV4qeKUAw3XIedB6ztPBKlFPjsDH6u ixsP/ClFeMs9E4zZs9dOIOuBpgdLserRPAmKkozdJXs30AvK+PG6bBMfwEVy8nSFdPyE xoy4qNLduM9rBv5dE+65lf5A7lzqhkQvQU1qaMU5+NPUkLiXyvXpcDQUXM546mycerhm RoXwFmQJcy55JKgbe6+5n6K94XFNq+7p56kvvxI2Z/p2LcXFwkDU9wuFj3x7psVqMOhb VEug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=e7Eujl9TONcNYsMANe/HBMPhXswxieLTEnBVw6VDaZs=; fh=GUNhzEJfka7aU6InG/mqeUgtNKAejFmk0vy+CY7S+VM=; b=CgyPExfiJYfLYTgGtOdCLkZTAE7vYjL4Fv6t5OXZ+MjQRi0PAPgBJUzO9BwwzAp5Xb H8TwM+iZzfClcsoIaL1I+MeZYs806sQMa96zRX14b0R0wf2D7O6tSzYjdDZ4RVJ5uqUZ ioASdkiPQaFaA1FiT7BLvIEjPHUNqkuEgwtJw6RuWsUKDsSt4KcESTqvdybKXoE2TqXO bA20lwKZEuENDbV/3jKOI4GvBKw6bXhEvqZDf8yfwhh0ZrzopDRDLZkOgNfMH4MoufP4 vqeT3Pu5EI2jwN0zNAAnWW4iOl2nSritr8hUg1KBs6WOktrAGnauu+s1KTaUN97cJ79v bCPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=s3Ze57Wv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q202-20020a632ad3000000b0055785a37147si8005781pgq.590.2023.08.02.11.43.32; Wed, 02 Aug 2023 11:43:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=s3Ze57Wv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234320AbjHBR7Q (ORCPT + 99 others); Wed, 2 Aug 2023 13:59:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46788 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234105AbjHBR6e (ORCPT ); Wed, 2 Aug 2023 13:58:34 -0400 Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3322C1BF9 for ; Wed, 2 Aug 2023 10:58:26 -0700 (PDT) Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-3fe32016bc8so1309025e9.1 for ; Wed, 02 Aug 2023 10:58:26 -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=FpKkTXA4Sc7zVmT1qlg2PTOwj+Je6345jSB4Hzsj07t2RPTPiN4Ahwx5zatkH7xacU Gr29o++ncNz0bKQ0QYJOXoPJ6ukyz0mF6KtHc9WsBuJlb7Y0kkJvbOITMd/EO1+Bg8/u lGG2GnFrZ87D1PiDFeietMjYZ7Vc8c8zbV4RGcBSc+3acIY4vfXxufRASJSEeynb8UbW vRAZeiOmm+eyall0ixS+/1PiuEfKfU5DVIfOokZeeAaOM3E087IHiynkRvTQOpN/0fD/ KyUtTJRk1yeFI6ZyLaoSo9Llmvyxz0Yj8c0D4/xIp0LitwtsodbZqh8ZaI9R23Xz0UUV lxBQ== X-Gm-Message-State: ABy/qLarH7t8NrZhjRdqiPhKpf4YucFT8E67OGqwQezTf8oTBBhHmvXv iSh4E2SawCfbObXQQo3iBwKo/20rPUQ= 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 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1773143930640364496 X-GMAIL-MSGID: 1773143930640364496 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: 130084 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f41:0:b0:3e4:2afc:c1 with SMTP id v1csp669094vqx; Wed, 2 Aug 2023 12:09:42 -0700 (PDT) X-Google-Smtp-Source: APBJJlEHGaR9o+y7p5gMZ+y4K9DIZ9QFj8xO4Cz4bNZwZWMBC1yCkR5qoCfw6d5aqUidoGjCpiD/ X-Received: by 2002:a05:6a00:2e91:b0:668:69fa:f791 with SMTP id fd17-20020a056a002e9100b0066869faf791mr18210898pfb.3.1691003382018; Wed, 02 Aug 2023 12:09:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691003381; cv=none; d=google.com; s=arc-20160816; b=gpmfgHeWw3NvVc1DNIusS1SYJPS2jkMwX9rjRjpM8fZy5xZzBKVNLpKrwGHNFZmAVo w/LPPLz+hRP44M6tiRVbGDvhc/ev+LMwSBUQICR9PMNeoQp1wmuWdvCIhQCano/VYX7D 2rEwUyx6OKSZGetdDf+TD0EEA5CClhngl1JUR4EFtGBxNp7AoJ0DC2/Mdn7vJrkBLk9v VbHYDJPPlptMqWMvXL88amtTZNbbWHWHNA2MD7o8Pi5McRDjGUoH7xIYZVjSV/0FkSFz HraDVKBkrpTRml0ago4ToZxtm/EDHZQMWBclWib4GQP12KxqIVQDaJbeeugWsIjFvkEY KNUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=JOTz/u9h6P9leGyC09eMFHXEMo4zw2Mhp9Q7N9y8+Lo=; fh=GUNhzEJfka7aU6InG/mqeUgtNKAejFmk0vy+CY7S+VM=; b=AXCvNk7xESYosAm64kZBsXqdgWsfgZg8TeqAwzE9PjCkFXqInD9FSoN0gMgsj+G9Qm 7DHwxI6/21LDMtUhTHUbuUgWWrKFnE9P1WGijRCpYzZAClrwnaNVTIrpXb8tcehIrhNs dDTm1It7EV+ZbGO0wIbhBdyRYWMeIs+c/FZNWHP6UCAocbGSxj6KOe8eoLqgxtLor/K0 FyLXce2cbM3yFvO62pK1Vfy+M4hotYeMVhWxxCjOoPTSTDQvi6+pIXOTKBs12r05d5cY sGVt4btIvuLRTZwtL8OZeSSqkBFXzSUk5LdejnwdSGZa9Dyn/kuU7qJtW0IEXv8H5EZo 1wvg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=CaRzBES1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 3-20020a630903000000b00563e82a67a6si3847821pgj.358.2023.08.02.12.09.28; Wed, 02 Aug 2023 12:09:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=CaRzBES1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234328AbjHBR7U (ORCPT + 99 others); Wed, 2 Aug 2023 13:59:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47230 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234205AbjHBR6m (ORCPT ); Wed, 2 Aug 2023 13:58:42 -0400 Received: from mail-wm1-x336.google.com (mail-wm1-x336.google.com [IPv6:2a00:1450:4864:20::336]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EC4512119 for ; Wed, 2 Aug 2023 10:58:27 -0700 (PDT) Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-3fb4146e8fcso1072355e9.0 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=END7vpgClCMAwApUUOrKmXuASrlSvdkdIVyCktCDzhcZahzuYM8yOe9V5qDtkKzfgg tJ5/tHKyhicvhmszNRObNa4t3lFzGTmmYUoCuz6t2WtCkLABCng/SmuQS0Pmx5cjfBOd s6K4AyOZVUiwOugArJSzBODd0gFq6aE+V/wpoRMRsRtyL5HSOcUlcXGAqGRprZSsHEZF L6Z+ZP4kuaYhWJFBGvWjpNwsFuCNS8pZ2e9KyGZb2n7hOdo0s9/au4IqmnEs9aI3Z+8x 9mcB3rWnbtXEuPD6AK4eSf0mAgiV3eOBAxZ7NjOYwH+2xW+hEVhjY+zhUVeuWWL8zXjT T0Dw== X-Gm-Message-State: ABy/qLZh9iZARjyyhlFdnp5pmVo47T5Q6hHBNTZO9BBLeunWuVaBdNjA LTCukZ8kd7Q4J8HVaGeriR4= 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 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1773145562344580692 X-GMAIL-MSGID: 1773145562344580692 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: 130064 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f41:0:b0:3e4:2afc:c1 with SMTP id v1csp658552vqx; Wed, 2 Aug 2023 11:50:20 -0700 (PDT) X-Google-Smtp-Source: APBJJlFY5N/g/HzY7iQmYnWf8/SGj9OgtVbH50KEbu7uQKVj+D9thc/mywwYTfqPM6+Kct2YErlX X-Received: by 2002:a05:6808:1595:b0:3a7:4e0c:faa9 with SMTP id t21-20020a056808159500b003a74e0cfaa9mr6620863oiw.29.1691002220183; Wed, 02 Aug 2023 11:50:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691002220; cv=none; d=google.com; s=arc-20160816; b=FRrqa1Nlju0xMRueNDpiqOAVNMc9zEdgZ3nS4SDfJyH6jhLcRSRnWSFR0JdYsHvk0O 0OPnOYDXpBi5/unDAYSXGS73+CRrCos2OeREV7W+qEHRhiIrjtD+CQTvIh5QfQv4OTrQ 3WaCek2FTa//gyLrU2X/0kFUFLaQ97LDgpqaRQgSC/39J32gO0Z/vOf3srdPTGCv0eG9 Gqxhf/Mn8uYNATcB+Oo4iJdONsjexl8Y0Aw2w453svVaxkmug9w6xOZ8kRzi2cdI+FMz Vam8GvmYQfB2h4FW/rD/eFW4oNlwn1M/T+AcdFtN7XY8IUfTiptkLEE1swX/Xg6UiT7v bqPQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=9tKsk9a4HVB+S55ZghOAU5wwthWw0fqP95yqfmB/mNM=; fh=GUNhzEJfka7aU6InG/mqeUgtNKAejFmk0vy+CY7S+VM=; b=Ckaar8Ku+ucrROG2MsDMlwKN5TpWmf4Ho32e+/MFezr4xnQ2TtiB9jtu42fn51gDKb WgX+MaQoDtznsbTuzTCCjx0i4o88xrhUSehPbupiLdWK2mD0bevXpl+nPrM0O1H8T5F0 pgJcW42ZdYq9JEhrNj+a298T/YCdFinUxBQcM2SaYGZdwFHhOh5XAIYdy/78vCrC7DzL EbwnrnWvc8qX+P2ZgaBNSUuhTQkjj0nNNF6e8UeD/WQG/acmUq1O7aM0kFGiAvoVMtl5 f4UTc931fNgeiAhgGURKCqyNe5bpp27Qbt92AHbfh9945ElFNupykzGpGn0lxdjfhbIz O0sg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=ckvh3W+O; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o14-20020a635a0e000000b00563b3628dfcsi10868010pgb.668.2023.08.02.11.50.05; Wed, 02 Aug 2023 11:50:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=ckvh3W+O; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234242AbjHBR72 (ORCPT + 99 others); Wed, 2 Aug 2023 13:59:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47320 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234234AbjHBR6q (ORCPT ); Wed, 2 Aug 2023 13:58:46 -0400 Received: from mail-wm1-x336.google.com (mail-wm1-x336.google.com [IPv6:2a00:1450:4864:20::336]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 42CB326A6 for ; Wed, 2 Aug 2023 10:58:30 -0700 (PDT) Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-3fe24dd8898so1327695e9.2 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=igmRZXdTq7Bn20TN9Y9QGFsXJR/d1jySHN6195PSj42mKUD/1VpqDhjIvI+gvTkHdg 1u8BfHA+CzuH7YIKF+ghBuch5lpIOCodSNN75L5AaZD7tVtmS2f5JvbMxKWFcaOCDn0C T2+AUBK9aDDt6Dg/E1QRSUsvQ4MZzKkcyBPOCmtg49gr2NHiXy9QAR8kpMYAWPq3z4cE bxnaU6HOx/ocY5q3nnKDBHiuUjzpy8fWTaN+Cd7xCwLPzErb6i71ozfAMUAyGgnKVXcI bTCD4MX4m+QVGWk249iKMm+TZVZMZ3/iM6T1gWotU3i7WRzNCIytILpRzu5yvPl4GPaM lNrw== X-Gm-Message-State: ABy/qLazXhRvdyHOVaZ2aPt55GcVCgjQp5Fm2kZ5TBOyp9ODAlokwN1T +urN/3GBnV/aX02FQ/A9SKw= 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 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1773144343955490096 X-GMAIL-MSGID: 1773144343955490096 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: 130052 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f41:0:b0:3e4:2afc:c1 with SMTP id v1csp650539vqx; Wed, 2 Aug 2023 11:33:42 -0700 (PDT) X-Google-Smtp-Source: APBJJlGPEqCR97GWRzNApjiuBLmrcYUqR8dme8gVfC9mHm3qiTlndV7bQ0eyOLdgPgYQ8UydKXIt X-Received: by 2002:a05:6a20:4285:b0:13e:fe55:b99f with SMTP id o5-20020a056a20428500b0013efe55b99fmr2537481pzj.56.1691001222413; Wed, 02 Aug 2023 11:33:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691001222; cv=none; d=google.com; s=arc-20160816; b=CPhm0i2q6XLpRcHfWMYANeUbilQmRVqkt8l+gm3E8o9VOAVZp/ctXi7suIxYpPHEBe UBR+4S/i3zWLfUwdPswO/nCvLiTwhHTEu6wPZpVWkCzEjXzfQ7QZ7o6+0sNSXqCRFWqB Cs7mherHHDw+gSMFKTVlyUSefG3Yv4XCgxxkU+QntotPX9wu5z79Br501182giF9mGSs kA8pQkzwpQR4Yo7jH86aomEMXPU9Xh7mqehpBG2PlN5PTuIqiUacDiW47FVanaqE/jxg w8NRIOgci5LlCm7yx/UGX276dM2FrmEmFfTshwnBtIJy4VRAaXPqK1gs/dJ2R2zOOALA vscw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=XyXZmbrejVy6oU7P85KygnAFUmokjdS7T3od5TZzPV0=; fh=GUNhzEJfka7aU6InG/mqeUgtNKAejFmk0vy+CY7S+VM=; b=YRVfqX/yHwSSujBtfPkJC2ilxJOdufHu2uGq+FqMTzZ8SiUqZVmnB47Fp7t0083Ypu EFZJW0sFHC3Wsak8NdiavSWoI7GEEJQeJA4Z+yNMDTSwv8ua9XZzMazpOgj/4zSubbVQ yE418sCGMzIAdI8ePSkRPU/MjbUDtyjyohgSu+jhvA8EKi93XYmht8iKKprB1JQEAzAf AMjEmgE7mZtr1QfqxA2wgIef3NSctk6DxnT7hr6lv9iwiqcuClTSr+98rpCySCFU9twm CUz0m3QCgCACnphFkTFK20UhTzo/7YJii58It+qyArIs5UNmwEiTXCXK1OsTuym9S+tQ JnCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=o61PY30O; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bk13-20020a056a02028d00b0055baed7e7e6si66774pgb.251.2023.08.02.11.33.28; Wed, 02 Aug 2023 11:33:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=o61PY30O; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234388AbjHBR7g (ORCPT + 99 others); Wed, 2 Aug 2023 13:59:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47576 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234266AbjHBR65 (ORCPT ); Wed, 2 Aug 2023 13:58:57 -0400 Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 016C51734 for ; Wed, 2 Aug 2023 10:58:31 -0700 (PDT) Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-3fbf1b82d9cso1210925e9.2 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=KCNqpkArp509rrV5TknS3GF/J9tCMgpmoerL9UoViiLJ/aUB/x5y6fa+EK89weaqnf mscITwZVe21Kv+q5z82Txy7a48hQ/4hSPRhMBYuHdszG+mmW8umfggPMHLHhCNhZBFzb nhnBdwkAYa2pkbyRvJUhdfFBur01dVxhIxfWkWa9yKTK3lgVNrcuWKLOZNyoEYFzu7gk HaYJKowZCH0MDcCnIba1vA4QOGGlRX9g8PWg2Jxo0XKPIY885jpVG0LUulS/27JOh7a4 vNPmhcD1ZPZkGJLfzfgGPO323VZW7XtuAe4ctQKNdRTm7tAY2o4ox2Fg1NCsGqVxH7vg Cqig== X-Gm-Message-State: ABy/qLadoa5sxpJesGWGwixnLPQI/Sv1EPefJ4mnlqak8TpBLKaV87PR VohUuE2t2irOPi/V4rbDLpM= 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 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1773143297567387674 X-GMAIL-MSGID: 1773143297567387674 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: 130085 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f41:0:b0:3e4:2afc:c1 with SMTP id v1csp669152vqx; Wed, 2 Aug 2023 12:09:49 -0700 (PDT) X-Google-Smtp-Source: APBJJlElvqfKjQh0jF0DDCbkXpe/C7DUv9KkiAuXatnXJREB9nh2MJ+VAL+ZOoNBw6dgAcG8K2V7 X-Received: by 2002:a17:903:120a:b0:1b9:d307:c1df with SMTP id l10-20020a170903120a00b001b9d307c1dfmr18768499plh.17.1691003389397; Wed, 02 Aug 2023 12:09:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691003389; cv=none; d=google.com; s=arc-20160816; b=T5g87tVM0fDB+vR4uefGNXHu7kL2syQKfXz59ajSfOjmRqye3M1h20TRQuaQdFe5Xy KnkU+GqMzs/LIhuJt82Lk9jAI66a+pdUYYpiuz3E9bBDuvOeG5bXyoRqhuT2SZxN72pm 6X/uWnDeYAgh8eqQQoBlXGUXyX1Wz8vm8ZEHVpDKoLAOHNCfi/F/qr2Jr8Vlvfi85QNa EwSuDhsL7VatFTSut9D7MMGli6AdQ6v+Src3e+2ZMbsenJaQIKf63Qy96jRfi5ljI3w0 W/+/PbcSW8491xf5yZG9m/4099VENjtWElOL/Qh7W6S6Cjs1/clKouAQAlJ4a89Rcxv3 ZfGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=oxOrpyuPOmymgtlpLpXF+pVhKHjkFdHFw3wiijDx7h4=; fh=GUNhzEJfka7aU6InG/mqeUgtNKAejFmk0vy+CY7S+VM=; b=a2bGR6nE5KHFrZ/bgTuzLEBMaqg+bU8MiLczTE+1djtTHv4yXD+41KggRGaTxcpXiI BIEms6gLqBBwfuXCNBuFxc8TaR/FbJrnohFfxyIeSFpoyGUg0Kd28Crj3OGMc3s/q5bP DKH8FzecEDaJnRI6zN7cAdAbbHW6YBu+uMuI04tVKHsw+mh+XBbjugCMXi9TZS5wWlGx DxuRImaOtSlYwvQK0Yk1c8oiOnx4akSMCAKu/ipcrprHIhntH2JbatPLZrPSTCkHEZOx uV3t/DZG3q9NFcXmtZPo+kaxj+eWs8zyUEqfkt5K6INjIJEskPTTruFqNnKdSqDjVPT3 GVzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=oNo4Wjet; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id kw11-20020a170902f90b00b001b54bdd6412si11220535plb.396.2023.08.02.12.09.36; Wed, 02 Aug 2023 12:09:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=oNo4Wjet; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234211AbjHBR7j (ORCPT + 99 others); Wed, 2 Aug 2023 13:59:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47838 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234196AbjHBR7L (ORCPT ); Wed, 2 Aug 2023 13:59:11 -0400 Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 495282D67 for ; Wed, 2 Aug 2023 10:58:33 -0700 (PDT) Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-3fe2048c910so1373065e9.1 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=Ka7FLCrulW/QoYMs626XvahNCTovRa2YtZTNnnbz8P+gZr5TBxeYWoz+WYe4mBMb/O 1pBSb4Az35Qg9zz+GltaZ8hcEnZ8sh/CrEv8mWmL5o1w3w4YgbGhOYadWV8u+t7utnPf nBRS5GUJTrEXqjfwzmkGx/W/0asSajTItOFLza1QJEN8IUz9SBE8f/7oM5Ycp4wJ5lBe qSTPYe9fEwA/l0WTa09NgFpKP65oZXndT4AXblRr/0B9Spk4hwkd2QTKE6P+IlBIRxlC 4L+RsmuECtmckna9ov8EVuMc1x9UM9OKoAKi3aQ3kfWgoDAqAzZjWP9g9Wq/rPhSSI3l tZHA== X-Gm-Message-State: ABy/qLYz6TNkNALq9fD30hwlLUXaDpNFwmnbNSAlGay0RiFm+uwdc2IK YOo1dR3KzzKgRJkBEl54zCM= 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 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1773145569968163370 X-GMAIL-MSGID: 1773145569968163370 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: 130108 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f41:0:b0:3e4:2afc:c1 with SMTP id v1csp684077vqx; Wed, 2 Aug 2023 12:38:42 -0700 (PDT) X-Google-Smtp-Source: APBJJlH8A948tfJ2VunTP7GsrG5xrTxBFXepEHXbqahly1l61h+iA+VDTMuUBJtmE8vWx36dk+3U X-Received: by 2002:a05:6a21:3395:b0:133:f0a8:fb60 with SMTP id yy21-20020a056a21339500b00133f0a8fb60mr17779514pzb.15.1691005122090; Wed, 02 Aug 2023 12:38:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691005122; cv=none; d=google.com; s=arc-20160816; b=L+4UtsMg0UOPysPsw19Nvjw2XmpgBpArZ7gm/wvaRhR9nGBAohilDCORS0KJ8O49X1 MInMY1B0Rb3Z5Pp12EyRS+7rKwb56WU2eQc1cBFBvOPq+UY7+cmg40CRGfklTg8jp2Rq 3CAcoUsF/tecOTB4o6MSWpNYwJ5n7qzdNfOLPsKhSTU7pLzBjW80Kq70hx4vWB1Ht+Hi iP8OIw5T83fLAfFzRuq1lD2131JALbrPA6TJc6lLGGaMT/QIf9rEFShNvWhHy1bwfU3k EoWyBIFXSeFjIvbjcprUS5r1Bse4BOe9iRRijM/nKkUmbQ6d4ctziyZqM3OjEUju16ql PxaQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=a+3O1DghoKTsvX8XNtwYPlplZlPGOuzWPkOeAp7AhV4=; fh=GUNhzEJfka7aU6InG/mqeUgtNKAejFmk0vy+CY7S+VM=; b=b2EiLtDBLsumOY4tHcZdgUlZ5AuLrGg3XliISKLKn+5Od6KB8wc1LvQnjgcdWPVLGc TlnimZewjR/HUysb3S5OieoXX2wBLrkCKzip4Xia7EpiR+hnKkFjDPtiBbWha2J1tA4o RSy/9X0YRBoL5EBDaJpl1mEw/zw9LvR9fGz3JiMjantK0R0ifgCk0J6cQIxwTpjVUwLo Z9OOFubitYHSnWu83BYVTy/tu24pud2AMvoK6CGAGOleQENKohDcV85eM4V4vdoPf7oT bgMaOvDszOaXs7fXOktHQmPe7OfMliuPzmuTXCrOMsm3wFqfe4vrfOgH6aumlop96B1B 00Vw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=PgoxqIWg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id be3-20020a656e43000000b0055c826f2bd4si11238323pgb.77.2023.08.02.12.38.28; Wed, 02 Aug 2023 12:38:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=PgoxqIWg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234335AbjHBR7v (ORCPT + 99 others); Wed, 2 Aug 2023 13:59:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48134 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234205AbjHBR70 (ORCPT ); Wed, 2 Aug 2023 13:59:26 -0400 Received: from mail-wm1-x32f.google.com (mail-wm1-x32f.google.com [IPv6:2a00:1450:4864:20::32f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BC8402D7B for ; Wed, 2 Aug 2023 10:58:35 -0700 (PDT) Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-3fe32016bc8so1310475e9.1 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=TeGn/xX2cOeCQwOl5XOyrAXQDIWbi6SnYRaEKMOECGz+UPRaGFqEvivvu+9yfWB0/U UjCcVU4qIJDnKybY0TWfkHTQVI/lx+b4wmSv6k5Wf1N5rgXKgBSaC7507oCptNPlj9z3 W/Xu6sTEh7IK1BvkFvog/k7tU1iAjKfCRTOVURpvaejEOGxC2WnglR9jB8pphbm7hok/ S2rEmvPJw/NkHNFPT1RhF7QU/pk5yutBXq6Ce8vCnVrvu9YPp93FeRA3wd98PAcmMFVN l3qVNj+LFw7qdvVnVKwF/usjadhzoIS/sIAcltYwPIRxhb8cYiYTZO/M+rjJAOFdufoo CBTw== X-Gm-Message-State: ABy/qLbwGfayC7Oyob2NQuPDY/Sp8dzhNTN7Wk2QQlbsf6cs9D11hpLT pHMaRWrPTp9gbNW5LoA5TgU= 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 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1773147386995515888 X-GMAIL-MSGID: 1773147386995515888 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: 130061 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f41:0:b0:3e4:2afc:c1 with SMTP id v1csp658367vqx; Wed, 2 Aug 2023 11:49:56 -0700 (PDT) X-Google-Smtp-Source: APBJJlGh5TBClXDWHwjrPqeT6YQCd6CbSQ9AaYZq7ewAr8a9CGz/OgkL2pHo+ZdfI90h0qZzmf2Q X-Received: by 2002:a17:907:77cd:b0:99b:ef1e:3836 with SMTP id kz13-20020a17090777cd00b0099bef1e3836mr6524887ejc.9.1691002196565; Wed, 02 Aug 2023 11:49:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691002196; cv=none; d=google.com; s=arc-20160816; b=BnZVAvemn4mLlTt5Rkn6wJSuSAZfRuFKY++uKT1ULQCkLBXNCfz5OSyOek6dHwJYlX 1U3lOpiLRVHUeQ/zdXfbkX51iFGcg3UmBUYa2+g+dIl0+XUyWbDsB/ssZeDH/SdPAQLt rqmpWd3aHIG9Nhy/o1SWCCqJ8lKuYO06IL2htpGmWsKa/aQ5OyjFoMzvf0tMRZHZM0Rj Uv3IwpCJALlaejILZmW+mskJOIhw90eP+w5+xIpeGAGDqo0OVUHnFxjjoQRykHlNvHIi aPDLW/djJxLFiE9Zq2TLZ5iYAXwy7xuykIJzswkqgNYL7buG3LcMsfzLxWXKpCukQkp4 Srmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=2zh/WX6wdJak4IhHc3jkL9iRoK+aXWh9O/IfQG1cm3A=; fh=GUNhzEJfka7aU6InG/mqeUgtNKAejFmk0vy+CY7S+VM=; b=fQB36xzpL5IG88FxtdXDXd1hnIWss0Q5KJasv93DapgkY3vFRS14iq5lA2cGoGGVNa EIcDUfroETZbgUJWC3W8VwXe0kLRVSrsVgwcHzDeyaA0/pzAslv+WMq4uk4UlaHonW8X HIGoQjWyam+Rsu3KATFSY+82/ILozE0TIYTt6zh2qQ0rjWErpE4dycEsnOQwtXaJiL8I qHRkhZ+aatMqHTTSOsoMiRKNZlDB5sMI1wq+cIPrb9skRTeIFRinFOYGmwtmjBoMXuUp 4ysCOa1yNAyQOcQ0RgHx6pI83xf8Kh8GUevnb25AhTPF2E8zwd3THGU9Znz3qxffQFNT 9HPg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=FTZxpdE5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cd21-20020a170906b35500b009945340230esi10860219ejb.174.2023.08.02.11.49.32; Wed, 02 Aug 2023 11:49:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=FTZxpdE5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233986AbjHBSAJ (ORCPT + 99 others); Wed, 2 Aug 2023 14:00:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47022 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234195AbjHBR7h (ORCPT ); Wed, 2 Aug 2023 13:59:37 -0400 Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [IPv6:2a00:1450:4864:20::334]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3E00A30E3 for ; Wed, 2 Aug 2023 10:58:38 -0700 (PDT) Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-3fbc59de0e2so1248345e9.3 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=VqG/Bq1HIolk4Emvm1IIJxllEIFlnkK6mwWEqEniEyaO8+Lor3nxg9cREEYHuzztD1 /xDo6zS5GwJCaHtbx2h4UyBKS7u5MxWzM9lkrRys1joTGEKUdbatfTKE7ILTSRmKItUB KVGauggwurP7gwD5iSHGGbUff9S85J5ltZUzVCspbbFgMkopDO2xrjm9fyiyxtaNryE/ KTnNpuX/uH8Dq0MAif/iioyqjdn6Fpk13hWjwBU00jLHCmxQJS8/TcBIqN2JqL1mtqAD pldkf8vELgfnhwbVQ//5QPi/JyDWVKUw6/7LYEY17bhXahz1lBdbKTd4b+iVsDVg4Pcs 3rCA== X-Gm-Message-State: ABy/qLbASzBWcZx+akVIcM40HodXz1g3ZAfFhJiBLP8uchVT3Ej+1N1F 2WDgwvDQl1lXUFOSc7H9/jg= 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 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1773144319667957549 X-GMAIL-MSGID: 1773144319667957549 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: 130102 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f41:0:b0:3e4:2afc:c1 with SMTP id v1csp682307vqx; Wed, 2 Aug 2023 12:35:20 -0700 (PDT) X-Google-Smtp-Source: APBJJlGjGXxWrJfDdT0EhR/UHyQD29i4QUdgaksHjgAn6K0ef96aQRGw/TjLT8R2wIDtRFrr/psT X-Received: by 2002:a2e:80c3:0:b0:2b7:2db:8ea4 with SMTP id r3-20020a2e80c3000000b002b702db8ea4mr6230809ljg.30.1691004920398; Wed, 02 Aug 2023 12:35:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691004920; cv=none; d=google.com; s=arc-20160816; b=WPqgi8ksTEYJ8QJzt/eCjGLkgCPVs/ynrh8tvWOS62bRz+kGOQuKQYSRTFFlFtLumA 7pLERrCu7kOFD8uW4fe1z4/LgSpSQfSXZNdTRaDXYbvmEzjl7fOv0gSLABZWKNVrJAdo UEPp2xMx1E26f8I4kM6/wkOjRD1QNmBzyQKdm52xkqzRraJ4MKMFtsDXrxQFepVuOMB3 iUcGDR2sN3B5LpUOxfnXx71Yk/apHKuEzuoxtPPua9grMLmVtbR8Nec5bqZww7JgaOcP +bc7JZyHBJJTy/lv686RJ5Lw+T4pGvVAxrWe9POrgn6atfrsK86LueZXCQ2qNUXKzPRZ ZzNw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ivMSWY5W5vVdPZxQIPJMmrp6wGH4fY48CYl1yy0Ej0E=; fh=GUNhzEJfka7aU6InG/mqeUgtNKAejFmk0vy+CY7S+VM=; b=myQUBKA6wKis9krtHBmBfm5BqOsYgI70gSdTdxfOrEZCA33BLi+RlCLOavYPIg3WLp 8JKu7V5hELpznXesmywEkpt2Oq29Qt4ZpOQMQ9xY3QojJV8StoMmW8m+vFka6VeV4w4C 8SPRCdVRgrEISEeLeZAEXJEiZD4LCxtqtl/gJ2AI1klorj6kO/Kcb161/YYh8dSSQYGi hxvt1WMyvyOFrLSAhzQAc0qXBs3oqydVt7h4wYZC3Y6TRs1VbjmU5VVREj/xKitAK3WF 5tTgdp9H2VIskHgVeHDh+lDBXn6+yvKlpoDqUzDmclFxe2kzMUrjKyZO3FNvpWn3OzEY GLpQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=MqN6xWER; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f5-20020a1709064dc500b009889cad765dsi12318206ejw.352.2023.08.02.12.34.56; Wed, 02 Aug 2023 12:35:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=MqN6xWER; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234278AbjHBSAB (ORCPT + 99 others); Wed, 2 Aug 2023 14:00:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46752 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234046AbjHBR7f (ORCPT ); Wed, 2 Aug 2023 13:59:35 -0400 Received: from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com [IPv6:2a00:1450:4864:20::32e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3990F35B5 for ; Wed, 2 Aug 2023 10:58:39 -0700 (PDT) Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-3fc0aecf15bso1390055e9.1 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=R1/KtXHANJqU9zHoF9HdwPKYCOKMfrNQ6xVaFPDrcyzlB9pwPdSVNB6isBmxGUQAdI uiuWAz+osQmLilTuonAjEjCRVokn2Ur7wP4MNQpmee+TSXo82AX/gSEKIJP8Hxvu8BvU xOZOOM0uRp+GZvZ0qStwtGG2GPVlnREFBhPFyR9sfZDZd0tW2MSl2q/3lqi9KdEehXUn X2CwmSGzkTeS5t2ixvyMmu/FkfFgT/nKi4nY+9Q2MDHsn4ZrHSsRz7uaFKGvj5BwjYkd S6GgjuKk9XVu6BObFk15Ui2befEnCr/aDzqC3Yhux9zJXcm4bZRP5p+0f3jJNSZy79Dz ct6w== X-Gm-Message-State: ABy/qLZMYKptqGT3ILTMdoyT45cshfy8zhHr1OltAHfInZodqOub6fHZ 20DAeLEq26IHQFQUsSeEeeE= 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 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1773147175576749280 X-GMAIL-MSGID: 1773147175576749280 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: 130097 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f41:0:b0:3e4:2afc:c1 with SMTP id v1csp681572vqx; Wed, 2 Aug 2023 12:33:45 -0700 (PDT) X-Google-Smtp-Source: APBJJlH85kCiNal2X5v3oyw3dvL4V4gVDxmP6ECrgw+iK0+UnIpWauV9ft1O5N/jxjNoAtNgXKAp X-Received: by 2002:a2e:904e:0:b0:2b9:e53f:e201 with SMTP id n14-20020a2e904e000000b002b9e53fe201mr5771515ljg.31.1691004825122; Wed, 02 Aug 2023 12:33:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691004825; cv=none; d=google.com; s=arc-20160816; b=gpb6aHUNWPpeseWAgnX2u7MoraBTsY5/clDOX58910N7V+GGCPPvuUb08+CuPMcRVJ C/rxZyiX2iL+YtmftWAjF8460wT4sfD2H7bNkb4UHTOZ57ggfeuXo+8q5oM7brUqn0S3 3n1Ednlsjt+A8+Cmf0SSeio9R6tSa5jbP50ZuVTGmhN/8D3OrhLk+mnNhxHJqolXtPps EhMPYWGeg1okpKnuIVRcYMKhuNaspR7dSrWosYcgszgHWI/SGu0SODaFLroDEqXd+Sk4 t6L0Rbxm1qfT1Y6zYW/fsObRj5gAMf7MeUcyZToWL1OydhElcYSgYaZcpxYIjQiWa9A6 kJ0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=r84U5vKKrOG5iP+/wELvgXipD3A/eO08Kh4+Yu4iiLQ=; fh=GUNhzEJfka7aU6InG/mqeUgtNKAejFmk0vy+CY7S+VM=; b=uz0bOzuRnOlF57mAm05w/5DHGX+8xLes9bYf9/QGruKwtlV17knf0uEdJo76sStBwq /Q43RiZ21RmcoqgDjlQLzJ9y0V5OSD/qmRFjSpQGuBDG2BUcIb1NzfMNBs3+li9qmN4U CBHFwEtrxswaSwx/d+8a7exTeFW57mdI94stMAjSkA8AzkfwmWvyUM51hBtloI2TQJ2t 5CmtHzvsKdTcuBqachISuZgDdFohpmYI65Hi9HvZK7/U1DKY855+cbU5SvH1c3b/tJTD 4Rf9XOO7x+/y2DxkmyO6C0RL5iItlBeQpIcmAb6Fk4vYaUhNg6C+AcwnL4Law1IzOHIe Dt3A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=nHvmRKQk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f5-20020a1709064dc500b009889cad765dsi12318206ejw.352.2023.08.02.12.33.20; Wed, 02 Aug 2023 12:33:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=nHvmRKQk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230095AbjHBSAU (ORCPT + 99 others); Wed, 2 Aug 2023 14:00:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47992 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231463AbjHBR7s (ORCPT ); Wed, 2 Aug 2023 13:59:48 -0400 Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [IPv6:2a00:1450:4864:20::334]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 85D33170D for ; Wed, 2 Aug 2023 10:58:45 -0700 (PDT) Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-3fe1e1142caso1620375e9.0 for ; Wed, 02 Aug 2023 10:58:45 -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=GBdofa7aWUHtDYtUpX6wrelWBs2Tie6S70DryBysFfuTmu680e/cRMTpuzq3lLIHBN cA37GhhX+efc/X/z+QLRUKLmxog0/xXZt/HERbt7NF9BZPKhZdwObFy24xq57p5R0CJq MqthqPBsUPPjrMP5DZ4hatH+8SRoZ+xvMHtmi5TV4HleGTpJU3trPCqCkuCqvGsJO5WE LenIL2Oi4v+pst0vLaXMQRU8GuvuoUTIs9T/VqlBLlxI8dh7/qLozaVeMAm3AUUwu31Q aaFDr/OzwOL2KDk/DGW8j9ltodTq16Nkvnqvgkmd3pAKgX8AyxyrtquamtO1nKTwPI9m Hqug== X-Gm-Message-State: ABy/qLaCOI7HFq0RUVIg+D68zyluogLoNlxxOEziZfL0Sd8xoLvvbeOk yynNfM119u06Mz2c5zzS0wk= 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 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1773147075515663955 X-GMAIL-MSGID: 1773147075515663955 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: 130118 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f41:0:b0:3e4:2afc:c1 with SMTP id v1csp686145vqx; Wed, 2 Aug 2023 12:43:33 -0700 (PDT) X-Google-Smtp-Source: APBJJlEOGy2pKCjYPDOmRz5cEoRSr4yuYcXqtDkMba+QE7R1G6aF9mxURCUcjYXET7T/yZMksfAN X-Received: by 2002:a05:6a00:2e8d:b0:654:4a24:d787 with SMTP id fd13-20020a056a002e8d00b006544a24d787mr21159475pfb.12.1691005413219; Wed, 02 Aug 2023 12:43:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691005413; cv=none; d=google.com; s=arc-20160816; b=ieAnmkSTxVPlFvNaGqUQMvn7APXmvPGP+QcOUImkSak8GhADQUAItGGKWCv+tt/nip tqggr/J3AJOU8yNYwFSXfxL5w0Umt3ZKc0x78hgglqVRh+TjEJ57avuS3aZ9qexEKjxQ WkVMaGcmv4xKbBdiX4i/Vjl2m0P/iOxCWh0700oRKmzMkspf3eLLRebmsiIh6gVO0lq8 K5RiEjitLXY/4Ngu+N2k17sJb0deL/X1dCs2Xxnp/wMggqP6a/DKDQ1bPK1Xj5uIlgBs K3YPVK+ISxSv09UXAZRDc1wQEO3wdQJjhS1H7HUHi5yGSNDjOFNWvzEFiPtRYnNOftOf /d6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=7E+xhja+1jrCpHxegbBsk22hE7b38rXeL+uTtQJDC68=; fh=GUNhzEJfka7aU6InG/mqeUgtNKAejFmk0vy+CY7S+VM=; b=ZcwKDwCz1J3/DlLIUI6Stx9dp/Axmh9zvYItwZK8b9iVMdLqHQVqIn1ZIzjOWBCL0i JwMstUbJlLZu9lWDXklsKvxlb+0hfHfc24mx3F8bVJW41sL0HfOLbNgvqZIyG26PhamW d7E/QYIkNdRqXNLQjKhT5WuAS2cKHGGBS8OdLeeqwd1n1+3bZL2DZQA94EYySYpCg8sd GfAe1glucCLGbs0fdggxqHFSpALZW5fL3JKOeeOiES3eqDnAMw4dt7kZEzxfG82TetLR 1J1E9+0qe5uCz4eRb2JqwADhzyWVjhbmQs/TWtRmsNEJ9DtXKyuuQlYoIqFcfsOLp7aT gfdw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b="ST/5jqkz"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l28-20020a63701c000000b0054f993d7f29si4064047pgc.563.2023.08.02.12.43.19; Wed, 02 Aug 2023 12:43:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b="ST/5jqkz"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234433AbjHBSA0 (ORCPT + 99 others); Wed, 2 Aug 2023 14:00:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48184 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232540AbjHBR7w (ORCPT ); Wed, 2 Aug 2023 13:59:52 -0400 Received: from mail-wm1-x332.google.com (mail-wm1-x332.google.com [IPv6:2a00:1450:4864:20::332]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 73A023C0B for ; Wed, 2 Aug 2023 10:58:51 -0700 (PDT) Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-3fbc244d384so1529055e9.0 for ; Wed, 02 Aug 2023 10:58:51 -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=TMo9uuUGxtBIySqk74PjEtaC1lahSwRc9bhZqPhIZ3FjEmODajGc+5eeZwKm/DWNob zozaZjpoYJMvOqLkysrP29OivlCQmjAI9FF0TOJyFWVF1XahrXWxMmR1cfSHwpC7i6RH wxfoJsreJ5qCQ5lj18S6Ve1lzpY+Lr8nD5Dl06HwoFQNdm3HcpHjxsT4SJPVIk+acxZk 4sz4Fv3N4Eqn9qJOAdWNhFmNz6V7EH6MxDsRjmQIE+Apl4eUN9GQb87Yk0Apk3hgIkUW ppkYAeei4eh4vNZUVK09rr6nrT8Q4dWNpqrrT3rrwfEdMA/x88WMJ8o01Jctqw3NbCFW eDZg== X-Gm-Message-State: ABy/qLbLBQcjqBqJ1qfUmuPIK/SxmPYoPTqIeCkHLh8gSulEmJd6wJKH 5aELki6KbVpNhh2huoBR1mw= 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 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1773147691927810435 X-GMAIL-MSGID: 1773147691927810435 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: 130110 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f41:0:b0:3e4:2afc:c1 with SMTP id v1csp684524vqx; Wed, 2 Aug 2023 12:39:46 -0700 (PDT) X-Google-Smtp-Source: APBJJlHZ7WTDBe+fAk1AbGgXHBUC0dqtLzrS+Y2h6mRR0ryauaWUaevjloPmn3O7POmQMq2cXt3r X-Received: by 2002:a17:902:e88c:b0:1bb:9357:8b76 with SMTP id w12-20020a170902e88c00b001bb93578b76mr18712407plg.50.1691005186505; Wed, 02 Aug 2023 12:39:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691005186; cv=none; d=google.com; s=arc-20160816; b=RrfQWMzngrZ+jZ/wdhxnYx9fsqEcCA5Fc7naUb7b1n22ybNYyIv79kTK4/Yu4NxVZm /yJJDE+mwgocLIH3l4HUm5jbbIWuKa/9+niLxPMYE8Ukivg42sdcRpUCltAesW8OoXLo ldT+mdqltBGCpZQwagOkx+hqWGmFSZR8WRJnXGU5XSl5gNXQUvTBa6VgJ0U5m2jT7WoY x8bH1nZfVlTMmJG+iqrWrhevb4oWKheG1ht0RP3F70oQPkdRlJ+EROlgZbDiUK3y6Yri /K+Z67LJ2UvowCCi4R4r+CPC9A4uZMWHbhqRnOuwXBMuThn5nmwAS7hIH1l6ZwIhz7eX je3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=oXqXYAcukJg9NxGMzxMn5REWqtvtEi1jTOlYbMmEIwQ=; fh=GUNhzEJfka7aU6InG/mqeUgtNKAejFmk0vy+CY7S+VM=; b=lWus2x8+Sf5OsvAHk0SvXvmFjwkRsve+KrBoUFpSzxLfbtVW3RUltZ8YL5EyxD61Q9 5RyV55z5Qnbo01XaIcqUY4/Rq5Ee4iYjOT1ggm+aYhOknMdrAEaIcgOQEcSc28V5t+v1 OI1g+VUVxF97dzqmX/YPmo9dnOKd1GWsLUB4ZSo2b9lHlxE71U3FEzcyLiODy05ENfXY 19nmJQhupu0x0OxlhcpOvHvNH5QKWur4+Ne+RT81yPlsAiyh4szZkoP4b/g11bRdMldO lQCXnzO1vNiRX1kJnBcz8pBEbnurZkeYK+MPS7sr5ao2sz1r0mQ75Ugqt7OmEPzdieXo uUlg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=HRCj7K9d; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u17-20020a17090341d100b001b9e2ce5723si11669093ple.495.2023.08.02.12.39.32; Wed, 02 Aug 2023 12:39:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=HRCj7K9d; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234423AbjHBSAY (ORCPT + 99 others); Wed, 2 Aug 2023 14:00:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47040 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231241AbjHBR7v (ORCPT ); Wed, 2 Aug 2023 13:59:51 -0400 Received: from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com [IPv6:2a00:1450:4864:20::32e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 558B33C05 for ; Wed, 2 Aug 2023 10:58:51 -0700 (PDT) Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-3fb4146e8fcso1075375e9.0 for ; Wed, 02 Aug 2023 10:58:51 -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=S4+Bthwnz5lfEgYfAXQzIldv8rUe+7Bk5h83Lkx8ZpBu9FbdoeDOoCn+ZdqnMHdrAy 33sDNTM5tO7DqIfuBI61Nx30Lc9HioelSR7VUNAyjN6PB4fI0P7JdNoFreeXOchnfGpW P+AsIEsr76az+jUgJrXxxdBd2tpU89IOzupKA6QeLhBmznQ9HHYyPc54b/u7i81Nfq9n RfeYpmRZjKqXTU5NjJ9/scZHbTUnwepY348dOIx09Mj1HJbeFYaEFJK9LGkQyusd+uTo s3dXcyEoeFe+/kzjjkvidXWVH5DgwFCJnVpug6ovIv4kH5aUh9zr6RH6vg8tkGH/H5Me 43Xg== X-Gm-Message-State: ABy/qLZOLcOZXUuYtP79T26qYFWaJJQIfd8g9J3FInY4ubSkmKa5rdRl 4jv7U9ql66JKoUyv7Ub5mgY= 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 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1773147454235664134 X-GMAIL-MSGID: 1773147454235664134 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: 130081 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f41:0:b0:3e4:2afc:c1 with SMTP id v1csp668520vqx; Wed, 2 Aug 2023 12:08:42 -0700 (PDT) X-Google-Smtp-Source: APBJJlEPIqWgxEW6iWX3zTdHePu+oqHvPUfd4/HHvX51931rX1TaNRPyWwB2naXWGHdwByFDvA2B X-Received: by 2002:a05:6a00:a20:b0:67b:f249:35e3 with SMTP id p32-20020a056a000a2000b0067bf24935e3mr18341757pfh.26.1691003322450; Wed, 02 Aug 2023 12:08:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691003322; cv=none; d=google.com; s=arc-20160816; b=Dbrnt+Ib49a9SJwYIo2CBQ6t/szp2eg3HRd8qO3TdOcdtMIvCjfH+GPUqNXlxwkscJ rLq1/9s6qi/Vt2BIuOwpU9REzhrf7GBS318/3c5wETTzA2A+1Z0ZrUb0UwGPGEpgMe6t GC5d2RrJ4Tha9dFsq7PgjdwYh5PjOfcEOfTHLGQqBl0BZKBOQV/uEjJGwJi+JC5+hO5d 7OjspgdnaW1C18LPDuvMtiOcfl/WaB3fkKI7nkFFauEN+74dGwgGBm/PJfKDoA7wW3xi RqyEt8dgII8I4Fo6OoGWqFfdnpKQXpx38q8/CSEZjSqqbsRZxB6uXJlYqwk33j/hSCwW cutQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=0QAIWP4M6rBKtTpn/rRinZikOOxcMUXJXPcYbOcWh7A=; fh=GUNhzEJfka7aU6InG/mqeUgtNKAejFmk0vy+CY7S+VM=; b=dDxyjHZwqCHWmENlbxx6qV1EoOyWwk5BGllnSTgJUNWKaOmhcSxN9fgISW1rxLVc47 lPKMX9SyB74A+1fy9TgWoCS/B7VoiQ4gS0IamEa54u7+XXbKvQdgntUK1LSRq/vD5N6w m2715n9aqc1fQ0aa4VEYfjsaTNDN1nWqsOzRi0O46eKZk+a0sSSj5F1/z6frzSIemy2R Zp28W5QcfzGK+dsUVXcUgM78B0uNQxA6kUpVGI9u4lPpuyHWHlegTkqn+AB0lgW7Ji8z 92rS+fniSjjeLfj0z7fyQzC/tI8rqq5w7A8v+SQvuDa9IG04YABektTTQQ5Ygv6ltqOo urMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=jG029gDz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h3-20020a056a00218300b0064d3e917a90si7836554pfi.180.2023.08.02.12.08.29; Wed, 02 Aug 2023 12:08:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=jG029gDz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234240AbjHBSA3 (ORCPT + 99 others); Wed, 2 Aug 2023 14:00:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47366 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234205AbjHBR7x (ORCPT ); Wed, 2 Aug 2023 13:59:53 -0400 Received: from mail-wm1-x333.google.com (mail-wm1-x333.google.com [IPv6:2a00:1450:4864:20::333]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6DA7C3C11 for ; Wed, 2 Aug 2023 10:58:52 -0700 (PDT) Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-3fbab0d0b88so8096785e9.0 for ; Wed, 02 Aug 2023 10:58:52 -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=ZZmhaySxg+55uYRBFzGAlX5hONYiIV1xlcA6cFtQhVzdv+DrzmYAPVIGRkJ023DwtF EXa7Ac118kNRkpF1eI0mwPaXg7royNtmSCj+49a1FIGSU1yVGZi9FtfMwPulNAM+s4qa 7eaIJ5wLkK7IImMBYvf4ce9TCyUSo9MXQHGwcbW0ssct2tXLOWOmLlofmrw9WEb8+vnU CT3uJdj+mURebY9TjcXI8CbXFOsj//a9yHsJkZ2FaBILEnHQDnx8LB6eXE3yz/zTaqRn PZtrHWrC1T2/Be96g3WgUQJaS0I4P1henV7Ek0JI/3UEaL7vr/LiCeg7r8M4vNnfiMcj JYbA== X-Gm-Message-State: ABy/qLYEpszgPa7c2AF6QnpkEduO3DcoSmSUEYmJVl8P+eCdEYzdkBnX aCQR7ogzRjBMWwwx0L+Vr8Q= 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 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1773145500034278142 X-GMAIL-MSGID: 1773145500034278142 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: 130080 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f41:0:b0:3e4:2afc:c1 with SMTP id v1csp668395vqx; Wed, 2 Aug 2023 12:08:30 -0700 (PDT) X-Google-Smtp-Source: APBJJlH2s9acJTqpvAFVOVcpYNRxM6DwjAihdH5tnQxSdPcDUSA37skRrM3K+B9kGPF0QZt6yfQl X-Received: by 2002:a17:90a:86c7:b0:268:2b5c:14c with SMTP id y7-20020a17090a86c700b002682b5c014cmr14026681pjv.13.1691003310634; Wed, 02 Aug 2023 12:08:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691003310; cv=none; d=google.com; s=arc-20160816; b=RaHid61WJ57LG8HW1IWPwXZT5gF9AAFhCMklW6Yx1+V/WpW0ObVvq0f3hsScb2V6wK 52awNg0aaO9M5O88GQe5ZDtvqlNySfV1L7CpPrgC+EZfGYB9MO6G1IkkagyQs4n2rXAV p0atdUdX7AKJOCK7C8aedik5R78/qH3AndSPnXkd9SSzth+0FJVQ95tHinm+VnBM2J+F +Fdgk2zJ4JHUKzEAn9+ISZyuiLGYZtpF6W9dk3HISWji/0jHNESUisIHkBjv2XMtRnfa 9xIJ0RGh+sE527h1RB/V6oPukn/8xjNH2lODvrfBQ2IKZqBZLX3LT8i656UEkDEsJc+K P5KA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=tNMbLNyqZ+emJZ68zpth6DtJLmrhI+8LXvJVEDQYQ2I=; fh=GUNhzEJfka7aU6InG/mqeUgtNKAejFmk0vy+CY7S+VM=; b=hXO76Tt6hRXuTYvIEk9X07Se4/MOMkdp+XgW8WoNN1Cs1bZaZr6susmY67s3VPG8bS 0k0DPRlIh177LmMM2GqStde+0o31PV4nddugi4UUf0RMzxdcEHsprA7JNgGhmrFRM7Ac q1T4NPXUhKp96MQJcnvi/u7zOYDr8jrCYzTHm/yIzgXyoOjaVhC670OaE2wYEUfWV/Ri SoFRzvOKBWWWojPNDe5+DZ2nkZIVM9DTJl2Va5FhjdY1WZFKhbmpEsCttHo8f0ByfD0B /59d/v0TaSgvDsp/Apoo3cp+QqQTSOvcgxIFXAG7TpecLz1Ze3l3IgO4YZ6GLQ45X3Il GwJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=g1wME0Sd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id mu3-20020a17090b388300b0026807ec51b2si1635551pjb.53.2023.08.02.12.08.16; Wed, 02 Aug 2023 12:08:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=g1wME0Sd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234448AbjHBSAn (ORCPT + 99 others); Wed, 2 Aug 2023 14:00:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47212 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234257AbjHBR77 (ORCPT ); Wed, 2 Aug 2023 13:59:59 -0400 Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 47D114236 for ; Wed, 2 Aug 2023 10:58:58 -0700 (PDT) Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-3fbc12181b6so1273255e9.2 for ; Wed, 02 Aug 2023 10:58:58 -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=gXFnlEXeIzeFRt0tgG1bhOnPS8bDMWsUbTgEh8bnSWzGVHcOmK7QzDtBdhUlqrW5UH yl57IvcH5G4R+sfw4MlEvT+lXRlD87LJ9o91mdHSdQSlNDTaCIpZz/LndAhuv5P/V9F4 zIwUCAffoJvn4r41Ng1LittGO0qCAnrI6Fw0SpHV/i5kdd66ckuiNGEEF1rP/Z+tTfVI 9xsnyZS2XLMrarqJ7dkS7Qg/0p6Gkn+djf7q6+BZ/gb5cCvZLGib0IfpF30lAKCjGouf q/x7SuGwklJ63r4jIsg8BvrgF0ETbU4M+V42S8qTW0KEN3miU4X1T/uwcPHkg2EFammV FHGQ== X-Gm-Message-State: ABy/qLYWHTy1/aSmUd92CyMEvsowFj8xgPavYA2nLdJaTMlC95clJ6mM mp3QmclrBkmC6DrrIBYJTLQ= 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 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1773145487560918443 X-GMAIL-MSGID: 1773145487560918443 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;