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;