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;