From patchwork Wed Aug 2 17:57:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alper Nebi Yasak X-Patchwork-Id: 13338712 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2F22DC001DF for ; Wed, 2 Aug 2023 18:05:34 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 96EE0E81; Wed, 2 Aug 2023 20:04:42 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 96EE0E81 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1690999532; bh=VIIRnkDnYUzpm8Rls44qmTYiqEqceh58gUUMgF3oL8w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=IYDJwp96DHsF4bnMPSKNETz6mHCD1GAw77B1Z5AJb6PnYJO4y38pq80F181C1yfw6 shJ2UW1r6v8iqJ1ydIIv1Rq5HxX3FD1MqwCz2WSa3siA/LbTalSYn1IvcaT6dtSHgg v2y0PhSbiE+FW3ay3XV3us/62TaTmxvSVA8QRKF4= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 5875AF8068D; Wed, 2 Aug 2023 19:59:26 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id CE88EF80680; Wed, 2 Aug 2023 19:59:25 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 3A66CF80601; Wed, 2 Aug 2023 19:58:50 +0200 (CEST) Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com [IPv6:2a00:1450:4864:20::330]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 76210F805F2 for ; Wed, 2 Aug 2023 19:58:45 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 76210F805F2 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20221208 header.b=HRCj7K9d Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-3fe110de3b6so917565e9.1 for ; Wed, 02 Aug 2023 10:58:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690999123; x=1691603923; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=oXqXYAcukJg9NxGMzxMn5REWqtvtEi1jTOlYbMmEIwQ=; b=HRCj7K9dtm+flY3nG52NdwdzhU/m9cYvvltc4+JcXjr+3hBjxAxlfu3xEC9Q5wS26x GVg9y1suh7fhuXt/GPxc6N3xoTv7DjEMN8pea6sgapzjpU9bmXqLPLe4OcDsNp63ZK9D uN5GPpv2bxxNeMdFRvcWse/YNZT3VXtGukhFwDaDJ8STEXZQSCO8g7cx2l+egd/QdNA3 eVLKc38vAtsMAOIUezHhXjX+UTl3DLLR/K6IxXYusihdWdlQoW/AYcvZlVlUrU0Si5+b pktAYGsgyBnrQyJJ/GZA7cz2/ZdoBeh3V7xo9afYhauPw/+KPkbnEmbRq9njiaAvRXEx py+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690999123; x=1691603923; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=oXqXYAcukJg9NxGMzxMn5REWqtvtEi1jTOlYbMmEIwQ=; b=CLYOiHDULo11ec593xY2+dVvQwVtoohE7IB51NqanVajQP0PEMXpmTi58dt5sL8pwj AdEA+tlihTbvvRSsY0pk3X519KBixY/R4qUc6Z8Xy8sQk5vagN7RVrn8Dm2ZtL7zseBh sLaPiSULAC5KCOccXevkuOfCvfSY038w5ar1IOYwbD3mwPU6nmfY4E26Q1Ozby51Dn+d X2MVYKxu3LOIg6USaqAn94zzecnEFL7j9m1++UZ7VwSRX1Pz0XnrtoA/KSj/Vk7iT7ke l8PLuAGBp58PcoZpngQYdigf7DieQWf34AQqDTQDVAihS0Vny21w625s18+rjsO4g8MW 5mAw== X-Gm-Message-State: ABy/qLbzskkmiRFyfXcteQBRC2WPfhgooPVHynHk5Nfwp4qIqf2P6NaE lOx2pSJDUAt8dpUBRPq5JjxfX51SVv4= X-Google-Smtp-Source: APBJJlF4WH4ztE6sP96Ip/0+rlET/v5cd61TY/xgM05U+urjF/YhBfw4WfbX+mrQ1mjsRh1wiH6llQ== X-Received: by 2002:a05:600c:3d85:b0:3f7:e78e:8a41 with SMTP id bi5-20020a05600c3d8500b003f7e78e8a41mr5585448wmb.18.1690999123631; Wed, 02 Aug 2023 10:58:43 -0700 (PDT) Received: from ALPER-PC.. ([178.233.24.1]) by smtp.gmail.com with ESMTPSA id l23-20020a7bc457000000b003fe20db88ebsm2192439wmi.31.2023.08.02.10.58.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Aug 2023 10:58:43 -0700 (PDT) From: Alper Nebi Yasak To: alsa-devel@alsa-project.org Cc: Cezary Rojewski , Alper Nebi Yasak , Mark Brown , Liam Girdwood , Takashi Iwai , AngeloGioacchino Del Regno , Jaroslav Kysela , linux-kernel@vger.kernel.org, Akihiko Odaki , Pierre-Louis Bossart , Matthias Brugger , =?utf-8?q?N=C3=ADcolas_F_=2E_R_?= =?utf-8?q?=2E_A_=2E_Prado?= Subject: [PATCH 25/27] ASoC: samsung: littlemill: Map missing jack kcontrols Date: Wed, 2 Aug 2023 20:57:35 +0300 Message-Id: <20230802175737.263412-26-alpernebiyasak@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230802175737.263412-1-alpernebiyasak@gmail.com> References: <20230802175737.263412-1-alpernebiyasak@gmail.com> MIME-Version: 1.0 Message-ID-Hash: DF6BVMV7TU6S5RZG7IDMSRJFPFESV4MX X-Message-ID-Hash: DF6BVMV7TU6S5RZG7IDMSRJFPFESV4MX X-MailFrom: alpernebiyasak@gmail.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: This driver does not properly map jack pins to kcontrols that PulseAudio and PipeWire need to handle jack detection events. The WM8958 codec used here can detect Headphone and Headset Mic connections. Expose each to userspace as a kcontrol and add the necessary widgets. Signed-off-by: Alper Nebi Yasak --- Would SND_JACK_MECHANICAL be useful as a kcontrol as well? sound/soc/samsung/littlemill.c | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/sound/soc/samsung/littlemill.c b/sound/soc/samsung/littlemill.c index 5d8118e69359..fafadcef234e 100644 --- a/sound/soc/samsung/littlemill.c +++ b/sound/soc/samsung/littlemill.c @@ -225,12 +225,15 @@ static int bbclk_ev(struct snd_soc_dapm_widget *w, } static const struct snd_kcontrol_new controls[] = { + SOC_DAPM_PIN_SWITCH("Headphone"), + SOC_DAPM_PIN_SWITCH("Headset Mic"), SOC_DAPM_PIN_SWITCH("WM1250 Input"), SOC_DAPM_PIN_SWITCH("WM1250 Output"), }; static const struct snd_soc_dapm_widget widgets[] = { SND_SOC_DAPM_HP("Headphone", NULL), + SND_SOC_DAPM_HP("Headset Mic", NULL), SND_SOC_DAPM_MIC("AMIC", NULL), SND_SOC_DAPM_MIC("DMIC", NULL), @@ -255,6 +258,16 @@ static const struct snd_soc_dapm_route audio_paths[] = { }; static struct snd_soc_jack littlemill_headset; +static struct snd_soc_jack_pin littlemill_headset_pins[] = { + { + .pin = "Headphone", + .mask = SND_JACK_HEADPHONE, + }, + { + .pin = "Headset Mic", + .mask = SND_JACK_MICROPHONE, + }, +}; static int littlemill_late_probe(struct snd_soc_card *card) { @@ -281,12 +294,14 @@ static int littlemill_late_probe(struct snd_soc_card *card) if (ret < 0) return ret; - ret = snd_soc_card_jack_new(card, "Headset", - SND_JACK_HEADSET | SND_JACK_MECHANICAL | - SND_JACK_BTN_0 | SND_JACK_BTN_1 | - SND_JACK_BTN_2 | SND_JACK_BTN_3 | - SND_JACK_BTN_4 | SND_JACK_BTN_5, - &littlemill_headset); + ret = snd_soc_card_jack_new_pins(card, "Headset", + SND_JACK_HEADSET | SND_JACK_MECHANICAL | + SND_JACK_BTN_0 | SND_JACK_BTN_1 | + SND_JACK_BTN_2 | SND_JACK_BTN_3 | + SND_JACK_BTN_4 | SND_JACK_BTN_5, + &littlemill_headset, + littlemill_headset_pins, + ARRAY_SIZE(littlemill_headset_pins)); if (ret) return ret;