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;